iobroker.javascript 10.1.4 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/README.md +18 -42
  2. package/admin/assets/AiChatPanel-DzN_zJhJ.js +27 -0
  3. package/admin/assets/AiChatService-k72w0sOt.js +216 -0
  4. package/admin/assets/AiDiffView-DAleMXcP.js +1 -0
  5. package/admin/assets/AiInlineProvider-C5EJApDe.js +5 -0
  6. package/admin/assets/Debugger-C4EMPnwD.js +15 -0
  7. package/admin/assets/Error-DBiAAbCC.js +1 -0
  8. package/admin/assets/Import-Dm-2zYlI.js +1 -0
  9. package/admin/assets/RulesEditor-1zrGeOYq.js +1 -0
  10. package/admin/assets/RulesEditor-CybrKL-9.css +1 -0
  11. package/admin/assets/ScriptEditor-DrKzMShn.js +2 -0
  12. package/admin/assets/ScriptEditorVanillaMonaco-uvElLaRp.js +3 -0
  13. package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-CQpJXcpz.js +1 -0
  14. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-Drq9CkPs.js +1217 -0
  15. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-B8K8J9cp.js +9 -0
  16. package/admin/assets/aiPromptBuilder-LTtUGqJp.js +1 -0
  17. package/admin/assets/{blockly-DBw-ytY1.js → blockly-Fp-1_Ye3.js} +1 -1
  18. package/admin/assets/{blocks_action-Dflw8PyN.js → blocks_action-xqgGyzT2.js} +1 -1
  19. package/admin/assets/{blocks_convert-XTqMxB04.js → blocks_convert-PyFGxenp.js} +1 -1
  20. package/admin/assets/{blocks_logic-JaZOQj6_.js → blocks_logic-BJxcqx2J.js} +1 -1
  21. package/admin/assets/{blocks_number-TU4dV-Ia.js → blocks_number-xkiHAbop.js} +1 -1
  22. package/admin/assets/{blocks_object-V6ojF22C.js → blocks_object-D7_2tXgc.js} +1 -1
  23. package/admin/assets/{blocks_procedures-Cu8VeJhw.js → blocks_procedures-BSaG5k0y.js} +1 -1
  24. package/admin/assets/{blocks_sendto-BnDWzP0n.js → blocks_sendto-CdFzuf2Q.js} +1 -1
  25. package/admin/assets/{blocks_switch-DKUc060E.js → blocks_switch-CRs6hqoN.js} +1 -1
  26. package/admin/assets/{blocks_system-BW_UpMW-.js → blocks_system-ImR4v_sW.js} +1 -1
  27. package/admin/assets/{blocks_text-BIU2kf_V.js → blocks_text-BATVRS4q.js} +1 -1
  28. package/admin/assets/{blocks_time-2vgvS4_j.js → blocks_time-BhxMTQmg.js} +1 -1
  29. package/admin/assets/{blocks_timeout-BPzmWif8.js → blocks_timeout-BZ2hzRJk.js} +1 -1
  30. package/admin/assets/{blocks_trigger-BSFZEWEO.js → blocks_trigger-bkOJ_uVI.js} +1 -1
  31. package/admin/assets/cronHoverProvider-DYMf8M44.js +2 -0
  32. package/admin/assets/{dist-BF-PlO2i.js → dist-D4uJqRBO.js} +1 -1
  33. package/admin/assets/field_cron-B-SF-uZM.js +1 -0
  34. package/admin/assets/field_oid-fYE12Bhj.js +1 -0
  35. package/admin/assets/field_script-aZs3j-vG.js +1 -0
  36. package/admin/assets/{helpers-BFQD9R82.js → helpers-DIT6UgRN.js} +1 -1
  37. package/admin/assets/{hostInit-B_aW3Wuw.js → hostInit-CzvCZFy5.js} +1 -1
  38. package/admin/assets/index-DwTLl2xB.js +871 -0
  39. package/admin/assets/inlineChatWidget-n7ufGLov.js +2 -0
  40. package/admin/assets/{inlineDiffController-DGl5rDYU.js → inlineDiffController-5u3tIcIH.js} +1 -1
  41. package/admin/assets/{mf-entry-bootstrap-0-ec2e487a.js → mf-entry-bootstrap-0-bde4e47a.js} +14 -2
  42. package/admin/assets/pendingShares-C6DqQuMX.js +1 -0
  43. package/admin/assets/stateHoverProvider-C0OUV2Nh.js +9 -0
  44. package/admin/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__iobroker_javascript__remoteEntry_js-BvxK85AS.js +1 -0
  45. package/admin/assets/{vite-preload-helper-B7qeedMF.js → vite-preload-helper-CaC3yEL3.js} +1 -1
  46. package/admin/custom/assets/Components-qR8oYG5T.js +1 -0
  47. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-CB5V_0nT.js +1 -0
  48. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-Cc7MmJgr.js +1 -0
  49. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-CFSZkPFK.js +1 -0
  50. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-o8Mkax3s.js +1217 -0
  51. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-DLa2mE8b.js +1 -0
  52. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__loadShare___mf_0_mui_mf_1_x_mf_2_date_mf_2_pickers__loadShare__.js-CZc6K9E9.js +1 -0
  53. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__loadShare__date_mf_2_fns__loadShare__.js-Bx5h7ISf.js +1 -0
  54. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__loadShare__leaflet__loadShare__.js-im3edKNs.js +1 -0
  55. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-Ca3AhTHn.js +1 -0
  56. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-bDecxMAs.js +124 -0
  57. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__prebuild__leaflet__prebuild__-CAKlcuIS.js +1 -0
  58. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-Byvr2uOb.js +1 -0
  59. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__32150414352696__prebuild__react_mf_2_dom_mf_1_client__prebuild__-Thbi9Vo9.js +9 -0
  60. package/admin/custom/assets/dist-D4uJqRBO.js +4 -0
  61. package/admin/custom/assets/{hostInit-CkdLQZaZ.js → hostInit-B0Qa8jfJ.js} +1 -1
  62. package/admin/custom/assets/index-DADYLUN0.js +1 -0
  63. package/admin/custom/assets/{lib-D9tipKpE.js → lib-BDVPOOMD.js} +2 -2
  64. package/admin/custom/assets/{mf-entry-bootstrap-0-ff278fef.js → mf-entry-bootstrap-0-b41e47ad.js} +14 -2
  65. package/admin/custom/assets/pendingShares-Gn0OX49v.js +1 -0
  66. package/admin/custom/assets/virtualExposes-DjwWqUOb.js +1 -0
  67. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-CHOLf9xJ.js +1 -0
  68. package/admin/custom/assets/{virtual_mf-exposes___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-C1DpedFv.js → virtual_mf-exposes___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-C0XlV8T_.js} +2 -2
  69. package/admin/custom/assets/{vite-preload-helper-B7qeedMF.js → vite-preload-helper-CaC3yEL3.js} +1 -1
  70. package/admin/custom/customComponents.js +2 -2
  71. package/admin/i18n/de.json +8 -2
  72. package/admin/i18n/en.json +8 -2
  73. package/admin/i18n/es.json +8 -2
  74. package/admin/i18n/fr.json +8 -2
  75. package/admin/i18n/it.json +8 -2
  76. package/admin/i18n/nl.json +8 -2
  77. package/admin/i18n/pl.json +8 -2
  78. package/admin/i18n/pt.json +8 -2
  79. package/admin/i18n/ru.json +8 -2
  80. package/admin/i18n/uk.json +8 -2
  81. package/admin/i18n/zh-cn.json +8 -2
  82. package/admin/jsonConfig.json +53 -0
  83. package/admin/mf-manifest.json +1 -1
  84. package/admin/mf-stats.json +1 -1
  85. package/admin/remoteEntry.js +2 -2
  86. package/admin/tab.html +5 -5
  87. package/build/lib/aiProviderResolver.js +22 -1
  88. package/build/lib/aiProviderResolver.js.map +1 -1
  89. package/build/lib/lazyTsServer.js +177 -0
  90. package/build/lib/lazyTsServer.js.map +1 -0
  91. package/build/main.js +176 -24
  92. package/build/main.js.map +1 -1
  93. package/build/types.d.ts +13 -0
  94. package/io-package.json +18 -15
  95. package/package.json +7 -8
  96. package/admin/assets/AiChatPanel-D93BBufl.js +0 -242
  97. package/admin/assets/AiDiffView-D5QZDwuC.js +0 -1
  98. package/admin/assets/AiInlineProvider-CRU2J938.js +0 -5
  99. package/admin/assets/Debugger-BLzsRkue.js +0 -15
  100. package/admin/assets/Error-BWXtkB6H.js +0 -1
  101. package/admin/assets/Import-D_RBSmNU.js +0 -1
  102. package/admin/assets/RulesEditor-DpKr8byp.js +0 -1
  103. package/admin/assets/RulesEditor-QNWIRnqB.css +0 -1
  104. package/admin/assets/ScriptEditor-DK6nNmcp.js +0 -2
  105. package/admin/assets/ScriptEditorVanillaMonaco-BVIwadsl.js +0 -3
  106. package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-v3-PYsgp.js +0 -1
  107. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-GB0oxSwG.js +0 -1217
  108. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-SF46owzN.js +0 -9
  109. package/admin/assets/aiPromptBuilder-CtijdvYL.js +0 -1
  110. package/admin/assets/cronHoverProvider-BMVsvVuG.js +0 -2
  111. package/admin/assets/field_cron-Br4hxeLb.js +0 -1
  112. package/admin/assets/field_oid-ojNnLVGL.js +0 -1
  113. package/admin/assets/field_script-Bs925umq.js +0 -1
  114. package/admin/assets/index-BnLv569U.js +0 -871
  115. package/admin/assets/inlineChatWidget-BcLIwfEH.js +0 -2
  116. package/admin/assets/stateHoverProvider-XKm8a_93.js +0 -9
  117. package/admin/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__iobroker_javascript__remoteEntry_js-IRf47UYM.js +0 -1
  118. package/admin/custom/assets/Components-BpxzAzc7.js +0 -1
  119. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-wwYTJNxa.js +0 -1
  120. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-DzaRKfE_.js +0 -1
  121. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-B9fjpXOq.js +0 -1
  122. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-QxUxIFgP.js +0 -1217
  123. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-BUk3WHjQ.js +0 -1494
  124. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__leaflet__loadShare__.js-n2zIPi0L.js +0 -1
  125. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DqjU6PXX.js +0 -9
  126. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__date_mf_2_fns__prebuild__-CXAEcWml.js +0 -1
  127. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__leaflet__prebuild__-BeF0jEWM.js +0 -1
  128. package/admin/custom/assets/index-D2qJNee0.js +0 -1
  129. package/admin/custom/assets/setYear-DXk_Jooa.js +0 -1
  130. package/admin/custom/assets/virtualExposes-vH26J8jF.js +0 -1
  131. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-qdaLIbFV.js +0 -1
@@ -1 +1 @@
1
- import{i as e,o as t,r as n,s as r,t as i}from"./blockly-DBw-ytY1.js";import{c as a,l as o}from"./index-BnLv569U.js";import{c as s,o as c,r as l,u}from"./helpers-BFQD9R82.js";import{FieldOID as d}from"./field_oid-ojNnLVGL.js";function f(){let f=window.Blockly,p=f.Translate,m=window.getHelp;f.CustomBlocks=f.CustomBlocks||[],f.CustomBlocks.push(`System`),f.System={HUE:210,blocks:{},WARNING_PARENTS:[`on_ext`]};let h=e=>[[p(`get_value_val`),`val`],[p(`get_value_ack`),`ack`],[p(`get_value_ts`),`ts`],[p(`get_value_lc`),`lc`],[p(`get_value_q`),`q`],[p(`get_value_comment`),`c`],[p(`get_value_from`),`from`],...e?[[p(`get_value_user`),`user`]]:[],[p(`get_common_name`),`common.name`],[p(`get_common_desc`),`common.desc`],[p(`get_common_unit`),`common.unit`],[p(`get_common_role`),`common.role`],[p(`get_common_state_type`),`common.type`],[p(`get_common_read`),`common.read`],[p(`get_common_write`),`common.write`]],g=e=>e===`type`||e.startsWith(`common.`),_=function(){let e=this.getParent();e&&f.System.WARNING_PARENTS.includes(e.type)?this.setWarningText(p(`false_connection_trigger_warning`),this.id):this.setWarningText(null,this.id)},v=r=>({mutationToDom:function(){let e=document.createElement(`mutation`);return e.setAttribute(`delay_input`,String(l(this.getFieldValue(`WITH_DELAY`)))),e},domToMutation:function(e){this.updateShape_(l(e.getAttribute(`delay_input`)))},updateShape_:function(i){i?this.getInput(`DELAY`)||this.appendDummyInput(`DELAY`).appendField(` `).appendField(new t(`1000`),`DELAY_MS`).appendField(new e([[p(`control_ms`),`ms`],[p(`control_sec`),`sec`],[p(`control_min`),`min`]]),`UNIT`):this.getInput(`DELAY`)&&this.removeInput(`DELAY`),i?this.getInput(`CLEAR_RUNNING_INPUT`)||this.appendDummyInput(`CLEAR_RUNNING_INPUT`).appendField(p(r)).appendField(new n,`CLEAR_RUNNING`):this.getInput(`CLEAR_RUNNING_INPUT`)&&this.removeInput(`CLEAR_RUNNING_INPUT`)}}),y=()=>new n(`FALSE`,function(e){this.getSourceBlock().updateShape_(l(e))}),b=e=>u(e.getFieldValue(`DELAY_MS`),e.getFieldValue(`UNIT`));f.System.blocks.global_var=`<block type="global_var"> <field name="VAR">scriptName</field></block>`,i.global_var={init:function(){this.appendDummyInput(`VAR`).appendField(new e([[p(`global_var_scriptname`),`scriptName`],[p(`global_var_defaultdatadir`),`defaultDataDir`],[p(`global_var_verbose`),`verbose`]]),`VAR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`global_var_tooltip`)),this.setHelpUrl(m(`global_var`))}},o.forBlock.global_var=function(e){return[e.getFieldValue(`VAR`),a.ATOMIC]},f.System.blocks.secret=`<block type="secret"></block>`;let x=()=>{var e;return((e=window.main)==null?void 0:e.secrets)||[]},S=()=>x().length?x().map(e=>[e.name,e.name]):[[p(`secret_no_secrets`),``]],C=function(){var e,t;let n=(e=this.getSourceBlock())==null?void 0:e.getFieldValue(`NAME`),r=(t=x().find(e=>e.name===n))==null?void 0:t.fields;return(r!=null&&r.length?r:[`key`,`login`,`password`]).map(e=>[e,e])};i.secret={init:function(){let n=this.appendDummyInput(`SECRET`).appendField(p(`secret`));x().length?n.appendField(new e(S),`NAME`):n.appendField(new t(`CameraPassword`),`NAME`),n.appendField(p(`secret_attr`)).appendField(new e(C),`ATTR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`secret_tooltip`)),this.setHelpUrl(m(`secret_help`))}},o.forBlock.secret=function(e){let t=e.getFieldValue(`NAME`),n=e.getFieldValue(`ATTR`),r=/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n)?`.${n}`:`[${s(n)}]`;return[`SECRETS[${s(t)}]?${r}`,a.ATOMIC]},f.System.blocks.debug=`<block type="debug"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text"> <field name="TEXT">test</field> </shadow> </value></block>`,i.debug={init:function(){this.appendValueInput(`TEXT`).setCheck(null).appendField(p(`debug`)),this.appendDummyInput(`Severity`).appendField(new e([[p(`loglevel_debug`),`debug`],[p(`loglevel_info`),`info`],[p(`loglevel_warn`),`warn`],[p(`loglevel_error`),`error`]]),`Severity`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`debug_tooltip`)),this.setHelpUrl(m(`debug_help`))}},o.forBlock.debug=function(e){let t=o.valueToCode(e,`TEXT`,a.ATOMIC);return`console.${e.getFieldValue(`Severity`)}(${t});\n`},f.System.blocks.comment=`<block type="comment"></block>`,i.comment={init:function(){this.appendDummyInput(`COMMENT`).appendField(new f.FieldMultilineInput(p(`comment`)),`COMMENT`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(`#FFFF00`),this.setTooltip(p(`comment_tooltip`))}},o.forBlock.comment=function(e){return`${o.prefixLines(e.getFieldValue(`COMMENT`),`// `)}\n`},f.System.blocks.control=`<block type="control"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.control={init:function(){this.appendDummyInput().appendField(p(`control`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`control_with`)),this.appendDummyInput(`WITH_DELAY`).appendField(p(`control_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_tooltip`)),this.setHelpUrl(m(`control_help`))},...v(`control_clear_running`)},o.forBlock.control=function(e){let t=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let n=b(e),i=l(e.getFieldValue(`CLEAR_RUNNING`)),s=o.valueToCode(e,`VALUE`,a.ATOMIC),u=c(t),d=u?` /* ${u} */`:``;return l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${t}'${d}, ${s}, ${n}, ${i});\n`:`setState('${t}'${d}, ${s});\n`},f.System.blocks.toggle=`<sep gap="5"></sep><block type="toggle"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.toggle={init:function(){this.appendDummyInput().appendField(p(`toggle`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendDummyInput(`WITH_DELAY`).appendField(p(`toggle_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`toggle_tooltip`)),this.setHelpUrl(m(`toggle_help`))},...v(`toggle_clear_running`)},o.forBlock.toggle=function(e){var t;let n=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let i=b(e),a=(t=window.main)==null||(t=t.objects[n])==null?void 0:t.common,s=(a==null?void 0:a.type)||`boolean`,u=c(n),d=u?` /* ${u} */`:``,f=l(e.getFieldValue(`CLEAR_RUNNING`)),p;if(s===`number`){let e=a.max===void 0?100:parseFloat(a.max),t=a.min===void 0?0:parseFloat(a.min);p=`setState('${n}'${d}, state ? (state.val === ${t} ? ${e} : ${t}) : ${e});`}else p=`setState('${n}'${d}, state ? !state.val : true);`;let m=l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${n}'${d}, state ? !state.val : true, ${i}, ${f});`:p;return`getState('${n}', (err, state) => {\n${o.prefixLines(m,o.INDENT)}\n});\n`},f.System.blocks.update=`<sep gap="5"></sep><block type="update"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.update={init:function(){this.appendDummyInput().appendField(p(`update`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`update_with`)),this.appendDummyInput(`WITH_DELAY`).appendField(p(`update_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`update_tooltip`)),this.setHelpUrl(m(`update_help`))},...v(`control_clear_running`)},o.forBlock.update=function(e){let t=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let n=o.valueToCode(e,`VALUE`,a.ATOMIC),i=b(e),s=l(e.getFieldValue(`CLEAR_RUNNING`)),u=c(t),d=u?` /* ${u} */`:``;return l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${t}'${d}, ${n}, true, ${i}, ${s});\n`:`setState('${t}'${d}, ${n}, true);\n`},f.System.blocks.control_ex=`<sep gap="5"></sep><block type="control_ex"> <field name="TYPE">false</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid"> </shadow> </value> <value name="VALUE"> <shadow type="logic_boolean"> <field name="BOOL">TRUE</field> </shadow> </value> <value name="DELAY_MS"> <shadow type="math_number"> <field name="NUM">0</field> </shadow> </value> <value name="EXPIRE"> <shadow type="math_number"> <field name="NUM">0</field> </shadow> </value></block>`,i.control_ex={init:function(){this.appendDummyInput().appendField(p(`control_ex`)),this.appendValueInput(`OID`).setCheck(`String`).appendField(p(`field_oid_OID`)),this.appendDummyInput(`TYPE`).appendField(new e([[p(`control_ex_control`),`false`],[p(`control_ex_update`),`true`]]),`TYPE`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`control_ex_value`)),this.appendValueInput(`DELAY_MS`).setCheck(`Number`).appendField(p(`control_ex_delay`)),this.appendValueInput(`EXPIRE`).setCheck(`Number`).appendField(p(`control_ex_expire`)),this.appendDummyInput(`CLEAR_RUNNING_INPUT`).appendField(p(`control_ex_clear_running`)).appendField(new n,`CLEAR_RUNNING`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_tooltip`)),this.setHelpUrl(m(`control_help`))}},o.forBlock.control_ex=function(e){let t=o.valueToCode(e,`OID`,a.ATOMIC),n=o.valueToCode(e,`VALUE`,a.ATOMIC),r=o.valueToCode(e,`DELAY_MS`,a.ATOMIC),i=o.valueToCode(e,`EXPIRE`,a.ATOMIC),s=l(e.getFieldValue(`CLEAR_RUNNING`));return`setStateDelayed(${t}, { val: ${n}, ack: ${l(e.getFieldValue(`TYPE`))}${i?`, expire: ${i}`:``} }, parseInt(((${r}) || '').toString(), 10), ${s});\n`},f.System.blocks.create=`<block type="create"> <field name="NAME">0_userdata.0.example</field></block>`,i.create={init:function(){this.appendDummyInput().appendField(p(`create`)),this.appendDummyInput(`NAME`).appendField(p(`create_oid`)).appendField(new t(`0_userdata.0.example`),`NAME`);let e=this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`create_init`));e.connection&&(e.connection._optional=!0);let n=this.appendValueInput(`COMMON`).setCheck(null).appendField(p(`create_common`));n.connection&&(n.connection._optional=!0),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`create_tooltip`)),this.setHelpUrl(m(`create_help`))}},o.forBlock.create=function(e){let t=e.getFieldValue(`NAME`),n=o.valueToCode(e,`VALUE`,a.ATOMIC),r=n!==null&&n!==``?`, ${n}`:``,i=o.valueToCode(e,`COMMON`,a.ATOMIC),c=i!==null&&i!==``?`, ((common) => typeof common !== 'object' ? JSON.parse(common) : common)(${i})`:``,l=o.statementToCode(e,`STATEMENT`);return`createState(${s(t)}${r}${c}, async () => {\n${l}});\n`},f.System.blocks.create_ex=`<sep gap="5"></sep><block type="create_ex"> <field name="NAME">0_userdata.0.example</field> <field name="TYPE">string</field> <field name="READABLE">FALSE</field> <field name="WRITEABLE">FALSE</field></block>`,i.create_ex={init:function(){this.appendDummyInput().appendField(p(`create`)),this.appendDummyInput(`NAME`).appendField(p(`create_oid`)).appendField(new t(`0_userdata.0.example`),`NAME`),this.appendDummyInput(`TYPE`).appendField(p(`create_type`)).appendField(new e([[p(`create_type_string`),`string`],[p(`create_type_number`),`number`],[p(`create_type_boolean`),`boolean`],[p(`create_type_json`),`json`],[p(`create_type_object`),`object`],[p(`create_type_array`),`array`]]),`TYPE`);let r=this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`create_init`));r.connection&&(r.connection._optional=!0),this.appendDummyInput(`READABLE_INPUT`).appendField(p(`create_readable`)).appendField(new n(`FALSE`),`READABLE`),this.appendDummyInput(`WRITEABLE_INPUT`).appendField(p(`create_writeable`)).appendField(new n(`FALSE`),`WRITEABLE`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`create_tooltip`)),this.setHelpUrl(m(`create_help`))}},o.forBlock.create_ex=function(e){let t=e.getFieldValue(`NAME`),n=e.getFieldValue(`TYPE`),r=``,i=o.valueToCode(e,`VALUE`,a.ATOMIC);i!==null&&i!==``&&(r=n===`number`?`, parseFloat(${i})`:n===`boolean`?`, !!${i}`:n===`string`?`, String(${i})`:`, ${i}`);let c=l(e.getFieldValue(`READABLE`)),u=l(e.getFieldValue(`WRITEABLE`)),d=o.statementToCode(e,`STATEMENT`);return`createState(${s(t)}${r}, { type: '${n}', read: ${c}, write: ${u} }, async () => {\n${d}});\n`},f.System.blocks.get_value=`<block type="get_value"> <field name="ATTR">val</field></block>`,i.get_value={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!0)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendDummyInput().appendField(new d(p(`select_id`),`state`),`OID`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))},onchange:_},o.forBlock.get_value=function(e){let t=e.getFieldValue(`OID`),n=e.getFieldValue(`ATTR`);return g(n)?[`(await getObjectAsync('${t}')).${n}`,a.ATOMIC]:[`getState(${s(t)}).${n}`,a.ATOMIC]},f.System.blocks.get_value_var=`<sep gap="5"></sep><block type="get_value_var"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid"> </shadow> </value></block>`,i.get_value_var={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!1)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendValueInput(`OID`).setCheck(null),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))},onchange:_},o.forBlock.get_value_var=function(e){let t=o.valueToCode(e,`OID`,a.ATOMIC),n=e.getFieldValue(`ATTR`);return g(n)?[`(await getObjectAsync(${t})).${n}`,a.ATOMIC]:[`getState(${t}).${n}`,a.ATOMIC]},f.System.blocks.get_value_async=`<sep gap="5"></sep><block type="get_value_async"> <field name="ATTR">val</field></block>`,i.get_value_async={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!1)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendDummyInput().appendField(new d(p(`select_id`),`state`),`OID`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))}},o.forBlock.get_value_async=function(e){let t=e.getFieldValue(`OID`),n=e.getFieldValue(`ATTR`),r=o.statementToCode(e,`STATEMENT`),i=g(n)?{call:`getObjectAsync`,args:`(err, obj)`,from:`obj`}:{call:`getState`,args:`(err, state)`,from:`state`};return`${i.call}(${s(t)}, async ${i.args} => {\n${o.prefixLines(`let value = ${i.from}.${n};`,o.INDENT)}\n${r}});\n`},f.System.blocks.get_object=`<block type="get_object"></block>`,i.get_object={init:function(){this.appendDummyInput().appendField(p(`get_object`)),this.appendDummyInput().appendField(new d(p(`select_id`),`all`),`OID`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.Object.HUE),this.setTooltip(p(`get_object_tooltip`)),this.setHelpUrl(m(`get_object_help`))},onchange:function(){let e=this.getParent();e&&f.System.WARNING_PARENTS.includes(e.type)?this.setWarningText(p(`false_connection_trigger_warning`),this.id):e&&[`direct`,`control_ex`,`get_value_var`].includes(e.type)?this.setWarningText(p(`get_object_connection_warning`),this.id):this.setWarningText(null,this.id)}},o.forBlock.get_object=function(e){return[`getObject(${s(e.getFieldValue(`OID`))})`,a.ATOMIC]},f.System.blocks.get_object_async=`<sep gap="5"></sep><block type="get_object_async"></block>`,i.get_object_async={init:function(){this.appendDummyInput().appendField(p(`get_object`)),this.appendDummyInput().appendField(new d(p(`select_id`),`all`),`OID`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setColour(f.Object.HUE),this.setTooltip(p(`get_object_tooltip`)),this.setHelpUrl(m(`get_object_help`))}},o.forBlock.get_object_async=function(e){let t=o.statementToCode(e,`STATEMENT`);return`getObjectAsync(${s(e.getFieldValue(`OID`))}).then(async (obj) => {\n${t}});\n`},f.System.blocks.state_exists_var=`<sep gap="5"></sep><block type="state_exists_var"> <value name="OID"> <shadow type="field_oid"> </shadow> </value></block>`,i.state_exists_var={init:function(){this.appendDummyInput().appendField(p(`state_exists`)),this.appendValueInput(`OID`).setCheck(null),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(f.System.HUE),this.setTooltip(p(`state_exists_tooltip`)),this.setHelpUrl(m(`state_exists_help`))}},o.forBlock.state_exists_var=function(e){return[`(await existsStateAsync(${o.valueToCode(e,`OID`,a.ATOMIC)||`''`}))`,a.ATOMIC]};let w=(e,t,n)=>{i[e]={init:function(){this.appendDummyInput().appendField(p(t)),this.appendDummyInput().appendField(new d(p(`select_id`),n),`oid`),this.setInputsInline(!0),this.setOutput(!0,`String`),this.setColour(`%{BKY_TEXTS_HUE}`),this.setTooltip(p(`field_oid_tooltip`))}},o.forBlock[e]=function(e){return[s(e.getFieldValue(`oid`)),a.ATOMIC]}};f.System.blocks.field_oid=`<block type="field_oid"></block>`,w(`field_oid`,`field_oid_OID`,`state`),f.System.blocks.field_oid_meta=`<sep gap="5"></sep><block type="field_oid_meta"></block>`,w(`field_oid_meta`,`field_oid_OID_meta`,`meta`),f.System.blocks.field_oid_script=`<sep gap="5"></sep><block type="field_oid_script"></block>`,w(`field_oid_script`,`field_oid_OID_script`,`script`),f.System.blocks.get_attr=`<block type="get_attr"> <value name="PATH"> <shadow type="text"> <field name="TEXT">attribute1</field> </shadow> </value> <value name="OBJECT"> <shadow type="get_object"> <field name="OID">Object ID</field> </shadow> </value></block>`,i.get_attr={init:function(){this.appendValueInput(`PATH`).setCheck(null).appendField(p(`get_attr_path`)),this.appendValueInput(`OBJECT`).appendField(p(`get_attr_by`)),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_attr_tooltip`)),this.setHelpUrl(m(`get_attr_help`))}},o.forBlock.get_attr=function(e){return[`getAttr(${o.valueToCode(e,`OBJECT`,a.ATOMIC)}, ${o.valueToCode(e,`PATH`,a.ATOMIC)})`,a.ATOMIC]},f.System.blocks.direct=`<block type="direct"> <field name="ONLY_CHANGES">TRUE</field> <value name="OID_SRC"> <shadow type="field_oid"> <field name="oid">Object ID 1</field> </shadow> </value> <value name="OID_DST"> <shadow type="field_oid"> <field name="oid">Object ID 2</field> </shadow> </value></block>`,i.direct={init:function(){this.appendDummyInput().appendField(p(`direct`)),this.appendValueInput(`OID_SRC`).setCheck(`String`).appendField(p(`direct_oid_src`)),this.appendValueInput(`OID_DST`).setCheck(`String`).appendField(p(`direct_oid_dst`)),this.appendDummyInput(`ONLY_CHANGES`).appendField(p(`direct_only_changes`)).appendField(new n(`TRUE`),`ONLY_CHANGES`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.Trigger.HUE),this.setTooltip(p(`direct_tooltip`)),this.setHelpUrl(m(`direct_help`))}},o.forBlock.direct=function(e){let t=o.valueToCode(e,`OID_SRC`,a.ATOMIC),n=o.valueToCode(e,`OID_DST`,a.ATOMIC);return`on({ id: ${t}, change: '${l(e.getFieldValue(`ONLY_CHANGES`))?`ne`:`any`}' }, (obj) => {\n${o.prefixLines(`setState(${n}, obj.state.val);`,o.INDENT)}\n});\n`},f.System.blocks.control_instance=`<block type="control_instance"> <field name="INSTANCE">admin.0</field> <field name="ACTION">restartInstanceAsync</field></block>`,i.control_instance={init:function(){var n;let r=[];if((n=window.main)!=null&&n.instances){for(let e of window.main.instances){let t=e.substring(15);r.push([t,t])}r.length||r.push([p(`control_instance_no_instances`),``]),this.appendDummyInput(`INSTANCE`).appendField(p(`control_instance`)).appendField(new e(r),`INSTANCE`)}else this.appendDummyInput(`INSTANCE`).appendField(p(`control_instance`)).appendField(new t(`adapter.0`),`INSTANCE`);this.appendDummyInput(`ACTION`).appendField(p(`control_instance_action`)).appendField(new e([[p(`control_instance_start`),`startInstanceAsync`],[p(`control_instance_stop`),`stopInstanceAsync`],[p(`control_instance_restart`),`restartInstanceAsync`]]),`ACTION`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_instance_tooltip`)),this.setHelpUrl(m(`control_instance_help`))}},o.forBlock.control_instance=function(e){return`await ${e.getFieldValue(`ACTION`)}(${s(e.getFieldValue(`INSTANCE`))});\n`},f.System.blocks.control_script=`<block type="control_script"> <field name="ACTION">startScriptAsync</field></block>`,i.control_script={init:function(){this.appendDummyInput(`OID`).appendField(p(`control_script`)).appendField(new d(p(`select_id`),`script`),`OID`),this.appendDummyInput(`ACTION`).appendField(p(`control_instance_action`)).appendField(new e([[p(`control_script_start`),`startScriptAsync`],[p(`control_script_stop`),`stopScriptAsync`]]),`ACTION`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_script_tooltip`)),this.setHelpUrl(m(`control_script_help`))}},o.forBlock.control_script=function(e){return`await ${e.getFieldValue(`ACTION`)}(${s(e.getFieldValue(`OID`))});\n`},f.System.blocks.regex=`<block type="regex"> <field name="TEXT">(.*)</field></block>`,i.regex={init:function(){this.appendDummyInput().appendField(`RegExp`),this.appendDummyInput(`TEXT`).appendField(new t(`(.*)`),`TEXT`),this.setInputsInline(!0),this.setOutput(!0,`Array`),this.setColour(f.System.HUE)}},o.forBlock.regex=function(e){return[`new RegExp(${s(e.getFieldValue(`TEXT`))})`,a.ATOMIC]},f.System.blocks.selector=`<block type="selector"> <field name="TEXT">channel[state.id=*]</field></block>`,i.selector={init:function(){this.appendDummyInput().appendField(`${p(`selector`)} $(`),this.appendDummyInput(`TEXT`).appendField(new t(`channel[state.id=*]`),`TEXT`),this.appendDummyInput().appendField(`)`),this.setInputsInline(!0),this.setOutput(!0,`Array`),this.setColour(f.System.HUE)}},o.forBlock.selector=function(e){return[`Array.prototype.slice.apply($(${s(e.getFieldValue(`TEXT`))}))`,a.ATOMIC]}}export{f as install};
1
+ import{i as e,o as t,r as n,s as r,t as i}from"./blockly-Fp-1_Ye3.js";import{c as a,l as o}from"./index-DwTLl2xB.js";import{c as s,o as c,r as l,u}from"./helpers-DIT6UgRN.js";import{FieldOID as d}from"./field_oid-fYE12Bhj.js";function f(){let f=window.Blockly,p=f.Translate,m=window.getHelp;f.CustomBlocks=f.CustomBlocks||[],f.CustomBlocks.push(`System`),f.System={HUE:210,blocks:{},WARNING_PARENTS:[`on_ext`]};let h=e=>[[p(`get_value_val`),`val`],[p(`get_value_ack`),`ack`],[p(`get_value_ts`),`ts`],[p(`get_value_lc`),`lc`],[p(`get_value_q`),`q`],[p(`get_value_comment`),`c`],[p(`get_value_from`),`from`],...e?[[p(`get_value_user`),`user`]]:[],[p(`get_common_name`),`common.name`],[p(`get_common_desc`),`common.desc`],[p(`get_common_unit`),`common.unit`],[p(`get_common_role`),`common.role`],[p(`get_common_state_type`),`common.type`],[p(`get_common_read`),`common.read`],[p(`get_common_write`),`common.write`]],g=e=>e===`type`||e.startsWith(`common.`),_=function(){let e=this.getParent();e&&f.System.WARNING_PARENTS.includes(e.type)?this.setWarningText(p(`false_connection_trigger_warning`),this.id):this.setWarningText(null,this.id)},v=r=>({mutationToDom:function(){let e=document.createElement(`mutation`);return e.setAttribute(`delay_input`,String(l(this.getFieldValue(`WITH_DELAY`)))),e},domToMutation:function(e){this.updateShape_(l(e.getAttribute(`delay_input`)))},updateShape_:function(i){i?this.getInput(`DELAY`)||this.appendDummyInput(`DELAY`).appendField(` `).appendField(new t(`1000`),`DELAY_MS`).appendField(new e([[p(`control_ms`),`ms`],[p(`control_sec`),`sec`],[p(`control_min`),`min`]]),`UNIT`):this.getInput(`DELAY`)&&this.removeInput(`DELAY`),i?this.getInput(`CLEAR_RUNNING_INPUT`)||this.appendDummyInput(`CLEAR_RUNNING_INPUT`).appendField(p(r)).appendField(new n,`CLEAR_RUNNING`):this.getInput(`CLEAR_RUNNING_INPUT`)&&this.removeInput(`CLEAR_RUNNING_INPUT`)}}),y=()=>new n(`FALSE`,function(e){this.getSourceBlock().updateShape_(l(e))}),b=e=>u(e.getFieldValue(`DELAY_MS`),e.getFieldValue(`UNIT`));f.System.blocks.global_var=`<block type="global_var"> <field name="VAR">scriptName</field></block>`,i.global_var={init:function(){this.appendDummyInput(`VAR`).appendField(new e([[p(`global_var_scriptname`),`scriptName`],[p(`global_var_defaultdatadir`),`defaultDataDir`],[p(`global_var_verbose`),`verbose`]]),`VAR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`global_var_tooltip`)),this.setHelpUrl(m(`global_var`))}},o.forBlock.global_var=function(e){return[e.getFieldValue(`VAR`),a.ATOMIC]},f.System.blocks.secret=`<block type="secret"></block>`;let x=()=>{var e;return((e=window.main)==null?void 0:e.secrets)||[]},S=()=>x().length?x().map(e=>[e.name,e.name]):[[p(`secret_no_secrets`),``]],C=function(){var e,t;let n=(e=this.getSourceBlock())==null?void 0:e.getFieldValue(`NAME`),r=(t=x().find(e=>e.name===n))==null?void 0:t.fields;return(r!=null&&r.length?r:[`key`,`login`,`password`]).map(e=>[e,e])};i.secret={init:function(){let n=this.appendDummyInput(`SECRET`).appendField(p(`secret`));x().length?n.appendField(new e(S),`NAME`):n.appendField(new t(`CameraPassword`),`NAME`),n.appendField(p(`secret_attr`)).appendField(new e(C),`ATTR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`secret_tooltip`)),this.setHelpUrl(m(`secret_help`))}},o.forBlock.secret=function(e){let t=e.getFieldValue(`NAME`),n=e.getFieldValue(`ATTR`),r=/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n)?`.${n}`:`[${s(n)}]`;return[`SECRETS[${s(t)}]?${r}`,a.ATOMIC]},f.System.blocks.debug=`<block type="debug"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text"> <field name="TEXT">test</field> </shadow> </value></block>`,i.debug={init:function(){this.appendValueInput(`TEXT`).setCheck(null).appendField(p(`debug`)),this.appendDummyInput(`Severity`).appendField(new e([[p(`loglevel_debug`),`debug`],[p(`loglevel_info`),`info`],[p(`loglevel_warn`),`warn`],[p(`loglevel_error`),`error`]]),`Severity`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`debug_tooltip`)),this.setHelpUrl(m(`debug_help`))}},o.forBlock.debug=function(e){let t=o.valueToCode(e,`TEXT`,a.ATOMIC);return`console.${e.getFieldValue(`Severity`)}(${t});\n`},f.System.blocks.comment=`<block type="comment"></block>`,i.comment={init:function(){this.appendDummyInput(`COMMENT`).appendField(new f.FieldMultilineInput(p(`comment`)),`COMMENT`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(`#FFFF00`),this.setTooltip(p(`comment_tooltip`))}},o.forBlock.comment=function(e){return`${o.prefixLines(e.getFieldValue(`COMMENT`),`// `)}\n`},f.System.blocks.control=`<block type="control"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.control={init:function(){this.appendDummyInput().appendField(p(`control`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`control_with`)),this.appendDummyInput(`WITH_DELAY`).appendField(p(`control_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_tooltip`)),this.setHelpUrl(m(`control_help`))},...v(`control_clear_running`)},o.forBlock.control=function(e){let t=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let n=b(e),i=l(e.getFieldValue(`CLEAR_RUNNING`)),s=o.valueToCode(e,`VALUE`,a.ATOMIC),u=c(t),d=u?` /* ${u} */`:``;return l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${t}'${d}, ${s}, ${n}, ${i});\n`:`setState('${t}'${d}, ${s});\n`},f.System.blocks.toggle=`<sep gap="5"></sep><block type="toggle"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.toggle={init:function(){this.appendDummyInput().appendField(p(`toggle`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendDummyInput(`WITH_DELAY`).appendField(p(`toggle_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`toggle_tooltip`)),this.setHelpUrl(m(`toggle_help`))},...v(`toggle_clear_running`)},o.forBlock.toggle=function(e){var t;let n=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let i=b(e),a=(t=window.main)==null||(t=t.objects[n])==null?void 0:t.common,s=(a==null?void 0:a.type)||`boolean`,u=c(n),d=u?` /* ${u} */`:``,f=l(e.getFieldValue(`CLEAR_RUNNING`)),p;if(s===`number`){let e=a.max===void 0?100:parseFloat(a.max),t=a.min===void 0?0:parseFloat(a.min);p=`setState('${n}'${d}, state ? (state.val === ${t} ? ${e} : ${t}) : ${e});`}else p=`setState('${n}'${d}, state ? !state.val : true);`;let m=l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${n}'${d}, state ? !state.val : true, ${i}, ${f});`:p;return`getState('${n}', (err, state) => {\n${o.prefixLines(m,o.INDENT)}\n});\n`},f.System.blocks.update=`<sep gap="5"></sep><block type="update"> <mutation delay_input="false"></mutation> <field name="WITH_DELAY">FALSE</field></block>`,i.update={init:function(){this.appendDummyInput().appendField(p(`update`)),this.appendDummyInput(`OID`).appendField(new d(p(`select_id`),`state`),`OID`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`update_with`)),this.appendDummyInput(`WITH_DELAY`).appendField(p(`update_delay`)).appendField(y(),`WITH_DELAY`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`update_tooltip`)),this.setHelpUrl(m(`update_help`))},...v(`control_clear_running`)},o.forBlock.update=function(e){let t=e.getFieldValue(`OID`);r.VARIABLES_DEFAULT_NAME=`value`;let n=o.valueToCode(e,`VALUE`,a.ATOMIC),i=b(e),s=l(e.getFieldValue(`CLEAR_RUNNING`)),u=c(t),d=u?` /* ${u} */`:``;return l(e.getFieldValue(`WITH_DELAY`))?`setStateDelayed('${t}'${d}, ${n}, true, ${i}, ${s});\n`:`setState('${t}'${d}, ${n}, true);\n`},f.System.blocks.control_ex=`<sep gap="5"></sep><block type="control_ex"> <field name="TYPE">false</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid"> </shadow> </value> <value name="VALUE"> <shadow type="logic_boolean"> <field name="BOOL">TRUE</field> </shadow> </value> <value name="DELAY_MS"> <shadow type="math_number"> <field name="NUM">0</field> </shadow> </value> <value name="EXPIRE"> <shadow type="math_number"> <field name="NUM">0</field> </shadow> </value></block>`,i.control_ex={init:function(){this.appendDummyInput().appendField(p(`control_ex`)),this.appendValueInput(`OID`).setCheck(`String`).appendField(p(`field_oid_OID`)),this.appendDummyInput(`TYPE`).appendField(new e([[p(`control_ex_control`),`false`],[p(`control_ex_update`),`true`]]),`TYPE`),this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`control_ex_value`)),this.appendValueInput(`DELAY_MS`).setCheck(`Number`).appendField(p(`control_ex_delay`)),this.appendValueInput(`EXPIRE`).setCheck(`Number`).appendField(p(`control_ex_expire`)),this.appendDummyInput(`CLEAR_RUNNING_INPUT`).appendField(p(`control_ex_clear_running`)).appendField(new n,`CLEAR_RUNNING`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_tooltip`)),this.setHelpUrl(m(`control_help`))}},o.forBlock.control_ex=function(e){let t=o.valueToCode(e,`OID`,a.ATOMIC),n=o.valueToCode(e,`VALUE`,a.ATOMIC),r=o.valueToCode(e,`DELAY_MS`,a.ATOMIC),i=o.valueToCode(e,`EXPIRE`,a.ATOMIC),s=l(e.getFieldValue(`CLEAR_RUNNING`));return`setStateDelayed(${t}, { val: ${n}, ack: ${l(e.getFieldValue(`TYPE`))}${i?`, expire: ${i}`:``} }, parseInt(((${r}) || '').toString(), 10), ${s});\n`},f.System.blocks.create=`<block type="create"> <field name="NAME">0_userdata.0.example</field></block>`,i.create={init:function(){this.appendDummyInput().appendField(p(`create`)),this.appendDummyInput(`NAME`).appendField(p(`create_oid`)).appendField(new t(`0_userdata.0.example`),`NAME`);let e=this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`create_init`));e.connection&&(e.connection._optional=!0);let n=this.appendValueInput(`COMMON`).setCheck(null).appendField(p(`create_common`));n.connection&&(n.connection._optional=!0),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`create_tooltip`)),this.setHelpUrl(m(`create_help`))}},o.forBlock.create=function(e){let t=e.getFieldValue(`NAME`),n=o.valueToCode(e,`VALUE`,a.ATOMIC),r=n!==null&&n!==``?`, ${n}`:``,i=o.valueToCode(e,`COMMON`,a.ATOMIC),c=i!==null&&i!==``?`, ((common) => typeof common !== 'object' ? JSON.parse(common) : common)(${i})`:``,l=o.statementToCode(e,`STATEMENT`);return`createState(${s(t)}${r}${c}, async () => {\n${l}});\n`},f.System.blocks.create_ex=`<sep gap="5"></sep><block type="create_ex"> <field name="NAME">0_userdata.0.example</field> <field name="TYPE">string</field> <field name="READABLE">FALSE</field> <field name="WRITEABLE">FALSE</field></block>`,i.create_ex={init:function(){this.appendDummyInput().appendField(p(`create`)),this.appendDummyInput(`NAME`).appendField(p(`create_oid`)).appendField(new t(`0_userdata.0.example`),`NAME`),this.appendDummyInput(`TYPE`).appendField(p(`create_type`)).appendField(new e([[p(`create_type_string`),`string`],[p(`create_type_number`),`number`],[p(`create_type_boolean`),`boolean`],[p(`create_type_json`),`json`],[p(`create_type_object`),`object`],[p(`create_type_array`),`array`]]),`TYPE`);let r=this.appendValueInput(`VALUE`).setCheck(null).appendField(p(`create_init`));r.connection&&(r.connection._optional=!0),this.appendDummyInput(`READABLE_INPUT`).appendField(p(`create_readable`)).appendField(new n(`FALSE`),`READABLE`),this.appendDummyInput(`WRITEABLE_INPUT`).appendField(p(`create_writeable`)).appendField(new n(`FALSE`),`WRITEABLE`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`create_tooltip`)),this.setHelpUrl(m(`create_help`))}},o.forBlock.create_ex=function(e){let t=e.getFieldValue(`NAME`),n=e.getFieldValue(`TYPE`),r=``,i=o.valueToCode(e,`VALUE`,a.ATOMIC);i!==null&&i!==``&&(r=n===`number`?`, parseFloat(${i})`:n===`boolean`?`, !!${i}`:n===`string`?`, String(${i})`:`, ${i}`);let c=l(e.getFieldValue(`READABLE`)),u=l(e.getFieldValue(`WRITEABLE`)),d=o.statementToCode(e,`STATEMENT`);return`createState(${s(t)}${r}, { type: '${n}', read: ${c}, write: ${u} }, async () => {\n${d}});\n`},f.System.blocks.get_value=`<block type="get_value"> <field name="ATTR">val</field></block>`,i.get_value={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!0)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendDummyInput().appendField(new d(p(`select_id`),`state`),`OID`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))},onchange:_},o.forBlock.get_value=function(e){let t=e.getFieldValue(`OID`),n=e.getFieldValue(`ATTR`);return g(n)?[`(await getObjectAsync('${t}')).${n}`,a.ATOMIC]:[`getState(${s(t)}).${n}`,a.ATOMIC]},f.System.blocks.get_value_var=`<sep gap="5"></sep><block type="get_value_var"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid"> </shadow> </value></block>`,i.get_value_var={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!1)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendValueInput(`OID`).setCheck(null),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))},onchange:_},o.forBlock.get_value_var=function(e){let t=o.valueToCode(e,`OID`,a.ATOMIC),n=e.getFieldValue(`ATTR`);return g(n)?[`(await getObjectAsync(${t})).${n}`,a.ATOMIC]:[`getState(${t}).${n}`,a.ATOMIC]},f.System.blocks.get_value_async=`<sep gap="5"></sep><block type="get_value_async"> <field name="ATTR">val</field></block>`,i.get_value_async={init:function(){this.appendDummyInput(`ATTR`).appendField(new e(h(!1)),`ATTR`),this.appendDummyInput().appendField(p(`get_value_OID`)),this.appendDummyInput().appendField(new d(p(`select_id`),`state`),`OID`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`get_value_tooltip`)),this.setHelpUrl(m(`get_value_help`))}},o.forBlock.get_value_async=function(e){let t=e.getFieldValue(`OID`),n=e.getFieldValue(`ATTR`),r=o.statementToCode(e,`STATEMENT`),i=g(n)?{call:`getObjectAsync`,args:`(err, obj)`,from:`obj`}:{call:`getState`,args:`(err, state)`,from:`state`};return`${i.call}(${s(t)}, async ${i.args} => {\n${o.prefixLines(`let value = ${i.from}.${n};`,o.INDENT)}\n${r}});\n`},f.System.blocks.get_object=`<block type="get_object"></block>`,i.get_object={init:function(){this.appendDummyInput().appendField(p(`get_object`)),this.appendDummyInput().appendField(new d(p(`select_id`),`all`),`OID`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.Object.HUE),this.setTooltip(p(`get_object_tooltip`)),this.setHelpUrl(m(`get_object_help`))},onchange:function(){let e=this.getParent();e&&f.System.WARNING_PARENTS.includes(e.type)?this.setWarningText(p(`false_connection_trigger_warning`),this.id):e&&[`direct`,`control_ex`,`get_value_var`].includes(e.type)?this.setWarningText(p(`get_object_connection_warning`),this.id):this.setWarningText(null,this.id)}},o.forBlock.get_object=function(e){return[`getObject(${s(e.getFieldValue(`OID`))})`,a.ATOMIC]},f.System.blocks.get_object_async=`<sep gap="5"></sep><block type="get_object_async"></block>`,i.get_object_async={init:function(){this.appendDummyInput().appendField(p(`get_object`)),this.appendDummyInput().appendField(new d(p(`select_id`),`all`),`OID`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setInputsInline(!0),this.setColour(f.Object.HUE),this.setTooltip(p(`get_object_tooltip`)),this.setHelpUrl(m(`get_object_help`))}},o.forBlock.get_object_async=function(e){let t=o.statementToCode(e,`STATEMENT`);return`getObjectAsync(${s(e.getFieldValue(`OID`))}).then(async (obj) => {\n${t}});\n`},f.System.blocks.state_exists_var=`<sep gap="5"></sep><block type="state_exists_var"> <value name="OID"> <shadow type="field_oid"> </shadow> </value></block>`,i.state_exists_var={init:function(){this.appendDummyInput().appendField(p(`state_exists`)),this.appendValueInput(`OID`).setCheck(null),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(f.System.HUE),this.setTooltip(p(`state_exists_tooltip`)),this.setHelpUrl(m(`state_exists_help`))}},o.forBlock.state_exists_var=function(e){return[`(await existsStateAsync(${o.valueToCode(e,`OID`,a.ATOMIC)||`''`}))`,a.ATOMIC]};let w=(e,t,n)=>{i[e]={init:function(){this.appendDummyInput().appendField(p(t)),this.appendDummyInput().appendField(new d(p(`select_id`),n),`oid`),this.setInputsInline(!0),this.setOutput(!0,`String`),this.setColour(`%{BKY_TEXTS_HUE}`),this.setTooltip(p(`field_oid_tooltip`))}},o.forBlock[e]=function(e){return[s(e.getFieldValue(`oid`)),a.ATOMIC]}};f.System.blocks.field_oid=`<block type="field_oid"></block>`,w(`field_oid`,`field_oid_OID`,`state`),f.System.blocks.field_oid_meta=`<sep gap="5"></sep><block type="field_oid_meta"></block>`,w(`field_oid_meta`,`field_oid_OID_meta`,`meta`),f.System.blocks.field_oid_script=`<sep gap="5"></sep><block type="field_oid_script"></block>`,w(`field_oid_script`,`field_oid_OID_script`,`script`),f.System.blocks.get_attr=`<block type="get_attr"> <value name="PATH"> <shadow type="text"> <field name="TEXT">attribute1</field> </shadow> </value> <value name="OBJECT"> <shadow type="get_object"> <field name="OID">Object ID</field> </shadow> </value></block>`,i.get_attr={init:function(){this.appendValueInput(`PATH`).setCheck(null).appendField(p(`get_attr_path`)),this.appendValueInput(`OBJECT`).appendField(p(`get_attr_by`)),this.setInputsInline(!0),this.setOutput(!0),this.setColour(f.System.HUE),this.setTooltip(p(`get_attr_tooltip`)),this.setHelpUrl(m(`get_attr_help`))}},o.forBlock.get_attr=function(e){return[`getAttr(${o.valueToCode(e,`OBJECT`,a.ATOMIC)}, ${o.valueToCode(e,`PATH`,a.ATOMIC)})`,a.ATOMIC]},f.System.blocks.direct=`<block type="direct"> <field name="ONLY_CHANGES">TRUE</field> <value name="OID_SRC"> <shadow type="field_oid"> <field name="oid">Object ID 1</field> </shadow> </value> <value name="OID_DST"> <shadow type="field_oid"> <field name="oid">Object ID 2</field> </shadow> </value></block>`,i.direct={init:function(){this.appendDummyInput().appendField(p(`direct`)),this.appendValueInput(`OID_SRC`).setCheck(`String`).appendField(p(`direct_oid_src`)),this.appendValueInput(`OID_DST`).setCheck(`String`).appendField(p(`direct_oid_dst`)),this.appendDummyInput(`ONLY_CHANGES`).appendField(p(`direct_only_changes`)).appendField(new n(`TRUE`),`ONLY_CHANGES`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.Trigger.HUE),this.setTooltip(p(`direct_tooltip`)),this.setHelpUrl(m(`direct_help`))}},o.forBlock.direct=function(e){let t=o.valueToCode(e,`OID_SRC`,a.ATOMIC),n=o.valueToCode(e,`OID_DST`,a.ATOMIC);return`on({ id: ${t}, change: '${l(e.getFieldValue(`ONLY_CHANGES`))?`ne`:`any`}' }, (obj) => {\n${o.prefixLines(`setState(${n}, obj.state.val);`,o.INDENT)}\n});\n`},f.System.blocks.control_instance=`<block type="control_instance"> <field name="INSTANCE">admin.0</field> <field name="ACTION">restartInstanceAsync</field></block>`,i.control_instance={init:function(){var n;let r=[];if((n=window.main)!=null&&n.instances){for(let e of window.main.instances){let t=e.substring(15);r.push([t,t])}r.length||r.push([p(`control_instance_no_instances`),``]),this.appendDummyInput(`INSTANCE`).appendField(p(`control_instance`)).appendField(new e(r),`INSTANCE`)}else this.appendDummyInput(`INSTANCE`).appendField(p(`control_instance`)).appendField(new t(`adapter.0`),`INSTANCE`);this.appendDummyInput(`ACTION`).appendField(p(`control_instance_action`)).appendField(new e([[p(`control_instance_start`),`startInstanceAsync`],[p(`control_instance_stop`),`stopInstanceAsync`],[p(`control_instance_restart`),`restartInstanceAsync`]]),`ACTION`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_instance_tooltip`)),this.setHelpUrl(m(`control_instance_help`))}},o.forBlock.control_instance=function(e){return`await ${e.getFieldValue(`ACTION`)}(${s(e.getFieldValue(`INSTANCE`))});\n`},f.System.blocks.control_script=`<block type="control_script"> <field name="ACTION">startScriptAsync</field></block>`,i.control_script={init:function(){this.appendDummyInput(`OID`).appendField(p(`control_script`)).appendField(new d(p(`select_id`),`script`),`OID`),this.appendDummyInput(`ACTION`).appendField(p(`control_instance_action`)).appendField(new e([[p(`control_script_start`),`startScriptAsync`],[p(`control_script_stop`),`stopScriptAsync`]]),`ACTION`),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(f.System.HUE),this.setTooltip(p(`control_script_tooltip`)),this.setHelpUrl(m(`control_script_help`))}},o.forBlock.control_script=function(e){return`await ${e.getFieldValue(`ACTION`)}(${s(e.getFieldValue(`OID`))});\n`},f.System.blocks.regex=`<block type="regex"> <field name="TEXT">(.*)</field></block>`,i.regex={init:function(){this.appendDummyInput().appendField(`RegExp`),this.appendDummyInput(`TEXT`).appendField(new t(`(.*)`),`TEXT`),this.setInputsInline(!0),this.setOutput(!0,`Array`),this.setColour(f.System.HUE)}},o.forBlock.regex=function(e){return[`new RegExp(${s(e.getFieldValue(`TEXT`))})`,a.ATOMIC]},f.System.blocks.selector=`<block type="selector"> <field name="TEXT">channel[state.id=*]</field></block>`,i.selector={init:function(){this.appendDummyInput().appendField(`${p(`selector`)} $(`),this.appendDummyInput(`TEXT`).appendField(new t(`channel[state.id=*]`),`TEXT`),this.appendDummyInput().appendField(`)`),this.setInputsInline(!0),this.setOutput(!0,`Array`),this.setColour(f.System.HUE)}},o.forBlock.selector=function(e){return[`Array.prototype.slice.apply($(${s(e.getFieldValue(`TEXT`))}))`,a.ATOMIC]}}export{f as install};
@@ -1 +1 @@
1
- import{i as e,t}from"./blockly-DBw-ytY1.js";import{c as n,l as r}from"./index-BnLv569U.js";function i(){let i=window.Blockly.Translate;t.text_newline={init:function(){this.appendDummyInput().appendField(i(`text_newline`)),this.appendDummyInput().appendField(new e([[`\\n`,`\\n`],[`\\r`,`\\r`],[`\\r\\n`,`\\r\\n`]]),`Type`),this.setInputsInline(!0),this.setOutput(!0,`String`),this.setColour(`%{BKY_TEXTS_HUE}`),this.setTooltip(i(`text_newline_tooltip`))}},r.forBlock.text_newline=function(e){return[`'${e.getFieldValue(`Type`)}'`,n.ATOMIC]},t.text_contains={init:function(){this.appendDummyInput().appendField(i(`text_contains`)),this.appendValueInput(`VALUE`).setCheck(null),this.appendValueInput(`FIND`).setCheck(null).appendField(i(`text_contains_value`)),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(`%{BKY_TEXTS_HUE}`)}},r.forBlock.text_contains=function(e){return[`String(${r.valueToCode(e,`VALUE`,n.ATOMIC)}).includes(${r.valueToCode(e,`FIND`,n.ATOMIC)})`,n.ATOMIC]},t.text_format_value={init:function(){this.appendValueInput(`VALUE`).appendField(i(`text_format_value`)).setCheck(null),this.appendDummyInput().appendField(i(`text_format_value_format`)).appendField(new e([[`System`,`system`],[`.,`,`.,`],[`,.`,`,.`],[` .`,` .`]]),`FORMAT`),this.appendValueInput(`DECIMALS`).appendField(i(`text_format_value_decimals`)),this.setInputsInline(!0),this.setOutput(!0,`String`),this.setColour(`%{BKY_TEXTS_HUE}`)}},r.forBlock.text_format_value=function(e){let t=r.valueToCode(e,`VALUE`,n.ATOMIC),i=r.valueToCode(e,`DECIMALS`,n.ATOMIC),a=e.getFieldValue(`FORMAT`);return a===`system`?[`formatValue(parseFloat(${t}), ${i})`,n.ATOMIC]:[`formatValue(parseFloat(${t}), ${i}, '${a}')`,n.ATOMIC]}}export{i as install};
1
+ import{i as e,t}from"./blockly-Fp-1_Ye3.js";import{c as n,l as r}from"./index-DwTLl2xB.js";function i(){let i=window.Blockly.Translate;t.text_newline={init:function(){this.appendDummyInput().appendField(i(`text_newline`)),this.appendDummyInput().appendField(new e([[`\\n`,`\\n`],[`\\r`,`\\r`],[`\\r\\n`,`\\r\\n`]]),`Type`),this.setInputsInline(!0),this.setOutput(!0,`String`),this.setColour(`%{BKY_TEXTS_HUE}`),this.setTooltip(i(`text_newline_tooltip`))}},r.forBlock.text_newline=function(e){return[`'${e.getFieldValue(`Type`)}'`,n.ATOMIC]},t.text_contains={init:function(){this.appendDummyInput().appendField(i(`text_contains`)),this.appendValueInput(`VALUE`).setCheck(null),this.appendValueInput(`FIND`).setCheck(null).appendField(i(`text_contains_value`)),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(`%{BKY_TEXTS_HUE}`)}},r.forBlock.text_contains=function(e){return[`String(${r.valueToCode(e,`VALUE`,n.ATOMIC)}).includes(${r.valueToCode(e,`FIND`,n.ATOMIC)})`,n.ATOMIC]},t.text_format_value={init:function(){this.appendValueInput(`VALUE`).appendField(i(`text_format_value`)).setCheck(null),this.appendDummyInput().appendField(i(`text_format_value_format`)).appendField(new e([[`System`,`system`],[`.,`,`.,`],[`,.`,`,.`],[` .`,` .`]]),`FORMAT`),this.appendValueInput(`DECIMALS`).appendField(i(`text_format_value_decimals`)),this.setInputsInline(!0),this.setOutput(!0,`String`),this.setColour(`%{BKY_TEXTS_HUE}`)}},r.forBlock.text_format_value=function(e){let t=r.valueToCode(e,`VALUE`,n.ATOMIC),i=r.valueToCode(e,`DECIMALS`,n.ATOMIC),a=e.getFieldValue(`FORMAT`);return a===`system`?[`formatValue(parseFloat(${t}), ${i})`,n.ATOMIC]:[`formatValue(parseFloat(${t}), ${i}, '${a}')`,n.ATOMIC]}}export{i as install};
@@ -1 +1 @@
1
- import{i as e,o as t,r as n,t as r}from"./blockly-DBw-ytY1.js";import{c as i,l as a}from"./index-BnLv569U.js";import{c as o,n as s,t as c}from"./helpers-BFQD9R82.js";var l={"time_get_yyyy.mm.dd":`YYYY.MM.DD`,"time_get_yyyy/mm/dd":`YYYY/MM/DD`,"time_get_yy.mm.dd":`YY.MM.DD`,"time_get_yy/mm/dd":`YY/MM/DD`,"time_get_dd.mm.yyyy":`DD.MM.YYYY`,"time_get_dd/mm/yyyy":`DD/MM/YYYY`,"time_get_dd.mm.yy":`DD.MM.YY`,"time_get_dd/mm/yy":`DD/MM/YY`,"time_get_mm/dd/yyyy":`MM/DD/YYYY`,"time_get_mm/dd/yy":`MM/DD/YY`,"time_get_dd.mm":`DD.MM.`,"time_get_dd/mm":`DD/MM`,"time_get_mm.dd":`MM.DD`,"time_get_mm/dd":`MM/DD`,time_get_hh_mm:`hh:mm`,time_get_hh_mm_ss:`hh:mm:ss`,"time_get_hh_mm_ss.sss":`hh:mm:ss.sss`};function u(e){return e===!0||e===`true`||e===`TRUE`}function d(){let d=window.Blockly,f=d.Translate,p=window.getHelp;d.CustomBlocks=d.CustomBlocks||[],d.CustomBlocks.push(`Time`),d.Time={HUE:270,blocks:{}};for(let[e,t]of Object.entries(l))d.Words[e].format=t;let m=()=>[[f(`time_compare_lt`),`<`],[f(`time_compare_le`),`<=`],[f(`time_compare_gt`),`>`],[f(`time_compare_ge`),`>=`],[f(`time_compare_eq`),`==`],[f(`time_compare_bw`),`between`],[f(`time_compare_nb`),`not between`]];d.Time.blocks.time_compare_ex=`<block type="time_compare_ex"> <mutation end_time="false" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">&lt;</field> <value name="START_TIME"> <shadow type="text"> <field name="TEXT">12:00</field> </shadow> </value></block>`,r.time_compare_ex={init:function(){this.appendDummyInput(`TIME_TEXT`).appendField(f(`time_compare_ex`)),this.appendDummyInput(`USE_ACTUAL_TIME`).appendField(new n(`TRUE`,function(e){this.getSourceBlock().updateShape_(void 0,e)}),`USE_ACTUAL_TIME`),this.appendDummyInput().appendField(f(`time_compare_is_ex`)),this.appendDummyInput(`OPTION`).appendField(new e(m(),function(e){this.getSourceBlock().updateShape_(e===`between`||e===`not between`)}),`OPTION`),this.appendDummyInput().appendField(` `),this.appendValueInput(`START_TIME`),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_compare_ex_tooltip`)),this.setHelpUrl(p(`time_compare_ex_help`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`),n=this.getFieldValue(`USE_ACTUAL_TIME`);return e.setAttribute(`end_time`,t===`between`||t===`not between`?`true`:`false`),e.setAttribute(`actual_time`,u(n)?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`end_time`)),u(e.getAttribute(`actual_time`)))},updateShape_:function(e,t){if(e===void 0&&(e=this.getFieldValue(`OPTION`)===`between`||this.getFieldValue(`OPTION`)===`not between`),e){if(!this.getInput(`END_TIME`)&&(this.getInput(`CUSTOM_TIME`)&&(this.removeInput(`CUSTOM_TIME`),this.removeInput(`CUSTOM_TEXT`)),this.appendDummyInput(`AND`).appendField(f(`time_compare_and`)),this.appendValueInput(`END_TIME`),!window.scripts.loading)){let e=this.workspace;setTimeout(()=>{var t;let n=this.getInput(`END_TIME`);if(!(n!=null&&(t=n.connection)!=null&&t.isConnected())){let t=e.newBlock(`text`);t.setShadow(!0),t.setFieldValue(`18:00`,`TEXT`),t.outputConnection.connect(n.connection),t.initSvg(),t.render()}},100)}}else this.getInput(`END_TIME`)&&(this.removeInput(`END_TIME`),this.removeInput(`AND`));t===void 0&&(t=this.getFieldValue(`USE_ACTUAL_TIME`));let n=u(t),r=this.getInput(`CUSTOM_TIME`);n?r&&(this.getInput(`TIME_TEXT`).fieldRow[0].setValue(f(`time_compare_ex`)),this.removeInput(`CUSTOM_TIME`),this.removeInput(`CUSTOM_TEXT`)):(this.getInput(`TIME_TEXT`).fieldRow[0].setValue(f(`time_compare_custom_ex`)),r||(this.appendDummyInput(`CUSTOM_TEXT`).appendField(f(`time_compare_ex_custom`)),this.appendValueInput(`CUSTOM_TIME`)))}},a.forBlock.time_compare_ex=function(e){let t=e.getFieldValue(`OPTION`);return[`compareTime(${a.valueToCode(e,`START_TIME`,i.ATOMIC)}, ${e.getInput(`END_TIME`)&&a.valueToCode(e,`END_TIME`,i.ATOMIC)||null}, '${t}', ${e.getInput(`CUSTOM_TIME`)&&a.valueToCode(e,`CUSTOM_TIME`,i.ATOMIC)||null})`,i.ATOMIC]},d.Time.blocks.time_compare=`<block type="time_compare"> <mutation end_time="false"></mutation> <field name="OPTION">&lt;</field> <field name="START_TIME">12:00</field></block>`,r.time_compare={init:function(){this.appendDummyInput().appendField(f(`time_compare`)),this.appendDummyInput(`OPTION`).appendField(new e(m(),function(e){this.getSourceBlock().updateShape_(e===`between`||e===`not between`)}),`OPTION`),this.appendDummyInput().appendField(` `),this.appendDummyInput(`START_TIME`).appendField(new t(`12:00`),`START_TIME`),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_compare_tooltip`)),this.setHelpUrl(p(`time_compare_help`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`);return e.setAttribute(`end_time`,t===`between`||t===`not between`?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`end_time`)))},updateShape_:function(e){e?this.getInput(`END_TIME`)||(this.appendDummyInput(`AND`).appendField(f(`time_compare_and`)),this.appendDummyInput(`END_TIME`).appendField(new t(`18:00`),`END_TIME`)):this.getInput(`END_TIME`)&&(this.removeInput(`END_TIME`),this.removeInput(`AND`))}},a.forBlock.time_compare=function(e){let t=e.getFieldValue(`OPTION`),n=e.getFieldValue(`START_TIME`),r=e.getFieldValue(`END_TIME`);return[`compareTime(${o(n)}, ${r?o(r):`null`}, ${o(t)})`,i.ATOMIC]},d.Time.blocks.time_get=`<block type="time_get"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field></block>`,r.time_get={init:function(){this.appendDummyInput().appendField(f(`time_get`)),this.appendDummyInput(`OPTION`).appendField(new e(c(),function(e){this.getSourceBlock().updateShape_(e===`custom`,e===`wdt`||e===`wdts`||e===`Mt`||e===`Mts`)}),`OPTION`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Time.HUE),this.setTooltip(f(`time_get_tooltip`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`);return e.setAttribute(`format`,t===`custom`?`true`:`false`),e.setAttribute(`language`,t===`wdt`||t===`wdts`||t===`Mt`||t===`Mts`?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`format`)),u(e.getAttribute(`language`)))},updateShape_:function(n,r){n?this.getInput(`FORMAT`)||this.appendDummyInput(`FORMAT`).appendField(` `).appendField(new t(f(`time_get_default_format`)),`FORMAT`):this.getInput(`FORMAT`)&&this.removeInput(`FORMAT`),r?this.getInput(`LANGUAGE`)||this.appendDummyInput(`LANGUAGE`).appendField(new e(s()),`LANGUAGE`):this.getInput(`LANGUAGE`)&&this.removeInput(`LANGUAGE`)}},a.forBlock.time_get=function(e){let t=e.getFieldValue(`OPTION`),n=e.getFieldValue(`FORMAT`),r=e.getFieldValue(`LANGUAGE`),a;return a=t===`object`?`(new Date().getTime())`:t===`ms`?`(new Date().getMilliseconds())`:t===`s`?`(new Date().getSeconds())`:t===`sid`?`(() => { const v = new Date(); return v.getHours() * 3600 + v.getMinutes() * 60 + v.getSeconds(); })()`:t===`m`?`(new Date().getMinutes())`:t===`mid`?`(() => { const v = new Date(); return v.getHours() * 60 + v.getMinutes(); })()`:t===`h`?`(new Date().getHours())`:t===`d`?`(new Date().getDate())`:t===`M`?`(new Date().getMonth() + 1)`:t===`Mt`?`formatDate(new Date(), 'OO', '${r}')`:t===`Mts`?`formatDate(new Date(), 'O', '${r}')`:t===`y`?`(new Date().getYear())`:t===`fy`?`(new Date().getFullYear())`:t===`wdt`?`formatDate(new Date(), 'WW', '${r}')`:t===`wdts`?`formatDate(new Date(), 'W', '${r}')`:t===`wd`?`(() => { const d = new Date().getDay(); return d === 0 ? 7 : d; })()`:t===`cw`?`((date) => { const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); const dayNum = d.getUTCDay() || 7; d.setUTCDate(d.getUTCDate() + 4 - dayNum); const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1)); return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7); })(new Date())`:t===`custom`?`formatDate(new Date(), ${o(n)})`:`formatDate(new Date(), ${o(t)})`,[a,i.ATOMIC]},d.Time.blocks.time_get_special=`<block type="time_get_special"> <field name="TYPE">dayStart</field></block>`,r.time_get_special={init:function(){this.appendDummyInput().appendField(f(`time_get_special`)),this.appendDummyInput(`TYPE`).appendField(new e([[f(`time_get_special_day_start`),`dayStart`],[f(`time_get_special_day_end`),`dayEnd`],[f(`time_get_special_week_start`),`weekStart`],[f(`time_get_special_week_end`),`weekEnd`],[f(`time_get_special_month_start`),`monthStart`],[f(`time_get_special_month_end`),`monthEnd`]]),`TYPE`),this.setInputsInline(!0),this.setOutput(!0,`Number`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_get_special_tooltip`))}},a.forBlock.time_get_special=function(e){let t=e.getFieldValue(`TYPE`),n=``;return t===`dayStart`?n=`/* start of day */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return d.getTime(); })()`:t===`dayEnd`?n=`/* end of day */ (() => { const d = new Date(); d.setHours(23, 59, 59, 999); return d.getTime(); })()`:t===`weekStart`?n=`/* start of week */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth(), d.getDate() - d.getDay() + (d.getDay() == 0 ? -6 : 1)).getTime(); })()`:t===`weekEnd`?n=`/* end of week */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth(), d.getDate() + (8 - d.getDay())).getTime() - 1; })()`:t===`monthStart`?n=`/* start of month */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); d.setDate(1); return d.getTime(); })()`:t===`monthEnd`&&(n=`/* end of month */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth() + 1, 1).getTime() - 1; })()`),[n,i.ATOMIC]},d.Time.blocks.time_astro=`<block type="time_astro"> <field name="TYPE">sunrise</field> <field name="OFFSET">0</field></block>`,r.time_astro={init:function(){this.appendDummyInput().appendField(f(`time_astro`)),this.appendDummyInput(`TYPE`).appendField(new e([[f(`astro_sunriseText`),`sunrise`],[f(`astro_sunriseEndText`),`sunriseEnd`],[f(`astro_goldenHourEndText`),`goldenHourEnd`],[f(`astro_solarNoonText`),`solarNoon`],[f(`astro_goldenHourText`),`goldenHour`],[f(`astro_sunsetStartText`),`sunsetStart`],[f(`astro_sunsetText`),`sunset`],[f(`astro_duskText`),`dusk`],[f(`astro_nauticalDuskText`),`nauticalDusk`],[f(`astro_nightText`),`night`],[f(`astro_nightEndText`),`nightEnd`],[f(`astro_nauticalDawnText`),`nauticalDawn`],[f(`astro_dawnText`),`dawn`],[f(`astro_nadirText`),`nadir`]]),`TYPE`),this.appendDummyInput(`OFFSET`).appendField(f(`time_astro_offset`)).appendField(new t(`0`),`OFFSET`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Time.HUE),this.setTooltip(f(`time_astro_tooltip`)),this.setHelpUrl(p(`time_astro_help`))}},a.forBlock.time_astro=function(e){return[`getAstroDate('${e.getFieldValue(`TYPE`)}', undefined, ${parseFloat(e.getFieldValue(`OFFSET`))})`,i.ATOMIC]},d.Time.blocks.time_calculation=`<block type="time_calculation"> <field name="OPERATION">+</field> <field name="UNIT">ms</field> <value name="DATE_TIME"> <shadow type="time_get"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> </value> <value name="VALUE"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> </value></block>`,r.time_calculation={init:function(){this.appendDummyInput(`NAME`).appendField(f(`time_calculation`)),this.appendValueInput(`DATE_TIME`).appendField(f(`time_calculation_on`)).setCheck(null),this.appendDummyInput(`OPERATION`).appendField(new e([[`+`,`+`],[`-`,`-`]]),`OPERATION`),this.appendValueInput(`VALUE`),this.appendDummyInput(`UNIT`).appendField(new e([[f(`time_calculation_ms`),`ms`],[f(`time_calculation_sec`),`sec`],[f(`time_calculation_min`),`min`],[f(`time_calculation_hour`),`hour`],[f(`time_calculation_day`),`day`],[f(`time_calculation_week`),`week`]]),`UNIT`),this.setInputsInline(!0),this.setOutput(!0,`Number`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_calculation_tooltip`))}},a.forBlock.time_calculation=function(e){let t=a.valueToCode(e,`DATE_TIME`,i.ATOMIC),n=e.getFieldValue(`OPERATION`),r=a.valueToCode(e,`VALUE`,i.ATOMIC),o=e.getFieldValue(`UNIT`),s=1;return o===`sec`?s=1e3:o===`min`?s=6e4:o===`hour`?s=36e5:o===`day`?s=864e5:o===`week`&&(s=6048e5),[`/* time calculation */ ((dateTime) => { const ts = (typeof dateTime === 'object' ? dateTime.getTime() : dateTime); return ts ${n} ((${r}) * ${s}); })(${t})`,i.ATOMIC]}}export{d as install};
1
+ import{i as e,o as t,r as n,t as r}from"./blockly-Fp-1_Ye3.js";import{c as i,l as a}from"./index-DwTLl2xB.js";import{c as o,n as s,t as c}from"./helpers-DIT6UgRN.js";var l={"time_get_yyyy.mm.dd":`YYYY.MM.DD`,"time_get_yyyy/mm/dd":`YYYY/MM/DD`,"time_get_yy.mm.dd":`YY.MM.DD`,"time_get_yy/mm/dd":`YY/MM/DD`,"time_get_dd.mm.yyyy":`DD.MM.YYYY`,"time_get_dd/mm/yyyy":`DD/MM/YYYY`,"time_get_dd.mm.yy":`DD.MM.YY`,"time_get_dd/mm/yy":`DD/MM/YY`,"time_get_mm/dd/yyyy":`MM/DD/YYYY`,"time_get_mm/dd/yy":`MM/DD/YY`,"time_get_dd.mm":`DD.MM.`,"time_get_dd/mm":`DD/MM`,"time_get_mm.dd":`MM.DD`,"time_get_mm/dd":`MM/DD`,time_get_hh_mm:`hh:mm`,time_get_hh_mm_ss:`hh:mm:ss`,"time_get_hh_mm_ss.sss":`hh:mm:ss.sss`};function u(e){return e===!0||e===`true`||e===`TRUE`}function d(){let d=window.Blockly,f=d.Translate,p=window.getHelp;d.CustomBlocks=d.CustomBlocks||[],d.CustomBlocks.push(`Time`),d.Time={HUE:270,blocks:{}};for(let[e,t]of Object.entries(l))d.Words[e].format=t;let m=()=>[[f(`time_compare_lt`),`<`],[f(`time_compare_le`),`<=`],[f(`time_compare_gt`),`>`],[f(`time_compare_ge`),`>=`],[f(`time_compare_eq`),`==`],[f(`time_compare_bw`),`between`],[f(`time_compare_nb`),`not between`]];d.Time.blocks.time_compare_ex=`<block type="time_compare_ex"> <mutation end_time="false" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">&lt;</field> <value name="START_TIME"> <shadow type="text"> <field name="TEXT">12:00</field> </shadow> </value></block>`,r.time_compare_ex={init:function(){this.appendDummyInput(`TIME_TEXT`).appendField(f(`time_compare_ex`)),this.appendDummyInput(`USE_ACTUAL_TIME`).appendField(new n(`TRUE`,function(e){this.getSourceBlock().updateShape_(void 0,e)}),`USE_ACTUAL_TIME`),this.appendDummyInput().appendField(f(`time_compare_is_ex`)),this.appendDummyInput(`OPTION`).appendField(new e(m(),function(e){this.getSourceBlock().updateShape_(e===`between`||e===`not between`)}),`OPTION`),this.appendDummyInput().appendField(` `),this.appendValueInput(`START_TIME`),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_compare_ex_tooltip`)),this.setHelpUrl(p(`time_compare_ex_help`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`),n=this.getFieldValue(`USE_ACTUAL_TIME`);return e.setAttribute(`end_time`,t===`between`||t===`not between`?`true`:`false`),e.setAttribute(`actual_time`,u(n)?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`end_time`)),u(e.getAttribute(`actual_time`)))},updateShape_:function(e,t){if(e===void 0&&(e=this.getFieldValue(`OPTION`)===`between`||this.getFieldValue(`OPTION`)===`not between`),e){if(!this.getInput(`END_TIME`)&&(this.getInput(`CUSTOM_TIME`)&&(this.removeInput(`CUSTOM_TIME`),this.removeInput(`CUSTOM_TEXT`)),this.appendDummyInput(`AND`).appendField(f(`time_compare_and`)),this.appendValueInput(`END_TIME`),!window.scripts.loading)){let e=this.workspace;setTimeout(()=>{var t;let n=this.getInput(`END_TIME`);if(!(n!=null&&(t=n.connection)!=null&&t.isConnected())){let t=e.newBlock(`text`);t.setShadow(!0),t.setFieldValue(`18:00`,`TEXT`),t.outputConnection.connect(n.connection),t.initSvg(),t.render()}},100)}}else this.getInput(`END_TIME`)&&(this.removeInput(`END_TIME`),this.removeInput(`AND`));t===void 0&&(t=this.getFieldValue(`USE_ACTUAL_TIME`));let n=u(t),r=this.getInput(`CUSTOM_TIME`);n?r&&(this.getInput(`TIME_TEXT`).fieldRow[0].setValue(f(`time_compare_ex`)),this.removeInput(`CUSTOM_TIME`),this.removeInput(`CUSTOM_TEXT`)):(this.getInput(`TIME_TEXT`).fieldRow[0].setValue(f(`time_compare_custom_ex`)),r||(this.appendDummyInput(`CUSTOM_TEXT`).appendField(f(`time_compare_ex_custom`)),this.appendValueInput(`CUSTOM_TIME`)))}},a.forBlock.time_compare_ex=function(e){let t=e.getFieldValue(`OPTION`);return[`compareTime(${a.valueToCode(e,`START_TIME`,i.ATOMIC)}, ${e.getInput(`END_TIME`)&&a.valueToCode(e,`END_TIME`,i.ATOMIC)||null}, '${t}', ${e.getInput(`CUSTOM_TIME`)&&a.valueToCode(e,`CUSTOM_TIME`,i.ATOMIC)||null})`,i.ATOMIC]},d.Time.blocks.time_compare=`<block type="time_compare"> <mutation end_time="false"></mutation> <field name="OPTION">&lt;</field> <field name="START_TIME">12:00</field></block>`,r.time_compare={init:function(){this.appendDummyInput().appendField(f(`time_compare`)),this.appendDummyInput(`OPTION`).appendField(new e(m(),function(e){this.getSourceBlock().updateShape_(e===`between`||e===`not between`)}),`OPTION`),this.appendDummyInput().appendField(` `),this.appendDummyInput(`START_TIME`).appendField(new t(`12:00`),`START_TIME`),this.setInputsInline(!0),this.setOutput(!0,`Boolean`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_compare_tooltip`)),this.setHelpUrl(p(`time_compare_help`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`);return e.setAttribute(`end_time`,t===`between`||t===`not between`?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`end_time`)))},updateShape_:function(e){e?this.getInput(`END_TIME`)||(this.appendDummyInput(`AND`).appendField(f(`time_compare_and`)),this.appendDummyInput(`END_TIME`).appendField(new t(`18:00`),`END_TIME`)):this.getInput(`END_TIME`)&&(this.removeInput(`END_TIME`),this.removeInput(`AND`))}},a.forBlock.time_compare=function(e){let t=e.getFieldValue(`OPTION`),n=e.getFieldValue(`START_TIME`),r=e.getFieldValue(`END_TIME`);return[`compareTime(${o(n)}, ${r?o(r):`null`}, ${o(t)})`,i.ATOMIC]},d.Time.blocks.time_get=`<block type="time_get"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field></block>`,r.time_get={init:function(){this.appendDummyInput().appendField(f(`time_get`)),this.appendDummyInput(`OPTION`).appendField(new e(c(),function(e){this.getSourceBlock().updateShape_(e===`custom`,e===`wdt`||e===`wdts`||e===`Mt`||e===`Mts`)}),`OPTION`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Time.HUE),this.setTooltip(f(`time_get_tooltip`))},mutationToDom:function(){let e=document.createElement(`mutation`),t=this.getFieldValue(`OPTION`);return e.setAttribute(`format`,t===`custom`?`true`:`false`),e.setAttribute(`language`,t===`wdt`||t===`wdts`||t===`Mt`||t===`Mts`?`true`:`false`),e},domToMutation:function(e){this.updateShape_(u(e.getAttribute(`format`)),u(e.getAttribute(`language`)))},updateShape_:function(n,r){n?this.getInput(`FORMAT`)||this.appendDummyInput(`FORMAT`).appendField(` `).appendField(new t(f(`time_get_default_format`)),`FORMAT`):this.getInput(`FORMAT`)&&this.removeInput(`FORMAT`),r?this.getInput(`LANGUAGE`)||this.appendDummyInput(`LANGUAGE`).appendField(new e(s()),`LANGUAGE`):this.getInput(`LANGUAGE`)&&this.removeInput(`LANGUAGE`)}},a.forBlock.time_get=function(e){let t=e.getFieldValue(`OPTION`),n=e.getFieldValue(`FORMAT`),r=e.getFieldValue(`LANGUAGE`),a;return a=t===`object`?`(new Date().getTime())`:t===`ms`?`(new Date().getMilliseconds())`:t===`s`?`(new Date().getSeconds())`:t===`sid`?`(() => { const v = new Date(); return v.getHours() * 3600 + v.getMinutes() * 60 + v.getSeconds(); })()`:t===`m`?`(new Date().getMinutes())`:t===`mid`?`(() => { const v = new Date(); return v.getHours() * 60 + v.getMinutes(); })()`:t===`h`?`(new Date().getHours())`:t===`d`?`(new Date().getDate())`:t===`M`?`(new Date().getMonth() + 1)`:t===`Mt`?`formatDate(new Date(), 'OO', '${r}')`:t===`Mts`?`formatDate(new Date(), 'O', '${r}')`:t===`y`?`(new Date().getYear())`:t===`fy`?`(new Date().getFullYear())`:t===`wdt`?`formatDate(new Date(), 'WW', '${r}')`:t===`wdts`?`formatDate(new Date(), 'W', '${r}')`:t===`wd`?`(() => { const d = new Date().getDay(); return d === 0 ? 7 : d; })()`:t===`cw`?`((date) => { const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); const dayNum = d.getUTCDay() || 7; d.setUTCDate(d.getUTCDate() + 4 - dayNum); const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1)); return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7); })(new Date())`:t===`custom`?`formatDate(new Date(), ${o(n)})`:`formatDate(new Date(), ${o(t)})`,[a,i.ATOMIC]},d.Time.blocks.time_get_special=`<block type="time_get_special"> <field name="TYPE">dayStart</field></block>`,r.time_get_special={init:function(){this.appendDummyInput().appendField(f(`time_get_special`)),this.appendDummyInput(`TYPE`).appendField(new e([[f(`time_get_special_day_start`),`dayStart`],[f(`time_get_special_day_end`),`dayEnd`],[f(`time_get_special_week_start`),`weekStart`],[f(`time_get_special_week_end`),`weekEnd`],[f(`time_get_special_month_start`),`monthStart`],[f(`time_get_special_month_end`),`monthEnd`]]),`TYPE`),this.setInputsInline(!0),this.setOutput(!0,`Number`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_get_special_tooltip`))}},a.forBlock.time_get_special=function(e){let t=e.getFieldValue(`TYPE`),n=``;return t===`dayStart`?n=`/* start of day */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return d.getTime(); })()`:t===`dayEnd`?n=`/* end of day */ (() => { const d = new Date(); d.setHours(23, 59, 59, 999); return d.getTime(); })()`:t===`weekStart`?n=`/* start of week */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth(), d.getDate() - d.getDay() + (d.getDay() == 0 ? -6 : 1)).getTime(); })()`:t===`weekEnd`?n=`/* end of week */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth(), d.getDate() + (8 - d.getDay())).getTime() - 1; })()`:t===`monthStart`?n=`/* start of month */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); d.setDate(1); return d.getTime(); })()`:t===`monthEnd`&&(n=`/* end of month */ (() => { const d = new Date(); d.setHours(0, 0, 0, 0); return new Date(d.getFullYear(), d.getMonth() + 1, 1).getTime() - 1; })()`),[n,i.ATOMIC]},d.Time.blocks.time_astro=`<block type="time_astro"> <field name="TYPE">sunrise</field> <field name="OFFSET">0</field></block>`,r.time_astro={init:function(){this.appendDummyInput().appendField(f(`time_astro`)),this.appendDummyInput(`TYPE`).appendField(new e([[f(`astro_sunriseText`),`sunrise`],[f(`astro_sunriseEndText`),`sunriseEnd`],[f(`astro_goldenHourEndText`),`goldenHourEnd`],[f(`astro_solarNoonText`),`solarNoon`],[f(`astro_goldenHourText`),`goldenHour`],[f(`astro_sunsetStartText`),`sunsetStart`],[f(`astro_sunsetText`),`sunset`],[f(`astro_duskText`),`dusk`],[f(`astro_nauticalDuskText`),`nauticalDusk`],[f(`astro_nightText`),`night`],[f(`astro_nightEndText`),`nightEnd`],[f(`astro_nauticalDawnText`),`nauticalDawn`],[f(`astro_dawnText`),`dawn`],[f(`astro_nadirText`),`nadir`]]),`TYPE`),this.appendDummyInput(`OFFSET`).appendField(f(`time_astro_offset`)).appendField(new t(`0`),`OFFSET`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Time.HUE),this.setTooltip(f(`time_astro_tooltip`)),this.setHelpUrl(p(`time_astro_help`))}},a.forBlock.time_astro=function(e){return[`getAstroDate('${e.getFieldValue(`TYPE`)}', undefined, ${parseFloat(e.getFieldValue(`OFFSET`))})`,i.ATOMIC]},d.Time.blocks.time_calculation=`<block type="time_calculation"> <field name="OPERATION">+</field> <field name="UNIT">ms</field> <value name="DATE_TIME"> <shadow type="time_get"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> </value> <value name="VALUE"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> </value></block>`,r.time_calculation={init:function(){this.appendDummyInput(`NAME`).appendField(f(`time_calculation`)),this.appendValueInput(`DATE_TIME`).appendField(f(`time_calculation_on`)).setCheck(null),this.appendDummyInput(`OPERATION`).appendField(new e([[`+`,`+`],[`-`,`-`]]),`OPERATION`),this.appendValueInput(`VALUE`),this.appendDummyInput(`UNIT`).appendField(new e([[f(`time_calculation_ms`),`ms`],[f(`time_calculation_sec`),`sec`],[f(`time_calculation_min`),`min`],[f(`time_calculation_hour`),`hour`],[f(`time_calculation_day`),`day`],[f(`time_calculation_week`),`week`]]),`UNIT`),this.setInputsInline(!0),this.setOutput(!0,`Number`),this.setColour(d.Time.HUE),this.setTooltip(f(`time_calculation_tooltip`))}},a.forBlock.time_calculation=function(e){let t=a.valueToCode(e,`DATE_TIME`,i.ATOMIC),n=e.getFieldValue(`OPERATION`),r=a.valueToCode(e,`VALUE`,i.ATOMIC),o=e.getFieldValue(`UNIT`),s=1;return o===`sec`?s=1e3:o===`min`?s=6e4:o===`hour`?s=36e5:o===`day`?s=864e5:o===`week`&&(s=6048e5),[`/* time calculation */ ((dateTime) => { const ts = (typeof dateTime === 'object' ? dateTime.getTime() : dateTime); return ts ${n} ((${r}) * ${s}); })(${t})`,i.ATOMIC]}}export{d as install};
@@ -1 +1 @@
1
- import{c as e,i as t,o as n,t as r}from"./blockly-DBw-ytY1.js";import{c as i,l as a}from"./index-BnLv569U.js";import{a as o}from"./helpers-BFQD9R82.js";var s={id:`timeout`,marker:`isTimeout_`,variableType:`timeout`},c={id:`interval`,marker:`isInterval_`,variableType:`interval`};function l(e,t){let n=parseFloat(e);return t===`min`?n*6e4:t===`sec`?n*1e3:n}function u(e){return a.nameDB_.safeName(e.getFieldValue(`NAME`))}function d(){let d=window.Blockly,f=d.Translate,p=window.getHelp;d.CustomBlocks=d.CustomBlocks||[],d.CustomBlocks.push(`Timeouts`);let m=()=>[[f(`timeouts_settimeout_ms`),`ms`],[f(`timeouts_settimeout_sec`),`sec`],[f(`timeouts_settimeout_min`),`min`]],h=(t,n,r)=>{for(let i of n.getAllBlocks())if(i!==r&&(i.isTimeout_||i.isInterval_)&&e.equals(i.getFieldValue(`NAME`),t))return!1;return!0},g=(e,t)=>{if(t.isInFlyout)return e;for(;!h(e,t.workspace,t);){let t=e.match(/^(.*?)(\d+)$/);t?e=t[1]+(parseInt(t[2],10)+1):e+=`2`}return e},_=function(e){return g(e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,``),this.getSourceBlock())},v=(e,t)=>{let n=[];for(let r of e.getAllBlocks())if(r[t.marker]){let e=r.getFieldValue(`NAME`);n.push([e,e])}if(window.scripts.loading)for(let t of e.getVariableMap().getVariablesOfType(``))n.find(e=>e[0]===t.getName())||n.push([t.getName(),t.getName()]);for(let r of e.getVariableMap().getVariablesOfType(t.variableType))n.find(e=>e[0]===r.getName())||n.push([r.getName(),r.getName()]);return n.length||n.push([``,``]),n};d.Timeouts={HUE:70,blocks:{},getAllTimeouts:e=>v(e,s),getAllIntervals:e=>v(e,c)};let y=e=>new t(()=>{var t;return(t=window.scripts)!=null&&t.blocklyWorkspace?v(window.scripts.blocklyWorkspace,e):[]});d.Timeouts.blocks.timeouts_wait=`<block type="timeouts_wait"> <field name="DELAY">1000</field> <field name="UNIT">ms</field></block>`,r.timeouts_wait={init:function(){this.appendDummyInput().appendField(f(`timeouts_wait`)).appendField(new n(`1000`),`DELAY`).appendField(new t(m()),`UNIT`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Timeouts.HUE),this.setTooltip(f(`timeouts_wait_tooltip`)),this.setHelpUrl(p(`timeouts_wait_help`))}},a.forBlock.timeouts_wait=function(e){return`await wait(${l(e.getFieldValue(`DELAY`),e.getFieldValue(`UNIT`))});\n`};let b=(e,s)=>{let c=e.id===`timeout`,h=`timeouts_set${e.id}${s?`_variable`:``}`,v=c?`DELAY`:`INTERVAL`,y=c?`DELAY_MS`:`INTERVAL_MS`,b=`timeouts_set${e.id}`,x=c?`timeout`:f(`timeouts_setinterval_name`);r[h]={init:function(){let e=new n(g(x,this),_);e.setSpellcheck(!1);let r=this.appendDummyInput().appendField(f(b)).appendField(e,`NAME`).appendField(f(`${b}_in`));s?this.appendValueInput(y).setCheck(`Number`).appendField(f(`timeouts_settimeout_ms`)):r.appendField(new n(`1000`),v).appendField(new t(m()),`UNIT`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(s),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Timeouts.HUE),this.setTooltip(f(`${b}_tooltip`)),this.setHelpUrl(p(`${b}_help`))},[e.marker]:!0,getVars:function(){return[this.getFieldValue(`NAME`)]},getVarModels:function(){return[o(this.getFieldValue(`NAME`),e.variableType)]}},a.forBlock[h]=function(e){let t=u(e),n=a.statementToCode(e,`STATEMENT`),r=s?`parseInt(${a.valueToCode(e,y,i.ATOMIC)})`:String(l(e.getFieldValue(v),e.getFieldValue(`UNIT`))),o=c?`${a.prefixLines(`${t} = null;`,a.INDENT)}\n`:``;return`${t} = ${c?`setTimeout`:`setInterval`}(async () => {\n${o}${n}}, ${r});\n`}},x=e=>{let t=`timeouts_clear${e.id}`,n=`timeouts_get${e.id}`;d.Timeouts.blocks[t]=`<sep gap="5"></sep><block type="${t}"> <field name="NAME"></field></block>`,r[t]={init:function(){this.appendDummyInput(`NAME`).appendField(f(t)).appendField(y(e),`NAME`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Timeouts.HUE),this.setTooltip(f(`${t}_tooltip`)),this.setHelpUrl(p(`${t}_help`))}},a.forBlock[t]=function(t){let n=u(t);return`(() => { if (${n}) { ${e.id===`timeout`?`clearTimeout`:`clearInterval`}(${n}); ${n} = null; }})();\n`},d.Timeouts.blocks[n]=`<sep gap="5"></sep><block type="${n}"> <field name="NAME"></field></block>`,r[n]={init:function(){this.appendDummyInput(`NAME`).appendField(f(n)).appendField(y(e),`NAME`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Timeouts.HUE),this.setTooltip(f(`${n}_tooltip`)),this.setHelpUrl(p(`${n}_help`))}},a.forBlock[n]=function(e){return[u(e),i.ATOMIC]}};d.Timeouts.blocks.timeouts_settimeout=`<block type="timeouts_settimeout"> <field name="NAME">timeout</field> <field name="DELAY">1000</field> <field name="UNIT">ms</field></block>`,b(s,!1),d.Timeouts.blocks.timeouts_settimeout_variable=`<sep gap="5"></sep><block type="timeouts_settimeout_variable"> <value name="DELAY_MS"> <shadow type="math_number"> <field name="NUM">1000</field> </shadow> </value></block>`,b(s,!0),x(s),d.Timeouts.blocks.timeouts_setinterval=`<block type="timeouts_setinterval"> <field name="INTERVAL">1000</field> <field name="UNIT">ms</field></block>`,b(c,!1),d.Timeouts.blocks.timeouts_setinterval_variable=`<sep gap="5"></sep><block type="timeouts_setinterval_variable"> <value name="INTERVAL_MS"> <shadow type="math_number"> <field name="NUM">1000</field> </shadow> </value></block>`,b(c,!0),x(c)}export{d as install};
1
+ import{c as e,i as t,o as n,t as r}from"./blockly-Fp-1_Ye3.js";import{c as i,l as a}from"./index-DwTLl2xB.js";import{a as o}from"./helpers-DIT6UgRN.js";var s={id:`timeout`,marker:`isTimeout_`,variableType:`timeout`},c={id:`interval`,marker:`isInterval_`,variableType:`interval`};function l(e,t){let n=parseFloat(e);return t===`min`?n*6e4:t===`sec`?n*1e3:n}function u(e){return a.nameDB_.safeName(e.getFieldValue(`NAME`))}function d(){let d=window.Blockly,f=d.Translate,p=window.getHelp;d.CustomBlocks=d.CustomBlocks||[],d.CustomBlocks.push(`Timeouts`);let m=()=>[[f(`timeouts_settimeout_ms`),`ms`],[f(`timeouts_settimeout_sec`),`sec`],[f(`timeouts_settimeout_min`),`min`]],h=(t,n,r)=>{for(let i of n.getAllBlocks())if(i!==r&&(i.isTimeout_||i.isInterval_)&&e.equals(i.getFieldValue(`NAME`),t))return!1;return!0},g=(e,t)=>{if(t.isInFlyout)return e;for(;!h(e,t.workspace,t);){let t=e.match(/^(.*?)(\d+)$/);t?e=t[1]+(parseInt(t[2],10)+1):e+=`2`}return e},_=function(e){return g(e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,``),this.getSourceBlock())},v=(e,t)=>{let n=[];for(let r of e.getAllBlocks())if(r[t.marker]){let e=r.getFieldValue(`NAME`);n.push([e,e])}if(window.scripts.loading)for(let t of e.getVariableMap().getVariablesOfType(``))n.find(e=>e[0]===t.getName())||n.push([t.getName(),t.getName()]);for(let r of e.getVariableMap().getVariablesOfType(t.variableType))n.find(e=>e[0]===r.getName())||n.push([r.getName(),r.getName()]);return n.length||n.push([``,``]),n};d.Timeouts={HUE:70,blocks:{},getAllTimeouts:e=>v(e,s),getAllIntervals:e=>v(e,c)};let y=e=>new t(()=>{var t;return(t=window.scripts)!=null&&t.blocklyWorkspace?v(window.scripts.blocklyWorkspace,e):[]});d.Timeouts.blocks.timeouts_wait=`<block type="timeouts_wait"> <field name="DELAY">1000</field> <field name="UNIT">ms</field></block>`,r.timeouts_wait={init:function(){this.appendDummyInput().appendField(f(`timeouts_wait`)).appendField(new n(`1000`),`DELAY`).appendField(new t(m()),`UNIT`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Timeouts.HUE),this.setTooltip(f(`timeouts_wait_tooltip`)),this.setHelpUrl(p(`timeouts_wait_help`))}},a.forBlock.timeouts_wait=function(e){return`await wait(${l(e.getFieldValue(`DELAY`),e.getFieldValue(`UNIT`))});\n`};let b=(e,s)=>{let c=e.id===`timeout`,h=`timeouts_set${e.id}${s?`_variable`:``}`,v=c?`DELAY`:`INTERVAL`,y=c?`DELAY_MS`:`INTERVAL_MS`,b=`timeouts_set${e.id}`,x=c?`timeout`:f(`timeouts_setinterval_name`);r[h]={init:function(){let e=new n(g(x,this),_);e.setSpellcheck(!1);let r=this.appendDummyInput().appendField(f(b)).appendField(e,`NAME`).appendField(f(`${b}_in`));s?this.appendValueInput(y).setCheck(`Number`).appendField(f(`timeouts_settimeout_ms`)):r.appendField(new n(`1000`),v).appendField(new t(m()),`UNIT`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(s),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Timeouts.HUE),this.setTooltip(f(`${b}_tooltip`)),this.setHelpUrl(p(`${b}_help`))},[e.marker]:!0,getVars:function(){return[this.getFieldValue(`NAME`)]},getVarModels:function(){return[o(this.getFieldValue(`NAME`),e.variableType)]}},a.forBlock[h]=function(e){let t=u(e),n=a.statementToCode(e,`STATEMENT`),r=s?`parseInt(${a.valueToCode(e,y,i.ATOMIC)})`:String(l(e.getFieldValue(v),e.getFieldValue(`UNIT`))),o=c?`${a.prefixLines(`${t} = null;`,a.INDENT)}\n`:``;return`${t} = ${c?`setTimeout`:`setInterval`}(async () => {\n${o}${n}}, ${r});\n`}},x=e=>{let t=`timeouts_clear${e.id}`,n=`timeouts_get${e.id}`;d.Timeouts.blocks[t]=`<sep gap="5"></sep><block type="${t}"> <field name="NAME"></field></block>`,r[t]={init:function(){this.appendDummyInput(`NAME`).appendField(f(t)).appendField(y(e),`NAME`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(d.Timeouts.HUE),this.setTooltip(f(`${t}_tooltip`)),this.setHelpUrl(p(`${t}_help`))}},a.forBlock[t]=function(t){let n=u(t);return`(() => { if (${n}) { ${e.id===`timeout`?`clearTimeout`:`clearInterval`}(${n}); ${n} = null; }})();\n`},d.Timeouts.blocks[n]=`<sep gap="5"></sep><block type="${n}"> <field name="NAME"></field></block>`,r[n]={init:function(){this.appendDummyInput(`NAME`).appendField(f(n)).appendField(y(e),`NAME`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(d.Timeouts.HUE),this.setTooltip(f(`${n}_tooltip`)),this.setHelpUrl(p(`${n}_help`))}},a.forBlock[n]=function(e){return[u(e),i.ATOMIC]}};d.Timeouts.blocks.timeouts_settimeout=`<block type="timeouts_settimeout"> <field name="NAME">timeout</field> <field name="DELAY">1000</field> <field name="UNIT">ms</field></block>`,b(s,!1),d.Timeouts.blocks.timeouts_settimeout_variable=`<sep gap="5"></sep><block type="timeouts_settimeout_variable"> <value name="DELAY_MS"> <shadow type="math_number"> <field name="NUM">1000</field> </shadow> </value></block>`,b(s,!0),x(s),d.Timeouts.blocks.timeouts_setinterval=`<block type="timeouts_setinterval"> <field name="INTERVAL">1000</field> <field name="UNIT">ms</field></block>`,b(c,!1),d.Timeouts.blocks.timeouts_setinterval_variable=`<sep gap="5"></sep><block type="timeouts_setinterval_variable"> <value name="INTERVAL_MS"> <shadow type="math_number"> <field name="NUM">1000</field> </shadow> </value></block>`,b(c,!0),x(c)}export{d as install};
@@ -1,2 +1,2 @@
1
- import{c as e,f as t,i as n,o as r,r as i,s as a,t as o}from"./blockly-DBw-ytY1.js";import{c as s,l as c}from"./index-BnLv569U.js";import{a as l,c as u,f as d,l as f,o as p,p as m,r as h,s as g}from"./helpers-BFQD9R82.js";import{FieldOID as _}from"./field_oid-ojNnLVGL.js";import{FieldCRON as v}from"./field_cron-Br4hxeLb.js";function y(e){return c.nameDB_.safeName(e.getFieldValue(`NAME`))}function b(){let b=window.Blockly,x=b.Translate,S=window.getHelp;b.CustomBlocks=b.CustomBlocks||[],b.CustomBlocks.push(`Trigger`);let C=e=>{let t=[];for(let n of e.getAllBlocks())if(n.isSchedule_){let e=n.getFieldValue(`NAME`);t.push([e,e])}if(window.scripts.loading)for(let n of e.getVariableMap().getVariablesOfType(``))t.find(e=>e[0]===n.getName())||t.push([n.getName(),n.getName()]);for(let n of e.getVariableMap().getVariablesOfType(`cron`))t.find(e=>e[0]===n.getName())||t.push([n.getName(),n.getName()]);return t.length||t.push([``,``]),t};b.Trigger={HUE:330,getAllSchedules:C,blocks:{},WARNING_PARENTS:[`on`,`on_ext`,`schedule`,`schedule_by_id`,`schedule_create`,`astro`,`onMessage`,`onFile`,`onLog`,`onEnumMembers`,`timeouts_setinterval`,`timeouts_setinterval_variable`,`controls_repeat_ext`,`controls_repeat_ext`,`controls_for`,`controls_forEach`]};let w=()=>[[x(`on_onchange`),`ne`],[x(`on_any`),`any`],[x(`on_gt`),`gt`],[x(`on_ge`),`ge`],[x(`on_lt`),`lt`],[x(`on_le`),`le`],[x(`on_true`),`true`],[x(`on_false`),`false`]],T=()=>[[x(`on_ack_any`),``],[x(`on_ack_true`),`true`],[x(`on_ack_false`),`false`]],E=e=>e===`true`||e===`false`?`val: ${e}`:`change: '${e}'`,D=()=>`${c.prefixLines(`let value = obj.state.val;`,c.INDENT)}\n${c.prefixLines(`let oldValue = obj.oldState.val;`,c.INDENT)}\n`,O=(e,t,n,r)=>{setTimeout(()=>{var i;if(!((i=t.connection)!=null&&i.isConnected())){let i=e.newBlock(n);i.setShadow(!0),r&&i.setFieldValue(r[1],r[0]),i.outputConnection.connect(t.connection),i.initSvg(),i.render()}},100)},k=(e,t,r,i,a,s,c)=>{o[e]={init:function(){this.appendDummyInput().appendField(t),this.appendDummyInput(`ATTR`).appendField(new n(r),`ATTR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(s),this.setTooltip(x(`${e}_tooltip`)),c&&this.setHelpUrl(S(c))},onchange:function(){m(this,i,a)},FUNCTION_TYPES:i}};b.Trigger.blocks.on_ext=`<block type="on_ext"> <mutation items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid"> </shadow> </value></block>`,o.on_ext_oid_container={init:function(){this.appendDummyInput().appendField(x(`on_ext_on`)),this.appendStatementInput(`STACK`),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_ext_on_tooltip`)),this.contextMenu=!1}},o.on_ext_oid={init:function(){this.appendDummyInput(`OID`).appendField(x(`on_ext_oid`)),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_ext_oid_tooltip`)),this.contextMenu=!1}},o.on_ext={init:function(){this.itemCount_=1,this.setMutator(new t.MutatorIcon([`on_ext_oid`],this)),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_ext_tooltip`)),this.setHelpUrl(S(`on_help`))},mutationToDom:function(){let e=document.createElement(`mutation`);return e.setAttribute(`items`,String(this.itemCount_)),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute(`items`),10),this.updateShape_()},decompose:function(e){var t;let n=e.newBlock(`on_ext_oid_container`);n.initSvg();let r=(t=n.getInput(`STACK`))==null?void 0:t.connection;for(let t=0;t<this.itemCount_;t++){let t=e.newBlock(`on_ext_oid`);t.initSvg(),r.connect(t.previousConnection),r=t.nextConnection}return n},compose:function(e){let t=e.getInputTargetBlock(`STACK`),n=[];for(;t;)n.push(t.valueConnection_),t=t.nextConnection&&t.nextConnection.targetBlock();for(let e=0;e<this.itemCount_;e++){var r;let t=(r=this.getInput(`OID${e}`))==null||(r=r.connection)==null?void 0:r.targetConnection;t&&!n.includes(t)&&t.disconnect()}this.itemCount_=n.length,this.itemCount_<1&&(this.itemCount_=1),this.updateShape_();for(let e=0;e<this.itemCount_;e++)f(n[e],this,`OID${e}`)},saveConnections:function(e){let t=e.getInputTargetBlock(`STACK`),n=0;for(;t;){var r,i;t.valueConnection_=(r=this.getInput(`OID${n}`))==null||(r=r.connection)==null?void 0:r.targetConnection,n++,t=(i=t.nextConnection)==null?void 0:i.targetBlock()}},updateShape_:function(){let e;this.getInput(`CONDITION`)&&(e=this.getFieldValue(`CONDITION`),this.removeInput(`CONDITION`));let t;this.getInput(`ACK_CONDITION`)&&(t=this.getFieldValue(`ACK_CONDITION`),this.removeInput(`ACK_CONDITION`));let r;for(let e=0;this.inputList[e];e++)if(this.inputList[e].name===`STATEMENT`){r=this.inputList[e],this.inputList.splice(e,1);break}let i=this.workspace,a;for(a=0;a<this.itemCount_;a++){let e=this.getInput(`OID${a}`);e||(e=this.appendValueInput(`OID${a}`),a===0&&e.appendField(x(`on_ext`))),O(i,e,`field_oid`)}for(;this.getInput(`OID${a}`);)this.removeInput(`OID${a}`),a++;this.appendDummyInput(`CONDITION`).appendField(new n(w()),`CONDITION`),e&&this.setFieldValue(e,`CONDITION`),this.appendDummyInput(`ACK_CONDITION`).appendField(x(`on_ack`)).appendField(new n(T()),`ACK_CONDITION`),t&&this.setFieldValue(t,`ACK_CONDITION`),r?this.inputList.push(r):this.appendStatementInput(`STATEMENT`).setCheck(null)},onchange:function(){d(this)}},c.forBlock.on_ext=function(e){let t=e,n=E(e.getFieldValue(`CONDITION`)),r=e.getFieldValue(`ACK_CONDITION`),i=[];for(let n=0;n<t.itemCount_;n++){let t=c.valueToCode(e,`OID${n}`,s.COMMA);t&&(t=t.toString(),t.startsWith(`'`)&&t.endsWith(`'`)&&(t=`[${t}]`),i.includes(t)||i.push(t))}let a=`[].concat(${i.join(`).concat(`)})`,o=c.statementToCode(e,`STATEMENT`);return`on({ id: ${a}, ${n}${r?`, ack: ${r}`:``} }, async (obj) => {\n${i.length===1?D():``}${o}});\n`},b.Trigger.blocks.on=`<sep gap="5"></sep><block type="on"> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field></block>`,o.on={init:function(){this.appendDummyInput().appendField(x(`on`)),this.appendDummyInput(`OID`).appendField(new _(x(`select_id`),`state`),`OID`),this.appendDummyInput(`CONDITION`).appendField(new n(w()),`CONDITION`),this.appendDummyInput(`ACK_CONDITION`).appendField(x(`on_ack`)).appendField(new n(T()),`ACK_CONDITION`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_tooltip`)),this.setHelpUrl(S(`on_help`))},onchange:function(){d(this)}},c.forBlock.on=function(e){let t=e.getFieldValue(`OID`),n=E(e.getFieldValue(`CONDITION`)),r=e.getFieldValue(`ACK_CONDITION`);a.VARIABLES_DEFAULT_NAME=`value`;let i=p(t),o=c.statementToCode(e,`STATEMENT`);return`on({ id: '${t}'${i?` /* ${i} */`:``}, ${n}${r?`, ack: ${r}`:``} }, async (obj) => {\n${D()}${o}});\n`},b.Trigger.blocks.on_source=`<sep gap="5"></sep><block type="on_source"> <field name="ATTR">state.val</field></block>`,k(`on_source`,`↪`,[[x(`on_source_state_val`),`state.val`],[x(`on_source_state_ts`),`state.ts`],[x(`on_source_state_q`),`state.q`],[x(`on_source_state_from`),`state.from`],[x(`on_source_state_ack`),`state.ack`],[x(`on_source_state_lc`),`state.lc`],[x(`on_source_state_c`),`state.c`],[x(`on_source_state_user`),`state.user`],[x(`on_source_id`),`id`],[x(`on_source_name`),`common.name`],[x(`on_source_desc`),`common.desc`],[x(`on_source_channel_id`),`channelId`],[x(`on_source_channel_name`),`channelName`],[x(`on_source_device_id`),`deviceId`],[x(`on_source_device_name`),`deviceName`],[x(`on_source_oldstate_val`),`oldState.val`],[x(`on_source_oldstate_ts`),`oldState.ts`],[x(`on_source_oldstate_q`),`oldState.q`],[x(`on_source_oldstate_from`),`oldState.from`],[x(`on_source_oldstate_ack`),`oldState.ack`],[x(`on_source_oldstate_lc`),`oldState.lc`],[x(`on_source_oldstate_c`),`oldState.c`],[x(`on_source_oldstate_user`),`oldState.user`]],[`on`,`on_ext`,`onEnumMembers`],`on_source_warning`,b.Trigger.HUE,`on_help`),c.forBlock.on_source=function(e){let t=e.getFieldValue(`ATTR`),n=t.split(`.`);return[n.length>1?`(obj.${n[0]} ? obj.${t} : '')`:`obj.${t}`,s.ATOMIC]},b.Trigger.blocks.on_ack_value=`<sep gap="5"></sep><block type="on_ack_value"></block>`,o.on_ack_value={init:function(){this.appendDummyInput().appendField(`↪ ${x(`on_ack_value`)}`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_ack_value_tooltip`)),this.setHelpUrl(S(`on_help`))},onchange:function(){m(this,[`on`,`on_ext`,`onEnumMembers`],`on_ack_value_warning`)},FUNCTION_TYPES:[`on`,`on_ext`,`onEnumMembers`]},c.forBlock.on_ack_value=function(){return`if (obj.id && obj?.state && !obj.state.ack) {
1
+ import{c as e,f as t,i as n,o as r,r as i,s as a,t as o}from"./blockly-Fp-1_Ye3.js";import{c as s,l as c}from"./index-DwTLl2xB.js";import{a as l,c as u,f as d,l as f,o as p,p as m,r as h,s as g}from"./helpers-DIT6UgRN.js";import{FieldOID as _}from"./field_oid-fYE12Bhj.js";import{FieldCRON as v}from"./field_cron-B-SF-uZM.js";function y(e){return c.nameDB_.safeName(e.getFieldValue(`NAME`))}function b(){let b=window.Blockly,x=b.Translate,S=window.getHelp;b.CustomBlocks=b.CustomBlocks||[],b.CustomBlocks.push(`Trigger`);let C=e=>{let t=[];for(let n of e.getAllBlocks())if(n.isSchedule_){let e=n.getFieldValue(`NAME`);t.push([e,e])}if(window.scripts.loading)for(let n of e.getVariableMap().getVariablesOfType(``))t.find(e=>e[0]===n.getName())||t.push([n.getName(),n.getName()]);for(let n of e.getVariableMap().getVariablesOfType(`cron`))t.find(e=>e[0]===n.getName())||t.push([n.getName(),n.getName()]);return t.length||t.push([``,``]),t};b.Trigger={HUE:330,getAllSchedules:C,blocks:{},WARNING_PARENTS:[`on`,`on_ext`,`schedule`,`schedule_by_id`,`schedule_create`,`astro`,`onMessage`,`onFile`,`onLog`,`onEnumMembers`,`timeouts_setinterval`,`timeouts_setinterval_variable`,`controls_repeat_ext`,`controls_repeat_ext`,`controls_for`,`controls_forEach`]};let w=()=>[[x(`on_onchange`),`ne`],[x(`on_any`),`any`],[x(`on_gt`),`gt`],[x(`on_ge`),`ge`],[x(`on_lt`),`lt`],[x(`on_le`),`le`],[x(`on_true`),`true`],[x(`on_false`),`false`]],T=()=>[[x(`on_ack_any`),``],[x(`on_ack_true`),`true`],[x(`on_ack_false`),`false`]],E=e=>e===`true`||e===`false`?`val: ${e}`:`change: '${e}'`,D=()=>`${c.prefixLines(`let value = obj.state.val;`,c.INDENT)}\n${c.prefixLines(`let oldValue = obj.oldState.val;`,c.INDENT)}\n`,O=(e,t,n,r)=>{setTimeout(()=>{var i;if(!((i=t.connection)!=null&&i.isConnected())){let i=e.newBlock(n);i.setShadow(!0),r&&i.setFieldValue(r[1],r[0]),i.outputConnection.connect(t.connection),i.initSvg(),i.render()}},100)},k=(e,t,r,i,a,s,c)=>{o[e]={init:function(){this.appendDummyInput().appendField(t),this.appendDummyInput(`ATTR`).appendField(new n(r),`ATTR`),this.setInputsInline(!0),this.setOutput(!0),this.setColour(s),this.setTooltip(x(`${e}_tooltip`)),c&&this.setHelpUrl(S(c))},onchange:function(){m(this,i,a)},FUNCTION_TYPES:i}};b.Trigger.blocks.on_ext=`<block type="on_ext"> <mutation items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid"> </shadow> </value></block>`,o.on_ext_oid_container={init:function(){this.appendDummyInput().appendField(x(`on_ext_on`)),this.appendStatementInput(`STACK`),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_ext_on_tooltip`)),this.contextMenu=!1}},o.on_ext_oid={init:function(){this.appendDummyInput(`OID`).appendField(x(`on_ext_oid`)),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_ext_oid_tooltip`)),this.contextMenu=!1}},o.on_ext={init:function(){this.itemCount_=1,this.setMutator(new t.MutatorIcon([`on_ext_oid`],this)),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_ext_tooltip`)),this.setHelpUrl(S(`on_help`))},mutationToDom:function(){let e=document.createElement(`mutation`);return e.setAttribute(`items`,String(this.itemCount_)),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute(`items`),10),this.updateShape_()},decompose:function(e){var t;let n=e.newBlock(`on_ext_oid_container`);n.initSvg();let r=(t=n.getInput(`STACK`))==null?void 0:t.connection;for(let t=0;t<this.itemCount_;t++){let t=e.newBlock(`on_ext_oid`);t.initSvg(),r.connect(t.previousConnection),r=t.nextConnection}return n},compose:function(e){let t=e.getInputTargetBlock(`STACK`),n=[];for(;t;)n.push(t.valueConnection_),t=t.nextConnection&&t.nextConnection.targetBlock();for(let e=0;e<this.itemCount_;e++){var r;let t=(r=this.getInput(`OID${e}`))==null||(r=r.connection)==null?void 0:r.targetConnection;t&&!n.includes(t)&&t.disconnect()}this.itemCount_=n.length,this.itemCount_<1&&(this.itemCount_=1),this.updateShape_();for(let e=0;e<this.itemCount_;e++)f(n[e],this,`OID${e}`)},saveConnections:function(e){let t=e.getInputTargetBlock(`STACK`),n=0;for(;t;){var r,i;t.valueConnection_=(r=this.getInput(`OID${n}`))==null||(r=r.connection)==null?void 0:r.targetConnection,n++,t=(i=t.nextConnection)==null?void 0:i.targetBlock()}},updateShape_:function(){let e;this.getInput(`CONDITION`)&&(e=this.getFieldValue(`CONDITION`),this.removeInput(`CONDITION`));let t;this.getInput(`ACK_CONDITION`)&&(t=this.getFieldValue(`ACK_CONDITION`),this.removeInput(`ACK_CONDITION`));let r;for(let e=0;this.inputList[e];e++)if(this.inputList[e].name===`STATEMENT`){r=this.inputList[e],this.inputList.splice(e,1);break}let i=this.workspace,a=0;for(;a<this.itemCount_;a++){let e=this.getInput(`OID${a}`);e||(e=this.appendValueInput(`OID${a}`),a===0&&e.appendField(x(`on_ext`))),O(i,e,`field_oid`)}for(;this.getInput(`OID${a}`);)this.removeInput(`OID${a}`),a++;this.appendDummyInput(`CONDITION`).appendField(new n(w()),`CONDITION`),e&&this.setFieldValue(e,`CONDITION`),this.appendDummyInput(`ACK_CONDITION`).appendField(x(`on_ack`)).appendField(new n(T()),`ACK_CONDITION`),t&&this.setFieldValue(t,`ACK_CONDITION`),r?this.inputList.push(r):this.appendStatementInput(`STATEMENT`).setCheck(null)},onchange:function(){d(this)}},c.forBlock.on_ext=function(e){let t=e,n=E(e.getFieldValue(`CONDITION`)),r=e.getFieldValue(`ACK_CONDITION`),i=[];for(let n=0;n<t.itemCount_;n++){let t=c.valueToCode(e,`OID${n}`,s.COMMA);t&&(t=t.toString(),t.startsWith(`'`)&&t.endsWith(`'`)&&(t=`[${t}]`),i.includes(t)||i.push(t))}let a=`[].concat(${i.join(`).concat(`)})`,o=c.statementToCode(e,`STATEMENT`);return`on({ id: ${a}, ${n}${r?`, ack: ${r}`:``} }, async (obj) => {\n${i.length===1?D():``}${o}});\n`},b.Trigger.blocks.on=`<sep gap="5"></sep><block type="on"> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field></block>`,o.on={init:function(){this.appendDummyInput().appendField(x(`on`)),this.appendDummyInput(`OID`).appendField(new _(x(`select_id`),`state`),`OID`),this.appendDummyInput(`CONDITION`).appendField(new n(w()),`CONDITION`),this.appendDummyInput(`ACK_CONDITION`).appendField(x(`on_ack`)).appendField(new n(T()),`ACK_CONDITION`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_tooltip`)),this.setHelpUrl(S(`on_help`))},onchange:function(){d(this)}},c.forBlock.on=function(e){let t=e.getFieldValue(`OID`),n=E(e.getFieldValue(`CONDITION`)),r=e.getFieldValue(`ACK_CONDITION`);a.VARIABLES_DEFAULT_NAME=`value`;let i=p(t),o=c.statementToCode(e,`STATEMENT`);return`on({ id: '${t}'${i?` /* ${i} */`:``}, ${n}${r?`, ack: ${r}`:``} }, async (obj) => {\n${D()}${o}});\n`},b.Trigger.blocks.on_source=`<sep gap="5"></sep><block type="on_source"> <field name="ATTR">state.val</field></block>`,k(`on_source`,`↪`,[[x(`on_source_state_val`),`state.val`],[x(`on_source_state_ts`),`state.ts`],[x(`on_source_state_q`),`state.q`],[x(`on_source_state_from`),`state.from`],[x(`on_source_state_ack`),`state.ack`],[x(`on_source_state_lc`),`state.lc`],[x(`on_source_state_c`),`state.c`],[x(`on_source_state_user`),`state.user`],[x(`on_source_id`),`id`],[x(`on_source_name`),`common.name`],[x(`on_source_desc`),`common.desc`],[x(`on_source_channel_id`),`channelId`],[x(`on_source_channel_name`),`channelName`],[x(`on_source_device_id`),`deviceId`],[x(`on_source_device_name`),`deviceName`],[x(`on_source_oldstate_val`),`oldState.val`],[x(`on_source_oldstate_ts`),`oldState.ts`],[x(`on_source_oldstate_q`),`oldState.q`],[x(`on_source_oldstate_from`),`oldState.from`],[x(`on_source_oldstate_ack`),`oldState.ack`],[x(`on_source_oldstate_lc`),`oldState.lc`],[x(`on_source_oldstate_c`),`oldState.c`],[x(`on_source_oldstate_user`),`oldState.user`]],[`on`,`on_ext`,`onEnumMembers`],`on_source_warning`,b.Trigger.HUE,`on_help`),c.forBlock.on_source=function(e){let t=e.getFieldValue(`ATTR`),n=t.split(`.`);return[n.length>1?`(obj.${n[0]} ? obj.${t} : '')`:`obj.${t}`,s.ATOMIC]},b.Trigger.blocks.on_ack_value=`<sep gap="5"></sep><block type="on_ack_value"></block>`,o.on_ack_value={init:function(){this.appendDummyInput().appendField(`↪ ${x(`on_ack_value`)}`),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`on_ack_value_tooltip`)),this.setHelpUrl(S(`on_help`))},onchange:function(){m(this,[`on`,`on_ext`,`onEnumMembers`],`on_ack_value_warning`)},FUNCTION_TYPES:[`on`,`on_ext`,`onEnumMembers`]},c.forBlock.on_ack_value=function(){return`if (obj.id && obj?.state && !obj.state.ack) {
2
2
  ${c.prefixLines(`await setStateAsync(obj.id, { val: obj.state.val, ack: true });`,c.INDENT)}\n}\n`},b.Trigger.blocks.astro=`<block type="astro"> <field name="TYPE">sunrise</field> <field name="OFFSET">0</field></block>`,o.astro={init:function(){this.appendDummyInput().appendField(x(`astro`)),this.appendDummyInput(`TYPE`).appendField(new n([[x(`astro_sunriseText`),`sunrise`],[x(`astro_sunriseEndText`),`sunriseEnd`],[x(`astro_goldenHourEndText`),`goldenHourEnd`],[x(`astro_solarNoonText`),`solarNoon`],[x(`astro_goldenHourText`),`goldenHour`],[x(`astro_sunsetStartText`),`sunsetStart`],[x(`astro_sunsetText`),`sunset`],[x(`astro_duskText`),`dusk`],[x(`astro_nauticalDuskText`),`nauticalDusk`],[x(`astro_nightText`),`night`],[x(`astro_nightEndText`),`nightEnd`],[x(`astro_nauticalDawnText`),`nauticalDawn`],[x(`astro_dawnText`),`dawn`],[x(`astro_nadirText`),`nadir`]]),`TYPE`),this.appendDummyInput().appendField(x(`astro_offset`)),this.appendDummyInput(`OFFSET`).appendField(new r(`0`),`OFFSET`),this.appendDummyInput().appendField(x(`astro_minutes`)),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`astro_tooltip`)),this.setHelpUrl(S(`astro_help`))},onchange:function(){d(this)}},c.forBlock.astro=function(e){return`schedule({ astro: '${e.getFieldValue(`TYPE`)}', shift: ${parseInt(e.getFieldValue(`OFFSET`),10)} }, async () => {\n${c.statementToCode(e,`STATEMENT`)}});\n`},b.Trigger.blocks.schedule=`<block type="schedule"> <field name="SCHEDULE">* * * * *</field></block>`,o.schedule={init:function(){this.appendDummyInput().appendField(x(`schedule`)),this.appendDummyInput(`SCHEDULE`).appendField(new v(`* * * * *`),`SCHEDULE`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`schedule_tooltip`)),this.setHelpUrl(S(`schedule_help`))},onchange:function(){d(this)}},c.forBlock.schedule=function(e){let t=e.getFieldValue(`SCHEDULE`),n=c.statementToCode(e,`STATEMENT`);return`schedule(${t.startsWith(`{`)?`'${t}'`:`"${t}"`}, async () => {\n${n}});\n`},b.Trigger.blocks.schedule_by_id=`<block type="schedule_by_id"> <field name="ACK_CONDITION"></field></block>`,o.schedule_by_id={init:function(){this.appendDummyInput().appendField(x(`schedule_by_id`)),this.appendDummyInput(`OID`).appendField(new _(x(`select_id`),`state`),`OID`),this.appendDummyInput(`ACK_CONDITION`).appendField(x(`on_ack`)).appendField(new n(T()),`ACK_CONDITION`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`schedule_by_id_tooltip`)),this.setHelpUrl(S(`schedule_by_id_help`))}},c.forBlock.schedule_by_id=function(e){let t=e.getFieldValue(`OID`),n=e.getFieldValue(`ACK_CONDITION`),r=c.statementToCode(e,`STATEMENT`),i=p(t);return`scheduleById('${t}'${i?` /* ${i} */`:``}${n?`, ${n}`:``}, async () => {\n${r}});\n`},b.Trigger.blocks.schedule_create=`<block type="schedule_create"> <field name="NAME">schedule</field> <value name="SCHEDULE"> <shadow type="field_cron"> </shadow> </value></block>`;let A=(t,n,r)=>{if(t===`schedule`)return!1;for(let i of n.getAllBlocks())if(i!==r&&i.isSchedule_&&e.equals(i.getFieldValue(`NAME`),t))return!1;return!0},j=(e,t)=>{if(t.isInFlyout)return e;for(;!A(e,t.workspace,t);){let t=e.match(/^(.*?)(\d+)$/);t?e=t[1]+(parseInt(t[2],10)+1):e+=`1`}return e},M=function(e){return j(e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,``),this.getSourceBlock())};o.schedule_create={init:function(){let e=new r(j(`schedule`,this),M);e.setSpellcheck(!1),this.appendDummyInput(`NAME`).appendField(x(`schedule_create`)).appendField(e,`NAME`),this.appendValueInput(`SCHEDULE`).appendField(x(`schedule_text`)),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`schedule_create_tooltip`)),this.setHelpUrl(S(`schedule_create_help`))},isSchedule_:!0,getVars:function(){return[this.getFieldValue(`NAME`)]},getVarModels:function(){return[l(this.getFieldValue(`NAME`),`cron`)]}},c.forBlock.schedule_create=function(e){return`${y(e)} = schedule(${c.valueToCode(e,`SCHEDULE`,s.ATOMIC)}, async () => {\n${c.statementToCode(e,`STATEMENT`)}});\n`},b.Trigger.blocks.schedule_clear=`<sep gap="5"></sep><block type="schedule_clear"> <field name="NAME"></field></block>`,o.schedule_clear={init:function(){this.appendDummyInput(`NAME`).appendField(x(`schedule_clear`)).appendField(new n(()=>{var e;return(e=window.scripts)!=null&&e.blocklyWorkspace?C(window.scripts.blocklyWorkspace):[]}),`NAME`),this.setInputsInline(!0),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`schedule_clear_tooltip`)),this.setHelpUrl(S(`schedule_clear_help`))}},c.forBlock.schedule_clear=function(e){let t=y(e);return`(() => { if (${t}) { clearSchedule(${t}); ${t} = null; }})();\n`},b.Trigger.blocks.field_cron=`<sep gap="5"></sep><block type="field_cron"> <field name="CRON">* * * * *</field></block>`,o.field_cron={init:function(){this.appendDummyInput().appendField(x(`field_cron_CRON`)),this.appendDummyInput().appendField(new v(`* * * * *`),`CRON`),this.setInputsInline(!0),this.setOutput(!0,`String`),this.setColour(b.Trigger.HUE),this.setTooltip(x(`field_cron_tooltip`))}},c.forBlock.field_cron=function(e){return[`'${e.getFieldValue(`CRON`)}'`,s.ATOMIC]},b.Trigger.blocks.cron_builder=`<sep gap="5"></sep><block type="cron_builder"> <mutation seconds="false" as_line="false"></mutation> <field name="LINE">FALSE</field> <field name="WITH_SECONDS">FALSE</field> <value name="DOW"> <shadow type="text"> <field name="TEXT">*</field> </shadow> </value> <value name="MONTHS"> <shadow type="text"> <field name="TEXT">*</field> </shadow> </value> <value name="DAYS"> <shadow type="text"> <field name="TEXT">*</field> </shadow> </value> <value name="HOURS"> <shadow type="text"> <field name="TEXT">*</field> </shadow> </value> <value name="MINUTES"> <shadow type="text"> <field name="TEXT">*</field> </shadow> </value></block>`,o.cron_builder={init:function(){this.appendDummyInput().appendField(x(`cron_builder_CRON`)),this.appendDummyInput(`LINE`).appendField(x(`cron_builder_line`)).appendField(new i(`FALSE`,function(e){var t;(t=this.getSourceBlock())==null||t.setInputsInline(h(e))}),`LINE`);let e=this.workspace;for(let[t,n]of[[`DOW`,`cron_builder_dow`],[`MONTHS`,`cron_builder_month`],[`DAYS`,`cron_builder_day`],[`HOURS`,`cron_builder_hour`],[`MINUTES`,`cron_builder_minutes`]]){let r=this.appendValueInput(t).appendField(x(n));O(e,r,`text`,[`TEXT`,`*`])}this.appendDummyInput(`WITH_SECONDS`).appendField(x(`cron_builder_with_seconds`)).appendField(new i(`FALSE`,function(e){this.getSourceBlock().updateShape_(h(e))}),`WITH_SECONDS`),this.seconds_=!1,this.as_line_=!1,this.setInputsInline(this.as_line_),this.setOutput(!0,`String`),this.setColour(b.Trigger.HUE),this.setTooltip(x(`field_cron_tooltip`))},mutationToDom:function(){let e=document.createElement(`mutation`);return e.setAttribute(`seconds`,String(this.seconds_)),e.setAttribute(`as_line`,String(this.as_line_)),e},domToMutation:function(e){this.seconds_=e.getAttribute(`seconds`)===`true`,this.as_line_=e.getAttribute(`as_line`)===`true`,this.setInputsInline(this.as_line_),this.updateShape_(this.seconds_)},updateShape_:function(e){if(this.seconds_=e,e){if(!this.getInput(`SECONDS`)){let e=this.appendValueInput(`SECONDS`).appendField(x(`cron_builder_seconds`));O(this.workspace,e,`text`,[`TEXT`,`*`])}}else this.getInput(`SECONDS`)&&this.removeInput(`SECONDS`)}},c.forBlock.cron_builder=function(e){let t=t=>c.valueToCode(e,t,s.ATOMIC),n=e.getFieldValue(`WITH_SECONDS`),r=n&&e.getInput(`SECONDS`)?t(`SECONDS`):`0`;return[(h(n)?`${r}.toString().trim() + ' ' + `:``)+`${t(`MINUTES`)}.toString().trim() + ' ' + ${t(`HOURS`)}.toString().trim() + ' ' + ${t(`DAYS`)}.toString().trim() + ' ' + ${t(`MONTHS`)}.toString().trim() + ' ' + ${t(`DOW`)}.toString().trim()`,s.ATOMIC]},b.Trigger.blocks.onMessage=`<block type="onMessage"> <field name="MESSAGE">customMessage</field></block>`,o.onMessage={init:function(){this.appendDummyInput(`NAME`).appendField(`✉️ ${x(`onMessage`)}`),this.appendDummyInput(`MESSAGE`).appendField(x(`onMessage_message`)).appendField(new r(`customMessage`),`MESSAGE`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`onMessage_tooltip`)),this.setHelpUrl(S(`onMessage_help`))},onchange:function(){d(this)}},c.forBlock.onMessage=function(e){let t=e.getFieldValue(`MESSAGE`),n=c.statementToCode(e,`STATEMENT`);return`onMessage(${u(t)}, async (data, callback) => {\n${n}${c.prefixLines(`typeof callback === 'function' && callback({ result: true }); // default callback`,c.INDENT)}\n});\n`},b.Trigger.blocks.onMessage_data=`<sep gap="5"></sep><block type="onMessage_data"> <field name="ATTR">data</field></block>`,k(`onMessage_data`,`✉️ `,[[x(`onMessage_data_data`),`data`]],[`onMessage`],`onMessage_data_warning`,b.Action.HUE,`onMessage_data_help`),c.forBlock.onMessage_data=function(e){return[e.getFieldValue(`ATTR`),s.ATOMIC]},b.Trigger.blocks.onFile=`<block type="onFile"> <field name="WITH_FILE">FALSE</field> <value name="OID"> <shadow type="field_oid_meta"> <field name="oid">0_userdata.0</field> </shadow> </value> <value name="FILE"> <shadow type="text"> <field name="TEXT">*</field> </shadow> </value></block>`,o.onFile={init:function(){this.appendValueInput(`OID`).appendField(`📁 ${x(`onFile`)}`).setCheck(null),this.appendValueInput(`FILE`).appendField(x(`onFile_file`)).setCheck(null),this.appendDummyInput(`WITH_FILE_INPUT`).appendField(x(`onFile_withFile`)).appendField(new i(`FALSE`),`WITH_FILE`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`onFile_tooltip`)),this.setHelpUrl(S(`onFile_help`))},onchange:function(){d(this)}},c.forBlock.onFile=function(e){let t=c.valueToCode(e,`OID`,s.ATOMIC),n=c.valueToCode(e,`FILE`,s.ATOMIC),r=e.getFieldValue(`WITH_FILE`),i=c.statementToCode(e,`STATEMENT`),a=g(t);return`onFile(${t}${a?` /* ${a} */`:``}, ${n}, ${r===`TRUE`?`true`:`false`}, async (id, fileName, size, data, mimeType) => {\n${i}});\n`},b.Trigger.blocks.onFile_data=`<sep gap="5"></sep><block type="onFile_data"> <field name="ATTR">data</field></block>`,k(`onFile_data`,`📁`,[[x(`onFile_data_data`),`data`],[x(`onFile_data_filename`),`fileName`],[x(`onFile_data_size`),`size`],[x(`onFile_data_mimeType`),`mimeType`],[x(`onFile_data_id`),`id`],[x(`onFile_data_tempFile`),`TEMP_FILE_PATH`]],[`onFile`],`onFile_data_warning`,b.Trigger.HUE),c.forBlock.onFile_data=function(e){let t=e.getFieldValue(`ATTR`);return t===`TEMP_FILE_PATH`?[`createTempFile(fileName, data)`,s.ATOMIC]:[t,s.ATOMIC]},b.Trigger.blocks.offFile=`<sep gap="5"></sep><block type="offFile"> <value name="OID"> <shadow type="field_oid_meta"> <field name="oid">0_userdata.0</field> </shadow> </value> <value name="FILE"> <shadow type="text"> <field name="TEXT">*</field> </shadow> </value></block>`,o.offFile={init:function(){this.appendValueInput(`OID`).appendField(`📁 ${x(`offFile`)}`).setCheck(null),this.appendValueInput(`FILE`).appendField(x(`onFile_file`)).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`offFile_tooltip`)),this.setHelpUrl(S(`offFile_help`))}},c.forBlock.offFile=function(e){let t=c.valueToCode(e,`OID`,s.ATOMIC),n=c.valueToCode(e,`FILE`,s.ATOMIC),r=g(t);return`offFile(${t}${r?` /* ${r} */`:``}, ${n});\n`},b.Trigger.blocks.onLog=`<block type="onLog"> <field name="Severity">error</field></block>`,o.onLog={init:function(){this.appendDummyInput(`TEXT`).appendField(`💬 ${x(`onLog`)}`),this.appendDummyInput(`Severity`).appendField(x(`loglevel`)).appendField(new n([[x(`loglevel_error`),`error`],[x(`loglevel_warn`),`warn`],[x(`loglevel_info`),`info`],[x(`loglevel_debug`),`debug`],[x(`loglevel_all`),`*`]]),`Severity`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`onLog_tooltip`)),this.setHelpUrl(S(`onLog_help`))},onchange:function(){d(this)}},c.forBlock.onLog=function(e){let t=c.statementToCode(e,`STATEMENT`);return`onLog('${e.getFieldValue(`Severity`)}', async (data) => {\n${t}});\n`},b.Trigger.blocks.onLog_data=`<sep gap="5"></sep><block type="onLog_data"> <field name="ATTR">data.message</field></block>`,k(`onLog_data`,`💬 `,[[x(`onLog_data_message`),`data.message`],[x(`loglevel`),`data.severity`],[x(`onLog_data_from`),`data.from`],[x(`onLog_data_ts`),`data.ts`]],[`onLog`],`onLog_data_warning`,b.Trigger.HUE),c.forBlock.onLog_data=function(e){return[e.getFieldValue(`ATTR`),s.ATOMIC]},b.Trigger.blocks.onEnumMembers=`<block type="onEnumMembers"></block>`,o.onEnumMembers={init:function(){this.appendDummyInput().appendField(x(`onEnumMembers`)),this.appendDummyInput(`OID`).appendField(new _(x(`select_id`),`enum`),`OID`),this.appendStatementInput(`STATEMENT`).setCheck(null),this.setInputsInline(!1),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(b.Trigger.HUE),this.setTooltip(x(`onEnumMembers_tooltip`)),this.setHelpUrl(S(`onEnumMembers_help`))},onchange:function(){d(this)}},c.forBlock.onEnumMembers=function(e){let t=e.getFieldValue(`OID`),n=c.statementToCode(e,`STATEMENT`),r=p(t);return`onEnumMembers('${t}'${r?` /* ${r} */`:``}, async (obj) => {\n${D()}${n}});\n`}}export{b as install};
@@ -0,0 +1,2 @@
1
+ import{p as e,v as t}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-Drq9CkPs.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,4 +1,4 @@
1
- import{t as e}from"./vite-preload-helper-B7qeedMF.js";var t=`FEDERATION_DEBUG`,n={AT:`@`,HYPHEN:`-`,SLASH:`/`},r={[n.AT]:`scope_`,[n.HYPHEN]:`_`,[n.SLASH]:`__`};r[n.AT],n.AT,r[n.HYPHEN],n.HYPHEN,r[n.SLASH],n.SLASH;var i=function(e){return e[e.UNKNOWN=1]=`UNKNOWN`,e[e.CALCULATED=2]=`CALCULATED`,e[e.NO_USE=0]=`NO_USE`,e}({});function a(){return!0}function o(){var e;return typeof navigator<`u`&&((e=navigator)==null?void 0:e.product)===`ReactNative`}function s(){try{if(a()&&window.localStorage)return!!localStorage.getItem(t)}catch{return!1}return!1}function c(){return typeof process<`u`&&{}.FEDERATION_DEBUG?!!{}.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<`u`&&FEDERATION_DEBUG?!0:s()}var l=`[ Federation Runtime ]`,u=function(...e){return e.length?e.reduce((e,t)=>t?e?`${e}:${t}`:t:e,``):``};function d(e,t){if(`getPublicPath`in e){let n;return n=e.getPublicPath.startsWith(`function`)?Function(`return `+e.getPublicPath)()():Function(e.getPublicPath)(),`${n}${t}`}return`publicPath`in e?!a()&&!o()&&`ssrPublicPath`in e&&typeof e.ssrPublicPath==`string`?`${e.ssrPublicPath}${t}`:`${e.publicPath}${t}`:(console.warn(`Cannot get resource URL. If in debug mode, please ignore.`,e,t),``)}var f=e=>{console.warn(`${l}: ${e}`)};function p(e){try{return JSON.stringify(e,null,2)}catch{return``}}var m=(e,t)=>{if(!e)return t;let n=(e=>{if(e===`.`)return``;if(e.startsWith(`./`))return e.replace(`./`,``);if(e.startsWith(`/`)){let t=e.slice(1);return t.endsWith(`/`)?t.slice(0,-1):t}return e})(e);return n?n.endsWith(`/`)?`${n}${t}`:`${n}/${t}`:t};function h(e){return e.replace(/#.*$/,``).replace(/\?.*$/,``).replace(/\/[^\/]+$/,`/`)}function g(e,t={}){var n;let{remotes:r={},overrides:i={},version:a}=t,o,s=()=>`publicPath`in e.metaData?(e.metaData.publicPath===`auto`||e.metaData.publicPath===``)&&a?h(a):e.metaData.publicPath:e.metaData.getPublicPath,c=Object.keys(i),l={};Object.keys(r).length||(l=((n=e.remotes)==null?void 0:n.reduce((e,t)=>{let n,r=t.federationContainerName;return n=c.includes(r)?i[r]:`version`in t?t.version:t.entry,e[r]={matchedVersion:n},e},{}))||{}),Object.keys(r).forEach(e=>l[e]={matchedVersion:c.includes(e)?i[e]:r[e]});let{remoteEntry:{path:u,name:d,type:f},types:p={path:``,name:``,zip:``,api:``},buildInfo:{buildVersion:g},globalName:_,ssrRemoteEntry:v}=e.metaData,{exposes:y}=e,ee={version:a||``,buildVersion:g,globalName:_,remoteEntry:m(u,d),remoteEntryType:f,remoteTypes:m(p.path,p.name),remoteTypesZip:p.zip||``,remoteTypesAPI:p.api||``,remotesInfo:l,shared:e==null?void 0:e.shared.map(e=>({assets:e.assets,sharedName:e.name,version:e.version,usedExports:e.referenceExports||[]})),modules:y==null?void 0:y.map(e=>({moduleName:e.name,modulePath:e.path,assets:e.assets}))};if(`publicPath`in e.metaData?(o={...ee,publicPath:s()},typeof e.metaData.ssrPublicPath==`string`&&(o.ssrPublicPath=e.metaData.ssrPublicPath)):o={...ee,getPublicPath:s()},v){let e=m(v.path,v.name);o.ssrRemoteEntry=e,o.ssrRemoteEntryType=v.type||`commonjs-module`}return o}function _(e){return!!(`remoteEntry`in e&&e.remoteEntry.includes(`.json`))}var v=`[ Module Federation ]`,y=console,ee=[`logger.ts`,`logger.js`,`captureStackTrace`,`Logger.emit`,`Logger.log`,`Logger.info`,`Logger.warn`,`Logger.error`,`Logger.debug`];function te(){try{let e=Error().stack;if(!e)return;let[,...t]=e.split(`
1
+ import{t as e}from"./vite-preload-helper-CaC3yEL3.js";var t=`FEDERATION_DEBUG`,n={AT:`@`,HYPHEN:`-`,SLASH:`/`},r={[n.AT]:`scope_`,[n.HYPHEN]:`_`,[n.SLASH]:`__`};r[n.AT],n.AT,r[n.HYPHEN],n.HYPHEN,r[n.SLASH],n.SLASH;var i=function(e){return e[e.UNKNOWN=1]=`UNKNOWN`,e[e.CALCULATED=2]=`CALCULATED`,e[e.NO_USE=0]=`NO_USE`,e}({});function a(){return!0}function o(){var e;return typeof navigator<`u`&&((e=navigator)==null?void 0:e.product)===`ReactNative`}function s(){try{if(a()&&window.localStorage)return!!localStorage.getItem(t)}catch{return!1}return!1}function c(){return typeof process<`u`&&{}.FEDERATION_DEBUG?!!{}.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<`u`&&FEDERATION_DEBUG?!0:s()}var l=`[ Federation Runtime ]`,u=function(...e){return e.length?e.reduce((e,t)=>t?e?`${e}:${t}`:t:e,``):``};function d(e,t){if(`getPublicPath`in e){let n;return n=e.getPublicPath.startsWith(`function`)?Function(`return `+e.getPublicPath)()():Function(e.getPublicPath)(),`${n}${t}`}return`publicPath`in e?!a()&&!o()&&`ssrPublicPath`in e&&typeof e.ssrPublicPath==`string`?`${e.ssrPublicPath}${t}`:`${e.publicPath}${t}`:(console.warn(`Cannot get resource URL. If in debug mode, please ignore.`,e,t),``)}var f=e=>{console.warn(`${l}: ${e}`)};function p(e){try{return JSON.stringify(e,null,2)}catch{return``}}var m=(e,t)=>{if(!e)return t;let n=(e=>{if(e===`.`)return``;if(e.startsWith(`./`))return e.replace(`./`,``);if(e.startsWith(`/`)){let t=e.slice(1);return t.endsWith(`/`)?t.slice(0,-1):t}return e})(e);return n?n.endsWith(`/`)?`${n}${t}`:`${n}/${t}`:t};function h(e){return e.replace(/#.*$/,``).replace(/\?.*$/,``).replace(/\/[^\/]+$/,`/`)}function g(e,t={}){var n;let{remotes:r={},overrides:i={},version:a}=t,o,s=()=>`publicPath`in e.metaData?(e.metaData.publicPath===`auto`||e.metaData.publicPath===``)&&a?h(a):e.metaData.publicPath:e.metaData.getPublicPath,c=Object.keys(i),l={};Object.keys(r).length||(l=((n=e.remotes)==null?void 0:n.reduce((e,t)=>{let n,r=t.federationContainerName;return n=c.includes(r)?i[r]:`version`in t?t.version:t.entry,e[r]={matchedVersion:n},e},{}))||{}),Object.keys(r).forEach(e=>l[e]={matchedVersion:c.includes(e)?i[e]:r[e]});let{remoteEntry:{path:u,name:d,type:f},types:p={path:``,name:``,zip:``,api:``},buildInfo:{buildVersion:g},globalName:_,ssrRemoteEntry:v}=e.metaData,{exposes:y}=e,ee={version:a||``,buildVersion:g,globalName:_,remoteEntry:m(u,d),remoteEntryType:f,remoteTypes:m(p.path,p.name),remoteTypesZip:p.zip||``,remoteTypesAPI:p.api||``,remotesInfo:l,shared:e==null?void 0:e.shared.map(e=>({assets:e.assets,sharedName:e.name,version:e.version,usedExports:e.referenceExports||[]})),modules:y==null?void 0:y.map(e=>({moduleName:e.name,modulePath:e.path,assets:e.assets}))};if(`publicPath`in e.metaData?(o={...ee,publicPath:s()},typeof e.metaData.ssrPublicPath==`string`&&(o.ssrPublicPath=e.metaData.ssrPublicPath)):o={...ee,getPublicPath:s()},v){let e=m(v.path,v.name);o.ssrRemoteEntry=e,o.ssrRemoteEntryType=v.type||`commonjs-module`}return o}function _(e){return!!(`remoteEntry`in e&&e.remoteEntry.includes(`.json`))}var v=`[ Module Federation ]`,y=console,ee=[`logger.ts`,`logger.js`,`captureStackTrace`,`Logger.emit`,`Logger.log`,`Logger.info`,`Logger.warn`,`Logger.error`,`Logger.debug`];function te(){try{let e=Error().stack;if(!e)return;let[,...t]=e.split(`
2
2
  `),n=t.filter(e=>!ee.some(t=>e.includes(t)));return n.length?`Stack trace:\n${n.slice(0,5).join(`
3
3
  `)}`:void 0}catch{return}}var ne=class{constructor(e,t=y){this.prefix=e,this.delegate=t??y}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??y}emit(e,t){let n=this.delegate,r=c()?te():void 0,i=r?[...t,r]:t,a=(()=>{switch(e){case`log`:return[`log`,`info`];case`info`:return[`info`,`log`];case`warn`:return[`warn`,`info`,`log`];case`error`:return[`error`,`warn`,`log`];default:return[`debug`,`log`]}})();for(let e of a){let t=n[e];if(typeof t==`function`){t.call(n,this.prefix,...i);return}}for(let e of a){let t=y[e];if(typeof t==`function`){t.call(y,this.prefix,...i);return}}}log(...e){this.emit(`log`,e)}warn(...e){this.emit(`warn`,e)}error(...e){this.emit(`error`,e)}success(...e){this.emit(`info`,e)}info(...e){this.emit(`info`,e)}ready(...e){this.emit(`info`,e)}debug(...e){c()&&this.emit(`debug`,e)}};function re(e){return new ne(e)}function ie(e){let t=new ne(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}re(v),ie(v);async function ae(e,t){try{return await e()}catch(e){!t&&f(e);return}}function oe(e,t){let n=/^(https?:)?\/\//i;return e.replace(n,``).replace(/\/$/,``)===t.replace(n,``).replace(/\/$/,``)}function se(e){let t=null,n=!0,r=2e4,i,a=document.getElementsByTagName(`script`);for(let r=0;r<a.length;r++){let i=a[r],o=i.getAttribute(`src`);if(o&&oe(o,e.url)){t=i,n=!1;break}}if(!t){let n=e.attrs;t=document.createElement(`script`),t.type=(n==null?void 0:n.type)===`module`?`module`:`text/javascript`;let i;e.createScriptHook&&(i=e.createScriptHook(e.url,e.attrs),i instanceof HTMLScriptElement?t=i:typeof i==`object`&&(`script`in i&&i.script&&(t=i.script),`timeout`in i&&i.timeout&&(r=i.timeout))),t.src||(t.src=e.url),n&&!i&&Object.keys(n).forEach(e=>{t&&(e===`async`||e===`defer`?t[e]=n[e]:t.getAttribute(e)||t.setAttribute(e,n[e]))})}let o=null,s=typeof window<`u`?t=>{if(t.filename&&oe(t.filename,e.url)){let n=Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`);n.name=`ScriptExecutionError`,o=n}}:null;s&&window.addEventListener(`error`,s);let c=async(n,r)=>{clearTimeout(i),s&&window.removeEventListener(`error`,s);let a=()=>{if((r==null?void 0:r.type)===`error`){let t=Error(r!=null&&r.isTimeout?`ScriptNetworkError: Script "${e.url}" timed out.`:`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);t.name=`ScriptNetworkError`,e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(t))}else o?e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(o)):e!=null&&e.cb&&(e==null||e.cb())};if(t&&(t.onerror=null,t.onload=null,ae(()=>{let{needDeleteScript:n=!0}=e;n&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),n&&typeof n==`function`)){let e=n(r);if(e instanceof Promise){let t=await e;return a(),t}return a(),e}a()};return t.onerror=c.bind(null,t.onerror),t.onload=c.bind(null,t.onload),i=setTimeout(()=>{c(null,{type:`error`,isTimeout:!0})},r),{script:t,needAttach:n}}function ce(e){let t=null,n=!0,r=2e4,i,a=document.getElementsByTagName(`link`);for(let r=0;r<a.length;r++){let i=a[r],o=i.getAttribute(`href`),s=i.getAttribute(`rel`);if(o&&oe(o,e.url)&&s===e.attrs.rel){t=i,n=!1;break}}if(!t){t=document.createElement(`link`),t.setAttribute(`href`,e.url);let n,i=!0,a=e.attrs;e.createLinkHook&&(n=e.createLinkHook(e.url,a),n instanceof HTMLLinkElement?(t=n,i=!1):typeof n==`object`&&(`link`in n&&n.link&&(t=n.link,i=!1),`timeout`in n&&n.timeout&&(r=n.timeout))),a&&i&&Object.keys(a).forEach(e=>{t&&!t.getAttribute(e)&&t.setAttribute(e,a[e])})}if(!n)return Promise.resolve().then(()=>{e!=null&&e.cb&&(e==null||e.cb())}),{link:t,needAttach:n};let o=(n,r)=>{i&&clearTimeout(i);let a=()=>{if((r==null?void 0:r.type)===`error`){let t=Error(r!=null&&r.isTimeout?`LinkNetworkError: Link "${e.url}" timed out.`:`LinkNetworkError: Failed to load link "${e.url}" - the URL is unreachable or the server returned an error.`);t.name=`LinkNetworkError`,e!=null&&e.onErrorCallback&&(e==null||e.onErrorCallback(t))}else e!=null&&e.cb&&(e==null||e.cb())};if(t&&(t.onerror=null,t.onload=null,ae(()=>{let{needDeleteLink:n=!0}=e;n&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),n)){let e=n(r);return a(),e}a()};return t.onerror=o.bind(null,t.onerror),t.onload=o.bind(null,t.onload),i=setTimeout(()=>{o(null,{type:`error`,isTimeout:!0})},r),{link:t,needAttach:n}}function le(e,t){let{attrs:n={},createScriptHook:r}=t;return new Promise((t,i)=>{let{script:a,needAttach:o}=se({url:e,cb:t,onErrorCallback:i,attrs:{fetchpriority:`high`,...n},createScriptHook:r,needDeleteScript:!0});o&&document.head.appendChild(a)})}var ue=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split(`-`)[0].toLowerCase()}#${e.toLowerCase()}`,de=(e,t,n,r)=>{let i=[`${[t[e]]} #${e}`];return n&&i.push(`args: ${JSON.stringify(n)}`),i.push(ue(e)),r&&i.push(`Original Error Message:\n ${r}`),i.join(`
4
4
  `)};function fe(e,t,n,r,i,a){return r(de(e,t,n,i))}var b=`[ Federation Runtime ]`,pe=re(b);function x(e,t,n,r,i){e||(n===void 0?S(t):S(t,n,r,void 0,i))}function S(e,t,n,r,i){if(t!==void 0)return fe(e,t,n??{},e=>{throw Error(`${b}: ${e}`)},r,i);let a=e;throw a instanceof Error?(a.message.startsWith(b)||(a.message=`${b}: ${a.message}`),a):Error(`${b}: ${a}`)}function C(e){e instanceof Error&&(e.message.startsWith(b)||(e.message=`${b}: ${e.message}`)),pe.warn(e)}function me(e,t){return e.findIndex(e=>e===t)===-1&&e.push(t),e}function w(e){return`version`in e&&e.version?`${e.name}:${e.version}`:`entry`in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function he(e){return e.entry!==void 0}function ge(e){return!e.entry.includes(`.json`)}function _e(e){return e&&typeof e==`object`}var ve=Object.prototype.toString;function ye(e){return ve.call(e)===`[object Object]`}function be(e){return Array.isArray(e)?e:[e]}function xe(e){return`remoteEntry`in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:{url:``,type:`global`,globalName:``}}var Se=(e,t)=>{let n;return n=e.endsWith(`/`)?e.slice(0,-1):e,t.startsWith(`.`)&&(t=t.slice(1)),n+=t,n},Ce=2e3,T=typeof globalThis==`object`?globalThis:window,E=(()=>{try{return document.defaultView}catch{return T}})(),D=E;function we(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!1,writable:!0})}function Te(e,t){return Object.hasOwnProperty.call(e,t)}Te(T,`__GLOBAL_LOADING_REMOTE_ENTRY__`)||we(T,`__GLOBAL_LOADING_REMOTE_ENTRY__`,{});var O=T.__GLOBAL_LOADING_REMOTE_ENTRY__;function Ee(e){Te(e,`__VMOK__`)&&!Te(e,`__FEDERATION__`)&&we(e,`__FEDERATION__`,e.__VMOK__),Te(e,`__FEDERATION__`)||(we(e,`__FEDERATION__`,{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map,__PRELOADED_ASSETS__:new Set}),we(e,`__VMOK__`,e.__FEDERATION__)),e.__FEDERATION__.__GLOBAL_PLUGIN__??=[],e.__FEDERATION__.__INSTANCES__??=[],e.__FEDERATION__.moduleInfo??={},e.__FEDERATION__.__SHARE__??={},e.__FEDERATION__.__MANIFEST_LOADING__??={},e.__FEDERATION__.__PRELOADED_MAP__??=new Map,e.__FEDERATION__.__PRELOADED_ASSETS__??=new Set}Ee(T),Ee(E);function De(){T.__FEDERATION__.__GLOBAL_PLUGIN__=[],T.__FEDERATION__.__INSTANCES__=[],T.__FEDERATION__.moduleInfo={},T.__FEDERATION__.__SHARE__={},T.__FEDERATION__.__MANIFEST_LOADING__={},T.__FEDERATION__.__PRELOADED_ASSETS__.clear(),Object.keys(O).forEach(e=>{delete O[e]})}function Oe(e){T.__FEDERATION__.__INSTANCES__.push(e)}function ke(){return T.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function Ae(e,t=c()){t&&(T.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,T.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__=`2.9.0`)}function k(e,t){if(typeof t==`string`){if(e[t])return{value:e[t],key:t};{let n=Object.keys(e);for(let r of n){let[n,i]=r.split(`:`),a=`${n}:${t}`,o=e[a];if(o)return{value:o,key:a}}return{value:void 0,key:t}}}S(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}var je=()=>E.__FEDERATION__.moduleInfo,Me=(e,t)=>{let n=k(t,w(e)).value;if(n&&!n.version&&`version`in e&&e.version&&(n.version=e.version),n)return n;if(`version`in e&&e.version){let{version:t,...n}=e,r=w(n),i=k(E.__FEDERATION__.moduleInfo,r).value;if((i==null?void 0:i.version)===t)return i}},A=e=>Me(e,E.__FEDERATION__.moduleInfo),Ne=(e,t)=>{let n=w(e);return E.__FEDERATION__.moduleInfo[n]=t,E.__FEDERATION__.moduleInfo},Pe=e=>(E.__FEDERATION__.moduleInfo={...E.__FEDERATION__.moduleInfo,...e},()=>{let t=Object.keys(e);for(let e of t)delete E.__FEDERATION__.moduleInfo[e]}),Fe=(e,t)=>{let n=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:n,entryExports:T[n]}},Ie=e=>{let{__GLOBAL_PLUGIN__:t}=E.__FEDERATION__;e.forEach(e=>{t.findIndex(t=>t.name===e.name)===-1?t.push(e):C(`The plugin ${e.name} has been registered.`)})},Le=()=>E.__FEDERATION__.__GLOBAL_PLUGIN__,Re=e=>T.__FEDERATION__.__PRELOADED_MAP__.get(e),ze=e=>T.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),Be=e=>T.__FEDERATION__.__PRELOADED_ASSETS__.has(e),Ve=e=>{let t=T.__FEDERATION__.__PRELOADED_ASSETS__;if(t.add(e),t.size>Ce){let e=t.values().next().value;e!==void 0&&t.delete(e)}},He=`[0-9A-Za-z-]+`,Ue=`(?:\\+(${He}(?:\\.${He})*))`,j=`0|[1-9]\\d*`,We=`[0-9]+`,Ge=`\\d*[a-zA-Z-][a-zA-Z0-9-]*`,Ke=`(?:${We}|${Ge})`,qe=`(?:-?(${Ke}(?:\\.${Ke})*))`,Je=`(?:${j}|${Ge})`,Ye=`(?:-(${Je}(?:\\.${Je})*))`,Xe=`${j}|x|X|\\*`,M=`[v=\\s]*(${Xe})(?:\\.(${Xe})(?:\\.(${Xe})(?:${Ye})?${Ue}?)?)?`,Ze=`^\\s*(${M})\\s+-\\s+(${M})\\s*$`,Qe=`[v=\\s]*${`(${We})\\.(${We})\\.(${We})`}${qe}?${Ue}?`,$e=`((?:<|>)?=?)`,et=`(\\s*)${$e}\\s*(${Qe}|${M})`,tt=`(?:~>?)`,nt=`(\\s*)${tt}\\s+`,rt=`(?:\\^)`,it=`(\\s*)${rt}\\s+`,at=`(<|>)?=?\\s*\\*`,ot=`^${rt}${M}$`,st=`v?${`(${j})\\.(${j})\\.(${j})`}${Ye}?${Ue}?`,ct=`^${tt}${M}$`,lt=`^${$e}\\s*${M}$`,ut=`^${$e}\\s*(${st})$|^$`,dt=`^\\s*>=\\s*0.0.0\\s*$`;function N(e){return new RegExp(e)}function P(e){return!e||e.toLowerCase()===`x`||e===`*`}function ft(...e){return t=>e.reduce((e,t)=>t(e),t)}function pt(e){return e.match(N(ut))}function mt(e,t,n,r){let i=`${e}.${t}.${n}`;return r?`${i}-${r}`:i}function ht(e){return e.replace(N(Ze),(e,t,n,r,i,a,o,s,c,l,u,d)=>(t=P(n)?``:P(r)?`>=${n}.0.0`:P(i)?`>=${n}.${r}.0`:`>=${t}`,s=P(c)?``:P(l)?`<${Number(c)+1}.0.0-0`:P(u)?`<${c}.${Number(l)+1}.0-0`:d?`<=${c}.${l}.${u}-${d}`:`<=${s}`,`${t} ${s}`.trim()))}function gt(e){return e.replace(N(et),`$1$2$3`)}function _t(e){return e.replace(N(nt),`$1~`)}function vt(e){return e.replace(N(it),`$1^`)}function yt(e){return e.trim().split(/\s+/).map(e=>e.replace(N(ot),(e,t,n,r,i)=>P(t)?``:P(n)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:P(r)?t===`0`?`>=${t}.${n}.0 <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.0 <${Number(t)+1}.0.0-0`:i?t===`0`?n===`0`?`>=${t}.${n}.${r}-${i} <${t}.${n}.${Number(r)+1}-0`:`>=${t}.${n}.${r}-${i} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r}-${i} <${Number(t)+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${r} <${t}.${n}.${Number(r)+1}-0`:`>=${t}.${n}.${r} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r} <${Number(t)+1}.0.0-0`)).join(` `)}function bt(e){return e.trim().split(/\s+/).map(e=>e.replace(N(ct),(e,t,n,r,i)=>P(t)?``:P(n)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:P(r)?`>=${t}.${n}.0 <${t}.${Number(n)+1}.0-0`:i?`>=${t}.${n}.${r}-${i} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${r} <${t}.${Number(n)+1}.0-0`)).join(` `)}function xt(e){return e.split(/\s+/).map(e=>e.trim().replace(N(lt),(e,t,n,r,i,a)=>{let o=P(n),s=o||P(r),c=s||P(i);return t===`=`&&c&&(t=``),a=``,o?t===`>`||t===`<`?`<0.0.0-0`:`*`:t&&c?(s&&(r=0),i=0,t===`>`?(t=`>=`,s?(n=Number(n)+1,r=0,i=0):(r=Number(r)+1,i=0)):t===`<=`&&(t=`<`,s?n=Number(n)+1:r=Number(r)+1),t===`<`&&(a=`-0`),`${t+n}.${r}.${i}${a}`):s?`>=${n}.0.0${a} <${Number(n)+1}.0.0-0`:c?`>=${n}.${r}.0${a} <${n}.${Number(r)+1}.0-0`:e})).join(` `)}function St(e){return e.trim().replace(N(at),``)}function Ct(e){return e.trim().replace(N(dt),``)}function F(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function wt(e,t){let{preRelease:n}=e,{preRelease:r}=t;if(n===void 0&&r)return 1;if(n&&r===void 0)return-1;if(n===void 0&&r===void 0)return 0;for(let e=0,t=n.length;e<=t;e++){let t=n[e],i=r[e];if(t!==i)return t===void 0&&i===void 0?0:t?i?F(t,i):-1:1}return 0}function Tt(e,t){return F(e.major,t.major)||F(e.minor,t.minor)||F(e.patch,t.patch)||wt(e,t)}function Et(e,t){return e.version===t.version}function Dt(e,t){switch(e.operator){case``:case`=`:return Et(e,t);case`>`:return Tt(e,t)<0;case`>=`:return Et(e,t)||Tt(e,t)<0;case`<`:return Tt(e,t)>0;case`<=`:return Et(e,t)||Tt(e,t)>0;case void 0:return!0;default:return!1}}function Ot(e){return ft(yt,bt,xt,St)(e)}function kt(e){return ft(ht,gt,_t,vt)(e.trim()).split(/\s+/).join(` `)}function I(e,t){if(!e)return!1;let n=pt(e);if(!n)return!1;let[,r,,i,a,o,s]=n,c={operator:r,version:mt(i,a,o,s),major:i,minor:a,patch:o,preRelease:s==null?void 0:s.split(`.`)},l=t.split(`||`);for(let e of l){let t=e.trim();if(!t||t===`*`||t===`x`)return!0;try{let e=kt(t);if(!e.trim())return!0;let n=e.split(` `).map(e=>Ot(e)).join(` `);if(!n.trim())return!0;let r=n.split(/\s+/).map(e=>Ct(e)).filter(Boolean);if(r.length===0)continue;let i=!0;for(let e of r){let t=pt(e);if(!t){i=!1;break}let[,n,,r,a,o,s]=t;if(!Dt({operator:n,version:mt(r,a,o,s),major:r,minor:a,patch:o,preRelease:s==null?void 0:s.split(`.`)},c)){i=!1;break}}if(i)return!0}catch(e){console.error(`[semver] Error processing range part "${t}":`,e);continue}}return!1}var At=`default`,jt=`global`;function Mt(e,t,n,r){var a,o;let s;return s=`get`in e?e.get:`lib`in e?()=>Promise.resolve(e.lib):()=>Promise.resolve(()=>{S(`Cannot get shared "${n}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),(a=e.shareConfig)!=null&&a.eager&&(o=e.treeShaking)!=null&&o.mode&&S(`Invalid shared config for "${n}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:s,loaded:e!=null&&e.loaded||`lib`in e?!0:void 0,version:e.version??`0`,scope:Array.isArray(e.scope)?e.scope:[e.scope??`default`],strategy:(e.strategy??r)||`version-first`,treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??`server-calc`,status:e.treeShaking.status??i.UNKNOWN,useIn:[]}:void 0}}function Nt(e,t){let n=t.shared||{},r=t.name,i=Object.keys(n).reduce((e,i)=>{let a=be(n[i]);return e[i]=e[i]||[],a.forEach(n=>{e[i].push(Mt(n,r,i,t.shareStrategy))}),e},{}),a={...e.shared};return Object.keys(i).forEach(e=>{a[e]?i[e].forEach(t=>{a[e].find(e=>e.version===t.version)||a[e].push(t)}):a[e]=i[e]}),{allShareInfos:a,newShareInfos:i}}function L(e,t){if(!e)return!1;let{status:n,mode:r}=e;return n===i.NO_USE?!1:n===i.CALCULATED?!0:r===`runtime-infer`?!t||It(e,t):!1}function R(e,t){let n=e=>{if(!Number.isNaN(Number(e))){let t=e.split(`.`),n=e;for(let e=0;e<3-t.length;e++)n+=`.0`;return n}return e};return!!I(n(e),`<=${n(t)}`)}var z=(e,t)=>{let n=t||function(e,t){return R(e,t)};return Object.keys(e).reduce((e,t)=>!e||n(e,t)||e===`0`?t:e,0)},Pt=e=>!!e.loaded||typeof e.lib==`function`,Ft=e=>!!e.loading,It=(e,t)=>{if(!e||!t)return!1;let{usedExports:n}=e;return n?!!t.every(e=>n.includes(e)):!1};function Lt(e,t,n,r){let i=e[t][n],a=``,o=L(r),s=function(e,t){return o?i[e].treeShaking?i[t].treeShaking?!Pt(i[e].treeShaking)&&R(e,t):!1:!0:!Pt(i[e])&&R(e,t)};if(o){if(a=z(e[t][n],s),a)return{version:a,useTreesShaking:o};o=!1}return{version:z(e[t][n],s),useTreesShaking:o}}var B=e=>Pt(e)||Ft(e);function Rt(e,t,n,r){let i=e[t][n],a=``,o=L(r),s=function(e,t){if(o){if(!i[e].treeShaking)return!0;if(!i[t].treeShaking)return!1;if(B(i[t].treeShaking))return!B(i[e].treeShaking)||!!R(e,t);if(B(i[e].treeShaking))return!1}return B(i[t])?!B(i[e])||!!R(e,t):!B(i[e])&&R(e,t)};if(o){if(a=z(e[t][n],s),a)return{version:a,useTreesShaking:o};o=!1}return{version:z(e[t][n],s),useTreesShaking:o}}function zt(e){return e===`loaded-first`?Rt:Lt}function V(e,t,n,r,i){if(!e)return;let{shareConfig:a,scope:o=At,strategy:s,treeShaking:c}=n,l=Array.isArray(o)?o:[o];for(let o of l)if(a&&e[o]&&e[o][t]){let{requiredVersion:l}=a,{version:u,useTreesShaking:d}=zt(s)(e,o,t,c),f={shareScopeMap:e,scope:o,pkgName:t,version:u,GlobalFederation:D.__FEDERATION__,shareInfo:n,resolver:()=>{let r=e[o][t][u];if(a.singleton){if(typeof l==`string`&&!I(u,l)){let e=`Version ${u} from ${u&&r.from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${l})`;a.strictVersion?S(e):C(e)}return{shared:r,useTreesShaking:d}}{if(l===!1||l===`*`||I(u,l))return{shared:r,useTreesShaking:d};let n=L(c);if(n){for(let[r,i]of Object.entries(e[o][t]))if(L(i.treeShaking,c==null?void 0:c.usedExports)&&I(r,l))return{shared:i,useTreesShaking:n}}for(let[n,r]of Object.entries(e[o][t]))if(I(n,l))return{shared:r,useTreesShaking:!1}}},loadContext:i};return(r.emit(f)||f).resolver()}}function Bt(){return D.__FEDERATION__.__SHARE__}function Vt(e){let{pkgName:t,extraOptions:n,shareInfos:r}=e,i=(n==null?void 0:n.resolver)??(e=>{if(!e)return;let t={};return e.forEach(e=>{t[e.version]=e}),t[z(t,function(e,n){return!Pt(t[e])&&R(e,n)})]}),a=e=>typeof e==`object`&&!!e&&!Array.isArray(e),o=(...e)=>{let t={};for(let n of e)if(n)for(let[e,r]of Object.entries(n)){let n=t[e];a(n)&&a(r)?t[e]=o(n,r):r!==void 0&&(t[e]=r)}return t};return o(i(r[t]),n==null?void 0:n.customShareInfo)}var H=(e,t)=>{e.useIn||=[],me(e.useIn,t)};function Ht(e,t){return t&&e.treeShaking?e.treeShaking:e}function Ut(e,t){return!t||t===`.`?e:`${e}/${t.replace(/^\.\//,``)}`}function Wt(e,t){for(let n of e){let e=t.startsWith(n.name),r=t.replace(n.name,``);if(e){if(r.startsWith(`/`)){let e=n.name;return r=`.${r}`,{pkgNameOrAlias:e,expose:r,remote:n}}if(r===``)return{pkgNameOrAlias:n.name,expose:`.`,remote:n}}let i=n.alias&&t.startsWith(n.alias),a=n.alias&&t.replace(n.alias,``);if(n.alias&&i){if(a&&a.startsWith(`/`)){let e=n.alias;return a=`.${a}`,{pkgNameOrAlias:e,expose:a,remote:n}}if(a===``)return{pkgNameOrAlias:n.alias,expose:`.`,remote:n}}}}function Gt(e,t){for(let n of e)if(t===n.name||n.alias&&t===n.alias)return n}var Kt=`RUNTIME-001`,qt=`RUNTIME-002`,Jt=`RUNTIME-003`,Yt=`RUNTIME-004`,Xt=`RUNTIME-005`,Zt=`RUNTIME-006`,Qt=`RUNTIME-007`,$t=`RUNTIME-008`,en=`RUNTIME-009`,tn=`RUNTIME-010`,nn=`RUNTIME-011`,rn=`RUNTIME-012`,an=`RUNTIME-013`,on=`RUNTIME-014`,sn=`RUNTIME-015`,cn=`TYPE-001`,ln=`BUILD-001`,un=`BUILD-002`,U={[Kt]:`Failed to get remoteEntry exports.`,[qt]:`The remote entry interface does not contain "init"`,[Jt]:`Failed to get manifest.`,[Yt]:`Failed to locate remote.`,[Xt]:`Invalid loadShareSync function call from bundler runtime`,[Zt]:`Invalid loadShareSync function call from runtime`,[Qt]:`Failed to get remote snapshot.`,[$t]:`Failed to load script resources.`,[en]:`Please call createInstance first.`,[tn]:`The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.`,[nn]:`The remoteEntry URL is missing from the remote snapshot.`,[rn]:`The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.`,[an]:`The manifest is not a valid Module Federation manifest.`,[on]:`The remote does not expose the requested module.`,[sn]:`Remote container initialization failed.`},dn={[cn]:`Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.`},fn={[ln]:`Failed to find expose module.`,[un]:`PublicPath is required in prod mode.`};({...U,...dn,...fn});var pn=`.then(callbacks[0]).catch(callbacks[1])`,mn=new WeakMap,hn=[`Failed to fetch dynamically imported module`,`Importing a module script failed`,`error loading dynamically imported module`];function gn(e){return e instanceof TypeError&&hn.some(t=>e.message.includes(t))}function _n(e){return e===`esm`||e===`module`}async function vn({entry:t,remoteEntryExports:n,name:r,getEntryUrl:i}){return new Promise((a,o)=>{let s=e=>{if(gn(e)){let t=e instanceof Error?e.message:String(e);try{S($t,U,{remoteName:r,resourceUrl:c},t)}catch(e){o(e);return}}o(e)},c=i?i(t):t;try{n?a(n):typeof FEDERATION_ALLOW_NEW_FUNCTION<`u`?Function(`callbacks`,`import("${c}")${pn}`)([a,s]):e(()=>import(c).then(a),[],import.meta.url).catch(s)}catch(e){S(`Failed to load ESM entry from "${c}". ${e instanceof Error?e.message:String(e)}`)}})}async function yn({entry:e,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof __system_context__>`u`?System.import(e).then(n).catch(r):Function(`callbacks`,`System.import("${e}")${pn}`)([n,r])}catch(t){S(`Failed to load SystemJS entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}})}function bn(e,t,n){let{remoteEntryKey:r,entryExports:i}=Fe(e,t);return i||S(Kt,U,{remoteName:e,remoteEntryUrl:n,remoteEntryKey:r}),i}async function xn({name:e,globalName:t,entry:n,remoteInfo:r,loaderHook:i,getEntryUrl:a,resourceContext:o}){let{entryExports:s}=Fe(e,t);if(s)return s;let c=a?a(n):n;return le(c,{attrs:{},createScriptHook:(e,t)=>{let n=i.lifecycle.createScript.emit({url:e,attrs:t,remoteInfo:r,resourceContext:o?{...o,url:e}:void 0});if(n&&(n instanceof HTMLScriptElement||`script`in n||`timeout`in n))return n}}).then(()=>bn(e,t,n),t=>{let n=t instanceof Error?t.message:String(t);S($t,U,{remoteName:e,resourceUrl:c},n)})}async function Sn({remoteInfo:e,remoteEntryExports:t,loaderHook:n,getEntryUrl:r,resourceContext:i}){let{entry:a,entryGlobalName:o,name:s,type:c}=e;return _n(c)?vn({entry:a,remoteEntryExports:t,name:s,getEntryUrl:r}):c===`system`?yn({entry:a,remoteEntryExports:t}):xn({entry:a,globalName:o,name:s,remoteInfo:e,loaderHook:n,getEntryUrl:r,resourceContext:i})}function Cn(e){let{entry:t,name:n}=e;return u(n,t)}async function wn(e){let{origin:t,remoteEntryExports:n,remoteInfo:r,getEntryUrl:i,resourceContext:a,_inErrorHandling:o=!1}=e,s=Cn(r);if(n)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:n,resourceContext:a,cached:!0}),n;if(!O[s]){let e=t.remoteHandler.hooks.lifecycle.loadEntry,c=t.loaderHook;O[s]=e.emit({origin:t,loaderHook:c,remoteInfo:r,remoteEntryExports:n,resourceContext:a}).then(e=>e||Sn({remoteInfo:r,remoteEntryExports:n,loaderHook:c,getEntryUrl:i,resourceContext:a})).then(async e=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:e,resourceContext:a}),e)).catch(async e=>{let i=e instanceof Error&&e.message.includes(`ScriptExecutionError`);if(e instanceof Error&&e.message.includes(`RUNTIME-008`)&&!i&&!o){let i=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:e=>wn({...e,_inErrorHandling:!0}),origin:t,remoteInfo:r,remoteEntryExports:n,globalLoading:O,uniqueKey:s});if(i)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:i,resourceContext:a,error:e,recovered:!0}),i}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,resourceContext:a,error:e}),e}),mn.set(O[s],t)}let c=O[s];if(mn.get(c)!==t)try{let e=await c;return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:e,resourceContext:a}),e}catch(e){throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,resourceContext:a,error:e}),e}return c}function W(e){return{...e,entry:`entry`in e?e.entry:``,type:e.type||`global`,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||`default`}}function Tn(){return typeof FEDERATION_BUILD_IDENTIFIER<`u`?FEDERATION_BUILD_IDENTIFIER:``}function En(e){let t=new Map;return[...e||[],...Le()].forEach(e=>{e&&(x(ye(e),`Plugin configuration is invalid.`),x(e.name,`A name must be provided by the plugin.`),t.has(e.name)||t.set(e.name,e))}),Array.from(t.values())}function Dn(e,t){return t===void 0?e:{...t,name:e.name,version:e.version}}function On(e,t){let n=new Map;t.options.plugins.forEach(e=>{e&&n.set(e.name,e)});let r=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return En(e).forEach(e=>{var i;if(n.set(e.name,e),t.hooks.registerPlugins[e.name])return;let a=Dn(e,(i=e.apply)==null?void 0:i.call(e,t));r.forEach(e=>{e.applyPlugin(a)})}),Array.from(n.values())}function kn(e){return{name:e.name,alias:e.alias,entry:`entry`in e?e.entry:void 0,version:`version`in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function G(e){var t,n;let r={};for(let[t,n]of Object.entries(e.shared)){var i,a,o,s;let e=n[0];e&&(r[t]={version:e.version,singleton:(i=e.shareConfig)==null?void 0:i.singleton,requiredVersion:((a=e.shareConfig)==null?void 0:a.requiredVersion)===!1?!1:(o=e.shareConfig)==null?void 0:o.requiredVersion,eager:e.eager,strictVersion:(s=e.shareConfig)==null?void 0:s.strictVersion})}return{project:{name:e.name,mfRole:((t=e.remotes)==null?void 0:t.length)>0?`host`:`unknown`},mfConfig:{name:e.name,remotes:((n=e.remotes)==null?void 0:n.map(kn))??[],shared:r}}}function An(e){return{resourceCategory:`sync`,share:!0,depsRemote:!0,recordPreloadedAssets:!0,...e}}function jn(e,t){return t.map(t=>{let n=Gt(e,t.nameOrAlias);return x(n,`Unable to preload ${t.nameOrAlias} as it is not included in ${!n&&p({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:An(t)}})}function Mn(e){return e?e.map(e=>e===`.`?e:e.startsWith(`./`)?e.replace(`./`,``):e):[]}function Nn(e){return e instanceof Error?e.message.includes(`timed out`)||e.name.includes(`Timeout`):!1}function K(e,t,n,r){return{url:t,status:n,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:r}}function Pn(e,t,n,r){return n?Be(t)?Promise.resolve(K(e,t,`cached`)):(Ve(t),r()):r()}async function Fn(e,t,n,r){let i=e.moduleCache.get(n.name),a=n.entry;if(i!=null&&i.remoteEntryExports)return K(r,a,`cached`);try{if(!await wn({origin:e,remoteInfo:n,remoteEntryExports:i==null?void 0:i.remoteEntryExports,resourceContext:{...r,url:a}}))throw Error(`Failed to load remoteEntry "${a}".`);return K(r,a,`success`)}catch(e){return K(r,a,Nn(e)?`timeout`:`error`,e)}}function In({host:e,remoteInfo:t,url:n,attrs:r,context:i,needDeleteLink:a}){return new Promise(o=>{let{link:s,needAttach:c}=ce({url:n,cb:()=>{o(K(i,n,c?`success`:`cached`))},onErrorCallback:e=>{o(K(i,n,Nn(e)?`timeout`:`error`,e))},attrs:r,createLinkHook:(n,r)=>{let a=e.loaderHook.lifecycle.createLink.emit({url:n,attrs:r,remoteInfo:t,resourceContext:{...i,url:n}});return a instanceof HTMLLinkElement,a},needDeleteLink:a});c&&document.head.appendChild(s)})}function Ln({host:e,remoteInfo:t,url:n,attrs:r,context:i}){return new Promise(a=>{let{script:o,needAttach:s}=se({url:n,cb:()=>{a(K(i,n,s?`success`:`cached`))},onErrorCallback:e=>{a(K(i,n,Nn(e)?`timeout`:`error`,e))},attrs:r,createScriptHook:(n,r)=>{let a=e.loaderHook.lifecycle.createScript.emit({url:n,attrs:r,remoteInfo:t,resourceContext:{...i,url:n}});return a instanceof HTMLScriptElement,a},needDeleteScript:!0});s&&document.head.appendChild(o)})}function Rn(e,t){return{...e,resourceType:t}}function zn(e,t,n,r=!0,i={initiator:`preloadRemote`,id:e.name},a=!0){let{cssAssets:o,jsAssetsWithoutEntry:s,entryAssets:c}=n,l=[];if(t.options.inBrowser){if(c.forEach(n=>{let{moduleInfo:r}=n;l.push(Fn(t,e,r,Rn(i,`remoteEntry`)))}),r){let n={rel:`preload`,as:`style`};o.forEach(r=>{let o=Rn(i,`css`);l.push(Pn(o,r,a,()=>In({host:t,remoteInfo:e,url:r,attrs:n,context:o})))})}else{let n={rel:`stylesheet`,type:`text/css`};o.forEach(r=>{let o=Rn(i,`css`);l.push(Pn(o,r,a,()=>In({host:t,remoteInfo:e,url:r,attrs:n,needDeleteLink:!1,context:o})))})}let n=Ln,u={fetchpriority:`high`,type:`text/javascript`};r?(n=In,u={rel:`preload`,as:`script`}):_n(e.type)&&(n=In,u={rel:`modulepreload`,fetchpriority:`high`}),s.forEach(r=>{let o=Rn(i,`js`);l.push(Pn(o,r,a,()=>n({host:t,remoteInfo:e,url:r,attrs:u,context:o})))})}return Promise.all(l)}var Bn={global:{Global:D,nativeGlobal:E,resetFederationGlobalInfo:De,setGlobalFederationInstance:Oe,getGlobalFederationConstructor:ke,setGlobalFederationConstructor:Ae,getInfoWithoutType:k,getGlobalSnapshot:je,getTargetSnapshotInfoByModuleInfo:Me,getGlobalSnapshotInfoByModuleInfo:A,setGlobalSnapshotInfoByModuleInfo:Ne,addGlobalSnapshot:Pe,getRemoteEntryExports:Fe,registerGlobalPlugins:Ie,getGlobalHostPlugins:Le,getPreloaded:Re,setPreloaded:ze},share:{getRegisteredShare:V,getGlobalShareScope:Bt},utils:{matchRemoteWithNameAndExpose:Wt,preloadAssets:zn,getRemoteInfo:W}};function Vn(e){if(!e||!(`modules`in e)||!Array.isArray(e.modules))return;let t=e.modules.map(e=>e.moduleName).filter(Boolean);return t.length?t.join(`,`):void 0}function Hn(e,t,n){let r=t,i=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];i.length||i.push(`default`),i.forEach(e=>{r[e]||(r[e]={})});let a={version:e.version||``,shareScopeKeys:Array.isArray(e.shareScope)?i:e.shareScope||`default`};return Object.defineProperty(a,"shareScopeMap",{value:r,enumerable:!1}),{remoteEntryInitOptions:a,shareScope:r[i[0]],initScope:n??[]}}var Un=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(e,t){let n=t||{initiator:`loadRemote`,id:Ut(this.remoteInfo.name,e),resourceType:`remoteEntry`,url:this.remoteInfo.entry,expose:e},r=await wn({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:n});return x(r,`remoteEntryExports is undefined \n ${p(this.remoteInfo)}`),this.remoteEntryExports=r,this.remoteEntryExports}async init(e,t,n,r,i){let a=await this.getEntry(r,i);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,cached:!0,origin:this.host}),a;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,cached:!0,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,error:n,cached:!0,origin:this.host}),n}return a}this.initing=!0,this.initPromise=(async()=>{await this.host.loaderHook.lifecycle.beforeInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,origin:this.host});let{remoteEntryInitOptions:r,shareScope:i,initScope:o}=Hn(this.remoteInfo,this.host.shareScopeMap,n),s=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:i,remoteEntryInitOptions:r,initScope:o,remoteInfo:this.remoteInfo,origin:this.host});(a==null?void 0:a.init)===void 0&&S(qt,U,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,G(this.host.options));try{await a.init(s.shareScope,s.initScope,s.remoteEntryInitOptions)}catch(e){S(sn,U,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${e}`,G(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...s,id:e,remoteSnapshot:t,remoteEntryExports:a}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:a,error:n,origin:this.host}),n}finally{this.initing=!1,this.initPromise=void 0}return a}async get(e,t,n,r){let{loadFactory:i=!0}=n||{loadFactory:!0},a=await this.init(e,r,void 0,t);this.lib=a,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:a,origin:this.host});let o;try{let n=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:t,moduleInfo:this.remoteInfo});o=typeof n==`function`?n:void 0,o||=await a.get(t),o||S(on,U,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:Vn(r)},void 0,G(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:a,moduleFactory:o,origin:this.host})}catch(n){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:a,error:n,origin:this.host}),n}let s=Se(this.remoteInfo.name,t),c=this.wraperFactory(o,s);if(!i)return c;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:i,origin:this.host});try{let n=await c();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:i,exposeModule:n,origin:this.host}),n}catch(n){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:i,error:n,origin:this.host}),n}}wraperFactory(e,t){function n(e,t){e&&typeof e==`object`&&Object.isExtensible(e)&&!Object.getOwnPropertyDescriptor(e,Symbol.for(`mf_module_id`))&&Object.defineProperty(e,Symbol.for(`mf_module_id`),{value:t,enumerable:!1})}return()=>{let r=e();return r instanceof Promise?r.then(e=>(n(e,t),e)):(n(r,t),r)}}},q=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e){x(ye(e),`Plugin configuration is invalid.`);let t=e.name;x(t,`A name must be provided by the plugin.`),this.registerPlugins[t]||(this.registerPlugins[t]=e,this.lifecycleKeys.forEach(t=>{let n=e[t];n&&this.lifecycle[t].on(n)}))}removePlugin(e){x(e,`A name is required.`);let t=this.registerPlugins[e];x(t,`The plugin "${e}" is not registered.`),this.lifecycleKeys.forEach(e=>{let n=t[e];n&&this.lifecycle[e].remove(n)}),delete this.registerPlugins[e]}},J=class{constructor(e){this.type=``,this.listeners=new Set,e&&(this.type=e)}on(e){typeof e==`function`&&this.listeners.add(e)}once(e){let t=this;this.on(function n(...r){return t.remove(n),e.apply(null,r)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(n=>{let r=n(...e);r!==void 0&&(t=r)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},Y=class extends J{emit(...e){let t,n=Array.from(this.listeners);if(n.length>0){let r=0,i=t=>t===!1?!1:r<n.length?Promise.resolve(n[r++].apply(null,e)).then(n=>n===void 0||e.length===1&&n===e[0]?i(t):i(n)):t;t=i()}return Promise.resolve(t)}};function Wn(e,t){if(!_e(t))return!1;if(e!==t){for(let n in e)if(!(n in t))return!1}return!0}var X=class extends J{constructor(e){super(),this.onerror=S,this.type=e}emit(e){_e(e)||S(`The data for the "${this.type}" hook should be an object.`);for(let t of this.listeners)try{let n=t(e);if(n===void 0)continue;if(Wn(e,n))e=n;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(e){C(e),this.onerror(e)}return e}},Z=class extends J{constructor(e){super(),this.onerror=S,this.type=e}emit(e){_e(e)||S(`The response data for the "${this.type}" hook must be an object.`);let t=Array.from(this.listeners);if(t.length>0){let n=0,r=t=>(C(t),this.onerror(t),e),i=a=>{if(a!==void 0&&Wn(e,a))e=a;else if(a!==void 0)return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`),e;if(n<t.length)try{return Promise.resolve(t[n++](e)).then(i,r)}catch(e){return r(e)}return e};return Promise.resolve(i(e))}return Promise.resolve(e)}},Q=`Remote loading is disabled by experiments.optimization.disableRemote.`,Gn=class{constructor(){this.hooks=new q({})}formatAndRegisterRemote(){return[]}loadRemote(){throw Error(Q)}preloadRemote(){throw Error(Q)}registerRemotes(){throw Error(Q)}getRemoteModuleAndOptions(){throw Error(Q)}initRawContainer(){throw Error(Q)}};function Kn(e,t){let n=xe(t);n.url||S(nn,U,{remoteName:e.name});let r=d(t,n.url);e.type=n.type,e.entryGlobalName=n.globalName,e.entry=r,e.version=t.version,e.buildVersion=t.buildVersion}function qn(){return{name:`snapshot-plugin`,async afterResolve(e){let{remote:t,pkgNameOrAlias:n,expose:r,origin:i,remoteInfo:a,id:o}=e;if(!he(t)||!ge(t)){let{remoteSnapshot:s,globalSnapshot:c}=await i.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:Ut(t.name,r)});Kn(a,s);let l=[{nameOrAlias:n,exposes:[r],resourceCategory:`sync`,share:!1,depsRemote:!1,recordPreloadedAssets:!0}];await i.remoteHandler.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:l,options:i.options,origin:i});let[u]=l;if(u){let e={remote:t,preloadConfig:u},n=await i.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:i,preloadOptions:e,remoteInfo:a,remote:t,remoteSnapshot:s,globalSnapshot:c});n&&zn(a,i,n,!1,{initiator:`loadRemote`,id:o},u.recordPreloadedAssets).catch(()=>void 0)}return{...e,remoteSnapshot:s}}return e}}}function Jn(e){let t=e.split(`:`);return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function Yn(e,t,n,r,i={},a){let{value:o}=k(e,w(t)),s=a||o;if(s&&!_(s)&&(n(s,t,r),s.remotesInfo)){let t=Object.keys(s.remotesInfo);for(let r of t){if(i[r])continue;i[r]=!0;let t=Jn(r),a=s.remotesInfo[r];Yn(e,{name:t.name,version:a.matchedVersion},n,!1,i,void 0)}}}var Xn=(e,t)=>document.querySelector(`${e}[${e===`link`?`href`:`src`}="${t}"]`);function Zn(e,t,n,r,i){let a=[],o=[],s=[],c=new Set,l=new Set,{options:u}=e,{preloadConfig:f}=t,{depsRemote:p}=f;if(Yn(r,n,(t,n,r)=>{var i;let c;if(r)c=f;else if(Array.isArray(p)){let e=p.find(e=>e.nameOrAlias===n.name||e.nameOrAlias===n.alias);if(!e)return;c=An(e)}else if(p===!0)c=f;else return;let l=d(t,xe(t).url);l&&s.push({name:n.name,moduleInfo:{name:n.name,entry:l,type:`remoteEntryType`in t?t.remoteEntryType:`global`,entryGlobalName:`globalName`in t?t.globalName:n.name,shareScope:``,version:`version`in t?t.version:void 0},url:l});let u=`modules`in t?t.modules:[],m=Mn(c.exposes);m.length&&`modules`in t&&(u=t==null||(i=t.modules)==null?void 0:i.reduce((e,t)=>((m==null?void 0:m.indexOf(t.moduleName))!==-1&&e.push(t),e),[]));function h(e){let n=e.map(e=>d(t,e));return c.filter?n.filter(c.filter):n}if(u){let r=u.length;for(let i=0;i<r;i++){let r=u[i],s=`${n.name}/${r.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:r.moduleName===`.`?n.name:s,name:n.name,remoteSnapshot:t,preloadConfig:c,remote:n,origin:e}),!Re(s)&&(c.resourceCategory===`all`?(a.push(...h(r.assets.css.async)),a.push(...h(r.assets.css.sync)),o.push(...h(r.assets.js.async)),o.push(...h(r.assets.js.sync))):c.resourceCategory===`sync`&&(a.push(...h(r.assets.css.sync)),o.push(...h(r.assets.js.sync))),ze(s))}}},!0,{},i),i.shared&&i.shared.length>0){let t=(t,n)=>{let{shared:r}=V(e.shareScopeMap,n.sharedName,t,e.sharedHandler.hooks.lifecycle.resolveShare)||{};r&&typeof r.lib==`function`&&(n.assets.js.sync.forEach(e=>{c.add(e)}),n.assets.css.sync.forEach(e=>{l.add(e)}))};i.shared.forEach(e=>{var n;let r=(n=u.shared)==null?void 0:n[e.sharedName];if(!r)return;let i=e.version?r.find(t=>t.version===e.version):r;i&&be(i).forEach(n=>{t(n,e)})})}let m=o.filter(e=>!c.has(e)&&!Xn(`script`,e));return{cssAssets:a.filter(e=>!l.has(e)&&!Xn(`link`,e)),jsAssetsWithoutEntry:m,entryAssets:s.filter(e=>!Xn(`script`,e.url))}}var Qn=function(){return{name:`generate-preload-assets-plugin`,async generatePreloadAssets(e){let{origin:t,preloadOptions:n,remoteInfo:r,remote:i,globalSnapshot:a,remoteSnapshot:o}=e;return he(i)&&ge(i)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:i.name,url:i.entry,moduleInfo:{name:r.name,entry:i.entry,type:r.type||`global`,entryGlobalName:``,shareScope:``}}]}:(Kn(r,o),Zn(t,n,r,a,o))}}};function $n(e,t){let n=A({name:t.name,version:t.options.version}),r=n&&`remotesInfo`in n&&n.remotesInfo&&k(n.remotesInfo,e.name).value;return r&&r.matchedVersion?{hostGlobalSnapshot:n,globalSnapshot:je(),remoteSnapshot:A({name:e.name,version:r.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:je(),remoteSnapshot:A({name:e.name,version:`version`in e?e.version:void 0})}}var er=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new q({beforeLoadRemoteSnapshot:new Y(`beforeLoadRemoteSnapshot`),loadSnapshot:new Z(`loadGlobalSnapshot`),loadRemoteSnapshot:new Z(`loadRemoteSnapshot`),afterLoadSnapshot:new Z(`afterLoadSnapshot`),beforeLoadManifest:new Y(`beforeLoadManifest`),afterLoadManifest:new Y(`afterLoadManifest`)}),this.manifestLoading=D.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:n=`loadRemote`}){let{options:r}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:r,moduleInfo:e,origin:this.HostInstance});let i=A({name:this.HostInstance.options.name,version:this.HostInstance.options.version});i||(i={version:this.HostInstance.options.version||``,remoteEntry:``,remotesInfo:{}},Pe({[this.HostInstance.options.name]:i})),i&&`remotesInfo`in i&&!k(i.remotesInfo,e.name).value&&(`version`in e||`entry`in e)&&(i.remotesInfo={...i==null?void 0:i.remotesInfo,[e.name]:{matchedVersion:`version`in e?e.version:e.entry}});let{hostGlobalSnapshot:a,remoteSnapshot:o,globalSnapshot:s}=this.getGlobalRemoteInfo(e),{remoteSnapshot:c,globalSnapshot:l}=await this.hooks.lifecycle.loadSnapshot.emit({options:r,moduleInfo:e,hostGlobalSnapshot:a,remoteSnapshot:o,globalSnapshot:s}),u,d;if(c){if(_(c)){let r=c.remoteEntry,i=await this.loadManifestSnapshot(r,e,{},{initiator:n,id:t||e.name}),a=Ne({...e,entry:r},i);u=i,d=a}else{let{remoteSnapshot:t}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:c,from:`global`});u=t,d=l}}else if(he(e)){let r=await this.loadManifestSnapshot(e.entry,e,{},{initiator:n,id:t||e.name}),i=Ne(e,r);u=r,d=i}else S(Qt,U,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(l)},void 0,G(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:r,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:d}}getGlobalRemoteInfo(e){return $n(e,this.HostInstance)}async getManifestJson(e,t,n,r){return(async()=>{let n=W(t),i=this.manifestCache.get(e);if(i)return await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:r,manifestJson:i,cached:!0,origin:this.HostInstance}),i;await this.hooks.lifecycle.beforeLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:r,origin:this.HostInstance});let a,o,s=!1;try{let t=await this.loaderHook.lifecycle.fetch.emit(e,{},n,r?{...r,url:e,resourceType:`manifest`}:void 0);(!t||!(t instanceof Response))&&(t=await fetch(e,{})),a=t,i=await t.json()}catch(c){o=c,i=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:c,from:`runtime`,lifecycle:`afterResolve`,remote:n,origin:this.HostInstance}),i||(delete this.manifestLoading[e],await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:r,response:a,error:c,origin:this.HostInstance}),S(Jt,U,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${c}`,G(this.HostInstance.options))),s=!0}let c=[!i.metaData&&`metaData`,!i.exposes&&`exposes`,!i.shared&&`shared`].filter(Boolean),l=c.length>0?Error(`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${c.join(`, `)}.`):void 0;return l&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:l,from:`runtime`,lifecycle:`afterResolve`,remote:n,origin:this.HostInstance}),await this.hooks.lifecycle.afterLoadManifest.emit({manifestUrl:e,moduleInfo:t,resourceOptions:r,manifestJson:i,response:a,error:l||o,recovered:l?void 0:s||void 0,origin:this.HostInstance}),l&&S(an,U,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:c.join(`,`)},void 0,G(this.HostInstance.options)),this.manifestCache.set(e,i),i})()}async loadManifestSnapshot(e,t,n,r){let i=async()=>{let i=await this.getManifestJson(e,t,n,r),a=g(i,{version:e}),{remoteSnapshot:o}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:i,remoteSnapshot:a,manifestUrl:e,from:`manifest`});return o};return this.manifestLoading[e]||(this.manifestLoading[e]=i().then(e=>e)),this.manifestLoading[e]}},tr=class{constructor(){this.hooks=new q({})}},nr=class{constructor(e){this.hooks=new q({beforeRegisterShare:new X(`beforeRegisterShare`),afterRegisterShare:new J(`afterRegisterShare`),afterResolve:new Z(`afterResolve`),beforeLoadShare:new Z(`beforeLoadShare`),loadShare:new Y,afterLoadShare:new J(`afterLoadShare`),errorLoadShare:new J(`errorLoadShare`),resolveShare:new X(`resolveShare`),initContainerShareScopeMap:new X(`initContainerShareScopeMap`)}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}emitAfterRegisterShare(e,t){this.hooks.lifecycle.afterRegisterShare.emit({pkgName:e,...t,shareScopeMap:this.shareScopeMap,origin:this.host})}emitAfterLoadShare({lifecycle:e,pkgName:t,shareInfo:n,selectedShared:r,loadContext:i}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:n,selectedShared:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,loadContext:i,origin:this.host})}catch(e){C(e)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:n,error:r,recovered:i,loadContext:a}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:n,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:r,recovered:i,loadContext:a})}catch(e){C(e)}}registerShared(e,t){let{newShareInfos:n,allShareInfos:r}=Nt(e,t);return Object.keys(n).forEach(e=>{n[e].forEach(n=>{n.scope.forEach(r=>{var i,a;this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:e,shared:n});let o=(i=this.shareScopeMap[r])==null?void 0:i[e],s=o==null?void 0:o[n.version];o||this.setShared({pkgName:e,lib:n.lib,get:n.get,loaded:n.loaded||!!n.lib,shared:n,from:t.name}),this.emitAfterRegisterShare(e,{scope:r,shared:n,previousShared:s,registeredShared:(a=this.shareScopeMap[r])==null||(a=a[e])==null?void 0:a[n.version],trigger:`runtime`})})})}),{newShareInfos:n,allShareInfos:r}}async loadShare(e,t){let{host:n}=this,r=t==null?void 0:t.context,i=Vt({pkgName:e,extraOptions:t,shareInfos:n.options.shared}),a=i;try{i!=null&&i.scope&&await Promise.all(i.scope.map(async e=>{await Promise.all(this.initializeSharing(e,{strategy:i.strategy,context:r}))}));let o=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:i,shared:n.options.shared,origin:n,loadContext:r});a=o.shareInfo,r=o.loadContext||r,x(a,`Cannot find shared "${e}" in host "${n.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);let s=a,{shared:c,useTreesShaking:l}=V(this.shareScopeMap,e,a,this.hooks.lifecycle.resolveShare,r)||{};if(c){let t=Ht(c,l);if(t.lib)return H(t,n.options.name),this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,selectedShared:c,loadContext:r}),t.lib;if(t.loading&&!t.loaded){let i=await t.loading;return t.loaded=!0,t.lib||=i,H(t,n.options.name),this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,selectedShared:c,loadContext:r}),i}{let i=(async()=>{let e=await t.get();return H(t,n.options.name),t.loaded=!0,t.lib=e,e})();this.setShared({pkgName:e,loaded:!1,shared:c,from:n.options.name,lib:null,loading:i,treeShaking:l?t:void 0});let a=await i;return this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,selectedShared:c,loadContext:r}),a}}{if(t!=null&&t.customShareInfo)return this.emitErrorLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,recovered:!0,loadContext:r}),!1;let i=L(s.treeShaking),a=Ht(s,i),o=(async()=>{let t=await a.get();a.lib=t,a.loaded=!0,H(a,n.options.name);let{shared:i,useTreesShaking:o}=V(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare,r)||{};if(i){let e=Ht(i,o);e.lib=t,e.loaded=!0,i.from=s.from}return t})();this.setShared({pkgName:e,loaded:!1,shared:s,from:n.options.name,lib:null,loading:o,treeShaking:i?a:void 0});let c=await o;return this.emitAfterLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:s,selectedShared:s,loadContext:r}),c}}catch(t){throw this.emitErrorLoadShare({lifecycle:`loadShare`,pkgName:e,shareInfo:a,error:t,loadContext:r}),t}}initializeSharing(e=At,t){var n;let{host:r}=this,i=t==null?void 0:t.from,a=t==null?void 0:t.strategy,o=(t==null||(n=t.context)==null?void 0:n.trigger)||i||`runtime`,s=t==null?void 0:t.initScope,c=[];if(i!==`build`){let{initTokens:t}=this;s||=[];let n=t[e];if(n||=t[e]={from:this.host.name},s.indexOf(n)>=0)return c;s.push(n)}let l=this.shareScopeMap,u=r.options.name;l[e]||(l[e]={});let d=l[e],f=(t,n)=>{var r;let{version:i,eager:a}=n;d[t]=d[t]||{};let s=d[t],c=s[i],l=c&&Ht(c),f=!!(l&&(`eager`in l&&l.eager||`shareConfig`in l&&(r=l.shareConfig)!=null&&r.eager));(!l||l.strategy!==`loaded-first`&&!l.loaded&&(!a==!f?u>s[i].from:a))&&(s[i]=n),this.emitAfterRegisterShare(t,{scope:e,shared:n,previousShared:c,registeredShared:s[i],trigger:o})},p=async e=>{let{module:t}=await r.remoteHandler.getRemoteModuleAndOptions({id:e}),n,i={initiator:`loadShare`,id:e,resourceType:`remoteEntry`,url:t.remoteInfo.entry};try{n=await t.getEntry(void 0,i)}catch(i){if(n=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:`runtime`,lifecycle:`beforeLoadShare`,remote:t.remoteInfo,origin:r}),!n)return}finally{n!=null&&n.init&&!t.initing&&(t.remoteEntryExports=n,await t.init(void 0,void 0,s,void 0,i))}};return Object.keys(r.options.shared).forEach(t=>{r.options.shared[t].forEach(n=>{n.scope.includes(e)&&f(t,n)})}),(r.options.shareStrategy===`version-first`||a===`version-first`)&&r.options.remotes.forEach(t=>{t.shareScope===e&&c.push(p(t.name))}),c}loadShareSync(e,t){let{host:n}=this,r=t==null?void 0:t.context,i=Vt({pkgName:e,extraOptions:t,shareInfos:n.options.shared});try{i!=null&&i.scope&&i.scope.forEach(e=>{this.initializeSharing(e,{strategy:i.strategy,from:t==null?void 0:t.from,context:r})});let{shared:a}=V(this.shareScopeMap,e,i,this.hooks.lifecycle.resolveShare,r)||{};if(a){if(typeof a.lib==`function`)return H(a,n.options.name),a.loaded||(a.loaded=!0,a.from===n.options.name&&(i.loaded=!0)),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,selectedShared:a,loadContext:r}),a.lib;if(typeof a.get==`function`){let t=a.get();if(!(t instanceof Promise))return H(a,n.options.name),this.setShared({pkgName:e,loaded:!0,from:n.options.name,lib:t,shared:a}),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,selectedShared:a,loadContext:r}),t}}if(i.lib)return i.loaded||=!0,this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,selectedShared:i,loadContext:r}),i.lib;if(i.get){let a=i.get();return a instanceof Promise&&S((t==null?void 0:t.from)===`build`?Xt:Zt,U,{hostName:n.options.name,sharedPkgName:e},void 0,G(n.options)),i.lib=a,this.setShared({pkgName:e,loaded:!0,from:n.options.name,lib:i.lib,shared:i}),this.emitAfterLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,selectedShared:i,loadContext:r}),i.lib}S(Zt,U,{hostName:n.options.name,sharedPkgName:e},void 0,G(n.options))}catch(t){throw this.emitErrorLoadShare({lifecycle:`loadShareSync`,pkgName:e,shareInfo:i,error:t,loadContext:r}),t}}initShareScopeMap(e,t,n={}){let{host:r}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:r.options,origin:r,scopeName:e,hostShareScopeMap:n.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:n,lib:r,loading:i,loaded:a,get:o,treeShaking:s}){let{version:c,scope:l=`default`,...u}=t,d=Array.isArray(l)?l:[l],f=e=>{let t=(e,t,n)=>{n&&!e[t]&&(e[t]=n)},n=s?e.treeShaking:e;t(n,`loaded`,a),t(n,`loading`,i),t(n,`get`,o),t(n,`lib`,r)};d.forEach(t=>{this.shareScopeMap[t]||(this.shareScopeMap[t]={}),this.shareScopeMap[t][e]||(this.shareScopeMap[t][e]={}),this.shareScopeMap[t][e][c]||(this.shareScopeMap[t][e][c]={version:c,scope:[t],...u,lib:r});let i=this.shareScopeMap[t][e][c];f(i),n&&i.from!==n&&(i.from=n)})}_setGlobalShareScopeMap(e){let t=Bt(),n=e.id||e.name;n&&!t[n]&&(t[n]=this.shareScopeMap)}},rr=class{constructor(){this.shareScopeMap={},this.hooks=new q({afterResolve:new Z(`afterResolve`)})}registerShared(){return{newShareInfos:{},allShareInfos:{}}}loadShare(){throw Error(`Shared dependency loading is disabled by experiments.optimization.disableShared.`)}loadShareSync(){throw Error(`Shared dependency loading is disabled by experiments.optimization.disableShared.`)}initializeSharing(){return[]}initShareScopeMap(e,t){this.shareScopeMap[e]=t}},ir=class{constructor(e){this.hooks=new q({beforeRegisterRemote:new X(`beforeRegisterRemote`),registerRemote:new X(`registerRemote`),beforeRequest:new Z(`beforeRequest`),afterMatchRemote:new Y(`afterMatchRemote`),onLoad:new Y(`onLoad`),afterLoadRemote:new Y(`afterLoadRemote`),handlePreloadModule:new J(`handlePreloadModule`),errorLoadRemote:new Y(`errorLoadRemote`),beforePreloadRemote:new Y(`beforePreloadRemote`),generatePreloadAssets:new Y(`generatePreloadAssets`),afterPreloadRemote:new Y(`afterPreloadRemote`),loadEntry:new Y}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((e,t)=>(this.registerRemote(t,e,{force:!1}),e),e.remotes)}setIdToRemoteMap(e,t){let{remote:n,expose:r}=t,{name:i,alias:a}=n;if(this.idToRemoteMap[e]={name:n.name,expose:r},a&&e.startsWith(i)){let t=e.replace(i,a);this.idToRemoteMap[t]={name:n.name,expose:r};return}if(a&&e.startsWith(a)){let t=e.replace(a,i);this.idToRemoteMap[t]={name:n.name,expose:r}}}async loadRemote(e,t){let{host:n}=this,r=Wt(n.options.remotes,e),i=e,a=r==null?void 0:r.expose,o=r?W(r.remote):void 0,s;try{let{loadFactory:r=!0}=t||{loadFactory:!0},{module:c,moduleOptions:l,remoteMatchInfo:u}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:d,remote:f,expose:p,id:m,remoteSnapshot:h}=u;i=m,a=p,o=W(f);let g=await c.get(m,p,t,h),_=await this.hooks.lifecycle.onLoad.emit({id:m,pkgNameOrAlias:d,expose:p,exposeModule:r?g:void 0,exposeModuleFactory:r?void 0:g,remote:f,options:l,moduleInstance:c,origin:n});return this.setIdToRemoteMap(e,u),s={id:i,expose:a,remote:o,options:t,origin:n},typeof _==`function`?_:g}catch(r){let{from:c=`runtime`}=t||{from:`runtime`},l;try{l=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:r,from:c,lifecycle:`onLoad`,expose:a,remote:o,origin:n})}catch(e){throw s={id:i,expose:a,remote:o,options:t,error:e,origin:n},e}if(!l)throw s={id:i,expose:a,remote:o,options:t,error:r,origin:n},r;return s={id:i,expose:a,remote:o,options:t,error:r,origin:n,recovered:!0},l}finally{s&&await this.hooks.lifecycle.afterLoadRemote.emit(s)}}async preloadRemote(e){let{host:t}=this,n=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});let r=jn(t.options.remotes,e),i=e=>{let{preloadConfig:t,remote:n}=e,r=t.exposes||[];return r.length?r.map(r=>({ops:{...e,preloadConfig:{...t,exposes:[r]}},id:Ut(n.name,r)})):[{ops:e,id:`${n.name}/*`}]},a;await Promise.all(r.flatMap(i).map(async e=>{let{ops:r,id:i}=e,{remote:a,preloadConfig:o}=r,s=W(a);try{let{globalSnapshot:e,remoteSnapshot:c}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:a,id:i,initiator:`preloadRemote`}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:r,remote:a,remoteInfo:s,globalSnapshot:e,remoteSnapshot:c});if(!l)return;let u=await zn(s,t,l,!0,{initiator:`preloadRemote`,id:i},o.recordPreloadedAssets);n.push({remote:a,remoteInfo:s,preloadConfig:o,id:i,results:u})}catch(e){n.push({remote:a,remoteInfo:s,preloadConfig:o,id:i,results:[{url:s.entry,status:`error`,resourceType:/\.json(?:$|[?#])/i.test(s.entry)?`manifest`:`remoteEntry`,initiator:`preloadRemote`,id:i,error:e}]})}}));let o=n.flatMap(e=>e.results.filter(e=>e.status===`error`||e.status===`timeout`));if(o.length>0&&(a=Error(`preloadRemote failed to load ${o.length} resource(s).`),Object.assign(a,{results:n,failedResults:o})),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:t.options,origin:t,results:n,error:a}),a)throw a}registerRemotes(e,t){let{host:n}=this;e.forEach(e=>{this.registerRemote(e,n.options.remotes,{force:t==null?void 0:t.force})})}initRawContainer(e,t,n){let{host:r}=this,i=new Un({host:r,remoteInfo:W({name:e,entry:t})});return i.remoteEntryExports=n,r.moduleCache.set(e,i),i}async getRemoteModuleAndOptions(e){let{host:t}=this,{id:n}=e,r;try{r=await this.hooks.lifecycle.beforeRequest.emit({id:n,options:t.options,origin:t})}catch(e){if(r=await this.hooks.lifecycle.errorLoadRemote.emit({id:n,options:t.options,origin:t,from:`runtime`,error:e,lifecycle:`beforeRequest`}),!r)throw e}let{id:i}=r,a=Wt(t.options.remotes,i);if(!a)try{S(Yt,U,{hostName:t.options.name,requestId:i},void 0,G(t.options))}catch(e){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:i,options:t.options,error:e,origin:t}),e}let{remote:o}=a,s=W(o);await this.hooks.lifecycle.afterMatchRemote.emit({id:i,...a,options:t.options,remoteInfo:s,origin:t});let c=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:i,...a,options:t.options,origin:t,remoteInfo:s}),{remote:l,expose:u}=c;x(l&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);let d=t.moduleCache.get(l.name),f={host:t,remoteInfo:s};return d||(d=new Un(f),t.moduleCache.set(l.name,d)),{module:d,moduleOptions:f,remoteMatchInfo:c}}registerRemote(e,t,n){let{host:r}=this,i=()=>{if(e.alias){let n=t.find(t=>{var n;return e.alias&&(t.name.startsWith(e.alias)||((n=t.alias)==null?void 0:n.startsWith(e.alias)))});x(!n,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${n&&n.name} name or alias`)}`entry`in e&&typeof window<`u`&&!e.entry.startsWith(`http`)&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||=At,e.type||=jt};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:r});let a=t.find(t=>t.name===e.name);if(!a)i(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:r});else{let o=[`The remote "${e.name}" is already registered.`,`Please note that overriding it may cause unexpected errors.`];n!=null&&n.force&&(this.removeRemote(a),i(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:r}),f(o.join(` `)))}}removeRemote(e){try{let{host:n}=this,{name:r}=e,i=n.options.remotes.findIndex(e=>e.name===r);i!==-1&&n.options.remotes.splice(i,1);let a=k(T.__FEDERATION__.moduleInfo,w(e)).key;delete T.__FEDERATION__.moduleInfo[a],`entry`in e&&(n.snapshotHandler.manifestCache.delete(e.entry),delete D.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);let{hostGlobalSnapshot:o}=$n(e,n);if(o){let t=o&&`remotesInfo`in o&&o.remotesInfo&&k(o.remotesInfo,e.name).key;t&&delete o.remotesInfo[t]}let s=n.moduleCache.get(e.name);if(s){var t;let r=s.remoteInfo,i=r.entryGlobalName;T[i]&&((t=Object.getOwnPropertyDescriptor(T,i))!=null&&t.configurable?delete T[i]:T[i]=void 0);let a=Cn(s.remoteInfo);O[a]&&delete O[a];let o=r.buildVersion?u(r.name,r.buildVersion):r.name,c=T.__FEDERATION__.__INSTANCES__.findIndex(e=>r.buildVersion?e.options.id===o:e.name===o);if(c!==-1){let e=T.__FEDERATION__.__INSTANCES__[c];o=e.options.id||o;let t=Bt(),n=!0,i=[];Object.keys(t).forEach(e=>{let a=t[e];a&&Object.keys(a).forEach(t=>{let o=a[t];o&&Object.keys(o).forEach(a=>{let s=o[a];s&&Object.keys(s).forEach(o=>{let c=s[o];c&&typeof c==`object`&&c.from===r.name&&(c.loaded||c.loading?(c.useIn=c.useIn.filter(e=>e!==r.name),c.useIn.length?n=!1:i.push([e,t,a,o])):i.push([e,t,a,o]))})})})}),n&&(e.shareScopeMap={},delete t[o]),i.forEach(([e,n,r,i])=>{var a;(a=t[e])==null||(a=a[n])==null||(a=a[r])==null||delete a[i]}),T.__FEDERATION__.__INSTANCES__.splice(c,1)}n.moduleCache.delete(e.name)}}catch(e){pe.error(`removeRemote failed: ${e instanceof Error?e.message:String(e)}`)}}},ar=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN!=`boolean`||!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN,or=typeof FEDERATION_OPTIMIZE_NO_REMOTE!=`boolean`||!FEDERATION_OPTIMIZE_NO_REMOTE,sr=typeof FEDERATION_OPTIMIZE_NO_SHARED!=`boolean`||!FEDERATION_OPTIMIZE_NO_SHARED,cr=class{constructor(e){this.hooks=new q({beforeInit:new X(`beforeInit`),init:new J,beforeInitContainer:new Z(`beforeInitContainer`),initContainer:new Z(`initContainer`)}),this.version=`2.9.0`,this.moduleCache=new Map,this.loaderHook=new q({getModuleInfo:new J,createScript:new J,createLink:new J,fetch:new Y,loadEntryError:new Y,afterLoadEntry:new Y(`afterLoadEntry`),beforeInitRemote:new Y(`beforeInitRemote`),afterInitRemote:new Y(`afterInitRemote`),beforeGetExpose:new Y(`beforeGetExpose`),afterGetExpose:new Y(`afterGetExpose`),beforeExecuteFactory:new Y(`beforeExecuteFactory`),afterExecuteFactory:new Y(`afterExecuteFactory`),getModuleFactory:new Y}),this.bridgeHook=new q({beforeBridgeRender:new J,afterBridgeRender:new J,beforeBridgeDestroy:new J,afterBridgeDestroy:new J,afterBridgeRouteSync:new J});let t=or&&ar?[qn(),Qn()]:[],n={id:Tn(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:!0};this.name=e.name,this.options=n,this.snapshotHandler=or?new er(this):new tr,this.sharedHandler=sr?new nr(this):new rr,this.remoteHandler=or?new ir(this):new Gn,this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...n.plugins,...e.plugins||[]]),this.options=this.formatOptions(n,e)}initOptions(e){e.name&&e.name!==this.options.name&&S(de(tn,U)),this.registerPlugins(e.plugins);let t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=At,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,n){return this.remoteHandler.initRawContainer(e,t,n)}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,n={}){this.sharedHandler.initShareScopeMap(e,t,n)}formatOptions(e,t){let n=sr?Nt(e,t).allShareInfos:{},{userOptions:r,options:i}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:n}),a=this.remoteHandler.formatAndRegisterRemote(i,r),{allShareInfos:o}=this.sharedHandler.registerShared(i,r),s=[...i.plugins];r.plugins&&r.plugins.forEach(e=>{s.includes(e)||s.push(e)});let c={...e,...t,plugins:s,remotes:a,shared:o,id:r.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:c}),c}registerPlugins(e){this.options.plugins=On(e,this)}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}},lr=Bn;function ur(){return typeof FEDERATION_BUILD_IDENTIFIER<`u`?FEDERATION_BUILD_IDENTIFIER:``}function dr(e,t){let n=ur();return T.__FEDERATION__.__INSTANCES__.find(r=>!!(n&&r.options.id===n||r.options.name===e&&!r.options.version&&!t||r.options.name===e&&t&&r.options.version===t))}function fr(e){let t=new((ke())||cr)({id:`${e.name}@${e.version||Date.now()}`,...e});return Oe(t),t}var $=null;function pr(e){let t=dr(e.name,e.version),n={...e,id:e.id||``};return t?(t.initOptions(n),$||=t,t):($=fr(n),$)}function mr(...e){return x($,en,U),$.loadRemote.apply($,e)}function hr(...e){return x($,en,U),$.registerRemotes.apply($,e)}Ae(cr);export{lr as a,dr as i,mr as n,hr as r,pr as t};
@@ -0,0 +1 @@
1
+ import{Hn as e}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-Drq9CkPs.js";import{n as t,u as n}from"./blockly-Fp-1_Ye3.js";var r=class extends t{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(){n.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};
@@ -0,0 +1 @@
1
+ import{Hn as e}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-Drq9CkPs.js";import{n as t,u as n}from"./blockly-Fp-1_Ye3.js";var r=`http://www.w3.org/2000/svg`,i=`http://www.w3.org/1999/xlink`,a=16,o=class o extends t{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,n.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,n){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})`),n&&s.length>n&&(s=`${s.substring(0,n-2)}…`),s=s.replace(/\s/g,t.NBSP),s||t.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 n;if(e===null)return;let r=o._objects();r&&!r[e]&&typeof((n=window.main)==null?void 0:n.getObject)==`function`?(this._idName=e||t.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 n=this._idName;return this._showValue&&this._stateValueText&&(n=`${n||``} = ${this._stateValueText}`),n?(n.length>this.maxDisplayLength&&(n=`${n.substring(0,this.maxDisplayLength-2)}…`),n=n.replace(/\s/g,t.NBSP),(e=this.getSourceBlock())!=null&&e.RTL&&(n+=`‏`),n):t.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};
@@ -0,0 +1 @@
1
+ import{Hn as e}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-Drq9CkPs.js";import{n as t,u as n}from"./blockly-Fp-1_Ye3.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 t{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(){n.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};
@@ -1 +1 @@
1
- import{l as javascriptGenerator}from"./index-BnLv569U.js";function reconnectChild(e,t,n){var r;if(!(e!=null&&e.getSourceBlock().workspace))return!1;let i=(r=t.getInput(n))==null?void 0:r.connection;if(!i)return!1;let a=e.targetBlock();return(!a||a===t)&&i.targetConnection!==e&&(i.isConnected()&&i.disconnect(),i.connect(e),!0)}function quote(e){return javascriptGenerator.quote_(e)}function dateFormat(e){return window.Blockly.Words[e].format}function dateFormatOptions(){let e=window.Blockly.Translate,t=[`object`,`ms`,`s`,`sid`,`m`,`mid`,`h`,`d`,`M`,`Mt`,`Mts`,`y`,`fy`,`wdt`,`wdts`,`wd`,`cw`,`custom`],n=[`time_get_yyyy.mm.dd`,`time_get_yyyy/mm/dd`,`time_get_yy.mm.dd`,`time_get_yy/mm/dd`,`time_get_dd.mm.yyyy`,`time_get_dd/mm/yyyy`,`time_get_dd.mm.yy`,`time_get_dd/mm/yy`,`time_get_mm/dd/yyyy`,`time_get_mm/dd/yy`,`time_get_dd.mm`,`time_get_dd/mm`,`time_get_mm.dd`,`time_get_mm/dd`,`time_get_hh_mm`,`time_get_hh_mm_ss`,`time_get_hh_mm_ss.sss`];return[...t.map(t=>[e(`time_get_${t}`),t]),...n.map(t=>[e(t),dateFormat(t)])]}function dateLanguageOptions(){let e=[`in english`,`en`],t=[`auf deutsch`,`de`],n=[`на русском`,`ru`];return window.systemLang===`de`?[t,e,n]:window.systemLang===`ru`?[n,e,t]:[e,t,n]}function isTrue(e){return e===!0||e===`true`||e===`TRUE`}function logLevelOptions(){let e=window.Blockly.Translate;return[[e(`loglevel_none`),``],[e(`loglevel_debug`),`debug`],[e(`loglevel_info`),`info`],[e(`loglevel_warn`),`warn`],[e(`loglevel_error`),`error`]]}function updateStatementInput(e,t){let n=t===void 0?isTrue(e.getFieldValue(`WITH_STATEMENT`)):t;e.getInput(`STATEMENT`)&&e.removeInput(`STATEMENT`),n&&e.appendStatementInput(`STATEMENT`)}function warnIfNotNestedIn(e,t,n){let r=!1,i=e;do{if(t.includes(i.type)){r=!0;break}i=i.getSurroundParent()}while(i);e.setWarningText(r?null:window.Blockly.Translate(n),e.id)}function objectNameOf(code){try{var _window$main;const objId=eval(code);let name=((_window$main=window.main)==null||(_window$main=_window$main.objects[objId])==null||(_window$main=_window$main.common)==null?void 0:_window$main.name)||``;return typeof name==`object`&&(name=name[window.systemLang]||name.en),name||``}catch{return``}}function toMilliseconds(e,t){let n=parseFloat(e);return t===`min`?n*6e4:t===`sec`?n*1e3:n}function objectNameById(e){var t;let n=((t=window.main)==null||(t=t.objects[e])==null||(t=t.common)==null?void 0:t.name)||``;return typeof n==`object`&&(n=n[window.systemLang]||n.en),n||``}function warnIfInsideTrigger(e){let t=e.getSurroundParent();for(;t;){if(window.Blockly.Trigger.WARNING_PARENTS.includes(t.type)){e.setWarningText(window.Blockly.Translate(`trigger_in_trigger_warning`),e.id);return}t=t.getSurroundParent()}e.setWarningText(null,e.id)}function namedResourceVariableModel(e,t){return{getId:()=>e,getName:()=>e,getType:()=>t,name:e,type:t}}export{namedResourceVariableModel as a,quote as c,updateStatementInput as d,warnIfInsideTrigger as f,logLevelOptions as i,reconnectChild as l,dateLanguageOptions as n,objectNameById as o,warnIfNotNestedIn as p,isTrue as r,objectNameOf as s,dateFormatOptions as t,toMilliseconds as u};
1
+ import{l as javascriptGenerator}from"./index-DwTLl2xB.js";function reconnectChild(e,t,n){var r;if(!(e!=null&&e.getSourceBlock().workspace))return!1;let i=(r=t.getInput(n))==null?void 0:r.connection;if(!i)return!1;let a=e.targetBlock();return(!a||a===t)&&i.targetConnection!==e&&(i.isConnected()&&i.disconnect(),i.connect(e),!0)}function quote(e){return javascriptGenerator.quote_(e)}function dateFormat(e){return window.Blockly.Words[e].format}function dateFormatOptions(){let e=window.Blockly.Translate,t=[`object`,`ms`,`s`,`sid`,`m`,`mid`,`h`,`d`,`M`,`Mt`,`Mts`,`y`,`fy`,`wdt`,`wdts`,`wd`,`cw`,`custom`],n=[`time_get_yyyy.mm.dd`,`time_get_yyyy/mm/dd`,`time_get_yy.mm.dd`,`time_get_yy/mm/dd`,`time_get_dd.mm.yyyy`,`time_get_dd/mm/yyyy`,`time_get_dd.mm.yy`,`time_get_dd/mm/yy`,`time_get_mm/dd/yyyy`,`time_get_mm/dd/yy`,`time_get_dd.mm`,`time_get_dd/mm`,`time_get_mm.dd`,`time_get_mm/dd`,`time_get_hh_mm`,`time_get_hh_mm_ss`,`time_get_hh_mm_ss.sss`];return[...t.map(t=>[e(`time_get_${t}`),t]),...n.map(t=>[e(t),dateFormat(t)])]}function dateLanguageOptions(){let e=[`in english`,`en`],t=[`auf deutsch`,`de`],n=[`на русском`,`ru`];return window.systemLang===`de`?[t,e,n]:window.systemLang===`ru`?[n,e,t]:[e,t,n]}function isTrue(e){return e===!0||e===`true`||e===`TRUE`}function logLevelOptions(){let e=window.Blockly.Translate;return[[e(`loglevel_none`),``],[e(`loglevel_debug`),`debug`],[e(`loglevel_info`),`info`],[e(`loglevel_warn`),`warn`],[e(`loglevel_error`),`error`]]}function updateStatementInput(e,t){let n=t===void 0?isTrue(e.getFieldValue(`WITH_STATEMENT`)):t;e.getInput(`STATEMENT`)&&e.removeInput(`STATEMENT`),n&&e.appendStatementInput(`STATEMENT`)}function warnIfNotNestedIn(e,t,n){let r=!1,i=e;do{if(t.includes(i.type)){r=!0;break}i=i.getSurroundParent()}while(i);e.setWarningText(r?null:window.Blockly.Translate(n),e.id)}function objectNameOf(code){try{var _window$main;const objId=eval(code);let name=((_window$main=window.main)==null||(_window$main=_window$main.objects[objId])==null||(_window$main=_window$main.common)==null?void 0:_window$main.name)||``;return typeof name==`object`&&(name=name[window.systemLang]||name.en),name||``}catch{return``}}function toMilliseconds(e,t){let n=parseFloat(e);return t===`min`?n*6e4:t===`sec`?n*1e3:n}function objectNameById(e){var t;let n=((t=window.main)==null||(t=t.objects[e])==null||(t=t.common)==null?void 0:t.name)||``;return typeof n==`object`&&(n=n[window.systemLang]||n.en),n||``}function warnIfInsideTrigger(e){let t=e.getSurroundParent();for(;t;){if(window.Blockly.Trigger.WARNING_PARENTS.includes(t.type)){e.setWarningText(window.Blockly.Translate(`trigger_in_trigger_warning`),e.id);return}t=t.getSurroundParent()}e.setWarningText(null,e.id)}function namedResourceVariableModel(e,t){return{getId:()=>e,getName:()=>e,getType:()=>t,name:e,type:t}}export{namedResourceVariableModel as a,quote as c,updateStatementInput as d,warnIfInsideTrigger as f,logLevelOptions as i,reconnectChild as l,dateLanguageOptions as n,objectNameById as o,warnIfNotNestedIn as p,isTrue as r,objectNameOf as s,dateFormatOptions as t,toMilliseconds as u};
@@ -1 +1 @@
1
- import{t as e}from"./vite-preload-helper-B7qeedMF.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t];for(let e of Object.keys(n.share))if(e.startsWith(`default:`)){let t=e.slice(8);n.share[t]===void 0&&(n.share[t]=n.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;n.share[t]===void 0&&(n.share[t]=n.share[e])}var r;async function i(){return r||=(async()=>{let t=(e,t,n,r)=>{let i=(Array.isArray(r)?r[0]:r)||`default`,a=t||!n?e:e+`@`+n,o={canonical:i+`:`+a};return i==="default"&&(o.aliases=[a]),o},r=(e,t)=>{let n=e[t.canonical];if(n!==void 0)return n;let r=t.aliases||[];for(let n of r){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=e[n];if(r!==void 0)return e[t.canonical]=r,r}},i=Symbol.for(`module-federation.shared-cache-listeners`),a=Symbol.for(`module-federation.shared-cache-owners`),o=e=>{let t=e[a];return t===void 0&&(t=Object.create(null),Object.defineProperty(e,a,{value:t,enumerable:!1,configurable:!1,writable:!1})),t},s=(e,t)=>{var n;return(n=e[a])==null?void 0:n[t.canonical]},c=(e,t,n,r)=>{var s;e[t.canonical]=n;let c=t.aliases||[];for(let t of c)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});let l=e[a];r===void 0?l&&delete l[t.canonical]:o(e)[t.canonical]=r;let u=(s=e[i])==null?void 0:s[t.canonical];if(u)for(let e of u)e(n);return n},l=await(await e(()=>import(`../remoteEntry.js`),[],import.meta.url)).init(),{usedShared:u}=await e(async()=>{let{usedShared:e}=await import(`./_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-v3-PYsgp.js`);return{usedShared:e}},[],import.meta.url),d=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.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(n.length>0&&n.some(e=>e!==void 0))break;t=e}return t};for(let e of[[`react`,`prop-types`],[`react-dom`],[`@mui/material`],[`@iobroker/gui-components`]])await Promise.all(e.map(async e=>{var i;let a=u[e];if(!a||a.materialize===!1||a.treeShaking)return;let o=t(e,(i=a.shareConfig)==null?void 0:i.singleton,a.version,a.scope);(r(n.share,o)===void 0||s(n.share,o)!==`iobroker_javascript`)&&await l.loadShare(e,{customShareInfo:{shareConfig:a.shareConfig}}).then(async e=>{let t=typeof e==`function`?e():e,r=d(await Promise.resolve(t));c(n.share,o,r,`iobroker_javascript`)})}));return l})(),r}r=i();export{r as hostInitPromise,i as initHost};
1
+ import{t as e}from"./vite-preload-helper-CaC3yEL3.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t];for(let e of Object.keys(n.share))if(e.startsWith(`default:`)){let t=e.slice(8);n.share[t]===void 0&&(n.share[t]=n.share[e])}else if(!e.includes(`:`)){let t=`default:`+e;n.share[t]===void 0&&(n.share[t]=n.share[e])}var r;async function i(){return r||=(async()=>{let t=(e,t,n,r)=>{let i=(Array.isArray(r)?r[0]:r)||`default`,a=t||!n?e:e+`@`+n,o={canonical:i+`:`+a};return i==="default"&&(o.aliases=[a]),o},r=(e,t)=>{let n=e[t.canonical];if(n!==void 0)return n;let r=t.aliases||[];for(let n of r){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=e[n];if(r!==void 0)return e[t.canonical]=r,r}},i=Symbol.for(`module-federation.shared-cache-listeners`),a=Symbol.for(`module-federation.shared-cache-owners`),o=e=>{let t=e[a];return t===void 0&&(t=Object.create(null),Object.defineProperty(e,a,{value:t,enumerable:!1,configurable:!1,writable:!1})),t},s=(e,t)=>{var n;return(n=e[a])==null?void 0:n[t.canonical]},c=(e,t,n,r)=>{var s;e[t.canonical]=n;let c=t.aliases||[];for(let t of c)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0});let l=e[a];r===void 0?l&&delete l[t.canonical]:o(e)[t.canonical]=r;let u=(s=e[i])==null?void 0:s[t.canonical];if(u)for(let e of u)e(n);return n},l=await(await e(()=>import(`../remoteEntry.js`),[],import.meta.url)).init(),{usedShared:u}=await e(async()=>{let{usedShared:e}=await import(`./_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-CQpJXcpz.js`);return{usedShared:e}},[],import.meta.url),d=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.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(n.length>0&&n.some(e=>e!==void 0))break;t=e}return t};for(let e of[[`react`,`prop-types`],[`react-dom`],[`@mui/material`],[`@iobroker/gui-components`]])await Promise.all(e.map(async e=>{var i,a;let o=u[e];if(!o||o.materialize===!1||o.treeShaking)return;let f=t(e,(i=o.shareConfig)==null?void 0:i.singleton,o.version,o.scope);(r(n.share,f)===void 0||s(n.share,f)!==`iobroker_javascript`)&&(((a=o.shareConfig)==null?void 0:a.import)!==!1||(Array.isArray(o.scope)?o.scope:[o.scope||`default`]).some(t=>{var n;return Object.values(((n=l.shareScopeMap)==null||(n=n[t])==null?void 0:n[e])||{}).some(e=>{var t;return(e==null||(t=e.shareConfig)==null?void 0:t.import)!==!1})}))&&await l.loadShare(e,{customShareInfo:{shareConfig:o.shareConfig}}).then(async e=>{let t=typeof e==`function`?e():e,r=d(await Promise.resolve(t));c(n.share,f,r,`iobroker_javascript`)})}));return l})(),r}r=i();export{r as hostInitPromise,i as initHost};