iobroker.javascript 10.3.0 → 10.4.1

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 (165) hide show
  1. package/README.md +23 -22
  2. package/admin/assets/AiChatPanel-CfjSsVpE.js +27 -0
  3. package/admin/assets/AiChatService-rFZwYNPk.js +216 -0
  4. package/admin/assets/AiDiffView-DeynDw7L.js +1 -0
  5. package/admin/assets/AiInlineProvider-R_AVYwFT.js +5 -0
  6. package/admin/assets/{BlocklyEditor-BZyoN1JE.js → BlocklyEditor-DPJkoxjP.js} +7 -7
  7. package/admin/assets/Compile-BgTrxmPA.js +165 -0
  8. package/admin/assets/Debugger-CThCzBvP.js +15 -0
  9. package/admin/assets/Diff--plofAtP.js +1 -0
  10. package/admin/assets/{Documentation-uz4Ut9pT.js → Documentation-D3E0U4AK.js} +4 -4
  11. package/admin/assets/ExpandMore-Dio4GeHC.js +1 -0
  12. package/admin/assets/{FbEditor-aOZ-RpPV.js → FbEditor-A7I5U0hA.js} +6 -6
  13. package/admin/assets/History-Ewi5YEEn.js +1 -0
  14. package/admin/assets/Import-6Mm2vrM2.js +1 -0
  15. package/admin/assets/MonacoDiff-BYvG7IqB.js +1 -0
  16. package/admin/assets/{NotificationsActive-BdzH44gp.js → NotificationsActive-CuNfWVJM.js} +1 -1
  17. package/admin/assets/RulesEditor-MDkGXERp.js +1 -0
  18. package/admin/assets/{ScriptEditor-CviB6Hif.js → ScriptEditor-CqphehA8.js} +2 -2
  19. package/admin/assets/ScriptEditorVanillaMonaco-CxgNa-3O.js +3 -0
  20. package/admin/assets/Send-Pz1eveU5.js +1 -0
  21. package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-Ceh8EDcF.js +1 -0
  22. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__234968779812303__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BRdHvuuG.js +1217 -0
  23. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__234968779812303__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DLWT3PGo.js +9 -0
  24. package/admin/assets/aiPromptBuilder-CI2ChET0.js +1 -0
  25. package/admin/assets/{blockly-fcfyKYzp.js → blockly-B0t_IRJQ.js} +1 -1
  26. package/admin/assets/{blocklyTheme-CGhU3cEO.js → blocklyTheme-iZoge1S9.js} +1 -1
  27. package/admin/assets/{blocks_action-BQ4O7NRE.js → blocks_action-3CepYoiX.js} +1 -1
  28. package/admin/assets/{blocks_convert-0VBjfhqQ.js → blocks_convert-BEpxVx-_.js} +1 -1
  29. package/admin/assets/{blocks_logic-DAo99xDr.js → blocks_logic-CyIBT53p.js} +1 -1
  30. package/admin/assets/{blocks_number-C--e19NU.js → blocks_number-yqm4qwfh.js} +1 -1
  31. package/admin/assets/{blocks_object-D0TPhdzg.js → blocks_object-CizLkmWp.js} +1 -1
  32. package/admin/assets/blocks_procedures-pFTThYqz.js +3 -0
  33. package/admin/assets/{blocks_sendto-CRIrtOUc.js → blocks_sendto-rEq1xPmO.js} +2 -2
  34. package/admin/assets/{blocks_switch-b_GYfF0n.js → blocks_switch-D3aybjqu.js} +1 -1
  35. package/admin/assets/{blocks_system-BdkUdSsc.js → blocks_system-BVRsS2OE.js} +1 -1
  36. package/admin/assets/{blocks_text-DSFhEVOf.js → blocks_text-D93xQ_03.js} +1 -1
  37. package/admin/assets/{blocks_time-CqALAiJp.js → blocks_time-ChxhjgD7.js} +1 -1
  38. package/admin/assets/{blocks_timeout-yrOD2pZp.js → blocks_timeout-CUZ80HaP.js} +1 -1
  39. package/admin/assets/{blocks_trigger-DeAYXpSS.js → blocks_trigger-DivLpAuy.js} +2 -2
  40. package/admin/assets/{cronHoverProvider-DoO2_tpG.js → cronHoverProvider-Curcjz4m.js} +1 -1
  41. package/admin/assets/dist-CzitsFi7.js +1 -0
  42. package/admin/assets/field_cron-RgLY53_S.js +1 -0
  43. package/admin/assets/field_oid-rBhotXJe.js +1 -0
  44. package/admin/assets/field_script-CU7g3-oB.js +1 -0
  45. package/admin/assets/helpers-BZgjFQNf.js +1 -0
  46. package/admin/assets/{helpers-BTGaTdnT.js → helpers-Bt4VKZBw.js} +1 -1
  47. package/admin/assets/hostInit-CrHjJGJJ.js +1 -0
  48. package/admin/assets/index-DzAQnPTD.js +157 -0
  49. package/admin/assets/{inlineChatWidget-BwQVCPkx.js → inlineChatWidget-ChchJD9a.js} +1 -1
  50. package/admin/assets/{inlineDiffController-BsDDsDHn.js → inlineDiffController-ly6qX4jk.js} +1 -1
  51. package/admin/assets/{loadBlocks-RpqM7PwO.js → loadBlocks-DDLPEDa6.js} +23 -23
  52. package/admin/assets/{mf-entry-bootstrap-0-0deef484.js → mf-entry-bootstrap-0-d055f05d.js} +3 -3
  53. package/admin/assets/pendingShares-mBGPbRwZ.js +2 -0
  54. package/admin/assets/{reactour.esm-DX9ZgYlx.js → reactour.esm-Dk3aGxKn.js} +5 -5
  55. package/admin/assets/{stateHoverProvider-BEadnSXp.js → stateHoverProvider-wAsP-THx.js} +1 -1
  56. package/admin/assets/utils-DUKzLJUz.js +4 -0
  57. package/admin/assets/vite-preload-helper-DjNwdemH.js +1 -0
  58. package/admin/custom/assets/Components-fDcxCyN4.js +1 -0
  59. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-BraOrMSu.js +1 -0
  60. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-DbKT6Hsb.js +1 -0
  61. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-CVvbIPAy.js +1 -0
  62. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DVb0ZZ1Q.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BhZYie9-.js} +89 -89
  63. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__loadShare___mf_0_mui_mf_1_x_mf_2_date_mf_2_pickers__loadShare__.js-CV50dgj4.js +1 -0
  64. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__loadShare__date_mf_2_fns__loadShare__.js-Djg9OMcQ.js +1 -0
  65. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__loadShare__leaflet__loadShare__.js-D9EyCd42.js +1 -0
  66. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__loadShare__shared-Hb6V6BnJ.js +2 -0
  67. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-BrY-nF2a.js +122 -0
  68. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__prebuild__leaflet__prebuild__-CHjWtrkp.js +1 -0
  69. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DOkC-g0X.js +9 -0
  70. package/admin/custom/assets/dist-CzitsFi7.js +1 -0
  71. package/admin/custom/assets/helpers-BZgjFQNf.js +1 -0
  72. package/admin/custom/assets/hostInit-akwaQLq8.js +1 -0
  73. package/admin/custom/assets/index-BkItz-nL.js +1 -0
  74. package/admin/custom/assets/{lib-BmDlTzq2.js → lib-CADOx2YN.js} +1 -1
  75. package/admin/custom/assets/{mf-entry-bootstrap-0-ad1cd7d0.js → mf-entry-bootstrap-0-3c4565e0.js} +3 -3
  76. package/admin/custom/assets/pendingShares-TCMDgBLn.js +2 -0
  77. package/admin/custom/assets/utils-DUKzLJUz.js +4 -0
  78. package/admin/custom/assets/vite-preload-helper-DjNwdemH.js +1 -0
  79. package/admin/custom/customComponents.js +2 -2
  80. package/admin/custom/i18n/de.json +19 -1
  81. package/admin/custom/i18n/en.json +19 -1
  82. package/admin/custom/i18n/es.json +19 -1
  83. package/admin/custom/i18n/fr.json +19 -1
  84. package/admin/custom/i18n/it.json +19 -1
  85. package/admin/custom/i18n/nl.json +19 -1
  86. package/admin/custom/i18n/pl.json +19 -1
  87. package/admin/custom/i18n/pt.json +19 -1
  88. package/admin/custom/i18n/ru.json +19 -1
  89. package/admin/custom/i18n/uk.json +19 -1
  90. package/admin/custom/i18n/zh-cn.json +19 -1
  91. package/admin/i18n/de.json +13 -1
  92. package/admin/i18n/en.json +13 -1
  93. package/admin/i18n/es.json +13 -1
  94. package/admin/i18n/fr.json +13 -1
  95. package/admin/i18n/it.json +13 -1
  96. package/admin/i18n/nl.json +13 -1
  97. package/admin/i18n/pl.json +13 -1
  98. package/admin/i18n/pt.json +13 -1
  99. package/admin/i18n/ru.json +13 -1
  100. package/admin/i18n/uk.json +13 -1
  101. package/admin/i18n/zh-cn.json +13 -1
  102. package/admin/jsonConfig.json +274 -86
  103. package/admin/mf-manifest.json +1 -1
  104. package/admin/mf-stats.json +1 -1
  105. package/admin/remoteEntry.js +2 -2
  106. package/admin/tab.html +2 -2
  107. package/build/lib/ai.js +53 -0
  108. package/build/lib/ai.js.map +1 -0
  109. package/build/lib/inspect.js +66 -10
  110. package/build/lib/inspect.js.map +1 -1
  111. package/build/lib/mirror.js +24 -23
  112. package/build/lib/mirror.js.map +1 -1
  113. package/build/lib/scriptHistory.js +245 -0
  114. package/build/lib/scriptHistory.js.map +1 -0
  115. package/build/main.js +358 -413
  116. package/build/main.js.map +1 -1
  117. package/build/types.d.ts +11 -0
  118. package/io-package.json +17 -15
  119. package/package.json +8 -7
  120. package/admin/assets/AiChatPanel-CpY4Bun-.js +0 -27
  121. package/admin/assets/AiChatService-QKcpW4jQ.js +0 -216
  122. package/admin/assets/AiDiffView-DscPfZ38.js +0 -1
  123. package/admin/assets/AiInlineProvider-DTSPKoXG.js +0 -5
  124. package/admin/assets/Compile-Oss28m_f.js +0 -165
  125. package/admin/assets/Debugger-teJTIU-2.js +0 -15
  126. package/admin/assets/ExpandMore-V5Ix1QB1.js +0 -1
  127. package/admin/assets/Import-BIC5Ee9z.js +0 -1
  128. package/admin/assets/RulesEditor-CcDVthPa.js +0 -1
  129. package/admin/assets/ScriptEditorVanillaMonaco-ByuXwybM.js +0 -3
  130. package/admin/assets/Send-Mdo32jMb.js +0 -1
  131. package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-BnL93BgK.js +0 -1
  132. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__180366418666083__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-NI-3Uv4e.js +0 -1217
  133. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__180366418666083__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DVaMIZyC.js +0 -9
  134. package/admin/assets/aiPromptBuilder-yTB6N2VT.js +0 -1
  135. package/admin/assets/blocks_procedures-DgTxgXdB.js +0 -3
  136. package/admin/assets/dist-D4uJqRBO.js +0 -4
  137. package/admin/assets/field_cron-D3Ts_s9M.js +0 -1
  138. package/admin/assets/field_oid-BRNXredg.js +0 -1
  139. package/admin/assets/field_script-3X6ousg7.js +0 -1
  140. package/admin/assets/hostInit-2h2Cbsaw.js +0 -1
  141. package/admin/assets/index-CbQlIKB_.js +0 -156
  142. package/admin/assets/pendingShares-BaAadIDv.js +0 -1
  143. package/admin/assets/vite-preload-helper-CaC3yEL3.js +0 -1
  144. package/admin/custom/assets/Components-FkGDIlId.js +0 -1
  145. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-Cs88NUCd.js +0 -1
  146. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-P-8ffWXw.js +0 -1
  147. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-ZVuRAEo5.js +0 -1
  148. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-Dna3WF04.js +0 -1
  149. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__loadShare___mf_0_mui_mf_1_x_mf_2_date_mf_2_pickers__loadShare__.js-DcjdCGAx.js +0 -1
  150. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__loadShare__date_mf_2_fns__loadShare__.js-CnhNjamd.js +0 -1
  151. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__loadShare__leaflet__loadShare__.js-Dz7BFJqH.js +0 -1
  152. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-B0olko2J.js +0 -1
  153. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-CzN4reh_.js +0 -122
  154. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__prebuild__leaflet__prebuild__-xPcBaiTQ.js +0 -1
  155. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DuFBE5fh.js +0 -9
  156. package/admin/custom/assets/dist-D4uJqRBO.js +0 -4
  157. package/admin/custom/assets/hostInit-6oh4UY2k.js +0 -1
  158. package/admin/custom/assets/index-BrlyEy6J.js +0 -1
  159. package/admin/custom/assets/pendingShares-kV2kwejX.js +0 -1
  160. package/admin/custom/assets/vite-preload-helper-CaC3yEL3.js +0 -1
  161. package/build/lib/aiProviderResolver.js +0 -140
  162. package/build/lib/aiProviderResolver.js.map +0 -1
  163. package/build/lib/anthropicAdapter.js +0 -175
  164. package/build/lib/anthropicAdapter.js.map +0 -1
  165. /package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__37453319418803__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-CXpyx8Vy.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__198282747311932__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-CXpyx8Vy.js} +0 -0
@@ -1,216 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{ct as t,m as n}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__180366418666083__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-NI-3Uv4e.js";import{t as r}from"./vite-preload-helper-CaC3yEL3.js";var i=e(t(),1),a=r(()=>import(`./docs-compact-D7rpMc7r.js`),[],import.meta.url),o={openai:`img/openai.svg`,anthropic:`img/anthropic.svg`,gemini:`img/gemini.svg`,deepseek:`img/deepseek.svg`,custom:`img/custom.svg`},s={width:16,height:16,flexShrink:0,opacity:.7},c={ru:`Russian`,en:`English`,de:`German`,es:`Spanish`,fr:`French`,it:`Italian`,pl:`Polish`,nl:`Dutch`,pt:`Portuguese`,uk:`Ukrainian`,"zh-cn":`Chinese`},l=null,u=null,d=null,f=null;function p(){l=null,u=null,d=null,f=null}async function m(e,t){if(l)return l;let n=Object.keys(t)[0];if(!n)return null;let r=await e.sendTo(n,`getAvailableAiProviders`,{}),i=((r==null?void 0:r.providers)||[]).map(e=>e.provider),a=((r==null?void 0:r.providers)||[]).find(e=>e.provider===`custom`);return i.length?(l={providers:i,gptBaseUrl:a==null?void 0:a.baseUrl},l):null}var h=`embedding.text-embedding.textembedding.embeddinggemma.embed-.-embed.bge-.mxbai-embed.nomic-embed.arctic-embed.snowflake-arctic-embed.all-minilm.multilingual-e5.jina-embed.voyage-.gecko.paraphrase-multilingual.dall-e.gpt-image.image-edit.-image-preview.-image-latest.flash-image.nano-banana.stable-diffusion.sdxl.midjourney.flux-.imagen.sora.veo-.cogvideo.runway-.lumiere.lyria.whisper.tts-.-tts.speech-.audio-preview.mini-tts.mini-transcribe.-transcribe.native-audio.flash-live.gpt-audio.realtime.bark-.xtts.voicebox.moderation.omni-moderation.llama-guard.shieldgemma.prompt-guard.-guardian.safeguard.rerank.reranker.babbage-.davinci-.curie-.text-ada-.text-davinci.text-curie.text-babbage.instructgpt.code-davinci.code-cushman.-turbo-instruct.-search-preview.-search-api.code-search.text-search.similarity-.computer-use-preview.deep-research.robotics.aqa.reader-lm.-nsql.minicheck`.split(`.`);function g(e){let t=e.toLowerCase();return!(h.some(e=>t.includes(e))||t.startsWith(`claude-1`)||t.startsWith(`claude-instant`))}var _=`openai-model`,v=`openai-model-provider`;function y(e,t){window.localStorage.setItem(_,e),t?window.localStorage.setItem(v,t):window.localStorage.removeItem(v)}function b(){return{model:window.localStorage.getItem(_)||``,provider:window.localStorage.getItem(v)||``}}async function x(e,t){let r=await m(e,t);if(!r)return{models:[],providerMap:{},errors:[`No API keys configured`]};let i=Object.keys(t)[0];if(!i)return{models:[],providerMap:{},errors:[n.t(`No running javascript instance found`)]};let a=[],o={},s=[],c={},l=[],u=(t,n)=>{l.push(e.sendTo(i,`testApiConnection`,{provider:t}).then(e=>{e.models?c[t]=e.models:e.error&&s.push(`${n||t}: ${e.error}`)}).catch(e=>{s.push(`${n||t}: ${String(e)}`)}))},d={openai:`OpenAI`,anthropic:`Anthropic`,gemini:`Gemini`,deepseek:`DeepSeek`,custom:`Custom`};for(let e of r.providers)u(e,d[e]);await Promise.all(l);for(let e of r.providers)for(let t of c[e]||[])g(t)&&!o[t]&&(a.push(t),o[t]=e);return a.sort(),{models:a,providerMap:o,errors:s}}async function S(e,t,n){var r;return await e.sendTo(t,`chatCompletion`,{timeout:n.timeout||6e5,model:n.model,provider:n.provider,messages:n.messages,...n.baseUrl?{baseUrl:n.baseUrl}:{},...(r=n.tools)!=null&&r.length?{tools:n.tools}:{}})}async function C(e){if(f)return f;let t=await e.getObjectViewSystem(`state`,``,`香`),n=await e.getObjectViewSystem(`channel`,``,`香`),r=await e.getObjectViewSystem(`device`,``,`香`),i=await e.getObjectViewSystem(`folder`,``,`香`),a=await e.getObjectViewSystem(`enum`,``,`香`);return f=Object.assign(t,n,r,i,a),f}async function w(e){return C(e)}function T(e,t){return e&&typeof e==`object`?e[t]||e.en:e||``}async function E(e){if(u)return u;let t=n.getLanguage(),r=await C(e),a=Object.keys(r).sort(),o=new i.default,s=[],c=[`UNREACH_STICKY`],l=[i.Types.info],d=[],f=[],p=[],m=[];a.forEach(e=>{var t,n;((t=r[e])==null?void 0:t.type)===`enum`?d.push(e):(n=r[e])!=null&&(n=n.common)!=null&&n.smartName&&m.push(e)}),d.forEach(e=>{e.startsWith(`enum.rooms.`)?f.push(e):e.startsWith(`enum.functions.`)&&p.push(e);let t=r[e].common.members;t!=null&&t.length&&t.forEach(e=>{r[e]&&!m.includes(e)&&m.push(e)})});let h={id:``,objects:r,_keysOptional:a,_usedIdsOptional:s,ignoreIndicators:c,excludedTypes:l},g=[];m.forEach(e=>{h.id=e;let n=o.detect(h);n&&n.forEach(e=>{var n;let i=(n=e.states.find(e=>e.id))==null?void 0:n.id;if(!i||g.find(e=>e.id===i))return;let a=r[i],o={id:i,name:T(a.common.name,t),type:a.type,deviceType:e.type,states:e.states.filter(e=>e.id).map(e=>({id:e.id,name:e.name,role:e.defaultRole,type:r[e.id].common.type,unit:r[e.id].common.unit,read:r[e.id].common.read??!0,write:r[e.id].common.write??!0}))},s=i.split(`.`),c,l;(a.type===`channel`||a.type===`state`)&&(s.pop(),c=s.join(`.`),r[c]&&(r[c].type===`channel`||r[c].type===`folder`)?(s.pop(),l=s.join(`.`),(!r[l]||r[l].type!==`device`&&r[c].type!==`folder`)&&(l=void 0)):c=void 0);let u=f.find(e=>{var t,n,a;return(t=r[e].common.members)!=null&&t.includes(i)||c&&(n=r[e].common.members)!=null&&n.includes(c)?!0:l&&((a=r[e].common.members)==null?void 0:a.includes(l))});u&&(o.room=T(r[u].common.name,t));let d=p.find(e=>{var t,n,a;return(t=r[e].common.members)!=null&&t.includes(i)||c&&(n=r[e].common.members)!=null&&n.includes(c)?!0:l&&((a=r[e].common.members)==null?void 0:a.includes(l))});d&&(o.function=T(r[d].common.name,t)),g.push(o)})});for(let e=0;e<g.length;e++){let n=g[e];if(n.type===`state`||n.type===`channel`){let e=n.id.split(`.`);e.pop();let i=r[e.join(`.`)];if(i&&(i.type===`channel`||i.type===`device`||i.type===`folder`)){var _,v;n.name=T(((_=i.common)==null?void 0:_.name)||n.name,t),e.pop();let a=r[e.join(`.`)];if((a==null?void 0:a.type)===`device`&&(v=a.common)!=null&&v.icon){var y;n.name=T(((y=a.common)==null?void 0:y.name)||n.name,t)}}else{var b;n.name=T((i==null||(b=i.common)==null?void 0:b.name)||n.name,t)}}}return u=g,g}async function D(){return d||(d=(await a).default,d)}function O(){return c[n.getLanguage()]||`English`}function k(e){return`You write ioBroker JavaScript adapter scripts.
2
- Copy EXACTLY this syntax. Do NOT change the callback signature.
3
- IMPORTANT: Write all code at top level. NEVER use console.log (use log instead). NEVER define functions with the function keyword.
4
-
5
- // CORRECT: on() always has ONE callback argument called obj
6
- on('zigbee.0.sensor.state', (obj) => {
7
- // obj.state.val = the new value (boolean or number)
8
- // obj.id = the state ID that changed
9
- setState('zigbee.0.lamp.state', obj.state.val);
10
- log('Changed to ' + obj.state.val);
11
- });
12
-
13
- // CORRECT: on() with filter
14
- on({id: /zigbee\\.0\\..*\\.state$/, change: 'ne'}, (obj) => {
15
- if (obj.state.val === true) {
16
- setState('zigbee.0.other.state', true);
17
- }
18
- });
19
-
20
- // Other correct examples:
21
- setState('id', true);
22
- setState('id', 50);
23
- const val = getState('id').val;
24
- schedule('0 7 * * *', () => { log('runs daily at 07:00'); });
25
- schedule('0 22 * * *', () => { setState('id', false); });
26
-
27
- // CORRECT Telegram: always use sendTo, NEVER setState on telegram
28
- sendTo('telegram.0', 'send', {text: 'Alert: ' + someValue});
29
-
30
- // CORRECT httpGet: res.data is a STRING, parse JSON with JSON.parse
31
- httpGet('https://api.example.com/data', (err, res) => {
32
- const data = JSON.parse(res.data);
33
- log('Temperature: ' + data.main.temp);
34
- });
35
-
36
- $('state[state.id=*.state](rooms=Room)').each((id) => { setState(id, false); });
37
- createState('name', 0, {type: 'number', name: 'Name'});
38
- // CORRECT: one-time delayed action (turn off after 5 minutes = 300000ms)
39
- setStateDelayed('zigbee.0.lamp.state', false, false, 5 * 60 * 1000);
40
- log(formatDate(new Date(), 'DD.MM.YYYY hh:mm'));
41
-
42
- WRONG: on('id', (id, state) => {}) CORRECT: on('id', (obj) => {})
43
- WRONG: set('id', true) CORRECT: setState('id', true)
44
- WRONG: adapter.setState('id', true) CORRECT: setState('id', true)
45
- WRONG: obj.val or newState.val CORRECT: obj.state.val
46
- WRONG: on('change', {id: 'x'}, cb) CORRECT: on({id: 'x', change: 'ne'}, cb)
47
- WRONG: setState('telegram.0', text) CORRECT: sendTo('telegram.0', 'send', {text: text})
48
- WRONG: res.body.main.temp CORRECT: JSON.parse(res.data).main.temp
49
- WRONG: function myFunc() {} CORRECT: write code directly, no function definitions
50
- WRONG: setTimeout(fn, ms) CORRECT: setStateDelayed(id, val, false, ms) for one-time delay
51
- WRONG: schedule('*/5 * * * *', fn) for one-time delay. schedule() is ONLY for recurring tasks
52
- Values are boolean (true/false) or numbers, NEVER strings like 'ON'/'OFF'.
53
- NEVER use: function keyword, require, import, setInterval, setTimeout, console.log, debug().
54
-
55
- All available functions (use syntax from examples above):
56
- on(pattern, (obj)=>{}) | once(pattern, (obj)=>{}) | unsubscribe(handler)
57
- setState(id, val) | getState(id).val | setStateChanged(id, val) | setStateDelayed(id, val, ack, ms) | clearStateDelayed(id)
58
- existsState(id) | existsObject(id) | getObject(id) | setObject(id, obj) | extendObject(id, obj) | deleteObject(id)
59
- createState(name, initVal, {type,name,role}) | deleteState(name) | createAlias(name, alias)
60
- schedule(cron, ()=>{}) | clearSchedule(obj) | scheduleById(id, (obj)=>{}) | getSchedules()
61
- sendTo(adapter, cmd, msg) | sendToHost(host, cmd, msg)
62
- $('selector').each((id)=>{}) | $('selector').setState(val) | $('selector').getState()
63
- log(text) | formatDate(date, 'DD.MM.YYYY hh:mm') | formatTimeDiff(ms) | formatValue(val, decimals)
64
- getDateObject(str) | getAstroDate(pattern) | isAstroDay() | compareTime(start, end, op)
65
- exec(cmd, (err,stdout,stderr)=>{}) | httpGet(url, (err,res)=>{}) | httpPost(url, data, (err,res)=>{})
66
- readFile(adapter, name, (err,data)=>{}) | writeFile(adapter, name, data, cb) | delFile(adapter, name, cb)
67
- onFile(id, name, withFile, cb) | offFile(id, name) | onStop(cb, timeout)
68
- getHistory(inst, {id,start,end,aggregate,count}, cb) | getEnums(name) | getIdByName(name)
69
- wait(ms) | toInt(val) | toFloat(val) | toBoolean(val)
70
- messageTo(target, data) | onMessage(name, cb) | onLog(severity, cb)
71
- runScript(name) | startScript(name) | stopScript(name) | isScriptActive(name)
72
-
73
- Write comments in ${e}. Put code in a \`\`\`javascript code block.`}function A(e){return`You generate ioBroker Blockly XML blocks. Return Blockly XML in a \`\`\`xml code block.
74
- Use EXACT state IDs from the plan. Write text/comments in ${e}.
75
-
76
- IMPORTANT RULES:
77
- - Return ONLY the inner blocks (no <xml> wrapper needed)
78
- - Use the exact block types shown below
79
- - State IDs must be full paths like "zigbee2mqtt.0.0x1234.state"
80
- - Values are boolean (true/false) or numbers, NEVER strings like "ON"/"OFF"
81
- - For Telegram use sendto_custom block, NEVER setState on telegram
82
-
83
- ## Block Templates
84
-
85
- ### Trigger: on_ext (react to state changes)
86
- <block type="on_ext" x="0" y="0">
87
- <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
88
- <field name="CONDITION">ne</field>
89
- <field name="ACK_CONDITION"></field>
90
- <value name="OID0">
91
- <shadow type="field_oid"><field name="oid">STATE_ID_HERE</field></shadow>
92
- </value>
93
- <statement name="STATEMENT">
94
- <!-- actions here -->
95
- </statement>
96
- </block>
97
-
98
- ### Schedule: schedule (cron-based)
99
- <block type="schedule" x="0" y="0">
100
- <field name="SCHEDULE">0 7 * * *</field>
101
- <statement name="STATEMENT">
102
- <!-- actions here -->
103
- </statement>
104
- </block>
105
-
106
- ### Set State: control
107
- <block type="control">
108
- <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
109
- <field name="OID">STATE_ID_HERE</field>
110
- <field name="WITH_DELAY">FALSE</field>
111
- <value name="VALUE">
112
- <block type="logic_boolean"><field name="BOOL">TRUE</field></block>
113
- </value>
114
- </block>
115
-
116
- ### Get State Value: get_value
117
- <block type="get_value">
118
- <field name="ATTR">val</field>
119
- <field name="OID">STATE_ID_HERE</field>
120
- </block>
121
-
122
- ### Log: debug
123
- <block type="debug">
124
- <field name="Severity">log</field>
125
- <value name="TEXT">
126
- <shadow type="text"><field name="TEXT">Message here</field></shadow>
127
- </value>
128
- </block>
129
-
130
- ### SendTo (Telegram): sendto_custom
131
- <block type="sendto_custom">
132
- <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
133
- <field name="INSTANCE">telegram.0</field>
134
- <field name="COMMAND">send</field>
135
- <field name="LOG"></field>
136
- <value name="ARG0">
137
- <block type="text"><field name="TEXT">Message text</field></block>
138
- </value>
139
- <value name="ATTR0">
140
- <block type="text"><field name="TEXT">text</field></block>
141
- </value>
142
- </block>
143
-
144
- ### Timeout: timeouts_settimeout
145
- <block type="timeouts_settimeout">
146
- <field name="NAME">timeout1</field>
147
- <field name="DELAY">5000</field>
148
- <field name="UNIT">ms</field>
149
- <statement name="STATEMENT">
150
- <!-- delayed actions -->
151
- </statement>
152
- </block>
153
-
154
- ### If/Else: controls_if
155
- <block type="controls_if">
156
- <mutation else="1"></mutation>
157
- <value name="IF0">
158
- <block type="logic_compare">
159
- <field name="OP">EQ</field>
160
- <value name="A"><block type="get_value"><field name="ATTR">val</field><field name="OID">STATE_ID</field></block></value>
161
- <value name="B"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value>
162
- </block>
163
- </value>
164
- <statement name="DO0"><!-- then --></statement>
165
- <statement name="ELSE"><!-- else --></statement>
166
- </block>
167
-
168
- ### Number value
169
- <block type="math_number"><field name="NUM">0</field></block>
170
-
171
- ### Text value
172
- <block type="text"><field name="TEXT">hello</field></block>
173
-
174
- ### Boolean value
175
- <block type="logic_boolean"><field name="BOOL">TRUE</field></block>
176
-
177
- ### Comparison: logic_compare
178
- <block type="logic_compare">
179
- <field name="OP">EQ</field>
180
- <!-- OP can be: EQ, NEQ, LT, LTE, GT, GTE -->
181
- <value name="A"><!-- left side --></value>
182
- <value name="B"><!-- right side --></value>
183
- </block>
184
-
185
- ## Common Patterns
186
-
187
- ### Turn on light when sensor triggers:
188
- <block type="on_ext" x="0" y="0">
189
- <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
190
- <field name="CONDITION">ne</field>
191
- <field name="ACK_CONDITION"></field>
192
- <value name="OID0">
193
- <shadow type="field_oid"><field name="oid">zigbee2mqtt.0.0xSENSOR.occupancy</field></shadow>
194
- </value>
195
- <statement name="STATEMENT">
196
- <block type="controls_if">
197
- <value name="IF0">
198
- <block type="logic_compare">
199
- <field name="OP">EQ</field>
200
- <value name="A"><block type="get_value"><field name="ATTR">val</field><field name="OID">zigbee2mqtt.0.0xSENSOR.occupancy</field></block></value>
201
- <value name="B"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value>
202
- </block>
203
- </value>
204
- <statement name="DO0">
205
- <block type="control">
206
- <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
207
- <field name="OID">zigbee2mqtt.0.0xLAMP.state</field>
208
- <field name="WITH_DELAY">FALSE</field>
209
- <value name="VALUE"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></value>
210
- </block>
211
- </statement>
212
- </block>
213
- </statement>
214
- </block>
215
-
216
- Write comments in ${e}. Put blocks in a \`\`\`xml code block.`}function j(e){let t=e;return t=t.replace(/<think>[\s\S]*?<\/think>/gi,``),t=t.replace(/<\|endoftext\|>/g,``),t=t.replace(/<\|im_start\|>[\s\S]*?<\|im_end\|>/g,``),t=t.replace(/<\|im_start\|>[\s\S]*/g,``),t.trim()}export{w as a,k as c,x as d,b as f,j as h,E as i,D as l,S as m,o as n,m as o,y as p,p as r,A as s,s as t,O as u};
@@ -1 +0,0 @@
1
- import{Cr as e,Dt as t,Gt as n,Jt as r,Kt as i,Nr as a,Or as o,Tt as s,Ut as c,br as l,m as u,or as d,sr as f}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__180366418666083__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-NI-3Uv4e.js";import{n as p}from"./loadMonaco-BVOEahNw.js";a();var m=({originalCode:a,modifiedCode:m,language:h,themeType:g,onAccept:_,onReject:v})=>{let y=o(null),b=o(null),x=o(null);e(()=>{let e=null,t=!1;return p().then(n=>{if(t||!y.current)return;let r=n.editor.createDiffEditor(y.current,{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,theme:g===`dark`?`vs-dark`:`vs`,scrollBeyondLastLine:!1,minimap:{enabled:!1}}),i=n.editor.createModel(a,h),o=n.editor.createModel(m,h);x.current=o,r.setModel({original:i,modified:o}),b.current=r,e=()=>{r.dispose(),i.dispose(),o.dispose(),b.current=null,x.current=null}}).catch(e=>console.error(`Cannot load the code editor: ${e}`)),()=>{t=!0,e==null||e()}},[a,m,h,g]);let S=l(()=>{var e;_(((e=x.current)==null?void 0:e.getValue())||m)},[m,_]);return f(i,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`},children:[f(c,{variant:`dense`,sx:{minHeight:36,bgcolor:`background.paper`,borderBottom:`1px solid`,borderColor:`divider`,gap:1,flexShrink:0},children:[d(n,{variant:`subtitle2`,sx:{flex:1},children:u.t(`AI suggested changes`)}),d(r,{variant:`contained`,color:`success`,size:`small`,startIcon:d(t,{}),onClick:S,children:u.t(`Accept`)}),d(r,{variant:`outlined`,color:`error`,size:`small`,startIcon:d(s,{}),onClick:v,children:u.t(`Reject`)})]}),d(i,{ref:y,sx:{flex:1,overflow:`hidden`}})]})};export{m as default};
@@ -1,5 +0,0 @@
1
- import{f as e}from"./AiChatService-QKcpW4jQ.js";var t=800,n=`You are a code completion engine for ioBroker JavaScript adapter scripts.
2
- Complete the code at the cursor position marked with <CURSOR>.
3
- Return ONLY the completion text, no explanation, no markdown fences, no comments about what you did.
4
- If you cannot complete, return an empty string.
5
- Available functions: on(), setState(), getState(), schedule(), sendTo(), log(), createState(), setStateDelayed(), existsState(), httpGet(), httpPost(), exec(), formatDate(), $(), wait(), toInt(), toFloat(), readFile(), writeFile().`,r=null,i=null,a=null,o=6e4;function s(s,c,l){let u=[];for(let d of[`javascript`,`typescript`]){let f=s.languages.registerInlineCompletionsProvider(d,{disposeInlineCompletions(){},provideInlineCompletions(u,d,f,p){return new Promise(f=>{if(r&&=(r.cancel(),null),i&&clearTimeout(i),p.isCancellationRequested){f(void 0);return}i=setTimeout(async()=>{if(p.isCancellationRequested){f(void 0);return}let t=Object.keys(l)[0];if(!t){f(void 0);return}if(!a||Date.now()-a.ts>o)try{let e=await c.sendTo(t,`getAvailableAiProviders`,{});a={providers:(e==null?void 0:e.providers)||[],ts:Date.now()}}catch{f(void 0);return}let{model:i,provider:m}=e(),h=m&&a.providers.find(e=>e.provider===m);if(!i||!h){f(void 0);return}let g=h.baseUrl||``,_=u.getLineCount(),v=Math.max(1,d.lineNumber-50),y=Math.min(_,d.lineNumber+10),b=``;for(let e=v;e<d.lineNumber;e++)b+=`${u.getLineContent(e)}\n`;b+=u.getLineContent(d.lineNumber).substring(0,d.column-1);let x=u.getLineContent(d.lineNumber).substring(d.column-1);for(let e=d.lineNumber+1;e<=y;e++)x+=`\n${u.getLineContent(e)}`;let S=!1;r={cancel:()=>{S=!0}},p.onCancellationRequested(()=>{S=!0});try{let e=await c.sendTo(t,`chatCompletion`,{timeout:15e3,...g?{baseUrl:g}:{},model:i,provider:m,messages:[{role:`system`,content:n},{role:`user`,content:`${b}<CURSOR>${x}`}]});if(S||p.isCancellationRequested){f(void 0);return}if(e.error||!e.content){f(void 0);return}let r=e.content.trim(),a=r.match(/```\w*\n?([\s\S]*?)```/);if(a&&(r=a[1].trim()),!r){f(void 0);return}f({items:[{insertText:r,range:new s.Range(d.lineNumber,d.column,d.lineNumber,d.column)}]})}catch{f(void 0)}r=null},t)})}});u.push(f)}return{dispose:()=>{i&&clearTimeout(i),r&&r.cancel(),u.forEach(e=>e.dispose())}}}export{s as registerAiInlineProvider};
@@ -1,165 +0,0 @@
1
- import{Bn as e,Cr as t,Ht as n,Jn as r,Jt as i,Ln as a,Mn as o,Mt as s,Nn as c,Nr as l,Sr as u,_t as d,an as f,ar as p,bn as m,d as h,en as g,f as _,gn as v,hn as y,kr as b,l as x,m as S,mn as C,o as w,on as ee,or as T,qn as E,s as te,sn as ne,sr as D,v as O,vr as re,vt as ie,xn as ae,yn as oe,yr as k,yt as se}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__180366418666083__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-NI-3Uv4e.js";import{n as ce,r as le,t as ue}from"./NotificationsActive-BdzH44gp.js";import{t as de}from"./Send-Mdo32jMb.js";import{l as A,v as fe,y as pe}from"./index-CbQlIKB_.js";var me=r(T(`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=r(T(`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=r(T(`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=r(T(`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=r(T(`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=r([T(`path`,{d:`m12 2-5.5 9h11z`},`0`),T(`circle`,{cx:`17.5`,cy:`17.5`,r:`4.5`},`1`),T(`path`,{d:`M3 13.5h8v8H3z`},`2`)],`Category`),M=r(T(`path`,{d:`M7 2v11h3v9l7-12h-4l4-8z`}),`FlashOn`),N=r(T(`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=r(T(`path`,{d:`M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z`}),`Functions`),F=r(T(`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=r(T(`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=r(T(`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=r(T(`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=r(T(`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=r(T(`path`,{d:`M6 6h12v12H6z`}),`Stop`),we=r(T(`path`,{d:`M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z`}),`Storage`),Te=r(T(`path`,{d:`M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z`}),`Subject`),Ee=r(T(`path`,{d:`M6.99 11 3 15l3.99 4v-3H14v-2H6.99zM21 9l-3.99-4v3H10v2h7.01v3z`}),`SwapHoriz`);l();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:a,value:o,square:s,icon:c})=>T(i,{variant:`outlined`,color:`primary`,onClick:n,fullWidth:e,style:r,className:O.clsx(L.root,a,s?L.square:``),size:t||`medium`,children:c?T(_,{className:L.icon,src:c}):o}),De={root:`_root_1ucda_1`};l();var z=k(({size:e,value:t,title:n,onChange:r,className:i,customValue:a,disabled:o})=>{let[s,c]=b(!1);return D(p,{children:[T(g,{disabled:o,checked:!!(a?t:s),className:O.clsx(De.root,i),onChange:e=>{a&&c(e.target.checked),r&&r(e.target.checked)},size:e||`medium`}),n||null]})}),B={root:`_root_19roy_1`};l();var V=e=>{let[t,r]=b(``),{value:i,type:a,error:o,className:s,icon:c,label:l,style:u,onChange:d,fullWidth:f,autoComplete:p,customValue:m,autoFocus:h,rows:g,size:v,variant:y,multiline:x,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 T(n,{error:!!o,autoFocus:h,fullWidth:f,label:l,disabled:S,variant:y,multiline:x,rows:g,value:m?i:t,type:a,helperText:o,style:u,className:O.clsx(B.root,s),autoComplete:p,onChange:e=>{!m&&r(e.target.value),d&&d(e.target.value)},slotProps:{input:{endAdornment:c?T(ae,{position:`end`,children:T(_,{className:B.icon,src:c})}):null}},margin:`normal`,size:v})};l();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:e,value:n,customValue:r,socket:i,title:o,attr:s,adapter:l,style:u,onChange:d,onInstanceHide:f})=>{let[p,h]=b(n||`test1`),[g,_]=b([]);return t(()=>{i==null||i.getAdapterInstances(l).then(e=>{let t=e.map(e=>({value:e._id.replace(`system.adapter.`,``),title:e._id.replace(`system.adapter.`,``)}));t.length===1?f(t[0].value):t.unshift({value:l,title:S.t(`All`)}),_(t)})},[i,l,f]),D(C,{sx:Oe.formControl,fullWidth:!0,style:u,children:[T(a,{variant:`standard`,value:(r?n:p)||`_`,fullWidth:!0,multiple:e,renderValue:t=>e&&Array.isArray(t)?t.join(`, `):t,onChange:e=>{!r&&h(e.target.value),d(e.target.value)},input:s?T(m,{name:s,id:`${s}-helper`}):T(m,{name:s}),children:g.map(e=>T(c,{style:{placeContent:`space-between`},value:e.value||`_`,children:S.t(e.title)},`key-${e.value}`))}),o?T(v,{children:S.t(o)}):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`};l();var U=({onClose:e,children:t,titleButtonApply:n,titleButtonClose:r,onApply:a,className:o,textInput:s,defaultValue:c,disabled:l})=>{let[u,d]=b(c||``),[p]=b(c||``);return D(f,{open:!0,maxWidth:`md`,onClose:e,classes:{paper:H.modalDialog},className:H.modalWrapper,children:[D(ne,{children:[s&&T(V,{className:o,autoComplete:`off`,fullWidth:!0,variant:`outlined`,size:`medium`,rows:10,multiline:!0,value:u,onChange:d,customValue:!0}),!s&&t]}),D(ee,{children:[T(i,{disabled:l===void 0?p===u:l,onClick:()=>a(s?u:null),variant:`contained`,color:`primary`,children:S.t(n||`Ok`)}),T(i,{color:`grey`,onClick:e,variant:`contained`,children:S.t(r||`Cancel`)})]})]})},Ae={root:`_root_15mo1_1`};l();var je=({multiple:e,value:t,customValue:n,title:r,attr:i,options:o,style:s,onChange:l,className:u,doNotTranslate:d,doNotTranslate2:f})=>{let[p,h]=b(t===void 0?o[0].value:t),g=n?t:p,_=g===``||g==null?`_`:g;return D(C,{variant:`standard`,className:O.clsx(Ae.root,u),fullWidth:!0,style:s,children:[D(a,{variant:`standard`,value:_,fullWidth:!0,multiple:e,renderValue:t=>{if(e&&Array.isArray(t)){t.sort();let e=t.indexOf(`0`);e!==-1&&(t.splice(e,1),t.push(`0`)),e=t.indexOf(`_`),e!==-1&&(t.splice(e,1),t.unshift(`_`));let n=o.find(e=>e.only);return n&&t.includes(n.value)?n.titleShort?d?n.titleShort:S.t(n.titleShort):d?n.title:S.t(n.title):t.map(e=>o.find(t=>t.value===e||e===`_`&&t.value===``)||e).map(e=>typeof e==`object`?e.titleShort?d?e.titleShort:S.t(e.titleShort):d?e.title:S.t(e.title):d?e:S.t(e)).join(`, `)}let n=o?o.find(e=>e.value===t||t===`_`&&e.value===``):null;return n!=null&&n.title?d?n==null?void 0:n.title:S.t(n==null?void 0:n.title):t},onChange:t=>{if(n||h(t.target.value),e){let e=t.target.value,n=o.find(e=>e.only);if(n){let t=n.value;if(e.length===o.length-1&&e.includes(t))return l(e.filter(e=>e!==t),i);if(e.includes(t))return l(o.map(e=>e.value),i)}}l(t.target.value,i)},input:i?T(m,{name:i,id:`${i}-helper`}):T(m,{name:i}),children:[!e&&(o==null?void 0:o.map(e=>D(c,{style:{placeContent:`space-between`},value:e.value===``||e.value===null||e.value===void 0?`_`:e.value,children:[d?e.title:S.t(e.title),e.title2&&T(`div`,{children:f?e.title2:S.t(e.title2)})]},`key-${e.value}`))),e&&(o==null?void 0:o.map(e=>D(c,{style:{placeContent:`space-between`},value:e.value||`_`,children:[d?e.title:S.t(e.title),` `,T(z,{customValue:!0,value:t==null?void 0:t.includes(e.value)})]},`key-${e.value}`)))]}),r?T(v,{children:S.t(r)}):null]})},W={root:`_root_167v0_1`,mark:`_mark_167v0_24`};l();var Me=({size:t,value:n,style:r,onChange:i,className:a,customValue:o,min:s,max:c,step:l,unit:u})=>{let[d,f]=b(0);s=s===void 0?0:s,c=c===void 0?0:c,l=l!==void 0&&l>0?l:(c-s)/100||1;let p=(()=>{let e=typeof n==`number`?n:parseFloat(n);return isFinite(e)?e<s?s:e>c?c:e:s})(),m=[{value:s,label:s+(u||``)},{value:c,label:c+(u||``)}];return T(e,{defaultValue:o?p:d,"aria-labelledby":`discrete-slider`,valueLabelDisplay:`auto`,classes:{mark:W.mark},marks:m,step:l,min:s,max:c,value:o?p:d,style:r,className:O.clsx(W.root,a),onChange:(e,t)=>{Array.isArray(t)?(!o&&f(t[0]),i(t[0])):(!o&&f(t),i(t))},size:t||`medium`})},Ne={root:`_root_rzul6_1`};l();var Pe=k(({label:e,size:t,value:n,style:r,onChange:i,className:a,customValue:o})=>{let[c,l]=b(!1);return T(y,{className:Ne.root,control:T(s,{checked:o?n:c,style:r,className:a,onChange:e=>{o||l(e.target.checked),i(e.target.checked)},size:t||`medium`}),label:e??`all`})}),Fe={root:`_root_135pm_1`};l();var Ie=({value:e,style:t,onChange:r,className:i})=>T(n,{variant:`standard`,id:`time`,type:`time`,onChange:e=>r(e.currentTarget.value),value:e,className:O.clsx(Fe.root,i),fullWidth:!0,style:t,slotProps:{htmlInput:{step:300},inputLabel:{shrink:!0}}}),G={root:`_root_135pm_1`};l();var K=[31,29,31,30,31,30,31,31,30,31,30,31],Le=({value:e,onChange:t,className:n,style:r})=>{let[i,o]=(e||`01.01`).toString().split(`.`),s=parseInt(o,10)||0,l=parseInt(i,10)||0;l>12?l=12:l<0&&(l=0),s>K[l]?s=K[l]:s<0&&(s=0);let u=[];for(let e=0;e<K[l];e++)u.push(e+1);return D(`div`,{children:[T(C,{variant:`standard`,className:O.clsx(G.root,n),style:r,children:D(a,{variant:`standard`,className:O.clsx(G.root,n),margin:`dense`,label:S.t(`Month`),onChange:e=>t(`${e.target.value.toString().padStart(2,`0`)}.${s.toString().padStart(2,`0`)}`),value:l,children:[T(c,{style:{placeContent:`space-between`},value:0,children:S.t(`Any month`)},0),T(c,{style:{placeContent:`space-between`},value:1,children:S.t(`January`)},1),T(c,{style:{placeContent:`space-between`},value:2,children:S.t(`February`)},2),T(c,{style:{placeContent:`space-between`},value:3,children:S.t(`March`)},3),T(c,{style:{placeContent:`space-between`},value:4,children:S.t(`April`)},4),T(c,{style:{placeContent:`space-between`},value:5,children:S.t(`May`)},5),T(c,{style:{placeContent:`space-between`},value:6,children:S.t(`June`)},6),T(c,{style:{placeContent:`space-between`},value:7,children:S.t(`July`)},7),T(c,{style:{placeContent:`space-between`},value:8,children:S.t(`August`)},8),T(c,{style:{placeContent:`space-between`},value:9,children:S.t(`September`)},9),T(c,{style:{placeContent:`space-between`},value:10,children:S.t(`October`)},10),T(c,{style:{placeContent:`space-between`},value:11,children:S.t(`November`)},11),T(c,{style:{placeContent:`space-between`},value:12,children:S.t(`December`)},12)]})}),T(C,{variant:`standard`,className:O.clsx(G.root,n),style:r,children:D(a,{variant:`standard`,className:O.clsx(G.root,n),margin:`dense`,label:S.t(`Date`),onChange:e=>t(`${l.toString().padStart(2,`0`)}.${e.target.value.toString().padStart(2,`0`)}`),value:s,children:[T(c,{style:{placeContent:`space-between`},value:0,children:S.t(`Any`)},`A`),u.map(e=>T(c,{style:{placeContent:`space-between`},value:e,children:e},e))]})})]})};l();var q={},Re={Shuffle:Se,Apps:he,Functions:P,Language:d,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:ie,AccountTree:ce,Article:ge,Stop:Ce,Category:j,Forum:N,PublishedWithChanges:xe};function J({iconName:e,className:n,adapter:r,socket:i,onClick:a,style:o}){let[s,c]=b(``);if(t(()=>{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)&&c(`../../adapter/${r}/${e.common.icon}`)}))},[r,i]),r)return T(`img`,{onClick:e=>a&&a(e),src:s||``,className:n,style:o,alt:``});let l=e&&Re[e]||se;return T(l,{className:n,style:o,onClick:e=>a&&a(e)})}var Y;function ze(e){return Y||=S.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()}l();var Ve=class e extends re{static getStaticData(){return{acceptedBy:`actions`,name:`Not found`,id:`ActionEmpty`,icon:`Shuffle`}}static compile(e,t){return``}constructor(e,t){super(e),E(this,`debugHideTimeout`,null),E(this,`initiallyCollapsed`,!1),E(this,`collapseDecided`,!1),E(this,`lastObjectIdChange`,0),E(this,`enableSimulationProcessing`,!1),E(this,`mounted`,!1),E(this,`tagCardTimeout`,null),E(this,`enableSimulationTimeout`,null),E(this,`lastDebugMessage`,0),E(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,S.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:S.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:d}=e;return D(u,{children:[D(`div`,{className:O.clsx(I.displayFlex,I.blockMarginTop),children:[a&&T(`div`,{className:I.frontText,children:l?a:S.t(a)}),T(V,{className:r,autoComplete:`off`,label:ze(c),variant:`outlined`,size:`small`,fullWidth:!0,value:t,onChange:n,customValue:!0}),o&&T(`div`,{className:I.backText,children:d?o:S.t(o)})]}),s&&T(`div`,{className:I.nameBlock,children:S.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&&T(`div`,{className:I.frontText,children:c?a:S.t(a)}),T(Pe,{className:r,label:``,customValue:!0,value:t,onChange:n}),o&&T(`div`,{className:I.backText,children:l?o:S.t(o)})]}),s&&T(`div`,{className:I.nameBlock,children:S.t(s)})]},i)}renderNameText({attr:e,signature:t,doNotTranslate:n,defaultValue:r},i){return T(`div`,{className:O.clsx(t?I.displayItalic:I.displayFlex,I.blockMarginTop),children:i?n?i:S.t(i):n?r:S.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&&T(`div`,{className:I.frontText,children:l?s:S.t(s)}),T(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&&T(`div`,{className:I.backText,children:u?o:S.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&&T(`div`,{className:I.frontText,children:s?o:S.t(o)}),T(V,{className:r,autoComplete:`off`,fullWidth:!0,variant:`outlined`,size:`small`,type:`color`,value:t,onChange:n}),a&&T(`div`,{className:I.backText,children:c?a:S.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&&T(`div`,{className:I.frontText,children:l?s:S.t(s)}),T(z,{className:r,size:`small`,value:typeof i[a]==`boolean`?!!i[a]:!!c,customValue:!0,onChange:n}),o&&T(`div`,{onClick:()=>n(typeof i[a]==`boolean`?!i[a]:!c),className:I.backText,children:u?o:S.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&&T(`div`,{className:I.frontText,children:f?a:S.t(a)}),T(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&&T(`div`,{style:{marginLeft:20},className:I.backText,children:p?o:S.t(o)})]}),s&&T(`div`,{className:I.nameBlock,children:S.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&&T(`div`,{className:I.frontText,children:s?a:S.t(a)}),T(R,{fullWidth:!0,value:t.toString(),className:r,onClick:()=>n(t)}),o&&T(`div`,{className:I.backText,children:c?o:S.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 h(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?S.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?T(`div`,{children:S.t(e.title)}):null,T(V,{className:c,style:u,autoComplete:`off`,fullWidth:!0,disabled:!0,variant:`outlined`,size:`small`,value:t,customValue:!0}),T(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?T(`div`,{className:O.clsx(I.nameBlock,I.displayItalic),children:O.getObjectNameFromObj(p,S.getLanguage())}):null,s?T(x,{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 T(`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&&T(`div`,{className:I.frontText,children:o?a:S.t(a)}),T(Ie,{value:t,onChange:n}),i&&T(`div`,{className:I.backText,children:s?i:S.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&&T(`div`,{className:I.frontText,children:S.t(s)}),T(je,{attr:l,doNotTranslate:d,doNotTranslate2:f,title:a,className:r,style:i,options:o,value:t,onChange:n,multiple:u,customValue:!0}),c&&T(`div`,{className:I.backText,children:p?c:S.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&&T(`div`,{className:I.frontText,children:l?a:S.t(a)}),T(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&&T(`div`,{className:I.backText,children:u?o:S.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&&T(`div`,{className:I.frontText,children:o?n:S.t(n)}),T(J,{iconName:a,className:O.clsx(I.iconDialog),onClick:()=>t&&t()}),r&&T(`div`,{className:I.backText,children:s?r:S.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&&T(`div`,{className:I.frontText,children:u?s:S.t(s)}),T(V,{disabled:!!l,className:i,autoComplete:`off`,fullWidth:!0,variant:`outlined`,size:`small`,value:t,onChange:n,customValue:!0}),T(R,{square:!0,style:{marginLeft:5},value:`...`,className:i,onClick:()=>this.setState({openModal:!0})}),c&&T(`div`,{className:I.backText,children:d?c:S.t(c)})]}),r?T(U,{onApply:e=>this.setState({openModal:!1},()=>e!=null&&n(e)),onClose:()=>this.setState({openModal:!1}),defaultValue:t,textInput:!0}):null,o&&T(`div`,{className:I.nameBlock,children:S.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&&T(`div`,{className:I.frontText,children:o?a:S.t(a)}),T(Le,{value:t,onChange:n}),i&&T(`div`,{className:I.backText,children:s?i:S.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,r=n!==`=`&&n!==`<>`&&n!==`>=`&&n!==`()`&&n!==`.`&&n!==`<=`&&n!==`<`&&n!==`>`&&n?S.t(n):n;return e.length>=3&&(r=D(`div`,{children:[T(`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:r}),T(o,{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(c,{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?S.t(r):r,typeof e!=`string`&&e.title2&&T(`div`,{style:{marginLeft:4},children:S.t(e.title2)})]},`${r}_${t}`)})})]})),r}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?T(`div`,{className:I.debugInfo,style:{opacity:1,height:22,bottom:-22},children:this.renderDebug?this.renderDebug(this.state.debugMessage):S.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)):T(`div`,{children:S.t(`Invalid renderTime`)},`invalid_${t}`);case`renderNameText`:return this.renderNameText(e,r);case`renderSelect`:return i?this.renderSelect(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderSelect`)},`invalid_${t}`);case`renderModalInput`:return i?this.renderModalInput(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderModalInput`)},`invalid_${t}`);case`renderObjectID`:return i?this.renderObjectID(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderObjectID`)},`invalid_${t}`);case`renderDialog`:return i?this.renderDialog(e):T(`div`,{children:S.t(`Invalid renderDialog`)},`invalid_${t}`);case`renderInstance`:return i?this.renderInstance(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderInstance`)},`invalid_${t}`);case`renderText`:return i?this.renderText(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderText`)},`invalid_${t}`);case`renderSlider`:return i?this.renderSlider(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderSlider`)},`invalid_${t}`);case`renderCheckbox`:return i?this.renderCheckbox(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderCheckbox`)},`invalid_${t}`);case`renderButton`:return i?this.renderButton(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderButton`)},`invalid_${t}`);case`renderColor`:return i?this.renderColor(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderColor`)},`invalid_${t}`);case`renderSwitch`:return i?this.renderSwitch(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderSwitch`)},`invalid_${t}`);case`renderDate`:return i?this.renderDate(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderDate`)},`invalid_${t}`);case`renderCron`:return i?this.renderCron(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderCron`)},`invalid_${t}`);case`renderWizard`:return i?this.renderWizard(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderWizard`)},`invalid_${t}`);case`renderWriteState`:return this.renderWriteState();case`renderNumber`:return i?this.renderNumber(e,o,this.onChangeInput(i)):T(`div`,{children:S.t(`Invalid renderNumber`)},`invalid_${t}`);default:return this[n]?this[n](e,o,i?this.onChangeInput(i):null):T(`div`,{children:S.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:l,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 f;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){f=t;break}}f&&(this.lastDebugMessage=f.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(f)));let p=this.getSummary(),m=this.isCollapsed(!!p),h=m?this.summaryObjectIcon(this.summaryObjectId()):void 0;return D(u,{children:[i?this.renderIconTag():T(J,{iconName:r,className:O.clsx(I.iconThemCard,m&&I.iconThemCardCollapsed,s&&this.state.tagCardArray.length&&I.iconThemCardSelectable),adapter:o,socket:l,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":!m,children:[D(`div`,{className:O.clsx(I.headerRow,p&&I.headerRowClickable),onClick:p?()=>this.toggleCollapsed(!m):void 0,children:[h?T(`img`,{className:I.summaryObjectIcon,src:h,alt:``}):null,T(`span`,{className:O.clsx(I.chevron,m&&I.chevronCollapsed,!p&&I.chevronPlaceholder),children:`▾`}),D(`div`,{className:I.headerText,children:[p!=null&&p.kicker?T(`div`,{className:I.kicker,children:p.kicker}):null,D(`span`,{className:O.clsx(I.nameCard,p&&I.nameCardSummary),children:[p?p.title:S.t(n),d?S.t(`%s not found`,a.id):``]}),m&&p!=null&&p.subtitle?T(`div`,{className:I.summarySub,title:p.subtitle,children:p.subtitle}):null]}),s?T(`div`,{onClick:e=>{e.stopPropagation(),this.onChangeTag()},className:O.clsx(I.tagCard,`tag-card`),children:this.renderTags()}):null,c?T(oe,{className:I.iconHelp,size:`small`,onClick:e=>{e.stopPropagation(),this.setState({helpText:S.t(c)})},children:T(F,{})}):null]}),m?null:t.map((e,t)=>this.renderInputElement(e,t))]}),this.renderDebugInfo(),this.state.error?T(w,{title:S.t(`Warning`),text:this.state.error,onClose:()=>this.setState({error:``})}):null,this.state.helpText?T(te,{title:S.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};