iobroker.javascript 10.4.2 → 10.4.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 (112) hide show
  1. package/README.md +4 -2
  2. package/admin/assets/{AiChatPanel-Bh1UgzLN.js → AiChatPanel-DDMXsfSt.js} +2 -2
  3. package/admin/assets/{AiChatService-h1EHSXaR.js → AiChatService-DwMHP0xt.js} +1 -1
  4. package/admin/assets/AiDiffView-Bk-37CNd.js +1 -0
  5. package/admin/assets/{AiInlineProvider-CslJGmO0.js → AiInlineProvider-CXlH1WK8.js} +1 -1
  6. package/admin/assets/{BlocklyEditor-DD7PWWnm.js → BlocklyEditor-DY4OoiFv.js} +10 -10
  7. package/admin/assets/Compile-DUNqNndk.js +165 -0
  8. package/admin/assets/{Debugger-DcFTsY_u.js → Debugger-B5PuUkp6.js} +1 -1
  9. package/admin/assets/Diff-CumYKon3.js +1 -0
  10. package/admin/assets/{Documentation-DmTfviYr.js → Documentation-DDu-zfNv.js} +1 -1
  11. package/admin/assets/ExpandMore-CivgfFOr.js +1 -0
  12. package/admin/assets/{FbEditor-BCD6eDj-.js → FbEditor-D1m29HMt.js} +1 -1
  13. package/admin/assets/History-jUbe5GP0.js +1 -0
  14. package/admin/assets/Import-iMDY2N5I.js +1 -0
  15. package/admin/assets/MonacoDiff-D24nsTu6.js +1 -0
  16. package/admin/assets/NotificationsActive-DaZ6l1oz.js +1 -0
  17. package/admin/assets/RulesEditor-qd1dXeG0.js +1 -0
  18. package/admin/assets/{ScriptEditor-sb_g6vXT.js → ScriptEditor-DfX-VuXG.js} +1 -1
  19. package/admin/assets/ScriptEditorVanillaMonaco-DDf9Xgnp.js +3 -0
  20. package/admin/assets/Send-BggvRgCd.js +1 -0
  21. package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-DCbVrrFZ.js +1 -0
  22. package/admin/assets/{_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js → _virtual_mf___mfe_internal__iobroker_javascript__mf_owner__244278364413149__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-Lnn-CkVR.js} +53 -53
  23. package/admin/assets/{_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BCLgOrQh.js → _virtual_mf___mfe_internal__iobroker_javascript__mf_owner__244278364413149__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-z1D20r27.js} +1 -1
  24. package/admin/assets/aiPromptBuilder-BlIDJp0X.js +1 -0
  25. package/admin/assets/{blockly-B0t_IRJQ.js → blockly-C3YM75rJ.js} +48 -44
  26. package/admin/assets/blocklyTheme-DT7bwtSS.js +1 -0
  27. package/admin/assets/{blocks_action-CM4AAMF1.js → blocks_action-DpPxKVI7.js} +1 -1
  28. package/admin/assets/{blocks_convert-DIBthcQF.js → blocks_convert-BZem2yRU.js} +1 -1
  29. package/admin/assets/{blocks_logic-CJBNXoP3.js → blocks_logic-vMLrt5md.js} +1 -1
  30. package/admin/assets/{blocks_number-GuNZ4kQO.js → blocks_number-ImO9YZku.js} +1 -1
  31. package/admin/assets/{blocks_object-BFR1ocL_.js → blocks_object-Cfw-t61W.js} +1 -1
  32. package/admin/assets/{blocks_procedures-CQxCN9F8.js → blocks_procedures-Df_jKvkW.js} +1 -1
  33. package/admin/assets/{blocks_sendto-DSfpmOb2.js → blocks_sendto-BePXoq3l.js} +1 -1
  34. package/admin/assets/{blocks_switch-CzWnVKX-.js → blocks_switch-Cf1Ly48W.js} +1 -1
  35. package/admin/assets/{blocks_system-DVfA31Hy.js → blocks_system-D_7Ev6nN.js} +1 -1
  36. package/admin/assets/{blocks_text-CgO-seeL.js → blocks_text-CM4ZTMkn.js} +1 -1
  37. package/admin/assets/{blocks_time-DNQPTg92.js → blocks_time-CovNiZ5E.js} +1 -1
  38. package/admin/assets/{blocks_timeout-BXypxY7F.js → blocks_timeout-WxihPUYn.js} +1 -1
  39. package/admin/assets/{blocks_trigger-elp6XrND.js → blocks_trigger-cu2p03ud.js} +1 -1
  40. package/admin/assets/cronHoverProvider-CeC4ghkd.js +2 -0
  41. package/admin/assets/field_cron-CTSbO0Sj.js +1 -0
  42. package/admin/assets/field_oid-yf2RKHSk.js +1 -0
  43. package/admin/assets/field_script-WzNnU0JL.js +1 -0
  44. package/admin/assets/{helpers-Ch3tewpw.js → helpers-DLkZXmzA.js} +1 -1
  45. package/admin/assets/{hostInit-CflF0J5w.js → hostInit-DHGIvBts.js} +1 -1
  46. package/admin/assets/{index-_7Mh4AxK.js → index-BAjPlTzo.js} +6 -6
  47. package/admin/assets/inlineChatWidget-DvAKhg6g.js +2 -0
  48. package/admin/assets/{inlineDiffController-VazWO1wi.js → inlineDiffController-DOhV-sbU.js} +1 -1
  49. package/admin/assets/{loadBlocks-CGEGNJcd.js → loadBlocks-zPpF1gDy.js} +1 -1
  50. package/admin/assets/{mf-entry-bootstrap-0-536f3328.js → mf-entry-bootstrap-0-757148b7.js} +3 -3
  51. package/admin/assets/{pendingShares-WHCuAHKo.js → pendingShares-TGMPCf23.js} +1 -1
  52. package/admin/assets/reactour.esm-Q4nnZoim.js +137 -0
  53. package/admin/assets/{stateHoverProvider-BfhQov29.js → stateHoverProvider-GWaLOu7S.js} +1 -1
  54. package/admin/custom/assets/Components-2p8wiA9W.js +1 -0
  55. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-LoDUiIZH.js +1 -0
  56. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-D2tgwrcS.js +1 -0
  57. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-nQIzP_1l.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D27wqFWN.js} +89 -89
  58. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__loadShare___mf_0_mui_mf_1_x_mf_2_date_mf_2_pickers__loadShare__.js-CAjPWACG.js +1 -0
  59. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__loadShare__date_mf_2_fns__loadShare__.js-B2r0vvPY.js +1 -0
  60. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__loadShare__shared-CdAm7fPH.js +2 -0
  61. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-DAE9qWf5.js +122 -0
  62. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__prebuild__leaflet__prebuild__--WMuxzd-.js +1 -0
  63. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__prebuild__react_mf_2_dom_mf_1_client__prebuild__--phH3reL.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DEIPBEui.js} +1 -1
  64. package/admin/custom/assets/{hostInit-CuGqkIzY.js → hostInit-CgdfLZgR.js} +1 -1
  65. package/admin/custom/assets/index-BqWkNbeU.js +1 -0
  66. package/admin/custom/assets/{lib-WawTWipl.js → lib-5TzGpBXO.js} +1 -1
  67. package/admin/custom/assets/{mf-entry-bootstrap-0-81b08d9c.js → mf-entry-bootstrap-0-3bac0bf3.js} +3 -3
  68. package/admin/custom/assets/pendingShares-fPzqQeON.js +2 -0
  69. package/admin/custom/customComponents.js +2 -2
  70. package/admin/mf-manifest.json +1 -1
  71. package/admin/mf-stats.json +1 -1
  72. package/admin/remoteEntry.js +2 -2
  73. package/admin/tab.html +2 -2
  74. package/build/lib/sandbox.js +50 -4
  75. package/build/lib/sandbox.js.map +1 -1
  76. package/build/main.js +26 -5
  77. package/build/main.js.map +1 -1
  78. package/io-package.json +13 -13
  79. package/package.json +3 -3
  80. package/admin/assets/AiDiffView-pmbNE43A.js +0 -1
  81. package/admin/assets/Compile-CHnsUZ3H.js +0 -165
  82. package/admin/assets/Diff-BMtToKAY.js +0 -1
  83. package/admin/assets/ExpandMore-BjBfK8y_.js +0 -1
  84. package/admin/assets/History-DM03Cwv-.js +0 -1
  85. package/admin/assets/Import-Bh_K9cpx.js +0 -1
  86. package/admin/assets/MonacoDiff-yYWwyqpx.js +0 -1
  87. package/admin/assets/NotificationsActive-B7pgt1LW.js +0 -1
  88. package/admin/assets/RulesEditor-CV-5poRY.js +0 -1
  89. package/admin/assets/ScriptEditorVanillaMonaco-DbOlv3vi.js +0 -3
  90. package/admin/assets/Send-Bo4QPFhQ.js +0 -1
  91. package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-B7myBQHF.js +0 -1
  92. package/admin/assets/aiPromptBuilder-jeMwCFvL.js +0 -1
  93. package/admin/assets/blocklyTheme-B0abPSuE.js +0 -1
  94. package/admin/assets/cronHoverProvider-CZrYrB2m.js +0 -2
  95. package/admin/assets/field_cron-m1xxzKf2.js +0 -1
  96. package/admin/assets/field_oid-BLNfi7lh.js +0 -1
  97. package/admin/assets/field_script-CGDpmlGL.js +0 -1
  98. package/admin/assets/inlineChatWidget-BfjarD99.js +0 -2
  99. package/admin/assets/reactour.esm-CETRUaME.js +0 -137
  100. package/admin/custom/assets/Components-C6UfjQAS.js +0 -1
  101. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-B1DaT32e.js +0 -1
  102. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-BRo2TJu1.js +0 -1
  103. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__loadShare___mf_0_mui_mf_1_x_mf_2_date_mf_2_pickers__loadShare__.js-DQfhTnYi.js +0 -1
  104. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__loadShare__date_mf_2_fns__loadShare__.js-BrsJpRn9.js +0 -1
  105. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__loadShare__shared-Bm5cq4Wz.js +0 -2
  106. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-Bv9I6S4D.js +0 -122
  107. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__prebuild__leaflet__prebuild__-R1ziirob.js +0 -1
  108. package/admin/custom/assets/index-CgBEPuXx.js +0 -1
  109. package/admin/custom/assets/pendingShares-5RvH3v48.js +0 -2
  110. /package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-DbKT6Hsb.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-DbKT6Hsb.js} +0 -0
  111. /package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__loadShare__leaflet__loadShare__.js-D9EyCd42.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__loadShare__leaflet__loadShare__.js-D9EyCd42.js} +0 -0
  112. /package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__18840520564161__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-CXpyx8Vy.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__211401881746328__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-CXpyx8Vy.js} +0 -0
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "javascript",
4
- "version": "10.4.2",
4
+ "version": "10.4.4",
5
5
  "blockedVersions": [
6
6
  "8.0.0",
7
7
  "8.0.1"
@@ -40,18 +40,18 @@
40
40
  "Matthias Kleine <info@haus-automatisierung.com>"
41
41
  ],
42
42
  "news": {
43
- "10.4.2": {
44
- "en": "Fixed: the AI chat stopped with \"m.default is not a constructor\", and the variable view of the debugger did not show objects",
45
- "de": "Behoben: Der KI-Chat endete mit „m.default is not a constructor“ und die Variablenansicht des Debuggers zeigte keine Objekte",
46
- "ru": "Исправлено: чат с искусственным интеллектом останавливался с надписью «m.default не является конструктором», а в виде переменных в отладчике не отображались объекты",
47
- "pt": "Corrigido: o chat de IA parou com “m.default não é um construtor” e a visão variável do depurador não mostra objetos",
48
- "nl": "Opgelost: de AI-chat stopte met „m.default is geen constructor”, en de variabele weergave van de debugger toonde geen objecten",
49
- "fr": "Corrigé : le chat IA s'arrêtait avec « m.default n'est pas un constructeur » et la vue variable du débogueur ne montrait aucun objet",
50
- "it": "Risolto: la chat AI si fermava con «m.default non è un costruttore» e la vista variabile del debugger non mostrava oggetti",
51
- "es": "Corregido: el chat de la IA paró con «m.default no es un constructor» y la vista variable del depurador no mostraba objetos",
52
- "pl": "Naprawiono: czat AI zatrzymał się z „m.default nie jest konstruktorem”, a zmienny widok debuggera nie pokazywał obiektów",
53
- "uk": "Виправлено: чат AI зупинився з «m.default не є конструктором», а змінний вигляд налагоджувача не показував об'єктів",
54
- "zh-cn": "修复:AI 聊天因 “m.default 不是构造函数” 而停止,调试器的变量视图未显示对象"
43
+ "10.4.4": {
44
+ "en": "Fixed: a script that did not handle a rejected `setStateAsync` (e.g. of a missing state) or another asynchronous function terminated the adapter\nFixed: instances of different versions\nFixed: the AI chat stopped with \"m.default is not a constructor\"",
45
+ "de": "Behoben: Ein Script, das abgelehnte `setStateAsync` (z. B. mit fehlendem Status) oder asynchroner Funktion nicht behandelte, beendete den Adapter\nBehoben: Instanzen anderer Versionen\nBehoben: Der KI-Chat endete mit „m.default is not a constructor“",
46
+ "ru": "Исправлено: скрипт, который не обрабатывал отклоненную функцию setStateAsync (например, отсутствующее состояние) или другую асинхронную функцию, прерывал работу адаптера\nИсправлено: экземпляры разных версий\nИсправлено: чат с искусственным интеллектом остановился с надписью «m.default не является конструктором»",
47
+ "pt": "Corrigido: um script que não tratava um `setStateAsync` rejeitado (p. ex., ausente) ou outra função assíncrona encerrou o adaptador\nFixo: casos de várias versões\nCorrigido: o chat AI parou com “m.default não é um construtor”",
48
+ "nl": "Opgelost: een script dat een afgewezen `SetStateAsync` niet afhandelde (bijvoorbeeld een ontbrekende status) of een andere asynchrone functie beëindigde de adapter\nOpgelost: exemplaren van verschillende versies\nOpgelost: de AI-chat stopte met „m.default is geen constructor”",
49
+ "fr": "Corrigé : un script qui ne gérait pas un setStateAsync rejeté (par exemple un état manquant) ou une autre fonction asynchrone a mis fin à l'adaptateur\nCorrigé : différentes versions\nCorrigé : le chat AI s'arrêtait avec « m.default n'est pas un constructeur »",
50
+ "it": "Risolto: uno script che non gestiva un `setStateAsync` rifiutato (ad es. uno stato mancante) o un'altra funzione asincrona chiudeva l'adattatore\nRisolto: casi di versioni diverse\nRisolto: la chat AI si fermò con «m.default non è un costruttore»",
51
+ "es": "Corregido: un guion que no gestionaba un `setStateAsync` rechazado (por ejemplo, de un estado faltante) u otra función asincrónica terminaba el adaptador\nFijo: casos de diferentes versiones\nCorregido: el chat de IA paró con «m.default no es un constructor»",
52
+ "pl": "Naprawiono: skrypt, który nie obsługiwał odrzuconego `setStateSync` (np. brakującego stanu) lub innej funkcji asynchronicznej, zakończył adapter\nNaprawiono: wystąpienia różnych wersji\nNaprawiono: czat AI zatrzymał się z „m.default nie jest konstruktorem”",
53
+ "uk": "Виправлено: скрипт, який не обробляв відхилений `setStateAsync` (наприклад, відсутній стан) або інша асинхронна функція припинила адаптер\nВиправлено: екземпляри різних версій\nВиправлено: чат AI зупинився з «m.default не є конструктором»",
54
+ "zh-cn": "修复:未处理被拒绝的 “setStateAsync”(例如缺失状态)或其他异步函数的脚本终止了适配器\n修复:不同版本的实例\n修复:AI 聊天因 “m.default 不是构造函数” 而停止的"
55
55
  },
56
56
  "10.4.1": {
57
57
  "en": "Changed: the AI assistant uses the shared libraries `@iobroker/ai-core` and `@iobroker/ai-gui`",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.javascript",
3
- "version": "10.4.2",
3
+ "version": "10.4.4",
4
4
  "description": "Rules Engine for ioBroker",
5
5
  "author": "bluefox <dogafox@gmail.com>",
6
6
  "contributors": [
@@ -50,7 +50,7 @@
50
50
  "jszip": "^3.10.2",
51
51
  "node-inspect": "^2.0.0",
52
52
  "node-schedule": "2.1.1",
53
- "nodemailer": "^10.1.0",
53
+ "nodemailer": "^10.1.1",
54
54
  "prettier": "^3.9.10",
55
55
  "semver": "^7.8.5",
56
56
  "suncalc2": "^1.8.1",
@@ -66,7 +66,7 @@
66
66
  "@iobroker/build-tools": "^3.0.3",
67
67
  "@iobroker/eslint-config": "^2.3.4",
68
68
  "@iobroker/plugin-sentry": "^3.2.1",
69
- "@iobroker/testing": "^6.3.0",
69
+ "@iobroker/testing": "^6.3.1",
70
70
  "@tsconfig/node22": "^22.0.6",
71
71
  "@types/node-schedule": "^2.1.8",
72
72
  "@types/nodemailer": "^8.0.2",
@@ -1 +0,0 @@
1
- import{At as e,Cr as t,Ir as n,Jt as r,Kt as i,Ot as a,Yt as o,Zt as s,jr as c,lr as l,m as u,ur as d}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{t as f}from"./MonacoDiff-yYWwyqpx.js";n();var p=({originalCode:n,modifiedCode:p,language:m,themeType:h,onAccept:g,onReject:_})=>{let v=c(null),y=t(()=>{var e;g(((e=v.current)==null?void 0:e.getModifiedValue())??p)},[p,g]);return d(o,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`},children:[d(i,{variant:`dense`,sx:{minHeight:36,bgcolor:`background.paper`,borderBottom:`1px solid`,borderColor:`divider`,gap:1,flexShrink:0},children:[l(r,{variant:`subtitle2`,sx:{flex:1},children:u.t(`AI suggested changes`)}),l(s,{variant:`contained`,color:`success`,size:`small`,startIcon:l(e,{}),onClick:y,children:u.t(`Accept`)}),l(s,{variant:`outlined`,color:`error`,size:`small`,startIcon:l(a,{}),onClick:_,children:u.t(`Reject`)})]}),l(o,{sx:{flex:1,overflow:`hidden`},children:l(f,{ref:v,originalCode:n,modifiedCode:p,language:m,themeType:h})})]})};export{p as default};
@@ -1,165 +0,0 @@
1
- import{Bn as e,Cn as t,Er as n,Fn as r,Ft as i,Gt as a,In as o,Ir as s,Mr as c,Sn as l,Sr as u,St as d,Tr as f,Un as p,Xn as m,Zt as h,_n as g,bt as _,cn as v,cr as y,d as b,f as x,l as S,ln as ee,lr as C,m as w,o as te,rn as ne,s as re,sr as T,un as E,ur as D,v as O,vn as ie,wn as ae,xr as oe,xt as se,yn as k}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{n as ce,r as le,t as ue}from"./NotificationsActive-B7pgt1LW.js";import{t as de}from"./Send-Bo4QPFhQ.js";import{l as A,v as fe,y as pe}from"./index-_7Mh4AxK.js";var me=m(C(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z`}),`AddBox`),he=m(C(`path`,{d:`M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z`}),`Apps`),ge=m(C(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-5 14H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z`}),`Article`),_e=m(C(`path`,{d:`M9 2c-1.05 0-2.05.16-3 .46 4.06 1.27 7 5.06 7 9.54s-2.94 8.27-7 9.54c.95.3 1.95.46 3 .46 5.52 0 10-4.48 10-10S14.52 2 9 2`}),`Brightness3`),ve=m(C(`path`,{d:`M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V10h14zM9 14H7v-2h2zm4 0h-2v-2h2zm4 0h-2v-2h2zm-8 4H7v-2h2zm4 0h-2v-2h2zm4 0h-2v-2h2z`}),`CalendarMonth`),j=m([C(`path`,{d:`m12 2-5.5 9h11z`},`0`),C(`circle`,{cx:`17.5`,cy:`17.5`,r:`4.5`},`1`),C(`path`,{d:`M3 13.5h8v8H3z`},`2`)],`Category`),M=m(C(`path`,{d:`M7 2v11h3v9l7-12h-4l4-8z`}),`FlashOn`),N=m(C(`path`,{d:`M21 6h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1m-4 6V3c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1`}),`Forum`),P=m(C(`path`,{d:`M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z`}),`Functions`),F=m(C(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25`}),`HelpOutlined`),ye=m(C(`path`,{d:`M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-2 12H6v-2h12zm0-3H6V9h12zm0-3H6V6h12z`}),`Message`),be=m(C(`path`,{d:`M11 5v5.59H7.5l4.5 4.5 4.5-4.5H13V5zm-5 9c0 3.31 2.69 6 6 6s6-2.69 6-6h-2c0 2.21-1.79 4-4 4s-4-1.79-4-4z`}),`PlayForWork`),xe=m(C(`path`,{d:`m17.66 9.53-7.07 7.07-4.24-4.24 1.41-1.41 2.83 2.83 5.66-5.66zM4 12c0-2.33 1.02-4.42 2.62-5.88L9 8.5v-6H3l2.2 2.2C3.24 6.52 2 9.11 2 12c0 5.19 3.95 9.45 9 9.95v-2.02c-3.94-.49-7-3.86-7-7.93m18 0c0-5.19-3.95-9.45-9-9.95v2.02c3.94.49 7 3.86 7 7.93 0 2.33-1.02 4.42-2.62 5.88L15 15.5v6h6l-2.2-2.2c1.96-1.82 3.2-4.41 3.2-7.3`}),`PublishedWithChanges`),Se=m(C(`path`,{d:`M10.59 9.17 5.41 4 4 5.41l5.17 5.17zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4zm.33 9.41-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04z`}),`Shuffle`),Ce=m(C(`path`,{d:`M6 6h12v12H6z`}),`Stop`),we=m(C(`path`,{d:`M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z`}),`Storage`),Te=m(C(`path`,{d:`M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z`}),`Subject`),Ee=m(C(`path`,{d:`M6.99 11 3 15l3.99 4v-3H14v-2H6.99zM21 9l-3.99-4v3H10v2h7.01v3z`}),`SwapHoriz`);s();var I={nameCard:`_nameCard_1ji9r_15`,nameCardSummary:`_nameCardSummary_1ji9r_24`,headerRow:`_headerRow_1ji9r_32`,headerRowClickable:`_headerRowClickable_1ji9r_39`,headerText:`_headerText_1ji9r_43`,summaryObjectIcon:`_summaryObjectIcon_1ji9r_48`,kicker:`_kicker_1ji9r_56`,summarySub:`_summarySub_1ji9r_68`,chevron:`_chevron_1ji9r_77`,chevronCollapsed:`_chevronCollapsed_1ji9r_89`,chevronPlaceholder:`_chevronPlaceholder_1ji9r_94`,iconThemCard:`_iconThemCard_1ji9r_98`,iconThemCardCollapsed:`_iconThemCardCollapsed_1ji9r_109`,iconThemCardSelectable:`_iconThemCardSelectable_1ji9r_114`,iconHelp:`_iconHelp_1ji9r_118`,blockName:`_blockName_1ji9r_124`,debugInfo:`_debugInfo_1ji9r_130`,fadeIn:`_fadeIn_1ji9r_1`,tagCard:`_tagCard_1ji9r_146`,displayFlex:`_displayFlex_1ji9r_163`,blockMarginTop:`_blockMarginTop_1ji9r_168`,nameBlock:`_nameBlock_1ji9r_169`,frontText:`_frontText_1ji9r_173`,backText:`_backText_1ji9r_179`,iconTag:`_iconTag_1ji9r_183`,displayItalic:`_displayItalic_1ji9r_193`},L={root:`_root_1dr6a_1`,square:`_square_1dr6a_11`,icon:`_icon_1dr6a_16`},R=({fullWidth:e,size:t,onClick:n,style:r,className:i,value:a,square:o,icon:s})=>C(h,{variant:`outlined`,color:`primary`,onClick:n,fullWidth:e,style:r,className:O.clsx(L.root,i,o?L.square:``),size:t||`medium`,children:s?C(x,{className:L.icon,src:s}):a}),De={root:`_root_1ucda_1`};s();var z=u(({size:e,value:t,title:n,onChange:r,className:i,customValue:a,disabled:o})=>{let[s,l]=c(!1);return D(y,{children:[C(ne,{disabled:o,checked:!!(a?t:s),className:O.clsx(De.root,i),onChange:e=>{a&&l(e.target.checked),r&&r(e.target.checked)},size:e||`medium`}),n||null]})}),B={root:`_root_19roy_1`};s();var V=e=>{let[t,n]=c(``),{value:r,type:i,error:o,className:s,icon:l,label:u,style:d,onChange:f,fullWidth:p,autoComplete:m,customValue:h,autoFocus:g,rows:_,size:v,variant:y,multiline:b,disabled:S}=Object.assign({value:``,type:`text`,error:``,className:null,table:!1,native:{},variant:`standard`,size:`medium`,component:null,styleComponentBlock:null,fullWidth:!1,autoComplete:``,customValue:!1,autoFocus:!1,rows:1},e);return C(a,{error:!!o,autoFocus:g,fullWidth:p,label:u,disabled:S,variant:y,multiline:b,rows:_,value:h?r:t,type:i,helperText:o,style:d,className:O.clsx(B.root,s),autoComplete:m,onChange:e=>{!h&&n(e.target.value),f&&f(e.target.value)},slotProps:{input:{endAdornment:l?C(ae,{position:`end`,children:C(x,{className:B.icon,src:l})}):null}},margin:`normal`,size:v})};s();var Oe={formControl:{m:`10px 0`,"& .MuiFormControl-marginNormal":{mt:0,mb:0},"& > *":{color:`#2d0440 !important`},"& .MuiSelect-icon":{color:`#81688c`},"& label.Mui-focused":{color:`#81688c`},"& .MuiInput-underline:after":{borderBottomColor:`#510573`},"& .MuiInput-underline:before":{borderBottomColor:`#81688c`},"& .MuiInput-underline:hover:before":{borderBottomColor:`#81688c`}}},ke=({multiple:r,value:i,customValue:a,socket:s,title:l,attr:u,adapter:d,style:f,onChange:p,onInstanceHide:m})=>{let[h,_]=c(i||`test1`),[v,y]=c([]);return n(()=>{s==null||s.getAdapterInstances(d).then(e=>{let t=e.map(e=>({value:e._id.replace(`system.adapter.`,``),title:e._id.replace(`system.adapter.`,``)}));t.length===1?m(t[0].value):t.unshift({value:d,title:w.t(`All`)}),y(t)})},[s,d,m]),D(g,{sx:Oe.formControl,fullWidth:!0,style:f,children:[C(e,{variant:`standard`,value:(a?i:h)||`_`,fullWidth:!0,multiple:r,renderValue:e=>r&&Array.isArray(e)?e.join(`, `):e,onChange:e=>{!a&&_(e.target.value),p(e.target.value)},input:u?C(t,{name:u,id:`${u}-helper`}):C(t,{name:u}),children:v.map(e=>C(o,{style:{placeContent:`space-between`},value:e.value||`_`,children:w.t(e.title)},`key-${e.value}`))}),l?C(k,{children:w.t(l)}):null]})},H={modalContentWrapper:`_modalContentWrapper_587ci_1`,modalButtonBlock:`_modalButtonBlock_587ci_8`,modalButtonBlockTwo:`_modalButtonBlockTwo_587ci_23`,modalWrapper:`_modalWrapper_587ci_33`,modalDialog:`_modalDialog_587ci_40`,close:`_close_587ci_44`};s();var U=({onClose:e,children:t,titleButtonApply:n,titleButtonClose:r,onApply:i,className:a,textInput:o,defaultValue:s,disabled:l})=>{let[u,d]=c(s||``),[f]=c(s||``);return D(v,{open:!0,maxWidth:`md`,onClose:e,classes:{paper:H.modalDialog},className:H.modalWrapper,children:[D(E,{children:[o&&C(V,{className:a,autoComplete:`off`,fullWidth:!0,variant:`outlined`,size:`medium`,rows:10,multiline:!0,value:u,onChange:d,customValue:!0}),!o&&t]}),D(ee,{children:[C(h,{disabled:l===void 0?f===u:l,onClick:()=>i(o?u:null),variant:`contained`,color:`primary`,children:w.t(n||`Ok`)}),C(h,{color:`grey`,onClick:e,variant:`contained`,children:w.t(r||`Cancel`)})]})]})},Ae={root:`_root_15mo1_1`};s();var je=({multiple:n,value:r,customValue:i,title:a,attr:s,options:l,style:u,onChange:d,className:f,doNotTranslate:p,doNotTranslate2:m})=>{let[h,_]=c(r===void 0?l[0].value:r),v=i?r:h,y=v===``||v==null?`_`:v;return D(g,{variant:`standard`,className:O.clsx(Ae.root,f),fullWidth:!0,style:u,children:[D(e,{variant:`standard`,value:y,fullWidth:!0,multiple:n,renderValue:e=>{if(n&&Array.isArray(e)){e.sort();let t=e.indexOf(`0`);t!==-1&&(e.splice(t,1),e.push(`0`)),t=e.indexOf(`_`),t!==-1&&(e.splice(t,1),e.unshift(`_`));let n=l.find(e=>e.only);return n&&e.includes(n.value)?n.titleShort?p?n.titleShort:w.t(n.titleShort):p?n.title:w.t(n.title):e.map(e=>l.find(t=>t.value===e||e===`_`&&t.value===``)||e).map(e=>typeof e==`object`?e.titleShort?p?e.titleShort:w.t(e.titleShort):p?e.title:w.t(e.title):p?e:w.t(e)).join(`, `)}let t=l?l.find(t=>t.value===e||e===`_`&&t.value===``):null;return t!=null&&t.title?p?t==null?void 0:t.title:w.t(t==null?void 0:t.title):e},onChange:e=>{if(i||_(e.target.value),n){let t=e.target.value,n=l.find(e=>e.only);if(n){let e=n.value;if(t.length===l.length-1&&t.includes(e))return d(t.filter(t=>t!==e),s);if(t.includes(e))return d(l.map(e=>e.value),s)}}d(e.target.value,s)},input:s?C(t,{name:s,id:`${s}-helper`}):C(t,{name:s}),children:[!n&&(l==null?void 0:l.map(e=>D(o,{style:{placeContent:`space-between`},value:e.value===``||e.value===null||e.value===void 0?`_`:e.value,children:[p?e.title:w.t(e.title),e.title2&&C(`div`,{children:m?e.title2:w.t(e.title2)})]},`key-${e.value}`))),n&&(l==null?void 0:l.map(e=>D(o,{style:{placeContent:`space-between`},value:e.value||`_`,children:[p?e.title:w.t(e.title),` `,C(z,{customValue:!0,value:r==null?void 0:r.includes(e.value)})]},`key-${e.value}`)))]}),a?C(k,{children:w.t(a)}):null]})},W={root:`_root_167v0_1`,mark:`_mark_167v0_24`};s();var Me=({size:e,value:t,style:n,onChange:r,className:i,customValue:a,min:o,max:s,step:l,unit:u})=>{let[d,f]=c(0);o=o===void 0?0:o,s=s===void 0?0:s,l=l!==void 0&&l>0?l:(s-o)/100||1;let m=(()=>{let e=typeof t==`number`?t:parseFloat(t);return isFinite(e)?e<o?o:e>s?s:e:o})(),h=[{value:o,label:o+(u||``)},{value:s,label:s+(u||``)}];return C(p,{defaultValue:a?m:d,"aria-labelledby":`discrete-slider`,valueLabelDisplay:`auto`,classes:{mark:W.mark},marks:h,step:l,min:o,max:s,value:a?m:d,style:n,className:O.clsx(W.root,i),onChange:(e,t)=>{Array.isArray(t)?(!a&&f(t[0]),r(t[0])):(!a&&f(t),r(t))},size:e||`medium`})},Ne={root:`_root_rzul6_1`};s();var Pe=u(({label:e,size:t,value:n,style:r,onChange:a,className:o,customValue:s})=>{let[l,u]=c(!1);return C(ie,{className:Ne.root,control:C(i,{checked:s?n:l,style:r,className:o,onChange:e=>{s||u(e.target.checked),a(e.target.checked)},size:t||`medium`}),label:e??`all`})}),Fe={root:`_root_135pm_1`};s();var Ie=({value:e,style:t,onChange:n,className:r})=>C(a,{variant:`standard`,id:`time`,type:`time`,onChange:e=>n(e.currentTarget.value),value:e,className:O.clsx(Fe.root,r),fullWidth:!0,style:t,slotProps:{htmlInput:{step:300},inputLabel:{shrink:!0}}}),G={root:`_root_135pm_1`};s();var K=[31,29,31,30,31,30,31,31,30,31,30,31],Le=({value:t,onChange:n,className:r,style:i})=>{let[a,s]=(t||`01.01`).toString().split(`.`),c=parseInt(s,10)||0,l=parseInt(a,10)||0;l>12?l=12:l<0&&(l=0),c>K[l]?c=K[l]:c<0&&(c=0);let u=[];for(let e=0;e<K[l];e++)u.push(e+1);return D(`div`,{children:[C(g,{variant:`standard`,className:O.clsx(G.root,r),style:i,children:D(e,{variant:`standard`,className:O.clsx(G.root,r),margin:`dense`,label:w.t(`Month`),onChange:e=>n(`${e.target.value.toString().padStart(2,`0`)}.${c.toString().padStart(2,`0`)}`),value:l,children:[C(o,{style:{placeContent:`space-between`},value:0,children:w.t(`Any month`)},0),C(o,{style:{placeContent:`space-between`},value:1,children:w.t(`January`)},1),C(o,{style:{placeContent:`space-between`},value:2,children:w.t(`February`)},2),C(o,{style:{placeContent:`space-between`},value:3,children:w.t(`March`)},3),C(o,{style:{placeContent:`space-between`},value:4,children:w.t(`April`)},4),C(o,{style:{placeContent:`space-between`},value:5,children:w.t(`May`)},5),C(o,{style:{placeContent:`space-between`},value:6,children:w.t(`June`)},6),C(o,{style:{placeContent:`space-between`},value:7,children:w.t(`July`)},7),C(o,{style:{placeContent:`space-between`},value:8,children:w.t(`August`)},8),C(o,{style:{placeContent:`space-between`},value:9,children:w.t(`September`)},9),C(o,{style:{placeContent:`space-between`},value:10,children:w.t(`October`)},10),C(o,{style:{placeContent:`space-between`},value:11,children:w.t(`November`)},11),C(o,{style:{placeContent:`space-between`},value:12,children:w.t(`December`)},12)]})}),C(g,{variant:`standard`,className:O.clsx(G.root,r),style:i,children:D(e,{variant:`standard`,className:O.clsx(G.root,r),margin:`dense`,label:w.t(`Date`),onChange:e=>n(`${l.toString().padStart(2,`0`)}.${e.target.value.toString().padStart(2,`0`)}`),value:c,children:[C(o,{style:{placeContent:`space-between`},value:0,children:w.t(`Any`)},`A`),u.map(e=>C(o,{style:{placeContent:`space-between`},value:e,children:e},e))]})})]})};s();var q={},Re={Shuffle:Se,Apps:he,Functions:P,Language:_,AddBox:me,Pause:pe,Subject:Te,PlayForWork:be,Brightness3:_e,HelpOutline:F,Storage:we,AccessTime:le,PlayArrow:fe,FlashOn:M,CalendarMonth:ve,Send:de,Message:ye,NotificationsActive:ue,SwapHoriz:Ee,InsertDriveFile:se,AccountTree:ce,Article:ge,Stop:Ce,Category:j,Forum:N,PublishedWithChanges:xe};function J({iconName:e,className:t,adapter:r,socket:i,onClick:a,style:o}){let[s,l]=c(``);if(n(()=>{r&&i&&(q[r]instanceof Promise||(q[r]=i.getObject(`system.adapter.${r}`)),q[r].then(e=>{var t;return(e==null||(t=e.common)==null?void 0:t.icon)&&l(`../../adapter/${r}/${e.common.icon}`)}))},[r,i]),r)return C(`img`,{onClick:e=>a&&a(e),src:s||``,className:t,style:o,alt:``});let u=e&&Re[e]||d;return C(u,{className:t,style:o,onClick:e=>a&&a(e)})}var Y;function ze(e){return Y||=w.getLanguage(),e&&typeof e==`object`?e[Y]||e.en:e||``}function Be(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?e.join(`, `):typeof e==`object`?JSON.stringify(e):e.toString()}s();var Ve=class e extends oe{static getStaticData(){return{acceptedBy:`actions`,name:`Not found`,id:`ActionEmpty`,icon:`Shuffle`}}static compile(e,t){return``}constructor(e,t){super(e),T(this,`debugHideTimeout`,null),T(this,`initiallyCollapsed`,!1),T(this,`collapseDecided`,!1),T(this,`lastObjectIdChange`,0),T(this,`enableSimulationProcessing`,!1),T(this,`mounted`,!1),T(this,`tagCardTimeout`,null),T(this,`enableSimulationTimeout`,null),T(this,`lastDebugMessage`,0),T(this,`debugMessageTimeout`,null),t||={};let n=e.settings||{tagCard:t.tagCardArray?typeof t.tagCardArray[0]==`string`?t.tagCardArray[0]:t.tagCardArray[0].title:``};!n.tagCard&&t.tagCardArray&&(n.tagCard=typeof t.tagCardArray[0]==`string`?t.tagCardArray[0]:t.tagCardArray[0].title),this.state={inputs:t.inputs||e.inputs||[],name:t.name||e.name||``,icon:t.icon||e.icon||``,adapter:t.adapter||e.adapter||``,helpDialog:t.helpDialog||e.helpDialog||``,tagCardArray:t.tagCardArray||[],openTagMenu:!1,openModal:!1,iconTag:!1,error:``,helpText:``,instanceSelectionOptions:[],instanceSelectionDef:``,hideAttributes:[],settings:n,debugMessage:null,enableSimulation:this.props.enableSimulation}}componentWillUnmount(){this.mounted=!1,this.debugMessageTimeout&&=(clearTimeout(this.debugMessageTimeout),null),this.debugHideTimeout&&=(clearTimeout(this.debugHideTimeout),null),this.tagCardTimeout&&=(clearTimeout(this.tagCardTimeout),null),this.enableSimulationTimeout&&=(clearTimeout(this.enableSimulationTimeout),null)}onTagChange(e,t,n,r,i){let a=!1,o=JSON.parse(JSON.stringify(this.state.settings));this.state.inputs.forEach(e=>{let t=e.attr,n=e.defaultValue;t&&n!==void 0&&o[t]===void 0&&(a=!0,o[t]=n)}),a?(this.setState({settings:o},()=>t==null?void 0:t()),this.props.onChange(o)):t&&t()}onUpdate(){}onValueChanged(e,t){}getSummary(){return null}objectName(e){if(!e)return;let t=this.state[e];if(t===void 0){setTimeout(async()=>{let t=await this.props.socket.getObject(e);this.mounted&&this.setState({[e]:t||!1})},0);return}return t&&O.getObjectNameFromObj(t,w.getLanguage())||void 0}summaryObjectIcon(e){if(!e)return;let t=`${e}___icon`,n=this.state[t];if(n===void 0){setTimeout(async()=>{let n=await this.props.socket.getObject(e),r=await this.findIcon(n);this.mounted&&this.setState({[t]:r})},0);return}return n||void 0}summaryObjectId(){let e=this.state.inputs.find(e=>e.nameRender===`renderObjectID`&&typeof this.state.settings[e.attr||``]==`string`);return e!=null&&e.attr&&this.state.settings[e.attr]||void 0}optionTitle(e,t,n=`title`){var r,i;if(t==null||t===``)return;let a=(r=this.state.inputs)==null?void 0:r.find(t=>t.attr===e),o=a==null||(i=a.options)==null?void 0:i.find(e=>String(e.value)===String(t));if(o)return n===`title2`?o.title2:a!=null&&a.doNotTranslate?o.title:w.t(o.title)}isCollapsed(e){this.collapseDecided||(this.collapseDecided=!0,this.initiallyCollapsed=e);let t=this.state.userCollapsed;return e&&(t===void 0?this.initiallyCollapsed:t)}toggleCollapsed(e){this.setState({userCollapsed:e})}renderText(e,t,n){let{className:r}=this.props,{attr:i,frontText:a,backText:o,nameBlock:s,name:c,doNotTranslate:l,doNotTranslateBack:u}=e;return D(f,{children:[D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),children:[a&&C(`div`,{className:I.frontText,children:l?a:w.t(a)}),C(V,{className:r,autoComplete:`off`,label:ze(c),variant:`outlined`,size:`small`,fullWidth:!0,value:t,onChange:n,customValue:!0}),o&&C(`div`,{className:I.backText,children:u?o:w.t(o)})]}),s&&C(`div`,{className:I.nameBlock,children:w.t(s)})]},i)}renderSwitch(e,t,n){let{className:r}=this.props,{attr:i,frontText:a,backText:o,nameBlock:s,doNotTranslate:c,doNotTranslateBack:l}=e;return D(`div`,{children:[D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),children:[a&&C(`div`,{className:I.frontText,children:c?a:w.t(a)}),C(Pe,{className:r,label:``,customValue:!0,value:t,onChange:n}),o&&C(`div`,{className:I.backText,children:l?o:w.t(o)})]}),s&&C(`div`,{className:I.nameBlock,children:w.t(s)})]},i)}renderNameText({attr:e,signature:t,doNotTranslate:n,defaultValue:r},i){return C(`div`,{className:O.clsx(t?I.displayItalic:I.displayFlex,I.blockMarginTop),children:i?n?i:w.t(i):n?r:w.t(r)},e)}renderNumber(e,t,n){let{className:r}=this.props,{settings:i}=this.state,{attr:a,backText:o,frontText:s,openCheckbox:c,doNotTranslate:l,doNotTranslateBack:u}=e,d=!0;return c&&(d=typeof i.offset!=`boolean`||i.offset),d?D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),children:[s&&C(`div`,{className:I.frontText,children:l?s:w.t(s)}),C(V,{className:O.clsx(r,e.className),fullWidth:!0,autoComplete:`off`,label:e.noHelperText?``:`number`,variant:`outlined`,size:`small`,type:`number`,value:t,onChange:n,customValue:!0}),o&&C(`div`,{className:I.backText,children:u?o:w.t(o)})]},a):null}renderColor(e,t,n){let{className:r}=this.props,{attr:i,backText:a,frontText:o,doNotTranslate:s,doNotTranslateBack:c}=e;return D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),children:[o&&C(`div`,{className:I.frontText,children:s?o:w.t(o)}),C(V,{className:r,autoComplete:`off`,fullWidth:!0,variant:`outlined`,size:`small`,type:`color`,value:t,onChange:n}),a&&C(`div`,{className:I.backText,children:c?a:w.t(a)})]},i)}renderCheckbox(e,t,n){let{className:r}=this.props,{settings:i}=this.state,{attr:a,backText:o,frontText:s,defaultValue:c,doNotTranslate:l,doNotTranslateBack:u}=e;return D(`div`,{className:I.displayFlex,children:[s&&C(`div`,{className:I.frontText,children:l?s:w.t(s)}),C(z,{className:r,size:`small`,value:typeof i[a]==`boolean`?!!i[a]:!!c,customValue:!0,onChange:n}),o&&C(`div`,{onClick:()=>n(typeof i[a]==`boolean`?!i[a]:!c),className:I.backText,children:u?o:w.t(o)})]},a)}renderSlider(e,t,n){let{className:r}=this.props,{attr:i,frontText:a,backText:o,nameBlock:s,min:c,max:l,step:u,unit:d,doNotTranslate:f,doNotTranslateBack:p}=e;return D(`div`,{children:[D(`div`,{className:I.displayFlex,style:{marginRight:20},children:[a&&C(`div`,{className:I.frontText,children:f?a:w.t(a)}),C(Me,{customValue:!0,min:c,max:l,step:u,unit:d,className:r,autoComplete:`off`,label:`number`,variant:`outlined`,size:`small`,value:t,onChange:e=>n(e)}),o&&C(`div`,{style:{marginLeft:20},className:I.backText,children:p?o:w.t(o)})]}),s&&C(`div`,{className:I.nameBlock,children:w.t(s)})]},i)}renderButton(e,t,n){let{className:r}=this.props,{attr:i,frontText:a,backText:o,doNotTranslate:s,doNotTranslateBack:c}=e;return D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),children:[a&&C(`div`,{className:I.frontText,children:s?a:w.t(a)}),C(R,{fullWidth:!0,value:t.toString(),className:r,onClick:()=>n(t)}),o&&C(`div`,{className:I.backText,children:c?o:w.t(o)})]},i)}async findIcon(e){var t;if(!e)return null;if((t=e.common)!=null&&t.icon&&(e.type===`state`||e.type===`channel`||e.type===`device`))return b(e,`../..`);if(e.type===`state`||e.type===`channel`){let t=e._id.split(`.`);t.pop();let n=t.join(`.`);try{let e=await this.props.socket.getObject(n);return await this.findIcon(e)}catch{return null}}return null}renderObjectID(e,t,n){let{attr:r,openCheckbox:i,checkReadOnly:a}=e,{settings:o}=this.state,s=this.state[`showSelectId${r}`],{className:c,socket:l,style:u}=this.props,d=!0;i&&(d=typeof o.offset!=`boolean`||o.offset);let f=o[r],p=f?this.state[f]:void 0;return f&&!p&&p!==!1&&setTimeout(async e=>{var n;let r=await l.getObject(t),i=await this.findIcon(r);if(!this.mounted)return;let s={[e]:r||!1,[`${e}___icon`]:i,error:a&&this.lastObjectIdChange&&Date.now()-this.lastObjectIdChange<1e3&&(r==null||(n=r.common)==null?void 0:n.write)===!1?w.t(`Read only ID selected: %s`,o[e]):``};this.setState(s)},0,f),d?D(`div`,{className:I.blockMarginTop,children:[D(`div`,{className:I.displayFlex,children:[e.title?C(`div`,{children:w.t(e.title)}):null,C(V,{className:c,style:u,autoComplete:`off`,fullWidth:!0,disabled:!0,variant:`outlined`,size:`small`,value:t,customValue:!0}),C(R,{icon:this.state[`${f}___icon`],square:!0,style:{...u||void 0,marginLeft:7},value:`...`,className:c,onClick:()=>{let e={};e[`showSelectId${r}`]=!0,this.setState(e)}})]}),p?C(`div`,{className:O.clsx(I.nameBlock,I.displayItalic),children:O.getObjectNameFromObj(p,w.getLanguage())}):null,s?C(S,{theme:this.props.theme,imagePrefix:`../..`,dialogName:`javascript`,themeType:O.getThemeType(),socket:l,selected:t,onClose:()=>{let e={};e[`showSelectId${r}`]=!1,this.setState(e)},onOk:(e,t)=>{let i={};i[`showSelectId${r}`]=!1;let a=Array.isArray(e)?e[0]:e;this.setState(i,async()=>{var t,i,o,s,c,u,d,f,p,m;let h=a?await l.getObject(a):void 0;this.lastObjectIdChange=Date.now(),n({[r]:e,[`${r}Role`]:h==null||(t=h.common)==null?void 0:t.role,[`${r}Type`]:h==null||(i=h.common)==null?void 0:i.type,[`${r}Unit`]:h==null||(o=h.common)==null?void 0:o.unit,[`${r}States`]:h==null||(s=h.common)==null?void 0:s.states,[`${r}Min`]:h==null||(c=h.common)==null?void 0:c.min,[`${r}Max`]:h==null||(u=h.common)==null?void 0:u.max,[`${r}Step`]:h==null||(d=h.common)==null?void 0:d.step,[`${r}Def`]:h==null||(f=h.common)==null?void 0:f.def,[`${r}Write`]:h==null||(p=h.common)==null?void 0:p.write,[`${r}Read`]:h==null||(m=h.common)==null?void 0:m.read},()=>this.props.setOnUpdate&&this.props.setOnUpdate(!0))})}}):null]},r):null}renderIconTag(){return C(`div`,{className:I.iconTag,onClick:e=>{this.state.settings.tagCard&&(this.state.tagCardArray.length<3?this.onChangeTag():this.setState({openTagMenu:e.currentTarget}))},children:this.state.settings.tagCard})}renderTime(e,t,n){let{attr:r,backText:i,frontText:a,doNotTranslate:o,doNotTranslateBack:s}=e;return D(`div`,{className:I.displayFlex,style:{whiteSpace:`nowrap`},children:[a&&C(`div`,{className:I.frontText,children:o?a:w.t(a)}),C(Ie,{value:t,onChange:n}),i&&C(`div`,{className:I.backText,children:s?i:w.t(i)})]},r)}renderSelect(e,t,n){let{className:r,style:i}=this.props,{name:a,options:o,frontText:s,backText:c,attr:l,multiple:u,doNotTranslate:d,doNotTranslate2:f,doNotTranslateBack:p}=e;return D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),style:{whiteSpace:`nowrap`},children:[s&&C(`div`,{className:I.frontText,children:w.t(s)}),C(je,{attr:l,doNotTranslate:d,doNotTranslate2:f,title:a,className:r,style:i,options:o,value:t,onChange:n,multiple:u,customValue:!0}),c&&C(`div`,{className:I.backText,children:p?c:w.t(c)})]},l)}renderInstance(e,t,n){let{socket:r}=this.props,{name:i,frontText:a,backText:o,attr:s,adapter:c,doNotTranslate:l,doNotTranslateBack:u}=e;return this.state.hideAttributes.includes(s)?null:D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),style:{whiteSpace:`nowrap`},children:[a&&C(`div`,{className:I.frontText,children:l?a:w.t(a)}),C(ke,{attr:s,socket:r,adapter:c,title:i,value:t,onChange:e=>{n(Array.isArray(e)?e[0]:e)},customValue:!0,onInstanceHide:e=>this.setState({hideAttributes:[...this.state.hideAttributes,s]},()=>n(e))}),o&&C(`div`,{className:I.backText,children:u?o:w.t(o)})]},s)}renderDialog(e){let{onShowDialog:t,frontText:n,backText:r,attr:i,icon:a,doNotTranslate:o,doNotTranslateBack:s}=e;return D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),style:{whiteSpace:`nowrap`},children:[n&&C(`div`,{className:I.frontText,children:o?n:w.t(n)}),C(J,{iconName:a,className:O.clsx(I.iconDialog),onClick:()=>t&&t()}),r&&C(`div`,{className:I.backText,children:s?r:w.t(r)})]},i)}renderModalInput(e,t,n){let{openModal:r}=this.state,{className:i}=this.props,{attr:a,nameBlock:o,frontText:s,backText:c,noTextEdit:l,doNotTranslate:u,doNotTranslateBack:d}=e;return D(`div`,{children:[D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),children:[s&&C(`div`,{className:I.frontText,children:u?s:w.t(s)}),C(V,{disabled:!!l,className:i,autoComplete:`off`,fullWidth:!0,variant:`outlined`,size:`small`,value:t,onChange:n,customValue:!0}),C(R,{square:!0,style:{marginLeft:5},value:`...`,className:i,onClick:()=>this.setState({openModal:!0})}),c&&C(`div`,{className:I.backText,children:d?c:w.t(c)})]}),r?C(U,{onApply:e=>this.setState({openModal:!1},()=>e!=null&&n(e)),onClose:()=>this.setState({openModal:!1}),defaultValue:t,textInput:!0}):null,o&&C(`div`,{className:I.nameBlock,children:w.t(o)})]},a)}renderDate(e,t,n){let{attr:r,backText:i,frontText:a,doNotTranslate:o,doNotTranslateBack:s}=e;return D(`div`,{className:I.displayFlex,style:{whiteSpace:`nowrap`},children:[a&&C(`div`,{className:I.frontText,children:o?a:w.t(a)}),C(Le,{value:t,onChange:n}),i&&C(`div`,{className:I.backText,children:s?i:w.t(i)})]},r)}static getValueReplace(e,t){return`.replace(/%(?:\\.(\\d+))?${e}/g, (_m, d) => { const v = ${t}; return d !== undefined && (typeof v === "number" || (typeof v === "string" && v.trim() !== "")) && isFinite(v) ? formatValue(v, parseInt(d, 10)) : v; })`}static getReplacesInText(t){var n,r,i,a,o,s;let c=``;return(n=t.trigger)!=null&&n.oidType||((r=t.trigger)==null?void 0:r.id)===`TriggerEnumMembers`?c=`${e.getValueReplace(`s`,`obj.state.val`)}.replace(/%id/g, obj.id).replace(/%name/g, obj.common && obj.common.name)${e.getValueReplace(`old`,`obj.oldState.val`)}`:((i=t.trigger)==null?void 0:i.id)===`TriggerMessage`?c=e.getValueReplace(`s`,`typeof data === "object" ? JSON.stringify(data) : data`):((a=t.trigger)==null?void 0:a.id)===`TriggerFile`?c=`.replace(/%(?:\\.\\d+)?s/g, fileName).replace(/%id/g, fileId)`:((o=t.trigger)==null?void 0:o.id)===`TriggerObject`?c=`.replace(/%(?:\\.\\d+)?s/g, id).replace(/%id/g, id)`:((s=t.trigger)==null?void 0:s.id)===`TriggerLog`?c=`.replace(/%(?:\\.\\d+)?s/g, info.message).replace(/%id/g, info.from)`:t.conditionsStates.length&&(c=`${e.getValueReplace(`s`,t.conditionsStates[0].name)}.replace(/%id/g, "${t.conditionsStates[0].id}")`),c}renderTags(){let{tagCardArray:e,openTagMenu:t}=this.state,{tagCard:n}=this.state.settings,i=n!==`=`&&n!==`<>`&&n!==`>=`&&n!==`()`&&n!==`.`&&n!==`<=`&&n!==`<`&&n!==`>`&&n?w.t(n):n;return e.length>=3&&(i=D(`div`,{children:[C(`div`,{"aria-controls":`simple-menu`,"aria-haspopup":`true`,onClick:e=>{this.setState({openTagMenu:e.currentTarget},()=>{this.props.isTourOpen&&this.props.tourStep===A.openTagsMenu&&setTimeout(()=>this.props.setTourStep&&this.props.setTourStep(A.selectIntervalTag),300)})},children:i}),C(r,{id:`simple-menu`,anchorEl:t,keepMounted:!0,open:!!t,onClose:()=>this.setState({openTagMenu:null}),children:e.map((e,t)=>{let r;return r=typeof e==`string`?e:e.title,D(o,{selected:r===n,className:`tag-card-${r}`,style:{placeContent:`space-between`},onClick:e=>{e.stopPropagation(),this.props.isTourOpen&&(this.props.tourStep===A.openTagsMenu||this.props.tourStep===A.selectIntervalTag)&&r===`interval`&&setTimeout(()=>{var e,t;return(e=(t=this.props).setTourStep)==null?void 0:e.call(t,A.selectActions)},500);let t=JSON.parse(JSON.stringify(this.state.settings));t.tagCard=r,this.setState({openTagMenu:null,settings:t},()=>{this.props.onChange(this.state.settings),this.onTagChange(this.state.settings.tagCard)})},children:[r.search(/>|<|<>|<=|>=|=/)===-1?w.t(r):r,typeof e!=`string`&&e.title2&&C(`div`,{style:{marginLeft:4},children:w.t(e.title2)})]},`${r}_${t}`)})})]})),i}getData(){return{acceptedBy:`triggers`,name:``,id:``}}onChangeTag(){let{tagCardArray:e,settings:t,settings:{tagCard:n}}=this.state,r;if(r=typeof e[0]==`string`?[...e]:e.map(e=>e.title),n&&r.length<3){let e={...t},i=r[(r.indexOf(n)+1)%r.length];e.tagCard=i,this.setState({settings:e},()=>{this.props.onChange(e),this.onTagChange(i)})}}componentDidMount(){this.mounted=!0,this.onTagChange()}componentDidUpdate(){this.props.acceptedBy!==`triggers`&&this.props.onUpdate&&setTimeout(()=>this.onUpdate(),0)}onChangeInput(e){return(t,n,r)=>{let i=JSON.parse(JSON.stringify(this.state.settings));typeof t==`object`&&(!n||typeof n==`function`)?(Object.keys(t).forEach(e=>i[e]=t[e]),typeof n==`function`&&(r=n,n=void 0)):i[n||e]=t,i.id=this.getData().id,i._id=this.props._id,this.setState({settings:i},()=>{this.onValueChanged(t,n||e),this.props.onChange(i),r==null||r()})}}renderSpecific(){return null}renderDebug(e){return``}renderDebugInfo(){return this.state.debugMessage?C(`div`,{className:I.debugInfo,style:{opacity:1,height:22,bottom:-22},children:this.renderDebug?this.renderDebug(this.state.debugMessage):w.t(`executed`)},this.state.debugMessage.ts):null}renderCron(e,t,n){return null}renderWizard(e,t,n){return null}renderWriteState(){return null}renderInputElement(e,t){let{nameRender:n,defaultValue:r,attr:i}=e,{settings:a}=this.state,o=i?a[i]:void 0;switch(o===void 0&&(o=r),n){case`renderTime`:return i?this.renderTime(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderTime`)},`invalid_${t}`);case`renderNameText`:return this.renderNameText(e,r);case`renderSelect`:return i?this.renderSelect(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderSelect`)},`invalid_${t}`);case`renderModalInput`:return i?this.renderModalInput(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderModalInput`)},`invalid_${t}`);case`renderObjectID`:return i?this.renderObjectID(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderObjectID`)},`invalid_${t}`);case`renderDialog`:return i?this.renderDialog(e):C(`div`,{children:w.t(`Invalid renderDialog`)},`invalid_${t}`);case`renderInstance`:return i?this.renderInstance(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderInstance`)},`invalid_${t}`);case`renderText`:return i?this.renderText(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderText`)},`invalid_${t}`);case`renderSlider`:return i?this.renderSlider(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderSlider`)},`invalid_${t}`);case`renderCheckbox`:return i?this.renderCheckbox(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderCheckbox`)},`invalid_${t}`);case`renderButton`:return i?this.renderButton(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderButton`)},`invalid_${t}`);case`renderColor`:return i?this.renderColor(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderColor`)},`invalid_${t}`);case`renderSwitch`:return i?this.renderSwitch(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderSwitch`)},`invalid_${t}`);case`renderDate`:return i?this.renderDate(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderDate`)},`invalid_${t}`);case`renderCron`:return i?this.renderCron(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderCron`)},`invalid_${t}`);case`renderWizard`:return i?this.renderWizard(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderWizard`)},`invalid_${t}`);case`renderWriteState`:return this.renderWriteState();case`renderNumber`:return i?this.renderNumber(e,o,this.onChangeInput(i)):C(`div`,{children:w.t(`Invalid renderNumber`)},`invalid_${t}`);default:return this[n]?this[n](e,o,i?this.onChangeInput(i):null):C(`div`,{children:w.t(`Invalid input type: %s`,n)},`invalid_${t}`)}}render(){var e;let{inputs:t,name:n,icon:r,iconTag:i,settings:a,adapter:o,settings:{tagCard:s},helpDialog:c}=this.state,{socket:u,notFound:d}=this.props;this.state.settings&&!this.state.settings.tagCard&&(e=this.state.tagCardArray)!=null&&e.length&&!this.tagCardTimeout&&(this.tagCardTimeout=setTimeout(()=>{if(this.tagCardTimeout=null,!this.mounted)return;let e=JSON.parse(JSON.stringify(this.state.settings));e.tagCard=typeof this.state.tagCardArray[0]==`string`?this.state.tagCardArray[0]:this.state.tagCardArray[0].title,this.setState({settings:e})},50)),this.state.enableSimulation!==this.props.enableSimulation&&!this.enableSimulationProcessing&&(this.enableSimulationProcessing=!0,this.enableSimulationTimeout=setTimeout(()=>{if(this.enableSimulationTimeout=null,!this.mounted){this.enableSimulationProcessing=!1;return}this.setState({enableSimulation:this.props.enableSimulation},()=>{this.enableSimulationProcessing=!1})},50));let p;if(this.props.onDebugMessage)for(let e=this.props.onDebugMessage.length-1;e>=0;e--){let t=this.props.onDebugMessage[e];if(t.blockId===this.props._id&&t.ts>this.lastDebugMessage&&t.ts>Date.now()-1e3){p=t;break}}p&&(this.lastDebugMessage=p.ts,this.debugMessageTimeout&&clearTimeout(this.debugMessageTimeout),this.debugHideTimeout&&=(clearTimeout(this.debugHideTimeout),null),this.debugMessageTimeout=setTimeout(e=>{let t=JSON.parse(e),n=t.hideTimeout||5e3;this.debugMessageTimeout=null,this.setState({debugMessage:t},()=>{this.debugHideTimeout&&clearTimeout(this.debugHideTimeout),this.debugHideTimeout=setTimeout(()=>{this.debugHideTimeout=null,this.setState({debugMessage:null})},n)})},50,JSON.stringify(p)));let m=this.getSummary(),h=this.isCollapsed(!!m),g=h?this.summaryObjectIcon(this.summaryObjectId()):void 0;return D(f,{children:[i?this.renderIconTag():C(J,{iconName:r,className:O.clsx(I.iconThemCard,h&&I.iconThemCardCollapsed,s&&this.state.tagCardArray.length&&I.iconThemCardSelectable),adapter:o,socket:u,onClick:e=>{s&&(e.stopPropagation(),this.state.tagCardArray.length<3?this.onChangeTag():this.setState({openTagMenu:e.currentTarget}))}}),D(`div`,{className:I.blockName,"data-rules-expanded":!h,children:[D(`div`,{className:O.clsx(I.headerRow,m&&I.headerRowClickable),onClick:m?()=>this.toggleCollapsed(!h):void 0,children:[g?C(`img`,{className:I.summaryObjectIcon,src:g,alt:``}):null,C(`span`,{className:O.clsx(I.chevron,h&&I.chevronCollapsed,!m&&I.chevronPlaceholder),children:`▾`}),D(`div`,{className:I.headerText,children:[m!=null&&m.kicker?C(`div`,{className:I.kicker,children:m.kicker}):null,D(`span`,{className:O.clsx(I.nameCard,m&&I.nameCardSummary),children:[m?m.title:w.t(n),d?w.t(`%s not found`,a.id):``]}),h&&m!=null&&m.subtitle?C(`div`,{className:I.summarySub,title:m.subtitle,children:m.subtitle}):null]}),s?C(`div`,{onClick:e=>{e.stopPropagation(),this.onChangeTag()},className:O.clsx(I.tagCard,`tag-card`),children:this.renderTags()}):null,c?C(l,{className:I.iconHelp,size:`small`,onClick:e=>{e.stopPropagation(),this.setState({helpText:w.t(c)})},children:C(F,{})}):null]}),h?null:t.map((e,t)=>this.renderInputElement(e,t))]}),this.renderDebugInfo(),this.state.error?C(te,{title:w.t(`Warning`),text:this.state.error,onClose:()=>this.setState({error:``})}):null,this.state.helpText?C(re,{title:w.t(`Instructions`),text:this.state.helpText,onClose:()=>this.setState({helpText:``})}):null,this.renderSpecific()]})}},He=`async function (obj) {
2
- "__%%DEBUG_TRIGGER%%__";
3
- __%%CONDITIONS_VARS%%__
4
- const _cond = __%%CONDITION%%__;
5
-
6
- "__%%DEBUG_CONDITIONS%%__";
7
-
8
- if (_cond) {
9
- __%%THEN%%__
10
- } else {
11
- __%%ELSE%%__
12
- }
13
- }`,Ue=`async function (obj) {
14
- "__%%DEBUG_TRIGGER%%__";
15
- __%%CONDITIONS_VARS%%__
16
- const _cond = __%%CONDITION%%__;
17
-
18
- "__%%DEBUG_CONDITIONS%%__";
19
-
20
- if (__%%STATE%%__ === false && _cond) {
21
- __%%STATE%%__ = true;
22
- __%%THEN%%__
23
- } else if (__%%STATE%%__ === true && !_cond) {
24
- __%%STATE%%__ = false;
25
- __%%ELSE%%__
26
- }
27
- }`,We=`async function (data, _callback) {
28
- "__%%DEBUG_TRIGGER%%__";
29
- __%%CONDITIONS_VARS%%__
30
- const _cond = __%%CONDITION%%__;
31
-
32
- "__%%DEBUG_CONDITIONS%%__";
33
-
34
- if (_cond) {
35
- __%%THEN%%__
36
- } else {
37
- __%%ELSE%%__
38
- }
39
- }`,Ge=`async function (data, _callback) {
40
- "__%%DEBUG_TRIGGER%%__";
41
- __%%CONDITIONS_VARS%%__
42
- const _cond = __%%CONDITION%%__;
43
-
44
- "__%%DEBUG_CONDITIONS%%__";
45
-
46
- if (__%%STATE%%__ === false && _cond) {
47
- __%%STATE%%__ = true;
48
- __%%THEN%%__
49
- } else if (__%%STATE%%__ === true && !_cond) {
50
- __%%STATE%%__ = false;
51
- __%%ELSE%%__
52
- }
53
- }`,Ke=`async function (fileId, fileName, size) {
54
- "__%%DEBUG_TRIGGER%%__";
55
- __%%CONDITIONS_VARS%%__
56
- const _cond = __%%CONDITION%%__;
57
-
58
- "__%%DEBUG_CONDITIONS%%__";
59
-
60
- if (_cond) {
61
- __%%THEN%%__
62
- } else {
63
- __%%ELSE%%__
64
- }
65
- }`,qe=`async function (fileId, fileName, size) {
66
- "__%%DEBUG_TRIGGER%%__";
67
- __%%CONDITIONS_VARS%%__
68
- const _cond = __%%CONDITION%%__;
69
-
70
- "__%%DEBUG_CONDITIONS%%__";
71
-
72
- if (__%%STATE%%__ === false && _cond) {
73
- __%%STATE%%__ = true;
74
- __%%THEN%%__
75
- } else if (__%%STATE%%__ === true && !_cond) {
76
- __%%STATE%%__ = false;
77
- __%%ELSE%%__
78
- }
79
- }`,Je=`async function (id, obj) {
80
- "__%%DEBUG_TRIGGER%%__";
81
- __%%CONDITIONS_VARS%%__
82
- const _cond = __%%CONDITION%%__;
83
-
84
- "__%%DEBUG_CONDITIONS%%__";
85
-
86
- if (_cond) {
87
- __%%THEN%%__
88
- } else {
89
- __%%ELSE%%__
90
- }
91
- }`,Ye=`async function (id, obj) {
92
- "__%%DEBUG_TRIGGER%%__";
93
- __%%CONDITIONS_VARS%%__
94
- const _cond = __%%CONDITION%%__;
95
-
96
- "__%%DEBUG_CONDITIONS%%__";
97
-
98
- if (__%%STATE%%__ === false && _cond) {
99
- __%%STATE%%__ = true;
100
- __%%THEN%%__
101
- } else if (__%%STATE%%__ === true && !_cond) {
102
- __%%STATE%%__ = false;
103
- __%%ELSE%%__
104
- }
105
- }`,Xe=`async function (info) {
106
- "__%%DEBUG_TRIGGER%%__";
107
- __%%CONDITIONS_VARS%%__
108
- const _cond = __%%CONDITION%%__;
109
-
110
- "__%%DEBUG_CONDITIONS%%__";
111
-
112
- if (_cond) {
113
- __%%THEN%%__
114
- } else {
115
- __%%ELSE%%__
116
- }
117
- }`,Ze=`async function (info) {
118
- "__%%DEBUG_TRIGGER%%__";
119
- __%%CONDITIONS_VARS%%__
120
- const _cond = __%%CONDITION%%__;
121
-
122
- "__%%DEBUG_CONDITIONS%%__";
123
-
124
- if (__%%STATE%%__ === false && _cond) {
125
- __%%STATE%%__ = true;
126
- __%%THEN%%__
127
- } else if (__%%STATE%%__ === true && !_cond) {
128
- __%%STATE%%__ = false;
129
- __%%ELSE%%__
130
- }
131
- }`,X=`function (_done) {
132
- void (async () => {
133
- "__%%DEBUG_TRIGGER%%__";
134
- __%%CONDITIONS_VARS%%__
135
- const _cond = __%%CONDITION%%__;
136
-
137
- "__%%DEBUG_CONDITIONS%%__";
138
-
139
- if (_cond) {
140
- __%%THEN%%__
141
- } else {
142
- __%%ELSE%%__
143
- }
144
- })().catch(e => console.error(e)).finally(_done);
145
- }`,Qe=`"__%%DEBUG_TRIGGER%%__";
146
- __%%CONDITIONS_VARS%%__
147
- const _cond = __%%CONDITION%%__;
148
-
149
- "__%%DEBUG_CONDITIONS%%__";
150
-
151
- if (_cond) {
152
- __%%THEN%%__
153
- } else {
154
- __%%ELSE%%__
155
- }`,Z={triggers:[],conditions:[[]],justCheck:!1,actions:{then:[],else:[]}};function $e(e,t,n){let r=[],i=e.triggers;i.length||(i=[{id:`TriggerScriptSave`}]);let a=[],o=[],s=e.conditions.find(e=>e.find(e=>e.tagCard===`()`));i.forEach((t,i)=>{let c=Q(t.id,n);if(c){var l;let u={trigger:t,condition:{index:0},justCheck:s?!1:e.justCheck||!e.conditions.length||!e.conditions[0].length,conditionsDebug:[],conditionsVars:[],conditionsStates:[]},d=c.compile(t,u),f=et(e.conditions,u,n),p=$(e.actions.then,u,n),m=$(e.actions.else,u,n);a.push(`cond${i}`),(l=u.prelines)!=null&&l.length&&u.prelines.forEach(e=>o.push(e)),d.includes(` __%%CONDITIONS_VARS%%__`)&&(u.conditionsVars=u.conditionsVars.map((e,t)=>t?` ${e}`:e),u.conditionsDebug=u.conditionsDebug.map((e,t)=>t?` ${e}`:e)),r.push(d.replace(`__%%CONDITIONS_VARS%%__`,u.conditionsVars.join(`
156
- `)).replace(`"__%%DEBUG_CONDITIONS%%__";`,u.conditionsDebug.join(`
157
- `)).replace(`__%%CONDITION%%__`,f).replace(`__%%THEN%%__`,p||`// ignore`).replace(`__%%ELSE%%__`,m||`// ignore`).replace(/__%%STATE%%__/g,`cond${i}`))}});let c=r.join(`
158
-
159
- `);return(!e.justCheck||s)&&(c=`${a.map(e=>`let ${e} = false;`).join(`
160
- `)}\n\n${c}`),o&&(c=`${o.join(`
161
- `)}\n\n${c}`),c}function Q(e,t){return t.find(t=>t.getStaticData&&t.getStaticData().id===e)}function $(e,t,n){let r=[];return e==null||e.forEach(e=>{let i=Q(e.id,n);i&&r.push(i.compile(e,t))}),`\t\t${r.join(`
162
-
163
- `)}`}function et(e,t,n){let r=[],i=0;return e==null||e.forEach(e=>{let a=[];e!=null&&e.length&&(e.forEach(e=>{let r=Q(e.id,n);r&&(t.condition.index=i++,a.push(r.compile(e,t)))}),r.push(`(${a.join(`) &&
164
- (`)})`))}),r.length?r.length===1?r[0]||`true`:`(${r.join(`) || (`)})`:`true`}function tt(e,t){return $e(e,null,t)}function nt(e){if(!e)return Z;let t=e.split(`
165
- `);try{let e=(t.pop()||``).replace(/^\/\//,``),n=JSON.parse(e);return n.triggers||(n=Z),n}catch{return Z}}function rt(e,t){let n=``,r=tt(e,t);return n+=r,n+=`\n/*\nconst demo = ${JSON.stringify(e,null,2).replace(/\*\//g,`* /`)};\n*/\n`,`${n}\n//${JSON.stringify(e)}`}export{J as _,Ze as a,R as b,Je as c,Ue as d,X as f,Be as g,Ve as h,Xe as i,Ye as l,rt as m,Ke as n,We as o,nt as p,qe as r,Ge as s,Qe as t,He as u,U as v,F as x,V as y};
@@ -1 +0,0 @@
1
- import{Ir as e,Jt as t,Ot as n,Yt as r,Zt as i,cn as a,fn as o,gt as s,ln as c,lr as l,m as u,un as d,ur as f}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{t as p}from"./MonacoDiff-yYWwyqpx.js";e();var m=({savedCode:e,currentCode:m,language:h,themeType:g,name:_,onClose:v,onSave:y})=>f(a,{open:!0,onClose:v,maxWidth:`lg`,fullWidth:!0,sx:{"& .MuiDialog-paper":{height:`calc(100% - 64px)`}},children:[f(o,{children:[u.t(`Changes against the saved version`),l(t,{component:`span`,sx:{ml:1,color:`text.secondary`},children:_})]}),l(d,{sx:{display:`flex`,flexDirection:`column`,p:0,overflow:`hidden`},children:l(r,{sx:{display:`flex`,flex:1,minHeight:0},children:l(p,{originalCode:e,modifiedCode:m,language:h,themeType:g,readOnly:!0})})}),f(c,{children:[l(i,{variant:`contained`,color:`primary`,onClick:()=>{y(),v()},startIcon:l(s,{}),children:u.t(`Save`)}),l(i,{variant:`contained`,color:`grey`,onClick:v,startIcon:l(n,{}),children:u.t(`Close`)})]})]});export{m as default};
@@ -1 +0,0 @@
1
- import{Xn as e,lr as t}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";var n=e(t(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),r=e(t(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`}),`ExpandMore`);export{n,r as t};
@@ -1 +0,0 @@
1
- import{Cr as e,Er as t,Ir as n,Jt as r,Mr as i,Nn as a,Ot as o,Sn as s,Xn as c,Yt as l,Zt as u,an as d,cn as f,fn as p,jn as m,kn as h,ln as g,lr as _,m as v,qt as y,un as b,ur as x,wt as S,xn as C}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{t as w}from"./MonacoDiff-yYWwyqpx.js";var T=c(_(`path`,{d:`M15 16h4v2h-4zm0-8h7v2h-7zm0 4h6v2h-6zM3 18c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V8H3zM14 5h-3l-1-1H6L5 5H2v2h12z`}),`DeleteSweep`),E=c(_(`path`,{d:`M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z`}),`Restore`);n();var D=({socket:n,instanceId:c,scriptId:D,currentCode:O,language:k,themeType:A,onRestore:j,onClose:M})=>{let[N,P]=i(null),[F,I]=i(null),[L,R]=i(null),[z,B]=i(``),[V,H]=i(!1),U=e(e=>n.sendTo(c,`getScriptVersions`,{id:D}).then(t=>{var n;if(t!=null&&t.error){B(t.error),P([]);return}let r=(t==null?void 0:t.versions)||[];P(r),I(r.some(t=>t.ts===e)?e:((n=r[0])==null?void 0:n.ts)??null)}).catch(e=>B(String(e))),[n,c,D]);t(()=>{U()},[U]);let W=e(async e=>{let t=await n.sendTo(c,`deleteHistory`,{id:D,...e?{ts:e}:{}});if(t!=null&&t.error){B(t.error);return}await U(e?F:null)},[n,c,D,U,F]);t(()=>{if(F===null){R(null);return}let e=!1;return H(!0),n.sendTo(c,`getScriptVersion`,{id:D,ts:F}).then(t=>{e||(H(!1),t!=null&&t.error?(B(t.error),R(null)):(B(``),R((t==null?void 0:t.source)??``)))}).catch(t=>{e||(H(!1),B(String(t)))}),()=>{e=!0}},[n,c,D,F]);let G=e(e=>[(e.user||``).replace(/^system\.user\./,``),(e.from||``).replace(/^system\.adapter\./,``)].filter(Boolean).join(` · `),[]),K=N==null?void 0:N.find(e=>e.ts===F);return x(f,{open:!0,onClose:M,maxWidth:`lg`,fullWidth:!0,sx:{"& .MuiDialog-paper":{height:`calc(100% - 64px)`}},children:[x(p,{children:[v.t(`Script history`),_(r,{component:`span`,sx:{ml:1,color:`text.secondary`},children:D.replace(/^script\.js\./,``)})]}),x(b,{sx:{display:`flex`,p:0,overflow:`hidden`,gap:0},children:[x(l,{sx:{width:280,flexShrink:0,overflow:`auto`,borderRight:`1px solid`,borderColor:`divider`},children:[N===null?_(l,{sx:{display:`flex`,justifyContent:`center`,p:2},children:_(d,{size:20})}):null,(N==null?void 0:N.length)===0?_(r,{variant:`body2`,sx:{p:2,color:`text.secondary`},children:v.t(`No versions stored yet. They are written from the next save on.`)}):null,_(h,{dense:!0,children:(N||[]).map((e,t)=>{let n=N==null?void 0:N[t+1],r=n?e.lines-n.lines:0;return x(m,{selected:e.ts===F,onClick:()=>I(e.ts),children:[_(a,{primary:new Date(e.ts).toLocaleString(),secondary:`${e.lines} ${v.t(`lines`)}${r?` (${r>0?`+`:``}${r})`:``}${G(e)?` · ${G(e)}`:``}`}),_(y,{title:v.t(`Delete this version`),children:_(s,{size:`small`,onClick:t=>{t.stopPropagation(),W(e.ts)},children:_(S,{fontSize:`small`})})})]},e.ts)})})]}),x(l,{sx:{display:`flex`,flex:1,minWidth:0,flexDirection:`column`},children:[z?_(C,{severity:`error`,children:z}):null,K!=null&&K.protected&&L!==null?_(C,{severity:`info`,children:v.t(`This script is protected, its versions are stored encrypted.`)}):null,V?_(l,{sx:{display:`flex`,justifyContent:`center`,p:2},children:_(d,{size:20})}):null,L!==null&&!V?_(l,{sx:{flex:1,minHeight:0},children:_(w,{originalCode:L,modifiedCode:O,language:k,themeType:A,readOnly:!0})}):null]})]}),x(g,{children:[_(r,{variant:`caption`,sx:{flex:1,ml:2,color:`text.secondary`},children:v.t(`Left: the selected version. Right: the editor.`)}),_(u,{color:`error`,disabled:!(N!=null&&N.length),onClick:()=>void W(),startIcon:_(T,{}),children:v.t(`Delete the whole history`)}),_(u,{variant:`contained`,color:`primary`,disabled:L===null||V,onClick:()=>{L!==null&&(j(L),M())},startIcon:_(E,{}),children:v.t(`Take over into the editor`)}),_(u,{variant:`contained`,color:`grey`,onClick:M,startIcon:_(o,{}),children:v.t(`Close`)})]})]})};export{D as default};
@@ -1 +0,0 @@
1
- import{A as e,At as t,Ir as n,Rn as r,Xn as i,Zt as a,at as o,cn as s,fn as c,ft as l,gn as u,jt as d,ln as f,lr as p,m,pr as h,un as g,ur as _,v,x as y,z as b,zn as x}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";var S=i(p(`path`,{d:`M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2zm-1 7h5.5L14 6.5z`}),`FileCopy`);n();var C={textArea:{width:`100%`,height:`100%`,overflow:`auto`},textAreaLight:{background:`lightgray`},dialog:{height:`95%`},typography:{padding:16},overflowY:{overflowY:`hidden`}},w=class extends h.Component{constructor(e){super(e),this.state={anchorEl:null,popper:``}}handleCancel(){this.props.onClose()}onCopy(e){v.copyToClipboard(this.props.text);let t=e.currentTarget;setTimeout(()=>{this.setState({popper:m.t(`Copied`),anchorEl:t}),setTimeout(()=>this.setState({popper:``,anchorEl:null}),1e3)},50)}render(){let e=new Blob([this.props.text],{type:`application/xml`}),t=`${this.props.scriptId.substring(10)}.xml`;return _(s,{onClose:()=>!1,maxWidth:`lg`,sx:{"& .MuiDialog-paper":C.dialog},fullWidth:!0,open:!0,"aria-labelledby":`export-dialog-title`,children:[p(c,{id:`export-dialog-title`,children:m.t(`Export selected blocks`)}),p(g,{style:C.overflowY,children:p(`pre`,{id:`export-text`,style:{...C.textArea,...this.props.themeType===`dark`?void 0:C.textAreaLight},children:this.props.text})}),_(f,{children:[p(a,{variant:`contained`,color:`secondary`,startIcon:p(o,{}),children:p(`a`,{download:t,target:`_blank`,rel:`noreferrer`,href:URL.createObjectURL(e),style:{textDecoration:`inherit`,color:`inherit`},children:m.t(`Download as file`)})}),p(a,{variant:`contained`,onClick:e=>this.onCopy(e),color:`secondary`,startIcon:p(S,{}),children:m.t(`Copy to clipboard`)}),p(a,{variant:`contained`,onClick:()=>this.handleCancel(),color:`primary`,startIcon:p(d,{}),children:m.t(`Close`)}),p(x,{id:`popper`,style:{zIndex:1e4},open:!!this.state.popper,placement:`top`,anchorEl:this.state.anchorEl,transition:!0,children:({TransitionProps:e})=>p(u,{...e,timeout:350,children:p(r,{children:p(`p`,{style:C.typography,children:this.state.popper})})})}),p(`textarea`,{id:`copy_input`,readOnly:!0,style:{position:`absolute`,left:-9999},tabIndex:-1,"aria-hidden":!0,value:this.props.text})]})]},`export-dialog`)}};n();var T={textArea:{width:`calc(100% - 10px)`,height:`calc(80% - 20px)`,resize:`none`,fontFamily:`monospace`,fontSize:`1em`,backgroundColor:`transparent`,borderRadius:4,outline:`none`},dropzone:{marginTop:20,width:`100%`,borderWidth:5,borderStyle:`dashed`,borderColor:`#d0cccc`,textAlign:`center`,boxSizing:`border-box`,paddingTop:45,borderRadius:10,height:`calc(100% - 10px)`},dropzoneDiv:{width:`100%`,height:`20%`,position:`relative`},dropzoneRejected:{borderColor:`#970000`},dropzoneAccepted:{borderColor:`#17cd02`},icon:{height:`80%`,width:`80%`,opacity:.3,color:`#eeeeee`,position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%,-50%)`,zIndex:0},iconError:{color:`#ffc3c6`},iconOk:{color:`#aaeebc`},text:{top:`50%`,left:`50%`,transform:`translate(-50%,-50%)`,color:`#868686`,position:`absolute`,zIndex:1},dialog:{height:`95%`},fullHeight:{height:`100%`,overflow:`hidden`}},E=class n extends h.Component{constructor(e){super(e),this.state={text:``,imageStatus:``,error:``}}componentDidMount(){setTimeout(()=>{try{var e;(e=window.document.getElementById(`import-text-area`))==null||e.focus()}catch{}},100)}static readFileDataUrl(e,t){let n=new FileReader;n.onload=()=>{t(null,{data:n.result,name:e.name})},n.onabort=()=>{console.error(`file reading was aborted`),t(m.t(`file reading was aborted`))},n.onerror=e=>{console.error(`file reading has failed`),t(m.t(`file reading has failed: %s`,e))},n.readAsText(e)}handleDropFile(e){if(!(e!=null&&e.length))return;let t=e[e.length-1];t&&n.readFileDataUrl(t,(e,t)=>{if(e||!t)this.setState({error:e||`No data`});else{var n;this.setState({text:((n=t.data)==null?void 0:n.toString())||``})}})}handleCancel(){this.props.onClose()}handleOk(){this.props.onClose(this.state.text)}onChange(e){this.setState({text:e.target.value})}render(){let n={...T.dropzone,...this.state.imageStatus===`accepted`?T.dropzoneAccepted:this.state.imageStatus===`rejected`?T.dropzoneRejected:void 0};return _(s,{onClose:()=>!1,maxWidth:`lg`,sx:{"& .MuiDialog-paper":T.dialog},fullWidth:!0,open:!0,"aria-labelledby":`import-dialog-title`,children:[p(c,{id:`import-dialog-title`,children:m.t(`Import blocks`)}),_(g,{style:T.fullHeight,children:[p(`textarea`,{autoFocus:!0,id:`import-text-area`,placeholder:m.t(`Paste your blocks here`),style:{...T.textArea,color:this.props.themeType===`dark`?`#ffffff`:`#000000`},onChange:e=>this.onChange(e),value:this.state.text}),p(l,{maxSize:5e7,onDrop:(e,t)=>{if(e.length)this.handleDropFile(e);else{var n;window.alert((t==null||(n=t[0])==null||(n=n.errors)==null||(n=n[0])==null?void 0:n.message)||m.t(`ra_Cannot upload`))}},multiple:!1,accept:{"text/plain":[],"text/xml":[],"application/xml":[]},children:({getRootProps:t,getInputProps:r,isDragActive:i,isDragReject:a})=>a?(this.state.imageStatus!==`rejected`&&this.setState({imageStatus:`rejected`}),_(`div`,{style:{...n,...T.dropzoneDiv},...t(),children:[p(`input`,{...r()}),p(`span`,{style:T.text,children:m.t(`Some files will be rejected`)},`text`),p(e,{style:{...T.icon,...T.iconError}},`icon`)]})):i?(this.state.imageStatus!==`accepted`&&this.setState({imageStatus:`accepted`}),_(`div`,{style:{...n,...T.dropzoneDiv},...t(),children:[p(`input`,{...r()}),p(`span`,{style:T.text,children:m.t(`All files will be accepted`)},`text`),p(y,{style:{...T.icon,...T.iconOk}},`icon`)]})):(this.state.imageStatus!==`wait`&&this.setState({imageStatus:`wait`}),_(`div`,{style:{...n,...T.dropzoneDiv},...t(),children:[p(`input`,{...r()}),p(`span`,{style:T.text,children:m.t(`Drop some files here or click...`)},`text`),p(b,{style:T.icon},`icon`)]}))})]}),_(f,{children:[p(a,{variant:`contained`,disabled:!this.state.text,onClick:()=>this.handleOk(),color:`primary`,startIcon:p(t,{}),children:m.t(`Import`)}),p(a,{color:`grey`,variant:`contained`,onClick:()=>this.handleCancel(),startIcon:p(d,{}),children:m.t(`Close`)})]})]})}};export{w as n,E as t};
@@ -1 +0,0 @@
1
- import{Dr as e,Er as t,Ir as n,Yt as r,jr as i,lr as a}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{n as o}from"./loadMonaco-BVOEahNw.js";n();var s=({originalCode:n,modifiedCode:s,language:c,themeType:l,readOnly:u,ref:d})=>{let f=i(null),p=i(null);return e(d,()=>({getModifiedValue:()=>{var e;return((e=p.current)==null?void 0:e.getValue())??s}})),t(()=>{let e=null,t=!1;return o().then(r=>{if(t||!f.current)return;let i=r.editor.createDiffEditor(f.current,{readOnly:!!u,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,theme:l===`dark`?`vs-dark`:`vs`,scrollBeyondLastLine:!1,minimap:{enabled:!1}}),a=r.editor.createModel(n,c),o=r.editor.createModel(s,c);p.current=o,i.setModel({original:a,modified:o}),e=()=>{i.dispose(),a.dispose(),o.dispose(),p.current=null}}).catch(e=>console.error(`Cannot load the code editor: ${e}`)),()=>{t=!0,e==null||e()}},[n,s,c,l,u]),a(r,{ref:f,sx:{flex:1,overflow:`hidden`,height:`100%`,width:`100%`}})};export{s as t};
@@ -1 +0,0 @@
1
- import{Xn as e,lr as t}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";var n=e([t(`path`,{d:`M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8`},`0`),t(`path`,{d:`M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z`},`1`)],`AccessTime`),r=e(t(`path`,{d:`M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3z`}),`AccountTree`),i=e(t(`path`,{d:`M7.58 4.08 6.15 2.65C3.75 4.48 2.17 7.3 2.03 10.5h2c.15-2.65 1.51-4.97 3.55-6.42m12.39 6.42h2c-.15-3.2-1.73-6.02-4.12-7.85l-1.42 1.43c2.02 1.45 3.39 3.77 3.54 6.42M18 11c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2zm-6 11c.14 0 .27-.01.4-.04.65-.14 1.18-.58 1.44-1.18q.15-.36.15-.78h-4c.01 1.1.9 2 2.01 2`}),`NotificationsActive`);export{r as n,n as r,i as t};
@@ -1 +0,0 @@
1
- import{At as e,Bn as t,Cr as n,Dn as r,Er as i,In as a,Ir as o,It as s,Kn as c,Mr as l,Mt as u,Nt as d,Ot as f,Pn as p,Pt as m,Sn as h,Sr as g,Tr as _,Ut as v,Xn as y,Zt as b,cn as x,cr as S,dn as C,fn as w,jr as T,kr as E,ln as D,lr as O,m as k,on as A,un as j,ur as M,v as N,vt as P,wr as F}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{_ as I,h as L,m as ee,p as te,x as R,y as z}from"./Compile-CHnsUZ3H.js";import{n as B,t as V}from"./ExpandMore-BjBfK8y_.js";import{n as ne,t as re}from"./Import-Bh_K9cpx.js";import{d as H,f as ie,l as U,m as ae,p as oe,t as W}from"./index-_7Mh4AxK.js";var se=y(O(`path`,{d:`M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z`}),`AutoFixHigh`),ce=y(O(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`ChevronLeft`),le=y(O(`path`,{d:`M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z`}),`DeleteOutlined`),ue=y(O(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`NavigateBefore`);o();function de(e){let t=oe().getMonitor(),[n,r]=ae(t,e);return i(()=>t.subscribeToOffsetChange(r)),i(()=>t.subscribeToStateChange(r)),n}var G;function fe(){return G||(G=new Image,G.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),G}var K={wrapperRules:`_wrapperRules_147jt_8`,rootWrapper:`_rootWrapper_147jt_14`,bands:`_bands_147jt_26`,emptyRule:`_emptyRule_147jt_39`,emptyRuleText:`_emptyRuleText_147jt_51`},pe={switchesItem:`_switchesItem_b8h5i_6`,switchesItemActive:`_switchesItemActive_b8h5i_35`,iconTheme:`_iconTheme_b8h5i_43`};o();var me=({name:e,id:t,active:n,icon:r,adapter:i,socket:a,onDoubleClick:o,title:s,onTouchMove:c,style:l})=>M(`div`,{onDoubleClick:o,onTouchMove:c,title:k.t(s||e),className:N.clsx(pe.switchesItem,n&&pe.switchesItemActive,`block-${t}`),children:[O(I,{iconName:r,className:pe.iconTheme,adapter:i,socket:a,style:l}),O(`span`,{children:e?k.t(e):``})]},t),q={cardStyle:`_cardStyle_15e7l_1`,railTriggers:`_railTriggers_15e7l_25`,railConditions:`_railConditions_15e7l_29`,railActions:`_railActions_15e7l_33`,cardStyleActive:`_cardStyleActive_15e7l_37`,controlMenu:`_controlMenu_15e7l_46`,closeBtn:`_closeBtn_15e7l_64`,isDelete:`_isDelete_15e7l_106`,drag_mobile:`_drag_mobile_15e7l_125`};function J(e,t,n){let r;switch(e){case`actions`:if(n===`else`)return r={...t,actions:{...t[e],else:[...t[e].else]}},r;if(n===`then`)return r={...t,actions:{...t[e],then:[...t[e].then]}},r;throw console.error(`Unknown additionalParameter: ${n}`),Error(`Unknown additionalParameter: ${n}`);case`triggers`:return r={...t,triggers:[...t.triggers]},r;case`conditions`:return r={...t,conditions:[...t.conditions]},r;default:throw Error(`Unknown name: ${e}`)}}function Y(e,t,n,r){switch(e){case`actions`:return t.actions[n]=t.actions[n].filter(e=>e._id!==r),t;case`conditions`:var i;return t.conditions[n]=(i=t.conditions[n])==null?void 0:i.filter(e=>e._id!==r),t;default:return t.triggers=t.triggers.filter(e=>e._id!==r),t}}function he(e,t,n){let{_id:r,acceptedBy:i}=e,a;if(!i||!t[i])return console.warn(`Cannot find ${i}`),t;switch(i){case`actions`:if(a=t.actions[n].find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let r=t.actions[n].indexOf(a);t.actions[n][r]=e}return t;case`conditions`:if(a=t.conditions[n].find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let r=t.conditions[n].indexOf(a);t.conditions[n][r]=e}return t;default:if(a=t.triggers.find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let n=t.triggers.indexOf(a);t.triggers[n]=e}return t}}o();var ge={triggers:q.railTriggers,conditions:q.railConditions,actions:q.railActions},_e=g(e=>{var t;let{setUserRules:r,userRules:i,_id:a,id:o,blockValue:s,active:c,acceptedBy:u,isTourOpen:d,setTourStep:f,tourStep:p}=e,{blocks:m,socket:h,onUpdate:g,setOnUpdate:_,onDebugMessage:v,enableSimulation:y}=F(W),b=n(e=>m==null?void 0:m.find(t=>t.getStaticData().id===e),[m]),x=n(e=>{let t=he(e,i,s);t&&r(t)},[i]),S=E(()=>{let t=b(o)||L;return O(t,{...e,notFound:!b(o),isTourOpen:d,setTourStep:f,tourStep:p,onUpdate:g,setOnUpdate:_,enableSimulation:y,onDebugMessage:v,onChange:x,className:void 0,socket:h})},[i,g,v,y]),[C,w]=l(!1);return M(`div`,{onMouseDown:e=>{if(e.ctrlKey){let e,t=J(u,i,s);u===`conditions`?(e=t.conditions[s].find(e=>e._id===a),e&&t.conditions[s].splice(t.conditions[s].indexOf(e),0,{...e,_id:Date.now()})):u===`actions`?(e=t.actions[s].find(e=>e._id===a),e&&t.actions[s].splice(t.actions[s].indexOf(e),0,{...e,_id:Date.now()})):(e=t.triggers.find(e=>e._id===a),e&&t.triggers.splice(t[u].indexOf(e),0,{...e,_id:Date.now()})),r(t)}},id:`height`,style:c?{width:(((t=document.getElementById(`width`))==null?void 0:t.clientWidth)||0)-70}:void 0,className:[q.cardStyle,ge[u],c&&q.cardStyleActive,C&&q.isDelete].filter(Boolean).join(` `),children:[O(`div`,{className:q.drag_mobile}),S,r&&O(`div`,{className:q.controlMenu,children:O(`div`,{onClick:()=>{let e=J(u,i,s);e=Y(u,e,s,a),w(!0),setTimeout(()=>{u===`triggers`&&_(!0),r(e)},300)},className:q.closeBtn})})]})});o();var ve={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},ye=(e,t)=>[Math.round(e/32)*32,Math.round(t/32)*32],be=(e,t,n)=>{if(!e||!t)return{display:`none`};let{x:r,y:i}=t;n&&(r-=e.x,i-=e.y,[r,i]=ye(r,i),r+=e.x,i+=e.y);let a=`translate(${r}px, ${i}px)`;return{transform:a,WebkitTransform:a}},xe=e=>{let{itemType:t,isDragging:n,item:r,initialOffset:i,currentOffset:a,targetIds:o}=de(e=>({item:e.getItem(),itemType:e.getItemType(),initialOffset:e.getInitialSourceClientOffset(),currentOffset:e.getSourceClientOffset(),isDragging:e.isDragging(),targetIds:e.getTargetIds()}));return n?O(`div`,{style:ve,children:O(`div`,{style:be(i,a),children:(()=>{switch(t){case`box`:return o.length?O(_e,{active:!0,...r,allBlocks:e.allBlocks}):O(me,{active:!0,...r,socket:e.socket});default:return null}})()})}):null},X={emptyBlockStyle:`_emptyBlockStyle_1p9c1_1`,emptyBlock:`_emptyBlock_1p9c1_1`,marginTop:`_marginTop_1p9c1_1`,selectOnChange:`_selectOnChange_1p9c1_17`,selectOnChangeHelp:`_selectOnChangeHelp_1p9c1_23`,selectOnChangeHelpIcon:`_selectOnChangeHelpIcon_1p9c1_29`,emptyBlockNone:`_emptyBlockNone_1p9c1_44`,bandTriggers:`_bandTriggers_1p9c1_57`,bandConditions:`_bandConditions_1p9c1_61`,bandActions:`_bandActions_1p9c1_65`,mainBlockItemRules:`_mainBlockItemRules_1p9c1_69`,nameBlockItems:`_nameBlockItems_1p9c1_93`,nameBlockItemsFoldable:`_nameBlockItemsFoldable_1p9c1_120`,foldIcon:`_foldIcon_1p9c1_124`,foldHint:`_foldHint_1p9c1_124`,contentBlockItem:`_contentBlockItem_1p9c1_145`,wrapperMargin:`_wrapperMargin_1p9c1_153`,contentHeightOn:`_contentHeightOn_1p9c1_160`,heightBlock:`_heightBlock_1p9c1_1`,contentHeightOff:`_contentHeightOff_1p9c1_179`,cardAdd:`_cardAdd_1p9c1_186`,blockCardAdd:`_blockCardAdd_1p9c1_206`};o();function Se(e,t){let[n,r]=l(window.localStorage.getItem(t)?JSON.parse(window.localStorage.getItem(t)||``):e);return[n,e=>{window.localStorage.setItem(t,JSON.stringify(e)),r(e)},!!window.localStorage.getItem(t)]}function Ce(e,t){let n=0,r=null,i;return function(...a){let o=Date.now();i=a,o-n>=t?(n=o,e.apply(this,a)):r||=setTimeout(()=>{n=Date.now(),r=null,e.apply(this,i)},t-(o-n))}}function we(e){if(Array.isArray(e))return e.map(e=>we(e));if(typeof e==`function`)return e.bind(null);if(e&&typeof e==`object`){let t={};return Object.keys(e).forEach(n=>{t[n]=we(e[n])}),t}return e}var Te=Ce((e,t)=>e(t),0);function Ee(e,t){let n=t.find(t=>t._id===e);return{card:n,index:n?t.indexOf(n):-1}}function De(e,t,n,r,i,a,o,s,c){let{card:l,index:u}=Ee(e,n);if(!(u<t&&s<c)&&!(u>t&&s>c)&&l&&u!==t){let e=we(n);e.splice(u,1),e.splice(t,0,l);let s=we(i);switch(a){case`actions`:s.actions[o]=e,Te(r,s);return;case`conditions`:s.conditions[o]=e,Te(r,s);return;default:s.triggers=e,Te(r,s);return}}}var Oe={drag:`_drag_7xfhc_1`,root:`_root_7xfhc_11`};o();var ke=({typeBlock:e,allProperties:t,id:n,isActive:r,setUserRules:a,userRules:o,children:s,_id:c,blockValue:l})=>{let{setOnUpdate:u}=F(W),[{opacity:d},f,p]=ie({type:`box`,item:()=>({...t,id:n,isActive:r,_id:c}),end:(e,t)=>{let{acceptedBy:n}=e,r=t.getDropResult(),i;if(!r)return typeof c==`number`&&!t.getTargetIds().length&&(i=J(n,o,l),i=Y(n,i,l,c),a(i)),null;if(r.blockValue!==l){let t=typeof c==`number`?c:Date.now();i=J(n,o,r.blockValue);let s={id:e.id,acceptedBy:e.acceptedBy};switch(n){case`actions`:return l&&(i=Y(`actions`,i,l,t)),i=Y(`actions`,i,r.blockValue,t),i.actions[r.blockValue].push({...s,_id:t}),a(i);case`conditions`:return typeof l==`number`&&(i=Y(`conditions`,i,l,t)),i=Y(`conditions`,i,r.blockValue,t),i.conditions[r.blockValue].push({...s,_id:t}),a(i);default:return u(!0),i=Y(`triggers`,i,r.blockValue,t),i.triggers.push({...s,_id:t}),a(i)}}},collect:e=>({opacity:e.isDragging()?.4:1,isDragging:e.isDragging()})}),m=T(null),[,h]=H({accept:`box`,canDrop:()=>!1,hover({_id:t,acceptedBy:n},r){var i;if(!m.current||e!==n)return;let s=(i=m.current)==null?void 0:i.getBoundingClientRect(),u=(s.bottom-s.top)/2,d=r.getClientOffset(),f=((d==null?void 0:d.y)||0)-s.top;if(c&&t!==c)switch(n){case`actions`:if(l===`then`||l===`else`){let{index:e}=Ee(c,o.actions[l]);e!==t&&De(t,e,o[n][l],a,o,n,l,f,u)}return;case`conditions`:if(typeof l==`number`){let{index:e}=Ee(c,o[n][l]);e!==t&&De(t,e,o[n][l],a,o,n,l,f,u)}return;default:{let{index:e}=Ee(c,o[n]);e!==t&&De(t,e,o[n],a,o,n,void 0,f,u);return}}}});i(()=>{p(fe(),{captureDraggingState:!0})},[]),f(h(m));let g=window.innerWidth<600;return M(`div`,{ref:g&&c?null:m,className:Oe.root,style:{opacity:d},children:[O(`div`,{className:c?Oe.drag:null,ref:c&&g?m:null}),s]})};o();var Ae=({onClose:t,open:n})=>M(x,{open:n,onClose:t,"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[O(j,{children:M(`div`,{style:{fontSize:`1rem`,fontFamily:`"Roboto", "Helvetica", "Arial", sans-serif`,fontWeight:400,lineHeight:1.5,letterSpacing:`0.00938em`},children:[O(`h3`,{children:k.t(`On condition change`)}),O(`div`,{children:k.t(`help_on_change`)}),O(`h3`,{children:k.t(`Just check`)}),O(`div`,{children:k.t(`help_just_check`)})]})}),O(D,{children:O(b,{onClick:t,color:`primary`,autoFocus:!0,startIcon:O(e,{}),children:k.t(`OK`)})})]});o();var je=({onClose:e,open:t})=>M(x,{open:t,onClose:e,"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[O(j,{children:M(C,{id:`alert-dialog-description`,children:[O(`h3`,{children:k.t(`On condition change`)}),O(`div`,{children:k.t(`help_on_change`)}),O(`h3`,{children:k.t(`Just check`)}),O(`div`,{children:k.t(`help_just_check`)})]})}),O(D,{children:O(b,{onClick:e,color:`primary`,autoFocus:!0,children:k.t(`OK`)})})]});o();var Me={triggers:X.bandTriggers,conditions:X.bandConditions,actions:X.bandActions},Ne=({blockValue:e,boolean:t,typeBlock:n,userRules:r,setUserRules:a,animation:o,setTourStep:s,tourStep:c,isTourOpen:u,theme:d,themeType:f,themeName:p})=>{var m;let[h,g]=l(!1),[_,v]=l(!1),[y,b]=l(!1),[x,S]=l(``);t===void 0&&(t=!0);let C=H({accept:`box`,drop:()=>({blockValue:e}),hover:({acceptedBy:e,_id:t},r)=>{g(e===n),b(!!t),S(r.getHandlerId()||``)},canDrop:({acceptedBy:e})=>(v(e===n),e===n),collect:e=>{var t;return{isOver:e.isOver(),canDrop:((t=e.getItem())==null?void 0:t.acceptedBy)===n,offset:e.getClientOffset(),targetId:e.getHandlerId()}}}),{canDrop:w,isOver:T,offset:E,targetId:D}=C[0],k=C[1];i(()=>{S(``)},[E]);let A=w&&T,j=``;A?j=h?`#00fb003d`:`#fb00002e`:w?j=_?`#00fb003d`:`#fb00002e`:E&&(j=D===x?`#fb00002e`:``);let P;return P=n===`actions`?r.actions[e]:n===`conditions`?r.conditions[e]:r.triggers,O(`div`,{ref:e=>{k(e)},style:{backgroundColor:j},className:N.clsx(X.contentBlockItem,t?o&&X.contentHeightOn:X.contentHeightOff),children:M(`div`,{className:X.wrapperMargin,children:[P.map(t=>O(ke,{typeBlock:n,...t,blockValue:e,allProperties:t,userRules:r,setUserRules:a,children:O(_e,{...t,isTourOpen:u,setTourStep:s,tourStep:c,settings:t,blockValue:e,userRules:r,setUserRules:a,theme:d,themeType:f,themeName:p})},t._id)),O(`div`,{style:A&&h&&!y?{height:((m=document.getElementById(`height`))==null?void 0:m.clientHeight)||200}:void 0,className:`${X.emptyBlockStyle} ${A&&h&&!y?X.emptyBlock:X.emptyBlockNone}`})]})})},Pe=({typeBlock:e,name:n,nameAdditionally:r,additionally:o,userRules:s,setUserRules:c,iconName:u,adapter:d,socket:f,setTourStep:p,tourStep:m,isTourOpen:g,theme:v,themeType:y,themeName:b})=>{let[x,C,w]=Se(e!==`actions`&&[],`additionallyClickItems_${e}`),[T,E]=l(!1),[D,A]=l(!1),j=e===`conditions`&&!s.conditions.some(e=>e.length),[P,F]=Se(!0,`foldEmptyConditions`),L=j&&P,[,ee]=H({accept:`box`,hover:({acceptedBy:e})=>{e===`conditions`&&L&&F(!1)}});i(()=>{if(e===`conditions`&&(x==null?void 0:x.length)!==s.conditions.length-1){let e=[];s.conditions.forEach((t,n)=>{n>0&&e.push({_id:Date.now(),open:!0})}),C([...x,...e])}e===`actions`&&!w&&s.actions.else.length&&C(!0)},[]);let[te,z]=l(!1),ne=s.conditions.some(e=>e.length)||!!s.actions.else.length;return M(`div`,{className:`${X.mainBlockItemRules} ${Me[e]}`,children:[M(`span`,{id:`width`,ref:e=>{ee(j?e:null)},className:N.clsx(X.nameBlockItems,j&&X.nameBlockItemsFoldable),onClick:j?()=>F(!P):void 0,title:j?k.t(L?`Show conditions`:`Hide empty conditions`):void 0,children:[O(I,{iconName:u,className:X.iconThemCard,adapter:d,socket:f}),n,j?M(S,{children:[O(L?B:V,{className:X.foldIcon}),L?O(`span`,{className:X.foldHint,children:k.t(`without condition`)}):null]}):null]}),e===`conditions`&&!L?M(`div`,{style:{width:`100%`},children:[M(t,{variant:`standard`,className:X.selectOnChange,value:s.justCheck||!1,onChange:e=>{let t=J(`conditions`,s);t.justCheck=e.target.value===`true`,c(t)},children:[O(a,{value:`false`,children:k.t(`on condition change`)}),O(a,{value:`true`,children:k.t(`just check`)})]}),O(h,{size:`small`,title:k.t(`Explanation`),className:X.selectOnChangeHelp,onClick:()=>E(!0),children:O(R,{className:X.selectOnChangeHelpIcon})})]}):null,L?null:O(Ne,{setTourStep:p,tourStep:m,isTourOpen:g,blockValue:e===`actions`?`then`:e===`conditions`?0:e,typeBlock:e,setUserRules:c,userRules:s,theme:v,themeName:b,themeType:y}),!L&&o&&[...Array(e===`actions`?+!!ne:s.conditions.length-1)].map((t,n)=>{let i=(t=n)=>e===`actions`?!!x:!!x.find((e,n)=>n===t&&e.open);return M(_,{children:[M(`div`,{onClick:()=>{if(e===`actions`)return C(!x),null;let t=JSON.parse(JSON.stringify(x));if(s.conditions[n+1].length)return t[n].open=!t[n].open,C(t),null;t=t.filter((e,t)=>t!==n),C(t),z(n),setTimeout(()=>{z(!1),c({...s,conditions:[...s.conditions.filter((e,t)=>t!==n+1)]})},250)},className:X.blockCardAdd,children:[i()?`-`:`+`,O(`div`,{className:X.cardAdd,children:r})]},n),O(Ne,{blockValue:e===`actions`?`else`:e===`conditions`?n+1:e,typeBlock:e,setUserRules:c,userRules:s,boolean:i(),animation:te===n,theme:v,themeName:b,themeType:y})]},`${n}_block_${e}`)}),!L&&o&&e===`conditions`&&M(`div`,{onClick:()=>{C([...x,{_id:Date.now(),open:!0}]),c({...s,conditions:[...s.conditions,[]]}),z(s.conditions.length-1),setTimeout(()=>z(!1),1e3)},className:X.blockCardAdd,children:[`+`,O(`div`,{className:X.cardAdd,children:r})]}),O(Ae,{open:T,onClose:()=>E(!1)}),O(je,{open:D,onClose:()=>A(!1)})]})},Z={menuRules:`_menuRules_1ijaq_1`,wizardButton:`_wizardButton_1ijaq_13`,switchesRenderWrapper:`_switchesRenderWrapper_1ijaq_26`,menuOff:`_menuOff_1ijaq_35`,menuTitle:`_menuTitle_1ijaq_41`,marginAuto:`_marginAuto_1ijaq_55`,inputWidth:`_inputWidth_1ijaq_60`,menuWrapper:`_menuWrapper_1ijaq_72`,hamburgerWrapper:`_hamburgerWrapper_1ijaq_80`,hamburgerOff:`_hamburgerOff_1ijaq_113`,nothingFound:`_nothingFound_1ijaq_121`,resetSearch:`_resetSearch_1ijaq_128`,controlPanel:`_controlPanel_1ijaq_140`,controlPanelAppBar:`_controlPanelAppBar_1ijaq_164`,tabTriggers:`_tabTriggers_1ijaq_180`,tabConditions:`_tabConditions_1ijaq_184`,tabActions:`_tabActions_1ijaq_188`,addClassMenu:`_addClassMenu_1ijaq_192`,addClassBackground:`_addClassBackground_1ijaq_198`,addClassPosition:`_addClassPosition_1ijaq_202`};o();var Fe=e=>{let{allProperties:t,allProperties:{acceptedBy:n,id:r},setUserRules:i,userRules:a,setTourStep:o,tourStep:s,isTourOpen:c,onTouchMove:l,isActive:u}=e;return O(ke,{allProperties:t,id:t.id,isActive:u,setUserRules:i,userRules:a,children:O(me,{onDoubleClick:()=>{c&&s===U.addScheduleByDoubleClick&&r===`TriggerScheduleBlock`&&o(U.openTagsMenu),c&&s===U.addActionPrintText&&r===`ActionPrintText`&&o(U.showJavascript);let e=Date.now(),t;switch(n){case`actions`:t=`then`;break;case`conditions`:t=a[n].length-1}let l=J(n,a,t),u={id:r,_id:e,acceptedBy:n};t===void 0?l.triggers.push({...u}):n===`actions`?l.actions[t].push({...u}):n===`conditions`&&l.conditions[t].push({...u}),i(l)},...e,...t,onTouchMove:l})})};o();var Ie={triggers:Z.tabTriggers,conditions:Z.tabConditions,actions:Z.tabActions},Le=({addClass:e,setAllBlocks:t,allBlocks:n,userRules:r,onChangeBlocks:a,setTourStep:o,tourStep:c,isTourOpen:l,onStartWizard:u})=>{let{blocks:d,socket:f}=F(W),[m,h]=Se(!1,`hamburgerOnOff`),[g,y]=Se({text:``,type:`triggers`,index:0},`filterControlPanel`),x=(e=g.text,n=g.type)=>{if(!d)return;let r=[...d];r=r.filter(t=>{if(!e)return!0;let{name:n}=t.getStaticData();return n&&k.t(n).toLowerCase().includes(e.toLowerCase())}),r=r.filter(e=>n===e.getStaticData().acceptedBy),t(r)},S=(e,t)=>{l&&t===0&&c===U.selectTriggers&&o(U.addScheduleByDoubleClick),l&&t===2&&c===U.selectActions&&o(U.addActionPrintText),y({...g,index:t,type:[`triggers`,`conditions`,`actions`][t]}),x(g.text,[`triggers`,`conditions`,`actions`][t])},C=e=>({id:`scrollable-force-tab-${e}`,"aria-controls":`scrollable-force-tabpanel-${e}`});return i(()=>{x()},[d]),O(A,{mouseEvent:!1,touchEvent:`onTouchStart`,onClickAway:()=>h(!0),children:M(`div`,{className:N.clsx(Z.menuWrapper,e[1035]&&Z.addClassMenu),children:[O(`div`,{className:`${Z.hamburgerWrapper} ${m?Z.hamburgerOff:null}`,onClick:()=>h(!m),children:O(m?B:ce,{})}),M(`div`,{className:`${N.clsx(Z.menuRules,Ie[g.type],e[1035]&&Z.addClassBackground,e[835]&&Z.addClassPosition)} ${m?Z.menuOff:null}`,children:[O(b,{className:Z.wizardButton,fullWidth:!0,size:`small`,variant:`outlined`,startIcon:O(se,{}),onClick:u,children:k.t(`Wizard`)}),O(`div`,{className:Z.controlPanel,children:O(p,{className:Z.controlPanelAppBar,position:`static`,children:M(v,{value:g.index,onChange:S,children:[O(s,{className:N.clsx(`blocks-triggers`,Z.tabTriggers),title:k.t(`Triggers`),icon:O(I,{iconName:`FlashOn`}),...C(0)}),O(s,{title:k.t(`Conditions`),className:N.clsx(`blocks-conditions`,Z.tabConditions),icon:O(I,{iconName:`Help`}),...C(1)}),O(s,{title:k.t(`Actions`),className:N.clsx(`blocks-actions`,Z.tabActions),icon:O(I,{iconName:`PlayForWork`}),...C(2)})]})})}),O(`div`,{className:Z.switchesRenderWrapper,children:M(`span`,{children:[n.map(e=>{let{name:t,id:n,icon:i,adapter:s}=e.getStaticData();return O(_,{children:O(Fe,{adapter:s,allProperties:e.getStaticData(),icon:i,id:n,isActive:!1,isTourOpen:l,name:t,onTouchMove:()=>h(!0),setTourStep:o,setUserRules:a,socket:f,tourStep:c,userRules:r})},n)}),!n.length&&M(`div`,{className:Z.nothingFound,children:[k.t(`Nothing found`),`...`,O(`div`,{className:Z.resetSearch,onClick:()=>{y({...g,text:``}),x(``)},children:k.t(`reset search`)})]})]})}),O(`div`,{className:N.clsx(Z.menuTitle,Z.marginAuto)}),O(z,{className:Z.inputWidth,fullWidth:!0,customValue:!0,value:g.text,size:`small`,autoComplete:`off`,label:k.t(`search`),variant:`outlined`,onChange:e=>{y({...g,text:e}),x(e)}})]})]})})},Q={bandTriggers:`_bandTriggers_91vrz_5`,bandConditions:`_bandConditions_91vrz_9`,bandActions:`_bandActions_91vrz_13`,paper:`_paper_91vrz_17`,title:`_title_91vrz_22`,close:`_close_91vrz_29`,content:`_content_91vrz_35`,stepper:`_stepper_91vrz_40`,step:`_step_91vrz_40`,hint:`_hint_91vrz_56`,warning:`_warning_91vrz_61`,blockCard:`_blockCard_91vrz_68`,blockBody:`_blockBody_91vrz_79`,remove:`_remove_91vrz_86`,notFound:`_notFound_91vrz_93`,chooser:`_chooser_91vrz_99`,choice:`_choice_91vrz_105`,choiceIcon:`_choiceIcon_91vrz_128`,choiceName:`_choiceName_91vrz_136`,addMore:`_addMore_91vrz_144`,summaryBand:`_summaryBand_91vrz_150`,summaryLabel:`_summaryLabel_91vrz_156`,preview:`_preview_91vrz_164`,actions:`_actions_91vrz_169`,spacer:`_spacer_91vrz_173`};o();var $=[`triggers`,`conditions`,`actions`],Re={triggers:`Triggers`,conditions:`Conditions`,actions:`Actions`},ze={triggers:`What should start the rule?`,conditions:`When should the rule run? This step is optional.`,actions:`What should happen?`},Be={triggers:`when`,conditions:`and`,actions:`then`},Ve={triggers:Q.bandTriggers,conditions:Q.bandConditions,actions:Q.bandActions},He=()=>({triggers:[],conditions:[],actions:[]}),Ue=({onCreate:e,onClose:t,hasRule:n,socket:r,theme:i,themeType:a,themeName:o})=>{let{blocks:s}=F(W),[p,g]=l(0),[_,v]=l(He),[y,S]=l(null),C=T(0),A=E(()=>{let e={triggers:[],conditions:[],actions:[]};return s==null||s.forEach(t=>{var n;let{acceptedBy:r}=t.getStaticData();(n=e[r])==null||n.push(t)}),e},[s]),L=E(()=>({triggers:_.triggers,conditions:_.conditions.length?[_.conditions]:[[]],justCheck:!1,actions:{then:_.actions,else:[]}}),[_]),ee=(e,t)=>{C.current+=1,v(n=>({...n,[e]:[...n[e],{id:t,_id:C.current,acceptedBy:e}]})),S(null)},te=(e,t)=>v(n=>({...n,[e]:n[e].filter(e=>e._id!==t)})),R=(e,t,n)=>v(r=>({...r,[e]:r[e].map(r=>r._id===t?{...n,_id:t,id:r.id,acceptedBy:e}:r)})),z=(e,t,n)=>{let c=s==null?void 0:s.find(t=>t.getStaticData().id===e.id);return c?O(c,{_id:e._id,settings:e,acceptedBy:t,onChange:n?()=>{}:n=>R(t,e._id,n),socket:r,theme:i,themeType:a,themeName:o,enableSimulation:!1,userRules:L,onUpdate:!1,setOnUpdate:()=>{}}):O(`div`,{className:Q.notFound,children:k.t(`Block not found`)})},B=e=>O(`div`,{className:Q.chooser,children:A[e].map(t=>{let{id:n,name:i,icon:a,adapter:o,title:s}=t.getStaticData();return M(`button`,{type:`button`,className:Q.choice,title:s?k.t(s):void 0,onClick:()=>ee(e,n),children:[O(I,{iconName:a,adapter:o,socket:r,className:Q.choiceIcon}),O(`span`,{className:Q.choiceName,children:k.t(i)})]},n)})}),V=(e,t)=>M(`div`,{className:Q.step,hidden:p!==t,children:[O(`div`,{className:Q.hint,children:k.t(ze[e])}),_[e].map(t=>M(`div`,{className:N.clsx(Q.blockCard,Ve[e]),children:[O(`div`,{className:Q.blockBody,children:z(t,e)}),O(h,{className:Q.remove,size:`small`,title:k.t(`Delete`),onClick:()=>te(e,t._id),children:O(le,{fontSize:`small`})})]},t._id)),y===e||!_[e].length?B(e):O(b,{className:Q.addMore,startIcon:O(u,{}),onClick:()=>S(e),children:k.t(`Add another`)})]},e),ne=()=>M(`div`,{className:Q.step,children:[$.map(e=>_[e].length?M(`div`,{className:Q.summaryBand,children:[O(`div`,{className:N.clsx(Q.summaryLabel,Ve[e]),children:k.t(Be[e])}),_[e].map(t=>O(`div`,{className:N.clsx(Q.blockCard,Q.preview,Ve[e]),children:O(`div`,{className:Q.blockBody,children:z(t,e,!0)})},t._id))]},e):null),_.conditions.length?null:O(`div`,{className:Q.hint,children:k.t(`Without a condition the rule always runs`)}),n?O(`div`,{className:Q.warning,children:k.t(`The current rule will be replaced`)}):null]}),re=p===$.length,H=re||p===1||!!_[$[p]].length;return M(x,{open:!0,fullWidth:!0,maxWidth:`md`,onClose:t,classes:{paper:Q.paper},children:[M(w,{className:Q.title,children:[k.t(`Create a rule step by step`),O(h,{className:Q.close,size:`small`,title:k.t(`Close`),onClick:t,children:O(f,{})})]}),M(j,{className:Q.content,children:[M(m,{className:Q.stepper,activeStep:p,children:[$.map(e=>O(c,{children:O(d,{children:k.t(Re[e])})},e)),O(c,{children:O(d,{children:k.t(`Summary`)})})]}),$.map(V),re?ne():null]}),M(D,{className:Q.actions,children:[O(b,{disabled:!p,startIcon:O(ue,{}),onClick:()=>g(p-1),children:k.t(`Back`)}),O(`div`,{className:Q.spacer}),O(b,{onClick:t,children:k.t(`Cancel`)}),re?O(b,{variant:`contained`,color:`primary`,onClick:()=>{e(L),t()},children:k.t(n?`Replace rule`:`Create rule`)}):O(b,{variant:`contained`,color:`primary`,disabled:!H,endIcon:O(P,{}),onClick:()=>g(p+1),children:k.t(p===1&&!_.conditions.length?`Skip`:`Next`)})]})]})};o();var We=[],Ge=({code:e,onChange:t,themeName:a,themeType:o,theme:s,setTourStep:c,tourStep:u,isTourOpen:d,command:f,scriptId:p,changed:m,running:h,newRuleId:g,onNewRuleHandled:_})=>{var v;let{blocks:y,loadBlocks:x,socket:S,setOnUpdate:C,setOnDebugMessage:w,setEnableSimulation:E}=F(W),[D,A]=l([]),[j,N]=l(te(e)),[P,I]=l(``),[L,R]=l(!1),[z,B]=l(!1);i(()=>{let e,t,n=(n,r)=>{n===`${e}.alive`&&t!==(r==null?void 0:r.val)&&(t=!!(r!=null&&r.val),t&&e&&(S==null||S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOn`,p)))},r=(r,i)=>{var a;if(S&&e!==(i==null||(a=i.common)==null?void 0:a.engine)){var o;e&&(S.unsubscribeState(`${e}.alive`,n),t&&S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOn`,p)),e=i==null||(o=i.common)==null?void 0:o.engine,e&&e&&S.subscribeState(`${e}.alive`,n)}},i=(e,t)=>{if(t)try{let e=JSON.parse(t.val),n=Date.now();if(e.ruleId===p&&n-e.ts<1e3){let t=[...We,{blockId:e.blockId,data:e.data,ts:e.ts}];t.length>200&&t.splice(0,t.length-200);for(let e=t.length-1;e>=0;e--)if(t[e].ts<n-5e3){t.splice(0,e);break}We=t,w(t)}}catch{console.error(`Cannot parse: ${t.val}`)}};return S==null||S.getObject(p).then(t=>{var a;e=t==null||(a=t.common)==null?void 0:a.engine,S.subscribeObject(p,r),e&&(S.subscribeState(`${e}.alive`,n),S.subscribeState(`${e.replace(/^system\.adapter\./,``)}.debug.rules`,i))}),function(){S==null||S.unsubscribeObject(p,r),e&&(S==null||S.unsubscribeState(`${e}.alive`,n),t&&(S==null||S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOff`,p)),S==null||S.unsubscribeState(`${e.replace(/^system\.adapter\./,``)}.debug.rules`,i))}},[]),i(()=>x(),[x]),i(()=>{E(!m&&h)},[m,h,E]),i(()=>{f&&(I(f),L||R(!0))},[f]),i(()=>{let t=te(e);JSON.stringify(t)!==JSON.stringify(j)&&(N(t),C(!0))},[e]),i(()=>{document.getElementsByTagName(`HTML`)[0].className=a||`blue`},[a]),i(()=>{g&&g===p&&(_(),B(!0))},[g,p,_]);let V=n(e=>{N(e),y&&t(ee(e,y))},[y,t]),H=T(null),[ie,U]=l({835:!1,1035:!1});if(i(()=>{H.current&&(H.current.clientWidth<=1035&&U({835:!1,1035:!0}),H.current.clientWidth<=835&&U({1035:!0,835:!0}),H.current.clientWidth>1035&&U({835:!1,1035:!1}))},[((v=H.current)==null?void 0:v.clientWidth)||0]),!S)return null;if(!y)return O(r,{});let ae=!j.triggers.length&&!j.actions.then.length&&!j.actions.else.length&&!j.conditions.some(e=>e.length);return M(`div`,{className:K.wrapperRules,ref:H,children:[O(xe,{allBlocks:D,socket:S}),L?P===`export`?O(ne,{scriptId:p,themeType:o,onClose:()=>R(!1),text:JSON.stringify(j,null,2)}):O(re,{themeType:o,onClose:e=>{R(!1),e&&V(JSON.parse(e))}}):null,z?O(Ue,{hasRule:!ae,socket:S,theme:s,themeType:o,themeName:a,onCreate:V,onClose:()=>B(!1)}):null,M(`div`,{className:K.rootWrapper,children:[O(Le,{setAllBlocks:A,allBlocks:D,userRules:j,onChangeBlocks:V,setTourStep:c,tourStep:u,addClass:ie,isTourOpen:d,onStartWizard:()=>B(!0)}),M(`div`,{className:K.bands,children:[ae?M(`div`,{className:K.emptyRule,children:[O(`div`,{className:K.emptyRuleText,children:k.t(`Create a rule step by step`)}),O(b,{variant:`contained`,color:`primary`,startIcon:O(se,{}),onClick:()=>B(!0),children:k.t(`Wizard`)})]}):null,O(Pe,{socket:S,setUserRules:V,userRules:j,isTourOpen:d,setTourStep:c,tourStep:u,name:`${k.t(`when`)}...`,typeBlock:`triggers`,iconName:`FlashOn`,themeType:o,themeName:a,theme:s}),O(Pe,{socket:S,setUserRules:V,isTourOpen:d,setTourStep:c,tourStep:u,userRules:j,name:`...${k.t(`and`)}...`,typeBlock:`conditions`,iconName:`Help`,nameAdditionally:k.t(`or`),additionally:!0,themeType:o,themeName:a,theme:s}),O(Pe,{socket:S,setUserRules:V,isTourOpen:d,setTourStep:c,tourStep:u,userRules:j,name:`...${k.t(`then`)}`,typeBlock:`actions`,iconName:`PlayForWork`,nameAdditionally:k.t(`else`),additionally:!0,themeType:o,themeName:a,theme:s})]})]})]},`rulesEditor`)};export{Ge as default};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./stateHoverProvider-BfhQov29.js","./cronHoverProvider-CZrYrB2m.js","./AiInlineProvider-CslJGmO0.js","./AiChatService-h1EHSXaR.js","./index-_7Mh4AxK.js","./index-BHhhebRG.css","./inlineDiffController-VazWO1wi.js","./applyCodeEdit-D3nb7erO.js","./inlineChatWidget-BfjarD99.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-C0FnF6B9.js";import{B as t,Dn as n,Ir as r,N as i,Sn as a,Wn as o,Zt as s,cn as c,fn as l,hn as u,ln as d,lr as f,m as p,pr as m,sr as h,un as g,ur as _}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{t as v}from"./vite-preload-helper-BbbETgeG.js";import{a as y,n as b,r as x}from"./index-_7Mh4AxK.js";import{n as S,t as C}from"./loadMonaco-BVOEahNw.js";var w=e({default:()=>O});r();function T(e){return/^script\.js\.global\./.test(e)}var E=0;function D(e){return e.replace(/\x1b\[[0-9;]*m/g,``)}var O=class extends m.Component{get monacoTS(){var e;return(e=this.monaco)==null||(e=e.languages)==null?void 0:e.typescript}constructor(e){super(e),h(this,`monacoDiv`,null),h(this,`editor`,null),h(this,`monaco`,C()),h(this,`insert`,``),h(this,`originalCode`,void 0),h(this,`runningInstancesStr`,void 0),h(this,`unmounted`,!1),h(this,`location`,void 0),h(this,`breakpoints`,void 0),h(this,`lastSearch`,``),h(this,`typings`,{}),h(this,`decorations`,[]),h(this,`datapointProviderDisposable`,null),h(this,`inlineProviderDisposable`,null),h(this,`stateHoverDisposable`,null),h(this,`showStateValueDisposable`,null),h(this,`cronHoverDisposable`,null),h(this,`codeLensDisposable`,null),h(this,`aiHelpersUnsubscribe`,null),h(this,`inlineChatWidgetInstance`,null),h(this,`inlineDiffInstance`,null),h(this,`inlineDiffCssInjected`,!1),h(this,`triggerPrettier`,void 0),h(this,`contentChangeDisposable`,null),h(this,`mouseDownDisposable`,null),this.state={name:`current`,isDark:e.isDark||!1,language:e.language||`javascript`,readOnly:e.readOnly||!1,alive:!0,check:!1,searchText:this.props.searchText||``,typingsLoaded:!1,showError:null},this.triggerPrettier=e.triggerPrettier,this.runningInstancesStr=JSON.stringify(this.props.runningInstances),this.originalCode=e.code||``,this.monacoDiv=m.createRef()}loadTypings(e){if(!this.editor)return;e||=this.props.runningInstances;let t=e&&Object.keys(e).find(t=>e==null?void 0:e[t]);t&&this.props.socket.sendTo(t.replace(`system.adapter.`,``),`loadTypings`,null).then(e=>{this.setState({alive:!0,check:!0,typingsLoaded:!0}),this.setTypeCheck(!0),e.typings?(this.typings=e.typings,this.setEditorTypings(this.state.name)):console.error(`failed to load typings: ${e.error}`)})}componentDidMount(){if(this.undo,this.redo,this.showInlineDiff,this.getEditorSelection,this.getEditorContent,this.setEditorContent,this.getCursorPosition,this.getWordAtCursor,this.highlightLineRange,this.goToLine,this.replaceSelection,this.getDiagnostics,this.getDocumentSymbols,this.monaco){this.initEditor();return}S().then(e=>{this.unmounted||(this.monaco=e,this.forceUpdate(()=>this.initEditor()))}).catch(e=>{console.error(`Cannot load the code editor: ${e}`),this.unmounted||this.setState({showError:{title:p.t(`Cannot load the code editor`),message:String(e)}})})}initEditor(){var e;if(!this.editor&&(e=this.monacoTS)!=null&&e.typescriptDefaults&&this.monaco){var t,n,r;console.log(`Init editor`),(t=(n=this.props).onRegisterSelect)==null||t.call(n,()=>{if(this.editor){let t=this.editor.getSelection();if(t){var e;return(e=this.editor.getModel())==null?void 0:e.getValueInRange(t)}}});let e=this.monacoTS.typescriptDefaults.getCompilerOptions();if(e.allowJs=!0,e.checkJs=this.props.checkJs!==!1,e.noLib=!0,e.lib=[],e.useUnknownInCatchVariables=!1,e.moduleResolution=this.monacoTS.ModuleResolutionKind.NodeJs,e.target=this.monacoTS.ScriptTarget.ESNext,e.module=this.monacoTS.ModuleKind.ESNext,e.allowNonTsExtensions=!0,this.monacoTS.typescriptDefaults.setCompilerOptions(e),this.setTypeCheck(!1),(r=this.monacoDiv)!=null&&r.current){var i;this.editor=this.monaco.editor.create((i=this.monacoDiv)==null?void 0:i.current,{lineNumbers:`on`,scrollBeyondLastLine:!1,automaticLayout:!0,glyphMargin:!!this.props.breakpoints,colorDecorators:!0,hover:{enabled:`on`,delay:200,sticky:!0},fixedOverflowWidgets:!0}),this.contentChangeDisposable=this.editor.onDidChangeModelContent(()=>this.onChange()),this.monaco&&!this.datapointProviderDisposable&&v(async()=>{let{registerDatapointProvider:e}=await import(`./AiDatapointProvider-DzFpUKkT.js`);return{registerDatapointProvider:e}},[],import.meta.url).then(({registerDatapointProvider:e})=>{this.monaco&&(this.datapointProviderDisposable=e(this.monaco,this.props.socket))}).catch(()=>{}),this.monaco&&!this.showStateValueDisposable&&v(async()=>{let{registerShowStateValueAction:e}=await import(`./stateHoverProvider-BfhQov29.js`);return{registerShowStateValueAction:e}},__vite__mapDeps([0]),import.meta.url).then(({registerShowStateValueAction:e})=>{this.monaco&&this.editor&&!this.showStateValueDisposable&&(this.showStateValueDisposable=e(this.editor,this.monaco,p.t(`Show ioBroker state value`)))}).catch(()=>{}),this.registerAiHelpers(),this.aiHelpersUnsubscribe=x(e=>{e?this.registerAiHelpers():this.disposeAiHelpers()}),this.loadTypings(),this.props.onForceSave&&this.editor.addCommand(this.monaco.KeyMod.CtrlCmd|this.monaco.KeyCode.KeyS,()=>this.props.onForceSave&&this.props.onForceSave()),this.registerAiActions(),setTimeout(()=>{this.highlightText(this.state.searchText),this.location=this.props.location||void 0,this.breakpoints=this.props.breakpoints,this.showDecorators()})}}let a={selectOnLineNumbers:!0,scrollBeyondLastLine:!1,automaticLayout:!0,readOnly:this.state.readOnly,language:this.state.language,isDark:this.state.isDark};this.setEditorOptions(a),this.editor&&(this.editor.focus(),this.editor.setValue(this.originalCode),this.props.onToggleBreakpoint&&(this.mouseDownDisposable=this.editor.onMouseDown(e=>{var t;let n=e.target;this.props.onToggleBreakpoint&&((t=n.detail)==null?void 0:t.glyphMarginLeft)!==void 0&&n.position&&this.props.onToggleBreakpoint(n.position.lineNumber-1)})))}setEditorOptions(e){if(e&&(e.language&&this.setEditorLanguage(e.language),this.editor&&(e.readOnly!==void 0&&this.editor.updateOptions({readOnly:e.readOnly}),e.lineWrap!==void 0&&this.editor.updateOptions({wordWrap:e.lineWrap?`on`:`off`})),e.typeCheck!==void 0&&this.setTypeCheck(e.typeCheck),e.isDark!==void 0)){var t;(t=this.monaco)==null||t.editor.setTheme(e.isDark?`vs-dark`:`vs`)}}registerAiHelpers(){b()&&this.monaco&&this.editor&&(this.stateHoverDisposable||v(async()=>{let{registerStateHoverProvider:e}=await import(`./stateHoverProvider-BfhQov29.js`);return{registerStateHoverProvider:e}},__vite__mapDeps([0]),import.meta.url).then(({registerStateHoverProvider:e})=>{this.monaco&&b()&&!this.stateHoverDisposable&&(this.stateHoverDisposable=e(this.monaco,this.props.socket))}).catch(()=>{}),this.cronHoverDisposable||v(async()=>{let{registerCronHoverProvider:e}=await import(`./cronHoverProvider-CZrYrB2m.js`);return{registerCronHoverProvider:e}},__vite__mapDeps([1]),import.meta.url).then(({registerCronHoverProvider:e})=>{this.monaco&&b()&&!this.cronHoverDisposable&&(this.cronHoverDisposable=e(this.monaco))}).catch(()=>{}),this.props.aiCompletionsEnabled&&!this.inlineProviderDisposable&&v(async()=>{let{registerAiInlineProvider:e}=await import(`./AiInlineProvider-CslJGmO0.js`);return{registerAiInlineProvider:e}},__vite__mapDeps([2,3]),import.meta.url).then(({registerAiInlineProvider:e})=>{this.monaco&&b()&&!this.inlineProviderDisposable&&(this.inlineProviderDisposable=e(this.monaco,this.props.socket,this.props.runningInstances))}).catch(()=>{}),this.props.onAiAction&&!this.codeLensDisposable&&v(async()=>{let{registerAiCodeLensProvider:e}=await import(`./index-_7Mh4AxK.js`).then(e=>e.i);return{registerAiCodeLensProvider:e}},__vite__mapDeps([4,5]),import.meta.url).then(({registerAiCodeLensProvider:e})=>{this.monaco&&this.editor&&this.props.onAiAction&&b()&&!this.codeLensDisposable&&(this.codeLensDisposable=e(this.monaco,this.editor,(e,t,n,r,i)=>{var a,o,s;let c=(a=this.editor)==null?void 0:a.getModel(),l=c?c.getLineMaxColumn(Math.min(i,c.getLineCount())):1;(o=(s=this.props).onAiAction)==null||o.call(s,{action:e,code:t,rangeLabel:n,range:{startLine:r,startColumn:1,endLine:i,endColumn:l},kind:`codelens`})}))}).catch(()=>{}))}disposeAiHelpers(){var e,t,n,r;(e=this.stateHoverDisposable)==null||e.dispose(),this.stateHoverDisposable=null,(t=this.cronHoverDisposable)==null||t.dispose(),this.cronHoverDisposable=null,(n=this.inlineProviderDisposable)==null||n.dispose(),this.inlineProviderDisposable=null,(r=this.codeLensDisposable)==null||r.dispose(),this.codeLensDisposable=null}componentWillUnmount(){var e,t,n,r,i,a,o,s,c,l;if(this.unmounted=!0,(e=this.contentChangeDisposable)==null||e.dispose(),this.contentChangeDisposable=null,(t=this.mouseDownDisposable)==null||t.dispose(),this.mouseDownDisposable=null,(n=this.datapointProviderDisposable)==null||n.dispose(),this.datapointProviderDisposable=null,v(async()=>{let{clearDatapointCache:e}=await import(`./AiDatapointProvider-DzFpUKkT.js`);return{clearDatapointCache:e}},[],import.meta.url).then(({clearDatapointCache:e})=>e()).catch(()=>{}),(r=this.inlineProviderDisposable)==null||r.dispose(),this.inlineProviderDisposable=null,(i=this.stateHoverDisposable)==null||i.dispose(),this.stateHoverDisposable=null,(a=this.showStateValueDisposable)==null||a.dispose(),this.showStateValueDisposable=null,v(async()=>{let{clearStateHoverCache:e}=await import(`./stateHoverProvider-BfhQov29.js`);return{clearStateHoverCache:e}},__vite__mapDeps([0]),import.meta.url).then(({clearStateHoverCache:e})=>e()).catch(()=>{}),(o=this.cronHoverDisposable)==null||o.dispose(),this.cronHoverDisposable=null,(s=this.codeLensDisposable)==null||s.dispose(),this.codeLensDisposable=null,(c=this.aiHelpersUnsubscribe)==null||c.call(this),this.aiHelpersUnsubscribe=null,(l=this.inlineChatWidgetInstance)==null||l.dispose(),this.inlineChatWidgetInstance=null,this.hideInlineDiff(),this.editor){var u,d;(u=(d=this.props).onRegisterSelect)==null||u.call(d,null),this.editor.dispose(),this.editor=null}}async doPrettier(){var e;let t=this.props.runningInstances&&Object.keys(this.props.runningInstances).find(e=>{var t;return(t=this.props.runningInstances)==null?void 0:t[e]});if(!t){window.alert(p.t(`No script adapter instance found to format the code`));return}let n=await this.props.socket.sendTo(t.replace(`system.adapter.`,``),`prettier`,{code:(e=this.editor)==null?void 0:e.getValue(),type:this.state.language});if(n.error)this.setState({showError:{title:p.t(`Error formatting code`),message:D(n.error)}});else if(n.code){var r,i,a;(r=this.editor)==null||r.setValue(n.code),(i=(a=this.props).onChange)==null||i.call(a,n.code),this.showDecorators()}}setEditorLanguage(e){if(!this.editor)return;let t=this.editor.getModel();if(t){var n;let i=t.getValue(),a=t.uri.path,o=typeof a==`string`&&a.includes(`.`)?a.substring(0,a.lastIndexOf(`.`)):`index`,s=e===`javascript`?`js`:e===`typescript`?`ts`:e;t.dispose();let c=e===`javascript`||e===`typescript`?`typescript`:e,l=(n=this.monaco)==null?void 0:n.editor.createModel(i,c,this.monaco.Uri.from({scheme:window.location.protocol.replace(`:`,``),path:`${o}${E++}.${s}`}));if(l){var r;this.editor.setModel(l),(r=this.contentChangeDisposable)==null||r.dispose(),this.contentChangeDisposable=this.editor.onDidChangeModelContent(()=>this.onChange())}}}setTypeCheck(e){var t,n;let r={noSemanticValidation:!this.state.alive||!e,noSyntaxValidation:!this.state.alive};(t=this.monacoTS)==null||t.typescriptDefaults.setDiagnosticsOptions(r),(n=this.monacoTS)==null||n.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!this.state.alive||!e,noSyntaxValidation:!this.state.alive})}setEditorTypings(e=``){var t,n;let r=T(e),i=`${e}.d.ts`,a=[];for(let e of Object.keys(this.typings))r&&(e===`global.d.ts`||e.startsWith(`script.js.global`)&&e!==i)||a.push({filePath:e,content:this.typings[e]});if((t=this.monacoTS)!=null&&(t=t.typescriptDefaults)!=null&&t.setExtraLibs)this.monacoTS.typescriptDefaults.setExtraLibs(a);else if((n=this.monacoTS)!=null&&(n=n.typescriptDefaults)!=null&&n.addExtraLib){let e=this.monacoTS.typescriptDefaults.getExtraLibs();a.forEach(t=>{!e[t.filePath]&&this.monaco&&this.monacoTS.typescriptDefaults.addExtraLib(t.content,t.filePath)})}}undo(){var e;(e=this.editor)==null||e.trigger(`toolbar`,`undo`,null)}redo(){var e;(e=this.editor)==null||e.trigger(`toolbar`,`redo`,null)}insertTextIntoEditor(e){if(!this.editor||!this.monaco)return;let t=this.editor.getSelection();if(t){let n=new this.monaco.Range(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn);this.editor.executeEdits(``,[{range:n,text:e,forceMoveMarkers:!0}])}this.editor.focus()}highlightText(e){var t;if(!this.editor||!this.monaco)return 0;let n=e?(t=this.editor.getModel())==null?void 0:t.findMatches(e,!0,!1,!1,null,!0):void 0;if(n!=null&&n.length)return n.forEach(e=>{var t;return(t=this.editor)==null?void 0:t.setSelection(e.range)}),this.editor.revealLine(n[0].range.startLineNumber),n.length;let r=this.editor.getPosition();if(r){let e=r.lineNumber,t=r.column;this.editor.setSelection(new this.monaco.Range(e,t,e,t))}return 0}showInlineDiff(e){if(!this.editor||!this.monaco)return;let t=this.editor,n=this.monaco;this.hideInlineDiff(),v(async()=>{let{InlineDiffController:e,INLINE_DIFF_CSS:t}=await import(`./inlineDiffController-VazWO1wi.js`);return{InlineDiffController:e,INLINE_DIFF_CSS:t}},__vite__mapDeps([6,7]),import.meta.url).then(({InlineDiffController:r,INLINE_DIFF_CSS:i})=>{if(!this.inlineDiffCssInjected){let e=document.createElement(`style`);e.textContent=i,e.setAttribute(`data-iob-aichat`,`inline-diff`),document.head.appendChild(e),this.inlineDiffCssInjected=!0}let a=new r(t,n,{range:e.range,originalText:e.originalText,modifiedText:e.modifiedText,onAccepted:()=>{var t;this.inlineDiffInstance=null,(t=e.onAccepted)==null||t.call(e)},onRejected:()=>{var t;this.inlineDiffInstance=null,(t=e.onRejected)==null||t.call(e)}});this.inlineDiffInstance=a,a.show()}).catch(()=>{})}hideInlineDiff(){if(this.inlineDiffInstance){try{this.inlineDiffInstance.dispose()}catch{}this.inlineDiffInstance=null}}showInlineChatWidget(){if(!this.editor||!this.monaco||!this.props.onInlineAsk)return;if(this.inlineChatWidgetInstance){this.inlineChatWidgetInstance.show();return}let e=this.editor,t=this.monaco,n=this.props.onInlineAsk,r=this.props.onAiAction;v(async()=>{let{InlineChatWidget:e}=await import(`./inlineChatWidget-BfjarD99.js`);return{InlineChatWidget:e}},__vite__mapDeps([8,7]),import.meta.url).then(({InlineChatWidget:i})=>{let a=new i(e,t,{onSubmit:async e=>n({question:e.question,selectedCode:e.selectedCode}),onEscalateToChat:e=>{r&&r({action:`ask`,code:e.selectedCode,question:e.question,rangeLabel:e.range?`lines ${e.range.startLineNumber}-${e.range.endLineNumber}`:`whole file`})}});this.inlineChatWidgetInstance=a,a.show()}).catch(()=>{})}registerAiActions(){if(!this.editor||!this.monaco||!this.props.onAiAction)return;let e=this.monaco,t=(t,n={})=>{if(!this.editor||!this.props.onAiAction)return;let r=this.editor.getModel();if(!r)return;let i=this.editor.getSelection(),a=i&&!i.isEmpty(),o,s,c,l=`selection`;if(a)o=r.getValueInRange(i),s=i.startLineNumber===i.endLineNumber?`line ${i.startLineNumber}`:`lines ${i.startLineNumber}-${i.endLineNumber}`,c={startLine:i.startLineNumber,startColumn:i.startColumn,endLine:i.endLineNumber,endColumn:i.endColumn},l=`selection`;else{let t=this.editor.getPosition(),n=null;if(t)try{n=y(r.getValue(),t.lineNumber)}catch{}if(n){let t=n.startLine,i=n.endLine,a=r.getLineMaxColumn(i),u=new e.Range(t,1,i,a);o=r.getValueInRange(u),s=t===i?`line ${t}`:`lines ${t}-${i}`,c={startLine:t,startColumn:1,endLine:i,endColumn:a},l=`codelens`}else o=r.getValue(),s=`whole file`,l=`none`}this.props.onAiAction({action:t,code:o,rangeLabel:s,range:c,kind:l,...n})},n=[{id:`iobroker.ai.inline`,label:`🤖 ${p.t(`AI: Inline chat…`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyI],order:1,run:()=>{if(this.props.onInlineAsk)this.showInlineChatWidget();else{let e=window.prompt(p.t(`Ask the AI about the selected code:`));e&&e.trim()&&t(`ask`,{question:e.trim()})}}},{id:`iobroker.ai.explain`,label:`💡 ${p.t(`AI: Explain`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyE],order:2,run:()=>t(`explain`)},{id:`iobroker.ai.refactor`,label:`🔧 ${p.t(`AI: Refactor`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyR],order:3,run:()=>t(`refactor`)},{id:`iobroker.ai.comment`,label:`💬 ${p.t(`AI: Add comments`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyC],order:4,run:()=>t(`comment`)},{id:`iobroker.ai.fix`,label:`🛠️ ${p.t(`AI: Fix problem`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyF],order:5,run:()=>{let n;try{var r,i;let t=(r=this.editor)==null?void 0:r.getModel(),a=(i=this.editor)==null?void 0:i.getPosition();if(t&&a){let r=e.editor.getModelMarkers({resource:t.uri}).find(e=>a.lineNumber>=e.startLineNumber&&a.lineNumber<=e.endLineNumber);r&&(n=r.message)}}catch{}t(`fix`,{diagnostic:n})}},{id:`iobroker.ai.tests`,label:`✅ ${p.t(`AI: Suggest tests`)}`,order:6,run:()=>t(`tests`)}];for(let e of n)try{this.editor.addAction({id:e.id,label:e.label,contextMenuGroupId:`aichat`,contextMenuOrder:e.order,keybindings:e.keybindings,run:()=>e.run()})}catch{}}getEditorSelection(){if(!this.editor)return null;let e=this.editor.getSelection();if(!e||e.isEmpty())return null;let t=this.editor.getModel();return t?{text:t.getValueInRange(e),range:{startLine:e.startLineNumber,startColumn:e.startColumn,endLine:e.endLineNumber,endColumn:e.endColumn}}:null}getEditorContent(){var e;return((e=this.editor)==null||(e=e.getModel())==null?void 0:e.getValue())??``}setEditorContent(e){var t;let n=(t=this.editor)==null?void 0:t.getModel();this.editor&&n&&(this.editor.pushUndoStop(),this.editor.executeEdits(`iobroker-set-content`,[{range:n.getFullModelRange(),text:e,forceMoveMarkers:!0}]),this.editor.pushUndoStop())}getWordAtCursor(){var e,t,n;let r=(e=this.editor)==null?void 0:e.getModel(),i=(t=this.editor)==null?void 0:t.getSelection();if(!r||!i)return null;if(!i.isEmpty()){let e=r.getValueInRange(i).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}return((n=r.getWordAtPosition(i.getPosition()))==null?void 0:n.word)??null}getCursorPosition(){var e;let t=(e=this.editor)==null?void 0:e.getPosition();return t?{line:t.lineNumber,column:t.column}:null}highlightLineRange(e,t){if(!this.editor||!this.monaco)return!1;let n=this.editor.getModel();if(!n)return!1;let r=n.getLineCount(),i=Math.max(1,Math.min(e,r)),a=Math.max(i,Math.min(t,r)),o=n.getLineMaxColumn(a);return this.editor.setSelection(new this.monaco.Range(i,1,a,o)),this.editor.revealLineInCenter(i),!0}goToLine(e,t=1){if(!this.editor||!this.monaco)return!1;let n=this.editor.getModel();if(!n)return!1;let r=n.getLineCount(),i=Math.max(1,Math.min(e,r));return this.editor.setPosition({lineNumber:i,column:t}),this.editor.revealLineInCenter(i),this.editor.focus(),!0}replaceSelection(e){if(!this.editor||!this.monaco)return!1;let t=this.editor.getSelection();if(!t)return!1;let n=new this.monaco.Range(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn);return this.editor.executeEdits(``,[{range:n,text:e,forceMoveMarkers:!0}]),this.editor.focus(),!0}getDiagnostics(){if(!this.editor||!this.monaco)return[];let e=this.editor.getModel();if(!e)return[];let t=this.monaco.editor.getModelMarkers({resource:e.uri}),n={8:`error`,4:`warning`,2:`info`,1:`hint`};return t.map(e=>({line:e.startLineNumber,column:e.startColumn,endLine:e.endLineNumber,endColumn:e.endColumn,severity:n[e.severity]||`info`,message:e.message,...e.source?{source:e.source}:{}}))}async getDocumentSymbols(){if(!this.editor||!this.monaco)return[];let e=this.editor.getModel();if(!e)return[];let t=[];try{var n;let r=this.monaco.languages,i=(n=r.getDocumentSymbolProviders)==null?void 0:n.call(r,e);if(i!=null&&i.length){let n={0:`file`,1:`module`,2:`namespace`,3:`package`,4:`class`,5:`method`,6:`property`,7:`field`,8:`constructor`,9:`enum`,10:`interface`,11:`function`,12:`variable`,13:`constant`,14:`string`,15:`number`,16:`boolean`,17:`array`,18:`object`,19:`key`,20:`null`,21:`enum-member`,22:`struct`,23:`event`,24:`operator`,25:`type-parameter`};for(let r of i){let i=await r.provideDocumentSymbols(e,{isCancellationRequested:!1});if(!i)continue;let a=e=>{for(let i of e){var r;t.push({name:i.name,kind:n[i.kind]||String(i.kind),line:i.range.startLineNumber,endLine:i.range.endLineNumber,...i.detail?{detail:i.detail}:{}}),(r=i.children)!=null&&r.length&&a(i.children)}};if(a(i),t.length)break}}}catch{}if(t.length===0){let n=e.getValue().split(`
3
- `),r=[{re:/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/,kind:`function`},{re:/^(?:export\s+)?class\s+(\w+)/,kind:`class`},{re:/^(?:export\s+)?(?:const|let|var)\s+(\w+)/,kind:`variable`}];for(let e=0;e<n.length;e++){let i=n[e].trim();for(let{re:n,kind:a}of r){let r=n.exec(i);if(r!=null&&r[1]){t.push({name:r[1],kind:a,line:e+1,endLine:e+1});break}}}}return t}showDecorators(){var e;let t=[];if(this.location&&this.monaco&&(t.push({range:new this.monaco.Range(this.location.lineNumber+1,(this.location.columnNumber||0)+1,this.location.lineNumber+1,1e3),options:{isWholeLine:!1,className:this.props.isDark?`monacoCurrentLineDark`:`monacoCurrentLine`}}),t.push({range:new this.monaco.Range(this.location.lineNumber+1,0,this.location.lineNumber+1,0),options:{isWholeLine:!0,className:this.props.isDark?`monacoCurrentFullLineDark`:`monacoCurrentFullLine`}})),(e=this.breakpoints)==null||e.forEach(e=>{this.monaco&&t.push({range:new this.monaco.Range(e.location.lineNumber+1,0,e.location.lineNumber+1,100),options:{isWholeLine:!0,glyphMarginClassName:this.props.isDark?`monacoBreakPointDark`:`monacoBreakPoint`}})}),this.editor){let e=this.editor.getModel();e&&(this.decorations=e.deltaDecorations(this.decorations,t))}}initNewScript(e,t){var n;this.setState({name:e}),this.originalCode=t||``,(n=this.editor)==null||n.setValue(t||``),this.highlightText(this.lastSearch),this.showDecorators(),this.setEditorTypings(e)}scrollToLineIfNeeded(e){if(this.editor){let t=this.editor.getVisibleRanges();(!t||!t[0]||t[0].startLineNumber>e||e>t[0].endLineNumber)&&this.editor.revealLineInCenter(e)}}UNSAFE_componentWillReceiveProps(e){let t={};this.state.name!==e.name&&this.initNewScript(e.name,e.code),JSON.stringify(e.runningInstances)!==this.runningInstancesStr&&(this.runningInstancesStr=JSON.stringify(e.runningInstances),this.state.typingsLoaded||this.loadTypings(e.runningInstances)),this.editor?!e.changed&&(e.code!==this.originalCode||e.code!==this.editor.getValue())&&(this.originalCode=e.code||``,this.editor.setValue(this.originalCode),this.showDecorators(),this.location&&this.scrollToLineIfNeeded(this.location.lineNumber+1)):this.originalCode=e.code||``,e.searchText!==this.lastSearch&&(this.lastSearch=e.searchText||``,this.highlightText(this.lastSearch)),JSON.stringify(e.location)!==JSON.stringify(this.location)&&JSON.stringify(e.breakpoints)!==JSON.stringify(this.breakpoints)?(this.location=e.location||void 0,this.breakpoints=e.breakpoints,this.showDecorators(),this.editor&&this.location&&this.scrollToLineIfNeeded(this.location.lineNumber+1)):JSON.stringify(e.breakpoints)===JSON.stringify(this.breakpoints)?JSON.stringify(e.location)!==JSON.stringify(this.location)&&(this.location=e.location||void 0,this.showDecorators(),this.editor&&this.location&&this.scrollToLineIfNeeded(this.location.lineNumber+1)):(this.breakpoints=e.breakpoints,this.showDecorators()),this.state.language===(e.language||`javascript`)?this.state.readOnly===(e.readOnly||!1)?this.state.isDark!==(e.isDark||!1)&&(this.setState({isDark:e.isDark||!1}),t.isDark=e.isDark):(this.setState({readOnly:e.readOnly||!1}),t.readOnly=e.readOnly):(this.setState({language:e.language||`javascript`}),t.language=e.language||`javascript`),this.setEditorOptions(t),e.aiCompletionsEnabled!==this.props.aiCompletionsEnabled&&(e.aiCompletionsEnabled&&this.monaco&&b()?this.inlineProviderDisposable||v(async()=>{let{registerAiInlineProvider:e}=await import(`./AiInlineProvider-CslJGmO0.js`);return{registerAiInlineProvider:e}},__vite__mapDeps([2,3]),import.meta.url).then(({registerAiInlineProvider:e})=>{this.monaco&&b()&&!this.inlineProviderDisposable&&(this.inlineProviderDisposable=e(this.monaco,this.props.socket,this.props.runningInstances))}).catch(()=>{}):!e.aiCompletionsEnabled&&this.inlineProviderDisposable&&(this.inlineProviderDisposable.dispose(),this.inlineProviderDisposable=null)),this.insert!==e.insert&&(this.insert=e.insert||``,this.insert&&(console.log(`Insert text: ${this.insert}`),setTimeout(e=>{this.insertTextIntoEditor(e),setTimeout(()=>this.props.onInserted&&this.props.onInserted(),100)},100,this.insert)))}onChange(){if(!this.props.readOnly&&this.editor){var e,t;(e=(t=this.props).onChange)==null||e.call(t,this.editor.getValue())}}renderErrorDialog(){return this.state.showError?this.state.showError.full?_(c,{open:!0,maxWidth:`md`,onClose:()=>this.setState({showError:null}),children:[f(l,{children:this.state.showError.title||p.t(`Error`)}),f(g,{children:f(`pre`,{children:f(`code`,{children:this.state.showError.message})})}),f(d,{children:_(s,{variant:`contained`,startIcon:f(i,{}),onClick:()=>this.setState({showError:null}),children:[p.t(`Close`),` `]})})]}):f(o,{open:!0,autoHideDuration:5e3,onClose:()=>this.setState({showError:null}),message:this.state.showError.title,action:_(m.Fragment,{children:[f(s,{color:`secondary`,size:`small`,onClick:()=>this.setState({showError:{...this.state.showError,full:!0}}),children:p.t(`More`)}),f(a,{size:`small`,"aria-label":`close`,color:`inherit`,onClick:()=>this.setState({showError:null}),children:f(i,{fontSize:`small`})})]})}):null}render(){var e;return!((e=this.monacoTS)!=null&&e.typescriptDefaults)||!this.props.runningInstances?this.state.showError?this.renderErrorDialog():f(n,{}):(this.props.triggerPrettier!==this.triggerPrettier&&(this.triggerPrettier=this.props.triggerPrettier,setTimeout(()=>this.doPrettier().catch(e=>console.error(`Error formatting code:`,e)),50)),_(`div`,{ref:this.monacoDiv,style:{...this.props.style,width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`},children:[this.renderErrorDialog(),!this.state.check&&f(u,{size:`small`,title:p.t(`Check is not active, because javascript adapter is disabled`),style:{bottom:10,right:10,opacity:.5,position:`absolute`,zIndex:1,background:`red`,color:`white`},color:`secondary`,children:f(t,{})})]}))}};export{w as n,O as t};
@@ -1 +0,0 @@
1
- import{Xn as e,lr as t}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";var n=e(t(`path`,{d:`M2.01 21 23 12 2.01 3 2 10l15 2-15 2z`}),`Send`);export{n as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./vite-preload-helper-BbbETgeG.js";import"./dist-CSJEdwl2.js";var t=e=>{let t=e;for(let e=0;e<5;e++){let e=t==null?void 0:t.default;if(!e||typeof e!=`object`||Object.keys(e).length===0)break;let n=Object.getPrototypeOf(e);if(n!==null&&n!==Object.prototype)break;let r=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(r.length>0&&r.some(e=>e!==void 0))break;t=e}return t},n=(e,t,n,r)=>{var i,a;let o=(i=globalThis.__mf_module_cache__)==null?void 0:i.share,s=t.map(e=>o==null?void 0:o[e]).find(e=>e!==void 0),c=e=>{let t=String(e||``).split(/[^0-9]+/).map(Number),r=String(n||``).split(/[^0-9]+/).map(Number);for(let e=0;e<Math.max(t.length,r.length);e++){if((t[e]||0)<(r[e]||0))return!0;if((t[e]||0)>(r[e]||0))return!1}return!1};if(!c((s==null?void 0:s.version)??(s==null||(a=s.default)==null?void 0:a.version)))for(let t of e){var l,u;let e=o==null?void 0:o[t];if(e===void 0)continue;let n=(e==null?void 0:e.version)??(e==null||(l=e.default)==null?void 0:l.version);if(!(n!==void 0&&c(n))&&(!r||typeof(e==null?void 0:e[r])==`function`||typeof(e==null||(u=e.default)==null?void 0:u[r])==`function`))return e}},r={react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js`).then(e=>(e.Rr(),e.Lr)),[],import.meta.url),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js`).then(e=>e.dr),[],import.meta.url),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js`).then(e=>e.Yn),[],import.meta.url),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BCLgOrQh.js`).then(e=>e.n),[],import.meta.url),"prop-types":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js`).then(e=>e.ar),[],import.meta.url),"@mui/material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js`).then(e=>e.qn),[],import.meta.url),"@iobroker/gui-components":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js`).then(e=>e.b),[],import.meta.url)},i={react:{name:`react`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`iobroker_javascript`,canLiveRebind:!0,get(){let e=i.react;return e.lib?e.lib:(e.loading||=(async()=>{try{let{react:n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`iobroker_javascript`,canLiveRebind:!0,get(){let e=i[`react/jsx-runtime`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react/jsx-runtime`,`react/jsx-runtime`],[`default:react`,`react`],`19.3.0`,void 0);return a===void 0?(e.loading=(async()=>{try{let{"react/jsx-runtime":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom":{name:`react-dom`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`iobroker_javascript`,canLiveRebind:!0,get(){let e=i[`react-dom`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"react-dom":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom/client":{name:`react-dom/client`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`iobroker_javascript`,canLiveRebind:!0,get(){let e=i[`react-dom/client`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react-dom/client`,`react-dom/client`,`default:react-dom`,`react-dom`],[`default:react`,`react`],`19.3.0`,`createRoot`);return a===void 0?(e.loading=(async()=>{try{let{"react-dom/client":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"prop-types":{name:`prop-types`,version:`15.8.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`iobroker_javascript`,canLiveRebind:!0,get(){let e=i[`prop-types`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"prop-types":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/material":{name:`@mui/material`,version:`9.5.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`iobroker_javascript`,canLiveRebind:!0,get(){let e=i[`@mui/material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/gui-components":{name:`@iobroker/gui-components`,version:`10.3.9`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`iobroker_javascript`,canLiveRebind:!0,get(){let e=i[`@iobroker/gui-components`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/gui-components":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}}},a=[];export{a as usedRemotes,i as usedShared};
@@ -1 +0,0 @@
1
- import{t as e}from"./AiChatPanel-Bh1UgzLN.js";export{e as buildActionPrompt};
@@ -1 +0,0 @@
1
- import{nr as e}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";var t={};function n(n){if(t[n.name])return t[n.name];let r=n.palette.background.default,i=n.palette.background.paper===r?e(r,.07):n.palette.background.paper,a=e(i,.07),o=`iob-${n.name}`;return t[n.name]=window.Blockly.Theme.defineTheme(o,{name:o,base:window.Blockly.Themes.Classic,componentStyles:{workspaceBackgroundColour:r,toolboxBackgroundColour:a,toolboxForegroundColour:n.palette.text.primary,flyoutBackgroundColour:i,flyoutForegroundColour:n.palette.text.secondary,flyoutOpacity:1,scrollbarColour:e(r,.35),scrollbarOpacity:.4,insertionMarkerColour:e(r,.9),insertionMarkerOpacity:.3,cursorColour:e(r,.75)}}),t[n.name]}export{n as t};
@@ -1,2 +0,0 @@
1
- import{m as e,y as t}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";var n=[`'`,`"`,"`"],r=/^@(annually|yearly|monthly|weekly|daily|midnight|hourly|reboot)$/i,i=/^[0-9A-Za-z*/,?#\-LW]+$/;function a(e){let t=e.trim();if(!t)return!1;if(r.test(t))return!0;let n=t.split(/\s+/);return n.length<5||n.length>7||!n.every(e=>i.test(e))?!1:/[\d*/]/.test(t)}function o(e,t){if(!e)return null;let r=Math.max(1,Math.min(t,e.length+1))-1,i=null,o=-1;for(let t=r-1;t>=0;t--){let r=e[t];if(n.includes(r)&&e[t-1]!==`\\`){let n=0;for(let i=0;i<t;i++)e[i]===r&&e[i-1]!==`\\`&&n++;if(n%2==0){i=r,o=t;break}}}if(i===null||o<0)return null;let s=-1;for(let t=o+1;t<e.length;t++)if(e[t]===i&&e[t-1]!==`\\`){s=t;break}if(s<0||r<o||r>s)return null;let c=e.substring(o+1,s);return a(c)?{expression:c.trim(),startColumn:o+2,endColumn:s+1}:null}function s(n,r){try{return t(n,r||e.getLanguage())||null}catch{return null}}function c(t){let n=e.t(`Second`),r=e.t(`Minute`),i=e.t(`Hour`),a=e.t(`Day of month`),o=e.t(`Month`),s=e.t(`Day of week`),c=e.t(`Year`);return t===7?[n,r,i,a,o,s,c]:t===6?[n,r,i,a,o,s]:[r,i,a,o,s]}function l(t,n){let i=[];i.push(`**⏰ ${e.t(`Cron expression`)}** · \`${t}\``),i.push(``,`**${n}**`);let a=t.split(/\s+/);if(!r.test(t)&&a.length>=5&&a.length<=7){let e=c(a.length);i.push(``),a.forEach((t,n)=>{i.push(`- \`${t}\` — ${e[n]}`)})}return i.join(`
2
- `)}function u(e){let t=[];for(let n of[`javascript`,`typescript`]){let r=e.languages.registerHoverProvider(n,{provideHover:(t,n)=>{let r=o(t.getLineContent(n.lineNumber),n.column);if(!r)return null;let i=s(r.expression);if(!i)return null;let a=l(r.expression,i);return{range:new e.Range(n.lineNumber,r.startColumn,n.lineNumber,r.endColumn),contents:[{value:a,isTrusted:!1,supportHtml:!1}]}}});t.push(r)}return{dispose(){t.forEach(e=>{try{e.dispose()}catch{}})}}}export{u as registerCronHoverProvider};
@@ -1 +0,0 @@
1
- import{sr as e}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{d as t,n}from"./blockly-B0t_IRJQ.js";var r=class extends n{constructor(t){super(t),e(this,`FONTSIZE`,void 0),e(this,`CURSOR`,void 0),e(this,`SERIALIZABLE`,void 0),e(this,`spellcheck_`,void 0),this.FONTSIZE=11,this.CURSOR=`pointer`,this.SERIALIZABLE=!0,this.spellcheck_=!1}dispose(){t.hideIfOwner(this),super.dispose()}setValue(e){e!==null&&super.setValue(e)}showEditor_(){window.main.cronDialog(this.getValue(),e=>{e!=null&&this.setValue(e)})}};function i(){window.Blockly.FieldCRON=r}export{r as FieldCRON,i as install};
@@ -1 +0,0 @@
1
- import{sr as e}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{d as t,n}from"./blockly-B0t_IRJQ.js";var r=`http://www.w3.org/2000/svg`,i=`http://www.w3.org/1999/xlink`,a=16,o=class o extends n{constructor(t,n){super(t),e(this,`FONTSIZE`,void 0),e(this,`CURSOR`,void 0),e(this,`SERIALIZABLE`,void 0),e(this,`spellcheck_`,void 0),e(this,`maxDisplayLength`,void 0),e(this,`_type`,void 0),e(this,`_idName`,null),e(this,`_iconElement`,null),e(this,`_iconUrl`,null),e(this,`_showValue`,!1),e(this,`_stateValueText`,null),e(this,`_valueBadge`,null),e(this,`_hoverHandler`,null),e(this,`_disposed`,!1),this._type=n,this.FONTSIZE=11,this.CURSOR=`pointer`,this.SERIALIZABLE=!0,this.spellcheck_=!1,this.maxDisplayLength=200}dispose(){this._disposed=!0,t.hideIfOwner(this),this.fieldGroup_&&this._hoverHandler&&(this.fieldGroup_.removeEventListener(`mouseenter`,this._hoverHandler),this._hoverHandler=null),this._valueBadge&&=(this._valueBadge.remove(),null),super.dispose()}initView(){super.initView();let e=this.getValue();e&&this.updateIcon_(e),this.fieldGroup_&&!this._hoverHandler&&(this._hoverHandler=()=>this._fetchStateValue(),this.fieldGroup_.addEventListener(`mouseenter`,this._hoverHandler)),this._ensureValueBadge()}static _objects(){var e;return(e=window.main)==null?void 0:e.objects}static _resolveObjectName(e){var t;let n=o._objects();if(!(n!=null&&(t=n[e])!=null&&(t=t.common)!=null&&t.name))return null;let r=n[e].common.name;return typeof r==`object`&&(r=r[window.systemLang]||r.en),r||null}static computeDisplayText(e,t){var r;let i=o.displayMode,a=o._objects(),s;switch(i){case 1:{let t=e.split(`.`),n=[];for(let e=0;e<t.length;e++){let r=t.slice(0,e+1).join(`.`),i=o._resolveObjectName(r);n.push(i||t[e])}s=n.join(`.`);break}case 2:s=e.split(`.`).pop()||e;break;case 3:s=e;break;default:s=o._resolveObjectName(e)||e}return a!=null&&(r=a[e])!=null&&r.type&&![`state`,`meta`,`script`].includes(a[e].type)&&(s+=` (${a[e].type})`),t&&s.length>t&&(s=`${s.substring(0,t-2)}…`),s=s.replace(/\s/g,n.NBSP),s||n.NBSP}refreshDisplay(){let e=this.getValue();e&&(this._idName=o.computeDisplayText(e,this.maxDisplayLength),this.updateIcon_(e),this.forceRerender(),o.displayMode===1&&this._resolvePathNamesAsync(e))}_resolvePathNamesAsync(e){var t;if(typeof((t=window.main)==null?void 0:t.getObject)!=`function`)return;let n=o._objects(),r=e.split(`.`),i=0,a=!1;for(let t=0;t<r.length;t++){let s=r.slice(0,t+1).join(`.`);n[s]||(i++,window.main.getObject(s,(t,r)=>{r&&(n[r._id]=n[r._id]||r,a=!0),i--,i===0&&a&&(this._idName=o.computeDisplayText(e,this.maxDisplayLength),this.forceRerender())}))}}_getIconOffset(){return o.showIcon&&this._iconElement?20:0}updateSize_(e){let t=this.getConstants();if(!t)return;let n=e===void 0?this.isFullBlockField()?0:t.FIELD_BORDER_RECT_X_PADDING:e,r=this._getIconOffset(),i=this._getBadgeOffset(),a=0;this.textElement_&&(a=this.textElement_.getComputedTextLength());let o=2*n+a+r+i,s=t.FIELD_TEXT_HEIGHT;this.isFullBlockField()||(s=Math.max(s,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=s,this.size_.width=o,this.positionTextElement_(n+r,a),this.positionBorderRect_(),this._positionValueBadge(o,n,s)}updateIcon_(e){if(!this.fieldGroup_)return;if(!o.showIcon){this._iconElement&&(this._iconElement.remove(),this._iconElement=null,this._iconUrl=null);return}let t=o.resolveIcon(e);t&&this._applyIcon(t),this._resolveIconAsync(e)}_applyIcon(e){this.fieldGroup_&&e&&(this._iconUrl===e&&this._iconElement||(this._iconUrl=e,this._iconElement||(this._iconElement=document.createElementNS(r,`image`),this._iconElement.setAttribute(`width`,String(a)),this._iconElement.setAttribute(`height`,String(a)),this.textElement_?this.fieldGroup_.insertBefore(this._iconElement,this.textElement_):this.fieldGroup_.appendChild(this._iconElement)),this._iconElement.setAttributeNS(i,`xlink:href`,e),this._positionIcon()))}_positionIcon(){if(this._iconElement&&this.textElement_)try{let e=this.getConstants(),t=this.borderRect_&&e?e.FIELD_BORDER_RECT_X_PADDING:0;this._iconElement.setAttribute(`x`,String(t+2));let n=this.textElement_.getBBox();if(n.height>0){let e=n.y+n.height/2;this._iconElement.setAttribute(`y`,String(e-a/2))}}catch{}}_resolveIconAsync(e){var t;if(!o.showIcon||typeof((t=window.main)==null?void 0:t.getObject)!=`function`)return;let n=o._objects(),r=e.split(`.`),i=r[0],a=e=>{if(e<1)return;let t=r.slice(0,e).join(`.`);if(n[t]){var s;if((s=n[t].common)!=null&&s.icon){this._applyIcon(o._buildIconUrl(n[t].common.icon,i));return}a(e-1);return}window.main.getObject(t,(t,r)=>{let s=r;if(s){var c;if(n[s._id]=n[s._id]||s,(c=s.common)!=null&&c.icon){this._applyIcon(o._buildIconUrl(s.common.icon,i));return}}a(e-1)})};a(r.length)}static _formatStateValue(e,t){var n;if((t==null?void 0:t.val)===void 0||(t==null?void 0:t.val)===null)return`null`;let r;if(typeof t.val==`object`)try{r=JSON.stringify(t.val)}catch{r=String(t.val)}else r=String(t.val);r.length>60&&(r=`${r.substring(0,60)}…`);let i=(n=o._objects())==null||(n=n[e])==null?void 0:n.common;return i!=null&&i.unit&&(r+=` ${i.unit}`),t.ack===!1&&(r+=` (?)`),r}_fetchStateValue(e){var t;let n=this.getValue();if(!n||typeof((t=window.main)==null?void 0:t.getState)!=`function`){e==null||e();return}window.main.getState(n,(t,r)=>{this._disposed||(this._stateValueText=r?o._formatStateValue(n,r):null,e==null||e())})}_composeTooltip(){let e=this.getValue();if(!e)return``;let t=o._resolveObjectName(e),n=t?`${t}\n${e}`:e;return this._stateValueText&&(n+=`\n= ${this._stateValueText}`),n}_getBadgeOffset(){return this._valueBadge?18:0}_ensureValueBadge(){var e;if(this._type!==`state`||this._valueBadge||!this.fieldGroup_||!this.getValue())return;let t=document.createElementNS(r,`text`);t.setAttribute(`class`,`blocklyText`),t.setAttribute(`text-anchor`,`middle`),t.style.fill=`#2196f3`,t.style.fontWeight=`bold`,t.style.cursor=`pointer`,t.textContent=`=`;let n=document.createElementNS(r,`title`);n.textContent=`Show/hide current value`,t.appendChild(n);let i=e=>e.stopPropagation();t.addEventListener(`pointerdown`,i),t.addEventListener(`mousedown`,i),t.addEventListener(`click`,e=>{e.stopPropagation(),this._toggleValue()}),this._valueBadge=t,this.fieldGroup_.appendChild(t),(e=this.getSourceBlock())!=null&&e.rendered&&this.forceRerender()}_positionValueBadge(e,t,n){this._valueBadge&&(this._valueBadge.setAttribute(`x`,String(e-t-9)),this._valueBadge.setAttribute(`y`,String(n/2+4)))}_toggleValue(){this._showValue=!this._showValue,this._valueBadge&&(this._valueBadge.textContent=this._showValue?`×`:`=`),this._showValue?(this._stateValueText=this._stateValueText||`…`,this.forceRerender(),this._fetchStateValue(()=>this.forceRerender())):this.forceRerender()}setValue(e){var t;if(e===null)return;let r=o._objects();r&&!r[e]&&typeof((t=window.main)==null?void 0:t.getObject)==`function`?(this._idName=e||n.NBSP,window.main.getObject(e,(t,n)=>{if(n){r[n._id]=r[n._id]||n;let t=o.computeDisplayText(e,this.maxDisplayLength);t&&(this._idName=t,this.forceRerender()),o.displayMode===1&&this._resolvePathNamesAsync(e)}})):(this._idName=o.computeDisplayText(e,this.maxDisplayLength),o.displayMode===1&&this._resolvePathNamesAsync(e)),this.updateIcon_(e),super.setValue(e),super.setTooltip(()=>this._composeTooltip()),this._ensureValueBadge()}getDisplayText_(){var e;let t=this._idName;return this._showValue&&this._stateValueText&&(t=`${t||``} = ${this._stateValueText}`),t?(t.length>this.maxDisplayLength&&(t=`${t.substring(0,this.maxDisplayLength-2)}…`),t=t.replace(/\s/g,n.NBSP),(e=this.getSourceBlock())!=null&&e.RTL&&(t+=`‏`),t):n.NBSP}showEditor_(){var e,t;(e=window.main)==null||(t=e.selectIdDialog)==null||t.call(e,this.getValue(),this._type,e=>{e!==null&&this.setValue(e)})}static _buildIconUrl(e,t){return e?e.startsWith(`data:`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)?e:`/adapter/${t}/${e}`:null}static resolveIcon(e){let t=o._objects();if(!t)return null;let n=e.split(`.`),r=n[0];for(let e=n.length;e>=1;e--){var i;let a=t[n.slice(0,e).join(`.`)];if(a!=null&&(i=a.common)!=null&&i.icon)return o._buildIconUrl(a.common.icon,r)}if(n.length>=2){var a;let e=t[`system.adapter.${n[0]}.${n[1]}`];if(e!=null&&(a=e.common)!=null&&a.icon)return o._buildIconUrl(e.common.icon,r)}return null}static _refreshAll(e){for(let t of e.getAllBlocks(!1))for(let e of t.inputList)for(let t of e.fieldRow)t instanceof o&&t.refreshDisplay()}static setDisplayMode(e,t){o.displayMode=e,localStorage.setItem(`Blockly.FieldOID.displayMode`,String(e)),o._refreshAll(t)}static setShowIcon(e,t){o.showIcon=e,localStorage.setItem(`Blockly.FieldOID.showIcon`,String(e)),o._refreshAll(t)}};e(o,`DISPLAY_MODE_KEYS`,[`oid_display_name`,`oid_display_path`,`oid_display_id`,`oid_display_full_id`]),e(o,`displayMode`,parseInt(localStorage.getItem(`Blockly.FieldOID.displayMode`)||`0`,10)||0),e(o,`showIcon`,localStorage.getItem(`Blockly.FieldOID.showIcon`)===`true`);function s(){window.Blockly.FieldOID=o}export{o as FieldOID,s as install};
@@ -1 +0,0 @@
1
- import{sr as e}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__57338878793567__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-8WiAnp-r.js";import{d as t,n}from"./blockly-B0t_IRJQ.js";function r(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))))}function i(e){try{return decodeURIComponent(Array.prototype.map.call(atob(e),e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join(``))}catch{return atob(e||``)}}var a=class extends n{constructor(t){super(t),e(this,`FONTSIZE`,void 0),e(this,`CURSOR`,void 0),e(this,`SERIALIZABLE`,void 0),e(this,`spellcheck_`,void 0),this.FONTSIZE=11,this.CURSOR=`pointer`,this.SERIALIZABLE=!0,this.spellcheck_=!1}dispose(){t.hideIfOwner(this),super.dispose()}setValue(e){e!==null&&super.setValue(e)}showEditor_(){let e=this.getValue(),t=this.getSourceBlock(),n=null,a=!1;t!=null&&t.arguments_&&(n=t.arguments_),t!=null&&t.getProcedureDef&&(a=t.getProcedureDef()[2]),window.main.showScriptDialog(i(e||``),n,a,e=>{e!=null&&this.setValue(r(e))})}render_(){let e=this.getConstants();if(!e)return;let t=this.borderRect_?e.FIELD_BORDER_RECT_X_PADDING:0,n=t*2+12,r=e.FIELD_TEXT_HEIGHT;this.borderRect_&&(r=Math.max(r,e.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=r,this.size_.width=n,this.positionTextElement_(t,12),this.positionBorderRect_(),this.getTextElement().textContent=`...`}};function o(){window.Blockly.FieldScript=a,window.Blockly.b64EncodeUnicode=r,window.Blockly.b64DecodeUnicode=i}export{a as FieldScript,i as b64DecodeUnicode,r as b64EncodeUnicode,o as install};