iobroker.javascript 9.0.18 → 9.1.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 (156) hide show
  1. package/README.md +13 -6
  2. package/admin/assets/OpenAiDialog-Dx-XNET0.js +13 -0
  3. package/admin/assets/{Save-C-o2LLTD.js → Save-Cld9qv9i.js} +1 -1
  4. package/admin/assets/ScriptEditor-BVaX7Hcs.js +2 -0
  5. package/admin/assets/ScriptEditorVanillaMonaco-yq11eIYC.js +1 -0
  6. package/admin/assets/createSvgIcon-DPvF8xqu.js +8 -0
  7. package/admin/assets/hostInit-LzITLWDa.js +1 -0
  8. package/admin/assets/index-BkyLyaYT.js +8 -0
  9. package/admin/assets/index-CLJ6-h9Q.js +1 -0
  10. package/admin/assets/index-COZhHfBn.js +1230 -0
  11. package/admin/assets/index-CVZSzCXy.js +1 -0
  12. package/admin/assets/index-Cu-TydZj.js +5 -0
  13. package/admin/assets/index-D8iYqogF.js +16 -0
  14. package/admin/assets/index-DlDUIfpA.js +193 -0
  15. package/admin/assets/index-Dnbw7_L3.js +986 -0
  16. package/admin/assets/index-Dsh1HfIY.js +1 -0
  17. package/admin/assets/index-gIA8x-8f.js +1 -0
  18. package/admin/assets/inheritsLoose-B0Ba5G9z.js +29 -0
  19. package/admin/assets/iobroker_javascript__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-DkBjPSMw.js +1 -0
  20. package/admin/assets/iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-QWG5Arqe.js +1 -0
  21. package/admin/assets/iobroker_javascript__loadShare__prop_mf_2_types__loadShare__.mjs-BCtSFofY.js +1 -0
  22. package/admin/assets/iobroker_javascript__loadShare__react__loadShare__.mjs-CTZOFJS2.js +1 -0
  23. package/admin/assets/iobroker_javascript__loadShare__react__loadShare__.mjs_commonjs-proxy-CE9lvhW8.js +1 -0
  24. package/admin/assets/iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs-DeVAS-oa.js +1 -0
  25. package/admin/assets/iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-RQRRZMX5.js +1 -0
  26. package/admin/assets/localSharedImportMap-AxgBkrOR.js +1 -0
  27. package/admin/assets/useTheme-hy6f3gra.js +1 -0
  28. package/admin/assets/virtualExposes-BPsCufin.js +1 -0
  29. package/admin/assets/virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-C9suQF96.js +8 -0
  30. package/admin/custom/assets/Components-FfVbavBM.js +1 -0
  31. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-B7D2xOvV.js +1 -0
  32. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.mjs-ClsgYnEX.js +1 -0
  33. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__.mjs-B551AMx-.js +1 -0
  34. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-KsT5vKjV.js +1 -0
  35. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_x_mf_2_date_mf_2_pickers__loadShare__.mjs-DgHZUNxn.js +1 -0
  36. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__leaflet__loadShare__.mjs-BYONkEgA.js +1 -0
  37. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react__loadShare__.mjs-0SjJESw9.js +1 -0
  38. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react__loadShare__.mjs_commonjs-proxy-CInLgMWW.js +1 -0
  39. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__.mjs-CL--xmjC.js +1 -0
  40. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-CorOEig8.js +1 -0
  41. package/admin/custom/assets/DefaultPropsProvider-CGb21NGY.js +1 -0
  42. package/admin/custom/assets/TextField-DNzklBSl.js +139 -0
  43. package/admin/custom/assets/ThemeProvider-B4G3jidj.js +29 -0
  44. package/admin/custom/assets/blue-CagzI6CQ.js +1 -0
  45. package/admin/custom/assets/createSvgIcon-ZdrQ8zSU.js +1 -0
  46. package/admin/custom/assets/createTheme-Wd4QxQE0.js +8 -0
  47. package/admin/custom/assets/defaultTheme-F2iJF2G2.js +1 -0
  48. package/admin/custom/assets/hostInit-iUL-wyj1.js +1 -0
  49. package/admin/custom/assets/index-AZB1OHDH.js +1 -0
  50. package/admin/custom/assets/index-Be7j5wvd.js +1523 -0
  51. package/admin/custom/assets/index-BptSiKBK.js +55 -0
  52. package/admin/custom/assets/index-Bvwv5H7k.js +1 -0
  53. package/admin/custom/assets/index-C0RmLaAj.js +1 -0
  54. package/admin/custom/assets/index-CYc31Gwg.js +960 -0
  55. package/admin/custom/assets/index-CmJ8HzSc.js +1 -0
  56. package/admin/custom/assets/index-D0iTiVVG.js +8 -0
  57. package/admin/custom/assets/index-DNdWk-cT.js +1 -0
  58. package/admin/custom/assets/index-Dp7A3XHd.js +7 -0
  59. package/admin/custom/assets/index-YBvFYuP6.js +31 -0
  60. package/admin/custom/assets/index-huvZQhZw.js +1 -0
  61. package/admin/custom/assets/index-iRHaQfi-.js +1 -0
  62. package/admin/custom/assets/isSameWeek-DDsSIa_t.js +1 -0
  63. package/admin/custom/assets/jsx-runtime-DfVU3AZG.js +1 -0
  64. package/admin/custom/assets/leaflet-src-k2rCV-Ix.js +1 -0
  65. package/admin/custom/assets/localSharedImportMap-BRxFonIn.js +1 -0
  66. package/admin/custom/assets/useTheme-BfhDdtAr.js +1 -0
  67. package/admin/custom/assets/useTheme-DWZ6jNyq.js +1 -0
  68. package/admin/custom/assets/virtualExposes-DyedJotb.js +2 -0
  69. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID_ConfigCustomJavascriptSet__customComponents_js-BtJxKB87.js +8 -0
  70. package/admin/custom/customComponents.js +1 -2
  71. package/admin/i18n/de.json +10 -1
  72. package/admin/i18n/en.json +10 -1
  73. package/admin/i18n/es.json +10 -1
  74. package/admin/i18n/fr.json +10 -1
  75. package/admin/i18n/it.json +10 -1
  76. package/admin/i18n/nl.json +10 -1
  77. package/admin/i18n/pl.json +10 -1
  78. package/admin/i18n/pt.json +10 -1
  79. package/admin/i18n/ru.json +10 -1
  80. package/admin/i18n/uk.json +10 -1
  81. package/admin/i18n/zh-cn.json +10 -1
  82. package/admin/jsonConfig.json +195 -130
  83. package/admin/mf-manifest.json +1 -1
  84. package/admin/remoteEntry.js +1 -2
  85. package/admin/tab.html +13 -8
  86. package/build/lib/javascript.d.ts +4 -2
  87. package/build/lib/nodeModulesManagement.js +3 -2
  88. package/build/lib/nodeModulesManagement.js.map +1 -1
  89. package/build/lib/protectFs.js +27 -12
  90. package/build/lib/protectFs.js.map +1 -1
  91. package/build/lib/sandbox.js +3 -3
  92. package/build/lib/sandbox.js.map +1 -1
  93. package/build/lib/tools.js +7 -2
  94. package/build/lib/tools.js.map +1 -1
  95. package/build/main.js +236 -19
  96. package/build/main.js.map +1 -1
  97. package/build/types.d.ts +5 -0
  98. package/docs/de/README.md +75 -0
  99. package/docs/en/README.md +75 -0
  100. package/io-package.json +19 -15
  101. package/package.json +14 -14
  102. package/admin/assets/OpenAiDialog-BVH3CrDi.js +0 -36
  103. package/admin/assets/ScriptEditor-CAoVSrVf.js +0 -2
  104. package/admin/assets/ScriptEditorVanillaMonaco-Cf9lA3Q5.js +0 -1
  105. package/admin/assets/_commonjsHelpers-Cpj98o6Y.js +0 -1
  106. package/admin/assets/createSvgIcon-XLoRKyxt.js +0 -30
  107. package/admin/assets/hostInit-OBG53iVO.js +0 -2
  108. package/admin/assets/index-BDco9K7T.js +0 -942
  109. package/admin/assets/index-C96hfBFW.js +0 -16
  110. package/admin/assets/index-CFhFEZTW.js +0 -5
  111. package/admin/assets/index-Cm-iTDHo.js +0 -193
  112. package/admin/assets/index-DCTpQXgR.js +0 -1294
  113. package/admin/assets/index-DKvqhUY5.js +0 -24
  114. package/admin/assets/index-DQiceR5U.js +0 -1
  115. package/admin/assets/index-DZ3lKVw8.js +0 -1
  116. package/admin/assets/index-DcrzW8Zn.js +0 -1
  117. package/admin/assets/index-Do-nCdWy.js +0 -9
  118. package/admin/assets/inheritsLoose-tR_kcxUR.js +0 -36
  119. package/admin/assets/iobroker_javascript__loadShare__react__loadShare__-6sH5wUl6.js +0 -1
  120. package/admin/assets/iobroker_javascript__mf_v__runtimeInit__mf_v__-CMP-NJnH.js +0 -8
  121. package/admin/assets/useTheme-C2oUi01-.js +0 -1
  122. package/admin/assets/virtualExposes-BIHI7g3E.js +0 -1
  123. package/admin/custom/assets/Components-DjQ_LxKw.js +0 -1
  124. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-DaN0pfsw.js +0 -1
  125. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-BqzgglHd.js +0 -1
  126. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react__loadShare__-BNbscXK6.js +0 -1
  127. package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__-N2_tx_mJ.js +0 -1
  128. package/admin/custom/assets/ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-jdUmHa_i.js +0 -5
  129. package/admin/custom/assets/DefaultPropsProvider-B8ZCC-c2.js +0 -1
  130. package/admin/custom/assets/DefaultPropsProvider-DfdXSIBu.js +0 -1
  131. package/admin/custom/assets/FilledInput-CSjr0QT8.js +0 -2
  132. package/admin/custom/assets/Tabs-CiTQkBjL.js +0 -138
  133. package/admin/custom/assets/ThemeProvider-C50pIiW4.js +0 -29
  134. package/admin/custom/assets/_commonjsHelpers-CE1G-McA.js +0 -1
  135. package/admin/custom/assets/createSvgIcon-C7qUEvjp.js +0 -1
  136. package/admin/custom/assets/createTheme-Bm92JF8u.js +0 -8
  137. package/admin/custom/assets/defaultTheme-BlO0eCf6.js +0 -1
  138. package/admin/custom/assets/hostInit-BJ6gSofk.js +0 -2
  139. package/admin/custom/assets/index-4wMOc304.js +0 -1
  140. package/admin/custom/assets/index-5CTGLw4h.js +0 -55
  141. package/admin/custom/assets/index-BkjEWGjf.js +0 -1
  142. package/admin/custom/assets/index-Bym4WjyH.js +0 -908
  143. package/admin/custom/assets/index-COcxCdeX.js +0 -8
  144. package/admin/custom/assets/index-CnpybLRW.js +0 -1
  145. package/admin/custom/assets/index-Db8nkuMR.js +0 -7
  146. package/admin/custom/assets/index-DcK0RDrH.js +0 -1
  147. package/admin/custom/assets/index-Df6OaCxx.js +0 -1
  148. package/admin/custom/assets/index-Dx7rDE4p.js +0 -1
  149. package/admin/custom/assets/index-t-NMdeH5.js +0 -31
  150. package/admin/custom/assets/index-u8R8UVCf.js +0 -1393
  151. package/admin/custom/assets/jsx-runtime-C1csJtRx.js +0 -1
  152. package/admin/custom/assets/leaflet-src-DpWQqQWv.js +0 -1
  153. package/admin/custom/assets/useEnhancedEffect-aUb-5tTL.js +0 -1
  154. package/admin/custom/assets/useTheme-Cgjfsi-1.js +0 -1
  155. package/admin/custom/assets/useTheme-DFGylj2o.js +0 -1
  156. package/admin/custom/assets/virtualExposes-C_DtjFte.js +0 -2
@@ -0,0 +1,1230 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CLJ6-h9Q.js","./createSvgIcon-DPvF8xqu.js","./iobroker_javascript__loadShare__react__loadShare__.mjs-CTZOFJS2.js","./iobroker_javascript__loadShare__react__loadShare__.mjs_commonjs-proxy-CE9lvhW8.js","./iobroker_javascript__loadShare__prop_mf_2_types__loadShare__.mjs-BCtSFofY.js","./iobroker_javascript__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-DkBjPSMw.js","./iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-QWG5Arqe.js","./index-Cu-TydZj.js","./virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-C9suQF96.js","./preload-helper-BDBacUwf.js","./iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-RQRRZMX5.js","./iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs-DeVAS-oa.js","./inheritsLoose-B0Ba5G9z.js","./index-BCK6q-N6.css","./index-D8iYqogF.js","./ScriptEditorVanillaMonaco-yq11eIYC.js","./ScriptEditor-BVaX7Hcs.js","./Save-Cld9qv9i.js","./OpenAiDialog-Dx-XNET0.js","./index-gIA8x-8f.js"])))=>i.map(i=>d[i]);
2
+ import{d as Xy}from"./virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-C9suQF96.js";import{j as g,c as ht,g as Cw,r as Tw,_ as Tg,i as Zy}from"./createSvgIcon-DPvF8xqu.js";import{r as Ek}from"./iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-RQRRZMX5.js";import{a as Y,_ as Ik,b as Bo,c as Mt,d as xk,e as kw,f as kg,g as rm,h as am,i as lm,j as vt,k as _n,l as rs,m as Xr,n as Sw,o as Sg,p as Dk,q as Ak,r as Ew,s as Rk,t as pn}from"./iobroker_javascript__loadShare__react__loadShare__.mjs-CTZOFJS2.js";import{_ as Vt,a as as,b as Gt,c as vo,d as _i,e as Eg,f as wi,g as Ve,h as Kt,i as De,j as Yl,k as Jl,l as ql,m as Xl,n as Zl,o as Me,p as Iw,q as $i,r as Ig,s as Qy,t as xg,u as Dg,v as Dn,w as xw,x as Ok,y as cm,z as $t,A as Mk,B as e_,C as Nk,D as Yp,E as bc,F as Lk,G as Pk,H as Bk,I as jk,J as Dw,K as Fk,L as zk,M as t_,N as gn,O as Uk,P as Hk,Q as Wk,R as Vk,S as Gk,T as Aw,U as Kk,V as Ag,W as Rw,X as Yk}from"./iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-QWG5Arqe.js";import{_ as b}from"./iobroker_javascript__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-DkBjPSMw.js";import{I as zo,a as qs,b as dc,C as Jk,c as Ow,F as qk,d as Xk,e as vc,f as Rg,g as Zk,h as Qk,i as eS,j as tS,M as sS,k as oS,l as iS,m as nS,_ as rS,n as Ql,o as aS,p as lS,q as ec,r as s_,s as cS,t as uS,u as dS,v as hS,w as o_,x as Wc,y as pS,z as gS,A as mS,B as fS,D as $S,E as bS,G as Mw,H as Nw,J as Lw,L as vS,K as yS,N as _S,O as wS,P as CS,Q as TS}from"./index-Cu-TydZj.js";import{y as kS,_ as SS,a as ES,m as IS,S as i_,T as n_}from"./inheritsLoose-B0Ba5G9z.js";import{c as wn}from"./iobroker_javascript__loadShare__react__loadShare__.mjs_commonjs-proxy-CE9lvhW8.js";function Si(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}import{_ as On}from"./preload-helper-BDBacUwf.js";import{P as Z}from"./iobroker_javascript__loadShare__prop_mf_2_types__loadShare__.mjs-BCtSFofY.js";import{_ as xS}from"./iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs-DeVAS-oa.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function i(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(l){if(l.ep)return;l.ep=!0;const u=i(l);fetch(l.href,u)}})();var Pw,r_=Ek;Pw=r_.createRoot,r_.hydrateRoot;var Bw={exports:{}},rt={};var Vc=60103,Gc=60106,Zr=60107,Qr=60108,ea=60114,ta=60109,sa=60110,oa=60112,ia=60113,um=60120,na=60115,ra=60116,jw=60121,Fw=60122,zw=60117,Uw=60129,Hw=60131;if(typeof Symbol=="function"&&Symbol.for){var Rt=Symbol.for;Vc=Rt("react.element"),Gc=Rt("react.portal"),Zr=Rt("react.fragment"),Qr=Rt("react.strict_mode"),ea=Rt("react.profiler"),ta=Rt("react.provider"),sa=Rt("react.context"),oa=Rt("react.forward_ref"),ia=Rt("react.suspense"),um=Rt("react.suspense_list"),na=Rt("react.memo"),ra=Rt("react.lazy"),jw=Rt("react.block"),Fw=Rt("react.server.block"),zw=Rt("react.fundamental"),Uw=Rt("react.debug_trace_mode"),Hw=Rt("react.legacy_hidden")}function Rs(a){if(typeof a=="object"&&a!==null){var s=a.$$typeof;switch(s){case Vc:switch(a=a.type,a){case Zr:case ea:case Qr:case ia:case um:return a;default:switch(a=a&&a.$$typeof,a){case sa:case oa:case ra:case na:case ta:return a;default:return s}}case Gc:return s}}}var DS=ta,AS=Vc,RS=oa,OS=Zr,MS=ra,NS=na,LS=Gc,PS=ea,BS=Qr,jS=ia;rt.ContextConsumer=sa;rt.ContextProvider=DS;rt.Element=AS;rt.ForwardRef=RS;rt.Fragment=OS;rt.Lazy=MS;rt.Memo=NS;rt.Portal=LS;rt.Profiler=PS;rt.StrictMode=BS;rt.Suspense=jS;rt.isAsyncMode=function(){return!1};rt.isConcurrentMode=function(){return!1};rt.isContextConsumer=function(a){return Rs(a)===sa};rt.isContextProvider=function(a){return Rs(a)===ta};rt.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===Vc};rt.isForwardRef=function(a){return Rs(a)===oa};rt.isFragment=function(a){return Rs(a)===Zr};rt.isLazy=function(a){return Rs(a)===ra};rt.isMemo=function(a){return Rs(a)===na};rt.isPortal=function(a){return Rs(a)===Gc};rt.isProfiler=function(a){return Rs(a)===ea};rt.isStrictMode=function(a){return Rs(a)===Qr};rt.isSuspense=function(a){return Rs(a)===ia};rt.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===Zr||a===ea||a===Uw||a===Qr||a===ia||a===um||a===Hw||typeof a=="object"&&a!==null&&(a.$$typeof===ra||a.$$typeof===na||a.$$typeof===ta||a.$$typeof===sa||a.$$typeof===oa||a.$$typeof===zw||a.$$typeof===jw||a[0]===Fw)};rt.typeOf=Rs;Bw.exports=rt;var FS=Bw.exports;function yc(a,s){const i=getComputedStyle(s);if(!i)return;let r=a===dt.Horizontal?s.clientWidth:s.clientHeight;return r!==0?(a===dt.Horizontal?r-=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight):r-=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom),r):void 0}function tc(a,s,i=[],r={condition:!0}){const{condition:l}=r,u=(function(d,p){var m={};for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&p.indexOf(f)<0&&(m[f]=d[f]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function"){var v=0;for(f=Object.getOwnPropertySymbols(d);v<f.length;v++)p.indexOf(f[v])<0&&Object.prototype.propertyIsEnumerable.call(d,f[v])&&(m[f[v]]=d[f[v]])}return m})(r,["condition"]);Mt((()=>(l&&window.addEventListener(a,s,u),()=>{l&&window.removeEventListener(a,s)})),[a,s,l,...i])}(function(a,s){s===void 0&&(s={});var i=s.insertAt;if(typeof document<"u"){var r=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css",i==="top"&&r.firstChild?r.insertBefore(l,r.firstChild):r.appendChild(l),l.styleSheet?l.styleSheet.cssText=a:l.appendChild(document.createTextNode(a))}})(`/* === Main Container === */
3
+ .__dbk__container {
4
+ height: 100%;
5
+ width: 100%;
6
+
7
+ display: flex;
8
+ overflow: hidden;
9
+ }
10
+
11
+ .__dbk__container.Horizontal {
12
+ flex-direction: row;
13
+ }
14
+
15
+ .__dbk__container.Vertical {
16
+ flex-direction: column;
17
+ }
18
+ /* ====== */
19
+
20
+ /* === Wrapper for each child element === */
21
+ .__dbk__child-wrapper {
22
+ height: 100%;
23
+ width: 100%;
24
+ }
25
+ /* ====== */
26
+
27
+ /* === Gutter === */
28
+ .__dbk__gutter {
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ }
33
+ /* .__dbk__gutter > div {
34
+ background: red;
35
+ } */
36
+ .__dbk__gutter.Horizontal {
37
+ height: 100%;
38
+ padding: 0 2px;
39
+ flex-direction: column;
40
+ }
41
+ .__dbk__gutter.Horizontal:hover {
42
+ cursor: col-resize;
43
+ }
44
+
45
+ .__dbk__gutter.Vertical {
46
+ width: 100%;
47
+ padding: 2px 0;
48
+ flex-direction: row;
49
+ }
50
+ .__dbk__gutter.Vertical:hover {
51
+ cursor: row-resize;
52
+ }
53
+
54
+ .__dbk__gutter.Light {
55
+ background: #EDF0EF;
56
+ }
57
+ .__dbk__gutter.Light:hover > .__dbk__dragger {
58
+ background: #76747B;
59
+ }
60
+
61
+ .__dbk__gutter.Dark {
62
+ background: #020203;
63
+ }
64
+ .__dbk__gutter.Dark:hover > .__dbk__dragger {
65
+ background: #9995A3;
66
+ }
67
+ /* ====== */
68
+
69
+ /* === Gutter's Dragger === */
70
+ .__dbk__dragger {
71
+ border-radius: 2px;
72
+ }
73
+
74
+ .__dbk__dragger.Horizontal {
75
+ width: 4px;
76
+ height: 24px;
77
+ }
78
+
79
+ .__dbk__dragger.Vertical {
80
+ width: 24px;
81
+ height: 4px;
82
+ }
83
+
84
+ .__dbk__dragger.Light {
85
+ background: #A6ACB5;
86
+ }
87
+
88
+ .__dbk__dragger.Dark {
89
+ background: #434252;
90
+ }
91
+ /* ====== */`);const zS=Y.forwardRef((({className:a,theme:s,draggerClassName:i,direction:r=dt.Vertical,onDragging:l},u)=>{const d=`__dbk__gutter ${r} ${a||s}`,p=`__dbk__dragger ${r} ${i||s}`;return g.jsx("div",Object.assign({className:d,ref:u,dir:r,onMouseDown:l,onTouchStart:hc?l:void 0},{children:g.jsx("div",{className:p},void 0)}),void 0)}));var vs;function Og(a,s,i){let r,l;return s?(r=a/2,l=a):i?(r=a,l=a/2):(r=a,l=a),{aGutterSize:r,bGutterSize:l}}function US(a,s){switch(s.type){case vs.SetIsReadyToCompute:return Object.assign(Object.assign({},a),{isReady:s.payload.isReady});case vs.CreatePairs:{const{direction:i,children:r,gutters:l}=s.payload,u=r[0].parentNode;if(!u)throw new Error("Cannot create pairs - parent is undefined.");const d=yc(i,u);if(d===void 0)throw new Error(`Cannot create pairs - parent has undefined or zero size: ${d}.`);const p=[];return r.forEach(((m,f)=>{if(f>0){const v=r[f-1],_=r[f],y=l[f-1],k=i===dt.Horizontal?v.getBoundingClientRect().left:v.getBoundingClientRect().top,C=i===dt.Horizontal?_.getBoundingClientRect().right:_.getBoundingClientRect().bottom,w=i===dt.Horizontal?v.getBoundingClientRect().width+y.getBoundingClientRect().width+_.getBoundingClientRect().width:v.getBoundingClientRect().height+y.getBoundingClientRect().height+_.getBoundingClientRect().height,E=i===dt.Horizontal?y.getBoundingClientRect().width:y.getBoundingClientRect().height,R={idx:f-1,a:v,b:_,gutter:y,parent:u,start:k,end:C,size:w,gutterSize:E,aSizePct:100/r.length,bSizePct:100/r.length};p.push(R)}})),Object.assign(Object.assign({},a),{pairs:p})}case vs.StartDragging:{const{gutterIdx:i}=s.payload;return Object.assign(Object.assign({},a),{isDragging:!0,draggingIdx:i})}case vs.StopDragging:return Object.assign(Object.assign({},a),{isDragging:!1});case vs.CalculateSizes:{const{direction:i,gutterIdx:r}=s.payload,l=a.pairs[r],u=yc(i,l.parent);if(!u)throw new Error("Cannot calculate sizes - 'pair.parent' has undefined or zero size.");const d=l.gutter[i===dt.Horizontal?"clientWidth":"clientHeight"],p=r===0,m=r===a.pairs.length-1,{aGutterSize:f,bGutterSize:v}=Og(d,p,m);let _,y,k,C,w;return i===dt.Horizontal?(_=l.a.getBoundingClientRect().left,y=l.b.getBoundingClientRect().right,C=(l.a.getBoundingClientRect().width+f)/u*100,w=(l.b.getBoundingClientRect().width+v)/u*100,k=l.a.getBoundingClientRect().width+f+v+l.b.getBoundingClientRect().width):(_=l.a.getBoundingClientRect().top,y=l.b.getBoundingClientRect().bottom,C=(l.a.getBoundingClientRect().height+f)/u*100,w=(l.b.getBoundingClientRect().height+v)/u*100,k=l.a.getBoundingClientRect().height+f+v+l.b.getBoundingClientRect().height),a.pairs[r]=Object.assign(Object.assign({},l),{start:_,end:y,size:k,aSizePct:C,bSizePct:w,gutterSize:d}),Object.assign({},a)}default:return a}}function Ww(a,s=0,i=[]){return xk.toArray(a).reduce(((r,l,u)=>(FS.isFragment(l)?r.push.apply(r,Ww(l.props.children,s+1,i.concat(l.key||u))):kw(l)?r.push(kg(l,{key:i.concat(String(l.key)).join(".")})):typeof l!="string"&&typeof l!="number"||r.push(l),r)),[])}(function(a){a[a.SetIsReadyToCompute=0]="SetIsReadyToCompute",a[a.CreatePairs=1]="CreatePairs",a[a.CalculateSizes=2]="CalculateSizes",a[a.StartDragging=3]="StartDragging",a[a.StopDragging=4]="StopDragging"})(vs||(vs={}));const a_=a=>"changedTouches"in a;var dt,Mg;(function(a){a.Horizontal="Horizontal",a.Vertical="Vertical"})(dt||(dt={})),(function(a){a.Light="Light",a.Dark="Dark"})(Mg||(Mg={}));const hc=typeof window<"u"&&"ontouchstart"in window;function Jp(a){return a===dt.Horizontal?"col-resize":"row-resize"}const HS={isReady:!1,isDragging:!1,pairs:[]};function l_({direction:a=dt.Horizontal,minWidths:s=[],minHeights:i=[],initialSizes:r,gutterTheme:l=Mg.Dark,gutterClassName:u,draggerClassName:d,children:p,onResizeStarted:m,onResizeFinished:f,classes:v=[]}){const _=Ww(p),[y,k]=Ik(US,HS),C=Bo(null),w=Bo([]),E=Bo([]);w.current=[],E.current=[];const R=Y.useCallback((ae=>{k({type:vs.SetIsReadyToCompute,payload:{isReady:ae}})}),[]),D=Y.useCallback(((ae,ce)=>{k({type:vs.StartDragging,payload:{gutterIdx:ce}});const K=y.pairs[ce];m==null||m(K.idx),K.a.style.userSelect="none",K.b.style.userSelect="none",K.gutter.style.cursor=Jp(ae),K.parent.style.cursor=Jp(ae),document.body.style.cursor=Jp(ae)}),[y.pairs]),A=Y.useCallback((()=>{k({type:vs.StopDragging});const ae=[];for(let K=0;K<y.pairs.length;K++){const ye=y.pairs[K],he=yc(a,ye.parent);if(he===void 0)throw new Error("Cannot call the 'onResizeFinished' callback - parentSize is undefined");if(ye.gutterSize===void 0)throw new Error("Cannot call 'onResizeFinished' callback - gutterSize is undefined");const je=K===0,G=K===y.pairs.length-1,tt=ye.a.getBoundingClientRect()[a===dt.Horizontal?"width":"height"],{aGutterSize:q,bGutterSize:ee}=Og(ye.gutterSize,je,G),B=(tt+q)/he*100;if(ae.push(B),G){const H=(ye.b.getBoundingClientRect()[a===dt.Horizontal?"width":"height"]+ee)/he*100;ae.push(H)}}if(y.draggingIdx===void 0)throw new Error("Could not reset cursor and user-select because 'state.draggingIdx' is undefined");const ce=y.pairs[y.draggingIdx];f==null||f(ce.idx,ae),ce.a.style.userSelect="",ce.b.style.userSelect="",ce.gutter.style.cursor="",ce.parent.style.cursor="",document.body.style.cursor=""}),[y.draggingIdx,y.pairs,a]),J=Y.useCallback(((ae,ce)=>{k({type:vs.CalculateSizes,payload:{direction:ae,gutterIdx:ce}})}),[]),ie=Y.useCallback(((ae,ce,K)=>{k({type:vs.CreatePairs,payload:{direction:ae,children:ce,gutters:K}})}),[]),se=Y.useCallback(((ae,ce,K,ye)=>{const he=ce[0].parentNode;if(!he)throw new Error("Cannot set initial sizes - parent is undefined");if(yc(ae,he)===void 0)throw new Error("Cannot set initial sizes - parent has undefined size");ce.forEach(((je,G)=>{const tt=G===0,q=G===ce.length-1;let ee,B=0;ce.length>1&&(B=K[q?G-1:G].getBoundingClientRect()[ae===dt.Horizontal?"width":"height"],B=tt||q?B/2:B),ee=ye&&G<ye.length?`calc(${ye[G]}% - ${B}px)`:`calc(${100/ce.length}% - ${B}px)`,ae===dt.Horizontal?(je.style.width=ee,je.style.height="100%"):(je.style.height=ee,je.style.width="100%")}))}),[]),me=Y.useCallback(((ae,ce)=>{if(y.draggingIdx===void 0)throw new Error("Cannot adjust size - 'draggingIdx' is undefined");const K=y.pairs[y.draggingIdx];if(K.size===void 0)throw new Error("Cannot adjust size - 'pair.size' is undefined");if(K.gutterSize===void 0)throw new Error("Cannot adjust size - 'pair.gutterSize' is undefined");const ye=K.aSizePct+K.bSizePct,he=ce/K.size*ye,je=ye-ce/K.size*ye,G=y.draggingIdx===0,tt=y.draggingIdx===y.pairs.length-1,{aGutterSize:q,bGutterSize:ee}=Og(K.gutterSize,G,tt),B=`calc(${he}% - ${q}px)`,H=`calc(${je}% - ${ee}px)`;ae===dt.Horizontal?(K.a.style.width=B,K.b.style.width=H):(K.a.style.height=B,K.b.style.height=H)}),[y.draggingIdx,y.pairs,a]),z=Y.useCallback(((ae,ce,K)=>{if(!y.isDragging)return;if(y.draggingIdx===void 0)throw new Error("Cannot drag - 'draggingIdx' is undefined");const ye=y.pairs[y.draggingIdx];if(ye.start===void 0)throw new Error("Cannot drag - 'pair.start' is undefined");if(ye.size===void 0)throw new Error("Cannot drag - 'pair.size' is undefined");if(ye.gutterSize===void 0)throw new Error("Cannot drag - 'pair.gutterSize' is undefined");let he=(function(tt,q){const ee=a_(q)?q.changedTouches[0]:q;return tt===dt.Horizontal?ee.clientX:ee.clientY})(ce,ae)-ye.start,je=16,G=16;K.length>y.draggingIdx&&(je=K[y.draggingIdx]),K.length>=y.draggingIdx+1&&(G=K[y.draggingIdx+1]),he<ye.gutterSize+je&&(he=ye.gutterSize+je),he>=ye.size-(ye.gutterSize+G)&&(he=ye.size-(ye.gutterSize+G)),me(ce,he)}),[y.isDragging,y.draggingIdx,y.pairs,me]),Oe=()=>{if(y.isDragging){if(y.draggingIdx===void 0)throw new Error("Cannot calculate sizes after dragging = 'state.draggingIdx' is undefined");J(a,y.draggingIdx),A()}},Ne=ae=>{y.isDragging&&(a_(ae)&&ae.preventDefault(),z(ae,a,a===dt.Horizontal?s:i))};function Ze(ae,ce){if(!ae.current)throw new Error("Can't add element to ref object - ref isn't initialized");ce&&!ae.current.includes(ce)&&ae.current.push(ce)}return tc("mouseup",Oe,[y.isDragging,A]),tc("mousemove",Ne,[a,y.isDragging,z,s,i]),tc("touchend",Oe,[y.isDragging,A],{condition:hc}),tc("touchmove",Ne,[a,y.isDragging,z,s,i],{condition:hc,passive:!hc}),Mt((function(){if(!C.current)return;const ae=C.current.parentElement;if(!ae)return;const ce=new ResizeObserver((()=>{const K=getComputedStyle(ae),ye=a===dt.Horizontal?ae.clientWidth:ae.clientHeight;R(!!K&&!!ye)}));return ce.observe(ae),()=>{ce.disconnect()}}),[C.current,a]),Mt((function(){if(y.isReady&&(!w.current||w.current[0].offsetParent)){if(!w.current||!E.current)throw new Error("Cannot create pairs - either variable 'childRefs' or 'gutterRefs' is undefined");_.length<=1?se(a,w.current,E.current,r):(se(a,w.current,E.current,r),ie(a,w.current,E.current))}}),[p,y.isReady,a,se,ie,r]),g.jsx("div",Object.assign({className:`__dbk__container ${a}`,ref:C},{children:y.isReady&&_.map(((ae,ce)=>g.jsxs(Y.Fragment,{children:[g.jsx("div",Object.assign({ref:K=>Ze(w,K),className:"__dbk__child-wrapper "+(ce<v.length?v[ce]:"")},{children:ae}),void 0),ce<_.length-1&&g.jsx(zS,{ref:K=>Ze(E,K),className:u,theme:l,draggerClassName:d,direction:a,onDragging:()=>{return J(a,K=ce),void D(a,K);var K}},void 0)]},ce)))}),void 0)}const Vw=rm({dragDropManager:void 0});function Gr(a){"@babel/helpers - typeof";return Gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Gr(a)}function WS(a,s){if(Gr(a)!="object"||!a)return a;var i=a[Symbol.toPrimitive];if(i!==void 0){var r=i.call(a,s);if(Gr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}function VS(a){var s=WS(a,"string");return Gr(s)=="symbol"?s:s+""}function GS(a,s,i){return(s=VS(s))in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function ms(a){return"Minified Redux error #"+a+"; visit https://redux.js.org/Errors?code="+a+" for the full message or use the non-minified dev environment for full errors. "}var c_=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),u_=function(){return Math.random().toString(36).substring(7).split("").join(".")},d_={INIT:"@@redux/INIT"+u_(),REPLACE:"@@redux/REPLACE"+u_()};function KS(a){if(typeof a!="object"||a===null)return!1;for(var s=a;Object.getPrototypeOf(s)!==null;)s=Object.getPrototypeOf(s);return Object.getPrototypeOf(a)===s}function Gw(a,s,i){var r;if(typeof s=="function"&&typeof i=="function"||typeof i=="function"&&typeof arguments[3]=="function")throw new Error(ms(0));if(typeof s=="function"&&typeof i>"u"&&(i=s,s=void 0),typeof i<"u"){if(typeof i!="function")throw new Error(ms(1));return i(Gw)(a,s)}if(typeof a!="function")throw new Error(ms(2));var l=a,u=s,d=[],p=d,m=!1;function f(){p===d&&(p=d.slice())}function v(){if(m)throw new Error(ms(3));return u}function _(w){if(typeof w!="function")throw new Error(ms(4));if(m)throw new Error(ms(5));var E=!0;return f(),p.push(w),function(){if(E){if(m)throw new Error(ms(6));E=!1,f();var D=p.indexOf(w);p.splice(D,1),d=null}}}function y(w){if(!KS(w))throw new Error(ms(7));if(typeof w.type>"u")throw new Error(ms(8));if(m)throw new Error(ms(9));try{m=!0,u=l(u,w)}finally{m=!1}for(var E=d=p,R=0;R<E.length;R++){var D=E[R];D()}return w}function k(w){if(typeof w!="function")throw new Error(ms(10));l=w,y({type:d_.REPLACE})}function C(){var w,E=_;return w={subscribe:function(D){if(typeof D!="object"||D===null)throw new Error(ms(11));function A(){D.next&&D.next(v())}A();var J=E(A);return{unsubscribe:J}}},w[c_]=function(){return this},w}return y({type:d_.INIT}),r={dispatch:y,subscribe:_,getState:v,replaceReducer:k},r[c_]=C,r}function Ie(a,s,...i){if(YS()&&s===void 0)throw new Error("invariant requires an error message argument");if(!a){let r;if(s===void 0)r=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let l=0;r=new Error(s.replace(/%s/g,function(){return i[l++]})),r.name="Invariant Violation"}throw r.framesToPop=1,r}}function YS(){return typeof process<"u"&&!0}function JS(a,s,i){return s.split(".").reduce((r,l)=>r&&r[l]?r[l]:i||null,a)}function qS(a,s){return a.filter(i=>i!==s)}function Kw(a){return typeof a=="object"}function XS(a,s){const i=new Map,r=u=>{i.set(u,i.has(u)?i.get(u)+1:1)};a.forEach(r),s.forEach(r);const l=[];return i.forEach((u,d)=>{u===1&&l.push(d)}),l}function ZS(a,s){return a.filter(i=>s.indexOf(i)>-1)}const dm="dnd-core/INIT_COORDS",Kc="dnd-core/BEGIN_DRAG",hm="dnd-core/PUBLISH_DRAG_SOURCE",Yc="dnd-core/HOVER",Jc="dnd-core/DROP",qc="dnd-core/END_DRAG";function h_(a,s){return{type:dm,payload:{sourceClientOffset:s||null,clientOffset:a||null}}}const QS={type:dm,payload:{clientOffset:null,sourceClientOffset:null}};function eE(a){return function(i=[],r={publishSource:!0}){const{publishSource:l=!0,clientOffset:u,getSourceClientOffset:d}=r,p=a.getMonitor(),m=a.getRegistry();a.dispatch(h_(u)),tE(i,p,m);const f=iE(i,p);if(f==null){a.dispatch(QS);return}let v=null;if(u){if(!d)throw new Error("getSourceClientOffset must be defined");sE(d),v=d(f)}a.dispatch(h_(u,v));const y=m.getSource(f).beginDrag(p,f);if(y==null)return;oE(y),m.pinSource(f);const k=m.getSourceType(f);return{type:Kc,payload:{itemType:k,item:y,sourceId:f,clientOffset:u||null,sourceClientOffset:v||null,isSourcePublic:!!l}}}}function tE(a,s,i){Ie(!s.isDragging(),"Cannot call beginDrag while dragging."),a.forEach(function(r){Ie(i.getSource(r),"Expected sourceIds to be registered.")})}function sE(a){Ie(typeof a=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function oE(a){Ie(Kw(a),"Item must be an object.")}function iE(a,s){let i=null;for(let r=a.length-1;r>=0;r--)if(s.canDragSource(a[r])){i=a[r];break}return i}function nE(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function rE(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){nE(a,l,i[l])})}return a}function aE(a){return function(i={}){const r=a.getMonitor(),l=a.getRegistry();lE(r),dE(r).forEach((d,p)=>{const m=cE(d,p,l,r),f={type:Jc,payload:{dropResult:rE({},i,m)}};a.dispatch(f)})}}function lE(a){Ie(a.isDragging(),"Cannot call drop while not dragging."),Ie(!a.didDrop(),"Cannot call drop twice during one drag operation.")}function cE(a,s,i,r){const l=i.getTarget(a);let u=l?l.drop(r,a):void 0;return uE(u),typeof u>"u"&&(u=s===0?{}:r.getDropResult()),u}function uE(a){Ie(typeof a>"u"||Kw(a),"Drop result must either be an object or undefined.")}function dE(a){const s=a.getTargetIds().filter(a.canDropOnTarget,a);return s.reverse(),s}function hE(a){return function(){const i=a.getMonitor(),r=a.getRegistry();pE(i);const l=i.getSourceId();return l!=null&&(r.getSource(l,!0).endDrag(i,l),r.unpinSource()),{type:qc}}}function pE(a){Ie(a.isDragging(),"Cannot call endDrag while not dragging.")}function Ng(a,s){return s===null?a===null:Array.isArray(a)?a.some(i=>i===s):a===s}function gE(a){return function(i,{clientOffset:r}={}){mE(i);const l=i.slice(0),u=a.getMonitor(),d=a.getRegistry(),p=u.getItemType();return $E(l,d,p),fE(l,u,d),bE(l,u,d),{type:Yc,payload:{targetIds:l,clientOffset:r||null}}}}function mE(a){Ie(Array.isArray(a),"Expected targetIds to be an array.")}function fE(a,s,i){Ie(s.isDragging(),"Cannot call hover while not dragging."),Ie(!s.didDrop(),"Cannot call hover after drop.");for(let r=0;r<a.length;r++){const l=a[r];Ie(a.lastIndexOf(l)===r,"Expected targetIds to be unique in the passed array.");const u=i.getTarget(l);Ie(u,"Expected targetIds to be registered.")}}function $E(a,s,i){for(let r=a.length-1;r>=0;r--){const l=a[r],u=s.getTargetType(l);Ng(u,i)||a.splice(r,1)}}function bE(a,s,i){a.forEach(function(r){i.getTarget(r).hover(s,r)})}function vE(a){return function(){if(a.getMonitor().isDragging())return{type:hm}}}function yE(a){return{beginDrag:eE(a),publishDragSource:vE(a),hover:gE(a),drop:aE(a),endDrag:hE(a)}}class _E{receiveBackend(s){this.backend=s}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const s=this,{dispatch:i}=this.store;function r(u){return(...d)=>{const p=u.apply(s,d);typeof p<"u"&&i(p)}}const l=yE(this);return Object.keys(l).reduce((u,d)=>{const p=l[d];return u[d]=r(p),u},{})}dispatch(s){this.store.dispatch(s)}constructor(s,i){this.isSetUp=!1,this.handleRefCountChange=()=>{const r=this.store.getState().refCount>0;this.backend&&(r&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!r&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=s,this.monitor=i,s.subscribe(this.handleRefCountChange)}}function wE(a,s){return{x:a.x+s.x,y:a.y+s.y}}function Yw(a,s){return{x:a.x-s.x,y:a.y-s.y}}function CE(a){const{clientOffset:s,initialClientOffset:i,initialSourceClientOffset:r}=a;return!s||!i||!r?null:Yw(wE(s,r),i)}function TE(a){const{clientOffset:s,initialClientOffset:i}=a;return!s||!i?null:Yw(s,i)}const Fr=[],pm=[];Fr.__IS_NONE__=!0;pm.__IS_ALL__=!0;function kE(a,s){return a===Fr?!1:a===pm||typeof s>"u"?!0:ZS(s,a).length>0}class SE{subscribeToStateChange(s,i={}){const{handlerIds:r}=i;Ie(typeof s=="function","listener must be a function."),Ie(typeof r>"u"||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let l=this.store.getState().stateId;const u=()=>{const d=this.store.getState(),p=d.stateId;try{p===l||p===l+1&&!kE(d.dirtyHandlerIds,r)||s()}finally{l=p}};return this.store.subscribe(u)}subscribeToOffsetChange(s){Ie(typeof s=="function","listener must be a function.");let i=this.store.getState().dragOffset;const r=()=>{const l=this.store.getState().dragOffset;l!==i&&(i=l,s())};return this.store.subscribe(r)}canDragSource(s){if(!s)return!1;const i=this.registry.getSource(s);return Ie(i,`Expected to find a valid source. sourceId=${s}`),this.isDragging()?!1:i.canDrag(this,s)}canDropOnTarget(s){if(!s)return!1;const i=this.registry.getTarget(s);if(Ie(i,`Expected to find a valid target. targetId=${s}`),!this.isDragging()||this.didDrop())return!1;const r=this.registry.getTargetType(s),l=this.getItemType();return Ng(r,l)&&i.canDrop(this,s)}isDragging(){return!!this.getItemType()}isDraggingSource(s){if(!s)return!1;const i=this.registry.getSource(s,!0);if(Ie(i,`Expected to find a valid source. sourceId=${s}`),!this.isDragging()||!this.isSourcePublic())return!1;const r=this.registry.getSourceType(s),l=this.getItemType();return r!==l?!1:i.isDragging(this,s)}isOverTarget(s,i={shallow:!1}){if(!s)return!1;const{shallow:r}=i;if(!this.isDragging())return!1;const l=this.registry.getTargetType(s),u=this.getItemType();if(u&&!Ng(l,u))return!1;const d=this.getTargetIds();if(!d.length)return!1;const p=d.indexOf(s);return r?p===d.length-1:p>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return CE(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return TE(this.store.getState().dragOffset)}constructor(s,i){this.store=s,this.registry=i}}const p_=typeof global<"u"?global:self,Jw=p_.MutationObserver||p_.WebKitMutationObserver;function qw(a){return function(){const i=setTimeout(l,0),r=setInterval(l,50);function l(){clearTimeout(i),clearInterval(r),a()}}}function EE(a){let s=1;const i=new Jw(a),r=document.createTextNode("");return i.observe(r,{characterData:!0}),function(){s=-s,r.data=s}}const IE=typeof Jw=="function"?EE:qw;class xE{enqueueTask(s){const{queue:i,requestFlush:r}=this;i.length||(r(),this.flushing=!0),i[i.length]=s}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:s}=this;for(;this.index<s.length;){const i=this.index;if(this.index++,s[i].call(),this.index>this.capacity){for(let r=0,l=s.length-this.index;r<l;r++)s[r]=s[r+this.index];s.length-=this.index,this.index=0}}s.length=0,this.index=0,this.flushing=!1},this.registerPendingError=s=>{this.pendingErrors.push(s),this.requestErrorThrow()},this.requestFlush=IE(this.flush),this.requestErrorThrow=qw(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class DE{call(){try{this.task&&this.task()}catch(s){this.onError(s)}finally{this.task=null,this.release(this)}}constructor(s,i){this.onError=s,this.release=i,this.task=null}}class AE{create(s){const i=this.freeTasks,r=i.length?i.pop():new DE(this.onError,l=>i[i.length]=l);return r.task=s,r}constructor(s){this.onError=s,this.freeTasks=[]}}const Xw=new xE,RE=new AE(Xw.registerPendingError);function OE(a){Xw.enqueueTask(RE.create(a))}const gm="dnd-core/ADD_SOURCE",mm="dnd-core/ADD_TARGET",fm="dnd-core/REMOVE_SOURCE",Xc="dnd-core/REMOVE_TARGET";function ME(a){return{type:gm,payload:{sourceId:a}}}function NE(a){return{type:mm,payload:{targetId:a}}}function LE(a){return{type:fm,payload:{sourceId:a}}}function PE(a){return{type:Xc,payload:{targetId:a}}}function BE(a){Ie(typeof a.canDrag=="function","Expected canDrag to be a function."),Ie(typeof a.beginDrag=="function","Expected beginDrag to be a function."),Ie(typeof a.endDrag=="function","Expected endDrag to be a function.")}function jE(a){Ie(typeof a.canDrop=="function","Expected canDrop to be a function."),Ie(typeof a.hover=="function","Expected hover to be a function."),Ie(typeof a.drop=="function","Expected beginDrag to be a function.")}function Lg(a,s){if(s&&Array.isArray(a)){a.forEach(i=>Lg(i,!1));return}Ie(typeof a=="string"||typeof a=="symbol",s?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var bs;(function(a){a.SOURCE="SOURCE",a.TARGET="TARGET"})(bs||(bs={}));let FE=0;function zE(){return FE++}function UE(a){const s=zE().toString();switch(a){case bs.SOURCE:return`S${s}`;case bs.TARGET:return`T${s}`;default:throw new Error(`Unknown Handler Role: ${a}`)}}function g_(a){switch(a[0]){case"S":return bs.SOURCE;case"T":return bs.TARGET;default:throw new Error(`Cannot parse handler ID: ${a}`)}}function m_(a,s){const i=a.entries();let r=!1;do{const{done:l,value:[,u]}=i.next();if(u===s)return!0;r=!!l}while(!r);return!1}class HE{addSource(s,i){Lg(s),BE(i);const r=this.addHandler(bs.SOURCE,s,i);return this.store.dispatch(ME(r)),r}addTarget(s,i){Lg(s,!0),jE(i);const r=this.addHandler(bs.TARGET,s,i);return this.store.dispatch(NE(r)),r}containsHandler(s){return m_(this.dragSources,s)||m_(this.dropTargets,s)}getSource(s,i=!1){return Ie(this.isSourceId(s),"Expected a valid source ID."),i&&s===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(s)}getTarget(s){return Ie(this.isTargetId(s),"Expected a valid target ID."),this.dropTargets.get(s)}getSourceType(s){return Ie(this.isSourceId(s),"Expected a valid source ID."),this.types.get(s)}getTargetType(s){return Ie(this.isTargetId(s),"Expected a valid target ID."),this.types.get(s)}isSourceId(s){return g_(s)===bs.SOURCE}isTargetId(s){return g_(s)===bs.TARGET}removeSource(s){Ie(this.getSource(s),"Expected an existing source."),this.store.dispatch(LE(s)),OE(()=>{this.dragSources.delete(s),this.types.delete(s)})}removeTarget(s){Ie(this.getTarget(s),"Expected an existing target."),this.store.dispatch(PE(s)),this.dropTargets.delete(s),this.types.delete(s)}pinSource(s){const i=this.getSource(s);Ie(i,"Expected an existing source."),this.pinnedSourceId=s,this.pinnedSource=i}unpinSource(){Ie(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(s,i,r){const l=UE(s);return this.types.set(l,i),s===bs.SOURCE?this.dragSources.set(l,r):s===bs.TARGET&&this.dropTargets.set(l,r),l}constructor(s){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=s}}const WE=(a,s)=>a===s;function VE(a,s){return!a&&!s?!0:!a||!s?!1:a.x===s.x&&a.y===s.y}function GE(a,s,i=WE){if(a.length!==s.length)return!1;for(let r=0;r<a.length;++r)if(!i(a[r],s[r]))return!1;return!0}function KE(a=Fr,s){switch(s.type){case Yc:break;case gm:case mm:case Xc:case fm:return Fr;case Kc:case hm:case qc:case Jc:default:return pm}const{targetIds:i=[],prevTargetIds:r=[]}=s.payload,l=XS(i,r);if(!(l.length>0||!GE(i,r)))return Fr;const d=r[r.length-1],p=i[i.length-1];return d!==p&&(d&&l.push(d),p&&l.push(p)),l}function YE(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function JE(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){YE(a,l,i[l])})}return a}const f_={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function qE(a=f_,s){const{payload:i}=s;switch(s.type){case dm:case Kc:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case Yc:return VE(a.clientOffset,i.clientOffset)?a:JE({},a,{clientOffset:i.clientOffset});case qc:case Jc:return f_;default:return a}}function XE(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function mn(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){XE(a,l,i[l])})}return a}const ZE={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function QE(a=ZE,s){const{payload:i}=s;switch(s.type){case Kc:return mn({},a,{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case hm:return mn({},a,{isSourcePublic:!0});case Yc:return mn({},a,{targetIds:i.targetIds});case Xc:return a.targetIds.indexOf(i.targetId)===-1?a:mn({},a,{targetIds:qS(a.targetIds,i.targetId)});case Jc:return mn({},a,{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case qc:return mn({},a,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return a}}function eI(a=0,s){switch(s.type){case gm:case mm:return a+1;case fm:case Xc:return a-1;default:return a}}function tI(a=0){return a+1}function sI(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function oI(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){sI(a,l,i[l])})}return a}function iI(a={},s){return{dirtyHandlerIds:KE(a.dirtyHandlerIds,{type:s.type,payload:oI({},s.payload,{prevTargetIds:JS(a,"dragOperation.targetIds",[])})}),dragOffset:qE(a.dragOffset,s),refCount:eI(a.refCount,s),dragOperation:QE(a.dragOperation,s),stateId:tI(a.stateId)}}function nI(a,s=void 0,i={},r=!1){const l=rI(r),u=new SE(l,new HE(l)),d=new _E(l,u),p=a(d,s,i);return d.receiveBackend(p),d}function rI(a){const s=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Gw(iI,a&&s&&s({name:"dnd-core",instanceId:"dnd-core"}))}function aI(a,s){if(a==null)return{};var i=lI(a,s),r,l;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(a);for(l=0;l<u.length;l++)r=u[l],!(s.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(a,r)&&(i[r]=a[r])}return i}function lI(a,s){if(a==null)return{};var i={},r=Object.keys(a),l,u;for(u=0;u<r.length;u++)l=r[u],!(s.indexOf(l)>=0)&&(i[l]=a[l]);return i}let $_=0;const pc=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Zw=am(function(s){var{children:i}=s,r=aI(s,["children"]);const[l,u]=cI(r);return Mt(()=>{if(u){const d=Qw();return++$_,()=>{--$_===0&&(d[pc]=null)}}},[]),g.jsx(Vw.Provider,{value:l,children:i})});function cI(a){if("manager"in a)return[{dragDropManager:a.manager},!1];const s=uI(a.backend,a.context,a.options,a.debugMode),i=!a.context;return[s,i]}function uI(a,s=Qw(),i,r){const l=s;return l[pc]||(l[pc]={dragDropManager:nI(a,s,i,r)}),l[pc]}function Qw(){return typeof global<"u"?global:window}var dI=function a(s,i){if(s===i)return!0;if(s&&i&&typeof s=="object"&&typeof i=="object"){if(s.constructor!==i.constructor)return!1;var r,l,u;if(Array.isArray(s)){if(r=s.length,r!=i.length)return!1;for(l=r;l--!==0;)if(!a(s[l],i[l]))return!1;return!0}if(s.constructor===RegExp)return s.source===i.source&&s.flags===i.flags;if(s.valueOf!==Object.prototype.valueOf)return s.valueOf()===i.valueOf();if(s.toString!==Object.prototype.toString)return s.toString()===i.toString();if(u=Object.keys(s),r=u.length,r!==Object.keys(i).length)return!1;for(l=r;l--!==0;)if(!Object.prototype.hasOwnProperty.call(i,u[l]))return!1;for(l=r;l--!==0;){var d=u[l];if(!a(s[d],i[d]))return!1}return!0}return s!==s&&i!==i};const hI=Si(dI),Ci=typeof window<"u"?lm:Mt;function pI(a,s,i){const[r,l]=vt(()=>s(a)),u=_n(()=>{const d=s(a);hI(r,d)||(l(d),i&&i())},[r,a,i]);return Ci(u),[r,u]}function gI(a,s,i){const[r,l]=pI(a,s,i);return Ci(function(){const d=a.getHandlerId();if(d!=null)return a.subscribeToStateChange(l,{handlerIds:[d]})},[a,l]),r}function eC(a,s,i){return gI(s,a||(()=>({})),()=>i.reconnect())}function tC(a,s){const i=[];return typeof a!="function"&&i.push(a),rs(()=>typeof a=="function"?a():a,i)}function mI(a){return rs(()=>a.hooks.dragSource(),[a])}function fI(a){return rs(()=>a.hooks.dragPreview(),[a])}let qp=!1,Xp=!1;class $I{receiveHandlerId(s){this.sourceId=s}getHandlerId(){return this.sourceId}canDrag(){Ie(!qp,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return qp=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{qp=!1}}isDragging(){if(!this.sourceId)return!1;Ie(!Xp,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Xp=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Xp=!1}}subscribeToStateChange(s,i){return this.internalMonitor.subscribeToStateChange(s,i)}isDraggingSource(s){return this.internalMonitor.isDraggingSource(s)}isOverTarget(s,i){return this.internalMonitor.isOverTarget(s,i)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(s){return this.internalMonitor.subscribeToOffsetChange(s)}canDragSource(s){return this.internalMonitor.canDragSource(s)}canDropOnTarget(s){return this.internalMonitor.canDropOnTarget(s)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(s){this.sourceId=null,this.internalMonitor=s.getMonitor()}}let Zp=!1;class bI{receiveHandlerId(s){this.targetId=s}getHandlerId(){return this.targetId}subscribeToStateChange(s,i){return this.internalMonitor.subscribeToStateChange(s,i)}canDrop(){if(!this.targetId)return!1;Ie(!Zp,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Zp=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Zp=!1}}isOver(s){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,s):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(s){this.targetId=null,this.internalMonitor=s.getMonitor()}}function vI(a,s,i){const r=i.getRegistry(),l=r.addTarget(a,s);return[l,()=>r.removeTarget(l)]}function yI(a,s,i){const r=i.getRegistry(),l=r.addSource(a,s);return[l,()=>r.removeSource(l)]}function Pg(a,s,i,r){let l;if(l!==void 0)return!!l;if(a===s)return!0;if(typeof a!="object"||!a||typeof s!="object"||!s)return!1;const u=Object.keys(a),d=Object.keys(s);if(u.length!==d.length)return!1;const p=Object.prototype.hasOwnProperty.bind(s);for(let m=0;m<u.length;m++){const f=u[m];if(!p(f))return!1;const v=a[f],_=s[f];if(l=void 0,l===!1||l===void 0&&v!==_)return!1}return!0}function Bg(a){return a!==null&&typeof a=="object"&&Object.prototype.hasOwnProperty.call(a,"current")}function _I(a){if(typeof a.type=="string")return;const s=a.type.displayName||a.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${s} into a <div>, or turn it into a drag source or a drop target itself.`)}function wI(a){return(s=null,i=null)=>{if(!kw(s)){const u=s;return a(u,i),u}const r=s;return _I(r),CI(r,i?u=>a(u,i):a)}}function sC(a){const s={};return Object.keys(a).forEach(i=>{const r=a[i];if(i.endsWith("Ref"))s[i]=a[i];else{const l=wI(r);s[i]=()=>l}}),s}function b_(a,s){typeof a=="function"?a(s):a.current=s}function CI(a,s){const i=a.ref;return Ie(typeof i!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),i?kg(a,{ref:r=>{b_(i,r),b_(s,r)}}):kg(a,{ref:s})}class TI{receiveHandlerId(s){this.handlerId!==s&&(this.handlerId=s,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(s){this.dragSourceOptionsInternal=s}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(s){this.dragPreviewOptionsInternal=s}reconnect(){const s=this.reconnectDragSource();this.reconnectDragPreview(s)}reconnectDragSource(){const s=this.dragSource,i=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return i&&this.disconnectDragSource(),this.handlerId?s?(i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=s,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,s,this.dragSourceOptions)),i):(this.lastConnectedDragSource=s,i):i}reconnectDragPreview(s=!1){const i=this.dragPreview,r=s||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(r&&this.disconnectDragPreview(),!!this.handlerId){if(!i){this.lastConnectedDragPreview=i;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=i,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,i,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Pg(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Pg(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(s){this.hooks=sC({dragSource:(i,r)=>{this.clearDragSource(),this.dragSourceOptions=r||null,Bg(i)?this.dragSourceRef=i:this.dragSourceNode=i,this.reconnectDragSource()},dragPreview:(i,r)=>{this.clearDragPreview(),this.dragPreviewOptions=r||null,Bg(i)?this.dragPreviewRef=i:this.dragPreviewNode=i,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=s}}class kI{get connectTarget(){return this.dropTarget}reconnect(){const s=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();s&&this.disconnectDropTarget();const i=this.dropTarget;if(this.handlerId){if(!i){this.lastConnectedDropTarget=i;return}s&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=i,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,i,this.dropTargetOptions))}}receiveHandlerId(s){s!==this.handlerId&&(this.handlerId=s,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(s){this.dropTargetOptionsInternal=s}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Pg(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(s){this.hooks=sC({dropTarget:(i,r)=>{this.clearDropTarget(),this.dropTargetOptions=r,Bg(i)?this.dropTargetRef=i:this.dropTargetNode=i,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=s}}function Mn(){const{dragDropManager:a}=Xr(Vw);return Ie(a!=null,"Expected drag drop context"),a}function SI(a,s){const i=Mn(),r=rs(()=>new TI(i.getBackend()),[i]);return Ci(()=>(r.dragSourceOptions=a||null,r.reconnect(),()=>r.disconnectDragSource()),[r,a]),Ci(()=>(r.dragPreviewOptions=s||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,s]),r}function EI(){const a=Mn();return rs(()=>new $I(a),[a])}class II{beginDrag(){const s=this.spec,i=this.monitor;let r=null;return typeof s.item=="object"?r=s.item:typeof s.item=="function"?r=s.item(i):r={},r??null}canDrag(){const s=this.spec,i=this.monitor;return typeof s.canDrag=="boolean"?s.canDrag:typeof s.canDrag=="function"?s.canDrag(i):!0}isDragging(s,i){const r=this.spec,l=this.monitor,{isDragging:u}=r;return u?u(l):i===s.getSourceId()}endDrag(){const s=this.spec,i=this.monitor,r=this.connector,{end:l}=s;l&&l(i.getItem(),i),r.reconnect()}constructor(s,i,r){this.spec=s,this.monitor=i,this.connector=r}}function xI(a,s,i){const r=rs(()=>new II(a,s,i),[s,i]);return Mt(()=>{r.spec=a},[a]),r}function DI(a){return rs(()=>{const s=a.type;return Ie(s!=null,"spec.type must be defined"),s},[a])}function AI(a,s,i){const r=Mn(),l=xI(a,s,i),u=DI(a);Ci(function(){if(u!=null){const[p,m]=yI(u,l,r);return s.receiveHandlerId(p),i.receiveHandlerId(p),m}},[r,s,i,l,u])}function RI(a,s){const i=tC(a);Ie(!i.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=EI(),l=SI(i.options,i.previewOptions);return AI(i,r,l),[eC(i.collect,r,l),mI(l),fI(l)]}function OI(a){return rs(()=>a.hooks.dropTarget(),[a])}function MI(a){const s=Mn(),i=rs(()=>new kI(s.getBackend()),[s]);return Ci(()=>(i.dropTargetOptions=a||null,i.reconnect(),()=>i.disconnectDropTarget()),[a]),i}function NI(){const a=Mn();return rs(()=>new bI(a),[a])}function LI(a){const{accept:s}=a;return rs(()=>(Ie(a.accept!=null,"accept must be defined"),Array.isArray(s)?s:[s]),[s])}class PI{canDrop(){const s=this.spec,i=this.monitor;return s.canDrop?s.canDrop(i.getItem(),i):!0}hover(){const s=this.spec,i=this.monitor;s.hover&&s.hover(i.getItem(),i)}drop(){const s=this.spec,i=this.monitor;if(s.drop)return s.drop(i.getItem(),i)}constructor(s,i){this.spec=s,this.monitor=i}}function BI(a,s){const i=rs(()=>new PI(a,s),[s]);return Mt(()=>{i.spec=a},[a]),i}function jI(a,s,i){const r=Mn(),l=BI(a,s),u=LI(a);Ci(function(){const[p,m]=vI(u,l,r);return s.receiveHandlerId(p),i.receiveHandlerId(p),m},[r,s,l,i,u.map(d=>d.toString()).join("|")])}function FI(a,s){const i=tC(a),r=NI(),l=MI(i.options);return jI(i,r,l),[eC(i.collect,r,l),OI(l)]}function oC(a){let s=null;return()=>(s==null&&(s=a()),s)}function zI(a,s){return a.filter(i=>i!==s)}function UI(a,s){const i=new Set,r=u=>i.add(u);a.forEach(r),s.forEach(r);const l=[];return i.forEach(u=>l.push(u)),l}class HI{enter(s){const i=this.entered.length,r=l=>this.isNodeInDocument(l)&&(!l.contains||l.contains(s));return this.entered=UI(this.entered.filter(r),[s]),i===0&&this.entered.length>0}leave(s){const i=this.entered.length;return this.entered=zI(this.entered.filter(this.isNodeInDocument),s),i>0&&this.entered.length===0}reset(){this.entered=[]}constructor(s){this.entered=[],this.isNodeInDocument=s}}class WI{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(s=>{Object.defineProperty(this.item,s,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${s}" until the drop event.`),null}})})}loadDataTransfer(s){if(s){const i={};Object.keys(this.config.exposeProperties).forEach(r=>{const l=this.config.exposeProperties[r];l!=null&&(i[r]={value:l(s,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,i)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(s,i){return i===s.getSourceId()}endDrag(){}constructor(s){this.config=s,this.item={},this.initializeExposedProperties()}}const iC="__NATIVE_FILE__",nC="__NATIVE_URL__",rC="__NATIVE_TEXT__",aC="__NATIVE_HTML__",v_=Object.freeze(Object.defineProperty({__proto__:null,FILE:iC,HTML:aC,TEXT:rC,URL:nC},Symbol.toStringTag,{value:"Module"}));function Qp(a,s,i){const r=s.reduce((l,u)=>l||a.getData(u),"");return r??i}const jg={[iC]:{exposeProperties:{files:a=>Array.prototype.slice.call(a.files),items:a=>a.items,dataTransfer:a=>a},matchesTypes:["Files"]},[aC]:{exposeProperties:{html:(a,s)=>Qp(a,s,""),dataTransfer:a=>a},matchesTypes:["Html","text/html"]},[nC]:{exposeProperties:{urls:(a,s)=>Qp(a,s,"").split(`
92
+ `),dataTransfer:a=>a},matchesTypes:["Url","text/uri-list"]},[rC]:{exposeProperties:{text:(a,s)=>Qp(a,s,""),dataTransfer:a=>a},matchesTypes:["Text","text/plain"]}};function VI(a,s){const i=jg[a];if(!i)throw new Error(`native type ${a} has no configuration`);const r=new WI(i);return r.loadDataTransfer(s),r}function eg(a){if(!a)return null;const s=Array.prototype.slice.call(a.types||[]);return Object.keys(jg).filter(i=>{const r=jg[i];return r!=null&&r.matchesTypes?r.matchesTypes.some(l=>s.indexOf(l)>-1):!1})[0]||null}const GI=oC(()=>/firefox/i.test(navigator.userAgent)),lC=oC(()=>!!window.safari);class y_{interpolate(s){const{xs:i,ys:r,c1s:l,c2s:u,c3s:d}=this;let p=i.length-1;if(s===i[p])return r[p];let m=0,f=d.length-1,v;for(;m<=f;){v=Math.floor(.5*(m+f));const k=i[v];if(k<s)m=v+1;else if(k>s)f=v-1;else return r[v]}p=Math.max(0,f);const _=s-i[p],y=_*_;return r[p]+l[p]*_+u[p]*y+d[p]*_*y}constructor(s,i){const{length:r}=s,l=[];for(let k=0;k<r;k++)l.push(k);l.sort((k,C)=>s[k]<s[C]?-1:1);const u=[],d=[];let p,m;for(let k=0;k<r-1;k++)p=s[k+1]-s[k],m=i[k+1]-i[k],u.push(p),d.push(m/p);const f=[d[0]];for(let k=0;k<u.length-1;k++){const C=d[k],w=d[k+1];if(C*w<=0)f.push(0);else{p=u[k];const E=u[k+1],R=p+E;f.push(3*R/((R+E)/C+(R+p)/w))}}f.push(d[d.length-1]);const v=[],_=[];let y;for(let k=0;k<f.length-1;k++){y=d[k];const C=f[k],w=1/u[k],E=C+f[k+1]-y-y;v.push((y-C-E)*w),_.push(E*w*w)}this.xs=s,this.ys=i,this.c1s=f,this.c2s=v,this.c3s=_}}const KI=1;function cC(a){const s=a.nodeType===KI?a:a.parentElement;if(!s)return null;const{top:i,left:r}=s.getBoundingClientRect();return{x:r,y:i}}function sc(a){return{x:a.clientX,y:a.clientY}}function YI(a){var s;return a.nodeName==="IMG"&&(GI()||!(!((s=document.documentElement)===null||s===void 0)&&s.contains(a)))}function JI(a,s,i,r){let l=a?s.width:i,u=a?s.height:r;return lC()&&a&&(u/=window.devicePixelRatio,l/=window.devicePixelRatio),{dragPreviewWidth:l,dragPreviewHeight:u}}function qI(a,s,i,r,l){const u=YI(s),p=cC(u?a:s),m={x:i.x-p.x,y:i.y-p.y},{offsetWidth:f,offsetHeight:v}=a,{anchorX:_,anchorY:y}=r,{dragPreviewWidth:k,dragPreviewHeight:C}=JI(u,s,f,v),w=()=>{let se=new y_([0,.5,1],[m.y,m.y/v*C,m.y+C-v]).interpolate(y);return lC()&&u&&(se+=(window.devicePixelRatio-1)*C),se},E=()=>new y_([0,.5,1],[m.x,m.x/f*k,m.x+k-f]).interpolate(_),{offsetX:R,offsetY:D}=l,A=R===0||R,J=D===0||D;return{x:A?R:E(),y:J?D:w()}}let XI=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var s;return!((s=this.globalContext)===null||s===void 0)&&s.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var s;return((s=this.optionsArgs)===null||s===void 0?void 0:s.rootElement)||this.window}constructor(s,i){this.ownerDocument=null,this.globalContext=s,this.optionsArgs=i}};function ZI(a,s,i){return s in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function __(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},r=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),r.forEach(function(l){ZI(a,l,i[l])})}return a}class QI{profile(){var s,i;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((s=this.dragStartSourceIds)===null||s===void 0?void 0:s.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((i=this.dragOverTargetIds)===null||i===void 0?void 0:i.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const s=this.rootElement;if(s!==void 0){if(s.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");s.__isReactDndBackendSetUp=!0,this.addEventListeners(s)}}teardown(){const s=this.rootElement;if(s!==void 0&&(s.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var i;(i=this.window)===null||i===void 0||i.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(s,i,r){return this.sourcePreviewNodeOptions.set(s,r),this.sourcePreviewNodes.set(s,i),()=>{this.sourcePreviewNodes.delete(s),this.sourcePreviewNodeOptions.delete(s)}}connectDragSource(s,i,r){this.sourceNodes.set(s,i),this.sourceNodeOptions.set(s,r);const l=d=>this.handleDragStart(d,s),u=d=>this.handleSelectStart(d);return i.setAttribute("draggable","true"),i.addEventListener("dragstart",l),i.addEventListener("selectstart",u),()=>{this.sourceNodes.delete(s),this.sourceNodeOptions.delete(s),i.removeEventListener("dragstart",l),i.removeEventListener("selectstart",u),i.setAttribute("draggable","false")}}connectDropTarget(s,i){const r=d=>this.handleDragEnter(d,s),l=d=>this.handleDragOver(d,s),u=d=>this.handleDrop(d,s);return i.addEventListener("dragenter",r),i.addEventListener("dragover",l),i.addEventListener("drop",u),()=>{i.removeEventListener("dragenter",r),i.removeEventListener("dragover",l),i.removeEventListener("drop",u)}}addEventListeners(s){s.addEventListener&&(s.addEventListener("dragstart",this.handleTopDragStart),s.addEventListener("dragstart",this.handleTopDragStartCapture,!0),s.addEventListener("dragend",this.handleTopDragEndCapture,!0),s.addEventListener("dragenter",this.handleTopDragEnter),s.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),s.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),s.addEventListener("dragover",this.handleTopDragOver),s.addEventListener("dragover",this.handleTopDragOverCapture,!0),s.addEventListener("drop",this.handleTopDrop),s.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(s){s.removeEventListener&&(s.removeEventListener("dragstart",this.handleTopDragStart),s.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),s.removeEventListener("dragend",this.handleTopDragEndCapture,!0),s.removeEventListener("dragenter",this.handleTopDragEnter),s.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),s.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),s.removeEventListener("dragover",this.handleTopDragOver),s.removeEventListener("dragover",this.handleTopDragOverCapture,!0),s.removeEventListener("drop",this.handleTopDrop),s.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const s=this.monitor.getSourceId(),i=this.sourceNodeOptions.get(s);return __({dropEffect:this.altKeyPressed?"copy":"move"},i||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const s=this.monitor.getSourceId(),i=this.sourcePreviewNodeOptions.get(s);return __({anchorX:.5,anchorY:.5,captureDraggingState:!1},i||{})}isDraggingNativeItem(){const s=this.monitor.getItemType();return Object.keys(v_).some(i=>v_[i]===s)}beginDragNativeItem(s,i){this.clearCurrentDragSourceNode(),this.currentNativeSource=VI(s,i),this.currentNativeHandle=this.registry.addSource(s,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(s){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=s;const i=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var r;return(r=this.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},i)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var s;(s=this.window)===null||s===void 0||s.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(s,i){s.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(i))}handleDragEnter(s,i){this.dragEnterTargetIds.unshift(i)}handleDragOver(s,i){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(i)}handleDrop(s,i){this.dropTargetIds.unshift(i)}constructor(s,i,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=l=>{const u=this.sourceNodes.get(l);return u&&cC(u)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=l=>!!(l&&this.document&&this.document.body&&this.document.body.contains(l)),this.endDragIfSourceWasRemovedFromDOM=()=>{const l=this.currentDragSourceNode;l==null||this.isNodeInDocument(l)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=l=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(l||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=l=>{if(l.defaultPrevented)return;const{dragStartSourceIds:u}=this;this.dragStartSourceIds=null;const d=sc(l);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(u||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:d});const{dataTransfer:p}=l,m=eg(p);if(this.monitor.isDragging()){if(p&&typeof p.setDragImage=="function"){const v=this.monitor.getSourceId(),_=this.sourceNodes.get(v),y=this.sourcePreviewNodes.get(v)||_;if(y){const{anchorX:k,anchorY:C,offsetX:w,offsetY:E}=this.getCurrentSourcePreviewNodeOptions(),A=qI(_,y,d,{anchorX:k,anchorY:C},{offsetX:w,offsetY:E});p.setDragImage(y,A.x,A.y)}}try{p==null||p.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(l.target);const{captureDraggingState:f}=this.getCurrentSourcePreviewNodeOptions();f?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(m)this.beginDragNativeItem(m);else{if(p&&!p.types&&(l.target&&!l.target.hasAttribute||!l.target.hasAttribute("draggable")))return;l.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=l=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var u;(u=this.currentNativeSource)===null||u===void 0||u.loadDataTransfer(l.dataTransfer)}if(!this.enterLeaveCounter.enter(l.target)||this.monitor.isDragging())return;const{dataTransfer:p}=l,m=eg(p);m&&this.beginDragNativeItem(m,p)},this.handleTopDragEnter=l=>{const{dragEnterTargetIds:u}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=l.altKey,u.length>0&&this.actions.hover(u,{clientOffset:sc(l)}),u.some(p=>this.monitor.canDropOnTarget(p))&&(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=l=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var u;(u=this.currentNativeSource)===null||u===void 0||u.loadDataTransfer(l.dataTransfer)}},this.handleTopDragOver=l=>{const{dragOverTargetIds:u}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect="none");return}this.altKeyPressed=l.altKey,this.lastClientOffset=sc(l),this.scheduleHover(u),(u||[]).some(p=>this.monitor.canDropOnTarget(p))?(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?l.preventDefault():(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=l=>{this.isDraggingNativeItem()&&l.preventDefault(),this.enterLeaveCounter.leave(l.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=l=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var u;l.preventDefault(),(u=this.currentNativeSource)===null||u===void 0||u.loadDataTransfer(l.dataTransfer)}else eg(l.dataTransfer)&&l.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=l=>{const{dropTargetIds:u}=this;this.dropTargetIds=[],this.actions.hover(u,{clientOffset:sc(l)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=l=>{const u=l.target;typeof u.dragDrop=="function"&&(u.tagName==="INPUT"||u.tagName==="SELECT"||u.tagName==="TEXTAREA"||u.isContentEditable||(l.preventDefault(),u.dragDrop()))},this.options=new XI(i,r),this.actions=s.getActions(),this.monitor=s.getMonitor(),this.registry=s.getRegistry(),this.enterLeaveCounter=new HI(this.isNodeInDocument)}}const uC=function(s,i,r){return new QI(s,i,r)},ex=ht([g.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),g.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),tx=ht(g.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox"),sx=ht(g.jsx("path",{d:"M4 8h4V4H4zm6 12h4v-4h-4zm-6 0h4v-4H4zm0-6h4v-4H4zm6 0h4v-4h-4zm6-10v4h4V4zm-6 4h4V4h-4zm6 6h4v-4h-4zm0 6h4v-4h-4z"}),"Apps"),ox=ht(g.jsx("path",{d:"M9 2c-1.05 0-2.05.16-3 .46 4.06 1.27 7 5.06 7 9.54s-2.94 8.27-7 9.54c.95.3 1.95.46 3 .46 5.52 0 10-4.48 10-10S14.52 2 9 2"}),"Brightness3"),ix=ht(g.jsx("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20zm-6 8h-4v-2h4zm0-4h-4v-2h4z"}),"BugReport"),nx=ht(g.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2zm-1 7h5.5L14 6.5z"}),"FileCopy"),rx=ht(g.jsx("path",{d:"M7 2v11h3v9l7-12h-4l4-8z"}),"FlashOn"),ax=ht(g.jsx("path",{d:"M3.27 5 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5z"}),"FormatClear"),lx=ht(g.jsx("path",{d:"M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z"}),"Functions"),dC=ht(g.jsx("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutline"),cx=ht(g.jsx("path",{d:"M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2M11 16l4-4-4-4v3H1v2h10z"}),"Input"),w_=ht(g.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"}),"Lock"),ux=ht(g.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreVert"),dx=ht(g.jsx("path",{d:"M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.61-.23-1.2-.64-1.67-.08-.1-.13-.21-.13-.33 0-.28.22-.5.5-.5H16c3.31 0 6-2.69 6-6 0-4.96-4.49-9-10-9m5.5 11c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m-3-4c-.83 0-1.5-.67-1.5-1.5S13.67 6 14.5 6s1.5.67 1.5 1.5S15.33 9 14.5 9M5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S7.33 13 6.5 13 5 12.33 5 11.5m6-4c0 .83-.67 1.5-1.5 1.5S8 8.33 8 7.5 8.67 6 9.5 6s1.5.67 1.5 1.5"}),"Palette"),gc=ht(g.jsx("path",{d:"M6 19h4V5H6zm8-14v14h4V5z"}),"Pause"),Fg=ht(g.jsx("path",{d:"M8 5v14l11-7z"}),"PlayArrow"),hx=ht(g.jsx("path",{d:"M11 5v5.59H7.5l4.5 4.5 4.5-4.5H13V5zm-5 9c0 3.31 2.69 6 6 6s6-2.69 6-6h-2c0 2.21-1.79 4-4 4s-4-1.79-4-4z"}),"PlayForWork"),px=ht(g.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search"),gx=ht(g.jsx("path",{d:"M10.59 9.17 5.41 4 4 5.41l5.17 5.17zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4zm.33 9.41-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04z"}),"Shuffle"),mx=ht(g.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}),"Storage"),fx=ht(g.jsx("path",{d:"M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z"}),"Subject"),$x=ht(g.jsx("path",{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99zM9 3 5 6.99h3V14h2V6.99h3z"}),"SwapVert"),bx=ht(g.jsx("path",{d:"M7.41 18.59 8.83 20 12 16.83 15.17 20l1.41-1.41L12 14zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10z"}),"UnfoldLess"),vx=ht(g.jsx("path",{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15z"}),"UnfoldMore"),_c="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='512'%20height='512'%20shape-rendering='geometricPrecision'%20image-rendering='optimizeQuality'%20fill-rule='evenodd'%20xmlns:v='https://vecta.io/nano'%3e%3cpath%20fill='%23efda4e'%20d='M-.5-.5h512v512H-.5V-.5z'/%3e%3cpath%20fill='%23020100'%20d='M308.5%20287.5c1.777-3.005%202.777-6.338%203-10%209.147-21.963%2025.48-35.463%2049-40.5%2021.999-4.173%2043.666-2.84%2065%204%2014.575%205.411%2025.575%2014.911%2033%2028.5l-1%202c-12.413%205.624-24.58%2011.624-36.5%2018-5.321-8.25-12.821-13.417-22.5-15.5-13.957-3.122-27.29-1.455-40%205-8.125%205.36-10.958%2012.86-8.5%2022.5%203.223%206.223%208.057%2010.723%2014.5%2013.5l64%2020c38.459%2016.085%2052.626%2044.585%2042.5%2085.5-7.572%2026.208-24.738%2042.041-51.5%2047.5-25.102%205.733-49.768%204.4-74-4-19.291-8.625-32.291-22.958-39-43%2011.266-8.887%2023.433-16.387%2036.5-22.5%203.117%206.896%206.784%2013.563%2011%2020%2012.705%2012.307%2027.872%2016.807%2045.5%2013.5%2022.189-3.504%2032.355-16.338%2030.5-38.5-2.833-6.833-7.667-11.667-14.5-14.5l-57-17c-36.004-11.84-52.67-36.673-50-74.5z'/%3e%3cpath%20fill='%23020200'%20d='M222.5%20238.5h43l-.5%20159c-2.688%2052.355-30.188%2076.855-82.5%2073.5-24.871-3.543-41.204-17.21-49-41l.5-2.5a12.14%2012.14%200%200%200%204.5-3.5c10.653-5.825%2021.32-11.325%2032-16.5%204.763%2021.72%2017.763%2028.887%2039%2021.5%204.616-2.618%207.783-6.451%209.5-11.5%201.163-5.968%202.163-11.968%203-18l.5-161z'/%3e%3cpath%20fill='%23615820'%20d='M311.5%20277.5c-.223%203.662-1.223%206.995-3%2010%20.223-3.662%201.223-6.995%203-10z'/%3e%3c/svg%3e",hC="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20500%20500'%3e%3cpath%20fill='%234285f4'%20d='M44.271%2027.275l206.5%201v170l-58.5-36.5c-7.005-.916-12.505%201.584-16.5%207.5v147c4.625%204.412%2010.125%206.245%2016.5%205.5l57.5-35.5c.833%2054.003%201.356%20108.003.189%20162-1.272.546-45.599-.242-48.689%201.121-3.674%207.844-4.79%2011.207-13%2023.879-4.372%205.527-2.19%204.097-10.689%2012.258-5.166%202.748-4.191%203.45-14.311%206.242-17.67%201.983-35.336%201.983-53%200-9.535-3.774-10.879-4.163-18.526-11.22-5.562-4.39-11.131-11.803-11.974-15.28-4.068-7.881-3.42-9.116-5.5-13.5-3.672-1.503-35.798.203-40.746-1.335-5.823-2.314-2.946-.422-7.954-3.689-2.888-2.668-2.255-3.221-2.421-9.904L20.771%2050.275c.36-2.108-.41-5.806%202.522-11.615%204.343-5.852%205.374-7%2010.061-9.146%206.083-2.73%208.677-1.475%2010.917-2.239z'/%3e%3cpath%20d='M258.271%2030.275l154.63.407c5.654.559%2010.783%203.17%2014.37%207.093%204.907%204.408%206.204%208.723%207.5%2013.5v373c-.208%205.716-.297%207.982-4.848%2015.404-7.078%206.393-9.879%206.39-15.652%206.692-24.804%201.296-50.079%201.189-74.96%201.041-24.516-.014-68.46.89-81.5.391l-2.512-172.528c-20.083%2012.625-42.777%2025.125-63.028%2037.5-4.127%201.292-7.294.125-9.5-3.5l1-137c1.864-2.707%204.364-3.541%207.5-2.5%2020.366%2013.427%2064.35%2038.947%2065.581%2038.339l1.419-177.839z'%20fill='%23DDD'/%3e%3c/svg%3e",pC="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20width='32'%20height='32'%3e%3cpath%20fill='%23007acc'%20d='M-.5-.5h503l-1%20179h10v333h-421v-7h-91V-.5z'/%3e%3cpath%20fill='%230f81cf'%20d='M502.5-.5h9v179h-10l1-179z'/%3e%3cpath%20fill='%23fdfefe'%20d='M470.5%20227.5c.33%2017.508-.003%2034.841-1%2052-23.486-15.709-48.82-19.875-76-12.5-15.89%208.078-19.39%2019.911-10.5%2035.5%204.673%205.577%2010.173%2010.077%2016.5%2013.5l38%2019c17.945%209.278%2031.112%2023.112%2039.5%2041.5%201.352%203.22%202.186%206.553%202.5%2010a305.16%20305.16%200%200%201%201%2026c-3.553%2033.726-21.886%2054.559-55%2062.5-34.769%207.363-68.435%204.196-101-9.5-.167-19.003%200-38.003.5-57%2022.903%2021.314%2049.736%2029.147%2080.5%2023.5%2019.435-5.701%2025.268-17.868%2017.5-36.5-4.718-6.44-10.552-11.606-17.5-15.5a1552.42%201552.42%200%200%201-47-24c-27.679-19.331-38.846-45.831-33.5-79.5%206.43-26.433%2022.597-43.933%2048.5-52.5%2026.131-6.625%2052.464-7.292%2079-2a565.56%20565.56%200%200%201%2018%205.5z'/%3e%3cpath%20fill='%23fefefe'%20d='M122.5%20222.5h182v46h-65v206h-52v-206h-65v-46z'/%3e%3cpath%20fill='%2370b3e1'%20d='M470.5%20227.5c1.327%2017.505%201.327%2035.171%200%2053-.607-.124-.94-.457-1-1%20.997-17.159%201.33-34.492%201-52z'/%3e%3cpath%20fill='%236cafe0'%20d='M479.5%20386.5c1.465%205.09%202.132%2010.423%202%2016-.002%203.518-.335%206.851-1%2010a305.16%20305.16%200%200%200-1-26z'/%3e%3cpath%20fill='%231283cf'%20d='M-.5%20504.5h91v7h-91v-7z'/%3e%3c/svg%3e",gC="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIj4KICAgIDxyYWRpYWxHcmFkaWVudCBpZD0ibXlHcmFkaWVudCI+CiAgICAgICAgPHN0b3Agb2Zmc2V0PSIxMCUiIHN0b3AtY29sb3I9IiMxQzJENUYiIC8+CiAgICAgICAgPHN0b3Agb2Zmc2V0PSI5NSUiIHN0b3AtY29sb3I9IiMwQjFENTMiIC8+CiAgICA8L3JhZGlhbEdyYWRpZW50PgogICAgPHBhdGggZmlsbD0idXJsKCcjbXlHcmFkaWVudCcpIiBkPSJNLS4xLS4xaDUxMnY1MTJILS4xVi0uMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNmOGY4ZmEiCiAgICAgICAgICBkPSJNNDgyLjUgMjMxLjV2NmgtMjVjLS45NzItOC4xNy01LjYzOS0xMi4xNy0xNC0xMi05LjUzMS4wMjktMTMuMzY1IDQuNjk1LTExLjUgMTRsNC41IDQuNSAzMyA4YzE5LjM4OCA5LjYzNCAyMy4zODggMjMuODAxIDEyIDQyLjVhMzUuMDYgMzUuMDYgMCAwIDAtOCA2Yy0xMy45MjUgNC43NjEtMjguMjU4IDYuMjYxLTQzIDQuNS0xMC42MDEtMS4wMjQtMTguOTM1LTUuODU3LTI1LTE0LjUtMS4wNzctMi4yMjktMS43NDQtNC41NjMtMi03di04aDI1YzEuNDk1IDQuMjc5IDMuODI4IDguMTEzIDcgMTEuNSA3LjQ3OCAyLjI1OCAxNC44MTEgMS45MjUgMjItMSAyLjg5NC0yLjkwOSAzLjcyNy02LjQwOSAyLjUtMTAuNWEzNi44IDM2LjggMCAwIDAtMTIuNS01LjUgNTM5Ljc5IDUzOS43OSAwIDAgMS0yOC04Yy0xMi44NzQtNi41NjItMTcuNzA3LTE3LjA2Mi0xNC41LTMxLjUgMy41Ny0xMC41NjkgMTAuNzM3LTE3LjQwMyAyMS41LTIwLjUgMTYuMTQ4LTQuNTM5IDMxLjQ4Mi0yLjcwNiA0NiA1LjUgMiAyLjY2NyA0LjMzMyA1IDcgNyAxLjg3MSAyLjczNCAyLjg3MSA1LjczNCAzIDl6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTRhYmJmIiBkPSJNMTUzLjUgMjA5LjVjLjA2LS41NDMuMzkzLS44NzYgMS0xYTEwMjQuNjMgMTAyNC42MyAwIDAgMSAxIDY0bC0yLTYzeiIvPgogICAgPHBhdGggZmlsbD0iI2ZhZmJmYyIKICAgICAgICAgIGQ9Ik0xNTMuNSAyMDkuNWwyIDYzYzEuMjc4IDExLjQ0NCA3LjYxMSAxNi4yNzcgMTkgMTQuNSA4LjcwNC0xLjM3OCAxMy4yMDQtNi41NDQgMTMuNS0xNS41LjUtMjAuNjY0LjY2Ny00MS4zMzEuNS02MiA5Ljc0My0uMjE5IDE5LjQwOS0uMjE5IDI5IDAgLjQwMSAyMy4zNjItLjA5OSA0Ni42OTYtMS41IDcwLTQuMjk4IDE0Ljk2OC0xNC4xMzEgMjMuNDY4LTI5LjUgMjUuNWEyMjUuMTQgMjI1LjE0IDAgMCAxLTMwIDBjLTE1LjgyMi0yLjE1NS0yNS42NTUtMTAuOTg4LTI5LjUtMjYuNWwtLjUtNjloMjd6Ii8+CiAgICA8cGF0aCBmaWxsPSIjZmVmZWZlIgogICAgICAgICAgZD0iTTIzMy41IDIwOS41aDI3Yy0uMzMxIDI1LjE3Mi4wMDIgNTAuMTcyIDEgNzUgMCAuNjY3LjMzMyAxIDEgMSAxMy4xNTYuOTk2IDI2LjQ5IDEuMzI5IDQwIDF2MTdoLTY5di05NHoiLz4KICAgIDxwYXRoIGZpbGw9IiNhNWFjYmYiIGQ9Ik0yMzMuNSAyMDkuNWM5LjE1Mi0uOTk0IDE4LjQ4NS0xLjMyNyAyOC0xdjc2Yy0uOTk4LTI0LjgyOC0xLjMzMS00OS44MjgtMS03NWgtMjd6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTdhZWMxIiBkPSJNMzE2LjUgMjA5LjVoNzNjLjMyMyA2LjE5LS4wMSAxMi4xOS0xIDE4di0xN2MtMjQuMTcyLjMzMS00OC4xNzItLjAwMi03Mi0xeiIvPgogICAgPHBhdGggZmlsbD0iI2E1YWNjMCIgZD0iTTg1LjUgMjEwLjVoLTU5djkzaDI3Yy0uMzI4LTExLjE3OS4wMDUtMjIuMTc5IDEtMzN2MzRoLTI5di05NWE5MDAuOTggOTAwLjk4IDAgMCAxIDYwIDF6Ii8+CiAgICA8cGF0aCBmaWxsPSIjZmNmY2ZjIgogICAgICAgICAgZD0iTTg1LjUgMjEwLjVjMjIuMjIzIDMuNzU4IDI5LjU1NiAxNi40MjUgMjIgMzgtNC4yMjggNS4zOTctOS4yMjggOS44OTctMTUgMTMuNS0xLjMwNS44MDQtMS45NzEgMS45NzEtMiAzLjVsMjMgMzZjLTQuNDUxIDEuMzI3LTkuMjg0IDEuOTk0LTE0LjUgMmExMjguMTkgMTI4LjE5IDAgMCAxLTE1LjUtMWMtNi45NTUtMTAuMzI2LTEzLjQ1NS0yMC45OTItMTkuNS0zMi0zLjI2OS0xLjMxOC02LjQzNS0xLjMxOC05LjUgMC0uOTk1IDEwLjgyMS0xLjMyOCAyMS44MjEtMSAzM2gtMjd2LTkzaDU5eiIvPgogICAgPHBhdGggZmlsbD0iI2ZlZmVmZSIKICAgICAgICAgIGQ9Ik0zMTYuNSAyMDkuNWMyMy44MjguOTk4IDQ3LjgyOCAxLjMzMSA3MiAxdjE3Yy0xNC42Ny0uMTY3LTI5LjMzNyAwLTQ0IC41LTEuMzI2IDYuNTk5LTEuMzI2IDEzLjA5OSAwIDE5LjUgMTQuNDkuOTk2IDI5LjE1NyAxLjMyOSA0NCAxdjE2Yy0xNC44NDMtLjMyOS0yOS41MS4wMDQtNDQgMWE1MC41MSA1MC41MSAwIDAgMCAwIDIwYzE0LjQ5Ljk5NiAyOS4xNTcgMS4zMjkgNDQgMXYxN2gtNzNjLS4zMzItMzEuNTA0LjAwMi02Mi44MzggMS05NHoiLz4KICAgIDxwYXRoIGZpbGw9IiMxODI3NWIiCiAgICAgICAgICBkPSJNNTUuNSAyMjkuNWM3LjA4OS0uMzg0IDE0LjA4OS4xMTYgMjEgMS41IDMuNDAxIDEuMzIgNC43MzUgMy44MiA0IDcuNWwtLjUgNWMtMS43NzEuODA0LTMuMjcxIDEuOTcxLTQuNSAzLjUtNi41OTIgMS4zMjktMTMuMjU5IDEuODI5LTIwIDEuNXYtMTl6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTVhY2MwIiBkPSJNNDgyLjUgMjMxLjVjLjk2OCAyLjEwNyAxLjMwMiA0LjQ0MSAxIDctOC44NDkuMzI2LTE3LjUxNi0uMDA3LTI2LTFoMjV2LTZ6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTZhZGMwIiBkPSJNMzQ0LjUgMjQ3LjVoNDV2MThoLTQ1YzE0LjQ5LS45OTYgMjkuMTU3LTEuMzI5IDQ0LTF2LTE2Yy0xNC44NDMuMzI5LTI5LjUxLS4wMDQtNDQtMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNhMmE5YmUiIGQ9Ik00MjguNSAyNzUuNWgtMjV2OGMtLjk3Ny0yLjc4Ny0xLjMxLTUuNzg3LTEtOSA4Ljg0OS0uMzI2IDE3LjUxNi4wMDcgMjYgMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNhNWFjYmYiCiAgICAgICAgICBkPSJNMTEzLjUgMzAxLjVjLjk3OC4zMTEgMS42NDUuOTc4IDIgMmwtMTYgMWMtNS43MTEtLjAwNS0xMS4wNDQtLjY3Mi0xNi0yYTEyOC4xOSAxMjguMTkgMCAwIDAgMTUuNSAxYzUuMjE2LS4wMDYgMTAuMDQ5LS42NzMgMTQuNS0yeiIvPgogICAgPHBhdGggZmlsbD0iI2E1YWNjMCIgZD0iTTIzMy41IDIwOS41djk0aDY5di0xN2MtMTMuNTEuMzI5LTI2Ljg0NC0uMDA0LTQwLTFoNDF2MTloLTcxYTIyNTYuNDEgMjI1Ni40MSAwIDAgMSAxLTk1eiIvPgogICAgPHBhdGggZmlsbD0iI2E2YWNjMCIKICAgICAgICAgIGQ9Ik0zMTYuNSAyMDkuNWMtLjk5OCAzMS4xNjItMS4zMzIgNjIuNDk2LTEgOTRoNzN2LTE3Yy0xNC44NDMuMzI5LTI5LjUxLS4wMDQtNDQtMWg0NXYxOWgtNzVhMjMwNC45NSAyMzA0Ljk1IDAgMCAxIDEtOTZjLjYwNy4xMjQuOTQuNDU3IDEgMXoiLz4KPC9zdmc+";class $m extends Y.Component{isShowInstance;oldId;constructor(s){super(s),this.state={name:s.name,id:s.id,instance:s.instance||0,prefix:$m.getPrefix(s.id)},this.isShowInstance=!s.folder&&!!s.instances&&(!!s.instance||!!s.instances[0]||s.instances.length>1),this.oldId=s.id}static getPrefix(s){const i=(s||"").split(".");return i.pop(),i.join(".")}getId(s){return s=(s||"").replace(/[\\/\][*,;'"`<>?\s]/g,"_"),`${this.state.prefix}.${s}`}handleCancel=()=>{this.props.onClose()};handleOk=()=>{this.props.onRename(this.oldId,this.state.id,this.state.name,this.state.instance===0?0:this.state.instance||void 0),this.props.onClose()};handleChange=s=>{this.setState({name:s,id:this.getId(s)})};render(){return g.jsxs(Vt,{onClose:()=>!1,maxWidth:"md",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(as,{id:"confirmation-dialog-title",children:b.I18n.t("Rename")}),g.jsx(Gt,{children:g.jsxs("form",{noValidate:!0,autoComplete:"off",children:[g.jsx(vo,{variant:"standard",style:{width:"100%"},id:"standard-name",autoFocus:!0,label:b.I18n.t("Name"),value:this.state.name,onKeyUp:s=>{s.key==="Enter"&&(s.preventDefault(),setTimeout(()=>this.handleOk(),200))},onChange:s=>this.handleChange(s.target.value),margin:"normal"}),g.jsx(vo,{variant:"standard",id:"standard-name-id",style:{width:"100%"},label:b.I18n.t("ID"),value:this.state.id,disabled:!0,margin:"normal"}),this.isShowInstance&&g.jsxs(_i,{variant:"standard",children:[g.jsx(Eg,{htmlFor:"instance",children:b.I18n.t("Instance")}),g.jsx(wi,{variant:"standard",value:this.state.instance,onChange:s=>this.setState({instance:parseInt(s.target.value,10)}),inputProps:{name:"instance",id:"instance"},children:this.props.instances.map(s=>g.jsx(Ve,{value:s,children:s||"0"},s))})]})]})}),g.jsxs(Kt,{children:[g.jsx(De,{variant:"contained",onClick:this.handleOk,color:"primary",startIcon:g.jsx(zo,{}),children:b.I18n.t("Ok")}),g.jsx(De,{color:"grey",variant:"contained",onClick:this.handleCancel,startIcon:g.jsx(qs,{}),children:b.I18n.t("Cancel")})]})]})}}class yx extends Y.Component{constructor(s){super(s),this.state={name:s.name,id:s.id}}handleCancel=()=>{this.props.onClose()};handleOk=()=>{this.props.onDelete(this.state.id),this.props.onClose()};render(){return g.jsxs(Vt,{onClose:()=>!1,maxWidth:"md",open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(as,{id:"confirmation-dialog-title",children:b.I18n.t("Are you sure?")}),g.jsxs(Gt,{children:[g.jsx(dc,{}),g.jsx("span",{style:{fontSize:14,fontWeight:"bold"},children:b.I18n.t("Delete %s",this.state.name)})]}),g.jsxs(Kt,{children:[g.jsx(De,{variant:"contained",onClick:this.handleOk,color:"primary",startIcon:g.jsx(zo,{}),children:b.I18n.t("Ok")}),g.jsx(De,{color:"grey",variant:"contained",onClick:this.handleCancel,startIcon:g.jsx(qs,{}),children:b.I18n.t("Cancel")})]})]})}}const _x=""+new URL("tileJS-C48gYbHw.png",import.meta.url).href,wx=""+new URL("tileTS-CsXmgy4B.png",import.meta.url).href,Cx=""+new URL("tileBlockly-BMpdinN3.png",import.meta.url).href,Tx=""+new URL("tileRules-BkbaFIhs.png",import.meta.url).href,Pt={card:{maxWidth:345,minWidth:250,display:"inline-block",margin:"0 10px 0 10px"},media:{height:122},text:{maxWidth:218,minHeight:30},complexity:{fontWeight:"bold",fontStyle:"italic",marginBottom:8}};class Cn extends Y.Component{handleCancel=()=>{this.props.onClose()};static openHtml(s){const i=b.I18n.getLanguage();!s.includes("javascript.md")&&(i==="de"||i==="ru")&&(s=s.replace(/\/en\//,`/${i}/`));const r=window.open(s,"_blank");r==null||r.focus()}getJSCard(){return g.jsxs(Yl,{style:Pt.card,children:[g.jsxs(Jl,{onClick:()=>this.props.onClose&&this.props.onClose("Javascript/js"),children:[g.jsx(ql,{style:Pt.media,image:_x,title:"JavaScript"}),g.jsxs(Xl,{children:[g.jsx("h2",{children:"JavaScript"}),g.jsx("div",{style:Pt.complexity,children:b.I18n.t("for programmers")}),g.jsx("div",{style:Pt.text,children:b.I18n.t("JS description")})]})]}),g.jsxs(Zl,{children:[g.jsx(De,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Javascript/js"),children:b.I18n.t("Add")}),g.jsx(De,{size:"small",color:"secondary",onClick:()=>Cn.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:b.I18n.t("Learn More")})]})]})}getTSCard(){return g.jsxs(Yl,{style:Pt.card,children:[g.jsxs(Jl,{onClick:()=>this.props.onClose&&this.props.onClose("TypeScript/ts"),children:[g.jsx(ql,{style:Pt.media,image:wx,title:"TypeScript"}),g.jsxs(Xl,{children:[g.jsx("h2",{children:"TypeScript"}),g.jsx("div",{style:Pt.complexity,children:b.I18n.t("for professionals")}),g.jsx("div",{style:Pt.text,children:b.I18n.t("TS description")})]})]}),g.jsxs(Zl,{children:[g.jsx(De,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("TypeScript/ts"),children:b.I18n.t("Add")}),g.jsx(De,{size:"small",color:"secondary",onClick:()=>Cn.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:b.I18n.t("Learn More")})]})]})}getBlocklyCard(){return g.jsxs(Yl,{style:Pt.card,children:[g.jsxs(Jl,{onClick:()=>this.props.onClose&&this.props.onClose("Blockly"),children:[g.jsx(ql,{style:Pt.media,image:Cx,title:"Blockly"}),g.jsxs(Xl,{children:[g.jsx("h2",{children:"Blockly"}),g.jsx("div",{style:Pt.complexity,children:b.I18n.t("normal")}),g.jsx("div",{style:Pt.text,children:b.I18n.t("Blockly description")})]})]}),g.jsxs(Zl,{children:[g.jsx(De,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Blockly"),children:b.I18n.t("Add")}),g.jsx(De,{size:"small",color:"secondary",onClick:()=>Cn.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/blockly.md"),children:b.I18n.t("Learn More")})]})]})}getRulesCard(){return g.jsxs(Yl,{style:Pt.card,children:[g.jsxs(Jl,{onClick:()=>this.props.onClose&&this.props.onClose("Rules"),children:[g.jsx(ql,{style:Pt.media,image:Tx,title:"Rules"}),g.jsxs(Xl,{children:[g.jsx("h2",{children:"Rules"}),g.jsx("div",{style:Pt.complexity,children:b.I18n.t("easy")}),g.jsx("div",{style:Pt.text,children:b.I18n.t("Rules description")})]})]}),g.jsxs(Zl,{children:[g.jsx(De,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Rules"),children:b.I18n.t("Add")}),g.jsx(De,{size:"small",color:"secondary",onClick:()=>Cn.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:b.I18n.t("Learn More")})]})]})}render(){return g.jsxs(Vt,{onClose:()=>!1,maxWidth:"lg",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(as,{id:"confirmation-dialog-title",children:b.I18n.t("Add new script")}),g.jsxs(Gt,{style:{textAlign:"center"},children:[this.getRulesCard(),this.getBlocklyCard(),this.getJSCard(),this.getTSCard()]}),g.jsx(Kt,{children:g.jsx(De,{color:"grey",onClick:this.handleCancel,startIcon:g.jsx(qs,{}),children:b.I18n.t("Cancel")})})]})}}class tg extends Y.Component{isShowInstance;constructor(s){super(s),this.state={name:s.name||"Script",instance:s.instance||0,parent:s.parent,error:"",id:""},this.isShowInstance=!s.folder&&!!s.instances&&(!!s.instance||!!s.instances[0]||s.instances.length>1)}getId(s){return s=s||this.state.name||"",s=s.replace(/[\\/\][.*,;'"`<>?\s]/g,"_").trim().replace(/\.$/,"_"),`${this.state?this.state.parent:this.props.parent}.${s}`}handleOk=()=>{this.props.onAdd(this.getId(this.state.name),this.state.name,this.state.instance,this.props.type),this.props.onClose()};render(){var s;return console.log(this.state.name),g.jsxs(Vt,{onClose:()=>!1,maxWidth:"md",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(as,{id:"confirmation-dialog-title",children:this.props.title||b.I18n.t("Create new")}),g.jsx(Gt,{children:g.jsxs("form",{noValidate:!0,autoComplete:"off",children:[g.jsx(vo,{variant:"standard",style:{width:"100%"},id:"standard-name",autoFocus:!0,error:!!this.state.error,label:b.I18n.t("Name"),value:this.state.name||"",helperText:this.state.error,slotProps:{input:{endAdornment:this.state.name?g.jsx(Me,{size:"small",onClick:()=>this.setState({name:""}),children:g.jsx(Jk,{})}):void 0}},onKeyUp:i=>{i.preventDefault(),i.key==="Enter"&&!this.state.error&&setTimeout(()=>this.handleOk(),200)},onChange:i=>{var u;const r=i.target.value,l=this.getId(r);r?(u=this.props.existingItems)!=null&&u.includes(l)?this.setState({name:r,id:l,error:b.I18n.t("Duplicate name")}):(console.log(`Set name: "${r}"`),this.setState({name:r,id:l,error:""})):this.setState({name:r,id:l,error:b.I18n.t("Empty name is not allowed")})},margin:"normal"}),g.jsxs(_i,{variant:"standard",style:{width:"100%"},children:[g.jsx(Eg,{htmlFor:"parent",children:b.I18n.t("Folder")}),g.jsx(wi,{variant:"standard",style:{width:"100%"},value:this.state.parent,onChange:i=>this.setState({parent:i.target.value}),inputProps:{name:"parent",id:"parent"},children:this.props.parents.map(i=>{const r=i.id.split(".");r.splice(0,2);const l=[];let u="script.js";return r.forEach(d=>{u+=`.${d}`;const p=this.props.parents.find(m=>m.id===u);p?l.push(p.name):l.push(d)}),l.length||l.push(i.name),g.jsx(Ve,{value:i.id,children:l.join(" / ")},i.id)})})]}),g.jsx(vo,{variant:"standard",id:"standard-name-id",style:{width:"100%"},label:b.I18n.t("ID"),value:this.getId(),disabled:!0,margin:"normal"}),this.isShowInstance&&g.jsxs(_i,{variant:"standard",children:[g.jsx(Eg,{htmlFor:"instance",children:b.I18n.t("Instance")}),g.jsx(wi,{variant:"standard",value:this.state.instance,onChange:i=>this.setState({instance:parseInt(i.target.value,10)}),inputProps:{name:"instance",id:"instance"},children:(s=this.props.instances)==null?void 0:s.map(i=>g.jsx(Ve,{value:i,children:i||"0"},`instance${i}`))})]})]})}),g.jsxs(Kt,{children:[g.jsx(De,{variant:"contained",onClick:this.handleOk,disabled:!!this.state.error,color:"primary",startIcon:g.jsx(zo,{}),children:b.I18n.t("Ok")}),g.jsx(De,{color:"grey",variant:"contained",onClick:()=>this.props.onClose(),startIcon:g.jsx(qs,{}),children:b.I18n.t("Cancel")})]})]})}}const kx={title:a=>({background:a.palette.error.main,color:a.palette.error.contrastText,"&>h2":{color:a.palette.error.contrastText}})};class Zc extends Y.Component{handleOk=()=>{this.props.onClose()};render(){return g.jsxs(Vt,{open:!0,maxWidth:"sm",fullWidth:!0,onClose:()=>this.handleOk(),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[g.jsx(as,{sx:kx.title,id:"alert-dialog-title",children:this.props.title||b.I18n.t("Error")}),g.jsx(Gt,{children:g.jsx(Iw,{id:"alert-dialog-description",children:this.props.text||b.I18n.t("Unknown error!")})}),g.jsx(Kt,{children:g.jsx(De,{variant:"contained",onClick:()=>this.handleOk(),color:"primary",autoFocus:!0,startIcon:g.jsx(zo,{}),children:b.I18n.t("Ok")})})]})}}const Mr={icon:{width:24,height:24},filterWithButton:{width:"100%"},title:{fontWeight:"bold",marginTop:16}};class Sx extends Y.Component{constructor(s){super(s),this.state={instances:[],filter:window.localStorage.getItem("javascript.debug.filter")||"",showAskForStop:!1,jsInstance:window.localStorage.getItem("javascript.debug.instance")||"",jsInstanceHost:"",adapterToDebug:window.localStorage.getItem("javascript.debug.adapter")||""}}componentDidMount(){this.props.socket.getAdapterInstances().then(s=>{const i=s.filter(p=>{var m;return p&&!((m=p.common)!=null&&m.onlyWWW)}).map(p=>{var v,_,y;const m=p._id.replace(/^system\.adapter\./,""),[f]=m.split(".");return{id:m,enabled:(v=p.common)==null?void 0:v.enabled,host:(_=p.common)==null?void 0:_.host,icon:(y=p.common)!=null&&y.icon?`../../adapter/${f}/${p.common.icon}`:""}});i.sort((p,m)=>p.id>m.id?1:p.id<m.id?-1:0);let r=this.state.jsInstance||"";const l=this.state.jsInstance?i.find(p=>p.id===this.state.jsInstance):null;let u;if(!this.state.jsInstance||!l){const p=i.find(m=>m.id.startsWith("javascript."));u=(p==null?void 0:p.host)||"",r=(p==null?void 0:p.id)||""}else u=(l==null?void 0:l.host)||"";let d=this.state.adapterToDebug||"";d&&!i.find(p=>p.id===d)&&(d=""),this.setState({instances:i,jsInstance:r,adapterToDebug:d,jsInstanceHost:u})})}handleOk=()=>{var s;if((s=this.state.instances.find(i=>i.id===this.state.adapterToDebug))!=null&&s.enabled){this.props.socket.getObject(`system.adapter.${this.state.adapterToDebug}`).then(i=>{i&&(i.common.enabled=!1,this.props.socket.setObject(i._id,i).then(()=>this.props.onDebug(this.state.jsInstance,this.state.adapterToDebug)))});return}this.props.onDebug(this.state.jsInstance,this.state.adapterToDebug)};renderJavascriptList(){const s=this.state.instances.filter(i=>i.id.startsWith("javascript."));return s.length<2?null:g.jsxs($i,{children:[g.jsx("div",{style:Mr.title,children:b.I18n.t("Host")}),g.jsx(Ig,{component:"nav",children:s.map(i=>g.jsxs(Qy,{component:"div",selected:this.state.jsInstance===i.id,onClick:()=>this.setState({jsInstance:i.id,jsInstanceHost:i.host}),children:[g.jsx(xg,{children:g.jsx("img",{src:i.icon,alt:i.id,style:Mr.icon})}),g.jsx(Dg,{primary:i.id})]},i.id))})]})}renderInstances(){if(!this.state.jsInstance)return g.jsx($i,{});const s=this.state.instances.filter(i=>i.id!==this.state.jsInstance&&i.host===this.state.jsInstanceHost&&(!this.state.filter||i.id.includes(this.state.filter.toLowerCase())));return g.jsxs($i,{children:[g.jsx("div",{style:Mr.title,children:b.I18n.t("Instances")}),g.jsx(Ig,{component:"nav",children:s.map(i=>g.jsxs(Qy,{selected:this.state.adapterToDebug===i.id,onDoubleClick:()=>this.setState({adapterToDebug:i.id},()=>this.handleOk()),onClick:()=>this.setState({adapterToDebug:i.id}),children:[g.jsx(xg,{children:g.jsx("img",{src:i.icon,alt:i.id,style:Mr.icon})}),g.jsx(Dg,{primary:i.id})]},i.id))})]})}render(){return g.jsxs(Vt,{maxWidth:"md",fullWidth:!1,open:!0,onClose:()=>!1,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(as,{id:"confirmation-dialog-title",children:this.props.title||b.I18n.t("Debug instance")}),g.jsx(Gt,{children:g.jsxs($i,{container:!0,direction:"column",children:[g.jsx($i,{children:g.jsx(Dn,{style:Mr.filterWithButton,value:this.state.filter,placeholder:b.I18n.t("Filter"),onChange:s=>{this.setState({filter:s.target.value}),window.localStorage.setItem("javascript.debug.filter",s.target.value)},endAdornment:g.jsx(xw,{position:"end",children:this.state.filter?g.jsx(Me,{size:"small","aria-label":"toggle password visibility",onClick:()=>this.setState({filter:""}),children:g.jsx(Ow,{})}):""})})}),g.jsx($i,{children:g.jsxs($i,{container:!0,children:[this.renderJavascriptList(),this.renderInstances()]})})]})}),g.jsxs(Kt,{children:[g.jsx(De,{variant:"contained",onClick:this.handleOk,disabled:!this.state.jsInstance||!this.state.adapterToDebug,color:"primary",startIcon:g.jsx(zo,{}),children:b.I18n.t("Start")}),g.jsx(De,{color:"grey",variant:"contained",onClick:()=>this.props.onClose(),startIcon:g.jsx(qs,{}),children:b.I18n.t("Close")})]})]})}}function mC(a){if(!a)throw new Error("Password must be a non-empty string.")}function zg(a){return new TextEncoder().encode(a)}function Ex(a){return new TextDecoder().decode(a)}function Ix(a){let s="";for(let i=0;i<a.length;i++)s+=String.fromCharCode(a[i]);return btoa(s)}function xx(a){const s=atob(a),i=new Uint8Array(s.length);for(let r=0;r<s.length;r++)i[r]=s.charCodeAt(r);return i}function fC(a,s){const i=new Uint8Array(a.length);for(let r=0;r<a.length;r++)i[r]=a[r]^s[r%s.length];return i}function mc(a,s){mC(a);const i=zg(s),r=zg(a),l=fC(i,r);return Ix(l)}function Ug(a,s){mC(a);const i=xx(s),r=zg(a),l=fC(i,r);return Ex(l)}const Dx=48,C_=Cw[400],T_=kS[400],k_=Tw[400],Wt="script.js",fn=`${Wt}.common`,$o=`${Wt}.global`,Nr=350,Ax=16,fe={drawerPaper:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},toolbar:a=>({height:a.toolbar.height}),toolbarButtons:a=>({color:a.palette.mode==="dark"?"white !important":"black !important"}),iconButtonsDisabled:{filter:"grayscale(100%)",opacity:.5},toolbarSearch:{width:"calc(100% - 105px)",lineHeight:"34px",marginLeft:5},iconButtons:{width:32,height:32,padding:2},iconDropdownMenu:{paddingRight:5},menu:{width:"100%",height:"100%"},innerMenu:{width:"100%",height:"calc(100% - 76px)",overflowX:"hidden",overflowY:"auto"},listItemIcon:{minWidth:32},scriptIcon:{width:18,height:18,borderRadius:2,marginTop:4,marginBottom:4,marginLeft:8,marginRight:4},folder:{cursor:"pointer",padding:0,userSelect:"none"},folderReorder:{opacity:.3,transitionDuration:"0.5s",transitionProperty:"opacity"},folderIcon:{width:20,height:20},folderIconReorder:{paddingTop:4,paddingBottom:4,paddingLeft:8,paddingRight:4},folderIconNoReorder:{cursor:"pointer",paddingTop:4,paddingBottom:4,paddingLeft:8,paddingRight:4},script:{cursor:"pointer",padding:0,userSelect:"none"},scriptReorder:{opacity:1,transitionDuration:"0.5s",transitionProperty:"opacity"},reorder:{},selected:window.vendorPrefix?a=>({backgroundColor:a.palette.primary.main,color:a.palette.text.primary}):{backgroundColor:"#164477",color:"white"},instances:{color:"gray",fontSize:"smaller"},childrenCount:{fontSize:10,opacity:.4},footer:{height:24,display:"flex"},footerButtons:a=>({"& img":{color:a.palette.mode==="dark"?"#ffffff":"#111111",cursor:"pointer",mt:"1px",mr:"2px",height:22,width:22,"&:hover":{backgroundColor:"#dbdbdb"}},"& svg":{color:a.palette.mode==="dark"?"#ffffff":"#111111",cursor:"pointer",mt:"1px",mr:"2px",height:22,width:22,"&:hover":{backgroundColor:"#dbdbdb"}}}),footerButtonsRight:{float:"right"}},$n={Blockly:hC,"Javascript/js":_c,def:_c,Rules:gC,"TypeScript/ts":pC};function Hg(a,s,i){var r;return i=i||b.I18n.getLanguage(),(r=s==null?void 0:s.common)!=null&&r.name?typeof s.common.name=="object"?(s.common.name[i]||s.common.name.en||a.replace(/^script\.js./,"")).toString():s.common.name.toString():a.replace(/^script\.js./,"")}function S_(a){var l;const s=[{id:Wt,depth:0,index:0,parent:null,title:"root",type:"folder",parentIndex:null}],i=Object.keys(a);for(let u=0;u<i.length;u++){const d=a[i[u]],p=i[u].split(".");p.pop(),d.type==="script"?s.push({id:i[u],title:Hg(i[u],d),enabled:!!((l=d==null?void 0:d.common)!=null&&l.enabled),depth:p.length-1,type:d.common.engineType,parent:p.length>1?p.join("."):null,instance:d.common.engine?parseInt(d.common.engine.split(".").pop(),10)||0:null,index:0,parentIndex:0}):s.push({id:i[u],title:Hg(i[u],d),depth:p.length-1,type:"folder",parent:p.length>1?p.join("."):null,index:0,parentIndex:null})}let r;do r=!1,s.forEach(u=>{if(u.parent&&!s.find(p=>p.id===u.parent)){const p=u.parent.split(".");p.pop(),s.push({id:u.parent,title:u.parent.split(".").pop()||"",depth:p.length-1,type:"folder",parent:p.length>1?p.join("."):null,index:0,parentIndex:null}),r=!0}});while(r);return s.sort((u,d)=>{const p=u.id.toLowerCase(),m=d.id.toLowerCase();return u.type==="folder"&&d.type!=="folder"?-1:d.type==="folder"&&u.type!=="folder"||p>m?1:p<m?-1:0}),s.forEach((u,d)=>u.index=d),s.forEach(u=>{if(u.parent){const d=s.find(p=>p.id===u.parent);d&&(u.parentIndex=d.index)}}),s}function Rx(a){const{onDrop:s}=a,[{isOver:i,isOverAny:r},l]=FI({accept:"script",drop:u=>i?s(u):void 0,collect:u=>({isOver:u.isOver({shallow:!0}),isOverAny:u.isOver()})});return g.jsx("div",{ref:l,style:{background:i?"#40adff":void 0,opacity:r?.7:void 0},children:a.children},a.folderName)}function E_(a){const{name:s}=a,[{opacity:i},r]=RI({type:"script",item:()=>({name:s}),collect:l=>({opacity:l.isDragging()?.3:1})});return g.jsx("div",{ref:r,style:{opacity:i,transform:"translate3d(0, 0, 0)"},children:a.children},s)}class bo extends Y.Component{inputRef;filterTimer;problems;problemsTimer;onProblemUpdatedBound;parent=null;constructor(s){super(s);const i=window.localStorage?window.localStorage.getItem("SideMenu.expanded"):"[]";let r;try{r=JSON.parse(i||"[]")||[]}catch{r=[]}this.inputRef=Y.createRef(),this.state={listItems:S_(s.scripts||{}),expanded:r,problems:[],reorder:!1,themeName:this.props.themeName,selected:window.localStorage&&window.localStorage.getItem("SideMenu.selected")||null,creatingScript:null,creatingFolder:!1,copingScript:"",renaming:null,deleting:null,choosingType:!1,errorText:"",instances:s.instances||[],menuOpened:!1,menuAnchorEl:null,menuAnchorFilterEl:null,searchMode:!1,expertMode:this.props.expertMode,searchText:"",width:this.props.width||300,typeFilter:window.localStorage&&window.localStorage.getItem("SideMenu.typeFilter")||"",statusFilter:window.localStorage&&window.localStorage.getItem("SideMenu.statusFilter")||"",runningInstances:this.props.runningInstances||{},scriptsHash:s.scriptsHash,showAdapterDebug:!1,isAllZeroInstances:!1};const l=this.ensureSelectedIsVisible();l&&Object.assign(this.state,{expanded:l}),this.filterTimer=null,Object.assign(this.state,{isAllZeroInstances:this.getIsAllZeroInstances()}),this.problems=null,this.problemsTimer=null,this.onProblemUpdatedBound=this.onProblemUpdated.bind(this)}readProblems(s,i){var r,l;if(i||(i=Object.keys(this.props.scripts)),!i||!i.length)s&&s();else{const u=i.shift(),d=this.props.scripts[u];if(((r=this.props.scripts)==null?void 0:r[u].type)==="script"&&((l=d.common)!=null&&l.enabled)&&!u.match(/^script\.js\.global\./)){const p=d.common.engine.split(".").pop(),m=this,f=`javascript.${p}.scriptProblem.${u.substring(Wt.length+1)}`;this.props.socket.getState(f).then(v=>{m.onProblemUpdated(f,v),setTimeout(()=>m.readProblems(s,i),0)})}else setTimeout(()=>this.readProblems(s,i),0)}}componentDidMount(){this.readProblems(()=>{this.props.instances.forEach(s=>{this.props.socket.subscribeState(`javascript.${s}.scriptProblem.*`,this.onProblemUpdatedBound)})})}componentWillUnmount(){this.props.instances.forEach(s=>{this.props.socket.unsubscribeState(`javascript.${s}.scriptProblem.*`,this.onProblemUpdatedBound)})}onProblemUpdated(s,i){if(!i||!s)return;s=`${Wt}.${s.replace(/^javascript\.\d+\.scriptProblem\./,"")}`,this.problems||(this.problems=JSON.parse(JSON.stringify(this.state.problems))||[]);let r=!1;if(i.val)this.problems.includes(s)||(this.problems.push(s),r=!0);else{const l=this.problems.indexOf(s);l!==-1&&(this.problems.splice(l,1),r=!0)}r&&!this.problemsTimer&&(this.problemsTimer=setTimeout(()=>{this.problemsTimer=null,this.setState({problems:this.problems}),this.problems=null},300))}static filterListStatic(s,i,r,l,u){i=JSON.parse(JSON.stringify(i));let d=!1;const p={listItems:i};if(s&&r&&l){const m=l.toLowerCase();if(i.forEach(f=>{var k;const v=f.title.toLowerCase();f.filteredPartly=!1;let _=v.includes(m);const y=(k=u==null?void 0:u[f.id])==null?void 0:k.common;if(!_&&(y!=null&&y.source))if(y.engineType==="Blockly"){const C=y.source.lastIndexOf("//");_=y.source.substring(0,C).toLowerCase().includes(m)}else _=y.source.toLowerCase().includes(m);_?f.filtered&&(f.filtered=!1,d=!0):f.filtered||(f.filtered=!0,d=!0)}),d)for(let f=i.length-1;f>=0;f--){const v=i[f];if(!v.filtered||v.filteredPartly){let _=v;do _!=null&&_.parent&&i[_.parentIndex]&&(d=!0,i[_.parentIndex].filteredPartly=!0),_=_!=null&&_.parent&&i[_.parentIndex]?i[_.parentIndex]:null;while(_)}}}else i.forEach(m=>{(m.filtered||m.filteredPartly)&&(m.filtered=!1,m.filteredPartly=!1,d=!0)}),s||(p.searchText="",p.searchMode=!1,d=!0);return d?p:null}filterList(s,i){const r=bo.filterListStatic(s,this.state.listItems,this.state.searchMode,this.state.searchText,this.props.scripts);r?this.setState(r,()=>i&&i()):i&&i()}static ensureSelectedIsVisibleStatic(s,i,r){i=JSON.parse(JSON.stringify(i));let l=!1,u=typeof s=="object"?s:r.find(d=>d.id===s);do{if(u!=null&&u.parent){const d=u.parent;u=r.find(p=>p.id===d)}else u=void 0;u&&(i.includes(u.id)||(i.push(u.id),l=!0))}while(u);return l?i:null}ensureSelectedIsVisible(s,i){return bo.ensureSelectedIsVisibleStatic(s||this.state.selected,i||this.state.expanded,this.state.listItems)}static getDerivedStateFromProps(s,i){const r={};let l=!1;if(i.expertMode!==s.expertMode&&(l=!0,r.expertMode=s.expertMode),i.scriptsHash!==s.scriptsHash&&s.scripts){const u=S_(s.scripts||{});if(r.listItems=u,i.searchText){const m=bo.filterListStatic(!0,u,i.searchMode,i.searchText,s.scripts);m&&Object.assign(r,m)}const d=bo.getIsAllZeroInstancesStatic(u,s.instances||[]),p=bo.ensureSelectedIsVisibleStatic(i.selected,i.expanded,i.listItems);r.isAllZeroInstances=d,p&&(r.expanded=p),l=!0}if(i.width!==s.width&&(l=!0,r.width=s.width),i.themeName!==s.themeName&&(l=!0,r.themeName=s.themeName),s.selectId&&i.selected!==s.selectId){const u=i.listItems.find(d=>d.id===s.selectId);if(!i.reorder&&u){const d=bo.ensureSelectedIsVisibleStatic(u,i.expanded,i.listItems);r.selected=u.id,d&&(r.expanded=d),l=!0,window.localStorage&&window.localStorage.setItem("SideMenu.selected",u.id)}}return l?r:null}static getIsAllZeroInstancesStatic(s,i){let r=!i[0]&&i.length<=1;return r&&s.forEach(l=>{l.type!=="folder"&&l.instance!==0&&(r=!1)}),r}getIsAllZeroInstances(s,i){return s=s||this.state.listItems,i=i||this.state.instances,bo.getIsAllZeroInstancesStatic(s||this.state.listItems,i||this.state.instances)}saveExpanded(s){window.localStorage.setItem("SideMenu.expanded",JSON.stringify(s||this.state.expanded))}showError(s){this.setState({errorText:s})}onToggle(s,i){if(i==null||i.stopPropagation(),s===Wt)return;const r=[...this.state.expanded],l=r.indexOf(s);l!==-1?(r.splice(l,1),this.state.selected&&this.state.selected.startsWith(`${s}.`)&&window.localStorage&&window.localStorage.setItem("SideMenu.selected",s)):(r.push(s),r.sort()),this.setState({expanded:r}),this.saveExpanded(r)}renderItemButtonsOnEnd(s,i){if(this.state.reorder)return null;if(s.type!=="folder"){let r=s.enabled?C_:k_;return s.enabled&&this.state.problems.includes(s.id)&&(r=T_),[g.jsx(Me,{onClick:l=>{l.stopPropagation(),this.props.onEnableDisable&&this.props.onEnableDisable(s.id,!s.enabled)},title:s.enabled?b.I18n.t("Pause script"):b.I18n.t("Run script"),disabled:this.props.debugMode,style:{...fe.iconButtons,...this.props.debugMode?fe.iconButtonsDisabled:void 0,color:r},size:"medium",children:s.enabled?g.jsx(gc,{}):g.jsx(Fg,{})},"startStop"),this.state.width>Nr?g.jsx(Me,{style:this.props.debugMode?fe.iconButtonsDisabled:void 0,title:b.I18n.t("Delete script"),disabled:s.id===$o||s.id===fn||this.props.debugMode,onClick:l=>this.onDelete(s,l),size:"medium",children:g.jsx(dc,{})},"delete"):null,g.jsx(Me,{style:this.props.debugMode?fe.iconButtonsDisabled:void 0,disabled:this.props.debugMode,title:b.I18n.t("Edit script or just double click"),onClick:l=>this.onEdit(s,l),size:"medium",children:g.jsx(cx,{})},"openInEdit")]}return this.state.width>Nr&&s.id!==Wt&&s.id!==fn&&s.id!==$o&&!(i!=null&&i.length)?g.jsx(Me,{style:this.props.debugMode?fe.iconButtonsDisabled:void 0,title:b.I18n.t("Delete folder"),disabled:s.id===$o||s.id===fn||this.props.debugMode,onClick:r=>this.onDelete(s,r),size:"medium",children:g.jsx(dc,{})},"delete"):null}onDelete(s,i){return i==null||i.stopPropagation(),new Promise(r=>{if(!s){r();return}typeof s!="object"?this.setState({deleting:s},()=>r()):this.setState({deleting:s.id},()=>r())})}onEdit(s,i){this.onClick(s,i),this.props.onEdit&&this.props.onEdit(s.id)}getTextStyle(s){return!this.state.reorder&&s.type!=="folder"?{width:`calc(100% - ${this.state.width>Nr?185:137}px)`,overflow:"hidden",whiteSpace:"nowrap",flex:"none",padding:"0 16px 0 0"}:{whiteSpace:"nowrap",padding:"0 16px 0 0"}}onClick(s,i){if(i==null||i.stopPropagation(),!this.state.reorder&&s){const r=this.ensureSelectedIsVisible(s),l={selected:s.id};r&&(l.expanded=r),this.setState(l),window.localStorage&&window.localStorage.setItem("SideMenu.selected",s.id)}}onDblClick(s,i){i==null||i.stopPropagation(),!this.state.reorder&&(s.type==="folder"?this.onToggle(s.id):this.onEdit(s))}isFilteredOut(s){var i,r;return s.filtered&&!s.filteredPartly||this.state.typeFilter&&s.type!=="folder"&&s.type.toLowerCase()!==this.state.typeFilter.toLowerCase()||!this.state.expertMode&&((r=(i=this.props.scripts[s.id])==null?void 0:i.native)!=null&&r.protected)||this.state.statusFilter&&s.type!=="folder"&&(this.state.statusFilter==="running"&&!s.enabled||this.state.statusFilter==="paused"&&s.enabled||this.state.statusFilter==="problems"&&(!s.enabled||this.state.problems.indexOf(s.id)===-1))?!0:s.id===$o&&!this.state.expertMode}renderListItem(s,i,r){var y,k;if(s.id===Wt&&!this.state.reorder)return null;const l=(this.state.reorder?s.depth:s.depth-1)*Ax;let u=s.title;if(this.state.searchText){const C=u.toLowerCase().indexOf(this.state.searchText.toLowerCase());C!==-1&&(u=[g.jsx("span",{children:u.substring(0,C)},"first"),g.jsx("span",{style:{color:"orange"},children:u.substring(C,C+this.state.searchText.length)},"second"),g.jsx("span",{children:u.substring(C+this.state.searchText.length)},"third")])}!this.state.isAllZeroInstances&&s.type!=="folder"&&(u=[g.jsx("span",{children:u},"title"),g.jsxs("span",{title:b.I18n.t("Instance"),style:fe.instances,children:["[",s.instance,"]"]},"instance")]);const d=this.state.reorder&&!this.props.debugMode,p={marginLeft:l,cursor:s.type==="folder"&&d?"default":"inherit",width:`calc(100% - ${l}px)`};d||(p.opacity=s.filteredPartly?.5:1),s.id===$o&&s.id!==this.state.selected&&(p.color="#00a200");let m=s.id===Wt;!m&&i&&(m=this.state.expanded.includes(s.id));let f;s.type==="folder"?f={...fe.folderIcon,...d?fe.folderIconReorder:fe.folderIconNoReorder}:f={...fe.scriptIcon},s.id===$o?f.color="#356956":s.id===fn&&(f.color="#4899e1");let v=null;(r&&r.length||i&&i.length)&&(v=g.jsx("span",{style:fe.childrenCount,children:r&&r.length!==i.length?`${r.length}(${i.length})`:i.length}));const _={...s.type==="folder"?fe.folder:fe.script,...d?fe.reorder:void 0,...d&&s.type!=="folder"?fe.scriptReorder:void 0,...d&&s.type==="folder"?fe.folderReorder:void 0,...p};return g.jsxs(Ok,{style:_,sx:s.id===this.state.selected&&!d?fe.selected:void 0,className:b.Utils.clsx(d&&s.type==="folder"&&"folder-reorder",d&&s.type!=="folder"&&"script-reorder"),onClick:C=>this.onClick(s,C),onDoubleClick:C=>this.onDblClick(s,C),secondaryAction:this.renderItemButtonsOnEnd(s,i),children:[(k=(y=this.props.scripts[s.id])==null?void 0:y.native)!=null&&k.protected?g.jsx(w_,{style:{color:"orange",position:"absolute",right:5,width:10,height:10}}):null,g.jsx(xg,{style:fe.listItemIcon,children:s.type==="folder"?d||m?g.jsx(qk,{style:f,onClick:C=>!d&&this.onToggle(s.id,C)}):g.jsx(Xk,{style:f,onClick:C=>!d&&this.onToggle(s.id,C)}):g.jsx("img",{style:f,alt:s.type,src:$n[s.type]||$n.def})}),g.jsx(Dg,{sx:{"& .MuiListItemText-primary":s.id===this.state.selected&&!d?fe.selected:void 0},style:this.getTextStyle(s),primary:g.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[u,v]})})]},s.id)}onDragFinish(s,i){let r=`${i}.${s.split(".").pop()}`;r!==s&&(this.state.listItems.find(l=>l.id===r)&&(r+=`_${b.I18n.t("copy")}`),this.props.onRename&&this.props.onRename(s,r))}renderOneItem(s,i){const r=this.state.statusFilter||this.state.typeFilter?s.filter(f=>f.parent===i.id?!this.isFilteredOut(f):!1):[],l=s.filter(f=>f.parent===i.id);if(this.isFilteredOut(i)||i.type==="folder"&&(this.state.statusFilter||this.state.typeFilter)&&!r.length)return null;const u=this.state.reorder&&!this.props.debugMode,d=this.renderListItem(i,l,r),p=[];let m;return l&&(u||this.state.expanded.includes(i.id)||i.id===Wt)&&(m=l.map(f=>this.renderOneItem(s,f))),u?i.type==="folder"?p.push(g.jsxs(Rx,{onDrop:f=>this.onDragFinish(f.name,i.id),folderName:i.id,children:[g.jsx(E_,{name:i.id,children:d},`draggable_${i.id}`),m||null]},`droppable_${i.id}`)):p.push(g.jsxs(E_,{name:i.id,children:[d,m||null]},`draggable_${i.id}`)):(p.push(d),m==null||m.forEach(f=>p.push(f))),p}renderAllItems(s){const i=s.filter(r=>!r.parent).map(r=>this.renderOneItem(s,r));return g.jsx(Ig,{dense:!0,disablePadding:!0,sx:fe.mainList,children:i})}onAddNew(s){s==null||s.stopPropagation();let i=this.state.listItems.find(l=>l.id===this.state.selected),r=Wt;for(;i&&i.type!=="folder";)i=this.state.listItems[i.parentIndex];i&&(r=i.id),this.parent=r,this.setState({choosingType:!0})}onCopy(s,i){s==null||s.stopPropagation();let r=this.state.listItems.find(u=>u.id===i),l=Wt;for(;r&&r.type!=="folder";)r=this.state.listItems[r.parentIndex];r&&(l=r.id),this.parent=l,this.setState({copingScript:i||""})}onAddNewFolder(s){s==null||s.stopPropagation();let i=this.state.listItems.find(l=>l.id===this.state.selected),r=Wt;for(;i&&i.type!=="folder";)i=this.state.listItems[i.parentIndex];i&&(r=i.id),this.parent=r,this.setState({creatingFolder:!0})}onRename(s){s==null||s.stopPropagation(),this.setState({renaming:this.state.selected})}getUniqueName(s){let i=1,r=`${b.I18n.t("Script")} `;if(s){const l=Hg(s,this.props.scripts[s]),u=l.match(/\d+$/);u?(r=l.replace(/\d+$/,""),i=parseInt(u[0],10)+1):r=l}for(;this.state.listItems.find(l=>l.id===`${this.parent}.${r.replace(/\.\s/g,"_")}${i}`);)i++;return r+i}getUniqueFolderName(){let s=1;for(;this.state.listItems.find(i=>i.id===`${this.parent}.${b.I18n.t("Folder")}_${s}`);)s++;return`${b.I18n.t("Folder")} ${s}`}onCloseMenu(s){this.setState({menuOpened:!1,menuAnchorEl:null,menuAnchorFilterEl:null},s)}getMainMenu(s,i){var l,u,d,p;const r=this.state.expertMode&&!!Object.keys(this.props.changedScripts).find(m=>{var f,v;return this.props.changedScripts[m]&&((v=(f=this.props.scripts[m])==null?void 0:f.native)==null?void 0:v.protected)});return g.jsxs(cm,{id:"long-menu",anchorEl:this.state.menuAnchorEl,open:this.state.menuOpened,onClose:()=>this.setState({menuOpened:!1,menuAnchorEl:null}),slotProps:{paper:{style:{maxHeight:Dx*7.5}}},children:[this.state.width<=Nr?g.jsxs(Ve,{disabled:this.props.debugMode||!this.state.selected||this.state.selected===$o||this.state.selected===fn||!!(s!=null&&s.length),onClick:m=>{if(m.stopPropagation(),m.preventDefault(),this.state.listItems.find(f=>f.parent===this.state.selected)){this.showError(b.I18n.t("Cannot delete non empty item!"));return}this.setState({menuOpened:!1,menuAnchorEl:null},()=>this.onDelete(this.state.selected).then(()=>{}))},children:[g.jsx(dc,{style:{...fe.iconDropdownMenu,color:"red"}}),b.I18n.t("Delete")]},"delete"):null,g.jsxs(Ve,{disabled:this.props.debugMode||r,selected:this.state.expertMode,onClick:m=>{m.stopPropagation(),m.preventDefault(),this.onCloseMenu(()=>this.props.onExpertModeChange&&this.props.onExpertModeChange(!this.state.expertMode))},children:[g.jsx(b.IconExpert,{style:{...fe.iconDropdownMenu,color:this.state.expertMode?"orange":"inherit"}}),b.I18n.t("Expert mode")]},"expertMode"),this.props.onExport&&g.jsxs(Ve,{onClick:m=>{m.stopPropagation(),m.preventDefault(),this.onCloseMenu(()=>this.props.onExport())},children:[g.jsx(vc,{style:fe.iconDropdownMenu}),b.I18n.t("Export all scripts")]},"exportAll"),this.props.onImport&&g.jsxs(Ve,{disabled:this.props.debugMode,onClick:m=>{m.stopPropagation(),m.preventDefault(),this.onCloseMenu(()=>this.props.onImport())},children:[g.jsx(Rg,{style:fe.iconDropdownMenu}),b.I18n.t("Import scripts")]},"import"),this.props.onThemeChange&&g.jsxs(Ve,{onClick:()=>this.onCloseMenu(()=>{this.props.onThemeChange&&this.props.onThemeChange(b.Utils.toggleTheme(this.state.themeName))}),children:[g.jsx(dx,{style:fe.iconDropdownMenu}),b.I18n.t('Change theme (actual "%s")',this.state.themeName)]},"dark"),this.props.onAddNew&&g.jsxs(Ve,{disabled:!this.state.selected||!i||i.type==="folder",onClick:m=>{const f=this.state.selected;this.onCloseMenu(()=>this.onCopy(m,f))},children:[g.jsx(Zk,{style:fe.iconDropdownMenu}),b.I18n.t("Copy script")]},"copy"),this.state.expertMode&&g.jsxs(Ve,{disabled:this.props.debugMode,onClick:m=>{m.stopPropagation(),m.preventDefault(),this.onCloseMenu(()=>this.setState({showAdapterDebug:!0}))},children:[g.jsx(ix,{style:fe.iconDropdownMenu}),b.I18n.t("Debug instance")]},"debugInstance"),this.state.selected&&this.props.password&&this.props.scripts[this.state.selected].type==="script"?g.jsxs(Ve,{disabled:this.props.debugMode||this.props.changedScripts[this.state.selected],onClick:m=>{m.stopPropagation(),m.preventDefault(),this.onCloseMenu(async()=>{var v;const f=await this.props.socket.getObject(this.state.selected);f&&((v=f.native)!=null&&v.protected?(delete f.native.protected,f.common.source=Ug(this.props.password,f.common.source||"")):(f.native||={},f.native.protected=!0,f.common.source=mc(this.props.password,f.common.source||"")),await this.props.socket.setObject(f._id,f))})},children:[g.jsx(w_,{style:{...fe.iconDropdownMenu,color:"orange"}}),(u=(l=this.props.scripts[this.state.selected])==null?void 0:l.native)!=null&&u.protected?g.jsx("span",{style:{color:(p=(d=this.props.scripts[this.state.selected])==null?void 0:d.native)!=null&&p.protected?"orange":void 0},children:b.I18n.t("Unprotect script")}):b.I18n.t("Protect script")]},"encrypt"):null]},"menu")}getToolbarButtons(){const s=[],i=this.state.reorder&&!this.props.debugMode;if(this.state.searchMode&&!this.props.debugMode)s.push(g.jsx(Dn,{value:this.state.searchText,style:fe.toolbarSearch,ref:this.inputRef,autoFocus:!0,placeholder:b.I18n.t("Search..."),onChange:r=>{this.setState({searchText:r.target.value}),this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>{this.filterTimer=null,this.filterList(!0),this.props.onSearch&&this.props.onSearch(this.state.searchText)},400)}},"searchInput")),s.push(g.jsx(Me,{sx:fe.toolbarButtons,style:{float:"right"},title:b.I18n.t("End search mode"),onClick:r=>{r.stopPropagation(),this.filterList(!1,()=>this.props.onSearch&&this.props.onSearch(this.state.searchText))},size:"medium",children:g.jsx(ax,{})},"disableSearch")),this.state.searchText&&s.push(g.jsx(Me,{title:b.I18n.t("Clear search input"),sx:fe.toolbarButtons,style:{marginTop:7,float:"right"},onClick:r=>{r.stopPropagation(),this.setState({searchText:""},()=>{this.filterList(!0),this.props.onSearch&&this.props.onSearch(this.state.searchText)})},size:"medium",children:g.jsx(Ow,{fontSize:"small"})},"cleanSearch"));else{if(!i){s.push(g.jsx(Me,{"aria-label":"More","aria-owns":this.state.menuOpened?"long-menu":void 0,title:b.I18n.t("Menu"),"aria-haspopup":"true",onClick:u=>{u.stopPropagation(),u.preventDefault(),this.setState({menuOpened:!0,menuAnchorEl:u.currentTarget})},size:"medium",children:g.jsx(ux,{})},"menuButton"));const r=this.state.listItems.find(u=>u.id===this.state.selected);let l;r&&this.state.width<=Nr&&r.type==="folder"&&(l=this.state.listItems.filter(u=>u.parent===this.state.selected)),s.push(this.getMainMenu(l,r)),s.push(g.jsx(Me,{disabled:this.props.debugMode,title:b.I18n.t("Create new script"),sx:{...fe.toolbarButtons,...this.props.debugMode?fe.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit"},onClick:u=>this.onAddNew(u),size:"medium",children:g.jsx(Qk,{})},"new-script")),s.push(g.jsx(Me,{disabled:this.props.debugMode,title:b.I18n.t("Create new folder"),sx:{...fe.toolbarButtons,...this.props.debugMode?fe.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit"},onClick:u=>this.onAddNewFolder(u),size:"medium",children:g.jsx(eS,{})},"new-folder"))}s.push(g.jsx(Me,{disabled:i||this.props.debugMode,sx:{...fe.toolbarButtons,...this.props.debugMode?fe.iconButtonsDisabled:void 0},title:b.I18n.t("Search in scripts"),style:{float:"right",opacity:this.props.debugMode?.5:i?0:1},onClick:r=>{r.stopPropagation(),this.setState({searchMode:!0})},size:"medium",children:g.jsx(px,{})},"search")),s.push(g.jsx(Me,{disabled:this.props.debugMode,title:b.I18n.t("Reorder scripts in folders"),sx:{...fe.toolbarButtons,...this.props.debugMode?fe.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit",float:"right"},onClick:r=>{r.stopPropagation(),this.setState({reorder:!this.state.reorder})},size:"medium",children:g.jsx($x,{})},"reorder")),!i&&this.state.selected&&this.state.selected!==$o&&this.state.selected!==fn&&s.push(g.jsx(Me,{sx:{...fe.toolbarButtons,...this.props.debugMode?fe.iconButtonsDisabled:void 0},disabled:this.props.debugMode,title:b.I18n.t("Rename"),onClick:r=>this.onRename(r),size:"medium",children:g.jsx(tS,{})},"rename")),s.push(g.jsxs("span",{style:{opacity:.5,fontSize:10},children:["v",this.props.version]},"version"))}return s}getFolders(){const s=[{id:Wt,name:b.I18n.t("Root folder")}];return this.state.listItems.forEach(i=>{i.type==="folder"&&i.id!==Wt&&(!i.id.startsWith($o)||this.state.expertMode)&&s.push({id:i.id,name:i.title})}),s}onCollapseAll(){this.setState({expanded:[]}),this.saveExpanded([])}onExpandAll(){const s=[];this.state.listItems.forEach(i=>this.state.listItems.find(r=>r.parent===i.id)&&s.push(i.id)),this.setState({expanded:s}),this.saveExpanded(s)}getBottomButtons(){return this.state.reorder||this.props.debugMode?null:[g.jsx($t,{sx:fe.footerButtons,title:b.I18n.t("Show only running scripts"),onClick:s=>{s.stopPropagation(),s.preventDefault();const i=this.state.statusFilter==="running"?"":"running";window.localStorage&&window.localStorage.setItem("SideMenu.statusFilter",i),this.setState({statusFilter:i})},children:g.jsx(gc,{style:{color:C_,opacity:this.state.statusFilter==="running"?1:.3,background:this.state.statusFilter==="running"?"gray":"inherit"}})},"filterByRunning"),g.jsx($t,{sx:fe.footerButtons,title:b.I18n.t("Show only paused scripts"),onClick:()=>{const s=this.state.statusFilter==="paused"?"":"paused";window.localStorage&&window.localStorage.setItem("SideMenu.statusFilter",s),this.setState({statusFilter:s})},children:g.jsx(Fg,{style:{color:k_,opacity:this.state.statusFilter==="paused"?1:.3,background:this.state.statusFilter==="paused"?"gray":"inherit"}})},"filterByPaused"),g.jsx($t,{sx:fe.footerButtons,style:{marginRight:16},title:b.I18n.t("Show only scripts with problems"),onClick:()=>{const s=this.state.statusFilter==="problems"?"":"problems";window.localStorage&&window.localStorage.setItem("SideMenu.statusFilter",s),this.setState({statusFilter:s})},children:g.jsx(gc,{style:{color:T_,opacity:this.state.statusFilter==="problems"?1:.3,background:this.state.statusFilter==="problems"?"gray":"inherit"}})},"filterByProblem"),g.jsx($t,{sx:fe.footerButtons,children:g.jsx("img",{alt:"Blockly",style:{opacity:this.state.typeFilter==="Blockly"?1:.3,background:this.state.typeFilter==="Blockly"?"gray":"inherit"},src:$n.Blockly,onClick:()=>{const s=this.state.typeFilter==="Blockly"?"":"Blockly";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterBlockly"),g.jsx($t,{sx:fe.footerButtons,children:g.jsx("img",{alt:"Javascript",style:{opacity:this.state.typeFilter==="Javascript/js"?1:.3,background:this.state.typeFilter==="Javascript/js"?"gray":"inherit"},src:$n["Javascript/js"],onClick:()=>{const s=this.state.typeFilter==="Javascript/js"?"":"Javascript/js";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterJS"),g.jsx($t,{sx:fe.footerButtons,children:g.jsx("img",{alt:"TypeScript",style:{opacity:this.state.typeFilter==="TypeScript/ts"?1:.3,background:this.state.typeFilter==="TypeScript/ts"?"gray":"inherit"},src:$n["TypeScript/ts"],onClick:()=>{const s=this.state.typeFilter==="TypeScript/ts"?"":"TypeScript/ts";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterTS"),g.jsx($t,{sx:fe.footerButtons,children:g.jsx("img",{alt:"Rules",style:{opacity:this.state.typeFilter==="Rules"?1:.3,background:this.state.typeFilter==="Rules"?"gray":"inherit"},src:$n.Rules,onClick:()=>{const s=this.state.typeFilter==="Rules"?"":"Rules";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterRules"),g.jsx("div",{style:{flexGrow:1}},"padding"),g.jsx($t,{sx:fe.footerButtons,onClick:()=>this.onExpandAll(),title:b.I18n.t("Expand all"),children:g.jsx(vx,{style:fe.footerButtonsRight})},"expandAll"),this.state.expanded.length?g.jsx($t,{sx:fe.footerButtons,onClick:()=>this.onCollapseAll(),title:b.I18n.t("Collapse all"),children:g.jsx(bx,{style:fe.footerButtonsRight})},"collapseAll"):g.jsx("div",{style:{height:22,width:24}})]}getAdapterDebugDialog(){return this.state.showAdapterDebug?g.jsx(Sx,{socket:this.props.socket,onClose:()=>this.setState({showAdapterDebug:!1}),onDebug:(s,i)=>this.setState({showAdapterDebug:!1},()=>this.props.onDebugInstance({instance:s,adapter:i}))},"debug"):null}render(){var r,l,u;const s=this.state.renaming?this.state.listItems.find(d=>d.id===this.state.renaming):void 0,i=this.state.copingScript&&this.props.scripts[this.state.copingScript].type==="script"?this.props.scripts[this.state.copingScript]:void 0;return[g.jsxs(Mk,{variant:"permanent",style:fe.menu,sx:{"& .MuiDrawer-paper":fe.drawerPaper},anchor:"left",onClick:()=>this.onClick({id:""}),children:[g.jsx($t,{sx:fe.toolbar,children:this.getToolbarButtons()}),g.jsx(e_,{}),g.jsx(Zw,{backend:uC,children:g.jsx("div",{style:fe.innerMenu,children:this.renderAllItems(this.state.listItems)})}),g.jsx(e_,{}),g.jsx("div",{style:fe.footer,children:this.getBottomButtons()})]},"drawer"),s?g.jsx($m,{name:s.title,id:this.state.renaming||"",folder:s.type==="folder",instance:s.instance,instances:this.props.instances,onClose:()=>this.setState({renaming:null}),onRename:(d,p,m,f)=>this.props.onRename&&this.props.onRename(d,p,m,f)},"dialog-rename"):null,this.state.deleting?g.jsx(yx,{name:this.state.listItems.find(d=>d.id===this.state.deleting).title,id:this.state.deleting,onClose:()=>this.setState({deleting:null}),onDelete:d=>this.props.onDelete&&this.props.onDelete(d)},"dialog-delete"):null,this.state.choosingType?g.jsx(Cn,{onClose:d=>{const p={choosingType:!1};d&&(p.creatingScript=d),this.setState(p)}},"dialog-script-type"):null,this.state.creatingScript?g.jsx(tg,{onClose:()=>this.setState({creatingScript:null}),title:b.I18n.t("Create new script"),name:this.getUniqueName(),parents:this.getFolders(),folder:!1,existingItems:this.state.listItems.map(d=>d.id),instance:this.props.instances[0]||0,instances:this.props.instances,type:this.state.creatingScript,parent:this.parent,onAdd:(d,p,m,f)=>this.props.onAddNew&&this.props.onAddNew(d,p,!1,m,f)},"dialog-new-script"):null,this.state.copingScript?g.jsx(tg,{onClose:()=>this.setState({copingScript:""}),title:b.I18n.t("Copy script"),name:this.getUniqueName(this.state.copingScript),parents:this.getFolders(),folder:!1,instance:parseInt((l=(r=i==null?void 0:i.common)==null?void 0:r.engine)==null?void 0:l.split(".").pop(),10)||0,instances:this.props.instances,type:((u=i==null?void 0:i.common)==null?void 0:u.engineType)||"Javascript/js",parent:this.parent,onAdd:(d,p,m,f)=>{var _;const v=this.state.copingScript&&this.props.scripts[this.state.copingScript].type==="script"?this.props.scripts[this.state.copingScript]:void 0;v!=null&&v.common&&(v.common.enabled=!1),this.props.onAddNew&&this.props.onAddNew(d,p,!1,m,f,(_=v==null?void 0:v.common)==null?void 0:_.source)}},"dialog-copy-script"):null,this.state.creatingFolder?g.jsx(tg,{onClose:()=>this.setState({creatingFolder:!1}),title:b.I18n.t("Create new folder"),parents:this.getFolders(),name:this.getUniqueFolderName(),parent:this.parent,onAdd:(d,p)=>this.props.onAddNew&&this.props.onAddNew(d,p,!0)},"dialog-new-folder"):null,this.state.errorText?g.jsx(Zc,{onClose:()=>this.setState({errorText:""}),text:this.state.errorText},"error"):null,this.getAdapterDebugDialog()]}}const Ox="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAXRSTlMAQObYZgAAACFJREFUeAFjAIJRwP////8PYIKWHCigNQdKj/pn1D+jAABTG16wVQqVpQAAAABJRU5ErkJggg==",Mx="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAXRSTlMAQObYZgAAABtJREFUeAFjAIJRwP8fCj7QkENn/4z6Z5QzCgBjbWaoyx1PqQAAAABJRU5ErkJggg==";function Nx(a){let s,i=a.getHours();return i<10&&(i=`0${i.toString()}`),s=`${i}:`,i=a.getMinutes(),i<10&&(i=`0${i.toString()}`),s+=`${i}:`,i=a.getSeconds(),i<10&&(i=`0${i.toString()}`),s+=`${i}.`,i=a.getMilliseconds(),i<10?i=`00${i.toString()}`:i<100&&(i=`0${i.toString()}`),s+=i,s}const I_=34,Bt={logBox:{width:"100%",height:"100%",position:"relative",overflow:"hidden"},logBoxInner:a=>({display:"inline-block",color:a.palette.mode==="dark"?"white":"black",width:`calc(100% - ${I_}px)`,height:"100%",overflow:"auto",position:"relative",verticalAlign:"top"}),info:a=>({background:a.palette.mode==="dark"?"darkgrey":"lightgrey",color:(a.palette.mode==="dark","black")}),error:a=>({background:"#FF0000",color:a.palette.mode==="dark"?"black":"white"}),warn:a=>({background:"#FF8000",color:a.palette.mode==="dark"?"black":"white"}),debug:a=>({background:"gray",opacity:.8,color:a.palette.mode==="dark"?"black":"white"}),silly:a=>({background:"gray",opacity:.6,color:a.palette.mode==="dark"?"black":"white"}),table:{fontFamily:"monospace",width:"100%"},toolbox:{width:I_,height:"100%",boxShadow:"2px 0px 4px -1px rgba(0, 0, 0, 0.2), 4px 0px 5px 0px rgba(0, 0, 0, 0.14), 1px 0px 10px 0px rgba(0, 0, 0, 0.12)",display:"inline-block",verticalAlign:"top",overflow:"hidden"},trFrom:{width:90},trTime:{width:90},trSeverity:{width:40,fontWeight:"bold"},trPreMessage:{padding:0,margin:0},iconButtons:{width:32,height:32,padding:4},layoutIcon:a=>({"& img":{width:24,height:24,background:a.palette.mode==="dark"?"#9d9d9d":void 0,borderRadius:a.palette.mode==="dark"?"30px":void 0}})};function Lx(a){return a<10?`00${a}`:a<100?`0${a}`:a.toString()}const Ks={};class bm extends Y.Component{messagesEnd;constructor(s){super(s),this.state={lines:{},goBottom:!0,selected:null,editing:this.props.editing||[]},this.messagesEnd=Y.createRef()}static generateLine(s,i){let r=s.message||"";if(typeof r!="object"){const l=new RegExp(`${s.from.replace(".","\\.").replace(")","\\)").replace("(","\\(")} \\(\\d+\\) `,"g"),u=r.match(l);u?r=r.replace(u[0],""):r=r.replace(`${s.from} `,"")}return r.startsWith(`${i}: `)&&(r=r.substring(i.length+2)),g.jsxs($t,{component:"tr",sx:Bt[s.severity],children:[g.jsx("td",{style:Bt.trFrom,children:s.from}),g.jsx("td",{style:Bt.trTime,children:Nx(new Date(s.ts))}),g.jsx("td",{style:Bt.trSeverity,children:s.severity}),g.jsx("td",{children:g.jsx("pre",{style:Bt.trPreMessage,children:r})})]},`tr_${s.ts}_${s.message.substring(s.message.length-10)}`)}scrollToBottom(){var s,i;(i=(s=this.messagesEnd)==null?void 0:s.current)==null||i.scrollIntoView({behavior:"smooth"})}logHandler=s=>{const i=this.state.lines,r=this.state.editing.filter(f=>s.message.includes(f));let l=null;if(!r.length||(r.length===1?l=r[0]:(r.sort(),l=r[r.length-1]),!l))return;const u=i[l]||[],d=Ks[l]||[];u.push(bm.generateLine(s,l));let p=s.severity;(p==="info"||p==="warn")&&(p+=" ");const m=new Date(s.ts);d.push(`${m.toLocaleString()}.${Lx(m.getMilliseconds())} [${p}]: ${s.message}`),u.length>300&&(u.splice(0,u.length-300),d.splice(0,u.length-300)),Ks[l]=d,i[l]=u,this.setState({lines:i})};componentDidMount(){this.props.socket.registerLogHandler(this.logHandler)}componentWillUnmount(){this.props.socket.unregisterLogHandler(this.logHandler)}componentDidUpdate(){this.state.goBottom&&this.scrollToBottom()}static getDerivedStateFromProps(s,i){let r=!1;const l={};if(s.selected!==i.selected){const u=s.selected,d=i.lines;u&&(d[u]=d[u]||[],Ks[u]=Ks[u]||[]),l.selected=u,r=!0}if(JSON.stringify(s.editing)!==JSON.stringify(i.editing)){const u=JSON.parse(JSON.stringify(s.editing));r=!0;const d=i.lines;for(const p in Ks)Object.prototype.hasOwnProperty.call(Ks,p)&&(u.includes(p)||(delete Ks[p],delete d[p]));l.editing=u}return r?l:null}onCopy(){b.Utils.copyToClipboard((Ks[this.state.selected]||[]).join(`
93
+ `))}clearLog(){const s=this.state.lines;s[this.state.selected]&&(s[this.state.selected]=[]),Ks[this.state.selected]&&(Ks[this.state.selected]=[]),this.setState({lines:s})}renderLogList(s){return this.state.selected&&(s!=null&&s.length)?g.jsxs($t,{sx:Bt.logBoxInner,children:[g.jsx("table",{style:Bt.table,children:g.jsx("tbody",{children:s})},"logTable"),g.jsx("div",{ref:this.messagesEnd,style:{float:"left",clear:"both"}},"logScrollPoint")]},"logList"):g.jsx($t,{sx:Bt.logBoxInner,style:{paddingLeft:10},children:b.I18n.t("Log outputs")},"logList")}render(){const s=this.state.selected?this.state.lines[this.state.selected]:null;return g.jsxs("div",{style:Bt.logBox,children:[g.jsxs("div",{style:Bt.toolbox,children:[g.jsx(Me,{style:Bt.iconButtons,onClick:()=>this.setState({goBottom:!this.state.goBottom}),color:this.state.goBottom?"secondary":void 0,size:"medium",children:g.jsx(sS,{})}),s!=null&&s.length?g.jsx(Me,{style:Bt.iconButtons,onClick:()=>this.clearLog(),size:"medium",children:g.jsx(oS,{})}):null,s!=null&&s.length?g.jsx(Me,{style:Bt.iconButtons,onClick:()=>this.onCopy(),size:"medium",children:g.jsx(iS,{})}):null,this.props.onLayoutChange?g.jsx(Me,{style:Bt.iconButtons,onClick:()=>this.props.onLayoutChange&&this.props.onLayoutChange(),title:b.I18n.t("Change layout"),size:"medium",sx:Bt.layoutIcon,children:g.jsx("img",{alt:"split",src:this.props.verticalLayout?Ox:Mx})}):null,g.jsx(Me,{style:Bt.iconButtons,onClick:()=>this.props.onHideLog(),title:b.I18n.t("Hide logs"),size:"medium",children:g.jsx(nS,{})})]},"toolbox"),this.renderLogList(s)]})}}var x_="focus-outline-hidden";function $C(){var a=this;document.addEventListener("keydown",function(s){a.focusByKeyboard=!0},!0),document.addEventListener("mousedown",function(s){a.focusByKeyboard=!1},!0),document.addEventListener("focus",function(s){a.updateVisibility()},!0),document.addEventListener("focusout",function(s){window.setTimeout(function(){document.hasFocus()||(a.focusByKeyboard=!0,a.updateVisibility())},0)}),this.updateVisibility()}$C.prototype={focusByKeyboard:!0,updateVisibility:function(){this.hidden=!this.focusByKeyboard},set hidden(a){document.documentElement.classList.toggle(x_,a)},get hidden(){return document.documentElement.classList.contains(x_)}};new $C;var bC={exports:{}};(function(a){(function(){var s={}.hasOwnProperty;function i(){for(var r=[],l=0;l<arguments.length;l++){var u=arguments[l];if(u){var d=typeof u;if(d==="string"||d==="number")r.push(u);else if(Array.isArray(u)){if(u.length){var p=i.apply(null,u);p&&r.push(p)}}else if(d==="object")if(u.toString===Object.prototype.toString)for(var m in u)s.call(u,m)&&u[m]&&r.push(m);else r.push(u.toString())}}return r.join(" ")}a.exports?(i.default=i,a.exports=i):window.classNames=i})()})(bC);var Px=bC.exports;const D_=Si(Px);var Wg={exports:{}},Vg={exports:{}},Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});var Bx=Ei.easeFunctions={linear:function(s){return s},easeInQuad:function(s){return s*s},easeOutQuad:function(s){return s*(2-s)},easeInOutQuad:function(s){return s<.5?2*s*s:-1+(4-2*s)*s},easeInCubic:function(s){return s*s*s},easeOutCubic:function(s){return--s*s*s+1},easeInOutCubic:function(s){return s<.5?4*s*s*s:(s-1)*(2*s-2)*(2*s-2)+1},easeInQuart:function(s){return s*s*s*s},easeOutQuart:function(s){return 1- --s*s*s*s},easeInOutQuart:function(s){return s<.5?8*s*s*s*s:1-8*--s*s*s*s},easeInQuint:function(s){return s*s*s*s*s},easeOutQuint:function(s){return 1+--s*s*s*s*s},easeInOutQuint:function(s){return s<.5?16*s*s*s*s*s:1+16*--s*s*s*s*s}},jx=Ei.isNumeric=function(s){return!isNaN(parseFloat(s))&&isFinite(s)};Ei.setPosition=function(s,i,r,l){var u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"easeInOutCubic";return r>l?i:s+(i-s)*Bx[u](r/l)};Ei.calcEndPoint=function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:window,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(jx(s))return parseInt(s)+r;var l=i===window||i===document.documentElement?window.pageYOffset:i.scrollTop-i.getBoundingClientRect().top,u=s.nodeName.toLowerCase()==="html"?-l:s.getBoundingClientRect().top+l;return u+r};(function(a,s){Object.defineProperty(s,"__esModule",{value:!0});var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},r=Ei;s.default=function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=u.duration,p=d===void 0?500:d,m=u.context,f=m===void 0?window:m,v=u.offset,_=v===void 0?0:v,y=u.ease,k=y===void 0?"easeInOutCubic":y,C=u.callback;if((typeof window>"u"?"undefined":i(window))==="object"){var w=f.scrollTop!==null&&f.scrollTop!==void 0?f.scrollTop:window.pageYOffset,E=(0,r.calcEndPoint)(l,f,_),R=performance.now(),D=window.requestAnimationFrame,A=function J(){var ie=performance.now()-R,se=(0,r.setPosition)(w,E,ie,p,k);f!==window?f.scrollTop=se:window.scroll(0,se),ie>p?typeof C=="function"&&C(l):D(J)};A()}},a.exports=s.default})(Vg,Vg.exports);var vC=Vg.exports,Gg={exports:{}};(function(a,s){Object.defineProperty(s,"__esModule",{value:!0});var i=Object.assign||function(d){for(var p=1;p<arguments.length;p++){var m=arguments[p];for(var f in m)Object.prototype.hasOwnProperty.call(m,f)&&(d[f]=m[f])}return d},r=vC,l=u(r);function u(d){return d&&d.__esModule?d:{default:d}}s.default=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=d.query,m=p===void 0?'[href^="#"]:not([href="#"]':p,f=d.match,v=f===void 0?function(E){return document.getElementById(E.hash.substring(1))}:f,_=d.hashChange,y=_===void 0?!0:_,k=d.scrollSmoothConfig,C=document.querySelectorAll(m),w=function(R){R.preventDefault();var D=v(R.target);D&&(y&&history.replaceState(null,null,"#"+D.id),(0,l.default)(D,i({},k)))};Array.from(C).map(function(E){E.addEventListener("click",w,!1)})},a.exports=s.default})(Gg,Gg.exports);var Fx=Gg.exports,Kg={exports:{}};(function(a,s){Object.defineProperty(s,"__esModule",{value:!0});function i(r){if(Array.isArray(r)){for(var l=0,u=Array(r.length);l<r.length;l++)u[l]=r[l];return u}else return Array.from(r)}s.default=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=r.activeClass,u=l===void 0?"active":l,d=r.query,p=d===void 0?'[href^="#"]:not([href="#"]):not([href="#0"])':d,m=r.threshold,f=m===void 0?[.25,.5,.75]:m,v=r.detectType,_=v===void 0?"max":v,y={threshold:f},k=function(se){return se.classList.remove(u)},C=function(se){return se.classList.add(u)},w=function(){document.querySelectorAll("."+u).forEach(k)},E=function(se){w(),C(document.querySelector('a[href="#'+se.id+'"]'))},R=function(se){se.forEach(function(me){me.intersectionRatio>=Math[_].apply(Math,i(f))&&E(me.target)})},D=document.querySelectorAll(p),A=new IntersectionObserver(R,y),J=function(se){var me=document.querySelector("#"+se.hash.slice(1));A.observe(me)};D.forEach(J)},a.exports=s.default})(Kg,Kg.exports);var zx=Kg.exports;(function(a,s){Object.defineProperty(s,"__esModule",{value:!0});var i=vC,r=f(i),l=Ei,u=Fx,d=f(u),p=zx,m=f(p);function f(v){return v&&v.__esModule?v:{default:v}}s.default={to:r.default,calcEndPoint:l.calcEndPoint,anchorScroll:d.default,observe:m.default},a.exports=s.default})(Wg,Wg.exports);var Ux=Wg.exports;const Hx=Si(Ux);var vm={exports:{}},Wx=vm.exports;(function(a){(function(s,i){a.exports?a.exports=i():s.Scrollparent=i()})(Wx,function(){var s=/(auto|scroll)/,i=function(p,m){return p.parentNode===null?m:i(p.parentNode,m.concat([p]))},r=function(p,m){return getComputedStyle(p,null).getPropertyValue(m)},l=function(p){return r(p,"overflow")+r(p,"overflow-y")+r(p,"overflow-x")},u=function(p){return s.test(l(p))},d=function(p){if(p instanceof HTMLElement||p instanceof SVGElement){for(var m=i(p.parentNode,[]),f=0;f<m.length;f+=1)if(u(m[f]))return m[f];return document.scrollingElement||document.documentElement}};return d})})(vm);var Vx=vm.exports;const Gx=Si(Vx);var Kx="Expected a function",A_=NaN,Yx="[object Symbol]",Jx=/^\s+|\s+$/g,qx=/^[-+]0x[0-9a-f]+$/i,Xx=/^0b[01]+$/i,Zx=/^0o[0-7]+$/i,Qx=parseInt,eD=typeof wn=="object"&&wn&&wn.Object===Object&&wn,tD=typeof self=="object"&&self&&self.Object===Object&&self,sD=eD||tD||Function("return this")(),oD=Object.prototype,iD=oD.toString,nD=Math.max,rD=Math.min,sg=function(){return sD.Date.now()};function aD(a,s,i){var r,l,u,d,p,m,f=0,v=!1,_=!1,y=!0;if(typeof a!="function")throw new TypeError(Kx);s=R_(s)||0,Yg(i)&&(v=!!i.leading,_="maxWait"in i,u=_?nD(R_(i.maxWait)||0,s):u,y="trailing"in i?!!i.trailing:y);function k(se){var me=r,z=l;return r=l=void 0,f=se,d=a.apply(z,me),d}function C(se){return f=se,p=setTimeout(R,s),v?k(se):d}function w(se){var me=se-m,z=se-f,Oe=s-me;return _?rD(Oe,u-z):Oe}function E(se){var me=se-m,z=se-f;return m===void 0||me>=s||me<0||_&&z>=u}function R(){var se=sg();if(E(se))return D(se);p=setTimeout(R,w(se))}function D(se){return p=void 0,y&&r?k(se):(r=l=void 0,d)}function A(){p!==void 0&&clearTimeout(p),f=0,r=m=l=p=void 0}function J(){return p===void 0?d:D(sg())}function ie(){var se=sg(),me=E(se);if(r=arguments,l=this,m=se,me){if(p===void 0)return C(m);if(_)return p=setTimeout(R,s),k(m)}return p===void 0&&(p=setTimeout(R,s)),d}return ie.cancel=A,ie.flush=J,ie}function Yg(a){var s=typeof a;return!!a&&(s=="object"||s=="function")}function lD(a){return!!a&&typeof a=="object"}function cD(a){return typeof a=="symbol"||lD(a)&&iD.call(a)==Yx}function R_(a){if(typeof a=="number")return a;if(cD(a))return A_;if(Yg(a)){var s=typeof a.valueOf=="function"?a.valueOf():a;a=Yg(s)?s+"":s}if(typeof a!="string")return a===0?a:+a;a=a.replace(Jx,"");var i=Xx.test(a);return i||Zx.test(a)?Qx(a.slice(2),i?2:8):qx.test(a)?A_:+a}var uD=aD;const dD=Si(uD);var Jg="data-focus-lock",yC="data-focus-lock-disabled",hD="data-no-focus-lock",pD="data-autofocus-inside",gD="data-no-autofocus";function og(a,s){return typeof a=="function"?a(s):a&&(a.current=s),a}function mD(a,s){var i=vt(function(){return{value:a,callback:s,facade:{get current(){return i.value},set current(r){var l=i.value;l!==r&&(i.value=r,i.callback(r,l))}}}})[0];return i.callback=s,i.facade}var fD=typeof window<"u"?lm:Mt,O_=new WeakMap;function $D(a,s){var i=mD(null,function(r){return a.forEach(function(l){return og(l,r)})});return fD(function(){var r=O_.get(i);if(r){var l=new Set(r),u=new Set(a),d=i.current;l.forEach(function(p){u.has(p)||og(p,null)}),u.forEach(function(p){l.has(p)||og(p,d)})}O_.set(i,a)},[a]),i}var ig={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"};function _C(a){return a}function wC(a,s){s===void 0&&(s=_C);var i=[],r=!1,l={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:a},useMedium:function(u){var d=s(u,r);return i.push(d),function(){i=i.filter(function(p){return p!==d})}},assignSyncMedium:function(u){for(r=!0;i.length;){var d=i;i=[],d.forEach(u)}i={push:function(p){return u(p)},filter:function(){return i}}},assignMedium:function(u){r=!0;var d=[];if(i.length){var p=i;i=[],p.forEach(u),d=i}var m=function(){var v=d;d=[],v.forEach(u)},f=function(){return Promise.resolve().then(m)};f(),i={push:function(v){d.push(v),f()},filter:function(v){return d=d.filter(v),i}}}};return l}function ym(a,s){return s===void 0&&(s=_C),wC(a,s)}function bD(a){a===void 0&&(a={});var s=wC(null);return s.options=rS({async:!0,ssr:!1},a),s}var CC=ym({},function(a){var s=a.target,i=a.currentTarget;return{target:s,currentTarget:i}}),TC=ym(),vD=ym(),yD=bD({async:!0,ssr:typeof document<"u"}),_D=rm(void 0),wD=[],_m=Sw(function(s,i){var r,l=vt(),u=l[0],d=l[1],p=Bo(),m=Bo(!1),f=Bo(null),v=vt({}),_=v[1],y=s.children,k=s.disabled,C=k===void 0?!1:k,w=s.noFocusGuards,E=w===void 0?!1:w,R=s.persistentFocus,D=R===void 0?!1:R,A=s.crossFrame,J=A===void 0?!0:A,ie=s.autoFocus,se=ie===void 0?!0:ie;s.allowTextSelection;var me=s.group,z=s.className,Oe=s.whiteList,Ne=s.hasPositiveIndices,Ze=s.shards,ae=Ze===void 0?wD:Ze,ce=s.as,K=ce===void 0?"div":ce,ye=s.lockProps,he=ye===void 0?{}:ye,je=s.sideCar,G=s.returnFocus,tt=G===void 0?!1:G,q=s.focusOptions,ee=s.onActivation,B=s.onDeactivation,H=vt({}),U=H[0],re=_n(function(ke){var $e=ke.captureFocusRestore;if(!f.current){var Pe,bt=(Pe=document)==null?void 0:Pe.activeElement;f.current=bt,bt!==document.body&&(f.current=$e(bt))}p.current&&ee&&ee(p.current),m.current=!0,_()},[ee]),I=_n(function(){m.current=!1,B&&B(p.current),_()},[B]),de=_n(function(ke){var $e=f.current;if($e){var Pe=(typeof $e=="function"?$e():$e)||document.body,bt=typeof tt=="function"?tt(Pe):tt;if(bt){var X=typeof bt=="object"?bt:void 0;f.current=null,ke?Promise.resolve().then(function(){return Pe.focus(X)}):Pe.focus(X)}}},[tt]),W=_n(function(ke){m.current&&CC.useMedium(ke)},[]),Ce=TC.useMedium,be=_n(function(ke){p.current!==ke&&(p.current=ke,d(ke))},[]),Se=Tg((r={},r[yC]=C&&"disabled",r[Jg]=me,r),he),pe=E!==!0,Ge=pe&&E!=="tail",Je=$D([i,be]),_e=rs(function(){return{observed:p,shards:ae,enabled:!C,active:m.current}},[C,m.current,ae,u]);return Y.createElement(Sg,null,pe&&[Y.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:C?-1:0,style:ig}),Ne?Y.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:C?-1:1,style:ig}):null],!C&&Y.createElement(je,{id:U,sideCar:yD,observed:u,disabled:C,persistentFocus:D,crossFrame:J,autoFocus:se,whiteList:Oe,shards:ae,onActivation:re,onDeactivation:I,returnFocus:de,focusOptions:q,noFocusGuards:E}),Y.createElement(K,Tg({ref:Je},Se,{className:z,onBlur:Ce,onFocus:W}),Y.createElement(_D.Provider,{value:_e},y)),Ge&&Y.createElement("div",{"data-focus-guard":!0,tabIndex:C?-1:0,style:ig}))});_m.propTypes={};function CD(a,s){function i(r){return r.displayName||r.name||"Component"}return function(l){var u=[],d;function p(){d=a(u.map(function(f){return f.props})),s(d)}var m=(function(f){SS(v,f);function v(){return f.apply(this,arguments)||this}v.peek=function(){return d};var _=v.prototype;return _.componentDidMount=function(){u.push(this),p()},_.componentDidUpdate=function(){p()},_.componentWillUnmount=function(){var k=u.indexOf(this);u.splice(k,1),p()},_.render=function(){return Y.createElement(l,this.props)},v})(Dk);return GS(m,"displayName","SideEffect("+i(l)+")"),m}}var Xs=function(a){for(var s=Array(a.length),i=0;i<a.length;++i)s[i]=a[i];return s},Ti=function(a){return Array.isArray(a)?a:[a]},kC=function(a){return Array.isArray(a)?a[0]:a},TD=function(a){if(a.nodeType!==Node.ELEMENT_NODE)return!1;var s=window.getComputedStyle(a,null);return!s||!s.getPropertyValue?!1:s.getPropertyValue("display")==="none"||s.getPropertyValue("visibility")==="hidden"},SC=function(a){return a.parentNode&&a.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?a.parentNode.host:a.parentNode},EC=function(a){return a===document||a&&a.nodeType===Node.DOCUMENT_NODE},kD=function(a){return a.hasAttribute("inert")},SD=function(a,s){return!a||EC(a)||!TD(a)&&!kD(a)&&s(SC(a))},IC=function(a,s){var i=a.get(s);if(i!==void 0)return i;var r=SD(s,IC.bind(void 0,a));return a.set(s,r),r},ED=function(a,s){return a&&!EC(a)?DD(a)?s(SC(a)):!1:!0},xC=function(a,s){var i=a.get(s);if(i!==void 0)return i;var r=ED(s,xC.bind(void 0,a));return a.set(s,r),r},DC=function(a){return a.dataset},ID=function(a){return a.tagName==="BUTTON"},AC=function(a){return a.tagName==="INPUT"},RC=function(a){return AC(a)&&a.type==="radio"},xD=function(a){return!((AC(a)||ID(a))&&(a.type==="hidden"||a.disabled))},DD=function(a){var s=a.getAttribute(gD);return![!0,"true",""].includes(s)},wm=function(a){var s;return!!(a&&(!((s=DC(a))===null||s===void 0)&&s.focusGuard))},qg=function(a){return!wm(a)},AD=function(a){return!!a},RD=function(a,s){var i=Math.max(0,a.tabIndex),r=Math.max(0,s.tabIndex),l=i-r,u=a.index-s.index;if(l){if(!i)return 1;if(!r)return-1}return l||u},OD=function(a){return a.tabIndex<0&&!a.hasAttribute("tabindex")?0:a.tabIndex},Cm=function(a,s,i){return Xs(a).map(function(r,l){var u=OD(r);return{node:r,index:l,tabIndex:i&&u===-1?(r.dataset||{}).focusGuard?0:-1:u}}).filter(function(r){return!s||r.tabIndex>=0}).sort(RD)},MD=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],Tm=MD.join(","),ND="".concat(Tm,", [data-focus-guard]"),OC=function(a,s){return Xs((a.shadowRoot||a).children).reduce(function(i,r){return i.concat(r.matches(s?ND:Tm)?[r]:[],OC(r))},[])},LD=function(a,s){var i;return a instanceof HTMLIFrameElement&&(!((i=a.contentDocument)===null||i===void 0)&&i.body)?An([a.contentDocument.body],s):[a]},An=function(a,s){return a.reduce(function(i,r){var l,u=OC(r,s),d=(l=[]).concat.apply(l,u.map(function(p){return LD(p,s)}));return i.concat(d,r.parentNode?Xs(r.parentNode.querySelectorAll(Tm)).filter(function(p){return p===r}):[])},[])},PD=function(a){var s=a.querySelectorAll("[".concat(pD,"]"));return Xs(s).map(function(i){return An([i])}).reduce(function(i,r){return i.concat(r)},[])},km=function(a,s){return Xs(a).filter(function(i){return IC(s,i)}).filter(function(i){return xD(i)})},M_=function(a,s){return s===void 0&&(s=new Map),Xs(a).filter(function(i){return xC(s,i)})},Sm=function(a,s,i){return Cm(km(An(a,i),s),!0,i)},Kr=function(a,s){return Cm(km(An(a),s),!1)},BD=function(a,s){return km(PD(a),s)},yi=function(a,s){return a.shadowRoot?yi(a.shadowRoot,s):Object.getPrototypeOf(a).contains!==void 0&&Object.getPrototypeOf(a).contains.call(a,s)?!0:Xs(a.children).some(function(i){var r;if(i instanceof HTMLIFrameElement){var l=(r=i.contentDocument)===null||r===void 0?void 0:r.body;return l?yi(l,s):!1}return yi(i,s)})},jD=function(a){for(var s=new Set,i=a.length,r=0;r<i;r+=1)for(var l=r+1;l<i;l+=1){var u=a[r].compareDocumentPosition(a[l]);(u&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&s.add(l),(u&Node.DOCUMENT_POSITION_CONTAINS)>0&&s.add(r)}return a.filter(function(d,p){return!s.has(p)})},MC=function(a){return a.parentNode?MC(a.parentNode):a},Em=function(a){var s=Ti(a);return s.filter(Boolean).reduce(function(i,r){var l=r.getAttribute(Jg);return i.push.apply(i,l?jD(Xs(MC(r).querySelectorAll("[".concat(Jg,'="').concat(l,'"]:not([').concat(yC,'="disabled"])')))):[r]),i},[])},FD=function(a){try{return a()}catch{return}},Yr=function(a){if(a===void 0&&(a=document),!(!a||!a.activeElement)){var s=a.activeElement;return s.shadowRoot?Yr(s.shadowRoot):s instanceof HTMLIFrameElement&&FD(function(){return s.contentWindow.document})?Yr(s.contentWindow.document):s}},zD=function(a,s){return a===s},UD=function(a,s){return!!Xs(a.querySelectorAll("iframe")).some(function(i){return zD(i,s)})},NC=function(a,s){return s===void 0&&(s=Yr(kC(a).ownerDocument)),!s||s.dataset&&s.dataset.focusGuard?!1:Em(a).some(function(i){return yi(i,s)||UD(i,s)})},HD=function(a){a===void 0&&(a=document);var s=Yr(a);return s?Xs(a.querySelectorAll("[".concat(hD,"]"))).some(function(i){return yi(i,s)}):!1},WD=function(a,s){return s.filter(RC).filter(function(i){return i.name===a.name}).filter(function(i){return i.checked})[0]||a},Im=function(a,s){return RC(a)&&a.name?WD(a,s):a},VD=function(a){var s=new Set;return a.forEach(function(i){return s.add(Im(i,a))}),a.filter(function(i){return s.has(i)})},N_=function(a){return a[0]&&a.length>1?Im(a[0],a):a[0]},L_=function(a,s){return a.indexOf(Im(s,a))},Xg="NEW_FOCUS",GD=function(a,s,i,r,l){var u=a.length,d=a[0],p=a[u-1],m=wm(r);if(!(r&&a.indexOf(r)>=0)){var f=r!==void 0?i.indexOf(r):-1,v=l?i.indexOf(l):f,_=l?a.indexOf(l):-1;if(f===-1)return _!==-1?_:Xg;if(_===-1)return Xg;var y=f-v,k=i.indexOf(d),C=i.indexOf(p),w=VD(i),E=r!==void 0?w.indexOf(r):-1,R=l?w.indexOf(l):E,D=w.filter(function(z){return z.tabIndex>=0}),A=r!==void 0?D.indexOf(r):-1,J=l?D.indexOf(l):A,ie=A>=0&&J>=0?J-A:R-E;if(!y&&_>=0||s.length===0)return _;var se=L_(a,s[0]),me=L_(a,s[s.length-1]);if(f<=k&&m&&Math.abs(y)>1)return me;if(f>=C&&m&&Math.abs(y)>1)return se;if(y&&Math.abs(ie)>1)return _;if(f<=k)return me;if(f>C)return se;if(y)return Math.abs(y)>1?_:(u+_+y)%u}},KD=function(a){return function(s){var i,r=(i=DC(s))===null||i===void 0?void 0:i.autofocus;return s.autofocus||r!==void 0&&r!=="false"||a.indexOf(s)>=0}},P_=function(a,s,i){var r=a.map(function(u){var d=u.node;return d}),l=M_(r.filter(KD(i)));return l&&l.length?N_(l):N_(M_(s))},Zg=function(a,s){return s===void 0&&(s=[]),s.push(a),a.parentNode&&Zg(a.parentNode.host||a.parentNode,s),s},ng=function(a,s){for(var i=Zg(a),r=Zg(s),l=0;l<i.length;l+=1){var u=i[l];if(r.indexOf(u)>=0)return u}return!1},LC=function(a,s,i){var r=Ti(a),l=Ti(s),u=r[0],d=!1;return l.filter(Boolean).forEach(function(p){d=ng(d||p,p)||d,i.filter(Boolean).forEach(function(m){var f=ng(u,m);f&&(!d||yi(f,d)?d=f:d=ng(f,d))})}),d},B_=function(a,s){return a.reduce(function(i,r){return i.concat(BD(r,s))},[])},YD=function(a,s){var i=new Map;return s.forEach(function(r){return i.set(r.node,r)}),a.map(function(r){return i.get(r)}).filter(AD)},JD=function(a,s){var i=Yr(Ti(a).length>0?document:kC(a).ownerDocument),r=Em(a).filter(qg),l=LC(i||a,a,r),u=new Map,d=Kr(r,u),p=d.filter(function(C){var w=C.node;return qg(w)});if(p[0]){var m=Kr([l],u).map(function(C){var w=C.node;return w}),f=YD(m,p),v=f.map(function(C){var w=C.node;return w}),_=f.filter(function(C){var w=C.tabIndex;return w>=0}).map(function(C){var w=C.node;return w}),y=GD(v,_,m,i,s);if(y===Xg){var k=P_(d,_,B_(r,u))||P_(d,v,B_(r,u));if(k)return{node:k};console.warn("focus-lock: cannot find any node to move focus into");return}return y===void 0?y:f[y]}},qD=function(a){var s=Em(a).filter(qg),i=LC(a,a,s),r=Cm(An([i],!0),!0,!0),l=An(s,!1);return r.map(function(u){var d=u.node,p=u.index;return{node:d,index:p,lockItem:l.indexOf(d)>=0,guard:wm(d)}})},xm=function(a,s){a&&("focus"in a&&a.focus(s),"contentWindow"in a&&a.contentWindow&&a.contentWindow.focus())},rg=0,ag=!1,PC=function(a,s,i){i===void 0&&(i={});var r=JD(a,s);if(!ag&&r){if(rg>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),ag=!0,setTimeout(function(){ag=!1},1);return}rg++,xm(r.node,i.focusOptions),rg--}};function Lr(a){if(!a)return null;if(typeof WeakRef>"u")return function(){return a||null};var s=a?new WeakRef(a):null;return function(){return(s==null?void 0:s.deref())||null}}var XD=function(a){if(!a)return null;for(var s=[],i=a;i&&i!==document.body;)s.push({current:Lr(i),parent:Lr(i.parentElement),left:Lr(i.previousElementSibling),right:Lr(i.nextElementSibling)}),i=i.parentElement;return{element:Lr(a),stack:s,ownerDocument:a.ownerDocument}},ZD=function(a){var s,i,r,l,u;if(a)for(var d=a.stack,p=a.ownerDocument,m=new Map,f=0,v=d;f<v.length;f++){var _=v[f],y=(s=_.parent)===null||s===void 0?void 0:s.call(_);if(y&&p.contains(y)){for(var k=(i=_.left)===null||i===void 0?void 0:i.call(_),C=_.current(),w=y.contains(C)?C:void 0,E=(r=_.right)===null||r===void 0?void 0:r.call(_),R=Sm([y],m),D=(u=(l=w??(k==null?void 0:k.nextElementSibling))!==null&&l!==void 0?l:E)!==null&&u!==void 0?u:k;D;){for(var A=0,J=R;A<J.length;A++){var ie=J[A];if(D!=null&&D.contains(ie.node))return ie.node}D=D.nextElementSibling}if(R.length)return R[0].node}}},BC=function(a){var s=XD(a);return function(){return ZD(s)}},QD=function(a,s,i){if(!a||!s)return console.error("no element or scope given"),{};var r=Ti(s);if(r.every(function(d){return!yi(d,a)}))return console.error("Active element is not contained in the scope"),{};var l=i?Sm(r,new Map):Kr(r,new Map),u=l.findIndex(function(d){var p=d.node;return p===a});if(u!==-1)return{prev:l[u-1],next:l[u+1],first:l[0],last:l[l.length-1]}},eA=function(a,s){var i=s?Sm(Ti(a),new Map):Kr(Ti(a),new Map);return{first:i[0],last:i[i.length-1]}},tA=function(a){return Object.assign({scope:document.body,cycle:!0,onlyTabbable:!0},a)},jC=function(a,s,i){s===void 0&&(s={});var r=tA(s),l=QD(a,r.scope,r.onlyTabbable);if(l){var u=i(l,r.cycle);u&&xm(u.node,r.focusOptions)}},sA=function(a,s){s===void 0&&(s={}),jC(a,s,function(i,r){var l=i.next,u=i.first;return l||r&&u})},oA=function(a,s){s===void 0&&(s={}),jC(a,s,function(i,r){var l=i.prev,u=i.last;return l||r&&u})},FC=function(a,s,i){var r,l=eA(a,(r=s.onlyTabbable)!==null&&r!==void 0?r:!0),u=l[i];u&&xm(u.node,s.focusOptions)},iA=function(a,s){s===void 0&&(s={}),FC(a,s,"first")},nA=function(a,s){s===void 0&&(s={}),FC(a,s,"last")};function Dm(a){setTimeout(a,1)}var rA=function(s){return s&&"current"in s?s.current:s},zC=function(){return document&&document.activeElement===document.body},aA=function(){return zC()||HD()},Sn=null,Zt=null,j_=function(){return null},En=null,Jr=!1,Am=!1,lA=function(){return!0},cA=function(s){return(Sn.whiteList||lA)(s)},uA=function(s,i){En={observerNode:s,portaledElement:i}},dA=function(s){return En&&En.portaledElement===s};function F_(a,s,i,r){var l=null,u=a;do{var d=r[u];if(d.guard)d.node.dataset.focusAutoGuard&&(l=d);else if(d.lockItem){if(u!==a)return;l=null}else break}while((u+=i)!==s);l&&(l.node.tabIndex=0)}var hA=function(s){return s?!!Jr:Jr==="meanwhile"},pA=function a(s,i,r){return i&&(i.host===s&&(!i.activeElement||r.contains(i.activeElement))||i.parentNode&&a(s,i.parentNode,r))},gA=function(s,i){return i.some(function(r){return pA(s,r,r)})},UC=function(s){return Kr(s,new Map)},mA=function(s){return!UC([s.parentNode]).some(function(i){return i.node===s})},wc=function(){var s=!1;if(Sn){var i=Sn,r=i.observed,l=i.persistentFocus,u=i.autoFocus,d=i.shards,p=i.crossFrame,m=i.focusOptions,f=i.noFocusGuards,v=r||En&&En.portaledElement;if(zC()&&Zt&&Zt!==document.body&&(!document.body.contains(Zt)||mA(Zt))){var _=j_();_&&_.focus()}var y=document&&document.activeElement;if(v){var k=[v].concat(d.map(rA).filter(Boolean)),C=function(){if(!hA(p)||!f||!Zt||Am)return!1;var A=UC(k),J=A.findIndex(function(ie){var se=ie.node;return se===Zt});return J===0||J===A.length-1};if((!y||cA(y))&&(l||C()||!aA()||!Zt&&u)&&(v&&!(NC(k)||y&&gA(y,k)||dA(y))&&(document&&!Zt&&y&&!u?(y.blur&&y.blur(),document.body.focus()):(s=PC(k,Zt,{focusOptions:m}),En={})),Zt=document&&document.activeElement,Zt!==document.body&&(j_=BC(Zt)),Jr=!1),document&&y!==document.activeElement&&document.querySelector("[data-focus-auto-guard]")){var w=document&&document.activeElement,E=qD(k),R=E.map(function(D){var A=D.node;return A}).indexOf(w);R>-1&&(E.filter(function(D){var A=D.guard,J=D.node;return A&&J.dataset.focusAutoGuard}).forEach(function(D){var A=D.node;return A.removeAttribute("tabIndex")}),F_(R,E.length,1,E),F_(R,-1,-1,E))}}}return s},HC=function(s){wc()&&s&&(s.stopPropagation(),s.preventDefault())},Rm=function(){return Dm(wc)},fA=function(s){var i=s.target,r=s.currentTarget;r.contains(i)||uA(r,i)},$A=function(){return null},WC=function(){Am=!0},VC=function(){Am=!1,Jr="just",Dm(function(){Jr="meanwhile"})},bA=function(){document.addEventListener("focusin",HC),document.addEventListener("focusout",Rm),window.addEventListener("focus",WC),window.addEventListener("blur",VC)},vA=function(){document.removeEventListener("focusin",HC),document.removeEventListener("focusout",Rm),window.removeEventListener("focus",WC),window.removeEventListener("blur",VC)};function yA(a){return a.filter(function(s){var i=s.disabled;return!i})}var GC={moveFocusInside:PC,focusInside:NC,focusNextElement:sA,focusPrevElement:oA,focusFirstElement:iA,focusLastElement:nA,captureFocusRestore:BC};function _A(a){var s=a.slice(-1)[0];s&&!Sn&&bA();var i=Sn,r=i&&s&&s.id===i.id;Sn=s,i&&!r&&(i.onDeactivation(),a.filter(function(l){var u=l.id;return u===i.id}).length||i.returnFocus(!s)),s?(Zt=null,(!r||i.observed!==s.observed)&&s.onActivation(GC),wc(),Dm(wc)):(vA(),Zt=null)}CC.assignSyncMedium(fA);TC.assignMedium(Rm);vD.assignMedium(function(a){return a(GC)});const wA=CD(yA,_A)($A);var KC=Sw(function(s,i){return Y.createElement(_m,Tg({sideCar:wA,ref:i},s))}),YC=_m.propTypes||{};YC.sideCar;ES(YC,["sideCar"]);KC.propTypes={};var JC={exports:{}},et={};var Om=Symbol.for("react.element"),Mm=Symbol.for("react.portal"),Qc=Symbol.for("react.fragment"),eu=Symbol.for("react.strict_mode"),tu=Symbol.for("react.profiler"),su=Symbol.for("react.provider"),ou=Symbol.for("react.context"),CA=Symbol.for("react.server_context"),iu=Symbol.for("react.forward_ref"),nu=Symbol.for("react.suspense"),ru=Symbol.for("react.suspense_list"),au=Symbol.for("react.memo"),lu=Symbol.for("react.lazy"),TA=Symbol.for("react.offscreen"),qC;qC=Symbol.for("react.module.reference");function _s(a){if(typeof a=="object"&&a!==null){var s=a.$$typeof;switch(s){case Om:switch(a=a.type,a){case Qc:case tu:case eu:case nu:case ru:return a;default:switch(a=a&&a.$$typeof,a){case CA:case ou:case iu:case lu:case au:case su:return a;default:return s}}case Mm:return s}}}et.ContextConsumer=ou;et.ContextProvider=su;et.Element=Om;et.ForwardRef=iu;et.Fragment=Qc;et.Lazy=lu;et.Memo=au;et.Portal=Mm;et.Profiler=tu;et.StrictMode=eu;et.Suspense=nu;et.SuspenseList=ru;et.isAsyncMode=function(){return!1};et.isConcurrentMode=function(){return!1};et.isContextConsumer=function(a){return _s(a)===ou};et.isContextProvider=function(a){return _s(a)===su};et.isElement=function(a){return typeof a=="object"&&a!==null&&a.$$typeof===Om};et.isForwardRef=function(a){return _s(a)===iu};et.isFragment=function(a){return _s(a)===Qc};et.isLazy=function(a){return _s(a)===lu};et.isMemo=function(a){return _s(a)===au};et.isPortal=function(a){return _s(a)===Mm};et.isProfiler=function(a){return _s(a)===tu};et.isStrictMode=function(a){return _s(a)===eu};et.isSuspense=function(a){return _s(a)===nu};et.isSuspenseList=function(a){return _s(a)===ru};et.isValidElementType=function(a){return typeof a=="string"||typeof a=="function"||a===Qc||a===tu||a===eu||a===nu||a===ru||a===TA||typeof a=="object"&&a!==null&&(a.$$typeof===lu||a.$$typeof===au||a.$$typeof===su||a.$$typeof===ou||a.$$typeof===iu||a.$$typeof===qC||a.getModuleId!==void 0)};et.typeOf=_s;JC.exports=et;var XC=JC.exports;function kA(a){function s(B,H,U,re,I){for(var de=0,W=0,Ce=0,be=0,Se,pe,Ge=0,Je=0,_e,ke=_e=Se=0,$e=0,Pe=0,bt=0,X=0,ct=U.length,ze=ct-1,kt,ve="",st="",Zs="",St="",Et;$e<ct;){if(pe=U.charCodeAt($e),$e===ze&&W+be+Ce+de!==0&&(W!==0&&(pe=W===47?10:47),be=Ce=de=0,ct++,ze++),W+be+Ce+de===0){if($e===ze&&(0<Pe&&(ve=ve.replace(y,"")),0<ve.trim().length)){switch(pe){case 32:case 9:case 59:case 13:case 10:break;default:ve+=U.charAt($e)}pe=59}switch(pe){case 123:for(ve=ve.trim(),Se=ve.charCodeAt(0),_e=1,X=++$e;$e<ct;){switch(pe=U.charCodeAt($e)){case 123:_e++;break;case 125:_e--;break;case 47:switch(pe=U.charCodeAt($e+1)){case 42:case 47:e:{for(ke=$e+1;ke<ze;++ke)switch(U.charCodeAt(ke)){case 47:if(pe===42&&U.charCodeAt(ke-1)===42&&$e+2!==ke){$e=ke+1;break e}break;case 10:if(pe===47){$e=ke+1;break e}}$e=ke}}break;case 91:pe++;case 40:pe++;case 34:case 39:for(;$e++<ze&&U.charCodeAt($e)!==pe;);}if(_e===0)break;$e++}switch(_e=U.substring(X,$e),Se===0&&(Se=(ve=ve.replace(_,"").trim()).charCodeAt(0)),Se){case 64:switch(0<Pe&&(ve=ve.replace(y,"")),pe=ve.charCodeAt(1),pe){case 100:case 109:case 115:case 45:Pe=H;break;default:Pe=he}if(_e=s(H,Pe,_e,pe,I+1),X=_e.length,0<G&&(Pe=i(he,ve,bt),Et=p(3,_e,Pe,H,ce,ae,X,pe,I,re),ve=Pe.join(""),Et!==void 0&&(X=(_e=Et.trim()).length)===0&&(pe=0,_e="")),0<X)switch(pe){case 115:ve=ve.replace(se,d);case 100:case 109:case 45:_e=ve+"{"+_e+"}";break;case 107:ve=ve.replace(D,"$1 $2"),_e=ve+"{"+_e+"}",_e=ye===1||ye===2&&u("@"+_e,3)?"@-webkit-"+_e+"@"+_e:"@"+_e;break;default:_e=ve+_e,re===112&&(_e=(st+=_e,""))}else _e="";break;default:_e=s(H,i(H,ve,bt),_e,re,I+1)}Zs+=_e,_e=bt=Pe=ke=Se=0,ve="",pe=U.charCodeAt(++$e);break;case 125:case 59:if(ve=(0<Pe?ve.replace(y,""):ve).trim(),1<(X=ve.length))switch(ke===0&&(Se=ve.charCodeAt(0),Se===45||96<Se&&123>Se)&&(X=(ve=ve.replace(" ",":")).length),0<G&&(Et=p(1,ve,H,B,ce,ae,st.length,re,I,re))!==void 0&&(X=(ve=Et.trim()).length)===0&&(ve="\0\0"),Se=ve.charCodeAt(0),pe=ve.charCodeAt(1),Se){case 0:break;case 64:if(pe===105||pe===99){St+=ve+U.charAt($e);break}default:ve.charCodeAt(X-1)!==58&&(st+=l(ve,Se,pe,ve.charCodeAt(2)))}bt=Pe=ke=Se=0,ve="",pe=U.charCodeAt(++$e)}}switch(pe){case 13:case 10:W===47?W=0:1+Se===0&&re!==107&&0<ve.length&&(Pe=1,ve+="\0"),0<G*q&&p(0,ve,H,B,ce,ae,st.length,re,I,re),ae=1,ce++;break;case 59:case 125:if(W+be+Ce+de===0){ae++;break}default:switch(ae++,kt=U.charAt($e),pe){case 9:case 32:if(be+de+W===0)switch(Ge){case 44:case 58:case 9:case 32:kt="";break;default:pe!==32&&(kt=" ")}break;case 0:kt="\\0";break;case 12:kt="\\f";break;case 11:kt="\\v";break;case 38:be+W+de===0&&(Pe=bt=1,kt="\f"+kt);break;case 108:if(be+W+de+K===0&&0<ke)switch($e-ke){case 2:Ge===112&&U.charCodeAt($e-3)===58&&(K=Ge);case 8:Je===111&&(K=Je)}break;case 58:be+W+de===0&&(ke=$e);break;case 44:W+Ce+be+de===0&&(Pe=1,kt+="\r");break;case 34:case 39:W===0&&(be=be===pe?0:be===0?pe:be);break;case 91:be+W+Ce===0&&de++;break;case 93:be+W+Ce===0&&de--;break;case 41:be+W+de===0&&Ce--;break;case 40:be+W+de===0&&(Se===0&&(2*Ge+3*Je===533||(Se=1)),Ce++);break;case 64:W+Ce+be+de+ke+_e===0&&(_e=1);break;case 42:case 47:if(!(0<be+de+Ce))switch(W){case 0:switch(2*pe+3*U.charCodeAt($e+1)){case 235:W=47;break;case 220:X=$e,W=42}break;case 42:pe===47&&Ge===42&&X+2!==$e&&(U.charCodeAt(X+2)===33&&(st+=U.substring(X,$e+1)),kt="",W=0)}}W===0&&(ve+=kt)}Je=Ge,Ge=pe,$e++}if(X=st.length,0<X){if(Pe=H,0<G&&(Et=p(2,st,Pe,B,ce,ae,X,re,I,re),Et!==void 0&&(st=Et).length===0))return St+st+Zs;if(st=Pe.join(",")+"{"+st+"}",ye*K!==0){switch(ye!==2||u(st,2)||(K=0),K){case 111:st=st.replace(J,":-moz-$1")+st;break;case 112:st=st.replace(A,"::-webkit-input-$1")+st.replace(A,"::-moz-$1")+st.replace(A,":-ms-input-$1")+st}K=0}}return St+st+Zs}function i(B,H,U){var re=H.trim().split(E);H=re;var I=re.length,de=B.length;switch(de){case 0:case 1:var W=0;for(B=de===0?"":B[0]+" ";W<I;++W)H[W]=r(B,H[W],U).trim();break;default:var Ce=W=0;for(H=[];W<I;++W)for(var be=0;be<de;++be)H[Ce++]=r(B[be]+" ",re[W],U).trim()}return H}function r(B,H,U){var re=H.charCodeAt(0);switch(33>re&&(re=(H=H.trim()).charCodeAt(0)),re){case 38:return H.replace(R,"$1"+B.trim());case 58:return B.trim()+H.replace(R,"$1"+B.trim());default:if(0<1*U&&0<H.indexOf("\f"))return H.replace(R,(B.charCodeAt(0)===58?"":"$1")+B.trim())}return B+H}function l(B,H,U,re){var I=B+";",de=2*H+3*U+4*re;if(de===944){B=I.indexOf(":",9)+1;var W=I.substring(B,I.length-1).trim();return W=I.substring(0,B).trim()+W+";",ye===1||ye===2&&u(W,1)?"-webkit-"+W+W:W}if(ye===0||ye===2&&!u(I,1))return I;switch(de){case 1015:return I.charCodeAt(10)===97?"-webkit-"+I+I:I;case 951:return I.charCodeAt(3)===116?"-webkit-"+I+I:I;case 963:return I.charCodeAt(5)===110?"-webkit-"+I+I:I;case 1009:if(I.charCodeAt(4)!==100)break;case 969:case 942:return"-webkit-"+I+I;case 978:return"-webkit-"+I+"-moz-"+I+I;case 1019:case 983:return"-webkit-"+I+"-moz-"+I+"-ms-"+I+I;case 883:if(I.charCodeAt(8)===45)return"-webkit-"+I+I;if(0<I.indexOf("image-set(",11))return I.replace(Ze,"$1-webkit-$2")+I;break;case 932:if(I.charCodeAt(4)===45)switch(I.charCodeAt(5)){case 103:return"-webkit-box-"+I.replace("-grow","")+"-webkit-"+I+"-ms-"+I.replace("grow","positive")+I;case 115:return"-webkit-"+I+"-ms-"+I.replace("shrink","negative")+I;case 98:return"-webkit-"+I+"-ms-"+I.replace("basis","preferred-size")+I}return"-webkit-"+I+"-ms-"+I+I;case 964:return"-webkit-"+I+"-ms-flex-"+I+I;case 1023:if(I.charCodeAt(8)!==99)break;return W=I.substring(I.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+W+"-webkit-"+I+"-ms-flex-pack"+W+I;case 1005:return C.test(I)?I.replace(k,":-webkit-")+I.replace(k,":-moz-")+I:I;case 1e3:switch(W=I.substring(13).trim(),H=W.indexOf("-")+1,W.charCodeAt(0)+W.charCodeAt(H)){case 226:W=I.replace(ie,"tb");break;case 232:W=I.replace(ie,"tb-rl");break;case 220:W=I.replace(ie,"lr");break;default:return I}return"-webkit-"+I+"-ms-"+W+I;case 1017:if(I.indexOf("sticky",9)===-1)break;case 975:switch(H=(I=B).length-10,W=(I.charCodeAt(H)===33?I.substring(0,H):I).substring(B.indexOf(":",7)+1).trim(),de=W.charCodeAt(0)+(W.charCodeAt(7)|0)){case 203:if(111>W.charCodeAt(8))break;case 115:I=I.replace(W,"-webkit-"+W)+";"+I;break;case 207:case 102:I=I.replace(W,"-webkit-"+(102<de?"inline-":"")+"box")+";"+I.replace(W,"-webkit-"+W)+";"+I.replace(W,"-ms-"+W+"box")+";"+I}return I+";";case 938:if(I.charCodeAt(5)===45)switch(I.charCodeAt(6)){case 105:return W=I.replace("-items",""),"-webkit-"+I+"-webkit-box-"+W+"-ms-flex-"+W+I;case 115:return"-webkit-"+I+"-ms-flex-item-"+I.replace(z,"")+I;default:return"-webkit-"+I+"-ms-flex-line-pack"+I.replace("align-content","").replace(z,"")+I}break;case 973:case 989:if(I.charCodeAt(3)!==45||I.charCodeAt(4)===122)break;case 931:case 953:if(Ne.test(B)===!0)return(W=B.substring(B.indexOf(":")+1)).charCodeAt(0)===115?l(B.replace("stretch","fill-available"),H,U,re).replace(":fill-available",":stretch"):I.replace(W,"-webkit-"+W)+I.replace(W,"-moz-"+W.replace("fill-",""))+I;break;case 962:if(I="-webkit-"+I+(I.charCodeAt(5)===102?"-ms-"+I:"")+I,U+re===211&&I.charCodeAt(13)===105&&0<I.indexOf("transform",10))return I.substring(0,I.indexOf(";",27)+1).replace(w,"$1-webkit-$2")+I}return I}function u(B,H){var U=B.indexOf(H===1?":":"{"),re=B.substring(0,H!==3?U:10);return U=B.substring(U+1,B.length-1),tt(H!==2?re:re.replace(Oe,"$1"),U,H)}function d(B,H){var U=l(H,H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2));return U!==H+";"?U.replace(me," or ($1)").substring(4):"("+H+")"}function p(B,H,U,re,I,de,W,Ce,be,Se){for(var pe=0,Ge=H,Je;pe<G;++pe)switch(Je=je[pe].call(v,B,Ge,U,re,I,de,W,Ce,be,Se)){case void 0:case!1:case!0:case null:break;default:Ge=Je}if(Ge!==H)return Ge}function m(B){switch(B){case void 0:case null:G=je.length=0;break;default:if(typeof B=="function")je[G++]=B;else if(typeof B=="object")for(var H=0,U=B.length;H<U;++H)m(B[H]);else q=!!B|0}return m}function f(B){return B=B.prefix,B!==void 0&&(tt=null,B?typeof B!="function"?ye=1:(ye=2,tt=B):ye=0),f}function v(B,H){var U=B;if(33>U.charCodeAt(0)&&(U=U.trim()),ee=U,U=[ee],0<G){var re=p(-1,H,U,U,ce,ae,0,0,0,0);re!==void 0&&typeof re=="string"&&(H=re)}var I=s(he,U,H,0,0);return 0<G&&(re=p(-2,I,U,U,ce,ae,I.length,0,0,0),re!==void 0&&(I=re)),ee="",K=0,ae=ce=1,I}var _=/^\0+/g,y=/[\0\r\f]/g,k=/: */g,C=/zoo|gra/,w=/([,: ])(transform)/g,E=/,\r+?/g,R=/([\t\r\n ])*\f?&/g,D=/@(k\w+)\s*(\S*)\s*/,A=/::(place)/g,J=/:(read-only)/g,ie=/[svh]\w+-[tblr]{2}/,se=/\(\s*(.*)\s*\)/g,me=/([\s\S]*?);/g,z=/-self|flex-/g,Oe=/[^]*?(:[rp][el]a[\w-]+)[^]*/,Ne=/stretch|:\s*\w+\-(?:conte|avail)/,Ze=/([^-])(image-set\()/,ae=1,ce=1,K=0,ye=1,he=[],je=[],G=0,tt=null,q=0,ee="";return v.use=m,v.set=f,a!==void 0&&f(a),v}var SA={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},$s={};function Js(){return(Js=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(a[r]=i[r])}return a}).apply(this,arguments)}var z_=function(a,s){for(var i=[a[0]],r=0,l=s.length;r<l;r+=1)i.push(s[r],a[r+1]);return i},Qg=function(a){return a!==null&&typeof a=="object"&&(a.toString?a.toString():Object.prototype.toString.call(a))==="[object Object]"&&!XC.typeOf(a)},Cc=Object.freeze([]),jo=Object.freeze({});function qr(a){return typeof a=="function"}function U_(a){return a.displayName||a.name||"Component"}function Nm(a){return a&&typeof a.styledComponentId=="string"}var Rn=typeof process<"u"&&$s!==void 0&&($s.REACT_APP_SC_ATTR||$s.SC_ATTR)||"data-styled",Lm=typeof window<"u"&&"HTMLElement"in window,EA=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&$s!==void 0&&($s.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&$s.REACT_APP_SC_DISABLE_SPEEDY!==""?$s.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&$s.REACT_APP_SC_DISABLE_SPEEDY:$s.SC_DISABLE_SPEEDY!==void 0&&$s.SC_DISABLE_SPEEDY!==""&&$s.SC_DISABLE_SPEEDY!=="false"&&$s.SC_DISABLE_SPEEDY)),IA={};function aa(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];throw new Error("An error occurred. See https://git.io/JUIaE#"+a+" for more information."+(i.length>0?" Args: "+i.join(", "):""))}var xA=(function(){function a(i){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=i}var s=a.prototype;return s.indexOfGroup=function(i){for(var r=0,l=0;l<i;l++)r+=this.groupSizes[l];return r},s.insertRules=function(i,r){if(i>=this.groupSizes.length){for(var l=this.groupSizes,u=l.length,d=u;i>=d;)(d<<=1)<0&&aa(16,""+i);this.groupSizes=new Uint32Array(d),this.groupSizes.set(l),this.length=d;for(var p=u;p<d;p++)this.groupSizes[p]=0}for(var m=this.indexOfGroup(i+1),f=0,v=r.length;f<v;f++)this.tag.insertRule(m,r[f])&&(this.groupSizes[i]++,m++)},s.clearGroup=function(i){if(i<this.length){var r=this.groupSizes[i],l=this.indexOfGroup(i),u=l+r;this.groupSizes[i]=0;for(var d=l;d<u;d++)this.tag.deleteRule(l)}},s.getGroup=function(i){var r="";if(i>=this.length||this.groupSizes[i]===0)return r;for(var l=this.groupSizes[i],u=this.indexOfGroup(i),d=u+l,p=u;p<d;p++)r+=this.tag.getRule(p)+`/*!sc*/
94
+ `;return r},a})(),fc=new Map,Tc=new Map,zr=1,oc=function(a){if(fc.has(a))return fc.get(a);for(;Tc.has(zr);)zr++;var s=zr++;return fc.set(a,s),Tc.set(s,a),s},DA=function(a){return Tc.get(a)},AA=function(a,s){s>=zr&&(zr=s+1),fc.set(a,s),Tc.set(s,a)},RA="style["+Rn+'][data-styled-version="5.3.11"]',OA=new RegExp("^"+Rn+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),MA=function(a,s,i){for(var r,l=i.split(","),u=0,d=l.length;u<d;u++)(r=l[u])&&a.registerName(s,r)},NA=function(a,s){for(var i=(s.textContent||"").split(`/*!sc*/
95
+ `),r=[],l=0,u=i.length;l<u;l++){var d=i[l].trim();if(d){var p=d.match(OA);if(p){var m=0|parseInt(p[1],10),f=p[2];m!==0&&(AA(f,m),MA(a,f,p[3]),a.getTag().insertRules(m,r)),r.length=0}else r.push(d)}}},LA=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null},ZC=function(a){var s=document.head,i=a||s,r=document.createElement("style"),l=(function(p){for(var m=p.childNodes,f=m.length;f>=0;f--){var v=m[f];if(v&&v.nodeType===1&&v.hasAttribute(Rn))return v}})(i),u=l!==void 0?l.nextSibling:null;r.setAttribute(Rn,"active"),r.setAttribute("data-styled-version","5.3.11");var d=LA();return d&&r.setAttribute("nonce",d),i.insertBefore(r,u),r},PA=(function(){function a(i){var r=this.element=ZC(i);r.appendChild(document.createTextNode("")),this.sheet=(function(l){if(l.sheet)return l.sheet;for(var u=document.styleSheets,d=0,p=u.length;d<p;d++){var m=u[d];if(m.ownerNode===l)return m}aa(17)})(r),this.length=0}var s=a.prototype;return s.insertRule=function(i,r){try{return this.sheet.insertRule(r,i),this.length++,!0}catch{return!1}},s.deleteRule=function(i){this.sheet.deleteRule(i),this.length--},s.getRule=function(i){var r=this.sheet.cssRules[i];return r!==void 0&&typeof r.cssText=="string"?r.cssText:""},a})(),BA=(function(){function a(i){var r=this.element=ZC(i);this.nodes=r.childNodes,this.length=0}var s=a.prototype;return s.insertRule=function(i,r){if(i<=this.length&&i>=0){var l=document.createTextNode(r),u=this.nodes[i];return this.element.insertBefore(l,u||null),this.length++,!0}return!1},s.deleteRule=function(i){this.element.removeChild(this.nodes[i]),this.length--},s.getRule=function(i){return i<this.length?this.nodes[i].textContent:""},a})(),jA=(function(){function a(i){this.rules=[],this.length=0}var s=a.prototype;return s.insertRule=function(i,r){return i<=this.length&&(this.rules.splice(i,0,r),this.length++,!0)},s.deleteRule=function(i){this.rules.splice(i,1),this.length--},s.getRule=function(i){return i<this.length?this.rules[i]:""},a})(),H_=Lm,FA={isServer:!Lm,useCSSOMInjection:!EA},kc=(function(){function a(i,r,l){i===void 0&&(i=jo),r===void 0&&(r={}),this.options=Js({},FA,{},i),this.gs=r,this.names=new Map(l),this.server=!!i.isServer,!this.server&&Lm&&H_&&(H_=!1,(function(u){for(var d=document.querySelectorAll(RA),p=0,m=d.length;p<m;p++){var f=d[p];f&&f.getAttribute(Rn)!=="active"&&(NA(u,f),f.parentNode&&f.parentNode.removeChild(f))}})(this))}a.registerId=function(i){return oc(i)};var s=a.prototype;return s.reconstructWithOptions=function(i,r){return r===void 0&&(r=!0),new a(Js({},this.options,{},i),this.gs,r&&this.names||void 0)},s.allocateGSInstance=function(i){return this.gs[i]=(this.gs[i]||0)+1},s.getTag=function(){return this.tag||(this.tag=(l=(r=this.options).isServer,u=r.useCSSOMInjection,d=r.target,i=l?new jA(d):u?new PA(d):new BA(d),new xA(i)));var i,r,l,u,d},s.hasNameForId=function(i,r){return this.names.has(i)&&this.names.get(i).has(r)},s.registerName=function(i,r){if(oc(i),this.names.has(i))this.names.get(i).add(r);else{var l=new Set;l.add(r),this.names.set(i,l)}},s.insertRules=function(i,r,l){this.registerName(i,r),this.getTag().insertRules(oc(i),l)},s.clearNames=function(i){this.names.has(i)&&this.names.get(i).clear()},s.clearRules=function(i){this.getTag().clearGroup(oc(i)),this.clearNames(i)},s.clearTag=function(){this.tag=void 0},s.toString=function(){return(function(i){for(var r=i.getTag(),l=r.length,u="",d=0;d<l;d++){var p=DA(d);if(p!==void 0){var m=i.names.get(p),f=r.getGroup(d);if(m&&f&&m.size){var v=Rn+".g"+d+'[id="'+p+'"]',_="";m!==void 0&&m.forEach((function(y){y.length>0&&(_+=y+",")})),u+=""+f+v+'{content:"'+_+`"}/*!sc*/
96
+ `}}}return u})(this)},a})(),zA=/(a)(d)/gi,W_=function(a){return String.fromCharCode(a+(a>25?39:97))};function em(a){var s,i="";for(s=Math.abs(a);s>52;s=s/52|0)i=W_(s%52)+i;return(W_(s%52)+i).replace(zA,"$1-$2")}var Tn=function(a,s){for(var i=s.length;i;)a=33*a^s.charCodeAt(--i);return a},QC=function(a){return Tn(5381,a)};function eT(a){for(var s=0;s<a.length;s+=1){var i=a[s];if(qr(i)&&!Nm(i))return!1}return!0}var UA=QC("5.3.11"),HA=(function(){function a(s,i,r){this.rules=s,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&eT(s),this.componentId=i,this.baseHash=Tn(UA,i),this.baseStyle=r,kc.registerId(i)}return a.prototype.generateAndInjectStyles=function(s,i,r){var l=this.componentId,u=[];if(this.baseStyle&&u.push(this.baseStyle.generateAndInjectStyles(s,i,r)),this.isStatic&&!r.hash)if(this.staticRulesId&&i.hasNameForId(l,this.staticRulesId))u.push(this.staticRulesId);else{var d=ki(this.rules,s,i,r).join(""),p=em(Tn(this.baseHash,d)>>>0);if(!i.hasNameForId(l,p)){var m=r(d,"."+p,void 0,l);i.insertRules(l,p,m)}u.push(p),this.staticRulesId=p}else{for(var f=this.rules.length,v=Tn(this.baseHash,r.hash),_="",y=0;y<f;y++){var k=this.rules[y];if(typeof k=="string")_+=k;else if(k){var C=ki(k,s,i,r),w=Array.isArray(C)?C.join(""):C;v=Tn(v,w+y),_+=w}}if(_){var E=em(v>>>0);if(!i.hasNameForId(l,E)){var R=r(_,"."+E,void 0,l);i.insertRules(l,E,R)}u.push(E)}}return u.join(" ")},a})(),WA=/^\s*\/\/.*$/gm,VA=[":","[",".","#"];function GA(a){var s,i,r,l,u=jo,d=u.options,p=d===void 0?jo:d,m=u.plugins,f=m===void 0?Cc:m,v=new kA(p),_=[],y=(function(w){function E(R){if(R)try{w(R+"}")}catch{}}return function(R,D,A,J,ie,se,me,z,Oe,Ne){switch(R){case 1:if(Oe===0&&D.charCodeAt(0)===64)return w(D+";"),"";break;case 2:if(z===0)return D+"/*|*/";break;case 3:switch(z){case 102:case 112:return w(A[0]+D),"";default:return D+(Ne===0?"/*|*/":"")}case-2:D.split("/*|*/}").forEach(E)}}})((function(w){_.push(w)})),k=function(w,E,R){return E===0&&VA.indexOf(R[i.length])!==-1||R.match(l)?w:"."+s};function C(w,E,R,D){D===void 0&&(D="&");var A=w.replace(WA,""),J=E&&R?R+" "+E+" { "+A+" }":A;return s=D,i=E,r=new RegExp("\\"+i+"\\b","g"),l=new RegExp("(\\"+i+"\\b){2,}"),v(R||!E?"":E,J)}return v.use([].concat(f,[function(w,E,R){w===2&&R.length&&R[0].lastIndexOf(i)>0&&(R[0]=R[0].replace(r,k))},y,function(w){if(w===-2){var E=_;return _=[],E}}])),C.hash=f.length?f.reduce((function(w,E){return E.name||aa(15),Tn(w,E.name)}),5381).toString():"",C}var tT=Y.createContext();tT.Consumer;var sT=Y.createContext(),KA=(sT.Consumer,new kc),tm=GA();function oT(){return Xr(tT)||KA}function iT(){return Xr(sT)||tm}var YA=(function(){function a(s,i){var r=this;this.inject=function(l,u){u===void 0&&(u=tm);var d=r.name+u.hash;l.hasNameForId(r.id,d)||l.insertRules(r.id,d,u(r.rules,d,"@keyframes"))},this.toString=function(){return aa(12,String(r.name))},this.name=s,this.id="sc-keyframes-"+s,this.rules=i}return a.prototype.getName=function(s){return s===void 0&&(s=tm),this.name+s.hash},a})(),JA=/([A-Z])/,qA=/([A-Z])/g,XA=/^ms-/,ZA=function(a){return"-"+a.toLowerCase()};function V_(a){return JA.test(a)?a.replace(qA,ZA).replace(XA,"-ms-"):a}var G_=function(a){return a==null||a===!1||a===""};function ki(a,s,i,r){if(Array.isArray(a)){for(var l,u=[],d=0,p=a.length;d<p;d+=1)(l=ki(a[d],s,i,r))!==""&&(Array.isArray(l)?u.push.apply(u,l):u.push(l));return u}if(G_(a))return"";if(Nm(a))return"."+a.styledComponentId;if(qr(a)){if(typeof(f=a)!="function"||f.prototype&&f.prototype.isReactComponent||!s)return a;var m=a(s);return ki(m,s,i,r)}var f;return a instanceof YA?i?(a.inject(i,r),a.getName(r)):a:Qg(a)?(function v(_,y){var k,C,w=[];for(var E in _)_.hasOwnProperty(E)&&!G_(_[E])&&(Array.isArray(_[E])&&_[E].isCss||qr(_[E])?w.push(V_(E)+":",_[E],";"):Qg(_[E])?w.push.apply(w,v(_[E],E)):w.push(V_(E)+": "+(k=E,(C=_[E])==null||typeof C=="boolean"||C===""?"":typeof C!="number"||C===0||k in SA||k.startsWith("--")?String(C).trim():C+"px")+";"));return y?[y+" {"].concat(w,["}"]):w})(a):a.toString()}var K_=function(a){return Array.isArray(a)&&(a.isCss=!0),a};function nT(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];return qr(a)||Qg(a)?K_(ki(z_(Cc,[a].concat(i)))):i.length===0&&a.length===1&&typeof a[0]=="string"?a:K_(ki(z_(a,i)))}var rT=function(a,s,i){return i===void 0&&(i=jo),a.theme!==i.theme&&a.theme||s||i.theme},QA=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,e0=/(^-|-$)/g;function lg(a){return a.replace(QA,"-").replace(e0,"")}var aT=function(a){return em(QC(a)>>>0)};function ic(a){return typeof a=="string"&&!0}var sm=function(a){return typeof a=="function"||typeof a=="object"&&a!==null&&!Array.isArray(a)},t0=function(a){return a!=="__proto__"&&a!=="constructor"&&a!=="prototype"};function s0(a,s,i){var r=a[i];sm(s)&&sm(r)?lT(r,s):a[i]=s}function lT(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];for(var l=0,u=i;l<u.length;l++){var d=u[l];if(sm(d))for(var p in d)t0(p)&&s0(a,d[p],p)}return a}var Pm=Y.createContext();Pm.Consumer;var cg={};function cT(a,s,i){var r=Nm(a),l=!ic(a),u=s.attrs,d=u===void 0?Cc:u,p=s.componentId,m=p===void 0?(function(D,A){var J=typeof D!="string"?"sc":lg(D);cg[J]=(cg[J]||0)+1;var ie=J+"-"+aT("5.3.11"+J+cg[J]);return A?A+"-"+ie:ie})(s.displayName,s.parentComponentId):p,f=s.displayName,v=f===void 0?(function(D){return ic(D)?"styled."+D:"Styled("+U_(D)+")"})(a):f,_=s.displayName&&s.componentId?lg(s.displayName)+"-"+s.componentId:s.componentId||m,y=r&&a.attrs?Array.prototype.concat(a.attrs,d).filter(Boolean):d,k=s.shouldForwardProp;r&&a.shouldForwardProp&&(k=s.shouldForwardProp?function(D,A,J){return a.shouldForwardProp(D,A,J)&&s.shouldForwardProp(D,A,J)}:a.shouldForwardProp);var C,w=new HA(i,_,r?a.componentStyle:void 0),E=w.isStatic&&d.length===0,R=function(D,A){return(function(J,ie,se,me){var z=J.attrs,Oe=J.componentStyle,Ne=J.defaultProps,Ze=J.foldedComponentIds,ae=J.shouldForwardProp,ce=J.styledComponentId,K=J.target,ye=(function(re,I,de){re===void 0&&(re=jo);var W=Js({},I,{theme:re}),Ce={};return de.forEach((function(be){var Se,pe,Ge,Je=be;for(Se in qr(Je)&&(Je=Je(W)),Je)W[Se]=Ce[Se]=Se==="className"?(pe=Ce[Se],Ge=Je[Se],pe&&Ge?pe+" "+Ge:pe||Ge):Je[Se]})),[W,Ce]})(rT(ie,Xr(Pm),Ne)||jo,ie,z),he=ye[0],je=ye[1],G=(function(re,I,de,W){var Ce=oT(),be=iT(),Se=I?re.generateAndInjectStyles(jo,Ce,be):re.generateAndInjectStyles(de,Ce,be);return Se})(Oe,me,he),tt=se,q=je.$as||ie.$as||je.as||ie.as||K,ee=ic(q),B=je!==ie?Js({},ie,{},je):ie,H={};for(var U in B)U[0]!=="$"&&U!=="as"&&(U==="forwardedAs"?H.as=B[U]:(ae?ae(U,Zy,q):!ee||Zy(U))&&(H[U]=B[U]));return ie.style&&je.style!==ie.style&&(H.style=Js({},ie.style,{},je.style)),H.className=Array.prototype.concat(Ze,ce,G!==ce?G:null,ie.className,je.className).filter(Boolean).join(" "),H.ref=tt,Ak(q,H)})(C,D,A,E)};return R.displayName=v,(C=Y.forwardRef(R)).attrs=y,C.componentStyle=w,C.displayName=v,C.shouldForwardProp=k,C.foldedComponentIds=r?Array.prototype.concat(a.foldedComponentIds,a.styledComponentId):Cc,C.styledComponentId=_,C.target=r?a.target:a,C.withComponent=function(D){var A=s.componentId,J=(function(se,me){if(se==null)return{};var z,Oe,Ne={},Ze=Object.keys(se);for(Oe=0;Oe<Ze.length;Oe++)z=Ze[Oe],me.indexOf(z)>=0||(Ne[z]=se[z]);return Ne})(s,["componentId"]),ie=A&&A+"-"+(ic(D)?D:lg(U_(D)));return cT(D,Js({},J,{attrs:y,componentId:ie}),i)},Object.defineProperty(C,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(D){this._foldedDefaultProps=r?lT({},a.defaultProps,D):D}}),Object.defineProperty(C,"toString",{value:function(){return"."+C.styledComponentId}}),l&&IS(C,a,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),C}var ys=function(a){return(function s(i,r,l){if(l===void 0&&(l=jo),!XC.isValidElementType(r))return aa(1,String(r));var u=function(){return i(r,l,nT.apply(void 0,arguments))};return u.withConfig=function(d){return s(i,r,Js({},l,{},d))},u.attrs=function(d){return s(i,r,Js({},l,{attrs:Array.prototype.concat(l.attrs,d).filter(Boolean)}))},u})(cT,a)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(a){ys[a]=ys(a)}));var o0=(function(){function a(i,r){this.rules=i,this.componentId=r,this.isStatic=eT(i),kc.registerId(this.componentId+1)}var s=a.prototype;return s.createStyles=function(i,r,l,u){var d=u(ki(this.rules,r,l,u).join(""),""),p=this.componentId+i;l.insertRules(p,p,d)},s.removeStyles=function(i,r){r.clearRules(this.componentId+i)},s.renderStyles=function(i,r,l,u){i>2&&kc.registerId(this.componentId+i),this.removeStyles(i,l),this.createStyles(i,r,l,u)},a})();function i0(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),r=1;r<s;r++)i[r-1]=arguments[r];var l=nT.apply(void 0,[a].concat(i)),u="sc-global-"+aT(JSON.stringify(l)),d=new o0(l,u);function p(f){var v=oT(),_=iT(),y=Xr(Pm),k=Bo(v.allocateGSInstance(u)).current;return v.server&&m(k,f,v,y,_),lm((function(){if(!v.server)return m(k,f,v,y,_),function(){return d.removeStyles(k,v)}}),[k,f,v,y,_]),null}function m(f,v,_,y,k){if(d.isStatic)d.renderStyles(f,IA,_,k);else{var C=Js({},v,{theme:rT(v,y,p.defaultProps)});d.renderStyles(f,C,_,k)}}return Y.memo(p)}function Y_(a,s){(s==null||s>a.length)&&(s=a.length);for(var i=0,r=Array(s);i<s;i++)r[i]=a[i];return r}function n0(a){if(Array.isArray(a))return a}function r0(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function a0(a,s,i){return s=Sc(s),g0(a,uT()?Reflect.construct(s,[],Sc(a).constructor):s.apply(a,i))}function l0(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}function c0(a,s){for(var i=0;i<s.length;i++){var r=s[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,dT(r.key),r)}}function u0(a,s,i){return s&&c0(a.prototype,s),Object.defineProperty(a,"prototype",{writable:!1}),a}function In(a,s){var i=typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(!i){if(Array.isArray(a)||(i=hT(a))||s){i&&(a=i);var r=0,l=function(){};return{s:l,n:function(){return r>=a.length?{done:!0}:{done:!1,value:a[r++]}},e:function(m){throw m},f:l}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
97
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var u,d=!0,p=!1;return{s:function(){i=i.call(a)},n:function(){var m=i.next();return d=m.done,m},e:function(m){p=!0,u=m},f:function(){try{d||i.return==null||i.return()}finally{if(p)throw u}}}}function fs(a,s,i){return(s=dT(s))in a?Object.defineProperty(a,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[s]=i,a}function Sc(a){return Sc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},Sc(a)}function d0(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),s&&om(a,s)}function uT(){try{var a=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uT=function(){return!!a})()}function h0(a,s){var i=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(i!=null){var r,l,u,d,p=[],m=!0,f=!1;try{if(u=(i=i.call(a)).next,s!==0)for(;!(m=(r=u.call(i)).done)&&(p.push(r.value),p.length!==s);m=!0);}catch(v){f=!0,l=v}finally{try{if(!m&&i.return!=null&&(d=i.return(),Object(d)!==d))return}finally{if(f)throw l}}return p}}function p0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
98
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function J_(a,s){var i=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);s&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable})),i.push.apply(i,r)}return i}function Ec(a){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{};s%2?J_(Object(i),!0).forEach(function(r){fs(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):J_(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function g0(a,s){if(s&&(typeof s=="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return r0(a)}function om(a,s){return om=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},om(a,s)}function m0(a,s){return n0(a)||h0(a,s)||hT(a,s)||p0()}function Os(a,s){return s||(s=a.slice(0)),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(s)}}))}function f0(a,s){if(typeof a!="object"||!a)return a;var i=a[Symbol.toPrimitive];if(i!==void 0){var r=i.call(a,s);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(a)}function dT(a){var s=f0(a,"string");return typeof s=="symbol"?s:s+""}function hT(a,s){if(a){if(typeof a=="string")return Y_(a,s);var i={}.toString.call(a).slice(8,-1);return i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set"?Array.from(a):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Y_(a,s):void 0}}var q_,$0=i0(q_||(q_=Os([`
99
+ .focus-outline-hidden :focus {
100
+ outline: none;
101
+ }
102
+ `]))),X_,pT=ys.button(X_||(X_=Os([`
103
+ display: block;
104
+ padding: 0;
105
+ border: 0;
106
+ background: none;
107
+ font-size: 0;
108
+ cursor: `,`;
109
+ `])),function(a){return a.disabled?"not-allowed":"pointer"}),Z_,Q_,b0=ys.span(Z_||(Z_=Os([`
110
+ font-size: 12px;
111
+ line-height: 1;
112
+ `])));function gT(a){var s=a.className,i=a.onClick,r=a.inverted,l=a.label,u=a.disabled;return Y.createElement(pT,{className:s,onClick:i,"data-tour-elem":"".concat(r?"right":"left","-arrow"),disabled:u},l?Y.createElement(b0,null,l):Y.createElement("svg",{viewBox:"0 0 18.4 14.4"},Y.createElement("path",{d:r?"M17 7.2H1M10.8 1L17 7.2l-6.2 6.2":"M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeMiterlimit:"10"})))}gT.propTypes={className:Z.string.isRequired,onClick:Z.func.isRequired,inverted:Z.bool,label:Z.node,disabled:Z.bool};var ew=ys(gT)(Q_||(Q_=Os([`
113
+ color: `,`;
114
+
115
+ `,`;
116
+ `,`;
117
+
118
+ &:hover {
119
+ color: `,`;
120
+ }
121
+ `])),function(a){return a.disabled?"#caccce":"#646464"},function(a){return a.inverted?"margin-left: 24px;":"margin-right: 24px;"},function(a){return!a.label&&`
122
+ width: 16px;
123
+ height: 12px;
124
+ flex: 0 0 16px;
125
+ `},function(a){return a.disabled?"#caccce":"#000"}),tw;function mT(a){var s=a.className,i=a.onClick,r=a.ariaLabel;return Y.createElement(pT,{className:s,onClick:i,"aria-label":r},Y.createElement("svg",{viewBox:"0 0 9.1 9.1","aria-hidden":!0,role:"presentation"},Y.createElement("path",{fill:"currentColor",d:"M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z"})))}mT.propTypes={className:Z.string.isRequired,onClick:Z.func.isRequired,ariaLabel:Z.string};var v0=ys(mT)(tw||(tw=Os([`
126
+ position: absolute;
127
+ top: 22px;
128
+ right: 22px;
129
+ width: 9px;
130
+ height: 9px;
131
+ color: #5e5e5e;
132
+ &:hover {
133
+ color: #000;
134
+ }
135
+ `])));function $c(a){var s=a.getBoundingClientRect(),i=s.top,r=s.right,l=s.bottom,u=s.left,d=s.width,p=s.height;return{top:i,right:r,bottom:l,left:u,width:d,height:p}}function fT(a,s){if(!s.highlightedSelectors)return $c(a);var i=$c(a),r=In(s.highlightedSelectors),l;try{for(r.s();!(l=r.n()).done;){var u=l.value,d=document.querySelector(u);if(!(!d||d.style.display==="none"||d.style.visibility==="hidden")){var p=$c(d);p.top<i.top&&(i.top=p.top),p.right>i.right&&(i.right=p.right),p.bottom>i.bottom&&(i.bottom=p.bottom),p.left<i.left&&(i.left=p.left)}}}catch(m){r.e(m)}finally{r.f()}return i.width=i.right-i.left,i.height=i.bottom-i.top,i}function y0(a){var s=a.top,i=a.right,r=a.bottom,l=a.left,u=a.w,d=a.h,p=a.threshold,m=p===void 0?0:p;return s>=0+m&&l>=0+m&&r<=d-m&&i<=u-m}function _0(a){return a===document.querySelector("body")||a===document.querySelector("html")}var w0=function(s){return/(left|right)/.test(s)},ug=function(s,i){return s>i},dg=function(s,i){return s>i},Ys=function(s){return s<0?0:s};function C0(a){return Object.keys(a).map(function(s){return{position:s,value:a[s]}}).sort(function(s,i){return i.value-s.value}).map(function(s){return s.position})}var sw,T0=ys.div(sw||(sw=Os([`
136
+ --reactour-accent: `,`;
137
+ `,`
138
+ position: fixed;
139
+ transition: transform 0.3s;
140
+ top: 0;
141
+ left: 0;
142
+ z-index: 1000000;
143
+
144
+ transform: `,`;
145
+ `])),function(a){return a.accentColor},function(a){return a.defaultStyles?`
146
+ max-width: 331px;
147
+ min-width: 150px;
148
+ padding-right: 40px;
149
+ border-radius: `.concat(a.rounded,`px;
150
+ background-color: #fff;
151
+ padding: 24px 30px;
152
+ box-shadow: 0 0.5em 3em rgba(0, 0, 0, 0.3);
153
+ color: inherit;
154
+ `):""},function(a){var s=a.targetTop,i=a.targetRight,r=a.targetBottom,l=a.targetLeft,u=a.windowWidth,d=a.windowHeight,p=a.helperWidth,m=a.helperHeight,f=a.helperPosition,v=a.padding,_={left:l,right:u-i,top:s,bottom:d-r},y=function(R){return _[R]>(w0(R)?p+v*2:m+v*2)},k=function(R){for(var D=C0(_),A=0;A<D.length;A++)if(y(D[A]))return R[D[A]];return R.center},C=function(R){if(Array.isArray(R)){var D=ug(R[0],u),A=dg(R[1],d),J=function(Ze,ae){console.warn("".concat(Ze,":").concat(ae," is outside window, falling back to center"))};return D&&J("x",R[0]),A&&J("y",R[1]),[D?u/2-p/2:R[0],A?d/2-m/2:R[1]]}var ie=ug(l+p,u)?ug(i+v,u)?i-p:i-p+v:l-v,se=ie>v?ie:v,me=dg(s+m,d)?dg(r+v,d)?r-m:r-m+v:s-v,z=me>v?me:v,Oe={top:[se,s-m-v*2],right:[i+v*2,z],bottom:[se,r+v*2],left:[l-p-v*2,z],center:[u/2-p/2,d/2-m/2]};return R==="center"||y(R)?Oe[R]:k(Oe)},w=C(f);return"translate(".concat(Math.round(w[0]),"px, ").concat(Math.round(w[1]),"px)")}),ow,k0=ys.span(ow||(ow=Os([`
155
+ position: absolute;
156
+ font-family: monospace;
157
+ background: var(--reactour-accent);
158
+ background: `,`;
159
+ height: 1.875em;
160
+ line-height: 2;
161
+ padding-left: 0.8125em;
162
+ padding-right: 0.8125em;
163
+ font-size: 1em;
164
+ border-radius: 1.625em;
165
+ color: white;
166
+ text-align: center;
167
+ box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.3);
168
+ top: -0.8125em;
169
+ left: -0.8125em;
170
+ `])),function(a){return a.accentColor}),iw,S0=ys.div(iw||(iw=Os([`
171
+ display: flex;
172
+ margin-top: 24px;
173
+ align-items: center;
174
+ justify-content: center;
175
+ `]))),nw,E0=ys.nav(nw||(nw=Os([`
176
+ counter-reset: dot;
177
+ display: flex;
178
+ justify-content: center;
179
+ align-items: center;
180
+ flex-wrap: wrap;
181
+ `]))),rw,I0=ys.button(rw||(rw=Os([`
182
+ counter-increment: dot;
183
+ width: 8px;
184
+ height: 8px;
185
+ border: `,`;
186
+
187
+ border-radius: 100%;
188
+ padding: 0;
189
+ display: block;
190
+ margin: 4px;
191
+ transition: opacity 0.3s, transform 0.3s;
192
+ cursor: `,`;
193
+ transform: scale(`,`);
194
+
195
+ color: `,`;
196
+ background: `,`;
197
+
198
+ color: `,`;
199
+ background: `,`;
200
+
201
+ &:before {
202
+ content: counter(dot);
203
+ position: absolute;
204
+ bottom: calc(100% + 0.25em);
205
+ left: 50%;
206
+ opacity: 0;
207
+ transform: translate(-50%, 1em);
208
+ transition: 0.3s;
209
+ display: `,`;
210
+ }
211
+
212
+ &:hover {
213
+ background-color: currentColor;
214
+
215
+ &:before {
216
+ opacity: 0.5;
217
+ transform: translate(-50%, -2px);
218
+ }
219
+ }
220
+ `])),function(a){return a.current===a.index?"0":"1px solid #caccce"},function(a){return a.disabled?"not-allowed":"pointer"},function(a){return a.current===a.index?1.25:1},function(a){return a.current===a.index?"var(--reactour-accent)":"#caccce"},function(a){return a.current===a.index?"var(--reactour-accent)":"none"},function(a){return a.current===a.index?a.accentColor:"#caccce"},function(a){return a.current===a.index?a.accentColor:"none"},function(a){return a.showNumber?"block":"none"}),aw,x0=ys.div(aw||(aw=Os([`
221
+ opacity: `,`;
222
+ color: `,`;
223
+ width: 100%;
224
+ left: 0;
225
+ top: 0;
226
+ height: 100%;
227
+ position: fixed;
228
+ z-index: 99999;
229
+ pointer-events: none;
230
+ `])),function(a){return!a.maskClassName&&.7},function(a){return!a.maskClassName&&"#000"});function $T(a){var s=a.windowWidth,i=a.windowHeight,r=a.targetWidth,l=a.targetHeight,u=a.targetTop,d=a.targetLeft,p=a.padding,m=a.rounded,f=a.roundedStep,v=a.disableInteraction,_=a.disableInteractionClassName,y=a.className,k=a.onClick,C=a.highlightedBorder,w=Ys(r+p*2),E=Ys(l+p*2),R=Ys(u-p),D=Ys(d-p),A=f?Math.min(w/2,E/2):m;return Y.createElement(x0,{onClick:k,maskClassName:y},Y.createElement("svg",{width:s,height:i,xmlns:"http://www.w3.org/2000/svg",className:y},Y.createElement("defs",null,Y.createElement("mask",{id:"mask-main"},Y.createElement("rect",{x:0,y:0,width:s,height:i,fill:"white"}),Y.createElement("rect",{x:D,y:R,width:w,height:E,fill:"black"}),Y.createElement("rect",{x:D-1,y:R-1,width:A,height:A,fill:"white"}),Y.createElement("circle",{cx:D+A,cy:R+A,r:A,fill:"black"}),Y.createElement("rect",{x:D+w-A+1,y:R-1,width:A,height:A,fill:"white"}),Y.createElement("circle",{cx:D+w-A,cy:R+A,r:A,fill:"black"}),Y.createElement("rect",{x:D-1,y:R+E-A+1,width:A,height:A,fill:"white"}),Y.createElement("circle",{cx:D+A,cy:R+E-A,r:A,fill:"black"}),Y.createElement("rect",{x:D+w-A+1,y:R+E-A+1,width:A,height:A,fill:"white"}),Y.createElement("circle",{cx:D+w-A,cy:R+E-A,r:A,fill:"black "})),Y.createElement("clipPath",{id:"clip-path"},Y.createElement("rect",{x:0,y:0,width:s,height:R}),Y.createElement("rect",{x:0,y:R,width:D,height:E}),Y.createElement("rect",{x:d+r+p,y:R,width:Ys(s-r-D),height:E}),Y.createElement("rect",{x:0,y:u+l+p,width:s,height:Ys(i-l-R)}))),Y.createElement("rect",{x:0,y:0,width:s,height:i,fill:"currentColor",mask:"url(#mask-main)"}),Y.createElement("rect",{x:0,y:0,width:s,height:i,fill:"currentColor",clipPath:"url(#clip-path)",pointerEvents:"auto"}),Y.createElement("rect",{x:D,y:R,width:w,height:E,pointerEvents:"auto",fill:"transparent",display:v?"block":"none",className:_}),C&&Y.createElement("rect",{x:Ys(D+C.width/2),y:Ys(R+C.width/2),width:Ys(w-C.width),height:Ys(E-C.width),pointerEvents:"auto",fill:"none",strokeWidth:C.width,stroke:C.color,rx:A-2})))}$T.propTypes={windowWidth:Z.number.isRequired,windowHeight:Z.number.isRequired,targetWidth:Z.number.isRequired,targetHeight:Z.number.isRequired,targetTop:Z.number.isRequired,targetLeft:Z.number.isRequired,padding:Z.number.isRequired,rounded:Z.number.isRequired,roundedStep:Z.bool,disableInteraction:Z.bool.isRequired,disableInteractionClassName:Z.string.isRequired,highlightedBorder:Z.shape({color:Z.string.isRequired,width:Z.number.isRequired})};var D0=(function(a){var s=a.step,i=a.refresh,r=vt(0),l=m0(r,2),u=l[0],d=l[1];return Mt(function(){if(s.resizeObservables){var p=function(y){var k=In(y),C;try{var w=function(){var R=C.value;if(!R.attributes)return 1;var D=s.resizeObservables.find(function(A){return R.matches(A)||R.querySelector(A)!=null});D&&d(u+1)};for(k.s();!(C=k.n()).done;)w()}catch(E){k.e(E)}finally{k.f()}},m=new MutationObserver(function(_){var y=In(_),k;try{for(y.s();!(k=y.n()).done;){var C=k.value;C.addedNodes.length!==0&&p(C.addedNodes),C.removedNodes.length!==0&&p(C.removedNodes)}}catch(w){y.e(w)}finally{y.f()}}),f=document.documentElement||document.body,v={childList:!0,subtree:!0};return m.observe(f,v),function(){m.disconnect()}}},[s,u]),Mt(function(){if(s.resizeObservables){var p=new ResizeObserver(function(y){i()}),m=In(s.resizeObservables),f;try{for(m.s();!(f=m.n()).done;){var v=f.value,_=document.querySelector(v);_&&p.observe(_)}}catch(y){m.e(y)}finally{m.f()}return function(){p.disconnect()}}},[s,u]),null}),A0=(function(a){var s=a.step,i=a.refresh;return Mt(function(){if(s.mutationObservables){var r=function(m){var f=In(m),v;try{var _=function(){var k=v.value;if(!k.attributes)return 1;var C=s.mutationObservables.find(function(w){return k.matches(w)||k.querySelector(w)!=null});C&&i()};for(f.s();!(v=f.n()).done;)_()}catch(y){f.e(y)}finally{f.f()}},l=new MutationObserver(function(p){var m=In(p),f;try{for(m.s();!(f=m.n()).done;){var v=f.value;v.addedNodes.length!==0&&r(v.addedNodes),v.removedNodes.length!==0&&r(v.removedNodes)}}catch(_){m.e(_)}finally{m.f()}}),u=document.documentElement||document.body,d={childList:!0,subtree:!0};return l.observe(u,d),function(){l.disconnect()}}},[s]),null});function R0(a){var s=a.children,i=Bo(null);return i.current===null&&(i.current=document.createElement("div"),i.current.setAttribute("id","___reactour")),Mt(function(){return document.body.appendChild(i.current),function(){document.body.removeChild(i.current)}},[i]),xS(s,i.current)}var O0={disableFocusLock:Z.bool,badgeContent:Z.func,highlightedMaskClassName:Z.string,children:Z.oneOfType([Z.node,Z.element]),className:Z.string,closeButtonAriaLabel:Z.string,closeWithMask:Z.bool,inViewThreshold:Z.number,isOpen:Z.bool.isRequired,lastStepNextButton:Z.node,maskClassName:Z.string,maskSpace:Z.number,nextButton:Z.node,onAfterOpen:Z.func,onBeforeClose:Z.func,onRequestClose:Z.func,prevButton:Z.node,scrollDuration:Z.number,scrollOffset:Z.number,showButtons:Z.bool,showCloseButton:Z.bool,showNavigation:Z.bool,showNavigationNumber:Z.bool,showNumber:Z.bool,startAt:Z.number,goToStep:Z.number,getCurrentStep:Z.func,nextStep:Z.func,prevStep:Z.func,steps:Z.arrayOf(Z.shape({selector:Z.string,content:Z.oneOfType([Z.node,Z.element,Z.func]).isRequired,position:Z.oneOfType([Z.arrayOf(Z.number),Z.oneOf(["top","right","bottom","left","center"])]),action:Z.func,style:Z.object,stepInteraction:Z.bool,navDotAriaLabel:Z.string,roundedStep:Z.bool})),update:Z.string,updateDelay:Z.number,disableInteraction:Z.bool,disableDotsNavigation:Z.bool,disableKeyboardNavigation:Z.oneOfType([Z.arrayOf(Z.oneOf(["esc","right","left"])),Z.bool]),rounded:Z.number,accentColor:Z.string,highlightedBorder:Z.shape({color:Z.string.isRequired,width:Z.number.isRequired})},M0={disableFocusLock:!1,showNavigation:!0,showNavigationNumber:!0,showButtons:!0,showCloseButton:!0,closeButtonAriaLabel:"Close",showNumber:!0,scrollDuration:1,maskSpace:10,updateDelay:1,disableInteraction:!1,rounded:0,accentColor:"#007aff",closeWithMask:!0},bn={mask:{disableInteraction:"reactour__mask--disable-interaction"},helper:{base:"reactour__helper",isOpen:"reactour__helper--is-open"},dot:{base:"reactour__dot",active:"reactour__dot--is-active"}},Bm=(function(a){function s(){var i;return l0(this,s),i=a0(this,s),fs(i,"unlockFocus",function(r){i.setState({focusUnlocked:!0},r())}),fs(i,"showStep",function(){if(!(!i.helper||!i.helper.current)){var r=i.props.steps,l=i.state,u=l.current,d=l.focusUnlocked;d&&i.setState({focusUnlocked:!1});var p=r[u],m=p.selector?document.querySelector(p.selector):null,f=function(C){p.action&&typeof p.action=="function"&&i.unlockFocus(function(){return p.action(C)})};if(p.observe){var v=document.querySelector(p.observe),_={attributes:!0,childList:!0,characterData:!0};i.setState(function(k){return k.observer&&setTimeout(function(){k.observer.disconnect()},0),{observer:new MutationObserver(function(C){C.forEach(function(w){if(w.type==="childList"&&w.addedNodes.length>0){var E=function(){return f(w.addedNodes[0])};setTimeout(function(){return i.calculateNode(w.addedNodes[0],p,E)},100)}else if(w.type==="childList"&&w.removedNodes.length>0){var R=function(){return f(m)};i.calculateNode(m,p,R)}})})}},function(){return i.state.observer.observe(v,_)})}else i.state.observer&&(i.state.observer.disconnect(),i.setState({observer:null}));if(m){var y=function(){return f(m)};i.calculateNode(m,p,y)}else i.setState(hg(null,p,i.helper.current),f),p.selector&&console.warn("Doesn't find a DOM node '".concat(p.selector,"'. Please check the 'steps' Tour prop Array at position ").concat(u,"."))}}),fs(i,"calculateNode",function(r,l,u){var d=i.props,p=d.scrollDuration,m=d.inViewThreshold,f=d.scrollOffset,v=fT(r,l),_=Math.max(document.documentElement.clientWidth,window.innerWidth||0),y=Math.max(document.documentElement.clientHeight,window.innerHeight||0);if(y0(Ec(Ec({},v),{},{w:_,h:y,threshold:m})))i.setState(hg(r,l,i.helper.current),u);else{var k=Gx(r),C=f||(v.height>y?-25:-(y/2)+v.height/2);Hx.to(r,{context:_0(k)?window:k,duration:p,offset:C,callback:function(E){i.setState(hg(E,l,i.helper.current),u)}})}}),fs(i,"recalculateNode",function(r){var l=document.querySelector(r.selector),u=function(p){r.action&&typeof r.action=="function"&&i.unlockFocus(function(){return r.action(p)})};i.calculateNode(l,r,function(){return u(l)})}),fs(i,"maskClickHandler",function(r){var l=i.props,u=l.closeWithMask,d=l.onRequestClose;u&&!r.target.classList.contains(bn.mask.disableInteraction)&&d(r)}),fs(i,"nextStep",function(){var r=i.props,l=r.steps,u=r.getCurrentStep;i.setState(function(d){var p=d.current<l.length-1?d.current+1:d.current;return typeof u=="function"&&u(p),{current:p}},i.showStep)}),fs(i,"prevStep",function(){var r=i.props.getCurrentStep;i.setState(function(l){var u=l.current>0?l.current-1:l.current;return typeof r=="function"&&r(u),{current:u}},i.showStep)}),fs(i,"gotoStep",function(r){var l=i.props,u=l.steps,d=l.getCurrentStep;i.setState(function(p){var m=u[r]?r:p.current;return typeof d=="function"&&d(m),{current:m}},i.showStep)}),fs(i,"keyDownHandler",function(r){var l=i.props,u=l.onRequestClose,d=l.nextStep,p=l.prevStep,m=l.disableKeyboardNavigation;if(r.stopPropagation(),m!==!0){var f,v,_;m&&(f=m.includes("esc"),v=m.includes("right"),_=m.includes("left")),r.keyCode===27&&!f&&(r.preventDefault(),u()),r.keyCode===39&&!v&&(r.preventDefault(),typeof d=="function"?d():i.nextStep()),r.keyCode===37&&!_&&(r.preventDefault(),typeof p=="function"?p():i.prevStep())}}),i.state={isOpen:!1,current:0,top:0,right:0,bottom:0,left:0,width:0,height:0,w:0,h:0,inDOM:!1,observer:null,focusUnlocked:!1},i.helper=Rk(),i.helperElement=null,i.debouncedShowStep=dD(i.showStep,70),i}return d0(s,a),u0(s,[{key:"componentDidMount",value:function(){var r=this.props,l=r.isOpen,u=r.startAt;l&&this.open(u)}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){var l=this.props,u=l.isOpen,d=l.update,p=l.updateDelay;!u&&r.isOpen?this.open(r.startAt):u&&!r.isOpen&&this.close(),u&&d!==r.update&&(r.steps[this.state.current]?setTimeout(this.showStep,p):this.props.onRequestClose()),u&&r.isOpen&&this.state.current!==r.goToStep&&this.gotoStep(r.goToStep)}},{key:"componentWillUnmount",value:function(){var r=this.props.isOpen;r&&this.close(),this.state.observer&&this.state.observer.disconnect()}},{key:"open",value:function(r){var l=this,u=this.props.onAfterOpen;this.setState(function(d){return{isOpen:!0,current:r!==void 0?r:d.current}},function(){setTimeout(l.showStep,1),l.helperElement=l.helper.current,l.props.disableFocusLock||l.helper.current.focus(),u&&u(l.helperElement)}),window.addEventListener("resize",this.debouncedShowStep,!1),window.addEventListener("keydown",this.keyDownHandler,!1)}},{key:"close",value:function(){this.setState(function(r){return r.observer&&r.observer.disconnect(),{isOpen:!1,observer:null}},this.onBeforeClose),window.removeEventListener("resize",this.debouncedShowStep),window.removeEventListener("keydown",this.keyDownHandler)}},{key:"onBeforeClose",value:function(){var r=this.props.onBeforeClose;r&&r(this.helperElement)}},{key:"render",value:function(){var r=this,l=this.props,u=l.className,d=l.steps,p=l.maskClassName,m=l.showButtons,f=l.showCloseButton,v=l.closeButtonAriaLabel,_=l.showNavigation,y=l.showNavigationNumber,k=l.showNumber,C=l.onRequestClose,w=l.maskSpace,E=l.lastStepNextButton,R=l.nextButton,D=l.prevButton,A=l.badgeContent,J=l.highlightedMaskClassName,ie=l.disableInteraction,se=l.disableDotsNavigation,me=l.nextStep,z=l.prevStep,Oe=l.rounded,Ne=l.accentColor,Ze=l.CustomHelper,ae=l.disableFocusLock,ce=l.highlightedBorder,K=this.state,ye=K.isOpen,he=K.current,je=K.inDOM,G=K.top,tt=K.right,q=K.bottom,ee=K.left,B=K.width,H=K.height,U=K.w,re=K.h,I=K.helperWidth,de=K.helperHeight,W=K.helperPosition;return ye?Y.createElement(R0,null,Y.createElement($0,null),Y.createElement(D0,{step:d[he],refresh:function(){return r.recalculateNode(d[he])}}),Y.createElement(A0,{step:d[he],refresh:function(){return r.recalculateNode(d[he])}}),Y.createElement($T,{onClick:this.maskClickHandler,forwardRef:function(be){return r.mask=be},windowWidth:U,windowHeight:re,targetWidth:B,targetHeight:H,targetTop:G,targetLeft:ee,padding:w,rounded:Oe,roundedStep:d[he].roundedStep,className:p,disableInteraction:d[he].stepInteraction===!1||ie?!d[he].stepInteraction:ie,disableInteractionClassName:"".concat(bn.mask.disableInteraction," ").concat(J),highlightedBorder:ce}),Y.createElement(KC,{disabled:ae,autoFocus:!1},Y.createElement(T0,{ref:this.helper,targetHeight:H,targetWidth:B,targetTop:G,targetRight:tt,targetBottom:q,targetLeft:ee,windowWidth:U,windowHeight:re,helperWidth:I,helperHeight:de,helperPosition:W,padding:w,tabIndex:-1,current:he,style:d[he].style?d[he].style:{},rounded:Oe,className:D_(bn.helper.base,u,fs({},bn.helper.isOpen,ye)),accentColor:Ne,defaultStyles:!Ze,role:"dialog"},Ze?Y.createElement(Ze,{current:he,totalSteps:d.length,gotoStep:this.gotoStep,close:C,content:d[he]&&(typeof d[he].content=="function"?d[he].content({close:C,goTo:this.gotoStep,inDOM:je,step:he+1}):d[he].content)},this.props.children):Y.createElement(Y.Fragment,null,this.props.children,d[he]&&(typeof d[he].content=="function"?d[he].content({close:C,goTo:this.gotoStep,inDOM:je,step:he+1}):d[he].content),k&&Y.createElement(k0,{"data-tour-elem":"badge",accentColor:Ne},typeof A=="function"?A(he+1,d.length):he+1),(m||_)&&Y.createElement(S0,{"data-tour-elem":"controls"},m&&Y.createElement(ew,{onClick:typeof z=="function"?z:this.prevStep,disabled:he===0,label:D||null}),_&&Y.createElement(E0,{"data-tour-elem":"navigation"},d.map(function(Ce,be){return Y.createElement(I0,{key:"".concat(Ce.selector?Ce.selector:"undef","_").concat(be),onClick:function(){return r.gotoStep(be)},current:he,index:be,accentColor:Ne,disabled:he===be||se,showNumber:y,"data-tour-elem":"dot",className:D_(bn.dot.base,fs({},bn.dot.active,he===be)),"aria-label":Ce.navDotAriaLabel})})),m&&Y.createElement(ew,{onClick:he===d.length-1?E?C:function(){}:typeof me=="function"?me:this.nextStep,disabled:!E&&he===d.length-1,inverted:!0,label:E&&he===d.length-1?E:R||null})),f&&Y.createElement(v0,{onClick:C,className:"reactour__close",ariaLabel:v}))))):null}}])})(Ew),hg=function(s,i,r){if(r){var l=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u=Math.max(document.documentElement.clientHeight,window.innerHeight||0),d=$c(r),p=d.width,m=d.height,f={top:u+10,right:l/2+9,bottom:u/2+9,left:l/2-p/2,width:0,height:0,w:l,h:u,helperPosition:"center"};return s&&(f=fT(s,i)),function(){return Ec(Ec({w:l,h:u,helperWidth:p,helperHeight:m,helperPosition:i.position},f),{},{inDOM:!!s})}}};Bm.propTypes=O0;Bm.defaultProps=M0;const N0=""+new URL("blockly2js-B3Jxf2e-.svg",import.meta.url).href,L0=""+new URL("rules2js-DnYyR8mI.svg",import.meta.url).href,As={selectTriggers:0,addScheduleByDoubleClick:1,openTagsMenu:2,selectIntervalTag:3,selectActions:4,addActionPrintText:5,showJavascript:6,switchBackToRules:7,saveTheScript:8},P0=[{selector:".blocks-triggers",content:"Select triggers"},{selector:".block-TriggerScheduleBlock",content:"Double click to add the block"},{selector:".tag-card",content:"Open drop down menu"},{selector:".tag-card-interval",content:"Select interval"},{selector:".blocks-actions",content:"Select action blocks"},{selector:".block-ActionPrintText",content:"Double click to add the block"},{selector:".button-js-code",content:"Check the script"},{selector:".button-js-code",content:"Switch back to rules"},{selector:".button-save",content:"Save the script"}],pg=187,nc={root:{left:0,top:0,width:"100%",height:"100%",position:"fixed",background:"rgba(0, 0, 0, .3)",zIndex:2e4},connecting:{left:"40%",top:"40%",width:"20%",height:"20%",position:"absolute"},spinner:{animation:"admin-connecting-rotator 1.4s linear infinite"},path:{strokeDasharray:187,strokeDashoffset:0,transformOrigin:"center",animation:"admin-connecting-dash 1.4s ease-in-out infinite, $colors 5.6s ease-in-out infinite"}};function vn(){return g.jsxs("div",{style:nc.root,children:[g.jsx("style",{children:`
231
+ ' @keyframes admin-connecting-colors {
232
+ 0% {
233
+ stroke: #4285F4;
234
+ }
235
+ 25% {
236
+ stroke: #DE3E35;
237
+ }
238
+ 50% {
239
+ stroke: #F7C223;
240
+ }
241
+ 75% {
242
+ stroke: #1B9A59;
243
+ }
244
+ 100% {
245
+ stroke: #4285F4;
246
+ }
247
+ }
248
+ @keyframes admin-connecting-dash {
249
+ 0% {
250
+ stroke-dashoffset: ${pg};
251
+ }
252
+ 50% {
253
+ stroke-dashoffset: ${pg/4};
254
+ transform: rotate(135deg);
255
+ }
256
+ 100% {
257
+ stroke-dashoffset: ${pg};
258
+ transform: 'rotate(450deg);
259
+ }
260
+ }
261
+ @keyframes admin-connecting-rotator {
262
+ 0% {
263
+ transform: rotate(0deg);
264
+ }
265
+ 100% {
266
+ transform: rotate(270deg);
267
+ }
268
+ }
269
+ `}),g.jsx("div",{style:nc.connecting,children:g.jsx("svg",{style:nc.spinner,width:"100%",height:"100%",viewBox:"0 0 66 66",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("circle",{style:nc.path,fill:"none",strokeWidth:"6",strokeLinecap:"round",cx:"33",cy:"33",r:"30"})})})]})}const B0=Y.lazy(()=>On(()=>Promise.resolve().then(()=>fR),void 0,import.meta.url)),j0=Y.lazy(()=>On(()=>import("./index-CLJ6-h9Q.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)),F0=Y.lazy(()=>On(()=>import("./index-D8iYqogF.js"),__vite__mapDeps([14,1,2,3,4,6,7,5,15,8,9,10,11,12]),import.meta.url)),z0=Y.lazy(()=>On(()=>import("./ScriptEditorVanillaMonaco-yq11eIYC.js"),__vite__mapDeps([15,1,2,3,4,6,7,5]),import.meta.url)),U0=Y.lazy(()=>On(()=>import("./ScriptEditor-BVaX7Hcs.js"),__vite__mapDeps([16,1,2,3,4,6,5,15,7,17]),import.meta.url)),H0=Y.lazy(()=>On(()=>import("./OpenAiDialog-Dx-XNET0.js"),__vite__mapDeps([18,1,2,3,4,6,5,9,19,15,7,8,10,11,12]),import.meta.url)),lw={Blockly:hC,"Javascript/js":_c,Rules:gC,def:_c,"TypeScript/ts":pC},W0=48,cw="#02a102",gg="#70aae9",V0=Cw[400],G0=Tw[400],Te={toolbar:a=>({minHeight:38,boxShadow:"0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)",backgroundColor:a.palette.mode==="dark"?"#1e1e1e":"#E2E2E2"}),toolbarButtons:{padding:4,marginLeft:4},toolbarButtonsDisabled:{filter:"grayscale(100%)",opacity:.5},editorDiv:a=>({height:`calc(100% - ${(parseInt(a.toolbar.height,10)||48)+38+10}px)`,width:"100%",overflow:"hidden",position:"relative"}),textButton:{marginRight:10,minHeight:24,padding:"6px 16px",height:32},saveButton:{background:"#ff9900"},tabIcon:{width:24,height:24,verticalAlign:"middle",marginBottom:2,marginRight:2,borderRadius:3},hintIcon:{padding:"0 8px 0 8px"},hintButton:{marginTop:8,marginLeft:20},tabMenuButton:{position:"absolute",top:0,right:0},tabChanged:a=>({color:a.palette.secondary.main}),tabText:{maxWidth:130,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",display:"inline-block",verticalAlign:"middle"},tabChangedIcon:{color:"#FF0000",fontSize:16,marginLeft:5},closeButton:{marginLeft:5},notRunning:{color:"#ffbc00",marginRight:8,marginLeft:8},tabButton:{minHeight:48},tabButtonWrapper:{display:"inline-block"},menuIcon:{width:18,height:18,borderRadius:2,marginRight:5}};function K0(){return g.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 2406 2406",children:[g.jsx("path",{d:"M1 578.4C1 259.5 259.5 1 578.4 1h1249.1c319 0 577.5 258.5 577.5 577.4V2406H578.4C259.5 2406 1 2147.5 1 1828.6V578.4z",fill:"#74aa9c"}),g.jsx("path",{d:"M1107.3 299.1c-198 0-373.9 127.3-435.2 315.3C544.8 640.6 434.9 720.2 370.5 833c-99.3 171.4-76.6 386.9 56.4 533.8-41.1 123.1-27 257.7 38.6 369.2 98.7 172 297.3 260.2 491.6 219.2 86.1 97 209.8 152.3 339.6 151.8 198 0 373.9-127.3 435.3-315.3 127.5-26.3 237.2-105.9 301-218.5 99.9-171.4 77.2-386.9-55.8-533.9v-.6c41.1-123.1 27-257.8-38.6-369.8-98.7-171.4-297.3-259.6-491-218.6-86.6-96.8-210.5-151.8-340.3-151.2zm0 117.5-.6.6c79.7 0 156.3 27.5 217.6 78.4-2.5 1.2-7.4 4.3-11 6.1L952.8 709.3c-18.4 10.4-29.4 30-29.4 51.4V1248l-155.1-89.4V755.8c-.1-187.1 151.6-338.9 339-339.2zm434.2 141.9c121.6-.2 234 64.5 294.7 169.8 39.2 68.6 53.9 148.8 40.4 226.5-2.5-1.8-7.3-4.3-10.4-6.1l-360.4-208.2c-18.4-10.4-41-10.4-59.4 0L1024 984.2V805.4L1372.7 604c51.3-29.7 109.5-45.4 168.8-45.5zM650 743.5v427.9c0 21.4 11 40.4 29.4 51.4l421.7 243-155.7 90L597.2 1355c-162-93.8-217.4-300.9-123.8-462.8C513.1 823.6 575.5 771 650 743.5zm807.9 106 348.8 200.8c162.5 93.7 217.6 300.6 123.8 462.8l.6.6c-39.8 68.6-102.4 121.2-176.5 148.2v-428c0-21.4-11-41-29.4-51.4l-422.3-243.7 155-89.3zM1201.7 997l177.8 102.8v205.1l-177.8 102.8-177.8-102.8v-205.1L1201.7 997zm279.5 161.6 155.1 89.4v402.2c0 187.3-152 339.2-339 339.2v-.6c-79.1 0-156.3-27.6-217-78.4 2.5-1.2 8-4.3 11-6.1l360.4-207.5c18.4-10.4 30-30 29.4-51.4l.1-486.8zM1380 1421.9v178.8l-348.8 200.8c-162.5 93.1-369.6 38-463.4-123.7h.6c-39.8-68-54-148.8-40.5-226.5 2.5 1.8 7.4 4.3 10.4 6.1l360.4 208.2c18.4 10.4 41 10.4 59.4 0l421.9-243.7z",fill:"white"})]})}class kn extends Y.Component{getSelect=null;changedMirror={};cron={initValue:null,callback:null};scriptDialog={initValue:null,callback:null,args:null,isReturn:!1};objects;scripts;selectId={initValue:null,callback:null};confirmCallback=null;constructor(s){var u,d;super(s);let i=window.localStorage.getItem("Editor.selected")||"";const r=window.localStorage.getItem("Editor.editing")||"[]";let l;try{l=JSON.parse(r)}catch{l=[]}i&&!l.includes(i)&&l.push(i),i&&!this.props.password&&((d=(u=this.props.objects[i])==null?void 0:u.native)!=null&&d.protected)&&(i=l.find(p=>{var m,f;return!((f=(m=this.props.objects[p])==null?void 0:m.native)!=null&&f.protected)})||""),!i&&l.length&&(this.props.password?i=l[0]:i=l.find(p=>{var m,f;return!((f=(m=this.props.objects[p])==null?void 0:m.native)!=null&&f.protected)})||""),this.state={askAboutDebug:!1,astroEvents:null,blockly:null,changed:{},cmdToBlockly:"",cmdToRules:"",confirm:"",debugEnabled:!1,editing:l,insert:"",instancesLoaded:!1,isTourOpen:window.localStorage.getItem("tour")!=="true",menuDebugAnchorEl:null,menuOpened:!!this.props.menuOpened,menuTabsOpened:!1,openAiDialog:!1,triggerPrettier:1,rules:null,runningInstances:this.props.runningInstances||{},searchText:"",selected:i,showAdapterDebug:!1,showAstro:!1,showCompiledCode:!1,showCron:!1,showDebugMenu:!1,showScript:!1,showSelectId:!1,themeType:this.props.themeType,toast:"",tourStep:As.selectTriggers,verboseEnabled:!1,visible:s.visible},this.setChangedInAdmin(),window.systemLang=b.I18n.getLanguage(),window.main={objects:{},getObject:(p,m)=>this.props.socket.getObject(p).then(f=>m==null?void 0:m(null,f)).catch(f=>m==null?void 0:m(f)),instances:[],selectIdDialog:(p,m,f)=>{typeof m=="function"&&(f=m,m=null),this.selectId.callback=f,this.selectId.initValue=p,this.selectId.type=m,this.setState({showSelectId:!0})},cronDialog:(p,m)=>{this.cron.callback=m,this.cron.initValue=p,this.setState({showCron:!0})},showScriptDialog:(p,m,f,v)=>{this.scriptDialog.callback=v,this.scriptDialog.initValue=p,this.scriptDialog.args=m,this.scriptDialog.isReturn=f||!1,this.setState({showScript:!0})}},this.objects=s.objects,this.scripts={},this.getAllAdapterInstances().then(()=>{this.props.onSelectedChange&&this.state.selected&&setTimeout(()=>this.props.onSelectedChange(this.state.selected,this.state.editing),100)})}async getAllAdapterInstances(){const s=await this.props.socket.getAdapterInstances(!0),i={},r=s.map(l=>(i[l._id]=l,l._id));window.main.objects=i,window.main.instances=r,this.setState({instancesLoaded:!0})}static onInstanceChanged(s,i){if(s)if(!i&&window.main.instances.includes(s)){delete window.main.objects[s];const r=window.main.instances.indexOf(s);window.main.instances.splice(r,1)}else(i==null?void 0:i.type)==="instance"&&(window.main.instances.includes(s)||(window.main.instances.push(s),window.main.instances.sort()),window.main.objects[s]=i)}setChangedInAdmin(){const s=Object.keys(this.state.changed).find(i=>this.state.changed[i]);Object.keys(this.state.changed).forEach(i=>{this.changedMirror[i]=this.state.changed[i]}),Object.keys(this.changedMirror).forEach(i=>{this.state.changed[i]===void 0&&delete this.changedMirror[i]}),this.props.onChangedChanged(this.changedMirror),typeof window.parent<"u"&&window.parent&&(window.parent.configNotSaved=!!s)}componentDidMount(){window.addEventListener("beforeunload",this.onBrowserClose,!1),this.props.socket.subscribeObject("system.adapter.*",kn.onInstanceChanged)}componentWillUnmount(){window.removeEventListener("beforeunload",this.onBrowserClose),this.props.socket.unsubscribeObject("system.adapter.*",kn.onInstanceChanged)}onBrowserClose=s=>{const i=Object.keys(this.scripts).find(r=>JSON.stringify(this.scripts[r])!==JSON.stringify(this.getScriptFromObject(r)));if(i){console.log(`Script ${JSON.stringify(this.scripts[i])}`);const r=b.I18n.t("Configuration not saved.");return s=s||window.event,s&&(s.returnValue=r),r}};removeNonExistingScripts(s,i){s=s||this.props,i=i||{};let r=!1;if(this.state.editing&&this.state.editing.find(u=>s&&!s.objects[u])){const u=[...this.state.editing];for(let d=u.length-1;d>=0;d--)this.objects[u[d]]||(r=!0,u.splice(d,1));r&&(i.editing=u),this.state.selected&&!this.objects[this.state.selected]&&(r=!0,i.selected=u[0]||"",i.selected&&this.scripts[i.selected]&&(this.state.blockly!==(this.scripts[i.selected].engineType==="Blockly")&&(i.blockly=this.scripts[i.selected].engineType==="Blockly",r=!0),this.state.rules!==(this.scripts[i.selected].engineType==="Rules")&&(i.rules=this.scripts[i.selected].engineType==="Rules",r=!0),this.state.verboseEnabled!==this.scripts[i.selected].verbose&&(i.verboseEnabled=this.scripts[i.selected].verbose,r=!0),this.state.debugEnabled!==this.scripts[i.selected].debug&&(i.debugEnabled=this.scripts[i.selected].debug,r=!0)))}return r}UNSAFE_componentWillReceiveProps(s){var l,u,d;const i={};let r=!1;if(JSON.stringify(s.runningInstances)!==JSON.stringify(this.state.runningInstances)&&(r=!0,i.runningInstances=s.runningInstances),this.state.menuOpened!==s.menuOpened&&(i.menuOpened=s.menuOpened,r=!0),this.state.themeType!==s.themeType&&(i.themeType=s.themeType,r=!0),this.removeNonExistingScripts(s,i)&&(r=!0),this.state.searchText!==s.searchText&&(i.searchText=s.searchText,r=!0),this.objects!==s.objects){this.objects=s.objects,window.main.objects=s.objects,Object.keys(this.scripts).forEach(m=>{const f=this.scripts[m].source;this.scripts[m]=JSON.parse(JSON.stringify(this.objects[m].common)),this.scripts[m].source=f}),this.state.selected&&this.objects[this.state.selected]&&(this.scripts[this.state.selected]||=JSON.parse(JSON.stringify(this.objects[this.state.selected].common)),this.state.blockly!==(this.scripts[this.state.selected].engineType==="Blockly")&&(i.blockly=this.scripts[this.state.selected].engineType==="Blockly",r=!0),this.state.rules!==(this.scripts[this.state.selected].engineType==="Rules")&&(i.rules=this.scripts[this.state.selected].engineType==="Rules",r=!0),this.state.verboseEnabled!==this.scripts[this.state.selected].verbose&&(i.verboseEnabled=this.scripts[this.state.selected].verbose,r=!0),this.state.debugEnabled!==this.scripts[this.state.selected].debug&&(i.debugEnabled=this.scripts[this.state.selected].debug,r=!0));const p=[...this.state.editing];for(let m=p.length-1;m>=0;m--)this.objects[p[m]]||(r=!0,p.splice(m,1),this.state.changed[p[m]]!==void 0&&(i.changed||={...this.state.changed},i.changed&&delete i.changed[p[m]]));this.state.selected&&!this.objects[this.state.selected]&&(i.selected=p[0]||""),r&&(i.editing=p)}else for(const p in this.scripts)if(Object.prototype.hasOwnProperty.call(this.scripts,p)){if((l=this.objects[p])!=null&&l.common){if(this.objects[p].type==="script"){const m=this.scripts[p].source,f=JSON.parse(JSON.stringify(this.scripts[p]));f.source=this.objects[p].common.source,JSON.stringify(f)!==JSON.stringify(this.objects[p].common)&&(this.scripts[p]=JSON.parse(JSON.stringify(this.objects[p].common)),this.scripts[p].source=m),m!==this.objects[p].common.source?this.state.changed[p]?(d=this.objects[p].from)!=null&&d.startsWith("system.adapter.javascript.")&&(this.objects[p].from="system.adapter.admin.0",this.setState({toast:b.I18n.t("Script %s was modified on disk.",p.split(".").pop())})):this.props.password&&((u=this.objects[p].native)!=null&&u.protected)?this.scripts[p].source=Ug(this.props.password,this.objects[p].common.source):this.scripts[p].source=this.objects[p].common.source:this.state.changed[p]&&(i.changed||={...this.state.changed},i.changed&&(i.changed[p]=!1),r=!0)}}else if(this.scripts[p]&&(delete this.scripts[p],this.state.selected===p)){if(this.state.editing.indexOf(p)!==-1){const m=[...this.state.editing],f=m.indexOf(p);f!==-1&&(m.splice(f,1),i.editing=m,r=!0)}i.selected=this.state.editing[0]||"",r=!0}}if(s.selected&&this.state.selected!==s.selected){const p=this.getScriptFromObject(s.selected);this.scripts[s.selected]||=p;const m=p&&JSON.stringify(this.scripts[s.selected])!==JSON.stringify(p),f=[...this.state.editing];s.selected&&!f.includes(s.selected)&&(f.push(s.selected),this.props.onSelectedChange(s.selected,f),window.localStorage.setItem("Editor.editing",JSON.stringify(f))),r=!0,i.changed||={...this.state.changed},i.changed[s.selected]=!!m,i.editing=f,i.selected=s.selected,i.blockly=this.scripts[s.selected].engineType==="Blockly",i.rules=this.scripts[s.selected].engineType==="Rules",i.verboseEnabled=this.scripts[s.selected].verbose,i.debugEnabled=this.scripts[s.selected].debug,i.showCompiledCode=!1}this.state.visible!==s.visible&&(r=!0,i.visible=s.visible),r&&this.setState(i,()=>this.setChangedInAdmin())}onRestart(){var s,i;(i=(s=this.props).onRestart)==null||i.call(s,this.state.selected)}onStartStop(){var i,r,l;const s=JSON.parse(JSON.stringify(this.scripts[this.state.selected]));s.enabled=!s.enabled,this.props.password&&((i=this.props.objects[this.state.selected].native)!=null&&i.protected)&&(s.source=mc(this.props.password,s.source)),(l=(r=this.props).onChange)==null||l.call(r,this.state.selected,s)}onSave(){if(this.state.isTourOpen&&this.state.tourStep===As.saveTheScript&&(this.setState({isTourOpen:!1}),window.localStorage.setItem("tour","true")),this.state.changed[this.state.selected]){const s={...this.state.changed};s[this.state.selected]=!1,this.setState({changed:s},()=>{var r,l,u;this.setChangedInAdmin();const i=JSON.parse(JSON.stringify(this.scripts[this.state.selected]));this.props.password&&((r=this.props.objects[this.state.selected].native)!=null&&r.protected)&&(i.source=mc(this.props.password,i.source)),(u=(l=this.props).onChange)==null||u.call(l,this.state.selected,i)})}}onSaveAll(){const s={...this.state.changed};Object.keys(s).forEach(i=>{var r,l,u;if(s[i]){s[i]=!1;const d=JSON.parse(JSON.stringify(this.scripts[i]));this.props.password&&((r=this.props.objects[i].native)!=null&&r.protected)&&(d.source=mc(this.props.password,d.source)),(u=(l=this.props).onChange)==null||u.call(l,i,d)}}),this.setState({changed:s},()=>this.setChangedInAdmin())}onCancel(){this.scripts[this.state.selected]=this.getScriptFromObject(this.state.selected);const s={...this.state.changed};s[this.state.selected]=!1,this.setState({changed:s},()=>this.setChangedInAdmin())}onRegisterSelect(s){this.getSelect=s}onConvertBlockly2JS(){this.showConfirmDialog(b.I18n.t("It will not be possible to revert this operation."),s=>{if(s){this.scripts[this.state.selected].engineType="Javascript/js";const r=this.scripts[this.state.selected].source.split(`
270
+ `);r.pop(),this.scripts[this.state.selected].source=r.join(`
271
+ `);const l=this.state.selected,u={...this.state.changed};u[this.state.selected]=!0,this.setState({changed:u,blockly:!1,selected:""},()=>{this.setChangedInAdmin(),setTimeout(()=>this.setState({selected:l}),100)})}})}onChange(s){if(s.script!==void 0){if(s.script===this.scripts[this.state.selected].source)return;this.scripts[this.state.selected].source=s.script}s.debug!==void 0&&(this.scripts[this.state.selected].debug=s.debug),s.verbose!==void 0&&(this.scripts[this.state.selected].verbose=s.verbose);const i=JSON.stringify(this.scripts[this.state.selected])!==JSON.stringify(this.getScriptFromObject(this.state.selected));if(i!==!!this.state.changed[this.state.selected]){const r={...this.state.changed};r[this.state.selected]=i,this.objects[this.state.selected].from="system.adapter.admin.0",this.setState({changed:r},()=>this.setChangedInAdmin())}}onTabChange(s){var r,l;if(this.props.debugMode)return;window.localStorage.setItem("Editor.selected",s);const i=this.scripts[s]||this.getScriptFromObject(s);this.setState({selected:s,rules:i.engineType==="Rules",blockly:i.engineType==="Blockly",showCompiledCode:!1,verboseEnabled:i.verbose,debugEnabled:i.debug}),(l=(r=this.props).onSelectedChange)==null||l.call(r,s,this.state.editing)}isScriptChanged(s){return!!(this.scripts[s]&&this.props.objects[s]&&JSON.stringify(this.scripts[s])!==JSON.stringify(this.getScriptFromObject(s)))}onTabClose(s,i){i==null||i.stopPropagation();const r=this.state.editing.indexOf(s);if(this.state.editing.includes(s))if(this.isScriptChanged(s))this.showConfirmDialog(b.I18n.t("Discard changes for %s",this.props.objects[s].common.name),l=>{l&&(delete this.scripts[s],this.onTabClose(s))});else{const l=[...this.state.editing];l.splice(r,1);const u={editing:l};if(s===this.state.selected?l.length?r===0||l.length===1?u.selected=l[0]:u.selected=l[r-1]:u.selected="":this.state.selected&&!l.length&&(u.selected=""),window.localStorage.setItem("Editor.editing",JSON.stringify(l)),u.selected!==void 0){u.changed||={...this.state.changed},u.changed[u.selected]=this.isScriptChanged(u.selected);const d=u.selected?this.scripts[u.selected]||this.getScriptFromObject(u.selected):void 0;u.blockly=(d==null?void 0:d.engineType)==="Blockly",u.rules=(d==null?void 0:d.engineType)==="Rules",u.verboseEnabled=!!(d!=null&&d.verbose),u.debugEnabled=!!(d!=null&&d.debug),u.showCompiledCode=!1}this.setState(u,()=>{var d,p,m,f;this.setChangedInAdmin(),u.selected!==void 0?((p=(d=this.props).onSelectedChange)==null||p.call(d,u.selected,this.state.editing),window.localStorage.setItem("Editor.selected",u.selected)):(f=(m=this.props).onSelectedChange)==null||f.call(m,this.state.selected,this.state.editing)})}}showConfirmDialog(s,i){this.confirmCallback=i,this.setState({confirm:s})}sendCommandToBlockly(s){this.setState({cmdToBlockly:s},()=>setTimeout(()=>this.setState({cmdToBlockly:""}),200))}sendCommandToRules(s){this.setState({cmdToRules:s},()=>setTimeout(()=>this.setState({cmdToRules:""}),200))}static getText(s){return typeof s=="object"?s[b.I18n.getLanguage()]||s.en:s}getScriptFullName(s){var u;const i=s.split(".");i.shift(),i.shift();const r=[];let l="script.js";for(let d=0;d<i.length;d++)l+=`.${i[d]}`,(u=this.props.objects[l])!=null&&u.common?r.push(kn.getText(this.props.objects[l].common.name)):r.push(i[d]);return`/ ${r.join(" / ")}`}getTabs(){return this.state.editing.length?[g.jsxs(Nk,{component:"div",value:this.props.debugInstance?this.props.debugInstance.adapter:this.state.selected,onChange:(s,i)=>this.onTabChange(i),indicatorColor:"primary",style:{position:"relative",marginLeft:10,width:this.state.editing.length>1?"calc(100% - 50px)":"100%",display:"inline-block"},textColor:"primary",variant:"scrollable",scrollButtons:"auto",allowScrollButtonsMobile:!0,children:[this.state.editing.map(s=>{var p,m;if(!this.props.objects[s]){const f=[g.jsx($t,{sx:this.isScriptChanged(s)?Te.tabChanged:void 0,style:Te.tabText,children:s.split(".").pop()},"text"),g.jsx(Me,{onClick:v=>this.onTabClose(s,v),style:Te.closeButton,size:"small",component:"span",children:g.jsx(Ql,{})},"icon")];return g.jsx(Yp,{wrapped:!0,href:`#${s}`,label:f,value:s,sx:{"& .MuiTab-wrapper":Te.tabButtonWrapper}},s)}if(!this.props.password&&((p=this.props.objects[s].native)!=null&&p.protected))return null;let i=kn.getText(this.props.objects[s].common.name)||"";const r=this.getScriptFullName(s);i.length>18&&(i=`${i.substring(0,15)}...`);const l=(m=this.getScriptFromObject(s))==null?void 0:m.source,u=this.scripts[s]&&l!==this.scripts[s].source,d=[g.jsx($t,{sx:this.isScriptChanged(s)?Te.tabChanged:void 0,style:Te.tabText,children:i},"text"),u?g.jsx("span",{style:Te.tabChangedIcon,children:"▣"},"changedSign"):null,!this.props.debugInstance&&(!this.props.debugMode||this.state.selected!==s)&&g.jsx(Me,{onClick:f=>this.onTabClose(s,f),style:Te.closeButton,size:"small",component:"span",children:g.jsx(Ql,{})},"icon")];return g.jsx(Yp,{disabled:!!this.props.debugInstance||this.state.selected!==s&&this.props.debugMode,wrapped:!0,iconPosition:"start",icon:g.jsx("img",{alt:"",src:lw[this.props.objects[s].common.engineType]||lw.def,style:Te.tabIcon},"icon"),href:`#${s}`,label:d,style:Te.tabButton,value:s,title:r,sx:{"& .MuiTab-wrapper":Te.tabButtonWrapper}},s)}),this.props.debugInstance?g.jsx(Yp,{disabled:!1,wrapped:!0,href:`#${this.props.debugInstance.adapter}`,label:this.props.debugInstance.adapter,style:Te.tabButton,value:this.props.debugInstance.adapter,title:this.props.debugInstance.adapter,sx:{"& .MuiTab-wrapper":Te.tabButtonWrapper}},this.props.debugInstance.adapter):""]},"tabs1"),this.state.editing.length>1?g.jsx(Me,{href:"#","aria-label":"Close all but current",style:Te.tabMenuButton,title:b.I18n.t("Close all but current"),"aria-haspopup":"false",onClick:s=>{const i=[this.state.selected];Object.keys(this.scripts).forEach(r=>r!==this.state.selected&&JSON.stringify(this.scripts[r])!==JSON.stringify(this.getScriptFromObject(r))&&i.push(r)),window.localStorage.setItem("Editor.editing",JSON.stringify(i)),this.setState({menuTabsOpened:!1,editing:i})},size:"medium",children:g.jsx(aS,{})},"menuButton"):null]:g.jsx($t,{sx:Te.toolbar,children:g.jsxs(De,{color:"grey",disabled:!0,style:Te.hintButton,href:"",children:[g.jsx("span",{children:b.I18n.t("Click on this icon")},"select2"),g.jsx(lS,{style:Te.hintIcon},"select3"),g.jsx("span",{children:b.I18n.t("for edit or create script")},"select4")]},"select1")},"tabs2")}getDebugMenu(){return this.state.showDebugMenu?g.jsxs(cm,{id:"menu-debug",anchorEl:this.state.menuDebugAnchorEl,open:this.state.showDebugMenu,onClose:()=>this.setState({showDebugMenu:!1,menuDebugAnchorEl:null}),slotProps:{root:{style:{maxHeight:W0*7.5}}},children:[g.jsxs(Ve,{title:b.I18n.t("debug_help"),onClick:s=>{s.stopPropagation(),s.preventDefault(),this.setState({showDebugMenu:!1,menuDebugAnchorEl:null,debugEnabled:!this.state.debugEnabled},()=>this.onChange({debug:this.state.debugEnabled}))},children:[g.jsx(bc,{checked:this.state.debugEnabled}),g.jsx(ec,{style:{...Te.menuIcon,color:cw}}),b.I18n.t("debug_label")]},"debugEnabled"),g.jsxs(Ve,{title:b.I18n.t("verbose_help"),onClick:s=>{s.stopPropagation(),s.preventDefault(),this.setState({showDebugMenu:!1,menuDebugAnchorEl:null,verboseEnabled:!this.state.verboseEnabled},()=>this.onChange({verbose:this.state.verboseEnabled}))},children:[g.jsx(bc,{checked:this.state.verboseEnabled}),g.jsx(s_,{style:{...Te.menuIcon,color:gg}}),b.I18n.t("verbose_label")]},"verboseEnabled")]},"menuDebug"):null}getDebugBadge(){return[this.state.debugEnabled&&this.state.verboseEnabled?g.jsx(ec,{style:{...Te.menuIcon,color:gg}},"DebugVerbose"):null,this.state.debugEnabled&&!this.state.verboseEnabled?g.jsx(ec,{style:{...Te.menuIcon,color:cw}},"DebugNoVerbose"):null,!this.state.debugEnabled&&this.state.verboseEnabled?g.jsx(s_,{style:{...Te.menuIcon,color:gg}},"noDebugVerbose"):null]}getAskAboutDebug(){return this.state.askAboutDebug?g.jsx(b.DialogConfirm,{onClose:()=>{this.setState({askAboutDebug:!1},()=>this.props.onDebugModeChange(!0))},ok:b.I18n.t("Yes"),cancel:b.I18n.t("Cancel"),text:b.I18n.t("The script will be stopped and must be activated manually after debugging. Continue?")}):null}renderOpenAiDialog(){return this.state.openAiDialog?g.jsx(pn,{fallback:g.jsx(vn,{}),children:g.jsx(H0,{adapterName:this.props.adapterName,socket:this.props.socket,runningInstances:this.state.runningInstances,themeType:this.state.themeType,onClose:()=>this.setState({openAiDialog:!1}),language:this.scripts[this.state.selected].engineType==="TypeScript/ts"?"typescript":"javascript",onAddCode:s=>this.setState({insert:s})})}):null}getToolbar(){var r,l;const s=!!(this.state.selected&&((r=this.scripts[this.state.selected])!=null&&r.engine)&&this.state.runningInstances[this.scripts[this.state.selected].engine]),i=!!(this.state.selected&&((l=this.scripts[this.state.selected])!=null&&l.enabled));if(this.state.selected){const u=Object.keys(this.state.changed).filter(p=>this.state.changed[p]).length,d=this.state.changed[this.state.selected];return g.jsxs(Lk,{variant:"dense",sx:Te.toolbar,children:[!this.props.debugInstance&&this.state.menuOpened&&this.props.onLocate&&g.jsx(Me,{style:Te.toolbarButtons,title:b.I18n.t("Locate file"),onClick:()=>this.props.onLocate(this.state.selected),size:"medium",children:g.jsx(cS,{})},"locate"),!this.props.debugInstance&&!d&&s?g.jsx(Me,{disabled:this.props.debugMode,style:Te.toolbarButtons,onClick:()=>this.onRestart(),title:b.I18n.t("Restart"),size:"medium",children:g.jsx(uS,{})},"restart"):null,!this.props.debugInstance&&!d?g.jsx(Me,{disabled:this.props.debugMode,onClick:()=>this.onStartStop(),title:i?b.I18n.t("Pause script"):b.I18n.t("Run script"),size:"medium",style:{...Te.toolbarButtons,color:i?V0:G0},children:i?g.jsx(dS,{}):g.jsx(hS,{})},"start-stop"):null,!this.props.debugInstance&&!d&&!i?g.jsx("span",{style:Te.notRunning,children:b.I18n.t("Script is not running")}):null,!d&&i&&!s?g.jsx("span",{style:Te.notRunning,children:b.I18n.t("Instance is disabled")}):null,d?g.jsx(De,{color:"grey",variant:"contained",style:{...Te.textButton,...Te.saveButton},className:"button-save",onClick:()=>this.onSave(),endIcon:g.jsx(o_,{}),children:b.I18n.t("Save")},"save"):null,u>1||u===1&&!d?g.jsx(De,{color:"grey",variant:"contained",style:Te.textButton,onClick:()=>this.onSaveAll(),endIcon:g.jsx(o_,{}),children:b.I18n.t("Save all")},"saveall"):null,d?g.jsx(De,{color:"grey",variant:"contained",style:Te.textButton,onClick:()=>this.onCancel(),endIcon:g.jsx(Wc,{}),children:b.I18n.t("Cancel")},"cancel"):null,g.jsx("div",{style:{flex:2}}),!this.props.debugInstance&&!this.state.showCompiledCode&&g.jsx(Me,{style:Te.toolbarButtons,title:b.I18n.t("Prettify the script"),onClick:()=>this.setState({triggerPrettier:this.state.triggerPrettier+1}),size:"medium",children:g.jsx(pS,{})},"prettier"),this.state.blockly&&!this.state.showCompiledCode?g.jsx(Me,{"aria-label":"Export Blocks",title:b.I18n.t("Export blocks"),style:Te.toolbarButtons,onClick:()=>this.sendCommandToBlockly("export"),size:"medium",children:g.jsx(vc,{})},"export"):null,this.state.blockly&&!this.state.showCompiledCode&&g.jsx(Me,{"aria-label":"Import Blocks",title:b.I18n.t("Import blocks"),style:Te.toolbarButtons,onClick:()=>this.sendCommandToBlockly("import"),size:"medium",children:g.jsx(Rg,{})},"import"),this.state.blockly&&!this.state.showCompiledCode&&g.jsx(Me,{"aria-label":"Check code",title:b.I18n.t("Check blocks"),style:Te.toolbarButtons,onClick:()=>this.sendCommandToBlockly("check"),size:"medium",children:g.jsx(gS,{})},"check"),!this.props.debugMode&&!this.state.blockly&&!this.state.rules&&!this.state.showCompiledCode?g.jsx(Me,{"aria-label":"create CRON",title:b.I18n.t("Create or edit CRON or time wizard"),style:Te.toolbarButtons,onClick:()=>this.setState({showCron:!0}),size:"medium",children:g.jsx(mS,{})},"select-cron"):null,this.scripts[this.state.selected]&&this.scripts[this.state.selected].engineType!=="Blockly"&&this.scripts[this.state.selected].engineType!=="Rules"?g.jsx(Me,{"aria-label":"AI",title:b.I18n.t("AI code generator"),style:Te.toolbarButtons,size:"medium",onClick:()=>this.setState({openAiDialog:!0}),children:g.jsx(K0,{})},"ai"):null,g.jsx(Me,{"aria-label":"Show astronomical events",title:b.I18n.t("Show astronomical events"),style:Te.toolbarButtons,disabled:!s,onClick:()=>{this.setState({showAstro:!0,astroEvents:null}),this.props.socket.sendTo(this.scripts[this.state.selected].engine.replace("system.adapter.",""),"calcAstroAll",{}).then(p=>this.setState({astroEvents:p}))},size:"medium",children:g.jsx(fS,{})},"show-astro"),!this.props.debugMode&&!this.state.blockly&&!this.state.rules&&!this.state.showCompiledCode&&g.jsx(Me,{"aria-label":"select ID",title:b.I18n.t("Insert object ID"),style:Te.toolbarButtons,onClick:()=>this.setState({showSelectId:!0}),size:"medium",children:g.jsx($S,{})},"select-id"),this.state.blockly&&!this.state.rules&&this.state.showCompiledCode&&g.jsx(De,{color:"grey","aria-label":"convert to javascript",title:b.I18n.t("Convert blockly to javascript for ever."),onClick:()=>this.onConvertBlockly2JS(),children:"Blockly=>JS"},"convert2js"),this.state.rules&&!this.state.showCompiledCode&&g.jsx(Me,{"aria-label":"Export Blocks",title:b.I18n.t("Export blocks"),style:Te.toolbarButtons,onClick:()=>this.sendCommandToRules("export"),size:"medium",children:g.jsx(vc,{})},"export"),this.state.rules&&!this.state.showCompiledCode&&g.jsx(Me,{"aria-label":"Import Blocks",title:b.I18n.t("Import blocks"),style:Te.toolbarButtons,onClick:()=>this.sendCommandToRules("import"),size:"medium",children:g.jsx(Rg,{})},"import"),this.props.expertMode&&!d&&(this.props.debugMode||!this.state.blockly&&!this.state.rules||(this.state.blockly||this.state.rules)&&this.state.showCompiledCode)&&g.jsx(Me,{style:Te.toolbarButtons,color:this.props.debugMode?"primary":"default",disabled:!this.props.debugMode&&!s,onClick:()=>{!this.props.debugMode&&i?this.setState({askAboutDebug:!0}):this.props.onDebugModeChange(!this.props.debugMode)},size:"medium",children:g.jsx(ec,{style:{fontSize:32}})}),(this.state.blockly||this.state.rules)&&g.jsx(De,{"aria-label":"blockly",title:b.I18n.t("Show javascript code"),className:"button-js-code",color:this.state.showCompiledCode?"secondary":"inherit",disabled:this.props.debugMode,style:{...Te.toolbarButtons,...this.props.debugMode?Te.toolbarButtonsDisabled:void 0,padding:"0 5px"},onClick:()=>{this.props.debugMode||(this.setState({showCompiledCode:!this.state.showCompiledCode}),this.state.isTourOpen&&this.state.tourStep===As.showJavascript&&this.setState({tourStep:As.switchBackToRules}),this.state.isTourOpen&&this.state.tourStep===As.switchBackToRules&&this.setState({tourStep:As.saveTheScript}))},children:g.jsx("img",{alt:this.state.blockly?"blockly2js":"rules2js",src:this.state.blockly?N0:L0})},"blockly-code"),g.jsx(Me,{disabled:this.props.debugMode,"aria-label":"Debug menu",title:b.I18n.t("Debug options"),style:Te.toolbarButtons,onClick:p=>this.setState({showDebugMenu:!0,menuDebugAnchorEl:p.currentTarget}),size:"medium",children:g.jsx(Pk,{style:Te.badgeMargin,badgeContent:this.getDebugBadge(),children:g.jsx(bS,{})})},"debug")]},"toolbar1")}return null}getScriptEditor(){return!this.props.debugMode&&this.state.selected&&this.props.objects[this.state.selected]&&this.state.blockly!==null&&(!this.state.blockly||this.state.showCompiledCode)&&(!this.state.rules||this.state.showCompiledCode)?(this.scripts[this.state.selected]||=this.getScriptFromObject(this.state.selected),g.jsx($t,{sx:Te.editorDiv,children:g.jsx(pn,{fallback:g.jsx(vn,{}),children:g.jsx(z0,{name:this.state.selected,adapterName:this.props.adapterName,insert:this.state.insert,onInserted:()=>this.setState({insert:""}),onForceSave:()=>this.onSave(),searchText:this.state.searchText,onRegisterSelect:s=>this.onRegisterSelect(s),readOnly:this.state.showCompiledCode,changed:this.state.changed[this.state.selected],code:this.scripts[this.state.selected].source||"",isDark:this.state.themeType==="dark",socket:this.props.socket,runningInstances:this.state.runningInstances,triggerPrettier:this.state.triggerPrettier,onChange:s=>this.onChange({script:s}),language:this.scripts[this.state.selected].engineType==="TypeScript/ts"?"typescript":"javascript"},"scriptEditor1")})},"scriptEditorDiv")):null}getBlocklyEditor(){return!this.props.debugMode&&this.state.instancesLoaded&&this.state.selected&&this.props.objects[this.state.selected]&&this.state.blockly&&!this.state.showCompiledCode&&this.state.visible?(this.scripts[this.state.selected]||=this.getScriptFromObject(this.state.selected),g.jsx($t,{sx:Te.editorDiv,children:g.jsx(pn,{fallback:g.jsx(vn,{}),children:g.jsx(B0,{command:this.state.cmdToBlockly,themeType:this.state.themeType,searchText:this.state.searchText,code:this.scripts[this.state.selected].source||"",scriptId:this.state.selected,onChange:s=>this.onChange({script:s})},"BlocklyEditor")})},"blocklyEditorDiv")):null}getRulesEditor(){var s,i;if(!this.props.debugMode&&this.state.instancesLoaded&&this.state.selected&&this.props.objects[this.state.selected]&&this.state.rules&&!this.state.showCompiledCode&&this.state.visible){this.scripts[this.state.selected]||=this.getScriptFromObject(this.state.selected);const r=!!this.state.selected&&!!((s=this.scripts[this.state.selected])!=null&&s.engine)&&this.state.runningInstances[this.scripts[this.state.selected].engine],l=!!this.state.selected&&((i=this.scripts[this.state.selected])==null?void 0:i.enabled);return g.jsx($t,{sx:Te.editorDiv,children:g.jsx(pn,{fallback:g.jsx(vn,{}),children:g.jsx(j0,{scriptId:this.state.selected,setTourStep:this.setTourStep,tourStep:this.state.tourStep,isTourOpen:this.state.isTourOpen,changed:this.state.changed[this.state.selected],running:r&&l,command:this.state.cmdToRules,themeType:this.state.themeType,themeName:this.props.themeName,theme:this.props.theme,searchText:this.state.searchText,resizing:this.props.resizing,code:this.scripts[this.state.selected].source||"",onChange:u=>this.onChange({script:u})},"flowEditor")})},"flowEditorDiv")}return null}getConfirmDialog(){return this.state.confirm?g.jsx(b.DialogConfirm,{text:this.state.confirm,onClose:s=>{if(this.confirmCallback){const i=this.confirmCallback;this.confirmCallback=null,i(s)}this.setState({confirm:""})}},"dialogConfirm1"):null}getSelectIdDialog(){var s;if(this.state.showSelectId){const i=["state","channel","device","adapter","instance","enum","host","config","script","user","group"],r=["adapter","instance","enum","host","config","script","user","group"];let l=this.selectId.callback?this.selectId.initValue||"":this.getSelect&&this.getSelect()||"",u=l.indexOf("/*");u!==-1&&(l=l.substring(0,u)),u=l.indexOf("//"),u!==-1&&(l=l.substring(0,u));let d=l.match(/"([^"]+)"/);return d&&(l=d[1]),d=l.match(/'([^']+)'/),d&&(l=d[1]),g.jsx(b.DialogSelectID,{theme:this.props.theme,imagePrefix:"../..",themeName:this.props.themeName,themeType:this.state.themeType,socket:this.props.socket,selected:l,expertMode:this.selectId.type&&this.selectId.type!=="all"&&r.includes(this.selectId.type)?!0:void 0,types:((s=this.selectId)==null?void 0:s.type)==="all"?i:[this.selectId.type||"state"],onClose:()=>{this.setState({showSelectId:!1}),this.selectId.callback&&(this.selectId.callback=null)},onOk:(p,m)=>{this.selectId.initValue=null,this.selectId.callback?(this.selectId.callback(p),this.selectId.callback=null):this.setState({insert:`'${p}'/*${m}*/`})}},"dialogSelectID1")}return null}getCronDialog(){return this.state.showCron?g.jsx(b.DialogCron,{theme:this.props.theme,cron:this.cron.callback?this.cron.initValue||"":this.getSelect?this.getSelect():"* * * * *",onClose:()=>this.setState({showCron:!1}),onOk:s=>{this.cron.initValue=null,this.cron.callback?(this.cron.callback(s),this.cron.callback=null):this.setState({insert:`'${s}'`})}},"dialogCron1"):null}getAstroDialog(){return this.state.showAstro?g.jsxs(Vt,{open:!0,onClose:()=>this.setState({showAstro:!1}),children:[g.jsx(as,{children:b.I18n.t("Astronomical events today")}),g.jsx(Gt,{children:this.state.astroEvents?g.jsx(jk,{component:Dw,children:g.jsxs(Fk,{size:"small",children:[g.jsx(zk,{children:g.jsxs(t_,{children:[g.jsx(gn,{children:b.I18n.t("Name")}),g.jsx(gn,{children:b.I18n.t("Server time")}),g.jsx(gn,{children:b.I18n.t("Description")})]})}),g.jsx(Uk,{children:Object.keys(this.state.astroEvents).map(s=>{var i,r,l,u;return g.jsxs(t_,{children:[g.jsx(gn,{component:"th",scope:"row",children:s.startsWith("next")?"":s}),g.jsx(Hk,{title:`${b.I18n.t("Local time")}: ${(i=this.state.astroEvents)!=null&&i[s].isValidDate?new Date((r=this.state.astroEvents)==null?void 0:r[s].date).toLocaleTimeString():"n/a"}`,children:g.jsx(gn,{align:"right",children:(l=this.state.astroEvents)!=null&&l[s].isValidDate?(u=this.state.astroEvents)==null?void 0:u[s].serverTime:"n/a"})}),g.jsx(gn,{children:b.I18n.t(s)})]},s)})})]})}):g.jsx(Bk,{})}),g.jsx(Kt,{children:g.jsx(De,{variant:"contained",onClick:()=>this.setState({showAstro:!1}),color:"primary",startIcon:g.jsx(Ql,{}),children:b.I18n.t("Close")})})]},"dialogAstro"):null}getEditorDialog(){return this.state.showScript?g.jsx(pn,{fallback:g.jsx(vn,{}),children:g.jsx(U0,{adapterName:this.props.adapterName,source:this.scriptDialog.initValue||"",args:this.scriptDialog.args?this.scriptDialog.args.join(", "):"",isReturn:this.scriptDialog.isReturn,socket:this.props.socket,runningInstances:this.state.runningInstances,themeType:this.state.themeType,onClose:s=>{this.scriptDialog.initValue=null,this.scriptDialog.callback&&(s!==!1&&this.scriptDialog.callback(s||""),this.scriptDialog.callback=null),this.setState({showScript:!1})}},"scriptEditorDialog")}):null}getToast(){return g.jsx(Wk,{anchorOrigin:{vertical:"bottom",horizontal:"left"},open:!!this.state.toast,autoHideDuration:6e3,onClose:()=>this.setState({toast:""}),slotProps:{content:{"aria-describedby":"message-id"}},message:g.jsx("span",{id:"message-id",children:this.state.toast}),action:[g.jsx(Me,{"aria-label":"close",color:"inherit",style:Te.closeToast,onClick:()=>this.setState({toast:""}),size:"medium",children:g.jsx(Ql,{})},"close")]},"toast")}setTourStep=s=>this.setState({tourStep:s});getTour(){return this.state.instancesLoaded&&this.state.selected&&this.props.isAnyRulesExists===1&&this.props.objects[this.state.selected]&&this.state.rules&&this.state.visible?g.jsx(Bm,{steps:P0,isOpen:this.state.isTourOpen,onRequestClose:()=>{this.setState({isTourOpen:!1}),window.localStorage.setItem("tour","true"),this.props.socket.setState("javascript.0.variables.rulesTour",{val:!0,ack:!0})},goToStep:this.state.tourStep},"tour"):null}getDebug(){return this.props.debugMode?this.state.selected&&this.scripts[this.state.selected]&&this.scripts[this.state.selected].engine&&this.state.runningInstances[this.scripts[this.state.selected].engine]?g.jsx(pn,{fallback:g.jsx(vn,{}),children:g.jsx(F0,{runningInstances:this.state.runningInstances,adapterName:this.props.adapterName,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,src:this.props.debugInstance?this.props.debugInstance.adapter:this.state.selected,debugInstance:this.props.debugInstance},"debugger")}):(setTimeout(()=>this.props.onDebugModeChange(!1)),null):null}getScriptFromObject(s){var r,l;if(!((r=this.props.objects[s])!=null&&r.common))return;const i=JSON.parse(JSON.stringify(this.props.objects[s].common));return(l=this.props.objects[s].native)!=null&&l.protected&&this.props.password&&(i.source=Ug(this.props.password,i.source)),i}render(){var s,i;return this.state.selected&&this.props.objects[this.state.selected]&&this.state.blockly===null&&this.state.rules===null&&(this.scripts[this.state.selected]||=this.getScriptFromObject(this.state.selected),setTimeout(()=>{const r={blockly:this.scripts[this.state.selected].engineType==="Blockly",rules:this.scripts[this.state.selected].engineType==="Rules",showCompiledCode:!1,debugEnabled:this.scripts[this.state.selected].debug,verboseEnabled:this.scripts[this.state.selected].verbose};this.removeNonExistingScripts(null,r),this.setState(r)},100)),this.state.selected&&!this.props.password&&((i=(s=this.props.objects[this.state.selected])==null?void 0:s.native)!=null&&i.protected)&&setTimeout(()=>{const r=this.state.editing.find(l=>{var u,d;return!((d=(u=this.props.objects[l])==null?void 0:u.native)!=null&&d.protected)})||"";Object.keys(this.scripts).forEach(l=>{var u,d;(d=(u=this.props.objects[l])==null?void 0:u.native)!=null&&d.protected&&delete this.scripts[l]}),this.setState({selected:r},()=>{var l,u;(u=(l=this.props).onSelectedChange)==null||u.call(l,r,this.state.editing),this.state.selected?window.localStorage.setItem("Editor.selected",this.state.selected):window.localStorage.removeItem("Editor.selected")})},50),!this.state.selected&&this.props.password&&this.state.editing.length&&setTimeout(()=>{const r=this.state.editing[0];this.setState({selected:r},()=>{var l,u;(u=(l=this.props).onSelectedChange)==null||u.call(l,r,this.state.editing),window.localStorage.setItem("Editor.selected",this.state.selected)})},50),[this.getTabs(),this.getToolbar(),this.getScriptEditor(),this.getAskAboutDebug(),this.getBlocklyEditor(),this.getRulesEditor(),this.getDebug(),this.getConfirmDialog(),this.getSelectIdDialog(),this.getCronDialog(),this.getEditorDialog(),this.getAstroDialog(),this.getDebugMenu(),this.renderOpenAiDialog(),this.getToast(),this.getTour()]}}const Ht={dialog:{height:"95%"},dropzone:{marginTop:20,width:"100%",borderWidth:5,borderStyle:"dashed",borderColor:"#d0cccc",textAlign:"center",boxSizing:"border-box",paddingTop:45,borderRadius:10,height:"calc(100% - 10px)"},dropzoneDiv:{width:"100%",height:"100%"},dropzoneRejected:{borderColor:"#970000"},dropzoneAccepted:{borderColor:"#17cd02"},icon:{height:"30%",width:"30%",color:"#eeeeee",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%,-50%)",zIndex:0},iconError:{color:"#ffc3c6"},iconOk:{color:"#aaeebc"},text:{top:"50%",left:"50%",transform:"translate(-50%,-50%)",color:"#868686",position:"absolute",zIndex:1}};class jm extends Y.Component{constructor(s){super(s),this.state={error:"",imageStatus:""}}componentDidMount(){setTimeout(()=>{var s;try{(s=window.document.getElementById("import-text-area"))==null||s.focus()}catch{}},100)}handleCancel(){this.props.onClose()}static readFileDataUrl(s,i){const r=new FileReader;r.onload=()=>{i(null,{data:r.result,name:s.name})},r.onabort=()=>{console.error("file reading was aborted"),i(b.I18n.t("file reading was aborted"))},r.onerror=l=>{console.error("file reading has failed"),i(b.I18n.t("file reading has failed: %s",l))},r.readAsDataURL(s)}handleDropFile(s){if(!(s!=null&&s.length))return;const i=s[s.length-1];i&&jm.readFileDataUrl(i,(r,l)=>{var u;r||!l?this.setState({error:r||"No data"}):this.props.onClose(((u=l.data)==null?void 0:u.toString())||"")})}render(){const s={...Ht.dropzone,...this.state.imageStatus==="accepted"?Ht.dropzoneAccepted:this.state.imageStatus==="rejected"?Ht.dropzoneRejected:void 0};return g.jsxs(Vt,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":Ht.dialog},fullWidth:!0,open:!0,"aria-labelledby":"import-dialog-title",PaperProps:{style:{minHeight:"90%",maxHeight:"90%"}},children:[g.jsx(as,{id:"import-dialog-title",children:b.I18n.t("Import scripts")}),g.jsxs(Gt,{children:[g.jsx(Mw,{maxSize:5e7,onDrop:(i,r)=>{var l,u,d;i.length?this.handleDropFile(i):window.alert(((d=(u=(l=r==null?void 0:r[0])==null?void 0:l.errors)==null?void 0:u[0])==null?void 0:d.message)||b.I18n.t("ra_Cannot upload"))},multiple:!1,accept:{"application/zip":[],"application/x-zip-compressed":[]},children:({getRootProps:i,getInputProps:r,isDragActive:l,isDragReject:u})=>u?(this.state.imageStatus!=="rejected"&&this.setState({imageStatus:"rejected"}),g.jsxs("div",{style:{...s,...Ht.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ht.text,children:b.I18n.t("Some files will be rejected")},"text"),g.jsx(Wc,{style:{...Ht.icon,...Ht.iconError}},"icon")]})):l?(this.state.imageStatus!=="accepted"&&this.setState({imageStatus:"accepted"}),g.jsxs("div",{style:{...s,...Ht.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ht.text,children:b.I18n.t("All files will be accepted")},"text"),g.jsx(Nw,{style:{...Ht.icon,...Ht.iconOk}},"icon")]})):(this.state.imageStatus!=="wait"&&this.setState({imageStatus:"wait"}),g.jsxs("div",{style:{...s,...Ht.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ht.text,children:b.I18n.t("Drop some files here or click...")},"text"),g.jsx(Lw,{style:Ht.icon},"icon")]}))},"image-drop"),this.state.error?g.jsx(Zc,{text:this.state.error,onClose:()=>this.setState({error:""})}):null]}),g.jsx(Kt,{children:g.jsx(De,{color:"grey",variant:"contained",onClick:()=>this.handleCancel(),startIcon:g.jsx(qs,{}),children:b.I18n.t("Close")})})]})}}var Fm={exports:{}},Y0=Fm.exports;(function(a,s){(function(i,r){a.exports=r()})(Y0,function(){var i={},r,l,u,d,p,m,f,v,_,y,k,C,w,E,R,D,A,J,ie,se,me,z,Oe,Ne,Ze,ae,ce,K,ye,he,je,G,tt,q,ee,B,H,U,re,I,de,W,Ce,be,Se,pe,Ge,Je,_e,ke,$e,Pe,bt,X,ct,ze,kt,ve,st,Zs,St,Et,cu,N,ge,la,ot,Hm,Ke,Uo,ca,Ho,Wo,uu,Nn,ua,da,Ln,Wm,du,Ms,yo,hu,pu,ha,gu,Pn,pa,mu,fu,Vm,Gm,Km,Ii,Ym,ga,Jm,Bn,ma,qm,fa,Xm,$a,$u,bu,ba,va,ya,jn,Zm,xi,Fn,_a,Qm,ef,tf,_o,It,zn,vu,ws,Qs,sf,yu,wa,_u,of,wu,Un,nf,Ca,rf,af,Ta,lf,Di,cf,Cu,ka,Tu,ku,uf,Sa,Ai,Ea,df,Su,Eu,hf,pf,Vo,gf,Hn,Qt,mf,ff,$f,bf,vf,yf,_f,Iu,eo,Ri,xu,wf,Cf,Tf,kf,Sf,Ef,If,xf,Df,Du,Af,Oi,Ia,Rf,Mi,Au,Ru,Ou,Wn,xa,Mu,Of,Nu,Lu,Pu,Bu,ju,Fu,zu,Mf,Vn,Uu,Da,Aa,Ns,Hu,Wu,Gn,Vu,Gu,Nf,Ra,Ku,Lf,Pf,Bf,jf,Ff,Ni,Yu,Ju,Li,Oa,zf,Uf,qu,Xu,to,Zu,Qu,Hf,Wf,Vf,Gf,ed,Kf,td,Yf,Go,Kn,Ma,Na,Ko,sd,La,od,pt,Jf,Pi,Yo,qf,id,Pa,Bi,nd,Jo,Yn,rd,ad,Xf,Zf,Qf,ld,e$,cd,Jn,t$,s$,o$,i$,qn,ud,dd,Ba,ja,n$,Xn,hd,Zn,r$,a$,wo,pd,Ls,l$,c$,gd,u$,qo,md,d$,h$,p$,g$,m$,fd,f$,$$,Fa,b$,v$,$d,za,bd,Ua,vd,yd,ji,Xo,so,Ps,y$,_$,w$,_d,Ha,C$,T$,k$,wd,Wa,Cd,Va,S$,E$,I$,x$,ue,Yt,wt,at,Bs,Fi,ne,gt,Td,D$,Co,Ga,Ka,kd,A$,Sd,Ya,Ed,Id,R$,xd,O$,Ja,M$,N$,L$,P$,B$,Dd,j$,Qn,er,F$,Ad,Rd,Od,Md,qa,Nd,z$,U$,H$,zi,Ld,W$,Xa,ls,V$,To,Pd,G$,tr,Bd,jd,Fd,zd,Ud,Hd,Wd,Vd,Gd,Kd,K$,Y$,J$,q$,X$,Z$,Za,Q$,eb,Yd,Jd,qd,Xd,Zd,Qd,eh,Qa,sr,th,tb,sh,oh,ih,nh,rh,ah,lh,ch,uh,dh,sb,ob,ib,hh,nb,rb,ab,lb,cb,j;r=function(e,t,o,n){if(!(e instanceof F)&&typeof e!="string"||`${e}`.trim()==="")throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e=`${e}`.toLowerCase(),typeof t!="string"||t.trim()==="")throw Error('Invalid name "'+t+'". The name must be a non-empty string.');const c=t.toLowerCase();if(!o)throw Error("Can not register a null value");let h=ko[e],$=el[e];if(h||(h=ko[e]=Object.create(null),$=el[e]=Object.create(null)),l(e,o),!n&&h[c]&&h[c]!==o)throw Error('Name "'+c+'" with type "'+e+'" already registered.');h[c]=o,$[c]=t},l=function(e,t){switch(e){case String(F.FIELD):if(typeof t.fromJson!="function")throw Error('Type "'+e+'" must have a fromJson function')}},u=function(e,t){e=`${e}`.toLowerCase(),t=t.toLowerCase();const o=ko[e];o&&o[t]?(delete ko[e][t],delete el[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},d=function(e,t,o){e=`${e}`.toLowerCase(),t=t.toLowerCase();const n=ko[e];if(!n||!n[t]){if(t="Unable to find ["+t+"]["+e+"] in the registry.",o)throw Error(t+" You must require or register a "+e+" plugin.");return console.warn(t),null}return n[t]},p=function(e,t){return e=`${e}`.toLowerCase(),t=t.toLowerCase(),(e=ko[e])?!!e[t]:!1},m=function(e,t,o){return d(e,t,o)},f=function(e,t,o){return d(e,t,o)},v=function(e,t,o){e=`${e}`.toLowerCase();var n=ko[e];if(!n){if(n=`Unable to find [${e}] in the registry.`,o)throw Error(`${n} You must require or register a ${e} plugin.`);return console.warn(n),null}if(!t)return n;e=el[e],o=Object.create(null);for(const c of Object.keys(n))o[e[c]]=n[c];return o},_=function(e,t,o){return t=t.plugins[String(e)]||js,typeof t=="function"?t:m(e,t,o)},y=function(e,t,o,n){e=e+" was deprecated in "+t+" and will be deleted in "+o+".",n&&(e+=`
272
+ Use `+n+" instead."),db.has(e)||(db.add(e),console.warn(e))},k=function(){return"blockly-"+(OT++).toString(36)},C=function(){return gb.genUid()},w=function(e){return e.type===O.BLOCK_CREATE},E=function(e){return e.type===O.BLOCK_DELETE},R=function(e){return e.type===O.BLOCK_CHANGE},D=function(e){return e.type===O.BLOCK_FIELD_INTERMEDIATE_CHANGE},A=function(e){return e.type===O.BLOCK_MOVE},J=function(e){return e.type===O.CLICK},ie=function(e){return e.type===O.BUBBLE_OPEN},se=function(e){return e.type===O.VIEWPORT_CHANGE},i.setRecordUndo$$module$build$src$core$events$utils=function(e){or=e},me=function(){return or},z=function(e){fb.fireInternal(e)},Oe=function(e){if(K()){if(!io.length)try{requestAnimationFrame(()=>{setTimeout(Ne,0)})}catch{setTimeout(Ne,0)}Ze(e)}},Ne=function(){const e=ae(io,!0);io.length=0;for(const t of e){if(!t.workspaceId)continue;let o;(o=q(t.workspaceId))==null||o.fireChangeListener(t)}},Ze=function(e){if(R(e)&&e.element==="mutation"){let t;for(t=io.length;0<t;t--){const o=io[t-1];if(o.group!==e.group||o.workspaceId!==e.workspaceId||!A(o)||o.newParentId!==e.blockId)break}io.splice(t,0,e)}else io.push(e)},ae=function(e,t=!0){t||(y("filter(queue, /*forward=*/false)","v11.2","v12"),e=e.slice().reverse());const o=[];for(const n of e)if(e=o[o.length-1],!n.isNull())if(e&&e.workspaceId===n.workspaceId&&e.group===n.group)if(A(n)&&A(e)&&n.blockId===e.blockId){if(e.newParentId=n.newParentId,e.newInputName=n.newInputName,e.newCoordinate=n.newCoordinate,e.reason||n.reason){let c,h;e.reason=Array.from(new Set(((c=e.reason)!=null?c:[]).concat((h=n.reason)!=null?h:[])))}}else R(n)&&R(e)&&n.blockId===e.blockId&&n.element===e.element&&n.name===e.name?e.newValue=n.newValue:se(n)&&se(e)?(e.viewTop=n.viewTop,e.viewLeft=n.viewLeft,e.scale=n.scale,e.oldScale=n.oldScale):J(n)&&ie(e)||o.push(n);else o.push(n);return e=o.filter(n=>!n.isNull()),t||e.reverse(),e},ce=function(){for(let e=0,t;t=io[e];e++)t.recordUndo=!1},i.disable$$module$build$src$core$events$utils=function(){gh++},i.enable$$module$build$src$core$events$utils=function(){gh--},K=function(){return gh===0},i.getGroup$$module$build$src$core$events$utils=function(){return mb},i.setGroup$$module$build$src$core$events$utils=function(e){fb.setGroupInternal(e)},ye=function(e){mb=typeof e=="boolean"?e?C():"":e},he=function(e){const t=[];e=e.getDescendants(!1);for(let o=0,n;n=e[o];o++)t[o]=n.id;return t},je=function(e,t){const o=G(e.type);if(!o)throw Error("Unknown event type.");return o.fromJson(e,t)},G=function(e){const t=m(F.EVENT,e);if(!t)throw Error(`Event type ${e} not found in registry.`);return t},tt=function(e){if((A(e)||w(e))&&e.workspaceId){var t=q(e.workspaceId);if(!e.blockId)throw Error("Encountered a blockEvent without a proper blockId");if(e=t.getBlockById(e.blockId)){const o=or;try{or=!1;const n=e.getParent();if(n&&!n.hasDisabledReason(mh)){const c=e.getDescendants(!1);for(let h=0,$;$=c[h];h++)$.setDisabledReason(!1,mh)}else if((e.outputConnection||e.previousConnection)&&!t.isDragging())do e.setDisabledReason(!0,mh),e=e.getNextBlock();while(e)}finally{or=o}}}},q=function(e){return ir[e]||null},ee=function(){const e=[];for(const t in ir)e.push(ir[t]);return e},B=function(e){ir[e.id]=e},H=function(e){delete ir[e.id]},U=function(){return $b},re=function(e){$b=e},I=function(){return Zo},i.setSelected$$module$build$src$core$common=function(e){if(Zo!==e){var t,o,n,c,h,$,T=new(G(O.SELECTED))((n=(t=Zo)==null?void 0:t.id)!=null?n:null,(c=e==null?void 0:e.id)!=null?c:null,($=(h=e==null?void 0:e.workspace.id)!=null?h:(o=Zo)==null?void 0:o.workspace.id)!=null?$:"");z(T);var L;(L=Zo)==null||L.unselect(),Zo=e;var te;(te=Zo)==null||te.select()}},de=function(){return bb},W=function(e){bb=e},Ce=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;const t=e.getParentSvg(),o=e.getCachedParentSvgSize();var n=t.parentElement;if(n instanceof HTMLElement){var c=n.offsetWidth;n=n.offsetHeight,o.width!==c&&(t.setAttribute("width",c+"px"),e.setCachedParentSvgSize(c,null)),o.height!==n&&(t.setAttribute("height",n+"px"),e.setCachedParentSvgSize(null,n)),e.resize()}},be=function(e,t){const o=Object.create(null),n=e.getDescendants(!0);t&&(e=e.getNextBlock())&&(e=n.indexOf(e),n.splice(e,n.length-e));for(let c=0,h;h=n[c];c++)o[h.type]?o[h.type]++:o[h.type]=1;return o},Se=function(e){return function(){this.jsonInit(e)}},pe=function(e){vb.defineBlocksWithJsonArrayInternal(e)},Ge=function(e){i.defineBlocks$$module$build$src$core$common(i.createBlockDefinitionsFromJsonArray$$module$build$src$core$common(e))},i.createBlockDefinitionsFromJsonArray$$module$build$src$core$common=function(e){const t={};for(let o=0;o<e.length;o++){const n=e[o];if(!n){console.warn(`Block definition #${o} in JSON array is ${n}. Skipping`);continue}const c=n.type;c?t[c]={init:Se(n)}:console.warn(`Block definition #${o} in JSON array is missing a type attribute. Skipping.`)}return t},i.defineBlocks$$module$build$src$core$common=function(e){for(const t of Object.keys(e)){const o=e[t];t in Jt&&console.warn(`Block definition "${t}" overwrites previous definition.`),Jt[t]=o}},Je=function(e,t){_e(),sl=setTimeout(function(){t&&t.handleRightClick(e)},MT)},_e=function(){sl&&(clearTimeout(sl),sl=0)},ke=function(){tl=null},$e=function(e){return!e.type.startsWith("pointer")||e instanceof PointerEvent&&bt(e)},Pe=function(e){return`${e.pointerId}`},bt=function(e){const t=Pe(e);return tl?tl===t:e.type==="pointerdown"?(tl=t,!0):!1},X=function(e,t,o,n,c){function h(T){(c||$e(T))&&(o?n.call(o,T):n(T))}const $=[];if(t in Qo)for(let T=0;T<Qo[t].length;T++){const L=Qo[t][T];e.addEventListener(L,h,!1),$.push([e,L,h])}else e.addEventListener(t,h,!1),$.push([e,t,h]);return $},ct=function(e,t,o,n){function c($){o?n.call(o,$):n($)}const h=[];if(t in Qo)for(let $=0;$<Qo[t].length;$++){const T=Qo[t][$];e.addEventListener(T,c,!1),h.push([e,T,c])}else e.addEventListener(t,c,!1),h.push([e,t,c]);return h},ze=function(e){const t=e[e.length-1][2];for(;e.length;){const[o,n,c]=e.pop();o.removeEventListener(n,c,!1)}return t},kt=function(e){if(e.target instanceof HTMLElement){if(e.target.isContentEditable||e.target.getAttribute("data-is-text-input")==="true")return!0;if(e.target instanceof HTMLInputElement)return e=e.target,e.type==="text"||e.type==="number"||e.type==="email"||e.type==="password"||e.type==="search"||e.type==="tel"||e.type==="url";if(e.target instanceof HTMLTextAreaElement)return!0}return!1},ve=function(e){return e.ctrlKey&&_h?!0:e.button===2},st=function(e,t,o){const n=t.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,o||(o=t.getScreenCTM().inverse()),n.matrixTransform(o)},Zs=function(e){switch(e.deltaMode){default:return{x:e.deltaX,y:e.deltaY};case 1:return{x:e.deltaX*Ab,y:e.deltaY*Ab};case 2:return{x:e.deltaX*Rb,y:e.deltaY*Rb}}},St=function(e,t){return t=e.indexOf(t),t===-1?!1:(e.splice(t,1),!0)},Et=function(e){if(wh)throw Error("CSS already injected");Ch+=`
273
+ `+e},cu=function(e,t){wh||(wh=!0,e&&(e=t.replace(/[\\/]$/,""),t=Ch.replace(/<<<PATH>>>/g,e),Ch="",e=document.createElement("style"),e.id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},N=function(e,t,o){e=document.createElementNS(rr,`${e}`);for(const n in t)e.setAttribute(n,`${t[n]}`);return o&&o.appendChild(e),e},ge=function(e,t){return t=t.split(" "),t.every(o=>e.classList.contains(o))?!1:(e.classList.add(...t),!0)},la=function(e,t){e.classList.remove(...t.split(" "))},ot=function(e,t){return t=t.split(" "),t.every(o=>!e.classList.contains(o))?!1:(e.classList.remove(...t),!0)},Hm=function(e,t){return e.classList.contains(t)},Ke=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},Uo=function(e,t){const o=t.nextSibling;if(t=t.parentNode,!t)throw Error("Reference node has no parent.");o?t.insertBefore(e,o):t.appendChild(e)},ca=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},Ho=function(){kh++,Ts||(Ts=Object.create(null))},Wo=function(){kh--,kh||(Ts=null)},uu=function(e){const t=e.textContent+`
274
+ `+e.className.baseVal;let o;if(Ts&&(o=Ts[t]))return o;try{o=e.getComputedTextLength()}catch{return 8*e.textContent.length}return Ts&&(Ts[t]=o),o},Nn=function(e,t,o,n){return ua(e,t+"pt",o,n)},ua=function(e,t,o,n){const c=e.textContent;e=c+`
275
+ `+e.className.baseVal;var h;return Ts&&(h=Ts[e])||(rl||(h=document.createElement("canvas"),h.className="blocklyComputeCanvas",document.body.appendChild(h),rl=h.getContext("2d")),rl.font=o+" "+t+" "+n,h=c?rl.measureText(c).width:0,Ts&&(Ts[e]=h)),h},da=function(e,t,o,n){const c=document.createElement("span");c.style.font=o+" "+t+" "+n,c.textContent=e,e=document.createElement("div"),e.style.width="1px",e.style.height="0",t=document.createElement("div"),t.style.display="flex",t.style.position="fixed",t.style.top="0",t.style.left="0",t.appendChild(c),t.appendChild(e),document.body.appendChild(t),o={height:0,baseline:0};try{t.style.alignItems="baseline",o.baseline=e.offsetTop-c.offsetTop,t.style.alignItems="flex-end",o.height=e.offsetTop-c.offsetTop}finally{document.body.removeChild(t)}return o},Ln=function(e){return Mb.getSizeInternal(e)},Wm=function(e){if(Ms(e,"display")!=="none")return du(e);const t=e.style,o=t.display,n=t.visibility,c=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";const h=e.offsetWidth;return e=e.offsetHeight,t.display=o,t.position=c,t.visibility=n,new Le(h,e)},du=function(e){return new Le(e.offsetWidth,e.offsetHeight)},Ms=function(e,t){return e=window.getComputedStyle(e),e[t]||e.getPropertyValue(t)},yo=function(e){const t=new V(0,0);e=e.getBoundingClientRect();var o=document.documentElement;return o=new V(window.pageXOffset||o.scrollLeft,window.pageYOffset||o.scrollTop),t.x=e.left+o.x,t.y=e.top+o.y,t},hu=function(){const e=document.body,t=document.documentElement;return new V(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},pu=function(e){const t=parseFloat(Ms(e,"borderLeftWidth")),o=parseFloat(Ms(e,"borderRightWidth")),n=parseFloat(Ms(e,"borderTopWidth"));return e=parseFloat(Ms(e,"borderBottomWidth")),new qe(n,e,t,o)},ha=function(e,t,o){e=gu(e,t,o),t.scrollLeft=e.x,t.scrollTop=e.y},gu=function(e,t,o){var n=yo(e),c=yo(t),h=pu(t);const $=n.x-c.x-h.left;return n=n.y-c.y-h.top,c=du(e),e=t.clientWidth-c.width,c=t.clientHeight-c.height,h=t.scrollLeft,t=t.scrollTop,o?(h+=$-e/2,t+=n-c/2):(h+=Math.min($,Math.max($-e,0)),t+=Math.min(n,Math.max(n-c,0))),new V(h,t)},Pn=function(e){const t=new V(0,0);var o=e.x&&e.getAttribute("x");const n=e.y&&e.getAttribute("y");return o&&(t.x=parseInt(o)),n&&(t.y=parseInt(n)),(o=(o=e.getAttribute("transform"))&&o.match(Nb))&&(t.x+=Number(o[1]),o[3]&&(t.y+=Number(o[3]))),(e=e.getAttribute("style"))&&e.includes("translate")&&(e=e.match(Lb))&&(t.x+=Number(e[1]),e[3]&&(t.y+=Number(e[3]))),t},pa=function(e){let t=0,o=0;for(;e;){const n=Pn(e);if(t+=n.x,o+=n.y,(" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv "))break;e=e.parentNode}return new V(t,o)},mu=function(){const e=hu();return new qe(e.y,document.documentElement.clientHeight+e.y,e.x,document.documentElement.clientWidth+e.x)},fu=function(){const e=document.documentElement,t=window;return new V(t.pageXOffset||e.scrollLeft,t.pageYOffset||e.scrollTop)},Vm=function(e,t){var o=t.x;t=t.y;const n=e.getInjectionDiv().getBoundingClientRect();return o=new V(o-n.left,t-n.top),t=e.getOriginOffsetInPixels(),V.difference(o,t).scale(1/e.scale)},Gm=function(e,t){var o=t.scale(e.scale);t=o.x,o=o.y;const n=e.getInjectionDiv().getBoundingClientRect();return e=e.getOriginOffsetInPixels(),new V(t+n.left+e.x,o+n.top+e.y)},Km=function(e){({document:ll=ll,DOMParser:ar=ar,XMLSerializer:lr=lr}=e),al=new ar,Sh=new lr},i.createElement$$module$build$src$core$utils$xml=function(e){return ll.createElementNS(Pb,e)},i.createTextNode$$module$build$src$core$utils$xml=function(e){return ll.createTextNode(e)},i.textToDom$$module$build$src$core$utils$xml=function(e){let t=al.parseFromString(e,"text/xml");if(t&&t.documentElement&&!t.getElementsByTagName("parsererror").length)return t.documentElement;if((t=al.parseFromString(e,"text/html"))&&t.body.firstChild&&t.body.firstChild.nodeName.toLowerCase()==="xml")return t.body.firstChild;throw Error(`DOMParser was unable to parse: ${e}`)},Ii=function(e){return Ym(Sh.serializeToString(e))},Ym=function(e){return e.replace(BT,t=>`&#${t.charCodeAt(0)};`)},ga=function(e){return e?((e instanceof Element||typeof e=="string")&&(e=bu(e),e=Xm(e)),Jm(e),e):null},Jm=function(e){const t=e.kind;if(e=e.contents,t&&t!==Bb&&t!==Eh)throw Error("Invalid toolbox kind "+t+". Please supply either "+Bb+" or "+Eh);if(!e)throw Error("Toolbox must have a contents attribute.")},Bn=function(e){return e?e.contents?e.contents:Array.isArray(e)&&0<e.length&&!e[0].nodeType?e:$a(e):[]},ma=function(e){return jb.hasCategoriesInternal(e)},qm=function(e){if(!e)return!1;const t=e.kind;return t?t===Eh:!!e.contents.filter(o=>o.kind.toUpperCase()==="CATEGORY").length},fa=function(e){return e&&e.contents?!!e.contents.filter(function(t){return t.kind.toUpperCase()==="CATEGORY"}).length:!1},Xm=function(e){const t={contents:$a(e)};return e instanceof Node&&$u(e,t),t},$a=function(e){const t=[];let o=e.childNodes;o||(o=e);for(let n=0,c;c=o[n];n++){if(!c.tagName)continue;e={};const h=c.tagName.toUpperCase();e.kind=h,h==="BLOCK"?e.blockxml=c:c.childNodes&&0<c.childNodes.length&&(e.contents=$a(c)),$u(c,e),t.push(e)}return t},$u=function(e,t){for(let o=0;o<e.attributes.length;o++){const n=e.attributes[o];n.nodeName.includes("css-")?(t.cssconfig=t.cssconfig||{},t.cssconfig[n.nodeName.replace("css-","")]=n.value):t[n.nodeName]=n.value}},bu=function(e){let t=null;if(e)if(typeof e=="string"){if(t=i.textToDom$$module$build$src$core$utils$xml(e),t.nodeName.toLowerCase()!=="xml")throw TypeError("Toolbox should be an <xml> document.")}else e instanceof Element&&(t=e);return t},ba=function(e,t,o,n,c,h){const $=h.scrollbar&&h.scrollbar.canScrollVertically();return e.horizontal===Wi.LEFT?(o=c.absoluteMetrics.left+o,$&&h.RTL&&(o+=mt.scrollbarThickness)):(o=c.absoluteMetrics.left+c.viewMetrics.width-t.width-o,$&&!h.RTL&&(o-=mt.scrollbarThickness)),e.vertical===lo.TOP?e=c.absoluteMetrics.top+n:(e=c.absoluteMetrics.top+c.viewMetrics.height-t.height-n,h.scrollbar&&h.scrollbar.canScrollHorizontally()&&(e-=mt.scrollbarThickness)),new qe(e,e+t.height,o,o+t.width)},va=function(e,t){return{horizontal:t.toolboxMetrics.position===Ee.LEFT||e.horizontalLayout&&!e.RTL?Wi.RIGHT:Wi.LEFT,vertical:t.toolboxMetrics.position===Ee.BOTTOM?lo.TOP:lo.BOTTOM}},ya=function(e,t,o,n){const c=e.left,h=e.right-e.left,$=e.bottom-e.top;for(let T=0;T<n.length;T++){const L=n[T];e.intersects(L)&&(e=o===Io.UP?L.top-$-t:L.bottom+t,e=new qe(e,e+$,c,c+h),T=-1)}return e},jn=function(e,t){r(F.SERIALIZER,e,t)},Zm=function(e){u(F.SERIALIZER,e)},xi=function(e,{addCoordinates:t=!1,saveIds:o=!0}={}){const n=e.workspace,c=Object.create(null);return c.height=e.getSize().height,c.width=e.getSize().width,o&&(c.id=e.id),t&&(t=e.getRelativeToSurfaceXY(),c.x=n.RTL?n.getWidth()-t.x:t.x,c.y=t.y),e.getText()&&(c.text=e.getText()),e.isCollapsed()&&(c.collapsed=!0),e.isOwnEditable()||(c.editable=!1),e.isOwnMovable()||(c.movable=!1),e.isOwnDeletable()||(c.deletable=!1),c},Fn=function(e,t,{recordUndo:o=!1}={}){const n=me();if(i.setRecordUndo$$module$build$src$core$events$utils(o),o=t.newComment(e.id),e.text!==void 0&&o.setText(e.text),e.x!==void 0||e.y!==void 0){const h=o.getRelativeToSurfaceXY();let $,T=($=e.x)!=null?$:h.x;T=t.RTL?t.getWidth()-T:T;var c;t=(c=e.y)!=null?c:h.y,o.moveTo(new V(T,t))}if(e.width!==void 0||e.height){c=o.getSize();let h,$;o.setSize(new Le((h=e.width)!=null?h:c.width,($=e.height)!=null?$:c.height))}return e.collapsed!==void 0&&o.setCollapsed(e.collapsed),e.editable!==void 0&&o.setEditable(e.editable),e.movable!==void 0&&o.setMovable(e.movable),e.deletable!==void 0&&o.setDeletable(e.deletable),i.setRecordUndo$$module$build$src$core$events$utils(n),o},_a=function(e,t){r(F.PASTER,e,t)},Qm=function(e){u(F.PASTER,e)},ef=function(e){const t=e.workspace,o=e.getRelativeToSurfaceXY(),n=new V(0,0),c=t.getTopComments(!1).filter(h=>h.id!==e.id).map(h=>h.getRelativeToSurfaceXY());for(;tf(V.sum(o,n),c);)n.translate(t.RTL?-30:30,30);e.moveTo(V.sum(o,n))},tf=function(e,t){return t.some(o=>1>=Math.abs(o.x-e.x)&&1>=Math.abs(o.y-e.y))},_o=function(e,t){e.setAttribute(zT,t)},It=function(e,t,o){Array.isArray(o)&&(o=o.join(" ")),e.setAttribute(FT+t,`${o}`)},zn=function(e){return e.saveState!==void 0&&e.loadState!==void 0},vu=function(e){return yu(e),sf()?(wa(),Promise.resolve()):(Vi||(Vi=new Promise(t=>{Nh=t,Gb=window.requestAnimationFrame(()=>{wa(),t()})})),Vi)},ws=function(){return Vi||Promise.resolve()},Qs=function(e){e||window.cancelAnimationFrame(Gb),wa(e),!e&&Nh&&Nh()},sf=function(){return Eb},yu=function(e){Oh.add(e),Mh.set(e,i.getGroup$$module$build$src$core$events$utils());const t=e.getParent();t?yu(t):hl.add(e)},wa=function(e){const t=e?new Set([e]):new Set([...hl].map(h=>h.workspace)),o=[...hl].filter(of).filter(h=>t.has(h.workspace));for(var n of o)wu(n);for(const h of t)h.resizeContents();for(var c of o)n=c.getRelativeToSurfaceXY(),c.updateComponentLocations(n);for(const h of o)c=i.getGroup$$module$build$src$core$events$utils(),(n=Mh.get(h))&&i.setGroup$$module$build$src$core$events$utils(n),h.bumpNeighbours(),i.setGroup$$module$build$src$core$events$utils(c);for(const h of o)_u(h);e||(Vi=null)},_u=function(e){hl.delete(e),Oh.delete(e),Mh.delete(e);for(const t of e.getChildren(!1))_u(t)},of=function(e){return!e.isDisposed()&&!e.getParent()},wu=function(e){if(Oh.has(e)&&e.initialized){for(const t of e.getChildren(!1))wu(t);e.renderEfficiently()}},Un=function(e,t){Kb(e,t)},nf=function(e){Kb=e},Ca=function(e,t){qb.confirmInternal(e,t)},rf=function(e,t){Yb(e,t)},af=function(e){Yb=e},Ta=function(e,t,o){Jb(e,t,o)},lf=function(e){Jb=e},Di=function(e){return e.getProcedureDef!==void 0},cf=function(e){return e.getProcedureCall!==void 0&&e.renameProcedure!==void 0},Cu=function(e){return e.getVariableModel!==void 0},i.allUsedVarModels$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);const t=new Set;for(let o=0;o<e.length;o++){const n=e[o].getVarModels();if(n)for(let c=0;c<n.length;c++){const h=n[c];h.getId()&&t.add(h)}}return Array.from(t.values())},i.allDeveloperVariables$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);const t=new Set;for(let n=0,c;c=e[n];n++){var o=c.getDeveloperVariables;if(o){o=o();for(let h=0;h<o.length;h++)t.add(o[h])}}return Array.from(t.values())},ka=function(e){let t=[];const o=document.createElement("button");return o.setAttribute("text","%{BKY_NEW_VARIABLE}"),o.setAttribute("callbackKey","CREATE_VARIABLE"),e.registerButtonCallback("CREATE_VARIABLE",function(n){Ai(n.getTargetWorkspace())}),t.push(o),e=Tu(e),t=t.concat(e)},Tu=function(e){e=e.getVariablesOfType("");const t=[];if(0<e.length){var o=e[e.length-1];if(Jt.variables_set){var n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","variables_set"),n.setAttribute("gap",Jt.math_change?"8":"24"),n.appendChild(Vo(o)),t.push(n)}if(Jt.math_change&&(n=i.createElement$$module$build$src$core$utils$xml("block"),n.setAttribute("type","math_change"),n.setAttribute("gap",Jt.variables_get?"20":"8"),n.appendChild(Vo(o)),o=i.textToDom$$module$build$src$core$utils$xml('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),n.appendChild(o),t.push(n)),Jt.variables_get){e.sort(hr.compareByName);for(let c=0,h;h=e[c];c++)o=i.createElement$$module$build$src$core$utils$xml("block"),o.setAttribute("type","variables_get"),o.setAttribute("gap","8"),o.appendChild(Vo(h)),t.push(o)}}return t},ku=function(e){return Zb.generateUniqueNameInternal(e)},uf=function(e){return Sa(jh.charAt(0),e.getAllVariableNames())},Sa=function(e,t){if(!t.length)return e;const o=jh;let n="",c=o.indexOf(e);for(;;){let h=!1;for(let $=0;$<t.length;$++)if(t[$].toLowerCase()===e){h=!0;break}if(!h)break;c++,c===o.length&&(c=0,n=`${Number(n)+1}`),e=o.charAt(c)+n}return e},Ai=function(e,t,o){function n(h){Ea(i.Msg$$module$build$src$core$msg.NEW_VARIABLE_TITLE,h,function($){if($){var T=Su($,e);if(T){if(T.type===c)var L=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS.replace("%1",T.name);else L=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,L=L.replace("%1",T.name).replace("%2",T.type);Un(L,function(){n($)})}else e.createVariable($,c),t&&t($)}else t&&t(null)})}const c=o||"";n("")},i.renameVariable$$module$build$src$core$variables=function(e,t,o){function n(c){const h=i.Msg$$module$build$src$core$msg.RENAME_VARIABLE_TITLE.replace("%1",t.name);Ea(h,c,function($){if($){var T=df($,t.type,e),L=Eu(t.name,$,e);if(T||L){var te="";T?te=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",T.name).replace("%2",T.type):L&&(te=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER.replace("%1",$).replace("%2",L)),Un(te,function(){n($)})}else e.renameVariableById(t.getId(),$),o&&o($)}else o&&o(null)})}n("")},Ea=function(e,t,o){Ta(e,t,function(n){n&&(n=n.replace(/[\s\xa0]+/g," ").trim(),n===i.Msg$$module$build$src$core$msg.RENAME_VARIABLE||n===i.Msg$$module$build$src$core$msg.NEW_VARIABLE)&&(n=null),o(n)})},df=function(e,t,o){o=o.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let n=0,c;c=o[n];n++)if(c.name.toLowerCase()===e&&c.type!==t)return c;return null},Su=function(e,t){t=t.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let o=0,n;n=t[o];o++)if(n.name.toLowerCase()===e)return n;return null},Eu=function(e,t,o){return o.getProcedureMap().getProcedures().length?hf(e,t,o):pf(e,t,o)},hf=function(e,t,o){e=e.toLowerCase(),t=t.toLowerCase(),o=o.getProcedureMap().getProcedures();for(const c of o){var n=c.getParameters().filter(Cu).map(h=>h.getVariableModel().name);if(n&&(o=n.some(h=>h.toLowerCase()===e),n=n.some(h=>h.toLowerCase()===t),o&&n))return c.getName()}return null},pf=function(e,t,o){e=e.toLowerCase(),t=t.toLowerCase(),o=o.getAllBlocks(!1);for(const c of o){if(!Di(c))continue;o=c.getProcedureDef();var n=o[1];const h=n.some($=>$.toLowerCase()===e);if(n=n.some($=>$.toLowerCase()===t),h&&n)return o[0]}return null},Vo=function(e){const t=i.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name","VAR"),t.setAttribute("id",e.getId()),t.setAttribute("variabletype",e.type),e=i.createTextNode$$module$build$src$core$utils$xml(e.name),t.appendChild(e),t},i.getOrCreateVariablePackage$$module$build$src$core$variables=function(e,t,o,n){let c=i.getVariable$$module$build$src$core$variables(e,t,o,n);return c||(c=gf(e,t,o,n)),c},i.getVariable$$module$build$src$core$variables=function(e,t,o,n){const c=e.getPotentialVariableMap();let h=null;if(t&&(h=e.getVariableById(t),!h&&c&&(h=c.getVariableById(t)),h))return h;if(o){if(n===void 0)throw Error("Tried to look up a variable by name without a type");h=e.getVariable(o,n),!h&&c&&(h=c.getVariable(o,n))}return h},gf=function(e,t,o,n){const c=e.getPotentialVariableMap();return o||(o=ku(e.isFlyout?e.targetWorkspace:e)),c?c.createVariable(o,n,t):e.createVariable(o,n,t)},Hn=function(e,t){e=e.getAllVariables();const o=[];if(t.length!==e.length)for(let n=0;n<e.length;n++){const c=e[n];t.includes(c)||o.push(c)}return o},Qt=function(e,{addCoordinates:t=!1,addInputBlocks:o=!0,addNextBlocks:n=!0,doFullSerialization:c=!0,saveIds:h=!0}={}){if(e.isInsertionMarker())return null;const $={type:e.type,id:h?e.id:void 0};return t&&ff(e,$),mf(e,$),$f(e,$,c),bf(e,$,c),vf(e,$,c),o&&yf(e,$,c,h),n&&_f(e,$,c,h),$},mf=function(e,t){e.isCollapsed()&&(t.collapsed=!0),e.isEnabled()||(t.disabledReasons=Array.from(e.getDisabledReasons())),e.isOwnDeletable()||(t.deletable=!1),e.isOwnMovable()||(t.movable=!1),e.isOwnEditable()||(t.editable=!1),e.inputsInline!==void 0&&e.inputsInline!==e.inputsInlineDefault&&(t.inline=e.inputsInline),e.data&&(t.data=e.data)},ff=function(e,t){const o=e.workspace;e=e.getRelativeToSurfaceXY(),t.x=Math.round(o.RTL?o.getWidth()-e.x:e.x),t.y=Math.round(e.y)},$f=function(e,t,o){e.saveExtraState?(e=e.saveExtraState(o),e!==null&&(t.extraState=e)):e.mutationToDom&&(e=e.mutationToDom(),e!==null&&(t.extraState=Ls(e).replace(' xmlns="https://developers.google.com/blockly/xml"',"")))},bf=function(e,t,o){const n=Object.create(null);for(const c of e.getIcons())zn(c)&&(e=c.saveState(o))&&(n[c.getType().toString()]=e);Object.keys(n).length&&(t.icons=n)},vf=function(e,t,o){const n=Object.create(null);for(let c=0;c<e.inputList.length;c++){const h=e.inputList[c];for(let $=0;$<h.fieldRow.length;$++){const T=h.fieldRow[$];T.isSerializable()&&(n[T.name]=T.saveState(o))}}Object.keys(n).length&&(t.fields=n)},yf=function(e,t,o,n){const c=Object.create(null);for(let h=0;h<e.inputList.length;h++){const $=e.inputList[h];if(!$.connection)continue;const T=Iu($.connection,o,n);T&&(c[$.name]=T)}Object.keys(c).length&&(t.inputs=c)},_f=function(e,t,o,n){e.nextConnection&&(e=Iu(e.nextConnection,o,n))&&(t.next=e)},Iu=function(e,t,o){const n=e.getShadowState(!0);if(e=e.targetBlock(),!n&&!e)return null;const c=Object.create(null);return n&&(c.shadow=n),e&&!e.isShadow()&&(c.block=Qt(e,{doFullSerialization:t,saveIds:o})),c},eo=function(e,t,{recordUndo:o=!1}={}){return e=Ri(e,t,{recordUndo:o}),t.rendered&&Qs(),e},Ri=function(e,t,{parentConnection:o,isShadow:n=!1,recordUndo:c=!1}={}){const h=me();i.setRecordUndo$$module$build$src$core$events$utils(c),(c=i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),i.disable$$module$build$src$core$events$utils();const $=t.getAllVariables();let T;try{T=xu(e,t,{parentConnection:o,isShadow:n})}finally{i.enable$$module$build$src$core$events$utils()}if(wf(t,$),K()&&z(new(G(O.BLOCK_CREATE))(T)),i.setGroup$$module$build$src$core$events$utils(c),i.setRecordUndo$$module$build$src$core$events$utils(h),t.rendered){const L=T;setTimeout(()=>{L.disposed||L.setConnectionTracking(!0)},1)}return T},xu=function(e,t,{parentConnection:o,isShadow:n=!1}={}){if(!e.type)throw new Qb(e);const c=t.newBlock(e.type,e.id);return c.setShadow(n),Cf(c,e),Tf(c,e),kf(c,e),Sf(o,c,e),Ef(c,e),If(c,e),xf(c,e),Df(c,e),Af(c,t.rendered),c},wf=function(e,t){if(K())for(e=Hn(e,t),t=0;t<e.length;t++){const o=e[t];z(new(G(O.VAR_CREATE))(o))}},Cf=function(e,t){let o=t.x===void 0?0:t.x;t=t.y===void 0?0:t.y;const n=e.workspace;o=n.RTL?n.getWidth()-o:o,e.moveBy(o,t)},Tf=function(e,t){if(t.collapsed&&e.setCollapsed(!0),t.deletable===!1&&e.setDeletable(!1),t.movable===!1&&e.setMovable(!1),t.editable===!1&&e.setEditable(!1),t.enabled===!1&&e.setDisabledReason(!0,Ft),Array.isArray(t.disabledReasons))for(const o of t.disabledReasons)e.setDisabledReason(!0,o);t.inline!==void 0&&e.setInputsInline(t.inline),t.data!==void 0&&(e.data=t.data)},kf=function(e,t){t.extraState&&(e.loadExtraState?e.loadExtraState(t.extraState):e.domToMutation&&e.domToMutation(i.textToDom$$module$build$src$core$utils$xml(t.extraState)))},Sf=function(e,t,o){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new tv(o);if(e.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var n=t.outputConnection;if(!n)throw new pr("output",t,o)}else if(n=t.previousConnection,!n)throw new pr("previous",t,o);if(!e.connect(n)){const c=t.workspace.connectionChecker;throw new ev(c.getErrorMessage(c.canConnectWithReason(n,e,!1),n,e),e.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,o)}}},Ef=function(e,t){if(t.icons){var o=Object.keys(t.icons);for(const c of o){o=t.icons[c];var n=e.getIcon(c);if(!n){if(n=m(F.ICON,c,!1),!n)throw new sv(c,e,t);n=new n(e),e.addIcon(n)}zn(n)&&n.loadState(o)}}},If=function(e,t){if(t.fields){var o=Object.keys(t.fields);for(let n=0;n<o.length;n++){const c=o[n],h=t.fields[c],$=e.getField(c);$?$.loadState(h):console.warn(`Ignoring non-existant field ${c} in block ${e.type}`)}}},xf=function(e,t){if(t.inputs){var o=Object.keys(t.inputs);for(let n=0;n<o.length;n++){const c=o[n],h=e.getInput(c);if(!h||!h.connection)throw new pr(c,e,t);Du(h.connection,t.inputs[c])}}},Df=function(e,t){if(t.next){if(!e.nextConnection)throw new pr("next",e,t);Du(e.nextConnection,t.next)}},Du=function(e,t){t.shadow&&e.setShadowState(t.shadow),t.block&&xu(t.block,e.getSourceBlock().workspace,{parentConnection:e})},Af=function(e,t){if(t){e.setConnectionTracking(!1),e.initSvg(),e.queueRender();for(const o of e.getIcons())o.onLocationChange(e.getRelativeToSurfaceXY())}else e.initModel()},Oi=function(e){return e.bubbleIsVisible!==void 0&&e.setBubbleVisible!==void 0},Ia=function(e){return e*Math.PI/180},Rf=function(e){return 180*e/Math.PI},Mi=function(e,t,o){if(o<e){const n=o;o=e,e=n}return Math.max(e,Math.min(t,o))},Au=function(){document.querySelector(".blocklyDropDownDiv")||(Ue=document.createElement("div"),Ue.className="blocklyDropDownDiv",(de()||document.body).appendChild(Ue),Ji=document.createElement("div"),Ji.className="blocklyDropDownContent",Ue.appendChild(Ji),li=document.createElement("div"),li.className="blocklyDropDownArrow",Ue.appendChild(li),Ue.style.opacity="0",Ue.style.transition="transform "+fl+"s, opacity "+fl+"s",Ue.addEventListener("focusin",function(){ge(Ue,"blocklyFocused")}),Ue.addEventListener("focusout",function(){ot(Ue,"blocklyFocused")}))},Ru=function(e){Uh=e},Ou=function(){return xo},Wn=function(){return Ji},xa=function(){Ji.textContent="",Ji.style.width=""},Mu=function(e,t){Ue.style.backgroundColor=e,Ue.style.borderColor=t},Of=function(e,t,o,n){return Bu(Lu(t),e,o,n)},Nu=function(e,t,o){return rv=!0,Bu(Pu(e),e,t,o)},Lu=function(e){var t=e.getSvgRoot();const o=e.workspace.scale,n=e.height*o;return e=e.width*o,t=yo(t),new qe(t.y,t.y+n,t.x,t.x+e)},Pu=function(e){return e=e.getScaledBBox(),new qe(e.top,e.bottom,e.left,e.right)},Bu=function(e,t,o,n){const c=e.left+(e.right-e.left)/2,h=e.bottom;e=e.top,n&&(e+=n),n=t.getSourceBlock();let $=n.workspace;for(;$.options.parentWorkspace;)$=$.options.parentWorkspace;return Ru($.getParentSvg().parentNode),ju(t,n.RTL,c,h,c,e,o)},ju=function(e,t,o,n,c,h,$){return xo=e,ai=$||null,Ue.style.direction=t?"rtl":"ltr",e=U(),Ki=e.getRenderer().getClassName(),Yi=e.getTheme().getClassName(),Ki&&ge(Ue,Ki),Yi&&ge(Ue,Yi),Hu(o,n,c,h)},Fu=function(e,t,o,n){return e=Vn(e,o.left,o.right,n.width),{initialX:e.divX,initialY:t,finalX:e.divX,finalY:t+Fh,arrowX:e.arrowX,arrowY:-9,arrowAtTop:!0,arrowVisible:!0}},zu=function(e,t,o,n){return e=Vn(e,o.left,o.right,n.width),{initialX:e.divX,initialY:t-n.height,finalX:e.divX,finalY:t-n.height-Fh,arrowX:e.arrowX,arrowY:n.height-2*iv-ml/2,arrowAtTop:!1,arrowVisible:!0}},Mf=function(e,t,o){return e=Vn(e,t.left,t.right,o.width),{initialX:e.divX,initialY:0,finalX:e.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}},Vn=function(e,t,o,n){return t=Mi(t,e-n/2,o-n),e=e-ml/2-t,o=nv,e=Mi(o,e,n-o-ml),{arrowX:e,divX:t}},Uu=function(){return!!xo},Da=function(e,t){return xo===e?(t?Ns():Aa(),!0):!1},Aa=function(){Ue.style.transform="translate(0, 0)",Ue.style.opacity="0",zh=setTimeout(function(){Ns()},1e3*fl),ai&&(ai(),ai=null)},Ns=function(){Uu()&&(zh&&clearTimeout(zh),Ue.style.transform="",Ue.style.left="",Ue.style.top="",Ue.style.opacity="0",Ue.style.display="none",Ue.style.backgroundColor="",Ue.style.borderColor="",ai&&(ai(),ai=null),xa(),xo=null,Ki&&(ot(Ue,Ki),Ki=""),Yi&&(ot(Ue,Yi),Yi=""),U().markFocused())},Hu=function(e,t,o,n){e=Hh.getPositionMetrics(e,t,o,n),e.arrowVisible?(li.style.display="",li.style.transform="translate("+e.arrowX+"px,"+e.arrowY+"px) rotate(45deg)",li.setAttribute("class",e.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):li.style.display="none",t=Math.floor(e.initialX),o=Math.floor(e.initialY),n=Math.floor(e.finalX);const c=Math.floor(e.finalY);return Ue.style.left=t+"px",Ue.style.top=o+"px",Ue.style.display="block",Ue.style.opacity="1",Ue.style.transform="translate("+(n-t)+"px,"+(c-o)+"px)",!!e.arrowAtTop},Wu=function(){if(xo){var e=xo.getSourceBlock();e=rv?Pu(xo):Lu(e);const t=e.left+(e.right-e.left)/2;Hu(t,e.bottom,t,e.top)}else Aa()},Gn=function(e){return e.length?e.reduce(function(t,o){return t.length<o.length?t:o}).length:0},Vu=function(e,t){if(!e.length)return 0;if(e.length===1)return e[0].length;let o=0;t=t||Gn(e);let n;for(n=0;n<t;n++){for(var c=e[0][n],h=1;h<e.length;h++)if(c!==e[h][n])return o;c===" "&&(o=n+1)}for(c=1;c<e.length;c++)if((h=e[c][n])&&h!==" ")return o;return t},Gu=function(e,t){if(!e.length)return 0;if(e.length===1)return e[0].length;let o=0;t=t||Gn(e);let n;for(n=0;n<t;n++){for(var c=e[0].substr(-n-1,1),h=1;h<e.length;h++)if(c!==e[h].substr(-n-1,1))return o;c===" "&&(o=n+1)}for(c=1;c<e.length;c++)if((h=e[c].charAt(e[c].length-n-1))&&h!==" ")return o;return t},i.wrap$$module$build$src$core$utils$string=function(e,t){e=e.split(`
276
+ `);for(let o=0;o<e.length;o++)e[o]=Nf(e[o],t);return e.join(`
277
+ `)},Nf=function(e,t){if(e.length<=t)return e;const o=e.trim().split(/\s+/);for(var n=0;n<o.length;n++)o[n].length>t&&(t=o[n].length);var c=-1/0;let h,$=1;do{n=c,h=e,e=[],c=o.length/$;let T=1;for(let L=0;L<o.length-1;L++)T<(L+1.5)/c?(T++,e[L]=!0):e[L]=!1;e=Ku(o,e,t),c=Ra(o,e,t),e=Lf(o,e),$++}while(c>n);return h},Ra=function(e,t,o){const n=[0],c=[];for(var h=0;h<e.length;h++)n[n.length-1]+=e[h].length,t[h]===!0?(n.push(0),c.push(e[h].charAt(e[h].length-1))):t[h]===!1&&n[n.length-1]++;for(e=Math.max(...n),t=0,h=0;h<n.length;h++)t-=2*Math.pow(Math.abs(o-n[h]),1.5),t-=Math.pow(e-n[h],1.5),".?!".includes(c[h])?t+=o/3:",;)]}".includes(c[h])&&(t+=o/4);return 1<n.length&&n[n.length-1]<=n[n.length-2]&&(t+=.5),t},Ku=function(e,t,o){let n=Ra(e,t,o),c;for(let h=0;h<t.length-1;h++){if(t[h]===t[h+1])continue;const $=[].concat(t);$[h]=!$[h],$[h+1]=!$[h+1];const T=Ra(e,$,o);T>n&&(n=T,c=$)}return c?Ku(e,c,o):t},Lf=function(e,t){const o=[];for(let n=0;n<e.length;n++)o.push(e[n]),t[n]!==void 0&&o.push(t[n]?`
278
+ `:" ");return o.join("")},i.isNumber$$module$build$src$core$utils$string=function(e){return/^\s*-?\d+(\.\d+)?\s*$/.test(e)},Pf=function(e){$l=e},Bf=function(){return $l},jf=function(){return fr},Ff=function(){return _t},Ni=function(e){if(e=Yu(e)){for(e=e.tooltip;typeof e=="function";)e=e();if(typeof e!="string")throw Error("Tooltip function must return a string.");return e}return""},Yu=function(e){for(;e&&e.tooltip;){if(typeof e.tooltip=="string"||typeof e.tooltip=="function")return e;e=e.tooltip}return null},Ju=function(){document.querySelector(".blocklyTooltipDiv")||(_t=document.createElement("div"),_t.className="blocklyTooltipDiv",(de()||document.body).appendChild(_t))},Li=function(e){e.mouseOverWrapper_=ct(e,"pointerover",null,zf),e.mouseOutWrapper_=ct(e,"pointerout",null,Uf),e.addEventListener("pointermove",qu,!1)},Oa=function(e){e&&(ze(e.mouseOverWrapper_),ze(e.mouseOutWrapper_),e.removeEventListener("pointermove",qu))},zf=function(e){Xi||(e=Yu(e.currentTarget),cs!==e&&(to(),$r=null,cs=e),clearTimeout(lv))},Uf=function(e){Xi||(lv=setTimeout(function(){$r=cs=null,to()},1),clearTimeout(ci),ci=0)},qu=function(e){if(cs&&cs.tooltip&&!Xi)if(fr){const t=Wh-e.pageX;e=Vh-e.pageY,Math.sqrt(t*t+e*e)>cv&&to()}else $r!==cs&&(clearTimeout(ci),Wh=e.pageX,Vh=e.pageY,ci=setTimeout(Gf,uv))},Xu=function(){$r=cs=null,to()},to=function(){fr&&(fr=!1,_t&&(_t.style.display="none")),ci&&(clearTimeout(ci),ci=0)},Zu=function(){to(),Xi=!0},Qu=function(){Xi=!1},Hf=function(){_t&&cs&&(typeof $l=="function"?$l(_t,cs):Wf())},Wf=function(){var e=Ni(cs);e=i.wrap$$module$build$src$core$utils$string(e,av),e=e.split(`
279
+ `);for(let t=0;t<e.length;t++){const o=document.createElement("div");o.appendChild(document.createTextNode(e[t])),_t.appendChild(o)}},Vf=function(e){const t=document.documentElement.clientWidth,o=document.documentElement.clientHeight;let n=Wh;n=e?n-(Gh+_t.offsetWidth):n+Gh;let c=Vh+Kh;return c+_t.offsetHeight>o+window.scrollY&&(c-=_t.offsetHeight+2*Kh),e?n=Math.max(bl-window.scrollX,n):n+_t.offsetWidth>t+window.scrollX-2*bl&&(n=t-_t.offsetWidth-2*bl),{x:n,y:c}},Gf=function(){if(!Xi&&($r=cs,_t)){_t.textContent="",Hf();var e=cs.RTL;_t.style.direction=e?"rtl":"ltr",_t.style.display="block",fr=!0;var{x:t,y:o}=Vf(e);_t.style.left=t+"px",_t.style.top=o+"px"}},ed=function(){return Yh},Kf=function(e){Yh=e},td=function(){return Jh},Yf=function(e){Jh=e},Go=function(e){e=`${e}`.toLowerCase().trim();var t=dv[e];if(t||(t=e.substring(0,2)==="0x"?"#"+e.substring(2):e,t=t[0]==="#"?t:"#"+t,/^#[0-9a-f]{6}$/.test(t)))return t;if(/^#[0-9a-f]{3}$/.test(t))return["#",t[1],t[1],t[2],t[2],t[3],t[3]].join("");var o=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return o&&(e=Number(o[1]),t=Number(o[2]),o=Number(o[3]),0<=e&&256>e&&0<=t&&256>t&&0<=o&&256>o)?Kn(e,t,o):null},Kn=function(e,t,o){return t=e<<16|t<<8|o,16>e?"#"+(16777216|t).toString(16).substr(1):"#"+t.toString(16)},Ma=function(e){return e=Go(e),e?(e=parseInt(e.substr(1),16),[e>>16,e>>8&255,e&255]):[0,0,0]},Na=function(e,t,o){let n=0,c=0,h=0;if(t===0)h=c=n=o;else{const $=Math.floor(e/60),T=e/60-$;e=o*(1-t);const L=o*(1-t*T);switch(t=o*(1-t*(1-T)),$){case 1:n=L,c=o,h=e;break;case 2:n=e,c=o,h=t;break;case 3:n=e,c=L,h=o;break;case 4:n=t,c=e,h=o;break;case 5:n=o,c=e,h=L;break;case 6:case 0:n=o,c=t,h=e}}return Kn(Math.floor(n),Math.floor(c),Math.floor(h))},Ko=function(e,t,o){return e=Go(e),!e||(t=Go(t),!t)?null:(e=Ma(e),t=Ma(t),Kn(Math.round(t[0]+o*(e[0]-t[0])),Math.round(t[1]+o*(e[1]-t[1])),Math.round(t[2]+o*(e[2]-t[2]))))},sd=function(e){return Na(e,Yh,255*Jh)},La=function(e,t,o){const n=[];var c=e.split("");c.push("");var h=0;e=[];let $=null;for(let te=0;te<c.length;te++){var T=c[te];if(h===0)if(T==="%")(h=e.join(""))&&n.push(h),e.length=0,h=1;else if(o&&T===`
280
+ `){const nt=e.join("");nt&&n.push(nt),e.length=0,n.push(T)}else e.push(T);else if(h===1)T==="%"?(e.push(T),h=0):t&&"0"<=T&&"9">=T?(h=2,$=T,(T=e.join(""))&&n.push(T),e.length=0):T==="{"?h=3:(e.push("%",T),h=0);else if(h===2)if("0"<=T&&"9">=T)$+=T;else{var L=void 0;n.push(parseInt((L=$)!=null?L:"",10)),te--,h=0}else h===3&&(T===""?(e.splice(0,0,"%{"),te--,h=0):T!=="}"?e.push(T):(h=e.join(""),/[A-Z]\w*/i.test(h)?(T=h.toUpperCase(),(T=T.startsWith("BKY_")?T.substring(4):null)&&T in i.Msg$$module$build$src$core$msg?(h=i.Msg$$module$build$src$core$msg[T],typeof h=="string"?Array.prototype.push.apply(n,La(h,t,o)):t?n.push(`${h}`):n.push(h)):n.push("%{"+h+"}")):n.push("%{"+h+"}"),h=e.length=0))}for((t=e.join(""))&&n.push(t),L=[],e.length=0,c=0;c<n.length;c++)typeof n[c]!="string"||o&&n[c]===`
281
+ `?((t=e.join(""))&&L.push(t),e.length=0,L.push(n[c])):e.push(n[c]);return(t=e.join(""))&&L.push(t),e.length=0,L},od=function(e){return La(e,!0,!0)},pt=function(e){return typeof e!="string"?e:(e=La(e,!1,!1),e.length?String(e[0]):"")},Jf=function(e){let t=!0;const o=i.Msg$$module$build$src$core$msg,n=e.match(/%{BKY_[A-Z]\w*}/gi);if(n)for(let c=0;c<n.length;c++){const h=n[c].toUpperCase();o[h.slice(6,-1)]===void 0&&(console.warn("No message string for "+n[c]+" in "+e),t=!1)}return t},Pi=function(e){const t=typeof e=="string"?pt(e):e;var o=Number(t);if(!isNaN(o)&&0<=o&&360>=o)return{hue:o,hex:Na(o,ed(),255*td())};if(o=Go(t))return{hue:null,hex:o};throw o='Invalid colour: "'+t+'"',e!==t&&(o+=' (from "'+e+'")'),Error(o)},Yo=function(){return Ss},qf=function(e){if(Ss=e,e===null){let t;(t=document.querySelector("."+yl))==null||t.remove()}},id=function(){const e=de()||document.body;document.querySelector("."+yl)?Ss=document.querySelector("."+yl):(Ss=document.createElement("div"),Ss.className=yl),e.appendChild(Ss)},Pa=function(e,t,o,n){if(Bi(),Zi=e,vl=o,o=Ss){if(o.style.direction=t?"rtl":"ltr",o.style.display="block",!n&&e instanceof Qe){let $;n=($=e.getSourceBlock())==null?void 0:$.workspace}var c;qh=(c=n)!=null?c:null;var h;e=(h=n)!=null?h:U(),Qi=e.getRenderer().getClassName(),en=e.getTheme().getClassName(),Qi&&ge(o,Qi),en&&ge(o,en)}},Bi=function(){if(nd()){Zi=null;var e=Ss;e&&(e.style.display="none",e.style.left="",e.style.top="",vl&&vl(),vl=null,e.textContent="",Qi&&(ot(e,Qi),Qi=""),en&&(ot(e,en),en=""),U().markFocused())}},nd=function(){return!!Zi},Jo=function(e){Zi===e&&Bi()},Yn=function(e){qh!==null&&qh!==e||Bi()},rd=function(e,t,o){Ss.style.left=e+"px",Ss.style.top=t+"px",Ss.style.height=o+"px"},ad=function(e,t,o,n){const c=Zf(e,t,o);e=Xf(e,t,o,n),0>c?rd(e,0,o.height+c):rd(e,c,o.height)},Xf=function(e,t,o,n){return n?Math.min(Math.max(t.right-o.width,e.left),e.right-o.width):Math.max(Math.min(t.left,e.right-o.width),e.left)},Zf=function(e,t,o){return t.bottom+o.height>=e.bottom?t.top-o.height:t.bottom},Qf=function(e){return!(e==null||!e.repositionForWindowResize)},ld=function(){Qf(Zi)&&Zi.repositionForWindowResize()||Bi()},e$=function(){return _l},cd=function(e){_l=e},Jn=function(e,t,o,n){if(Pa(hv,o,ud,n),t.length){var c=t$(t,o,e);wl=c,s$(c,e,o),setTimeout(function(){c.focus()},1),_l=null}else qn()},t$=function(e,t,o){const n=new Ah;n.setRole(ks.MENU);for(let c=0;c<e.length;c++){const h=e[c],$=new Rh(h.text);$.setRightToLeft(t),$.setRole(ks.MENUITEM),n.addChild($),$.setEnabled(h.enabled),h.enabled&&$.onAction(function(){qn(),requestAnimationFrame(()=>{setTimeout(()=>{h.callback(h.scope,o)},0)})},{})}return n},s$=function(e,t,o){const n=mu();t=new qe(t.clientY+n.top,t.clientY+n.top,t.clientX+n.left,t.clientX+n.left),o$(e);const c=e.getSize();o&&(t.left+=c.width,t.right+=c.width,n.left+=c.width,n.right+=c.width),ad(n,t,c,o),e.focus()},o$=function(e){var t=Yo();if(!t)throw Error("Attempting to create a context menu when widget div is null");t=e.render(t),ge(t,"blocklyContextMenu"),X(t,"contextmenu",null,i$),e.focus()},i$=function(e){e.preventDefault(),e.stopPropagation()},qn=function(){Jo(hv),_l=null},ud=function(){wl&&(wl.dispose(),wl=null)},i.callbackFactory$$module$build$src$core$contextmenu=function(e,t){return()=>{i.disable$$module$build$src$core$events$utils();let o;try{o=t instanceof Element?qo(t,e.workspace):Ri(t,e.workspace);const n=e.getRelativeToSurfaceXY();n.x=e.RTL?n.x-i.config$$module$build$src$core$config.snapRadius:n.x+i.config$$module$build$src$core$config.snapRadius,n.y+=2*i.config$$module$build$src$core$config.snapRadius,o.moveBy(n.x,n.y)}finally{i.enable$$module$build$src$core$events$utils()}return K()&&!o.isShadow()&&z(new(G(O.BLOCK_CREATE))(o)),i.setSelected$$module$build$src$core$common(o),o}},dd=function(e,t){return t=st(t,e.getParentSvg(),e.getInverseScreenCTM()),t.x/=e.scale,t.y/=e.scale,t},Ba=function(e,t,o){t=dd(e,t),gv.set(e,V.difference(o,t))},ja=function(e,t){if(t=dd(e,t),e=gv.get(e),!e)throw Error("Drag not initialized");return V.sum(e,t)},n$=function(e,t=!1){const o=i.createElement$$module$build$src$core$utils$xml("xml");var n=hd(i.allUsedVarModels$$module$build$src$core$variables(e));n.hasChildNodes()&&o.appendChild(n);for(const c of e.getTopComments())o.appendChild(Xn(c,t));for(e=e.getTopBlocks(!0),n=0;n<e.length;n++)o.appendChild(Zn(e[n],t));return o},Xn=function(e,t=!1){const o=i.createElement$$module$build$src$core$utils$xml("comment");t||o.setAttribute("id",e.id),t=e.workspace;const n=e.getRelativeToSurfaceXY();return n.x=t.RTL?t.getWidth()-n.x:n.x,o.setAttribute("x",`${n.x}`),o.setAttribute("y",`${n.y}`),o.setAttribute("w",`${e.getSize().width}`),o.setAttribute("h",`${e.getSize().height}`),e.getText()&&(o.textContent=e.getText()),e.isCollapsed()&&o.setAttribute("collapsed","true"),e.isOwnEditable()||o.setAttribute("editable","false"),e.isOwnMovable()||o.setAttribute("movable","false"),e.isOwnDeletable()||o.setAttribute("deletable","false"),o},hd=function(e){const t=i.createElement$$module$build$src$core$utils$xml("variables");for(let o=0;o<e.length;o++){const n=e[o],c=i.createElement$$module$build$src$core$utils$xml("variable");c.appendChild(i.createTextNode$$module$build$src$core$utils$xml(n.name)),n.type&&c.setAttribute("type",n.type),c.id=n.getId(),t.appendChild(c)}return t},Zn=function(e,t){if(e.isInsertionMarker()&&(e=e.getChildren(!1)[0],!e))return new DocumentFragment;let o=0;if(e.workspace.RTL&&(o=e.workspace.getWidth()),t=wo(e,t),$d(t)){const n=e.getRelativeToSurfaceXY();t.setAttribute("x",String(Math.round(e.workspace.RTL?o-n.x:n.x))),t.setAttribute("y",String(Math.round(n.y)))}return t},r$=function(e){if(e.isSerializable()){const t=i.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name",e.name||""),e.toXml(t)}return null},a$=function(e,t){for(let o=0;o<e.inputList.length;o++){const n=e.inputList[o];for(let c=0;c<n.fieldRow.length;c++){const h=r$(n.fieldRow[c]);h&&t.appendChild(h)}}},wo=function(e,t){if(e.isInsertionMarker())return(t=e.getChildren(!1)[0])?wo(t):new DocumentFragment;const o=i.createElement$$module$build$src$core$utils$xml(e.isShadow()?"shadow":"block");if(o.setAttribute("type",e.type),t||(o.id=e.id),e.mutationToDom){var n=e.mutationToDom();n&&(n.hasChildNodes()||n.hasAttributes())&&o.appendChild(n)}if(a$(e,o),n=e.getCommentText()){var c=e.getIcon(yt.COMMENT),h=c.getBubbleSize();c=c.bubbleIsVisible();var $=i.createElement$$module$build$src$core$utils$xml("comment");$.appendChild(i.createTextNode$$module$build$src$core$utils$xml(n)),$.setAttribute("pinned",`${c}`),$.setAttribute("h",String(h.height)),$.setAttribute("w",String(h.width)),o.appendChild($)}for(e.data&&(n=i.createElement$$module$build$src$core$utils$xml("data"),n.appendChild(i.createTextNode$$module$build$src$core$utils$xml(e.data)),o.appendChild(n)),n=0;n<e.inputList.length;n++){h=e.inputList[n];var T=void 0;if(c=!0,h.type!==i.inputTypes$$module$build$src$core$inputs$input_types.DUMMY&&h.type!==i.inputTypes$$module$build$src$core$inputs$input_types.END_ROW){$=h.connection.targetBlock(),h.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE?T=i.createElement$$module$build$src$core$utils$xml("value"):h.type===i.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT&&(T=i.createElement$$module$build$src$core$utils$xml("statement"));const te=h.connection.getShadowDom();!te||$&&$.isShadow()||T.appendChild(pd(te,t)),$&&($=wo($,t),$.nodeType===ao.ELEMENT_NODE&&(T.appendChild($),c=!1)),T.setAttribute("name",h.name),c||o.appendChild(T)}}e.inputsInline!==void 0&&e.inputsInline!==e.inputsInlineDefault&&o.setAttribute("inline",String(e.inputsInline)),e.isCollapsed()&&o.setAttribute("collapsed","true"),e.isEnabled()||o.setAttribute("disabled-reasons",Array.from(e.getDisabledReasons()).map(encodeURIComponent).join(",")),e.isOwnDeletable()||o.setAttribute("deletable","false"),e.isOwnMovable()||o.setAttribute("movable","false"),e.isOwnEditable()||o.setAttribute("editable","false"),T=e.getNextBlock();let L;return T&&(n=wo(T,t),n.nodeType===ao.ELEMENT_NODE&&(L=i.createElement$$module$build$src$core$utils$xml("next"),L.appendChild(n),o.appendChild(L))),e=e.nextConnection&&e.nextConnection.getShadowDom(),!e||T&&T.isShadow()||L.appendChild(pd(e,t)),o},pd=function(e,t){let o=e=e.cloneNode(!0),n;for(;o;)if(t&&o.nodeName==="shadow"&&o.removeAttribute("id"),o.firstChild)o=o.firstChild;else{for(;o&&!o.nextSibling;){n=o,o=o.parentNode;let c;n.nodeType===ao.TEXT_NODE&&n.data.trim()===""&&((c=o)==null?void 0:c.firstChild)!==n&&Ke(n)}o&&(n=o,o=o.nextSibling,n.nodeType===ao.TEXT_NODE&&n.data.trim()===""&&Ke(n))}return e},Ls=function(e){return Ii(e).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},l$=function(e){e=Ls(e).split("<");let t="";for(let o=1;o<e.length;o++){const n=e[o];n[0]==="/"&&(t=t.substring(2)),e[o]=t+"<"+n,n[0]!=="/"&&n.slice(-2)!=="/>"&&(t+=" ")}return e=e.join(`
282
+ `),e=e.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>"),e.replace(/^\n/,"")},c$=function(e,t){return t.setResizesEnabled(!1),t.clear(),e=i.domToWorkspace$$module$build$src$core$xml(e,t),t.setResizesEnabled(!0),e},i.domToWorkspace$$module$build$src$core$xml=function(e,t){let o=0;t.RTL&&(o=t.getWidth());const n=[];Ho();const c=i.getGroup$$module$build$src$core$events$utils();c||i.setGroup$$module$build$src$core$events$utils(!0),t.setResizesEnabled&&t.setResizesEnabled(!1);let h=!0;try{for(let $=0,T;T=e.childNodes[$];$++){const L=T.nodeName.toLowerCase(),te=T;if(L==="block"||L==="shadow"&&!me()){const nt=qo(te,t);n.push(nt.id);let it;const Xt=parseInt((it=te.getAttribute("x"))!=null?it:"10",10);let hn;const Or=parseInt((hn=te.getAttribute("y"))!=null?hn:"10",10);isNaN(Xt)||isNaN(Or)||nt.moveBy(t.RTL?o-Xt:Xt,Or,["create"]),h=!1}else{if(L==="shadow")throw TypeError("Shadow block cannot be a top-level block.");if(L==="comment")gd(te,t);else if(L==="variables"){if(h)md(te,t);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");h=!1}}}}finally{i.setGroup$$module$build$src$core$events$utils(c),t.setResizesEnabled&&t.setResizesEnabled(!0),t.rendered&&Qs(),Wo()}return z(new(G(O.FINISHED_LOADING))(t)),n},gd=function(e,t){var o;const n=(o=e.getAttribute("id"))!=null?o:void 0;o=t.rendered?new kl(t,n):new Tl(t,n);var c;o.setText((c=e.textContent)!=null?c:"");var h;c=parseInt((h=e.getAttribute("x"))!=null?h:"",10);let $;h=parseInt(($=e.getAttribute("y"))!=null?$:"",10),isNaN(c)||isNaN(h)||(c=t.RTL?t.getWidth()-c:c,o.moveTo(new V(c,h)));var T;t=parseInt((T=e.getAttribute("w"))!=null?T:"",10);let L;return T=parseInt((L=e.getAttribute("h"))!=null?L:"",10),isNaN(t)||isNaN(T)||o.setSize(new Le(t,T)),e.getAttribute("collapsed")==="true"&&o.setCollapsed(!0),e.getAttribute("editable")==="false"&&o.setEditable(!1),e.getAttribute("movable")==="false"&&o.setMovable(!1),e.getAttribute("deletable")==="false"&&o.setDeletable(!1),o},u$=function(e,t){if(!t.getBlocksBoundingBox)return i.domToWorkspace$$module$build$src$core$xml(e,t);var o=t.getBlocksBoundingBox();if(e=i.domToWorkspace$$module$build$src$core$xml(e,t),o&&o.top!==o.bottom){var n=o.bottom;o=t.RTL?o.right:o.left;var c=1/0;let h=-1/0,$=1/0;for(let T=0;T<e.length;T++){const L=t.getBlockById(e[T]).getRelativeToSurfaceXY();L.y<$&&($=L.y),L.x<c&&(c=L.x),L.x>h&&(h=L.x)}for(n=n-$+10,o=t.RTL?o-h:o-c,c=0;c<e.length;c++)t.getBlockById(e[c]).moveBy(o,n,["create"])}return e},i.domToBlock$$module$build$src$core$xml=function(e,t){return e=qo(e,t),t.rendered&&Qs(),e},qo=function(e,t){i.disable$$module$build$src$core$events$utils();var o=t.getAllVariables();let n;try{if(n=Fa(e,t),t.rendered){const c=n,h=n.getDescendants(!1);c.setConnectionTracking(!1);for(let $=h.length-1;0<=$;$--)h[$].initSvg();for(let $=h.length-1;0<=$;$--)h[$].queueRender();setTimeout(function(){c.disposed||c.setConnectionTracking(!0)},1),t.resizeContents()}else{const c=n.getDescendants(!1);for(let h=c.length-1;0<=h;h--)c[h].initModel()}}finally{i.enable$$module$build$src$core$events$utils()}if(K()){for(e=Hn(t,o),t=0;t<e.length;t++)o=e[t],z(new(G(O.VAR_CREATE))(o));z(new(G(O.BLOCK_CREATE))(n))}return n},md=function(e,t){for(let n=0;n<e.children.length;n++){var o=e.children[n];const c=o.getAttribute("type"),h=o.getAttribute("id");if(o=o.textContent,!o)break;t.createVariable(o,c,h)}},d$=function(e){const t={mutation:[],comment:[],data:[],field:[],input:[],next:[]};for(let o=0;o<e.children.length;o++){const n=e.children[o];if(n.nodeType!==ao.TEXT_NODE)switch(n.nodeName.toLowerCase()){case"mutation":t.mutation.push(n);break;case"comment":t.comment.push(n);break;case"data":t.data.push(n);break;case"title":case"field":t.field.push(n);break;case"value":case"statement":t.input.push(n);break;case"next":t.next.push(n);break;default:console.warn("Ignoring unknown tag: "+n.nodeName)}}return t},h$=function(e,t){let o=!1;for(let n=0;n<e.length;n++){const c=e[n];t.domToMutation&&(t.domToMutation(c),t.initSvg&&(o=!0))}return o},p$=function(e,t){for(let n=0;n<e.length;n++){var o=e[n];const c=o.textContent,h=o.getAttribute("pinned")==="true";let $;const T=parseInt(($=o.getAttribute("w"))!=null?$:"50",10);let L;o=parseInt((L=o.getAttribute("h"))!=null?L:"50",10),t.setCommentText(c);const te=t.getIcon(yt.COMMENT);isNaN(T)||isNaN(o)||te.setBubbleSize(new Le(T,o)),te.setBubbleVisible(h),setTimeout(()=>te.setBubbleVisible(h),1)}},g$=function(e,t){for(let o=0;o<e.length;o++)t.data=e[o].textContent},m$=function(e,t){for(let o=0;o<e.length;o++){const n=e[o],c=n.getAttribute("name");c?b$(t,c,n):console.warn(`Ignoring unnamed field in block ${t.type}`)}},fd=function(e){let t=null,o=null;for(let n=0;n<e.childNodes.length;n++){const c=e.childNodes[n];$d(c)&&(c.nodeName.toLowerCase()==="block"?t=c:c.nodeName.toLowerCase()==="shadow"&&(o=c))}return{childBlockElement:t,childShadowElement:o}},f$=function(e,t,o,n){for(let h=0;h<e.length;h++){var c=e[h];const $=c.getAttribute("name"),T=$?o.getInput($):null;if(!T){console.warn("Ignoring non-existent input "+$+" in block "+n);break}if(c=fd(c),c.childBlockElement){if(!T.connection)throw TypeError("Input connection does not exist.");Fa(c.childBlockElement,t,T.connection,!1)}if(c.childShadowElement){let L;(L=T.connection)==null||L.setShadowDom(c.childShadowElement)}}},$$=function(e,t,o){for(let n=0;n<e.length;n++){const c=fd(e[n]);if(c.childBlockElement){if(!o.nextConnection)throw TypeError("Next statement does not exist.");if(o.nextConnection.isConnected())throw TypeError("Next statement is already connected.");Fa(c.childBlockElement,t,o.nextConnection,!0)}c.childShadowElement&&o.nextConnection&&o.nextConnection.setShadowDom(c.childShadowElement)}},Fa=function(e,t,o,n){var c;const h=e.getAttribute("type");if(!h)throw TypeError("Block type unspecified: "+e.outerHTML);var $=(c=e.getAttribute("id"))!=null?c:void 0;c=t.newBlock(h,$),$=d$(e);const T=h$($.mutation,c);if(p$($.comment,c),g$($.data,c),o)if(n)if(c.previousConnection)o.connect(c.previousConnection);else throw TypeError("Next block does not have previous statement.");else if(c.outputConnection)o.connect(c.outputConnection);else if(c.previousConnection)o.connect(c.previousConnection);else throw TypeError("Child block does not have output or previous statement.");if(m$($.field,c),f$($.input,t,c,h),$$($.next,t,c),T&&c.initSvg(),(t=e.getAttribute("inline"))&&c.setInputsInline(t==="true"),(t=e.getAttribute("disabled"))&&c.setDisabledReason(t==="true"||t==="disabled",Ft),t=e.getAttribute("disabled-reasons"),t!==null)for(var L of t.split(","))c.setDisabledReason(!0,decodeURIComponent(L));if((L=e.getAttribute("deletable"))&&c.setDeletable(L==="true"),(L=e.getAttribute("movable"))&&c.setMovable(L==="true"),(L=e.getAttribute("editable"))&&c.setEditable(L==="true"),(L=e.getAttribute("collapsed"))&&c.setCollapsed(L==="true"),e.nodeName.toLowerCase()==="shadow"){for(e=c.getChildren(!1),L=0;L<e.length;L++)if(!e[L].isShadow())throw TypeError("Shadow block not allowed non-shadow child.");c.setShadow(!0)}return c},b$=function(e,t,o){const n=e.getField(t);n?n.fromXml(o):console.warn("Ignoring non-existent field "+t+" in block "+e.type)},v$=function(e){for(let t=0;t<e.childNodes.length;t++){const o=e.childNodes[t];if(o.nodeName.toLowerCase()==="next"){e.removeChild(o);break}}},$d=function(e){return e.nodeType===ao.ELEMENT_NODE},za=function(e){if(!(100<e.getDescendants(!1).length)){var t=e.workspace,o=e.getSvgRoot();t.getAudioManager().play("delete");var n=e.getRelativeToSurfaceXY(),c=o.cloneNode(!0);c.setAttribute("transform","translate("+n.x+","+n.y+")");var h;(h=t.getLayerManager())==null||h.appendToAnimationLayer({getSvgRoot:()=>c}),bd(c,{x:n.x,y:n.y,width:e.width,height:e.height},t.RTL,new Date)}},bd=function(e,t,o,n){const c=(new Date().getTime()-n.getTime())/150;1<c?Ke(e):(e.setAttribute("transform","translate("+(t.x+(o?-1:1)*t.width/2*c)+","+(t.y+t.height/2*c)+") scale("+(1-c)+")"),setTimeout(bd,10,e,t,o,n))},Ua=function(e){var t=e.workspace;const o=t.scale;if(t.getAudioManager().play("click"),!(1>o)){var n=t.getSvgXY(e.getSvgRoot());e.outputConnection?(n.x+=(e.RTL?3:-3)*o,n.y+=13*o):e.previousConnection&&(n.x+=(e.RTL?-23:23)*o,n.y+=3*o);var c=N(x.CIRCLE,{cx:n.x,cy:n.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg());e=N(x.ANIMATE,{id:"animationCircle",begin:"indefinite",attributeName:"r",dur:"150ms",from:0,to:25*o},c),t=N(x.ANIMATE,{id:"animationOpacity",begin:"indefinite",attributeName:"opacity",dur:"150ms",from:1,to:0},c),e.beginElement(),t.beginElement(),setTimeout(()=>{Ke(c)},150)}},vd=function(e){if(ji(),e.workspace.getAudioManager().play("disconnect"),!(1>e.workspace.scale)){var t=e.getHeightWidth().height;t=Math.atan(10/t)/Math.PI*180,e.RTL||(t*=-1),vr=e,yd(e,t,new Date,0)}},yd=function(e,t,o,n){const c=[.66,1,.66,0,-.66,-1,-.66,0];let h="";o.getTime()+200>new Date().getTime()&&(h=`skewX(${Math.round(c[n%c.length]*t)})`,Sl=setTimeout(yd,15,e,t,o,n+1)),e.getSvgRoot().setAttribute("transform",`${e.getTranslation()} ${h}`)},ji=function(){vr&&(Sl&&(clearTimeout(Sl),Sl=null),vr.getSvgRoot().setAttribute("transform",vr.getTranslation()),vr=null)},Xo=function(e){return e.getRelativeToSurfaceXY!==void 0&&e.isMovable!==void 0&&e.startDrag!==void 0&&e.drag!==void 0&&e.endDrag!==void 0&&e.revertDrag!==void 0},so=function(e,t){for(const o in t)e[o]=t[o]!==null&&typeof t[o]=="object"?so(e[o]||Object.create(null),t[o]):t[o];return e},Ps=function(e,t){r(F.FIELD,e,t)},y$=function(e){u(F.FIELD,e)},i.fromJson$$module$build$src$core$field_registry=function(e){return bv.fromJsonInternal(e)},_$=function(e){const t=f(F.FIELD,e.type);return t?t.fromJson(e):(console.warn("Blockly could not create a field of type "+e.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null)},i.register$$module$build$src$core$extensions=function(e,t){if(typeof e!="string"||e.trim()==="")throw Error('Error: Invalid extension name "'+e+'"');if(sn[e])throw Error('Error: Extension "'+e+'" is already registered.');if(typeof t!="function")throw Error('Error: Extension "'+e+'" must be a function');sn[e]=t},i.registerMixin$$module$build$src$core$extensions=function(e,t){if(!t||typeof t!="object")throw Error('Error: Mixin "'+e+'" must be a object');i.register$$module$build$src$core$extensions(e,function(){this.mixin(t)})},i.registerMutator$$module$build$src$core$extensions=function(e,t,o,n){const c='Error when registering mutator "'+e+'": ';Cd(c,t);const h=wd(t,c);if(o&&typeof o!="function")throw Error(c+'Extension "'+e+'" is not a function');i.register$$module$build$src$core$extensions(e,function(){h&&this.setMutator(new i.MutatorIcon$$module$build$src$core$icons$mutator_icon(n||[],this)),this.mixin(t),o&&o.apply(this)})},w$=function(e){_d(e)?delete sn[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},_d=function(e){return!!sn[e]},Ha=function(e,t,o){const n=sn[e];if(typeof n!="function")throw Error('Error: Extension "'+e+'" not found.');let c;if(o?C$(e,t):c=Va(t),n.apply(t),o)Cd('Error after applying mutator "'+e+'": ',t);else if(!S$(c,t))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},C$=function(e,t){if(Va(t).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+t.id)},T$=function(e,t){return Wa(e.mutationToDom,e.domToMutation,t+" mutationToDom/domToMutation")},k$=function(e,t){return Wa(e.saveExtraState,e.loadExtraState,t+" saveExtraState/loadExtraState")},wd=function(e,t){return Wa(e.compose,e.decompose,t+" compose/decompose")},Wa=function(e,t,o){if(e&&t){if(typeof e!="function"||typeof t!="function")throw Error(o+" must be a function");return!0}if(!e&&!t)return!1;throw Error(o+"Must have both or neither functions")},Cd=function(e,t){const o=T$(t,e),n=k$(t,e);if(!o&&!n)throw Error(e+"Mutations must contain either XML hooks, or JSON hooks, or both");wd(t,e)},Va=function(e){const t=[];return e.domToMutation!==void 0&&t.push(e.domToMutation),e.mutationToDom!==void 0&&t.push(e.mutationToDom),e.saveExtraState!==void 0&&t.push(e.saveExtraState),e.loadExtraState!==void 0&&t.push(e.loadExtraState),e.compose!==void 0&&t.push(e.compose),e.decompose!==void 0&&t.push(e.decompose),t},S$=function(e,t){if(t=Va(t),t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(e[o]!==t[o])return!1;return!0},E$=function(e){if(typeof document!="object")throw Error("runAfterPageLoad() requires browser document.");if(document.readyState==="complete")e();else{const t=setInterval(function(){document.readyState==="complete"&&(clearInterval(t),e())},10)}},i.buildTooltipForDropdown$$module$build$src$core$extensions=function(e,t){const o=[];return function(){o.includes(this.type)||(I$(this,e,t),o.push(this.type)),this.setTooltip(function(){const n=String(this.getFieldValue(e));return pt(t[n])}.bind(this))}},I$=function(e,t,o){var n=e.getField(t);if(n instanceof qt&&!n.isOptionListDynamic()){n=n.getOptions();for(const[,c]of n)o[c]===void 0&&console.warn(`No tooltip mapping for value ${c} of field ${t} of block type ${e.type}.`)}},i.buildTooltipWithFieldText$$module$build$src$core$extensions=function(e,t){return function(){this.setTooltip(function(){const o=this.getField(t);return pt(e).replace("%1",o?o.getText():"")}.bind(this))}},x$=function(){const e=this.tooltip;this.setTooltip(function(){const t=this.getParent();return t&&t.getInputsInline()&&t.tooltip||e}.bind(this))},ue=function(e,t){return" "+e+","+t+" "},Yt=function(e,t){return" "+e+t.join("")},wt=function(e,t){return" M "+e+","+t+" "},at=function(e,t){return" m "+e+","+t+" "},Bs=function(e,t){return" l "+e+","+t+" "},Fi=function(e){return" l"+e.join("")},ne=function(e,t){return" "+e+" "+t+" "},gt=function(e,t,o,n){return e+" "+o+" "+o+" "+t+n},Td=function(e,t){r(F.ICON,e.toString(),t)},D$=function(e){u(F.ICON,e)},Co=function(e){return e.getProcedureModel!==void 0&&e.doProcedureUpdate!==void 0&&e.isProcedureDef!==void 0},Ga=function(e){return e.startPublishing!==void 0&&e.stopPublishing!==void 0},Ka=function(e){const t=e.getProcedureMap().getProcedures().filter(n=>!n.getReturnTypes()).map(n=>[n.getName(),n.getParameters().map(c=>c.getName()),!1]);e.getBlocksByType("procedures_defnoreturn",!1).forEach(n=>{!Co(n)&&Di(n)&&t.push(n.getProcedureDef())});const o=e.getProcedureMap().getProcedures().filter(n=>!!n.getReturnTypes()).map(n=>[n.getName(),n.getParameters().map(c=>c.getName()),!0]);return e.getBlocksByType("procedures_defreturn",!1).forEach(n=>{!Co(n)&&Di(n)&&o.push(n.getProcedureDef())}),t.sort(kd),o.sort(kd),[t,o]},kd=function(e,t){return e[0].localeCompare(t[0],void 0,{sensitivity:"base"})},i.findLegalName$$module$build$src$core$procedures=function(e,t){if(t.isInFlyout)return e;for(e=e||i.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!A$(e,t.workspace,t);){const o=e.match(/^(.*?)(\d+)$/);e=o?o[1]+(parseInt(o[2])+1):e+"2"}return e},A$=function(e,t,o){return!Sd(e,t,o)},Sd=function(e,t,o){for(const n of t.getAllBlocks(!1))if(n!==o&&Di(n)&&i.Names$$module$build$src$core$names.equals(n.getProcedureDef()[0],e))return!0;o=o&&Co(o)?o==null?void 0:o.getProcedureModel():void 0;for(const n of t.getProcedureMap().getProcedures())if(n!==o&&i.Names$$module$build$src$core$names.equals(n.getName(),e))return!0;return!1},i.rename$$module$build$src$core$procedures=function(e){var t=this.getSourceBlock();if(!t)throw new ft;e=e.trim();const o=i.findLegalName$$module$build$src$core$procedures(e,t);Co(t)&&!t.isInsertionMarker()&&t.getProcedureModel().setName(o);const n=this.getValue();if(n!==e&&n!==o)for(e=t.workspace.getAllBlocks(!1),t=0;t<e.length;t++){const c=e[t];c.renameProcedure&&c.renameProcedure(n,o)}return o},Ya=function(e){function t(h,$){for(let L=0;L<h.length;L++){var T=h[L][0];const te=h[L][1],nt=i.createElement$$module$build$src$core$utils$xml("block");nt.setAttribute("type",$),nt.setAttribute("gap","16");const it=i.createElement$$module$build$src$core$utils$xml("mutation");for(it.setAttribute("name",T),nt.appendChild(it),T=0;T<te.length;T++){const Xt=i.createElement$$module$build$src$core$utils$xml("arg");Xt.setAttribute("name",te[T]),it.appendChild(Xt)}o.push(nt)}}const o=[];if(Jt.procedures_defnoreturn){var n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","procedures_defnoreturn"),n.setAttribute("gap","16");var c=i.createElement$$module$build$src$core$utils$xml("field");c.setAttribute("name","NAME"),c.appendChild(i.createTextNode$$module$build$src$core$utils$xml(i.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE)),n.appendChild(c),o.push(n)}return Jt.procedures_defreturn&&(n=i.createElement$$module$build$src$core$utils$xml("block"),n.setAttribute("type","procedures_defreturn"),n.setAttribute("gap","16"),c=i.createElement$$module$build$src$core$utils$xml("field"),c.setAttribute("name","NAME"),c.appendChild(i.createTextNode$$module$build$src$core$utils$xml(i.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),n.appendChild(c),o.push(n)),Jt.procedures_ifreturn&&(n=i.createElement$$module$build$src$core$utils$xml("block"),n.setAttribute("type","procedures_ifreturn"),n.setAttribute("gap","16"),o.push(n)),o.length&&o[o.length-1].setAttribute("gap","24"),e=Ka(e),t(e[0],"procedures_callnoreturn"),t(e[1],"procedures_callreturn"),o},Ed=function(e){var t=[],o=e.getBlocksByType("procedures_mutatorarg",!1);for(let h=0,$;$=o[h];h++)t.push($.getFieldValue("NAME"));o=i.createElement$$module$build$src$core$utils$xml("xml");const n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","procedures_mutatorarg");const c=i.createElement$$module$build$src$core$utils$xml("field");c.setAttribute("name","NAME"),t=Sa(i.DEFAULT_ARG$$module$build$src$core$procedures,t),t=i.createTextNode$$module$build$src$core$utils$xml(t),c.appendChild(t),n.appendChild(c),o.appendChild(n),e.updateToolbox(o)},Id=function(e){if(ie(e)&&e.bubbleType==="mutator"&&e.isOpen&&e.blockId){e=q(e.workspaceId).getBlockById(e.blockId);var t=e.type;(t==="procedures_defnoreturn"||t==="procedures_defreturn")&&(e=e.getIcon(i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE).getWorkspace(),Ed(e),e.addChangeListener(R$))}},R$=function(e){(w(e)||E(e)||R(e)||D(e))&&(e=q(e.workspaceId),Ed(e))},xd=function(e,t){return t.getAllBlocks(!1).filter(o=>O$(o,e)||cf(o)&&i.Names$$module$build$src$core$names.equals(o.getProcedureCall(),e))},O$=function(e,t){return Co(e)&&!e.isProcedureDef()&&e.getProcedureModel()&&i.Names$$module$build$src$core$names.equals(e.getProcedureModel().getName(),t)},i.mutateCallers$$module$build$src$core$procedures=function(e){const t=me();var o=e.getProcedureDef()[0];const n=e.mutationToDom(!0);e=xd(o,e.workspace);for(let h=0,$;$=e[h];h++){o=(o=$.mutationToDom())&&Ii(o),$.domToMutation&&$.domToMutation(n);var c=$.mutationToDom();c=c&&Ii(c),o!==c&&(i.setRecordUndo$$module$build$src$core$events$utils(!1),z(new(G(O.BLOCK_CHANGE))($,"mutation",null,o,c)),i.setRecordUndo$$module$build$src$core$events$utils(t))}},i.getDefinition$$module$build$src$core$procedures=function(e,t){for(const o of t.getAllBlocks(!1))if(Co(o)&&o.isProcedureDef()&&i.Names$$module$build$src$core$names.equals(o.getProcedureModel().getName(),e)||Di(o)&&i.Names$$module$build$src$core$names.equals(o.getProcedureDef()[0],e))return o;return null},Ja=function(e){return e.isDynamic},M$=function(e){return e.pathDown!==void 0&&e.pathUp!==void 0},N$=function(e){return e.pathLeft!==void 0&&e.pathRight!==void 0},L$=function(e,t){if(!e||!t)throw Error("Cannot connect null connections.");e.targetConnection=t,t.targetConnection=e},P$=function(e,t){let o=null;t=t.outputConnection;const n=t==null?void 0:t.getConnectionChecker();for(let c=0,h;h=e.inputList[c];c++){const $=h.connection;let T;if($&&((T=n)!=null&&T.canConnect(t,$,!1))){if(o)return null;o=$}}return o},B$=function(e,t){let o;for(;o=P$(e,t);)if(e=o.targetBlock(),!e||e.isShadow())return o;return null},Dd=function(e){return e.getType!==void 0&&e.initView!==void 0&&e.dispose!==void 0&&e.getWeight!==void 0&&e.getSize!==void 0&&e.applyColour!==void 0&&e.hideForInsertionMarker!==void 0&&e.updateEditable!==void 0&&e.updateCollapsed!==void 0&&e.isShownWhenCollapsed!==void 0&&e.setOffsetInBlock!==void 0&&e.onLocationChange!==void 0&&e.onClick!==void 0},j$=function(e){return Dd(e)&&Oi(e)&&zn(e)&&e.setText!==void 0&&e.getText!==void 0&&e.setBubbleSize!==void 0&&e.getBubbleSize!==void 0&&e.getType()===yt.COMMENT},Qn=function(e){let t=e.outputConnection;return(!t||e.previousConnection&&e.previousConnection.isConnected())&&(t=e.previousConnection),t},er=function(e,t){r(F.RENDERER,e,t)},F$=function(e){u(F.RENDERER,e)},Ad=function(e,t,o){return e=new(m(F.RENDERER,e))(e),e.init(t,o),e},Rd=function(e){Ai(e.getTargetWorkspace(),void 0,"String")},Od=function(e){Ai(e.getTargetWorkspace(),void 0,"Number")},Md=function(e){Ai(e.getTargetWorkspace(),void 0,"Colour")},qa=function(e){let t=[],o=document.createElement("button");return o.setAttribute("text",i.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE),o.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),t.push(o),o=document.createElement("button"),o.setAttribute("text",i.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE),o.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),t.push(o),o=document.createElement("button"),o.setAttribute("text",i.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE),o.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),t.push(o),e.registerButtonCallback("CREATE_VARIABLE_STRING",Rd),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",Od),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",Md),e=Nd(e),t=t.concat(e)},Nd=function(e){e=e.getAllVariables();const t=[];if(0<e.length){if(Jt.variables_set_dynamic){var o=e[e.length-1];const n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","variables_set_dynamic"),n.setAttribute("gap","24"),n.appendChild(Vo(o)),t.push(n)}if(Jt.variables_get_dynamic){e.sort(hr.compareByName);for(let n=0,c;c=e[n];n++)o=i.createElement$$module$build$src$core$utils$xml("block"),o.setAttribute("type","variables_get_dynamic"),o.setAttribute("gap","8"),o.appendChild(Vo(c)),t.push(o)}}return t},z$=function(e,t){const o=e.workspace,n=i.config$$module$build$src$core$config.snapRadius,c=V.difference(t,e.getRelativeToSurfaceXY()),h=new V(0,0),$=o.getAllBlocks(!1).filter(T=>T.id!=e.id).map(T=>T.getRelativeToSurfaceXY());for(;U$(V.sum(t,h),$)||H$(e,V.sum(c,h),n);)o.RTL?h.translate(-n,2*n):h.translate(n,2*n);e.moveTo(V.sum(t,h))},U$=function(e,t){return t.some(o=>1>=Math.abs(o.x-e.x)&&1>=Math.abs(o.y-e.y))},H$=function(e,t,o){return e.getConnections_(!1).some(n=>!!n.closest(o,t).connection)},zi=function(e,t,o){const n=o.getBoundingRectangle(),c=n.right-n.left,h=Mi(t.top,n.top,t.top+t.height-(n.bottom-n.top))-n.top;let $=t.left;return t=t.left+t.width-c,e.RTL?$=Math.min(t,$):t=Math.max($,t),(e=Mi($,n.left,t)-n.left)||h?(o.moveBy(e,h,["inbounds"]),!0):!1},Ld=function(e){return t=>{var o=e.getMetricsManager();if(o.hasFixedEdges()&&!e.isDragging()){var n;if(ub.includes((n=t.type)!=null?n:"")){n=o.getScrollMetrics(!0);const c=W$(e,t);c&&(o=i.getGroup$$module$build$src$core$events$utils()||!1,i.setGroup$$module$build$src$core$events$utils(t.group),zi(e,n,c)&&!t.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),i.setGroup$$module$build$src$core$events$utils(o))}else se(t)&&t.scale&&t.oldScale&&t.scale>t.oldScale&&Xa(e)}}},W$=function(e,t){let o=null;switch(t.type){case O.BLOCK_CREATE:case O.BLOCK_MOVE:(o=e.getBlockById(t.blockId))&&(o=o.getRootBlock());break;case O.COMMENT_CREATE:case O.COMMENT_MOVE:case O.COMMENT_RESIZE:o=e.getCommentById(t.commentId)}return o},Xa=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var o=e.getTopBoundedElements();for(let n=0,c;c=o[n];n++)zi(e,t,c)}},ls=function(e){return e.isDeletable!==void 0&&e.dispose!==void 0&&e.setDeleteStyle!==void 0},V$=function(e){const t=e.toCopyData();Tp=t;let o;return kp=(o=e.workspace)!=null?o:null,t},To=function(e,t,o){return e&&t?Pd(e,t,o):Tp&&kp?Pd(Tp,kp):null},Pd=function(e,t,o){let n;t=t.isMutator?t:(n=t.getRootWorkspace())!=null?n:t;let c,h;return(h=(c=f(F.PASTER,e.paster,!1))==null?void 0:c.paste(e,t,o))!=null?h:null},G$=function(e){const t=e.toCopyData();return t?To(t,e.workspace):null},tr=function(e){return e.toCopyData!==void 0},Bd=function(){He.registry.register({name:Hs.ESCAPE,preconditionFn(e){return!e.options.readOnly},callback(e){return e.hideChaff(),!0},keyCodes:[Ae.ESC]})},jd=function(){He.registry.register({name:Hs.DELETE,preconditionFn(e){const t=I();return!e.options.readOnly&&t!=null&&ls(t)&&t.isDeletable()&&!co.inProgress()},callback(e,t){return t.preventDefault(),e=I(),e instanceof gs?e.checkAndDelete():ls(e)&&e.isDeletable()&&(i.setGroup$$module$build$src$core$events$utils(!0),e.dispose(),i.setGroup$$module$build$src$core$events$utils(!1)),!0},keyCodes:[Ae.DELETE,Ae.BACKSPACE]})},Fd=function(){const e=He.registry.createSerializedKey(Ae.C,[Ae.CTRL]),t=He.registry.createSerializedKey(Ae.C,[Ae.ALT]),o=He.registry.createSerializedKey(Ae.C,[Ae.META]);He.registry.register({name:Hs.COPY,preconditionFn(n){const c=I();return!n.options.readOnly&&!co.inProgress()&&c!=null&&ls(c)&&c.isDeletable()&&Xo(c)&&c.isMovable()&&tr(c)},callback(n,c){return c.preventDefault(),n.hideChaff(),c=I(),!c||!tr(c)?!1:(Mo=c.toCopyData(),No=c.workspace instanceof ns?c.workspace:n,cn=Xo(c)?c.getRelativeToSurfaceXY():null,!!Mo)},keyCodes:[e,t,o]})},zd=function(){const e=He.registry.createSerializedKey(Ae.X,[Ae.CTRL]),t=He.registry.createSerializedKey(Ae.X,[Ae.ALT]),o=He.registry.createSerializedKey(Ae.X,[Ae.META]);He.registry.register({name:Hs.CUT,preconditionFn(n){const c=I();return!n.options.readOnly&&!co.inProgress()&&c!=null&&ls(c)&&c.isDeletable()&&Xo(c)&&c.isMovable()&&!c.workspace.isFlyout},callback(n){const c=I();return c instanceof gs?(Mo=c.toCopyData(),No=n,cn=c.getRelativeToSurfaceXY(),c.checkAndDelete(),!0):ls(c)&&c.isDeletable()&&tr(c)?(Mo=c.toCopyData(),No=n,cn=Xo(c)?c.getRelativeToSurfaceXY():null,c.dispose(),!0):!1},keyCodes:[e,t,o]})},Ud=function(){const e=He.registry.createSerializedKey(Ae.V,[Ae.CTRL]),t=He.registry.createSerializedKey(Ae.V,[Ae.ALT]),o=He.registry.createSerializedKey(Ae.V,[Ae.META]);He.registry.register({name:Hs.PASTE,preconditionFn(n){return!n.options.readOnly&&!co.inProgress()},callback(){if(!Mo||!No)return!1;if(!cn)return!!To(Mo,No);const{left:n,top:c,width:h,height:$}=No.getMetricsManager().getViewMetrics(!0);if(new qe(c,c+$,n,n+h).contains(cn.x,cn.y))return!!To(Mo,No);const T=new V(n+h/2,c+$/2);return!!To(Mo,No,T)},keyCodes:[e,t,o]})},Hd=function(){const e=He.registry.createSerializedKey(Ae.Z,[Ae.CTRL]),t=He.registry.createSerializedKey(Ae.Z,[Ae.ALT]),o=He.registry.createSerializedKey(Ae.Z,[Ae.META]);He.registry.register({name:Hs.UNDO,preconditionFn(n){return!n.options.readOnly&&!co.inProgress()},callback(n,c){return n.hideChaff(),n.undo(!1),c.preventDefault(),!0},keyCodes:[e,t,o]})},Wd=function(){const e=He.registry.createSerializedKey(Ae.Z,[Ae.SHIFT,Ae.CTRL]),t=He.registry.createSerializedKey(Ae.Z,[Ae.SHIFT,Ae.ALT]),o=He.registry.createSerializedKey(Ae.Z,[Ae.SHIFT,Ae.META]),n=He.registry.createSerializedKey(Ae.Y,[Ae.CTRL]);He.registry.register({name:Hs.REDO,preconditionFn(c){return!co.inProgress()&&!c.options.readOnly},callback(c,h){return c.hideChaff(),c.undo(!0),h.preventDefault(),!0},keyCodes:[e,t,o,n]})},Vd=function(){Bd(),jd(),Fd(),zd(),Ud(),Hd(),Wd()},Gd=function(e){const t=e.saveState();return e.getParameters().length&&(t.parameters=e.getParameters().map(o=>o.saveState())),t},Kd=function(e,t,o,n){if(e=e.loadState(o,n),!o.parameters)return e;for(const[c,h]of o.parameters.entries())e.insertParameter(t.loadState(h,n),c);return e},K$=function(e){const t=Object.create(null),o=v(F.SERIALIZER,!0);for(const n in o){let c;const h=(c=o[n])==null?void 0:c.save(e);h&&(t[n]=h)}return t},Y$=function(e,t,{recordUndo:o=!1}={}){var n=v(F.SERIALIZER,!0);if(n){n=Object.entries(n).sort((h,$)=>$[1].priority-h[1].priority);var c=me();i.setRecordUndo$$module$build$src$core$events$utils(o),(o=i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),Ho(),t instanceof ns&&t.setResizesEnabled(!1);for(const[,h]of n.reverse()){let $;($=h)==null||$.clear(t)}for(const[h,$]of n.reverse())if(e[h]){let T;(T=$)==null||T.load(e[h],t)}t instanceof ns&&t.setResizesEnabled(!0),Wo(),z(new(G(O.FINISHED_LOADING))(t)),i.setGroup$$module$build$src$core$events$utils(o),i.setRecordUndo$$module$build$src$core$events$utils(c)}},J$=function(e,t){let o=null;o=typeof e=="string"?document.getElementById(e)||document.querySelector(e):e;var n;if(!document.contains(o)&&document!==((n=o)==null?void 0:n.ownerDocument))throw Error("Error: container is not in current document");e=new ds(t||{}),n=document.createElement("div"),ge(n,"injectionDiv"),t!=null&&t.rtl&&ge(n,"blocklyRTL"),n.tabIndex=0,It(n,Ct.LABEL,i.Msg$$module$build$src$core$msg.WORKSPACE_ARIA_LABEL),o.appendChild(n),t=q$(n,e);const c=X$(n,t,e);return Z$(c),re(c),Ce(c),n.addEventListener("focusin",function(){re(c)}),X(n,"keydown",null,Za),X(Wn(),"keydown",null,Za),(t=Yo())&&X(t,"keydown",null,Za),c},q$=function(e,t){e.setAttribute("dir","LTR"),cu(t.hasCss,t.pathToMedia),e=N(x.SVG,{xmlns:rr,"xmlns:html":Fs,"xmlns:xlink":es,version:"1.1",class:"blocklySvg",tabindex:"0"},e);const o=N(x.DEFS,{},e),n=String(Math.random()).substring(2);return t.gridPattern=ep.createDom(n,t.gridOptions,o),e},X$=function(e,t,o){o.parentWorkspace=null,o=new ns(o);const n=o.options;o.scale=n.zoomOptions.startScale,t.appendChild(o.createDom("blocklyMainBackground",e));var c=o.getRenderer().getClassName();return c&&ge(e,c),(c=o.getTheme().getClassName())&&ge(e,c),!n.hasCategories&&n.languageTree&&(e=o.addFlyout(x.SVG),Uo(e,t)),n.hasTrashcan&&o.addTrashcan(),n.zoomOptions&&n.zoomOptions.controls&&o.addZoomControls(),o.getThemeManager().subscribe(t,"workspaceBackgroundColour","background-color"),o.translate(0,0),o.addChangeListener(Ld(o)),Ce(o),id(),Au(),Ju(),o},Z$=function(e){const t=e.options;var o=e.getParentSvg();if(X(o.parentNode,"contextmenu",null,function(n){kt(n)||n.preventDefault()}),o=X(window,"resize",null,function(){to(),e.hideComponents(!0),Wu(),ld(),Ce(e),Xa(e)}),e.setResizeHandlerWrapper(o),Q$(),t.languageTree){o=e.getToolbox();const n=e.getFlyout(!0);o?o.init():n&&(n.init(e),n.show(t.languageTree),typeof n.scrollToStart=="function"&&n.scrollToStart())}t.hasTrashcan&&e.trashcan.init(),t.zoomOptions&&t.zoomOptions.controls&&e.zoomControls_.init(),t.moveOptions&&t.moveOptions.scrollbars?(e.scrollbar=new Ep(e,t.moveOptions.scrollbars===!0||!!t.moveOptions.scrollbars.horizontal,t.moveOptions.scrollbars===!0||!!t.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),e.scrollbar.resize()):e.setMetrics({x:.5,y:.5}),t.hasSounds&&eb(t.pathToMedia,e)},Za=function(e){const t=U();t&&!(kt(e)||t.rendered&&!t.isVisible())&&He.registry.onKeyDown(t,e)},Q$=function(){oy||(X(document,"scroll",null,function(){const e=ee();for(let t=0,o;o=e[t];t++)o instanceof ns&&o.updateInverseScreenCTM()}),ct(document,"touchend",null,_e),ct(document,"touchcancel",null,_e)),oy=!0},eb=function(e,t){function o(){for(;c.length;){const h=c.pop();h&&ze(h)}n.preload()}const n=t.getAudioManager();n.load([e+"click.mp3",e+"click.wav",e+"click.ogg"],"click"),n.load([e+"disconnect.wav",e+"disconnect.mp3",e+"disconnect.ogg"],"disconnect"),n.load([e+"delete.mp3",e+"delete.ogg",e+"delete.wav"],"delete");const c=[];c.push(X(document,"pointermove",null,o,!0)),c.push(X(document,"touchstart",null,o,!0))},Yd=function(){xe.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.UNDO},preconditionFn(e){return 0<e.workspace.getUndoStack().length?"enabled":"disabled"},callback(e){e.workspace.undo(!1)},scopeType:xe.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1})},Jd=function(){xe.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.REDO},preconditionFn(e){return 0<e.workspace.getRedoStack().length?"enabled":"disabled"},callback(e){e.workspace.undo(!0)},scopeType:xe.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2})},qd=function(){xe.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.CLEAN_UP},preconditionFn(e){return e.workspace.isMovable()?1<e.workspace.getTopBlocks(!1).length?"enabled":"disabled":"hidden"},callback(e){e.workspace.cleanUp()},scopeType:xe.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3})},Xd=function(e,t){function o(h){c--,h.setCollapsed(e),c===0&&i.setGroup$$module$build$src$core$events$utils(!1)}let n=0,c=0;i.setGroup$$module$build$src$core$events$utils(!0);for(let h=0;h<t.length;h++){let $=t[h];for(;$;)c++,setTimeout(o.bind(null,$),n),$=$.getNextBlock(),n+=10}},Zd=function(){xe.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.COLLAPSE_ALL},preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;t<e.length;t++){let o=e[t];for(;o;){if(!o.isCollapsed())return"enabled";o=o.getNextBlock()}}return"disabled"}return"hidden"},callback(e){Xd(!0,e.workspace.getTopBlocks(!0))},scopeType:xe.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})},Qd=function(){xe.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.EXPAND_ALL},preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;t<e.length;t++){let o=e[t];for(;o;){if(o.isCollapsed())return"enabled";o=o.getNextBlock()}}return"disabled"}return"hidden"},callback(e){Xd(!1,e.workspace.getTopBlocks(!0))},scopeType:xe.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})},eh=function(e,t){if(e.isDeletable())Array.prototype.push.apply(t,e.getDescendants(!1));else{e=e.getChildren(!1);for(let o=0;o<e.length;o++)eh(e[o],t)}},Qa=function(e){const t=[];e=e.getTopBlocks(!0);for(let o=0;o<e.length;o++)eh(e[o],t);return t},sr=function(e,t){t?i.setGroup$$module$build$src$core$events$utils(t):(i.setGroup$$module$build$src$core$events$utils(!0),t=i.getGroup$$module$build$src$core$events$utils());const o=e.shift();o&&(o.isDeadOrDying()?sr(e,t):(o.dispose(!1,!0),setTimeout(sr,10,e,t))),i.setGroup$$module$build$src$core$events$utils(!1)},th=function(){xe.registry.register({displayText(e){return e.workspace?(e=Qa(e.workspace).length,e===1?i.Msg$$module$build$src$core$msg.DELETE_BLOCK:i.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`)):""},preconditionFn(e){return e.workspace&&0<Qa(e.workspace).length?"enabled":"disabled"},callback(e){if(e.workspace){e.workspace.cancelCurrentGesture();var t=Qa(e.workspace);2>t.length?sr(t):Ca(i.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),function(o){o&&sr(t)})}},scopeType:xe.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},tb=function(){Yd(),Jd(),qd(),Zd(),Qd(),th()},sh=function(){xe.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.DUPLICATE_BLOCK},preconditionFn(e){return e=e.block,!e.isInFlyout&&e.isDeletable()&&e.isMovable()?e.isDuplicatable()?"enabled":"disabled":"hidden"},callback(e){if(e.block){var t=e.block.toCopyData();t&&To(t,e.block.workspace)}},scopeType:xe.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},oh=function(){xe.registry.register({displayText(e){return e.block.hasIcon(po.TYPE)?i.Msg$$module$build$src$core$msg.REMOVE_COMMENT:i.Msg$$module$build$src$core$msg.ADD_COMMENT},preconditionFn(e){return e=e.block,!e.isInFlyout&&e.workspace.options.comments&&!e.isCollapsed()&&e.isEditable()?"enabled":"hidden"},callback(e){e=e.block,e.hasIcon(po.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:xe.ScopeType.BLOCK,id:"blockComment",weight:2})},ih=function(){xe.registry.register({displayText(e){return e.block.getInputsInline()?i.Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:i.Msg$$module$build$src$core$msg.INLINE_INPUTS},preconditionFn(e){if(e=e.block,!e.isInFlyout&&e.isMovable()&&!e.isCollapsed()){for(let t=1;t<e.inputList.length;t++)if(!(e.inputList[t-1]instanceof Vl||e.inputList[t]instanceof Vl))return"enabled"}return"hidden"},callback(e){e.block.setInputsInline(!e.block.getInputsInline())},scopeType:xe.ScopeType.BLOCK,id:"blockInline",weight:3})},nh=function(){xe.registry.register({displayText(e){return e.block.isCollapsed()?i.Msg$$module$build$src$core$msg.EXPAND_BLOCK:i.Msg$$module$build$src$core$msg.COLLAPSE_BLOCK},preconditionFn(e){return e=e.block,!e.isInFlyout&&e.isMovable()&&e.workspace.options.collapse?"enabled":"hidden"},callback(e){e.block.setCollapsed(!e.block.isCollapsed())},scopeType:xe.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},rh=function(){xe.registry.register({displayText(e){return e.block.hasDisabledReason(Ft)?i.Msg$$module$build$src$core$msg.ENABLE_BLOCK:i.Msg$$module$build$src$core$msg.DISABLE_BLOCK},preconditionFn(e){if(e=e.block,!e.isInFlyout&&e.workspace.options.disable&&e.isEditable()){var t=e.getDisabledReasons();return t=t.size>(t.has(Ft)?1:0),e.getInheritedDisabled()||t?"disabled":"enabled"}return"hidden"},callback(e){e=e.block;const t=i.getGroup$$module$build$src$core$events$utils();t||i.setGroup$$module$build$src$core$events$utils(!0),e.setDisabledReason(!e.hasDisabledReason(Ft),Ft),i.setGroup$$module$build$src$core$events$utils(t)},scopeType:xe.ScopeType.BLOCK,id:"blockDisable",weight:5})},ah=function(){xe.registry.register({displayText(e){var t=e.block;return e=t.getDescendants(!1).length,(t=t.getNextBlock())&&(e-=t.getDescendants(!1).length),e===1?i.Msg$$module$build$src$core$msg.DELETE_BLOCK:i.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`)},preconditionFn(e){return!e.block.isInFlyout&&e.block.isDeletable()?"enabled":"hidden"},callback(e){e.block&&e.block.checkAndDelete()},scopeType:xe.ScopeType.BLOCK,id:"blockDelete",weight:6})},lh=function(){xe.registry.register({displayText(){return i.Msg$$module$build$src$core$msg.HELP},preconditionFn(e){return e=e.block,(typeof e.helpUrl=="function"?e.helpUrl():e.helpUrl)?"enabled":"hidden"},callback(e){e.block.showHelp()},scopeType:xe.ScopeType.BLOCK,id:"blockHelp",weight:7})},ch=function(){xe.registry.register({displayText:()=>i.Msg$$module$build$src$core$msg.REMOVE_COMMENT,preconditionFn(e){let t;return(t=e.comment)!=null&&t.isDeletable()?"enabled":"hidden"},callback(e){i.setGroup$$module$build$src$core$events$utils(!0);let t;(t=e.comment)==null||t.dispose(),i.setGroup$$module$build$src$core$events$utils(!1)},scopeType:xe.ScopeType.COMMENT,id:"commentDelete",weight:6})},uh=function(){xe.registry.register({displayText:()=>i.Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,preconditionFn(e){let t;return(t=e.comment)!=null&&t.isMovable()?"enabled":"hidden"},callback(e){if(e.comment){var t=e.comment.toCopyData();t&&To(t,e.comment.workspace)}},scopeType:xe.ScopeType.COMMENT,id:"commentDuplicate",weight:1})},dh=function(){xe.registry.register({displayText:()=>i.Msg$$module$build$src$core$msg.ADD_COMMENT,preconditionFn:e=>{let t;return(t=e.workspace)!=null&&t.isMutator?"hidden":"enabled"},callback:(e,t)=>{if(e=e.workspace){i.setGroup$$module$build$src$core$events$utils(!0);var o=new kl(e);o.setText(i.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT),o.moveTo(sb(new V(t.clientX,t.clientY),e)),i.setSelected$$module$build$src$core$common(o),i.setGroup$$module$build$src$core$events$utils(!1)}},scopeType:xe.ScopeType.WORKSPACE,id:"commentCreate",weight:8})},sb=function(e,t){var o=t.getInjectionDiv().getBoundingClientRect();return e=new V(e.x-o.left,e.y-o.top),o=t.getOriginOffsetInPixels(),e=V.difference(e,o),e.scale(1/t.scale),e},ob=function(){sh(),oh(),ih(),nh(),rh(),ah(),lh()},ib=function(){uh(),ch(),dh()},hh=function(){tb(),ob()},nb=function(e){return e.paste!==void 0},rb=function(e){return e.getSvgRoot!==void 0},ab=function(e){return typeof e.id=="string"&&e.workspace!==void 0&&e.select!==void 0&&e.unselect!==void 0},lb=function(e){return e.isSelectable()},cb=function(e){U().hideChaff(e)},j=j||{},j.scope={},j.ASSUME_ES5=!1,j.ASSUME_NO_NATIVE_MAP=!1,j.ASSUME_NO_NATIVE_SET=!1,j.SIMPLE_FROUND_POLYFILL=!1,j.ISOLATE_POLYFILLS=!1,j.FORCE_POLYFILL_PROMISE=!1,j.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,j.defineProperty=j.ASSUME_ES5||typeof Object.defineProperties=="function"?Object.defineProperty:function(e,t,o){return e==Array.prototype||e==Object.prototype||(e[t]=o.value),e},j.getGlobal=function(e){e=[typeof globalThis=="object"&&globalThis,e,typeof window=="object"&&window,typeof self=="object"&&self,typeof wn=="object"&&wn];for(var t=0;t<e.length;++t){var o=e[t];if(o&&o.Math==Math)return o}throw Error("Cannot find global object")},j.global=j.getGlobal(this),j.IS_SYMBOL_NATIVE=typeof Symbol=="function"&&typeof Symbol("x")=="symbol",j.TRUST_ES6_POLYFILLS=!j.ISOLATE_POLYFILLS||j.IS_SYMBOL_NATIVE,j.polyfills={},j.propertyToPolyfillSymbol={},j.POLYFILL_PREFIX="$jscp$",j.polyfill=function(e,t,o,n){t&&(j.ISOLATE_POLYFILLS?j.polyfillIsolated(e,t,o,n):j.polyfillUnisolated(e,t,o,n))},j.polyfillUnisolated=function(e,t,o,n){for(o=j.global,e=e.split("."),n=0;n<e.length-1;n++){var c=e[n];if(!(c in o))return;o=o[c]}e=e[e.length-1],n=o[e],t=t(n),t!=n&&t!=null&&j.defineProperty(o,e,{configurable:!0,writable:!0,value:t})},j.polyfillIsolated=function(e,t,o,n){var c=e.split(".");e=c.length===1,n=c[0],n=!e&&n in j.polyfills?j.polyfills:j.global;for(var h=0;h<c.length-1;h++){var $=c[h];if(!($ in n))return;n=n[$]}c=c[c.length-1],o=j.IS_SYMBOL_NATIVE&&o==="es6"?n[c]:null,t=t(o),t!=null&&(e?j.defineProperty(j.polyfills,c,{configurable:!0,writable:!0,value:t}):t!==o&&(j.propertyToPolyfillSymbol[c]===void 0&&(o=1e9*Math.random()>>>0,j.propertyToPolyfillSymbol[c]=j.IS_SYMBOL_NATIVE?j.global.Symbol(c):j.POLYFILL_PREFIX+o+"$"+c),j.defineProperty(n,j.propertyToPolyfillSymbol[c],{configurable:!0,writable:!0,value:t})))},j.underscoreProtoCanBeSet=function(){var e={a:!0},t={};try{return t.__proto__=e,t.a}catch{}return!1},j.setPrototypeOf=j.TRUST_ES6_POLYFILLS&&typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf:j.underscoreProtoCanBeSet()?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null,j.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}},j.arrayIterator=function(e){return{next:j.arrayIteratorImpl(e)}},j.makeIterator=function(e){var t=typeof Symbol<"u"&&Symbol.iterator&&e[Symbol.iterator];if(t)return t.call(e);if(typeof e.length=="number")return j.arrayIterator(e);throw Error(String(e)+" is not an iterable or ArrayLike")},j.generator={},j.generator.ensureIteratorResultIsObject_=function(e){if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object")},j.generator.Context=function(){this.isRunning_=!1,this.yieldAllIterator_=null,this.yieldResult=void 0,this.nextAddress=1,this.finallyAddress_=this.catchAddress_=0,this.finallyContexts_=this.abruptCompletion_=null},j.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0},j.generator.Context.prototype.stop_=function(){this.isRunning_=!1},j.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_},j.generator.Context.prototype.next_=function(e){this.yieldResult=e},j.generator.Context.prototype.throw_=function(e){this.abruptCompletion_={exception:e,isException:!0},this.jumpToErrorHandler_()},j.generator.Context.prototype.return=function(e){this.abruptCompletion_={return:e},this.nextAddress=this.finallyAddress_},j.generator.Context.prototype.jumpThroughFinallyBlocks=function(e){this.abruptCompletion_={jumpTo:e},this.nextAddress=this.finallyAddress_},j.generator.Context.prototype.yield=function(e,t){return this.nextAddress=t,{value:e}},j.generator.Context.prototype.yieldAll=function(e,t){e=j.makeIterator(e);var o=e.next();if(j.generator.ensureIteratorResultIsObject_(o),o.done)this.yieldResult=o.value,this.nextAddress=t;else return this.yieldAllIterator_=e,this.yield(o.value,t)},j.generator.Context.prototype.jumpTo=function(e){this.nextAddress=e},j.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0},j.generator.Context.prototype.setCatchFinallyBlocks=function(e,t){this.catchAddress_=e,t!=null&&(this.finallyAddress_=t)},j.generator.Context.prototype.setFinallyBlock=function(e){this.catchAddress_=0,this.finallyAddress_=e||0},j.generator.Context.prototype.leaveTryBlock=function(e,t){this.nextAddress=e,this.catchAddress_=t||0},j.generator.Context.prototype.enterCatchBlock=function(e){return this.catchAddress_=e||0,e=this.abruptCompletion_.exception,this.abruptCompletion_=null,e},j.generator.Context.prototype.enterFinallyBlock=function(e,t,o){o?this.finallyContexts_[o]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_],this.catchAddress_=e||0,this.finallyAddress_=t||0},j.generator.Context.prototype.leaveFinallyBlock=function(e,t){if(t=this.finallyContexts_.splice(t||0)[0],t=this.abruptCompletion_=this.abruptCompletion_||t){if(t.isException)return this.jumpToErrorHandler_();t.jumpTo!=null&&this.finallyAddress_<t.jumpTo?(this.nextAddress=t.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=e},j.generator.Context.prototype.forIn=function(e){return new j.generator.Context.PropertyIterator(e)},j.generator.Context.PropertyIterator=function(e){this.object_=e,this.properties_=[];for(var t in e)this.properties_.push(t);this.properties_.reverse()},j.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var e=this.properties_.pop();if(e in this.object_)return e}return null},j.generator.Engine_=function(e){this.context_=new j.generator.Context,this.program_=e},j.generator.Engine_.prototype.next_=function(e){return this.context_.start_(),this.context_.yieldAllIterator_?this.yieldAllStep_(this.context_.yieldAllIterator_.next,e,this.context_.next_):(this.context_.next_(e),this.nextStep_())},j.generator.Engine_.prototype.return_=function(e){this.context_.start_();var t=this.context_.yieldAllIterator_;return t?this.yieldAllStep_("return"in t?t.return:function(o){return{value:o,done:!0}},e,this.context_.return):(this.context_.return(e),this.nextStep_())},j.generator.Engine_.prototype.throw_=function(e){return this.context_.start_(),this.context_.yieldAllIterator_?this.yieldAllStep_(this.context_.yieldAllIterator_.throw,e,this.context_.next_):(this.context_.throw_(e),this.nextStep_())},j.generator.Engine_.prototype.yieldAllStep_=function(e,t,o){try{var n=e.call(this.context_.yieldAllIterator_,t);if(j.generator.ensureIteratorResultIsObject_(n),!n.done)return this.context_.stop_(),n;var c=n.value}catch(h){return this.context_.yieldAllIterator_=null,this.context_.throw_(h),this.nextStep_()}return this.context_.yieldAllIterator_=null,o.call(this.context_,c),this.nextStep_()},j.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var e=this.program_(this.context_);if(e)return this.context_.stop_(),{value:e.value,done:!1}}catch(t){this.context_.yieldResult=void 0,this.context_.throw_(t)}if(this.context_.stop_(),this.context_.abruptCompletion_){if(e=this.context_.abruptCompletion_,this.context_.abruptCompletion_=null,e.isException)throw e.exception;return{value:e.return,done:!0}}return{value:void 0,done:!0}},j.generator.Generator_=function(e){this.next=function(t){return e.next_(t)},this.throw=function(t){return e.throw_(t)},this.return=function(t){return e.return_(t)},this[Symbol.iterator]=function(){return this}},j.generator.createGenerator=function(e,t){return t=new j.generator.Generator_(new j.generator.Engine_(t)),j.setPrototypeOf&&e.prototype&&j.setPrototypeOf(t,e.prototype),t},j.asyncExecutePromiseGenerator=function(e){function t(n){return e.next(n)}function o(n){return e.throw(n)}return new Promise(function(n,c){function h($){$.done?n($.value):Promise.resolve($.value).then(t,o).then(h,c)}h(e.next())})},j.asyncExecutePromiseGeneratorFunction=function(e){return j.asyncExecutePromiseGenerator(e())},j.asyncExecutePromiseGeneratorProgram=function(e){return j.asyncExecutePromiseGenerator(new j.generator.Generator_(new j.generator.Engine_(e)))},j.polyfill("globalThis",function(e){return e||j.global},"es_2020","es3"),j.polyfill("Array.prototype.includes",function(e){return e||function(t,o){var n=this;n instanceof String&&(n=String(n));var c=n.length;for(o=o||0,0>o&&(o=Math.max(o+c,0));o<c;o++){var h=n[o];if(h===t||Object.is(h,t))return!0}return!1}},"es7","es3"),j.initSymbol=function(){},j.iteratorPrototype=function(e){return e={next:e},e[Symbol.iterator]=function(){return this},e},j.iteratorFromArray=function(e,t){e instanceof String&&(e+="");var o=0,n=!1,c={next:function(){if(!n&&o<e.length){var h=o++;return{value:t(h,e[h]),done:!1}}return n=!0,{done:!0,value:void 0}}};return c[Symbol.iterator]=function(){return c},c},j.polyfill("Array.prototype.values",function(e){return e||function(){return j.iteratorFromArray(this,function(t,o){return o})}},"es8","es3"),j.polyfill("Array.prototype.flat",function(e){return e||function(t){t=t===void 0?1:t;var o=[];return Array.prototype.forEach.call(this,function(n){Array.isArray(n)&&0<t?(n=Array.prototype.flat.call(n,t-1),o.push.apply(o,n)):o.push(n)}),o}},"es9","es5"),j.polyfill("Array.prototype.flatMap",function(e){return e||function(t,o){var n=[];return Array.prototype.forEach.call(this,function(c,h){c=t.call(o,c,h,this),Array.isArray(c)?n.push.apply(n,c):n.push(c)}),n}},"es9","es5"),j.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},j.polyfill("Object.entries",function(e){return e||function(t){var o=[],n;for(n in t)j.owns(t,n)&&o.push([n,t[n]]);return o}},"es8","es3"),j.polyfill("Object.values",function(e){return e||function(t){var o=[],n;for(n in t)j.owns(t,n)&&o.push(t[n]);return o}},"es8","es3");var ko=Object.create(null),RT={typeMap:ko},el=Object.create(null),js="default",F=class{constructor(e){this.name=e}toString(){return this.name}};F.CONNECTION_CHECKER=new F("connectionChecker"),F.CONNECTION_PREVIEWER=new F("connectionPreviewer"),F.CURSOR=new F("cursor"),F.EVENT=new F("event"),F.FIELD=new F("field"),F.INPUT=new F("input"),F.RENDERER=new F("renderer"),F.TOOLBOX=new F("toolbox"),F.THEME=new F("theme"),F.TOOLBOX_ITEM=new F("toolboxItem"),F.FLYOUTS_VERTICAL_TOOLBOX=new F("flyoutsVerticalToolbox"),F.FLYOUTS_HORIZONTAL_TOOLBOX=new F("flyoutsHorizontalToolbox"),F.METRICS_MANAGER=new F("metricsManager"),F.BLOCK_DRAGGER=new F("blockDragger"),F.SERIALIZER=new F("serializer"),F.ICON=new F("icon"),F.PASTER=new F("paster");var oo={DEFAULT:js,TEST_ONLY:RT};oo.Type=F,oo.getAllItems=v,oo.getClass=m,oo.getClassFromOptions=_,oo.getObject=f,oo.hasItem=p,oo.register=r,oo.unregister=u;var Jt=Object.create(null),O;(function(e){e.BLOCK_CREATE="create",e.BLOCK_DELETE="delete",e.BLOCK_CHANGE="change",e.BLOCK_FIELD_INTERMEDIATE_CHANGE="block_field_intermediate_change",e.BLOCK_MOVE="move",e.VAR_CREATE="var_create",e.VAR_DELETE="var_delete",e.VAR_RENAME="var_rename",e.UI="ui",e.BLOCK_DRAG="drag",e.SELECTED="selected",e.CLICK="click",e.MARKER_MOVE="marker_move",e.BUBBLE_OPEN="bubble_open",e.TRASHCAN_OPEN="trashcan_open",e.TOOLBOX_ITEM_SELECT="toolbox_item_select",e.THEME_CHANGE="theme_change",e.VIEWPORT_CHANGE="viewport_change",e.COMMENT_CREATE="comment_create",e.COMMENT_DELETE="comment_delete",e.COMMENT_CHANGE="comment_change",e.COMMENT_MOVE="comment_move",e.COMMENT_RESIZE="comment_resize",e.COMMENT_DRAG="comment_drag",e.COMMENT_COLLAPSE="comment_collapse",e.FINISHED_LOADING="finished_loading"})(O||(O={}));var ub=[O.BLOCK_CREATE,O.BLOCK_MOVE,O.COMMENT_CREATE,O.COMMENT_MOVE],db=new Set,hb={};hb.warn=y;var pb="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",gb={genUid:()=>{const e=pb.length,t=[];for(let o=0;20>o;o++)t[o]=pb.charAt(Math.random()*e);return t.join("")}},OT=0,ph={TEST_ONLY:gb};ph.genUid=C,ph.getNextUniqueId=k;var mb="",or=!0,gh=0,mh="ORPHANED_BLOCK",io=[],fb={FIRE_QUEUE:io,enqueueEvent:Ze,fireNow:Ne,fireInternal:Oe,setGroupInternal:ye};i.disable$$module$build$src$core$events$utils,i.enable$$module$build$src$core$events$utils,i.getGroup$$module$build$src$core$events$utils,i.setGroup$$module$build$src$core$events$utils,i.setRecordUndo$$module$build$src$core$events$utils;var ir=Object.create(null),$b,Zo=null,bb,nr=[],vb={defineBlocksWithJsonArrayInternal:Ge},Dt={TEST_ONLY:vb};Dt.createBlockDefinitionsFromJsonArray=i.createBlockDefinitionsFromJsonArray$$module$build$src$core$common,Dt.defineBlocks=i.defineBlocks$$module$build$src$core$common,Dt.defineBlocksWithJsonArray=pe,Dt.draggingConnections=nr,Dt.getAllWorkspaces=ee,Dt.getBlockTypeCounts=be,Dt.getMainWorkspace=U,Dt.getParentContainer=de,Dt.getSelected=I,Dt.getWorkspaceById=q,Dt.registerWorkspace=B,Dt.setMainWorkspace=re,Dt.setParentContainer=W,Dt.setSelected=i.setSelected$$module$build$src$core$common,Dt.svgResize=Ce,Dt.unregisterWorkpace=H;var Ui=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=i.getGroup$$module$build$src$core$events$utils(),this.recordUndo=me()}toJson(){return{type:this.type,group:this.group}}static fromJson(e,t,o){return o.isBlank=!1,o.group=e.group||"",o.workspaceId=t.id,o}isNull(){return!1}run(e){}getEventWorkspace_(){let e;if(this.workspaceId&&(e=q(this.workspaceId)),!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e}},Cs=class extends Ui{constructor(e){super(),this.recordUndo=!1,this.isUiEvent=!0,this.isBlank=typeof e>"u",this.workspaceId=e||""}},fh=class extends Cs{constructor(e,t,o){t=e?e.workspace.id:t,t===null&&(t=void 0),super(t),this.type=O.CLICK,this.blockId=e?e.id:void 0,this.targetType=o}toJson(){const e=super.toJson();if(!this.targetType)throw Error("The click target type is undefined. Either pass a block to the constructor, or call fromJson");return e.targetType=this.targetType,e.blockId=this.blockId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new fh),t.targetType=e.targetType,t.blockId=e.blockId,t}},$h;(function(e){e.BLOCK="block",e.WORKSPACE="workspace",e.ZOOM_CONTROLS="zoom_controls"})($h||($h={})),r(F.EVENT,O.CLICK,fh);var MT=750,yb="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),tl=null,Qo={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},sl=0,ei={TOUCH_ENABLED:yb,TOUCH_MAP:Qo};ei.checkTouchIdentifier=bt,ei.clearTouchIdentifier=ke,ei.getTouchIdentifierFromEvent=Pe,ei.longStart=Je,ei.longStop=_e,ei.shouldHandleEvent=$e;var bh,_b,wb,Cb,ol,il,vh,Tb,kb,Sb;(function(e){function t(n){return o.includes(n.toUpperCase())}bh=e;const o=bh.toUpperCase();_b=t("JavaFX"),wb=t("WebKit"),Cb=t("Gecko")&&!wb,ol=t("Android"),e=globalThis.navigator&&globalThis.navigator.maxTouchPoints,il=t("iPad")||t("Macintosh")&&0<e,vh=t("iPhone")&&!il,Tb=t("Macintosh"),kb=il||ol&&!t("Mobile")||t("Silk"),Sb=!kb&&(vh||ol)})(globalThis.navigator&&globalThis.navigator.userAgent||"");var NT=bh,Eb=_b,Ib=Cb,yh=ol,nl=il,xb=vh,_h=Tb,Db=Sb,LT={ANDROID:yh,GECKO:Ib,IPAD:nl,IPHONE:xb,JavaFx:Eb,MAC:_h,MOBILE:Db,raw:NT},Ab=40,Rb=125,no={};no.bind=ct,no.conditionalBind=X,no.getScrollDeltaPixels=Zs,no.isRightButton=ve,no.isTargetInput=kt,no.mouseToSvg=st,no.unbind=ze;var Ob={};Ob.removeElem=St;var ro=class{constructor(e){this.name=e}toString(){return this.name}};ro.POSITIONABLE=new ro("positionable"),ro.DRAG_TARGET=new ro("drag_target"),ro.DELETE_AREA=new ro("delete_area"),ro.AUTOHIDEABLE=new ro("autohideable");var lt=class{constructor(){this.componentData=new Map,this.capabilityToComponentIds=new Map}addComponent(e,t){const o=e.component.id;if(!t&&this.componentData.has(o)){var n;throw Error('Plugin "'+o+'" with capabilities "'+((n=this.componentData.get(o))==null?void 0:n.capabilities)+'" already added.')}for(this.componentData.set(o,e),t=[],n=0;n<e.capabilities.length;n++){const c=String(e.capabilities[n]).toLowerCase();if(t.push(c),this.capabilityToComponentIds.has(c)){let h;(h=this.capabilityToComponentIds.get(c))==null||h.push(o)}else this.capabilityToComponentIds.set(c,[o])}this.componentData.get(o).capabilities=t}removeComponent(e){const t=this.componentData.get(e);if(t){for(let o=0;o<t.capabilities.length;o++){const n=String(t.capabilities[o]).toLowerCase();St(this.capabilityToComponentIds.get(n),e)}this.componentData.delete(e)}}addCapability(e,t){if(!this.getComponent(e))throw Error('Cannot add capability, "'+t+'". Plugin "'+e+'" has not been added to the ComponentManager');if(this.hasCapability(e,t))console.warn('Plugin "'+e+'already has capability "'+t+'"');else{t=`${t}`.toLowerCase();var o;(o=this.componentData.get(e))==null||o.capabilities.push(t);var n;(n=this.capabilityToComponentIds.get(t))==null||n.push(e)}}removeCapability(e,t){if(!this.getComponent(e))throw Error('Cannot remove capability, "'+t+'". Plugin "'+e+'" has not been added to the ComponentManager');this.hasCapability(e,t)?(t=`${t}`.toLowerCase(),St(this.componentData.get(e).capabilities,t),St(this.capabilityToComponentIds.get(t),e)):console.warn('Plugin "'+e+`doesn't have capability "`+t+'" to remove')}hasCapability(e,t){return t=`${t}`.toLowerCase(),this.componentData.has(e)&&this.componentData.get(e).capabilities.includes(t)}getComponent(e){let t;return(t=this.componentData.get(e))==null?void 0:t.component}getComponents(e,t){if(e=`${e}`.toLowerCase(),e=this.capabilityToComponentIds.get(e),!e)return[];const o=[];if(t){const n=[];e.forEach(c=>{n.push(this.componentData.get(c))}),n.sort(function(c,h){return c.weight-h.weight}),n.forEach(function(c){o.push(c.component)})}else e.forEach(n=>{o.push(this.componentData.get(n).component)});return o}};lt.Capability=ro,(function(e){e=e.ComponentWeight||(e.ComponentWeight={}),e[e.TOOLBOX_WEIGHT=0]="TOOLBOX_WEIGHT",e[e.FLYOUT_WEIGHT=1]="FLYOUT_WEIGHT",e[e.TRASHCAN_WEIGHT=2]="TRASHCAN_WEIGHT",e[e.ZOOM_CONTROLS_WEIGHT=3]="ZOOM_CONTROLS_WEIGHT"})(lt||(lt={})),lt.ComponentWeight;var wh=!1,Ch=`
283
+ .blocklySvg {
284
+ background-color: #fff;
285
+ outline: none;
286
+ overflow: hidden; /* IE overflows by default. */
287
+ position: absolute;
288
+ display: block;
289
+ }
290
+
291
+ .blocklyWidgetDiv {
292
+ display: none;
293
+ position: absolute;
294
+ z-index: 99999; /* big value for bootstrap3 compatibility */
295
+ }
296
+
297
+ .injectionDiv {
298
+ height: 100%;
299
+ position: relative;
300
+ overflow: hidden; /* So blocks in drag surface disappear at edges */
301
+ touch-action: none;
302
+ user-select: none;
303
+ -webkit-user-select: none;
304
+ }
305
+
306
+ .blocklyNonSelectable {
307
+ user-select: none;
308
+ -ms-user-select: none;
309
+ -webkit-user-select: none;
310
+ }
311
+
312
+ .blocklyBlockCanvas.blocklyCanvasTransitioning,
313
+ .blocklyBubbleCanvas.blocklyCanvasTransitioning {
314
+ transition: transform .5s;
315
+ }
316
+
317
+ .blocklyTooltipDiv {
318
+ background-color: #ffffc7;
319
+ border: 1px solid #ddc;
320
+ box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);
321
+ color: #000;
322
+ display: none;
323
+ font: 9pt sans-serif;
324
+ opacity: .9;
325
+ padding: 2px;
326
+ position: absolute;
327
+ z-index: 100000; /* big value for bootstrap3 compatibility */
328
+ }
329
+
330
+ .blocklyDropDownDiv {
331
+ position: absolute;
332
+ left: 0;
333
+ top: 0;
334
+ z-index: 1000;
335
+ display: none;
336
+ border: 1px solid;
337
+ border-color: #dadce0;
338
+ background-color: #fff;
339
+ border-radius: 2px;
340
+ padding: 4px;
341
+ box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
342
+ }
343
+
344
+ .blocklyDropDownDiv.blocklyFocused {
345
+ box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
346
+ }
347
+
348
+ .blocklyDropDownContent {
349
+ max-height: 300px; /* @todo: spec for maximum height. */
350
+ overflow: auto;
351
+ overflow-x: hidden;
352
+ position: relative;
353
+ }
354
+
355
+ .blocklyDropDownArrow {
356
+ position: absolute;
357
+ left: 0;
358
+ top: 0;
359
+ width: 16px;
360
+ height: 16px;
361
+ z-index: -1;
362
+ background-color: inherit;
363
+ border-color: inherit;
364
+ }
365
+
366
+ .blocklyDropDownButton {
367
+ display: inline-block;
368
+ float: left;
369
+ padding: 0;
370
+ margin: 4px;
371
+ border-radius: 4px;
372
+ outline: none;
373
+ border: 1px solid;
374
+ transition: box-shadow .1s;
375
+ cursor: pointer;
376
+ }
377
+
378
+ .blocklyArrowTop {
379
+ border-top: 1px solid;
380
+ border-left: 1px solid;
381
+ border-top-left-radius: 4px;
382
+ border-color: inherit;
383
+ }
384
+
385
+ .blocklyArrowBottom {
386
+ border-bottom: 1px solid;
387
+ border-right: 1px solid;
388
+ border-bottom-right-radius: 4px;
389
+ border-color: inherit;
390
+ }
391
+
392
+ .blocklyResizeSE {
393
+ cursor: se-resize;
394
+ fill: #aaa;
395
+ }
396
+
397
+ .blocklyResizeSW {
398
+ cursor: sw-resize;
399
+ fill: #aaa;
400
+ }
401
+
402
+ .blocklyResizeLine {
403
+ stroke: #515A5A;
404
+ stroke-width: 1;
405
+ }
406
+
407
+ .blocklyHighlightedConnectionPath {
408
+ fill: none;
409
+ stroke: #fc3;
410
+ stroke-width: 4px;
411
+ }
412
+
413
+ .blocklyPathLight {
414
+ fill: none;
415
+ stroke-linecap: round;
416
+ stroke-width: 1;
417
+ }
418
+
419
+ .blocklySelected>.blocklyPathLight {
420
+ display: none;
421
+ }
422
+
423
+ .blocklyDraggable {
424
+ cursor: grab;
425
+ cursor: -webkit-grab;
426
+ }
427
+
428
+ .blocklyDragging {
429
+ cursor: grabbing;
430
+ cursor: -webkit-grabbing;
431
+ /* Drag surface disables events to not block the toolbox, so we have to
432
+ * reenable them here for the cursor values to work. */
433
+ pointer-events: auto;
434
+ }
435
+
436
+ /* Changes cursor on mouse down. Not effective in Firefox because of
437
+ https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */
438
+ .blocklyDraggable:active {
439
+ cursor: grabbing;
440
+ cursor: -webkit-grabbing;
441
+ }
442
+
443
+ .blocklyDragging.blocklyDraggingDelete {
444
+ cursor: url("<<<PATH>>>/handdelete.cur"), auto;
445
+ }
446
+
447
+ .blocklyDragging>.blocklyPath,
448
+ .blocklyDragging>.blocklyPathLight {
449
+ fill-opacity: .8;
450
+ stroke-opacity: .8;
451
+ }
452
+
453
+ .blocklyDragging>.blocklyPathDark {
454
+ display: none;
455
+ }
456
+
457
+ .blocklyDisabled>.blocklyPath {
458
+ fill-opacity: .5;
459
+ stroke-opacity: .5;
460
+ }
461
+
462
+ .blocklyDisabled>.blocklyPathLight,
463
+ .blocklyDisabled>.blocklyPathDark {
464
+ display: none;
465
+ }
466
+
467
+ .blocklyInsertionMarker>.blocklyPath,
468
+ .blocklyInsertionMarker>.blocklyPathLight,
469
+ .blocklyInsertionMarker>.blocklyPathDark {
470
+ fill-opacity: .2;
471
+ stroke: none;
472
+ }
473
+
474
+ .blocklyNonEditableText>text {
475
+ pointer-events: none;
476
+ }
477
+
478
+ .blocklyFlyout {
479
+ position: absolute;
480
+ z-index: 20;
481
+ }
482
+
483
+ .blocklyText text {
484
+ cursor: default;
485
+ }
486
+
487
+ .blocklyHidden {
488
+ display: none;
489
+ }
490
+
491
+ .blocklyFieldDropdown:not(.blocklyHidden) {
492
+ display: block;
493
+ }
494
+
495
+ .blocklyIconGroup {
496
+ cursor: default;
497
+ }
498
+
499
+ .blocklyIconGroup:not(:hover),
500
+ .blocklyIconGroupReadonly {
501
+ opacity: .6;
502
+ }
503
+
504
+ .blocklyIconShape {
505
+ fill: #00f;
506
+ stroke: #fff;
507
+ stroke-width: 1px;
508
+ }
509
+
510
+ .blocklyIconSymbol {
511
+ fill: #fff;
512
+ }
513
+
514
+ .blocklyMinimalBody {
515
+ margin: 0;
516
+ padding: 0;
517
+ height: 100%;
518
+ }
519
+
520
+ .blocklyHtmlInput {
521
+ border: none;
522
+ border-radius: 4px;
523
+ height: 100%;
524
+ margin: 0;
525
+ outline: none;
526
+ padding: 0;
527
+ width: 100%;
528
+ text-align: center;
529
+ display: block;
530
+ box-sizing: border-box;
531
+ }
532
+
533
+ /* Remove the increase and decrease arrows on the field number editor */
534
+ input.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,
535
+ input.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {
536
+ -webkit-appearance: none;
537
+ margin: 0;
538
+ }
539
+
540
+ input[type=number] {
541
+ -moz-appearance: textfield;
542
+ }
543
+
544
+ .blocklyMainBackground {
545
+ stroke-width: 1;
546
+ stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */
547
+ }
548
+
549
+ .blocklyMutatorBackground {
550
+ fill: #fff;
551
+ stroke: #ddd;
552
+ stroke-width: 1;
553
+ }
554
+
555
+ .blocklyFlyoutBackground {
556
+ fill: #ddd;
557
+ fill-opacity: .8;
558
+ }
559
+
560
+ .blocklyMainWorkspaceScrollbar {
561
+ z-index: 20;
562
+ }
563
+
564
+ .blocklyFlyoutScrollbar {
565
+ z-index: 30;
566
+ }
567
+
568
+ .blocklyScrollbarHorizontal,
569
+ .blocklyScrollbarVertical {
570
+ position: absolute;
571
+ outline: none;
572
+ }
573
+
574
+ .blocklyScrollbarBackground {
575
+ opacity: 0;
576
+ pointer-events: none;
577
+ }
578
+
579
+ .blocklyScrollbarHandle {
580
+ fill: #ccc;
581
+ }
582
+
583
+ .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
584
+ .blocklyScrollbarHandle:hover {
585
+ fill: #bbb;
586
+ }
587
+
588
+ /* Darken flyout scrollbars due to being on a grey background. */
589
+ /* By contrast, workspace scrollbars are on a white background. */
590
+ .blocklyFlyout .blocklyScrollbarHandle {
591
+ fill: #bbb;
592
+ }
593
+
594
+ .blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
595
+ .blocklyFlyout .blocklyScrollbarHandle:hover {
596
+ fill: #aaa;
597
+ }
598
+
599
+ .blocklyInvalidInput {
600
+ background: #faa;
601
+ }
602
+
603
+ .blocklyVerticalMarker {
604
+ stroke-width: 3px;
605
+ fill: rgba(255,255,255,.5);
606
+ pointer-events: none;
607
+ }
608
+
609
+ .blocklyComputeCanvas {
610
+ position: absolute;
611
+ width: 0;
612
+ height: 0;
613
+ }
614
+
615
+ .blocklyNoPointerEvents {
616
+ pointer-events: none;
617
+ }
618
+
619
+ .blocklyContextMenu {
620
+ border-radius: 4px;
621
+ max-height: 100%;
622
+ }
623
+
624
+ .blocklyDropdownMenu {
625
+ border-radius: 2px;
626
+ padding: 0 !important;
627
+ }
628
+
629
+ .blocklyDropdownMenu .blocklyMenuItem {
630
+ /* 28px on the left for icon or checkbox. */
631
+ padding-left: 28px;
632
+ }
633
+
634
+ /* BiDi override for the resting state. */
635
+ .blocklyDropdownMenu .blocklyMenuItemRtl {
636
+ /* Flip left/right padding for BiDi. */
637
+ padding-left: 5px;
638
+ padding-right: 28px;
639
+ }
640
+
641
+ .blocklyWidgetDiv .blocklyMenu {
642
+ background: #fff;
643
+ border: 1px solid transparent;
644
+ box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
645
+ font: normal 13px Arial, sans-serif;
646
+ margin: 0;
647
+ outline: none;
648
+ padding: 4px 0;
649
+ position: absolute;
650
+ overflow-y: auto;
651
+ overflow-x: hidden;
652
+ max-height: 100%;
653
+ z-index: 20000; /* Arbitrary, but some apps depend on it... */
654
+ }
655
+
656
+ .blocklyWidgetDiv .blocklyMenu.blocklyFocused {
657
+ box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
658
+ }
659
+
660
+ .blocklyDropDownDiv .blocklyMenu {
661
+ background: inherit; /* Compatibility with gapi, reset from goog-menu */
662
+ border: inherit; /* Compatibility with gapi, reset from goog-menu */
663
+ font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
664
+ outline: none;
665
+ position: relative; /* Compatibility with gapi, reset from goog-menu */
666
+ z-index: 20000; /* Arbitrary, but some apps depend on it... */
667
+ }
668
+
669
+ /* State: resting. */
670
+ .blocklyMenuItem {
671
+ border: none;
672
+ color: #000;
673
+ cursor: pointer;
674
+ list-style: none;
675
+ margin: 0;
676
+ /* 7em on the right for shortcut. */
677
+ min-width: 7em;
678
+ padding: 6px 15px;
679
+ white-space: nowrap;
680
+ }
681
+
682
+ /* State: disabled. */
683
+ .blocklyMenuItemDisabled {
684
+ color: #ccc;
685
+ cursor: inherit;
686
+ }
687
+
688
+ /* State: hover. */
689
+ .blocklyMenuItemHighlight {
690
+ background-color: rgba(0,0,0,.1);
691
+ }
692
+
693
+ /* State: selected/checked. */
694
+ .blocklyMenuItemCheckbox {
695
+ height: 16px;
696
+ position: absolute;
697
+ width: 16px;
698
+ }
699
+
700
+ .blocklyMenuItemSelected .blocklyMenuItemCheckbox {
701
+ background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;
702
+ float: left;
703
+ margin-left: -24px;
704
+ position: static; /* Scroll with the menu. */
705
+ }
706
+
707
+ .blocklyMenuItemRtl .blocklyMenuItemCheckbox {
708
+ float: right;
709
+ margin-right: -24px;
710
+ }
711
+
712
+ .blocklyBlockDragSurface, .blocklyAnimationLayer {
713
+ position: absolute;
714
+ top: 0;
715
+ left: 0;
716
+ right: 0;
717
+ bottom: 0;
718
+ overflow: visible !important;
719
+ z-index: 80;
720
+ pointer-events: none;
721
+ }
722
+ `,Th={};Th.inject=cu,Th.register=Et;var V=class{constructor(e,t){this.x=e,this.y=t}clone(){return new V(this.x,this.y)}scale(e){return this.x*=e,this.y*=e,this}translate(e,t){return this.x+=e,this.y+=t,this}static equals(e,t){return e===t?!0:e&&t?e.x===t.x&&e.y===t.y:!1}static distance(e,t){const o=e.x-t.x;return e=e.y-t.y,Math.sqrt(o*o+e*e)}static magnitude(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static difference(e,t){return new V(e.x-t.x,e.y-t.y)}static sum(e,t){return new V(e.x+t.x,e.y+t.y)}},rr="http://www.w3.org/2000/svg",Fs="http://www.w3.org/1999/xhtml",es="http://www.w3.org/1999/xlink",ao;(function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE"})(ao||(ao={}));var Ts=null,kh=0,rl=null,xt={HTML_NS:Fs};xt.NodeType=ao,xt.SVG_NS=rr,xt.XLINK_NS=es,xt.addClass=ge,xt.createSvgElement=N,xt.getFastTextWidth=Nn,xt.getFastTextWidthWithSizeString=ua,xt.getTextWidth=uu,xt.hasClass=Hm,xt.insertAfter=Uo,xt.measureFontMetrics=da,xt.removeClass=ot,xt.removeClasses=la,xt.removeNode=Ke,xt.setCssTransform=ca,xt.startTextWidthCache=Ho,xt.stopTextWidthCache=Wo;var x=class{constructor(e){this.tagName=e}toString(){return this.tagName}};x.ANIMATE=new x("animate"),x.CIRCLE=new x("circle"),x.CLIPPATH=new x("clipPath"),x.DEFS=new x("defs"),x.FECOMPOSITE=new x("feComposite"),x.FECOMPONENTTRANSFER=new x("feComponentTransfer"),x.FEFLOOD=new x("feFlood"),x.FEFUNCA=new x("feFuncA"),x.FEGAUSSIANBLUR=new x("feGaussianBlur"),x.FEPOINTLIGHT=new x("fePointLight"),x.FESPECULARLIGHTING=new x("feSpecularLighting"),x.FILTER=new x("filter"),x.FOREIGNOBJECT=new x("foreignObject"),x.G=new x("g"),x.IMAGE=new x("image"),x.LINE=new x("line"),x.PATH=new x("path"),x.PATTERN=new x("pattern"),x.POLYGON=new x("polygon"),x.RECT=new x("rect"),x.SVG=new x("svg"),x.TEXT=new x("text"),x.TSPAN=new x("tspan");var qe=class{constructor(e,t,o,n){this.top=e,this.bottom=t,this.left=o,this.right=n}clone(){return new qe(this.top,this.bottom,this.left,this.right)}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}contains(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}intersects(e){return this.left<=e.right&&this.right>=e.left&&this.bottom>=e.top&&this.top<=e.bottom}static equals(e,t){return e===t?!0:e&&t?e.top===t.top&&e.bottom===t.bottom&&e.left===t.left&&e.right===t.right:!1}static createFromPoint(e,t,o){const n=e.x;return e=e.y,new qe(e,e+o,n,n+t)}},Le=class{constructor(e,t){this.width=e,this.height=t}static equals(e,t){return e===t?!0:e&&t?e.width===t.width&&e.height===t.height:!1}static max(e,t){return new Le(Math.max(e.width,t.width),Math.max(e.height,t.height))}static min(e,t){return new Le(Math.min(e.width,t.width),Math.min(e.height,t.height))}},Mb={getSizeInternal:Wm},So={TEST_ONLY:Mb};So.getBorderBox=pu,So.getComputedStyle=Ms,So.getContainerOffsetToScrollInto=gu,So.getPageOffset=yo,So.getSize=Ln,So.getViewportPageOffset=hu,So.scrollIntoContainerView=ha;var Nb=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,Lb=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,PT={XY_REGEX:Nb,XY_STYLE_REGEX:Lb},ti={TEST_ONLY:PT};ti.getDocumentScroll=fu,ti.getInjectionDivXY=pa,ti.getRelativeXY=Pn,ti.getViewportBBox=mu,ti.screenToWsCoordinates=Vm,ti.wsToScreenCoordinates=Gm;var mt=class{constructor(e,t,o,n,c){this.workspace=e,this.horizontal=t,this.oldHostMetrics=null,this.ratio=1,this.origin=new V(0,0),this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0,this.containerVisible=this.isHandleVisible=!0,this.position=new V(0,0),this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null,this.pair=o||!1,this.margin=c!==void 0?c:mt.DEFAULT_SCROLLBAR_MARGIN,e="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical"),n&&(e+=" "+n),this.outerSvg=N(x.SVG,{class:e}),n=N(x.G,{},this.outerSvg),this.svgBackground=N(x.RECT,{class:"blocklyScrollbarBackground"},n),e=Math.floor((mt.scrollbarThickness-5)/2),this.svgHandle=N(x.RECT,{class:"blocklyScrollbarHandle",rx:e,ry:e},n),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarColour","fill"),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarOpacity","fill-opacity"),Uo(this.outerSvg,this.workspace.getParentSvg()),this.setInitialThickness(),t?(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=X(this.svgBackground,"pointerdown",this,this.onMouseDownBar),this.onMouseDownHandleWrapper_=X(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){const e=mt.scrollbarThickness;this.horizontal?(this.svgBackground.setAttribute("height",String(e)),this.outerSvg.setAttribute("height",String(e)),this.svgHandle.setAttribute("height",String(e-5)),this.svgHandle.setAttribute("y","2.5")):(this.svgBackground.setAttribute("width",String(e)),this.outerSvg.setAttribute("width",String(e)),this.svgHandle.setAttribute("width",String(e-5)),this.svgHandle.setAttribute("x","2.5"))}dispose(){this.cleanUp(),ze(this.onMouseDownBarWrapper_),ze(this.onMouseDownHandleWrapper_),Ke(this.outerSvg),this.workspace.getThemeManager().unsubscribe(this.svgHandle)}constrainHandleLength(e){return e=0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength)}setHandleLength(e){this.handleLength=e,this.svgHandle.setAttribute(this.lengthAttribute_,String(this.handleLength))}constrainHandlePosition(e){return e=0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength-this.handleLength)}setHandlePosition(e){this.handlePosition=e,this.svgHandle.setAttribute(this.positionAttribute_,String(this.handlePosition))}setScrollbarLength(e){this.scrollbarLength=e,this.outerSvg.setAttribute(this.lengthAttribute_,String(this.scrollbarLength)),this.svgBackground.setAttribute(this.lengthAttribute_,String(this.scrollbarLength))}setPosition(e,t){this.position.x=e,this.position.y=t,ca(this.outerSvg,"translate("+(this.position.x+this.origin.x)+"px,"+(this.position.y+this.origin.y)+"px)")}resize(e){!e&&(e=this.workspace.getMetrics(),!e)||this.oldHostMetrics&&mt.metricsAreEquivalent(e,this.oldHostMetrics)||(this.horizontal?this.resizeHorizontal(e):this.resizeVertical(e),this.oldHostMetrics=e,this.updateMetrics())}requiresViewResize(e){return this.oldHostMetrics?this.oldHostMetrics.viewWidth!==e.viewWidth||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteLeft!==e.absoluteLeft||this.oldHostMetrics.absoluteTop!==e.absoluteTop:!0}resizeHorizontal(e){this.requiresViewResize(e)?this.resizeViewHorizontal(e):this.resizeContentHorizontal(e)}resizeViewHorizontal(e){var t=e.viewWidth-2*this.margin;this.pair&&(t-=mt.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&(t+=mt.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-mt.scrollbarThickness-this.margin),this.resizeContentHorizontal(e)}resizeContentHorizontal(e){if(e.viewWidth>=e.scrollWidth)this.setHandleLength(this.scrollbarLength),this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var t=this.scrollbarLength*e.viewWidth/e.scrollWidth;t=this.constrainHandleLength(t),this.setHandleLength(t),t=e.scrollWidth-e.viewWidth;var o=this.scrollbarLength-this.handleLength;e=(e.viewLeft-e.scrollLeft)/t*o,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=o/t}}resizeVertical(e){this.requiresViewResize(e)?this.resizeViewVertical(e):this.resizeContentVertical(e)}resizeViewVertical(e){let t=e.viewHeight-2*this.margin;this.pair&&(t-=mt.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-mt.scrollbarThickness-this.margin,e.absoluteTop+this.margin),this.resizeContentVertical(e)}resizeContentVertical(e){if(e.viewHeight>=e.scrollHeight)this.setHandleLength(this.scrollbarLength),this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var t=this.scrollbarLength*e.viewHeight/e.scrollHeight;t=this.constrainHandleLength(t),this.setHandleLength(t),t=e.scrollHeight-e.viewHeight;var o=this.scrollbarLength-this.handleLength;e=(e.viewTop-e.scrollTop)/t*o,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=o/t}}isVisible(){return this.isHandleVisible}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay_()}setVisible(e){if(this.pair)throw Error("Unable to toggle visibility of paired scrollbars.");this.setVisibleInternal(e)}setVisibleInternal(e){const t=e!==this.isVisible();this.isHandleVisible=e,t&&this.updateDisplay_()}updateDisplay_(){this.containerVisible&&this.isVisible()?this.outerSvg.setAttribute("display","block"):this.outerSvg.setAttribute("display","none")}onMouseDownBar(e){if(this.workspace.markFocused(),ke(),this.cleanUp(),ve(e))e.stopPropagation();else{var t=st(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var o=pa(this.svgHandle);o=this.horizontal?o.x:o.y;var n=this.handlePosition,c=.95*this.handleLength;t<=o?n-=c:t>=o+this.handleLength&&(n+=c),this.setHandlePosition(this.constrainHandlePosition(n)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),ve(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=X(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=X(document,"pointermove",this,this.onMouseMoveHandle),e.stopPropagation(),e.preventDefault())}onMouseMoveHandle(e){this.setHandlePosition(this.constrainHandlePosition(this.startDragHandle+((this.horizontal?e.clientX:e.clientY)-this.startDragMouse))),this.updateMetrics()}onMouseUpHandle(){ke(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&(ze(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onMouseMoveWrapper_&&(ze(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){let e=this.handlePosition/(this.scrollbarLength-this.handleLength);return isNaN(e)&&(e=0),e}updateMetrics(){const e=this.getRatio_();this.horizontal?this.workspace.setMetrics({x:e}):this.workspace.setMetrics({y:e})}set(e,t){this.setHandlePosition(this.constrainHandlePosition(e*this.ratio)),(t||t===void 0)&&this.updateMetrics()}setOrigin(e,t){this.origin=new V(e,t)}static metricsAreEquivalent(e,t){return e.viewWidth===t.viewWidth&&e.viewHeight===t.viewHeight&&e.viewLeft===t.viewLeft&&e.viewTop===t.viewTop&&e.absoluteTop===t.absoluteTop&&e.absoluteLeft===t.absoluteLeft&&e.scrollWidth===t.scrollWidth&&e.scrollHeight===t.scrollHeight&&e.scrollLeft===t.scrollLeft&&e.scrollTop===t.scrollTop}};mt.scrollbarThickness=yb?25:15,mt.DEFAULT_SCROLLBAR_MARGIN=.5;var al={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},Sh={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:ll,DOMParser:ar,XMLSerializer:lr}=globalThis;ar&&(al=new ar),lr&&(Sh=new lr);var Pb="https://developers.google.com/blockly/xml",BT=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,Hi={NAME_SPACE:Pb};Hi.createElement=i.createElement$$module$build$src$core$utils$xml,Hi.createTextNode=i.createTextNode$$module$build$src$core$utils$xml,Hi.domToText=Ii,Hi.injectDependencies=Km,Hi.textToDom=i.textToDom$$module$build$src$core$utils$xml;var Eh="categoryToolbox",Bb="flyoutToolbox",Ee;(function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"})(Ee||(Ee={}));var jb={hasCategoriesInternal:qm},Eo={};Eo.Position=Ee,Eo.TEST_ONLY=jb,Eo.convertFlyoutDefToJsonArray=Bn,Eo.convertToolboxDefToJson=ga,Eo.hasCategories=ma,Eo.isCategoryCollapsible=fa,Eo.parseToolboxTree=bu;var lo;(function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM"})(lo||(lo={}));var Wi;(function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT"})(Wi||(Wi={}));var Io;(function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"})(Io||(Io={}));var si={};si.bumpDirection=Io,si.bumpPositionRect=ya,si.getCornerOppositeToolbox=va,si.getStartPositionRect=ba,si.horizontalPosition=Wi,si.verticalPosition=lo;var jt={width:96,height:124,url:"sprites.png"},Fb=class{constructor(e){this.workspace=e,this.id="zoomControls",this.boundEvents=[],this.zoomResetGroup=this.zoomOutGroup=this.zoomInGroup=null,this.HEIGHT=this.WIDTH=32,this.SMALL_SPACING=2,this.LARGE_SPACING=11,this.MARGIN_HORIZONTAL=this.MARGIN_VERTICAL=20,this.svgGroup=null,this.top=this.left=0,this.initialized=!1}createDom(){this.svgGroup=N(x.G,{});const e=String(Math.random()).substring(2);return this.createZoomOutSvg(e),this.createZoomInSvg(e),this.workspace.isMovable()&&this.createZoomResetSvg(e),this.svgGroup}init(){this.workspace.getComponentManager().addComponent({component:this,weight:lt.ComponentWeight.ZOOM_CONTROLS_WEIGHT,capabilities:[lt.Capability.POSITIONABLE]}),this.initialized=!0}dispose(){this.workspace.getComponentManager().removeComponent("zoomControls"),this.svgGroup&&Ke(this.svgGroup);for(const e of this.boundEvents)ze(e);this.boundEvents.length=0}getBoundingRectangle(){let e=this.SMALL_SPACING+2*this.HEIGHT;return this.zoomResetGroup&&(e+=this.LARGE_SPACING+this.HEIGHT),new qe(this.top,this.top+e,this.left,this.left+this.WIDTH)}position(e,t){if(this.initialized){var o=va(this.workspace,e),n=this.SMALL_SPACING+2*this.HEIGHT;if(this.zoomResetGroup&&(n+=this.LARGE_SPACING+this.HEIGHT),e=ba(o,new Le(this.WIDTH,n),this.MARGIN_HORIZONTAL,this.MARGIN_VERTICAL,e,this.workspace),o=o.vertical,t=ya(e,this.MARGIN_VERTICAL,o===lo.TOP?Io.DOWN:Io.UP,t),o===lo.TOP){var c=this.SMALL_SPACING+this.HEIGHT,h;(h=this.zoomInGroup)==null||h.setAttribute("transform","translate(0, "+c+")"),this.zoomResetGroup&&this.zoomResetGroup.setAttribute("transform","translate(0, "+(c+this.LARGE_SPACING+this.HEIGHT)+")")}else{h=this.zoomResetGroup?this.LARGE_SPACING+this.HEIGHT:0;let T;(T=this.zoomInGroup)==null||T.setAttribute("transform","translate(0, "+h+")"),h=h+this.SMALL_SPACING+this.HEIGHT,(c=this.zoomOutGroup)==null||c.setAttribute("transform","translate(0, "+h+")")}this.top=t.top,this.left=t.left;var $;($=this.svgGroup)==null||$.setAttribute("transform","translate("+this.left+","+this.top+")")}}createZoomOutSvg(e){this.zoomOutGroup=N(x.G,{class:"blocklyZoom blocklyZoomOut"},this.svgGroup);const t=N(x.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup);N(x.RECT,{width:32,height:32},t),N(x.IMAGE,{width:jt.width,height:jt.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup).setAttributeNS(es,"xlink:href",this.workspace.options.pathToMedia+jt.url),this.boundEvents.push(X(this.zoomOutGroup,"pointerdown",null,this.zoom.bind(this,-1)))}createZoomInSvg(e){this.zoomInGroup=N(x.G,{class:"blocklyZoom blocklyZoomIn"},this.svgGroup);const t=N(x.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup);N(x.RECT,{width:32,height:32},t),N(x.IMAGE,{width:jt.width,height:jt.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup).setAttributeNS(es,"xlink:href",this.workspace.options.pathToMedia+jt.url),this.boundEvents.push(X(this.zoomInGroup,"pointerdown",null,this.zoom.bind(this,1)))}zoom(e,t){this.workspace.markFocused(),this.workspace.zoomCenter(e),this.fireZoomEvent(),ke(),t.stopPropagation(),t.preventDefault()}createZoomResetSvg(e){this.zoomResetGroup=N(x.G,{class:"blocklyZoom blocklyZoomReset"},this.svgGroup);const t=N(x.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup);N(x.RECT,{width:32,height:32},t),N(x.IMAGE,{width:jt.width,height:jt.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup).setAttributeNS(es,"xlink:href",this.workspace.options.pathToMedia+jt.url),this.boundEvents.push(X(this.zoomResetGroup,"pointerdown",null,this.resetZoom.bind(this)))}resetZoom(e){this.workspace.markFocused();const t=Math.log(this.workspace.options.zoomOptions.startScale/this.workspace.scale)/Math.log(this.workspace.options.zoomOptions.scaleSpeed);this.workspace.beginCanvasTransition(),this.workspace.zoomCenter(t),this.workspace.scrollCenter(),setTimeout(this.workspace.endCanvasTransition.bind(this.workspace),500),this.fireZoomEvent(),ke(),e.stopPropagation(),e.preventDefault()}fireZoomEvent(){const e=new(G(O.CLICK))(null,this.workspace.id,"zoom_controls");z(e)}};Et(`
723
+ .blocklyZoom>image, .blocklyZoom>svg>image {
724
+ opacity: .4;
725
+ }
726
+
727
+ .blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {
728
+ opacity: .6;
729
+ }
730
+
731
+ .blocklyZoom>image:active, .blocklyZoom>svg>image:active {
732
+ opacity: .8;
733
+ }
734
+ `);var zb=100,Ub=75,Hb=50,Wb=25,jT={BLOCKS:Hb,PROCEDURES:Ub,VARIABLES:zb,WORKSPACE_COMMENTS:Wb},Ih={};Ih.register=jn,Ih.unregister=Zm;var Vb=class{constructor(){this.priority=Wb}save(e){const t=[];for(const o of e.getTopComments())(e=xi(o,{addCoordinates:!0,saveIds:!0}))&&t.push(e);return t.length?t:null}load(e,t){for(const o of e)Fn(o,t,{recordUndo:me()})}clear(e){for(const t of e.getTopComments())t.dispose()}};jn("workspaceComments",new Vb);var cl={};cl.WorkspaceCommentSerializer=Vb,cl.append=Fn,cl.save=xi;var xh={};xh.register=_a,xh.unregister=Qm;var ul=class{paste(e,t,o){e=e.commentState,o&&(e.x=o.x,e.y=o.y),i.disable$$module$build$src$core$events$utils();let n;try{n=Fn(e,t),ef(n)}finally{i.enable$$module$build$src$core$events$utils()}return n?(K()&&z(new(G(O.COMMENT_CREATE))(n)),i.setSelected$$module$build$src$core$common(n),n):null}};ul.TYPE="workspace-comment",_a(ul.TYPE,new ul);var Dh;Dh=28,i.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:Dh,connectingSnapRadius:Dh,currentConnectionPreference:8,bumpDelay:250},i.config$$module$build$src$core$config;var FT="aria-",zT="role",ks;(function(e){e.GRID="grid",e.GRIDCELL="gridcell",e.GROUP="group",e.LISTBOX="listbox",e.MENU="menu",e.MENUITEM="menuitem",e.MENUITEMCHECKBOX="menuitemcheckbox",e.OPTION="option",e.PRESENTATION="presentation",e.ROW="row",e.TREE="tree",e.TREEITEM="treeitem"})(ks||(ks={}));var Ct;(function(e){e.ACTIVEDESCENDANT="activedescendant",e.COLCOUNT="colcount",e.DISABLED="disabled",e.EXPANDED="expanded",e.INVALID="invalid",e.LABEL="label",e.LABELLEDBY="labelledby",e.LEVEL="level",e.ORIENTATION="orientation",e.POSINSET="posinset",e.ROWCOUNT="rowcount",e.SELECTED="selected",e.SETSIZE="setsize",e.VALUEMAX="valuemax",e.VALUEMIN="valuemin"})(Ct||(Ct={}));var cr={};cr.Role=ks,cr.State=Ct,cr.setRole=_o,cr.setState=It;var Ah=class{constructor(){this.menuItems=[],this.roleName=this.element=this.onKeyDownHandler=this.pointerLeaveHandler=this.pointerEnterHandler=this.clickHandler=this.pointerMoveHandler=this.highlightedItem=this.openingCoords=null}addChild(e){this.menuItems.push(e)}render(e){const t=document.createElement("div");t.className="blocklyMenu goog-menu blocklyNonSelectable",t.tabIndex=0,this.roleName&&_o(t,this.roleName),this.element=t;for(let o=0,n;n=this.menuItems[o];o++)t.appendChild(n.createDom());return this.pointerMoveHandler=X(t,"pointermove",this,this.handlePointerMove,!0),this.clickHandler=X(t,"pointerup",this,this.handleClick,!0),this.pointerEnterHandler=X(t,"pointerenter",this,this.handlePointerEnter,!0),this.pointerLeaveHandler=X(t,"pointerleave",this,this.handlePointerLeave,!0),this.onKeyDownHandler=X(t,"keydown",this,this.handleKeyEvent),e.appendChild(t),t}getElement(){return this.element}focus(){const e=this.getElement();e&&(e.focus({preventScroll:!0}),ge(e,"blocklyFocused"))}blur(){const e=this.getElement();e&&(e.blur(),ot(e,"blocklyFocused"))}setRole(e){this.roleName=e}dispose(){this.pointerMoveHandler&&(ze(this.pointerMoveHandler),this.pointerMoveHandler=null),this.clickHandler&&(ze(this.clickHandler),this.clickHandler=null),this.pointerEnterHandler&&(ze(this.pointerEnterHandler),this.pointerEnterHandler=null),this.pointerLeaveHandler&&(ze(this.pointerLeaveHandler),this.pointerLeaveHandler=null),this.onKeyDownHandler&&(ze(this.onKeyDownHandler),this.onKeyDownHandler=null);for(let e=0,t;t=this.menuItems[e];e++)t.dispose();this.element=null}getMenuItem(e){const t=this.getElement();for(;e&&e!==t;){if(e.classList.contains("blocklyMenuItem")){for(let o=0,n;n=this.menuItems[o];o++)if(n.getElement()===e)return n}e=e.parentElement}return null}setHighlighted(e){var t=this.highlightedItem;if(t&&(t.setHighlighted(!1),this.highlightedItem=null),e){e.setHighlighted(!0),this.highlightedItem=e,t=this.getElement();const o=t==null?void 0:t.parentElement,n=e.getElement();o&&n&&(ha(n,o),It(t,Ct.ACTIVEDESCENDANT,e.getId()))}}highlightNext(){const e=this.highlightedItem?this.menuItems.indexOf(this.highlightedItem):-1;this.highlightHelper(e,1)}highlightPrevious(){const e=this.highlightedItem?this.menuItems.indexOf(this.highlightedItem):-1;this.highlightHelper(0>e?this.menuItems.length:e,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(e,t){e+=t;let o;for(;o=this.menuItems[e];){if(o.isEnabled()){this.setHighlighted(o);break}e+=t}}handlePointerMove(e){Math.max(Math.abs(e.movementX),Math.abs(e.movementY))!==0&&(e=this.getMenuItem(e.target))&&(e.isEnabled()?this.highlightedItem!==e&&this.setHighlighted(e):this.setHighlighted(null))}handleClick(e){const t=this.openingCoords;if(this.openingCoords=null,t&&typeof e.clientX=="number"){const o=new V(e.clientX,e.clientY);if(1>V.distance(t,o))return}(e=this.getMenuItem(e.target))&&e.performAction()}handlePointerEnter(e){this.focus()}handlePointerLeave(e){this.getElement()&&this.setHighlighted(null)}handleKeyEvent(e){if(this.menuItems.length&&!(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){var t=this.highlightedItem;switch(e.key){case"Enter":case" ":t&&t.performAction();break;case"ArrowUp":this.highlightPrevious();break;case"ArrowDown":this.highlightNext();break;case"PageUp":case"Home":this.highlightFirst();break;case"PageDown":case"End":this.highlightLast();break;default:return}e.preventDefault(),e.stopPropagation()}}getSize(){const e=this.getElement(),t=Ln(e);return t.height=e.scrollHeight,t}},Rh=class{constructor(e,t){this.content=e,this.opt_value=t,this.enabled=!0,this.element=null,this.rightToLeft=!1,this.roleName=null,this.highlight=this.checked=this.checkable=!1,this.actionHandler=null}createDom(){const e=document.createElement("div");e.id=k(),this.element=e,e.className="blocklyMenuItem goog-menuitem "+(this.enabled?"":"blocklyMenuItemDisabled goog-menuitem-disabled ")+(this.checked?"blocklyMenuItemSelected goog-option-selected ":"")+(this.highlight?"blocklyMenuItemHighlight goog-menuitem-highlight ":"")+(this.rightToLeft?"blocklyMenuItemRtl goog-menuitem-rtl ":"");const t=document.createElement("div");if(t.className="blocklyMenuItemContent goog-menuitem-content",this.checkable){var o=document.createElement("div");o.className="blocklyMenuItemCheckbox goog-menuitem-checkbox",t.appendChild(o)}return o=this.content,typeof this.content=="string"&&(o=document.createTextNode(this.content)),t.appendChild(o),e.appendChild(t),this.roleName&&_o(e,this.roleName),It(e,Ct.SELECTED,this.checkable&&this.checked||!1),It(e,Ct.DISABLED,!this.enabled),e}dispose(){this.element=null}getElement(){return this.element}getId(){return this.element.id}getValue(){let e;return(e=this.opt_value)!=null?e:null}setRightToLeft(e){this.rightToLeft=e}setRole(e){this.roleName=e}setCheckable(e){this.checkable=e}setChecked(e){this.checked=e}setHighlighted(e){this.highlight=e;const t=this.getElement();t&&this.isEnabled()&&(e?(ge(t,"blocklyMenuItemHighlight"),ge(t,"goog-menuitem-highlight")):(ot(t,"blocklyMenuItemHighlight"),ot(t,"goog-menuitem-highlight")))}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}performAction(){this.isEnabled()&&this.actionHandler&&this.actionHandler(this)}onAction(e,t){this.actionHandler=e.bind(t)}},ur="_TEMP_COLLAPSED_INPUT",dl="_TEMP_COLLAPSED_FIELD",Ft="MANUALLY_DISABLED",UT={COLLAPSED_FIELD_NAME:dl,COLLAPSED_INPUT_NAME:ur,MANUALLY_DISABLED:Ft};(function(e){e[e.VALUE=1]="VALUE",e[e.STATEMENT=3]="STATEMENT",e[e.DUMMY=5]="DUMMY",e[e.CUSTOM=6]="CUSTOM",e[e.END_ROW=7]="END_ROW"})(i.inputTypes$$module$build$src$core$inputs$input_types||(i.inputTypes$$module$build$src$core$inputs$input_types={})),i.inputTypes$$module$build$src$core$inputs$input_types;var hl=new Set,Oh=new WeakSet,Mh=new WeakMap,Vi=null,Nh=null,Gb=0,pl={};pl.finishQueuedRenders=ws,pl.queueRender=vu,pl.triggerQueuedRenders=Qs;var Kb=function(e,t){window.alert(e),t&&t()},Yb=function(e,t){t(window.confirm(e))},Jb=function(e,t,o){o(window.prompt(e,t))},qb={confirmInternal:rf},oi={TEST_ONLY:qb};oi.alert=Un,oi.confirm=Ca,oi.prompt=Ta,oi.setAlert=nf,oi.setConfirm=af,oi.setPrompt=lf;var Lh,Xb;i.Msg$$module$build$src$core$msg=Object.create(null),Lh=function(e){Object.keys(e).forEach(function(t){i.Msg$$module$build$src$core$msg[t]=e[t]})},Xb={Msg:i.Msg$$module$build$src$core$msg,setLocale:Lh};var dr=class extends Ui{constructor(e){super(),this.isBlank=typeof e>"u",e&&(this.varId=e.getId(),this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");return e.varId=this.varId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new dr),t.varId=e.varId,t}},Ph=class extends dr{constructor(e){super(e),this.type=O.VAR_CREATE,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const e=super.toJson();if(this.varType===void 0)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");return e.varType=this.varType,e.varName=this.varName,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Ph),t.varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.createVariable(this.varName,this.varType,this.varId):t.deleteVariableById(this.varId)}};r(F.EVENT,O.VAR_CREATE,Ph);var hr=class{constructor(e,t,o,n){this.workspace=e,this.name=t,this.type=o||"",this.id=n||C()}getId(){return this.id}static compareByName(e,t){return e.name.localeCompare(t.name,void 0,{sensitivity:"base"})}},Bh="VARIABLE",jh="ijkmnopqrstuvwxyzabcdefgh",Zb={generateUniqueNameInternal:uf},At={CATEGORY_NAME:Bh,TEST_ONLY:Zb,VAR_LETTER_OPTIONS:jh};At.allDeveloperVariables=i.allDeveloperVariables$$module$build$src$core$variables,At.allUsedVarModels=i.allUsedVarModels$$module$build$src$core$variables,At.createVariableButtonHandler=Ai,At.flyoutCategory=ka,At.flyoutCategoryBlocks=Tu,At.generateUniqueName=ku,At.generateUniqueNameFromOptions=Sa,At.generateVariableFieldDom=Vo,At.getAddedVariables=Hn,At.getOrCreateVariablePackage=i.getOrCreateVariablePackage$$module$build$src$core$variables,At.getVariable=i.getVariable$$module$build$src$core$variables,At.nameUsedWithAnyType=Su,At.nameUsedWithConflictingParam=Eu,At.promptName=Ea,At.renameVariable=i.renameVariable$$module$build$src$core$variables;var Gi=class extends Error{},Qb=class extends Gi{constructor(e){super("Expected to find a 'type' property, defining the block type"),this.state=e}},pr=class extends Gi{constructor(e,t,o){super(`The block ${t.toDevString()} is missing a(n) ${e}
735
+ connection`),this.block=t,this.state=o}},ev=class extends Gi{constructor(e,t,o,n){super(`The block ${o.toDevString()} could not connect its
736
+ ${t} to its parent, because: ${e}`),this.childBlock=o,this.childState=n}},tv=class extends Gi{constructor(e){super(`Encountered a real block which is defined as a child of a shadow
737
+ block. It is an invariant of Blockly that shadow blocks only have shadow
738
+ children`),this.state=e}},sv=class extends Gi{constructor(e,t,o){super(`Cannot add an icon of type '${e}' to the block ${t.toDevString()}, because there is no icon registered with type '${e}'. Make sure that all of your icons have been registered.`),this.block=t,this.state=o}},ii={};ii.BadConnectionCheck=ev,ii.DeserializationError=Gi,ii.MissingBlockType=Qb,ii.MissingConnection=pr,ii.RealChildOfShadow=tv,ii.UnregisteredIcon=sv;var ov=class{constructor(){this.priority=Hb}save(e){const t=[];for(const o of e.getTopBlocks(!1))(e=Qt(o,{addCoordinates:!0,doFullSerialization:!1}))&&t.push(e);return t.length?{languageVersion:0,blocks:t}:null}load(e,t){e=e.blocks;for(const o of e)eo(o,t,{recordUndo:me()})}clear(e){for(const t of e.getTopBlocks(!1))t.dispose(!1)}};jn("blocks",new ov);var gr={};gr.BlockSerializer=ov,gr.append=eo,gr.appendInternal=Ri,gr.save=Qt;var yt=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};yt.MUTATOR=new yt("mutator"),yt.WARNING=new yt("warning"),yt.COMMENT=new yt("comment");var ni=class extends Ui{constructor(e){super(),this.isBlank=!e,e&&(this.blockId=e.id,this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.blockId=this.blockId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new ni),t.blockId=e.blockId,t}},ri=class extends ni{constructor(e,t,o,n,c){super(e),this.type=O.BLOCK_CHANGE,e&&(this.element=t,this.name=o||void 0,this.oldValue=n,this.newValue=c)}toJson(){const e=super.toJson();if(!this.element)throw Error("The changed element is undefined. Either pass an element to the constructor, or call fromJson");return e.element=this.element,e.name=this.name,e.oldValue=this.oldValue,e.newValue=this.newValue,this.disabledReason&&(e.disabledReason=this.disabledReason),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new ri),t.element=e.element,t.name=e.name,t.oldValue=e.oldValue,t.newValue=e.newValue,e.disabledReason!==void 0&&(t.disabledReason=e.disabledReason),t}setDisabledReason(e){if(this.element!=="disabled")throw Error('Cannot set the disabled reason for a BlockChange event if the element is not "disabled".');this.disabledReason=e}isNull(){return this.oldValue===this.newValue}run(e){var t=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");if(t=t.getBlockById(this.blockId),!t)throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");const o=t.getIcon(yt.MUTATOR);switch(o&&Oi(o)&&o.bubbleIsVisible()&&o.setBubbleVisible(!1),e=e?this.newValue:this.oldValue,this.element){case"field":(t=t.getField(this.name))?t.setValue(e):console.warn("Can't set non-existent field: "+this.name);break;case"comment":t.setCommentText(e||null);break;case"collapsed":t.setCollapsed(!!e);break;case"disabled":var n;t.setDisabledReason(!!e,(n=this.disabledReason)!=null?n:Ft);break;case"inline":t.setInputsInline(!!e);break;case"mutation":n=ri.getExtraBlockState_(t),t.loadExtraState?t.loadExtraState(JSON.parse(e||"{}")):t.domToMutation&&t.domToMutation(i.textToDom$$module$build$src$core$utils$xml(e||"<mutation/>")),z(new ri(t,"mutation",null,n,e));break;default:console.warn("Unknown change type: "+this.element)}}static getExtraBlockState_(e){return e.saveExtraState?(e=e.saveExtraState(!0))?JSON.stringify(e):"":e.mutationToDom&&(e=e.mutationToDom())?Ls(e):""}};r(F.EVENT,O.BLOCK_CHANGE,ri);var gl={};gl.clamp=Mi,gl.toDegrees=Rf,gl.toRadians=Ia;var ml=16,iv=1,nv=12,Fh=16,fl=.25,zh=null,ai=null,Ki="",Yi="",Ue,Ji,li,Uh=null,xo=null,rv=null,Hh={getBoundsInfo:function(){const e=yo(Uh),t=Ln(Uh);return{left:e.x,right:e.x+t.width,top:e.y,bottom:e.y+t.height,width:t.width,height:t.height}},getPositionMetrics:function(e,t,o,n){const c=Hh.getBoundsInfo(),h=Ln(Ue);return t+h.height<c.bottom?Fu(e,t,c,h):n-h.height>c.top?zu(o,n,c,h):t+h.height<document.documentElement.clientHeight?Fu(e,t,c,h):n-h.height>document.documentElement.clientTop?zu(o,n,c,h):Mf(e,c,h)}},Nt={ANIMATION_TIME:fl,ARROW_HORIZONTAL_PADDING:nv,ARROW_SIZE:ml,BORDER_SIZE:iv,PADDING_Y:Fh,TEST_ONLY:Hh};Nt.clearContent=xa,Nt.createDom=Au,Nt.getContentDiv=Wn,Nt.getOwner=Ou,Nt.getPositionX=Vn,Nt.hide=Aa,Nt.hideIfOwner=Da,Nt.hideWithoutAnimation=Ns,Nt.isVisible=Uu,Nt.repositionForWindowResize=Wu,Nt.setBoundsElement=Ru,Nt.setColour=Mu,Nt.show=ju,Nt.showPositionedByBlock=Of,Nt.showPositionedByField=Nu;var mr=class{constructor(e){this.workspace=e,this.cursorSvg=this.cursor=null,this.markers=new Map,this.markerSvg=null}registerMarker(e,t){this.markers.has(e)&&this.unregisterMarker(e),t.setDrawer(this.workspace.getRenderer().makeMarkerDrawer(this.workspace,t)),this.setMarkerSvg(t.getDrawer().createDom()),this.markers.set(e,t)}unregisterMarker(e){const t=this.markers.get(e);if(t)t.dispose(),this.markers.delete(e);else throw Error("Marker with ID "+e+" does not exist. Can only unregister markers that exist.")}getCursor(){return this.cursor}getMarker(e){return this.markers.get(e)||null}setCursor(e){this.cursor&&this.cursor.getDrawer()&&this.cursor.getDrawer().dispose(),(this.cursor=e)&&(e=this.workspace.getRenderer().makeMarkerDrawer(this.workspace,this.cursor),this.cursor.setDrawer(e),this.setCursorSvg(this.cursor.getDrawer().createDom()))}setCursorSvg(e){e?(this.workspace.getBlockCanvas().appendChild(e),this.cursorSvg=e):this.cursorSvg=null}setMarkerSvg(e){e?this.workspace.getBlockCanvas()&&(this.cursorSvg?this.workspace.getBlockCanvas().insertBefore(e,this.cursorSvg):this.workspace.getBlockCanvas().appendChild(e)):this.markerSvg=null}updateMarkers(){this.workspace.keyboardAccessibilityMode&&this.cursorSvg&&this.workspace.getCursor().draw()}dispose(){const e=Object.keys(this.markers);for(let t=0,o;o=e[t];t++)this.unregisterMarker(o);this.markers.clear(),this.cursor&&(this.cursor.dispose(),this.cursor=null)}};mr.LOCAL_MARKER="local_marker_1";var qi={};qi.commonWordPrefix=Vu,qi.commonWordSuffix=Gu,qi.isNumber=i.isNumber$$module$build$src$core$utils$string,qi.shortestStringLength=Gn,qi.wrap=i.wrap$$module$build$src$core$utils$string;var $l=void 0,fr=!1,Xi=!1,av=50,lv=0,ci=0,Wh=0,Vh=0,cs=null,$r=null,Gh=0,Kh=10,cv=10,uv=750,bl=5,_t=null,ts={HOVER_MS:uv,LIMIT:av,MARGINS:bl,OFFSET_X:Gh,OFFSET_Y:Kh,RADIUS_OK:cv};ts.bindMouseEvents=Li,ts.block=Zu,ts.createDom=Ju,ts.dispose=Xu,ts.getCustomTooltip=Bf,ts.getDiv=Ff,ts.getTooltipOfObject=Ni,ts.hide=to,ts.isVisible=jf,ts.setCustomTooltip=Pf,ts.unbindMouseEvents=Oa,ts.unblock=Qu;var Yh=.45,Jh=.65,dv={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},us={};us.blend=Ko,us.getHsvSaturation=ed,us.getHsvValue=td,us.hexToRgb=Ma,us.hsvToHex=Na,us.hueToHex=sd,us.names=dv,us.parse=Go,us.rgbToHex=Kn,us.setHsvSaturation=Kf,us.setHsvValue=Yf;var br={};br.checkMessageReferences=Jf,br.parseBlockColour=Pi,br.replaceMessageReferences=pt,br.tokenizeInterpolation=od;var Qe=class{constructor(e,t,o){this.DEFAULT_VALUE=null,this.name=void 0,this.constants_=this.mouseDownWrapper=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg=this.cursorSvg=this.tooltip=this.validator_=null,this.disposed=!1,this.maxDisplayLength=50,this.sourceBlock_=null,this.enabled_=this.visible_=this.isDirty_=!0,this.suffixField=this.prefixField=this.clickTarget_=null,this.EDITABLE=!0,this.SERIALIZABLE=!1,this.CURSOR="",this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE,this.size_=new Le(0,0),e!==Qe.SKIP_SETUP&&(o&&this.configure_(o),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(pt(e.tooltip))}setSourceBlock(e){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=e}getConstants(){return!this.constants_&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_}getSourceBlock(){return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=N(x.G,{}),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip),this.bindEvents_(),this.initModel(),this.applyColour())}initView(){this.createBorderRect_(),this.createTextElement_()}initModel(){}isFullBlockField(){return!this.borderRect_}createBorderRect_(){this.borderRect_=N(x.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,class:"blocklyFieldRect"},this.fieldGroup_)}createTextElement_(){this.textElement_=N(x.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)}bindEvents_(){const e=this.getClickTarget_();if(!e)throw Error("A click target has not been set.");Li(e),this.mouseDownWrapper=X(e,"pointerdown",this,this.onMouseDown_)}fromXml(e){this.setValue(e.textContent)}toXml(e){return e.textContent=this.getValue(),e}saveState(e){return e=this.saveLegacyState(Qe),e!==null?e:this.getValue()}loadState(e){this.loadLegacyState(Qe,e)||this.setValue(e)}saveLegacyState(e){return e.prototype.saveState===this.saveState&&e.prototype.toXml!==this.toXml?(e=i.createElement$$module$build$src$core$utils$xml("field"),e.setAttribute("name",this.name||""),Ii(this.toXml(e)).replace(' xmlns="https://developers.google.com/blockly/xml"',"")):null}loadLegacyState(e,t){return e.prototype.loadState===this.loadState&&e.prototype.fromXml!==this.fromXml?(this.fromXml(i.textToDom$$module$build$src$core$utils$xml(t)),!0):!1}dispose(){Da(this),Jo(this);let e;(e=this.getSourceBlock())!=null&&e.isDeadOrDying()||Ke(this.fieldGroup_),this.disposed=!0}updateEditable(){const e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(ge(e,"blocklyEditableText"),ot(e,"blocklyNonEditableText"),e.style.cursor=this.CURSOR):(ge(e,"blocklyNonEditableText"),ot(e,"blocklyEditableText"),e.style.cursor=""))}setEnabled(e){this.enabled_=e,this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==Qe.prototype.showEditor_}isClickableInFlyout(e){return!e}isCurrentlyEditable(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}isSerializable(){let e=!1;return this.name&&(this.SERIALIZABLE?e=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),e=!0)),e}isVisible(){return this.visible_}setVisible(e){if(this.visible_!==e){this.visible_=e;var t=this.fieldGroup_;t&&(t.style.display=e?"block":"none")}}setValidator(e){this.validator_=e}getValidator(){return this.validator_}getSvgRoot(){return this.fieldGroup_}getBorderRect(){if(!this.borderRect_)throw Error(`The border rectangle is ${this.borderRect_}.`);return this.borderRect_}getTextElement(){if(!this.textElement_)throw Error(`The text element is ${this.textElement_}.`);return this.textElement_}getTextContent(){if(!this.textContent_)throw Error(`The text content is ${this.textContent_}.`);return this.textContent_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()}showEditor(e){this.isClickable()&&this.showEditor_(e)}showEditor_(e){}repositionForWindowResize(){return!1}updateSize_(e){const t=this.getConstants();e=e!==void 0?e:this.isFullBlockField()?0:this.getConstants().FIELD_BORDER_RECT_X_PADDING;let o=2*e,n=t.FIELD_TEXT_HEIGHT,c=0;this.textElement_&&(c=Nn(this.textElement_,t.FIELD_TEXT_FONTSIZE,t.FIELD_TEXT_FONTWEIGHT,t.FIELD_TEXT_FONTFAMILY),o+=c),this.isFullBlockField()||(n=Math.max(n,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=n,this.size_.width=o,this.positionTextElement_(e,c),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var o=this.getConstants(),n=this.size_.height/2,c;this.textElement_.setAttribute("x",String((c=this.getSourceBlock())!=null&&c.RTL?this.size_.width-t-e:e)),this.textElement_.setAttribute("y",String(o.FIELD_TEXT_BASELINE_CENTER?n:n-o.FIELD_TEXT_HEIGHT/2+o.FIELD_TEXT_BASELINE))}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",String(this.size_.width)),this.borderRect_.setAttribute("height",String(this.size_.height)),this.borderRect_.setAttribute("rx",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)),this.borderRect_.setAttribute("ry",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)))}getSize(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&this.size_.width===0&&(this.render_(),this.size_.width!==0&&console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead.")),this.size_):new Le(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new ft;if(this.isFullBlockField()){var o=this.sourceBlock_.getHeightWidth();const n=t.workspace.scale;e=this.getAbsoluteXY_(),t=(o.width+1)*n,o=(o.height+1)*n,Ib?(e.x+=1.5*n,e.y+=1.5*n):(e.x-=.5*n,e.y-=.5*n)}else o=this.borderRect_.getBoundingClientRect(),e=yo(this.borderRect_),t=o.width,o=o.height;return new qe(e.y,e.y+o,e.x,e.x+t)}onLocationChange(e){}getDisplayText_(){let e=this.getText();return e?(e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,Qe.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+="‏"),e):Qe.NBSP}getText(){const e=this.getText_();return String(e!==null?e:this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0,this.constants_=null}forceRerender(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&this.sourceBlock_.queueRender()}setValue(e,t=!0){if(e!==null){var o=i.getGroup$$module$build$src$core$events$utils();o||i.setGroup$$module$build$src$core$events$utils(!0);try{const L=this.doClassValidation_(e),te=this.processValidation(e,L,t);if(!(te instanceof Error)){var n,c=(n=this.getValidator())==null?void 0:n.call(this,te),h=this.processValidation(te,c,t);if(!(h instanceof Error)){var $=this.sourceBlock_;if(!$||!$.disposed){var T=this.getValue();T===h?this.doValueUpdate_(h):(this.doValueUpdate_(h),t&&$&&K()&&z(new(G(O.BLOCK_CHANGE))($,"field",this.name||null,T,h)),this.isDirty_&&this.forceRerender())}}}}finally{i.setGroup$$module$build$src$core$events$utils(o)}}}processValidation(e,t,o){return t===null?(this.doValueInvalid_(e,o),this.isDirty_&&this.forceRerender(),Error()):t===void 0?e:t}getValue(){return this.value_}doClassValidation_(e){return e??null}doValueUpdate_(e){this.value_=e,this.isDirty_=!0}doValueInvalid_(e,t){}onMouseDown_(e){this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&(e=this.sourceBlock_.workspace.getGesture(e))&&e.setStartField(this)}setTooltip(e){e||e===""||(e=this.sourceBlock_);const t=this.getClickTarget_();t?t.tooltip=e:this.tooltip=e}getTooltip(){const e=this.getClickTarget_();return Ni(e||{tooltip:this.tooltip})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return yo(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null;const t=this.getSourceBlock();if(!t)throw new ft;const o=t.inputList;for(let n=0;n<t.inputList.length;n++){const c=o[n],h=c.fieldRow;for(let $=0;$<h.length;$++)if(h[$]===this){e=c;break}}return e}getFlipRtl(){return!1}isTabNavigable(){return!1}onShortcut(e){return!1}setCursorSvg(e){if(e){if(!this.fieldGroup_)throw Error(`The field group is ${this.fieldGroup_}.`);this.fieldGroup_.appendChild(e),this.cursorSvg=e}else this.cursorSvg=null}setMarkerSvg(e){if(e){if(!this.fieldGroup_)throw Error(`The field group is ${this.fieldGroup_}.`);this.fieldGroup_.appendChild(e),this.markerSvg=e}else this.markerSvg=null}updateMarkers_(){var e=this.getSourceBlock();if(!e)throw new ft;e=e.workspace,e.keyboardAccessibilityMode&&this.cursorSvg&&e.getCursor().draw(),e.keyboardAccessibilityMode&&this.markerSvg&&e.getMarker(mr.LOCAL_MARKER).draw()}static fromJson(e){throw Error("Attempted to instantiate a field from the registry that hasn't defined a 'fromJson' method.")}};Qe.NBSP=" ",Qe.SKIP_SETUP=Symbol("SKIP_SETUP");var ft=class extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}},Zi=null,qh=null,vl=null,yl="blocklyWidgetDiv",Qi="",en="",Ss,Es={};Es.createDom=id,Es.getDiv=Yo,Es.hide=Bi,Es.hideIfOwner=Jo,Es.hideIfOwnerIsInWorkspace=Yn,Es.isVisible=nd,Es.positionWithAnchor=ad,Es.repositionForWindowResize=ld,Es.show=Pa,Es.testOnly_setDiv=qf;var _l=null,hv={},wl=null,ui={};ui.callbackFactory=i.callbackFactory$$module$build$src$core$contextmenu,ui.dispose=ud,ui.getCurrentBlock=e$,ui.hide=qn,ui.setCurrentBlock=cd,ui.show=Jn;var xe=class{constructor(){this.registeredItems=new Map,this.reset()}reset(){this.registeredItems.clear()}register(e){if(this.registeredItems.has(e.id))throw Error('Menu item with ID "'+e.id+'" is already registered.');this.registeredItems.set(e.id,e)}unregister(e){if(!this.registeredItems.has(e))throw Error('Menu item with ID "'+e+'" not found.');this.registeredItems.delete(e)}getItem(e){let t;return(t=this.registeredItems.get(e))!=null?t:null}getContextMenuOptions(e,t){const o=[];for(const c of this.registeredItems.values())if(e===c.scopeType){var n=c.preconditionFn(t);n!=="hidden"&&(n={text:typeof c.displayText=="function"?c.displayText(t):c.displayText,enabled:n==="enabled",callback:c.callback,scope:t,weight:c.weight},o.push(n))}return o.sort(function(c,h){return c.weight-h.weight}),o}};(function(e){var t=e.ScopeType||(e.ScopeType={});t.BLOCK="block",t.WORKSPACE="workspace",t.COMMENT="comment",e.registry=new e})(xe||(xe={})),xe.ScopeType;var Do=50,Cl=100,HT={BLOCK:Do,BUBBLE:Cl},pv=class{constructor(e){this.comment=e,this.startLoc=null,this.inGroup=!1,this.workspace=e.workspace}isMovable(){return this.comment.isOwnMovable()&&!this.comment.isDeadOrDying()&&!this.workspace.options.readOnly}startDrag(){(this.inGroup=!!i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),this.fireDragStartEvent(),this.startLoc=this.comment.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1);let e;(e=this.workspace.getLayerManager())==null||e.moveToDragLayer(this.comment),this.comment.setDragging(!0)}drag(e){this.comment.moveDuringDrag(e)}endDrag(){this.fireDragEndEvent(),this.fireMoveEvent();let e;(e=this.workspace.getLayerManager())==null||e.moveOffDragLayer(this.comment,Do),this.comment.setDragging(!1),this.comment.snapToGrid(),this.workspace.setResizesEnabled(!0),this.inGroup||i.setGroup$$module$build$src$core$events$utils(!1)}fireDragStartEvent(){const e=new(G(O.COMMENT_DRAG))(this.comment,!0);z(e)}fireDragEndEvent(){const e=new(G(O.COMMENT_DRAG))(this.comment,!1);z(e)}fireMoveEvent(){if(!this.comment.isDeadOrDying()){var e=new(G(O.COMMENT_MOVE))(this.comment);e.setReason(["drag"]),e.oldCoordinate_=this.startLoc,e.recordNew(),z(e)}}revertDrag(){this.startLoc&&this.comment.moveDuringDrag(this.startLoc)}},gv=new WeakMap,mv=class{constructor(e){this.workspace=e,this.size=new Le(120,100),this.collapsed=!1,this.editable=!0,this.location=new V(0,0),this.text="",this.textChangeListeners=[],this.sizeChangeListeners=[],this.disposeListeners=[],this.collapseChangeListeners=[],this.resizePointerMoveListener=this.resizePointerUpListener=null,this.disposed=this.disposing=!1,this.svgRoot=N(x.G,{class:"blocklyComment blocklyEditable blocklyDraggable"}),this.highlightRect=this.createHighlightRect(this.svgRoot),{topBarGroup:this.topBarGroup,topBarBackground:this.topBarBackground,deleteIcon:this.deleteIcon,foldoutIcon:this.foldoutIcon,textPreview:this.textPreview,textPreviewNode:this.textPreviewNode}=this.createTopBar(this.svgRoot,e),{foreignObject:this.foreignObject,textArea:this.textArea}=this.createTextArea(this.svgRoot),this.resizeHandle=this.createResizeHandle(this.svgRoot,e);let t;(t=e.getLayerManager())==null||t.append(this,Do),this.setSizeWithoutFiringEvents(this.size),this.moveTo(new V(0,0))}createHighlightRect(e){return N(x.RECT,{class:"blocklyCommentHighlight"},e)}createTopBar(e,t){e=N(x.G,{class:"blocklyCommentTopbar"},e);const o=N(x.RECT,{class:"blocklyCommentTopbarBackground"},e),n=N(x.IMAGE,{class:"blocklyDeleteIcon",href:`${t.options.pathToMedia}delete-icon.svg`},e);t=N(x.IMAGE,{class:"blocklyFoldoutIcon",href:`${t.options.pathToMedia}foldout-icon.svg`},e);const c=N(x.TEXT,{class:"blocklyCommentPreview blocklyCommentText blocklyText"},e),h=document.createTextNode("");return c.appendChild(h),X(t,"pointerdown",this,this.onFoldoutDown),X(n,"pointerdown",this,this.onDeleteDown),{topBarGroup:e,topBarBackground:o,deleteIcon:n,foldoutIcon:t,textPreview:c,textPreviewNode:h}}createTextArea(e){e=N(x.FOREIGNOBJECT,{class:"blocklyCommentForeignObject"},e);const t=document.createElementNS(Fs,"body");t.setAttribute("xmlns",Fs),t.className="blocklyMinimalBody";const o=document.createElementNS(Fs,"textarea");return ge(o,"blocklyCommentText"),ge(o,"blocklyTextarea"),ge(o,"blocklyText"),t.appendChild(o),e.appendChild(t),X(o,"change",this,this.onTextChange),{foreignObject:e,textArea:o}}createResizeHandle(e,t){return e=N(x.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),X(e,"pointerdown",this,this.onResizePointerDown),e}getSvgRoot(){return this.svgRoot}getSize(){return this.collapsed?this.topBarBackground.getBBox():this.size}setSizeWithoutFiringEvents(e){const t=this.topBarBackground.getBBox(),o=this.deleteIcon.getBBox(),n=this.foldoutIcon.getBBox(),c=this.textPreview.getBBox(),h=this.resizeHandle.getBBox();this.size=e=Le.max(e,this.calcMinSize(t,n,o)),this.svgRoot.setAttribute("height",`${e.height}`),this.svgRoot.setAttribute("width",`${e.width}`),this.updateHighlightRect(e),this.updateTopBarSize(e),this.updateTextAreaSize(e,t),this.updateDeleteIconPosition(e,t,o),this.updateFoldoutIconPosition(t,n),this.updateTextPreviewSize(e,t,c,o,h),this.updateResizeHandlePosition(e,h)}setSize(e){const t=this.preResizeSize||this.size;this.setSizeWithoutFiringEvents(e),this.onSizeChange(t,this.size)}calcMinSize(e,t,o){var n;this.updateTextPreview((n=this.textArea.value)!=null?n:""),n=uu(this.textPreview);const c=this.calcFoldoutMargin(e,t),h=this.calcDeleteMargin(e,o);let $=n;return this.foldoutIcon.checkVisibility()?$+=t.width+2*c:n&&($+=4),this.deleteIcon.checkVisibility()?$+=o.width+2*h:n&&($+=4),new Le($,e.height+20)}calcDeleteMargin(e,t){return(e.height-t.height)/2}calcFoldoutMargin(e,t){return(e.height-t.height)/2}updateHighlightRect(e){this.highlightRect.setAttribute("height",`${e.height}`),this.highlightRect.setAttribute("width",`${e.width}`),this.workspace.RTL&&this.highlightRect.setAttribute("x",`${-e.width}`)}updateTopBarSize(e){this.topBarBackground.setAttribute("width",`${e.width}`)}updateTextAreaSize(e,t){this.foreignObject.setAttribute("height",`${e.height-t.height}`),this.foreignObject.setAttribute("width",`${e.width}`),this.foreignObject.setAttribute("y",`${t.height}`),this.workspace.RTL&&this.foreignObject.setAttribute("x",`${-e.width}`)}updateDeleteIconPosition(e,t,o){t=this.calcDeleteMargin(t,o),this.deleteIcon.setAttribute("y",`${t}`),this.deleteIcon.setAttribute("x",`${e.width-o.width-t}`)}updateFoldoutIconPosition(e,t){e=this.calcFoldoutMargin(e,t),this.foldoutIcon.setAttribute("y",`${e}`),this.foldoutIcon.setAttribute("x",`${e}`)}updateTextPreviewSize(e,t,o,n,c){const h=(t.height-o.height)/2,$=this.calcDeleteMargin(t,n);t=this.calcFoldoutMargin(t,c),e=e.width-c.width-2*t-n.width-2*$,this.textPreview.setAttribute("x",`${c.width+2*t*(this.workspace.RTL?-1:1)}`),this.textPreview.setAttribute("y",`${h+o.height/2}`),this.textPreview.setAttribute("width",`${e}`)}updateResizeHandlePosition(e,t){this.resizeHandle.setAttribute("y",`${e.height-t.height}`),this.resizeHandle.setAttribute("x",`${e.width-t.width}`)}onSizeChange(e,t){for(let o=this.sizeChangeListeners.length-1;0<=o;o--)this.sizeChangeListeners[o](e,t)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}removeSizeChangeListener(e){this.sizeChangeListeners.splice(this.sizeChangeListeners.indexOf(e),1)}onResizePointerDown(e){this.isEditable()&&(this.bringToFront(),ve(e)||(this.preResizeSize=this.getSize(),Ba(this.workspace,e,new V(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=X(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=X(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation())}onResizePointerUp(e){ke(),this.resizePointerUpListener&&(ze(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(ze(this.resizePointerMoveListener),this.resizePointerMoveListener=null),this.setSize(this.size),this.preResizeSize=void 0}onResizePointerMove(e){e=ja(this.workspace,e),this.setSizeWithoutFiringEvents(new Le(this.workspace.RTL?-e.x:e.x,e.y))}isCollapsed(){return this.collapsed}setCollapsed(e){(this.collapsed=e)?ge(this.svgRoot,"blocklyCollapsed"):ot(this.svgRoot,"blocklyCollapsed"),this.setSizeWithoutFiringEvents(this.size),this.onCollapse()}onCollapse(){for(let e=this.collapseChangeListeners.length-1;0<=e;e--)this.collapseChangeListeners[e](this.collapsed)}addOnCollapseListener(e){this.collapseChangeListeners.push(e)}removeOnCollapseListener(e){this.collapseChangeListeners.splice(this.collapseChangeListeners.indexOf(e),1)}onFoldoutDown(e){ke(),this.bringToFront(),ve(e)||(this.setCollapsed(!this.collapsed),this.workspace.hideChaff()),e.stopPropagation()}isEditable(){return this.editable}setEditable(e){(this.editable=e)?(ge(this.svgRoot,"blocklyEditable"),ot(this.svgRoot,"blocklyReadonly"),this.textArea.removeAttribute("readonly")):(ot(this.svgRoot,"blocklyEditable"),ge(this.svgRoot,"blocklyReadonly"),this.textArea.setAttribute("readonly","true"))}getRelativeToSurfaceXY(){return this.location}moveTo(e){this.location=e,this.svgRoot.setAttribute("transform",`translate(${e.x}, ${e.y})`)}getText(){return this.text}setText(e){this.textArea.value=e,this.onTextChange()}addTextChangeListener(e){this.textChangeListeners.push(e)}removeTextChangeListener(e){this.textChangeListeners.splice(this.textChangeListeners.indexOf(e),1)}onTextChange(){const e=this.text;this.text=this.textArea.value,this.updateTextPreview(this.text),this.setSize(this.size);for(let t=this.textChangeListeners.length-1;0<=t;t--)this.textChangeListeners[t](e,this.text)}updateTextPreview(e){this.textPreviewNode.textContent=this.truncateText(e)}truncateText(e){return 12<=e.length?`${e.substring(0,9)}...`:e}bringToFront(){const e=this.svgRoot.parentNode,t=e.childNodes;t[t.length-1]!==this.svgRoot&&e.appendChild(this.svgRoot)}onDeleteDown(e){ke(),ve(e)||this.dispose(),e.stopPropagation()}dispose(){this.disposing=!0,Ke(this.svgRoot);for(let e=this.disposeListeners.length-1;0<=e;e--)this.disposeListeners[e]();this.disposed=!0}isDisposed(){return this.disposed}isDeadOrDying(){return this.disposing||this.disposed}addDisposeListener(e){this.disposeListeners.push(e)}removeDisposeListener(e){this.disposeListeners.splice(this.disposeListeners.indexOf(e),1)}};Et(`
739
+ .injectionDiv {
740
+ --commentFillColour: #FFFCC7;
741
+ --commentBorderColour: #F2E49B;
742
+ }
743
+
744
+ .blocklyComment .blocklyTextarea {
745
+ background-color: var(--commentFillColour);
746
+ border: 1px solid var(--commentBorderColour);
747
+ box-sizing: border-box;
748
+ display: block;
749
+ outline: 0;
750
+ padding: 5px;
751
+ resize: none;
752
+ width: 100%;
753
+ height: 100%;
754
+ }
755
+
756
+ .blocklyReadonly.blocklyComment .blocklyTextarea {
757
+ cursor: inherit;
758
+ }
759
+
760
+ .blocklyDeleteIcon {
761
+ width: 20px;
762
+ height: 20px;
763
+ display: none;
764
+ cursor: pointer;
765
+ }
766
+
767
+ .blocklyFoldoutIcon {
768
+ width: 20px;
769
+ height: 20px;
770
+ transform-origin: 12px 12px;
771
+ cursor: pointer;
772
+ }
773
+ .blocklyResizeHandle {
774
+ width: 12px;
775
+ height: 12px;
776
+ cursor: se-resize;
777
+ }
778
+ .blocklyReadonly.blocklyComment .blocklyResizeHandle {
779
+ cursor: inherit;
780
+ }
781
+
782
+ .blocklyCommentTopbarBackground {
783
+ fill: var(--commentBorderColour);
784
+ height: 24px;
785
+ }
786
+
787
+ .blocklyComment .blocklyCommentPreview.blocklyText {
788
+ fill: #000;
789
+ dominant-baseline: middle;
790
+ visibility: hidden;
791
+ }
792
+
793
+ .blocklyCollapsed.blocklyComment .blocklyCommentPreview {
794
+ visibility: visible;
795
+ }
796
+
797
+ .blocklyCollapsed.blocklyComment .blocklyCommentForeignObject,
798
+ .blocklyCollapsed.blocklyComment .blocklyResizeHandle {
799
+ display: none;
800
+ }
801
+
802
+ .blocklyCollapsed.blocklyComment .blocklyFoldoutIcon {
803
+ transform: rotate(-90deg);
804
+ }
805
+
806
+ .blocklyRTL .blocklyCommentTopbar {
807
+ transform: scale(-1, 1);
808
+ }
809
+
810
+ .blocklyRTL .blocklyCommentForeignObject {
811
+ direction: rtl;
812
+ }
813
+
814
+ .blocklyRTL .blocklyCommentPreview {
815
+ /* Revert the scale and control RTL using direction instead. */
816
+ transform: scale(-1, 1);
817
+ direction: rtl;
818
+ }
819
+
820
+ .blocklyRTL .blocklyResizeHandle {
821
+ transform: scale(-1, 1);
822
+ cursor: sw-resize;
823
+ }
824
+
825
+ .blocklyCommentHighlight {
826
+ fill: none;
827
+ }
828
+
829
+ .blocklySelected .blocklyCommentHighlight {
830
+ stroke: #fc3;
831
+ stroke-width: 3px;
832
+ }
833
+
834
+ .blocklyCollapsed.blocklySelected .blocklyCommentHighlight {
835
+ stroke: none;
836
+ }
837
+
838
+ .blocklyCollapsed.blocklySelected .blocklyCommentTopbarBackground {
839
+ stroke: #fc3;
840
+ stroke-width: 3px;
841
+ }
842
+ `);var Tl=class{constructor(e,t){this.workspace=e,this.text="",this.size=new Le(120,100),this.collapsed=!1,this.deletable=this.movable=this.editable=!0,this.location=new V(0,0),this.disposing=this.disposed=!1,this.id=t&&!e.getCommentById(t)?t:C(),e.addTopComment(this),this.fireCreateEvent()}fireCreateEvent(){K()&&z(new(G(O.COMMENT_CREATE))(this))}fireDeleteEvent(){K()&&z(new(G(O.COMMENT_DELETE))(this))}fireChangeEvent(e,t){K()&&z(new(G(O.COMMENT_CHANGE))(this,e,t))}fireCollapseEvent(e){K()&&z(new(G(O.COMMENT_COLLAPSE))(this,e))}setText(e){const t=this.text;this.text=e,this.fireChangeEvent(t,e)}getText(){return this.text}setSize(e){const t=new(G(O.COMMENT_RESIZE))(this);this.size=e,t.recordCurrentSizeAsNewSize(),z(t)}getSize(){return this.size}setCollapsed(e){this.collapsed=e,this.fireCollapseEvent(e)}isCollapsed(){return this.collapsed}setEditable(e){this.editable=e}isEditable(){return this.isOwnEditable()&&!this.workspace.options.readOnly}isOwnEditable(){return this.editable}setMovable(e){this.movable=e}isMovable(){return this.isOwnMovable()&&!this.workspace.options.readOnly}isOwnMovable(){return this.movable}setDeletable(e){this.deletable=e}isDeletable(){return this.isOwnDeletable()&&!this.isDeadOrDying()&&!this.workspace.options.readOnly}isOwnDeletable(){return this.deletable}moveTo(e,t){const o=new(G(O.COMMENT_MOVE))(this);t&&o.setReason(t),this.location=e,o.recordNew(),z(o)}getRelativeToSurfaceXY(){return this.location}dispose(){this.disposing=!0,this.fireDeleteEvent(),this.workspace.removeTopComment(this),this.disposed=!0}isDisposed(){return this.disposed}isDeadOrDying(){return this.disposing||this.disposed}},kl=class extends Tl{constructor(e,t){super(e,t),this.dragStrategy=new pv(this),this.workspace=e,this.view=new mv(e),this.view.setSize(this.getSize()),this.view.setEditable(this.isEditable()),this.view.getSvgRoot().setAttribute("data-id",this.id),this.addModelUpdateBindings(),X(this.view.getSvgRoot(),"pointerdown",this,this.startGesture),X(this.view.getSvgRoot(),"wheel",this,o=>{o.stopPropagation()})}addModelUpdateBindings(){this.view.addTextChangeListener((e,t)=>{super.setText(t)}),this.view.addSizeChangeListener((e,t)=>{super.setSize(t)}),this.view.addOnCollapseListener(()=>{super.setCollapsed(this.view.isCollapsed())}),this.view.addDisposeListener(()=>{this.isDeadOrDying()||this.dispose()})}setText(e){this.view.setText(e)}setSize(e){this.view.setSize(e)}setCollapsed(e){this.view.setCollapsed(e)}setEditable(e){super.setEditable(e),this.view.setEditable(this.isEditable())}getSvgRoot(){return this.view.getSvgRoot()}getSize(){return super.getSize()}getBoundingRectangle(){const e=this.getRelativeToSurfaceXY();var t,o;const n=(o=(t=this.view)==null?void 0:t.getSize())!=null?o:this.getSize();return this.workspace.RTL?(t=e.x-n.width,o=e.x):(t=e.x,o=e.x+n.width),new qe(e.y,e.y+n.height,t,o)}moveBy(e,t,o){const n=this.getRelativeToSurfaceXY();e=new V(n.x+e,n.y+t),this.moveTo(e,o)}moveTo(e,t){super.moveTo(e,t),this.view.moveTo(e)}moveDuringDrag(e){this.location=e,this.view.moveTo(e)}setDragging(e){e?ge(this.getSvgRoot(),"blocklyDragging"):ot(this.getSvgRoot(),"blocklyDragging")}dispose(){this.disposing=!0,this.view.isDeadOrDying()||this.view.dispose(),super.dispose()}startGesture(e){const t=this.workspace.getGesture(e);if(t){if(kt(e))e.stopPropagation();else{t.handleCommentStart(e,this);let o;(o=this.workspace.getLayerManager())==null||o.append(this,Do)}i.setSelected$$module$build$src$core$common(this)}}setDeleteStyle(e){e?ge(this.getSvgRoot(),"blocklyDraggingDelete"):ot(this.getSvgRoot(),"blocklyDraggingDelete")}isMovable(){return this.dragStrategy.isMovable()}startDrag(){this.dragStrategy.startDrag()}drag(e){this.dragStrategy.drag(e)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){ge(this.getSvgRoot(),"blocklySelected")}unselect(){ot(this.getSvgRoot(),"blocklySelected")}toCopyData(){return{paster:ul.TYPE,commentState:xi(this,{addCoordinates:!0})}}showContextMenu(e){const t=xe.registry.getContextMenuOptions(xe.ScopeType.COMMENT,{comment:this});Jn(e,t,this.workspace.RTL,this.workspace)}snapToGrid(){if(!this.isDeadOrDying()){var e=this.workspace.getGrid();if(e!=null&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();e=e.alignXY(t),e!==t&&this.moveTo(e,["snap"])}}}},Lt={};Lt.appendDomToWorkspace=u$,Lt.blockToDom=wo,Lt.blockToDomWithXY=Zn,Lt.clearWorkspaceAndLoadFromXml=c$,Lt.deleteNext=v$,Lt.domToBlock=i.domToBlock$$module$build$src$core$xml,Lt.domToBlockInternal=qo,Lt.domToPrettyText=l$,Lt.domToText=Ls,Lt.domToVariables=md,Lt.domToWorkspace=i.domToWorkspace$$module$build$src$core$xml,Lt.loadWorkspaceComment=gd,Lt.saveWorkspaceComment=Xn,Lt.variablesToDom=hd,Lt.workspaceToDom=n$;var Xh=class extends ni{constructor(e){super(e),this.type=O.BLOCK_CREATE,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=Zn(e),this.ids=he(e),this.json=Qt(e,{addCoordinates:!0}))}toJson(){const e=super.toJson();if(!this.xml)throw Error("The block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Ls(this.xml),e.ids=this.ids,e.json=this.json,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Xh),t.xml=i.textToDom$$module$build$src$core$utils$xml(e.xml),t.ids=e.ids,t.json=e.json,e.recordUndo!==void 0&&(t.recordUndo=e.recordUndo),t}run(e){const t=this.getEventWorkspace_();if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!WT(t,this.ids))if(e)eo(this.json,t);else for(e=0;e<this.ids.length;e++){const o=this.ids[e],n=t.getBlockById(o);n?n.dispose(!1):o===this.blockId&&console.warn("Can't uncreate non-existent block: "+o)}}},WT=function(e,t){return t.map(o=>e.getBlockById(o)).filter(o=>o&&o.isShadow()).length===t.length};r(F.EVENT,O.BLOCK_CREATE,Xh);var Zh=class extends Cs{constructor(e,t){super(t),this.type=O.THEME_CHANGE,this.themeName=e}toJson(){const e=super.toJson();if(!this.themeName)throw Error("The theme name is undefined. Either pass a theme name to the constructor, or call fromJson");return e.themeName=this.themeName,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Zh),t.themeName=e.themeName,t}};r(F.EVENT,O.THEME_CHANGE,Zh);var Qh=class extends Cs{constructor(e,t,o,n,c){super(n),this.type=O.VIEWPORT_CHANGE,this.viewTop=e,this.viewLeft=t,this.scale=o,this.oldScale=c}toJson(){const e=super.toJson();if(this.viewTop===void 0)throw Error("The view top is undefined. Either pass a value to the constructor, or call fromJson");if(this.viewLeft===void 0)throw Error("The view left is undefined. Either pass a value to the constructor, or call fromJson");if(this.scale===void 0)throw Error("The scale is undefined. Either pass a value to the constructor, or call fromJson");if(this.oldScale===void 0)throw Error("The old scale is undefined. Either pass a value to the constructor, or call fromJson");return e.viewTop=this.viewTop,e.viewLeft=this.viewLeft,e.scale=this.scale,e.oldScale=this.oldScale,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Qh),t.viewTop=e.viewTop,t.viewLeft=e.viewLeft,t.scale=e.scale,t.oldScale=e.oldScale,t}};r(F.EVENT,O.VIEWPORT_CHANGE,Qh);var oe;(function(e){e[e.INPUT_VALUE=1]="INPUT_VALUE",e[e.OUTPUT_VALUE=2]="OUTPUT_VALUE",e[e.NEXT_STATEMENT=3]="NEXT_STATEMENT",e[e.PREVIOUS_STATEMENT=4]="PREVIOUS_STATEMENT"})(oe||(oe={}));var tn=class{constructor(e){this.connectionChecker=e,this.connections=[]}addConnection(e,t){t=this.calculateIndexForYPos(t),this.connections.splice(t,0,e)}findIndexOfConnection(e,t){if(!this.connections.length)return-1;const o=this.calculateIndexForYPos(t);if(o>=this.connections.length)return-1;t=e.y;let n=o;for(;0<=n&&this.connections[n].y===t;){if(this.connections[n]===e)return n;n--}for(n=o;n<this.connections.length&&this.connections[n].y===t;){if(this.connections[n]===e)return n;n++}return-1}calculateIndexForYPos(e){if(!this.connections.length)return 0;let t=0,o=this.connections.length;for(;t<o;){const n=Math.floor((t+o)/2);if(this.connections[n].y<e)t=n+1;else if(this.connections[n].y>e)o=n;else{t=n;break}}return t}removeConnection(e,t){if(e=this.findIndexOfConnection(e,t),e===-1)throw Error("Unable to find connection in connectionDB.");this.connections.splice(e,1)}getNeighbours(e,t){function o(te){const nt=c-n[te].x,it=h-n[te].y;return Math.sqrt(nt*nt+it*it)<=t&&L.push(n[te]),it<t}const n=this.connections,c=e.x,h=e.y;e=0;let $=n.length-2,T=$;for(;e<T;)n[T].y<h?e=T:$=T,T=Math.floor((e+$)/2);const L=[];if($=e=T,n.length){for(;0<=e&&o(e);)e--;do $++;while($<n.length&&o($))}return L}isInYRange(e,t,o){return Math.abs(this.connections[e].y-t)<=o}searchForClosest(e,t,o){if(!this.connections.length)return{connection:null,radius:t};const n=e.y,c=e.x;e.x=c+o.x,e.y=n+o.y;var h=this.calculateIndexForYPos(e.y);o=null;let $=t,T,L=h-1;for(;0<=L&&this.isInYRange(L,e.y,t);)T=this.connections[L],this.connectionChecker.canConnect(e,T,!0,$)&&(o=T,$=T.distanceFrom(e)),L--;for(;h<this.connections.length&&this.isInYRange(h,e.y,t);)T=this.connections[h],this.connectionChecker.canConnect(e,T,!0,$)&&(o=T,$=T.distanceFrom(e)),h++;return e.x=c,e.y=n,{connection:o,radius:$}}static init(e){const t=[];return t[oe.INPUT_VALUE]=new tn(e),t[oe.OUTPUT_VALUE]=new tn(e),t[oe.NEXT_STATEMENT]=new tn(e),t[oe.PREVIOUS_STATEMENT]=new tn(e),t}},Sl=null,vr=null,yr={};yr.connectionUiEffect=Ua,yr.disconnectUiEffect=vd,yr.disconnectUiStop=ji,yr.disposeUiEffect=za;var fv=class{constructor(e){this.workspace=e,this.horizontalScrollEnabled=this.workspace.isMovableHorizontally(),this.verticalScrollEnabled=this.workspace.isMovableVertically(),this.startScrollXY_=new V(e.scrollX,e.scrollY)}dispose(){this.workspace=null}startDrag(){I()&&I().unselect()}endDrag(e){this.drag(e)}drag(e){if(e=V.sum(this.startScrollXY_,e),this.horizontalScrollEnabled&&this.verticalScrollEnabled)this.workspace.scroll(e.x,e.y);else if(this.horizontalScrollEnabled)this.workspace.scroll(e.x,this.workspace.scrollY);else if(this.verticalScrollEnabled)this.workspace.scroll(this.workspace.scrollX,e.y);else throw new TypeError("Invalid state.")}},VT=5,GT=6,co=class{constructor(e,t){this.creatorWorkspace=t,this.mouseDownXY=new V(0,0),this.startWorkspace_=this.targetBlock=this.startComment=this.startBlock=this.startIcon=this.startField=this.startBubble=null,this.hasExceededDragRadius=!1,this.boundEvents=[],this.workspaceDragger=this.dragger=null,this.dragging=!1,this.flyout=null,this.multiTouch=this.isEnding_=this.gestureHasStarted=this.calledUpdateIsDragging=!1,this.cachedPoints=new Map,this.startDistance=this.previousScale=0,this.currentDropdownOwner=this.isPinchZoomEnabled=null,this.mostRecentEvent=e,this.currentDragDeltaXY=new V(0,0)}dispose(){ke(),Qu(),this.creatorWorkspace.clearGesture();for(const e of this.boundEvents)ze(e);this.boundEvents.length=0,this.workspaceDragger&&this.workspaceDragger.dispose()}updateFromEvent(e){const t=new V(e.clientX,e.clientY);this.updateDragDelta(t)&&(this.updateIsDragging(e),_e()),this.mostRecentEvent=e}updateDragDelta(e){return this.currentDragDeltaXY=V.difference(e,this.mouseDownXY),this.hasExceededDragRadius?!1:this.hasExceededDragRadius=V.magnitude(this.currentDragDeltaXY)>(this.flyout?i.config$$module$build$src$core$config.flyoutDragRadius:i.config$$module$build$src$core$config.dragRadius)}updateIsDraggingFromFlyout(){let e;if(!this.targetBlock||(e=this.flyout)==null||!e.isBlockCreatable(this.targetBlock))return!1;if(!this.flyout.targetWorkspace)throw Error(`Cannot update dragging from the flyout because the ' +
843
+ 'flyout's target workspace is undefined`);return!this.flyout.isScrollable()||this.flyout.isDragTowardWorkspace(this.currentDragDeltaXY)?(this.startWorkspace_=this.flyout.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),i.getGroup$$module$build$src$core$events$utils()||i.setGroup$$module$build$src$core$events$utils(!0),this.startBlock=null,this.targetBlock=this.flyout.createBlock(this.targetBlock),i.setSelected$$module$build$src$core$common(this.targetBlock),!0):!1}updateIsDraggingWorkspace(){if(!this.startWorkspace_)throw Error("Cannot update dragging the workspace because the start workspace is undefined");(this.flyout?this.flyout.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.dragging=!0,this.workspaceDragger=new fv(this.startWorkspace_),this.workspaceDragger.startDrag())}updateIsDragging(e){if(!this.startWorkspace_)throw Error("Cannot update dragging because the start workspace is undefined");if(this.calledUpdateIsDragging)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging=!0,this.flyout&&this.updateIsDraggingFromFlyout();const t=I();t&&Xo(t)&&t.isMovable()?(this.dragging=!0,this.dragger=this.createDragger(t,this.startWorkspace_),this.dragger.onDragStart(e),this.dragger.onDrag(e,this.currentDragDeltaXY)):this.updateIsDraggingWorkspace()}createDragger(e,t){return new(_(F.BLOCK_DRAGGER,this.creatorWorkspace.options,!0))(e,t)}doStart(e){if(!this.startWorkspace_)throw Error("Cannot start the touch gesture becauase the start workspace is undefined");this.isPinchZoomEnabled=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch,kt(e)?this.cancel():(this.gestureHasStarted=!0,ji(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=Ou(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,Zu(),ve(e)?this.handleRightClick(e):(e.type.toLowerCase()==="pointerdown"&&e.pointerType!=="mouse"&&Je(e,this),this.mouseDownXY=new V(e.clientX,e.clientY),this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(X(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(X(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(X(document,"pointerup",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&_e())}handleMove(e){this.isDragging()&&$e(e)||!this.isMultiTouch()?(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.dragger&&this.dragger.onDrag(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation()):this.isMultiTouch()&&(this.handleTouchMove(e),_e())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!$e(e))return;if(this.updateFromEvent(e),_e(),this.isEnding_){console.log("Trying to end a gesture recursively.");return}this.isEnding_=!0,this.dragger?this.dragger.onDragEnd(e,this.currentDragDeltaXY):this.workspaceDragger?this.workspaceDragger.endDrag(this.currentDragDeltaXY):this.isBubbleClick()||this.isCommentClick()||(this.isFieldClick()?this.doFieldClick():this.isIconClick()?this.doIconClick():this.isBlockClick()?this.doBlockClick():this.isWorkspaceClick()&&this.doWorkspaceClick(e))}e.preventDefault(),e.stopPropagation(),this.dispose()}handleTouchStart(e){var t=Pe(e);this.cachedPoints.set(t,this.getTouchPoint(e));var o=Array.from(this.cachedPoints.keys());o.length===2&&(t=this.cachedPoints.get(o[0]),o=this.cachedPoints.get(o[1]),this.startDistance=V.distance(t,o),this.multiTouch=!0,e.preventDefault())}handleTouchMove(e){const t=Pe(e);this.cachedPoints.set(t,this.getTouchPoint(e)),this.isPinchZoomEnabled&&this.cachedPoints.size===2?this.handlePinch(e):(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.dragger&&this.dragger.onDrag(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation())}handlePinch(e){var t=Array.from(this.cachedPoints.keys()),o=this.cachedPoints.get(t[0]);if(t=this.cachedPoints.get(t[1]),o=V.distance(o,t)/this.startDistance,0<this.previousScale&&1/0>this.previousScale){if(t=o-this.previousScale,t=0<t?t*VT:t*GT,!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");const n=this.startWorkspace_,c=st(e,n.getParentSvg(),n.getInverseScreenCTM());n.zoom(c.x,c.y,t)}this.previousScale=o,e.preventDefault()}handleTouchEnd(e){e=Pe(e),this.cachedPoints.has(e)&&this.cachedPoints.delete(e),2>this.cachedPoints.size&&(this.cachedPoints.clear(),this.previousScale=0)}getTouchPoint(e){return this.startWorkspace_?new V(e.pageX,e.pageY):null}isMultiTouch(){return this.multiTouch}cancel(){this.isEnding_||(_e(),this.dragger?this.dragger.onDragEnd(this.mostRecentEvent,this.currentDragDeltaXY):this.workspaceDragger&&this.workspaceDragger.endDrag(this.currentDragDeltaXY),this.dispose())}handleRightClick(e){this.targetBlock?(this.bringBlockToFront(),this.targetBlock.workspace.hideChaff(!!this.flyout),this.targetBlock.showContextMenu(e)):this.startBubble?this.startBubble.showContextMenu(e):this.startComment?(this.startComment.workspace.hideChaff(),this.startComment.showContextMenu(e)):this.startWorkspace_&&!this.flyout&&(this.startWorkspace_.hideChaff(),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),this.dispose()}handleWsStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace(t),this.mostRecentEvent=e,this.startBlock||this.startBubble||this.startComment||i.setSelected$$module$build$src$core$common(null),this.doStart(e)}fireWorkspaceClick(e){z(new(G(O.CLICK))(null,e.id,"workspace"))}handleFlyoutStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout(t),this.handleWsStart(e,t.getWorkspace())}handleBlockStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(t),this.mostRecentEvent=e}handleBubbleStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(t),this.mostRecentEvent=e}handleCommentStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleCommentStart, but the gesture had already been started.");this.setStartComment(t),this.mostRecentEvent=e}doFieldClick(){if(!this.startField)throw Error("Cannot do a field click because the start field is undefined");this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent),this.bringBlockToFront()}doIconClick(){if(!this.startIcon)throw Error("Cannot do an icon click because the start icon is undefined");this.bringBlockToFront(),this.startIcon.onClick()}doBlockClick(){if(this.flyout&&this.flyout.autoClose){if(!this.targetBlock)throw Error("Cannot do a block click because the target block is undefined");if(this.targetBlock.isEnabled()){i.getGroup$$module$build$src$core$events$utils()||i.setGroup$$module$build$src$core$events$utils(!0);var e=this.flyout.createBlock(this.targetBlock);e.snapToGrid(),e.bumpNeighbours()}}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");e=new(G(O.CLICK))(this.startBlock,this.startWorkspace_.id,"block"),z(e)}this.bringBlockToFront(),i.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){e=this.creatorWorkspace,I()&&I().unselect(),this.fireWorkspaceClick(this.startWorkspace_||e)}bringBlockToFront(){this.targetBlock&&!this.flyout&&this.targetBlock.bringToFront()}setStartField(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField||(this.startField=e)}setStartIcon(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartIcon, but the gesture had already been started.");this.startIcon||(this.startIcon=e)}setStartBubble(e){this.startBubble||(this.startBubble=e)}setStartComment(e){this.startComment||(this.startComment=e)}setStartBlock(e){this.startBlock||this.startBubble||(this.startBlock=e,i.setSelected$$module$build$src$core$common(this.startBlock),e.isInFlyout&&e!==e.getRootBlock()?this.setTargetBlock(e.getRootBlock()):this.setTargetBlock(e))}setTargetBlock(e){e.isShadow()?this.setTargetBlock(e.getParent()):this.targetBlock=e}setStartWorkspace(e){this.startWorkspace_||(this.startWorkspace_=e)}setStartFlyout(e){this.flyout||(this.flyout=e)}isBubbleClick(){return!!this.startBubble&&!this.hasExceededDragRadius}isCommentClick(){return!!this.startComment&&!this.hasExceededDragRadius}isBlockClick(){return!!this.startBlock&&!this.hasExceededDragRadius&&!this.isFieldClick()&&!this.isIconClick()}isFieldClick(){return this.startField?this.startField.isClickable()&&!this.hasExceededDragRadius&&(!this.flyout||this.startField.isClickableInFlyout(this.flyout.autoClose)):!1}isIconClick(){if(!this.startIcon)return!1;const e=!this.flyout||!this.startIcon.isClickableInFlyout||this.startIcon.isClickableInFlyout(this.flyout.autoClose);return!this.hasExceededDragRadius&&e}isWorkspaceClick(){return!this.startBlock&&!this.startBubble&&!this.startField&&!this.hasExceededDragRadius}getCurrentDragger(){let e,t;return(t=(e=this.workspaceDragger)!=null?e:this.dragger)!=null?t:null}isDragging(){return this.dragging}hasStarted(){return this.gestureHasStarted}static inProgress(){const e=ee();for(let t=0,o;o=e[t];t++)if(o.currentGesture_)return!0;return!1}},ep=class{constructor(e,t){this.pattern=e,this.scale=1;let o;this.spacing=(o=t.spacing)!=null?o:0;let n;this.length=(n=t.length)!=null?n:1,this.line2=(this.line1=e.firstChild)&&this.line1.nextSibling;let c;this.snapToGrid=(c=t.snap)!=null?c:!1}setSpacing(e){this.spacing=e,this.update(this.scale)}getSpacing(){return this.spacing}setLength(e){this.length=e,this.update(this.scale)}getLength(){return this.length}setSnapToGrid(e){this.snapToGrid=e}shouldSnap(){return this.snapToGrid}getPatternId(){return this.pattern.id}update(e){this.scale=e;var t=this.spacing*e;this.pattern.setAttribute("width",`${t}`),this.pattern.setAttribute("height",`${t}`),t=Math.floor(this.spacing/2)+.5;let o=t-this.length/2,n=t+this.length/2;t*=e,o*=e,n*=e,this.setLineAttributes(this.line1,e,o,n,t,t),this.setLineAttributes(this.line2,e,t,t,o,n)}setLineAttributes(e,t,o,n,c,h){e&&(e.setAttribute("stroke-width",`${t}`),e.setAttribute("x1",`${o}`),e.setAttribute("y1",`${c}`),e.setAttribute("x2",`${n}`),e.setAttribute("y2",`${h}`))}moveTo(e,t){this.pattern.setAttribute("x",`${e}`),this.pattern.setAttribute("y",`${t}`)}alignXY(e){var t=this.getSpacing();const o=t/2,n=Math.round(Math.round((e.x-o)/t)*t+o);return t=Math.round(Math.round((e.y-o)/t)*t+o),n===e.x&&t===e.y?e:new V(n,t)}static createDom(e,t,o){e=N(x.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},o);let n,c;if(0<((n=t.length)!=null?n:1)&&0<((c=t.spacing)!=null?c:0)){N(x.LINE,{stroke:t.colour},e);let h;(h=t.length)!=null&&h&&N(x.LINE,{stroke:t.colour},e)}else N(x.LINE,{},e);return e}},KT=class{constructor(e){this.workspace=e,this.layers=new Map,(e=e.getInjectionDiv())&&(this.dragLayer=this.createDragLayer(e),this.animationLayer=this.createAnimationLayer(e)),e=this.createLayer(Do),ge(e,"blocklyBlockCanvas"),e=this.createLayer(Cl),ge(e,"blocklyBubbleCanvas")}createDragLayer(e){const t=N(x.SVG,{class:"blocklyBlockDragSurface",xmlns:rr,"xmlns:html":Fs,"xmlns:xlink":es,version:"1.1"});return e.append(t),N(x.G,{},t)}createAnimationLayer(e){const t=N(x.SVG,{class:"blocklyAnimationLayer",xmlns:rr,"xmlns:html":Fs,"xmlns:xlink":es,version:"1.1"});return e.append(t),N(x.G,{},t)}appendToAnimationLayer(e){let t;const o=(t=this.dragLayer)==null?void 0:t.getAttribute("transform");if(o){let c;(c=this.animationLayer)==null||c.setAttribute("transform",o)}let n;(n=this.animationLayer)==null||n.appendChild(e.getSvgRoot())}translateLayers(e,t){e=`translate(${e.x}, ${e.y}) scale(${t})`;let o;(o=this.dragLayer)==null||o.setAttribute("transform",e);for(const[,n]of this.layers)n.setAttribute("transform",e)}moveToDragLayer(e){let t;(t=this.dragLayer)==null||t.appendChild(e.getSvgRoot())}moveOffDragLayer(e,t){this.append(e,t)}append(e,t){this.layers.has(t)||this.createLayer(t);let o;(o=this.layers.get(t))==null||o.appendChild(e.getSvgRoot())}createLayer(e){const t=this.workspace.getSvgGroup(),o=N(x.G,{});let n=!1;const c=[...this.layers].sort((h,$)=>h[0]-$[0]);for(const[h,$]of c)if(e<h){t.insertBefore(o,$),n=!0;break}return n||t.appendChild(o),this.layers.set(e,o),o}hasLayer(e){return e===this.dragLayer||new Set(this.layers.values()).has(e)}getBlockLayer(){return this.layers.get(Do)}getBubbleLayer(){return this.layers.get(Cl)}},$v={};$v.deepMerge=so;var di=class{constructor(e,t,o,n){this.name=e,this.startHats=!1,this.blockStyles=t||Object.create(null),this.categoryStyles=o||Object.create(null),this.componentStyles=n||Object.create(null),this.fontStyle=Object.create(null),r(F.THEME,e,this,!0)}getClassName(){return this.name+"-theme"}setBlockStyle(e,t){this.blockStyles[e]=t}setCategoryStyle(e,t){this.categoryStyles[e]=t}getComponentStyle(e){if(e=this.componentStyles[e],!e)return null;if(typeof e=="string"){const t=this.getComponentStyle(e);if(t)return t}return`${e}`}setComponentStyle(e,t){this.componentStyles[e]=t}setFontStyle(e){this.fontStyle=e}setStartHats(e){this.startHats=e}static defineTheme(e,t){e=e.toLowerCase();const o=new di(e);let n=t.base;if(n){if(typeof n=="string"){let c;n=(c=f(F.THEME,n))!=null?c:void 0}n instanceof di&&(so(o,n),o.name=e)}return so(o.blockStyles,t.blockStyles),so(o.categoryStyles,t.categoryStyles),so(o.componentStyles,t.componentStyles),so(o.fontStyle,t.fontStyle),t.startHats!==null&&(o.startHats=t.startHats),o}},YT={colour_blocks:{colourPrimary:"20"},list_blocks:{colourPrimary:"260"},logic_blocks:{colourPrimary:"210"},loop_blocks:{colourPrimary:"120"},math_blocks:{colourPrimary:"230"},procedure_blocks:{colourPrimary:"290"},text_blocks:{colourPrimary:"160"},variable_blocks:{colourPrimary:"330"},variable_dynamic_blocks:{colourPrimary:"310"},hat_blocks:{colourPrimary:"330",hat:"cap"}},JT={colour_category:{colour:"20"},list_category:{colour:"260"},logic_category:{colour:"210"},loop_category:{colour:"120"},math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}},El=new di("classic",YT,JT),ds=class{constructor(e){this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let t=null,o=!1;var n=!1,c=!1,h=!1,$=!1,T=!1;const L=!!e.readOnly;if(!L){var te;t=ga((te=e.toolbox)!=null?te:null),o=ma(t),n=e.trashcan,n=n===void 0?o:n,c=e.collapse,c=c===void 0?o:c,h=e.comments,h=h===void 0?o:h,$=e.disable,$=$===void 0?o:$,T=e.sounds,T=T===void 0?!0:T}te=e.maxTrashcanContents,n?te===void 0&&(te=32):te=0;const nt=!!e.rtl;let it=e.horizontalLayout;it===void 0&&(it=!1);var Xt=e.toolboxPosition!=="end";Xt=it?Xt?Ee.TOP:Ee.BOTTOM:Xt===nt?Ee.RIGHT:Ee.LEFT;let hn=e.css;hn===void 0&&(hn=!0);let Or="https://blockly-demo.appspot.com/static/media/";e.media&&(Or=e.media.endsWith("/")?e.media:e.media+"/");const Ky=e.oneBasedIndex,kk=e.renderer||"geras",Sk=e.plugins||{};let Kp=e.modalInputs;Kp===void 0&&(Kp=!0),this.RTL=nt,this.oneBasedIndex=Ky===void 0?!0:Ky,this.collapse=c,this.comments=h,this.disable=$,this.readOnly=L,this.maxBlocks=e.maxBlocks||1/0;let Yy;this.maxInstances=(Yy=e.maxInstances)!=null?Yy:null,this.modalInputs=Kp,this.pathToMedia=Or,this.hasCategories=o,this.moveOptions=ds.parseMoveOptions(e,o),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=n,this.maxTrashcanContents=te,this.hasSounds=T,this.hasCss=hn,this.horizontalLayout=it,this.languageTree=t,this.gridOptions=ds.parseGridOptions(e),this.zoomOptions=ds.parseZoomOptions(e),this.toolboxPosition=Xt,this.theme=ds.parseThemeOptions(e),this.renderer=kk;let Jy;this.rendererOverrides=(Jy=e.rendererOverrides)!=null?Jy:null;let qy;this.parentWorkspace=(qy=e.parentWorkspace)!=null?qy:null,this.plugins=Sk}static parseMoveOptions(e,t){const o=e.move||{},n={};return o.scrollbars===void 0&&e.scrollbars===void 0?n.scrollbars=t:typeof o.scrollbars=="object"?(n.scrollbars={horizontal:!!o.scrollbars.horizontal,vertical:!!o.scrollbars.vertical},n.scrollbars.horizontal&&n.scrollbars.vertical?n.scrollbars=!0:n.scrollbars.horizontal||n.scrollbars.vertical||(n.scrollbars=!1)):n.scrollbars=!!o.scrollbars||!!e.scrollbars,n.wheel=n.scrollbars&&o.wheel!==void 0?!!o.wheel:typeof n.scrollbars=="object",n.drag=n.scrollbars?o.drag===void 0?!0:!!o.drag:!1,n}static parseZoomOptions(e){e=e.zoom||{};const t={};return t.controls=e.controls===void 0?!1:!!e.controls,t.wheel=e.wheel===void 0?!1:!!e.wheel,t.startScale=e.startScale===void 0?1:Number(e.startScale),t.maxScale=e.maxScale===void 0?3:Number(e.maxScale),t.minScale=e.minScale===void 0?.3:Number(e.minScale),t.scaleSpeed=e.scaleSpeed===void 0?1.2:Number(e.scaleSpeed),t.pinch=e.pinch===void 0?t.wheel||t.controls:!!e.pinch,t}static parseGridOptions(e){e=e.grid||{};const t={};return t.spacing=Number(e.spacing)||0,t.colour=e.colour||"#888",t.length=e.length===void 0?1:Number(e.length),t.snap=0<t.spacing&&!!e.snap,t}static parseThemeOptions(e){return e=e.theme||El,typeof e=="string"?f(F.THEME,e):e instanceof di?e:di.defineTheme(e.name||"builtin"+k(),e)}},bv={fromJsonInternal:_$},Il={TEST_ONLY:bv};Il.fromJson=i.fromJson$$module$build$src$core$field_registry,Il.register=Ps,Il.unregister=y$;var qt=class extends Qe{constructor(e,t,o){super(Qe.SKIP_SETUP),this.svgArrow=this.arrow=this.imageElement=this.menu_=this.selectedMenuItem=null,this.SERIALIZABLE=!0,this.CURSOR="default",this.clickTarget_=this.suffixField=this.prefixField=this.generatedOptions=null,e!==Qe.SKIP_SETUP&&(Array.isArray(e)?(this.validateOptions(e),e=this.trimOptions(e),this.menuGenerator_=e.options,this.prefixField=e.prefix||null,this.suffixField=e.suffix||null):this.menuGenerator_=e,this.selectedOption=this.getOptions(!1)[0],o&&this.configure_(o),this.setValue(this.selectedOption[1]),t&&this.setValidator(t))}fromXml(e){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e.textContent)}loadState(e){this.loadLegacyState(qt,e)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement=N(x.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&ge(this.borderRect_,"blocklyDropdownRect")}shouldAddBorderRect_(){let e;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!((e=this.getSourceBlock())!=null&&e.isShadow())}createTextArrow_(){this.arrow=N(x.TSPAN,{},this.textElement_);let e;this.arrow.appendChild(document.createTextNode((e=this.getSourceBlock())!=null&&e.RTL?qt.ARROW_CHAR+" ":" "+qt.ARROW_CHAR)),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.arrow.setAttribute("dominant-baseline","central");let t;(t=this.getSourceBlock())!=null&&t.RTL?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=N(x.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow.setAttributeNS(es,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(e){var t=this.getSourceBlock();if(!t)throw new ft;this.dropdownCreate(),this.menu_.openingCoords=e&&typeof e.clientX=="number"?new V(e.clientX,e.clientY):null,xa(),e=this.menu_.render(Wn()),ge(e,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(t=t.getColour(),e=this.sourceBlock_.getColourTertiary(),Mu(t,e)),Nu(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem&&(this.menu_.setHighlighted(this.selectedMenuItem),ha(this.selectedMenuItem.getElement(),Wn(),!0)),this.applyColour()}dropdownCreate(){const e=this.getSourceBlock();if(!e)throw new ft;const t=new Ah;t.setRole(ks.LISTBOX),this.menu_=t;const o=this.getOptions(!1);this.selectedMenuItem=null;for(let c=0;c<o.length;c++){const[h,$]=o[c];if(typeof h=="object"){var n=new Image(h.width,h.height);n.src=h.src,n.alt=h.alt||""}else n=h;n=new Rh(n,$),n.setRole(ks.OPTION),n.setRightToLeft(e.RTL),n.setCheckable(!0),t.addChild(n),n.setChecked($===this.value_),$===this.value_&&(this.selectedMenuItem=n),n.onAction(this.handleMenuActionEvent,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose(),this.selectedMenuItem=this.menu_=null,this.applyColour()}handleMenuActionEvent(e){Da(this,!0),this.onItemSelected_(this.menu_,e)}onItemSelected_(e,t){this.setValue(t.getValue())}isOptionListDynamic(){return typeof this.menuGenerator_=="function"}getOptions(e){if(!this.menuGenerator_)throw TypeError("A menu generator was never defined.");return Array.isArray(this.menuGenerator_)?this.menuGenerator_:e&&this.generatedOptions?this.generatedOptions:(this.generatedOptions=this.menuGenerator_(),this.validateOptions(this.generatedOptions),this.generatedOptions)}doClassValidation_(e){return this.getOptions(!0).some(t=>t[1]===e)?e:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+e),null)}doValueUpdate_(e){super.doValueUpdate_(e),e=this.getOptions(!0);for(let t=0,o;o=e[t];t++)o[1]===this.value_&&(this.selectedOption=o)}applyColour(){const e=this.sourceBlock_;this.borderRect_&&(this.borderRect_.setAttribute("stroke",e.getColourTertiary()),this.menu_?this.borderRect_.setAttribute("fill",e.getColourTertiary()):this.borderRect_.setAttribute("fill","transparent")),e&&this.arrow&&(e.isShadow()?this.arrow.style.fill=e.getColourSecondary():this.arrow.style.fill=e.getColour())}render_(){this.getTextContent().nodeValue="",this.imageElement.style.display="none";const e=this.selectedOption&&this.selectedOption[0];e&&typeof e=="object"?this.renderSelectedImage(e):this.renderSelectedText(),this.positionBorderRect_()}renderSelectedImage(e){const t=this.getSourceBlock();if(!t)throw new ft;this.imageElement.style.display="",this.imageElement.setAttributeNS(es,"xlink:href",e.src),this.imageElement.setAttribute("height",String(e.height)),this.imageElement.setAttribute("width",String(e.width));const o=Number(e.height);e=Number(e.width);var n=!!this.borderRect_;const c=Math.max(n?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,o+qt.IMAGE_Y_PADDING);n=n?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let h;h=this.svgArrow?this.positionSVGArrow(e+n,c/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):Nn(this.arrow,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY),this.size_.width=e+h+2*n,this.size_.height=c;let $=0;t.RTL?this.imageElement.setAttribute("x",`${n+h}`):($=e+h,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x",`${n}`)),this.imageElement.setAttribute("y",String(c/2-o/2)),this.positionTextElement_($+n,e+h)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();ge(e,"blocklyDropdownText"),e.setAttribute("text-anchor","start");var t=!!this.borderRect_;e=Math.max(t?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);const o=Nn(this.getTextElement(),this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);t=t?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let n=0;this.svgArrow&&(n=this.positionSVGArrow(o+t,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_.width=o+n+2*t,this.size_.height=e,this.positionTextElement_(t,o)}positionSVGArrow(e,t){if(!this.svgArrow)return 0;const o=this.getSourceBlock();if(!o)throw new ft;const n=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,c=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,h=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(o.RTL?n:e+c)+","+t+")"),h+c}getText_(){if(!this.selectedOption)return null;const e=this.selectedOption[0];return typeof e=="object"?e.alt:e}static fromJson(e){if(!e.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");return new this(e.options,void 0,e)}trimOptions(e){let t=!1;const o=e.map(([$,T])=>typeof $=="string"?[pt($),T]:(t=!0,[$.alt!==null?Object.assign({},$,{alt:pt($.alt)}):Object.assign({},$),T]));if(t||2>e.length)return{options:o};var n=o.map(([$])=>$),c=Gn(n);e=Vu(n,c);const h=Gu(n,c);return!e&&!h||c<=e+h?{options:o}:(c=e?n[0].substring(0,e-1):void 0,n=h?n[0].substr(1-h):void 0,{options:this.applyTrim(o,e,h),prefix:c,suffix:n})}applyTrim(e,t,o){return e.map(([n,c])=>[n.substring(t,n.length-o),c])}validateOptions(e){if(!Array.isArray(e))throw TypeError("FieldDropdown options must be an array.");if(!e.length)throw TypeError("FieldDropdown options must not be an empty array.");let t=!1;for(let o=0;o<e.length;o++){const n=e[o];Array.isArray(n)?typeof n[1]!="string"?(t=!0,console.error(`Invalid option[${o}]: Each FieldDropdown option id must be a string.
844
+ Found ${n[1]} in: ${n}`)):n[0]&&typeof n[0]!="string"&&typeof n[0].src!="string"&&(t=!0,console.error(`Invalid option[${o}]: Each FieldDropdown option must have a string
845
+ label or image description. Found ${n[0]} in: ${n}`)):(t=!0,console.error(`Invalid option[${o}]: Each FieldDropdown option must be an array.
846
+ Found: ${n}`))}if(t)throw TypeError("Found invalid FieldDropdown options.")}};qt.CHECKMARK_OVERHANG=25,qt.MAX_MENU_HEIGHT_VH=.45,qt.ARROW_CHAR="▾",qt.IMAGE_Y_OFFSET=5,qt.IMAGE_Y_PADDING=2*qt.IMAGE_Y_OFFSET,Ps("field_dropdown",qt);var vv=class{constructor(e,t){this.bubble=e,this.workspace=t,this.startLoc=null,this.inGroup=!1}isMovable(){return!0}startDrag(){(this.inGroup=!!i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),this.startLoc=this.bubble.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1);let e;(e=this.workspace.getLayerManager())==null||e.moveToDragLayer(this.bubble),this.bubble.setDragging&&this.bubble.setDragging(!0)}drag(e){this.bubble.moveDuringDrag(e)}endDrag(){this.workspace.setResizesEnabled(!0),this.inGroup||i.setGroup$$module$build$src$core$events$utils(!1);let e;(e=this.workspace.getLayerManager())==null||e.moveOffDragLayer(this.bubble,Cl),this.bubble.setDragging(!1)}revertDrag(){this.startLoc&&this.bubble.moveDuringDrag(this.startLoc)}},ss,Ye=class{constructor(e,t,o){this.workspace=e,this.anchor=t,this.ownerRect=o,this.size=new Le(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.dragStrategy=new vv(this,this.workspace),this.id=k(),this.svgRoot=N(x.G,{class:"blocklyBubble"},e.getBubbleCanvas()),e=N(x.G,{filter:`url(#${this.workspace.getRenderer().getConstants().embossFilterId})`},this.svgRoot),this.tail=N(x.PATH,{class:"blocklyBubbleTail"},e),this.background=N(x.RECT,{class:"blocklyDraggable",x:0,y:0,rx:ss.BORDER_WIDTH,ry:ss.BORDER_WIDTH},e),this.contentContainer=N(x.G,{},this.svgRoot),X(this.background,"pointerdown",this,this.onMouseDown)}dispose(){Ke(this.svgRoot),this.disposed=!0}setAnchorLocation(e,t=!1){this.anchor=e,t?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor(),this.renderTail()}setPositionRelativeToAnchor(e,t){this.relativeLeft=e,this.relativeTop=t,this.positionRelativeToAnchor(),this.renderTail()}getSize(){return this.size}setSize(e,t=!1){e.width=Math.max(e.width,ss.MIN_SIZE),e.height=Math.max(e.height,ss.MIN_SIZE),this.size=e,this.background.setAttribute("width",`${e.width}`),this.background.setAttribute("height",`${e.height}`),t?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor(),this.renderTail()}getColour(){return this.colour}setColour(e){this.colour=e,this.tail.setAttribute("fill",e),this.background.setAttribute("fill",e)}onMouseDown(e){let t;(t=this.workspace.getGesture(e))==null||t.handleBubbleStart(e,this),this.bringToFront(),i.setSelected$$module$build$src$core$common(this)}positionRelativeToAnchor(){let e=this.anchor.x;e=this.workspace.RTL?e-(this.relativeLeft+this.size.width):e+this.relativeLeft,this.moveTo(e,this.relativeTop+this.anchor.y)}moveTo(e,t){this.svgRoot.setAttribute("transform",`translate(${e}, ${t})`)}positionByRect(e=new qe(0,0,0,0)){var t=this.workspace.getMetricsManager().getViewMetrics(!0),o=this.getOptimalRelativeLeft(t),n=this.getOptimalRelativeTop(t);const c={x:o,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},h={x:-this.size.width-30,y:n};n={x:e.getWidth(),y:n};var $={x:o,y:e.getHeight()};o=e.getWidth()<e.getHeight()?n:$,e=e.getWidth()<e.getHeight()?$:n,n=this.getOverlap(c,t),$=this.getOverlap(h,t);const T=this.getOverlap(o,t);t=this.getOverlap(e,t),t=Math.max(n,$,T,t),n===t?(this.relativeLeft=c.x,this.relativeTop=c.y):$===t?(this.relativeLeft=h.x,this.relativeTop=h.y):T===t?(this.relativeLeft=o.x,this.relativeTop=o.y):(this.relativeLeft=e.x,this.relativeTop=e.y),this.positionRelativeToAnchor()}getOverlap(e,t){var o=this.workspace.RTL?this.anchor.x-e.x-this.size.width:e.x+this.anchor.x;return e=e.y+this.anchor.y,Math.max(0,Math.min(1,(Math.min(o+this.size.width,t.left+t.width)-Math.max(o,t.left))*(Math.min(e+this.size.height,t.top+t.height)-Math.max(e,t.top))/(this.size.width*this.size.height)))}getOptimalRelativeLeft(e){let t=-this.size.width/4;if(this.size.width>e.width)return t;if(e=this.getWorkspaceViewRect(e),this.workspace.RTL){var o=this.anchor.x-t;o-this.size.width<e.left?t=-(e.left-this.anchor.x+this.size.width):o>e.right&&(t=-(e.right-this.anchor.x))}else{o=t+this.anchor.x;const n=o+this.size.width;o<e.left?t=e.left-this.anchor.x:n>e.right&&(t=e.right-this.anchor.x-this.size.width)}return t}getOptimalRelativeTop(e){let t=-this.size.height/4;if(this.size.height>e.height)return t;const o=this.anchor.y+t,n=o+this.size.height;return e=this.getWorkspaceViewRect(e),o<e.top?t=e.top-this.anchor.y:n>e.bottom&&(t=e.bottom-this.anchor.y-this.size.height),t}getWorkspaceViewRect(e){const t=e.top;let o=e.top+e.height,n=e.left;return e=e.left+e.width,o-=this.getScrollbarThickness(),this.workspace.RTL?n-=this.getScrollbarThickness():e-=this.getScrollbarThickness(),new qe(t,o,n,e)}getScrollbarThickness(){return mt.scrollbarThickness/this.workspace.scale}renderTail(){const e=[];var t=this.size.width/2,o=this.size.height/2,n=-this.relativeLeft,c=-this.relativeTop;if(t===n&&o===c)e.push("M "+t+","+o);else{c-=o,n-=t,this.workspace.RTL&&(n*=-1);var h=Math.sqrt(c*c+n*n),$=Math.acos(n/h);0>c&&($=2*Math.PI-$);var T=$+Math.PI/2;T>2*Math.PI&&(T-=2*Math.PI);var L=Math.sin(T);const nt=Math.cos(T);let it=(this.size.width+this.size.height)/ss.TAIL_THICKNESS;it=Math.min(it,this.size.width,this.size.height)/4,T=1-ss.ANCHOR_RADIUS/h,n=t+T*n,c=o+T*c,T=t+it*nt;const Xt=o+it*L;t-=it*nt,o-=it*L,L=Ia(this.workspace.RTL?-ss.TAIL_ANGLE:ss.TAIL_ANGLE),L=$+L,L>2*Math.PI&&(L-=2*Math.PI),$=Math.sin(L)*h/ss.TAIL_BEND,h=Math.cos(L)*h/ss.TAIL_BEND,e.push("M"+T+","+Xt),e.push("C"+(T+h)+","+(Xt+$)+" "+n+","+c+" "+n+","+c),e.push("C"+n+","+c+" "+(t+h)+","+(o+$)+" "+t+","+o)}e.push("z");let te;(te=this.tail)==null||te.setAttribute("d",e.join(" "))}bringToFront(){let e;const t=(e=this.svgRoot)==null?void 0:e.parentNode;return this.svgRoot&&(t==null?void 0:t.lastChild)!==this.svgRoot?(t==null||t.appendChild(this.svgRoot),!0):!1}getRelativeToSurfaceXY(){return new V(this.workspace.RTL?-this.relativeLeft+this.anchor.x-this.size.width:this.anchor.x+this.relativeLeft,this.anchor.y+this.relativeTop)}getSvgRoot(){return this.svgRoot}moveDuringDrag(e){this.moveTo(e.x,e.y),this.relativeLeft=this.workspace.RTL?this.anchor.x-e.x-this.size.width:e.x-this.anchor.x,this.relativeTop=e.y-this.anchor.y,this.renderTail()}setDragging(e){}setDeleteStyle(e){}isDeletable(){return!1}showContextMenu(e){}isMovable(){return!0}startDrag(){this.dragStrategy.startDrag()}drag(e){this.dragStrategy.drag(e)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){}unselect(){}};ss=Ye,Ye.BORDER_WIDTH=6,Ye.DOUBLE_BORDER=2*ss.BORDER_WIDTH,Ye.MIN_SIZE=ss.DOUBLE_BORDER,Ye.TAIL_THICKNESS=1,Ye.TAIL_ANGLE=20,Ye.TAIL_BEND=4,Ye.ANCHOR_RADIUS=8;var uo=class extends Ye{constructor(e,t,o,n){super(t,o,n),this.workspace=t,this.anchor=o,this.ownerRect=n,this.autoLayout=!0,t=new ds(e),this.validateWorkspaceOptions(t),this.svgDialog=N(x.SVG,{x:Ye.BORDER_WIDTH,y:Ye.BORDER_WIDTH},this.contentContainer),e.parentWorkspace=this.workspace,this.miniWorkspace=this.newWorkspaceSvg(new ds(e)),this.miniWorkspace.internalIsMutator=!0,e=this.miniWorkspace.createDom("blocklyMutatorBackground"),this.svgDialog.appendChild(e),t.languageTree&&(e.insertBefore(this.miniWorkspace.addFlyout(x.G),this.miniWorkspace.getCanvas()),e=this.miniWorkspace.getFlyout(),e==null||e.init(this.miniWorkspace),e==null||e.show(t.languageTree)),this.miniWorkspace.addChangeListener(this.onWorkspaceChange.bind(this));let c,h;(c=this.miniWorkspace.getFlyout())==null||(h=c.getWorkspace())==null||h.addChangeListener(this.onWorkspaceChange.bind(this)),this.updateBubbleSize()}dispose(){this.miniWorkspace.dispose(),super.dispose()}getWorkspace(){return this.miniWorkspace}addWorkspaceChangeListener(e){this.miniWorkspace.addChangeListener(e)}validateWorkspaceOptions(e){if(e.hasCategories)throw Error("The miniworkspace bubble does not support toolboxes with categories");if(e.hasTrashcan)throw Error("The miniworkspace bubble does not support trashcans");if(e.zoomOptions.controls||e.zoomOptions.wheel||e.zoomOptions.pinch)throw Error("The miniworkspace bubble does not support zooming");if(e.moveOptions.scrollbars||e.moveOptions.wheel||e.moveOptions.drag)throw Error("The miniworkspace bubble does not scrolling/moving the workspace");if(e.horizontalLayout)throw Error("The miniworkspace bubble does not support horizontal layouts")}onWorkspaceChange(){this.bumpBlocksIntoBounds(),this.updateBubbleSize()}bumpBlocksIntoBounds(){if(!this.miniWorkspace.isDragging())for(const e of this.miniWorkspace.getTopBlocks(!1)){const t=e.getRelativeToSurfaceXY();if(20>t.y&&e.moveBy(0,20-t.y),e.RTL){let o=-20;const n=this.miniWorkspace.getFlyout();n&&(o-=n.getWidth()),t.x>o&&e.moveBy(o-t.x,0)}else 20>t.x&&e.moveBy(20-t.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()){var e=this.getSize(),t=this.calculateWorkspaceSize();Math.abs(e.width-t.width)<uo.MINIMUM_VIEW_CHANGE&&Math.abs(e.height-t.height)<uo.MINIMUM_VIEW_CHANGE||(this.svgDialog.setAttribute("width",`${t.width}px`),this.svgDialog.setAttribute("height",`${t.height}px`),this.miniWorkspace.setCachedParentSvgSize(t.width,t.height),this.miniWorkspace.RTL&&this.miniWorkspace.getCanvas().setAttribute("transform",`translate(${t.width}, 0)`),this.setSize(new Le(t.width+Ye.DOUBLE_BORDER,t.height+Ye.DOUBLE_BORDER),this.autoLayout),this.miniWorkspace.resize(),this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var e=this.miniWorkspace.getCanvas().getBBox();let t=e.width+uo.MARGIN;e=e.height+uo.MARGIN;const o=this.miniWorkspace.getFlyout();if(o){const n=o.getWorkspace().getMetricsManager().getScrollMetrics();e=Math.max(e,n.height+20),t+=o.getWidth()}return new Le(t,e)}updateBlockStyles(){for(var e of this.miniWorkspace.getAllBlocks(!1))e.setStyle(e.getStyleName());let t;if(e=(t=this.miniWorkspace.getFlyout())==null?void 0:t.getWorkspace())for(const o of e.getAllBlocks(!1))o.setStyle(o.getStyleName())}moveDuringDrag(e){super.moveDuringDrag(e),this.autoLayout=!1}moveTo(e,t){super.moveTo(e,t),this.miniWorkspace.recordDragTargets()}newWorkspaceSvg(e){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts")}};uo.MINIMUM_VIEW_CHANGE=10,uo.MARGIN=3*Ye.DOUBLE_BORDER;var xl=class{constructor(e){this.sourceBlock=e,this.offsetInBlock=new V(0,0),this.workspaceLocation=new V(0,0),this.svgRoot=null,this.tooltip=e}getType(){throw Error("Icons must implement getType")}initView(e){if(!this.svgRoot){var t=this.sourceBlock;this.svgRoot=N(x.G,{class:"blocklyIconGroup"}),t.getSvgRoot().appendChild(this.svgRoot),this.updateSvgRootOffset(),X(this.svgRoot,"pointerdown",this,e),this.svgRoot.tooltip=this,Li(this.svgRoot)}}dispose(){Oa(this.svgRoot),Ke(this.svgRoot)}getWeight(){return-1}getSize(){return new Le(0,0)}setTooltip(e){this.tooltip=e??this.sourceBlock}getTooltip(){return this.tooltip}applyColour(){}updateEditable(){}updateCollapsed(){this.svgRoot&&(this.sourceBlock.isCollapsed()?this.svgRoot.style.display="none":this.svgRoot.style.display="block",Oi(this)&&this.setBubbleVisible(!1))}hideForInsertionMarker(){this.svgRoot&&(this.svgRoot.style.display="none")}isShownWhenCollapsed(){return!1}setOffsetInBlock(e){this.offsetInBlock=e,this.updateSvgRootOffset()}updateSvgRootOffset(){let e;(e=this.svgRoot)==null||e.setAttribute("transform",`translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`)}onLocationChange(e){this.workspaceLocation=V.sum(e,this.offsetInBlock)}onClick(){}isClickableInFlyout(e){return!0}},Dl,Al;Dl=17,Al=16,i.MutatorIcon$$module$build$src$core$icons$mutator_icon=class extends xl{constructor(e,t){super(t),this.flyoutBlockTypes=e,this.sourceBlock=t,this.saveConnectionsListener=this.updateWorkspacePid=this.rootBlock=this.miniWorkspaceBubble=null}getType(){return i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE}initView(e){this.svgRoot||(super.initView(e),N(x.RECT,{class:"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},this.svgRoot),N(x.PATH,{class:"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},this.svgRoot),N(x.CIRCLE,{class:"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},this.svgRoot),ge(this.svgRoot,"blockly-icon-mutator"))}dispose(){super.dispose();let e;(e=this.miniWorkspaceBubble)==null||e.dispose()}getWeight(){return i.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT}getSize(){return new Le(Dl,Dl)}applyColour(){super.applyColour();let e;(e=this.miniWorkspaceBubble)==null||e.setColour(this.sourceBlock.getColour());let t;(t=this.miniWorkspaceBubble)==null||t.updateBlockStyles()}updateCollapsed(){super.updateCollapsed(),this.sourceBlock.isCollapsed()&&this.setBubbleVisible(!1)}onLocationChange(e){super.onLocationChange(e);let t;(t=this.miniWorkspaceBubble)==null||t.setAnchorLocation(this.getAnchorLocation())}onClick(){super.onClick(),this.sourceBlock.isEditable()&&this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.miniWorkspaceBubble}setBubbleVisible(e){const t=this;return j.asyncExecutePromiseGeneratorFunction(function*(){if(t.bubbleIsVisible()!==e){if(yield ws(),e){t.miniWorkspaceBubble=new uo(t.getMiniWorkspaceConfig(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour(),t.createRootBlock(),t.addSaveConnectionsListener();let o;(o=t.miniWorkspaceBubble)==null||o.addWorkspaceChangeListener(t.createMiniWorkspaceChangeListener())}else{let o;(o=t.miniWorkspaceBubble)==null||o.dispose(),t.miniWorkspaceBubble=null,t.saveConnectionsListener&&t.sourceBlock.workspace.removeChangeListener(t.saveConnectionsListener),t.saveConnectionsListener=null}z(new(G(O.BUBBLE_OPEN))(t.sourceBlock,e,"mutator"))}})}getMiniWorkspaceConfig(){let e;const t={disable:!1,media:this.sourceBlock.workspace.options.pathToMedia,rtl:this.sourceBlock.RTL,renderer:this.sourceBlock.workspace.options.renderer,rendererOverrides:(e=this.sourceBlock.workspace.options.rendererOverrides)!=null?e:void 0};return this.flyoutBlockTypes.length&&(t.toolbox={kind:"flyoutToolbox",contents:this.flyoutBlockTypes.map(o=>({kind:"block",type:o}))}),t}getAnchorLocation(){const e=Dl/2;return V.sum(this.workspaceLocation,new V(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new qe(e.y,e.y+e.height,e.x,e.x+e.width)}createRootBlock(){if(!this.sourceBlock.decompose)throw Error("Blocks with mutator icons must include a decompose method");this.rootBlock=this.sourceBlock.decompose(this.miniWorkspaceBubble.getWorkspace());for(var e of this.rootBlock.getDescendants(!1))e.queueRender();this.rootBlock.setMovable(!1),this.rootBlock.setDeletable(!1);let t,o,n,c;e=(c=(t=this.miniWorkspaceBubble)==null||(o=t.getWorkspace())==null||(n=o.getFlyout())==null?void 0:n.getWidth())!=null?c:0,this.rootBlock.moveBy(this.rootBlock.RTL?-(e+Al):Al,Al)}addSaveConnectionsListener(){this.sourceBlock.saveConnections&&this.rootBlock&&(this.saveConnectionsListener=()=>{this.sourceBlock.saveConnections&&this.rootBlock&&this.sourceBlock.saveConnections(this.rootBlock)},this.saveConnectionsListener(),this.sourceBlock.workspace.addChangeListener(this.saveConnectionsListener))}createMiniWorkspaceChangeListener(){return e=>{i.MutatorIcon$$module$build$src$core$icons$mutator_icon.isIgnorableMutatorEvent(e)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null,this.recomposeSourceBlock()},0))}}static isIgnorableMutatorEvent(e){return e.isUiEvent||w(e)||R(e)&&e.element==="disabled"}recomposeSourceBlock(){if(this.rootBlock){if(!this.sourceBlock.compose)throw Error("Blocks with mutator icons must include a compose method");var e=i.getGroup$$module$build$src$core$events$utils();e||i.setGroup$$module$build$src$core$events$utils(!0);var t=ri.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var o=ri.getExtraBlockState_(this.sourceBlock);t!==o&&z(new(G(O.BLOCK_CHANGE))(this.sourceBlock,"mutation",null,t,o)),i.setGroup$$module$build$src$core$events$utils(e)}}getWorkspace(){let e;return(e=this.miniWorkspaceBubble)==null?void 0:e.getWorkspace()}},i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE=yt.MUTATOR,i.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1,i.MutatorIcon$$module$build$src$core$icons$mutator_icon;var sn=Object.create(null),qT={allExtensions:sn};i.register$$module$build$src$core$extensions("parent_tooltip_when_inline",x$);var Is={TEST_ONLY:qT};Is.apply=Ha,Is.buildTooltipForDropdown=i.buildTooltipForDropdown$$module$build$src$core$extensions,Is.buildTooltipWithFieldText=i.buildTooltipWithFieldText$$module$build$src$core$extensions,Is.isRegistered=_d,Is.register=i.register$$module$build$src$core$extensions,Is.registerMixin=i.registerMixin$$module$build$src$core$extensions,Is.registerMutator=i.registerMutator$$module$build$src$core$extensions,Is.runAfterPageLoad=E$,Is.unregister=w$;var Ae;(function(e){e[e.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX",e[e.MAC_ENTER=3]="MAC_ENTER",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.NUM_CENTER=12]="NUM_CENTER",e[e.ENTER=13]="ENTER",e[e.SHIFT=16]="SHIFT",e[e.CTRL=17]="CTRL",e[e.ALT=18]="ALT",e[e.PAUSE=19]="PAUSE",e[e.CAPS_LOCK=20]="CAPS_LOCK",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.PAGE_UP=33]="PAGE_UP",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.END=35]="END",e[e.HOME=36]="HOME",e[e.LEFT=37]="LEFT",e[e.UP=38]="UP",e[e.RIGHT=39]="RIGHT",e[e.DOWN=40]="DOWN",e[e.PLUS_SIGN=43]="PLUS_SIGN",e[e.PRINT_SCREEN=44]="PRINT_SCREEN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.ZERO=48]="ZERO",e[e.ONE=49]="ONE",e[e.TWO=50]="TWO",e[e.THREE=51]="THREE",e[e.FOUR=52]="FOUR",e[e.FIVE=53]="FIVE",e[e.SIX=54]="SIX",e[e.SEVEN=55]="SEVEN",e[e.EIGHT=56]="EIGHT",e[e.NINE=57]="NINE",e[e.FF_SEMICOLON=59]="FF_SEMICOLON",e[e.FF_EQUALS=61]="FF_EQUALS",e[e.FF_DASH=173]="FF_DASH",e[e.FF_HASH=163]="FF_HASH",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.AT_SIGN=64]="AT_SIGN",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.META=91]="META",e[e.WIN_KEY_RIGHT=92]="WIN_KEY_RIGHT",e[e.CONTEXT_MENU=93]="CONTEXT_MENU",e[e.NUM_ZERO=96]="NUM_ZERO",e[e.NUM_ONE=97]="NUM_ONE",e[e.NUM_TWO=98]="NUM_TWO",e[e.NUM_THREE=99]="NUM_THREE",e[e.NUM_FOUR=100]="NUM_FOUR",e[e.NUM_FIVE=101]="NUM_FIVE",e[e.NUM_SIX=102]="NUM_SIX",e[e.NUM_SEVEN=103]="NUM_SEVEN",e[e.NUM_EIGHT=104]="NUM_EIGHT",e[e.NUM_NINE=105]="NUM_NINE",e[e.NUM_MULTIPLY=106]="NUM_MULTIPLY",e[e.NUM_PLUS=107]="NUM_PLUS",e[e.NUM_MINUS=109]="NUM_MINUS",e[e.NUM_PERIOD=110]="NUM_PERIOD",e[e.NUM_DIVISION=111]="NUM_DIVISION",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUMLOCK=144]="NUMLOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.FIRST_MEDIA_KEY=166]="FIRST_MEDIA_KEY",e[e.LAST_MEDIA_KEY=183]="LAST_MEDIA_KEY",e[e.SEMICOLON=186]="SEMICOLON",e[e.DASH=189]="DASH",e[e.EQUALS=187]="EQUALS",e[e.COMMA=188]="COMMA",e[e.PERIOD=190]="PERIOD",e[e.SLASH=191]="SLASH",e[e.APOSTROPHE=192]="APOSTROPHE",e[e.TILDE=192]="TILDE",e[e.SINGLE_QUOTE=222]="SINGLE_QUOTE",e[e.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET",e[e.BACKSLASH=220]="BACKSLASH",e[e.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET",e[e.WIN_KEY=224]="WIN_KEY",e[e.MAC_FF_META=224]="MAC_FF_META",e[e.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT",e[e.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT",e[e.WIN_IME=229]="WIN_IME",e[e.VK_NONAME=252]="VK_NONAME",e[e.PHANTOM=255]="PHANTOM"})(Ae||(Ae={}));var ho={};ho.arc=gt,ho.curve=Yt,ho.line=Fi,ho.lineOnAxis=ne,ho.lineTo=Bs,ho.moveBy=at,ho.moveTo=wt,ho.point=ue;var ut={};ut.Coordinate=V,ut.KeyCodes=Ae,ut.Rect=qe,ut.Size=Le,ut.Svg=x,ut.aria=cr,ut.array=Ob,ut.browserEvents=no,ut.colour=us,ut.deprecation=hb,ut.dom=xt,ut.extensions=Is,ut.idGenerator=ph,ut.math=gl,ut.object=$v,ut.parsing=br,ut.string=qi,ut.style=So,ut.svgMath=ti,ut.svgPaths=ho,ut.toolbox=Eo,ut.userAgent=LT,ut.xml=Hi;var yv=class extends Ye{constructor(e,t,o){super(e,t,o),this.workspace=e,this.anchor=t,this.ownerRect=o,this.resizePointerMoveListener=this.resizePointerUpListener=null,this.textChangeListeners=[],this.sizeChangeListeners=[],this.text="",this.DEFAULT_SIZE=new Le(160+Ye.DOUBLE_BORDER,80+Ye.DOUBLE_BORDER),this.MIN_SIZE=new Le(45+Ye.DOUBLE_BORDER,20+Ye.DOUBLE_BORDER),this.editable=!0,ge(this.svgRoot,"blocklyTextInputBubble"),{inputRoot:this.inputRoot,textArea:this.textArea}=this.createEditor(this.contentContainer),this.resizeGroup=this.createResizeHandle(this.svgRoot,e),this.setSize(this.DEFAULT_SIZE,!0)}getText(){return this.text}setText(e){this.text=e,this.textArea.value=e,this.onTextChange()}setEditable(e){(this.editable=e)?this.textArea.removeAttribute("readonly"):this.textArea.setAttribute("readonly","")}isEditable(){return this.editable}addTextChangeListener(e){this.textChangeListeners.push(e)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}createEditor(e){e=N(x.FOREIGNOBJECT,{x:Ye.BORDER_WIDTH,y:Ye.BORDER_WIDTH},e);const t=document.createElementNS(Fs,"body");t.setAttribute("xmlns",Fs),t.className="blocklyMinimalBody";const o=document.createElementNS(Fs,"textarea");return o.className="blocklyTextarea blocklyText",o.setAttribute("dir",this.workspace.RTL?"RTL":"LTR"),t.appendChild(o),e.appendChild(t),this.bindTextAreaEvents(o),setTimeout(()=>{o.focus()},0),{inputRoot:e,textArea:o}}bindTextAreaEvents(e){X(e,"wheel",this,t=>{t.stopPropagation()}),X(e,"focus",this,this.onStartEdit,!0),X(e,"change",this,this.onTextChange)}createResizeHandle(e,t){return e=N(x.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),X(e,"pointerdown",this,this.onResizePointerDown),e}setSize(e,t=!1){e.width=Math.max(e.width,this.MIN_SIZE.width),e.height=Math.max(e.height,this.MIN_SIZE.height);const o=e.width-Ye.DOUBLE_BORDER,n=e.height-Ye.DOUBLE_BORDER;this.inputRoot.setAttribute("width",`${o}`),this.inputRoot.setAttribute("height",`${n}`),this.resizeGroup.setAttribute("y",`${n}`),this.workspace.RTL?this.resizeGroup.setAttribute("x",`${-Ye.DOUBLE_BORDER}`):this.resizeGroup.setAttribute("x",`${o}`),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}onResizePointerDown(e){this.bringToFront(),ve(e)||(Ba(this.workspace,e,new V(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=X(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=X(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){ke(),this.resizePointerUpListener&&(ze(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(ze(this.resizePointerMoveListener),this.resizePointerMoveListener=null)}onResizePointerMove(e){e=ja(this.workspace,e),this.setSize(new Le(this.workspace.RTL?-e.x:e.x,e.y),!1),this.onSizeChange()}onStartEdit(){this.bringToFront()&&this.textArea.focus()}onTextChange(){this.text=this.textArea.value;for(const e of this.textChangeListeners)e()}onSizeChange(){for(const e of this.sizeChangeListeners)e()}};Et(`
847
+ .blocklyTextInputBubble .blocklyTextarea {
848
+ background-color: var(--commentFillColour);
849
+ border: 0;
850
+ box-sizing: border-box;
851
+ display: block;
852
+ outline: 0;
853
+ padding: 5px;
854
+ resize: none;
855
+ width: 100%;
856
+ height: 100%;
857
+ }
858
+ `);var tp={};tp.register=Td,tp.unregister=D$;var sp=17,_v=160,wv=80,po=class extends xl{constructor(e){super(e),this.sourceBlock=e,this.textInputBubble=null,this.text="",this.bubbleSize=new Le(_v,wv),this.bubbleVisiblity=!1}getType(){return po.TYPE}initView(e){this.svgRoot||(super.initView(e),N(x.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),N(x.PATH,{class:"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},this.svgRoot),N(x.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),ge(this.svgRoot,"blockly-icon-comment"))}dispose(){super.dispose();let e;(e=this.textInputBubble)==null||e.dispose()}getWeight(){return po.WEIGHT}getSize(){return new Le(sp,sp)}applyColour(){super.applyColour();const e=this.sourceBlock.getColour();let t;(t=this.textInputBubble)==null||t.setColour(e)}updateEditable(){const e=this,t=()=>super.updateEditable;return j.asyncExecutePromiseGeneratorFunction(function*(){t().call(e),e.bubbleIsVisible()&&(yield e.setBubbleVisible(!1),yield e.setBubbleVisible(!0))})}onLocationChange(e){super.onLocationChange(e),e=this.getAnchorLocation();let t;(t=this.textInputBubble)==null||t.setAnchorLocation(e)}setText(e){const t=this.text;z(new(G(O.BLOCK_CHANGE))(this.sourceBlock,"comment",null,t,e)),this.text=e;let o;(o=this.textInputBubble)==null||o.setText(this.text)}getText(){return this.text}setBubbleSize(e){this.bubbleSize=e;let t;(t=this.textInputBubble)==null||t.setSize(this.bubbleSize,!0)}getBubbleSize(){return this.bubbleSize}saveState(){return this.text?{text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width}:null}loadState(e){let t;this.text=(t=e.text)!=null?t:"";let o,n;this.bubbleSize=new Le((o=e.width)!=null?o:_v,(n=e.height)!=null?n:wv);let c;this.bubbleVisiblity=(c=e.pinned)!=null?c:!1,this.setBubbleVisible(this.bubbleVisiblity)}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}onTextChange(){if(this.textInputBubble){var e=this.textInputBubble.getText();this.text!==e&&(z(new(G(O.BLOCK_CHANGE))(this.sourceBlock,"comment",null,this.text,e)),this.text=e)}}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(e){const t=this;return j.asyncExecutePromiseGeneratorFunction(function*(){t.bubbleVisiblity!==e&&(t.bubbleVisiblity=e,yield ws(),!t.sourceBlock.rendered||t.sourceBlock.isInFlyout||t.sourceBlock.isInsertionMarker()||(e?(t.sourceBlock.isEditable()?t.showEditableBubble():t.showNonEditableBubble(),t.applyColour()):t.hideBubble(),z(new(G(O.BUBBLE_OPEN))(t.sourceBlock,e,"comment"))))})}showEditableBubble(){this.createBubble();let e;(e=this.textInputBubble)==null||e.addTextChangeListener(()=>this.onTextChange());let t;(t=this.textInputBubble)==null||t.addSizeChangeListener(()=>this.onSizeChange())}showNonEditableBubble(){this.createBubble();let e;(e=this.textInputBubble)==null||e.setEditable(!1)}createBubble(){this.textInputBubble=new yv(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.textInputBubble.setText(this.getText()),this.textInputBubble.setSize(this.bubbleSize,!0)}hideBubble(){let e;(e=this.textInputBubble)==null||e.dispose(),this.textInputBubble=null}getAnchorLocation(){const e=sp/2;return V.sum(this.workspaceLocation,new V(e,e))}getBubbleOwnerRect(){return this.sourceBlock.getBoundingRectangleWithoutChildren()}};po.TYPE=yt.COMMENT,po.WEIGHT=3,Td(po.TYPE,po);var Cv=class extends Error{constructor(e){super(`Tried to append an icon of type ${e.getType()} when an icon of that type already exists on the block. Use getIcon to access the existing icon.`),this.icon=e}},Tv={};Tv.DuplicateIconType=Cv;var kv=class extends Ye{constructor(e,t,o,n){super(t,o,n),this.text=e,this.workspace=t,this.anchor=o,this.ownerRect=n,this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}getText(){return this.text}setText(e){this.text=e,Ke(this.paragraph),this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}stringToSvg(e,t){return t=this.createParagraph(t),e=this.createTextFragments(t,e),this.workspace.RTL&&this.rightAlignTextFragments(t.getBBox().width,e),t}createParagraph(e){return N(x.G,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",transform:`translate(0,${Ye.BORDER_WIDTH})`,style:`direction: ${this.workspace.RTL?"rtl":"ltr"}`},e)}createTextFragments(e,t){let o=1;return t.split(`
859
+ `).map(n=>{const c=N(x.TEXT,{y:`${o}em`,x:Ye.BORDER_WIDTH},e);return n=document.createTextNode(n),c.appendChild(n),o+=1,c})}rightAlignTextFragments(e,t){for(const o of t)o.setAttribute("text-anchor","start"),o.setAttribute("x",`${e+Ye.BORDER_WIDTH}`)}updateBubbleSize(){const e=this.paragraph.getBBox();this.setSize(new Le(e.width+2*Ye.BORDER_WIDTH,e.height+2*Ye.BORDER_WIDTH),!0)}},op=17,go=class extends xl{constructor(e){super(e),this.sourceBlock=e,this.textMap=new Map,this.textBubble=null}getType(){return go.TYPE}initView(e){this.svgRoot||(super.initView(e),N(x.PATH,{class:"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},this.svgRoot),N(x.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),N(x.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot),ge(this.svgRoot,"blockly-icon-warning"))}dispose(){super.dispose();let e;(e=this.textBubble)==null||e.dispose()}getWeight(){return go.WEIGHT}getSize(){return new Le(op,op)}applyColour(){super.applyColour();let e;(e=this.textBubble)==null||e.setColour(this.sourceBlock.getColour())}updateCollapsed(){}isShownWhenCollapsed(){return!0}onLocationChange(e){super.onLocationChange(e);let t;(t=this.textBubble)==null||t.setAnchorLocation(this.getAnchorLocation())}addMessage(e,t){if(this.textMap.get(t)===e)return this;e?this.textMap.set(t,e):this.textMap.delete(t);let o;return(o=this.textBubble)==null||o.setText(this.getText()),this}getText(){return[...this.textMap.values()].join(`
860
+ `)}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.textBubble}setBubbleVisible(e){const t=this;return j.asyncExecutePromiseGeneratorFunction(function*(){if(t.bubbleIsVisible()!==e){if(yield ws(),e)t.textBubble=new kv(t.getText(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour();else{let o;(o=t.textBubble)==null||o.dispose(),t.textBubble=null}z(new(G(O.BUBBLE_OPEN))(t.sourceBlock,e,"warning"))}})}getAnchorLocation(){const e=op/2;return V.sum(this.workspaceLocation,new V(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new qe(e.y,e.y+e.height,e.x,e.x+e.width)}};go.TYPE=yt.WARNING,go.WEIGHT=2;var Ao={};Ao.CommentIcon=po,Ao.Icon=xl,Ao.IconType=yt,Ao.MutatorIcon=i.MutatorIcon$$module$build$src$core$icons$mutator_icon,Ao.WarningIcon=go,Ao.exceptions=Tv,Ao.registry=tp,i.Names$$module$build$src$core$names=class{constructor(e,t){this.db=new Map,this.dbReverse=new Set,this.variableMap=null,this.variablePrefix=t||"",this.reservedWords=new Set(e?e.split(","):[])}reset(){this.db.clear(),this.dbReverse.clear(),this.variableMap=null}setVariableMap(e){this.variableMap=e}getNameForUserVariable(e){return this.variableMap?(e=this.variableMap.getVariableById(e))?e.name:null:(console.warn(`Deprecated call to Names.prototype.getName without defining a variable map. To fix, add the following code in your generator's init() function:
861
+ Blockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());`),null)}populateVariables(e){e=i.allUsedVarModels$$module$build$src$core$variables(e);for(let t=0;t<e.length;t++)this.getName(e[t].getId(),i.NameType$$module$build$src$core$names.VARIABLE)}populateProcedures(e){throw Error("The implementation of populateProcedures should be monkey-patched in by blockly.ts")}getName(e,t){let o=e;t===i.NameType$$module$build$src$core$names.VARIABLE&&(e=this.getNameForUserVariable(e))&&(o=e),e=o.toLowerCase();const n=t===i.NameType$$module$build$src$core$names.VARIABLE||t===i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix:"";this.db.has(t)||this.db.set(t,new Map);const c=this.db.get(t);return c.has(e)?n+c.get(e):(t=this.getDistinctName(o,t),c.set(e,t.substr(n.length)),t)}getUserNames(e){let t;return(e=(t=this.db.get(e))==null?void 0:t.keys())?Array.from(e):[]}getDistinctName(e,t){e=this.safeName(e);let o=null,n,c;for(;this.dbReverse.has(e+((n=o)!=null?n:""))||this.reservedWords.has(e+((c=o)!=null?c:""));)o=o?o+1:2;let h;return e+=(h=o)!=null?h:"",this.dbReverse.add(e),(t===i.NameType$$module$build$src$core$names.VARIABLE||t===i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix:"")+e}safeName(e){return e?(e=encodeURI(e.replace(/ /g,"_")).replace(/[^\w]/g,"_"),"0123456789".includes(e[0])&&(e="my_"+e)):e=i.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed",e}static equals(e,t){return e.toLowerCase()===t.toLowerCase()}},(function(e){e=e.NameType||(e.NameType={}),e.DEVELOPER_VARIABLE="DEVELOPER_VARIABLE",e.VARIABLE="VARIABLE",e.PROCEDURE="PROCEDURE"})(i.Names$$module$build$src$core$names||(i.Names$$module$build$src$core$names={})),i.NameType$$module$build$src$core$names=i.Names$$module$build$src$core$names.NameType,i.Names$$module$build$src$core$names.DEVELOPER_VARIABLE_TYPE=i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE,i.NameType$$module$build$src$core$names,i.Names$$module$build$src$core$names;var Sv=class extends Map{constructor(){super()}set(e,t){return this.get(e)===t?this:(super.set(e,t),Ga(t)&&t.startPublishing(),this)}delete(e){const t=this.get(e);return e=super.delete(e),e&&(Ga(t)&&t.stopPublishing(),e)}clear(){if(this.size)for(const e of this.keys())this.delete(e)}add(e){return this.set(e.getId(),e)}getProcedures(){return[...this.values()]}},Rl,zt;Rl="PROCEDURE",i.DEFAULT_ARG$$module$build$src$core$procedures="x",zt={CATEGORY_NAME:Rl,DEFAULT_ARG:i.DEFAULT_ARG$$module$build$src$core$procedures},zt.ObservableProcedureMap=Sv,zt.allProcedures=Ka,zt.findLegalName=i.findLegalName$$module$build$src$core$procedures,zt.flyoutCategory=Ya,zt.getCallers=xd,zt.getDefinition=i.getDefinition$$module$build$src$core$procedures,zt.isNameUsed=Sd,zt.isProcedureBlock=Co,zt.mutateCallers=i.mutateCallers$$module$build$src$core$procedures,zt.mutatorOpenListener=Id,zt.rename=i.rename$$module$build$src$core$procedures;var XT=class{constructor(){this.NONE=0,this.FIELD=1,this.HAT=2,this.ICON=4,this.SPACER=8,this.BETWEEN_ROW_SPACER=16,this.IN_ROW_SPACER=32,this.EXTERNAL_VALUE_INPUT=64,this.INPUT=128,this.INLINE_INPUT=256,this.STATEMENT_INPUT=512,this.CONNECTION=1024,this.PREVIOUS_CONNECTION=2048,this.NEXT_CONNECTION=4096,this.OUTPUT_CONNECTION=8192,this.CORNER=16384,this.LEFT_SQUARE_CORNER=32768,this.LEFT_ROUND_CORNER=65536,this.RIGHT_SQUARE_CORNER=131072,this.RIGHT_ROUND_CORNER=262144,this.JAGGED_EDGE=524288,this.ROW=1048576,this.TOP_ROW=2097152,this.BOTTOM_ROW=4194304,this.INPUT_ROW=8388608,this.LEFT_CORNER=this.LEFT_SQUARE_CORNER|this.LEFT_ROUND_CORNER,this.RIGHT_CORNER=this.RIGHT_SQUARE_CORNER|this.RIGHT_ROUND_CORNER,this.nextTypeValue_=16777216}getType(e){return Object.prototype.hasOwnProperty.call(this,e)||(this[e]=this.nextTypeValue_,this.nextTypeValue_<<=1),this[e]}isField(e){return e.type&this.FIELD}isHat(e){return e.type&this.HAT}isIcon(e){return e.type&this.ICON}isSpacer(e){return e.type&this.SPACER}isInRowSpacer(e){return e.type&this.IN_ROW_SPACER}isInput(e){return e.type&this.INPUT}isExternalInput(e){return e.type&this.EXTERNAL_VALUE_INPUT}isInlineInput(e){return e.type&this.INLINE_INPUT}isStatementInput(e){return e.type&this.STATEMENT_INPUT}isPreviousConnection(e){return e.type&this.PREVIOUS_CONNECTION}isNextConnection(e){return e.type&this.NEXT_CONNECTION}isPreviousOrNextConnection(e){return e.type&(this.PREVIOUS_CONNECTION|this.NEXT_CONNECTION)}isLeftRoundedCorner(e){return e.type&this.LEFT_ROUND_CORNER}isRightRoundedCorner(e){return e.type&this.RIGHT_ROUND_CORNER}isLeftSquareCorner(e){return e.type&this.LEFT_SQUARE_CORNER}isRightSquareCorner(e){return e.type&this.RIGHT_SQUARE_CORNER}isCorner(e){return e.type&this.CORNER}isJaggedEdge(e){return e.type&this.JAGGED_EDGE}isRow(e){return e.type&this.ROW}isBetweenRowSpacer(e){return e.type&this.BETWEEN_ROW_SPACER}isTopRow(e){return e.type&this.TOP_ROW}isBottomRow(e){return e.type&this.BOTTOM_ROW}isTopOrBottomRow(e){return e.type&(this.TOP_ROW|this.BOTTOM_ROW)}isInputRow(e){return e.type&this.INPUT_ROW}},S=new XT,zs=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=S.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},_r=class{constructor(e){this.elements=[],this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0,this.hasStatement=this.hasExternalInput=!1,this.statementEdge=0,this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=!1,this.align=null,this.constants_=e,this.type=S.ROW,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}getLastInput(){for(let e=this.elements.length-1;0<=e;e--){const t=this.elements[e];if(S.isInput(t))return t}return null}measure(){throw Error("Unexpected attempt to measure a base Row.")}startsWithElemSpacer(){return!0}endsWithElemSpacer(){return!0}getFirstSpacer(){for(let e=0;e<this.elements.length;e++){const t=this.elements[e];if(S.isSpacer(t))return t}return null}getLastSpacer(){for(let e=this.elements.length-1;0<=e;e--){const t=this.elements[e];if(S.isSpacer(t))return t}return null}},ip=class extends _r{constructor(e){super(e),this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0,this.type|=S.BOTTOM_ROW}hasLeftSquareCorner(e){return!!e.outputConnection||!!e.getNextBlock()}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,o=0;for(let n=0;n<this.elements.length;n++){const c=this.elements[n];t+=c.width,S.isSpacer(c)||(S.isNextConnection(c)?o=Math.max(o,c.height):e=Math.max(e,c.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+o,this.descenderHeight=o,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},mo=class extends zs{constructor(e,t){super(e),this.connectionModel=t,this.type|=S.CONNECTION,this.shape=this.constants_.shapeFor(t),this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic,this.highlighted=t.isHighlighted()}},Ro=class extends mo{constructor(e,t){super(e,t.connection),this.input=t,this.connectionOffsetY=this.connectionOffsetX=0,this.type|=S.INPUT,this.align=t.align,(this.connectedBlock=t.connection&&t.connection.targetBlock()?t.connection.targetBlock():null)?(e=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=e.width,this.connectedBlockHeight=e.height):this.connectedBlockHeight=this.connectedBlockWidth=0}},Ol=class extends Ro{constructor(e,t){super(e,t),this.height=0,this.type|=S.EXTERNAL_VALUE_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight-this.constants_.TAB_OFFSET_FROM_TOP-this.constants_.MEDIUM_PADDING:this.shape.height,this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionHeight=this.shape.height,this.connectionWidth=this.shape.width}},on=class extends zs{constructor(e,t,o){super(e),this.field=t,this.parentInput=o,this.isEditable=t.EDITABLE,this.flipRtl=t.getFlipRtl(),this.type|=S.FIELD,e=this.field.getSize(),this.height=e.height,this.width=e.width}},np=class extends zs{constructor(e){super(e),this.type|=S.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height}},Ev=class extends zs{constructor(e,t){super(e),this.icon=t,this.flipRtl=!1,this.type|=S.ICON,e=t.getSize(),this.height=e.height,this.width=e.width}},os=class extends zs{constructor(e,t){super(e),this.type=this.type|S.SPACER|S.IN_ROW_SPACER,this.width=t,this.height=this.constants_.SPACER_DEFAULT_HEIGHT}},rp=class extends Ro{constructor(e,t){super(e,t),this.type|=S.INLINE_INPUT,this.connectedBlock?(this.width=this.connectedBlockWidth,this.height=this.connectedBlockHeight):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.constants_.EMPTY_INLINE_INPUT_PADDING),this.connectionHeight=this.isDynamicShape?this.shape.height(this.height):this.shape.height,this.connectionWidth=this.isDynamicShape?this.shape.width(this.height):this.shape.width,this.connectedBlock||(this.width+=this.connectionWidth*(this.isDynamicShape?2:1)),this.connectionOffsetY="connectionOffsetY"in this.shape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX="connectionOffsetX"in this.shape?this.shape.connectionOffsetX(this.connectionWidth):0}},wr=class extends Ro{constructor(e,t){super(e,t),this.type|=S.STATEMENT_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT,this.width=this.constants_.STATEMENT_INPUT_NOTCH_OFFSET+this.shape.width}},ap=class extends _r{constructor(e){super(e),this.connectedBlockWidths=0,this.type|=S.INPUT_ROW}measure(){this.width=this.minWidth,this.height=this.minHeight;let e=0;for(let t=0;t<this.elements.length;t++){const o=this.elements[t];this.width+=o.width,S.isInput(o)&&o instanceof Ro&&(S.isStatementInput(o)&&o instanceof wr?e+=o.connectedBlockWidth:S.isExternalInput(o)&&o instanceof Ol&&o.connectedBlockWidth!==0&&(e+=o.connectedBlockWidth-o.connectionWidth)),S.isSpacer(o)||(this.height=Math.max(this.height,o.height))}this.connectedBlockWidths=e,this.widthWithConnectedBlocks=this.width+e}endsWithElemSpacer(){return!this.hasExternalInput&&!this.hasStatement}},Iv=class extends zs{constructor(e){super(e),this.type|=S.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width}},xv=class extends mo{constructor(e,t){super(e,t),this.type|=S.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},Dv=class extends mo{constructor(e,t){super(e,t),this.connectionOffsetX=0,this.type|=S.OUTPUT_CONNECTION,this.height=this.isDynamicShape?0:this.shape.height,this.startX=this.width=this.isDynamicShape?0:this.shape.width,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP}},Av=class extends mo{constructor(e,t){super(e,t),this.type|=S.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},Cr=class extends zs{constructor(e,t){super(e),this.type=(t&&t!=="left"?S.RIGHT_ROUND_CORNER:S.LEFT_ROUND_CORNER)|S.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2}},lp=class extends _r{constructor(e,t,o){super(e),this.height=t,this.width=o,this.precedesStatement=this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.type=this.type|S.SPACER|S.BETWEEN_ROW_SPACER,this.elements=[new os(this.constants_,o)]}measure(){}},Tr=class extends zs{constructor(e,t){super(e),this.type=(t&&t!=="left"?S.RIGHT_SQUARE_CORNER:S.LEFT_SQUARE_CORNER)|S.CORNER,this.width=this.height=this.constants_.NO_PADDING}},cp=class extends _r{constructor(e){super(e),this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null,this.type|=S.TOP_ROW}hasLeftSquareCorner(e){const t=(e.hat?e.hat==="cap":this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection,o=e.getPreviousBlock();return!!e.outputConnection||t||(o?o.getNextBlock()===e:!1)}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,o=0;for(let n=0;n<this.elements.length;n++){const c=this.elements[n];t+=c.width,S.isSpacer(c)||(S.isHat(c)&&c instanceof np?o=Math.max(o,c.ascenderHeight):e=Math.max(e,c.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+o,this.capline=this.ascenderHeight=o,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},Ml=class{constructor(){this.NO_PADDING=0,this.SMALL_PADDING=3,this.MEDIUM_PADDING=5,this.MEDIUM_LARGE_PADDING=8,this.LARGE_PADDING=10,this.TAB_HEIGHT=15,this.TAB_OFFSET_FROM_TOP=5,this.TAB_VERTICAL_OVERLAP=2.5,this.TAB_WIDTH=8,this.NOTCH_WIDTH=15,this.NOTCH_HEIGHT=4,this.MIN_BLOCK_WIDTH=12,this.EMPTY_BLOCK_SPACER_HEIGHT=16,this.CORNER_RADIUS=8,this.NOTCH_OFFSET_LEFT=15,this.STATEMENT_BOTTOM_SPACER=0,this.STATEMENT_INPUT_PADDING_LEFT=20,this.BETWEEN_STATEMENT_PADDING_Y=4,this.ADD_START_HATS=!1,this.START_HAT_HEIGHT=15,this.START_HAT_WIDTH=100,this.SPACER_DEFAULT_HEIGHT=15,this.MIN_BLOCK_HEIGHT=24,this.EMPTY_INLINE_INPUT_PADDING=14.5,this.EXTERNAL_VALUE_INPUT_PADDING=2,this.JAGGED_TEETH_HEIGHT=12,this.JAGGED_TEETH_WIDTH=6,this.FIELD_TEXT_FONTSIZE=11,this.FIELD_TEXT_FONTWEIGHT="normal",this.FIELD_TEXT_FONTFAMILY="sans-serif",this.FIELD_TEXT_BASELINE=this.FIELD_TEXT_HEIGHT=-1,this.FIELD_BORDER_RECT_RADIUS=4,this.FIELD_BORDER_RECT_HEIGHT=16,this.FIELD_BORDER_RECT_X_PADDING=5,this.FIELD_BORDER_RECT_Y_PADDING=3,this.FIELD_BORDER_RECT_COLOUR="#fff",this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1,this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12,this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1,this.FIELD_COLOUR_DEFAULT_WIDTH=26,this.defs=null,this.embossFilterId="",this.embossFilter=null,this.disabledPatternId="",this.disabledPattern=null,this.debugFilterId="",this.cssNode=this.debugFilter=null,this.CURSOR_COLOUR="#cc0a0a",this.MARKER_COLOUR="#4286f4",this.CURSOR_WS_WIDTH=100,this.WS_CURSOR_HEIGHT=5,this.CURSOR_STACK_PADDING=10,this.CURSOR_BLOCK_PADDING=2,this.CURSOR_STROKE_WIDTH=4,this.FULL_BLOCK_FIELDS=!1,this.INSERTION_MARKER_COLOUR="#000000",this.INSERTION_MARKER_OPACITY=.2,this.SHAPES={PUZZLE:1,NOTCH:2},this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=this.DUMMY_INPUT_MIN_HEIGHT=this.TAB_HEIGHT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT,this.TOP_ROW_MIN_HEIGHT=this.MEDIUM_PADDING,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.MEDIUM_PADDING,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11,this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT,this.START_POINT=at(0,0),this.FIELD_TEXT_BASELINE_CENTER=!0,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_DROPDOWN_SVG_ARROW_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",this.FIELD_COLOUR_DEFAULT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_CHECKBOX_X_OFFSET=this.FIELD_BORDER_RECT_X_PADDING-3,this.randomIdentifier=String(Math.random()).substring(2)}init(){this.JAGGED_TEETH=this.makeJaggedTeeth(),this.NOTCH=this.makeNotch(),this.START_HAT=this.makeStartHat(),this.PUZZLE_TAB=this.makePuzzleTab(),this.INSIDE_CORNERS=this.makeInsideCorners(),this.OUTSIDE_CORNERS=this.makeOutsideCorners()}setTheme(e){this.blockStyles=Object.create(null);const t=e.blockStyles;for(const o in t)this.blockStyles[o]=this.validatedBlockStyle_(t[o]);this.setDynamicProperties_(e)}setDynamicProperties_(e){this.setFontConstants_(e),this.setComponentConstants_(e),this.ADD_START_HATS=e.startHats!==void 0?e.startHats:this.ADD_START_HATS}setFontConstants_(e){e.fontStyle&&e.fontStyle.family&&(this.FIELD_TEXT_FONTFAMILY=e.fontStyle.family),e.fontStyle&&e.fontStyle.weight&&(this.FIELD_TEXT_FONTWEIGHT=e.fontStyle.weight),e.fontStyle&&e.fontStyle.size&&(this.FIELD_TEXT_FONTSIZE=e.fontStyle.size),e=da("Hg",this.FIELD_TEXT_FONTSIZE+"pt",this.FIELD_TEXT_FONTWEIGHT,this.FIELD_TEXT_FONTFAMILY),this.FIELD_TEXT_HEIGHT=e.height,this.FIELD_TEXT_BASELINE=e.baseline}setComponentConstants_(e){this.CURSOR_COLOUR=e.getComponentStyle("cursorColour")||this.CURSOR_COLOUR,this.MARKER_COLOUR=e.getComponentStyle("markerColour")||this.MARKER_COLOUR,this.INSERTION_MARKER_COLOUR=e.getComponentStyle("insertionMarkerColour")||this.INSERTION_MARKER_COLOUR,this.INSERTION_MARKER_OPACITY=Number(e.getComponentStyle("insertionMarkerOpacity"))||this.INSERTION_MARKER_OPACITY}getBlockStyleForColour(e){const t="auto_"+e;return this.blockStyles[t]||(this.blockStyles[t]=this.createBlockStyle_(e)),{style:this.blockStyles[t],name:t}}getBlockStyle(e){return this.blockStyles[e||""]||(e&&e.startsWith("auto_")?this.getBlockStyleForColour(e.substring(5)).style:this.createBlockStyle_("#000000"))}createBlockStyle_(e){return this.validatedBlockStyle_({colourPrimary:e})}validatedBlockStyle_(e){const t={};return e&&Object.assign(t,e),e=Pi(t.colourPrimary||"#000"),t.colourPrimary=e.hex,t.colourSecondary=t.colourSecondary?Pi(t.colourSecondary).hex:this.generateSecondaryColour_(t.colourPrimary),t.colourTertiary=t.colourTertiary?Pi(t.colourTertiary).hex:this.generateTertiaryColour_(t.colourPrimary),t.hat=t.hat||"",t}generateSecondaryColour_(e){return Ko("#fff",e,.6)||e}generateTertiaryColour_(e){return Ko("#fff",e,.3)||e}dispose(){this.embossFilter&&Ke(this.embossFilter),this.disabledPattern&&Ke(this.disabledPattern),this.debugFilter&&Ke(this.debugFilter),this.cssNode=null}makeJaggedTeeth(){const e=this.JAGGED_TEETH_HEIGHT,t=this.JAGGED_TEETH_WIDTH,o=Fi([ue(t,e/4),ue(2*-t,e/2),ue(t,e/4)]);return{height:e,width:t,path:o}}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,o=Yt("c",[ue(30,-e),ue(70,-e),ue(t,0)]);return{height:e,width:t,path:o}}makePuzzleTab(){function e(h){h=h?-1:1;const $=-h;var T=o/2;const L=T+2.5,te=T+.5,nt=ue(-t,h*T);return T=ue(t,h*T),Yt("c",[ue(0,h*L),ue(-t,$*te),nt])+Yt("s",[ue(t,2.5*$),T])}const t=this.TAB_WIDTH,o=this.TAB_HEIGHT,n=e(!0),c=e(!1);return{type:this.SHAPES.PUZZLE,width:t,height:o,pathDown:c,pathUp:n}}makeNotch(){function e($){return Fi([ue($*n,o),ue(3*$,0),ue($*n,-o)])}const t=this.NOTCH_WIDTH,o=this.NOTCH_HEIGHT,n=(t-3)/2,c=e(1),h=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:o,pathLeft:c,pathRight:h}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=gt("a","0 0,0",e,ue(-e,e)),o=gt("a","0 0,0",e,ue(e,e));return{width:e,height:e,pathTop:t,pathBottom:o}}makeOutsideCorners(){const e=this.CORNER_RADIUS,t=at(0,e)+gt("a","0 0,1",e,ue(e,-e)),o=gt("a","0 0,1",e,ue(e,e)),n=gt("a","0 0,1",e,ue(-e,-e)),c=gt("a","0 0,1",e,ue(-e,e));return{topLeft:t,topRight:o,bottomRight:c,bottomLeft:n,rightHeight:e}}shapeFor(e){switch(e.type){case oe.INPUT_VALUE:case oe.OUTPUT_VALUE:return this.PUZZLE_TAB;case oe.PREVIOUS_STATEMENT:case oe.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type")}}createDom(e,t,o){this.injectCSS_(t,o),this.defs=N(x.DEFS,{},e),e=N(x.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},this.defs),N(x.FEGAUSSIANBLUR,{in:"SourceAlpha",stdDeviation:1,result:"blur"},e),t=N(x.FESPECULARLIGHTING,{in:"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},e),N(x.FEPOINTLIGHT,{x:-5e3,y:-1e4,z:2e4},t),N(x.FECOMPOSITE,{in:"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},e),N(x.FECOMPOSITE,{in:"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},e),this.embossFilterId=e.id,this.embossFilter=e,e=N(x.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs),N(x.RECT,{width:10,height:10,fill:"#aaa"},e),N(x.PATH,{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},e),this.disabledPatternId=e.id,this.disabledPattern=e,this.createDebugFilter()}createDebugFilter(){if(!this.debugFilter){const e=N(x.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs),t=N(x.FECOMPONENTTRANSFER,{result:"outBlur"},e);N(x.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),N(x.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},e),N(x.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),this.debugFilterId=e.id,this.debugFilter=e}}injectCSS_(e,t){t=this.getCSS_(t),e="blockly-renderer-style-"+e,this.cssNode=document.getElementById(e);const o=t.join(`
862
+ `);this.cssNode?this.cssNode.firstChild.textContent=o:(t=document.createElement("style"),t.id=e,e=document.createTextNode(o),t.appendChild(e),document.head.insertBefore(t,document.head.firstChild),this.cssNode=t)}getCSS_(e){return[`${e} .blocklyText, `,`${e} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e} .blocklyText {`,"fill: #fff;","}",`${e} .blocklyNonEditableText>rect,`,`${e} .blocklyEditableText>rect {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"fill-opacity: .6;","stroke: none;","}",`${e} .blocklyNonEditableText>text,`,`${e} .blocklyEditableText>text {`,"fill: #000;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #000;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #000;","}",`${e} .blocklyEditableText:not(.editing):hover>rect {`,"stroke: #fff;","stroke-width: 2;","}",`${e} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"}",`${e} .blocklySelected>.blocklyPath {`,"stroke: #fc3;","stroke-width: 3px;","}",`${e} .blocklyHighlightedConnectionPath {`,"stroke: #fc3;","}",`${e} .blocklyReplaceable .blocklyPath {`,"fill-opacity: .5;","}",`${e} .blocklyReplaceable .blocklyPathLight,`,`${e} .blocklyReplaceable .blocklyPathDark {`,"display: none;","}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"]}},Nl=class{constructor(e,t){this.inlinePath_=this.outlinePath_="",this.block_=e,this.info_=t,this.topLeft_=e.getRelativeToSurfaceXY(),this.constants_=t.getRenderer().getConstants()}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),this.block_.pathObject.setPath(this.outlinePath_+`
863
+ `+this.inlinePath_),this.info_.RTL&&this.block_.pathObject.flipRTL(),this.recordSizeOnBlock_()}recordSizeOnBlock_(){this.block_.height=this.info_.height,this.block_.width=this.info_.widthWithChildren,this.block_.childlessWidth=this.info_.width}drawOutline_(){this.drawTop_();for(let e=1;e<this.info_.rows.length-1;e++){const t=this.info_.rows[e];t.hasJaggedEdge?this.drawJaggedEdge_(t):t.hasStatement?this.drawStatementInput_(t):t.hasExternalInput?this.drawValueInput_(t):this.drawRightSideRow_(t)}this.drawBottom_(),this.drawLeft_()}drawTop_(){const e=this.info_.topRow,t=e.elements;this.positionPreviousConnection_(),this.outlinePath_+=at(e.xPos,this.info_.startY);for(let o=0,n;n=t[o];o++)S.isLeftRoundedCorner(n)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:S.isRightRoundedCorner(n)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:S.isPreviousConnection(n)&&n instanceof mo?this.outlinePath_+=n.shape.pathLeft:S.isHat(n)?this.outlinePath_+=this.constants_.START_HAT.path:S.isSpacer(n)&&(this.outlinePath_+=ne("h",n.width));this.outlinePath_+=ne("v",e.height)}drawJaggedEdge_(e){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+ne("v",e.height-this.constants_.JAGGED_TEETH.height)}drawValueInput_(e){const t=e.getLastInput();this.positionExternalValueConnection_(e);const o=Ja(t.shape)?t.shape.pathDown(t.height):t.shape.pathDown;this.outlinePath_+=ne("H",t.xPos+t.width)+o+ne("v",e.height-t.connectionHeight)}drawStatementInput_(e){var t=e.getLastInput();if(t){var o=t.xPos+t.notchOffset+t.shape.width;t=t.shape.pathRight+ne("h",-(t.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var n=e.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=ne("H",o)+t+ne("v",n)+this.constants_.INSIDE_CORNERS.pathBottom+ne("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}}drawRightSideRow_(e){this.outlinePath_+=ne("V",e.yPos+e.height)}drawBottom_(){const e=this.info_.bottomRow,t=e.elements;this.positionNextConnection_();let o=0,n="";for(let c=t.length-1,h;h=t[c];c--)S.isNextConnection(h)&&h instanceof mo?n+=h.shape.pathRight:S.isLeftSquareCorner(h)?n+=ne("H",e.xPos):S.isLeftRoundedCorner(h)?n+=this.constants_.OUTSIDE_CORNERS.bottomLeft:S.isRightRoundedCorner(h)?(n+=this.constants_.OUTSIDE_CORNERS.bottomRight,o=this.constants_.OUTSIDE_CORNERS.rightHeight):S.isSpacer(h)&&(n+=ne("h",-1*h.width));this.outlinePath_+=ne("V",e.baseline-o),this.outlinePath_+=n}drawLeft_(){var e=this.info_.outputConnection;if(this.positionOutputConnection_(),e){const t=e.connectionOffsetY+e.height;e=Ja(e.shape)?e.shape.pathUp(e.height):e.shape.pathUp,this.outlinePath_+=ne("V",t)+e}this.outlinePath_+="z"}drawInternals_(){for(let e=0,t;t=this.info_.rows[e];e++)for(let o=0,n;n=t.elements[o];o++)S.isInlineInput(n)?this.drawInlineInput_(n):(S.isIcon(n)||S.isField(n))&&this.layoutField_(n)}layoutField_(e){const t=e.centerline-e.height/2;let o=e.xPos;var n="";this.info_.RTL&&(o=-(o+e.width),e.flipRtl&&(o+=e.width,n="scale(-1 1)")),S.isIcon(e)?(n=e.icon,n.setOffsetInBlock(new V(o,t)),this.info_.isInsertionMarker&&n.hideForInsertionMarker()):(e=e.field.getSvgRoot(),e.setAttribute("transform","translate("+o+","+t+")"+n),this.info_.isInsertionMarker&&e.setAttribute("display","none"))}drawInlineInput_(e){const t=e.width,o=e.height,n=e.connectionOffsetY,c=e.connectionHeight+n;this.inlinePath_+=wt(e.xPos+e.connectionWidth,e.centerline-o/2)+ne("v",n)+e.shape.pathDown+ne("v",o-c)+ne("h",t-e.connectionWidth)+ne("v",-o)+"z",this.positionInlineInputConnection_(e)}positionInlineInputConnection_(e){const t=e.centerline-e.height/2;if(e.connectionModel){let o=e.xPos+e.connectionWidth+e.connectionOffsetX;this.info_.RTL&&(o*=-1),e.connectionModel.setOffsetInBlock(o,t+e.connectionOffsetY)}}positionStatementInputConnection_(e){const t=e.getLastInput();if(t!=null&&t.connectionModel){let o=e.xPos+e.statementEdge+t.notchOffset;this.info_.RTL&&(o*=-1),t.connectionModel.setOffsetInBlock(o,e.yPos)}}positionExternalValueConnection_(e){const t=e.getLastInput();if(t&&t.connectionModel){let o=e.xPos+e.width;this.info_.RTL&&(o*=-1),t.connectionModel.setOffsetInBlock(o,e.yPos)}}positionPreviousConnection_(){const e=this.info_.topRow;if(e.connection){const t=e.xPos+e.notchOffset;e.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-t:t,0)}}positionNextConnection_(){const e=this.info_.bottomRow;if(e.connection){const t=e.connection,o=t.xPos;t.connectionModel.setOffsetInBlock(this.info_.RTL?-o:o,e.baseline)}}positionOutputConnection_(){if(this.info_.outputConnection){const e=this.info_.startX+this.info_.outputConnection.connectionOffsetX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-e:e,this.info_.outputConnection.connectionOffsetY)}}updateConnectionHighlights(){for(const e of this.info_.rows)for(const t of e.elements)if(t instanceof mo)if(t.highlighted)this.drawConnectionHighlightPath(t);else{let o,n;(n=(o=this.block_.pathObject).removeConnectionHighlight)==null||n.call(o,t.connectionModel)}}drawConnectionHighlightPath(e){const t=e.connectionModel;e=t.type===oe.INPUT_VALUE||t.type===oe.OUTPUT_VALUE?this.getExpressionConnectionHighlightPath(e):this.getStatementConnectionHighlightPath(e);const o=t.getSourceBlock();let n,c;(c=(n=o.pathObject).addConnectionHighlight)==null||c.call(n,t,e,t.getOffsetInBlock(),o.RTL)}getExpressionConnectionHighlightPath(e){let t="";return Ja(e.shape)?t=e.shape.pathDown(e.height):M$(e.shape)&&(t=e.shape.pathDown),e=this.constants_.TAB_OFFSET_FROM_TOP,at(0,-e)+ne("v",e)+t+ne("v",e)}getStatementConnectionHighlightPath(e){if(!N$(e.shape))throw Error("Statement connections should have notch shapes");const t=this.constants_.NOTCH_OFFSET_LEFT-this.constants_.CORNER_RADIUS;return at(-t,0)+ne("h",t)+e.shape.pathLeft+ne("h",t)}};(function(e){e[e.LEFT=-1]="LEFT",e[e.CENTRE=0]="CENTRE",e[e.RIGHT=1]="RIGHT"})(i.Align$$module$build$src$core$inputs$align||(i.Align$$module$build$src$core$inputs$align={})),i.Align$$module$build$src$core$inputs$align;var hi=class extends Qe{constructor(e,t,o){super(Qe.SKIP_SETUP),this.class=null,this.EDITABLE=!1,this.maxDisplayLength=1/0,e!==Qe.SKIP_SETUP&&(o?this.configure_(o):this.class=t||null,this.setValue(e))}configure_(e){super.configure_(e),e.class&&(this.class=e.class)}initView(){this.createTextElement_(),this.class&&ge(this.getTextElement(),this.class)}doClassValidation_(e){return e==null?null:`${e}`}setClass(e){this.textElement_&&(this.class&&ot(this.textElement_,this.class),e&&ge(this.textElement_,e)),this.class=e}static fromJson(e){return new this(pt(e.text),void 0,e)}};Ps("field_label",hi),hi.prototype.DEFAULT_VALUE="";var nn=class{constructor(e,t){this.name=e,this.sourceBlock=t,this.fieldRow=[],this.align=i.Align$$module$build$src$core$inputs$align.LEFT,this.visible=!0,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.CUSTOM,this.connection=null}getSourceBlock(){return this.sourceBlock}appendField(e,t){return this.insertFieldAt(this.fieldRow.length,e,t),this}insertFieldAt(e,t,o){if(0>e||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return(t||t===""&&o)&&(typeof t=="string"&&(t=i.fromJson$$module$build$src$core$field_registry({type:"field_label",text:t})),t.setSourceBlock(this.sourceBlock),this.sourceBlock.initialized&&this.initField(t),t.name=o,t.setVisible(this.isVisible()),t.prefixField&&(e=this.insertFieldAt(e,t.prefixField)),this.fieldRow.splice(e,0,t),e++,t.suffixField&&(e=this.insertFieldAt(e,t.suffixField)),this.sourceBlock.rendered&&this.sourceBlock.queueRender()),e}removeField(e,t){for(let o=0,n;n=this.fieldRow[o];o++)if(n.name===e)return n.dispose(),this.fieldRow.splice(o,1),this.sourceBlock.rendered&&this.sourceBlock.queueRender(),!0;if(t)return!1;throw Error('Field "'+e+'" not found.')}isVisible(){return this.visible}setVisible(e){let t=[];if(this.visible===e)return t;this.visible=e;for(let n=0,c;c=this.fieldRow[n];n++)c.setVisible(e);if(this.connection){var o=this.connection;e?t=o.startTrackingAll():o.stopTrackingAll(),(o=o.targetBlock())&&(o.getSvgRoot().style.display=e?"block":"none")}return t}markDirty(){for(let e=0,t;t=this.fieldRow[e];e++)t.markDirty()}setCheck(e){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setCheck(e),this}setAlign(e){return this.align=e,this.sourceBlock.rendered&&this.sourceBlock.queueRender(),this}setShadowDom(e){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setShadowDom(e),this}getShadowDom(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()}init(){for(const e of this.fieldRow)e.init()}initModel(){for(const e of this.fieldRow)e.initModel()}initField(e){this.sourceBlock.rendered?e.init():e.initModel()}dispose(){for(let e=0,t;t=this.fieldRow[e];e++)t.dispose();this.connection&&this.connection.dispose()}makeConnection(e){return this.sourceBlock.makeConnection_(e)}},Us=class extends nn{constructor(e,t){super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.DUMMY}},fo=class extends nn{constructor(e,t){super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.END_ROW}},is=class extends nn{constructor(e,t){if(!e)throw Error("Statement inputs must have a non-empty name");super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT,this.connection=this.makeConnection(oe.NEXT_STATEMENT)}},Rv;i.ValueInput$$module$build$src$core$inputs$value_input=class extends nn{constructor(e,t){if(!e)throw Error("Value inputs must have a non-empty name");super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.VALUE,this.connection=this.makeConnection(oe.INPUT_VALUE)}},Rv={},Rv.ValueInput=i.ValueInput$$module$build$src$core$inputs$value_input;var kr=class{constructor(e,t){this.statementEdge=this.width=this.widthWithChildren=this.height=0,this.rows=[],this.inputRows=[],this.startY=this.startX=0,this.renderer_=e,this.block_=t,this.constants_=this.renderer_.getConstants(),this.outputConnection=t.outputConnection?new Dv(this.constants_,t.outputConnection):null,this.isInline=t.getInputsInline()&&!t.isCollapsed(),this.isCollapsed=t.isCollapsed(),this.isInsertionMarker=t.isInsertionMarker(),this.RTL=t.RTL,this.topRow=new cp(this.constants_),this.bottomRow=new ip(this.constants_)}getRenderer(){return this.renderer_}measure(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()}createRows_(){this.populateTopRow_(),this.rows.push(this.topRow);let e=new ap(this.constants_);this.inputRows.push(e);var t=this.block_.getIcons();for(let o=0,n;n=t[o];o++){const c=new Ev(this.constants_,n);this.isCollapsed&&!n.isShownWhenCollapsed()||e.elements.push(c)}t=void 0;for(let o=0,n;n=this.block_.inputList[o];o++)if(n.isVisible()){this.shouldStartNewRow_(n,t)&&(this.rows.push(e),e=new ap(this.constants_),this.inputRows.push(e));for(let c=0,h;h=n.fieldRow[c];c++)e.elements.push(new on(this.constants_,h,n));this.addInput_(n,e),t=n}this.isCollapsed&&(e.hasJaggedEdge=!0,e.elements.push(new Iv(this.constants_))),(e.elements.length||e.hasDummyInput)&&this.rows.push(e),this.populateBottomRow_(),this.rows.push(this.bottomRow)}populateTopRow_(){var e=!!this.block_.previousConnection;const t=(this.block_.hat?this.block_.hat==="cap":this.constants_.ADD_START_HATS)&&!this.outputConnection&&!e;let o=this.topRow.hasLeftSquareCorner(this.block_)?Tr:Cr;this.topRow.elements.push(new o(this.constants_)),t?(e=new np(this.constants_),this.topRow.elements.push(e),this.topRow.capline=e.ascenderHeight):e&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new Av(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0]instanceof is&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT,o=this.topRow.hasRightSquareCorner(this.block_)?Tr:Cr,this.topRow.elements.push(new o(this.constants_,"right"))}populateBottomRow_(){this.bottomRow.hasNextConnection=!!this.block_.nextConnection,this.bottomRow.minHeight=this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1]instanceof is?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new Tr(this.constants_)):this.bottomRow.elements.push(new Cr(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new xv(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new Tr(this.constants_,"right")):this.bottomRow.elements.push(new Cr(this.constants_,"right"))}addInput_(e,t){this.isInline&&e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new rp(this.constants_,e)),t.hasInlineInput=!0):e instanceof is?(t.elements.push(new wr(this.constants_,e)),t.hasStatement=!0):e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new Ol(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Us||e instanceof fo)&&(t.minHeight=Math.max(t.minHeight,e.getSourceBlock()&&e.getSourceBlock().isShadow()?this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT:this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),t.align===null&&(t.align=e.align)}shouldStartNewRow_(e,t){return t?t instanceof fo||e instanceof is||t instanceof is?!0:e instanceof i.ValueInput$$module$build$src$core$inputs$value_input||e instanceof Us||t instanceof i.ValueInput$$module$build$src$core$inputs$value_input?!this.isInline:!1:!1}addElemSpacing_(){for(let e=0,t;t=this.rows[e];e++){const o=t.elements;if(t.elements=[],t.startsWithElemSpacer()&&t.elements.push(new os(this.constants_,this.getInRowSpacing_(null,o[0]))),o.length){for(let n=0;n<o.length-1;n++){t.elements.push(o[n]);const c=this.getInRowSpacing_(o[n],o[n+1]);t.elements.push(new os(this.constants_,c))}t.elements.push(o[o.length-1]),t.endsWithElemSpacer()&&t.elements.push(new os(this.constants_,this.getInRowSpacing_(o[o.length-1],null)))}}}getInRowSpacing_(e,t){if(!e&&t&&S.isStatementInput(t))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(e&&S.isInput(e)&&!t){if(S.isExternalInput(e))return this.constants_.NO_PADDING;if(S.isInlineInput(e))return this.constants_.LARGE_PADDING;if(S.isStatementInput(e))return this.constants_.NO_PADDING}return e&&S.isLeftSquareCorner(e)&&t&&(S.isPreviousConnection(t)||S.isNextConnection(t))?t.notchOffset:e&&S.isLeftRoundedCorner(e)&&t&&(S.isPreviousConnection(t)||S.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING}computeBounds_(){let e=0,t=0,o=0;for(let c=0,h;h=this.rows[c];c++){if(h.measure(),t=Math.max(t,h.width),h.hasStatement){var n=h.getLastInput();let $,T;n=h.width-((T=($=n)==null?void 0:$.width)!=null?T:0),e=Math.max(e,n)}o=Math.max(o,h.widthWithConnectedBlocks)}this.statementEdge=e,this.width=t;for(let c=0,h;h=this.rows[c];c++)h.hasStatement&&(h.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(t,o),this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)}alignRowElements_(){for(let t=0,o;o=this.rows[t];t++)if(o.hasStatement)this.alignStatementRow_(o);else{var e=o.width;e=this.getDesiredRowWidth_(o)-e,0<e&&this.addAlignmentPadding_(o,e),S.isTopOrBottomRow(o)&&(o.widthWithConnectedBlocks=o.width)}}getDesiredRowWidth_(e){return this.width-this.startX}addAlignmentPadding_(e,t){const o=e.getFirstSpacer(),n=e.getLastSpacer();if((e.hasExternalInput||e.hasStatement)&&(e.widthWithConnectedBlocks+=t),e.align===i.Align$$module$build$src$core$inputs$align.LEFT&&n)n.width+=t;else if(e.align===i.Align$$module$build$src$core$inputs$align.CENTRE&&o&&n)o.width+=t/2,n.width+=t/2;else if(e.align===i.Align$$module$build$src$core$inputs$align.RIGHT&&o)o.width+=t;else if(n)n.width+=t;else return;e.width+=t}alignStatementRow_(e){const t=e.getLastInput();if(t){var o=e.width-t.width,n=this.statementEdge;o=n-o,0<o&&this.addAlignmentPadding_(e,o),o=e.width,n=this.getDesiredRowWidth_(e),t.width+=n-o,t.height=Math.max(t.height,e.height),e.width+=n-o,e.widthWithConnectedBlocks=Math.max(e.width,this.statementEdge+e.connectedBlockWidths)}}addRowSpacing_(){const e=this.rows;this.rows=[];for(let t=0;t<e.length;t++)this.rows.push(e[t]),t!==e.length-1&&this.rows.push(this.makeSpacerRow_(e[t],e[t+1]))}makeSpacerRow_(e,t){var o=this.getSpacerRowHeight_(e,t);const n=this.getSpacerRowWidth_(e,t);return o=new lp(this.constants_,o,n),e.hasStatement&&(o.followsStatement=!0),t.hasStatement&&(o.precedesStatement=!0),o}getSpacerRowWidth_(e,t){return this.width-this.startX}getSpacerRowHeight_(e,t){return this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){return S.isSpacer(t)?e.yPos+t.height/2:S.isBottomRow(e)?(e=e.yPos+e.height-e.descenderHeight,S.isNextConnection(t)?e+t.height/2:e-t.height/2):S.isTopRow(e)?S.isHat(t)?e.capline-t.height/2:e.capline+t.height/2:e.yPos+e.height/2}recordElemPositions_(e){let t=e.xPos;for(let o=0,n;n=e.elements[o];o++)S.isSpacer(n)&&(n.height=e.height),n.xPos=t,n.centerline=this.getElemCenterline_(e,n),t+=n.width}finalize_(){let e=0,t=0;for(let o=0,n;n=this.rows[o];o++)n.yPos=t,n.xPos=this.startX,t+=n.height,e=Math.max(e,n.widthWithConnectedBlocks),this.recordElemPositions_(n);if(this.outputConnection&&this.block_.nextConnection){const o=this.block_.nextConnection.targetBlock();o&&(e=Math.max(e,o.getHeightWidth().width))}this.widthWithChildren=e+this.startX,this.height=t,this.startY=this.topRow.capline,this.bottomRow.baseline=t-this.bottomRow.descenderHeight}getMeasureableForConnection(e){let t;if(((t=this.outputConnection)==null?void 0:t.connectionModel)===e)return this.outputConnection;for(const o of this.rows)for(const n of o.elements)if(n instanceof mo&&n.connectionModel===e)return n;return null}},up=class extends ni{constructor(e){if(super(e),this.type=O.BLOCK_DELETE,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=Zn(e),this.ids=he(e),this.wasShadow=e.isShadow(),this.oldJson=Qt(e,{addCoordinates:!0})}}toJson(){const e=super.toJson();if(!this.oldXml)throw Error("The old block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(this.wasShadow===void 0)throw Error("Whether the block was a shadow is undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.oldXml=Ls(this.oldXml),e.ids=this.ids,e.wasShadow=this.wasShadow,e.oldJson=this.oldJson,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new up),t.oldXml=i.textToDom$$module$build$src$core$utils$xml(e.oldXml),t.ids=e.ids,t.wasShadow=e.wasShadow||t.oldXml.tagName.toLowerCase()==="shadow",t.oldJson=e.oldJson,e.recordUndo!==void 0&&(t.recordUndo=e.recordUndo),t}run(e){const t=this.getEventWorkspace_();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(e)for(e=0;e<this.ids.length;e++){const o=this.ids[e],n=t.getBlockById(o);n?n.dispose(!1):o===this.blockId&&console.warn("Can't delete non-existent block: "+o)}else eo(this.oldJson,t)}};r(F.EVENT,O.BLOCK_DELETE,up);var Be=class{constructor(e,t){this.type=t,this.targetConnection=null,this.disposed=!1,this.shadowDom=this.check=null,this.y=this.x=0,this.shadowState=null,this.sourceBlock_=e}connect_(e){const t=oe.INPUT_VALUE,o=this.getSourceBlock();var n=e.getSourceBlock();e.isConnected()&&e.disconnectInternal(!1);let c;if(this.isConnected()){const $=this.stashShadowState(),T=this.targetBlock();T.isShadow()?T.dispose(!1):(this.disconnectInternal(),c=T),this.applyShadowState($)}let h;K()&&(h=new(G(O.BLOCK_MOVE))(n),h.setReason(["connect"])),L$(this,e),n.setParent(o),h&&(h.recordNew(),z(h)),c&&(e=this.type===t?c.outputConnection:c.previousConnection)&&((n=Be.getConnectionForOrphanedConnection(n,e))?e.connect(n):e.onFailedConnect(this))}dispose(){if(this.isConnected()){this.isSuperior()&&this.setShadowStateInternal();const e=this.targetBlock();e&&!e.isDeadOrDying()&&e.unplug()}this.disposed=!0}getSourceBlock(){return this.sourceBlock_}isSuperior(){return this.type===oe.INPUT_VALUE||this.type===oe.NEXT_STATEMENT}isConnected(){return!!this.targetConnection}getConnectionChecker(){return this.sourceBlock_.workspace.connectionChecker}onFailedConnect(e){}connect(e){if(this.targetConnection===e)return!0;if(this.getConnectionChecker().canConnect(this,e,!1)){const t=i.getGroup$$module$build$src$core$events$utils();t||i.setGroup$$module$build$src$core$events$utils(!0),this.isSuperior()?this.connect_(e):e.connect_(this),i.setGroup$$module$build$src$core$events$utils(t)}return this.isConnected()}disconnect(){this.disconnectInternal()}disconnectInternal(e=!0){const{parentConnection:t,childConnection:o}=this.getParentAndChildConnections();if(!t||!o)throw Error("Source connection not connected.");const n=i.getGroup$$module$build$src$core$events$utils();n||i.setGroup$$module$build$src$core$events$utils(!0);let c;K()&&(c=new(G(O.BLOCK_MOVE))(o.getSourceBlock()),c.setReason(["disconnect"]));const h=this.targetConnection;h&&(h.targetConnection=null),this.targetConnection=null,e&&o.getSourceBlock().setParent(null),c&&(c.recordNew(),z(c)),o.getSourceBlock().isShadow()||t.respawnShadow_(),i.setGroup$$module$build$src$core$events$utils(n)}getParentAndChildConnections(){return this.targetConnection?this.isSuperior()?{parentConnection:this,childConnection:this.targetConnection}:{parentConnection:this.targetConnection,childConnection:this}:{}}respawnShadow_(){this.createShadowBlock(!0)}reconnect(e,t){if(this.getSourceBlock().isDeadOrDying())return!1;var o;return t=(o=e.getInput(t))==null?void 0:o.connection,o=this.targetBlock(),o&&o!==e||!t||t.targetConnection===this?!1:(t.isConnected()&&t.disconnect(),t.connect(this),!0)}targetBlock(){if(this.isConnected()){let e,t;return(t=(e=this.targetConnection)==null?void 0:e.getSourceBlock())!=null?t:null}return null}onCheckChanged_(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()}setCheck(e){return e?(Array.isArray(e)||(e=[e]),this.check=e,this.onCheckChanged_()):this.check=null,this}getCheck(){return this.check}setShadowDom(e){this.setShadowStateInternal({shadowDom:e})}getShadowDom(e){return e&&this.targetBlock().isShadow()?wo(this.targetBlock()):this.shadowDom}setShadowState(e){this.setShadowStateInternal({shadowState:e})}getShadowState(e){return e&&this.targetBlock()&&this.targetBlock().isShadow()?Qt(this.targetBlock()):this.shadowState}neighbours(e){return[]}getParentInput(){let e=null;const t=this.sourceBlock_.inputList;for(let o=0;o<t.length;o++)if(t[o].connection===this){e=t[o];break}return e}toString(){const e=this.sourceBlock_;if(!e)return"Orphan Connection";if(e.outputConnection===this)var t="Output Connection of ";else if(e.previousConnection===this)t="Previous Connection of ";else if(e.nextConnection===this)t="Next Connection of ";else{t=null;for(let o=0,n;n=e.inputList[o];o++)if(n.connection===this){t=n;break}if(t)t='Input "'+t.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}return t+e.toDevString()}stashShadowState(){const e=this.getShadowDom(!0),t=this.getShadowState(!0);return this.shadowState=this.shadowDom=null,{shadowDom:e,shadowState:t}}applyShadowState({shadowDom:e,shadowState:t}){this.shadowDom=e,this.shadowState=t}setShadowStateInternal({shadowDom:e=null,shadowState:t=null}={}){this.shadowDom=e,this.shadowState=t,this.getSourceBlock().isDeadOrDying()||((e=this.targetBlock())?e.isShadow()?(e.dispose(!1),this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock())):(e=this.createShadowBlock(!1),this.serializeShadow(e),e&&e.dispose(!1)):(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock())))}createShadowBlock(e){var t=this.getSourceBlock();const o=this.getShadowState(),n=this.getShadowDom();if(t.isDeadOrDying()||!o&&!n)return null;if(o)return t=Ri(o,t.workspace,{parentConnection:e?this:void 0,isShadow:!0,recordUndo:!1});if(n){if(t=qo(n,t.workspace),e)if(this.type===oe.INPUT_VALUE){if(!t.outputConnection)throw Error("Shadow block is missing an output connection");if(!this.connect(t.outputConnection))throw Error("Could not connect shadow block to connection")}else if(this.type===oe.NEXT_STATEMENT){if(!t.previousConnection)throw Error("Shadow block is missing previous connection");if(!this.connect(t.previousConnection))throw Error("Could not connect shadow block to connection")}else throw Error("Cannot connect a shadow block to a previous/output connection");return t}return null}serializeShadow(e){e&&(this.shadowDom=wo(e),this.shadowState=Qt(e))}static getConnectionForOrphanedConnection(e,t){if(t.type===oe.OUTPUT_VALUE)return B$(e,t.getSourceBlock());e=e.lastConnectionInStack(!0);const o=t.getConnectionChecker();return e&&o.canConnect(t,e,!1)?e:null}};Be.CAN_CONNECT=0,Be.REASON_SELF_CONNECTION=1,Be.REASON_WRONG_TYPE=2,Be.REASON_TARGET_NULL=3,Be.REASON_CHECKS_FAILED=4,Be.REASON_DIFFERENT_WORKSPACES=5,Be.REASON_SHADOW_PARENT=6,Be.REASON_DRAG_CHECKS_FAILED=7,Be.REASON_PREVIOUS_AND_OUTPUT=8;var Oo=class{constructor(e,t,o){if(this.data=null,this.disposed=!1,this.hue=null,this.colour_="#000000",this.styleName_="",this.suppressPrefixSuffix=!1,this.previousConnection=this.nextConnection=this.outputConnection=null,this.inputList=[],this.icons=[],this.disabledReasons=new Set,this.tooltip="",this.contextMenu=!0,this.parentBlock_=null,this.childBlocks_=[],this.editable=this.movable=this.deletable=!0,this.collapsed_=this.shadow=!1,this.outputShape_=null,this.rendered=this.isInsertionMarker_=this.initialized=this.disposing=!1,this.onchangeWrapper=this.helpUrl=null,this.statementInputCount=0,this.workspace=e,this.id=o&&!e.getBlockById(o)?o:C(),e.setBlockById(this.id,this),this.xy=new V(0,0),this.isInFlyout=e.isFlyout,this.isInMutator=e.isMutator,this.RTL=e.RTL,t){if(this.type=t,o=Jt[t],!o||typeof o!="object")throw TypeError("Invalid block definition for type: "+t);Object.assign(this,o)}e.addTopBlock(this),e.addTypedBlock(this),new.target===Oo&&this.doInit_()}doInit_(){const e=i.getGroup$$module$build$src$core$events$utils();e||i.setGroup$$module$build$src$core$events$utils(!0);const t=me();try{typeof this.init=="function"&&(i.setRecordUndo$$module$build$src$core$events$utils(!1),this.init(),i.setRecordUndo$$module$build$src$core$events$utils(t)),K()&&z(new(G(O.BLOCK_CREATE))(this))}finally{i.setGroup$$module$build$src$core$events$utils(e),i.setRecordUndo$$module$build$src$core$events$utils(t)}this.inputsInlineDefault=this.inputsInline,typeof this.onchange=="function"&&this.setOnChange(this.onchange)}dispose(e=!1){this.disposing=!0,this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.unplug(e),K()&&z(new(G(O.BLOCK_DELETE))(this)),this.workspace.removeTopBlock(this),this.disposeInternal()}disposeInternal(){this.disposing=!0,this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.workspace.removeTypedBlock(this),this.workspace.removeBlockById(this.id),typeof this.destroy=="function"&&this.destroy(),this.childBlocks_.forEach(e=>e.disposeInternal()),this.inputList.forEach(e=>e.dispose()),this.inputList.length=0,this.getConnections_(!0).forEach(e=>e.dispose()),this.disposed=!0}isDeadOrDying(){return this.disposing||this.disposed}initModel(){if(!this.initialized){for(const e of this.inputList)e.initModel();this.initialized=!0}}unplug(e){this.outputConnection&&this.unplugFromRow(e),this.previousConnection&&this.unplugFromStack(e)}unplugFromRow(e){let t=null,o;(o=this.outputConnection)!=null&&o.isConnected()&&(t=this.outputConnection.targetConnection,this.outputConnection.disconnect()),t&&e&&(e=this.getOnlyValueConnection())&&e.isConnected()&&!e.targetBlock().isShadow()&&(e=e.targetConnection,e==null||e.disconnect(),this.workspace.connectionChecker.canConnect(e,t,!1)?t.connect(e):e==null||e.onFailedConnect(t))}getOnlyValueConnection(){let e=null;for(let t=0;t<this.inputList.length;t++){const o=this.inputList[t].connection;if(o&&o.type===oe.INPUT_VALUE&&o.targetConnection){if(e)return null;e=o}}return e}unplugFromStack(e){let t=null;var o;if((o=this.previousConnection)!=null&&o.isConnected()&&(t=this.previousConnection.targetConnection,this.previousConnection.disconnect()),o=this.getNextBlock(),e&&o&&!o.isShadow()){let n,c;e=(c=(n=this.nextConnection)==null?void 0:n.targetConnection)!=null?c:null,e==null||e.disconnect(),t&&this.workspace.connectionChecker.canConnect(t,e,!1)&&t.connect(e)}}getConnections_(e){e=[],this.outputConnection&&e.push(this.outputConnection),this.previousConnection&&e.push(this.previousConnection),this.nextConnection&&e.push(this.nextConnection);for(let t=0,o;o=this.inputList[t];t++)o.connection&&e.push(o.connection);return e}lastConnectionInStack(e){let t=this.nextConnection;for(;t;){const o=t.targetBlock();if(!o||e&&o.isShadow())return t;t=o.nextConnection}return null}bumpNeighbours(){}getParent(){return this.parentBlock_}getInputWithBlock(e){for(let t=0,o;o=this.inputList[t];t++)if(o.connection&&o.connection.targetBlock()===e)return o;return null}getSurroundParent(){let e=this,t;do if(t=e,e=e.getParent(),!e)return null;while(e.getNextBlock()===t);return e}getNextBlock(){return this.nextConnection&&this.nextConnection.targetBlock()}getPreviousBlock(){return this.previousConnection&&this.previousConnection.targetBlock()}getRootBlock(){let e,t=this;do e=t,t=e.parentBlock_;while(t);return e}getTopStackBlock(){let e=this,t;do t=e.getPreviousBlock();while(t&&t.getNextBlock()===e&&(e=t));return e}getChildren(e){if(!e)return this.childBlocks_;e=[];for(let o=0,n;n=this.inputList[o];o++)if(n.connection){var t=n.connection.targetBlock();t&&e.push(t)}return(t=this.getNextBlock())&&e.push(t),e}setParent(e){if(e!==this.parentBlock_){var t=this.previousConnection&&this.previousConnection.targetBlock()||this.outputConnection&&this.outputConnection.targetBlock(),o=!!t;if(o&&e&&t!==e)throw Error("Block connected to superior one that is not new parent.");if(!o&&e)throw Error("Block not connected to new parent.");if(o&&!e)throw Error("Cannot set parent to null while block is still connected to superior block.");this.parentBlock_?St(this.parentBlock_.childBlocks_,this):this.workspace.removeTopBlock(this),(this.parentBlock_=e)?e.childBlocks_.push(this):this.workspace.addTopBlock(this)}}getDescendants(e){const t=[this],o=this.getChildren(e);for(let n,c=0;n=o[c];c++)t.push(...n.getDescendants(e));return t}isDeletable(){return this.deletable&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.options.readOnly}isOwnDeletable(){return this.deletable}setDeletable(e){this.deletable=e}isMovable(){return this.movable&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.options.readOnly}isOwnMovable(){return this.movable}setMovable(e){this.movable=e}isDuplicatable(){return this.workspace.hasBlockLimits()?this.workspace.isCapacityAvailable(be(this,!0)):!0}isShadow(){return this.shadow}setShadow(e){this.shadow=e}isInsertionMarker(){return this.isInsertionMarker_}setInsertionMarker(e){this.isInsertionMarker_=e}isEditable(){return this.editable&&!this.isDeadOrDying()&&!this.workspace.options.readOnly}isOwnEditable(){return this.editable}setEditable(e){this.editable=e;for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)c.updateEditable()}isDisposed(){return this.disposed}isSimpleReporter(){if(!this.outputConnection)return!1;for(const e of this.inputList)if(e.connection||1<e.fieldRow.length)return!1;return!0}getMatchingConnection(e,t){const o=this.getConnections_(!0);if(e=e.getConnections_(!0),o.length!==e.length)throw Error("Connection lists did not match in length.");for(let n=0;n<e.length;n++)if(e[n]===t)return o[n];return null}setHelpUrl(e){this.helpUrl=e}setTooltip(e){this.tooltip=e}getTooltip(){return Ni(this)}getColour(){return this.colour_}getStyleName(){return this.styleName_}getHue(){return this.hue}setColour(e){e=Pi(e),this.hue=e.hue,this.colour_=e.hex}setStyle(e){this.styleName_=e}setOnChange(e){if(e&&typeof e!="function")throw Error("onchange must be a function.");this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.onchange=e,this.onchangeWrapper=e.bind(this),this.workspace.addChangeListener(this.onchangeWrapper)}getField(e){if(typeof e!="string")throw TypeError("Block.prototype.getField expects a string with the field name but received "+(e===void 0?"nothing":e+" of type "+typeof e)+" instead");for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)if(c.name===e)return c;return null}getVars(){const e=[];for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)c.referencesVariables()&&e.push(c.getValue());return e}getVarModels(){const e=[];for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)if(c.referencesVariables()){const h=this.workspace.getVariableById(c.getValue());h&&e.push(h)}return e}updateVarName(e){for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)c.referencesVariables()&&e.getId()===c.getValue()&&c.refreshVariableName()}renameVarById(e,t){for(let o=0,n;n=this.inputList[o];o++)for(let c=0,h;h=n.fieldRow[c];c++)h.referencesVariables()&&e===h.getValue()&&h.setValue(t)}getFieldValue(e){return(e=this.getField(e))?e.getValue():null}setFieldValue(e,t){const o=this.getField(t);if(!o)throw Error('Field "'+t+'" not found.');o.setValue(e)}setPreviousStatement(e,t){if(e)t===void 0&&(t=null),this.previousConnection||(this.previousConnection=this.makeConnection_(oe.PREVIOUS_STATEMENT)),this.previousConnection.setCheck(t);else if(this.previousConnection){if(this.previousConnection.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.previousConnection.dispose(),this.previousConnection=null}}setNextStatement(e,t){if(e)t===void 0&&(t=null),this.nextConnection||(this.nextConnection=this.makeConnection_(oe.NEXT_STATEMENT)),this.nextConnection.setCheck(t);else if(this.nextConnection){if(this.nextConnection.isConnected())throw Error("Must disconnect next statement before removing connection.");this.nextConnection.dispose(),this.nextConnection=null}}setOutput(e,t){if(e)t===void 0&&(t=null),this.outputConnection||(this.outputConnection=this.makeConnection_(oe.OUTPUT_VALUE)),this.outputConnection.setCheck(t);else if(this.outputConnection){if(this.outputConnection.isConnected())throw Error("Must disconnect output value before removing connection.");this.outputConnection.dispose(),this.outputConnection=null}}setInputsInline(e){this.inputsInline!==e&&(z(new(G(O.BLOCK_CHANGE))(this,"inline",null,this.inputsInline,e)),this.inputsInline=e)}getInputsInline(){if(this.inputsInline!==void 0)return this.inputsInline;for(var e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof Us&&this.inputList[e]instanceof Us)return!1;for(e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof i.ValueInput$$module$build$src$core$inputs$value_input&&this.inputList[e]instanceof Us)return!0;for(e=0;e<this.inputList.length;e++)if(this.inputList[e]instanceof fo)return!0;return!1}setOutputShape(e){this.outputShape_=e}getOutputShape(){return this.outputShape_}isEnabled(){return this.disabledReasons.size===0}get disabled(){return y("disabled","v11","v12","the isEnabled or hasDisabledReason methods of Block"),this.hasDisabledReason(Ft)}set disabled(e){y("disabled","v11","v12","the setDisabledReason method of Block"),this.setDisabledReason(e,Ft)}setEnabled(e){y("setEnabled","v11","v12","the setDisabledReason method of Block"),this.setDisabledReason(!e,Ft)}setDisabledReason(e,t){e||this.workspace.options.disable||!this.hasDisabledReason(Ft)||t==Ft||this.setDisabledReason(!1,Ft),this.disabledReasons.has(t)!==e&&(e?this.disabledReasons.add(t):this.disabledReasons.delete(t),e=new(G(O.BLOCK_CHANGE))(this,"disabled",null,!e,e),e.setDisabledReason(t),z(e))}getInheritedDisabled(){let e=this.getSurroundParent();for(;e;){if(!e.isEnabled())return!0;e=e.getSurroundParent()}return!1}hasDisabledReason(e){return this.disabledReasons.has(e)}getDisabledReasons(){return this.disabledReasons}isCollapsed(){return this.collapsed_}setCollapsed(e){this.collapsed_!==e&&(z(new(G(O.BLOCK_CHANGE))(this,"collapsed",null,this.collapsed_,e)),this.collapsed_=e)}toString(e,t){t=this.toTokens(t);for(let n=2;n<t.length;n++)t[n-2]==="("&&t[n]===")"&&(t[n-2]=t[n-1],t.splice(n-1,2));let o="";return t=t.reduce((n,c)=>(n=n+(o==="("||c===")"?"":" ")+c,o=c[c.length-1],n),""),t=t.trim()||"???",e&&t.length>e&&(t=t.substring(0,e-3)+"..."),t}toTokens(e="?"){const t=[];for(const n of this.inputList)if(n.name!=ur){for(const c of n.fieldRow)t.push(c.getText());if(n.connection){const c=n.connection.targetBlock();if(c){var o=n.connection;let h=o.getCheck();!h&&o.targetConnection&&(h=o.targetConnection.getCheck()),(o=!!h&&(h.includes("Boolean")||h.includes("Number")))&&t.push("("),t.push(...c.toTokens(e)),o&&t.push(")")}else t.push(e)}}return t}appendValueInput(e){return this.appendInput(new i.ValueInput$$module$build$src$core$inputs$value_input(e,this))}appendStatementInput(e){return this.statementInputCount++,this.appendInput(new is(e,this))}appendDummyInput(e=""){return this.appendInput(new Us(e,this))}appendEndRowInput(e=""){return this.appendInput(new fo(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=m(F.INPUT,e,!1))?this.appendInput(new e(t,this)):null}jsonInit(e){var t=e.type?'Block "'+e.type+'": ':"";if(e.output&&e.previousStatement)throw Error(t+"Must not have both an output and a previousStatement.");for(var o=0;e["args"+o];){if(e["message"+o]===void 0)throw Error(t+`args${o} must have a corresponding message (message${o}).`);o++}if(e.style&&e.style.hat&&(this.hat=e.style.hat,e.style=null),e.style&&e.colour)throw Error(t+"Must not have both a colour and a style.");for(e.style?this.jsonInitStyle(e,t):this.jsonInitColour(e,t),o=0;e["message"+o]!==void 0;)this.interpolate(e["message"+o],e["args"+o]||[],e["implicitAlign"+o]||e["lastDummyAlign"+o],t),o++;if(e.inputsInline!==void 0&&(i.disable$$module$build$src$core$events$utils(),this.setInputsInline(e.inputsInline),i.enable$$module$build$src$core$events$utils()),e.output!==void 0&&this.setOutput(!0,e.output),e.outputShape!==void 0&&this.setOutputShape(e.outputShape),e.previousStatement!==void 0&&this.setPreviousStatement(!0,e.previousStatement),e.nextStatement!==void 0&&this.setNextStatement(!0,e.nextStatement),e.tooltip!==void 0&&(o=pt(e.tooltip),this.setTooltip(o)),e.enableContextMenu!==void 0&&(this.contextMenu=!!e.enableContextMenu),e.suppressPrefixSuffix!==void 0&&(this.suppressPrefixSuffix=!!e.suppressPrefixSuffix),e.helpUrl!==void 0&&(o=pt(e.helpUrl),this.setHelpUrl(o)),typeof e.extensions=="string"&&(console.warn(t+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+e.type+"' block."),e.extensions=[e.extensions]),e.mutator!==void 0&&Ha(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(t=0;t<e.length;t++)Ha(e[t],this,!1)}jsonInitColour(e,t){if("colour"in e)if(e.colour===void 0)console.warn(t+"Undefined colour value.");else{e=e.colour;try{this.setColour(e)}catch{console.warn(t+"Illegal colour value: ",e)}}}jsonInitStyle(e,t){e=e.style;try{this.setStyle(e)}catch{console.warn(t+"Style does not exist: ",e)}}mixin(e,t){if(t!==void 0&&typeof t!="boolean")throw Error("opt_disableCheck must be a boolean if provided");if(!t){t=[];for(const o in e)this[o]!==void 0&&t.push(o);if(t.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(t))}Object.assign(this,e)}interpolate(e,t,o,n){e=od(e),this.validateTokens(e,t.length),t=this.interpolateArguments(e,t,o),o=[];for(let c=0,h;h=t[c];c++)if(this.isInputKeyword(h.type)){if(e=this.inputFromJson(h,n)){for(let $=0,T;T=o[$];$++)e.appendField(T[0],T[1]);o.length=0}}else(e=this.fieldFromJson(h))&&o.push([e,h.name])}validateTokens(e,t){const o=[];let n=0;for(let c=0;c<e.length;c++){const h=e[c];if(typeof h=="number"){if(1>h||h>t)throw Error('Block "'+this.type+'": Message index %'+h+" out of range.");if(o[h])throw Error('Block "'+this.type+'": Message index %'+h+" duplicated.");o[h]=!0,n++}}if(n!==t)throw Error('Block "'+this.type+'": Message does not reference all '+t+" arg(s).")}interpolateArguments(e,t,o){const n=[];for(let h=0;h<e.length;h++){var c=e[h];if(typeof c=="number"&&(c=t[c-1]),typeof c=="string"){if(c===`
864
+ `)c={type:"input_end_row"},o&&(c.align=o);else if(c=this.stringToFieldJson(c),!c)continue}n.push(c)}return(e=n.length)&&!this.isInputKeyword(n[e-1].type)&&(e={type:"input_dummy"},o&&(e.align=o),n.push(e)),n}fieldFromJson(e){const t=i.fromJson$$module$build$src$core$field_registry(e);return!t&&e.alt?typeof e.alt=="string"?(e=this.stringToFieldJson(e.alt))?this.fieldFromJson(e):null:this.fieldFromJson(e.alt):t}inputFromJson(e,t){var o={LEFT:i.Align$$module$build$src$core$inputs$align.LEFT,RIGHT:i.Align$$module$build$src$core$inputs$align.RIGHT,CENTRE:i.Align$$module$build$src$core$inputs$align.CENTRE,CENTER:i.Align$$module$build$src$core$inputs$align.CENTRE};let n;switch(e.type){case"input_value":n=this.appendValueInput(e.name);break;case"input_statement":n=this.appendStatementInput(e.name);break;case"input_dummy":n=this.appendDummyInput(e.name);break;case"input_end_row":n=this.appendEndRowInput(e.name);break;default:n=this.appendInputFromRegistry(e.type,e.name)}return n?(e.check&&n.setCheck(e.check),e.align&&(o=o[e.align.toUpperCase()],o===void 0?console.warn(t+"Illegal align value: ",e.align):n.setAlign(o)),n):null}isInputKeyword(e){return e==="input_value"||e==="input_statement"||e==="input_dummy"||e==="input_end_row"||p(F.INPUT,e)}stringToFieldJson(e){return(e=e.trim())?{type:"field_label",text:e}:null}moveInputBefore(e,t){if(e!==t){var o=-1,n=t?-1:this.inputList.length;for(let c=0,h;h=this.inputList[c];c++)if(h.name===e){if(o=c,n!==-1)break}else if(t&&h.name===t&&(n=c,o!==-1))break;if(o===-1)throw Error('Named input "'+e+'" not found.');if(n===-1)throw Error('Reference input "'+t+'" not found.');this.moveNumberedInputBefore(o,n)}}moveNumberedInputBefore(e,t){if(e===t)throw Error("Can't move input to itself.");if(e>=this.inputList.length)throw RangeError("Input index "+e+" out of bounds.");if(t>this.inputList.length)throw RangeError("Reference input "+t+" out of bounds.");const o=this.inputList[e];this.inputList.splice(e,1),e<t&&t--,this.inputList.splice(t,0,o)}removeInput(e,t){for(let o=0,n;n=this.inputList[o];o++)if(n.name===e)return n instanceof is&&this.statementInputCount--,n.dispose(),this.inputList.splice(o,1),!0;if(t)return!1;throw Error("Input not found: "+e)}getInput(e){for(let t=0,o;o=this.inputList[t];t++)if(o.name===e)return o;return null}getInputTargetBlock(e){return(e=this.getInput(e))&&e.connection&&e.connection.targetBlock()}getCommentText(){let e,t;return(t=(e=this.getIcon(yt.COMMENT))==null?void 0:e.getText())!=null?t:null}setCommentText(e){var t;let o;const n=(o=(t=this.getIcon(yt.COMMENT))==null?void 0:t.getText())!=null?o:null;if(n!==e){if(e!==null){if(t=this.getIcon(yt.COMMENT),!t){if(t=m(F.ICON,yt.COMMENT.toString(),!1),!t)throw Error("No comment icon class is registered, so a comment cannot be set");if(t=new t(this),!j$(t))throw Error("The class registered as a comment icon does not conform to the ICommentIcon interface");t=this.addIcon(t)}i.disable$$module$build$src$core$events$utils(),t.setText(e),i.enable$$module$build$src$core$events$utils()}else this.removeIcon(yt.COMMENT);z(new(G(O.BLOCK_CHANGE))(this,"comment",null,n,e))}}setWarningText(e,t){}setMutator(e){}addIcon(e){if(this.hasIcon(e.getType()))throw new Cv(e);return this.icons.push(e),this.icons.sort((t,o)=>t.getWeight()-o.getWeight()),e}removeIcon(e){if(!this.hasIcon(e))return!1;let t;return(t=this.getIcon(e))==null||t.dispose(),this.icons=this.icons.filter(o=>!o.getType().equals(e)),!0}hasIcon(e){return this.icons.some(t=>t.getType().equals(e))}getIcon(e){return e instanceof yt?this.icons.find(t=>t.getType().equals(e)):this.icons.find(t=>t.getType().toString()===e)}getIcons(){return[...this.icons]}getRelativeToSurfaceXY(){return this.xy}moveBy(e,t,o){if(this.parentBlock_)throw Error("Block has parent");const n=new(G(O.BLOCK_MOVE))(this);o&&n.setReason(o),this.xy.translate(e,t),n.recordNew(),z(n)}makeConnection_(e){return new Be(this,e)}allInputsFilled(e){if(e===void 0&&(e=!0),!e&&this.isShadow())return!1;for(let o=0,n;n=this.inputList[o];o++)if(n.connection){var t=n.connection.targetBlock();if(!t||!t.allInputsFilled(e))return!1}return(t=this.getNextBlock())?t.allInputsFilled(e):!0}toDevString(){let e=this.type?'"'+this.type+'" block':"Block";return this.id&&(e+=' (id="'+this.id+'")'),e}};Oo.COLLAPSED_INPUT_NAME=ur,Oo.COLLAPSED_FIELD_NAME=dl;var hs=class{constructor(e,t,o,n){this.workspace=e,this.targetWorkspace=t,this.isFlyoutLabel=n,this.onMouseUpWrapper=null,this.height=this.width=0,this.cursorSvg=this.svgText=this.svgGroup=null,this.text=o.text,this.position=new V(0,0),this.callbackKey=o.callbackKey||o.callbackkey,this.cssClass=o["web-class"]||null,this.info=o}createDom(){var e=this.isFlyoutLabel?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.cssClass&&(e+=" "+this.cssClass),this.svgGroup=N(x.G,{class:e},this.workspace.getCanvas());let t;this.isFlyoutLabel||(t=N(x.RECT,{class:"blocklyFlyoutButtonShadow",rx:hs.BORDER_RADIUS,ry:hs.BORDER_RADIUS,x:1,y:1},this.svgGroup)),e=N(x.RECT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:hs.BORDER_RADIUS,ry:hs.BORDER_RADIUS},this.svgGroup);const o=N(x.TEXT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup);var n=pt(this.text);this.workspace.RTL&&(n+="‏"),o.textContent=n,this.isFlyoutLabel&&(this.svgText=o,this.workspace.getThemeManager().subscribe(this.svgText,"flyoutForegroundColour","fill"));const c=Ms(o,"fontSize"),h=Ms(o,"fontWeight"),$=Ms(o,"fontFamily");if(this.width=ua(o,c,h,$),n=da(n,c,h,$),this.height=n.height,!this.isFlyoutLabel){this.width+=2*hs.TEXT_MARGIN_X,this.height+=2*hs.TEXT_MARGIN_Y;let T;(T=t)==null||T.setAttribute("width",String(this.width));let L;(L=t)==null||L.setAttribute("height",String(this.height))}return e.setAttribute("width",String(this.width)),e.setAttribute("height",String(this.height)),o.setAttribute("x",String(this.width/2)),o.setAttribute("y",String(this.height/2-n.height/2+n.baseline)),this.updateTransform(),this.onMouseUpWrapper=X(this.svgGroup,"pointerup",this,this.onMouseUp),this.svgGroup}show(){this.updateTransform(),this.svgGroup.setAttribute("display","block")}updateTransform(){this.svgGroup.setAttribute("transform","translate("+this.position.x+","+this.position.y+")")}moveTo(e,t){this.position.x=e,this.position.y=t,this.updateTransform()}isLabel(){return this.isFlyoutLabel}getPosition(){return this.position}getButtonText(){return this.text}getTargetWorkspace(){return this.targetWorkspace}getWorkspace(){return this.workspace}dispose(){this.onMouseUpWrapper&&ze(this.onMouseUpWrapper),this.svgGroup&&Ke(this.svgGroup),this.svgText&&this.workspace.getThemeManager().unsubscribe(this.svgText)}setCursorSvg(e){e?this.svgGroup&&(this.svgGroup.appendChild(e),this.cursorSvg=e):this.cursorSvg=null}setMarkerSvg(){throw Error("Attempted to set a marker on a button.")}onMouseUp(e){(e=this.targetWorkspace.getGesture(e))&&e.cancel(),this.isFlyoutLabel&&this.callbackKey?console.warn("Labels should not have callbacks. Label text: "+this.text):this.isFlyoutLabel||this.callbackKey&&this.targetWorkspace.getButtonCallback(this.callbackKey)?this.isFlyoutLabel||(e=this.targetWorkspace.getButtonCallback(this.callbackKey))&&e(this):console.warn("Buttons should have callbacks. Button text: "+this.text)}};hs.TEXT_MARGIN_X=5,hs.TEXT_MARGIN_Y=2,hs.BORDER_RADIUS=4,Et(`
865
+ .blocklyFlyoutButton {
866
+ fill: #888;
867
+ cursor: default;
868
+ }
869
+
870
+ .blocklyFlyoutButtonShadow {
871
+ fill: #666;
872
+ }
873
+
874
+ .blocklyFlyoutButton:hover {
875
+ fill: #aaa;
876
+ }
877
+
878
+ .blocklyFlyoutLabel {
879
+ cursor: default;
880
+ }
881
+
882
+ .blocklyFlyoutLabelBackground {
883
+ opacity: 0;
884
+ }
885
+ `);var P=class{constructor(e,t,o){if(this.wsCoordinate=null,!t)throw Error("Cannot create a node without a location.");this.type=e,this.isConnectionLocation=P.isConnectionType(e),this.location=t,this.processParams(o||null)}processParams(e){e&&e.wsCoordinate&&(this.wsCoordinate=e.wsCoordinate)}getLocation(){return this.location}getType(){return this.type}getWsCoordinate(){return this.wsCoordinate}isConnection(){return this.isConnectionLocation}findNextForInput(){var e=this.location.getParentInput();const t=e.getSourceBlock();for(e=t.inputList.indexOf(e),e+=1;e<t.inputList.length;e++){const o=t.inputList[e],n=o.fieldRow;for(let c=0;c<n.length;c++){const h=n[c];if(h.isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(h)}if(o.connection)return P.createInputNode(o)}return null}findNextForField(){var e=this.location,t=e.getParentInput();const o=e.getSourceBlock();if(!o)throw Error("The current AST location is not associated with a block");var n=o.inputList.indexOf(t);for(e=t.fieldRow.indexOf(e)+1;n<o.inputList.length;n++){t=o.inputList[n];const c=t.fieldRow;for(;e<c.length;){if(c[e].isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(c[e]);e++}if(e=0,t.connection)return P.createInputNode(t)}return null}findPrevForInput(){const e=this.location.getParentInput(),t=e.getSourceBlock();for(var o=t.inputList.indexOf(e);0<=o;o--){var n=t.inputList[o];if(n.connection&&n!==e)return P.createInputNode(n);n=n.fieldRow;for(let c=n.length-1;0<=c;c--){const h=n[c];if(h.isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(h)}}return null}findPrevForField(){var e=this.location;const t=e.getParentInput(),o=e.getSourceBlock();if(!o)throw Error("The current AST location is not associated with a block");var n=o.inputList.indexOf(t);for(e=t.fieldRow.indexOf(e)-1;0<=n;n--){var c=o.inputList[n];if(c.connection&&c!==t)return P.createInputNode(c);for(c=c.fieldRow;-1<e;){if(c[e].isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(c[e]);e--}0<=n-1&&(e=o.inputList[n-1].fieldRow.length-1)}return null}navigateBetweenStacks(e){var t=this.getLocation();if(t.getSourceBlock){var o=t.getSourceBlock();o&&(t=o)}if(!t||t.isDeadOrDying())return null;if(t.workspace.isFlyout)return this.navigateFlyoutContents(e);o=t.getRootBlock(),t=o.workspace.getTopBlocks(!0);for(let n=0;n<t.length;n++)if(o.id===t[n].id)return e=n+(e?1:-1),e===-1||e===t.length?null:P.createStackNode(t[e]);throw Error("Couldn't find "+(e?"next":"previous")+" stack?!")}navigateFlyoutContents(e){let t;switch(this.getType()){case P.types.STACK:t=this.getLocation();var o=t.workspace.targetWorkspace;break;case P.types.BUTTON:t=this.getLocation(),o=t.getTargetWorkspace();break;default:return null}return o=o.getFlyout(),o&&(e=this.findNextLocationInFlyout(o.getContents(),t,e))?e.type==="button"&&e.button?P.createButtonNode(e.button):e.type==="block"&&e.block?P.createStackNode(e.block):null:null}findNextLocationInFlyout(e,t,o){const n=e.findIndex(c=>t instanceof Oo&&c.block===t||t instanceof hs&&c.button===t);return 0>n?null:(o=o?n+1:n-1,o===-1||o===e.length?null:e[o])}findTopASTNodeForBlock(e){const t=Qn(e);return t?P.createConnectionNode(t):P.createBlockNode(e)}getOutAstNodeForBlock(e){if(!e)return null;e=e.getTopStackBlock();const t=Qn(e);return t&&t.targetConnection&&t.targetConnection.getParentInput()?P.createInputNode(t.targetConnection.getParentInput()):P.createStackNode(e)}findFirstFieldOrInput(e){e=e.inputList;for(let t=0;t<e.length;t++){const o=e[t],n=o.fieldRow;for(let c=0;c<n.length;c++){const h=n[c];if(h.isClickable()||P.NAVIGATE_ALL_FIELDS)return P.createFieldNode(h)}if(o.connection)return P.createInputNode(o)}return null}getSourceBlock(){return this.getType()===P.types.BLOCK?this.getLocation():this.getType()===P.types.STACK?this.getLocation():this.getType()===P.types.WORKSPACE||this.getType()===P.types.BUTTON?null:this.getLocation().getSourceBlock()}next(){switch(this.type){case P.types.STACK:return this.navigateBetweenStacks(!0);case P.types.OUTPUT:return P.createBlockNode(this.location.getSourceBlock());case P.types.FIELD:return this.findNextForField();case P.types.INPUT:return this.findNextForInput();case P.types.BLOCK:const e=this.location.nextConnection;if(!e)break;return P.createConnectionNode(e);case P.types.PREVIOUS:return P.createBlockNode(this.location.getSourceBlock());case P.types.NEXT:return P.createConnectionNode(this.location.targetConnection);case P.types.BUTTON:return this.navigateFlyoutContents(!0)}return null}in(){switch(this.type){case P.types.WORKSPACE:const e=this.location.getTopBlocks(!0);if(0<e.length)return P.createStackNode(e[0]);break;case P.types.STACK:return this.findTopASTNodeForBlock(this.location);case P.types.BLOCK:return this.findFirstFieldOrInput(this.location);case P.types.INPUT:return P.createConnectionNode(this.location.targetConnection)}return null}prev(){switch(this.type){case P.types.STACK:return this.navigateBetweenStacks(!1);case P.types.FIELD:return this.findPrevForField();case P.types.INPUT:return this.findPrevForInput();case P.types.BLOCK:var e=Qn(this.location);if(!e)break;return P.createConnectionNode(e);case P.types.PREVIOUS:if((e=this.location.targetConnection)&&!e.getParentInput())return P.createConnectionNode(e);break;case P.types.NEXT:return P.createBlockNode(this.location.getSourceBlock());case P.types.BUTTON:return this.navigateFlyoutContents(!1)}return null}out(){switch(this.type){case P.types.STACK:var e=this.location,t=e.getRelativeToSurfaceXY();return t=new V(t.x,t.y+P.DEFAULT_OFFSET_Y),P.createWorkspaceNode(e.workspace,t);case P.types.OUTPUT:return e=this.location,(t=e.targetConnection)?P.createConnectionNode(t):P.createStackNode(e.getSourceBlock());case P.types.FIELD:if(e=this.location.getSourceBlock(),!e)throw Error("The current AST location is not associated with a block");return P.createBlockNode(e);case P.types.INPUT:return P.createBlockNode(this.location.getSourceBlock());case P.types.BLOCK:return this.getOutAstNodeForBlock(this.location);case P.types.PREVIOUS:return this.getOutAstNodeForBlock(this.location.getSourceBlock());case P.types.NEXT:return this.getOutAstNodeForBlock(this.location.getSourceBlock())}return null}static isConnectionType(e){switch(e){case P.types.PREVIOUS:case P.types.NEXT:case P.types.INPUT:case P.types.OUTPUT:return!0}return!1}static createFieldNode(e){return e?new P(P.types.FIELD,e):null}static createConnectionNode(e){if(!e)return null;const t=e.type;return t===oe.INPUT_VALUE||t===oe.NEXT_STATEMENT&&e.getParentInput()?P.createInputNode(e.getParentInput()):t===oe.NEXT_STATEMENT?new P(P.types.NEXT,e):t===oe.OUTPUT_VALUE?new P(P.types.OUTPUT,e):t===oe.PREVIOUS_STATEMENT?new P(P.types.PREVIOUS,e):null}static createInputNode(e){return e&&e.connection?new P(P.types.INPUT,e.connection):null}static createBlockNode(e){return e?new P(P.types.BLOCK,e):null}static createStackNode(e){return e?new P(P.types.STACK,e):null}static createButtonNode(e){return e?new P(P.types.BUTTON,e):null}static createWorkspaceNode(e,t){return t&&e?new P(P.types.WORKSPACE,e,{wsCoordinate:t}):null}static createTopNode(e){const t=Qn(e);return t?P.createConnectionNode(t):P.createBlockNode(e)}};P.NAVIGATE_ALL_FIELDS=!1,P.DEFAULT_OFFSET_Y=-20,(function(e){e=e.types||(e.types={}),e.FIELD="field",e.BLOCK="block",e.INPUT="input",e.OUTPUT="output",e.NEXT="next",e.PREVIOUS="previous",e.STACK="stack",e.WORKSPACE="workspace",e.BUTTON="button"})(P||(P={}));var dp=class extends Cs{constructor(e,t,o,n){let c=e?e.workspace.id:void 0;n&&n.getType()===P.types.WORKSPACE&&(c=n.getLocation().id),super(c),this.type=O.MARKER_MOVE,this.blockId=e==null?void 0:e.id,this.oldNode=o||void 0,this.newNode=n,this.isCursor=t}toJson(){const e=super.toJson();if(this.isCursor===void 0)throw Error("Whether this is a cursor event or not is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newNode)throw Error("The new node is undefined. Either pass a node to the constructor, or call fromJson");return e.isCursor=this.isCursor,e.blockId=this.blockId,e.oldNode=this.oldNode,e.newNode=this.newNode,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new dp),t.isCursor=e.isCursor,t.blockId=e.blockId,t.oldNode=e.oldNode,t.newNode=e.newNode,t}};r(F.EVENT,O.MARKER_MOVE,dp);var ZT="blocklyCursor",QT="blocklyMarker",ek=.75,hp=class{constructor(e,t,o){this.workspace=e,this.marker=o,this.markerSvgRect_=this.markerSvgLine_=this.markerInput_=this.markerBlock_=this.svgGroup_=this.markerSvg_=this.currentMarkerSvg=this.parent=null,this.constants_=t,e=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR,this.colour_=o.colour||e}getSvgRoot(){return this.svgGroup_}getMarker(){return this.marker}isCursor(){return this.marker.type==="cursor"}createDom(){const e=this.isCursor()?ZT:QT;return this.svgGroup_=N(x.G,{class:e}),this.createDomInternal_(),this.svgGroup_}setParent_(e){this.isCursor()?(this.parent&&this.parent.setCursorSvg(null),e.setCursorSvg(this.getSvgRoot())):(this.parent&&this.parent.setMarkerSvg(null),e.setMarkerSvg(this.getSvgRoot())),this.parent=e}draw(e,t){if(t){this.constants_=this.workspace.getRenderer().getConstants();var o=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=this.marker.colour||o,this.applyColour_(t),this.showAtLocation_(t),this.fireMarkerEvent(e,t),e=this.currentMarkerSvg.childNodes[0],e!==void 0&&e.beginElement&&e.beginElement()}else this.hide()}showAtLocation_(e){const t=e.getLocation().type;e.getType()===P.types.BLOCK?this.showWithBlock_(e):e.getType()===P.types.OUTPUT?this.showWithOutput_(e):t===oe.INPUT_VALUE?this.showWithInput_(e):t===oe.NEXT_STATEMENT?this.showWithNext_(e):e.getType()===P.types.PREVIOUS?this.showWithPrevious_(e):e.getType()===P.types.FIELD?this.showWithField_(e):e.getType()===P.types.WORKSPACE?this.showWithCoordinates_(e):e.getType()===P.types.STACK?this.showWithStack_(e):e.getType()===P.types.BUTTON&&this.showWithButton_(e)}showWithBlockPrevOutput(e){e=e.getSourceBlock();const t=e.width;var o=e.height,n=o*ek;const c=this.constants_.CURSOR_BLOCK_PADDING;e.previousConnection?(o=this.constants_.shapeFor(e.previousConnection),this.positionPrevious_(t,c,n,o)):e.outputConnection?(n=this.constants_.shapeFor(e.outputConnection),this.positionOutput_(t,o,n)):this.positionBlock_(t,c,n),this.setParent_(e),this.showCurrent_()}showWithBlock_(e){this.showWithBlockPrevOutput(e)}showWithPrevious_(e){this.showWithBlockPrevOutput(e)}showWithOutput_(e){this.showWithBlockPrevOutput(e)}showWithCoordinates_(e){var t=e.getWsCoordinate();e=t.x,t=t.y,this.workspace.RTL&&(e-=this.constants_.CURSOR_WS_WIDTH),this.positionLine_(e,t,this.constants_.CURSOR_WS_WIDTH),this.setParent_(this.workspace),this.showCurrent_()}showWithField_(e){e=e.getLocation();const t=e.getSize().width,o=e.getSize().height;this.positionRect_(0,0,t,o),this.setParent_(e),this.showCurrent_()}showWithInput_(e){e=e.getLocation();const t=e.getSourceBlock();this.positionInput_(e),this.setParent_(t),this.showCurrent_()}showWithNext_(e){var t=e.getLocation();e=t.getSourceBlock();let o=0;t=t.getOffsetInBlock().y;const n=e.getHeightWidth().width;this.workspace.RTL&&(o=-n),this.positionLine_(o,t,n),this.setParent_(e),this.showCurrent_()}showWithStack_(e){e=e.getLocation();var t=e.getHeightWidth();const o=t.width+this.constants_.CURSOR_STACK_PADDING;t=t.height+this.constants_.CURSOR_STACK_PADDING;const n=-this.constants_.CURSOR_STACK_PADDING/2,c=-this.constants_.CURSOR_STACK_PADDING/2;let h=n;this.workspace.RTL&&(h=-(o+n)),this.positionRect_(h,c,o,t),this.setParent_(e),this.showCurrent_()}showWithButton_(e){e=e.getLocation();const t=e.width+this.constants_.CURSOR_STACK_PADDING,o=e.height+this.constants_.CURSOR_STACK_PADDING,n=-this.constants_.CURSOR_STACK_PADDING/2,c=-this.constants_.CURSOR_STACK_PADDING/2;let h=n;this.workspace.RTL&&(h=-(t+n)),this.positionRect_(h,c,t,o),this.setParent_(e),this.showCurrent_()}showCurrent_(){this.hide(),this.currentMarkerSvg&&(this.currentMarkerSvg.style.display="")}positionBlock_(e,t,o){if(e=at(-t,o)+ne("V",-t)+ne("H",e+2*t)+ne("V",o),!this.markerBlock_)throw Error("createDom should be called before positioning the marker");this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionInput_(e){const t=e.getOffsetInBlock().x,o=e.getOffsetInBlock().y;e=wt(0,0)+this.constants_.shapeFor(e).pathDown,this.markerInput_.setAttribute("d",e),this.markerInput_.setAttribute("transform","translate("+t+","+o+")"+(this.workspace.RTL?" scale(-1 1)":"")),this.currentMarkerSvg=this.markerInput_}positionLine_(e,t,o){if(!this.markerSvgLine_)throw Error("createDom should be called before positioning the line");this.markerSvgLine_.setAttribute("x",`${e}`),this.markerSvgLine_.setAttribute("y",`${t}`),this.markerSvgLine_.setAttribute("width",`${o}`),this.currentMarkerSvg=this.markerSvgLine_}positionOutput_(e,t,o){if(!this.markerBlock_)throw Error("createDom should be called before positioning the output");e=at(e,0)+ne("h",-(e-o.width))+ne("v",this.constants_.TAB_OFFSET_FROM_TOP)+o.pathDown+ne("V",t)+ne("H",e),this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionPrevious_(e,t,o,n){if(!this.markerBlock_)throw Error("createDom should be called before positioning the previous connection marker");e=at(-t,o)+ne("V",-t)+ne("H",this.constants_.NOTCH_OFFSET_LEFT)+n.pathLeft+ne("H",e+2*t)+ne("V",o),this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionRect_(e,t,o,n){if(!this.markerSvgRect_)throw Error("createDom should be called before positioning the rect");this.markerSvgRect_.setAttribute("x",`${e}`),this.markerSvgRect_.setAttribute("y",`${t}`),this.markerSvgRect_.setAttribute("width",`${o}`),this.markerSvgRect_.setAttribute("height",`${n}`),this.currentMarkerSvg=this.markerSvgRect_}flipRtl(e){e.setAttribute("transform","scale(-1 1)")}hide(){if(!(this.markerSvgLine_&&this.markerSvgRect_&&this.markerInput_&&this.markerBlock_))throw Error("createDom should be called before hiding the marker");this.markerSvgLine_.style.display="none",this.markerSvgRect_.style.display="none",this.markerInput_.style.display="none",this.markerBlock_.style.display="none"}fireMarkerEvent(e,t){const o=t.getSourceBlock();e=new(G(O.MARKER_MOVE))(o,this.isCursor(),e,t),z(e)}getBlinkProperties_(){return{attributeType:"XML",attributeName:"fill",dur:"1s",values:this.colour_+";transparent;transparent;",repeatCount:"indefinite"}}createDomInternal_(){if(this.markerSvg_=N(x.G,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_),this.markerSvgLine_=N(x.RECT,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.markerSvg_),this.markerSvgRect_=N(x.RECT,{class:"blocklyVerticalMarker",rx:10,ry:10},this.markerSvg_),this.markerInput_=N(x.PATH,{transform:""},this.markerSvg_),this.markerBlock_=N(x.PATH,{transform:"",fill:"none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.hide(),this.isCursor()){const e=this.getBlinkProperties_();N(x.ANIMATE,e,this.markerSvgLine_),N(x.ANIMATE,e,this.markerInput_),N(x.ANIMATE,Object.assign({},e,{attributeName:"stroke"}),this.markerBlock_)}return this.markerSvg_}applyColour_(e){if(!(this.markerSvgLine_&&this.markerSvgRect_&&this.markerInput_&&this.markerBlock_))throw Error("createDom should be called before applying color to the markerj");this.markerSvgLine_.setAttribute("fill",this.colour_),this.markerSvgRect_.setAttribute("stroke",this.colour_),this.markerInput_.setAttribute("fill",this.colour_),this.markerBlock_.setAttribute("stroke",this.colour_),this.isCursor()&&(e=this.colour_+";transparent;transparent;",this.markerSvgLine_.firstElementChild.setAttribute("values",e),this.markerInput_.firstElementChild.setAttribute("values",e),this.markerBlock_.firstElementChild.setAttribute("values",e))}dispose(){this.svgGroup_&&Ke(this.svgGroup_)}},Ll=class{constructor(e,t,o){this.markerSvg=this.cursorSvg=null,this.connectionHighlights=new WeakMap,this.highlightOffsets=new WeakMap,this.constants=o,this.style=t,this.svgRoot=e,this.svgPath=N(x.PATH,{class:"blocklyPath"},this.svgRoot)}setPath(e){this.svgPath.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)")}setCursorSvg(e){e?(this.svgRoot.appendChild(e),this.cursorSvg=e):this.cursorSvg=null}setMarkerSvg(e){e?(this.cursorSvg?this.svgRoot.insertBefore(e,this.cursorSvg):this.svgRoot.appendChild(e),this.markerSvg=e):this.markerSvg=null}applyColour(e){this.svgPath.setAttribute("stroke",this.style.colourTertiary),this.svgPath.setAttribute("fill",this.style.colourPrimary),this.updateShadow_(e.isShadow()),this.updateDisabled_(!e.isEnabled()||e.getInheritedDisabled())}setStyle(e){this.style=e}setClass_(e,t){e&&(t?ge(this.svgRoot,e):ot(this.svgRoot,e))}updateHighlighted(e){e?this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"):this.svgPath.setAttribute("filter","none")}updateShadow_(e){e&&(this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))}updateDisabled_(e){this.setClass_("blocklyDisabled",e),e&&this.svgPath.setAttribute("fill","url(#"+this.constants.disabledPatternId+")")}updateSelected(e){this.setClass_("blocklySelected",e)}updateDraggingDelete(e){this.setClass_("blocklyDraggingDelete",e)}updateInsertionMarker(e){this.setClass_("blocklyInsertionMarker",e)}updateMovable(e){this.setClass_("blocklyDraggable",e)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e)}updateShapeForInputHighlight(e,t){}addConnectionHighlight(e,t,o,n){if(this.connectionHighlights.has(e)){if(this.currentHighlightMatchesNew(e,t,o))return;this.removeConnectionHighlight(e)}t=N(x.PATH,{class:"blocklyHighlightedConnectionPath",d:t,transform:`translate(${o.x}, ${o.y})`+(n?" scale(-1 1)":"")},this.svgRoot),this.connectionHighlights.set(e,t)}currentHighlightMatchesNew(e,t,o){let n;const c=(n=this.connectionHighlights.get(e))==null?void 0:n.getAttribute("d");return e=this.highlightOffsets.get(e),c===t&&V.equals(e,o)}removeConnectionHighlight(e){const t=this.connectionHighlights.get(e);t&&(Ke(t),this.connectionHighlights.delete(e))}},ps=class{constructor(e){this.activeCandidate=this.lastMarker=this.lastOnStack=null,this.wouldDeleteBlock=!1,this.fadedBlock=this.highlightedBlock=this.markerConnection=null,i.setSelected$$module$build$src$core$common(e),this.topBlock=e,this.workspace=e.workspace,this.firstMarker=this.createMarkerBlock(this.topBlock),this.availableConnections=this.initAvailableConnections(),this.lastOnStack&&(this.lastMarker=this.createMarkerBlock(this.lastOnStack.getSourceBlock()))}dispose(){this.availableConnections.length=0,this.disposeInsertionMarker(this.firstMarker),this.disposeInsertionMarker(this.lastMarker)}updateAvailableConnections(){this.availableConnections=this.initAvailableConnections()}wouldConnectBlock(){return!!this.activeCandidate}applyConnections(){if(this.activeCandidate){i.disable$$module$build$src$core$events$utils(),this.hidePreview(),i.enable$$module$build$src$core$events$utils();var{local:e,closest:t}=this.activeCandidate;e.connect(t);var o=e.isSuperior()?t:e,n=this.topBlock.getRootBlock();ws().then(()=>{Ua(o.getSourceBlock()),setTimeout(()=>{n.bringToFront()},0)})}}update(e,t){const o=this.getCandidate(e);((this.wouldDeleteBlock=this.shouldDelete(!!o,t))||this.shouldUpdatePreviews(o,e))&&(i.disable$$module$build$src$core$events$utils(),this.maybeHidePreview(o),this.maybeShowPreview(o),i.enable$$module$build$src$core$events$utils())}createMarkerBlock(e){i.disable$$module$build$src$core$events$utils();let t;try{const o=Qt(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!o)throw Error(`Failed to serialize source block. ${e.toDevString()}`);t=eo(o,this.workspace);for(const n of t.getDescendants(!1))n.setInsertionMarker(!0);t.initSvg(),t.getSvgRoot().setAttribute("visibility","hidden")}finally{i.enable$$module$build$src$core$events$utils()}return t}initAvailableConnections(){const e=this.topBlock.getConnections_(!1),t=this.topBlock.lastConnectionInStack(!0);return t&&t!==this.topBlock.nextConnection&&(e.push(t),this.lastOnStack=t),e}shouldUpdatePreviews(e,t){if(!e)return!!this.activeCandidate;if(!this.activeCandidate)return!0;const{local:o,closest:n}=this.activeCandidate;if(n===e.closest&&o===e.local)return!1;const c=o.x+t.x-n.x;return t=o.y+t.y-n.y,e.radius<Math.sqrt(c*c+t*t)-i.config$$module$build$src$core$config.currentConnectionPreference}getCandidate(e){this.markerConnection&&this.markerConnection.isConnected()||this.updateAvailableConnections();let t=this.getStartRadius(),o=null;for(let n=0;n<this.availableConnections.length;n++){const c=this.availableConnections[n],h=c.closest(t,e);h.connection&&(o={closest:h.connection,local:c,radius:h.radius},t=h.radius)}return o}getStartRadius(){return this.activeCandidate?i.config$$module$build$src$core$config.connectingSnapRadius:i.config$$module$build$src$core$config.snapRadius}shouldDelete(e,t){return t&&this.workspace.getComponentManager().hasCapability(t.id,lt.Capability.DELETE_AREA)?t.wouldDelete(this.topBlock):!1}maybeShowPreview(e){if(!this.wouldDeleteBlock&&e){var t=e.closest,o;t===((o=this.activeCandidate)==null?void 0:o.closest)||t.getSourceBlock().isInsertionMarker()?console.log("Trying to connect to an insertion marker"):(this.activeCandidate=e,this.showPreview(this.activeCandidate))}}showPreview(e){const t=this.workspace.getRenderer();switch(t.getConnectionPreviewMethod(e.closest,e.local,this.topBlock)){case ps.PREVIEW_TYPE.INPUT_OUTLINE:this.showInsertionInputOutline(e);break;case ps.PREVIEW_TYPE.INSERTION_MARKER:this.showInsertionMarker(e);break;case ps.PREVIEW_TYPE.REPLACEMENT_FADE:this.showReplacementFade(e)}t.shouldHighlightConnection(e.closest)&&e.closest.highlight()}maybeHidePreview(e){if(!e)this.hidePreview();else if(this.activeCandidate){const t=this.activeCandidate.local!==e.local;(this.activeCandidate.closest!==e.closest||t||this.wouldDeleteBlock)&&this.hidePreview()}this.activeCandidate=this.markerConnection=null}hidePreview(){let e;const t=(e=this.activeCandidate)==null?void 0:e.closest;t&&t.targetBlock()&&this.workspace.getRenderer().shouldHighlightConnection(t)&&t.unhighlight(),this.hideReplacementFade(),this.hideInsertionInputOutline(),this.hideInsertionMarker()}showInsertionMarker(e){const{local:t,closest:o}=e;let n=(e=this.lastOnStack&&t===this.lastOnStack)?this.lastMarker:this.firstMarker;if(!n)throw Error("Cannot show the insertion marker because there is no insertion marker block");let c;try{c=n.getMatchingConnection(t.getSourceBlock(),t)}catch{if(e&&this.lastOnStack?(this.disposeInsertionMarker(this.lastMarker),n=this.lastMarker=this.createMarkerBlock(this.lastOnStack.getSourceBlock())):(this.disposeInsertionMarker(this.firstMarker),n=this.firstMarker=this.createMarkerBlock(this.topBlock)),!n)throw Error("Cannot show the insertion marker because there is no insertion marker block");c=n.getMatchingConnection(t.getSourceBlock(),t)}if(!c)throw Error("Cannot show the insertion marker because there is no associated connection");if(c===this.markerConnection)throw Error("Made it to showInsertionMarker_ even though the marker isn't changing");n.queueRender(),Qs(),c.connect(o);const h={x:o.x-c.x,y:o.y-c.y},$=c.getOffsetInBlock().clone(),T=c;ws().then(()=>{let L;(L=n)==null||L.positionNearConnection(T,h,$);let te;(te=n)==null||te.getSvgRoot().setAttribute("visibility","visible")}),this.markerConnection=c}hideInsertionMarker(){if(this.markerConnection){var e=this.markerConnection,t=e.getSourceBlock(),o=t.outputConnection,n;if((n=t.previousConnection)!=null&&n.targetConnection||o!=null&&o.targetConnection)t.unplug(!0);else{let c;(c=e.targetBlock())==null||c.unplug(!1)}if(e.targetConnection)throw Error("markerConnection still connected at the end of disconnectInsertionMarker");this.markerConnection=null,(e=t.getSvgRoot())&&e.setAttribute("visibility","hidden")}}showInsertionInputOutline(e){e=e.closest,this.highlightedBlock=e.getSourceBlock(),this.highlightedBlock.highlightShapeForInput(e,!0)}hideInsertionInputOutline(){if(this.highlightedBlock){if(!this.activeCandidate)throw Error("Cannot hide the insertion marker outline because there is no active candidate");this.highlightedBlock.highlightShapeForInput(this.activeCandidate.closest,!1),this.highlightedBlock=null}}showReplacementFade(e){if(this.fadedBlock=e.closest.targetBlock(),!this.fadedBlock)throw Error("Cannot show the replacement fade because the closest connection does not have a target block");this.fadedBlock.fadeForReplacement(!0)}hideReplacementFade(){this.fadedBlock&&(this.fadedBlock.fadeForReplacement(!1),this.fadedBlock=null)}getInsertionMarkers(){const e=[];return this.firstMarker&&e.push(this.firstMarker),this.lastMarker&&e.push(this.lastMarker),e}disposeInsertionMarker(e){if(e){i.disable$$module$build$src$core$events$utils();try{e.dispose()}finally{i.enable$$module$build$src$core$events$utils()}}}};(function(e){e=e.PREVIEW_TYPE||(e.PREVIEW_TYPE={}),e[e.INSERTION_MARKER=0]="INSERTION_MARKER",e[e.INPUT_OUTLINE=1]="INPUT_OUTLINE",e[e.REPLACEMENT_FADE=2]="REPLACEMENT_FADE"})(ps||(ps={})),ps.PREVIEW_TYPE;var Pl=class{constructor(e){this.overrides=null,this.name=e}getClassName(){return this.name+"-renderer"}init(e,t){this.constants_=this.makeConstants_(),t&&(this.overrides=t,Object.assign(this.constants_,t)),this.constants_.setTheme(e),this.constants_.init()}createDom(e,t){this.constants_.createDom(e,this.name+"-"+t.name,"."+this.getClassName()+"."+t.getClassName())}refreshDom(e,t){const o=this.getConstants();o.dispose(),this.constants_=this.makeConstants_(),this.overrides&&Object.assign(this.constants_,this.overrides),this.constants_.randomIdentifier=o.randomIdentifier,this.constants_.setTheme(t),this.constants_.init(),this.createDom(e,t)}dispose(){this.constants_&&this.constants_.dispose()}makeConstants_(){return new Ml}makeRenderInfo_(e){return new kr(this,e)}makeDrawer_(e,t){return new Nl(e,t)}makeMarkerDrawer(e,t){return new hp(e,this.getConstants(),t)}makePathObject(e,t){return new Ll(e,t,this.constants_)}getConstants(){return this.constants_}shouldHighlightConnection(e){return!0}orphanCanConnectAtEnd(e,t,o){return!!Be.getConnectionForOrphanedConnection(e,o===oe.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}getConnectionPreviewMethod(e,t,o){return y("getConnectionPreviewMethod","v10","v12","an IConnectionPreviewer, if it fulfills your use case."),t.type===oe.OUTPUT_VALUE||t.type===oe.PREVIOUS_STATEMENT?!e.isConnected()||this.orphanCanConnectAtEnd(o,e.targetBlock(),t.type)?ps.PREVIEW_TYPE.INSERTION_MARKER:ps.PREVIEW_TYPE.REPLACEMENT_FADE:ps.PREVIEW_TYPE.INSERTION_MARKER}render(e){const t=this.makeRenderInfo_(e);t.measure(),this.makeDrawer_(e,t).draw()}},We={};We.BottomRow=ip,We.Connection=mo,We.ConstantProvider=Ml,We.Drawer=Nl,We.ExternalValueInput=Ol,We.Field=on,We.Hat=np,We.Icon=Ev,We.InRowSpacer=os,We.InlineInput=rp,We.InputConnection=Ro,We.InputRow=ap,We.JaggedEdge=Iv,We.MarkerSvg=hp,We.Measurable=zs,We.NextConnection=xv,We.OutputConnection=Dv,We.PathObject=Ll,We.PreviousConnection=Av,We.RenderInfo=kr,We.Renderer=Pl,We.RoundCorner=Cr,We.Row=_r,We.SpacerRow=lp,We.SquareCorner=Tr,We.StatementInput=wr,We.TopRow=cp,We.Types=S,We.init=Ad,We.register=er,We.unregister=F$;var Ov=class{constructor(e,t){this.workspace=e,this.theme=t,this.subscribedWorkspaces=[],this.componentDB=new Map}getTheme(){return this.theme}setTheme(e){var t=this.theme;this.theme=e,(e=this.workspace.getInjectionDiv())&&(t&&(t=t.getClassName())&&ot(e,t),(t=this.theme.getClassName())&&ge(e,t));for(let o=0,n;n=this.subscribedWorkspaces[o];o++)n.refreshTheme();for(const[o,n]of this.componentDB)for(const c of n){e=c.element,t=c.propertyName;const h=this.theme&&this.theme.getComponentStyle(o);e.style.setProperty(t,h||"")}for(const o of this.subscribedWorkspaces)o.hideChaff()}subscribeWorkspace(e){this.subscribedWorkspaces.push(e)}unsubscribeWorkspace(e){if(!St(this.subscribedWorkspaces,e))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.")}subscribe(e,t,o){this.componentDB.has(t)||this.componentDB.set(t,[]),this.componentDB.get(t).push({element:e,propertyName:o}),t=this.theme&&this.theme.getComponentStyle(t),e.style.setProperty(o,t||"")}unsubscribe(e){if(e)for(const[t,o]of this.componentDB){for(let n=o.length-1;0<=n;n--)o[n].element===e&&o.splice(n,1);o.length||this.componentDB.delete(t)}}dispose(){this.subscribedWorkspaces.length=0,this.componentDB.clear()}},pp="VARIABLE_DYNAMIC",pi={CATEGORY_NAME:pp};pi.flyoutCategory=qa,pi.flyoutCategoryBlocks=Nd,pi.onCreateVariableButtonClick_Colour=Md,pi.onCreateVariableButtonClick_Number=Od,pi.onCreateVariableButtonClick_String=Rd;var Mv=30,gi=[];gi[oe.INPUT_VALUE]=oe.OUTPUT_VALUE,gi[oe.OUTPUT_VALUE]=oe.INPUT_VALUE,gi[oe.NEXT_STATEMENT]=oe.PREVIOUS_STATEMENT,gi[oe.PREVIOUS_STATEMENT]=oe.NEXT_STATEMENT;var gp="RENAME_VARIABLE_ID",mp="DELETE_VARIABLE_ID",Nv=class{canConnect(e,t,o,n){return this.canConnectWithReason(e,t,o,n)===Be.CAN_CONNECT}canConnectWithReason(e,t,o,n){const c=this.doSafetyChecks(e,t);return c!==Be.CAN_CONNECT?c:this.doTypeChecks(e,t)?o&&!this.doDragChecks(e,t,n||0)?Be.REASON_DRAG_CHECKS_FAILED:Be.CAN_CONNECT:Be.REASON_CHECKS_FAILED}getErrorMessage(e,t,o){switch(e){case Be.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case Be.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case Be.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case Be.REASON_TARGET_NULL:return"Target connection is null.";case Be.REASON_CHECKS_FAILED:return"Connection checks failed. "+(t+" expected "+t.getCheck()+", found "+o.getCheck());case Be.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case Be.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case Be.REASON_PREVIOUS_AND_OUTPUT:return"Block would have an output and a previous connection.";default:return"Unknown connection failure: this should never happen!"}}doSafetyChecks(e,t){if(!e||!t)return Be.REASON_TARGET_NULL;let o,n,c;return e.isSuperior()?(o=e.getSourceBlock(),n=t.getSourceBlock(),c=t):(n=e.getSourceBlock(),o=t.getSourceBlock(),c=e,e=t),o===n?Be.REASON_SELF_CONNECTION:c.type!==gi[e.type]?Be.REASON_WRONG_TYPE:o.workspace!==n.workspace?Be.REASON_DIFFERENT_WORKSPACES:o.isShadow()&&!n.isShadow()?Be.REASON_SHADOW_PARENT:c.type===oe.OUTPUT_VALUE&&n.previousConnection&&n.previousConnection.isConnected()||c.type===oe.PREVIOUS_STATEMENT&&n.outputConnection&&n.outputConnection.isConnected()?Be.REASON_PREVIOUS_AND_OUTPUT:Be.CAN_CONNECT}doTypeChecks(e,t){if(e=e.getCheck(),t=t.getCheck(),!e||!t)return!0;for(let o=0;o<e.length;o++)if(t.includes(e[o]))return!0;return!1}doDragChecks(e,t,o){if(e.distanceFrom(t)>o||t.getSourceBlock().isInsertionMarker())return!1;switch(t.type){case oe.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case oe.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case oe.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case oe.NEXT_STATEMENT:if(t.isConnected()&&!e.getSourceBlock().nextConnection&&!t.targetBlock().isShadow()&&t.targetBlock().nextConnection||t.targetBlock()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;default:return!1}return!nr.includes(t)}canConnectToPrevious_(e,t){return e.targetConnection||nr.includes(t)?!1:t.targetConnection?(e=t.targetBlock(),e.isInsertionMarker()?!e.getPreviousBlock():!1):!0}};r(F.CONNECTION_CHECKER,js,Nv);var fp=class extends dr{constructor(e){super(e),this.type=O.VAR_DELETE,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const e=super.toJson();if(this.varType===void 0)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");return e.varType=this.varType,e.varName=this.varName,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new fp),t.varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.deleteVariableById(this.varId):t.createVariable(this.varName,this.varType,this.varId)}};r(F.EVENT,O.VAR_DELETE,fp);var $p=class extends dr{constructor(e,t){super(e),this.type=O.VAR_RENAME,e&&(this.oldName=e.name,this.newName=typeof t>"u"?"":t)}toJson(){const e=super.toJson();if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");return e.oldName=this.oldName,e.newName=this.newName,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new $p),t.oldName=e.oldName,t.newName=e.newName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");e?t.renameVariableById(this.varId,this.newName):t.renameVariableById(this.varId,this.oldName)}};r(F.EVENT,O.VAR_RENAME,$p);var bp=class{constructor(e){this.workspace=e,this.variableMap=new Map}clear(){for(const e of this.variableMap.values())for(;0<e.length;)this.deleteVariable(e[0]);if(this.variableMap.size!==0)throw Error("Non-empty variable map")}renameVariable(e,t){if(e.name!==t){var o=this.getVariable(t,e.type),n=this.workspace.getAllBlocks(!1),c=i.getGroup$$module$build$src$core$events$utils();c||i.setGroup$$module$build$src$core$events$utils(!0);try{o&&o.getId()!==e.getId()?this.renameVariableWithConflict(e,t,o,n):this.renameVariableAndUses(e,t,n)}finally{i.setGroup$$module$build$src$core$events$utils(c)}}}renameVariableById(e,t){const o=this.getVariableById(e);if(!o)throw Error("Tried to rename a variable that didn't exist. ID: "+e);this.renameVariable(o,t)}renameVariableAndUses(e,t,o){for(z(new(G(O.VAR_RENAME))(e,t)),e.name=t,t=0;t<o.length;t++)o[t].updateVarName(e)}renameVariableWithConflict(e,t,o,n){const c=e.type;for(t!==o.name&&this.renameVariableAndUses(o,t,n),t=0;t<n.length;t++)n[t].renameVarById(e.getId(),o.getId());z(new(G(O.VAR_DELETE))(e)),St(this.variableMap.get(c),e)}createVariable(e,t,o){var n=this.getVariable(e,t);if(n){if(o&&n.getId()!==o)throw Error('Variable "'+e+'" is already in use and its id is "'+n.getId()+'" which conflicts with the passed in id, "'+o+'".');return n}if(o&&this.getVariableById(o))throw Error('Variable id, "'+o+'", is already in use.');return n=o||C(),t=t||"",n=new hr(this.workspace,e,t,n),e=this.variableMap.get(t)||[],e.push(n),this.variableMap.delete(t),this.variableMap.set(t,e),z(new(G(O.VAR_CREATE))(n)),n}deleteVariable(e){const t=e.getId(),o=this.variableMap.get(e.type);if(o){for(let n=0;n<o.length;n++)if(o[n].getId()===t){o.splice(n,1),z(new(G(O.VAR_DELETE))(e)),o.length===0&&this.variableMap.delete(e.type);break}}}deleteVariableById(e){const t=this.getVariableById(e);if(t){var o=t.name;const n=this.getVariableUsesById(e);for(let c=0,h;h=n[c];c++)if(h.type==="procedures_defnoreturn"||h.type==="procedures_defreturn"){e=String(h.getFieldValue("NAME")),o=i.Msg$$module$build$src$core$msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",o).replace("%2",e),Un(o);return}1<n.length?(o=i.Msg$$module$build$src$core$msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(n.length)).replace("%2",o),Ca(o,c=>{c&&t&&this.deleteVariableInternal(t,n)})):this.deleteVariableInternal(t,n)}else console.warn("Can't delete non-existent variable: "+e)}deleteVariableInternal(e,t){const o=i.getGroup$$module$build$src$core$events$utils();o||i.setGroup$$module$build$src$core$events$utils(!0);try{for(let n=0;n<t.length;n++)t[n].dispose(!0);this.deleteVariable(e)}finally{i.setGroup$$module$build$src$core$events$utils(o)}}getVariable(e,t){if(t=this.variableMap.get(t||"")){for(let o=0,n;n=t[o];o++)if(i.Names$$module$build$src$core$names.equals(n.name,e))return n}return null}getVariableById(e){for(const t of this.variableMap.values())for(const o of t)if(o.getId()===e)return o;return null}getVariablesOfType(e){return(e=this.variableMap.get(e||""))?e.slice():[]}getVariableTypes(e){const t=new Set(this.variableMap.keys());if(e&&e.getPotentialVariableMap())for(const o of e.getPotentialVariableMap().variableMap.keys())t.add(o);return t.has("")||t.add(""),Array.from(t.values())}getAllVariables(){let e=[];for(const t of this.variableMap.values())e=e.concat(t);return e}getAllVariableNames(){return Array.from(this.variableMap.values()).flat().map(e=>e.name)}getVariableUsesById(e){const t=[],o=this.workspace.getAllBlocks(!1);for(let n=0;n<o.length;n++){const c=o[n].getVarModels();if(c)for(let h=0;h<c.length;h++)c[h].getId()===e&&t.push(o[n])}return t}},rn=class{get isFlyout(){return this.internalIsFlyout}get isMutator(){return this.internalIsMutator}constructor(e){this.isClearing=this.internalIsMutator=this.internalIsFlyout=this.rendered=!1,this.MAX_UNDO=1024,this.connectionDBList=[],this.topBlocks=[],this.topComments=[],this.commentDB=new Map,this.listeners=[],this.undoStack_=[],this.redoStack_=[],this.blockDB=new Map,this.typedBlocksDB=new Map,this.procedureMap=new Sv,this.potentialVariableMap=null,this.id=C(),B(this),this.options=e||new ds({}),this.RTL=!!this.options.RTL,this.horizontalLayout=!!this.options.horizontalLayout,this.toolboxPosition=this.options.toolboxPosition,this.connectionChecker=new(_(F.CONNECTION_CHECKER,this.options,!0))(this),this.variableMap=new bp(this)}dispose(){this.listeners.length=0,this.clear(),H(this)}sortObjects(e,t){const o=Math.sin(Ia(rn.SCAN_ANGLE))*(this.RTL?-1:1);return e=e.getRelativeToSurfaceXY(),t=t.getRelativeToSurfaceXY(),e.y+o*e.x-(t.y+o*t.x)}addTopBlock(e){this.topBlocks.push(e)}removeTopBlock(e){if(!St(this.topBlocks,e))throw Error("Block not present in workspace's list of top-most blocks.")}getTopBlocks(e=!1){const t=[].concat(this.topBlocks);return e&&1<t.length&&t.sort(this.sortObjects.bind(this)),t}addTypedBlock(e){this.typedBlocksDB.has(e.type)||this.typedBlocksDB.set(e.type,[]),this.typedBlocksDB.get(e.type).push(e)}removeTypedBlock(e){St(this.typedBlocksDB.get(e.type),e),this.typedBlocksDB.get(e.type).length||this.typedBlocksDB.delete(e.type)}getBlocksByType(e,t=!1){return this.typedBlocksDB.has(e)?(e=this.typedBlocksDB.get(e).slice(0),t&&e&&1<e.length&&e.sort(this.sortObjects.bind(this)),e.filter(o=>!o.isInsertionMarker())):[]}addTopComment(e){this.topComments.push(e),this.commentDB.has(e.id)&&console.warn('Overriding an existing comment on this workspace, with id "'+e.id+'"'),this.commentDB.set(e.id,e)}removeTopComment(e){if(!St(this.topComments,e))throw Error("Comment not present in workspace's list of top-most comments.");this.commentDB.delete(e.id)}getTopComments(e=!1){const t=[].concat(this.topComments);return e&&1<t.length&&t.sort(this.sortObjects.bind(this)),t}getAllBlocks(e=!1){if(e){var t=this.getTopBlocks(!0);e=[];for(let o=0;o<t.length;o++)e.push(...t[o].getDescendants(!0))}else for(e=this.getTopBlocks(!1),t=0;t<e.length;t++)e.push(...e[t].getChildren(!1));return e.filter(o=>!o.isInsertionMarker())}clear(){this.isClearing=!0;try{const e=i.getGroup$$module$build$src$core$events$utils();for(e||i.setGroup$$module$build$src$core$events$utils(!0);this.topBlocks.length;)this.topBlocks[0].dispose(!1);for(;this.topComments.length;)this.topComments[this.topComments.length-1].dispose();i.setGroup$$module$build$src$core$events$utils(e),this.variableMap.clear(),this.potentialVariableMap&&this.potentialVariableMap.clear()}finally{this.isClearing=!1}}renameVariableById(e,t){this.variableMap.renameVariableById(e,t)}createVariable(e,t,o){return this.variableMap.createVariable(e,t,o)}getVariableUsesById(e){return this.variableMap.getVariableUsesById(e)}deleteVariableById(e){this.variableMap.deleteVariableById(e)}getVariable(e,t){return this.variableMap.getVariable(e,t)}getVariableById(e){return this.variableMap.getVariableById(e)}getVariablesOfType(e){return this.variableMap.getVariablesOfType(e)}getVariableTypes(){return this.variableMap.getVariableTypes(this)}getAllVariables(){return this.variableMap.getAllVariables()}getAllVariableNames(){return this.variableMap.getAllVariableNames()}getWidth(){return 0}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}newComment(e){throw Error("The implementation of newComment should be monkey-patched in by blockly.ts")}remainingCapacity(){return isNaN(this.options.maxBlocks)?1/0:this.options.maxBlocks-this.getAllBlocks(!1).length}remainingCapacityOfType(e){return this.options.maxInstances?(this.options.maxInstances[e]!==void 0?this.options.maxInstances[e]:1/0)-this.getBlocksByType(e,!1).length:1/0}isCapacityAvailable(e){if(!this.hasBlockLimits())return!0;let t=0;for(const o in e){if(e[o]>this.remainingCapacityOfType(o))return!1;t+=e[o]}return!(t>this.remainingCapacity())}hasBlockLimits(){return this.options.maxBlocks!==1/0||!!this.options.maxInstances}getUndoStack(){return this.undoStack_}getRedoStack(){return this.redoStack_}undo(e){var t=e?this.redoStack_:this.undoStack_,o=e?this.undoStack_:this.redoStack_;const n=t.pop();if(n){for(var c=[n];t.length&&n.group&&n.group===t[t.length-1].group;){const h=t.pop();h&&c.push(h)}for(t=0;t<c.length;t++)o.push(c[t]);i.setRecordUndo$$module$build$src$core$events$utils(!1);try{for(o=0;o<c.length;o++)c[o].run(e)}finally{i.setRecordUndo$$module$build$src$core$events$utils(!0)}}}clearUndo(){this.undoStack_.length=0,this.redoStack_.length=0,ce()}addChangeListener(e){return this.listeners.push(e),e}removeChangeListener(e){St(this.listeners,e)}fireChangeListener(e){if(e.recordUndo)for(this.undoStack_.push(e),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(let t=0;t<this.listeners.length;t++)(0,this.listeners[t])(e)}getBlockById(e){return this.blockDB.get(e)||null}setBlockById(e,t){this.blockDB.set(e,t)}removeBlockById(e){this.blockDB.delete(e)}getCommentById(e){let t;return(t=this.commentDB.get(e))!=null?t:null}allInputsFilled(e){const t=this.getTopBlocks(!1);for(let o=0;o<t.length;o++)if(!t[o].allInputsFilled(e))return!1;return!0}getPotentialVariableMap(){return this.potentialVariableMap}createPotentialVariableMap(){this.potentialVariableMap=new bp(this)}getVariableMap(){return this.variableMap}setVariableMap(e){this.variableMap=e}getProcedureMap(){return this.procedureMap}getRootWorkspace(){let e=null;const t=this.options.parentWorkspace;return this.isFlyout?t&&t.options&&(e=t.options.parentWorkspace):t&&(e=t),e}static getById(e){return q(e)}static getAll(){return ee()}};rn.SCAN_ANGLE=3;var tk=100,Lv=class{constructor(e){this.parentWorkspace=e,this.sounds=new Map,this.lastSound=null,this.muted=!1}dispose(){this.sounds.clear()}load(e,t){if(e.length){try{var o=new globalThis.Audio}catch{return}for(let c=0;c<e.length;c++){const h=e[c],$=h.match(/\.(\w+)$/);if($&&o.canPlayType("audio/"+$[1])){var n=new globalThis.Audio(h);break}}n&&this.sounds.set(t,n)}}preload(){for(const e of this.sounds.values()){e.volume=.01;const t=e.play();if(t!==void 0?t.then(e.pause).catch(function(){}):e.pause(),nl||xb)break}}play(e,t){if(!this.muted){var o=this.sounds.get(e);o?(e=new Date,this.lastSound!==null&&e.getTime()-this.lastSound.getTime()<tk||(this.lastSound=e,o=nl||yh?o:o.cloneNode(),o.volume=t===void 0?1:t,o.play())):this.parentWorkspace&&this.parentWorkspace.getAudioManager().play(e,t)}}setMuted(e){this.muted=e}getMuted(){return this.muted}},sk=20,ns=class extends rn{constructor(e){super(e),this.resizeHandlerWrapper=null,this.resizesEnabled=this.visible=this.rendered=!0,this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0,this.oldScale=this.scale=1,this.oldLeft=this.oldTop=0,this.inverseScreenCTM=this.targetWorkspace=this.dummyWheelListener=this.configureContextMenu=this.lastRecordedPageScroll=this.injectionDiv=this.currentGesture_=this.toolbox=this.flyout=this.scrollbar=this.trashcan=null,this.inverseScreenCTMDirty=!0,this.highlightedBlocks=[],this.toolboxCategoryCallbacks=new Map,this.flyoutButtonCallbacks=new Map,this.cachedParentSvg=null,this.keyboardAccessibilityMode=!1,this.topBoundedElements=[],this.dragTargetAreas=[],this.zoomControls_=this.layerManager=null,this.metricsManager=new(_(F.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager),this.setMetrics=e.setMetrics||ns.setTopLevelWorkspaceMetrics,this.componentManager=new lt,this.connectionDBList=tn.init(this.connectionChecker),this.audioManager=new Lv(e.parentWorkspace),this.grid=this.options.gridPattern?new ep(this.options.gridPattern,e.gridOptions):null,this.markerManager=new mr(this),At&&ka&&this.registerToolboxCategoryCallback(Bh,ka),pi&&qa&&this.registerToolboxCategoryCallback(pp,qa),zt&&Ya&&(this.registerToolboxCategoryCallback(Rl,Ya),this.addChangeListener(Id)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new Ov(this,this.options.theme||El),this.themeManager_.subscribeWorkspace(this);let t;this.renderer=Ad(this.options.renderer||"geras",this.getTheme(),(t=this.options.rendererOverrides)!=null?t:void 0),this.cachedParentSvgSize=new Le(0,0)}getMarkerManager(){return this.markerManager}getMetricsManager(){return this.metricsManager}setMetricsManager(e){this.metricsManager=e,this.getMetrics=this.metricsManager.getMetrics.bind(this.metricsManager)}getComponentManager(){return this.componentManager}setCursorSvg(e){this.markerManager.setCursorSvg(e)}setMarkerSvg(e){this.markerManager.setMarkerSvg(e)}getMarker(e){return this.markerManager?this.markerManager.getMarker(e):null}getCursor(){return this.markerManager?this.markerManager.getCursor():null}getRenderer(){return this.renderer}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(e){e||(e=El),this.themeManager_.setTheme(e)}refreshTheme(){this.svgGroup_&&this.renderer.refreshDom(this.svgGroup_,this.getTheme()),this.updateBlockStyles(this.getAllBlocks(!1).filter(t=>!!t.getStyleName())),this.refreshToolboxSelection(),this.toolbox&&this.toolbox.refreshTheme(),this.isVisible()&&this.setVisible(!0);const e=new(G(O.THEME_CHANGE))(this.getTheme().name,this.id);z(e)}updateBlockStyles(e){for(let t=0,o;o=e[t];t++){const n=o.getStyleName();n&&o.setStyle(n)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){const e=this.getParentSvg().getScreenCTM();e&&(this.inverseScreenCTM=e.inverse(),this.inverseScreenCTMDirty=!1)}return this.inverseScreenCTM}updateInverseScreenCTM(){this.inverseScreenCTMDirty=!0}isVisible(){return this.visible}getSvgXY(e){let t=0,o=0,n=1;(this.getCanvas().contains(e)||this.getBubbleCanvas().contains(e))&&(n=this.scale);do{const c=Pn(e);(e===this.getCanvas()||e===this.getBubbleCanvas())&&(n=1),t+=c.x*n,o+=c.y*n,e=e.parentNode}while(e&&e!==this.getParentSvg()&&e!==this.getInjectionDiv());return new V(t,o)}getCachedParentSvgSize(){const e=this.cachedParentSvgSize;return new Le(e.width,e.height)}getOriginOffsetInPixels(){return pa(this.getCanvas())}getInjectionDiv(){if(!this.injectionDiv){let e=this.svgGroup_;for(;e;){if((" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv ")){this.injectionDiv=e;break}e=e.parentNode}}return this.injectionDiv}getSvgGroup(){return this.svgGroup_}getBlockCanvas(){return this.getCanvas()}setResizeHandlerWrapper(e){this.resizeHandlerWrapper=e}createDom(e,t){return this.injectionDiv||(this.injectionDiv=t??null),this.svgGroup_=N(x.G,{class:"blocklyWorkspace"}),e&&(this.svgBackground_=N(x.RECT,{height:"100%",width:"100%",class:e},this.svgGroup_),e==="blocklyMainBackground"&&this.grid?this.svgBackground_.style.fill="url(#"+this.grid.getPatternId()+")":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill")),this.layerManager=new KT(this),this.svgBlockCanvas_=this.layerManager.getBlockLayer(),this.svgBubbleCanvas_=this.layerManager.getBubbleLayer(),this.isFlyout||(X(this.svgGroup_,"pointerdown",this,this.onMouseDown,!1),this.dummyWheelListener=()=>{},document.body.addEventListener("wheel",this.dummyWheelListener),X(this.svgGroup_,"wheel",this,this.onMouseWheel)),this.options.hasCategories&&(this.toolbox=new(_(F.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=_(F.CURSOR,this.options))&&this.markerManager.setCursor(new e),this.renderer.createDom(this.svgGroup_,this.getTheme()),this.svgGroup_}dispose(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&Ke(this.svgGroup_),this.toolbox&&(this.toolbox.dispose(),this.toolbox=null),this.flyout&&(this.flyout.dispose(),this.flyout=null),this.trashcan&&(this.trashcan.dispose(),this.trashcan=null),this.scrollbar&&(this.scrollbar.dispose(),this.scrollbar=null),this.zoomControls_&&this.zoomControls_.dispose(),this.audioManager&&this.audioManager.dispose(),this.grid&&(this.grid=null),this.renderer.dispose(),this.markerManager&&this.markerManager.dispose(),super.dispose(),this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),this.options.parentWorkspace||this.themeManager_.dispose()),this.connectionDBList.length=0,this.toolboxCategoryCallbacks.clear(),this.flyoutButtonCallbacks.clear(),!this.options.parentWorkspace){const e=this.getParentSvg();e&&e.parentNode&&Ke(e.parentNode)}this.resizeHandlerWrapper&&(ze(this.resizeHandlerWrapper),this.resizeHandlerWrapper=null),this.dummyWheelListener&&(document.body.removeEventListener("wheel",this.dummyWheelListener),this.dummyWheelListener=null)}addTrashcan(){this.trashcan=ns.newTrashcan(this);const e=this.trashcan.createDom();this.svgGroup_.insertBefore(e,this.getCanvas())}static newTrashcan(e){throw Error("The implementation of newTrashcan should be monkey-patched in by blockly.ts")}addZoomControls(){this.zoomControls_=new Fb(this);const e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}addFlyout(e){const t=new ds({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,move:{scrollbars:!0}});return t.toolboxPosition=this.options.toolboxPosition,this.flyout=this.horizontalLayout?new(_(F.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(_(F.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(t),this.flyout.autoClose=!1,this.flyout.getWorkspace().setVisible(!0),this.flyout.createDom(e)}getFlyout(e){return this.flyout||e?this.flyout:this.toolbox?this.toolbox.getFlyout():null}getToolbox(){return this.toolbox}updateScreenCalculations(){this.updateInverseScreenCTM(),this.recordDragTargets()}resizeContents(){this.resizesEnabled&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())}resize(){this.toolbox&&this.toolbox.position(),this.flyout&&this.flyout.position();const e=this.componentManager.getComponents(lt.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),o=[];for(let n=0,c;c=e[n];n++){c.position(t,o);const h=c.getBoundingRectangle();h&&o.push(h)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations()}updateScreenCalculationsIfScrolled(){const e=fu();V.equals(this.lastRecordedPageScroll,e)||(this.lastRecordedPageScroll=e,this.updateScreenCalculations())}getLayerManager(){return this.layerManager}getCanvas(){return this.layerManager.getBlockLayer()}setCachedParentSvgSize(e,t){const o=this.getParentSvg();e!=null&&(this.cachedParentSvgSize.width=e,o.setAttribute("data-cached-width",`${e}`)),t!=null&&(this.cachedParentSvgSize.height=t,o.setAttribute("data-cached-height",`${t}`))}getBubbleCanvas(){return this.layerManager.getBubbleLayer()}getParentSvg(){if(!this.cachedParentSvg){let e=this.svgGroup_;for(;e;){if(e.tagName==="svg"){this.cachedParentSvg=e;break}e=e.parentNode}}return this.cachedParentSvg}maybeFireViewportChangeEvent(){if(K()){var e=this.scale,t=-this.scrollY,o=-this.scrollX;if(!(e===this.oldScale&&1>Math.abs(t-this.oldTop)&&1>Math.abs(o-this.oldLeft))){var n=new(G(O.VIEWPORT_CHANGE))(t,o,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=t,this.oldLeft=o,z(n)}}}translate(e,t){let o;(o=this.layerManager)==null||o.translateLayers(new V(e,t),this.scale);let n;(n=this.grid)==null||n.moveTo(e,t),this.maybeFireViewportChangeEvent()}getWidth(){const e=this.getMetrics();return e?e.viewWidth/this.scale:0}setVisible(e){this.visible=e,this.svgGroup_&&(this.scrollbar&&this.scrollbar.setContainerVisible(e),this.getFlyout()&&this.getFlyout().setContainerVisible(e),this.getParentSvg().style.display=e?"block":"none",this.toolbox&&this.toolbox.setVisible(e),e||this.hideChaff(!0))}render(){const e=this.getAllBlocks(!1);for(let t=e.length-1;0<=t;t--)e[t].queueRender();this.getTopBlocks().flatMap(t=>t.getDescendants(!1)).filter(t=>t.isInsertionMarker()).forEach(t=>t.queueRender()),ws().then(()=>{this.markerManager.updateMarkers()})}highlightBlock(e,t){if(t===void 0){for(let o=0,n;n=this.highlightedBlocks[o];o++)n.setHighlighted(!1);this.highlightedBlocks.length=0}(e=e?this.getBlockById(e):null)&&((t=t===void 0||t)?this.highlightedBlocks.includes(e)||this.highlightedBlocks.push(e):St(this.highlightedBlocks,e),e.setHighlighted(t))}refreshToolboxSelection(){const e=this.isFlyout?this.targetWorkspace:this;e&&!e.currentGesture_&&e.toolbox&&e.toolbox.getFlyout()&&e.toolbox.refreshSelection()}renameVariableById(e,t){super.renameVariableById(e,t),this.refreshToolboxSelection()}deleteVariableById(e){super.deleteVariableById(e),this.refreshToolboxSelection()}createVariable(e,t,o){return e=super.createVariable(e,t,o),this.refreshToolboxSelection(),e}recordDragTargets(){const e=this.componentManager.getComponents(lt.Capability.DRAG_TARGET,!0);this.dragTargetAreas=[];for(let t=0,o;o=e[t];t++){const n=o.getClientRect();n&&this.dragTargetAreas.push({component:o,clientRect:n})}}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}newComment(e){throw Error("The implementation of newComment should be monkey-patched in by blockly.ts")}getDragTarget(e){for(let t=0,o;o=this.dragTargetAreas[t];t++)if(o.clientRect.contains(e.clientX,e.clientY))return o.component;return null}onMouseDown(e){const t=this.getGesture(e);t&&t.handleWsStart(e,this)}startDrag(e,t){Ba(this,e,t)}moveDrag(e){return ja(this,e)}isDragging(){return this.currentGesture_!==null&&this.currentGesture_.isDragging()}isDraggable(){return this.options.moveOptions&&this.options.moveOptions.drag}isMovable(){return this.options.moveOptions&&!!this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel||this.options.zoomOptions&&this.options.zoomOptions.pinch}isMovableHorizontally(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollVertically())}onMouseWheel(e){if(co.inProgress())e.preventDefault(),e.stopPropagation();else{var t=this.options.zoomOptions&&this.options.zoomOptions.wheel,o=this.options.moveOptions&&this.options.moveOptions.wheel;if(t||o){var n=Zs(e);if(_h)var c=e.metaKey;t&&(e.ctrlKey||c||!o)?(n=-n.y/50,t=st(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(t.x,t.y,n)):(t=this.scrollX-n.x,o=this.scrollY-n.y,e.shiftKey&&!n.x&&(t=this.scrollX-n.y,o=this.scrollY),this.scroll(t,o)),e.preventDefault()}}}getBlocksBoundingBox(){const e=this.getTopBoundedElements();if(!e.length)return new qe(0,0,0,0);const t=e[0].getBoundingRectangle();for(let n=1;n<e.length;n++){var o=e[n];o.isInsertionMarker&&o.isInsertionMarker()||(o=o.getBoundingRectangle(),o.top<t.top&&(t.top=o.top),o.bottom>t.bottom&&(t.bottom=o.bottom),o.left<t.left&&(t.left=o.left),o.right>t.right&&(t.right=o.right))}return t}cleanUp(){this.setResizesEnabled(!1),i.setGroup$$module$build$src$core$events$utils(!0);var e=this.getTopBlocks(!0),t=e.filter(h=>h.isMovable());const o=e.filter(h=>!h.isMovable()).map(h=>h.getBoundingRectangle());e=function(h){for(const $ of o)if(h.intersects($))return $;return null};var n=0;const c=this.renderer.getConstants().MIN_BLOCK_HEIGHT;for(const h of t){for(t=h.getBoundingRectangle(),h.moveBy(-t.left,n-t.top,["cleanup"]),h.snapToGrid(),t=h.getBoundingRectangle(),n=e(t);n!=null;)n=n.top+n.getHeight()+c,h.moveBy(0,n-t.top,["cleanup"]),h.snapToGrid(),t=h.getBoundingRectangle(),n=e(t);n=h.getRelativeToSurfaceXY().y+h.getHeightWidth().height+c}i.setGroup$$module$build$src$core$events$utils(!1),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.options.readOnly&&!this.isFlyout){var t=xe.registry.getContextMenuOptions(xe.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(t,e),Jn(e,t,this.RTL,this)}}updateToolbox(e){if(e=ga(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(ma(e)){if(!this.toolbox)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=e,this.toolbox.render(e)}else{if(!this.flyout)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=e,this.flyout.show(e)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.")}markFocused(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(re(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(e,t,o){o=Math.pow(this.options.zoomOptions.scaleSpeed,o);const n=this.scale*o;if(this.scale!==n){n>this.options.zoomOptions.maxScale?o=this.options.zoomOptions.maxScale/this.scale:n<this.options.zoomOptions.minScale&&(o=this.options.zoomOptions.minScale/this.scale);var c=this.getCanvas().getCTM(),h=this.getParentSvg().createSVGPoint();h.x=e,h.y=t,h=h.matrixTransform(c.inverse()),e=h.x,t=h.y,c=c.translate(e*(1-o),t*(1-o)).scale(o),this.scrollX=c.e,this.scrollY=c.f,this.setScale(n)}}zoomCenter(e){var t=this.getMetrics();let o;this.flyout?(o=t.svgWidth?t.svgWidth/2:0,t=t.svgHeight?t.svgHeight/2:0):(o=t.viewWidth/2+t.absoluteLeft,t=t.viewHeight/2+t.absoluteTop),this.zoom(o,t,e)}zoomToFit(){if(this.isMovable()){var e=this.getMetrics(),t=e.viewWidth;e=e.viewHeight;var o=this.getBlocksBoundingBox(),n=2*sk,c=o.right-o.left+n;if(o=o.bottom-o.top+n,c){this.flyout&&(this.horizontalLayout?(e+=this.flyout.getHeight(),o+=this.flyout.getHeight()/this.scale):(t+=this.flyout.getWidth(),c+=this.flyout.getWidth()/this.scale)),t/=c,e/=o,i.disable$$module$build$src$core$events$utils();try{this.setScale(Math.min(t,e)),this.scrollCenter()}finally{i.enable$$module$build$src$core$events$utils()}this.maybeFireViewportChangeEvent()}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}beginCanvasTransition(){ge(this.getCanvas(),"blocklyCanvasTransitioning"),ge(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}endCanvasTransition(){ot(this.getCanvas(),"blocklyCanvasTransitioning"),ot(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}scrollCenter(){if(this.isMovable()){var e=this.getMetrics(),t=(e.scrollWidth-e.viewWidth)/2,o=(e.scrollHeight-e.viewHeight)/2;t=-t-e.scrollLeft,o=-o-e.scrollTop,this.scroll(t,o)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}centerOnBlock(e,t){if(this.isMovable()){var o=e?this.getBlockById(e):null;if(o){e=o.getRelativeToSurfaceXY(),o=t?{height:o.height,width:o.width}:o.getHeightWidth();var n=this.scale;t=(e.x+(this.RTL?-1:1)*o.width/2)*n,e=(e.y+o.height/2)*n,o=this.getMetrics(),this.scroll(-(t-o.viewWidth/2),-(e-o.viewHeight/2))}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}setScale(e){this.options.zoomOptions.maxScale&&e>this.options.zoomOptions.maxScale?e=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&e<this.options.zoomOptions.minScale&&(e=this.options.zoomOptions.minScale),this.scale=e,this.hideChaff(!1),(e=this.getFlyout(!1))&&e.isVisible()&&(e.reflow(),this.recordDragTargets()),this.grid&&this.grid.update(this.scale),e=this.getMetrics(),this.scrollX-=e.absoluteLeft,this.scrollY-=e.absoluteTop,e.viewLeft+=e.absoluteLeft,e.viewTop+=e.absoluteTop,this.scroll(this.scrollX,this.scrollY),this.scrollbar&&(this.flyout?this.scrollbar.resizeView(e):this.scrollbar.resizeContent(e))}getScale(){return this.options.parentWorkspace?this.options.parentWorkspace.getScale():this.scale}scroll(e,t){this.hideChaff(!0);const o=this.getMetrics();e=Math.min(e,-o.scrollLeft),t=Math.min(t,-o.scrollTop);const n=o.scrollTop+Math.max(0,o.scrollHeight-o.viewHeight);e=Math.max(e,-(o.scrollLeft+Math.max(0,o.scrollWidth-o.viewWidth))),t=Math.max(t,-n),this.scrollX=e,this.scrollY=t,this.scrollbar&&this.scrollbar.set(-(e+o.scrollLeft),-(t+o.scrollTop),!1),e+=o.absoluteLeft,t+=o.absoluteTop,this.translate(e,t)}getBlockById(e){return super.getBlockById(e)}getAllBlocks(e=!1){return super.getAllBlocks(e)}getTopBlocks(e=!1){return super.getTopBlocks(e)}addTopBlock(e){this.addTopBoundedElement(e),super.addTopBlock(e)}removeTopBlock(e){this.removeTopBoundedElement(e),super.removeTopBlock(e)}addTopComment(e){this.addTopBoundedElement(e),super.addTopComment(e)}removeTopComment(e){this.removeTopBoundedElement(e),super.removeTopComment(e)}getRootWorkspace(){return super.getRootWorkspace()}addTopBoundedElement(e){this.topBoundedElements.push(e)}removeTopBoundedElement(e){St(this.topBoundedElements,e)}getTopBoundedElements(){return[].concat(this.topBoundedElements)}setResizesEnabled(e){const t=!this.resizesEnabled&&e;this.resizesEnabled=e,t&&this.resizeContents()}clear(){this.setResizesEnabled(!1),super.clear(),this.topBoundedElements=[],this.setResizesEnabled(!0)}registerButtonCallback(e,t){if(typeof t!="function")throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks.set(e,t)}getButtonCallback(e){let t;return(t=this.flyoutButtonCallbacks.get(e))!=null?t:null}removeButtonCallback(e){this.flyoutButtonCallbacks.delete(e)}registerToolboxCategoryCallback(e,t){if(typeof t!="function")throw TypeError("Toolbox category callbacks must be functions.");this.toolboxCategoryCallbacks.set(e,t)}getToolboxCategoryCallback(e){return this.toolboxCategoryCallbacks.get(e)||null}removeToolboxCategoryCallback(e){this.toolboxCategoryCallbacks.delete(e)}getGesture(e){const t=e.type==="pointerdown",o=this.currentGesture_;return o?t&&o.hasStarted()?(console.warn("Tried to start the same gesture twice."),o.cancel(),null):o:t?this.currentGesture_=new co(e,this):null}clearGesture(){this.currentGesture_=null}cancelCurrentGesture(){this.currentGesture_&&this.currentGesture_.cancel()}getAudioManager(){return this.audioManager}getGrid(){return this.grid}hideChaff(e=!1){to(),Yn(this),Ns(),this.hideComponents(e)}hideComponents(e=!1){this.getComponentManager().getComponents(lt.Capability.AUTOHIDEABLE,!0).forEach(t=>t.autoHide(e))}static setTopLevelWorkspaceMetrics(e){const t=this.getMetrics();typeof e.x=="number"&&(this.scrollX=-(t.scrollLeft+(t.scrollWidth-t.viewWidth)*e.x)),typeof e.y=="number"&&(this.scrollY=-(t.scrollTop+(t.scrollHeight-t.viewHeight)*e.y)),this.translate(this.scrollX+t.absoluteLeft,this.scrollY+t.absoluteTop)}},vp=class extends Cs{constructor(e,t,o){super(o),this.type=O.SELECTED,this.oldElementId=e??void 0,this.newElementId=t??void 0}toJson(){const e=super.toJson();return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new vp),t.oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};r(F.EVENT,O.SELECTED,vp);var Sr=class{paste(e,t,o){if(!t.isCapacityAvailable(e.typeCounts))return null;o&&(e.blockState.x=o.x,e.blockState.y=o.y),o=o||new V(e.blockState.x||0,e.blockState.y||0),i.disable$$module$build$src$core$events$utils();let n;try{n=eo(e.blockState,t),z$(n,o)}finally{i.enable$$module$build$src$core$events$utils()}return n&&(K()&&!n.isShadow()&&z(new(G(O.BLOCK_CREATE))(n)),i.setSelected$$module$build$src$core$common(n),n)}};Sr.TYPE="block",_a(Sr.TYPE,new Sr);var Bl={};Bl.bumpIntoBounds=zi,Bl.bumpIntoBoundsHandler=Ld,Bl.bumpTopObjectsIntoBounds=Xa;var Pv=class{constructor(e){this.block=e,this.connectionPreviewer=this.connectionCandidate=this.startLoc=this.startChildConn=this.startParentConn=null,this.dragging=!1,this.dragOffset=new V(0,0),this.inGroup=!1,this.workspace=e.workspace}isMovable(){if(this.block.isShadow()){let e,t;return(t=(e=this.block.getParent())==null?void 0:e.isMovable())!=null?t:!1}return this.block.isOwnMovable()&&!this.block.isDeadOrDying()&&!this.workspace.options.readOnly&&!this.block.isInFlyout}startDrag(e){if(this.block.isShadow())this.startDraggingShadow(e);else{this.dragging=!0,(this.inGroup=!!i.getGroup$$module$build$src$core$events$utils())||i.setGroup$$module$build$src$core$events$utils(!0),this.fireDragStartEvent(),this.startLoc=this.block.getRelativeToSurfaceXY(),this.connectionCandidate=null,this.connectionPreviewer=new(_(F.CONNECTION_PREVIEWER,this.workspace.options))(this.block),Ho(),this.workspace.setResizesEnabled(!1),ji(),e=!!e&&(e.altKey||e.ctrlKey||e.metaKey),this.shouldDisconnect(e)&&this.disconnectBlock(e),this.block.setDragging(!0);var t;(t=this.workspace.getLayerManager())==null||t.moveToDragLayer(this.block)}}startDraggingShadow(e){const t=this.block.getParent();if(!t)throw Error("Tried to drag a shadow block with no parent. Shadow blocks should always have parents.");this.dragOffset=V.difference(t.getRelativeToSurfaceXY(),this.block.getRelativeToSurfaceXY()),t.startDrag(e)}shouldDisconnect(e){return!!(this.block.getParent()||e&&this.block.nextConnection&&this.block.nextConnection.targetBlock())}disconnectBlock(e){let t,o,n;if(this.startParentConn=(n=(t=this.block.outputConnection)==null?void 0:t.targetConnection)!=null?n:(o=this.block.previousConnection)==null?void 0:o.targetConnection,e){let c;this.startChildConn=(c=this.block.nextConnection)==null?void 0:c.targetConnection}this.block.unplug(e),vd(this.block)}fireDragStartEvent(){const e=new(G(O.BLOCK_DRAG))(this.block,!0,this.block.getDescendants(!1));z(e)}fireDragEndEvent(){const e=new(G(O.BLOCK_DRAG))(this.block,!1,this.block.getDescendants(!1));z(e)}fireMoveEvent(){if(!this.block.isDeadOrDying()){var e=new(G(O.BLOCK_MOVE))(this.block);e.setReason(["drag"]),e.oldCoordinate=this.startLoc,e.recordNew(),z(e)}}drag(e){if(this.block.isShadow()){let t;(t=this.block.getParent())==null||t.drag(V.sum(e,this.dragOffset))}else this.block.moveDuringDrag(e),this.updateConnectionPreview(this.block,V.difference(e,this.startLoc))}updateConnectionPreview(e,t){var o=this.connectionCandidate;const n=this.getConnectionCandidate(e,t);if(n){this.connectionCandidate=t=o&&this.currCandidateIsBetter(o,t,n)?o:n;var{local:c,neighbour:h}=t;t=c.type===oe.OUTPUT_VALUE||c.type===oe.PREVIOUS_STATEMENT,o=h.isConnected()&&!h.targetBlock().isInsertionMarker(),t&&o&&!this.orphanCanConnectAtEnd(e,h.targetBlock(),c.type)?this.connectionPreviewer.previewReplacement(c,h,h.targetBlock()):this.connectionPreviewer.previewConnection(c,h)}else this.connectionPreviewer.hidePreview(),this.connectionCandidate=null}orphanCanConnectAtEnd(e,t,o){return!!Be.getConnectionForOrphanedConnection(e,o===oe.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}currCandidateIsBetter(e,t,o){const{local:n,neighbour:c}=e;e=new V(n.x,n.y);const h=new V(c.x,c.y);return t=V.distance(V.sum(e,t),h),o.distance>t-i.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(e,t){e=this.getLocalConnections(e);let o=this.connectionCandidate?i.config$$module$build$src$core$config.connectingSnapRadius:i.config$$module$build$src$core$config.snapRadius,n=null;for(const c of e){const{connection:h,radius:$}=c.closest(o,t);h&&(n={local:c,neighbour:h,distance:$},o=$)}return n}getLocalConnections(e){const t=e.getConnections_(!1),o=e.lastConnectionInStack(!0);return o&&o!==e.nextConnection&&t.push(o),t}endDrag(e){if(this.block.isShadow()){let t;(t=this.block.getParent())==null||t.endDrag(e)}else{if(this.fireDragEndEvent(),this.fireMoveEvent(),Wo(),ji(),this.connectionPreviewer.hidePreview(),!this.block.isDeadOrDying()&&this.dragging){let t;(t=this.workspace.getLayerManager())==null||t.moveOffDragLayer(this.block,Do),this.block.setDragging(!1)}this.connectionCandidate?(this.applyConnections(this.connectionCandidate),this.disposeStep()):this.block.queueRender().then(()=>this.disposeStep()),this.inGroup||i.setGroup$$module$build$src$core$events$utils(!1)}}disposeStep(){this.block.snapToGrid(),this.connectionPreviewer.dispose(),this.workspace.setResizesEnabled(!0)}applyConnections(e){const{local:t,neighbour:o}=e;t.connect(o);const n=t.isSuperior()?o:t,c=this.block.getRootBlock();ws().then(()=>{Ua(n.getSourceBlock()),setTimeout(()=>{c.bringToFront()},0)})}revertDrag(){if(this.block.isShadow()){let t;(t=this.block.getParent())==null||t.revertDrag()}else{var e;if((e=this.startChildConn)==null||e.connect(this.block.nextConnection),this.startParentConn)switch(this.startParentConn.type){case oe.INPUT_VALUE:this.startParentConn.connect(this.block.outputConnection);break;case oe.NEXT_STATEMENT:this.startParentConn.connect(this.block.previousConnection)}else{this.block.moveTo(this.startLoc,["drag"]);let t;(t=this.workspace.getLayerManager())==null||t.moveOffDragLayer(this.block,Do),zi(this.workspace,this.workspace.getMetricsManager().getScrollMetrics(!0),this.block)}this.startParentConn=this.startChildConn=null,this.connectionPreviewer.hidePreview(),this.connectionCandidate=null,this.block.setDragging(!1),this.dragging=!1}}},Bv=class{constructor(){this.drawer=this.curNode=this.colour=null,this.type="marker"}setDrawer(e){this.drawer=e}getDrawer(){return this.drawer}getCurNode(){return this.curNode}setCurNode(e){const t=this.curNode;this.curNode=e,this.drawer&&this.drawer.draw(t,this.curNode)}draw(){this.drawer&&this.drawer.draw(this.curNode,this.curNode)}hide(){this.drawer&&this.drawer.hide()}dispose(){this.getDrawer()&&this.getDrawer().dispose()}},yp=class extends Bv{constructor(){super(),this.type="cursor"}next(){var e=this.getCurNode();if(!e)return null;for(e=e.next();e&&e.next()&&(e.getType()===P.types.NEXT||e.getType()===P.types.BLOCK);)e=e.next();return e&&this.setCurNode(e),e}in(){var e=this.getCurNode();if(!e)return null;(e.getType()===P.types.PREVIOUS||e.getType()===P.types.OUTPUT)&&(e=e.next());let t,o;return(e=(o=(t=e)==null?void 0:t.in())!=null?o:null)&&this.setCurNode(e),e}prev(){var e=this.getCurNode();if(!e)return null;for(e=e.prev();e&&e.prev()&&(e.getType()===P.types.NEXT||e.getType()===P.types.BLOCK);)e=e.prev();return e&&this.setCurNode(e),e}out(){var e=this.getCurNode();return e?((e=e.out())&&e.getType()===P.types.BLOCK&&(e=e.prev()||e),e&&this.setCurNode(e),e):null}};r(F.CURSOR,js,yp);var Er=class extends yp{constructor(){super()}next(){var e=this.getCurNode();return e?((e=this.getNextNode_(e,this.validNode_))&&this.setCurNode(e),e):null}in(){return this.next()}prev(){var e=this.getCurNode();return e?((e=this.getPreviousNode_(e,this.validNode_))&&this.setCurNode(e),e):null}out(){return this.prev()}getNextNode_(e,t){if(!e)return null;const o=e.in()||e.next();return t(o)?o:o?this.getNextNode_(o,t):(e=this.findSiblingOrParent(e.out()),t(e)?e:e?this.getNextNode_(e,t):null)}getPreviousNode_(e,t){if(!e)return null;let o=e.prev();return o=o?this.getRightMostChild(o):e.out(),t(o)?o:o?this.getPreviousNode_(o,t):null}validNode_(e){let t=!1;return e=e&&e.getType(),(e===P.types.OUTPUT||e===P.types.INPUT||e===P.types.FIELD||e===P.types.NEXT||e===P.types.PREVIOUS||e===P.types.WORKSPACE)&&(t=!0),t}findSiblingOrParent(e){if(!e)return null;const t=e.next();return t||this.findSiblingOrParent(e.out())}getRightMostChild(e){if(!e.in())return e;for(e=e.in();e&&e.next();)e=e.next();return this.getRightMostChild(e)}};Er.registrationName="basicCursor",r(F.CURSOR,Er.registrationName,Er);var jv=class extends Er{validNode_(e){let t=!1;const o=e&&e.getType();return e&&(e=e.getLocation(),o===P.types.FIELD&&e&&e.isTabNavigable()&&e.isClickable()&&(t=!0)),t}},Fv=10,Ut=class extends Be{constructor(e,t){super(e,t),this.highlighted=!1,this.targetConnection=null,this.db=e.workspace.connectionDBList[t],this.dbOpposite=e.workspace.connectionDBList[gi[t]],this.offsetInBlock=new V(0,0),this.trackedState=Ut.TrackedState.WILL_TRACK}dispose(){super.dispose(),this.trackedState===Ut.TrackedState.TRACKED&&this.db.removeConnection(this,this.y);let e,t;(t=(e=this.sourceBlock_.pathObject).removeConnectionHighlight)==null||t.call(e,this)}getSourceBlock(){return super.getSourceBlock()}targetBlock(){return super.targetBlock()}distanceFrom(e){const t=this.x-e.x;return e=this.y-e.y,Math.sqrt(t*t+e*e)}bumpAwayFrom(e,t=!1){if(!this.sourceBlock_.workspace.isDragging()){var o=i.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*Fv),n=i.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*Fv),c=e.sourceBlock_.getRootBlock(),h=this.sourceBlock_.getRootBlock();if(!c.isInFlyout&&!h.isInFlyout){var $=!0;if(h.isMovable())c.isMovable()&&t&&(n=-n);else if(c.isMovable())$=!1,o=-o,n=-n;else return;t=$?e:this,e=$?this:e,c=$?h:c,(h=I()===c)||c.addSelect(),c.RTL&&(o=-o),c.moveBy(t.x+o-e.x,t.y+n-e.y,["bump"]),h||c.removeSelect()}}}moveTo(e,t){let o=!1;return this.trackedState===Ut.TrackedState.WILL_TRACK?(this.db.addConnection(this,t),this.trackedState=Ut.TrackedState.TRACKED,o=!0):this.trackedState===Ut.TrackedState.TRACKED&&(this.db.removeConnection(this,this.y),this.db.addConnection(this,t),o=!0),this.x=e,this.y=t,o}moveBy(e,t){return this.moveTo(this.x+e,this.y+t)}moveToOffset(e){return this.moveTo(e.x+this.offsetInBlock.x,e.y+this.offsetInBlock.y)}setOffsetInBlock(e,t){this.offsetInBlock.x=e,this.offsetInBlock.y=t}getOffsetInBlock(){return this.offsetInBlock}tightenEfficiently(){var e=this.targetConnection;const t=this.targetBlock();e&&t&&(e=V.difference(this.offsetInBlock,e.offsetInBlock),t.translate(e.x,e.y))}closest(e,t){return this.dbOpposite.searchForClosest(this,e,t)}highlight(){this.highlighted=!0,this.getSourceBlock().queueRender()}unhighlight(){this.highlighted=!1,this.getSourceBlock().queueRender()}isHighlighted(){return this.highlighted}setTracking(e){e&&this.trackedState===Ut.TrackedState.TRACKED||!e&&this.trackedState===Ut.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db.addConnection(this,this.y),this.trackedState=Ut.TrackedState.TRACKED):(this.trackedState===Ut.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),this.trackedState=Ut.TrackedState.UNTRACKED))}stopTrackingAll(){if(this.setTracking(!1),this.targetConnection){const e=this.targetBlock().getDescendants(!1);for(let t=0;t<e.length;t++){const o=e[t],n=o.getConnections_(!0);for(let c=0;c<n.length;c++)n[c].setTracking(!1);for(const c of o.getIcons())Oi(c)&&c.setBubbleVisible(!1)}}}startTrackingAll(){this.setTracking(!0);let e=[];if(this.type!==oe.INPUT_VALUE&&this.type!==oe.NEXT_STATEMENT)return e;const t=this.targetBlock();if(t){let o;t.isCollapsed()?(o=[],t.outputConnection&&o.push(t.outputConnection),t.nextConnection&&o.push(t.nextConnection),t.previousConnection&&o.push(t.previousConnection)):o=t.getConnections_(!0);for(let n=0;n<o.length;n++)e.push(...o[n].startTrackingAll());e.length||(e=[t])}return e}onFailedConnect(e){const t=this.getSourceBlock();if(me()){const o=i.getGroup$$module$build$src$core$events$utils();setTimeout(function(){t.isDisposed()||t.getParent()||(i.setGroup$$module$build$src$core$events$utils(o),this.bumpAwayFrom(e),i.setGroup$$module$build$src$core$events$utils(!1))}.bind(this),i.config$$module$build$src$core$config.bumpDelay)}}disconnectInternal(e=!0){const{parentConnection:t,childConnection:o}=this.getParentAndChildConnections();if(t&&o){var n=i.getGroup$$module$build$src$core$events$utils();n||i.setGroup$$module$build$src$core$events$utils(!0);var c=t.getSourceBlock(),h=o.getSourceBlock();super.disconnectInternal(e),c.queueRender(),h.updateDisabled(),h.queueRender(),h.getSvgRoot().style.display="block",i.setGroup$$module$build$src$core$events$utils(n)}}respawnShadow_(){super.respawnShadow_();const e=this.targetBlock();e&&(e.initSvg(),e.queueRender())}neighbours(e){return this.dbOpposite.getNeighbours(this,e)}connect_(e){super.connect_(e);var t=this.getSourceBlock();e=e.getSourceBlock(),t.updateDisabled(),e.updateDisabled(),e.queueRender();var o=I();(o=o===t&&t||o===e&&e)&&(o.removeSelect(),o.addSelect()),(t=t.getInputWithBlock(e))&&(t=t.isVisible(),e.getSvgRoot().style.display=t?"block":"none")}onCheckChanged_(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()}setCheck(e){return super.setCheck(e),this.sourceBlock_.queueRender(),this}};(function(e){e=e.TrackedState||(e.TrackedState={}),e[e.WILL_TRACK=-1]="WILL_TRACK",e[e.UNTRACKED=0]="UNTRACKED",e[e.TRACKED=1]="TRACKED"})(Ut||(Ut={})),Ut.TrackedState;var gs=class extends Oo{constructor(e,t,o){if(super(e,t,o),this.childlessWidth=this.width=this.height=0,this.warningTextDb=new Map,this.mutator=null,this.rendered=!0,this.visuallyDisabled=!1,this.translation="",this.dragging=!1,this.relativeCoords=new V(0,0),this.dragStrategy=new Pv(this),!e.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=e,this.svgGroup=N(x.G,{}),this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup,this.style),e=this.pathObject.svgPath,e.tooltip=this,Li(e),this.svgGroup.setAttribute("data-id",this.id),this.doInit_()}initSvg(){if(!this.initialized){for(var e of this.inputList)e.init();for(const t of this.getIcons())t.initView(this.createIconPointerDownListener(t)),t.updateEditable();this.applyColour(),this.pathObject.updateMovable(this.isMovable()||this.isInFlyout),e=this.getSvgRoot(),!this.workspace.options.readOnly&&e&&X(e,"pointerdown",this,this.onMouseDown),e.parentNode||this.workspace.getCanvas().appendChild(e),this.initialized=!0}}getColourSecondary(){return this.style.colourSecondary}getColourTertiary(){return this.style.colourTertiary}select(){if(this.isShadow()){let e;(e=this.getParent())==null||e.select()}else this.addSelect()}unselect(){if(this.isShadow()){let e;(e=this.getParent())==null||e.unselect()}else this.removeSelect()}setParent(e){const t=this.parentBlock_;if(e!==t){Ho(),super.setParent(e),Wo();var o=this.getSvgRoot();if(!this.workspace.isClearing&&o){var n=this.getRelativeToSurfaceXY();e?e.getSvgRoot().appendChild(o):t&&((e=this.workspace.getCanvas().querySelector(".blocklyDragging"))?this.workspace.getCanvas().insertBefore(o,e):this.workspace.getCanvas().appendChild(o),this.translate(n.x,n.y)),this.applyColour()}}}getRelativeToSurfaceXY(){const e=this.workspace.getLayerManager();if(!e)throw Error("Cannot calculate position because the workspace has not been appended");let t=0,o=0,n=this.getSvgRoot();if(n)do{const c=Pn(n);t+=c.x,o+=c.y,n=n.parentNode}while(n&&!e.hasLayer(n));return new V(t,o)}moveBy(e,t,o){if(this.parentBlock_)throw Error("Block has parent");const n=K();let c=null;n&&(c=new(G(O.BLOCK_MOVE))(this),o&&c.setReason(o)),e=new V(e,t),t=this.getRelativeToSurfaceXY(),e=V.sum(t,e),this.translate(e.x,e.y),this.updateComponentLocations(e),n&&c&&(c.recordNew(),z(c)),this.workspace.resizeContents()}translate(e,t){this.translation=`translate(${e}, ${t})`,this.relativeCoords=new V(e,t),this.getSvgRoot().setAttribute("transform",this.getTranslation())}getTranslation(){return this.translation}moveTo(e,t){const o=this.getRelativeToSurfaceXY();this.moveBy(e.x-o.x,e.y-o.y,t)}moveDuringDrag(e){this.translate(e.x,e.y),this.getSvgRoot().setAttribute("transform",this.getTranslation()),this.updateComponentLocations(e)}snapToGrid(){if(!this.isDeadOrDying()&&!this.getParent()&&!this.isInFlyout){var e=this.workspace.getGrid();if(e!=null&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();e=e.alignXY(t),e!==t&&this.moveTo(e,["snap"])}}}getBoundingRectangle(){return this.getBoundingRectangleWithDimensions(this.getHeightWidth())}getBoundingRectangleWithoutChildren(){return this.getBoundingRectangleWithDimensions({height:this.height,width:this.childlessWidth})}getBoundingRectangleWithDimensions(e){const t=this.getRelativeToSurfaceXY();let o,n;return this.RTL?(o=t.x-e.width,n=t.x):(o=t.x,n=t.x+e.width),new qe(t.y,t.y+e.height,o,n)}markDirty(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(let e=0,t;t=this.inputList[e];e++)t.markDirty()}setCollapsed(e){this.collapsed_!==e&&(super.setCollapsed(e),this.updateCollapsed())}updateCollapsed(){var e=this.isCollapsed();const t=ur,o=dl;for(let c=0,h;h=this.inputList[c];c++)h.name!==t&&h.setVisible(!e);for(var n of this.getIcons())n.updateCollapsed();e?(e=this.toString(Mv),(n=this.getField(o))?n.setValue(e):(this.getInput(t)||this.appendDummyInput(t)).appendField(new hi(e),o)):(this.updateDisabled(),this.removeInput(t))}tab(e,t){const o=new jv;o.setCurNode(P.createFieldNode(e)),e=o.getCurNode(),t?o.next():o.prev(),(t=o.getCurNode())&&t!==e&&(t.getLocation().showEditor(),this.workspace.keyboardAccessibilityMode&&this.workspace.getCursor().setCurNode(t))}onMouseDown(e){const t=this.workspace.getGesture(e);t&&t.handleBlockStart(e,this)}showHelp(){const e=typeof this.helpUrl=="function"?this.helpUrl():this.helpUrl;e&&window.open(e)}generateContextMenu(){if(this.workspace.options.readOnly||!this.contextMenu)return null;const e=xe.registry.getContextMenuOptions(xe.ScopeType.BLOCK,{block:this});return this.customContextMenu&&this.customContextMenu(e),e}showContextMenu(e){const t=this.generateContextMenu();t&&t.length&&(Jn(e,t,this.RTL,this.workspace),cd(this))}updateComponentLocations(e){this.dragging||this.updateConnectionLocations(e),this.updateIconLocations(e),this.updateFieldLocations(e);for(const t of this.getChildren(!1))t.updateComponentLocations(V.sum(e,t.relativeCoords))}updateConnectionLocations(e){for(const t of this.getConnections_(!1))t.moveToOffset(e)}updateIconLocations(e){for(const t of this.getIcons())t.onLocationChange(e)}updateFieldLocations(e){for(const t of this.inputList)for(const o of t.fieldRow)o.onLocationChange(e)}setDragging(e){(this.dragging=e)?(this.translation="",nr.push(...this.getConnections_(!0)),ge(this.svgGroup,"blocklyDragging")):(nr.length=0,ot(this.svgGroup,"blocklyDragging"));for(let t=0;t<this.childBlocks_.length;t++)this.childBlocks_[t].setDragging(e)}setMovable(e){super.setMovable(e),this.pathObject.updateMovable(e)}setEditable(e){super.setEditable(e),e=this.getIcons();for(let t=0;t<e.length;t++)e[t].updateEditable()}setShadow(e){super.setShadow(e),this.applyColour()}setInsertionMarker(e){this.isInsertionMarker_!==e&&(this.isInsertionMarker_=e)&&(this.setColour(this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR),this.pathObject.updateInsertionMarker(!0))}getSvgRoot(){return this.svgGroup}dispose(e,t){if(this.disposing=!0,Xu(),qn(),t&&(this.unplug(e),za(this)),t=I(),t instanceof Oo){let o=t;for(;o!==null;)o===this&&t.unselect(),o=o.getParent()}super.dispose(!!e),Ke(this.svgGroup)}disposeInternal(){this.disposing=!0,super.disposeInternal(),I()===this&&(this.unselect(),this.workspace.cancelCurrentGesture()),[...this.warningTextDb.values()].forEach(e=>clearTimeout(e)),this.warningTextDb.clear(),this.getIcons().forEach(e=>e.dispose())}checkAndDelete(){this.workspace.isFlyout||(i.setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),i.setGroup$$module$build$src$core$events$utils(!1))}toCopyData(){return this.isInsertionMarker_?null:{paster:Sr.TYPE,blockState:Qt(this,{addCoordinates:!0,addNextBlocks:!1}),typeCounts:be(this,!0)}}applyColour(){this.pathObject.applyColour(this);const e=this.getIcons();for(let t=0;t<e.length;t++)e[t].applyColour();for(let t=0,o;o=this.inputList[t];t++)for(let n=0,c;c=o.fieldRow[n];n++)c.applyColour()}updateDisabled(){const e=!this.isEnabled()||this.getInheritedDisabled();if(this.visuallyDisabled===e){let t;(t=this.getNextBlock())==null||t.updateDisabled()}else{this.applyColour(),this.visuallyDisabled=e;for(const t of this.getChildren(!1))t.updateDisabled()}}setWarningText(e,t=""){if(t)this.warningTextDb.has(t)&&(clearTimeout(this.warningTextDb.get(t)),this.warningTextDb.delete(t));else{for(var o of this.warningTextDb.values())clearTimeout(o);this.warningTextDb.clear()}if(this.workspace.isDragging())this.warningTextDb.set(t,setTimeout(()=>{this.isDeadOrDying()||(this.warningTextDb.delete(t),this.setWarningText(e,t))},100));else if(this.isInFlyout&&(e=null),o=this.getIcon(go.TYPE),e){let n=this.getSurroundParent(),c=null;for(;n;)n.isCollapsed()&&(c=n),n=n.getSurroundParent();c&&c.setWarningText(i.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,gs.COLLAPSED_WARNING_ID),o?o.addMessage(e,t):this.addIcon(new go(this).addMessage(e,t))}else o&&(t?(o.addMessage("",t),o.getText()||this.removeIcon(go.TYPE)):this.removeIcon(go.TYPE))}setMutator(e){this.removeIcon(i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE),e&&this.addIcon(e)}addIcon(e){return super.addIcon(e),e instanceof i.MutatorIcon$$module$build$src$core$icons$mutator_icon&&(this.mutator=e),e.initView(this.createIconPointerDownListener(e)),e.applyColour(),e.updateEditable(),this.queueRender(),e}createIconPointerDownListener(e){return t=>{this.isDeadOrDying()||(t=this.workspace.getGesture(t))&&t.setStartIcon(e)}}removeIcon(e){const t=super.removeIcon(e);return e.equals(i.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE)&&(this.mutator=null),this.queueRender(),t}setEnabled(e){y("setEnabled","v11","v12","the setDisabledReason method of BlockSvg");const t=this.isEnabled();super.setEnabled(e),this.isEnabled()===t||this.getInheritedDisabled()||this.updateDisabled()}setDisabledReason(e,t){const o=this.isEnabled();super.setDisabledReason(e,t),this.isEnabled()===o||this.getInheritedDisabled()||this.updateDisabled()}setHighlighted(e){this.pathObject.updateHighlighted(e)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(e){this.pathObject.updateDraggingDelete(e)}getColour(){return this.style.colourPrimary}setColour(e){super.setColour(e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),this.pathObject.setStyle(e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()}setStyle(e){const t=this.workspace.getRenderer().getConstants().getBlockStyle(e);if(this.styleName_=e,t)this.hat=t.hat,this.pathObject.setStyle(t),this.colour_=t.colourPrimary,this.style=t,this.applyColour();else throw Error("Invalid style name: "+e)}getStyle(){return this.style}bringToFront(e=!1){let t=this;if(!t.isDeadOrDying())do{const o=t.getSvgRoot(),n=o.parentNode,c=n.childNodes;if(c[c.length-1]!==o&&n.appendChild(o),e)break;t=t.getParent()}while(t)}setPreviousStatement(e,t){super.setPreviousStatement(e,t),this.queueRender()}setNextStatement(e,t){super.setNextStatement(e,t),this.queueRender()}setOutput(e,t){super.setOutput(e,t),this.queueRender()}setInputsInline(e){super.setInputsInline(e),this.queueRender()}removeInput(e,t){return e=super.removeInput(e,t),this.queueRender(),e}moveNumberedInputBefore(e,t){super.moveNumberedInputBefore(e,t),this.queueRender()}appendInput(e){return super.appendInput(e),this.queueRender(),e}setConnectionTracking(e){if(this.previousConnection&&this.previousConnection.setTracking(e),this.outputConnection&&this.outputConnection.setTracking(e),this.nextConnection){this.nextConnection.setTracking(e);var t=this.nextConnection.targetBlock();t&&t.setConnectionTracking(e)}if(!this.collapsed_)for(t=0;t<this.inputList.length;t++){var o=this.inputList[t].connection;o&&(o.setTracking(e),(o=o.targetBlock())&&o.setConnectionTracking(e))}}getConnections_(e){const t=[];if(this.outputConnection&&t.push(this.outputConnection),this.previousConnection&&t.push(this.previousConnection),this.nextConnection&&t.push(this.nextConnection),e||!this.collapsed_)for(let o=0,n;n=this.inputList[o];o++)n.connection&&t.push(n.connection);return t}lastConnectionInStack(e){return super.lastConnectionInStack(e)}getMatchingConnection(e,t){return super.getMatchingConnection(e,t)}makeConnection_(e){return new Ut(this,e)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){const e=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||e.isInFlyout))for(const t of this.getConnections_(!1)){if(t.isSuperior()){let o;(o=t.targetBlock())==null||o.bumpNeighbours()}for(const o of t.neighbours(i.config$$module$build$src$core$config.snapRadius))o.getSourceBlock().getRootBlock()!==e&&(t.isConnected()&&o.isConnected()||(t.isSuperior()?o.bumpAwayFrom(t,!1):t.bumpAwayFrom(o,!0)))}}scheduleSnapAndBump(){this.snapToGrid(),this.bumpNeighbours()}positionNearConnection(e,t,o){if(e.type===oe.NEXT_STATEMENT||e.type===oe.INPUT_VALUE){let n=t.x;t=t.y,n+=o.x-e.getOffsetInBlock().x,t+=o.y-e.getOffsetInBlock().y,this.moveBy(n,t)}}getChildren(e){return super.getChildren(e)}queueRender(){return vu(this)}render(){this.queueRender(),Qs()}renderEfficiently(){Ho(),this.isCollapsed()&&this.updateCollapsed(),this.isEnabled()||this.updateDisabled(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),Wo(),this.updateMarkers_()}tightenChildrenEfficiently(){for(const e of this.inputList){const t=e.connection;t&&t.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}updateMarkers_(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw(),this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(mr.LOCAL_MARKER).draw();for(const e of this.inputList)for(const t of e.fieldRow)t.updateMarkers_()}setCursorSvg(e){this.pathObject.setCursorSvg(e)}setMarkerSvg(e){this.pathObject.setMarkerSvg(e)}getHeightWidth(){let e=this.height,t=this.width;var o=this.getNextBlock();if(o){o=o.getHeightWidth();const n=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;e+=o.height-n,t=Math.max(t,o.width)}return{height:e,width:t}}fadeForReplacement(e){this.pathObject.updateReplacementFade(e)}highlightShapeForInput(e,t){this.pathObject.updateShapeForInputHighlight(e,t)}setDragStrategy(e){this.dragStrategy=e}isMovable(){return this.dragStrategy.isMovable()}startDrag(e){this.dragStrategy.startDrag(e)}drag(e,t){this.dragStrategy.drag(e,t)}endDrag(e){this.dragStrategy.endDrag(e)}revertDrag(){this.dragStrategy.revertDrag()}toFlyoutInfo(){const e=Object.assign({},{kind:"BLOCK"},Qt(this)),t=new Set(["id","height","width","pinned","enabled"]),o=function(n){for(const c in n)t.has(c)?delete n[c]:typeof n[c]=="object"&&o(n[c])};return o(e),[e]}};gs.INLINE=-1,gs.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var zv=class{constructor(){}onDragEnter(e){}onDragOver(e){}onDragExit(e){}onDrop(e){}getClientRect(){return null}shouldPreventMove(e){return!1}},jl=class extends zv{constructor(){super(),this.wouldDelete_=!1}wouldDelete(e){return e instanceof gs?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e)):this.updateWouldDelete_(ls(e)&&e.isDeletable()),this.wouldDelete_}updateWouldDelete_(e){this.wouldDelete_=e}},_p=class extends Cs{constructor(e,t){super(t),this.type=O.TRASHCAN_OPEN,this.isOpen=e}toJson(){const e=super.toJson();if(this.isOpen===void 0)throw Error("Whether this is already open or not is undefined. Either pass a value to the constructor, or call fromJson");return e.isOpen=this.isOpen,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new _p),t.isOpen=e.isOpen,t}};r(F.EVENT,O.TRASHCAN_OPEN,_p);var Uv=class extends jl{constructor(e){super(),this.workspace=e,this.id="trashcan",this.contents=[],this.flyout=null,this.isLidOpen=!1,this.minOpenness=0,this.lidTask=this.svgLid=this.svgGroup=null,this.top=this.left=this.lidOpen=0,this.initialized=!1,0>=this.workspace.options.maxTrashcanContents||(e=new ds({scrollbars:!0,parentWorkspace:this.workspace,rtl:this.workspace.RTL,oneBasedIndex:this.workspace.options.oneBasedIndex,renderer:this.workspace.options.renderer,rendererOverrides:this.workspace.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace.horizontalLayout?(e.toolboxPosition=this.workspace.toolboxPosition===Ee.TOP?Ee.BOTTOM:Ee.TOP,this.flyout=new(_(F.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===Ee.RIGHT?Ee.LEFT:Ee.RIGHT,this.flyout=new(_(F.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){this.svgGroup=N(x.G,{class:"blocklyTrash"});let e;const t=String(Math.random()).substring(2);e=N(x.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),N(x.RECT,{width:an,height:Fl,y:ln},e);const o=N(x.IMAGE,{width:jt.width,x:-wp,height:jt.height,y:-Cp,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return o.setAttributeNS(es,"xlink:href",this.workspace.options.pathToMedia+jt.url),e=N(x.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),N(x.RECT,{width:an,height:ln},e),this.svgLid=N(x.IMAGE,{width:jt.width,x:-wp,height:jt.height,y:-Cp,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(es,"xlink:href",this.workspace.options.pathToMedia+jt.url),ct(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),ct(this.svgGroup,"pointerup",this,this.click),ct(o,"pointerover",this,this.mouseOver),ct(o,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){0<this.workspace.options.maxTrashcanContents&&(Uo(this.flyout.createDom(x.SVG),this.workspace.getParentSvg()),this.flyout.init(this.workspace)),this.workspace.getComponentManager().addComponent({component:this,weight:lt.ComponentWeight.TRASHCAN_WEIGHT,capabilities:[lt.Capability.AUTOHIDEABLE,lt.Capability.DELETE_AREA,lt.Capability.DRAG_TARGET,lt.Capability.POSITIONABLE]}),this.initialized=!0,this.setLidOpen(!1)}dispose(){this.workspace.getComponentManager().removeComponent("trashcan"),this.svgGroup&&Ke(this.svgGroup),this.lidTask&&clearTimeout(this.lidTask)}hasContents(){return!!this.contents.length}contentsIsOpen(){return!!this.flyout&&this.flyout.isVisible()}openFlyout(){if(!this.contentsIsOpen()){var e=this.contents.map(function(o){return JSON.parse(o)}),t=this.workspace.getParentSvg().style;t.cursor="wait",setTimeout(()=>{let o;(o=this.flyout)==null||o.show(e),t.cursor="";let n;(n=this.workspace.scrollbar)==null||n.setVisible(!1)},10),this.fireUiEvent(!0)}}closeFlyout(){if(this.contentsIsOpen()){var e;(e=this.flyout)==null||e.hide();var t;(t=this.workspace.scrollbar)==null||t.setVisible(!0),this.fireUiEvent(!1),this.workspace.recordDragTargets()}}autoHide(e){!e&&this.flyout&&this.closeFlyout()}emptyContents(){this.hasContents()&&(this.contents.length=0,this.setMinOpenness(0),this.closeFlyout())}position(e,t){if(this.initialized){var o=va(this.workspace,e);e=ba(o,new Le(an,Fl+ln),ok,Hv,e,this.workspace),t=ya(e,Hv,o.vertical===lo.TOP?Io.DOWN:Io.UP,t),this.top=t.top,this.left=t.left;var n;(n=this.svgGroup)==null||n.setAttribute("transform","translate("+this.left+","+this.top+")");var c;(c=this.flyout)==null||c.position()}}getBoundingRectangle(){return new qe(this.top,this.top+Fl+ln,this.left,this.left+an)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();const t=e.top+Cp-zl;return e=e.left+wp-zl,new qe(t,t+ln+Fl+2*zl,e,e+an+2*zl)}onDragOver(e){this.setLidOpen(this.wouldDelete_)}onDragExit(e){this.setLidOpen(!1)}onDrop(e){setTimeout(this.setLidOpen.bind(this,!1),100)}setLidOpen(e){this.isLidOpen!==e&&(this.lidTask&&clearTimeout(this.lidTask),this.isLidOpen=e,this.animateLid())}animateLid(){const e=rk;var t=1/(e+1);this.lidOpen+=this.isLidOpen?t:-t,this.lidOpen=Math.min(Math.max(this.lidOpen,this.minOpenness),1),this.setLidAngle(this.lidOpen*Vv),t=Wv+this.lidOpen*(ak-Wv),this.svgGroup&&(this.svgGroup.style.opacity=`${t}`),this.lidOpen>this.minOpenness&&1>this.lidOpen&&(this.lidTask=setTimeout(this.animateLid.bind(this),nk/e))}setLidAngle(e){const t=this.workspace.toolboxPosition===Ee.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;let o;(o=this.svgLid)==null||o.setAttribute("transform","rotate("+(t?-e:e)+","+(t?4:an-4)+","+(ln-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*Vv)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&!this.workspace.isDragging()&&this.openFlyout()}fireUiEvent(e){e=new(G(O.TRASHCAN_OPEN))(e,this.workspace.id),z(e)}blockMouseDownWhenOpenable(e){!this.contentsIsOpen()&&this.hasContents()&&e.stopPropagation()}mouseOver(){this.hasContents()&&this.setLidOpen(!0)}mouseOut(){this.setLidOpen(!1)}onDelete(e){if(!(0>=this.workspace.options.maxTrashcanContents||!E(e)||e.wasShadow)){if(!e.oldJson)throw Error("Encountered a delete event without proper oldJson");if(e=JSON.stringify(this.cleanBlockJson(e.oldJson)),!this.contents.includes(e)){for(this.contents.unshift(e);this.contents.length>this.workspace.options.maxTrashcanContents;)this.contents.pop();this.setMinOpenness(ik)}}}cleanBlockJson(e){function t(o){if(o){if(delete o.id,delete o.x,delete o.y,delete o.enabled,delete o.disabledReasons,o.icons&&o.icons.comment){var n=o.icons.comment;delete n.height,delete n.width,delete n.pinned}n=o.inputs;for(var c in n){var h=n[c];const $=h.block;h=h.shadow,$&&t($),h&&t(h)}o.next&&(c=o.next,o=c.block,c=c.shadow,o&&t(o),c&&t(c))}}return e=JSON.parse(JSON.stringify(e)),t(e),Object.assign({},{kind:"BLOCK"},e)}},an=47,Fl=44,ln=16,Hv=20,ok=20,zl=10,wp=0,Cp=32,ik=.1,nk=80,rk=4,Wv=.4,ak=.8,Vv=45,He=class{constructor(){this.shortcuts=new Map,this.keyMap=new Map,this.reset()}reset(){this.shortcuts.clear(),this.keyMap.clear()}register(e,t){if(this.shortcuts.get(e.name)&&!t)throw Error(`Shortcut named "${e.name}" already exists.`);if(this.shortcuts.set(e.name,e),t=e.keyCodes,t!=null&&t.length)for(const o of t)this.addKeyMapping(o,e.name,!!e.allowCollision)}unregister(e){return this.shortcuts.get(e)?(this.removeAllKeyMappings(e),this.shortcuts.delete(e),!0):(console.warn(`Keyboard shortcut named "${e}" not found.`),!1)}addKeyMapping(e,t,o){e=`${e}`;const n=this.keyMap.get(e);if(n&&!o)throw Error(`Shortcut named "${t}" collides with shortcuts "${n}"`);n&&o?n.unshift(t):this.keyMap.set(e,[t])}removeKeyMapping(e,t,o){const n=this.keyMap.get(e);if(!n)return o||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1;const c=n.indexOf(t);return-1<c?(n.splice(c,1),n.length===0&&this.keyMap.delete(e),!0):(o||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1)}removeAllKeyMappings(e){for(const t of this.keyMap.keys())this.removeKeyMapping(t,e,!0)}setKeyMap(e){this.keyMap.clear();for(const t in e)this.keyMap.set(t,e[t])}getKeyMap(){const e=Object.create(null);for(const[t,o]of this.keyMap)e[t]=o;return e}getRegistry(){const e=Object.create(null);for(const[t,o]of this.shortcuts)e[t]=o;return so(Object.create(null),e)}onKeyDown(e,t){var o=this.serializeKeyEvent(t);if(o=this.getShortcutNamesByKeyCode(o),!o)return!1;for(const n of o){if(o=this.shortcuts.get(n),!o||o.preconditionFn&&!o.preconditionFn(e))continue;let c,h;if((h=(c=o).callback)!=null&&h.call(c,e,t,o))return!0}return!1}getShortcutNamesByKeyCode(e){return this.keyMap.get(e)||[]}getKeyCodesByShortcutName(e){const t=[];for(const[o,n]of this.keyMap)-1<n.indexOf(e)&&t.push(o);return t}serializeKeyEvent(e){let t="";for(const o in He.modifierKeys)e.getModifierState(o)&&(t!==""&&(t+="+"),t+=o);return t!==""&&e.keyCode?t+="+"+e.keyCode:e.keyCode&&(t=String(e.keyCode)),t}checkModifiers(e){for(const t of e)if(!(t in He.modifierKeys))throw Error(t+" is not a valid modifier key.")}createSerializedKey(e,t){let o="";if(t){this.checkModifiers(t);for(const n in He.modifierKeys)t.includes(He.modifierKeys[n])&&(o!==""&&(o+="+"),o+=n)}return o!==""&&e?o+="+"+e:e&&(o=`${e}`),o}};He.registry=new He,(function(e){e=e.modifierKeys||(e.modifierKeys={}),e[e.Shift=16]="Shift",e[e.Control=17]="Control",e[e.Alt=18]="Alt",e[e.Meta=91]="Meta"})(He||(He={}));var Tp=null,kp=null,lk={duplicateInternal:G$,copyInternal:V$},Ir={};Ir.BlockPaster=Sr,Ir.TEST_ONLY=lk,Ir.paste=To,Ir.registry=xh;var Hs;(function(e){e.ESCAPE="escape",e.DELETE="delete",e.COPY="copy",e.CUT="cut",e.PASTE="paste",e.UNDO="undo",e.REDO="redo"})(Hs||(Hs={}));var Mo=null,No=null,cn=null;Vd();var Ws={};Ws.names=Hs,Ws.registerCopy=Fd,Ws.registerCut=zd,Ws.registerDefaultShortcuts=Vd,Ws.registerDelete=jd,Ws.registerEscape=Bd,Ws.registerPaste=Ud,Ws.registerRedo=Wd,Ws.registerUndo=Hd;var ck=class{constructor(e,t){this.procedureModelClass=e,this.parameterModelClass=t,this.priority=Ub}save(e){return e=e.getProcedureMap().getProcedures().map(t=>Gd(t)),e.length?e:null}load(e,t){const o=t.getProcedureMap();for(const n of e)o.add(Kd(this.procedureModelClass,this.parameterModelClass,n,t))}clear(e){e.getProcedureMap().clear()}},Ul={};Ul.ProcedureSerializer=ck,Ul.loadProcedure=Kd,Ul.saveProcedure=Gd;var Gv=class{constructor(){this.priority=zb}save(e){const t=[];for(const o of e.getAllVariables())e={name:o.name,id:o.getId()},o.type&&(e.type=o.type),t.push(e);return t.length?t:null}load(e,t){for(const o of e)t.createVariable(o.name,o.type,o.id)}clear(e){e.getVariableMap().clear()}};jn("variables",new Gv);var Kv={};Kv.VariableSerializer=Gv;var Sp={};Sp.load=Y$,Sp.save=K$;var uk={blocks:gr,exceptions:ii,priorities:jT,procedures:Ul,registry:Ih,variables:Kv,workspaceComments:cl,workspaces:Sp},Ep=class{constructor(e,t,o,n,c){this.workspace=e,this.oldHostMetrics=this.corner_=this.vScroll=this.hScroll=null,t=t===void 0?!0:t,o=o===void 0?!0:o;const h=t&&o;t&&(this.hScroll=new mt(e,!0,h,n,c)),o&&(this.vScroll=new mt(e,!1,h,n,c)),h&&(this.corner_=N(x.RECT,{height:mt.scrollbarThickness,width:mt.scrollbarThickness,class:"blocklyScrollbarBackground"}),Uo(this.corner_,e.getBubbleCanvas()))}dispose(){Ke(this.corner_),this.oldHostMetrics=this.corner_=null,this.hScroll&&(this.hScroll.dispose(),this.hScroll=null),this.vScroll&&(this.vScroll.dispose(),this.vScroll=null)}resize(){const e=this.workspace.getMetrics();if(e){var t=!1,o=!1;if(this.oldHostMetrics&&this.oldHostMetrics.viewWidth===e.viewWidth&&this.oldHostMetrics.viewHeight===e.viewHeight&&this.oldHostMetrics.absoluteTop===e.absoluteTop&&this.oldHostMetrics.absoluteLeft===e.absoluteLeft?(this.oldHostMetrics&&this.oldHostMetrics.scrollWidth===e.scrollWidth&&this.oldHostMetrics.viewLeft===e.viewLeft&&this.oldHostMetrics.scrollLeft===e.scrollLeft||(t=!0),this.oldHostMetrics&&this.oldHostMetrics.scrollHeight===e.scrollHeight&&this.oldHostMetrics.viewTop===e.viewTop&&this.oldHostMetrics.scrollTop===e.scrollTop||(o=!0)):o=t=!0,t||o){try{i.disable$$module$build$src$core$events$utils(),this.hScroll&&t&&this.hScroll.resize(e),this.vScroll&&o&&this.vScroll.resize(e)}finally{i.enable$$module$build$src$core$events$utils()}this.workspace.maybeFireViewportChangeEvent()}if(this.hScroll&&this.vScroll){if(!this.oldHostMetrics||this.oldHostMetrics.viewWidth!==e.viewWidth||this.oldHostMetrics.absoluteLeft!==e.absoluteLeft){let n;(n=this.corner_)==null||n.setAttribute("x",String(this.vScroll.position.x))}if(!this.oldHostMetrics||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteTop!==e.absoluteTop){let n;(n=this.corner_)==null||n.setAttribute("y",String(this.hScroll.position.y))}}this.oldHostMetrics=e}}canScrollHorizontally(){return!!this.hScroll}canScrollVertically(){return!!this.vScroll}setOrigin(e,t){this.hScroll&&this.hScroll.setOrigin(e,t),this.vScroll&&this.vScroll.setOrigin(e,t)}set(e,t,o){this.hScroll&&this.hScroll.set(e,!1),this.vScroll&&this.vScroll.set(t,!1),(o||o===void 0)&&(e={},this.hScroll&&(e.x=this.hScroll.getRatio_()),this.vScroll&&(e.y=this.vScroll.getRatio_()),this.workspace.setMetrics(e))}setX(e){this.hScroll&&this.hScroll.set(e,!0)}setY(e){this.vScroll&&this.vScroll.set(e,!0)}setContainerVisible(e){this.hScroll&&this.hScroll.setContainerVisible(e),this.vScroll&&this.vScroll.setContainerVisible(e)}isVisible(){let e=!1;return this.hScroll&&(e=this.hScroll.isVisible()),this.vScroll&&(e=e||this.vScroll.isVisible()),e}setVisible(e){this.hScroll&&this.hScroll.setVisibleInternal(e),this.vScroll&&this.vScroll.setVisibleInternal(e)}resizeContent(e){this.hScroll&&this.hScroll.resizeContentHorizontal(e),this.vScroll&&this.vScroll.resizeContentVertical(e)}resizeView(e){this.hScroll&&this.hScroll.resizeViewHorizontal(e),this.vScroll&&this.vScroll.resizeViewVertical(e)}},Ip=class{constructor(e){this.workspace_=e}getDimensionsPx_(e){let t=0,o=0;return e&&(t=e.getWidth(),o=e.getHeight()),new Le(t,o)}getFlyoutMetrics(e){return e=this.getDimensionsPx_(this.workspace_.getFlyout(e)),{width:e.width,height:e.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){const e=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:e.width,height:e.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){let e=0,t=0;const o=this.getToolboxMetrics(),n=this.getFlyoutMetrics(),c=!!this.workspace_.getToolbox();var h;const $=!((h=this.workspace_.getFlyout())!=null&&h.autoClose);h=c?o.position:n.position;const T=h===Ee.TOP;return h===Ee.LEFT&&(c&&(e+=o.width),$&&(e+=n.width)),T&&(c&&(t+=o.height),$&&(t+=n.height)),{top:t,left:e}}getViewMetrics(e){e=e?this.workspace_.scale:1;const t=this.getSvgMetrics(),o=this.getToolboxMetrics(),n=this.getFlyoutMetrics(),c=!!this.workspace_.getToolbox();var h;const $=!((h=this.workspace_.getFlyout())!=null&&h.autoClose);h=c?o.position:n.position;const T=h===Ee.LEFT||h===Ee.RIGHT;return(h===Ee.TOP||h===Ee.BOTTOM)&&(c&&(t.height-=o.height),$&&(t.height-=n.height)),T&&(c&&(t.width-=o.width),$&&(t.width-=n.width)),{height:t.height/e,width:t.width/e,top:-this.workspace_.scrollY/e,left:-this.workspace_.scrollX/e}}getContentMetrics(e){e=e?1:this.workspace_.scale;const t=this.workspace_.getBlocksBoundingBox();return{height:(t.bottom-t.top)*e,width:(t.right-t.left)*e,top:t.top*e,left:t.left*e}}hasFixedEdges(){return!this.workspace_.isMovableHorizontally()||!this.workspace_.isMovableVertically()}getComputedFixedEdges_(e){if(!this.hasFixedEdges())return{};const t=this.workspace_.isMovableHorizontally(),o=this.workspace_.isMovableVertically();e=e||this.getViewMetrics(!1);const n={};return o||(n.top=e.top,n.bottom=e.top+e.height),t||(n.left=e.left,n.right=e.left+e.width),n}getPaddedContent_(e,t){const o=t.top+t.height,n=t.left+t.width,c=e.width;e=e.height;const h=c/2,$=e/2;return{top:Math.min(t.top-$,o-e),bottom:Math.max(o+$,t.top+e),left:Math.min(t.left-h,n-c),right:Math.max(n+h,t.left+c)}}getScrollMetrics(e,t,o){e=e?this.workspace_.scale:1,t=t||this.getViewMetrics(!1);var n=o||this.getContentMetrics();o=this.getComputedFixedEdges_(t),t=this.getPaddedContent_(t,n),n=o.top!==void 0?o.top:t.top;const c=o.left!==void 0?o.left:t.left;return{top:n/e,left:c/e,width:((o.right!==void 0?o.right:t.right)-c)/e,height:((o.bottom!==void 0?o.bottom:t.bottom)-n)/e}}getUiMetrics(){return{viewMetrics:this.getViewMetrics(),absoluteMetrics:this.getAbsoluteMetrics(),toolboxMetrics:this.getToolboxMetrics()}}getMetrics(){const e=this.getToolboxMetrics(),t=this.getFlyoutMetrics(!0),o=this.getSvgMetrics(),n=this.getAbsoluteMetrics(),c=this.getViewMetrics(),h=this.getContentMetrics(),$=this.getScrollMetrics(!1,c,h);return{contentHeight:h.height,contentWidth:h.width,contentTop:h.top,contentLeft:h.left,scrollHeight:$.height,scrollWidth:$.width,scrollTop:$.top,scrollLeft:$.left,viewHeight:c.height,viewWidth:c.width,viewTop:c.top,viewLeft:c.left,absoluteTop:n.top,absoluteLeft:n.left,svgHeight:o.height,svgWidth:o.width,toolboxWidth:e.width,toolboxHeight:e.height,toolboxPosition:e.position,flyoutWidth:t.width,flyoutHeight:t.height}}};r(F.METRICS_MANAGER,js,Ip),"Blockly"in globalThis||(globalThis.Blockly={Msg:Xb});var Yv=class extends Ml{constructor(){super(),this.GRID_UNIT=4,this.CURSOR_COLOUR="#ffa200",this.CURSOR_RADIUS=5,this.JAGGED_TEETH_WIDTH=this.JAGGED_TEETH_HEIGHT=0,this.START_HAT_HEIGHT=22,this.START_HAT_WIDTH=96,this.SHAPES={HEXAGONAL:1,ROUND:2,SQUARE:3,PUZZLE:4,NOTCH:5},this.SHAPE_IN_SHAPE_PADDING={1:{0:5*this.GRID_UNIT,1:2*this.GRID_UNIT,2:5*this.GRID_UNIT,3:5*this.GRID_UNIT},2:{0:3*this.GRID_UNIT,1:3*this.GRID_UNIT,2:1*this.GRID_UNIT,3:2*this.GRID_UNIT},3:{0:2*this.GRID_UNIT,1:2*this.GRID_UNIT,2:2*this.GRID_UNIT,3:2*this.GRID_UNIT}},this.FULL_BLOCK_FIELDS=!0,this.FIELD_TEXT_FONTWEIGHT="bold",this.FIELD_TEXT_FONTFAMILY='"Helvetica Neue", "Segoe UI", Helvetica, sans-serif',this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0,this.SELECTED_GLOW_COLOUR="#fff200",this.SELECTED_GLOW_SIZE=.5,this.REPLACEMENT_GLOW_COLOUR="#fff200",this.REPLACEMENT_GLOW_SIZE=2,this.selectedGlowFilterId="",this.selectedGlowFilter=null,this.replacementGlowFilterId="",this.SQUARED=this.ROUNDED=this.HEXAGONAL=this.replacementGlowFilter=null,this.SMALL_PADDING=this.GRID_UNIT,this.MEDIUM_PADDING=2*this.GRID_UNIT,this.MEDIUM_LARGE_PADDING=3*this.GRID_UNIT,this.LARGE_PADDING=4*this.GRID_UNIT,this.CORNER_RADIUS=1*this.GRID_UNIT,this.NOTCH_WIDTH=9*this.GRID_UNIT,this.NOTCH_HEIGHT=2*this.GRID_UNIT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=3*this.GRID_UNIT,this.MIN_BLOCK_WIDTH=2*this.GRID_UNIT,this.MIN_BLOCK_HEIGHT=12*this.GRID_UNIT,this.EMPTY_STATEMENT_INPUT_HEIGHT=6*this.GRID_UNIT,this.TOP_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=6*this.GRID_UNIT,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT,this.STATEMENT_INPUT_SPACER_MIN_WIDTH=40*this.GRID_UNIT,this.STATEMENT_INPUT_PADDING_LEFT=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_PADDING=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_MIN_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=6*this.GRID_UNIT,this.CURSOR_WS_WIDTH=20*this.GRID_UNIT,this.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT,this.FIELD_BORDER_RECT_RADIUS=this.CORNER_RADIUS,this.FIELD_BORDER_RECT_X_PADDING=2*this.GRID_UNIT,this.FIELD_BORDER_RECT_Y_PADDING=1.625*this.GRID_UNIT,this.FIELD_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_COLOUR_DEFAULT_WIDTH=6*this.GRID_UNIT,this.FIELD_COLOUR_DEFAULT_HEIGHT=8*this.GRID_UNIT,this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT,this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT}setFontConstants_(e){super.setFontConstants_(e),this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING}init(){super.init(),this.HEXAGONAL=this.makeHexagonal(),this.ROUNDED=this.makeRounded(),this.SQUARED=this.makeSquared(),this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT+this.INSIDE_CORNERS.rightWidth}setDynamicProperties_(e){super.setDynamicProperties_(e),this.SELECTED_GLOW_COLOUR=e.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;const t=Number(e.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=t&&!isNaN(t)?t:this.SELECTED_GLOW_SIZE,this.REPLACEMENT_GLOW_COLOUR=e.getComponentStyle("replacementGlowColour")||this.REPLACEMENT_GLOW_COLOUR,this.REPLACEMENT_GLOW_SIZE=(e=Number(e.getComponentStyle("replacementGlowSize")))&&!isNaN(e)?e:this.REPLACEMENT_GLOW_SIZE}dispose(){super.dispose(),this.selectedGlowFilter&&Ke(this.selectedGlowFilter),this.replacementGlowFilter&&Ke(this.replacementGlowFilter)}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,o=Yt("c",[ue(25,-e),ue(71,-e),ue(t,0)]);return{height:e,width:t,path:o}}makeHexagonal(){function e(o,n,c){var h=o/2;return h=h>t?t:h,c=c?-1:1,o=(n?-1:1)*o/2,Bs(-c*h,o)+Bs(c*h,o)}const t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width(o){return o/=2,o>t?t:o},height(o){return o},connectionOffsetY(o){return o/2},connectionOffsetX(o){return-o},pathDown(o){return e(o,!1,!1)},pathUp(o){return e(o,!0,!1)},pathRightDown(o){return e(o,!1,!0)},pathRightUp(o){return e(o,!1,!0)}}}makeRounded(){function e(n,c,h){const $=n>o?n-o:0;n=(n>o?o:n)/2;const T=h===c?"0":"1";return gt("a","0 0,"+T,n,ue((h?1:-1)*n,(c?-1:1)*n))+ne("v",(c?-1:1)*$)+gt("a","0 0,"+T,n,ue((h?-1:1)*n,(c?-1:1)*n))}const t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,o=2*t;return{type:this.SHAPES.ROUND,isDynamic:!0,width(n){return n/=2,n>t?t:n},height(n){return n},connectionOffsetY(n){return n/2},connectionOffsetX(n){return-n},pathDown(n){return e(n,!1,!1)},pathUp(n){return e(n,!0,!1)},pathRightDown(n){return e(n,!1,!0)},pathRightUp(n){return e(n,!1,!0)}}}makeSquared(){function e(o,n,c){o-=2*t;const h=c===n?"0":"1";return gt("a","0 0,"+h,t,ue((c?1:-1)*t,(n?-1:1)*t))+ne("v",(n?-1:1)*o)+gt("a","0 0,"+h,t,ue((c?-1:1)*t,(n?-1:1)*t))}const t=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width(o){return t},height(o){return o},connectionOffsetY(o){return o/2},connectionOffsetX(o){return-o},pathDown(o){return e(o,!1,!1)},pathUp(o){return e(o,!0,!1)},pathRightDown(o){return e(o,!1,!0)},pathRightUp(o){return e(o,!1,!0)}}}shapeFor(e){let t=e.getCheck();switch(!t&&e.targetConnection&&(t=e.targetConnection.getCheck()),e.type){case oe.INPUT_VALUE:case oe.OUTPUT_VALUE:if(e=e.getSourceBlock().getOutputShape(),e!==null)switch(e){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}return t&&t.includes("Boolean")?this.HEXAGONAL:t&&t.includes("Number")?this.ROUNDED:(t&&t.includes("String"),this.ROUNDED);case oe.PREVIOUS_STATEMENT:case oe.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(te){return Yt("c",[ue(te*c/2,0),ue(te*c*3/4,$/2),ue(te*c,$)])+Fi([ue(te*c,h)])+Yt("c",[ue(te*c/4,$/2),ue(te*c/2,$),ue(te*c,$)])+ne("h",te*n)+Yt("c",[ue(te*c/2,0),ue(te*c*3/4,-($/2)),ue(te*c,-$)])+Fi([ue(te*c,-h)])+Yt("c",[ue(te*c/4,-($/2)),ue(te*c/2,-$),ue(te*c,-$)])}const t=this.NOTCH_WIDTH,o=this.NOTCH_HEIGHT,n=t/3,c=n/3,h=o/2,$=h/2,T=e(1),L=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:o,pathLeft:T,pathRight:L}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=gt("a","0 0,0",e,ue(-e,e)),o=gt("a","0 0,1",e,ue(-e,e)),n=gt("a","0 0,0",e,ue(e,e)),c=gt("a","0 0,1",e,ue(e,e));return{width:e,height:e,pathTop:t,pathBottom:n,rightWidth:e,rightHeight:e,pathTopRight:o,pathBottomRight:c}}generateSecondaryColour_(e){return Ko("#000",e,.15)||e}generateTertiaryColour_(e){return Ko("#000",e,.25)||e}createDom(e,t,o){super.createDom(e,t,o),e=N(x.DEFS,{},e),t=N(x.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),N(x.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),o=N(x.FECOMPONENTTRANSFER,{result:"outBlur"},t),N(x.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},o),N(x.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),N(x.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=N(x.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),N(x.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=N(x.FECOMPONENTTRANSFER,{result:"outBlur"},e),N(x.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),N(x.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),N(x.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),N(x.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter=e}getCSS_(e){return[`${e} .blocklyText,`,`${e} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e} .blocklyTextInputBubble textarea {`,"font-weight: normal;","}",`${e} .blocklyText {`,"fill: #fff;","}",`${e} .blocklyNonEditableText>rect:not(.blocklyDropdownRect),`,`${e} .blocklyEditableText>rect:not(.blocklyDropdownRect) {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"}",`${e} .blocklyNonEditableText>text,`,`${e} .blocklyEditableText>text,`,`${e} .blocklyNonEditableText>g>text,`,`${e} .blocklyEditableText>g>text {`,"fill: #575E75;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #575E75;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #575E75;","}",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableText:not(.editing):hover>rect,",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",`${e} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"color: #575E75;","}",`${e} .blocklyDropdownText {`,"fill: #fff !important;","}",`${e}.blocklyWidgetDiv .blocklyMenuItem,`,`${e}.blocklyDropDownDiv .blocklyMenuItem {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e}.blocklyDropDownDiv .blocklyMenuItemContent {`,"color: #fff;","}",`${e} .blocklyHighlightedConnectionPath {`,`stroke: ${this.SELECTED_GLOW_COLOUR};`,"}",`${e} .blocklyDisabled > .blocklyOutlinePath {`,`fill: url(#blocklyDisabledPattern${this.randomIdentifier})`,"}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"]}},Jv=class extends Nl{constructor(e,t){super(e,t)}draw(){const e=this.block_.pathObject;e.beginDrawing(),this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),e.setPath(this.outlinePath_+`
886
+ `+this.inlinePath_),this.info_.RTL&&e.flipRTL(),this.recordSizeOnBlock_(),this.info_.outputConnection&&(e.outputShapeType=this.info_.outputConnection.shape.type),e.endDrawing()}drawOutline_(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):super.drawOutline_()}drawLeft_(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():super.drawLeft_()}drawRightSideRow_(e){if(!(0>=e.height)){if(S.isSpacer(e)){const n=e.precedesStatement;var t=e.followsStatement;if(n||t){const c=this.constants_.INSIDE_CORNERS;var o=c.rightHeight;o=e.height-(n?o:0),t=t?c.pathBottomRight:"",e=0<o?ne("V",e.yPos+o):"",this.outlinePath_+=t+e+(n?c.pathTopRight:"");return}}this.outlinePath_+=ne("V",e.yPos+e.height)}}drawRightDynamicConnection_(){if(!this.info_.outputConnection)throw Error("Cannot draw the output connection of a block that doesn't have one");this.outlinePath_+=this.info_.outputConnection.shape.pathRightDown(this.info_.outputConnection.height)}drawLeftDynamicConnection_(){if(!this.info_.outputConnection)throw Error("Cannot draw the output connection of a block that doesn't have one");this.positionOutputConnection_(),this.outlinePath_+=this.info_.outputConnection.shape.pathUp(this.info_.outputConnection.height),this.outlinePath_+="z"}drawFlatTop_(){const e=this.info_.topRow;this.positionPreviousConnection_(),this.outlinePath_+=at(e.xPos,this.info_.startY),this.outlinePath_+=ne("h",e.width)}drawFlatBottom_(){const e=this.info_.bottomRow;this.positionNextConnection_(),this.outlinePath_+=ne("V",e.baseline),this.outlinePath_+=ne("h",-e.width)}drawInlineInput_(e){this.positionInlineInputConnection_(e);const t=e.input.name;e.connectedBlock||this.info_.isInsertionMarker||(e=wt(e.xPos+e.connectionWidth,e.centerline-e.height/2)+this.getInlineInputPath(e),this.block_.pathObject.setOutlinePath(t,e))}getInlineInputPath(e){const t=e.width-2*e.connectionWidth,o=e.height;return ne("h",t)+e.shape.pathRightDown(o)+ne("h",-t)+e.shape.pathUp(o)+"z"}drawStatementInput_(e){var t=e.getLastInput();const o=t.xPos+t.notchOffset+t.shape.width,n=this.constants_.INSIDE_CORNERS,c=t.shape.pathRight+ne("h",-(t.notchOffset-n.width))+n.pathTop,h=e.height-2*n.height;t=n.pathBottom+ne("h",t.notchOffset-n.width)+(t.connectedBottomNextConnection?"":t.shape.pathLeft),this.outlinePath_+=ne("H",o)+c+ne("v",h)+t+ne("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}drawConnectionHighlightPath(e){const t=e.connectionModel;if(t.type===oe.NEXT_STATEMENT||t.type===oe.PREVIOUS_STATEMENT||t.type===oe.OUTPUT_VALUE&&!e.isDynamicShape)super.drawConnectionHighlightPath(e);else{e=t.type===oe.INPUT_VALUE?wt(e.connectionWidth,-e.height/2)+this.getInlineInputPath(e):wt(e.width,-e.height/2)+e.shape.pathDown(e.height);var o=t.getSourceBlock(),n,c;(c=(n=o.pathObject).addConnectionHighlight)==null||c.call(n,t,e,t.getOffsetInBlock(),o.RTL)}}},mi=class extends Qe{constructor(e,t,o,n,c,h,$){if(super(Qe.SKIP_SETUP),this.imageElement=this.clickHandler=null,this.flipRtl=this.isDirty_=this.EDITABLE=!1,this.altText="",o=Number(pt(o)),t=Number(pt(t)),isNaN(o)||isNaN(t))throw Error("Height and width values of an image field must cast to numbers.");if(0>=o||0>=t)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new Le(t,o+mi.Y_PADDING),this.imageHeight=o,typeof c=="function"&&(this.clickHandler=c),e!==Qe.SKIP_SETUP&&($?this.configure_($):(this.flipRtl=!!h,this.altText=pt(n)||""),this.setValue(pt(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=pt(e.alt))}initView(){this.imageElement=N(x.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(es,"xlink:href",this.value_),this.clickHandler&&(this.imageElement.style.cursor="pointer")}updateSize_(){}doClassValidation_(e){return typeof e!="string"?null:e}doValueUpdate_(e){this.value_=e,this.imageElement&&this.imageElement.setAttributeNS(es,"xlink:href",this.value_)}getFlipRtl(){return this.flipRtl}setAlt(e){e!==this.altText&&(this.altText=e||"",this.imageElement&&this.imageElement.setAttribute("alt",this.altText))}showEditor_(){this.clickHandler&&this.clickHandler(this)}setOnClickHandler(e){this.clickHandler=e}getText_(){return this.altText}static fromJson(e){if(!e.src||!e.width||!e.height)throw Error("src, width, and height values for an image field arerequired. The width and height must be non-zero.");return new this(e.src,e.width,e.height,void 0,void 0,void 0,e)}};mi.Y_PADDING=1,Ps("field_image",mi),mi.prototype.DEFAULT_VALUE="";var Hl=class extends Qe{constructor(e,t,o){super(Qe.SKIP_SETUP),this.spellcheck_=!0,this.htmlInput_=null,this.isTextValid_=this.isBeingEdited_=!1,this.onKeyInputWrapper=this.onKeyDownWrapper=this.valueWhenEditorWasOpened_=null,this.fullBlockClickTarget_=!1,this.workspace_=null,this.SERIALIZABLE=!0,this.CURSOR="text",e!==Qe.SKIP_SETUP&&(o&&this.configure_(o),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.spellcheck!==void 0&&(this.spellcheck_=e.spellcheck)}initView(){if(!this.getSourceBlock())throw new ft;super.initView(),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot())}isFullBlockField(){const e=this.getSourceBlock();if(!e)throw new ft;let t;return this.fullBlockClickTarget_=!((t=this.getConstants())==null||!t.FULL_BLOCK_FIELDS)&&e.isSimpleReporter()}doValueInvalid_(e,t=!0){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,e=this.value_,this.value_=this.valueWhenEditorWasOpened_,this.sourceBlock_&&K()&&this.value_!==e&&t&&z(new(G(O.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,e,this.value_)))}doValueUpdate_(e){this.isTextValid_=this.isDirty_=!0,this.value_=e}applyColour(){const e=this.getSourceBlock();if(!e)throw new ft;this.getConstants().FULL_BLOCK_FIELDS&&this.fieldGroup_&&(!this.isFullBlockField()&&this.borderRect_?(this.borderRect_.style.display="block",this.borderRect_.setAttribute("stroke",e.getColourTertiary())):(this.borderRect_.style.display="none",e.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR)))}getSize(){let e;return(e=this.getConstants())!=null&&e.FULL_BLOCK_FIELDS&&(this.render_(),this.isDirty_=!1),super.getSize()}onLocationChange(){this.isBeingEdited_&&this.resizeEditor_()}render_(){if(super.render_(),this.isBeingEdited_){var e=this.htmlInput_;this.isTextValid_?(ot(e,"blocklyInvalidInput"),It(e,Ct.INVALID,!1)):(ge(e,"blocklyInvalidInput"),It(e,Ct.INVALID,!0))}if(e=this.getSourceBlock(),!e)throw new ft;this.getConstants().FULL_BLOCK_FIELDS&&e.applyColour()}setSpellcheck(e){e!==this.spellcheck_&&(this.spellcheck_=e,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}showEditor_(e,t=!1){this.workspace_=this.sourceBlock_.workspace,!t&&this.workspace_.options.modalInputs&&(Db||yh||nl)?this.showPromptEditor():this.showInlineEditor(t)}showPromptEditor(){Ta(i.Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),e=>{e!==null&&this.setValue(this.getValueFromEditorText_(e)),this.onFinishEditing_(this.value_)})}showInlineEditor(e){const t=this.getSourceBlock();if(!t)throw new ft;Pa(this,t.RTL,this.widgetDispose_.bind(this),this.workspace_),this.htmlInput_=this.widgetCreate_(),this.isBeingEdited_=!0,this.valueWhenEditorWasOpened_=this.value_,e||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}widgetCreate_(){var e=this.getSourceBlock();if(!e)throw new ft;i.setGroup$$module$build$src$core$events$utils(!0);const t=Yo();var o=this.getClickTarget_();if(!o)throw Error("A click target has not been set.");ge(o,"editing"),o=document.createElement("input"),o.className="blocklyHtmlInput",o.setAttribute("spellcheck",this.spellcheck_);const n=this.workspace_.getScale();var c=this.getConstants().FIELD_TEXT_FONTSIZE*n+"pt";return t.style.fontSize=c,o.style.fontSize=c,c=Hl.BORDERRADIUS*n+"px",this.isFullBlockField()&&(c=this.getScaledBBox(),c=(c.bottom-c.top)/2+"px",e=e.getParent()?e.getParent().getColourTertiary():this.sourceBlock_.getColourTertiary(),o.style.border=1*n+"px solid "+e,t.style.borderRadius=c,t.style.transition="box-shadow 0.25s ease 0s",this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(t.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*n+"px")),o.style.borderRadius=c,t.appendChild(o),o.value=o.defaultValue=this.getEditorText_(this.value_),o.setAttribute("data-untyped-default-value",String(this.value_)),this.resizeEditor_(),this.bindInputEvents_(o),o}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&K()&&this.valueWhenEditorWasOpened_!==null&&this.valueWhenEditorWasOpened_!==this.value_&&(z(new(G(O.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),i.setGroup$$module$build$src$core$events$utils(!1),this.unbindInputEvents_();var e=Yo().style;if(e.width="auto",e.height="auto",e.fontSize="",e.transition="",e.boxShadow="",this.htmlInput_=null,e=this.getClickTarget_(),!e)throw Error("A click target has not been set.");ot(e,"editing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper=X(e,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper=X(e,"input",this,this.onHtmlInputChange)}unbindInputEvents_(){this.onKeyDownWrapper&&(ze(this.onKeyDownWrapper),this.onKeyDownWrapper=null),this.onKeyInputWrapper&&(ze(this.onKeyInputWrapper),this.onKeyInputWrapper=null)}onHtmlInputKeyDown_(e){e.key==="Enter"?(Jo(this),Ns()):e.key==="Escape"?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),Jo(this),Ns()):e.key==="Tab"&&(Jo(this),Ns(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())}onHtmlInputChange(e){e=this.value_,this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&K()&&this.value_!==e&&z(new(G(O.BLOCK_FIELD_INTERMEDIATE_CHANGE))(this.sourceBlock_,this.name||null,e,this.value_))}setEditorValue_(e,t=!0){this.isDirty_=!0,this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(e)),this.setValue(e,t)}resizeEditor_(){ws().then(()=>{const e=this.getSourceBlock();if(!e)throw new ft;const t=Yo(),o=this.getScaledBBox();t.style.width=o.right-o.left+"px",t.style.height=o.bottom-o.top+"px";const n=o.top;t.style.left=`${e.RTL?o.right-t.offsetWidth:o.left}px`,t.style.top=`${n}px`})}repositionForWindowResize(){let e;const t=(e=this.getSourceBlock())==null?void 0:e.getRootBlock();return t instanceof gs?(zi(this.workspace_,this.workspace_.getMetricsManager().getViewMetrics(!0),t)||this.resizeEditor_(),!0):!1}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(e){return`${e}`}getValueFromEditorText_(e){return e}};Hl.BORDERRADIUS=4;var Wl=class extends Hl{constructor(e,t,o){super(e,t,o)}doClassValidation_(e){return e===void 0?null:`${e}`}static fromJson(e){return new this(pt(e.text),void 0,e)}};Ps("field_input",Wl),Wl.prototype.DEFAULT_VALUE="";var qv=class extends ip{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){return!!e.outputConnection}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},Vl=class extends wr{constructor(e,t){if(super(e,t),this.connectedBottomNextConnection=!1,this.connectedBlock){for(e=this.connectedBlock;t=e.getNextBlock();)e=t;e.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}}},Xv=class extends zs{constructor(e){super(e),this.width=this.height=0,this.type|=S.getType("RIGHT_CONNECTION")}},Zv=class extends cp{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){const t=(e.hat?e.hat==="cap":this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection;return!!e.outputConnection||t}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},Qv=class extends kr{constructor(e,t){super(e,t),this.isInline=!0,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.topRow=new Zv(this.constants_),this.bottomRow=new qv(this.constants_),this.isMultiRow=!t.getInputsInline()||t.isCollapsed(),this.hasStatementInput=0<t.statementInputCount,this.rightSide=this.outputConnection?new Xv(this.constants_):null,this.rightAlignedDummyInputs=new WeakMap}getRenderer(){return this.renderer_}measure(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.adjustXPosition_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()}shouldStartNewRow_(e,t){return t?t instanceof fo||e instanceof is||t instanceof is?!0:e instanceof i.ValueInput$$module$build$src$core$inputs$value_input||e instanceof Us||e instanceof fo?!this.isInline||this.isMultiRow:!1:!1}getDesiredRowWidth_(e){return e.hasStatement?this.width-this.startX-(this.constants_.INSIDE_CORNERS.rightWidth||0):super.getDesiredRowWidth_(e)}getInRowSpacing_(e,t){return e&&t||!this.outputConnection||!this.outputConnection.isDynamicShape||this.hasStatementInput||this.bottomRow.hasNextConnection?!e&&t&&S.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:e&&S.isLeftRoundedCorner(e)&&t&&(S.isPreviousConnection(t)||S.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&S.isLeftSquareCorner(e)&&t&&S.isHat(t)?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING}getSpacerRowHeight_(e,t){if(S.isTopRow(e)&&S.isBottomRow(t))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;const o=S.isInputRow(e)&&e.hasStatement,n=S.isInputRow(t)&&t.hasStatement;return n||o?(e=Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.INSIDE_CORNERS.rightHeight||0),n&&o?Math.max(e,this.constants_.DUMMY_INPUT_MIN_HEIGHT):e):S.isTopRow(e)?e.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):S.isBottomRow(t)?this.outputConnection?!t.hasNextConnection&&this.hasStatementInput?Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):this.constants_.NO_PADDING:Math.max(this.topRow.minHeight,Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.CORNER_RADIUS))-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING}getSpacerRowWidth_(e,t){const o=this.width-this.startX;return S.isInputRow(e)&&e.hasStatement||S.isInputRow(t)&&t.hasStatement?Math.max(o,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):o}getElemCenterline_(e,t){if(e.hasStatement&&!S.isSpacer(t)&&!S.isStatementInput(t))return e.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(S.isInlineInput(t)&&t instanceof Ro){const o=t.connectedBlock;if(o&&o.outputConnection&&o.nextConnection)return e.yPos+o.height/2}return super.getElemCenterline_(e,t)}addInput_(e,t){if((e instanceof Us||e instanceof fo)&&t.hasDummyInput&&t.align===i.Align$$module$build$src$core$inputs$align.LEFT&&e.align===i.Align$$module$build$src$core$inputs$align.RIGHT)this.rightAlignedDummyInputs.set(t,e);else if(e instanceof is){t.elements.push(new Vl(this.constants_,e)),t.hasStatement=!0,t.align===null&&(t.align=e.align);return}super.addInput_(e,t)}addAlignmentPadding_(e,t){if(this.rightAlignedDummyInputs.get(e)){let o;for(let n=0;n<e.elements.length;n++){const c=e.elements[n];if(S.isSpacer(c)&&(o=c),S.isField(c)&&c instanceof on&&c.parentInput===this.rightAlignedDummyInputs.get(e))break}if(o){o.width+=t,e.width+=t;return}}super.addAlignmentPadding_(e,t)}adjustXPosition_(){const e=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH;let t=e;for(let c=2;c<this.rows.length-1;c+=2){var o=this.rows[c-1];const h=this.rows[c];var n=this.rows[c+1];if(o=c===2?!!this.topRow.hasPreviousConnection:!!o.followsStatement,n=c+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!n.precedesStatement,S.isInputRow(h)&&h.hasStatement){h.measure();let $,T;t=h.width-((T=($=h.getLastInput())==null?void 0:$.width)!=null?T:0)+e}else if(o&&(c===2||n)&&S.isInputRow(h)&&!h.hasStatement){n=h.xPos,o=null;for(let $=0;$<h.elements.length;$++){const T=h.elements[$];S.isSpacer(T)&&(o=T),o&&(S.isField(T)||S.isInput(T))&&n<t&&!(S.isField(T)&&T instanceof on&&(T.field instanceof hi||T.field instanceof mi))&&(o.width+=t-n),n+=T.width}}}}finalizeOutputConnection_(){if(this.outputConnection&&this.outputConnection.isDynamicShape){var e=this.outputConnection.shape;if("isDynamic"in e&&e.isDynamic){for(var t=0,o=0;o<this.rows.length;o++){const n=this.rows[o];n.yPos=t,t+=n.height}this.height=t,o=this.bottomRow.hasNextConnection?this.height-this.bottomRow.descenderHeight:this.height,t=e.height(o),o=e.width(o),this.outputConnection.height=t,this.outputConnection.width=o,this.outputConnection.startX=o,this.outputConnection.connectionOffsetY=e.connectionOffsetY(t),this.outputConnection.connectionOffsetX=e.connectionOffsetX(o),e=0,this.hasStatementInput||this.bottomRow.hasNextConnection||(e=o,this.rightSide.height=t,this.rightSide.width=e,this.rightSide.centerline=t/2,this.rightSide.xPos=this.width+e),this.startX=o,this.width+=o+e,this.widthWithChildren+=o+e}}}finalizeHorizontalAlignment_(){if(this.outputConnection&&!this.hasStatementInput&&!this.bottomRow.hasNextConnection){for(var e=0,t=0;t<this.rows.length;t++){var o=this.rows[t];if(!S.isInputRow(o))continue;e=o.elements[o.elements.length-2];let n=this.getNegativeSpacing_(o.elements[1]),c=this.getNegativeSpacing_(e);e=n+c;const h=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-e<h&&(e=this.width-h,n=e/2,c=e/2),o.elements.unshift(new os(this.constants_,-n)),o.elements.push(new os(this.constants_,-c))}if(e)for(this.width-=e,this.widthWithChildren-=e,this.rightSide.xPos-=e,t=0;t<this.rows.length;t++)o=this.rows[t],S.isTopOrBottomRow(o)&&(o.elements[1].width-=e),o.width-=e,o.widthWithConnectedBlocks-=e}}getNegativeSpacing_(e){if(!e||!this.outputConnection)return 0;const t=this.outputConnection.width;var o=this.outputConnection.shape.type;const n=this.constants_;if(1<this.inputRows.length)return o===n.SHAPES.ROUND?(o=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,o=this.height/2>o?o:this.height/2,t-o*(1-Math.sin(Math.acos((o-this.constants_.SMALL_PADDING)/o)))):0;if(S.isInlineInput(e)&&e instanceof Ro){const c=e.connectedBlock;return e=c?c.pathObject.outputShapeType:e.shape.type,e==null||c&&c.outputConnection&&(c.statementInputCount||c.nextConnection)||o===n.SHAPES.HEXAGONAL&&o!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[o][e]}return S.isField(e)&&e instanceof on?o===n.SHAPES.ROUND&&e.field instanceof Wl?t-2.75*n.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[o][0]:S.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let n=2;n<this.rows.length-1;n+=2){const c=this.rows[n-1],h=this.rows[n],$=this.rows[n+1];var e=n===2,t=n+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!$.precedesStatement;if(e?this.topRow.hasPreviousConnection:c.followsStatement){var o=h.elements[1];if(o=h.elements.length===3&&o instanceof on&&(o.field instanceof hi||o.field instanceof mi),!e&&o)c.height-=this.constants_.SMALL_PADDING,$.height-=this.constants_.SMALL_PADDING,h.height-=this.constants_.MEDIUM_PADDING;else if(!e&&!t)c.height+=this.constants_.SMALL_PADDING;else if(t){for(e=!1,t=0;t<h.elements.length;t++)if(o=h.elements[t],o instanceof Ro&&S.isInlineInput(o)&&o.connectedBlock&&!o.connectedBlock.isShadow()&&40<=o.connectedBlock.getHeightWidth().height){e=!0;break}e&&(c.height-=this.constants_.SMALL_PADDING,$.height-=this.constants_.SMALL_PADDING)}}}}finalize_(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),super.finalize_(),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},ey=class extends hp{constructor(e,t,o){super(e,t,o),this.markerCircle=null}showWithInputOutput(e){const t=e.getSourceBlock();e=e.getLocation().getOffsetInBlock(),this.positionCircle(e.x,e.y),this.setParent_(t),this.showCurrent_()}showWithOutput_(e){this.showWithInputOutput(e)}showWithInput_(e){this.showWithInputOutput(e)}showWithBlock_(e){e=e.getLocation();const t=e.getHeightWidth();this.positionRect_(0,0,t.width,t.height),this.setParent_(e),this.showCurrent_()}positionCircle(e,t){let o;(o=this.markerCircle)==null||o.setAttribute("cx",`${e}`);let n;(n=this.markerCircle)==null||n.setAttribute("cy",`${t}`),this.currentMarkerSvg=this.markerCircle}hide(){super.hide(),this.markerCircle&&(this.markerCircle.style.display="none")}createDomInternal_(){if(super.createDomInternal_(),this.markerCircle=N(x.CIRCLE,{r:this.constants_.CURSOR_RADIUS,"stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.hide(),this.isCursor()){const e=this.getBlinkProperties_();N(x.ANIMATE,e,this.markerCircle)}return this.markerSvg_}applyColour_(e){super.applyColour_(e);let t;(t=this.markerCircle)==null||t.setAttribute("fill",this.colour_);let o;if((o=this.markerCircle)==null||o.setAttribute("stroke",this.colour_),this.isCursor()){e=this.colour_+";transparent;transparent;";let n;(n=this.markerCircle)==null||n.firstElementChild.setAttribute("values",e)}}},ty=class extends Ll{constructor(e,t,o){super(e,t,o),this.svgPathSelected=null,this.outlines=new Map,this.remainingOutlines=new Set,this.outputShapeType=null,this.constants=o}setPath(e){super.setPath(e),this.svgPathSelected&&this.svgPathSelected.setAttribute("d",e)}applyColour(e){super.applyColour(e);const t=e.getParent();e.isShadow()&&t&&this.svgPath.setAttribute("stroke",t.getColourTertiary());for(const o of this.outlines.values())o.setAttribute("fill",this.style.colourTertiary)}flipRTL(){super.flipRTL();for(const e of this.outlines.values())e.setAttribute("transform","scale(-1 1)")}updateSelected(e){this.setClass_("blocklySelected",e),e?this.svgPathSelected||(this.svgPathSelected=this.svgPath.cloneNode(!0),this.svgPathSelected.setAttribute("fill","none"),this.svgPathSelected.setAttribute("filter","url(#"+this.constants.selectedGlowFilterId+")"),this.svgRoot.appendChild(this.svgPathSelected)):this.svgPathSelected&&(this.svgRoot.removeChild(this.svgPathSelected),this.svgPathSelected=null)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e),e?this.svgPath.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):this.svgPath.removeAttribute("filter")}updateShapeForInputHighlight(e,t){e=e.getParentInput().name,(e=this.getOutlinePath(e))&&(t?e.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):e.removeAttribute("filter"))}beginDrawing(){this.remainingOutlines.clear();for(const e of this.outlines.keys())this.remainingOutlines.add(e)}endDrawing(){if(this.remainingOutlines.size)for(const e of this.remainingOutlines)this.removeOutlinePath(e);this.remainingOutlines.clear()}setOutlinePath(e,t){e=this.getOutlinePath(e),e.setAttribute("d",t),e.setAttribute("fill",this.style.colourTertiary)}getOutlinePath(e){return this.outlines.has(e)||this.outlines.set(e,N(x.PATH,{class:"blocklyOutlinePath",d:""},this.svgRoot)),this.remainingOutlines.delete(e),this.outlines.get(e)}removeOutlinePath(e){let t,o;(t=this.outlines.get(e))==null||(o=t.parentNode)==null||o.removeChild(this.outlines.get(e)),this.outlines.delete(e)}},xp=class extends Pl{constructor(e){super(e)}makeConstants_(){return new Yv}makeRenderInfo_(e){return new Qv(this,e)}makeDrawer_(e,t){return new Jv(e,t)}makeMarkerDrawer(e,t){return new ey(e,this.getConstants(),t)}makePathObject(e,t){return new ty(e,t,this.getConstants())}getConstants(){return this.constants_}getConnectionPreviewMethod(e,t,o){return y("getConnectionPreviewMethod","v10","v12","an IConnectionPreviewer, if it fulfills your use case."),t.type===oe.OUTPUT_VALUE?e.isConnected()?ps.PREVIEW_TYPE.REPLACEMENT_FADE:ps.PREVIEW_TYPE.INPUT_OUTLINE:super.getConnectionPreviewMethod(e,t,o)}};er("zelos",xp);var sy=class{constructor(e){this.staticConn=this.draggedConn=this.markerConn=this.fadedBlock=null,this.workspace=e.workspace}previewReplacement(e,t,o){i.disable$$module$build$src$core$events$utils();try{this.hidePreview(),this.fadedBlock=o,o.fadeForReplacement(!0),this.workspace.getRenderer().shouldHighlightConnection(t)&&(t.highlight(),this.staticConn=t)}finally{i.enable$$module$build$src$core$events$utils()}}previewConnection(e,t){if(e!==this.draggedConn||t!==this.staticConn){i.disable$$module$build$src$core$events$utils();try{this.hidePreview(),this.shouldUseMarkerPreview(e,t)&&(this.markerConn=this.previewMarker(e,t)),this.workspace.getRenderer().shouldHighlightConnection(t)&&t.highlight(),this.draggedConn=e,this.staticConn=t}finally{i.enable$$module$build$src$core$events$utils()}}}shouldUseMarkerPreview(e,t){return t.type===oe.PREVIOUS_STATEMENT||t.type===oe.NEXT_STATEMENT||!(this.workspace.getRenderer()instanceof xp)}previewMarker(e,t){const o=e.getSourceBlock(),n=this.createInsertionMarker(o),c=this.getMatchingConnection(o,n,e);if(!c)return null;n.queueRender(),Qs(),c.connect(t);const h={x:t.x-c.x,y:t.y-c.y},$=c.getOffsetInBlock().clone();return ws().then(()=>{if(!n.isDeadOrDying()){i.disable$$module$build$src$core$events$utils();try{n==null||n.positionNearConnection(c,h,$),n==null||n.getSvgRoot().setAttribute("visibility","visible")}finally{i.enable$$module$build$src$core$events$utils()}}}),c}createInsertionMarker(e){const t=Qt(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!t)throw Error(`Failed to serialize source block. ${e.toDevString()}`);e=eo(t,this.workspace);for(const o of e.getDescendants(!1))o.setInsertionMarker(!0);return e.initSvg(),e.getSvgRoot().setAttribute("visibility","hidden"),e}getMatchingConnection(e,t,o){if(e=e.getConnections_(!0),t=t.getConnections_(!0),e.length!==t.length)return null;for(let n=0;n<e.length;n++)if(e[n]===o)return t[n];return null}hidePreview(){i.disable$$module$build$src$core$events$utils();try{this.staticConn&&(this.staticConn.unhighlight(),this.staticConn=null),this.fadedBlock&&(this.fadedBlock.fadeForReplacement(!1),this.fadedBlock=null),this.markerConn&&(this.hideInsertionMarker(this.markerConn),this.draggedConn=this.markerConn=null)}finally{i.enable$$module$build$src$core$events$utils()}}hideInsertionMarker(e){const t=e.getSourceBlock(),o=t.outputConnection;let n;if((n=t.previousConnection)!=null&&n.targetConnection||o!=null&&o.targetConnection)t.unplug(!0);else{let c;(c=e.targetBlock())==null||c.unplug(!1)}t.dispose()}dispose(){this.hidePreview()}};r(F.CONNECTION_PREVIEWER,js,sy);var Lo={};Lo.Align=i.Align$$module$build$src$core$inputs$align,Lo.DummyInput=Us,Lo.EndRowInput=fo,Lo.Input=nn,Lo.StatementInput=is,Lo.ValueInput=i.ValueInput$$module$build$src$core$inputs$value_input,Lo.inputTypes=i.inputTypes$$module$build$src$core$inputs$input_types;var oy=!1,iy;i.CodeGenerator$$module$build$src$core$generator=class{constructor(e){this.forBlock=Object.create(null),this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}",this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null,this.INDENT=" ",this.COMMENT_WRAP=60,this.ORDER_OVERRIDES=[],this.isInitialized=null,this.RESERVED_WORDS_="",this.definitions_=Object.create(null),this.functionNames_=Object.create(null),this.nameDB_=void 0,this.name_=e,this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=U());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let o=0,n;n=e[o];o++){let c=this.blockToCode(n);Array.isArray(c)&&(c=c[0]),c&&(n.outputConnection&&(c=this.scrubNakedValue(c),this.STATEMENT_PREFIX&&!n.suppressPrefixSuffix&&(c=this.injectId(this.STATEMENT_PREFIX,n)+c),this.STATEMENT_SUFFIX&&!n.suppressPrefixSuffix&&(c+=this.injectId(this.STATEMENT_SUFFIX,n))),t.push(c))}return t=t.join(`
887
+ `),t=this.finish(t),t=t.replace(/^\s+\n/,""),t=t.replace(/\n\s+$/,`
888
+ `),t=t.replace(/[ \t]+\n/g,`
889
+ `)}prefixLines(e,t){return t+e.replace(/(?!\n$)\n/g,`
890
+ `+t)}allNestedComments(e){const t=[];e=e.getDescendants(!0);for(let o=0;o<e.length;o++){const n=e[o].getCommentText();n&&t.push(n)}return t.length&&t.push(""),t.join(`
891
+ `)}blockToCode(e,t){if(this.isInitialized===!1&&console.warn("CodeGenerator init was not called before blockToCode was called."),!e)return"";if(!e.isEnabled())return t?"":this.blockToCode(e.getNextBlock());if(e.isInsertionMarker())return t?"":this.blockToCode(e.getChildren(!1)[0]);var o=this.forBlock[e.type];if(typeof o!="function")throw Error(`${this.name_} generator does not know how to generate code for block type "${e.type}".`);if(o=o.call(e,e,this),Array.isArray(o)){if(!e.outputConnection)throw TypeError("Expecting string from statement block: "+e.type);return[this.scrub_(e,o[0],t),o[1]]}if(typeof o=="string")return this.STATEMENT_PREFIX&&!e.suppressPrefixSuffix&&(o=this.injectId(this.STATEMENT_PREFIX,e)+o),this.STATEMENT_SUFFIX&&!e.suppressPrefixSuffix&&(o+=this.injectId(this.STATEMENT_SUFFIX,e)),this.scrub_(e,o,t);if(o===null)return"";throw SyntaxError("Invalid code generated: "+o)}valueToCode(e,t,o){if(isNaN(o))throw TypeError("Expecting valid order from block: "+e.type);var n=e.getInputTargetBlock(t);if(!n&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if(!n||(t=this.blockToCode(n),t===""))return"";if(!Array.isArray(t))throw TypeError(`Expecting tuple from value block: ${n.type} See developers.google.com/blockly/guides/create-custom-blocks/generating-code for more information`);if(e=t[0],t=t[1],isNaN(t))throw TypeError("Expecting valid order from value block: "+n.type);if(!e)return"";n=!1;var c=Math.floor(o);const h=Math.floor(t);if(c<=h&&(c!==h||c!==0&&c!==99)){for(n=!0,c=0;c<this.ORDER_OVERRIDES.length;c++)if(this.ORDER_OVERRIDES[c][0]===o&&this.ORDER_OVERRIDES[c][1]===t){n=!1;break}}return n&&(e="("+e+")"),e}statementToCode(e,t){const o=e.getInputTargetBlock(t);if(!o&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if(e=this.blockToCode(o),typeof e!="string")throw TypeError("Expecting code from statement block: "+(o&&o.type));return e&&(e=this.prefixLines(e,this.INDENT)),e}addLoopTrap(e,t){return this.INFINITE_LOOP_TRAP&&(e=this.prefixLines(this.injectId(this.INFINITE_LOOP_TRAP,t),this.INDENT)+e),this.STATEMENT_SUFFIX&&!t.suppressPrefixSuffix&&(e=this.prefixLines(this.injectId(this.STATEMENT_SUFFIX,t),this.INDENT)+e),this.STATEMENT_PREFIX&&!t.suppressPrefixSuffix&&(e+=this.prefixLines(this.injectId(this.STATEMENT_PREFIX,t),this.INDENT)),e}injectId(e,t){return t=t.id.replace(/\$/g,"$$$$"),e.replace(/%1/g,"'"+t+"'")}addReservedWords(e){this.RESERVED_WORDS_+=e+","}provideFunction_(e,t){if(!this.definitions_[e]){const o=this.nameDB_.getDistinctName(e,i.NameType$$module$build$src$core$names.PROCEDURE);this.functionNames_[e]=o,Array.isArray(t)&&(t=t.join(`
892
+ `)),t=t.trim().replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,o);let n;for(;n!==t;)n=t,t=t.replace(/^(( {2})*) {2}/gm,"$1\0");t=t.replace(/\0/g,this.INDENT),this.definitions_[e]=t}return this.functionNames_[e]}getVariableName(e){return this.getName(e,i.NameType$$module$build$src$core$names.VARIABLE)}getProcedureName(e){return this.getName(e,i.NameType$$module$build$src$core$names.PROCEDURE)}getName(e,t){if(!this.nameDB_)throw Error("Name database is not defined. You must initialize `nameDB_` in your generator class and call `init` first.");return this.nameDB_.getName(e,t)}init(e){this.definitions_=Object.create(null),this.functionNames_=Object.create(null)}scrub_(e,t,o){return t}finish(e){return this.definitions_=Object.create(null),this.functionNames_=Object.create(null),e}scrubNakedValue(e){return e}},iy={},iy.CodeGenerator=i.CodeGenerator$$module$build$src$core$generator;var ny=class extends Ip{constructor(e,t){super(e),this.flyout_=t}getBoundingBox(){let e;try{e=this.workspace_.getCanvas().getBBox()}catch{e={height:0,y:0,width:0,x:0}}return e}getContentMetrics(e){const t=this.getBoundingBox();return e=e?1:this.workspace_.scale,{height:t.height*e,width:t.width*e,top:t.y*e,left:t.x*e}}getScrollMetrics(e,t,o){return t=o||this.getContentMetrics(),o=this.flyout_.MARGIN*this.workspace_.scale,e=e?this.workspace_.scale:1,{height:(t.height+2*o)/e,width:(t.width+t.left+o)/e,top:0,left:0}}},un;(function(e){e.BLOCK="block",e.BUTTON="button"})(un||(un={}));var dk="WORKSPACE_AT_BLOCK_CAPACITY",Gl=class extends jl{constructor(e){super(),this.horizontalLayout=!1,this.boundEvents=[],this.filterWrapper=this.reflowWrapper=null,this.mats=[],this.buttons_=[],this.contents=[],this.listeners=[],this.permanentlyDisabled=[],this.recycledBlocks=[],this.autoClose=!0,this.visible=!1,this.containerVisible=!0,this.CORNER_RADIUS=8,this.SCROLLBAR_MARGIN=2.5,this.height_=this.width_=0,this.dragAngleRange_=70,this.svgGroup_=this.svgBackground_=null,e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new ns(e),this.workspace_.setMetricsManager(new ny(this.workspace_,this)),this.workspace_.internalIsFlyout=!0,this.workspace_.setVisible(this.visible),this.id=C(),this.RTL=!!e.RTL,this.toolboxPosition_=e.toolboxPosition,this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH,this.rectMap_=new WeakMap,this.MARGIN=this.CORNER_RADIUS,this.GAP_X=3*this.MARGIN,this.GAP_Y=3*this.MARGIN}createDom(e){return this.svgGroup_=N(e,{class:"blocklyFlyout"}),this.svgGroup_.style.display="none",this.svgBackground_=N(x.PATH,{class:"blocklyFlyoutBackground"},this.svgGroup_),this.svgGroup_.appendChild(this.workspace_.createDom()),this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutBackgroundColour","fill"),this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutOpacity","fill-opacity"),this.svgGroup_}init(e){this.targetWorkspace=e,this.workspace_.targetWorkspace=e,this.workspace_.scrollbar=new Ep(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),this.boundEvents.push(X(this.svgGroup_,"wheel",this,this.wheel_)),this.filterWrapper=this.filterForCapacity.bind(this),this.targetWorkspace.addChangeListener(this.filterWrapper),this.boundEvents.push(X(this.svgBackground_,"pointerdown",this,this.onMouseDown)),this.workspace_.getGesture=this.targetWorkspace.getGesture.bind(this.targetWorkspace),this.workspace_.setVariableMap(this.targetWorkspace.getVariableMap()),this.workspace_.createPotentialVariableMap(),e.getComponentManager().addComponent({component:this,weight:lt.ComponentWeight.FLYOUT_WEIGHT,capabilities:[lt.Capability.AUTOHIDEABLE,lt.Capability.DELETE_AREA,lt.Capability.DRAG_TARGET]})}dispose(){this.hide(),this.targetWorkspace.getComponentManager().removeComponent(this.id);for(const e of this.boundEvents)ze(e);this.boundEvents.length=0,this.filterWrapper&&this.targetWorkspace.removeChangeListener(this.filterWrapper),this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.dispose()),this.svgGroup_&&Ke(this.svgGroup_)}getWidth(){return this.width_}getHeight(){return this.height_}getFlyoutScale(){return this.targetWorkspace.scale}getWorkspace(){return this.workspace_}setAutoClose(e){this.autoClose=e,this.targetWorkspace.recordDragTargets(),this.targetWorkspace.resizeContents()}autoHide(e){!e&&this.targetWorkspace.getFlyout(!0)===this&&this.autoClose&&this.hide()}getTargetWorkspace(){return this.targetWorkspace}isVisible(){return this.visible}setVisible(e){const t=e!==this.isVisible();this.visible=e,t&&(this.autoClose||this.targetWorkspace.recordDragTargets(),this.updateDisplay())}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay()}getContents(){return this.contents}setContents(e){this.contents=e}updateDisplay(){let e;e=this.containerVisible?this.isVisible():!1,this.svgGroup_&&(this.svgGroup_.style.display=e?"block":"none");let t;(t=this.workspace_.scrollbar)==null||t.setContainerVisible(e)}positionAt_(e,t,o,n){let c;(c=this.svgGroup_)==null||c.setAttribute("width",`${e}`);let h;(h=this.svgGroup_)==null||h.setAttribute("height",`${t}`),this.workspace_.setCachedParentSvgSize(e,t),this.svgGroup_&&ca(this.svgGroup_,"translate("+o+"px,"+n+"px)"),(e=this.workspace_.scrollbar)&&(e.setOrigin(o,n),e.resize(),e.hScroll&&e.hScroll.setPosition(e.hScroll.position.x,e.hScroll.position.y),e.vScroll&&e.vScroll.setPosition(e.vScroll.position.x,e.vScroll.position.y))}hide(){if(this.isVisible()){this.setVisible(!1);for(const e of this.listeners)ze(e);this.listeners.length=0,this.reflowWrapper&&(this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowWrapper=null)}}show(e){this.workspace_.setResizesEnabled(!1),this.hide(),this.clearOldBlocks(),typeof e=="string"&&(e=this.getDynamicCategoryContents(e)),this.setVisible(!0),e=Bn(e),e=this.createFlyoutInfo(e),Qs(this.workspace_),this.setContents(e.contents),this.layout_(e.contents,e.gaps),this.horizontalLayout?this.height_=0:this.width_=0,this.workspace_.setResizesEnabled(!0),this.reflow(),this.filterForCapacity(),this.position(),this.reflowWrapper=this.reflow.bind(this),this.workspace_.addChangeListener(this.reflowWrapper),this.emptyRecycledBlocks()}createFlyoutInfo(e){const t=[],o=[];this.permanentlyDisabled.length=0;const n=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(const c of e){if("custom"in c){e=this.getDynamicCategoryContents(c.custom),e=Bn(e);const{contents:h,gaps:$}=this.createFlyoutInfo(e);t.push(...h),o.push(...$)}switch(c.kind.toUpperCase()){case"BLOCK":e=c;const h=this.createFlyoutBlock(e);t.push({type:un.BLOCK,block:h}),this.addBlockGap(e,o,n);break;case"SEP":this.addSeparatorGap(c,o,n);break;case"LABEL":e=this.createButton(c,!0),t.push({type:un.BUTTON,button:e}),o.push(n);break;case"BUTTON":e=this.createButton(c,!1),t.push({type:un.BUTTON,button:e}),o.push(n)}}return{contents:t,gaps:o}}getDynamicCategoryContents(e){if(e=this.workspace_.targetWorkspace.getToolboxCategoryCallback(e),typeof e!="function")throw TypeError("Couldn't find a callback function when opening a toolbox category.");return e(this.workspace_.targetWorkspace)}createButton(e,t){return new hs(this.workspace_,this.targetWorkspace,e,t)}createFlyoutBlock(e){let t;return e.blockxml?(e=typeof e.blockxml=="string"?i.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,(t=this.getRecycledBlock(e.getAttribute("type")))||(t=qo(e,this.workspace_))):(t=this.getRecycledBlock(e.type),t||(e.enabled===void 0&&(e.enabled=e.disabled!=="true"&&e.disabled!==!0),e.disabledReasons===void 0&&e.enabled===!1&&(e.disabledReasons=[Ft]),t=Ri(e,this.workspace_))),t.isEnabled()||this.permanentlyDisabled.push(t),t}getRecycledBlock(e){let t=-1;for(let o=0;o<this.recycledBlocks.length;o++)if(this.recycledBlocks[o].type===e){t=o;break}return t===-1?void 0:this.recycledBlocks.splice(t,1)[0]}addBlockGap(e,t,o){let n;e.gap?n=parseInt(String(e.gap)):e.blockxml&&(e=typeof e.blockxml=="string"?i.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,n=parseInt(e.getAttribute("gap"))),t.push(!n||isNaN(n)?o:n)}addSeparatorGap(e,t,o){e=parseInt(String(e.gap)),!isNaN(e)&&0<t.length?t[t.length-1]=e:t.push(o)}clearOldBlocks(){var e=this.workspace_.getTopBlocks(!1);for(let o=0,n;n=e[o];o++)this.blockIsRecyclable_(n)?this.recycleBlock(n):n.dispose(!1,!1);for(e=0;e<this.mats.length;e++){const o=this.mats[e];o&&(Oa(o),Ke(o))}this.mats.length=0;for(let o=0,n;n=this.buttons_[o];o++)n.dispose();this.buttons_.length=0;let t;(t=this.workspace_.getPotentialVariableMap())==null||t.clear()}emptyRecycledBlocks(){for(let e=0;e<this.recycledBlocks.length;e++)this.recycledBlocks[e].dispose();this.recycledBlocks=[]}blockIsRecyclable_(e){return!1}recycleBlock(e){const t=e.getRelativeToSurfaceXY();e.moveBy(-t.x,-t.y),this.recycledBlocks.push(e)}addBlockListeners_(e,t,o){this.listeners.push(X(e,"pointerdown",null,this.blockMouseDown(t))),this.listeners.push(X(o,"pointerdown",null,this.blockMouseDown(t))),this.listeners.push(ct(e,"pointerenter",t,()=>{this.targetWorkspace.isDragging()||t.addSelect()})),this.listeners.push(ct(e,"pointerleave",t,()=>{this.targetWorkspace.isDragging()||t.removeSelect()})),this.listeners.push(ct(o,"pointerenter",t,()=>{this.targetWorkspace.isDragging()||t.addSelect()})),this.listeners.push(ct(o,"pointerleave",t,()=>{this.targetWorkspace.isDragging()||t.removeSelect()}))}blockMouseDown(e){return t=>{const o=this.targetWorkspace.getGesture(t);o&&(o.setStartBlock(e),o.handleFlyoutStart(t,this))}}onMouseDown(e){const t=this.targetWorkspace.getGesture(e);t&&t.handleFlyoutStart(e,this)}isBlockCreatable(e){return e.isEnabled()}createBlock(e){let t=null;i.disable$$module$build$src$core$events$utils();var o=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{t=this.placeNewBlock(e)}finally{i.enable$$module$build$src$core$events$utils()}if(this.targetWorkspace.hideChaff(),e=Hn(this.targetWorkspace,o),K()){for(i.setGroup$$module$build$src$core$events$utils(!0),o=0;o<e.length;o++){const n=e[o];z(new(G(O.VAR_CREATE))(n))}z(new(G(O.BLOCK_CREATE))(t))}return this.autoClose?this.hide():this.filterForCapacity(),t}initFlyoutButton_(e,t,o){const n=e.createDom();e.moveTo(t,o),e.show(),this.listeners.push(X(n,"pointerdown",this,this.onMouseDown)),this.buttons_.push(e)}createRect_(e,t,o,n,c){return t=N(x.RECT,{"fill-opacity":0,x:t,y:o,height:n.height,width:n.width}),t.tooltip=e,Li(t),this.workspace_.getCanvas().insertBefore(t,e.getSvgRoot()),this.rectMap_.set(e,t),this.mats[c]=t}moveRectToBlock_(e,t){const o=t.getHeightWidth();e.setAttribute("width",String(o.width)),e.setAttribute("height",String(o.height)),t=t.getRelativeToSurfaceXY(),e.setAttribute("y",String(t.y)),e.setAttribute("x",String(this.RTL?t.x-o.width:t.x))}filterForCapacity(){const e=this.workspace_.getTopBlocks(!1);for(let t=0,o;o=e[t];t++)if(!this.permanentlyDisabled.includes(o)){const n=this.targetWorkspace.isCapacityAvailable(be(o));for(;o;)o.setDisabledReason(!n,dk),o=o.getNextBlock()}}reflow(){this.reflowWrapper&&this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowInternal_(),this.reflowWrapper&&this.workspace_.addChangeListener(this.reflowWrapper)}isScrollable(){return this.workspace_.scrollbar?this.workspace_.scrollbar.isVisible():!1}placeNewBlock(e){var t=this.targetWorkspace;if(!e.getSvgRoot())throw Error("oldBlock is not rendered");const o=this.serializeBlock(e);return t.setResizesEnabled(!1),t=eo(o,t),this.positionNewBlock(e,t),t}serializeBlock(e){return Qt(e)}positionNewBlock(e,t){const o=this.targetWorkspace;var n=o.getOriginOffsetInPixels(),c=this.workspace_.getOriginOffsetInPixels();e=e.getRelativeToSurfaceXY(),e.scale(this.workspace_.scale),c=V.sum(c,e),n=V.difference(c,n),n.scale(1/o.scale),t.moveTo(new V(n.x,n.y))}};Gl.FlyoutItemType=un;var Dp=class extends Gl{constructor(e){super(e)}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),o=t.getScrollMetrics(),n=t.getViewMetrics();t=t.getAbsoluteMetrics(),typeof e.y=="number"&&(this.workspace_.scrollY=-(o.top+(o.height-n.height)*e.y)),this.workspace_.translate(this.workspace_.scrollX+t.left,this.workspace_.scrollY+t.top)}}getX(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager();const t=e.getAbsoluteMetrics(),o=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===Ee.LEFT?e.width:o.width-this.width_:this.toolboxPosition_===Ee.LEFT?0:o.width:this.toolboxPosition_===Ee.LEFT?0:o.width+t.left-this.width_}getY(){return 0}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=e.height,this.setBackgroundPath(this.width_-this.CORNER_RADIUS,e.height-2*this.CORNER_RADIUS),e=this.getX();var t=this.getY();this.positionAt_(this.width_,this.height_,e,t)}}setBackgroundPath(e,t){const o=this.toolboxPosition_===Ee.RIGHT;var n=e+this.CORNER_RADIUS;n=["M "+(o?n:0)+",0"],n.push("h",o?-e:e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,o?0:1,o?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",Math.max(0,t)),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,o?0:1,o?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",o?e:-e),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))}scrollToStart(){let e;(e=this.workspace_.scrollbar)==null||e.setY(0)}wheel_(e){var t=Zs(e);if(t.y){const o=this.workspace_.getMetricsManager(),n=o.getScrollMetrics();t=o.getViewMetrics().top-n.top+t.y;let c;(c=this.workspace_.scrollbar)==null||c.setY(t),Yn(this.workspace_),Ns()}e.preventDefault(),e.stopPropagation()}layout_(e,t){this.workspace_.scale=this.targetWorkspace.scale;var o=this.MARGIN;const n=this.RTL?o:o+this.tabWidth_;for(let T=0,L;L=e[T];T++)if(L.type==="block"){var c=L.block;if(!c)continue;var h=c.getDescendants(!1);for(let nt=0,it;it=h[nt];nt++)it.isInFlyout=!0;h=c.getSvgRoot();const te=c.getHeightWidth();var $=c.outputConnection?n-this.tabWidth_:n;c.moveBy($,o),$=this.createRect_(c,this.RTL?$-te.width:$,o,te,T),this.addBlockListeners_(h,c,$),o+=te.height+t[T]}else L.type==="button"&&(c=L.button,this.initFlyoutButton_(c,n,o),o+=c.height+t[T])}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;const t=this.dragAngleRange_;return e<t&&e>-t||e<-180+t||e>180-t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.left;return this.toolboxPosition_===Ee.LEFT?new qe(-1e9,1e9,-1e9,t+e.width):new qe(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;var t=this.workspace_.getTopBlocks(!1);for(let n=0,c;c=t[n];n++){var o=c.getHeightWidth().width;c.outputConnection&&(o-=this.tabWidth_),e=Math.max(e,o)}for(let n=0,c;c=this.buttons_[n];n++)e=Math.max(e,c.width);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=mt.scrollbarThickness,this.width_!==e){for(let n=0,c;c=t[n];n++){if(this.RTL){o=c.getRelativeToSurfaceXY().x;let h=e/this.workspace_.scale-this.MARGIN;c.outputConnection||(h-=this.tabWidth_),c.moveBy(h-o,0)}this.rectMap_.has(c)&&this.moveRectToBlock_(this.rectMap_.get(c),c)}if(this.RTL)for(let n=0,c;c=this.buttons_[n];n++)t=c.getPosition().y,c.moveTo(e/this.workspace_.scale-c.width-this.MARGIN-this.tabWidth_,t);this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==Ee.LEFT||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};Dp.registryName="verticalFlyout",r(F.FLYOUTS_VERTICAL_TOOLBOX,js,Dp);var ry=class extends Gl{constructor(e){super(e),this.horizontalLayout=!0}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),o=t.getScrollMetrics(),n=t.getViewMetrics();t=t.getAbsoluteMetrics(),typeof e.x=="number"&&(this.workspace_.scrollX=-(o.left+(o.width-n.width)*e.x)),this.workspace_.translate(this.workspace_.scrollX+t.left,this.workspace_.scrollY+t.top)}}getX(){return 0}getY(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager();const t=e.getAbsoluteMetrics(),o=e.getViewMetrics();e=e.getToolboxMetrics();const n=this.toolboxPosition_===Ee.TOP;return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?n?e.height:o.height-this.height_:n?0:o.height:n?0:o.height+t.top-this.height_}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.width_=e.width,this.setBackgroundPath(e.width-2*this.CORNER_RADIUS,this.height_-this.CORNER_RADIUS),e=this.getX();var t=this.getY();this.positionAt_(this.width_,this.height_,e,t)}}setBackgroundPath(e,t){const o=this.toolboxPosition_===Ee.TOP,n=["M 0,"+(o?0:this.CORNER_RADIUS)];o?(n.push("h",e+2*this.CORNER_RADIUS),n.push("v",t),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",-e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),n.push("h",e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",t),n.push("h",-e-2*this.CORNER_RADIUS)),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))}scrollToStart(){let e;(e=this.workspace_.scrollbar)==null||e.setX(this.RTL?1/0:0)}wheel_(e){var t=Zs(e);if(t=t.x||t.y){const o=this.workspace_.getMetricsManager(),n=o.getScrollMetrics();t=o.getViewMetrics().left-n.left+t;let c;(c=this.workspace_.scrollbar)==null||c.setX(t),Yn(this.workspace_),Ns()}e.preventDefault(),e.stopPropagation()}layout_(e,t){this.workspace_.scale=this.targetWorkspace.scale;const o=this.MARGIN;let n=o+this.tabWidth_;this.RTL&&(e=e.reverse());for(let T=0,L;L=e[T];T++)if(L.type==="block"){var c=L.block;if(c==null)continue;var h=c.getDescendants(!1);for(let nt=0,it;it=h[nt];nt++)it.isInFlyout=!0;h=c.getSvgRoot();const te=c.getHeightWidth();var $=c.outputConnection?this.tabWidth_:0;$=this.RTL?n+te.width:n-$,c.moveBy($,o),$=this.createRect_(c,$,o,te,T),n+=te.width+t[T],this.addBlockListeners_(h,c,$)}else L.type==="button"&&(c=L.button,this.initFlyoutButton_(c,n,o),n+=c.width+t[T])}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;const t=this.dragAngleRange_;return e<90+t&&e>90-t||e>-90-t&&e<-90+t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.top;return this.toolboxPosition_===Ee.TOP?new qe(-1e9,t+e.height,-1e9,1e9):new qe(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;const t=this.workspace_.getTopBlocks(!1);for(let n=0,c;c=t[n];n++)e=Math.max(e,c.getHeightWidth().height);const o=this.buttons_;for(let n=0,c;c=o[n];n++)e=Math.max(e,c.height);if(e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=mt.scrollbarThickness,this.height_!==e){for(let n=0,c;c=t[n];n++)this.rectMap_.has(c)&&this.moveRectToBlock_(this.rectMap_.get(c),c);this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==Ee.TOP||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};r(F.FLYOUTS_HORIZONTAL_TOOLBOX,js,ry);var xr=class extends qt{constructor(e,t,o,n,c){super(Qe.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=xr.dropdownCreate,this.defaultVariableName=typeof e=="string"?e:"",this.size_=new Le(0,0),e!==Qe.SKIP_SETUP&&(c?this.configure_(c):this.setTypes(o,n),t&&this.setValidator(t))}configure_(e){super.configure_(e),this.setTypes(e.variableTypes,e.defaultType)}initModel(){var e=this.getSourceBlock();if(!e)throw new ft;this.variable||(e=i.getOrCreateVariablePackage$$module$build$src$core$variables(e.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(e.getId()))}shouldAddBorderRect_(){const e=this.getSourceBlock();if(!e)throw new ft;return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||e.type!=="variables_get")}fromXml(e){var t=this.getSourceBlock();if(!t)throw new ft;const o=e.getAttribute("id"),n=e.textContent,c=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=i.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,o,n,c),c!==null&&c!==t.type)throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.type+", and does not match variable field that references it: "+Ls(e)+".");this.setValue(t.getId())}toXml(e){return this.initModel(),e.id=this.variable.getId(),e.textContent=this.variable.name,this.variable.type&&e.setAttribute("variabletype",this.variable.type),e}saveState(e){var t=this.saveLegacyState(xr);return t!==null||(this.initModel(),t={id:this.variable.getId()},e&&(t.name=this.variable.name,t.type=this.variable.type)),t}loadState(e){const t=this.getSourceBlock();if(!t)throw new ft;this.loadLegacyState(xr,e)||(e=i.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,e.id||null,e.name,e.type||""),this.setValue(e.getId()))}setSourceBlock(e){if(e.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(e)}getValue(){return this.variable?this.variable.getId():null}getText(){return this.variable?this.variable.name:""}getVariable(){return this.variable}getValidator(){return this.variable?this.validator_:null}doClassValidation_(e){if(e===null)return null;var t=this.getSourceBlock();if(!t)throw new ft;return t=i.getVariable$$module$build$src$core$variables(t.workspace,e),t?(t=t.type,this.typeIsAllowed(t)?e:(console.warn("Variable type doesn't match this field! Type was "+t),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+e),null)}doValueUpdate_(e){const t=this.getSourceBlock();if(!t)throw new ft;this.variable=i.getVariable$$module$build$src$core$variables(t.workspace,e),super.doValueUpdate_(e)}typeIsAllowed(e){const t=this.getVariableTypes();if(!t)return!0;for(let o=0;o<t.length;o++)if(e===t[o])return!0;return!1}getVariableTypes(){var e=this.variableTypes;if(e===null&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying())return this.sourceBlock_.workspace.getVariableTypes();if(e=e||[""],e.length===0)throw e=this.getText(),Error("'variableTypes' of field variable "+e+" was an empty list");return e}setTypes(e=null,t=""){if(Array.isArray(e)){let o=!1;for(let n=0;n<e.length;n++)e[n]===t&&(o=!0);if(!o)throw Error("Invalid default type '"+t+"' in the definition of a FieldVariable")}else if(e!==null)throw Error("'variableTypes' was not an array in the definition of a FieldVariable");this.defaultType=t,this.variableTypes=e}refreshVariableName(){this.forceRerender()}onItemSelected_(e,t){if(e=t.getValue(),this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){if(e===gp){i.renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable);return}if(e===mp){this.sourceBlock_.workspace.deleteVariableById(this.variable.getId());return}}this.setValue(e)}referencesVariables(){return!0}static fromJson(e){return new this(pt(e.variable),void 0,void 0,void 0,e)}static dropdownCreate(){if(!this.variable)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");const e=this.getText();let t=[];if(this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying())for(var o=this.getVariableTypes(),n=0;n<o.length;n++){const c=this.sourceBlock_.workspace.getVariablesOfType(o[n]);t=t.concat(c)}for(t.sort(hr.compareByName),o=[],n=0;n<t.length;n++)o[n]=[t[n].name,t[n].getId()];return o.push([i.Msg$$module$build$src$core$msg.RENAME_VARIABLE,gp]),i.Msg$$module$build$src$core$msg.DELETE_VARIABLE&&o.push([i.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",e),mp]),o}};Ps("field_variable",xr);var Ap=class extends Hl{constructor(e,t,o,n,c,h){super(Qe.SKIP_SETUP),this.min_=-1/0,this.max_=1/0,this.precision_=0,this.decimalPlaces=null,this.spellcheck_=!1,e!==Qe.SKIP_SETUP&&(h?this.configure_(h):this.setConstraints(t,o,n),this.setValue(e),c&&this.setValidator(c))}configure_(e){super.configure_(e),this.setMinInternal(e.min),this.setMaxInternal(e.max),this.setPrecisionInternal(e.precision)}setConstraints(e,t,o){this.setMinInternal(e),this.setMaxInternal(t),this.setPrecisionInternal(o),this.setValue(this.getValue())}setMin(e){this.setMinInternal(e),this.setValue(this.getValue())}setMinInternal(e){e==null?this.min_=-1/0:(e=Number(e),isNaN(e)||(this.min_=e))}getMin(){return this.min_}setMax(e){this.setMaxInternal(e),this.setValue(this.getValue())}setMaxInternal(e){e==null?this.max_=1/0:(e=Number(e),isNaN(e)||(this.max_=e))}getMax(){return this.max_}setPrecision(e){this.setPrecisionInternal(e),this.setValue(this.getValue())}setPrecisionInternal(e){this.precision_=Number(e)||0;let t=String(this.precision_);t.includes("e")&&(t=this.precision_.toLocaleString("en-US",{maximumFractionDigits:20}));const o=t.indexOf(".");this.decimalPlaces=o===-1?e?0:null:t.length-o-1}getPrecision(){return this.precision_}doClassValidation_(e){return e===null||(e=`${e}`.replace(/O/gi,"0"),e=e.replace(/,/g,""),e=e.replace(/infinity/i,"Infinity"),e=Number(e||0),isNaN(e))?null:(e=Math.min(Math.max(e,this.min_),this.max_),this.precision_&&isFinite(e)&&(e=Math.round(e/this.precision_)*this.precision_),this.decimalPlaces!==null&&(e=Number(e.toFixed(this.decimalPlaces))),e)}widgetCreate_(){const e=super.widgetCreate_();return-1/0<this.min_&&(e.min=`${this.min_}`,It(e,Ct.VALUEMIN,this.min_)),1/0>this.max_&&(e.max=`${this.max_}`,It(e,Ct.VALUEMAX,this.max_)),e}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};Ps("field_number",Ap),Ap.prototype.DEFAULT_VALUE=0;var ay=class extends hi{constructor(e,t,o){super(String(e??""),t,o),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(pt(e.text),void 0,e)}};Ps("field_label_serializable",ay);var fi=class extends Qe{constructor(e,t,o){super(Qe.SKIP_SETUP),this.SERIALIZABLE=!0,this.CURSOR="default",this.value_=this.value_,this.checkChar=fi.CHECK_CHAR,e!==Qe.SKIP_SETUP&&(o&&this.configure_(o),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.checkCharacter&&(this.checkChar=e.checkCharacter)}saveState(){const e=this.saveLegacyState(fi);return e!==null?e:this.getValueBoolean()}initView(){super.initView();const e=this.getTextElement();ge(e,"blocklyCheckbox"),e.style.display=this.value_?"block":"none"}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)}getDisplayText_(){return this.checkChar}setCheckCharacter(e){this.checkChar=e||fi.CHECK_CHAR,this.forceRerender()}showEditor_(){this.setValue(!this.value_)}doClassValidation_(e){return e===!0||e==="TRUE"?"TRUE":e===!1||e==="FALSE"?"FALSE":null}doValueUpdate_(e){this.value_=this.convertValueToBool(e),this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")}getValue(){return this.value_?"TRUE":"FALSE"}getValueBoolean(){return this.value_}getText(){return String(this.convertValueToBool(this.value_))}convertValueToBool(e){return typeof e=="string"?e==="TRUE":!!e}static fromJson(e){return new this(e.checked,void 0,e)}};fi.CHECK_CHAR="✓",Ps("field_checkbox",fi),fi.prototype.DEFAULT_VALUE=!1;var ly=class{constructor(e,t){this.draggable=e,this.workspace=t,this.dragTarget=null,this.startLoc=e.getRelativeToSurfaceXY()}onDragStart(e){this.draggable.startDrag(e)}onDrag(e,t){this.moveDraggable(e,t),t=this.getRoot(this.draggable),ls(t)&&t.setDeleteStyle(this.wouldDeleteDraggable(e,t)),this.updateDragTarget(e)}updateDragTarget(e){e=this.workspace.getDragTarget(e);const t=this.getRoot(this.draggable);if(this.dragTarget!==e){let o;(o=this.dragTarget)==null||o.onDragExit(t),e==null||e.onDragEnter(t)}e==null||e.onDragOver(t),this.dragTarget=e}moveDraggable(e,t){t=this.pixelsToWorkspaceUnits(t),t=V.sum(this.startLoc,t),this.draggable.drag(t,e)}wouldDeleteDraggable(e,t){return(e=this.workspace.getDragTarget(e))&&this.workspace.getComponentManager().hasCapability(e.id,lt.Capability.DELETE_AREA)?e.wouldDelete(t):!1}onDragEnd(e){const t=i.getGroup$$module$build$src$core$events$utils();var o=this.workspace.getDragTarget(e);const n=this.getRoot(this.draggable);if(o){let c;(c=this.dragTarget)==null||c.onDrop(n)}this.shouldReturnToStart(e,n)&&this.draggable.revertDrag(),(o=ls(n)&&this.wouldDeleteDraggable(e,n))&&this.draggable instanceof gs&&za(this.draggable.getRootBlock()),this.draggable.endDrag(e),o&&ls(n)&&(e=i.getGroup$$module$build$src$core$events$utils(),i.setGroup$$module$build$src$core$events$utils(t),n.dispose(),i.setGroup$$module$build$src$core$events$utils(e))}getRoot(e){return e instanceof gs?e.getRootBlock():e}shouldReturnToStart(e,t){return(e=this.workspace.getDragTarget(e))?e.shouldPreventMove(t):!1}pixelsToWorkspaceUnits(e){return e=new V(e.x/this.workspace.scale,e.y/this.workspace.scale),this.workspace.isMutator&&e.scale(1/this.workspace.options.parentWorkspace.scale),e}};r(F.BLOCK_DRAGGER,js,ly);var Dr={};Dr.BlockDragStrategy=Pv,Dr.BubbleDragStrategy=vv,Dr.CommentDragStrategy=pv,Dr.Dragger=ly;var Rp=class extends Cs{constructor(e,t,o){super(e?e.workspace.id:void 0),this.type=O.BLOCK_DRAG,e&&(this.blockId=e.id,this.isStart=t,this.blocks=o)}toJson(){const e=super.toJson();if(this.isStart===void 0)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(this.blockId===void 0)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.isStart=this.isStart,e.blockId=this.blockId,e.blocks=this.blocks,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Rp),t.isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};r(F.EVENT,O.BLOCK_DRAG,Rp);var Op=class extends ni{constructor(e,t,o,n){super(e),this.type=O.BLOCK_FIELD_INTERMEDIATE_CHANGE,this.recordUndo=!1,e&&(this.name=t,this.oldValue=o,this.newValue=n)}toJson(){const e=super.toJson();if(!this.name)throw Error("The changed field name is undefined. Either pass a name to the constructor, or call fromJson.");return e.name=this.name,e.oldValue=this.oldValue,e.newValue=this.newValue,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Op),t.name=e.name,t.oldValue=e.oldValue,t.newValue=e.newValue,t}isNull(){return this.oldValue===this.newValue}run(e){var t=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");if(t=t.getBlockById(this.blockId),!t)throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");e=e?this.newValue:this.oldValue,(t=t.getField(this.name))?t.setValue(e):console.warn("Can't set non-existent field: "+this.name)}};r(F.EVENT,O.BLOCK_FIELD_INTERMEDIATE_CHANGE,Op);var Mp=class extends ni{constructor(e){super(e),this.type=O.BLOCK_MOVE,e&&(e.isShadow()&&(this.recordUndo=!1),e=this.currentLocation(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)}toJson(){const e=super.toJson();return e.oldParentId=this.oldParentId,e.oldInputName=this.oldInputName,this.oldCoordinate&&(e.oldCoordinate=`${Math.round(this.oldCoordinate.x)}, ${Math.round(this.oldCoordinate.y)}`),e.newParentId=this.newParentId,e.newInputName=this.newInputName,this.newCoordinate&&(e.newCoordinate=`${Math.round(this.newCoordinate.x)}, ${Math.round(this.newCoordinate.y)}`),this.reason&&(e.reason=this.reason),this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Mp),t.oldParentId=e.oldParentId,t.oldInputName=e.oldInputName,e.oldCoordinate&&(o=e.oldCoordinate.split(","),t.oldCoordinate=new V(Number(o[0]),Number(o[1]))),t.newParentId=e.newParentId,t.newInputName=e.newInputName,e.newCoordinate&&(o=e.newCoordinate.split(","),t.newCoordinate=new V(Number(o[0]),Number(o[1]))),e.reason!==void 0&&(t.reason=e.reason),e.recordUndo!==void 0&&(t.recordUndo=e.recordUndo),t}recordNew(){const e=this.currentLocation();this.newParentId=e.parentId,this.newInputName=e.inputName,this.newCoordinate=e.coordinate}setReason(e){this.reason=e}currentLocation(){var e=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var t=e.getBlockById(this.blockId);if(!t)throw Error("The block associated with the block move event could not be found");e={};const o=t.getParent();return o?(e.parentId=o.id,(t=o.getInputWithBlock(t))&&(e.inputName=t.name)):e.coordinate=t.getRelativeToSurfaceXY(),e}isNull(){return this.oldParentId===this.newParentId&&this.oldInputName===this.newInputName&&V.equals(this.oldCoordinate,this.newCoordinate)}run(e){var t=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var o=t.getBlockById(this.blockId);if(o){var n=e?this.newParentId:this.oldParentId,c=e?this.newInputName:this.oldInputName;if(e=e?this.newCoordinate:this.oldCoordinate,n){var h=t.getBlockById(n);if(!h){console.warn("Can't connect to non-existent block: "+n);return}}if(o.getParent()&&o.unplug(),e)c=o.getRelativeToSurfaceXY(),o.moveBy(e.x-c.x,e.y-c.y,this.reason);else{t=o.outputConnection,(!t||o.previousConnection&&o.previousConnection.isConnected())&&(t=o.previousConnection);let $,T;o=(T=t)==null?void 0:T.type,c?(o=h.getInput(c))&&($=o.connection):o===oe.PREVIOUS_STATEMENT&&($=h.nextConnection),$&&t?t.connect($):console.warn("Can't connect to non-existent input: "+c)}}else console.warn("Can't move non-existent block: "+this.blockId)}};r(F.EVENT,O.BLOCK_MOVE,Mp);var Np=class extends Cs{constructor(e,t,o){super(e?e.workspace.id:void 0),this.type=O.BUBBLE_OPEN,e&&(this.blockId=e.id,this.isOpen=t,this.bubbleType=o)}toJson(){const e=super.toJson();if(this.isOpen===void 0)throw Error("Whether this event is for opening the bubble is undefined. Either pass the value to the constructor, or call fromJson");if(!this.bubbleType)throw Error("The type of bubble is undefined. Either pass the value to the constructor, or call fromJson");return e.isOpen=this.isOpen,e.bubbleType=this.bubbleType,e.blockId=this.blockId||"",e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Np),t.isOpen=e.isOpen,t.bubbleType=e.bubbleType,t.blockId=e.blockId,t}},Lp;(function(e){e.MUTATOR="mutator",e.COMMENT="comment",e.WARNING="warning"})(Lp||(Lp={})),r(F.EVENT,O.BUBBLE_OPEN,Np);var Vs=class extends Ui{constructor(e){super(),this.isBlank=!e,e&&(this.commentId=e.id,this.workspaceId=e.workspace.id,this.group=i.getGroup$$module$build$src$core$events$utils(),this.recordUndo=me())}toJson(){const e=super.toJson();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");return e.commentId=this.commentId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Vs),t.commentId=e.commentId,t}static CommentCreateDeleteHelper(e,t){const o=e.getEventWorkspace_();if(t){if(!e.json)throw Error("Encountered a comment event without proper json");Fn(e.json,o)}else{if(!e.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(t=o.getCommentById(e.commentId))?t.dispose():console.warn("Can't delete non-existent comment: "+e.commentId)}}},Pp=class extends Vs{constructor(e,t,o){super(e),this.type=O.COMMENT_CHANGE,e&&(this.oldContents_=typeof t>"u"?"":t,this.newContents_=typeof o>"u"?"":o)}toJson(){const e=super.toJson();if(!this.oldContents_)throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newContents_)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");return e.oldContents=this.oldContents_,e.newContents=this.newContents_,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Pp),t.oldContents_=e.oldContents,t.newContents_=e.newContents,t}isNull(){return this.oldContents_===this.newContents_}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){var o=e?this.newContents_:this.oldContents_;if(o===void 0)throw Error(e?"The new contents is undefined. Either pass a value to the constructor, or call fromJson":"The old contents is undefined. Either pass a value to the constructor, or call fromJson");t.setText(o)}else console.warn("Can't change non-existent comment: "+this.commentId)}};r(F.EVENT,O.COMMENT_CHANGE,Pp);var Bp=class extends Vs{constructor(e,t){super(e),this.newCollapsed=t,this.type=O.COMMENT_COLLAPSE}toJson(){const e=super.toJson();if(this.newCollapsed===void 0)throw Error("The new collapse value undefined. Either call recordNew, or call fromJson");return e.newCollapsed=this.newCollapsed,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Bp),t.newCollapsed=e.newCollapsed,t}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(t=t.getCommentById(this.commentId))?t.setCollapsed(e?!!this.newCollapsed:!this.newCollapsed):console.warn("Can't collapse or uncollapse non-existent comment: "+this.commentId)}};r(F.EVENT,O.COMMENT_COLLAPSE,Bp);var jp=class extends Vs{constructor(e){super(e),this.type=O.COMMENT_CREATE,e&&(this.xml=Xn(e),this.json=xi(e,{addCoordinates:!0}))}toJson(){const e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.json)throw Error("The comment JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Ls(this.xml),e.json=this.json,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new jp),t.xml=i.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}run(e){Vs.CommentCreateDeleteHelper(this,e)}};r(F.EVENT,O.COMMENT_CREATE,jp);var Fp=class extends Vs{constructor(e){super(e),this.type=O.COMMENT_DELETE,e&&(this.xml=Xn(e),this.json=xi(e,{addCoordinates:!0}))}run(e){Vs.CommentCreateDeleteHelper(this,!e)}toJson(){const e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.json)throw Error("The comment JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Ls(this.xml),e.json=this.json,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Fp),t.xml=i.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}};r(F.EVENT,O.COMMENT_DELETE,Fp);var zp=class extends Cs{constructor(e,t){super(e?e.workspace.id:void 0),this.type=O.COMMENT_DRAG,e&&(this.commentId=e.id,this.isStart=t)}toJson(){const e=super.toJson();if(this.isStart===void 0)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(this.commentId===void 0)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");return e.isStart=this.isStart,e.commentId=this.commentId,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new zp),t.isStart=e.isStart,t.commentId=e.commentId,t}};r(F.EVENT,O.COMMENT_DRAG,zp);var Up=class extends Vs{constructor(e){super(e),this.type=O.COMMENT_MOVE,e&&(this.comment_=e,this.oldCoordinate_=e.getRelativeToSurfaceXY())}recordNew(){if(this.newCoordinate_)throw Error("Tried to record the new position of a comment on the same event twice.");if(!this.comment_)throw Error("The comment is undefined. Pass a comment to the constructor if you want to use the record functionality");this.newCoordinate_=this.comment_.getRelativeToSurfaceXY()}setReason(e){this.reason=e}setOldCoordinate(e){this.oldCoordinate_=e}toJson(){const e=super.toJson();if(!this.oldCoordinate_)throw Error("The old comment position is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newCoordinate_)throw Error("The new comment position is undefined. Either call recordNew, or call fromJson");return e.oldCoordinate=`${Math.round(this.oldCoordinate_.x)}, ${Math.round(this.oldCoordinate_.y)}`,e.newCoordinate=Math.round(this.newCoordinate_.x)+","+Math.round(this.newCoordinate_.y),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Up),o=e.oldCoordinate.split(","),t.oldCoordinate_=new V(Number(o[0]),Number(o[1])),o=e.newCoordinate.split(","),t.newCoordinate_=new V(Number(o[0]),Number(o[1])),t}isNull(){return V.equals(this.oldCoordinate_,this.newCoordinate_)}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){if(e=e?this.newCoordinate_:this.oldCoordinate_,!e)throw Error("Either oldCoordinate_ or newCoordinate_ is undefined. Either pass a comment to the constructor and call recordNew, or call fromJson");t.moveTo(e)}else console.warn("Can't move non-existent comment: "+this.commentId)}};r(F.EVENT,O.COMMENT_MOVE,Up);var Hp=class extends Vs{constructor(e){super(e),this.type=O.COMMENT_RESIZE,e&&(this.oldSize=e.getSize())}recordCurrentSizeAsNewSize(){if(this.newSize)throw Error("Tried to record the new size of a comment on the same event twice.");var e=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(e=e.getCommentById(this.commentId),!e)throw Error("The comment associated with the comment resize event could not be found");this.newSize=e.getSize()}toJson(){const e=super.toJson();if(!this.oldSize)throw Error("The old comment size is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newSize)throw Error("The new comment size is undefined. Either call recordCurrentSizeAsNewSize, or call fromJson");return e.oldWidth=Math.round(this.oldSize.width),e.oldHeight=Math.round(this.oldSize.height),e.newWidth=Math.round(this.newSize.width),e.newHeight=Math.round(this.newSize.height),e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Hp),t.oldSize=new Le(e.oldWidth,e.oldHeight),t.newSize=new Le(e.newWidth,e.newHeight),t}isNull(){return Le.equals(this.oldSize,this.newSize)}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){if(e=e?this.newSize:this.oldSize,!e)throw Error("Either oldSize or newSize is undefined. Either pass a comment to the constructor and call recordCurrentSizeAsNewSize, or call fromJson");t.setSize(e)}else console.warn("Can't resize non-existent comment: "+this.commentId)}};r(F.EVENT,O.COMMENT_RESIZE,Hp);var Wp=class extends Cs{constructor(e,t,o){super(o),this.type=O.TOOLBOX_ITEM_SELECT,this.oldItem=e??void 0,this.newItem=t??void 0}toJson(){const e=super.toJson();return e.oldItem=this.oldItem,e.newItem=this.newItem,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new Wp),t.oldItem=e.oldItem,t.newItem=e.newItem,t}};r(F.EVENT,O.TOOLBOX_ITEM_SELECT,Wp);var cy=class extends Ui{constructor(e){super(),this.isBlank=!0,this.recordUndo=!1,this.type=O.FINISHED_LOADING,this.isBlank=!!e,e&&(this.workspaceId=e.id)}};r(F.EVENT,O.FINISHED_LOADING,cy);var uy,dy,hy,py,gy,my,fy,$y,by,vy,yy,_y,wy,Cy,Ty,ky,Sy,Ey,Iy,xy,Dy,Ay,Ry,Oy,My,Q;i.BLOCK_CHANGE$$module$build$src$core$events$events=O.BLOCK_CHANGE,i.BLOCK_CREATE$$module$build$src$core$events$events=O.BLOCK_CREATE,i.BLOCK_DELETE$$module$build$src$core$events$events=O.BLOCK_DELETE,uy=O.BLOCK_DRAG,i.BLOCK_MOVE$$module$build$src$core$events$events=O.BLOCK_MOVE,dy=O.BLOCK_FIELD_INTERMEDIATE_CHANGE,hy=O.BUBBLE_OPEN,py=O.BLOCK_CHANGE,gy=O.CLICK,my=O.COMMENT_CHANGE,fy=O.COMMENT_CREATE,$y=O.COMMENT_DELETE,by=O.COMMENT_MOVE,vy=O.COMMENT_RESIZE,yy=O.COMMENT_DRAG,_y=O.BLOCK_CREATE,wy=O.BLOCK_DELETE,Cy=O.FINISHED_LOADING,Ty=O.MARKER_MOVE,ky=O.BLOCK_MOVE,Sy=O.SELECTED,Ey=O.THEME_CHANGE,Iy=O.TOOLBOX_ITEM_SELECT,xy=O.TRASHCAN_OPEN,Dy=O.UI,Ay=O.VAR_CREATE,Ry=O.VAR_DELETE,Oy=O.VAR_RENAME,My=O.VIEWPORT_CHANGE,Q={},Q.Abstract=Ui,Q.BLOCK_CHANGE=i.BLOCK_CHANGE$$module$build$src$core$events$events,Q.BLOCK_CREATE=i.BLOCK_CREATE$$module$build$src$core$events$events,Q.BLOCK_DELETE=i.BLOCK_DELETE$$module$build$src$core$events$events,Q.BLOCK_DRAG=uy,Q.BLOCK_FIELD_INTERMEDIATE_CHANGE=dy,Q.BLOCK_MOVE=i.BLOCK_MOVE$$module$build$src$core$events$events,Q.BUBBLE_OPEN=hy,Q.BUMP_EVENTS=ub,Q.BlockBase=ni,Q.BlockChange=ri,Q.BlockCreate=Xh,Q.BlockDelete=up,Q.BlockDrag=Rp,Q.BlockFieldIntermediateChange=Op,Q.BlockMove=Mp,Q.BubbleOpen=Np,Q.BubbleType=Lp,Q.CHANGE=py,Q.CLICK=gy,Q.COMMENT_CHANGE=my,Q.COMMENT_CREATE=fy,Q.COMMENT_DELETE=$y,Q.COMMENT_DRAG=yy,Q.COMMENT_MOVE=by,Q.COMMENT_RESIZE=vy,Q.CREATE=_y,Q.Click=fh,Q.ClickTarget=$h,Q.CommentBase=Vs,Q.CommentChange=Pp,Q.CommentCollapse=Bp,Q.CommentCreate=jp,Q.CommentDelete=Fp,Q.CommentDrag=zp,Q.CommentMove=Up,Q.CommentResize=Hp,Q.DELETE=wy,Q.FINISHED_LOADING=Cy,Q.FinishedLoading=cy,Q.MARKER_MOVE=Ty,Q.MOVE=ky,Q.MarkerMove=dp,Q.SELECTED=Sy,Q.Selected=vp,Q.THEME_CHANGE=Ey,Q.TOOLBOX_ITEM_SELECT=Iy,Q.TRASHCAN_OPEN=xy,Q.ThemeChange=Zh,Q.ToolboxItemSelect=Wp,Q.TrashcanOpen=_p,Q.UI=Dy,Q.UiBase=Cs,Q.VAR_CREATE=Ay,Q.VAR_DELETE=Ry,Q.VAR_RENAME=Oy,Q.VIEWPORT_CHANGE=My,Q.VarBase=dr,Q.VarCreate=Ph,Q.VarDelete=fp,Q.VarRename=$p,Q.ViewportChange=Qh,Q.clearPendingUndo=ce,Q.disable=i.disable$$module$build$src$core$events$utils,Q.disableOrphans=tt,Q.enable=i.enable$$module$build$src$core$events$utils,Q.filter=ae,Q.fire=z,Q.fromJson=je,Q.get=G,Q.getDescendantIds=he,Q.getGroup=i.getGroup$$module$build$src$core$events$utils,Q.getRecordUndo=me,Q.isEnabled=K,Q.setGroup=i.setGroup$$module$build$src$core$events$utils,Q.setRecordUndo=i.setRecordUndo$$module$build$src$core$events$utils;var xs={};xs.BottomRow=qv,xs.ConstantProvider=Yv,xs.Drawer=Jv,xs.MarkerSvg=ey,xs.PathObject=ty,xs.RenderInfo=Qv,xs.Renderer=xp,xs.RightConnectionShape=Xv,xs.StatementInput=Vl,xs.TopRow=Zv,hh();var Tt={};Tt.registerCleanup=qd,Tt.registerCollapse=Zd,Tt.registerCollapseExpandBlock=nh,Tt.registerComment=oh,Tt.registerCommentCreate=dh,Tt.registerCommentDelete=ch,Tt.registerCommentDuplicate=uh,Tt.registerCommentOptions=ib,Tt.registerDefaultOptions=hh,Tt.registerDelete=ah,Tt.registerDeleteAll=th,Tt.registerDisable=rh,Tt.registerDuplicate=sh,Tt.registerExpand=Qd,Tt.registerHelp=lh,Tt.registerInline=ih,Tt.registerRedo=Jd,Tt.registerUndo=Yd;var Kl={};Kl.CommentView=mv,Kl.RenderedWorkspaceComment=kl,Kl.WorkspaceComment=Tl;var Ar={};Ar.Bubble=Ye,Ar.MiniWorkspaceBubble=uo,Ar.TextBubble=kv,Ar.TextInputBubble=yv;var Ny=class extends Ml{constructor(){super(),this.FIELD_TEXT_BASELINE_CENTER=!1,this.DARK_PATH_OFFSET=1,this.MAX_BOTTOM_WIDTH=30,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT/2}getCSS_(e){return super.getCSS_(e).concat([`${e} .blocklyInsertionMarker>.blocklyPathLight,`,`${e} .blocklyInsertionMarker>.blocklyPathDark {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"])}},Ly=class{constructor(e){this.inlineSteps_=this.steps_="",this.info_=e,this.RTL_=this.info_.RTL,e=e.getRenderer(),this.constants_=e.getConstants(),this.highlightConstants_=e.getHighlightConstants(),this.highlightOffset=this.highlightConstants_.OFFSET,this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER,this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER,this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB,this.notchPaths_=this.highlightConstants_.NOTCH,this.startPaths_=this.highlightConstants_.START_HAT,this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH}getPath(){return this.steps_+`
893
+ `+this.inlineSteps_}drawTopCorner(e){this.steps_+=at(e.xPos,this.info_.startY);for(let t=0,o;o=e.elements[t];t++)S.isLeftSquareCorner(o)?this.steps_+=this.highlightConstants_.START_POINT:S.isLeftRoundedCorner(o)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):S.isPreviousConnection(o)?this.steps_+=this.notchPaths_.pathLeft:S.isHat(o)?this.steps_+=this.startPaths_.path(this.RTL_):S.isSpacer(o)&&o.width!==0&&(this.steps_+=ne("H",o.xPos+o.width-this.highlightOffset));this.steps_+=ne("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+ne("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(e){const t=e.getLastInput();if(this.RTL_){const o=e.height-t.connectionHeight;this.steps_+=wt(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+ne("v",o)}else this.steps_+=wt(t.xPos+t.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(e){const t=e.getLastInput();if(t)if(this.RTL_){const o=e.height-2*this.insideCornerPaths_.height;this.steps_+=wt(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+ne("v",o)+this.insideCornerPaths_.pathBottom(this.RTL_)+Bs(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=wt(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+Bs(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){const t=e.xPos+e.width-this.highlightOffset;e instanceof lp&&e.followsStatement&&(this.steps_+=ne("H",t)),this.RTL_&&(this.steps_+=ne("H",t),e.height>this.highlightOffset&&(this.steps_+=ne("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=ne("V",e.baseline-this.highlightOffset);else{const t=this.info_.bottomRow.elements[0];S.isLeftSquareCorner(t)?this.steps_+=wt(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):S.isLeftRoundedCorner(t)&&(this.steps_+=wt(e.xPos,e.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft())}}drawLeft(){var e=this.info_.outputConnection;e&&(e=e.connectionOffsetY+e.height,this.RTL_?this.steps_+=wt(this.info_.startX,e):(this.steps_+=wt(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=ne("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,S.isLeftRoundedCorner(e.elements[0])?this.steps_+=ne("V",this.outsideCornerPaths_.height):this.steps_+=ne("V",e.capline+this.highlightOffset))}drawInlineInput(e){const t=this.highlightOffset,o=e.xPos+e.connectionWidth;var n=e.centerline-e.height/2;const c=e.width-e.connectionWidth,h=n+t;this.RTL_?(n=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=wt(o-t,h)+ne("v",n)+this.puzzleTabPaths_.pathDown(this.RTL_)+ne("v",e)+ne("h",c)):this.inlineSteps_+=wt(e.xPos+e.width+t,h)+ne("v",e.height)+ne("h",-c)+wt(o,n+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},Py=class extends Nl{constructor(e,t){super(e,t),this.highlighter_=new Ly(t)}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights();const e=this.block_.pathObject;e.setPath(this.outlinePath_+`
894
+ `+this.inlinePath_),e.setHighlightPath(this.highlighter_.getPath()),this.info_.RTL&&e.flipRTL(),this.recordSizeOnBlock_()}drawTop_(){this.highlighter_.drawTopCorner(this.info_.topRow),this.highlighter_.drawRightSideRow(this.info_.topRow),super.drawTop_()}drawJaggedEdge_(e){this.highlighter_.drawJaggedEdge_(e),super.drawJaggedEdge_(e)}drawValueInput_(e){this.highlighter_.drawValueInput(e),super.drawValueInput_(e)}drawStatementInput_(e){this.highlighter_.drawStatementInput(e),super.drawStatementInput_(e)}drawRightSideRow_(e){this.highlighter_.drawRightSideRow(e),this.outlinePath_+=ne("H",e.xPos+e.width)+ne("V",e.yPos+e.height)}drawBottom_(){this.highlighter_.drawBottomRow(this.info_.bottomRow),super.drawBottom_()}drawLeft_(){this.highlighter_.drawLeft(),super.drawLeft_()}drawInlineInput_(e){this.highlighter_.drawInlineInput(e),super.drawInlineInput_(e)}positionInlineInputConnection_(e){const t=e.centerline-e.height/2;if(e.connectionModel){let o=e.xPos+e.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(o*=-1),e.connectionModel.setOffsetInBlock(o,t+e.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(e){const t=e.getLastInput();if(t!=null&&t.connectionModel){let o=e.xPos+e.statementEdge+t.notchOffset;o=this.info_.RTL?-1*o:o+this.constants_.DARK_PATH_OFFSET,t.connectionModel.setOffsetInBlock(o,e.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(e){const t=e.getLastInput();if(t&&t.connectionModel){let o=e.xPos+e.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(o*=-1),t.connectionModel.setOffsetInBlock(o,e.yPos)}}positionNextConnection_(){const e=this.info_.bottomRow;if(e.connection){const t=e.connection,o=t.xPos;t.connectionModel.setOffsetInBlock((this.info_.RTL?-o:o)+this.constants_.DARK_PATH_OFFSET/2,e.baseline+this.constants_.DARK_PATH_OFFSET)}}},By=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=at(this.OFFSET,this.OFFSET)}init(){this.INSIDE_CORNER=this.makeInsideCorner(),this.OUTSIDE_CORNER=this.makeOutsideCorner(),this.PUZZLE_TAB=this.makePuzzleTab(),this.NOTCH=this.makeNotch(),this.JAGGED_TEETH=this.makeJaggedTeeth(),this.START_HAT=this.makeStartHat()}makeInsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,o=(1-Math.SQRT1_2)*(e+t)-t,n=at(o,o)+gt("a","0 0,0",e,ue(-o-t,e-o)),c=gt("a","0 0,0",e+t,ue(e+t,e+t)),h=at(o,-o)+gt("a","0 0,0",e+t,ue(e-o,o+t));return{width:e+t,height:e,pathTop($){return $?n:""},pathBottom($){return $?c:h}}}makeOutsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,o=(1-Math.SQRT1_2)*(e-t)+t,n=at(o,o)+gt("a","0 0,1",e-t,ue(e-o,-o+t)),c=at(t,e)+gt("a","0 0,1",e-t,ue(e,-e+t)),h=-o,$=at(o,h)+gt("a","0 0,1",e-t,ue(-o+t,-h-e));return{height:e,topLeft(T){return T?n:c},bottomLeft(){return $}}}makePuzzleTab(){const e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,o=at(-2,-t+3.4)+Bs(-.45*e,-2.1),n=ne("v",2.5)+at(.97*-e,2.5)+Yt("q",[ue(.05*-e,10),ue(.3*e,9.5)])+at(.67*e,-1.9)+ne("v",2.5),c=ne("v",-1.5)+at(-.92*e,-.5)+Yt("q",[ue(-.19*e,-5.5),ue(0,-11)])+at(.92*e,1),h=at(-5,t-.7)+Bs(.46*e,-2.1);return{width:e,height:t,pathUp($){return $?o:c},pathDown($){return $?n:h}}}makeNotch(){return{pathLeft:ne("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:Bs(5.1,2.6)+at(-10.2,6.8)+Bs(5.1,2.6),height:12,width:10.2}}makeStartHat(){const e=this.constantProvider.START_HAT.height,t=at(25,-8.7)+Yt("c",[ue(29.7,-6.2),ue(57.2,-.5),ue(75,8.7)]),o=Yt("c",[ue(17.8,-9.2),ue(45.3,-14.9),ue(75,-8.7)])+wt(100.5,e+.5);return{path(n){return n?t:o}}}},jy=class extends rp{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)}},Fy=class extends wr{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},zy=class extends kr{constructor(e,t){super(e,t),this.renderer_=e}getRenderer(){return this.renderer_}populateBottomRow_(){super.populateBottomRow_(),this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1]instanceof is||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}addInput_(e,t){this.isInline&&e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new jy(this.constants_,e)),t.hasInlineInput=!0):e instanceof is?(t.elements.push(new Fy(this.constants_,e)),t.hasStatement=!0):e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new Ol(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Us||e instanceof fo)&&(t.minHeight=Math.max(t.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),this.isInline||t.align!==null||(t.align=e.align)}addElemSpacing_(){let e=!1;for(let o=0,n;n=this.rows[o];o++)n.hasExternalInput&&(e=!0);for(let o=0,n;n=this.rows[o];o++){var t=n.elements;if(n.elements=[],n.startsWithElemSpacer()&&n.elements.push(new os(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let c=0;c<t.length-1;c++){n.elements.push(t[c]);const h=this.getInRowSpacing_(t[c],t[c+1]);n.elements.push(new os(this.constants_,h))}n.elements.push(t[t.length-1]),n.endsWithElemSpacer()&&(t=this.getInRowSpacing_(t[t.length-1],null),e&&n.hasDummyInput&&(t+=this.constants_.TAB_WIDTH),n.elements.push(new os(this.constants_,t)))}}}getInRowSpacing_(e,t){if(!e)return t&&S.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&S.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&S.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!S.isInput(e)&&(!t||S.isStatementInput(t)))return S.isField(e)&&e.isEditable?this.constants_.MEDIUM_PADDING:S.isIcon(e)?2*this.constants_.LARGE_PADDING+1:S.isHat(e)?this.constants_.NO_PADDING:S.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:S.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:S.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(S.isInput(e)&&!t){if(S.isExternalInput(e))return this.constants_.NO_PADDING;if(S.isInlineInput(e))return this.constants_.LARGE_PADDING;if(S.isStatementInput(e))return this.constants_.NO_PADDING}if(!S.isInput(e)&&t&&S.isInput(t)){if(S.isField(e)&&e.isEditable){if(S.isInlineInput(t)||S.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(S.isInlineInput(t)||S.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(S.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(S.isIcon(e)&&t&&!S.isInput(t))return this.constants_.LARGE_PADDING;if(S.isInlineInput(e)&&t&&S.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(S.isLeftSquareCorner(e)&&t){if(S.isHat(t))return this.constants_.NO_PADDING;if(S.isPreviousConnection(t))return t.notchOffset;if(S.isNextConnection(t))return t.notchOffset+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}if(S.isLeftRoundedCorner(e)&&t){if(S.isPreviousConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS;if(S.isNextConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}return S.isField(e)&&t&&S.isField(t)&&e.isEditable===t.isEditable||t&&S.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return S.isTopRow(e)&&S.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:S.isTopRow(e)||S.isBottomRow(t)?this.constants_.NO_PADDING:e.hasExternalInput&&t.hasExternalInput?this.constants_.LARGE_PADDING:!e.hasStatement&&t.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:e.hasStatement&&t.hasStatement||!e.hasStatement&&t.hasDummyInput||e.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){if(S.isSpacer(t))return e.yPos+t.height/2;if(S.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,S.isNextConnection(t)?e+t.height/2:e-t.height/2;if(S.isTopRow(e))return S.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let o=e.yPos;return S.isField(t)||S.isIcon(t)?(o+=t.height/2,(e.hasInlineInput||e.hasStatement)&&t.height+this.constants_.TALL_INPUT_FIELD_OFFSET_Y<=e.height&&(o+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y)):o=S.isInlineInput(t)?o+t.height/2:o+e.height/2,o}alignRowElements_(){if(this.isInline){var e=0,t=new WeakMap,o=null;for(let n=this.rows.length-1,c;c=this.rows[n];n--)t.set(c,e),S.isInputRow(c)&&(c.hasStatement&&this.alignStatementRow_(c),o&&o.hasStatement&&c.width<o.width?t.set(c,o.width):e=c.hasStatement?c.width:Math.max(e,c.width),o=c);e=0;for(let n=0,c;c=this.rows[n];n++)c.hasStatement?e=this.getDesiredRowWidth_(c):S.isSpacer(c)?c.width=Math.max(e,t.get(c)):(o=c.width,e=Math.max(e,t.get(c))-o,0<e&&this.addAlignmentPadding_(c,e),e=c.width)}else super.alignRowElements_()}getDesiredRowWidth_(e){return this.isInline&&e.hasStatement?this.statementEdge+this.constants_.MAX_BOTTOM_WIDTH+this.startX:super.getDesiredRowWidth_(e)}finalize_(){let e=0,t=0;for(let n=0,c;c=this.rows[n];n++){c.yPos=t,c.xPos=this.startX,t+=c.height,e=Math.max(e,c.widthWithConnectedBlocks);var o=t-this.topRow.ascenderHeight;c===this.bottomRow&&o<this.constants_.MIN_BLOCK_HEIGHT&&(o=this.constants_.MIN_BLOCK_HEIGHT-o,this.bottomRow.height+=o,t+=o),this.recordElemPositions_(c)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(o=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,o.getHeightWidth().width-this.constants_.DARK_PATH_OFFSET)),this.bottomRow.baseline=t-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX+this.constants_.DARK_PATH_OFFSET,this.width+=this.constants_.DARK_PATH_OFFSET,this.height=t+this.constants_.DARK_PATH_OFFSET,this.startY=this.topRow.capline}},Uy=class extends Ll{constructor(e,t,o){super(e,t,o),this.constants=o,this.colourDark="#000000",this.svgPathDark=N(x.PATH,{class:"blocklyPathDark",transform:"translate(1,1)"}),this.svgRoot.insertBefore(this.svgPathDark,this.svgPath),this.svgPathLight=N(x.PATH,{class:"blocklyPathLight"},this.svgRoot)}setPath(e){this.svgPath.setAttribute("d",e),this.svgPathDark.setAttribute("d",e)}setHighlightPath(e){this.svgPathLight.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)"),this.svgPathLight.setAttribute("transform","scale(-1 1)"),this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)")}applyColour(e){if(this.svgPathLight.style.display="",this.svgPathDark.style.display="",!this.style.colourTertiary)throw Error("The renderer did not properly initialize the tertiary colour of the block style");this.svgPathLight.setAttribute("stroke",this.style.colourTertiary),this.svgPathDark.setAttribute("fill",this.colourDark),super.applyColour(e),this.svgPath.setAttribute("stroke","none")}setStyle(e){this.style=e,this.colourDark=Ko("#000",this.style.colourPrimary,.2)||this.colourDark}updateHighlighted(e){e?(this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"),this.svgPathLight.style.display="none"):(this.svgPath.setAttribute("filter","none"),this.svgPathLight.style.display="inline")}updateShadow_(e){if(e){if(this.svgPathLight.style.display="none",!this.style.colourSecondary)throw Error("The renderer did not properly initialize the secondary colour of the block style block style");this.svgPathDark.setAttribute("fill",this.style.colourSecondary),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary)}}updateDisabled_(e){super.updateDisabled_(e),e&&this.svgPath.setAttribute("stroke","none")}},Hy=class extends Pl{constructor(e){super(e),this.highlightConstants=null}init(e,t){super.init(e,t),this.highlightConstants=this.makeHighlightConstants_(),this.highlightConstants.init()}refreshDom(e,t){super.refreshDom(e,t),this.getHighlightConstants().init()}makeConstants_(){return new Ny}makeRenderInfo_(e){return new zy(this,e)}makeDrawer_(e,t){return new Py(e,t)}makePathObject(e,t){return new Uy(e,t,this.getConstants())}makeHighlightConstants_(){return new By(this.getConstants())}getHighlightConstants(){if(!this.highlightConstants)throw Error("Cannot access the highlight constants because init has not been called");return this.highlightConstants}};er("geras",Hy);var Gs={};Gs.ConstantProvider=Ny,Gs.Drawer=Py,Gs.HighlightConstantProvider=By,Gs.Highlighter=Ly,Gs.InlineInput=jy,Gs.PathObject=Uy,Gs.RenderInfo=zy,Gs.Renderer=Hy,Gs.StatementInput=Fy;var Wy=class extends kr{constructor(e,t){super(e,t)}getRenderer(){return this.renderer_}addElemSpacing_(){let e=!1;for(var t=0;t<this.rows.length;t++)if(this.rows[t].hasExternalInput){e=!0;break}for(t=0;t<this.rows.length;t++){const n=this.rows[t];var o=n.elements;if(n.elements=[],n.startsWithElemSpacer()&&n.elements.push(new os(this.constants_,this.getInRowSpacing_(null,o[0]))),o.length){for(let c=0;c<o.length-1;c++){n.elements.push(o[c]);const h=this.getInRowSpacing_(o[c],o[c+1]);n.elements.push(new os(this.constants_,h))}n.elements.push(o[o.length-1]),n.endsWithElemSpacer()&&(o=this.getInRowSpacing_(o[o.length-1],null),e&&n.hasDummyInput&&(o+=this.constants_.TAB_WIDTH),n.elements.push(new os(this.constants_,o)))}}}getInRowSpacing_(e,t){if(!e)return t&&S.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&S.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&S.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!S.isInput(e)&&!t)return S.isField(e)&&e.isEditable?this.constants_.MEDIUM_PADDING:S.isIcon(e)?2*this.constants_.LARGE_PADDING+1:S.isHat(e)?this.constants_.NO_PADDING:S.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:S.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:S.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(S.isInput(e)&&!t){if(S.isExternalInput(e))return this.constants_.NO_PADDING;if(S.isInlineInput(e))return this.constants_.LARGE_PADDING;if(S.isStatementInput(e))return this.constants_.NO_PADDING}if(!S.isInput(e)&&t&&S.isInput(t)){if(S.isField(e)&&e.isEditable){if(S.isInlineInput(t)||S.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(S.isInlineInput(t)||S.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(S.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(S.isIcon(e)&&t&&!S.isInput(t))return this.constants_.LARGE_PADDING;if(S.isInlineInput(e)&&t&&S.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(S.isLeftSquareCorner(e)&&t){if(S.isHat(t))return this.constants_.NO_PADDING;if(S.isPreviousConnection(t)||S.isNextConnection(t))return t.notchOffset}return S.isLeftRoundedCorner(e)&&t?t.notchOffset-this.constants_.CORNER_RADIUS:S.isField(e)&&t&&S.isField(t)&&e.isEditable===t.isEditable||t&&S.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return S.isTopRow(e)&&S.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:S.isTopRow(e)||S.isBottomRow(t)?this.constants_.NO_PADDING:e.hasExternalInput&&t.hasExternalInput?this.constants_.LARGE_PADDING:!e.hasStatement&&t.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:e.hasStatement&&t.hasStatement||e.hasDummyInput||t.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){if(S.isSpacer(t))return e.yPos+t.height/2;if(S.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,S.isNextConnection(t)?e+t.height/2:e-t.height/2;if(S.isTopRow(e))return S.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let o=e.yPos;return o=S.isField(t)&&e.hasStatement?o+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+t.height/2):o+e.height/2}finalize_(){let e=0,t=0;for(var o=0;o<this.rows.length;o++){const c=this.rows[o];c.yPos=t,c.xPos=this.startX,t+=c.height,e=Math.max(e,c.widthWithConnectedBlocks);var n=t-this.topRow.ascenderHeight;c===this.bottomRow&&n<this.constants_.MIN_BLOCK_HEIGHT&&(n=this.constants_.MIN_BLOCK_HEIGHT-n,this.bottomRow.height+=n,t+=n),this.recordElemPositions_(c)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(o=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,o.getHeightWidth().width)),this.bottomRow.baseline=t-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX,this.height=t,this.startY=this.topRow.capline}},Vy=class extends Pl{constructor(e){super(e)}makeRenderInfo_(e){return new Wy(this,e)}};er("thrasos",Vy);var Vp={};Vp.RenderInfo=Wy,Vp.Renderer=Vy;var hk={colour_blocks:{colourPrimary:"#CF63CF",colourSecondary:"#C94FC9",colourTertiary:"#BD42BD"},list_blocks:{colourPrimary:"#9966FF",colourSecondary:"#855CD6",colourTertiary:"#774DCB"},logic_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC"},loop_blocks:{colourPrimary:"#0fBD8C",colourSecondary:"#0DA57A",colourTertiary:"#0B8E69"},math_blocks:{colourPrimary:"#59C059",colourSecondary:"#46B946",colourTertiary:"#389438"},procedure_blocks:{colourPrimary:"#FF6680",colourSecondary:"#FF4D6A",colourTertiary:"#FF3355"},text_blocks:{colourPrimary:"#FFBF00",colourSecondary:"#E6AC00",colourTertiary:"#CC9900"},variable_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},variable_dynamic_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},hat_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC",hat:"cap"}},pk={colour_category:{colour:"#CF63CF"},list_category:{colour:"#9966FF"},logic_category:{colour:"#4C97FF"},loop_category:{colour:"#0fBD8C"},math_category:{colour:"#59C059"},procedure_category:{colour:"#FF6680"},text_category:{colour:"#FFBF00"},variable_category:{colour:"#FF8C1A"},variable_dynamic_category:{colour:"#FF8C1A"}},gk=new di("zelos",hk,pk),mk={Classic:El,Zelos:gk},Gp=class{constructor(e,t,o){this.id_=e.toolboxitemid||k(),this.level_=(this.parent_=o||null)?this.parent_.getLevel()+1:0,this.toolboxItemDef_=e,this.parentToolbox_=t,this.workspace_=this.parentToolbox_.getWorkspace()}init(){}getDiv(){return null}getClickTarget(){return null}getId(){return this.id_}getParent(){return null}getLevel(){return this.level_}isSelectable(){return!1}isCollapsible(){return!1}dispose(){}setVisible_(e){}},Ds=class extends Gp{constructor(e,t,o){super(e,t,o),this.colour_=this.name_="",this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null,this.isDisabled_=this.isHidden_=!1,this.flyoutItems_=[],this.cssConfig_=this.makeDefaultCssConfig_()}init(){this.parseCategoryDef_(this.toolboxItemDef_),this.parseContents_(this.toolboxItemDef_),this.createDom_(),this.toolboxItemDef_.hidden==="true"&&this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategory",row:"blocklyTreeRow",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyTreeIcon",label:"blocklyTreeLabel",contents:"blocklyToolboxContents",selected:"blocklyTreeSelected",openicon:"blocklyTreeIconOpen",closedicon:"blocklyTreeIconClosed"}}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else if(e=e.contents)for(let t=0;t<e.length;t++){const o=e[t];Array.isArray(this.flyoutItems_)&&this.flyoutItems_.push(o)}}parseCategoryDef_(e){this.name_="name"in e?pt(e.name):"",this.colour_=this.getColour_(e),Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}createDom_(){this.htmlDiv_=this.createContainer_(),_o(this.htmlDiv_,ks.TREEITEM),It(this.htmlDiv_,Ct.SELECTED,!1),It(this.htmlDiv_,Ct.LEVEL,this.level_+1),this.rowDiv_=this.createRowContainer_(),this.rowDiv_.style.pointerEvents="auto",this.htmlDiv_.appendChild(this.rowDiv_),this.rowContents_=this.createRowContentsContainer_(),this.rowContents_.style.pointerEvents="none",this.rowDiv_.appendChild(this.rowContents_),this.iconDom_=this.createIconDom_(),_o(this.iconDom_,ks.PRESENTATION),this.rowContents_.appendChild(this.iconDom_),this.labelDom_=this.createLabelDom_(this.name_),this.rowContents_.appendChild(this.labelDom_);const e=this.labelDom_.getAttribute("id");return e&&It(this.htmlDiv_,Ct.LABELLEDBY,e),this.addColourBorder_(this.colour_),this.htmlDiv_}createContainer_(){const e=document.createElement("div"),t=this.cssConfig_.container;return t&&ge(e,t),e}createRowContainer_(){const e=document.createElement("div");var t=this.cssConfig_.row;return t&&ge(e,t),t=`${Ds.nestedPadding*this.getLevel()}px`,this.workspace_.RTL?e.style.paddingRight=t:e.style.paddingLeft=t,e}createRowContentsContainer_(){const e=document.createElement("div"),t=this.cssConfig_.rowcontentcontainer;return t&&ge(e,t),e}createIconDom_(){const e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){const t=this.cssConfig_.icon;t&&ge(e,t)}return e.style.display="inline-block",e}createLabelDom_(e){const t=document.createElement("span");return t.setAttribute("id",this.getId()+".label"),t.textContent=e,(e=this.cssConfig_.label)&&ge(t,e),t}refreshTheme(){this.colour_=this.getColour_(this.toolboxItemDef_),this.addColourBorder_(this.colour_)}addColourBorder_(e){e&&(e=Ds.borderWidth+"px solid "+(e||"#ddd"),this.workspace_.RTL?this.rowDiv_.style.borderRight=e:this.rowDiv_.style.borderLeft=e)}getColour_(e){const t=e.categorystyle||e.categoryStyle;if((e=e.colour)&&t)console.warn('Toolbox category "'+this.name_+'" must not have both a style and a colour');else{if(t)return this.getColourfromStyle(t);if(e)return this.parseColour(e)}return""}getColourfromStyle(e){var t=this.workspace_.getTheme();if(e&&t){if((t=t.categoryStyles[e])&&t.colour)return this.parseColour(t.colour);console.warn('Style "'+e+'" must exist and contain a colour value')}return""}getClickTarget(){return this.rowDiv_}parseColour(e){if(e=pt(e),e==null||e==="")return"";var t=Number(e);return isNaN(t)?(t=Go(e))?t:(console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+e),""):sd(t)}openIcon_(e){if(e){var t=this.cssConfig_.closedicon;t&&la(e,t),(t=this.cssConfig_.openicon)&&ge(e,t)}}closeIcon_(e){if(e){var t=this.cssConfig_.openicon;t&&la(e,t),(t=this.cssConfig_.closedicon)&&ge(e,t)}}setVisible_(e){this.htmlDiv_.style.display=e?"block":"none",this.isHidden_=!e,this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()}hide(){this.setVisible_(!1)}show(){this.setVisible_(!0)}isVisible(){return!this.isHidden_&&this.allAncestorsExpanded_()}allAncestorsExpanded_(){let e=this;for(;e.getParent();)if(e=e.getParent(),!e.isExpanded())return!1;return!0}isSelectable(){return this.isVisible()&&!this.isDisabled_}onClick(e){}setSelected(e){if(this.rowDiv_){var t=this.cssConfig_.selected;if(e){const o=this.parseColour(Ds.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||o,t&&ge(this.rowDiv_,t)}else this.rowDiv_.style.backgroundColor="",t&&ot(this.rowDiv_,t);It(this.htmlDiv_,Ct.SELECTED,e)}}setDisabled(e){this.isDisabled_=e,this.getDiv().setAttribute("disabled",`${e}`),e?this.getDiv().setAttribute("disabled","true"):this.getDiv().removeAttribute("disabled")}getName(){return this.name_}getParent(){return this.parent_}getDiv(){return this.htmlDiv_}getContents(){return this.flyoutItems_}updateFlyoutContents(e){this.flyoutItems_=[],this.toolboxItemDef_=typeof e=="string"?{kind:this.toolboxItemDef_.kind,custom:e,id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden}:{kind:this.toolboxItemDef_.kind,name:"name"in this.toolboxItemDef_?this.toolboxItemDef_.name:"",contents:Bn(e),id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden},this.parseContents_(this.toolboxItemDef_)}dispose(){Ke(this.htmlDiv_)}};Ds.registrationName="category",Ds.nestedPadding=19,Ds.borderWidth=8,Ds.defaultBackgroundColour="#57e",Et(`
895
+ .blocklyTreeRow:not(.blocklyTreeSelected):hover {
896
+ background-color: rgba(255, 255, 255, .2);
897
+ }
898
+
899
+ .blocklyToolboxDiv[layout="h"] .blocklyToolboxCategory {
900
+ margin: 1px 5px 1px 0;
901
+ }
902
+
903
+ .blocklyToolboxDiv[dir="RTL"][layout="h"] .blocklyToolboxCategory {
904
+ margin: 1px 0 1px 5px;
905
+ }
906
+
907
+ .blocklyTreeRow {
908
+ height: 22px;
909
+ line-height: 22px;
910
+ margin-bottom: 3px;
911
+ padding-right: 8px;
912
+ white-space: nowrap;
913
+ }
914
+
915
+ .blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {
916
+ margin-left: 8px;
917
+ padding-right: 0;
918
+ }
919
+
920
+ .blocklyTreeIcon {
921
+ background-image: url(<<<PATH>>>/sprites.png);
922
+ height: 16px;
923
+ vertical-align: middle;
924
+ visibility: hidden;
925
+ width: 16px;
926
+ }
927
+
928
+ .blocklyTreeIconClosed {
929
+ background-position: -32px -1px;
930
+ }
931
+
932
+ .blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {
933
+ background-position: 0 -1px;
934
+ }
935
+
936
+ .blocklyTreeSelected>.blocklyTreeIconClosed {
937
+ background-position: -32px -17px;
938
+ }
939
+
940
+ .blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {
941
+ background-position: 0 -17px;
942
+ }
943
+
944
+ .blocklyTreeIconOpen {
945
+ background-position: -16px -1px;
946
+ }
947
+
948
+ .blocklyTreeSelected>.blocklyTreeIconOpen {
949
+ background-position: -16px -17px;
950
+ }
951
+
952
+ .blocklyTreeLabel {
953
+ cursor: default;
954
+ font: 16px sans-serif;
955
+ padding: 0 3px;
956
+ vertical-align: middle;
957
+ }
958
+
959
+ .blocklyToolboxDelete .blocklyTreeLabel {
960
+ cursor: url("<<<PATH>>>/handdelete.cur"), auto;
961
+ }
962
+
963
+ .blocklyTreeSelected .blocklyTreeLabel {
964
+ color: #fff;
965
+ }
966
+ `),r(F.TOOLBOX_ITEM,Ds.registrationName,Ds);var Rr=class extends Gp{constructor(e,t){super(e,t),this.cssConfig_={container:"blocklyTreeSeparator"},this.htmlDiv=null,Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}init(){this.createDom_()}createDom_(){const e=document.createElement("div"),t=this.cssConfig_.container;return t&&ge(e,t),this.htmlDiv=e}getDiv(){return this.htmlDiv}dispose(){Ke(this.htmlDiv)}};Rr.registrationName="sep",Et(`
967
+ .blocklyTreeSeparator {
968
+ border-bottom: solid #e5e5e5 1px;
969
+ height: 0;
970
+ margin: 5px 0;
971
+ }
972
+
973
+ .blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {
974
+ border-right: solid #e5e5e5 1px;
975
+ border-bottom: none;
976
+ height: auto;
977
+ margin: 0 5px 0 5px;
978
+ padding: 5px 0;
979
+ width: 0;
980
+ }
981
+ `),r(F.TOOLBOX_ITEM,Rr.registrationName,Rr);var dn=class extends Ds{constructor(e,t,o){super(e,t,o),this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[]}makeDefaultCssConfig_(){const e=super.makeDefaultCssConfig_();return e.contents="blocklyToolboxContents",e}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else{const t=e.contents;if(t){this.flyoutItems_=[],e=!0;for(let o=0;o<t.length;o++){const n=t[o];!p(F.TOOLBOX_ITEM,n.kind)||n.kind.toLowerCase()===Rr.registrationName&&e?(this.flyoutItems_.push(n),e=!0):(this.createToolboxItem(n),e=!1)}}}}createToolboxItem(e){let t=e.kind;t.toUpperCase()==="CATEGORY"&&fa(e)&&(t=dn.registrationName),e=new(m(F.TOOLBOX_ITEM,t))(e,this.parentToolbox_,this),this.toolboxItems_.push(e)}init(){super.init(),this.setExpanded(this.toolboxItemDef_.expanded==="true"||this.toolboxItemDef_.expanded===!0)}createDom_(){super.createDom_();const e=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(e),_o(this.subcategoriesDiv_,ks.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.closeIcon_(this.iconDom_),It(this.htmlDiv_,Ct.EXPANDED,!1),this.htmlDiv_}createIconDom_(){const e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){const t=this.cssConfig_.icon;t&&ge(e,t),e.style.visibility="visible"}return e.style.display="inline-block",e}createSubCategoriesDom_(e){const t=document.createElement("div");t.style.display="none";var o=this.cssConfig_.contents;for(o&&ge(t,o),o=0;o<e.length;o++){const n=e[o];n.init();const c=n.getDiv();if(t.appendChild(c),n.getClickTarget){let h;(h=n.getClickTarget())==null||h.setAttribute("id",n.getId())}}return t}setExpanded(e){if(this.expanded_!==e){if(this.expanded_=e)this.subcategoriesDiv_.style.display="block",this.openIcon_(this.iconDom_);else{let t;(t=this.parentToolbox_.getFlyout())==null||t.setVisible(!1),this.subcategoriesDiv_.style.display="none",this.closeIcon_(this.iconDom_)}It(this.htmlDiv_,Ct.EXPANDED,e),this.parentToolbox_.handleToolboxItemResize()}}setVisible_(e){this.htmlDiv_.style.display=e?"block":"none";const t=this.getChildToolboxItems();for(let o=0;o<t.length;o++)t[o].setVisible_(e);this.isHidden_=!e,this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()}isExpanded(){return this.expanded_}isCollapsible(){return!0}onClick(e){this.toggleExpanded()}toggleExpanded(){this.setExpanded(!this.expanded_)}getDiv(){return this.htmlDiv_}getChildToolboxItems(){return this.toolboxItems_}};dn.registrationName="collapsibleCategory",r(F.TOOLBOX_ITEM,dn.registrationName,dn);var Gy=class extends jl{constructor(e){super(),this.id="toolbox",this.contentsDiv_=this.HtmlDiv=null,this.isVisible_=!1,this.contents_=[],this.height_=this.width_=0,this.previouslySelectedItem_=this.selectedItem_=this.flyout=null,this.boundEvents_=[],this.workspace_=e,this.toolboxDef_=e.options.languageTree||{contents:[]},this.horizontalLayout=e.options.horizontalLayout,this.RTL=e.options.RTL,this.contentMap_=Object.create(null),this.toolboxPosition=e.options.toolboxPosition}onShortcut(e){return!1}init(){var e=this.workspace_;const t=e.getParentSvg();this.flyout=this.createFlyout_(),this.HtmlDiv=this.createDom_(this.workspace_),Uo(this.flyout.createDom("svg"),t),this.setVisible(!0),this.flyout.init(e),this.render(this.toolboxDef_),e=e.getThemeManager(),e.subscribe(this.HtmlDiv,"toolboxBackgroundColour","background-color"),e.subscribe(this.HtmlDiv,"toolboxForegroundColour","color"),this.workspace_.getComponentManager().addComponent({component:this,weight:lt.ComponentWeight.TOOLBOX_WEIGHT,capabilities:[lt.Capability.AUTOHIDEABLE,lt.Capability.DELETE_AREA,lt.Capability.DRAG_TARGET]})}createDom_(e){e=e.getParentSvg();const t=this.createContainer_();return this.contentsDiv_=this.createContentsContainer_(),this.contentsDiv_.tabIndex=0,_o(this.contentsDiv_,ks.TREE),t.appendChild(this.contentsDiv_),e.parentNode.insertBefore(t,e),this.attachEvents_(t,this.contentsDiv_),t}createContainer_(){const e=document.createElement("div");return e.setAttribute("layout",this.isHorizontal()?"h":"v"),ge(e,"blocklyToolboxDiv"),e.setAttribute("dir",this.RTL?"RTL":"LTR"),e}createContentsContainer_(){const e=document.createElement("div");return ge(e,"blocklyToolboxContents"),this.isHorizontal()&&(e.style.flexDirection="row"),e}attachEvents_(e,t){e=X(e,"pointerdown",this,this.onClick_,!1),this.boundEvents_.push(e),t=X(t,"keydown",this,this.onKeyDown_,!1),this.boundEvents_.push(t)}onClick_(e){if(ve(e)||e.target===this.HtmlDiv)U().hideChaff(!1);else{var t=e.target.getAttribute("id");t&&(t=this.getToolboxItemById(t),t.isSelectable()&&(this.setSelectedItem(t),t.onClick(e))),U().hideChaff(!0)}ke()}onKeyDown_(e){let t=!1;switch(e.key){case"ArrowDown":t=this.selectNext();break;case"ArrowUp":t=this.selectPrevious();break;case"ArrowLeft":t=this.selectParent();break;case"ArrowRight":t=this.selectChild();break;case"Enter":case" ":this.selectedItem_&&this.selectedItem_.isCollapsible()&&(this.selectedItem_.toggleExpanded(),t=!0);break;default:t=!1}!t&&this.selectedItem_&&this.selectedItem_.onKeyDown&&(t=this.selectedItem_.onKeyDown(e)),t&&e.preventDefault()}createFlyout_(){const e=this.workspace_,t=new ds({parentWorkspace:e,rtl:e.RTL,oneBasedIndex:e.options.oneBasedIndex,horizontalLayout:e.horizontalLayout,renderer:e.options.renderer,rendererOverrides:e.options.rendererOverrides,move:{scrollbars:!0}});return t.toolboxPosition=e.options.toolboxPosition,new(e.horizontalLayout?_(F.FLYOUTS_HORIZONTAL_TOOLBOX,e.options,!0):_(F.FLYOUTS_VERTICAL_TOOLBOX,e.options,!0))(t)}render(e){this.toolboxDef_=e;for(let t=0;t<this.contents_.length;t++){const o=this.contents_[t];o&&o.dispose()}this.contents_=[],this.contentMap_=Object.create(null),this.renderContents_(e.contents),this.position(),this.handleToolboxItemResize()}renderContents_(e){const t=document.createDocumentFragment();for(let o=0;o<e.length;o++)this.createToolboxItem(e[o],t);this.contentsDiv_.appendChild(t)}createToolboxItem(e,t){var o=e.kind;o.toUpperCase()==="CATEGORY"&&fa(e)&&(o=dn.registrationName),(o=m(F.TOOLBOX_ITEM,o.toLowerCase()))&&(e=new o(e,this),e.init(),this.addToolboxItem_(e),(o=e.getDiv())&&t.appendChild(o),e.getClickTarget()&&e.getClickTarget().setAttribute("id",e.getId()))}addToolboxItem_(e){if(this.contents_.push(e),this.contentMap_[e.getId()]=e,e.isCollapsible()){e=e.getChildToolboxItems();for(let t=0;t<e.length;t++)this.addToolboxItem_(e[t])}}getToolboxItems(){return this.contents_}addStyle(e){e&&this.HtmlDiv&&ge(this.HtmlDiv,e)}removeStyle(e){e&&this.HtmlDiv&&ot(this.HtmlDiv,e)}getClientRect(){if(!this.HtmlDiv||!this.isVisible_)return null;var e=this.HtmlDiv.getBoundingClientRect();const t=e.top,o=t+e.height,n=e.left;return e=n+e.width,this.toolboxPosition===Ee.TOP?new qe(-1e7,o,-1e7,1e7):this.toolboxPosition===Ee.BOTTOM?new qe(t,1e7,-1e7,1e7):this.toolboxPosition===Ee.LEFT?new qe(-1e7,1e7,-1e7,e):new qe(-1e7,1e7,n,1e7)}wouldDelete(e){return e instanceof gs?this.updateWouldDelete_(!e.getParent()&&e.isDeletable()):this.updateWouldDelete_(ls(e)&&e.isDeletable()),this.wouldDelete_}onDragEnter(e){this.updateCursorDeleteStyle_(!0)}onDragExit(e){this.updateCursorDeleteStyle_(!1)}onDrop(e){this.updateCursorDeleteStyle_(!1)}updateWouldDelete_(e){e!==this.wouldDelete_&&(this.updateCursorDeleteStyle_(!1),this.wouldDelete_=e,this.updateCursorDeleteStyle_(!0))}updateCursorDeleteStyle_(e){const t=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";e?this.addStyle(t):this.removeStyle(t)}getToolboxItemById(e){return this.contentMap_[e]||null}getWidth(){return this.width_}getHeight(){return this.height_}getFlyout(){return this.flyout}getWorkspace(){return this.workspace_}getSelectedItem(){return this.selectedItem_}getPreviouslySelectedItem(){return this.previouslySelectedItem_}isHorizontal(){return this.horizontalLayout}position(){const e=this.workspace_.getMetrics(),t=this.HtmlDiv;t&&(this.horizontalLayout?(t.style.left="0",t.style.height="auto",t.style.width="100%",this.height_=t.offsetHeight,this.width_=e.viewWidth,this.toolboxPosition===Ee.TOP?t.style.top="0":t.style.bottom="0"):(this.toolboxPosition===Ee.RIGHT?t.style.right="0":t.style.left="0",t.style.height="100%",this.width_=t.offsetWidth,this.height_=e.viewHeight),this.flyout.position())}handleToolboxItemResize(){const e=this.workspace_,t=this.HtmlDiv.getBoundingClientRect();e.translate(this.toolboxPosition===Ee.LEFT?e.scrollX+t.width:e.scrollX,this.toolboxPosition===Ee.TOP?e.scrollY+t.height:e.scrollY),Ce(e)}clearSelection(){this.setSelectedItem(null)}refreshTheme(){for(let e=0;e<this.contents_.length;e++){const t=this.contents_[e];t.refreshTheme&&t.refreshTheme()}}refreshSelection(){this.selectedItem_&&this.selectedItem_.isSelectable()&&this.selectedItem_.getContents().length&&this.flyout.show(this.selectedItem_.getContents())}setVisible(e){this.isVisible_!==e&&(this.HtmlDiv.style.display=e?"block":"none",this.isVisible_=e,this.workspace_.recordDragTargets())}autoHide(e){!e&&this.flyout&&this.flyout.autoClose&&this.clearSelection()}setSelectedItem(e){const t=this.selectedItem_;!e&&!t||e&&!lb(e)||(this.shouldDeselectItem_(t,e)&&t!==null&&this.deselectItem_(t),this.shouldSelectItem_(t,e)&&e!==null&&this.selectItem_(t,e),this.updateFlyout_(t,e),this.fireSelectEvent(t,e))}shouldDeselectItem_(e,t){return e!==null&&(!e.isCollapsible()||e!==t)}shouldSelectItem_(e,t){return t!==null&&t!==e}deselectItem_(e){this.selectedItem_=null,this.previouslySelectedItem_=e,e.setSelected(!1),It(this.contentsDiv_,Ct.ACTIVEDESCENDANT,"")}selectItem_(e,t){this.selectedItem_=t,this.previouslySelectedItem_=e,t.setSelected(!0),It(this.contentsDiv_,Ct.ACTIVEDESCENDANT,t.getId())}selectItemByPosition(e){-1<e&&e<this.contents_.length&&(e=this.contents_[e],e.isSelectable()&&this.setSelectedItem(e))}updateFlyout_(e,t){t&&(e!==t||t.isCollapsible())&&t.getContents().length?(this.flyout.show(t.getContents()),this.flyout.scrollToStart()):this.flyout.hide()}fireSelectEvent(e,t){const o=e&&e.getName();let n=t&&t.getName();e===t&&(n=null),e=new(G(O.TOOLBOX_ITEM_SELECT))(o,n,this.workspace_.id),z(e)}selectParent(){return this.selectedItem_?this.selectedItem_.isCollapsible()&&this.selectedItem_.isExpanded()?(this.selectedItem_.toggleExpanded(),!0):this.selectedItem_.getParent()&&this.selectedItem_.getParent().isSelectable()?(this.setSelectedItem(this.selectedItem_.getParent()),!0):!1:!1}selectChild(){if(!this.selectedItem_||!this.selectedItem_.isCollapsible())return!1;const e=this.selectedItem_;return e.isExpanded()?this.selectNext():e.toggleExpanded(),!0}selectNext(){if(!this.selectedItem_)return!1;let e=this.contents_.indexOf(this.selectedItem_)+1;if(-1<e&&e<this.contents_.length){let t=this.contents_[e];for(;t&&!t.isSelectable();)t=this.contents_[++e];if(t&&t.isSelectable())return this.setSelectedItem(t),!0}return!1}selectPrevious(){if(!this.selectedItem_)return!1;let e=this.contents_.indexOf(this.selectedItem_)-1;if(-1<e&&e<this.contents_.length){let t=this.contents_[e];for(;t&&!t.isSelectable();)t=this.contents_[--e];if(t&&t.isSelectable())return this.setSelectedItem(t),!0}return!1}dispose(){this.workspace_.getComponentManager().removeComponent("toolbox"),this.flyout.dispose();for(var e=0;e<this.contents_.length;e++)this.contents_[e].dispose();for(e=0;e<this.boundEvents_.length;e++)ze(this.boundEvents_[e]);this.boundEvents_=[],this.contents_=[],this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),Ke(this.HtmlDiv))}};Et(`
982
+ .blocklyToolboxDelete {
983
+ cursor: url("<<<PATH>>>/handdelete.cur"), auto;
984
+ }
985
+
986
+ .blocklyToolboxGrab {
987
+ cursor: url("<<<PATH>>>/handclosed.cur"), auto;
988
+ cursor: grabbing;
989
+ cursor: -webkit-grabbing;
990
+ }
991
+
992
+ /* Category tree in Toolbox. */
993
+ .blocklyToolboxDiv {
994
+ background-color: #ddd;
995
+ overflow-x: visible;
996
+ overflow-y: auto;
997
+ padding: 4px 0 4px 0;
998
+ position: absolute;
999
+ z-index: 70; /* so blocks go under toolbox when dragging */
1000
+ -webkit-tap-highlight-color: transparent; /* issue #1345 */
1001
+ }
1002
+
1003
+ .blocklyToolboxContents {
1004
+ display: flex;
1005
+ flex-wrap: wrap;
1006
+ flex-direction: column;
1007
+ }
1008
+
1009
+ .blocklyToolboxContents:focus {
1010
+ outline: none;
1011
+ }
1012
+ `),r(F.TOOLBOX,js,Gy);var fk="11.2.2",$k=oe.INPUT_VALUE,bk=oe.OUTPUT_VALUE,vk=oe.NEXT_STATEMENT,yk=oe.PREVIOUS_STATEMENT,_k=Ee.TOP,wk=Ee.BOTTOM,Ck=Ee.LEFT,Tk=Ee.RIGHT;rn.prototype.newBlock=function(e,t){return new Oo(this,e,t)},ns.prototype.newBlock=function(e,t){return new gs(this,e,t)},rn.prototype.newComment=function(e){return new Tl(this,e)},ns.prototype.newComment=function(e){return new kl(this,e)},ns.newTrashcan=function(e){return new Uv(e)},uo.prototype.newWorkspaceSvg=function(e){return new ns(e)},i.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=Ka(e),e=e[0].concat(e[1]);for(let t=0;t<e.length;t++)this.getName(e[t][0],i.Names$$module$build$src$core$names.NameType.PROCEDURE)};var M={};return M.ASTNode=P,M.BasicCursor=Er,M.Block=Oo,M.BlockSvg=gs,M.Blocks=Jt,M.COLLAPSED_FIELD_NAME=dl,M.COLLAPSED_INPUT_NAME=ur,M.COLLAPSE_CHARS=Mv,M.CodeGenerator=i.CodeGenerator$$module$build$src$core$generator,M.CollapsibleToolboxCategory=dn,M.ComponentManager=lt,M.Connection=Be,M.ConnectionChecker=Nv,M.ConnectionDB=tn,M.ConnectionType=oe,M.ContextMenu=ui,M.ContextMenuItems=Tt,M.ContextMenuRegistry=xe,M.Css=Th,M.Cursor=yp,M.DELETE_VARIABLE_ID=mp,M.DeleteArea=jl,M.DragTarget=zv,M.DropDownDiv=Nt,M.Events=Q,M.Extensions=Is,M.Field=Qe,M.FieldCheckbox=fi,M.FieldDropdown=qt,M.FieldImage=mi,M.FieldLabel=hi,M.FieldLabelSerializable=ay,M.FieldNumber=Ap,M.FieldTextInput=Wl,M.FieldVariable=xr,M.Flyout=Gl,M.FlyoutButton=hs,M.FlyoutMetricsManager=ny,M.Generator=i.CodeGenerator$$module$build$src$core$generator,M.Gesture=co,M.Grid=ep,M.HorizontalFlyout=ry,M.INPUT_VALUE=$k,M.Input=nn,M.InsertionMarkerManager=ps,M.InsertionMarkerPreviewer=sy,M.Marker=Bv,M.MarkerManager=mr,M.Menu=Ah,M.MenuItem=Rh,M.MetricsManager=Ip,M.Msg=i.Msg$$module$build$src$core$msg,M.NEXT_STATEMENT=vk,M.Names=i.Names$$module$build$src$core$names,M.OPPOSITE_TYPE=gi,M.OUTPUT_VALUE=bk,M.Options=ds,M.PREVIOUS_STATEMENT=yk,M.PROCEDURE_CATEGORY_NAME=Rl,M.Procedures=zt,M.RENAME_VARIABLE_ID=gp,M.RenderedConnection=Ut,M.Scrollbar=mt,M.ScrollbarPair=Ep,M.ShortcutItems=Ws,M.ShortcutRegistry=He,M.TOOLBOX_AT_BOTTOM=wk,M.TOOLBOX_AT_LEFT=Ck,M.TOOLBOX_AT_RIGHT=Tk,M.TOOLBOX_AT_TOP=_k,M.TabNavigateCursor=jv,M.Theme=di,M.ThemeManager=Ov,M.Themes=mk,M.Toolbox=Gy,M.ToolboxCategory=Ds,M.ToolboxItem=Gp,M.ToolboxSeparator=Rr,M.Tooltip=ts,M.Touch=ei,M.Trashcan=Uv,M.UnattachedFieldError=ft,M.VARIABLE_CATEGORY_NAME=Bh,M.VARIABLE_DYNAMIC_CATEGORY_NAME=pp,M.VERSION=fk,M.VariableMap=bp,M.VariableModel=hr,M.Variables=At,M.VariablesDynamic=pi,M.VerticalFlyout=Dp,M.WidgetDiv=Es,M.Workspace=rn,M.WorkspaceAudio=Lv,M.WorkspaceDragger=fv,M.WorkspaceSvg=ns,M.Xml=Lt,M.ZoomControls=Fb,M.blockAnimations=yr,M.blockRendering=We,M.browserEvents=no,M.bubbles=Ar,M.bumpObjects=Bl,M.clipboard=Ir,M.comments=Kl,M.common=Dt,M.config=i.config$$module$build$src$core$config,M.constants=UT,M.defineBlocksWithJsonArray=pe,M.dialog=oi,M.dragging=Dr,M.fieldRegistry=Il,M.geras=Gs,M.getMainWorkspace=U,M.getSelected=I,M.hasBubble=Oi,M.hideChaff=cb,M.icons=Ao,M.inject=J$,M.inputs=Lo,M.isCopyable=tr,M.isDeletable=ls,M.isDraggable=Xo,M.isIcon=Dd,M.isObservable=Ga,M.isPaster=nb,M.isRenderedElement=rb,M.isSelectable=ab,M.isSerializable=zn,M.isVariableBackedParameterModel=Cu,M.layers=HT,M.procedures=zt,M.registry=oo,M.renderManagement=pl,M.serialization=uk,M.setLocale=Lh,M.setParentContainer=W,M.svgResize=Ce,M.thrasos=Vp,M.uiPosition=si,M.utils=ut,M.zelos=xs,M.__namespace__=i,M})})(Fm);var J0=Fm.exports;const q0=Si(J0),{ASTNode:Rse,BasicCursor:Ose,Block:Mse,BlockSvg:Nse,Blocks:Lse,COLLAPSED_FIELD_NAME:Pse,COLLAPSED_INPUT_NAME:Bse,COLLAPSE_CHARS:jse,CodeGenerator:Fse,CollapsibleToolboxCategory:zse,ComponentManager:Use,Connection:Hse,ConnectionChecker:Wse,ConnectionDB:Vse,ConnectionType:Gse,ContextMenu:Kse,ContextMenuItems:Yse,ContextMenuRegistry:Jse,Css:qse,Cursor:Xse,DELETE_VARIABLE_ID:Zse,DeleteArea:Qse,DragTarget:eoe,DropDownDiv:toe,Events:soe,Extensions:ooe,Field:ioe,FieldCheckbox:noe,FieldDropdown:roe,FieldImage:aoe,FieldLabel:loe,FieldLabelSerializable:coe,FieldNumber:uoe,FieldTextInput:doe,FieldVariable:hoe,Flyout:poe,FlyoutButton:goe,FlyoutMetricsManager:moe,Generator:foe,Gesture:$oe,Grid:boe,HorizontalFlyout:voe,INPUT_VALUE:yoe,Input:_oe,InsertionMarkerManager:woe,InsertionMarkerPreviewer:Coe,Marker:Toe,MarkerManager:koe,Menu:Soe,MenuItem:Eoe,MetricsManager:Ioe,Msg:xoe,NEXT_STATEMENT:Doe,Names:Aoe,OPPOSITE_TYPE:Roe,OUTPUT_VALUE:Ooe,Options:Moe,PREVIOUS_STATEMENT:Noe,PROCEDURE_CATEGORY_NAME:Loe,Procedures:Poe,RENAME_VARIABLE_ID:Boe,RenderedConnection:joe,Scrollbar:Foe,ScrollbarPair:zoe,ShortcutItems:Uoe,ShortcutRegistry:Hoe,TOOLBOX_AT_BOTTOM:Woe,TOOLBOX_AT_LEFT:Voe,TOOLBOX_AT_RIGHT:Goe,TOOLBOX_AT_TOP:Koe,TabNavigateCursor:Yoe,Theme:X0,ThemeManager:Joe,Themes:Z0,Toolbox:qoe,ToolboxCategory:Xoe,ToolboxItem:Zoe,ToolboxSeparator:Qoe,Tooltip:eie,Touch:tie,Trashcan:sie,UnattachedFieldError:oie,VARIABLE_CATEGORY_NAME:iie,VARIABLE_DYNAMIC_CATEGORY_NAME:nie,VERSION:rie,VariableMap:aie,VariableModel:lie,Variables:cie,VariablesDynamic:uie,VerticalFlyout:die,WidgetDiv:hie,Workspace:pie,WorkspaceAudio:gie,WorkspaceDragger:mie,WorkspaceSvg:fie,Xml:$ie,ZoomControls:bie,blockAnimations:vie,blockRendering:yie,browserEvents:_ie,bubbles:wie,bumpObjects:Cie,clipboard:Tie,comments:kie,common:Sie,config:Eie,constants:Iie,defineBlocksWithJsonArray:xie,dialog:Die,dragging:Aie,fieldRegistry:Rie,geras:Oie,getMainWorkspace:Mie,getSelected:Nie,hasBubble:Lie,hideChaff:Pie,icons:Bie,inject:jie,inputs:Fie,isCopyable:zie,isDeletable:Uie,isDraggable:Hie,isIcon:Wie,isObservable:Vie,isPaster:Gie,isRenderedElement:Kie,isSelectable:Yie,isSerializable:Jie,isVariableBackedParameterModel:qie,layers:Xie,procedures:Zie,registry:Qie,renderManagement:ene,serialization:tne,setLocale:sne,setParentContainer:one,svgResize:ine,thrasos:nne,uiPosition:rne,utils:ane,zelos:lne}=q0;const uw=X0.defineTheme("dark",{base:Z0.Classic,componentStyles:{workspaceBackgroundColour:"#1e1e1e",toolboxBackgroundColour:"blackBackground",toolboxForegroundColour:"#fff",flyoutBackgroundColour:"#252526",flyoutForegroundColour:"#ccc",flyoutOpacity:1,scrollbarColour:"#797979",insertionMarkerColour:"#fff",insertionMarkerOpacity:.3,scrollbarOpacity:.4,cursorColour:"#d0d0d0",blackBackground:"#333"}}),Pr={textArea:{width:"100%",height:"100%",overflow:"auto"},textAreaLight:{background:"lightgray"},dialog:{height:"95%"},typography:{padding:16},overflowY:{overflowY:"hidden"}};class Q0 extends Y.Component{constructor(s){super(s),this.state={anchorEl:null,popper:""}}handleCancel(){this.props.onClose()}onCopy(s){b.Utils.copyToClipboard(this.props.text);const i=s.currentTarget;setTimeout(()=>{this.setState({popper:b.I18n.t("Copied"),anchorEl:i}),setTimeout(()=>this.setState({popper:"",anchorEl:null}),1e3)},50)}render(){const s=new Blob([this.props.text],{type:"application/xml"}),i=`${this.props.scriptId.substring(10)}.xml`;return g.jsxs(Vt,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":Pr.dialog},fullWidth:!0,open:!0,"aria-labelledby":"export-dialog-title",children:[g.jsx(as,{id:"export-dialog-title",children:b.I18n.t("Export selected blocks")}),g.jsx(Gt,{style:Pr.overflowY,children:g.jsx("pre",{id:"export-text",style:{...Pr.textArea,...this.props.themeType==="dark"?void 0:Pr.textAreaLight},children:this.props.text})}),g.jsxs(Kt,{children:[g.jsx(De,{variant:"contained",color:"secondary",startIcon:g.jsx(vc,{}),children:g.jsx("a",{download:i,target:"_blank",rel:"noreferrer",href:URL.createObjectURL(s),style:{textDecoration:"inherit",color:"inherit"},children:b.I18n.t("Download as file")})}),g.jsx(De,{variant:"contained",onClick:r=>this.onCopy(r),color:"secondary",startIcon:g.jsx(nx,{}),children:b.I18n.t("Copy to clipboard")}),g.jsx(De,{variant:"contained",onClick:()=>this.handleCancel(),color:"primary",startIcon:g.jsx(qs,{}),children:b.I18n.t("Close")}),g.jsx(Vk,{id:"popper",style:{zIndex:1e4},open:!!this.state.popper,placement:"top",anchorEl:this.state.anchorEl,transition:!0,children:({TransitionProps:r})=>g.jsx(Gk,{...r,timeout:350,children:g.jsx(Dw,{children:g.jsx("p",{style:Pr.typography,children:this.state.popper})})})}),g.jsx("textarea",{id:"copy_input",readOnly:!0,style:{position:"absolute",left:-9999},tabIndex:-1,"aria-hidden":!0,value:this.props.text})]})]},"export-dialog")}}const Ot={textArea:{width:"calc(100% - 10px)",height:"calc(80% - 20px)",resize:"none",fontFamily:"monospace",fontSize:"1em",backgroundColor:"transparent",borderRadius:4,outline:"none"},dropzone:{marginTop:20,width:"100%",borderWidth:5,borderStyle:"dashed",borderColor:"#d0cccc",textAlign:"center",boxSizing:"border-box",paddingTop:45,borderRadius:10,height:"calc(100% - 10px)"},dropzoneDiv:{width:"100%",height:"20%",position:"relative"},dropzoneRejected:{borderColor:"#970000"},dropzoneAccepted:{borderColor:"#17cd02"},icon:{height:"80%",width:"80%",opacity:.3,color:"#eeeeee",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%,-50%)",zIndex:0},iconError:{color:"#ffc3c6"},iconOk:{color:"#aaeebc"},text:{top:"50%",left:"50%",transform:"translate(-50%,-50%)",color:"#868686",position:"absolute",zIndex:1},dialog:{height:"95%"},fullHeight:{height:"100%",overflow:"hidden"}};class zm extends Y.Component{constructor(s){super(s),this.state={text:"",imageStatus:"",error:""}}componentDidMount(){setTimeout(()=>{var s;try{(s=window.document.getElementById("import-text-area"))==null||s.focus()}catch{}},100)}static readFileDataUrl(s,i){const r=new FileReader;r.onload=()=>{i(null,{data:r.result,name:s.name})},r.onabort=()=>{console.error("file reading was aborted"),i(b.I18n.t("file reading was aborted"))},r.onerror=l=>{console.error("file reading has failed"),i(b.I18n.t("file reading has failed: %s",l))},r.readAsText(s)}handleDropFile(s){if(!(s!=null&&s.length))return;const i=s[s.length-1];i&&zm.readFileDataUrl(i,(r,l)=>{var u;r||!l?this.setState({error:r||"No data"}):this.setState({text:((u=l.data)==null?void 0:u.toString())||""})})}handleCancel(){this.props.onClose()}handleOk(){this.props.onClose(this.state.text)}onChange(s){this.setState({text:s.target.value})}render(){const s={...Ot.dropzone,...this.state.imageStatus==="accepted"?Ot.dropzoneAccepted:this.state.imageStatus==="rejected"?Ot.dropzoneRejected:void 0};return g.jsxs(Vt,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":Ot.dialog},fullWidth:!0,open:!0,"aria-labelledby":"import-dialog-title",children:[g.jsx(as,{id:"import-dialog-title",children:b.I18n.t("Import blocks")}),g.jsxs(Gt,{style:Ot.fullHeight,children:[g.jsx("textarea",{autoFocus:!0,id:"import-text-area",placeholder:b.I18n.t("Paste your blocks here"),style:{...Ot.textArea,color:this.props.themeType==="dark"?"#ffffff":"#000000"},onChange:i=>this.onChange(i),value:this.state.text}),g.jsx(Mw,{maxSize:5e7,onDrop:(i,r)=>{var l,u,d;i.length?this.handleDropFile(i):window.alert(((d=(u=(l=r==null?void 0:r[0])==null?void 0:l.errors)==null?void 0:u[0])==null?void 0:d.message)||b.I18n.t("ra_Cannot upload"))},multiple:!1,accept:{"text/plain":[],"text/xml":[],"application/xml":[]},children:({getRootProps:i,getInputProps:r,isDragActive:l,isDragReject:u})=>u?(this.state.imageStatus!=="rejected"&&this.setState({imageStatus:"rejected"}),g.jsxs("div",{style:{...s,...Ot.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ot.text,children:b.I18n.t("Some files will be rejected")},"text"),g.jsx(Wc,{style:{...Ot.icon,...Ot.iconError}},"icon")]})):l?(this.state.imageStatus!=="accepted"&&this.setState({imageStatus:"accepted"}),g.jsxs("div",{style:{...s,...Ot.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ot.text,children:b.I18n.t("All files will be accepted")},"text"),g.jsx(Nw,{style:{...Ot.icon,...Ot.iconOk}},"icon")]})):(this.state.imageStatus!=="wait"&&this.setState({imageStatus:"wait"}),g.jsxs("div",{style:{...s,...Ot.dropzoneDiv},...i(),children:[g.jsx("input",{...r()}),g.jsx("span",{style:Ot.text,children:b.I18n.t("Drop some files here or click...")},"text"),g.jsx(Lw,{style:Ot.icon},"icon")]}))})]}),g.jsxs(Kt,{children:[g.jsx(De,{variant:"contained",disabled:!this.state.text,onClick:()=>this.handleOk(),color:"primary",startIcon:g.jsx(zo,{}),children:b.I18n.t("Import")}),g.jsx(De,{color:"grey",variant:"contained",onClick:()=>this.handleCancel(),startIcon:g.jsx(qs,{}),children:b.I18n.t("Close")})]})]})}}const we=window.Blockly;class mg extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}}class Ic extends we.Field{textGroup=null;borderRect_=null;maxLines_=1/0;isOverflowedY_=!1;constructor(s,i,r){super(s),s!==Symbol("SKIP_SETUP")&&(r&&this.configure_(r),this.SERIALIZABLE=!0,this.setValue((s==null?void 0:s.toString())||""),i&&this.setValidator(i))}configure_(s){super.configure_(s),s.maxLines&&this.setMaxLines(s.maxLines)}toXml(s){return s.textContent=this.getValue().replace(/\n/g,"&#10;"),s}fromXml(s){this.setValue(s.textContent.replace(/&#10;/g,`
1013
+ `))}saveState(){const s=this.saveLegacyState(Ic);return s!==null?s:this.getValue()}loadState(s){this.loadLegacyState(we.Field,s)||this.setValue(s)}initView(){this.createBorderRect_(),this.textGroup=we.utils.dom.createSvgElement(we.utils.Svg.G,{class:"blocklyEditableText"},this.fieldGroup_)}onHtmlInputKeyDownSuper_(s){s.key==="Enter"?(we.WidgetDiv.hideIfOwner(this),we.dropDownDiv.hideWithoutAnimation()):s.key==="Escape"?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),we.WidgetDiv.hideIfOwner(this),we.dropDownDiv.hideWithoutAnimation()):s.key==="Tab"&&(we.WidgetDiv.hideIfOwner(this),we.dropDownDiv.hideWithoutAnimation(),this.sourceBlock_.tab(this,!s.shiftKey),s.preventDefault())}onHtmlInputChange_(s){const i=this.value_;this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&we.Events.isEnabled()&&this.value_!==i&&we.Events.fire(new(we.Events.get("block_field_intermediate_change"))(this.sourceBlock_,this.name||null,i,this.value_))}onFinishEditing_(s){}getValueFromEditorText_(s){return s}bindInputEvents_(s){this.onKeyDownWrapper_=we.browserEvents.conditionalBind(s,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper_=we.browserEvents.conditionalBind(s,"input",this,this.onHtmlInputChange_)}getDisplayText_(){const s=this.getSourceBlock();if(!s)throw new Error("The field has not yet been attached to its input. Call appendField to attach it.");let i=this.getText();if(!i)return we.Field.NBSP;const r=i.split(`
1014
+ `);i="";const l=this.isOverflowedY_?this.maxLines_:r.length;for(let u=0;u<l;u++){let d=r[u]||"";d.length>this.maxDisplayLength?d=`${d.substring(0,this.maxDisplayLength-4)}...`:this.isOverflowedY_&&u===l-1&&(d=`${d.substring(0,d.length-3)}...`),d=d.replace(/\s/g,we.Field.NBSP),i+=d,u!==l-1&&(i+=`
1015
+ `)}return s.RTL&&(i+="‏"),i}doValueUpdate_(s){super.doValueUpdate_(s),this.value_!==null&&(this.isOverflowedY_=this.value_.split(`
1016
+ `).length>this.maxLines_)}render_(){const s=this.getSourceBlock();if(!s)throw new Error("The field has not yet been attached to its input. Call appendField to attach it.");let i;const r=this.textGroup;for(;i=r.firstChild;)r.removeChild(i);const l=this.getConstants();if(!l)throw Error("Constants not found");const u=this.getDisplayText_().split(`
1017
+ `);let d=0;for(let p=0;p<u.length;p++){const m=l.FIELD_TEXT_HEIGHT+l.FIELD_BORDER_RECT_Y_PADDING;we.utils.dom.createSvgElement(we.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText",x:l.FIELD_BORDER_RECT_X_PADDING,y:d+l.FIELD_BORDER_RECT_Y_PADDING,dy:l.FIELD_TEXT_BASELINE},r).appendChild(document.createTextNode(u[p])),d+=m}if(this.isBeingEdited_){const p=this.htmlInput_;this.isOverflowedY_?we.utils.dom.addClass(p,"blocklyHtmlTextAreaInputOverflowedY"):we.utils.dom.removeClass(p,"blocklyHtmlTextAreaInputOverflowedY")}if(this.updateSize_(),this.isBeingEdited_){s.RTL?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();const p=this.htmlInput_;this.isTextValid_?(we.utils.dom.removeClass(p,"blocklyInvalidInput"),we.utils.aria.setState(p,we.utils.aria.State.INVALID,!1)):(we.utils.dom.addClass(p,"blocklyInvalidInput"),we.utils.aria.setState(p,we.utils.aria.State.INVALID,!0))}}updateSize_(){const s=this.getConstants();if(!s)throw Error("Constants not found");const i=this.textGroup.childNodes,r=s.FIELD_TEXT_FONTSIZE,l=s.FIELD_TEXT_FONTWEIGHT,u=s.FIELD_TEXT_FONTFAMILY;let d=0,p=0;for(let m=0;m<i.length;m++){const f=i[m],v=we.utils.dom.getFastTextWidth(f,r,l,u);v>d&&(d=v),p+=s.FIELD_TEXT_HEIGHT+(m>0?s.FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){const m=String(this.value_).split(`
1018
+ `),f=we.utils.dom.createSvgElement(we.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText"});for(let y=0;y<m.length;y++){m[y].length>this.maxDisplayLength&&(m[y]=m[y].substring(0,this.maxDisplayLength)),f.textContent=m[y];const k=we.utils.dom.getFastTextWidth(f,r,l,u);k>d&&(d=k)}const v=this.htmlInput_,_=v.offsetWidth-v.clientWidth;d+=_}this.borderRect_&&(p+=s.FIELD_BORDER_RECT_Y_PADDING*2,d+=s.FIELD_BORDER_RECT_X_PADDING*2+1,this.borderRect_.setAttribute("width",`${d}`),this.borderRect_.setAttribute("height",`${p}`)),this.size_.width=d,this.size_.height=p,this.positionBorderRect_()}showInlineEditor_(s){const i=this.getSourceBlock();if(!i)throw new mg;we.WidgetDiv.show(this,i.RTL,this.widgetDispose_.bind(this),this.workspace_),this.htmlInput_=this.widgetCreate_(),this.isBeingEdited_=!0,this.valueWhenEditorWasOpened_=this.value_,s||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}getEditorText_(s){return`${s}`}getScaledBBox(){let s,i,r;const l=this.getSourceBlock();if(!l)throw new mg;if(this.isFullBlockField()){const u=this.sourceBlock_.getHeightWidth(),d=l.workspace.scale;r=this.getAbsoluteXY_(),s=(u.width+1)*d,i=(u.height+1)*d,we.utils.userAgent.GECKO?(r.x+=1.5*d,r.y+=1.5*d):(r.x-=.5*d,r.y-=.5*d)}else{const u=this.borderRect_.getBoundingClientRect();r=we.utils.style.getPageOffset(this.borderRect_),s=u.width,i=u.height}return new we.utils.Rect(r.y,r.y+i,r.x,r.x+s)}resizeEditor_(){we.renderManagement.finishQueuedRenders().then(()=>{const s=this.getSourceBlock();if(!s)throw new mg;const i=we.WidgetDiv.getDiv(),r=this.getScaledBBox();i.style.width=`${r.right-r.left}px`,i.style.height=`${r.bottom-r.top}px`;const l=s.RTL?r.right-i.offsetWidth:r.left,u=r.top;i.style.left=`${l}px`,i.style.top=`${u}px`})}unbindInputEvents_(){this.onKeyDownWrapper_&&(we.browserEvents.unbind(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyInputWrapper_&&(we.browserEvents.unbind(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&we.Events.isEnabled()&&this.valueWhenEditorWasOpened_!==null&&this.valueWhenEditorWasOpened_!==this.value_&&(we.Events.fire(new(we.Events.get("change"))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),we.Events.setGroup(!1),this.unbindInputEvents_();const s=we.WidgetDiv.getDiv().style;s.width="auto",s.height="auto",s.fontSize="",s.transition="",s.boxShadow="",this.htmlInput_=null;const i=this.getClickTarget_();if(!i)throw new Error("A click target has not been set.");we.utils.dom.removeClass(i,"editing")}showEditor_(s,i){this.workspace_=this.sourceBlock_.workspace,!i&&this.workspace_.options.modalInputs&&(we.utils.userAgent.MOBILE||we.utils.userAgent.ANDROID||we.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(!!i),this.forceRerender()}widgetCreate_(){const s=we.WidgetDiv.getDiv(),i=this.workspace_.getScale(),r=this.getConstants();if(!r)throw Error("Constants not found");const l=document.createElement("textarea");l.className="blocklyHtmlInput blocklyHtmlTextAreaInput",l.setAttribute("spellcheck",String(this.spellcheck_));const u=`${r.FIELD_TEXT_FONTSIZE*i}pt`;s.style.fontSize=u,l.style.fontSize=u;const d=`${we.FieldTextInput.BORDERRADIUS*i}px`;l.style.borderRadius=d;const p=r.FIELD_BORDER_RECT_X_PADDING*i,m=r.FIELD_BORDER_RECT_Y_PADDING*i/2;l.style.padding=`${m}px ${p}px ${m}px ${p}px`;const f=r.FIELD_TEXT_HEIGHT+r.FIELD_BORDER_RECT_Y_PADDING;return l.style.lineHeight=`${f*i}px`,s.appendChild(l),l.value=l.defaultValue=this.getEditorText_(this.value_),l.setAttribute("data-untyped-default-value",String(this.value_)),l.setAttribute("data-old-value",""),we.utils.userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(l),l}setMaxLines(s){typeof s=="number"&&s>0&&s!==this.maxLines_&&(this.maxLines_=s,this.forceRerender())}getMaxLines(){return this.maxLines_}onHtmlInputKeyDown_(s){s.key!=="Enter"&&this.onHtmlInputKeyDownSuper_(s)}static fromJson(s){const i=we.utils.parsing.replaceMessageReferences(s.text);return new this(i,void 0,s)}}we.Css.register(`
1019
+ .blocklyHtmlTextAreaInput {
1020
+ font-family: monospace;
1021
+ resize: none;
1022
+ overflow: hidden;
1023
+ height: 100%;
1024
+ text-align: left;
1025
+ }
1026
+
1027
+ .blocklyHtmlTextAreaInputOverflowedY {
1028
+ overflow-y: scroll;
1029
+ }
1030
+ `);const bT="text_multiline",eR={type:bT,message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,height:17,alt:"¶"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]};function tR(a,s){const i=s.multiline_quote_(a.getFieldValue("TEXT")),r=i.indexOf("+")!==-1?6.2:0;return[i,r]}const sR=window.Blockly.common.createBlockDefinitionsFromJsonArray([eR]);sR[bT];const Re=window.Blockly;class im extends Re.Field{picker=null;highlightedIndex=null;boundEvents=[];SERIALIZABLE=!0;CURSOR="default";isDirty_=!1;colours=["#ffffff","#cccccc","#c0c0c0","#999999","#666666","#333333","#000000","#ffcccc","#ff6666","#ff0000","#cc0000","#990000","#660000","#330000","#ffcc99","#ff9966","#ff9900","#ff6600","#cc6600","#993300","#663300","#ffff99","#ffff66","#ffcc66","#ffcc33","#cc9933","#996633","#663333","#ffffcc","#ffff33","#ffff00","#ffcc00","#999900","#666600","#333300","#99ff99","#66ff99","#33ff33","#33cc00","#009900","#006600","#003300","#99ffff","#33ffff","#66cccc","#00cccc","#339999","#336666","#003333","#ccffff","#66ffff","#33ccff","#3366ff","#3333ff","#000099","#000066","#ccccff","#9999ff","#6666cc","#6633ff","#6600cc","#333399","#330099","#ffccff","#ff99ff","#cc66cc","#cc33cc","#993399","#663366","#330033"];titles=[];columns=7;constructor(s,i,r){super(s),s!==Symbol("SKIP_SETUP")&&(r&&this.configure_(r),this.setValue(s),i&&this.setValidator(i))}configure_(s){super.configure_(s),s.colourOptions&&(this.colours=s.colourOptions),s.colourTitles&&(this.titles=s.colourTitles),s.columns&&(this.columns=s.columns)}initView(){const s=this.getConstants();if(!s)throw Error("Constants not found");this.size_=new Re.utils.Size(s.FIELD_COLOUR_DEFAULT_WIDTH,s.FIELD_COLOUR_DEFAULT_HEIGHT),this.createBorderRect_(),this.getBorderRect().style.fillOpacity="1",this.getBorderRect().setAttribute("stroke","#fff"),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot())}isFullBlockField(){if(!this.getSourceBlock())throw new Re.UnattachedFieldError;const i=this.getConstants();return this.blockIsSimpleReporter()&&!!(i!=null&&i.FIELD_COLOUR_FULL_BLOCK)}blockIsSimpleReporter(){const s=this.getSourceBlock();if(!s)throw new Re.UnattachedFieldError;if(!s.outputConnection)return!1;for(const i of s.inputList)if(i.connection||i.fieldRow.length>1)return!1;return!0}applyColour(){const s=this.getSourceBlock();if(!s)throw new Re.UnattachedFieldError;if(!this.fieldGroup_)return;const i=this.borderRect_;if(!i)throw new Error("The border rect has not been initialized");this.isFullBlockField()?(i.style.display="none",s.pathObject.svgPath.setAttribute("fill",this.getValue()),s.pathObject.svgPath.setAttribute("stroke","#fff")):(i.style.display="block",i.style.fill=this.getValue())}getSize(){var s;return(s=this.getConstants())!=null&&s.FIELD_COLOUR_FULL_BLOCK&&(this.render_(),this.isDirty_=!1),super.getSize()}render_(){super.render_();const s=this.getSourceBlock();if(!s)throw new Re.UnattachedFieldError;s.applyColour()}updateSize_(s){const i=this.getConstants();if(!i)return;let r,l;this.isFullBlockField()?(r=(s??0)*2,l=i.FIELD_TEXT_HEIGHT):(r=i.FIELD_COLOUR_DEFAULT_WIDTH,l=i.FIELD_COLOUR_DEFAULT_HEIGHT),this.size_.height=l,this.size_.width=r,this.positionBorderRect_()}doClassValidation_(s){return typeof s!="string"?null:Re.utils.colour.parse(s)}getText(){let s=this.value_;return/^#(.)\1(.)\2(.)\3$/.test(s)&&(s=`#${s[1]}${s[3]}${s[5]}`),s}setColours(s,i){return this.colours=s,i&&(this.titles=i),this}setColumns(s){return this.columns=s,this}showEditor_(){if(this.dropdownCreate(),!this.picker)throw Error("Picker not found");Re.DropDownDiv.getContentDiv().appendChild(this.picker),Re.DropDownDiv.showPositionedByField(this,this.dropdownDispose.bind(this)),this.picker.focus({preventScroll:!0})}onClick(s){const i=s.target,r=i==null?void 0:i.getAttribute("data-colour");r!==null&&(this.setValue(r),Re.DropDownDiv.hideIfOwner(this))}onKeyDown(s){let i=!0,r;switch(s.key){case"ArrowUp":this.moveHighlightBy(0,-1);break;case"ArrowDown":this.moveHighlightBy(0,1);break;case"ArrowLeft":this.moveHighlightBy(-1,0);break;case"ArrowRight":this.moveHighlightBy(1,0);break;case"Enter":if(r=this.getHighlighted(),r){const l=r.getAttribute("data-colour");l!==null&&this.setValue(l)}Re.DropDownDiv.hideWithoutAnimation();break;default:i=!1}i&&s.stopPropagation()}moveHighlightBy(s,i){if(!this.highlightedIndex)return;const r=this.colours,l=this.columns;let u=this.highlightedIndex%l,d=Math.floor(this.highlightedIndex/l);u+=s,d+=i,s<0?u<0&&d>0?(u=l-1,d--):u<0&&(u=0):s>0?u>l-1&&d<Math.floor(r.length/l)-1?(u=0,d++):u>l-1&&u--:i<0?d<0&&(d=0):i>0&&d>Math.floor(r.length/l)-1&&(d=Math.floor(r.length/l)-1);const p=this.picker.childNodes[d].childNodes[u],m=d*l+u;this.setHighlightedCell(p,m)}onMouseMove(s){const i=s.target,r=i&&Number(i.getAttribute("data-index"));r!==null&&r!==this.highlightedIndex&&this.setHighlightedCell(i,r)}onMouseEnter(){var s;(s=this.picker)==null||s.focus({preventScroll:!0})}onMouseLeave(){var i;(i=this.picker)==null||i.blur();const s=this.getHighlighted();s&&Re.utils.dom.removeClass(s,"blocklyColourHighlighted")}getHighlighted(){var l;if(!this.highlightedIndex)return null;const s=this.highlightedIndex%this.columns,i=Math.floor(this.highlightedIndex/this.columns),r=(l=this.picker)==null?void 0:l.childNodes[i];return r?r.childNodes[s]:null}setHighlightedCell(s,i){const r=this.getHighlighted();r&&Re.utils.dom.removeClass(r,"blocklyColourHighlighted"),Re.utils.dom.addClass(s,"blocklyColourHighlighted"),this.highlightedIndex=i;const l=s.getAttribute("id");l&&this.picker&&Re.utils.aria.setState(this.picker,Re.utils.aria.State.ACTIVEDESCENDANT,l)}dropdownCreate(){const s=this.columns,i=this.colours,r=this.getValue(),l=document.createElement("table");l.className="blocklyColourTable",l.tabIndex=0,l.dir="ltr",Re.utils.aria.setRole(l,Re.utils.aria.Role.GRID),Re.utils.aria.setState(l,Re.utils.aria.State.EXPANDED,!0),Re.utils.aria.setState(l,Re.utils.aria.State.ROWCOUNT,Math.floor(i.length/s)),Re.utils.aria.setState(l,Re.utils.aria.State.COLCOUNT,s);let u=null;for(let d=0;d<i.length;d++){d%s===0&&(u=document.createElement("tr"),Re.utils.aria.setRole(u,Re.utils.aria.Role.ROW),l.appendChild(u));const p=document.createElement("td");u.appendChild(p),p.setAttribute("data-colour",i[d]),p.title=this.titles[d]||i[d],p.id=Re.utils.idGenerator.getNextUniqueId(),p.setAttribute("data-index",`${d}`),Re.utils.aria.setRole(p,Re.utils.aria.Role.GRIDCELL),Re.utils.aria.setState(p,Re.utils.aria.State.LABEL,i[d]),Re.utils.aria.setState(p,Re.utils.aria.State.SELECTED,i[d]===r),p.style.backgroundColor=i[d],i[d]===r&&(p.className="blocklyColourSelected",this.highlightedIndex=d)}this.boundEvents.push(Re.browserEvents.conditionalBind(l,"pointerdown",this,this.onClick,!0)),this.boundEvents.push(Re.browserEvents.conditionalBind(l,"pointermove",this,this.onMouseMove,!0)),this.boundEvents.push(Re.browserEvents.conditionalBind(l,"pointerenter",this,this.onMouseEnter,!0)),this.boundEvents.push(Re.browserEvents.conditionalBind(l,"pointerleave",this,this.onMouseLeave,!0)),this.boundEvents.push(Re.browserEvents.conditionalBind(l,"keydown",this,this.onKeyDown,!1)),this.picker=l}dropdownDispose(){for(const s of this.boundEvents)Re.browserEvents.unbind(s);this.boundEvents.length=0,this.picker=null,this.highlightedIndex=null}static fromJson(s){return new this(s.colour,void 0,s)}}im.prototype.DEFAULT_VALUE="#ffffff";Re.Css.register(`
1031
+ .blocklyColourTable {
1032
+ border-collapse: collapse;
1033
+ display: block;
1034
+ outline: none;
1035
+ padding: 1px;
1036
+ }
1037
+
1038
+ .blocklyColourTable>tr>td {
1039
+ border: 0.5px solid #888;
1040
+ box-sizing: border-box;
1041
+ cursor: pointer;
1042
+ display: inline-block;
1043
+ height: 20px;
1044
+ padding: 0;
1045
+ width: 20px;
1046
+ }
1047
+
1048
+ .blocklyColourTable>tr>td.blocklyColourHighlighted {
1049
+ border-color: #eee;
1050
+ box-shadow: 2px 2px 7px 2px rgba(0, 0, 0, 0.3);
1051
+ position: relative;
1052
+ }
1053
+
1054
+ .blocklyColourSelected, .blocklyColourSelected:hover {
1055
+ border-color: #eee !important;
1056
+ outline: 1px solid #333;
1057
+ position: relative;
1058
+ }
1059
+ `);const vT="colour_picker",oR={type:vT,message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]};function iR(a,s){return[s.quote_(a.getFieldValue("COLOUR")),0]}const nR=window.Blockly.common.createBlockDefinitionsFromJsonArray([oR]);nR[vT];const yT="colour_random",rR={type:yT,message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"};function aR(a,s){return[`${s.provideFunction_("colourRandom",`
1060
+ function ${s.FUNCTION_NAME_PLACEHOLDER_}() {
1061
+ var num = Math.floor(Math.random() * 0x1000000);
1062
+ return '#' + ('00000' + num.toString(16)).substr(-6);
1063
+ }
1064
+ `)}()`,2]}const lR=window.Blockly.common.createBlockDefinitionsFromJsonArray([rR]);lR[yT];const _T="colour_rgb",cR={type:_T,message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"};function uR(a,s){const i=s.valueToCode(a,"RED",99)||0,r=s.valueToCode(a,"GREEN",99)||0,l=s.valueToCode(a,"BLUE",99)||0;return[`${s.provideFunction_("colourRgb",`
1065
+ function ${s.FUNCTION_NAME_PLACEHOLDER_}(r, g, b) {
1066
+ r = Math.max(Math.min(Number(r), 100), 0) * 2.55;
1067
+ g = Math.max(Math.min(Number(g), 100), 0) * 2.55;
1068
+ b = Math.max(Math.min(Number(b), 100), 0) * 2.55;
1069
+ r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);
1070
+ g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);
1071
+ b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);
1072
+ return '#' + r + g + b;
1073
+ }
1074
+ `)}(${i}, ${r}, ${l})`,2]}const dR=window.Blockly.common.createBlockDefinitionsFromJsonArray([cR]);dR[_T];const wT="colour_blend",hR={type:wT,message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"};function pR(a,s){const i=s.valueToCode(a,"COLOUR1",99)||"'#000000'",r=s.valueToCode(a,"COLOUR2",99)||"'#000000'",l=s.valueToCode(a,"RATIO",99)||.5;return[`${s.provideFunction_("colourBlend",`
1075
+ function ${s.FUNCTION_NAME_PLACEHOLDER_}(c1, c2, ratio) {
1076
+ ratio = Math.max(Math.min(Number(ratio), 1), 0);
1077
+ var r1 = parseInt(c1.substring(1, 3), 16);
1078
+ var g1 = parseInt(c1.substring(3, 5), 16);
1079
+ var b1 = parseInt(c1.substring(5, 7), 16);
1080
+ var r2 = parseInt(c2.substring(1, 3), 16);
1081
+ var g2 = parseInt(c2.substring(3, 5), 16);
1082
+ var b2 = parseInt(c2.substring(5, 7), 16);
1083
+ var r = Math.round(r1 * (1 - ratio) + r2 * ratio);
1084
+ var g = Math.round(g1 * (1 - ratio) + g2 * ratio);
1085
+ var b = Math.round(b1 * (1 - ratio) + b2 * ratio);
1086
+ r = ('0' + (r || 0).toString(16)).slice(-2);
1087
+ g = ('0' + (g || 0).toString(16)).slice(-2);
1088
+ b = ('0' + (b || 0).toString(16)).slice(-2);
1089
+ return '#' + r + g + b;
1090
+ }
1091
+ `)}(${i}, ${r}, ${l})`,2]}const gR=window.Blockly.common.createBlockDefinitionsFromJsonArray([hR]);gR[wT];function mR(){window.Blockly.FieldMultilineInput||(window.Blockly.fieldRegistry.register("field_multilinetext",Ic),window.Blockly.JavaScript.forBlock.text_multiline=tR,window.Blockly.FieldMultilineInput=Ic,Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"text_multiline",message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,height:17,alt:"¶"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]}]))),window.Blockly.FieldColour||(window.Blockly.fieldRegistry.register("field_colour",im),window.Blockly.JavaScript.forBlock.colour_picker=iR,window.Blockly.JavaScript.forBlock.colour_blend=pR,window.Blockly.JavaScript.forBlock.colour_random=aR,window.Blockly.JavaScript.forBlock.colour_rgb=uR,window.Blockly.FieldColour=im,Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]}])),Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"}])),Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"}])),Object.assign(window.Blockly.Blocks,window.Blockly.common.createBlockDefinitionsFromJsonArray([{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}])));const a=window.Blockly.JavaScript;a.forBlock&&Object.keys(a).forEach(s=>{typeof a[s]=="function"&&(a.forBlock[s]||(console.log(`Migrating Blockly.JavaScript.${s} to Blockly.JavaScript.forBlock.${s}`),a.forBlock[s]=a[s],delete a[s]))})}let rc=!1,ac=!1,fg=null,$g=null;const dw=[];function CT(a,s,i,r){var l;if(r=r||[],(a.tagName==="BLOCK"||a.tagName==="block")&&(i=a.id),a.tagName==="FIELD"||a.tagName==="field")for(let u=0;u<a.attributes.length;u++){const d=(a.attributes[u].value||"").toLowerCase();a.attributes[u].nodeName==="name"&&(d==="oid"||d==="text"||d==="var")&&i&&(l=a.innerHTML)!=null&&l.toLowerCase().includes(s)&&r.push(i)}return a.childNodes.forEach(u=>CT(u,s,i,r)),r}class Fe extends Y.Component{blockly=null;blocklyWorkspace=null;originalCode;someSelected=null;changeTimer=null;someSelectedTime=0;ignoreChanges=!1;blinkBlock;onResizeBind;didUpdate=null;lastCommand="";lastSearch;static Blockly=window.Blockly;constructor(s){super(s),this.state={languageOwnLoaded:ac,languageBlocklyLoaded:rc,changed:!1,message:"",error:"",themeType:this.props.themeType,exportText:"",importText:!1,searchText:this.props.searchText||"",showInputPrompt:null},this.originalCode=s.code||"",this.someSelected=null,this.onResizeBind=this.onResize.bind(this),this.lastSearch=this.props.searchText||"",this.blinkBlock=null,mR(),Fe.Blockly.dialog.setPrompt(this.onShowNameDialog),this.loadLanguages()}onShowNameDialog=(s,i,r)=>{this.setState({showInputPrompt:{promptText:s,defaultText:i,callback:r,value:i}})};static loadJS(s,i,r){const l=document.createElement("script");try{l.src=s,l.onload=i,l.onerror=i,(r||window.document.body).appendChild(l)}catch(u){console.error(`Cannot load ${s}: ${u}`),i&&i()}}static loadScripts(s,i){if(!(s!=null&&s.length)){i&&i();return}const r=s.pop();r&&!dw.includes(r)?(dw.push(r),Fe.loadJS(`../../adapter/${r}/blockly.js`,()=>setTimeout(()=>Fe.loadScripts(s,i),0))):setTimeout(()=>Fe.loadScripts(s,i),0)}static loadCustomBlockly(s,i){var l;const r=[];for(const u in s)!Object.prototype.hasOwnProperty.call(s,u)||!s[u]||!u.match(/^system\.adapter\./)||s[u].type!=="adapter"||(l=s[u].common)!=null&&l.blockly&&(console.log(`Detected custom blockly: ${s[u].common.name}`),r.push(s[u].common.name));Fe.loadScripts(r,i)}static loadXMLDoc(s){let i;return window.DOMParser?i=r=>new window.DOMParser().parseFromString(r,"text/xml"):typeof window.ActiveXObject<"u"&&new window.ActiveXObject("Microsoft.XMLDOM")?i=r=>{const l=new window.ActiveXObject("Microsoft.XMLDOM");return l.async="false",l.loadXML(r),l}:i=()=>null,i(s)}searchBlocks(s){if(this.blocklyWorkspace){const i=Fe.Blockly.Xml.workspaceToDom(this.blocklyWorkspace),r=CT(i,s.toLowerCase());return console.log(`Search "${s}" found blocks: ${r.length?JSON.stringify(r):"none"}`),r}return[]}searchId(){const s=this.lastSearch?this.searchBlocks(this.lastSearch):null;s!=null&&s.length?(this.someSelected=s,this.someSelected.forEach(i=>{var r;return(r=this.blocklyWorkspace)==null?void 0:r.highlightBlock(i,!0)}),this.someSelectedTime=Date.now()):this.someSelected&&(this.someSelected.forEach(i=>{var r;return(r=this.blocklyWorkspace)==null?void 0:r.highlightBlock(i,!1)}),this.someSelected=null)}UNSAFE_componentWillReceiveProps(s){s.command&&this.lastCommand!==s.command&&(this.lastCommand=s.command,setTimeout(()=>this.lastCommand="",300),this.lastCommand==="check"?this.blocklyCheckBlocks((i,r)=>{i?(r&&Fe.blocklyBlinkBlock(r),this.setState({error:{text:b.I18n.t(i),title:b.I18n.t("Error was found")}}),this.blinkBlock=r):this.setState({message:b.I18n.t("Ok")})}):this.lastCommand==="export"?this.exportBlocks():this.lastCommand==="import"&&this.importBlocks()),s.searchText!==this.lastSearch&&(this.lastSearch=s.searchText,this.searchId()),this.state.themeType!==s.themeType&&this.setState({themeType:s.themeType},()=>this.updateBackground()),this.originalCode!==s.code&&(this.originalCode=s.code||"",this.loadCode(),this.searchId())}loadLanguages(){if(!rc){const s=window.document.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("src",`google-blockly/msg/js/${b.I18n.getLanguage()}.js`),s.onload=()=>{rc=!0,this.setState({languageBlocklyLoaded:rc})},window.document.getElementsByTagName("head")[0].appendChild(s)}if(!ac){const s=window.document.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("src",`google-blockly/own/msg/${b.I18n.getLanguage()}.js`),s.onload=()=>{ac=!0,this.setState({languageOwnLoaded:ac})},window.document.getElementsByTagName("head")[0].appendChild(s)}}onResize(){this.blocklyWorkspace&&Fe.Blockly.svgResize(this.blocklyWorkspace)}static jsCode2Blockly(s){s=s||"";const i=s.split(/[\r\n]+|\r|\n/g);let r="";for(let u=i.length-1;u>=0;u--)if(i[u].substring(0,2)==="//"){r=i[u].substring(2);break}if(r.substring(0,4)==="<xml")return r;let l;try{l=window.decodeURIComponent(window.atob(r))}catch(u){l=null,console.error(`cannot decode: ${r}`),console.error(u)}return l}static blocklyBlinkBlock(s){for(let i=300;i<3e3;i+=300)setTimeout(()=>s.select(),i),setTimeout(()=>s.unselect(),i+150)}blocklyRemoveOrphanedShadows(){if(this.blocklyWorkspace){const s=this.blocklyWorkspace.getAllBlocks();let i;for(let r=0;i=s[r];r++)if(i.isShadow()){const l=i.getConnections_(!0);let u;for(let d=0;u=l[d];d++)if(!u.targetConnection){i.dispose();break}}}}blocklyCheckBlocks(s){let i;if(!this.blocklyWorkspace||this.blocklyWorkspace.getAllBlocks().length===0)return s&&s("no blocks found"),!1;let r=this.blocklyGetUnconnectedBlock();return r?i="not properly connected":(r=this.blocklyGetBlockWithWarning(),r&&(i="warning on this block")),r?(s?s(i,r):Fe.blocklyBlinkBlock(r),!1):(s(),!0)}blocklyGetUnconnectedBlock(){var r;const s=(r=this.blocklyWorkspace)==null?void 0:r.getAllBlocks();let i;if(s)for(let l=0;i=s[l];l++){const u=i.getConnections_(!0);let d;for(let p=0;d=u[p];p++)if(!d.sourceBlock_||(d.type===Fe.Blockly.INPUT_VALUE||d.type===Fe.Blockly.OUTPUT_VALUE)&&!d.targetConnection&&!d._optional)return i}return null}blocklyGetBlockWithWarning(){var r;const s=(r=this.blocklyWorkspace)==null?void 0:r.getAllBlocks();let i;if(s){for(let l=0;i=s[l];l++)if(i.warning)return i}return null}blocklyCode2JSCode(s){if(!this.blocklyWorkspace)return"";let i=Fe.Blockly.JavaScript.workspaceToCode(this.blocklyWorkspace);if(!s){i+=`
1092
+ `;const r=Fe.Blockly.Xml.workspaceToDom(this.blocklyWorkspace),l=Fe.Blockly.Xml.domToText(r);i+=`//${btoa(encodeURIComponent(l))}`}return i}exportBlocks(){if(!this.blocklyWorkspace)return;let s;const i=Fe.Blockly.getSelected();if(i){const r=Fe.Blockly.Xml.blockToDom(i),l=i.getRelativeToSurfaceXY();r.setAttribute("x",(i.RTL?-l.x:l.x).toString()),r.setAttribute("y",l.y.toString()),s=Fe.Blockly.Xml.domToPrettyText(r)}else{const r=Fe.Blockly.Xml.workspaceToDom(this.blocklyWorkspace);s=Fe.Blockly.Xml.domToPrettyText(r)}this.setState({exportText:s})}importBlocks(){this.setState({importText:!0})}onImportBlocks(s){if(this.blocklyWorkspace&&(s=(s||"").trim(),s))try{s.startsWith("<xml")||(s=`<xml xmlns="https://developers.google.com/blockly/xml">${s}</xml>`),s=s.replace(/[\n\r]/g,"").replace(/<variables>.*<\/variables>/g,""),window.scripts.loading=!0;const i=Fe.Blockly.utils.xml.textToDom(s);Fe.Blockly.Xml.appendDomToWorkspace(i,this.blocklyWorkspace),window.scripts.loading=!1,this.onBlocklyChanged()}catch(i){this.setState({error:{text:i.toString(),title:b.I18n.t("Import error")}})}}loadCode(){if(this.blocklyWorkspace){this.ignoreChanges=!0,this.blocklyWorkspace.clear();try{const s=Fe.jsCode2Blockly(this.originalCode)||'<xml xmlns="https://developers.google.com/blockly/xml"></xml>';window.scripts.loading=!0;const i=Fe.Blockly.utils.xml.textToDom(s);Fe.Blockly.Xml.domToWorkspace(i,this.blocklyWorkspace),window.scripts.loading=!1}catch(s){console.error(s),setTimeout(()=>this.setState({error:b.I18n.t("Cannot extract Blockly code!")}))}setTimeout(()=>this.ignoreChanges=!1,100)}}onBlocklyChanged(){this.blocklyRemoveOrphanedShadows(),this.setState({changed:!0}),this.onChange()}async componentDidUpdate(){if(!this.blockly||(this.didUpdate&&(clearTimeout(this.didUpdate),this.didUpdate=null),this.blocklyWorkspace))return;window.addEventListener("resize",this.onResizeBind,!1),fg=fg||await this.getToolbox(),$g=$g||Fe.Blockly.utils.xml.textToDom(fg),this.blocklyWorkspace=Fe.Blockly.inject(this.blockly,{renderer:"thrasos",theme:this.state.themeType==="dark"?uw:"classic",media:"google-blockly/media/",toolbox:$g,zoom:{controls:!0,wheel:!1,startScale:1,maxScale:3,minScale:.3,scaleSpeed:1.2,pinch:!0},move:{scrollbars:{horizontal:!0,vertical:!0},drag:!0,wheel:!0},trashcan:!0,grid:{spacing:25,length:1,snap:!0},sounds:!1}),window.scripts={blocklyWorkspace:this.blocklyWorkspace},this.blocklyWorkspace.registerToolboxCategoryCallback("PROCEDURE",window.Blockly.Procedures.flyoutCategoryNew),this.blocklyWorkspace.addChangeListener(i=>{var r;if(this.someSelected&&Date.now()-this.someSelectedTime>500){const l=(r=this.blocklyWorkspace)==null?void 0:r.getAllBlocks();this.someSelected=null,l==null||l.forEach(u=>u.removeSelect())}[Fe.Blockly.Events.UI,Fe.Blockly.Events.CREATE,Fe.Blockly.Events.VIEWPORT_CHANGE].includes(i.type)||this.ignoreChanges||(this.changeTimer&&clearTimeout(this.changeTimer),this.changeTimer=setTimeout(()=>{this.changeTimer=null,this.onBlocklyChanged()},200))}),this.loadCode(),this.onResize();const s=document.getElementsByClassName("blocklyToolboxDiv")[0];this.blockly.appendChild(s),this.updateBackground(),setTimeout(()=>this.searchId(),200)}updateBackground(){var s;this.state.themeType==="dark"?(s=this.blocklyWorkspace)==null||s.setTheme(uw):this.blocklyWorkspace&&(this.blocklyWorkspace.getThemeManager(),this.blocklyWorkspace.setTheme(Fe.Blockly.Themes.Classic))}componentWillUnmount(){this.blocklyWorkspace&&(this.blocklyWorkspace.dispose(),this.blocklyWorkspace=null,this.changeTimer&&clearTimeout(this.changeTimer),this.changeTimer=null,window.removeEventListener("resize",this.onResizeBind))}onChange(){this.originalCode=this.blocklyCode2JSCode(),this.props.onChange&&this.props.onChange(this.originalCode)}async getToolbox(s){const i=window.document.getElementById("toolbox");let r=i==null?void 0:i.outerHTML;if(!r)return s?(console.error("Cannot load blocks!"),""):new Promise(l=>{setTimeout(()=>l(this.getToolbox(!0)),500)});if(r=r.replace(/{(\w+)}/g,(l,u)=>window.MSG[u]),window.Blockly.CustomBlocks){let l="";const u=b.I18n.getLanguage();for(let d=0;d<window.Blockly.CustomBlocks.length;d++){const p=window.Blockly.CustomBlocks[d],m=window.Blockly[p];l+=`<category name="${window.Blockly.Words[p][u]}" colour="${m.HUE}">`;for(const f in m.blocks)Object.prototype.hasOwnProperty.call(m.blocks,f)&&(l+=m.blocks[f]);l+="</category>"}r=r.replace("<category><block>%%CUSTOM_BLOCKS%%</block></category>",l)}return r}renderMessageDialog(){return this.state.message?g.jsx(b.Message,{text:typeof this.state.message=="object"?this.state.message.text:this.state.message,title:typeof this.state.message=="object"?this.state.message.title:"",onClose:()=>this.setState({message:""})},"dialogMessage"):null}renderErrorDialog(){return this.state.error?g.jsx(Zc,{text:typeof this.state.error=="object"?this.state.error.text.toString():this.state.error,title:typeof this.state.error=="object"?this.state.error.title:"",onClose:()=>{this.blinkBlock&&(Fe.blocklyBlinkBlock(this.blinkBlock),this.blinkBlock=null),this.setState({error:""})}},"dialogError"):null}renderExportDialog(){return this.state.exportText?g.jsx(Q0,{themeType:this.state.themeType,onClose:()=>this.setState({exportText:""}),text:this.state.exportText,scriptId:this.props.scriptId},"dialogExport"):null}renderImportDialog(){return this.state.importText?g.jsx(zm,{themeType:this.props.themeType,onClose:s=>{this.setState({importText:!1}),this.onImportBlocks(s)}},"dialogImport"):null}renderDialogPrompt(){return this.state.showInputPrompt?g.jsxs(Vt,{onClose:()=>{var i;const s=(i=this.state.showInputPrompt)==null?void 0:i.callback;s&&s(null),this.setState({showInputPrompt:null})},maxWidth:"sm",fullWidth:!0,open:!0,children:[g.jsx(as,{children:this.state.showInputPrompt.promptText}),g.jsx(Gt,{children:g.jsx(vo,{variant:"standard",fullWidth:!0,autoFocus:!0,value:this.state.showInputPrompt.value,onKeyUp:s=>{var i,r;if(s.key==="Enter"){const l=(i=this.state.showInputPrompt)==null?void 0:i.callback,u=(r=this.state.showInputPrompt)==null?void 0:r.value;l&&l(u===void 0?null:u),this.setState({showInputPrompt:null})}},onChange:s=>{var r,l;const i={...this.state.showInputPrompt};(r=this.state.showInputPrompt)!=null&&r.callback&&(i.callback=(l=this.state.showInputPrompt)==null?void 0:l.callback),i.value=s.target.value,this.setState({showInputPrompt:i})}})}),g.jsxs(Kt,{children:[g.jsx(De,{variant:"contained",disabled:!this.state.showInputPrompt.value,onClick:()=>{var r,l;const s=(r=this.state.showInputPrompt)==null?void 0:r.callback,i=(l=this.state.showInputPrompt)==null?void 0:l.value;s&&s(i===void 0?null:i),this.setState({showInputPrompt:null})},color:"primary",startIcon:g.jsx(zo,{}),children:b.I18n.t("Apply")}),g.jsx(De,{color:"grey",variant:"contained",onClick:()=>{var i;const s=(i=this.state.showInputPrompt)==null?void 0:i.callback;s&&s(null),this.setState({showInputPrompt:null})},startIcon:g.jsx(qs,{}),children:b.I18n.t("Close")})]})]},"inputDialog"):null}render(){return this.state.languageBlocklyLoaded&&this.state.languageOwnLoaded?(this.didUpdate=setTimeout(()=>{this.didUpdate=null,this.componentDidUpdate()},100),[g.jsx("div",{ref:s=>this.blockly=s,style:{width:"100%",height:"100%",position:"relative"}},"blocklyDOM"),this.renderDialogPrompt(),this.renderMessageDialog(),this.renderErrorDialog(),this.renderExportDialog(),this.renderImportDialog()]):null}}const fR=Object.freeze(Object.defineProperty({__proto__:null,default:Fe},Symbol.toStringTag,{value:"Module"})),$R="_nameCard_15el3_28",bR="_iconThemCard_15el3_40",vR="_iconThemCardSelectable_15el3_49",yR="_iconHelp_15el3_53",_R="_blockName_15el3_64",wR="_controlMenuTop_15el3_123",CR="_debugInfo_15el3_132",TR="_tagCard_15el3_142",kR="_displayFlex_15el3_161",SR="_blockMarginTop_15el3_166",ER="_nameBlock_15el3_167",IR="_frontText_15el3_171",xR="_backText_15el3_177",DR="_iconTag_15el3_181",AR="_displayItalic_15el3_191",le={nameCard:$R,iconThemCard:bR,iconThemCardSelectable:vR,iconHelp:yR,blockName:_R,controlMenuTop:wR,debugInfo:CR,tagCard:TR,displayFlex:kR,blockMarginTop:SR,nameBlock:ER,frontText:IR,backText:xR,iconTag:DR,displayItalic:AR},RR="_root_1dr6a_1",OR="_square_1dr6a_11",MR="_icon_1dr6a_16",bg={root:RR,square:OR,icon:MR},Ur=({fullWidth:a,size:s,onClick:i,style:r,className:l,value:u,square:d,icon:p})=>g.jsx(De,{variant:"outlined",color:"primary",onClick:i,fullWidth:a,style:r,className:b.Utils.clsx(bg.root,l,d?bg.square:""),size:s||"medium",children:p?g.jsx(b.Icon,{className:bg.icon,src:p}):u}),NR="_root_1ucda_1",LR={root:NR},PR=({size:a,value:s,title:i,onChange:r,className:l,customValue:u,disabled:d})=>{const[p,m]=vt(!1);return g.jsxs(g.Fragment,{children:[g.jsx(bc,{disabled:d,checked:!!(u?s:p),className:b.Utils.clsx(LR.root,l),onChange:f=>{u&&m(f.target.checked),r&&r(f.target.checked)},size:a||"medium"}),i||null]})},TT=am(PR),BR="_root_19roy_1",hw={root:BR},bi=a=>{const[s,i]=vt(""),{value:r,type:l,error:u,className:d,icon:p,label:m,style:f,onChange:v,fullWidth:_,autoComplete:y,customValue:k,autoFocus:C,rows:w,size:E,variant:R,multiline:D,disabled:A}=Object.assign({value:"",type:"text",error:"",className:null,table:!1,native:{},variant:"standard",size:"medium",component:null,styleComponentBlock:null,fullWidth:!1,autoComplete:"",customValue:!1,autoFocus:!1,rows:1},a);return g.jsx(vo,{error:!!u,autoFocus:C,fullWidth:_,label:m,disabled:A,variant:R,multiline:D,rows:w,value:k?r:s,type:l,helperText:u,style:f,className:b.Utils.clsx(hw.root,d),autoComplete:y,onChange:J=>{!k&&i(J.target.value),v&&v(J.target.value)},slotProps:{input:{endAdornment:p?g.jsx(xw,{position:"end",children:g.jsx(b.Icon,{className:hw.icon,src:p})}):null}},margin:"normal",size:E})},jR={formControl:{m:"10px 0","& .MuiFormControl-marginNormal":{mt:0,mb:0},"& > *":{color:"#2d0440 !important"},"& .MuiSelect-icon":{color:"#81688c"},"& label.Mui-focused":{color:"#81688c"},"& .MuiInput-underline:after":{borderBottomColor:"#510573"},"& .MuiInput-underline:before":{borderBottomColor:"#81688c"},"& .MuiInput-underline:hover:before":{borderBottomColor:"#81688c"}}},FR=({multiple:a,value:s,customValue:i,socket:r,title:l,attr:u,adapter:d,style:p,onChange:m,onInstanceHide:f})=>{const[v,_]=vt(s||"test1"),[y,k]=vt([]);return Mt(()=>{r==null||r.getAdapterInstances(d).then(C=>{const w=C.map(E=>({value:E._id.replace("system.adapter.",""),title:E._id.replace("system.adapter.","")}));w.length===1?f(w[0].value):w.unshift({value:d,title:b.I18n.t("All")}),k(w)})},[r,d,f]),g.jsxs(_i,{sx:jR.formControl,fullWidth:!0,style:p,children:[g.jsx(wi,{variant:"standard",value:(i?s:v)||"_",fullWidth:!0,multiple:a,renderValue:C=>a&&Array.isArray(C)?C.join(", "):C,onChange:C=>{!i&&_(C.target.value),m(C.target.value)},input:u?g.jsx(Dn,{name:u,id:`${u}-helper`}):g.jsx(Dn,{name:u}),children:y.map(C=>g.jsx(Ve,{style:{placeContent:"space-between"},value:C.value||"_",children:b.I18n.t(C.title)},`key-${C.value}`))}),l?g.jsx(Aw,{children:b.I18n.t(l)}):null]})},zR="_modalWrapper_587ci_33",UR="_modalDialog_587ci_40",pw={modalWrapper:zR,modalDialog:UR},nm=({onClose:a,children:s,titleButtonApply:i,titleButtonClose:r,onApply:l,className:u,textInput:d,defaultValue:p,disabled:m})=>{const[f,v]=vt(p||""),[_]=vt(p||"");return g.jsxs(Vt,{open:!0,maxWidth:"md",disableEscapeKeyDown:!1,onClose:a,classes:{paper:pw.modalDialog},className:pw.modalWrapper,children:[g.jsxs(Gt,{children:[d&&g.jsx(bi,{className:u,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"medium",rows:10,multiline:!0,value:f,onChange:v,customValue:!0}),!d&&s]}),g.jsxs(Kt,{children:[g.jsx(De,{disabled:m===void 0?_===f:m,onClick:()=>l(d?f:null),variant:"contained",color:"primary",children:b.I18n.t(i||"Ok")}),g.jsx(De,{color:"grey",onClick:a,variant:"contained",children:b.I18n.t(r||"Cancel")})]})]})},HR="_root_15mo1_1",WR={root:HR},VR=({multiple:a,value:s,customValue:i,title:r,attr:l,options:u,style:d,onChange:p,className:m,doNotTranslate:f,doNotTranslate2:v})=>{const[_,y]=vt(s===void 0?u[0].value:s),k=i?s:_,C=k===""||k===null||k===void 0?"_":k;return g.jsxs(_i,{variant:"standard",className:b.Utils.clsx(WR.root,m),fullWidth:!0,style:d,children:[g.jsxs(wi,{variant:"standard",value:C,fullWidth:!0,multiple:a,renderValue:w=>{if(a&&Array.isArray(w)){w.sort();let R=w.indexOf("0");R!==-1&&(w.splice(R,1),w.push("0")),R=w.indexOf("_"),R!==-1&&(w.splice(R,1),w.unshift("_"));const D=u.find(J=>J.only);return D&&w.includes(D.value)?D.titleShort?f?D.titleShort:b.I18n.t(D.titleShort):f?D.title:b.I18n.t(D.title):w.map(J=>u.find(ie=>ie.value===J||J==="_"&&ie.value==="")||J).map(J=>typeof J=="object"?J.titleShort?f?J.titleShort:b.I18n.t(J.titleShort):f?J.title:b.I18n.t(J.title):f?J:b.I18n.t(J)).join(", ")}const E=u?u.find(R=>R.value===w||w==="_"&&R.value===""):null;return E!=null&&E.title?f?E==null?void 0:E.title:b.I18n.t(E==null?void 0:E.title):w},onChange:w=>{if(i||y(w.target.value),a){const E=w.target.value,R=u.find(D=>D.only);if(R){const D=R.value;if(E.length===u.length-1&&E.includes(D))return p(E.filter(A=>A!==D),l);if(E.includes(D))return p(u.map(A=>A.value),l)}}p(w.target.value,l)},input:l?g.jsx(Dn,{name:l,id:`${l}-helper`}):g.jsx(Dn,{name:l}),children:[!a&&(u==null?void 0:u.map(w=>g.jsxs(Ve,{style:{placeContent:"space-between"},value:w.value===""||w.value===null||w.value===void 0?"_":w.value,children:[f?w.title:b.I18n.t(w.title),w.title2&&g.jsx("div",{children:v?w.title2:b.I18n.t(w.title2)})]},`key-${w.value}`))),a&&(u==null?void 0:u.map(w=>g.jsxs(Ve,{style:{placeContent:"space-between"},value:w.value||"_",children:[f?w.title:b.I18n.t(w.title)," ",g.jsx(TT,{customValue:!0,value:s==null?void 0:s.includes(w.value)})]},`key-${w.value}`)))]}),r?g.jsx(Aw,{children:b.I18n.t(r)}):null]})},GR="_root_1gt4d_1",KR="_mark_1gt4d_27",gw={root:GR,mark:KR},YR=({size:a,value:s,style:i,onChange:r,className:l,customValue:u,min:d,max:p,step:m,unit:f})=>{const[v,_]=vt(0);d=d!==void 0?d:0,p=p!==void 0?p:0,m=m!==void 0?m:(p-d)/100;const y=[{value:d,label:d+(f||"")},{value:p,label:p+(f||"")}];return g.jsx(Kk,{defaultValue:u?s:v,"aria-labelledby":"discrete-slider",valueLabelDisplay:"auto",classes:{mark:gw.mark},marks:y,step:m,min:d,max:p,value:u?s:v,style:i,className:b.Utils.clsx(gw.root,l),onChange:(k,C)=>{Array.isArray(C)?(!u&&_(C[0]),r(C[0])):(!u&&_(C),r(C))},size:a||"medium"})},JR="_root_rzul6_1",qR={root:JR},XR=({label:a,size:s,value:i,style:r,onChange:l,className:u,customValue:d})=>{const[p,m]=vt(!1);return g.jsx(Ag,{className:qR.root,control:g.jsx(Rw,{checked:d?i:p,style:r,className:u,onChange:f=>{d||m(f.target.checked),l(f.target.checked)},size:s||"medium"}),label:a??"all"})},ZR=am(XR),QR="_root_135pm_1",eO={root:QR},tO=({value:a,style:s,onChange:i,className:r})=>g.jsx(vo,{variant:"standard",id:"time",type:"time",onChange:l=>i(l.currentTarget.value),value:a,className:b.Utils.clsx(eO.root,r),fullWidth:!0,style:s,slotProps:{htmlInput:{step:300},inputLabel:{shrink:!0}}}),sO="_root_135pm_1",lc={root:sO},vg=[31,29,31,30,31,30,31,31,30,31,30,31],oO=({value:a,onChange:s,className:i,style:r})=>{const[l,u]=(a||"01.01").toString().split(".");let d=parseInt(u,10)||0,p=parseInt(l,10)||0;p>12?p=12:p<0&&(p=0),d>vg[p]?d=vg[p]:d<0&&(d=0);const m=[];for(let f=0;f<vg[p];f++)m.push(f+1);return g.jsxs("div",{children:[g.jsx(_i,{variant:"standard",className:b.Utils.clsx(lc.root,i),style:r,children:g.jsxs(wi,{variant:"standard",className:b.Utils.clsx(lc.root,i),margin:"dense",label:b.I18n.t("Month"),onChange:f=>s(`${f.target.value.toString().padStart(2,"0")}.${d.toString().padStart(2,"0")}`),value:p,children:[g.jsx(Ve,{style:{placeContent:"space-between"},value:0,children:b.I18n.t("Any month")},0),g.jsx(Ve,{style:{placeContent:"space-between"},value:1,children:b.I18n.t("January")},1),g.jsx(Ve,{style:{placeContent:"space-between"},value:2,children:b.I18n.t("February")},2),g.jsx(Ve,{style:{placeContent:"space-between"},value:3,children:b.I18n.t("March")},3),g.jsx(Ve,{style:{placeContent:"space-between"},value:4,children:b.I18n.t("April")},4),g.jsx(Ve,{style:{placeContent:"space-between"},value:5,children:b.I18n.t("May")},5),g.jsx(Ve,{style:{placeContent:"space-between"},value:6,children:b.I18n.t("June")},6),g.jsx(Ve,{style:{placeContent:"space-between"},value:7,children:b.I18n.t("July")},7),g.jsx(Ve,{style:{placeContent:"space-between"},value:8,children:b.I18n.t("August")},8),g.jsx(Ve,{style:{placeContent:"space-between"},value:9,children:b.I18n.t("September")},9),g.jsx(Ve,{style:{placeContent:"space-between"},value:10,children:b.I18n.t("October")},10),g.jsx(Ve,{style:{placeContent:"space-between"},value:11,children:b.I18n.t("November")},11),g.jsx(Ve,{style:{placeContent:"space-between"},value:12,children:b.I18n.t("December")},12)]})}),g.jsx(_i,{variant:"standard",className:b.Utils.clsx(lc.root,i),style:r,children:g.jsxs(wi,{variant:"standard",className:b.Utils.clsx(lc.root,i),margin:"dense",label:b.I18n.t("Date"),onChange:f=>s(`${p.toString().padStart(2,"0")}.${f.target.value.toString().padStart(2,"0")}`),value:d,children:[g.jsx(Ve,{style:{placeContent:"space-between"},value:0,children:b.I18n.t("Any")},"A"),m.map(f=>g.jsx(Ve,{style:{placeContent:"space-between"},value:f,children:f},f))]})})]})},yg={},iO={Shuffle:gx,Apps:sx,Functions:lx,Language:vS,AddBox:tx,Pause:gc,Subject:fx,PlayForWork:hx,Brightness3:ox,HelpOutline:dC,Storage:mx,AccessTime:ex,PlayArrow:Fg,FlashOn:rx};function mw({iconName:a,className:s,adapter:i,socket:r,onClick:l,style:u}){const[d,p]=vt("");if(Mt(()=>{i&&r&&(yg[i]instanceof Promise||(yg[i]=r.getObject(`system.adapter.${i}`)),yg[i].then(f=>{var v;return((v=f==null?void 0:f.common)==null?void 0:v.icon)&&p(`../../adapter/${i}/${f.common.icon}`)}))},[i,r]),i)return g.jsx("img",{onClick:f=>l&&l(f),src:d||"",className:s,style:u,alt:""});const m=a&&iO[a]||yS;return g.jsx(m,{className:s,style:u,onClick:f=>l&&l(f)})}let _g;function nO(a){return _g=_g||b.I18n.getLanguage(),a&&typeof a=="object"?a[_g]||a.en:a||""}function xn(a){return a===null?"null":a===void 0?"undefined":Array.isArray(a)?a.join(", "):typeof a=="object"?JSON.stringify(a):a.toString()}class Xe extends Ew{debugHideTimeout=null;lastObjectIdChange=0;enableSimulationProcessing=!1;lastDebugMessage=0;debugMessageTimeout=null;static getStaticData(){return{acceptedBy:"actions",name:"Not found",id:"ActionEmpty",icon:"Shuffle"}}static compile(s,i){return""}constructor(s,i){super(s),i||={};const r=s.settings||{tagCard:i.tagCardArray?typeof i.tagCardArray[0]!="string"?i.tagCardArray[0].title:i.tagCardArray[0]:""};!r.tagCard&&i.tagCardArray&&(r.tagCard=typeof i.tagCardArray[0]!="string"?i.tagCardArray[0].title:i.tagCardArray[0]),this.state={inputs:i.inputs||s.inputs||[],name:i.name||s.name||"",icon:i.icon||s.icon||"",adapter:i.adapter||s.adapter||"",helpDialog:i.helpDialog||s.helpDialog||"",tagCardArray:i.tagCardArray||[],openTagMenu:!1,openModal:!1,iconTag:!1,error:"",helpText:"",instanceSelectionOptions:[],instanceSelectionDef:"",hideAttributes:[],settings:r,debugMessage:null,enableSimulation:this.props.enableSimulation}}componentWillUnmount(){this.debugMessageTimeout&&(clearTimeout(this.debugMessageTimeout),this.debugMessageTimeout=null),this.debugHideTimeout&&(clearTimeout(this.debugHideTimeout),this.debugHideTimeout=null)}onTagChange(s,i,r,l,u){let d=!1;const p=JSON.parse(JSON.stringify(this.state.settings));this.state.inputs.forEach(m=>{const f=m.attr,v=m.defaultValue;f&&v!==void 0&&p[f]===void 0&&(d=!0,p[f]=v)}),d?(this.setState({settings:p},()=>i==null?void 0:i()),this.props.onChange(p)):i&&i()}onUpdate(){}onValueChanged(s,i){}renderText(s,i,r){const{className:l}=this.props,{attr:u,frontText:d,backText:p,nameBlock:m,name:f,doNotTranslate:v,doNotTranslateBack:_}=s;return g.jsxs(Sg,{children:[g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),children:[d&&g.jsx("div",{className:le.frontText,children:v?d:b.I18n.t(d)}),g.jsx(bi,{className:l,autoComplete:"off",label:nO(f),variant:"outlined",size:"small",fullWidth:!0,value:i,onChange:r,customValue:!0}),p&&g.jsx("div",{className:le.backText,children:_?p:b.I18n.t(p)})]}),m&&g.jsx("div",{className:le.nameBlock,children:b.I18n.t(m)})]},u)}renderSwitch(s,i,r){const{className:l}=this.props,{attr:u,frontText:d,backText:p,nameBlock:m,doNotTranslate:f,doNotTranslateBack:v}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),children:[d&&g.jsx("div",{className:le.frontText,children:f?d:b.I18n.t(d)}),g.jsx(ZR,{className:l,label:"",customValue:!0,value:i,onChange:r}),p&&g.jsx("div",{className:le.backText,children:v?p:b.I18n.t(p)})]}),m&&g.jsx("div",{className:le.nameBlock,children:b.I18n.t(m)})]},u)}renderNameText({attr:s,signature:i,doNotTranslate:r,defaultValue:l},u){return g.jsx("div",{className:b.Utils.clsx(i?le.displayItalic:le.displayFlex,le.blockMarginTop),children:u?r?u:b.I18n.t(u):r?l:b.I18n.t(l)},s)}renderNumber(s,i,r){const{className:l}=this.props,{settings:u}=this.state,{attr:d,backText:p,frontText:m,openCheckbox:f,doNotTranslate:v,doNotTranslateBack:_}=s;let y=!0;return f&&(y=typeof u.offset=="boolean"?u.offset:!0),y?g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),children:[m&&g.jsx("div",{className:le.frontText,children:v?m:b.I18n.t(m)}),g.jsx(bi,{className:b.Utils.clsx(l,s.className),fullWidth:!0,autoComplete:"off",label:s.noHelperText?"":"number",variant:"outlined",size:"small",type:"number",value:i,onChange:r,customValue:!0}),p&&g.jsx("div",{className:le.backText,children:_?p:b.I18n.t(p)})]},d):null}renderColor(s,i,r){const{className:l}=this.props,{attr:u,backText:d,frontText:p,doNotTranslate:m,doNotTranslateBack:f}=s;return g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),children:[p&&g.jsx("div",{className:le.frontText,children:m?p:b.I18n.t(p)}),g.jsx(bi,{className:l,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",type:"color",value:i,onChange:r}),d&&g.jsx("div",{className:le.backText,children:f?d:b.I18n.t(d)})]},u)}renderCheckbox(s,i,r){const{className:l}=this.props,{settings:u}=this.state,{attr:d,backText:p,frontText:m,defaultValue:f,doNotTranslate:v,doNotTranslateBack:_}=s;return g.jsxs("div",{className:le.displayFlex,children:[m&&g.jsx("div",{className:le.frontText,children:v?m:b.I18n.t(m)}),g.jsx(TT,{className:l,size:"small",value:typeof u[d]=="boolean"?!!u[d]:!!f,customValue:!0,onChange:r}),p&&g.jsx("div",{onClick:()=>r(typeof u[d]=="boolean"?!u[d]:!f),className:le.backText,children:_?p:b.I18n.t(p)})]},d)}renderSlider(s,i,r){const{className:l}=this.props,{attr:u,frontText:d,backText:p,nameBlock:m,min:f,max:v,step:_,unit:y,doNotTranslate:k,doNotTranslateBack:C}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:le.displayFlex,style:{marginRight:20},children:[d&&g.jsx("div",{className:le.frontText,children:k?d:b.I18n.t(d)}),g.jsx(YR,{customValue:!0,min:f,max:v,step:_,unit:y,className:l,autoComplete:"off",label:"number",variant:"outlined",size:"small",value:i,onChange:w=>{console.log(w),r(w)}}),p&&g.jsx("div",{style:{marginLeft:20},className:le.backText,children:C?p:b.I18n.t(p)})]}),m&&g.jsx("div",{className:le.nameBlock,children:b.I18n.t(m)})]},u)}renderButton(s,i,r){const{className:l}=this.props,{attr:u,frontText:d,backText:p,doNotTranslate:m,doNotTranslateBack:f}=s;return g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),children:[d&&g.jsx("div",{className:le.frontText,children:m?d:b.I18n.t(d)}),g.jsx(Ur,{fullWidth:!0,value:i.toString(),className:l,onClick:()=>r(i)}),p&&g.jsx("div",{className:le.backText,children:f?p:b.I18n.t(p)})]},u)}async findIcon(s){var i;if(!s)return null;if((i=s.common)!=null&&i.icon)return b.getSelectIdIcon(s,"../..");if(s.type==="state"||s.type==="channel"){const r=s._id.split(".");r.pop();const l=r.join(".");try{const u=await this.props.socket.getObject(l);return await this.findIcon(u)}catch{return null}}return null}renderObjectID(s,i,r){const{attr:l,openCheckbox:u,checkReadOnly:d}=s,{settings:p}=this.state,m=this.state[`showSelectId${l}`],{className:f,socket:v,style:_}=this.props;let y=!0;u&&(y=typeof p.offset=="boolean"?p.offset:!0);const k=p[l],C=k?this.state[k]:void 0;return k&&!C&&C!==!1&&setTimeout(async w=>{var A;const E=await v.getObject(i),R=await this.findIcon(E),D={[w]:E||!1,[`${w}___icon`]:R,error:d&&this.lastObjectIdChange&&Date.now()-this.lastObjectIdChange<1e3&&((A=E==null?void 0:E.common)==null?void 0:A.write)===!1?b.I18n.t("Read only ID selected: %s",p[w]):""};this.setState(D)},0,k),y?g.jsxs("div",{className:le.blockMarginTop,children:[g.jsxs("div",{className:le.displayFlex,children:[s.title?g.jsx("div",{children:b.I18n.t(s.title)}):null,g.jsx(bi,{className:f,style:_,autoComplete:"off",fullWidth:!0,disabled:!0,variant:"outlined",size:"small",value:i,customValue:!0}),g.jsx(Ur,{icon:this.state[`${k}___icon`],square:!0,style:{..._||void 0,marginLeft:7},value:"...",className:f,onClick:()=>{const w={};w[`showSelectId${l}`]=!0,this.setState(w)}})]}),C?g.jsx("div",{className:b.Utils.clsx(le.nameBlock,le.displayItalic),children:b.Utils.getObjectNameFromObj(C,b.I18n.getLanguage())}):null,m?g.jsx(b.DialogSelectID,{theme:this.props.theme,imagePrefix:"../..",dialogName:"javascript",themeType:b.Utils.getThemeName(),socket:v,selected:i,onClose:()=>{const w={};w[`showSelectId${l}`]=!1,this.setState(w)},onOk:(w,E)=>{const R={};R[`showSelectId${l}`]=!1;const D=Array.isArray(w)?w[0]:w;this.setState(R,async()=>{var J,ie,se,me,z,Oe,Ne,Ze,ae,ce;const A=D?await v.getObject(D):void 0;this.lastObjectIdChange=Date.now(),r({[l]:w,[`${l}Role`]:(J=A==null?void 0:A.common)==null?void 0:J.role,[`${l}Type`]:(ie=A==null?void 0:A.common)==null?void 0:ie.type,[`${l}Unit`]:(se=A==null?void 0:A.common)==null?void 0:se.unit,[`${l}States`]:(me=A==null?void 0:A.common)==null?void 0:me.states,[`${l}Min`]:(z=A==null?void 0:A.common)==null?void 0:z.min,[`${l}Max`]:(Oe=A==null?void 0:A.common)==null?void 0:Oe.max,[`${l}Step`]:(Ne=A==null?void 0:A.common)==null?void 0:Ne.step,[`${l}Def`]:(Ze=A==null?void 0:A.common)==null?void 0:Ze.def,[`${l}Write`]:(ae=A==null?void 0:A.common)==null?void 0:ae.write,[`${l}Read`]:(ce=A==null?void 0:A.common)==null?void 0:ce.read},()=>this.props.setOnUpdate&&this.props.setOnUpdate(!0))})}}):null]},l):null}renderIconTag(){return g.jsx("div",{className:le.iconTag,onClick:s=>{this.state.settings.tagCard&&(this.state.tagCardArray.length<3?this.onChangeTag():this.setState({openTagMenu:s.currentTarget}))},children:this.state.settings.tagCard})}renderTime(s,i,r){const{attr:l,backText:u,frontText:d,doNotTranslate:p,doNotTranslateBack:m}=s;return g.jsxs("div",{className:le.displayFlex,style:{whiteSpace:"nowrap"},children:[d&&g.jsx("div",{className:le.frontText,children:p?d:b.I18n.t(d)}),g.jsx(tO,{value:i,onChange:r}),u&&g.jsx("div",{className:le.backText,children:m?u:b.I18n.t(u)})]},l)}renderSelect(s,i,r){const{className:l,style:u}=this.props,{name:d,options:p,frontText:m,backText:f,attr:v,multiple:_,doNotTranslate:y,doNotTranslate2:k,doNotTranslateBack:C}=s;return g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),style:{whiteSpace:"nowrap"},children:[m&&g.jsx("div",{className:le.frontText,children:b.I18n.t(m)}),g.jsx(VR,{attr:v,doNotTranslate:y,doNotTranslate2:k,title:d,className:l,style:u,options:p,value:i,onChange:r,multiple:_,customValue:!0}),f&&g.jsx("div",{className:le.backText,children:C?f:b.I18n.t(f)})]},v)}renderInstance(s,i,r){const{socket:l}=this.props,{name:u,frontText:d,backText:p,attr:m,adapter:f,doNotTranslate:v,doNotTranslateBack:_}=s;return this.state.hideAttributes.includes(m)?null:g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),style:{whiteSpace:"nowrap"},children:[d&&g.jsx("div",{className:le.frontText,children:v?d:b.I18n.t(d)}),g.jsx(FR,{attr:m,socket:l,adapter:f,title:u,value:i,onChange:y=>{r(Array.isArray(y)?y[0]:y)},customValue:!0,onInstanceHide:y=>this.setState({hideAttributes:[...this.state.hideAttributes,m]},()=>r(y))}),p&&g.jsx("div",{className:le.backText,children:_?p:b.I18n.t(p)})]},m)}renderDialog(s){const{onShowDialog:i,frontText:r,backText:l,attr:u,icon:d,doNotTranslate:p,doNotTranslateBack:m}=s;return g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),style:{whiteSpace:"nowrap"},children:[r&&g.jsx("div",{className:le.frontText,children:p?r:b.I18n.t(r)}),g.jsx(mw,{iconName:d,className:b.Utils.clsx(le.iconDialog),onClick:()=>i&&i()}),l&&g.jsx("div",{className:le.backText,children:m?l:b.I18n.t(l)})]},u)}renderModalInput(s,i,r){const{openModal:l}=this.state,{className:u}=this.props,{attr:d,nameBlock:p,frontText:m,backText:f,noTextEdit:v,doNotTranslate:_,doNotTranslateBack:y}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:b.Utils.clsx(le.displayFlex,le.blockMarginTop),children:[m&&g.jsx("div",{className:le.frontText,children:_?m:b.I18n.t(m)}),g.jsx(bi,{disabled:!!v,className:u,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",value:i,onChange:r,customValue:!0}),g.jsx(Ur,{square:!0,style:{marginLeft:5},value:"...",className:u,onClick:()=>this.setState({openModal:!0})}),f&&g.jsx("div",{className:le.backText,children:y?f:b.I18n.t(f)})]}),l?g.jsx(nm,{onApply:k=>this.setState({openModal:!1},()=>k!=null&&r(k)),onClose:()=>this.setState({openModal:!1}),defaultValue:i,textInput:!0}):null,p&&g.jsx("div",{className:le.nameBlock,children:b.I18n.t(p)})]},d)}renderDate(s,i,r){const{attr:l,backText:u,frontText:d,doNotTranslate:p,doNotTranslateBack:m}=s;return g.jsxs("div",{className:le.displayFlex,style:{whiteSpace:"nowrap"},children:[d&&g.jsx("div",{className:le.frontText,children:p?d:b.I18n.t(d)}),g.jsx(oO,{value:i,onChange:r}),u&&g.jsx("div",{className:le.backText,children:m?u:b.I18n.t(u)})]},l)}static getReplacesInText(s){var r;let i="";return(r=s.trigger)!=null&&r.oidType?i=".replace(/%s/g, obj.state.val).replace(/%id/g, obj.id).replace(/%name/g, obj.common && obj.common.name).replace(/%old/g, obj.oldState.val)":s.conditionsStates.length&&(i=`.replace(/%s/g, ${s.conditionsStates[0].name}).replace(/%id/g, "${s.conditionsStates[0].id}")`),i}renderTags(){const{tagCardArray:s,openTagMenu:i}=this.state,{tagCard:r}=this.state.settings;let l=r!=="="&&r!=="<>"&&r!==">="&&r!=="()"&&r!=="."&&r!=="<="&&r!=="<"&&r!==">"&&r?b.I18n.t(r):r;return s.length>=3&&(l=g.jsxs("div",{children:[g.jsx("div",{"aria-controls":"simple-menu","aria-haspopup":"true",onClick:u=>{this.setState({openTagMenu:u.currentTarget},()=>{this.props.isTourOpen&&this.props.tourStep===As.openTagsMenu&&setTimeout(()=>this.props.setTourStep&&this.props.setTourStep(As.selectIntervalTag),300)})},children:l}),g.jsx(cm,{id:"simple-menu",anchorEl:i,keepMounted:!0,open:!!i,onClose:()=>this.setState({openTagMenu:null}),children:s.map((u,d)=>{let p;return typeof u!="string"?p=u.title:p=u,g.jsxs(Ve,{selected:p===r,className:`tag-card-${p}`,style:{placeContent:"space-between"},onClick:m=>{m.stopPropagation(),this.props.isTourOpen&&(this.props.tourStep===As.openTagsMenu||this.props.tourStep===As.selectIntervalTag)&&p==="interval"&&setTimeout(()=>{var v,_;return(_=(v=this.props).setTourStep)==null?void 0:_.call(v,As.selectActions)},500);const f=JSON.parse(JSON.stringify(this.state.settings));f.tagCard=p,this.setState({openTagMenu:null,settings:f},()=>{this.props.onChange(this.state.settings),this.onTagChange(this.state.settings.tagCard)})},children:[p.search(/>|<|<>|<=|>=|=/)!==-1?p:b.I18n.t(p),typeof u!="string"&&u.title2&&g.jsx("div",{style:{marginLeft:4},children:b.I18n.t(u.title2)})]},`${p}_${d}`)})})]})),l}getData(){return{acceptedBy:"triggers",name:"",id:""}}onChangeTag(){const{tagCardArray:s,settings:i,settings:{tagCard:r}}=this.state;let l;if(typeof s[0]!="string"?l=s.map(u=>u.title):l=[...s],r&&l.length<3){const u={...i},d=l[(l.indexOf(r)+1)%l.length];u.tagCard=d,this.setState({settings:u},()=>{this.props.onChange(u),this.onTagChange(d)})}}componentDidMount(){this.onTagChange()}componentDidUpdate(){this.props.acceptedBy!=="triggers"&&this.props.onUpdate&&setTimeout(()=>this.onUpdate(),0)}onChangeInput(s){return(i,r,l)=>{const u=JSON.parse(JSON.stringify(this.state.settings));typeof i=="object"&&(!r||typeof r=="function")?(Object.keys(i).forEach(d=>u[d]=i[d]),typeof r=="function"&&(l=r,r=void 0)):u[r||s]=i,u.id=this.getData().id,u._id=this.props._id,this.setState({settings:u},()=>{this.onValueChanged(i,r||s),this.props.onChange(u),l==null||l()})}}renderSpecific(){return null}renderDebug(s){return""}renderDebugInfo(){return this.state.debugMessage?g.jsx("div",{className:le.debugInfo,style:{opacity:1,height:22,bottom:-22},children:this.renderDebug?this.renderDebug(this.state.debugMessage):b.I18n.t("executed")},this.state.debugMessage.ts):null}renderCron(s,i,r){return null}renderWizard(s,i,r){return null}renderWriteState(){return null}renderInputElement(s,i){const{nameRender:r,defaultValue:l,attr:u}=s,{settings:d}=this.state;let p=u?d[u]:void 0;switch(p===void 0&&(p=l),r){case"renderTime":return u?this.renderTime(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderTime")},`invalid_${i}`);case"renderNameText":return this.renderNameText(s,l);case"renderSelect":return u?this.renderSelect(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderSelect")},`invalid_${i}`);case"renderModalInput":return u?this.renderModalInput(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderModalInput")},`invalid_${i}`);case"renderObjectID":return u?this.renderObjectID(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderObjectID")},`invalid_${i}`);case"renderDialog":return u?this.renderDialog(s):g.jsx("div",{children:b.I18n.t("Invalid renderDialog")},`invalid_${i}`);case"renderInstance":return u?this.renderInstance(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderInstance")},`invalid_${i}`);case"renderText":return u?this.renderText(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderText")},`invalid_${i}`);case"renderSlider":return u?this.renderSlider(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderSlider")},`invalid_${i}`);case"renderCheckbox":return u?this.renderCheckbox(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderCheckbox")},`invalid_${i}`);case"renderButton":return u?this.renderButton(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderButton")},`invalid_${i}`);case"renderColor":return u?this.renderColor(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderColor")},`invalid_${i}`);case"renderSwitch":return u?this.renderSwitch(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderSwitch")},`invalid_${i}`);case"renderDate":return u?this.renderDate(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderDate")},`invalid_${i}`);case"renderCron":return u?this.renderCron(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderCron")},`invalid_${i}`);case"renderWizard":return u?this.renderWizard(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderWizard")},`invalid_${i}`);case"renderWriteState":return this.renderWriteState();case"renderNumber":return u?this.renderNumber(s,p,this.onChangeInput(u)):g.jsx("div",{children:b.I18n.t("Invalid renderNumber")},`invalid_${i}`);default:return this[r]?this[r](s,p,u?this.onChangeInput(u):null):g.jsx("div",{children:b.I18n.t("Invalid input type: %s",r)},`invalid_${i}`)}}render(){var y;const{inputs:s,name:i,icon:r,iconTag:l,settings:u,adapter:d,settings:{tagCard:p},helpDialog:m}=this.state,{socket:f,notFound:v}=this.props;this.state.settings&&!this.state.settings.tagCard&&((y=this.state.tagCardArray)!=null&&y.length)&&setTimeout(()=>{const k=JSON.parse(JSON.stringify(this.state.settings));k.tagCard=typeof this.state.tagCardArray[0]!="string"?this.state.tagCardArray[0].title:this.state.tagCardArray[0],this.setState({settings:k})},50),this.state.enableSimulation!==this.props.enableSimulation&&!this.enableSimulationProcessing&&(this.enableSimulationProcessing=!0,setTimeout(()=>{this.setState({enableSimulation:this.props.enableSimulation},()=>{this.enableSimulationProcessing=!1})},50));let _;if(this.props.onDebugMessage)for(let k=this.props.onDebugMessage.length-1;k>=0;k--){const C=this.props.onDebugMessage[k];if(C.blockId===this.props._id&&C.ts>this.lastDebugMessage&&C.ts>Date.now()-1e3){_=C;break}}return _&&(this.lastDebugMessage=_.ts,this.debugMessageTimeout&&clearTimeout(this.debugMessageTimeout),this.debugHideTimeout&&(clearTimeout(this.debugHideTimeout),this.debugHideTimeout=null),this.debugMessageTimeout=setTimeout(k=>{const C=JSON.parse(k),w=C.hideTimeout||5e3;this.debugMessageTimeout=null,this.setState({debugMessage:C},()=>{this.debugHideTimeout&&clearTimeout(this.debugHideTimeout),this.debugHideTimeout=setTimeout(()=>{this.debugHideTimeout=null,this.setState({debugMessage:null})},w)})},50,JSON.stringify(_))),g.jsxs(Sg,{children:[l?this.renderIconTag():g.jsx(mw,{iconName:r,className:b.Utils.clsx(le.iconThemCard,p&&this.state.tagCardArray.length&&le.iconThemCardSelectable),adapter:d,socket:f,onClick:k=>{p&&(this.state.tagCardArray.length<3?this.onChangeTag():this.setState({openTagMenu:k.currentTarget}))}}),g.jsxs("div",{className:le.blockName,children:[g.jsxs("span",{className:le.nameCard,children:[b.I18n.t(i),v?b.I18n.t("%s not found",u.id):"",m?g.jsx(Me,{className:le.iconHelp,size:"small",onClick:()=>this.setState({helpText:b.I18n.t(m)}),children:g.jsx(dC,{})}):null]}),s.map((k,C)=>this.renderInputElement(k,C))]}),p&&g.jsx("div",{className:le.controlMenuTop,style:{opacity:1,height:22,top:-22},children:g.jsx("div",{onClick:()=>this.onChangeTag(),className:b.Utils.clsx(le.tagCard,"tag-card"),children:this.renderTags()})}),this.renderDebugInfo(),this.state.error?g.jsx(b.DialogError,{title:b.I18n.t("Warning"),text:this.state.error,onClose:()=>this.setState({error:""})}):null,this.state.helpText?g.jsx(b.DialogMessage,{title:b.I18n.t("Instructions"),text:this.state.helpText,onClose:()=>this.setState({helpText:""})}):null,this.renderSpecific()]})}}const fw={en:{name:"Google - English",engine:"google",params:[]},de:{name:"Google - Deutsch",engine:"google",params:[]},ru:{name:"Google - Русский",engine:"google",params:[]},it:{name:"Google - Italiano",engine:"google",params:[]},es:{name:"Google - Espaniol",engine:"google",params:[]},fr:{name:"Google - Français",engine:"google",params:[]},ru_YA:{name:"Yandex - Русский",engine:"yandex",params:["key","voice","emotion","ill","drunk","robot"],voice:["jane","zahar"],emotion:["none","good","neutral","evil","mixed"]},ru_YA_CLOUD:{name:"Yandex Cloud - Русский",engine:"yandexCloud",params:["key","folderID","voice","emotion"],voice:["alyss","oksana","jane","zahar"],emotion:["good","neutral","evil"]},"en-US":{name:"PicoTTS - Englisch US",engine:"PicoTTS",params:[]},"en-GB":{name:"PicoTTS - Englisch GB",engine:"PicoTTS",params:[]},"de-DE":{name:"PicoTTS - Deutsch",engine:"PicoTTS",params:[]},"it-IT":{name:"PicoTTS - Italiano",engine:"PicoTTS",params:[]},"es-ES":{name:"PicoTTS - Espaniol",engine:"PicoTTS",params:[]},"fr-FR":{name:"PicoTTS - Français",engine:"PicoTTS",params:[]},"ru-RU_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"ru-RU",ename:"Tatyana",ssml:!0,name:"Cloud - Русский - Татьяна"},"ru-RU_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"ru-RU",ename:"Maxim",ssml:!0,name:"Cloud - Русский - Максим"},"de-DE_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"de-DE",ename:"Marlene",ssml:!0,name:"Cloud - Deutsch - Marlene"},"de-DE_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"de-DE",ename:"Hans",ssml:!0,name:"Cloud - Deutsch - Hans"},"en-US_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Salli",ssml:!0,name:"Cloud - en-US - Female - Salli"},"en-US_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-US",ename:"Joey",ssml:!0,name:"Cloud - en-US - Male - Joey"},"da-DK_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"da-DK",ename:"Naja",ssml:!0,name:"Cloud - da-DK - Female - Naja"},"da-DK_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"da-DK",ename:"Mads",ssml:!0,name:"Cloud - da-DK - Male - Mads"},"en-AU_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-AU",ename:"Nicole",ssml:!0,name:"Cloud - en-AU - Female - Nicole"},"en-AU_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-AU",ename:"Russell",ssml:!0,name:"Cloud - en-AU - Male - Russell"},"en-GB_CLOUD_Female_Amy":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-GB",ename:"Amy",ssml:!0,name:"Cloud - en-GB - Female - Amy"},"en-GB_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-GB",ename:"Brian",ssml:!0,name:"Cloud - en-GB - Male - Brian"},"en-GB_CLOUD_Female_Emma":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-GB",ename:"Emma",ssml:!0,name:"Cloud - en-GB - Female - Emma"},"en-GB-WLS_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-GB-WLS",ename:"Gwyneth",ssml:!0,name:"Cloud - en-GB-WLS - Female - Gwyneth"},"en-GB-WLS_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-GB-WLS",ename:"Geraint",ssml:!0,name:"Cloud - en-GB-WLS - Male - Geraint"},"cy-GB_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"cy-GB",ename:"Gwyneth",ssml:!0,name:"Cloud - cy-GB - Female - Gwyneth"},"cy-GB_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"cy-GB",ename:"Geraint",ssml:!0,name:"Cloud - cy-GB - Male - Geraint"},"en-IN_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-IN",ename:"Raveena",ssml:!0,name:"Cloud - en-IN - Female - Raveena"},"en-US_CLOUD_Male_Chipmunk":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-US",ename:"Chipmunk",ssml:!0,name:"Cloud - en-US - Male - Chipmunk"},"en-US_CLOUD_Male_Eric":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-US",ename:"Eric",ssml:!0,name:"Cloud - en-US - Male - Eric"},"en-US_CLOUD_Female_Ivy":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Ivy",ssml:!0,name:"Cloud - en-US - Female - Ivy"},"en-US_CLOUD_Female_Jennifer":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Jennifer",ssml:!0,name:"Cloud - en-US - Female - Jennifer"},"en-US_CLOUD_Male_Justin":{gender:"Male",engine:"cloud",params:["cloud"],language:"en-US",ename:"Justin",ssml:!0,name:"Cloud - en-US - Male - Justin"},"en-US_CLOUD_Female_Kendra":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Kendra",ssml:!0,name:"Cloud - en-US - Female - Kendra"},"en-US_CLOUD_Female_Kimberly":{gender:"Female",engine:"cloud",params:["cloud"],language:"en-US",ename:"Kimberly",ssml:!0,name:"Cloud - en-US - Female - Kimberly"},"es-ES_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"es-ES",ename:"Conchita",ssml:!0,name:"Cloud - es-ES - Female - Conchita"},"es-ES_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"es-ES",ename:"Enrique",ssml:!0,name:"Cloud - es-ES - Male - Enrique"},"es-US_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"es-US",ename:"Penelope",ssml:!0,name:"Cloud - es-US - Female - Penelope"},"es-US_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"es-US",ename:"Miguel",ssml:!0,name:"Cloud - es-US - Male - Miguel"},"fr-CA_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"fr-CA",ename:"Chantal",ssml:!0,name:"Cloud - fr-CA - Female - Chantal"},"fr-FR_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"fr-FR",ename:"Celine",ssml:!0,name:"Cloud - fr-FR - Female - Celine"},"fr-FR_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"fr-FR",ename:"Mathieu",ssml:!0,name:"Cloud - fr-FR - Male - Mathieu"},"is-IS_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"is-IS",ename:"Dora",ssml:!0,name:"Cloud - is-IS - Female - Dora"},"is-IS_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"is-IS",ename:"Karl",ssml:!0,name:"Cloud - is-IS - Male - Karl"},"it-IT_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"it-IT",ename:"Carla",ssml:!0,name:"Cloud - it-IT - Female - Carla"},"it-IT_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"it-IT",ename:"Giorgio",ssml:!0,name:"Cloud - it-IT - Male - Giorgio"},"nb-NO_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"nb-NO",ename:"Liv",ssml:!0,name:"Cloud - nb-NO - Female - Liv"},"nl-NL_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"nl-NL",ename:"Lotte",ssml:!0,name:"Cloud - nl-NL - Female - Lotte"},"nl-NL_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"nl-NL",ename:"Ruben",ssml:!0,name:"Cloud - nl-NL - Male - Ruben"},"pl-PL_CLOUD_Female_Agnieszka":{gender:"Female",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Agnieszka",ssml:!0,name:"Cloud - pl-PL - Female - Agnieszka"},"pl-PL_CLOUD_Male_Jacek":{gender:"Male",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Jacek",ssml:!0,name:"Cloud - pl-PL - Male - Jacek"},"pl-PL_CLOUD_Female_Ewa":{gender:"Female",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Ewa",ssml:!0,name:"Cloud - pl-PL - Female - Ewa"},"pl-PL_CLOUD_Male_Jan":{gender:"Male",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Jan",ssml:!0,name:"Cloud - pl-PL - Male - Jan"},"pl-PL_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"pl-PL",ename:"Maja",ssml:!0,name:"Cloud - pl-PL - Female - Maja"},"pt-BR_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"pt-BR",ename:"Vitoria",ssml:!0,name:"Cloud - pt-BR - Female - Vitoria"},"pt-BR_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"pt-BR",ename:"Ricardo",ssml:!0,name:"Cloud - pt-BR - Male - Ricardo"},"pt-PT_CLOUD_Male":{gender:"Male",engine:"cloud",params:["cloud"],language:"pt-PT",ename:"Cristiano",ssml:!0,name:"Cloud - pt-PT - Male - Cristiano"},"pt-PT_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"pt-PT",ename:"Ines",ssml:!0,name:"Cloud - pt-PT - Female - Ines"},"ro-RO_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"ro-RO",ename:"Carmen",ssml:!0,name:"Cloud - ro-RO - Female - Carmen"},"sv-SE_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"sv-SE",ename:"Astrid",ssml:!0,name:"Cloud - sv-SE - Female - Astrid"},"tr-TR_CLOUD_Female":{gender:"Female",engine:"cloud",params:["cloud"],language:"tr-TR",ename:"Filiz",ssml:!0,name:"Cloud - tr-TR - Female - Filiz"},"ru-RU_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"ru-RU",ename:"Tatyana",ssml:!0,name:"AWS Polly - Русский - Татьяна"},"ru-RU_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"ru-RU",ename:"Maxim",ssml:!0,name:"AWS Polly - Русский - Максим"},"de-DE_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"de-DE",ename:"Marlene",ssml:!0,name:"AWS Polly - Deutsch - Marlene"},"de-DE_AP_Female_Vicky":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"de-DE",ename:"Vicky",ssml:!0,name:"AWS Polly - Deutsch - Vicky"},"de-DE_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"de-DE",ename:"Hans",ssml:!0,name:"AWS Polly - Deutsch - Hans"},"en-US_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Salli",ssml:!0,name:"AWS Polly - en-US - Female - Salli"},"en-US_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Joey",ssml:!0,name:"AWS Polly - en-US - Male - Joey"},"da-DK_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"da-DK",ename:"Naja",ssml:!0,name:"AWS Polly - da-DK - Female - Naja"},"da-DK_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"da-DK",ename:"Mads",ssml:!0,name:"AWS Polly - da-DK - Male - Mads"},"en-AU_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-AU",ename:"Nicole",ssml:!0,name:"AWS Polly - en-AU - Female - Nicole"},"en-AU_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-AU",ename:"Russell",ssml:!0,name:"AWS Polly - en-AU - Male - Russell"},"en-GB_AP_Female_Amy":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB",ename:"Amy",ssml:!0,name:"AWS Polly - en-GB - Female - Amy"},"en-GB_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB",ename:"Brian",ssml:!0,name:"AWS Polly - en-GB - Male - Brian"},"en-GB_AP_Female_Emma":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB",ename:"Emma",ssml:!0,name:"AWS Polly - en-GB - Female - Emma"},"en-GB-WLS_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB-WLS",ename:"Gwyneth",ssml:!0,name:"AWS Polly - en-GB-WLS - Female - Gwyneth"},"en-GB-WLS_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-GB-WLS",ename:"Geraint",ssml:!0,name:"AWS Polly - en-GB-WLS - Male - Geraint"},"cy-GB_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"cy-GB",ename:"Gwyneth",ssml:!0,name:"AWS Polly - cy-GB - Female - Gwyneth"},"cy-GB_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"cy-GB",ename:"Geraint",ssml:!0,name:"AWS Polly - cy-GB - Male - Geraint"},"en-IN_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-IN",ename:"Raveena",ssml:!0,name:"AWS Polly - en-IN - Female - Raveena"},"en-US_AP_Male_Chipmunk":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Chipmunk",ssml:!0,name:"AWS Polly - en-US - Male - Chipmunk"},"en-US_AP_Male_Eric":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Eric",ssml:!0,name:"AWS Polly - en-US - Male - Eric"},"en-US_AP_Female_Ivy":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Ivy",ssml:!0,name:"AWS Polly - en-US - Female - Ivy"},"en-US_AP_Female_Jennifer":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Jennifer",ssml:!0,name:"AWS Polly - en-US - Female - Jennifer"},"en-US_AP_Male_Justin":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Justin",ssml:!0,name:"AWS Polly - en-US - Male - Justin"},"en-US_AP_Female_Kendra":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Kendra",ssml:!0,name:"AWS Polly - en-US - Female - Kendra"},"en-US_AP_Female_Kimberly":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"en-US",ename:"Kimberly",ssml:!0,name:"AWS Polly - en-US - Female - Kimberly"},"es-ES_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"es-ES",ename:"Conchita",ssml:!0,name:"AWS Polly - es-ES - Female - Conchita"},"es-ES_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"es-ES",ename:"Enrique",ssml:!0,name:"AWS Polly - es-ES - Male - Enrique"},"es-US_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"es-US",ename:"Penelope",ssml:!0,name:"AWS Polly - es-US - Female - Penelope"},"es-US_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"es-US",ename:"Miguel",ssml:!0,name:"AWS Polly - es-US - Male - Miguel"},"fr-CA_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"fr-CA",ename:"Chantal",ssml:!0,name:"AWS Polly - fr-CA - Female - Chantal"},"fr-FR_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"fr-FR",ename:"Celine",ssml:!0,name:"AWS Polly - fr-FR - Female - Celine"},"fr-FR_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"fr-FR",ename:"Mathieu",ssml:!0,name:"AWS Polly - fr-FR - Male - Mathieu"},"is-IS_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"is-IS",ename:"Dora",ssml:!0,name:"AWS Polly - is-IS - Female - Dora"},"is-IS_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"is-IS",ename:"Karl",ssml:!0,name:"AWS Polly - is-IS - Male - Karl"},"it-IT_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"it-IT",ename:"Carla",ssml:!0,name:"AWS Polly - it-IT - Female - Carla"},"it-IT_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"it-IT",ename:"Giorgio",ssml:!0,name:"AWS Polly - it-IT - Male - Giorgio"},"nb-NO_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"nb-NO",ename:"Liv",ssml:!0,name:"AWS Polly - nb-NO - Female - Liv"},"nl-NL_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"nl-NL",ename:"Lotte",ssml:!0,name:"AWS Polly - nl-NL - Female - Lotte"},"nl-NL_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"nl-NL",ename:"Ruben",ssml:!0,name:"AWS Polly - nl-NL - Male - Ruben"},"pl-PL_AP_Female_Agnieszka":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Agnieszka",ssml:!0,name:"AWS Polly - pl-PL - Female - Agnieszka"},"pl-PL_AP_Male_Jacek":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Jacek",ssml:!0,name:"AWS Polly - pl-PL - Male - Jacek"},"pl-PL_AP_Female_Ewa":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Ewa",ssml:!0,name:"AWS Polly - pl-PL - Female - Ewa"},"pl-PL_AP_Male_Jan":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Jan",ssml:!0,name:"AWS Polly - pl-PL - Male - Jan"},"pl-PL_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pl-PL",ename:"Maja",ssml:!0,name:"AWS Polly - pl-PL - Female - Maja"},"pt-BR_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pt-BR",ename:"Vitoria",ssml:!0,name:"AWS Polly - pt-BR - Female - Vitoria"},"pt-BR_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"pt-BR",ename:"Ricardo",ssml:!0,name:"AWS Polly - pt-BR - Male - Ricardo"},"pt-PT_AP_Male":{gender:"Male",engine:"polly",params:["accessKey","secretKey","region"],language:"pt-PT",ename:"Cristiano",ssml:!0,name:"AWS Polly - pt-PT - Male - Cristiano"},"pt-PT_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"pt-PT",ename:"Ines",ssml:!0,name:"AWS Polly - pt-PT - Female - Ines"},"ro-RO_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"ro-RO",ename:"Carmen",ssml:!0,name:"AWS Polly - ro-RO - Female - Carmen"},"sv-SE_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"sv-SE",ename:"Astrid",ssml:!0,name:"AWS Polly - sv-SE - Female - Astrid"},"tr-TR_AP_Female":{gender:"Female",engine:"polly",params:["accessKey","secretKey","region"],language:"tr-TR",ename:"Filiz",ssml:!0,name:"AWS Polly - tr-TR - Female - Filiz"}};class xc extends Xe{constructor(s){super(s,xc.getStaticData())}static compile(s,i){return s.text?`// Sayit ${s.text||""}
1093
+ const subActionVar${s._id} = "${s.language&&s.language!=="_"?`${s.language};`:""}${s.volume?`${s.volume};`:""}${(s.text||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1094
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1095
+ await setStateAsync("${s.instance}.tts.text", subActionVar${s._id});`:`// no text defined
1096
+ _sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`${b.I18n.t("Say:")} ${s.data.text}`}onTagChange(){const s=b.I18n.getLanguage(),r=Object.keys(fw).filter(l=>l.startsWith(s)).map(l=>({title:fw[l].name,value:l}));r.unshift({title:"Default",value:"_"}),this.setState({inputs:[{attr:"instance",nameRender:"renderInstance",adapter:"sayit",defaultValue:"sayit.0",frontText:"Instance:"},{nameRender:"renderSelect",frontText:"Language:",options:r,defaultValue:"_",attr:"language"},{nameRender:"renderNameText",defaultValue:"Volume",attr:"textVol"},{nameRender:"renderSlider",attr:"volume",defaultValue:100,min:0,max:100},{attr:"text",nameRender:"renderModalInput",defaultValue:"Hallo",nameBlock:"",frontText:"Text:"}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Say It",id:"ActionSayText",adapter:"sayit",title:"Say some text via sayit adapter",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return xc.getStaticData()}}class Dc extends Xe{constructor(s){super(s,Dc.getStaticData())}static compile(s,i){const r=(s.text||"").replace(/"/g,'\\"');return r?`// Pushover ${s.text||""}
1097
+ const subActionVar${s._id} = "${r}"${Xe.getReplacesInText(i)};
1098
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1099
+ sendTo("${s.instance}", "send", {
1100
+ message: subActionVar${s._id},
1101
+ title: "${(s.title||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)},
1102
+ sound: "${s.sound}",
1103
+ priority: ${s.priority}
1104
+ });`:`// no text defined
1105
+ _sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`Sent: ${s.data.text}`}onTagChange(){this.setState({inputs:[{nameRender:"renderInstance",adapter:"pushover",frontText:"Instance:",defaultValue:"pushover.0",attr:"instance"},{nameRender:"renderModalInput",attr:"text",defaultValue:"Hello",nameBlock:"",frontText:"Text:"},{nameRender:"renderText",attr:"title",defaultValue:"ioBroker",frontText:"Title:"},{nameRender:"renderSelect",attr:"sound",defaultValue:"magic",frontText:"Sound:",doNotTranslate:!0,options:[{value:"pushover",title:"pushover"},{value:"bike",title:"bike"},{value:"bugle",title:"bugle"},{value:"cashregister",title:"cashregister"},{value:"classical",title:"classical"},{value:"cosmic",title:"cosmic"},{value:"falling",title:"falling"},{value:"gamelan",title:"gamelan"},{value:"incoming",title:"incoming"},{value:"intermission",title:"intermission"},{value:"magic",title:"magic"},{value:"mechanical",title:"mechanical"},{value:"pianobar",title:"pianobar"},{value:"siren",title:"siren"},{value:"spacealarm",title:"spacealarm"},{value:"tugboat",title:"tugboat"},{value:"alien",title:"alien"},{value:"climb",title:"climb"},{value:"persistent",title:"persistent"},{value:"echo",title:"echo"},{value:"updown",title:"updown"},{value:"none",title:"none"}]},{nameRender:"renderSelect",attr:"priority",defaultValue:-1,frontText:"Priority:",options:[{value:-1,title:"quiet"},{value:0,title:"normal"},{value:1,title:"high-priority"},{value:2,title:"acknowledgment"}]}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Pushover",id:"ActionPushover",adapter:"pushover",title:"Sends message via pushover",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return Dc.getStaticData()}}class Ac extends Xe{constructor(s){super(s,Ac.getStaticData())}static compile(s,i){const r=(s.text||"").replace(/"/g,'\\"');return r?`// whatsapp ${r||""}
1106
+ const subActionVar${s._id} = "${(r||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1107
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1108
+ sendTo("${s.instance}", "send", {text: subActionVar${s._id}${s.phone?`, phone: "${s.phone.replace(/"/g,'\\"')}"`:""}});`:`// no text defined
1109
+ _sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`${b.I18n.t("Sent:")} ${s.data.text}`}onTagChange(){this.setState({inputs:[{nameRender:"renderInstance",adapter:"whatsapp-cmb",frontText:"Instance:",defaultValue:"whatsapp-cmb.0",attr:"instance"},{nameRender:"renderModalInput",attr:"text",defaultValue:"Hello",nameBlock:"",frontText:"Text:"},{nameRender:"renderText",attr:"phone",defaultValue:"",frontText:"Phone:",backText:"(optional)"}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Whatsapp-cmb",id:"ActionWhatsappcmb",adapter:"whatsapp-cmb",title:"Sends message via whatsapp-cmb",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return Ac.getStaticData()}}class Rc extends Xe{constructor(s){super(s,Rc.getStaticData())}static compile(s,i){const r=(s.text||"").replace(/"/g,'\\"');return r?`// Pushsafer ${s.text||""}
1110
+ const subActionVar${s._id} = "${r}"${Xe.getReplacesInText(i)};
1111
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1112
+ sendTo("${s.instance}", "send", {
1113
+ message: subActionVar${s._id},
1114
+ title: "${(s.title||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)},
1115
+ ${s.sound&&s.sound!=="_"?`sound: "${s.sound}",`:""}
1116
+ priority: ${s.priority},
1117
+ ${s.vibration&&s.vibration!=="_"?`vibration: ${s.vibration},`:""}
1118
+ });`:`// no text defined
1119
+ _sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`Sent: ${s.data.text}`}onTagChange(){this.setState({inputs:[{nameRender:"renderInstance",adapter:"pushsafer",frontText:"Instance:",defaultValue:"pushsafer.0",attr:"instance"},{nameRender:"renderModalInput",attr:"text",defaultValue:"Hello",nameBlock:"",frontText:"Text:"},{nameRender:"renderText",attr:"title",defaultValue:"ioBroker",frontText:"Title:"},{nameRender:"renderSelect",attr:"sound",defaultValue:"magic",frontText:"Sound:",doNotTranslate:!0,options:[{value:"_",title:"Device Default"},{value:"0",title:"Silent"},{value:"1",title:"Ahem (IM)"},{value:"2",title:"Applause (Mail)"},{value:"3",title:"Arrow (Reminder)"},{value:"4",title:"Baby (SMS)"},{value:"5",title:"Bell (Alarm)"},{value:"6",title:"Bicycle (Alarm2)"},{value:"7",title:"Boing (Alarm3)"},{value:"8",title:"Buzzer (Alarm4)"},{value:"9",title:"Camera (Alarm5)"},{value:"10",title:"Car Horn (Alarm6)"},{value:"11",title:"Cash Register (Alarm7)"},{value:"12",title:"Chime (Alarm8)"},{value:"13",title:"Creaky Door (Alarm9)"},{value:"14",title:"Cuckoo Clock (Alarm10)"},{value:"15",title:"Disconnect (Call)"},{value:"16",title:"Dog (Call2)"},{value:"17",title:"Doorbell (Call3)"},{value:"18",title:"Fanfare (Call4)"},{value:"19",title:"Gun Shot (Call5)"},{value:"20",title:"Honk (Call6)"},{value:"21",title:"Jaw Harp (Call7)"},{value:"22",title:"Morse (Call8)"},{value:"23",title:"Electricity (Call9)"},{value:"24",title:"Radio Tuner (Call10)"},{value:"25",title:"Sirens"},{value:"26",title:"Military Trumpets"},{value:"27",title:"Ufo"},{value:"28",title:"Whah Whah Whah"},{value:"29",title:"Man Saying Goodbye"},{value:"30",title:"Man Saying Hello"},{value:"31",title:"Man Saying No"},{value:"32",title:"Man Saying Ok"},{value:"33",title:"Man Saying Ooohhhweee"},{value:"34",title:"Man Saying Warning"},{value:"35",title:"Man Saying Welcome"},{value:"36",title:"Man Saying Yeah"},{value:"37",title:"Man Saying Yes"},{value:"38",title:"Beep short"},{value:"39",title:"Weeeee short"},{value:"40",title:"Cut in and out short"},{value:"41",title:"Finger flicking glas short"},{value:"42",title:"Wa Wa Waaaa short"},{value:"43",title:"Laser short"},{value:"44",title:"Wind Chime short"},{value:"45",title:"Echo short"},{value:"46",title:"Zipper short"},{value:"47",title:"HiHat short"},{value:"48",title:"Beep 2 short"},{value:"49",title:"Beep 3 short"},{value:"50",title:"Beep 4 short"},{value:"51",title:"The Alarm is armed"},{value:"52",title:"The Alarm is disarmed"},{value:"53",title:"The Backup is ready"},{value:"54",title:"The Door is closed"},{value:"55",title:"The Door is opend"},{value:"56",title:"The Window is closed"},{value:"57",title:"The Window is open"},{value:"58",title:"The Light is off"},{value:"59",title:"The Light is on"},{value:"60",title:"The Doorbell rings"},{value:"61",title:"Pager short"},{value:"62",title:"Pager long"}]},{nameRender:"renderSelect",attr:"priority",defaultValue:0,frontText:"Priority:",options:[{value:-2,title:"lowest priority"},{value:-1,title:"lower priority"},{value:0,title:"normal priority"},{value:1,title:"high priority"},{value:2,title:"highest priority"}]},{nameRender:"renderSelect",attr:"vibration",defaultValue:0,frontText:"Vibration:",options:[{value:"_",title:"default"},{value:1,title:"1"},{value:2,title:"2"},{value:3,title:"3"}]}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Pushsafer",id:"ActionPushsafer",adapter:"pushsafer",title:"Sends message via Pushsafer",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return Rc.getStaticData()}}const kT=`async function (obj) {
1120
+ "__%%DEBUG_TRIGGER%%__";
1121
+ __%%CONDITIONS_VARS%%__
1122
+ const _cond = __%%CONDITION%%__;
1123
+
1124
+ "__%%DEBUG_CONDITIONS%%__";
1125
+
1126
+ if (_cond) {
1127
+ __%%THEN%%__
1128
+ } else {
1129
+ __%%ELSE%%__
1130
+ }
1131
+ }`,ST=`async function (obj) {
1132
+ "__%%DEBUG_TRIGGER%%__";
1133
+ __%%CONDITIONS_VARS%%__
1134
+ const _cond = __%%CONDITION%%__;
1135
+
1136
+ "__%%DEBUG_CONDITIONS%%__";
1137
+
1138
+ if (__%%STATE%%__ === false && _cond) {
1139
+ __%%STATE%%__ = true;
1140
+ __%%THEN%%__
1141
+ } else if (__%%STATE%%__ === true && !_cond) {
1142
+ __%%STATE%%__ = false;
1143
+ __%%ELSE%%__
1144
+ }
1145
+ }`,rO=`"__%%DEBUG_TRIGGER%%__";
1146
+ __%%CONDITIONS_VARS%%__
1147
+ const _cond = __%%CONDITION%%__;
1148
+
1149
+ "__%%DEBUG_CONDITIONS%%__";
1150
+
1151
+ if (_cond) {
1152
+ __%%THEN%%__
1153
+ } else {
1154
+ __%%ELSE%%__
1155
+ }`,wg={triggers:[],conditions:[[]],justCheck:!1,actions:{then:[],else:[]}};function aO(a,s,i){const r=[];let l=a.triggers;l.length||(l=[{id:"TriggerScriptSave"}]);const u=[],d=[],p=a.conditions.find(f=>f.find(v=>v.tagCard==="()"));l.forEach((f,v)=>{var y;const _=Um(f.id,i);if(_){const k={trigger:f,condition:{index:0},justCheck:p?!1:a.justCheck||!a.conditions.length||!a.conditions[0].length,conditionsDebug:[],conditionsVars:[],conditionsStates:[]},C=_.compile(f,k),w=lO(a.conditions,k,i),E=$w(a.actions.then,k,i),R=$w(a.actions.else,k,i);u.push(`cond${v}`),(y=k.prelines)!=null&&y.length&&k.prelines.forEach(D=>d.push(D)),C.includes(" __%%CONDITIONS_VARS%%__")&&(k.conditionsVars=k.conditionsVars.map((D,A)=>A?` ${D}`:D),k.conditionsDebug=k.conditionsDebug.map((D,A)=>A?` ${D}`:D)),r.push(C.replace("__%%CONDITIONS_VARS%%__",k.conditionsVars.join(`
1156
+ `)).replace('"__%%DEBUG_CONDITIONS%%__";',k.conditionsDebug.join(`
1157
+ `)).replace("__%%CONDITION%%__",w).replace("__%%THEN%%__",E||"// ignore").replace("__%%ELSE%%__",R||"// ignore").replace(/__%%STATE%%__/g,`cond${v}`))}});let m=r.join(`
1158
+
1159
+ `);return(!a.justCheck||p)&&(m=`${u.map(f=>`let ${f} = false;`).join(`
1160
+ `)}
1161
+
1162
+ ${m}`),d&&(m=`${d.join(`
1163
+ `)}
1164
+
1165
+ ${m}`),m}function Um(a,s){return s.find(i=>i.getStaticData&&i.getStaticData().id===a)}function $w(a,s,i){const r=[];return a==null||a.forEach(l=>{const u=Um(l.id,i);u&&r.push(u.compile(l,s))}),` ${r.join(`
1166
+
1167
+ `)}`}function lO(a,s,i){const r=[];let l=0;return a==null||a.forEach(u=>{const d=[];u!=null&&u.length&&(u.forEach(p=>{const m=Um(p.id,i);m&&(s.condition.index=l++,d.push(m.compile(p,s)))}),r.push(`(${d.join(`) &&
1168
+ (`)})`))}),r.length?r.length===1?r[0]||"true":`(${r.join(") || (")})`:"true"}function cO(a,s){return aO(a,null,s)}function cne(a){if(!a)return wg;const s=a.split(`
1169
+ `);try{const i=(s.pop()||"").replace(/^\/\//,"");let r=JSON.parse(i);return r.triggers||(r=wg),r}catch{return wg}}function une(a,s){let i="";const r=cO(a,s);return i+=r,i+=`
1170
+ /*
1171
+ const demo = ${JSON.stringify(a,null,2).replace(/\*\//g,"* /")};
1172
+ */
1173
+ `,`${i}
1174
+ //${JSON.stringify(a)}`}class Oc extends Xe{constructor(s){super(s,Oc.getStaticData())}static compile(s,i){return rO.replace('"__%%DEBUG_TRIGGER%%__"',`_sendToFrontEnd(${s._id}, {trigger: true})`)}renderDebug(){return b.I18n.t("Triggered")}onTagChange(s){this.setState({inputs:[{nameRender:"renderNameText",defaultValue:"On script save or adapter start",attr:"script"}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"triggers",name:"Start script",id:"TriggerScriptSave",icon:"PlayArrow",title:"Triggers the on script saving or the javascript instance restart"}}getData(){return Oc.getStaticData()}}var ET={exports:{}};(function(a,s){(function(){var i=Math.PI,r=Math.sin,l=Math.cos,u=Math.tan,d=Math.asin,p=Math.atan2,m=Math.acos,f=i/180,v=1e3*60*60*24,_=2440588,y=2451545;function k(q){return q.valueOf()/v-.5+_}function C(q){return new Date((q+.5-_)*v)}function w(q){return k(q)-y}var E=f*23.4397;function R(q,ee){return p(r(q)*l(E)-u(ee)*r(E),l(q))}function D(q,ee){return d(r(ee)*l(E)+l(ee)*r(E)*r(q))}function A(q,ee,B){return p(r(q),l(q)*r(ee)-u(B)*l(ee))}function J(q,ee,B){return d(r(ee)*r(B)+l(ee)*l(B)*l(q))}function ie(q,ee){return f*(280.16+360.9856235*q)-ee}function se(q){return q<0&&(q=0),2967e-7/Math.tan(q+.00312536/(q+.08901179))}function me(q){return f*(357.5291+.98560028*q)}function z(q){var ee=f*(1.9148*r(q)+.02*r(2*q)+3e-4*r(3*q)),B=f*102.9372;return q+ee+B+i}function Oe(q){var ee=me(q),B=z(ee);return{dec:D(B,0),ra:R(B,0)}}var Ne={};Ne.getPosition=function(q,ee,B){var H=f*-B,U=f*ee,re=w(q),I=Oe(re),de=ie(re,H)-I.ra;return{azimuth:A(de,U,I.dec),altitude:J(de,U,I.dec)}};var Ze=Ne.times=[[-.833,"sunrise","sunset"],[-.3,"sunriseEnd","sunsetStart"],[-6,"dawn","dusk"],[-12,"nauticalDawn","nauticalDusk"],[-18,"nightEnd","night"],[6,"goldenHourEnd","goldenHour"]];Ne.addTime=function(q,ee,B){Ze.push([q,ee,B])};var ae=9e-4;function ce(q,ee){return Math.round(q-ae-ee/(2*i))}function K(q,ee,B){return ae+(q+ee)/(2*i)+B}function ye(q,ee,B){return y+q+.0053*r(ee)-.0069*r(2*B)}function he(q,ee,B){return m((r(q)-r(ee)*r(B))/(l(ee)*l(B)))}function je(q,ee,B,H,U,re,I){var de=he(q,B,H),W=K(de,ee,U);return ye(W,re,I)}Ne.getTimes=function(q,ee,B){var H=f*-B,U=f*ee,re=w(q),I=ce(re,H),de=K(0,H,I),W=me(de),Ce=z(W),be=D(Ce,0),Se=ye(de,W,Ce),pe,Ge,Je,_e,ke,$e={solarNoon:C(Se),nadir:C(Se+.5)};for(pe=0,Ge=Ze.length;pe<Ge;pe+=1)Je=Ze[pe],_e=je(Je[0]*f,H,U,be,I,W,Ce),ke=Se-(_e-Se),$e[Je[1]]=C(ke),$e[Je[2]]=C(_e);return $e};function G(q){var ee=f*(218.316+13.176396*q),B=f*(134.963+13.064993*q),H=f*(93.272+13.22935*q),U=ee+f*6.289*r(B),re=f*5.128*r(H),I=385001-20905*l(B);return{ra:R(U,re),dec:D(U,re),dist:I}}Ne.getMoonPosition=function(q,ee,B){var H=f*-B,U=f*ee,re=w(q),I=G(re),de=ie(re,H)-I.ra,W=J(de,U,I.dec),Ce=p(r(de),u(U)*l(I.dec)-r(I.dec)*l(de));return W=W+se(W),{azimuth:A(de,U,I.dec),altitude:W,distance:I.dist,parallacticAngle:Ce}},Ne.getMoonIllumination=function(q){var ee=w(q||new Date),B=Oe(ee),H=G(ee),U=149598e3,re=m(r(B.dec)*r(H.dec)+l(B.dec)*l(H.dec)*l(B.ra-H.ra)),I=p(U*r(re),H.dist-U*l(re)),de=p(l(B.dec)*r(B.ra-H.ra),r(B.dec)*l(H.dec)-l(B.dec)*r(H.dec)*l(B.ra-H.ra));return{fraction:(1+l(I))/2,phase:.5+.5*I*(de<0?-1:1)/Math.PI,angle:de}};function tt(q,ee){return new Date(q.valueOf()+ee*v/24)}Ne.getMoonTimes=function(q,ee,B,H){var U=new Date(q);H?U.setUTCHours(0,0,0,0):U.setHours(0,0,0,0);for(var re=.133*f,I=Ne.getMoonPosition(U,ee,B).altitude-re,de,W,Ce,be,Se,pe,Ge,Je,_e,ke,$e,Pe,bt,X=1;X<=24&&(de=Ne.getMoonPosition(tt(U,X),ee,B).altitude-re,W=Ne.getMoonPosition(tt(U,X+1),ee,B).altitude-re,Se=(I+W)/2-de,pe=(W-I)/2,Ge=-pe/(2*Se),Je=(Se*Ge+pe)*Ge+de,_e=pe*pe-4*Se*de,ke=0,_e>=0&&(bt=Math.sqrt(_e)/(Math.abs(Se)*2),$e=Ge-bt,Pe=Ge+bt,Math.abs($e)<=1&&ke++,Math.abs(Pe)<=1&&ke++,$e<-1&&($e=Pe)),ke===1?I<0?Ce=X+$e:be=X+$e:ke===2&&(Ce=X+(Je<0?Pe:$e),be=X+(Je<0?$e:Pe)),!(Ce&&be));X+=2)I=W;var ct={};return Ce&&(ct.rise=tt(U,Ce)),be&&(ct.set=tt(U,be)),!Ce&&!be&&(ct[Je>0?"alwaysUp":"alwaysDown"]=!0),ct},a.exports=Ne})()})(ET);var uO=ET.exports;const IT=Si(uO),dO='{"time":{"start":"00:00","end":"24:00","mode":"hours","interval":1},"period":{"days":1}}';class vi extends Xe{coordinates=null;constructor(s){super(s,vi.getStaticData())}static compile(s,i){var u;let r="",l=i.justCheck?kT:ST;if(l=l.replace('"__%%DEBUG_TRIGGER%%__"',`_sendToFrontEnd(${s._id}, {trigger: true})`),s.tagCard==="interval")r=`setInterval(${l}, ${s.interval||1} * ${s.unit==="s"?1e3:s.unit==="m"?6e4:36e5});`;else if(s.tagCard==="cron")r=`schedule("${s.cron}", ${l});`;else if(s.tagCard==="at"){const[d,p]=(s.at||"").split(":");let m="*";if((u=s==null?void 0:s.dow)!=null&&u.length&&!s.dow.includes("_")){const f=[...s.dow].map(k=>parseInt(k,10));f.sort();const v=[];let _=f[0],y=1;for(;y<f.length;y++)f[y]-f[y-1]>1?(_===f[y-1]?v.push(_.toString()):f[y-1]-_===1?v.push(`${_},${f[y-1]}`):v.push(`${_}-${f[y-1]}`),_=f[y]):y===f.length-1&&(_===f[y-1]||f[y]-_===1?v.push(`${_},${f[y]}`):v.push(`${_}-${f[y]}`));m=v.join(",")}r=`schedule("${p||"0"} ${d||"0"} * * ${m}", ${l});`}else s.tagCard==="astro"?r=`schedule({astro: "${s.astro}", shift: ${s.offset?s.offsetValue:0}}, ${l});`:s.tagCard==="wizard"&&(r=`schedule('${s.wizard}', ${l});`);return r}static _time2String(s){return s?`${s.getHours().toString().padStart(2,"0")}:${s.getMinutes().toString().padStart(2,"0")}`:"--:--"}async _setAstro(s,i,r){var m,f;if(s||=this.state.settings.astro||"solarNoon",i??=this.state.settings.offset,r??=this.state.settings.offsetValue,r=parseInt(r,10)||0,!this.coordinates){const v=await this.props.socket.getObject("system.adapter.javascript.0"),_=(m=v==null?void 0:v.native)==null?void 0:m.latitude,y=(f=v==null?void 0:v.native)==null?void 0:f.longitude;if(!_&&!y){const k=await this.props.socket.getObject("system.config");k!=null&&k.common&&(k.common.latitude||k.common.longitude)?this.coordinates={latitude:parseFloat(k.common.latitude),longitude:parseFloat(k.common.longitude)}:this.coordinates=null}else this.coordinates={latitude:parseFloat(_),longitude:parseFloat(y)}}const l=this.coordinates&&IT.getTimes(new Date,this.coordinates.latitude,this.coordinates.longitude),u=l?Object.keys(l).map(v=>({value:v,title:v,title2:`[${vi._time2String(l[v])}]`,order:l?vi._time2String(l[v]):"??:??"})):[];u.sort((v,_)=>v.order>_.order?1:v.order<_.order?-1:0);let d="--:--";if(s&&l&&l[s]){const v=new Date(l[s]);i&&v.setMinutes(v.getMinutes()+parseInt(r,10)),d=b.I18n.t("(at %s)",vi._time2String(v))}let p;i?p=[{frontText:"at",attr:"astro",nameRender:"renderSelect",options:u,defaultValue:"solarNoon",doNotTranslate2:!0},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{backText:r===1?"minute":"minutes",frontText:"offset",nameRender:"renderNumber",defaultValue:0,attr:"offsetValue",noHelperText:!0},{nameRender:"renderNameText",attr:"textTime",defaultValue:d,doNotTranslate:!0}]:p=[{frontText:"at",attr:"astro",nameRender:"renderSelect",options:u,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{nameRender:"renderNameText",attr:"textTime1",defaultValue:d,doNotTranslate:!0}],this.setState({inputs:p},()=>super.onTagChange())}_setInterval(s){s=parseInt(s||this.state.settings.interval,10)||30;let i;s===1?i=[{value:"s",title:"second"},{value:"m",title:"minute"},{value:"h",title:"hour"}]:i=[{value:"s",title:"seconds"},{value:"m",title:"minutes"},{value:"h",title:"hours"}],this.setState({inputs:[{nameRender:"renderNumber",attr:"interval",frontText:"every",defaultValue:30,className:"block-input-interval"},{nameRender:"renderSelect",attr:"unit",defaultValue:"s",options:i}]},()=>super.onTagChange())}renderDebug(s){return b.I18n.t("Triggered")}onValueChanged(s,i){this.state.settings.tagCard==="astro"?i==="astro"?this._setAstro(s):i==="offset"?this._setAstro(void 0,s):i==="offsetValue"&&this._setAstro(void 0,void 0,s):this.state.settings.tagCard==="interval"&&i==="interval"&&this._setInterval(s)}renderCron(s,i,r){const{className:l}=this.props;return g.jsxs("div",{children:[g.jsxs("div",{style:{display:"flex",alignItems:"baseline"},children:[g.jsx("div",{style:{width:"100%"},children:this.renderText({nameRender:"renderText",attr:"cron",defaultValue:i},this.state.settings.cron||i,r)}),g.jsx(Ur,{square:!0,style:{marginLeft:7},value:"...",className:l,onClick:()=>this.setState({openDialog:!0,textCron:this.state.settings.cron})})]}),this.state.openDialog?g.jsx(nm,{disabled:this.state.settings.cron===this.state.textCron,onApply:()=>{const u=this.state.textCron;r(u,"cron",()=>{r(b.convertCronToText(u,b.I18n.getLanguage()),"addText"),this.setState({openDialog:!1})})},onClose:()=>this.setState({openDialog:!1,textCron:""}),children:g.jsx(b.ComplexCron,{cronExpression:this.state.settings.cron,onChange:u=>this.setState({textCron:u}),language:b.I18n.getLanguage()})}):null,this.renderNameText({nameRender:"renderNameText",defaultValue:b.I18n.t("every hour at 0 minutes"),attr:"addText",signature:!0,doNotTranslate:!0},this.state.settings.addText||b.I18n.t("every hour at 0 minutes"))]},"cron")}renderWizard(s,i,r){const{className:l}=this.props;return g.jsxs("div",{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",marginTop:7},children:[g.jsx(bi,{className:l,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",multiline:!0,rows:2,value:this.state.settings.wizardText,onChange:u=>r(u),customValue:!0}),g.jsx(Ur,{square:!0,style:{marginLeft:7},value:"...",className:l,onClick:()=>this.setState({openDialog:!0,wizard:this.state.settings.wizard,wizardText:b.Schedule.state2text(this.state.settings.wizard)})})]}),this.state.openDialog?g.jsx(nm,{disabled:this.state.settings.wizard===this.state.wizard,onApply:()=>this.setState({openDialog:!1},()=>{const u=JSON.parse(this.state.wizard);u.valid||={from:b.Schedule.now2string()},u.valid.from||=b.Schedule.now2string(),r({wizardText:this.state.wizardText,wizard:JSON.stringify(u)})}),onClose:()=>this.setState({openDialog:!1}),children:g.jsx(b.Schedule,{theme:this.props.theme,schedule:i,onChange:(u,d)=>this.setState({wizardText:d||"",wizard:u})})}):null]},"wizard")}onTagChange(s){switch(s||=this.state.settings.tagCard,s){case"interval":this._setInterval();break;case"cron":this.setState({inputs:[{nameRender:"renderCron",attr:"cron",defaultValue:"0 * * * *"}]},()=>super.onTagChange());break;case"wizard":{const i=JSON.parse(dO);i.valid||={from:b.Schedule.now2string()},i.valid.from||=b.Schedule.now2string(),this.setState({inputs:[{nameRender:"renderWizard",attr:"wizard",defaultValue:JSON.stringify(i)}]},()=>super.onTagChange(null,()=>{const r=b.Schedule.state2text(this.state.settings.wizard||i);if(this.state.settings.wizard!==r){const l=JSON.parse(JSON.stringify(this.state.settings));l.wizardText=r,this.setState({settings:l}),this.props.onChange(l)}}));break}case"at":this.setState({inputs:[{nameRender:"renderTime",prefix:"at",attr:"at",defaultValue:"07:30"},{nameRender:"renderSelect",attr:"dow",default:"",multiple:!0,defaultValue:["_","1","2","3","4","5","6","0"],options:[{value:"_",title:"Every day",only:!0},{value:"1",title:"Monday",titleShort:"Mo"},{value:"2",title:"Tuesday",titleShort:"Tu"},{value:"3",title:"Wednesday",titleShort:"We"},{value:"4",title:"Thursday",titleShort:"Th"},{value:"5",title:"Friday",titleShort:"Fr"},{value:"6",title:"Saturday",titleShort:"Sa"},{value:"0",title:"Sunday",titleShort:"Su"}]}]},()=>super.onTagChange());break;case"astro":this._setAstro();break}}static getStaticData(){return{acceptedBy:"triggers",name:"Schedule",id:"TriggerScheduleBlock",icon:"AccessTime",tagCardArray:["cron","wizard","interval","at","astro"],title:"Triggers the rule periodically or on some specific time"}}getData(){return vi.getStaticData()}}const yn={valueAck:{color:"#b02323"},valueNotAck:{color:"#12ac15"}},xT=Y.forwardRef((a,s)=>g.jsx(Yk,{direction:"up",ref:s,...a}));xT.displayName="Transition";class Mc extends Xe{inputRef;constructor(s){super(s,Mc.getStaticData()),this.inputRef=Y.createRef()}static compile(s,i){let r=i.justCheck?kT:ST;return r=r.replace('"__%%DEBUG_TRIGGER%%__"',`_sendToFrontEnd(${s._id}, {val: obj.state.val, ack: obj.state.ack, valOld: obj.oldState && obj.oldState.val, ackOld: obj.oldState && obj.oldState.ack})`),`on({id: "${s.oid||""}", change: "${s.tagCard==="on update"?"any":"ne"}"}, ${r});`}renderDebug(s){return s.data.valOld!==void 0?g.jsxs("span",{children:[b.I18n.t("Triggered")," ",g.jsx("span",{style:s.data.ackOld?yn.valueAck:yn.valueNotAck,children:xn(s.data.valOld)})," ","→"," ",g.jsx("span",{style:s.data.ack?yn.valueAck:yn.valueNotAck,children:xn(s.data.val)})]}):g.jsxs("span",{children:[b.I18n.t("Triggered")," ",g.jsx("span",{style:s.data.ack?yn.valueAck:yn.valueNotAck,children:xn(s.data.val)})]})}onWriteValue(){this.setState({openSimulate:!1});let s=this.state.simulateValue;window.localStorage.setItem(`javascript.app.${this.state.settings.oid}_ack`,this.state.simulateAck?"true":"false"),this.state.settings.oidType==="boolean"?(s=s===!0||s==="true"||s==="1",window.localStorage.setItem(`javascript.app.${this.state.settings.oid}`,s?"true":"false")):this.state.settings.oidType==="number"?(s=parseFloat(s)||0,window.localStorage.setItem(`javascript.app.${this.state.settings.oid}`,s.toString())):window.localStorage.setItem(`javascript.app.${this.state.settings.oid}`,(s==null?void 0:s.toString())||""),this.props.socket.setState(this.state.settings.oid,{val:s,ack:!!this.state.simulateAck})}renderWriteState(){return[g.jsx(De,{disabled:!this.state.settings.oid||!this.state.enableSimulation,variant:"contained",color:"primary",onClick:()=>{this.setState({openSimulate:!0,simulateValue:this.state.settings.oidType==="boolean"?window.localStorage.getItem(`javascript.app.${this.state.settings.oid}`)==="true":window.localStorage.getItem(`javascript.app.${this.state.settings.oid}`)||"",simulateAck:window.localStorage.getItem(`javascript.app.${this.state.settings.oid}_ack`)==="true"}),setTimeout(()=>{var s;return(s=this.inputRef.current)==null?void 0:s.focus()},200)},children:b.I18n.t("Simulate")},"buttonWrite"),g.jsxs(Vt,{open:!!this.state.openSimulate,TransitionComponent:xT,keepMounted:!0,onClose:()=>this.setState({openSimulate:!1}),"aria-labelledby":"simulate-dialog-slide-title","aria-describedby":"simulate-dialog-slide-description",children:[g.jsx(as,{id:"simulate-dialog-slide-title",children:b.I18n.t("Trigger with value")}),g.jsxs(Gt,{children:[this.state.settings.oidType==="boolean"?g.jsx(Ag,{control:g.jsx(Rw,{inputRef:this.inputRef,onKeyUp:s=>s.key==="Enter"&&this.onWriteValue(),value:!!this.state.simulateValue,onChange:s=>this.setState({simulateValue:s.target.checked})}),label:b.I18n.t("Value")}):g.jsx(vo,{variant:"standard",inputRef:this.inputRef,label:b.I18n.t("Value"),fullWidth:!0,onKeyUp:s=>s.key==="Enter"&&this.onWriteValue(),value:!this.state.simulateValue&&this.state.simulateValue!==0?"":this.state.simulateValue,onChange:s=>this.setState({simulateValue:s.target.value})}),g.jsx("br",{}),g.jsx(Ag,{control:g.jsx(bc,{checked:!!this.state.simulateAck,onChange:s=>this.setState({simulateAck:s.target.checked}),color:"primary"}),label:b.I18n.t("Ack")})]}),g.jsxs(Kt,{children:[g.jsxs(De,{variant:"contained",onClick:()=>this.onWriteValue(),color:"primary",children:[g.jsx(_S,{}),b.I18n.t("Write")]}),g.jsxs(De,{color:"grey",variant:"contained",onClick:()=>this.setState({openSimulate:!1}),children:[g.jsx(Wc,{}),b.I18n.t("Close")]})]})]},"dialogWrite")]}onTagChange(s){this.setState({inputs:[{nameRender:"renderObjectID",attr:"oid",defaultValue:""},{nameRender:"renderWriteState"}]},()=>{super.onTagChange()})}static getStaticData(){return{acceptedBy:"triggers",name:"State",id:"TriggerState",icon:"FlashOn",tagCardArray:["on change","on update"],title:"Triggers the rule on update or change of some state"}}getData(){return Mc.getStaticData()}}const hO=""+new URL("hysteresis-CLhhemcG.png",import.meta.url).href,bw=`function __hysteresis(val, limit, state, hist, comp) {
1175
+ let cond1, cond2;
1176
+ if (comp === '>') {
1177
+ cond1 = val > limit + hist;
1178
+ cond2 = val <= limit - hist;
1179
+ } else if (comp === '<') {
1180
+ cond1 = val < limit - hist;
1181
+ cond2 = val >= limit + hist;
1182
+ } else if (comp === '>=') {
1183
+ cond1 = val >= limit + hist;
1184
+ cond2 = val < limit - hist;
1185
+ } else if (comp === '<=') {
1186
+ cond1 = val <= limit - hist;
1187
+ cond2 = val > limit + hist;
1188
+ } else if (comp === '=') {
1189
+ cond1 = val <= limit + hist && val > limit - hist;
1190
+ cond2 = val > limit + hist || val <= limit - hist;
1191
+ } else if (comp === '<>') {
1192
+ cond1 = val > limit + hist || val <= limit - hist;
1193
+ cond2 = val <= limit + hist && val > limit - hist;
1194
+ }
1195
+
1196
+ if (!state && cond1) {
1197
+ return true;
1198
+ } else if (state && cond2) {
1199
+ return false;
1200
+ } else {
1201
+ return state;
1202
+ }
1203
+ }`;class Hr extends Xe{constructor(s){super(s,Hr.getStaticData())}isAllTriggersOnState(){var s,i,r,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(u=>u.id==="TriggerState"))&&!((l=(r=this.props.userRules)==null?void 0:r.triggers)!=null&&l.find(u=>u.id!=="TriggerState"))}static compile(s,i){var d,p;let r=s.value;r==null&&(r=!1);let l,u;if(s.tagCard==="()")i.prelines||=[],i.prelines.find(m=>m!==bw)||i.prelines.push(bw),s.useTrigger?(l="obj.state.val",r===""&&(r=0),u=`__hysteresis(subCondVar${s._id}, ${r}, __%%STATE%%__, ${s.hist}, "${s.histComp}")`):(l=`(await getStateAsync("${s.oid}")).val`,r===""&&(r=0),typeof r=="string"&&parseFloat(r.trim()).toString()!==r.trim()&&(r=`"${r}"`),u=`__hysteresis(subCondVar${s._id}, ${r}, __%%STATE%%__, ${s.hist}, "${s.histComp}")`);else if(s.tagCard!=="includes"){const m=s.tagCard==="="?"==":s.tagCard==="<>"?"!=":s.tagCard;s.useTrigger?(l="obj.state.val",((d=i==null?void 0:i.trigger)==null?void 0:d.oidType)==="string"?(r=r.replace(/"/g,'\\"'),u=`subCondVar${s._id} ${m} "${r}"`):(r===""&&(r=0),typeof r=="string"&&parseFloat(r.trim()).toString()!==r.trim()&&(r=`"${r}"`),u=`subCondVar${s._id} ${m} ${r}`)):(l=`(await getStateAsync("${s.oid}")).val`,s.oidType==="string"?(r=r.replace(/"/g,'\\"'),u=`subCondVar${s._id} ${m} "${r}"`):(r===""&&(r=0),typeof r=="string"&&parseFloat(r.trim()).toString()!==r.trim()&&(r=`"${r}"`),u=`subCondVar${s._id} ${m} ${r}`))}else s.useTrigger?(l="obj.state.val",((p=i==null?void 0:i.trigger)==null?void 0:p.oidType)==="string"?(r=r.replace(/"/g,'\\"'),u=`obj.state.val.includes("${r}")`):u="false"):(l=`(await getStateAsync("${s.oid}")).val`,s.oidType==="string"?(r=r.replace(/"/g,'\\"'),u=`subCondVar${s._id}.includes("${r}")`):u="false");return i.conditionsStates.push({name:`subCondVar${s._id}`,id:s.oid}),i.conditionsVars.push(`const subCondVar${s._id} = ${l};`),i.conditionsVars.push(`const subCond${s._id} = ${u};`),i.conditionsDebug.push(`_sendToFrontEnd(${s._id}, {result: subCond${s._id}, value: subCondVar${s._id}, compareWith: "${r}"});`),`subCond${s._id}`}renderDebug(s){const i=this.state.settings.tagCard;return i!=="()"?`${s.data.result.toString().toUpperCase()} [${s.data.value} ${i} ${s.data.compareWith}]`:b.I18n.t("Triggered")}onShowHelp=()=>this.setState({showHysteresisHelp:!0});_setInputs(s,i,r,l,u){var w,E;const d=this.isAllTriggersOnState();i=i||this.state.settings.tagCard,r=r||this.state.settings.oidType,l=l||this.state.settings.oidUnit,u=u||this.state.settings.oidStates,s===void 0&&(s=this.state.settings.useTrigger),d&&s&&((E=(w=this.props.userRules)==null?void 0:w.triggers)==null?void 0:E.length)===1&&(r=this.props.userRules.triggers[0].oidType,l=this.props.userRules.triggers[0].oidUnit,u=this.props.userRules.triggers[0].oidStates);const p=Hr.getStaticData().tagCardArray,m=p.find(R=>R.title===i)||p[0];let f,v=null;r==="number"?(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"},{title:"()",title2:"[hysteresis]",text:"hysteresis"}],u&&(v=Object.keys(u).map(R=>u?{value:R,title:u[R]}:null).filter(R=>R))):r==="boolean"?(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:"<>",title2:"[not equal]",text:"not equal to"}],v=[{title:"false",value:!1},{title:"true",value:!0}]):(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"},{title:".",title2:"[includes]",text:"includes"}],u&&(v=Object.keys(u).map(R=>({value:R,title:u?u[R]:R.toString()}))));let _=null;f.find(R=>R.title===i)||(i=f[0].title,_=_||{...this.state.settings},_.tagCard=i);let y,k={nameRender:"renderText",defaultValue:"",attr:"value",frontText:i==="()"?"Limit":(m==null?void 0:m.text)||"compare with",doNotTranslateBack:!0,backText:l};v&&(k={nameRender:"renderSelect",defaultValue:v[0].value,options:v,attr:"value",frontText:(m==null?void 0:m.text)||"compare with",doNotTranslateBack:!0,backText:l},v.find(R=>R.value===this.state.settings.value)||(_=_||{...this.state.settings},_.value=v[0].value),v.length<=2&&(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:"<>",title2:"[not equal]",text:"not equal to"}])),d&&s?y=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1},k]:d?y=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"},{nameRender:"renderObjectID",attr:"oid",defaultValue:""},k]:y=[{nameRender:"renderObjectID",attr:"oid",defaultValue:""},k],i==="()"&&(y.splice(1,0,{nameRender:"renderDialog",icon:"HelpOutline",frontText:"Explanation",onShowDialog:this.onShowHelp}),y.splice(2,0,{nameRender:"renderSelect",attr:"histComp",defaultValue:">",frontText:"Condition",doNotTranslate:!0,options:[{title:">",value:">"},{title:">=",value:">="},{title:"<",value:"<"},{title:"<=",value:"<="},{title:"=",value:"="},{title:"<>",value:"<>"}]}),y.push({frontText:"Δ",doNotTranslate:!0,nameRender:"renderNumber",noHelperText:!0,attr:"hist",defaultValue:1,doNotTranslateBack:!0,backText:l}));const C={iconTag:!0,tagCardArray:f,inputs:y};this.setState(C,()=>super.onTagChange(null,()=>{_&&(this.setState({settings:_}),this.props.onChange(_))}))}onValueChanged(s,i){typeof s=="object"?this._setInputs(s.useTrigger,s.tagCard,s.oidType,s.states):i==="useTrigger"?this._setInputs(s):i==="oidType"?this._setInputs(void 0,void 0,s):i==="oidUnit"?this._setInputs(void 0,void 0,void 0,s):i==="oidStates"&&this._setInputs(void 0,void 0,void 0,void 0,s)}onUpdate(){this._setInputs(this.state.settings.useTrigger)}onTagChange(s){this._setInputs(this.state.settings.useTrigger,s)}static getStaticData(){return{acceptedBy:"conditions",name:"State condition",id:"ConditionState",icon:"Shuffle",tagCardArray:[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"},{title:".",title2:"[includes]",text:"includes"},{title:"()",title2:"[hysteresis]",text:"hysteresis"}],title:"Compares the state value with user defined value"}}getData(){return Hr.getStaticData()}renderSpecific(){return this.state.showHysteresisHelp?g.jsxs(Vt,{open:!0,maxWidth:"md",onClose:()=>this.setState({showHysteresisHelp:!1}),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[g.jsx(Gt,{children:g.jsx(Iw,{id:"alert-dialog-description",children:g.jsx("img",{src:hO,alt:"Hysteresis"})})}),g.jsx(Kt,{children:g.jsx(De,{onClick:()=>this.setState({showHysteresisHelp:!1}),color:"primary",autoFocus:!0,children:b.I18n.t("OK")})})]}):null}}const vw=[31,29,31,30,31,30,31,31,30,31,30,31];class Wr extends Xe{constructor(s){super(s,Wr.getStaticData())}static compile(s,i){const r=s.tagCard==="="?"===":s.tagCard==="<>"?"!==":s.tagCard;let l;if(s.withDate){const[u,d]=(s.date||"01.01").toString().split(".");let p=parseInt(d,10)||0,m=parseInt(u,10)||0;m>12?m=12:m<0&&(m=0),p>vw[m]?p=vw[m]:p<0&&(p=0),p&&m?l=`formatDate(Date.now(), 'MM.DD-hh:mm') ${r} "${s.date}-${s.time}"`:p===0&&m?l=`formatDate(Date.now(), 'MM-hh:mm') ${r} "${m.toString().padStart(2,"0")}-${s.time}"`:m===0&&p?l=`formatDate(Date.now(), 'DD-hh:mm') ${r} "${p.toString().padStart(2,"0")}-${s.time}"`:l=`formatDate(Date.now(), 'hh:mm') ${r} "${s.time}"`}else l=`formatDate(Date.now(), 'hh:mm') ${r} "${s.time}"`;return i.conditionsVars.push(`const subCond${s._id} = ${l};`),i.conditionsDebug.push(`_sendToFrontEnd(${s._id}, {result: subCond${s._id}});`),`subCond${s._id}`}_setInputs(s,i){i=i===void 0?this.state.settings.withDate:i,s=s||this.state.settings.tagCard;const r=Wr.getStaticData().tagCardArray,l=r==null?void 0:r.find(d=>d.title===s),u=[{nameRender:"renderNameText",attr:"interval",defaultValue:"Actual time of day"},{frontText:(l==null?void 0:l.text)||s,nameRender:"renderTime",attr:"time",defaultValue:"12:00"},{frontText:"with date",nameRender:"renderCheckbox",attr:"withDate",defaultValue:!1}];i&&u.push({nameRender:"renderDate",attr:"date",defaultValue:"01.01"}),this.setState({inputs:u,iconTag:!0},()=>super.onTagChange())}onValueChanged(s,i){i==="withDate"&&this._setInputs(void 0,s)}onTagChange(s){this._setInputs(s)}static getStaticData(){return{acceptedBy:"conditions",name:"Time condition",id:"ConditionTime",icon:"Shuffle",tagCardArray:[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"}],title:"Compares current time with the user specific time"}}getData(){return Wr.getStaticData()}}class Po extends Xe{coordinates=null;constructor(s){super(s,Po.getStaticData())}static compile(s,i){const r=s.tagCard==="="?"===":s.tagCard==="<>"?"!==":s.tagCard;let l;s.offset&&(l=parseInt(s.offsetValue,10)||0);const u=`formatDate(Date.now(), 'hh:mm') ${r} formatDate(getAstroDate("${s.astro}"${l?`, undefined, ${l}`:""}), 'hh:mm')`;return i.conditionsVars.push(`const subCond${s._id} = ${u};`),i.conditionsDebug.push(`_sendToFrontEnd(${s._id}, {result: ${u}});`),u}static _time2String(s){return s?`${s.getHours().toString().padStart(2,"0")}:${s.getMinutes().toString().padStart(2,"0")}`:"--:--"}onValueChanged(s,i){i==="astro"?this._setAstro(s):i==="offset"?this._setAstro(void 0,s):i==="offsetValue"&&this._setAstro(void 0,void 0,s)}async _setAstro(s,i,r){if(s=s||this.state.settings.astro||"solarNoon",i=i===void 0?this.state.settings.offset:i,r=r===void 0?this.state.settings.offsetValue:r,r=parseInt(r,10)||0,!this.coordinates){const v=await this.props.socket.getObject("system.adapter.javascript.0");if(!(v!=null&&v.native.latitude)&&!(v!=null&&v.native.longitude)){const _=await this.props.socket.getObject("system.config");_&&(_.common.latitude||_.common.longitude)?this.coordinates={latitude:_.common.latitude,longitude:_.common.longitude}:this.coordinates=null}else this.coordinates={latitude:v==null?void 0:v.native.latitude,longitude:v==null?void 0:v.native.longitude}}const l=this.coordinates?IT.getTimes(new Date,this.coordinates.latitude,this.coordinates.longitude):null,u=l?Object.keys(l).map(v=>({value:v,title:v,title2:`[${Po._time2String(l[v])}]`,order:Po._time2String(l[v])})):[];u.sort((v,_)=>v.order>_.order?1:v.order<_.order?-1:0);const d=Po.getStaticData().tagCardArray,p=d.find(v=>v.title===this.state.settings.tagCard)||d[0];let m="--:--";if(s&&l&&l[s]){const v=new Date(l[s]);i&&v.setMinutes(v.getMinutes()+parseInt(r,10)),m=`(${b.I18n.t(p.text)} ${Po._time2String(v)})`}let f;i?f=[{nameRender:"renderNameText",defaultValue:"Actual time of day",attr:"text"},{frontText:p.text,attr:"astro",nameRender:"renderSelect",options:u,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{backText:r===1?"minute":"minutes",frontText:"offset",nameRender:"renderNumber",defaultValue:0,attr:"offsetValue",noHelperText:!0},{nameRender:"renderNameText",attr:"textTime",doNotTranslate:!0,defaultValue:m}]:f=[{nameRender:"renderNameText",defaultValue:"Actual time of day",attr:"text"},{frontText:p.text,attr:"astro",nameRender:"renderSelect",options:u,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{nameRender:"renderNameText",attr:"textTime",doNotTranslate:!0,defaultValue:m}],this.setState({inputs:f},()=>super.onTagChange())}onTagChange(){this._setAstro()}static getStaticData(){return{acceptedBy:"conditions",name:"Astronomical",id:"ConditionAstronomical",icon:"Brightness3",tagCardArray:[{title:"=",title2:"[equal]",text:"equal to"},{title:">=",title2:"[greater or equal]",text:"greater or equal to"},{title:">",title2:"[greater]",text:"greater than"},{title:"<=",title2:"[less or equal]",text:"less or equal to"},{title:"<",title2:"[less]",text:"less than"},{title:"<>",title2:"[not equal]",text:"not equal to"}],title:"Compares current time with astronomical event"}}getData(){return Po.getStaticData()}}const yw={valueAck:{color:"#b02323"},valueNotAck:{color:"#12ac15"}};class Nc extends Xe{constructor(s){super(s,Nc.getStaticData())}isAllTriggersOnState(){var s,i,r,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(u=>u.id==="TriggerState"))&&!((l=(r=this.props.userRules)==null?void 0:r.triggers)!=null&&l.find(u=>u.id!=="TriggerState"))}static compile(s,i){let r=s.value;s.useTrigger?r=s.toggle?"!obj.state.val":"obj.state.val":(r==null&&(r=""),typeof s.value=="string"&&parseFloat(s.value).toString()!==s.value&&s.value!=="true"&&s.value!=="false"&&(r=`"${r.replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)}`));let l;return s.toggle&&!s.useTrigger?l=`const subActionVar${s._id} = !(await getStateAsync("${s.oid}")).val`:l=`const subActionVar${s._id} = ${r}`,`// set state ${s.oid} to ${s.toggle&&!s.useTrigger?"toggle":r}
1204
+ ${l};
1205
+ _sendToFrontEnd(${s._id}, {val: subActionVar${s._id}, ack: ${s.tagCard==="update"}});
1206
+ await setStateAsync("${s.oid}", subActionVar${s._id}, ${s.tagCard==="update"});`}renderDebug(s){return g.jsxs("span",{children:[b.I18n.t("Set:")," ",g.jsx("span",{style:s.data.ack?yw.valueAck:yw.valueNotAck,children:xn(s.data.val)})]})}_setInputs(s,i){const r=this.isAllTriggersOnState();i=i===void 0?this.state.settings.toggle:i,s=s===void 0?this.state.settings.useTrigger:s;let l="",u;const{oidType:d,oidUnit:p,oidStates:m,oidMax:f,oidMin:v,oidRole:_,oidWrite:y,oidStep:k}=this.state.settings;let C;d&&(d==="number"?(l="number",f!==void 0&&v!==void 0&&(l="slider")):d==="boolean"?(l="boolean",_&&_.includes("button")&&y&&(l="button")):(l="",_&&_.includes("color")&&(l="color")),m&&(u=Object.keys(m).map(E=>({value:E,title:m[E]})),l="select"));let w;if(r&&s)w=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1}],l==="boolean"&&w.push({backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1});else{switch(l){case"number":w=[{backText:p||"",frontText:"with",nameRender:"renderNumber",defaultValue:f===void 0?0:f,attr:"value"}],this.state.settings.value!==void 0&&isNaN(parseFloat(this.state.settings.value))&&(C={value:f===void 0?0:f});break;case"slider":{w=[{nameRender:"renderSlider",defaultValue:f,min:v,max:f,unit:p,step:k,attr:"value"}];const E=parseFloat(this.state.settings.value);this.state.settings.value!==void 0&&(isNaN(E)||E<v||E>f)&&(C={value:f});break}case"select":w=[{nameRender:"renderSelect",frontText:"with",options:u,defaultValue:(u==null?void 0:u[0].value)||"",attr:"value"}],this.state.settings.value!==void 0&&!(u!=null&&u.find(E=>E.value===this.state.settings.value))&&(C={value:(u==null?void 0:u[0].value)||""});break;case"boolean":w=[{backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1}],i||w.push({backText:"true",frontText:"false",nameRender:"renderSwitch",defaultValue:!1,attr:"value"}),this.state.settings.value!==void 0&&this.state.settings.value!==!1&&this.state.settings.value!==!0&&(C={value:!1});break;case"button":w=[{nameRender:"renderButton",defaultValue:!0,attr:"value"}],this.state.settings.value!==void 0&&this.state.settings.value!==!0&&(C={value:!0});break;case"color":w=[{nameRender:"renderColor",frontText:"with",defaultValue:"#FFFFFF",attr:"value"}],this.state.settings.value!==void 0&&(typeof this.state.settings.value!="string"||!this.state.settings.value.startsWith("#")&&!this.state.settings.value.startsWith("rgb"))&&(C={value:"#FFFFFF"});break;default:w=[{backText:p||"",frontText:"with",nameRender:"renderText",defaultValue:"",attr:"value"}];break}r&&w.unshift({backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"})}return{inputs:w,newSettings:C}}onTagChange(s,i,r,l,u){u=u===void 0?this.state.settings.useTrigger:u;const{inputs:d,newSettings:p}=this._setInputs(u,l);d.unshift({nameRender:"renderObjectID",attr:"oid",defaultValue:"",checkReadOnly:!0}),this.setState({inputs:d},()=>super.onTagChange(null,()=>{if(p){const m=JSON.parse(JSON.stringify(this.state.settings));Object.assign(m,p),this.setState(m),this.props.onChange(m)}}))}onValueChanged(s,i){this.onTagChange(void 0,void 0,void 0,i==="toggle"?s:void 0,i==="useTrigger"?s:void 0)}onUpdate(){this.onTagChange()}static getStaticData(){return{acceptedBy:"actions",name:"Set state action",id:"ActionSetState",icon:"PlayForWork",tagCardArray:["control","update"],title:"Control or update some state",helpDialog:"You can use %s in the value to use the current trigger value or %id to display the triggered object ID"}}getData(){return Nc.getStaticData()}}class Lc extends Xe{constructor(s){super(s,Lc.getStaticData())}static compile(s,i){return`// exec "${s.exec}"
1207
+ const subActionVar${s._id} = "${(s.exec||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1208
+ _sendToFrontEnd(${s._id}, {exec: subActionVar${s._id}});
1209
+ console.log(subActionVar${s._id});`}renderDebug(s){return`Exec: ${s.data.exec}`}onTagChange(s){this.setState({inputs:[{nameRender:"renderModalInput",attr:"exec",defaultValue:"ls /opt/iobroker",nameBlock:"Shell command"}]},()=>super.onTagChange(s))}static getStaticData(){return{acceptedBy:"actions",name:"Exec",id:"ActionExec",icon:"Apps",title:"Executes some shell command",helpDialog:"You can use %s in the command to use current trigger value or %id to use the triggered object ID"}}getData(){return Lc.getStaticData()}}class Pc extends Xe{constructor(s){super(s,Pc.getStaticData())}static compile(s,i){return`// HTTP request ${s.url}
1210
+ const subActionVar${s._id} = "${(s.url||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1211
+ _sendToFrontEnd(${s._id}, {url: subActionVar${s._id}});
1212
+ request(subActionVar${s._id});`}renderDebug(s){return`URL: ${s.data.url}`}onTagChange(s){this.setState({inputs:[{nameRender:"renderModalInput",attr:"url",defaultValue:"http://mydevice.com?...",nameBlock:"URL"}]},()=>super.onTagChange(s))}static getStaticData(){return{acceptedBy:"actions",name:"HTTP Call",id:"ActionHTTPCall",icon:"Language",title:"Make a HTTP get request",helpDialog:"You can use %s in the URL to use current trigger value or %id to use the triggered object ID"}}getData(){return Pc.getStaticData()}}class Bc extends Xe{constructor(s){super(s,Bc.getStaticData())}static compile(s,i){return`// Log ${s.text}
1213
+ const subActionVar${s._id} = "${(s.text||"").replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)};
1214
+ _sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
1215
+ console.log(subActionVar${s._id});`}renderDebug(s){return b.I18n.t("Log: %s",s.data.text)}onTagChange(){this.setState({inputs:[{nameRender:"renderModalInput",attr:"text",defaultValue:"My device triggered",nameBlock:"Log text"}]},()=>super.onTagChange())}static getStaticData(){return{acceptedBy:"actions",name:"Log text",id:"ActionPrintText",icon:"Subject",title:"Print some text in log",helpDialog:"You can use %s in the text to display current trigger value or %id to display the triggered object ID"}}getData(){return Bc.getStaticData()}}class jc extends Xe{constructor(s){super(s,jc.getStaticData())}static compile(s){const i=s.unit==="ms"?1:s.unit==="s"?1e3:s.unit==="m"?6e4:36e5;return`// pause for ${i}ms
1216
+ _sendToFrontEnd(${s._id}, {paused: true});
1217
+
1218
+ await wait(${s.pause} * ${i});
1219
+
1220
+ _sendToFrontEnd(${s._id}, {paused: false});`}renderDebug(s){return b.I18n.t("Paused: %s",s.data.paused)}_getOptions(s){return s=s===void 0?this.state.settings.pause:s,s===1||s==="1"?[{value:"ms",title:"millisecond"},{value:"s",title:"second"},{value:"m",title:"minute"},{value:"h",title:"hour"}]:[{value:"ms",title:"milliseconds"},{value:"s",title:"seconds"},{value:"m",title:"minutes"},{value:"h",title:"hours"}]}_setInputs(s){this.setState({inputs:[{nameRender:"renderNumber",attr:"pause",defaultValue:100,noHelperText:!0},{nameRender:"renderSelect",attr:"unit",defaultValue:"ms",options:this._getOptions(s)}]},()=>super.onTagChange())}onValueChanged(s,i){i==="pause"&&this._setInputs(s)}onTagChange(){this._setInputs()}static getStaticData(){return{acceptedBy:"actions",name:"Pause",id:"ActionPause",icon:"Pause",title:"Make a pause between actions"}}getData(){return jc.getStaticData()}}class Fc extends Xe{constructor(s){super(s,Fc.getStaticData())}static compile(s){const i=(s.func||"").split(`
1221
+ `).map(r=>` ${r}`);return i.unshift(` _sendToFrontEnd(${s._id}, {func: 'executed'});`),i.unshift("// user function"),i.join(`
1222
+ `)}renderDebug(){return b.I18n.t("Function: executed")}onTagChange(s){this.setState({inputs:[{nameRender:"renderModalInput",attr:"func",noTextEdit:!0,defaultValue:'console.log("Test")',nameBlock:"Function"}]},()=>super.onTagChange(s))}static getStaticData(){return{acceptedBy:"actions",name:"User function",id:"ActionFunction",icon:"Functions",title:"Write your own code",helpDialog:"This is advances option. You can write your own code here and it will be executed on trigger"}}getData(){return Fc.getStaticData()}}class zc extends Xe{constructor(s){super(s,zc.getStaticData())}isAllTriggersOnState(){var s,i,r,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(u=>u.id==="TriggerState"))&&!((l=(r=this.props.userRules)==null?void 0:r.triggers)!=null&&l.find(u=>u.id!=="TriggerState"))}static compile(s,i){let r=s.value;s.useTrigger?r=s.toggle?"!obj.state.val":"obj.state.val":(r==null&&(r=""),typeof s.value=="string"&&parseFloat(s.value).toString()!==s.value&&s.value!=="true"&&s.value!=="false"&&(r=`"${r.replace(/"/g,'\\"')}"${Xe.getReplacesInText(i)}`));let l;return s.toggle&&!s.useTrigger?l=`const subActionVar${s._id} = !(await getStateAsync("${s.oid}")).val`:l=`const subActionVar${s._id} = ${r}`,`// set delayed state ${s.oid} to ${s.toggle&&!s.useTrigger?"toggle":r} with delay of ${s.delay}ms
1223
+ ${l};
1224
+ _sendToFrontEnd(${s._id}, {val: subActionVar${s._id}, ack: ${s.tagCard==="update"}});
1225
+ setStateDelayed("${s.oid}", subActionVar${s._id}, ${s.tagCard==="update"}, ${parseInt(s.delay,10)}, ${s.clearRunning?"true":"false"});`}renderDebug(s){var i,r;return g.jsxs("span",{children:[b.I18n.t("Set:")," ",g.jsx("span",{className:s.data.ack?(i=this.props.classes)==null?void 0:i.valueAck:(r=this.props.classes)==null?void 0:r.valueNotAck,children:xn(s.data.val)})]})}_setInputs(s,i){const r=this.isAllTriggersOnState();i=i===void 0?this.state.settings.toggle:i,s=s===void 0?this.state.settings.useTrigger:s;let l="",u;const{oidType:d,oidUnit:p,oidStates:m,oidMax:f,oidMin:v,oidRole:_,oidWrite:y,oidStep:k}=this.state.settings;let C;d&&(d==="number"?(l="number",f!==void 0&&v!==void 0&&(l="slider")):d==="boolean"?(l="boolean",_&&_.includes("button")&&y&&(l="button")):(l="",_&&_.includes("color")&&(l="color")),m&&(u=Object.keys(m).map(E=>({value:E,title:m[E]})),l="select"));let w;if(r&&s)w=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1}],l==="boolean"&&w.push({backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1});else{switch(l){case"number":w=[{backText:p||"",frontText:"with",nameRender:"renderNumber",defaultValue:f===void 0?0:f,attr:"value"}],this.state.settings.value!==void 0&&isNaN(parseFloat(this.state.settings.value))&&(C={value:f===void 0?0:f});break;case"slider":{w=[{nameRender:"renderSlider",defaultValue:f,min:v,max:f,unit:p,step:k,attr:"value"}];const E=parseFloat(this.state.settings.value);this.state.settings.value!==void 0&&(isNaN(E)||E<v||E>f)&&(C={value:f});break}case"select":w=[{nameRender:"renderSelect",frontText:"with",options:u,defaultValue:(u==null?void 0:u[0].value)||"",attr:"value"}],this.state.settings.value!==void 0&&!(u!=null&&u.find(E=>E.value===this.state.settings.value))&&(C={value:(u==null?void 0:u[0].value)||""});break;case"boolean":w=[{backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1}],i||w.push({backText:"true",frontText:"false",nameRender:"renderSwitch",defaultValue:!1,attr:"value"}),this.state.settings.value!==void 0&&this.state.settings.value!==!1&&this.state.settings.value!==!0&&(C={value:!1});break;case"button":w=[{nameRender:"renderButton",defaultValue:!0,attr:"value"}],this.state.settings.value!==void 0&&this.state.settings.value!==!0&&(C={value:!0});break;case"color":w=[{nameRender:"renderColor",frontText:"with",defaultValue:"#FFFFFF",attr:"value"}],this.state.settings.value!==void 0&&(typeof this.state.settings.value!="string"||!this.state.settings.value.startsWith("#")&&!this.state.settings.value.startsWith("rgb"))&&(C={value:"#FFFFFF"});break;default:w=[{backText:p||"",frontText:"with",nameRender:"renderText",defaultValue:"",attr:"value"}];break}r&&w.unshift({backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"})}return w.push({backText:"ms",frontText:"Delay",nameRender:"renderNumber",defaultValue:1e3,noHelperText:!0,attr:"delay"}),w.push({backText:"clear running",nameRender:"renderCheckbox",defaultValue:!0,attr:"clearRunning"}),{inputs:w,newSettings:C}}onTagChange(s,i,r,l,u){u=u===void 0?this.state.settings.useTrigger:u;const{inputs:d,newSettings:p}=this._setInputs(u,l);d.unshift({nameRender:"renderObjectID",attr:"oid",defaultValue:"",checkReadOnly:!0}),this.setState({inputs:d},()=>super.onTagChange(null,()=>{if(p){const m=JSON.parse(JSON.stringify(this.state.settings));Object.assign(m,p),this.setState(m),this.props.onChange(m)}}))}onValueChanged(s,i){this.onTagChange(void 0,void 0,void 0,i==="toggle"?s:void 0,i==="useTrigger"?s:void 0)}onUpdate(){this.onTagChange()}static getStaticData(){return{acceptedBy:"actions",name:"Set with delay",id:"ActionSetStateDelayed",icon:"PlayForWork",tagCardArray:["control","update"],title:"Control or update some state with delay",helpDialog:"You can use %s in the value to use the current trigger value or %id to display the triggered object ID"}}getData(){return zc.getStaticData()}}class Uc extends Xe{constructor(s){super(s,Uc.getStaticData())}isAllTriggersOnState(){var s,i,r,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(u=>u.id==="TriggerState"))&&!((l=(r=this.props.userRules)==null?void 0:r.triggers)!=null&&l.find(u=>u.id!=="TriggerState"))}static compile(s){const i=`const val2_${s._id} = (await getStateAsync("${s.oid1}")).val;`,r=`const val1_${s._id} = (await getStateAsync("${s.oid2}")).val;`;return`// ${s.oid1} ${s.operation} ${s.oid2} => ${s.oidResult}
1226
+ ${i}
1227
+ ${r}
1228
+ _sendToFrontEnd(${s._id}, {val: val1_${s._id} ${s.operation} val2_${s._id}, ack: ${s.tagCard==="update"}});
1229
+ await setStateAsync("${s.oidResult}", val1_${s._id} ${s.operation} val2_${s._id}, ${s.tagCard==="update"});`}renderDebug(s){var i,r;return g.jsxs("span",{children:[b.I18n.t("Set:")," ",g.jsx("span",{className:s.data.ack?(i=this.props.classes)==null?void 0:i.valueAck:(r=this.props.classes)==null?void 0:r.valueNotAck,children:xn(s.data.val)})]})}onTagChange(){const s=[];s.push({nameRender:"renderObjectID",title:"ID1",attr:"oid1",defaultValue:"",checkReadOnly:!1}),s.push({nameRender:"renderSelect",options:[{value:"+",title:"+"},{value:"-",title:"-"},{value:"*",title:"*"},{value:"/",title:"/"}],doNotTranslate:!0,defaultValue:"+",attr:"operation"}),s.push({nameRender:"renderObjectID",title:"ID2",attr:"oid2",defaultValue:"",checkReadOnly:!1}),s.push({nameRender:"renderNameText",defaultValue:"store in",attr:"textEqual"}),s.push({nameRender:"renderObjectID",attr:"oidResult",defaultValue:"",checkReadOnly:!0}),this.setState({inputs:s},()=>super.onTagChange(null,()=>{const i=JSON.parse(JSON.stringify(this.state.settings));this.props.onChange(i)}))}onValueChanged(s,i){this.onTagChange()}onUpdate(){this.onTagChange()}static getStaticData(){return{acceptedBy:"actions",name:"Operate two states",id:"ActionOperateStates",icon:"AddBox",tagCardArray:["control","update"],title:"Operations with two states"}}getData(){return Uc.getStaticData()}}const pO=[vi,Oc,Mc,Hr,Wr,Po,Nc,Lc,Pc,Bc,jc,Fc,zc,Uc],cc={sayit:xc,pushover:Dc,"whatsapp-cmb":Ac,pushsafer:Rc},gO=rm({blocks:null,socket:null,onUpdate:!1,setOnUpdate:a=>{},setOnDebugMessage:a=>{},onDebugMessage:[],enableSimulation:!1,setEnableSimulation:a=>{},changedScripts:{},setChangedScripts:a=>{}}),mO=({children:a,socket:s})=>{const[i,r]=vt(null),[l,u]=vt(!1),[d,p]=vt([]),[m,f]=vt(!1),[v,_]=vt({});return Mt(()=>{l&&u(!1)},[l]),Mt(()=>{(async()=>{const y=await s.getAdapterInstances(),k=Object.keys(cc).filter(D=>y.find(A=>{var J;return((J=A==null?void 0:A.common)==null?void 0:J.name)===D})),C=[],w=y.filter(D=>D.common.javascriptRules),E=[];for(const D of w){if(E.includes(D.common.name)||!D.common.javascriptRules)continue;let A;if(D.common.javascriptRules.url.startsWith("http:")||D.common.javascriptRules.url.startsWith("https:")?A=D.common.javascriptRules.url:D.common.javascriptRules.url.startsWith("./")?A=`${window.location.protocol}//${window.location.host}${D.common.javascriptRules.url.replace(/^\./,"")}`:A=`${window.location.protocol}//${window.location.host}/adapter/${D.common.name}/${D.common.javascriptRules.url}`,D.common.javascriptRules.i18n===!0){const J=A.lastIndexOf("/");let ie;J!==-1?ie=A.substring(0,J):ie=A;const se=b.I18n.getLanguage(),me=`${ie}/i18n/${se}.json`;await fetch(me).then(z=>z.json()).then(z=>b.I18n.extendTranslations(z,se)).catch(z=>{if(se!=="en")return fetch(`${ie}/i18n/en.json`).then(Oe=>Oe.json()).then(Oe=>b.I18n.extendTranslations(Oe,se)).catch(Oe=>console.error(`Cannot load i18n "${me}": ${Oe}`));console.log(`Cannot load i18n "${me}": ${z}`)})}else if(D.common.javascriptRules.i18n&&typeof D.common.javascriptRules.i18n=="object")try{b.I18n.extendTranslations(D.common.javascriptRules.i18n)}catch(J){console.error(`Cannot import i18n for "${D.common.javascriptRules.name}": ${J}`)}try{Xy.registerRemotes([{name:D.common.javascriptRules.name,entry:A,type:D.common.javascriptRules.type}]);const J=(await Xy.loadRemote(`${D.common.javascriptRules.name}/${D.common.javascriptRules.name}`)).default;J&&(C.push(J),E.push(D.common.name),cc[D.common.name]=null)}catch(J){console.error(`Cannot load component "${D.common.javascriptRules.name}": ${J}`)}}const R=k.filter(D=>cc[D]).map(D=>cc[D]);r([...pO,...R,...C])})()},[]),g.jsx(gO.Provider,{value:{blocks:i,socket:s,onUpdate:l,setOnUpdate:u,onDebugMessage:d,setOnDebugMessage:p,enableSimulation:m,setEnableSimulation:f,changedScripts:v,setChangedScripts:_},children:a})},fO="Acknowledged",$O="Actions",bO="Add",vO="All",yO="Any",_O="Apply",wO="April",CO="Ask",TO="Astronomical",kO="August",SO="Cancel",EO="Close",IO="Condition",xO="Conditions",DO="Console",AO="Copied",RO="December",OO="Default",MO="Delay",NO="Delete",LO="Description",PO="Done",BO="Exec shell",jO="Explanation",FO="Export",zO="Februar",UO="February",HO="Filter",WO="Folder",VO="Fr",GO="Friday",KO="ID",YO="ID1",JO="ID2",qO="Import",XO="Instance",ZO="Instances",QO="Instructions",eM="Januar",tM="January",sM="July",oM="June",iM="Limit",nM="March",rM="May",aM="Menu",lM="Message",cM="Mo",uM="Model",dM="Monday",hM="Month",pM="More",gM="Name",mM="November",fM="OK",$M="October",bM="Ok",vM="Pause",yM="Pushover",_M="Pushsafer",wM="Rename",CM="Repeat",TM="Restart",kM="Result",SM="Sa",EM="Saturday",IM="Save",xM="Schedule",DM="Script",AM="September",RM="Simulate",OM="Stack",MM="Start",NM="State",LM="Su",PM="Sunday",BM="Telegram",jM="Th",FM="Thursday",zM="Time",UM="Triggered",HM="Triggers",WM="Tu",VM="Tuesday",GM="URL",KM="Value",YM="Volume",JM="We",qM="Wednesday",XM="Write",ZM="Yes",QM="acknowledgment",eN="all",tN="and",sN="Astro",oN="at",iN="control",nN="copy",rN="CRON",aN="Dawn",lN="This is a special mode in which states and objects will not change. But only information about each planned change will be displayed in the protocol.",cN="Debug",uN="Dusk",dN="easy",hN="every",pN="Function",gN="ID",mN="Name",fN="Role",$N="Room",bN="Golden hour",vN="End of golden hour",yN='The code will be executed only every time when condition is true. E.g. if triggering on the temperature sensor value and the condition is "if temperature is greater than 20°C", the "then" actions will be executed every time when sensor sends the temperature and it is over 20°C. By 21°C, by 22°C and so on.',_N='The code will be executed only if the condition result changes. E.g. if triggering on the temperature sensor value and the condition is "if temperature is greater than 20°C", the "then" actions will be executed once when temperature is over 20. Next time the "then" actions will be executed when the temperature fails under 20 and then rises over 20 again.',wN="hours",CN="includes",TN="interval",kN="magic",SN="milliseconds",EN="minutes",IN="ms",xN="Nadir",DN="Nautical dawn",AN="Nautical dusk",RN="Next Sunrise",ON="Next sunset",MN="Night",NN="Night end",LN="normal",PN="offset",BN="one",jN="or",FN="quiet",zN="search",UN="seconds",HN="Solar noon",WN="sunrise",VN="Sunrise end",GN="Sunset",KN="Sunset start",YN="then",JN="Acknowledge",qN="From",XN="Last changed",ZN="Quality",QN="Timestamp",eL="User",tL="Value",sL="two",oL="update",iL="Adds debug output to the log for many system commands",nL="Verbose log outputs",rL="when",aL="Wizard",lL="Retry",cL={"%s not found":"%s not found","()":"()","(at %s)":"(at %s)","(optional)":"(optional)","-":"-",".":".","AI code generator":"AI code generator",Ack:fO,Actions:$O,"Actual time of day":"Actual time of day",Add:bO,"Add new script":"Add new script",All:vO,"All files will be accepted":"All files will be accepted",Any:yO,"Any month":"Any month",Apply:_O,April:wO,"Are you sure?":"Are you sure?",Ask:CO,Astronomical:TO,"Astronomical events today":"Astronomical events today",August:kO,"Blockly description":"Creating rules by graphic blocks","Body:":"Body:",Cancel:SO,"Cannot delete non empty item!":"Cannot delete non empty item!","Change layout":"Change layout",'Change theme (actual "%s")':'Change theme (now - "%s")',"Check blocks":"Check blocks","Check is not active, because javascript adapter is disabled":"Check is not active, because Javascript adapter is disabled","Clear search input":"Clear search input","Click on this icon":"Click on this icon",Close:EO,"Close all but current":"Close all but current","Collapse all":"Collapse all","Compares current time with astronomical event":"Compares current time with astronomical event","Compares current time with the user specific time":"Compares current time with the user specific time","Compares the state value with user defined value":"Compares the state value with user defined value",Condition:IO,Conditions:xO,"Configuration not saved.":"Configuration not saved.",Console:DO,"Control or update some state":"Control or update some state","Control or update some state with delay":"Control or update some state with delay","Convert blockly to javascript for ever.":"Permanently convert Blockly to Javascript.",Copied:AO,"Copy script":"Copy script","Copy to clipboard":"Copy to clipboard","Create new":"Create new","Create new folder":"Create new folder","Create new script":"Create new script","Create or edit CRON or time wizard":"Create or edit CRON or time wizard","Dark Theme":"Dark theme","Dark style":"Dark style",Date:"Date","Debug instance":"Debug instance","Debug options":"Debug options",December:RO,Default:OO,"Define cron...":"Define cron...","Define schedule...":"Define schedule...",Delay:MO,Delete:NO,"Delete %s":"Delete %s...","Delete folder":"Delete folder","Delete script":"Delete script",Description:LO,"Deselect all":"Deselect all","Discard changes for %s":"Discard changes for %s",Done:PO,"Double click to write value":"Double click to write value","Download as file":"Download as file","Drop some files here or click...":"Drop some files here or click...","Duplicate name":"Duplicate name","Edit script or just double click":"Edit script or just double click","Empty name is not allowed":"Empty name is not allowed","End search mode":"End search mode","Enter your question":"Enter your request",Error:"Error","Error formatting code":"Error formatting code","Error was found":"Error was found","Every day":"Every day",Exec:BO,"Executes some shell command":"Executes some shell command","Existing scripts will be overwritten.":"Existing scripts will be overwritten.","Expand all":"Expand all","Expert mode":"Expert mode",Explanation:jO,Export:FO,"Export all scripts":"Export all scripts","Export blocks":"Export blocks","Export selected blocks":"Export selected blocks",Februar:zO,February:UO,Filter:HO,Folder:WO,Fr:VO,Friday:GO,Function:"Function","Function editor":"Function editor","Function: executed":"Function: executed","Go to next line":"Go to next line","HTTP Call":"HTTP Call","Hide logs":"Hide logs",ID:KO,ID1:YO,ID2:JO,Import:qO,"Import blocks":"Import blocks","Import error":"Import error","Import scripts":"Import scripts","Insert object ID":"Insert object ID",Instance:XO,"Instance is disabled":"Instance is disabled","Instance:":"Instance:",Instances:ZO,Instructions:QO,"Invalid CRON":"Invalid CRON","It will not be possible to revert this operation.":"It will not be possible to revert this operation.","JS description":"Creating rules by writing Javascript",Januar:eM,January:tM,July:sM,June:oM,"Just check":"Just check","Language:":"Language:","Learn More":"Learn More","Light style":"Light style",Limit:iM,"Local time":"Local time","Locate file":"Locate file","Log outputs":"Log outputs","Log text":"Log text","Log: %s":"Log: %s","Make a HTTP get request":"Make a HTTP get request","Make a pause between actions":"Make a pause between actions",March:nM,"March ":"March ",May:rM,Menu:aM,Message:lM,Mo:cM,Model:uM,Monday:dM,Month:hM,More:pM,Name:gM,"No API key found":"No API key found","No Chat GPT Key found":"No Chat GPT Key found","No active host found":"No active host found","Nothing found":"Nothing found",November:mM,OK:fM,October:$M,Ok:bM,"On condition change":"On condition result change","On script save or adapter start":"On script save or adapter start","On weekdays":"On weekdays","Open configuration":"Open configuration","Operate two states":"Operate two states","Operations with two states":"Operations with two states","Paste your blocks here":"Paste your blocks here",Pause:vM,"Pause execution":"Pause execution","Pause script":"Pause script","Phone:":"Phone:","Please select object ID...":"Please select object ID...","Press Ctrl+Enter to get the answer":"Press Ctrl+Enter to get the answer","Prettify the script":"Prettify the script","Print some text in log":"Print some text in log","Priority:":"Priority:",Pushover:yM,Pushsafer:_M,"Read only ID selected: %s":"Read only ID selected: %s",Rename:wM,"Reorder scripts in folders":"Reorder scripts in folders",Repeat:CM,Restart:TM,Result:kM,"Resume execution":"Resume execution","Root folder":"Root folder","Rules description":"Create rules with IF, THEN, ELSE blocks","Run script":"Run script",Sa:SM,Saturday:EM,Save:IM,"Save all":"Save all","Say It":"Say It","Say some text via sayit adapter":"Say some text via sayit adapter",Schedule:xM,Script:DM,"Script %s was modified on disk":"Script %s was modified on disk","Script is not running":"Script is not running","Search in scripts":"Search in scripts","Search...":"Search...","Select all":"Select all","Send email":"Send email","Sends an email":"Sends an email","Sends message via Pushsafer":"Sends message via Pushsafer","Sends message via pushover":"Sends message via pushover","Sends message via telegram":"Sends message via telegram","Sends message via whatsapp-cmb":"Sends message via whatsapp-cmb",September:AM,"Server time":"Server time","Set state action":"Set state action","Set with delay":"Set with delay","Shell command":"Shell command","Show astronomical events":"Show astronomical events","Show javascript code":"Show Javascript code","Show logs":"Show logs","Show only paused scripts":"Show only paused scripts","Show only running scripts":"Show only running scripts","Show only scripts with problems":"Show only scripts with problems",Simulate:RM,"Some files will be rejected":"Some files will be rejected","Sound:":"Sound:",Stack:OM,Start:MM,"Start script":"Start script",State:NM,"State condition":"State condition","Step into function":"Step into function","Step out from function":"Step out from function","Stop on exception":"Stop on exception",Su:LM,"Subject:":"Subject:",Sunday:PM,"TS description":"Creating rules by writing Typescript",Telegram:BM,"Text:":"Text:",Th:jM,"The script will be stopped and must be activated manually after debugging. Continue?":"The script will be stopped and must be activated manually after debugging. Continue?","This is advances option. You can write your own code here and it will be executed on trigger":"This is advances option. You can write your own code here and it will be executed on trigger",Thursday:FM,Time:zM,"Time condition":"Time condition","Title:":"Title:","To:":"To:","Trigger with value":"Trigger with value",Triggered:UM,Triggers:HM,"Triggers the on script saving or the javascript instance restart":"Triggers the on script saving or the javascript instance restart","Triggers the rule on update or change of some state":"Triggers the rule on update or change of some state","Triggers the rule periodically or on some specific time":"Triggers the rule periodically or on some specific time",Tu:WM,Tuesday:VM,URL:GM,"Unknown error":"Unknown error","Unknown error!":"Unknown error!","Use generated code":"Use generated code","User function":"User function","User:":"User:",Value:KM,"Vibration:":"Vibration:",Volume:YM,We:JM,Wednesday:qM,"Whatsapp-cmb":"Whatsapp-cmb",Write:XM,"Write your own code":"Write your own code",Yes:ZM,"Yet exists!":"Yet exists!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"You can use %s in the URL to use current trigger value, %id to use the triggered object ID, %name to show triggered object ID name or %old to use old trigger value","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"You can use %s in the command to use current trigger value, %id to use the triggered object ID, %name to show triggered object ID name or %old to use old trigger value","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"You can use %s in the text to display current trigger value, %id to use the triggered object ID, %name to show triggered object ID name or %old to use old trigger value","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"You can use %s in the value to use the current trigger value, %id to use the triggered object ID, %name to show triggered object ID name or %old to use old trigger value","You have to enter OpenAI API key in the configuration of javascript adapter.":"You have to enter OpenAI API key in the configuration of javascript adapter.","You have to enter at least one API key in the configuration of javascript adapter.":"You have to enter at least one API key (OpenAI, Anthropic or Gemini) in the configuration of javascript adapter.","Please select a valid model":"Please select a valid model","[equal]":"[equal]","[greater or equal]":"[greater or equal]","[greater]":"[greater]","[hysteresis]":"[hysteresis]","[includes]":"[includes]","[less or equal]":"[less or equal]","[less]":"[less]","[not equal]":"[not equal]",acknowledgment:QM,all:eN,and:tN,astro:sN,at:oN,"clear running":"clear running",control:iN,copy:nN,cron:rN,dawn:aN,debug_help:lN,debug_label:cN,default:"default",dusk:uN,easy:dN,else:"else","equal to":"equal to",every:hN,"every hour at 0 minutes":"every hour at 0 minutes",false:"false","file reading has failed: %s":"file reading has failed: %s","file reading was aborted":"file reading was aborted",filter_func:pN,filter_id:gN,filter_name:mN,filter_role:fN,filter_room:$N,"for edit or create script":"for edit or create a new script","for professionals":"for professionals","for programmers":"for programmers",goldenHour:bN,goldenHourEnd:vN,"greater or equal":"greater or equal","greater or equal to":"greater or equal to","greater than":"greater than",help_just_check:yN,help_on_change:_N,"high priority":"high priority","high-priority":"high-priority","highest priority":"highest priority",hours:wN,includes:CN,interval:TN,"just check":"just check","less or equal":"less or equal","less or equal to":"less or equal to","less than":"less than","lower priority":"lower priority","lowest priority":"lowest priority",magic:kN,milliseconds:SN,minutes:EN,ms:IN,nadir:xN,nauticalDawn:DN,nauticalDusk:AN,nextSunrise:RN,nextSunset:ON,night:MN,nightEnd:NN,"no blocks found":"No blocks found","no group":"NO GROUP",normal:LN,"normal priority":"normal priority","not equal to":"not equal to","not properly connected":"This block is not properly connected to other blocks.",offset:PN,"on change":"on change","on condition change":"on condition change","on update":"on update",one:BN,or:jN,quiet:FN,"reset search":"reset search",search:zN,seconds:UN,solarNoon:HN,"store in":"store in",sunrise:WN,sunriseEnd:VN,sunset:GN,sunsetStart:KN,then:YN,"toggle value":"toggle value",tooltip_ack:JN,tooltip_from:qN,tooltip_lc:XN,tooltip_quality:ZN,tooltip_ts:QN,tooltip_user:eL,tooltip_value:tL,true:"true",two:sL,undefined:"undefined",update:oL,"use seconds":"use seconds","use trigger value":"use trigger value",verbose_help:iL,verbose_label:nL,when:rL,with:"with","with date":"with date","with offset":"with offset",wizard:aL,"Loading models...":"Loading models...","Could not connect to API at %s":"Could not connect to API at %s","Invalid API key":"Invalid API key","Access denied by API":"Access denied by API","API error: %s":"API error: %s",'Model "%s" not found':'Model "%s" not found',"Request failed: %s":"Request failed: %s",Retry:lL,"No running javascript instance found":"No running javascript instance found"},uL="Bestätigt",dL="Aktionen",hL="Hinzufügen",pL="Alle",gL="Egal",mL="Anwenden",fL="April",$L="Fragen",bL="Astronomisch",vL="August",yL="Abbrechen",_L="Schließen",wL="Bedingung",CL="Bedingungen",TL="Konsole",kL="Kopiert",SL="Dezember",EL="Standard",IL="Verzögerung",xL="Löschen",DL="Beschreibung",AL="Fertig",RL="Exec shell",OL="Erläuterung",ML="Export",NL="Februar",LL="Februar",PL="Filter",BL="Ordner",jL="Fr",FL="Freitag",zL="ID",UL="ID1",HL="ID2",WL="Import",VL="Instanz",GL="Instanzen",KL="Anleitung",YL="Januar",JL="Januar",qL="Juli",XL="Juni",ZL="Grenze",QL="März",e1="Mai",t1="Menü",s1="Nachricht",o1="Mo",i1="Modell",n1="Montag",r1="Monat",a1="Mehr",l1="Name",c1="November",u1="OK",d1="Oktober",h1="Ok",p1="Pause",g1="Pushover",m1="Pushsafer",f1="Umbenennen",$1="Wiederholen",b1="Neustart",v1="Ergebnis",y1="Sa",_1="Samstag",w1="Speichern",C1="Zeitplan",T1="Skript",k1="September",S1="Simulieren",E1="Stack",I1="Start",x1="Zustand",D1="So",A1="Sonntag",R1="Telegram",O1="Do",M1="Donnerstag",N1="Zeit",L1="Ausgelöst",P1="Löst aus",B1="Di",j1="Dienstag",F1="URL",z1="Wert",U1="Volumen",H1="Mi",W1="Mittwoch",V1="Schreiben",G1="Ja",K1="Wissen",Y1="alle",J1="und",q1="Astro",X1="um",Z1="Steuerung",Q1="Kopie",eP="CRON",tP="Morgendämmerung",sP="Dies ist ein spezieller Modus, in dem sich Zustände und Objekte nicht ändern. Im Protokoll werden jedoch nur Informationen zu jeder geplanten Änderung angezeigt.",oP="Debuggen",iP="Abenddämmerung",nP="einfach",rP="jeder",aP="Funktion",lP="ID",cP="Name",uP="Rolle",dP="Raum",hP="Goldene Abendstunde",pP="Vormittag",gP='Der Code wird jedes Mal ausgeführt, wenn die Bedingung erfüllt ist. z.B. wenn der Temperatur wert sich ändert und die Bedingung "Wenn die Temperatur größer als 20°C ist" lautet, werden die "Dann" -Aktionen jedes Mal ausgeführt, wenn der Sensor die Temperatur sendet und diese über 20°C liegt. Bei 21°C, bei 22°C und so weiter.',mP='Der Code wird nur ausgeführt, wenn sich das Ergebnis der Bedingung ändert. z.B. wenn sich der Temperatur wert ändert und die Bedingung "Wenn die Temperatur größer als 20°C ist" lautet, werden die "Dann" -Aktionen einmal ausgeführt, wenn die Temperatur über 20°C liegt. Das nächste Mal werden die "Dann" -Aktionen ausgeführt, wenn die Temperatur unter 20°C gefallen ist und dann wieder über 20°C ansteigt.',fP="Stunden",$P="beinhaltet",bP="Intervall",vP="Magie",yP="Millisekunden",_P="Minuten",wP="ms",CP="Nadir",TP="nautische Morgendämmerung",kP="nautische Abenddämmerung",SP="Nächster Sonnenaufgang",EP="Nächster Sonnenuntergang",IP="Nacht",xP="astronomische Morgendämmerung",DP="Normal",AP="Versatz",RP="einer",OP="oder",MP="ruhig",NP="Suche",LP="Sekunden",PP="(Nach-)Mittag",BP="Sonnenaufgang",jP="Goldene Morgenstunde",FP="Sonnenuntergang",zP="Sonnenuntergang (Anfang)",UP="dann",HP="Bestätigen",WP="Von",VP="Zuletzt geändert",GP="Qualität",KP="Zeitstempel",YP="Benutzer",JP="Wert",qP="zwei",XP="Aktualisieren",ZP="Fügt Debug-Ausgaben für viele Systembefehle zum Protokoll hinzu",QP="Ausführliche Protokollausgaben",eB="falls",tB="Assistent",sB="Erneut versuchen",oB={"%s not found":"%s nicht gefunden","()":"()","(at %s)":"(um %s)","(optional)":"(optional)","-":"-",".":".","AI code generator":"KI-Codegenerator",Ack:uL,Actions:dL,"Actual time of day":"Tatsächliche Tageszeit",Add:hL,"Add new script":"Neues Skript hinzufügen",All:pL,"All files will be accepted":"Alle Dateien werden akzeptiert",Any:gL,"Any month":"Jeden Monat",Apply:mL,April:fL,"Are you sure?":"Wirklich sicher?",Ask:$L,Astronomical:bL,"Astronomical events today":"Astronomische Ereignisse heute",August:vL,"Blockly description":"Erstellen von Regeln durch Grafikblöcke","Body:":"Körper:",Cancel:yL,"Cannot delete non empty item!":"Kann nicht gelöscht werden, weil noch einige Elementen darin sind!","Change layout":"Layout ändern",'Change theme (actual "%s")':'Thema ändern (jetzt - "%s")',"Check blocks":"Blöcke prüfen","Check is not active, because javascript adapter is disabled":"Syntax-Check ist nicht aktiv, weil der Javascript Adapter nicht aktiv ist.","Clear search input":"Sucheingabe löschen","Click on this icon":"Auf dieses Symbol klicken",Close:_L,"Close all but current":"Alle anderen außer dem Aktiven schließen","Collapse all":"Alles einklappen","Compares current time with astronomical event":"Vergleicht die aktuelle Zeit mit einem astronomischen Ereignis","Compares current time with the user specific time":"Vergleicht die aktuelle Zeit mit der benutzerspezifischen Zeit","Compares the state value with user defined value":"Vergleicht den Zustandswert mit dem benutzerdefinierten Wert",Condition:wL,Conditions:CL,"Configuration not saved.":"Die Konfiguration ist nicht gespeichert.",Console:TL,"Control or update some state":"Zustand steuern oder aktualisieren","Control or update some state with delay":"Zustand mit Verzögerung steuern oder aktualisieren","Convert blockly to javascript for ever.":"Blockly dauerhaft in Javascript konvertieren.",Copied:kL,"Copy script":"Skript kopieren","Copy to clipboard":"In die Zwischenablage kopieren","Create new":"Neu erstellen","Create new folder":"Neuen Ordner erstellen","Create new script":"Neues Skript erstellen","Create or edit CRON or time wizard":"CRON- oder Zeit-Assistenten erstellen oder bearbeiten","Dark Theme":"Dunkles Thema","Dark style":"Dunkler Stil",Date:"Datum","Debug instance":"Debug-Instanz","Debug options":"Debug-Optionen",December:SL,Default:EL,"Define cron...":"Cron definieren ...","Define schedule...":"Zeitplan definieren ...",Delay:IL,Delete:xL,"Delete %s":"Löschen %s...","Delete folder":"Ordner löschen","Delete script":"Skript löschen",Description:DL,"Deselect all":"Alles abwählen","Discard changes for %s":"Änderungen für %s verwerfen",Done:AL,"Double click to write value":"Doppelklick zum Schreiben des Wertes","Download as file":"Download als Datei","Drop some files here or click...":"Dateien hier ablegen oder klicken ...","Duplicate name":"Doppelter Name","Edit script or just double click":"Skript bearbeiten oder einfach doppelklicken","Empty name is not allowed":"Leerer Name ist nicht zulässig","End search mode":"Suchmodus beenden","Enter your question":"Anfrage eingeben",Error:"Fehler","Error formatting code":"Fehler beim Formatieren des Codes","Error was found":"Fehler wurde gefunden","Every day":"Täglich",Exec:RL,"Executes some shell command":"Führt einen Shell-Befehl aus","Existing scripts will be overwritten.":"Vorhandene Skripte werden überschrieben.","Expand all":"Alle erweitern","Expert mode":"Expertenmodus",Explanation:OL,Export:ML,"Export all scripts":"Alle Skripte exportieren","Export blocks":"Blöcke exportieren","Export selected blocks":"Ausgewählte Blöcke exportieren",Februar:NL,February:LL,Filter:PL,Folder:BL,Fr:jL,Friday:FL,Function:"Funktion","Function editor":"Funktions-Editor","Function: executed":"Funktion: ausgeführt","Go to next line":"Gehe zur nächsten Zeile","HTTP Call":"HTTP-Aufruf","Hide logs":"Protokoll ausblenden",ID:zL,ID1:UL,ID2:HL,Import:WL,"Import blocks":"Blöcke importieren","Import error":"Fehler beim Importieren","Import scripts":"Skripte importieren","Insert object ID":"Objekt-ID einfügen",Instance:VL,"Instance is disabled":"Instanz ist deaktiviert","Instance:":"Instanz:",Instances:GL,Instructions:KL,"Invalid CRON":"Ungültiger CRON","It will not be possible to revert this operation.":"Dieser Vorgang kann nicht rückgängig gemacht werden.","JS description":"Regeln erstellen mit JavaScript",Januar:YL,January:JL,July:qL,June:XL,"Just check":"Einfach überprüfen","Language:":"Sprache:","Learn More":"Mehr erfahren","Light style":"Heller Stil",Limit:ZL,"Local time":"Lokale Zeit","Locate file":"Datei zeigen","Log outputs":"Protokoll","Log text":"Protokolltext","Log: %s":"Log: %s","Make a HTTP get request":"Eine HTTP-Abrufanforderung stellen","Make a pause between actions":"Eine Pause zwischen den Aktionen machen",March:QL,"March ":"März ",May:e1,Menu:t1,Message:s1,Mo:o1,Model:i1,Monday:n1,Month:r1,More:a1,Name:l1,"No API key found":"Kein API-Schlüssel gefunden","No Chat GPT Key found":"Kein Chat-GPT-Schlüssel gefunden","No active host found":"Kein aktiver Host gefunden","Nothing found":"Nichts gefunden",November:c1,OK:u1,October:d1,Ok:h1,"On condition change":"Bei Änderung des Ergebnis der Bedingung","On script save or adapter start":"Beim Speichern des Skripts oder beim Starten des Adapters","On weekdays":"An Wochentagen","Open configuration":"Konfiguration öffnen","Operate two states":"Zwei Zustände operieren","Operations with two states":"Operationen mit zwei Zuständen","Paste your blocks here":"Fügen Sie Ihre Blöcke hier ein",Pause:p1,"Pause execution":"Ausführung pausieren","Pause script":"Skript anhalten","Phone:":"Telefon:","Please select object ID...":"Objekt-ID auswählen ...","Press Ctrl+Enter to get the answer":"Strg+Eingabetaste, um die Antwort zu erhalten","Prettify the script":"Verschönern Sie das Skript","Print some text in log":"Einen Text im Protokoll ausdrucken","Priority:":"Priorität:",Pushover:g1,Pushsafer:m1,"Read only ID selected: %s":"Schreibgeschützte ID ausgewählt: %s",Rename:f1,"Reorder scripts in folders":"Skripte in Ordnern neu ordnen",Repeat:$1,Restart:b1,Result:v1,"Resume execution":"Ausführung fortsetzen","Root folder":"Root-Verzeichnis","Rules description":"Regeln erstellen mit WENN-, DANN- und SONST-Blöcken","Run script":"Skript ausführen",Sa:y1,Saturday:_1,Save:w1,"Save all":"Alle speichern","Say It":"Say It","Say some text via sayit adapter":"Einen Text über den Sayit-Adapter sagen",Schedule:C1,Script:T1,"Script %s was modified on disk":'Skript "%s" wurde auf der Festplatte geändert',"Script is not running":"Skript läuft nicht","Search in scripts":"Suche in Skripten","Search...":"Suche...","Select all":"Alles auswählen","Send email":"E-Mail senden","Sends an email":"Sendet eine E-Mail","Sends message via Pushsafer":"Sendet eine Nachricht über Pushsafer","Sends message via pushover":"Sendet eine Nachricht per Pushover","Sends message via telegram":"Sendet eine Nachricht per telegram","Sends message via whatsapp-cmb":"Sendet eine Nachricht über WhatsApp-Cmb",September:k1,"Server time":"Server-Zeit","Set state action":"Zustand setzten","Set with delay":"Setzen mit Verzögerung","Shell command":"Shell-Befehl","Show astronomical events":"Astronomische Ereignisse anzeigen","Show javascript code":"Javascript-Code zeigen","Show logs":"Protokoll anzeigen","Show only paused scripts":"Nur angehaltene Skripte zeigen","Show only running scripts":"Nur laufende Skripte zeigen","Show only scripts with problems":"Nur Skripte mit Problemen zeigen",Simulate:S1,"Some files will be rejected":"Einige Dateien werden abgelehnt","Sound:":"Klang:",Stack:E1,Start:I1,"Start script":"Skript starten",State:x1,"State condition":"Zustandsbedingung","Step into function":"Schritt in die Funktion","Step out from function":"Raus aus der Funktion","Stop on exception":"Bei Ausnahme anhalten",Su:D1,"Subject:":"Gegenstand:",Sunday:A1,"TS description":"Regeln erstellen mit TypeScript",Telegram:R1,"Text:":"Text:",Th:O1,"The script will be stopped and must be activated manually after debugging. Continue?":"Das Skript wird gestoppt und muss nach dem Debuggen manuell aktiviert werden. Fortsetzen?","This is advances option. You can write your own code here and it will be executed on trigger":"Dies ist eine erweiterte Option. Sie können hier Ihren eigenen Code schreiben, der beim Auslösen ausgeführt wird",Thursday:M1,Time:N1,"Time condition":"Zeitbedingung","Title:":"Titel:","To:":"Zu:","Trigger with value":"Trigger mit Wert",Triggered:L1,Triggers:P1,"Triggers the on script saving or the javascript instance restart":"Löst das Speichern des Skripts oder den Neustart der Javascript-Instanz aus","Triggers the rule on update or change of some state":"Löst die Regel beim Aktualisieren oder Ändern eines Zustands aus","Triggers the rule periodically or on some specific time":"Löst periodisch oder zu einem bestimmten Zeitpunkt aus",Tu:B1,Tuesday:j1,URL:F1,"Unknown error":"Unbekannter Fehler","Unknown error!":"Unbekannter Fehler!","Use generated code":"Code verwenden","User function":"Benutzerfunktion","User:":"Benutzer:",Value:z1,"Vibration:":"Vibration:",Volume:U1,We:H1,Wednesday:W1,"Whatsapp-cmb":"WhatsApp-cmb",Write:V1,"Write your own code":"Eigenen Code schreiben",Yes:G1,"Yet exists!":"Existiert schon!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Sie können %s in der URL verwenden, um den aktuellen Triggerwert zu verwenden, %id, um die ausgelöste Objekt-ID zu verwenden, %name, um den ID-Namen des ausgelösten Objekts anzuzeigen, oder %old, um den alten Triggerwert zu verwenden","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Sie können %s im Befehl verwenden, um den aktuellen Triggerwert zu verwenden, %id, um die ausgelöste Objekt-ID zu verwenden, %name, um den ID-Namen des ausgelösten Objekts anzuzeigen, oder %old, um den alten Triggerwert zu verwenden","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Sie können %s im Text verwenden, um den aktuellen Triggerwert anzuzeigen, %id, um die ausgelöste Objekt-ID zu verwenden, %name, um den ID-Namen des ausgelösten Objekts anzuzeigen, oder %old, um den alten Triggerwert zu verwenden","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Sie können %s im Wert verwenden, um den aktuellen Triggerwert zu verwenden, %id, um die ID des ausgelösten Objekts zu verwenden, %name, um den ID-Namen des ausgelösten Objekts anzuzeigen, oder %old, um den alten Triggerwert zu verwenden","You have to enter OpenAI API key in the configuration of javascript adapter.":"Sie müssen den OpenAI-API-Schlüssel in der Konfiguration des Javascript-Adapters eingeben.","You have to enter at least one API key in the configuration of javascript adapter.":"Sie müssen mindestens einen API-Schlüssel (OpenAI, Anthropic oder Gemini) in der Konfiguration des Javascript-Adapters eingeben.","Please select a valid model":"Bitte wählen Sie ein gültiges Modell aus","[equal]":"[gleich]","[greater or equal]":"[größer oder gleich]","[greater]":"[größer]","[hysteresis]":"[Hysterese]","[includes]":"[enthält]","[less or equal]":"[kleiner oder gleich]","[less]":"[kleiner]","[not equal]":"[ungleich]",acknowledgment:K1,all:Y1,and:J1,astro:q1,at:X1,"clear running":"laufende abbrechen",control:Z1,copy:Q1,cron:eP,dawn:tP,debug_help:sP,debug_label:oP,default:"Standard",dusk:iP,easy:nP,else:"sonst","equal to":"gleich",every:rP,"every hour at 0 minutes":"jede Stunde bei 0 Minuten",false:"falsch","file reading has failed: %s":"Das Lesen der Datei ist fehlgeschlagen: %s","file reading was aborted":"Das Lesen der Datei wurde abgebrochen",filter_func:aP,filter_id:lP,filter_name:cP,filter_role:uP,filter_room:dP,"for edit or create script":"zum Bearbeiten oder zum Erstellen eines neues Skripts","for professionals":"für Profis","for programmers":"für Programmierer",goldenHour:hP,goldenHourEnd:pP,"greater or equal":"größer oder gleich","greater or equal to":"größer oder gleich","greater than":"größer als",help_just_check:gP,help_on_change:mP,"high priority":"hohe Priorität","high-priority":"hohe Priorität","highest priority":"höchste Priorität",hours:fP,includes:$P,interval:bP,"just check":"einfach prüfen","less or equal":"kleiner oder gleich","less or equal to":"kleiner oder gleich","less than":"kleiner als","lower priority":"geringere Priorität","lowest priority":"niedrigste Priorität",magic:vP,milliseconds:yP,minutes:_P,ms:wP,nadir:CP,nauticalDawn:TP,nauticalDusk:kP,nextSunrise:SP,nextSunset:EP,night:IP,nightEnd:xP,"no blocks found":"Keine Blöcke gefunden","no group":"KEINE GRUPPE",normal:DP,"normal priority":"normale Priorität","not equal to":"ungleich","not properly connected":"Dieser Block ist mit anderen nicht richtig verbunden.",offset:AP,"on change":"bei Änderung","on condition change":"bei Zustandsänderung","on update":"beim Aktualisieren",one:RP,or:OP,quiet:MP,"reset search":"Suche zurücksetzen",search:NP,seconds:LP,solarNoon:PP,"store in":"speichern in",sunrise:BP,sunriseEnd:jP,sunset:FP,sunsetStart:zP,then:UP,"toggle value":"Wert umschalten",tooltip_ack:HP,tooltip_from:WP,tooltip_lc:VP,tooltip_quality:GP,tooltip_ts:KP,tooltip_user:YP,tooltip_value:JP,true:"wahr",two:qP,undefined:"nicht definiert",update:XP,"use seconds":"Sekunden verwenden","use trigger value":"Triggerwert benutzen",verbose_help:ZP,verbose_label:QP,when:eB,with:"mit","with date":"mit Datum","with offset":"mit Versatz",wizard:tB,"Loading models...":"Modelle werden geladen...","Could not connect to API at %s":"Verbindung zur API unter %s nicht möglich","Invalid API key":"Ungültiger API-Schlüssel","Access denied by API":"Zugriff von der API verweigert","API error: %s":"API-Fehler: %s",'Model "%s" not found':'Modell "%s" nicht gefunden',"Request failed: %s":"Anfrage fehlgeschlagen: %s",Retry:sB,"No running javascript instance found":"Keine laufende JavaScript-Instanz gefunden"},iB="Admitido",nB="Comportamiento",rB="Añadir",aB="Todos",lB="Alguna",cB="Apply",uB="abril",dB="Preguntar",hB="Astronómico",pB="agosto",gB="Cancelar",mB="Cerrar",fB="Condición",$B="Condiciones",bB="Consola",vB="Copiado",yB="diciembre",_B="Defecto",wB="Demora",CB="Eliminar",TB="Descripción",kB="Hecho",SB="Ejecutivo shell",EB="Explicación",IB="Exportar",xB="Februar",DB="febrero",AB="Filtrar",RB="Carpeta",OB="P.",MB="viernes",NB="CARNÉ DE IDENTIDAD",LB="ID1",PB="ID2",BB="Importar",jB="Ejemplo",FB="Instancias",zB="Instrucciones",UB="Enero",HB="enero",WB="julio",VB="junio",GB="Límite",KB="marzo",YB="Mayo",JB="Menú",qB="Mensaje",XB="Mes",ZB="Modelo",QB="lunes",ej="Mes",tj="Más",sj="Nombre",oj="noviembre",ij="OK",nj="octubre",rj="Okay",aj="Pausa",lj="Persona fácil de convencer",cj="Pushsafer",uj="Rebautizar",dj="Repetir",hj="Reiniciar",pj="Resultado",gj="Sa",mj="sábado",fj="Salvar",$j="Calendario",bj="Guión",vj="septiembre",yj="Simular",_j="Stack",wj="Comienzo",Cj="Expresar",Tj="Su",kj="domingo",Sj="Telegrama",Ej="4",Ij="jueves",xj="Tiempo",Dj="Motivado",Aj="Disparadores",Rj="Tu",Oj="martes",Mj="URL",Nj="Valor",Lj="Volumen",Pj="3",Bj="miércoles",jj="Escribir",Fj="sí",zj="Reconocimiento",Uj="todos",Hj="y",Wj="astro",Vj="a",Gj="control",Kj="Copiar",Yj="CRON",Jj="Amanecer",qj="Este es un modo especial en el que los estados y los objetos no cambiarán. Pero solo se mostrará información sobre cada cambio planificado en el protocolo.",Xj="Depurar",Zj="Oscuridad",Qj="fácil",eF="cada",tF="Función",sF="CARNÉ DE IDENTIDAD",oF="Nombre",iF="Papel",nF="Habitación",rF="hora dorada",aF="Fin de la hora dorada",lF='El código se ejecutará solo cada vez que la condición sea verdadera. P.ej. si se activa en el valor del sensor de temperatura y la condición es "si la temperatura es superior a 20 ° C", las acciones "entonces" se ejecutarán cada vez que el sensor envíe la temperatura y supere los 20 ° C. Por 21 ° C, por 22 ° C y así sucesivamente.',cF='El código se ejecutará solo si cambia el resultado de la condición. P.ej. si se activa en el valor del sensor de temperatura y la condición es "si la temperatura es superior a 20 ° C", las acciones "entonces" se ejecutarán una vez cuando la temperatura sea superior a 20. La próxima vez, las acciones "entonces" se ejecutarán cuando la temperatura falla por debajo de 20 y luego sube por encima de 20 nuevamente.',uF="horas",dF="incluye",hF="intervalo",pF="magia",gF="milisegundos",mF="minutos",fF="ms",$F="nadir",bF="Amanecer náutico",vF="Atardecer náutico",yF="próximo amanecer",_F="Próxima puesta de sol",wF="Noche",CF="Fin de la noche",TF="normal",kF="compensar",SF="uno",EF="o",IF="tranquilo",xF="buscar",DF="segundos",AF="Mediodía solar",RF="amanecer",OF="Final del amanecer",MF="puesta de sol",NF="Inicio al atardecer",LF="entonces",PF="Reconocer",BF="De",jF="Último cambio",FF="Calidad",zF="Marca de tiempo",UF="Usuario",HF="Valor",WF="dos",VF="actualizar",GF="Agrega salida de depuración al registro para muchos comandos del sistema",KF="Salidas de registro detalladas",YF="cuando",JF="Wizard",qF="Reintentar",XF={"%s not found":"%s no encontrado","()":"()","(at %s)":"(en %s)","(optional)":"(Opcional)","-":"-",".":".","AI code generator":"Generador de código de IA",Ack:iB,Actions:nB,"Actual time of day":"Hora real del día",Add:rB,"Add new script":"Agregar nuevo script",All:aB,"All files will be accepted":"Todos los archivos serán aceptados.",Any:lB,"Any month":"Cualquier mes",Apply:cB,April:uB,"Are you sure?":"¿Estás seguro?",Ask:dB,Astronomical:hB,"Astronomical events today":"Eventos astronómicos hoy",August:pB,"Blockly description":"Crear reglas por bloques gráficos","Body:":"Cuerpo:",Cancel:gB,"Cannot delete non empty item!":"¡No se puede eliminar un elemento no vacío!","Change layout":"Cambia el diseño",'Change theme (actual "%s")':'Cambiar tema (ahora - "%s")',"Check blocks":"Comprobar bloques","Check is not active, because javascript adapter is disabled":"La comprobación no está activa porque el adaptador Javascript está desactivado","Clear search input":"Borrar entrada de búsqueda","Click on this icon":"Haga clic en este ícono",Close:mB,"Close all but current":"Cerrar todo menos el actual","Collapse all":"Desplegar todo","Compares current time with astronomical event":"Compara la hora actual con un evento astronómico","Compares current time with the user specific time":"Compara la hora actual con la hora específica del usuario","Compares the state value with user defined value":"Compara el valor del estado con el valor definido por el usuario",Condition:fB,Conditions:$B,"Configuration not saved.":"Configuración no guardada.",Console:bB,"Control or update some state":"Controlar o actualizar algún estado","Control or update some state with delay":"Controlar o actualizar algún estado con retraso","Convert blockly to javascript for ever.":"Convierta instantáneamente en bloque a Javascript.",Copied:vB,"Copy script":"Copiar guion","Copy to clipboard":"Copiar al portapapeles","Create new":"Crear nuevo","Create new folder":"Crear nueva carpeta","Create new script":"Crear nuevo script","Create or edit CRON or time wizard":"Crear o editar CRON o asistente de tiempo","Dark Theme":"Tema oscuro","Dark style":"Estilo oscuro",Date:"Fecha","Debug instance":"Instancia de depuración","Debug options":"Opciones de depuración",December:yB,Default:_B,"Define cron...":"Definir cron ...","Define schedule...":"Definir horario ...",Delay:wB,Delete:CB,"Delete %s":"Eliminar %s ...","Delete folder":"Eliminar carpeta","Delete script":"Eliminar guión",Description:TB,"Deselect all":"Deseleccionar todo","Discard changes for %s":"Descartar cambios para %s",Done:kB,"Double click to write value":"Doble clic para escribir el valor","Download as file":"Descargar como archivo","Drop some files here or click...":"Suelta algunos archivos aquí o haz clic ...","Duplicate name":"Nombre duplicado","Edit script or just double click":"Editar guión o simplemente hacer doble clic","Empty name is not allowed":"No se permite el nombre vacío","End search mode":"Fin del modo de búsqueda","Enter your question":"Ingrese su solicitud",Error:"Error","Error formatting code":"Código de formato de error","Error was found":"Error encontrado","Every day":"Diario",Exec:SB,"Executes some shell command":"Ejecuta algún comando de shell","Existing scripts will be overwritten.":"Los guiones existentes se sobrescribirán.","Expand all":"Expandir todo","Expert mode":"Modo experto",Explanation:EB,Export:IB,"Export all scripts":"Exportar todos los scripts","Export blocks":"Exportar bloques","Export selected blocks":"Exportar bloques seleccionados",Februar:xB,February:DB,Filter:AB,Folder:RB,Fr:OB,Friday:MB,Function:"Función","Function editor":"Editor de funciones","Function: executed":"Función: ejecutada","Go to next line":"Ir a la siguiente línea","HTTP Call":"Llamada HTTP","Hide logs":"Ocultar registros",ID:NB,ID1:LB,ID2:PB,Import:BB,"Import blocks":"Importar bloques","Import error":"Error de importación","Import scripts":"Importar guiones","Insert object ID":"Insertar ID de objeto",Instance:jB,"Instance is disabled":"La instancia está deshabilitada","Instance:":"Ejemplo:",Instances:FB,Instructions:zB,"Invalid CRON":"CRON inválido","It will not be possible to revert this operation.":"No será posible revertir esta operación.","JS description":"Crear reglas escribiendo Javascript",Januar:UB,January:HB,July:WB,June:VB,"Just check":"Sólo revisa","Language:":"Idioma:","Learn More":"Aprende más","Light style":"Estilo ligero",Limit:GB,"Local time":"Hora local","Locate file":"Localizar el archivo","Log outputs":"Salidas de registro","Log text":"Texto de registro","Log: %s":"Log: %s","Make a HTTP get request":"Realizar una solicitud de obtención HTTP","Make a pause between actions":"Hacer una pausa entre acciones",March:KB,"March ":"marzo",May:YB,Menu:JB,Message:qB,Mo:XB,Model:ZB,Monday:QB,Month:ej,More:tj,Name:sj,"No API key found":"No se encontró ninguna clave API","No Chat GPT Key found":"No se ha encontrado ninguna clave GPT de chat","No active host found":"No se encontró un host activo","Nothing found":"Nada Encontrado",November:oj,OK:ij,October:nj,Ok:rj,"On condition change":"En condición de cambio","On script save or adapter start":"Al guardar el script o al iniciar el adaptador","On weekdays":"De lunes a viernes","Open configuration":"Configuración abierta","Operate two states":"Operar dos estados","Operations with two states":"Operaciones con dos estados","Paste your blocks here":"Pega tus bloques aquí",Pause:aj,"Pause execution":"Pausar ejecución","Pause script":"Pausar guion","Phone:":"Teléfono:","Please select object ID...":"Por favor, seleccione la ID del objeto ...","Press Ctrl+Enter to get the answer":"Presiona Ctrl+Enter para obtener la respuesta","Prettify the script":"Embellecer el guión","Print some text in log":"Imprime texto en el registro","Priority:":"Prioridad:",Pushover:lj,Pushsafer:cj,"Read only ID selected: %s":"ID de solo lectura seleccionado: %s",Rename:uj,"Reorder scripts in folders":"Reordenar guiones en carpetas",Repeat:dj,Restart:hj,Result:pj,"Resume execution":"Reanudar ejecución","Root folder":"Carpeta raíz","Rules description":"Crea reglas con bloques IF, THEN, ELSE","Run script":"Ejecutar guión",Sa:gj,Saturday:mj,Save:fj,"Save all":"Salvar a todos","Say It":"Say It","Say some text via sayit adapter":"Di un mensaje de texto a través del adaptador sayit",Schedule:$j,Script:bj,"Script %s was modified on disk":"El script %s fue modificado en el disco","Script is not running":"El script no se está ejecutando","Search in scripts":"Buscar en guiones","Search...":"Buscar...","Select all":"Seleccionar todo","Send email":"Enviar correo electrónico","Sends an email":"Envía un correo electrónico","Sends message via Pushsafer":"Envía mensaje a través de Pushsafer","Sends message via pushover":"Envía un mensaje a través de un pushover","Sends message via telegram":"Envía mensaje por telegrama","Sends message via whatsapp-cmb":"Envía mensaje vía whatsapp-cmb",September:vj,"Server time":"Tiempo del servidor","Set state action":"Establecer acción estatal","Set with delay":"Establecer con retraso","Shell command":"Comando de Shell","Show astronomical events":"Mostrar eventos astronómicos","Show javascript code":"Mostrar código Javascript","Show logs":"Mostrar registros","Show only paused scripts":"Mostrar solo secuencias de comandos pausadas","Show only running scripts":"Mostrar solo scripts en ejecución","Show only scripts with problems":"Mostrar solo guiones con problemas",Simulate:yj,"Some files will be rejected":"Algunos archivos serán rechazados","Sound:":"Sonido:",Stack:_j,Start:wj,"Start script":"Iniciar guion",State:Cj,"State condition":"Condición del estado","Step into function":"Entra en función","Step out from function":"Sal de la función","Stop on exception":"Deténgase en excepción",Su:Tj,"Subject:":"Sujeto:",Sunday:kj,"TS description":"Crear reglas escribiendo el mecanografiado",Telegram:Sj,"Text:":"Texto:",Th:Ej,"The script will be stopped and must be activated manually after debugging. Continue?":"El script se detendrá y deberá activarse manualmente después de la depuración. ¿Continuar?","This is advances option. You can write your own code here and it will be executed on trigger":"Esta es la opción de avances. Puede escribir su propio código aquí y se ejecutará en el disparador",Thursday:Ij,Time:xj,"Time condition":"Condición de tiempo","Title:":"Título:","To:":"A:","Trigger with value":"Activar con valor",Triggered:Dj,Triggers:Aj,"Triggers the on script saving or the javascript instance restart":"Activa el guardado de la secuencia de comandos o el reinicio de la instancia de JavaScript","Triggers the rule on update or change of some state":"Activa la regla de actualización o cambio de algún estado","Triggers the rule periodically or on some specific time":"Activa la regla periódicamente o en un momento específico",Tu:Rj,Tuesday:Oj,URL:Mj,"Unknown error":"Error desconocido","Unknown error!":"¡Error desconocido!","Use generated code":"Usar código generado","User function":"Función de usuario","User:":"Usuario:",Value:Nj,"Vibration:":"Vibración:",Volume:Lj,We:Pj,Wednesday:Bj,"Whatsapp-cmb":"Whatsapp-cmb",Write:jj,"Write your own code":"Escribe tu propio código",Yes:Fj,"Yet exists!":"¡Sin embargo existe!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Puede usar %s en la URL para usar el valor de activación actual, %id para usar el ID de objeto activado, %name para mostrar el nombre de ID de objeto activado o %old para usar el valor de activación antiguo","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Puede usar %s en el comando para usar el valor de activación actual, %id para usar el ID de objeto activado, %name para mostrar el nombre de ID de objeto activado o %old para usar el valor de activación anterior","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Puede usar %s en el texto para mostrar el valor de activación actual, %id para usar el ID de objeto activado, %name para mostrar el nombre de ID de objeto activado o %old para usar el valor de activación antiguo","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Puede usar %s en el valor para usar el valor de activación actual, %id para usar el ID de objeto activado, %name para mostrar el nombre de ID de objeto activado o %old para usar el valor de activación antiguo","You have to enter OpenAI API key in the configuration of javascript adapter.":"Debe ingresar la clave API de OpenAI en la configuración del adaptador de JavaScript.","You have to enter at least one API key in the configuration of javascript adapter.":"Debe ingresar al menos una clave API (OpenAI, Anthropic o Gemini) en la configuración del adaptador de JavaScript.","Please select a valid model":"Seleccione un modelo válido","[equal]":"[igual]","[greater or equal]":"[mayor o igual]","[greater]":"[mayor que]","[hysteresis]":"[histéresis]","[includes]":"[incluye]","[less or equal]":"[menor o igual]","[less]":"[menos]","[not equal]":"[no es igual]",acknowledgment:zj,all:Uj,and:Hj,astro:Wj,at:Vj,"clear running":"carrera clara",control:Gj,copy:Kj,cron:Yj,dawn:Jj,debug_help:qj,debug_label:Xj,default:"defecto",dusk:Zj,easy:Qj,else:"demás","equal to":"igual a",every:eF,"every hour at 0 minutes":"cada hora a los 0 minutos",false:"falso","file reading has failed: %s":"la lectura del archivo ha fallado: %s","file reading was aborted":"la lectura del archivo fue abortada",filter_func:tF,filter_id:sF,filter_name:oF,filter_role:iF,filter_room:nF,"for edit or create script":"para editar o crear un nuevo script","for professionals":"para profesionales","for programmers":"para programadores",goldenHour:rF,goldenHourEnd:aF,"greater or equal":"mayor o igual","greater or equal to":"mayor o igual a","greater than":"mas grande que",help_just_check:lF,help_on_change:cF,"high priority":"alta prioridad","high-priority":"alta prioridad","highest priority":"más alta prioridad",hours:uF,includes:dF,interval:hF,"just check":"Sólo revisa","less or equal":"menor o igual","less or equal to":"menor o igual a","less than":"menos que","lower priority":"prioridad más baja","lowest priority":"prioridad más baja",magic:pF,milliseconds:gF,minutes:mF,ms:fF,nadir:$F,nauticalDawn:bF,nauticalDusk:vF,nextSunrise:yF,nextSunset:_F,night:wF,nightEnd:CF,"no blocks found":"No se encontraron bloques","no group":"NO GRUPO",normal:TF,"normal priority":"prioridad normal","not equal to":"no igual a","not properly connected":"Este bloque no está conectado correctamente a otros bloques.",offset:kF,"on change":"en el cambio","on condition change":"con cambio de condición","on update":"en actualización",one:SF,or:EF,quiet:IF,"reset search":"restablecer la búsqueda",search:xF,seconds:DF,solarNoon:AF,"store in":"almacenar en",sunrise:RF,sunriseEnd:OF,sunset:MF,sunsetStart:NF,then:LF,"toggle value":"alternar valor",tooltip_ack:PF,tooltip_from:BF,tooltip_lc:jF,tooltip_quality:FF,tooltip_ts:zF,tooltip_user:UF,tooltip_value:HF,true:"cierto",two:WF,undefined:"indefinido",update:VF,"use seconds":"usar segundos","use trigger value":"usar valor de activación",verbose_help:GF,verbose_label:KF,when:YF,with:"con","with date":"con fecha","with offset":"con desplazamiento",wizard:JF,"Loading models...":"Cargando modelos...","Could not connect to API at %s":"No se pudo conectar a la API en %s","Invalid API key":"Clave API no válida","Access denied by API":"Acceso denegado por la API","API error: %s":"Error de API: %s",'Model "%s" not found':'Modelo "%s" no encontrado',"Request failed: %s":"Solicitud fallida: %s",Retry:qF,"No running javascript instance found":"No se encontró ninguna instancia de JavaScript en ejecución"},ZF="Reconnu",QF="Actions",e2="Ajouter",t2="Tout",s2="Tout",o2="Postuler",i2="avril",n2="Demander",r2="Astronomique",a2="août",l2="Annuler",c2="proche",u2="État",d2="Conditions",h2="Console",p2="Copié",g2="décembre",m2="Défaut",f2="Retard",$2="Effacer",b2="Description",v2="Terminé",y2="Exec shell",_2="Explication",w2="Exportation",C2="Février",T2="février",k2="Filtre",S2="Dossier",E2="Fr",I2="Vendredi",x2="ID",D2="ID1",A2="ID2",R2="Importation",O2="Exemple",M2="Instances",N2="Instructions",L2="Janvier",P2="janvier",B2="juillet",j2="juin",F2="Limite",z2="Mars",U2="Mai",H2="M e n u",W2="Message",V2="Mo",G2="Modèle",K2="Lundi",Y2="Mois",J2="Plus",q2="Nom",X2="novembre",Z2="OK",Q2="octobre",ez="D'accord",tz="Pause",sz="Pushover",oz="Pushsafer",iz="Renommer",nz="Répéter",rz="Redémarrer",az="Résultat",lz="Sa",cz="samedi",uz="sauver",dz="Horaire",hz="Scénario",pz="septembre",gz="Simuler",mz="Stack",fz="Début",$z="État",bz="Su",vz="dimanche",yz="Télégramme",_z="4",wz="Jeudi",Cz="Temps",Tz="Déclenché",kz="Déclencheurs",Sz="Tu",Ez="Mardi",Iz="URL",xz="Valeur",Dz="Le volume",Az="3",Rz="Mercredi",Oz="Écrivez",Mz="Oui",Nz="reconnaissance",Lz="tout",Pz="et",Bz="astro",jz="à",Fz="contrôler",zz="copie",Uz="CRON",Hz="Aube",Wz="Il s'agit d'un mode spécial dans lequel les états et les objets ne changeront pas. Mais seules les informations sur chaque changement prévu seront affichées dans le protocole.",Vz="Déboguer",Gz="Crépuscule",Kz="facile",Yz="chaque",Jz="Une fonction",qz="ID",Xz="Nom",Zz="Rôle",Qz="Pièce",eU="Heure d'or",tU="Fin de l'heure d'or",sU="Le code ne sera exécuté que chaque fois que la condition est vraie. Par exemple. si déclenchement sur la valeur du capteur de température et que la condition est «si la température est supérieure à 20 ° C», les actions «alors» seront exécutées à chaque fois que le capteur envoie la température et qu'elle est supérieure à 20 ° C. À 21 ° C, à 22 ° C et ainsi de suite.",oU="Le code ne sera exécuté que si le résultat de la condition change. Par exemple. si le déclenchement sur la valeur du capteur de température et que la condition est «si la température est supérieure à 20 ° C», les actions «alors» seront exécutées une fois lorsque la température est supérieure à 20. La prochaine fois, les actions «alors» seront exécutées lorsque la température échoue sous 20 puis remonte au-dessus de 20.",iU="les heures",nU="comprend",rU="intervalle",aU="la magie",lU="millisecondes",cU="minutes",uU="ms",dU="nadir",hU="Aube nautique",pU="Crépuscule nautique",gU="Prochain lever de soleil",mU="Prochain coucher de soleil",fU="Nuit",$U="Fin de nuit",bU="Ordinaire",vU="décalage",yU="une",_U="ou",wU="calmer",CU="chercher",TU="secondes",kU="Midi solaire",SU="lever du soleil",EU="Fin du lever du soleil",IU="le coucher du soleil",xU="Début du coucher du soleil",DU="alors",AU="Reconnaître",RU="De",OU="Dernière modification",MU="Qualité",NU="Horodatage",LU="Utilisateur",PU="Valeur",BU="deux",jU="mettre à jour",FU="Ajoute une sortie de débogage au journal pour de nombreuses commandes système",zU="Sorties de journal détaillées",UU="lorsque",HU="Wizard",WU="Réessayer",VU={"%s not found":"%s non trouvé","()":"()","(at %s)":"(à %s)","(optional)":"(optionnel)","-":"-",".":".","AI code generator":"Générateur de code IA",Ack:ZF,Actions:QF,"Actual time of day":"Heure réelle de la journée",Add:e2,"Add new script":"Ajouter un nouveau script",All:t2,"All files will be accepted":"Tous les fichiers seront acceptés",Any:s2,"Any month":"N'importe quel mois",Apply:o2,April:i2,"Are you sure?":"Êtes-vous sûr?",Ask:n2,Astronomical:r2,"Astronomical events today":"Événements astronomiques aujourd'hui",August:a2,"Blockly description":"Création de règles par blocs graphiques","Body:":"Corps:",Cancel:l2,"Cannot delete non empty item!":"Impossible de supprimer un élément non vide!","Change layout":"Changer la disposition",'Change theme (actual "%s")':'Changer de thème (maintenant - "%s")',"Check blocks":"Vérifier les blocs","Check is not active, because javascript adapter is disabled":"La vérification n'est pas active, car l'adaptateur Javascript est désactivé","Clear search input":"Effacer la recherche","Click on this icon":"Cliquez sur cette icône",Close:c2,"Close all but current":"Ferme tout sauf courant","Collapse all":"Réduire tout","Compares current time with astronomical event":"Compare l'heure actuelle avec un événement astronomique","Compares current time with the user specific time":"Compare l'heure actuelle avec l'heure spécifique de l'utilisateur","Compares the state value with user defined value":"Compare la valeur d'état avec la valeur définie par l'utilisateur",Condition:u2,Conditions:d2,"Configuration not saved.":"Configuration non enregistrée.",Console:h2,"Control or update some state":"Contrôler ou mettre à jour un état","Control or update some state with delay":"Contrôler ou mettre à jour un état avec un délai","Convert blockly to javascript for ever.":"Convertissez instantanément en Javascript.",Copied:p2,"Copy script":"Copier le script","Copy to clipboard":"Copier dans le presse-papier","Create new":"Créer un nouveau","Create new folder":"Créer un nouveau dossier","Create new script":"Créer un nouveau script","Create or edit CRON or time wizard":"Créer ou éditer CRON ou un assistant de temps","Dark Theme":"Thème sombre","Dark style":"Style sombre",Date:"Date","Debug instance":"Instance de débogage","Debug options":"Options de débogage",December:g2,Default:m2,"Define cron...":"Définir le cron ...","Define schedule...":"Définir le calendrier ...",Delay:f2,Delete:$2,"Delete %s":"Supprimer %s ...","Delete folder":"Supprimer le dossier","Delete script":"Supprimer le script",Description:b2,"Deselect all":"Tout déselectionner","Discard changes for %s":"Ignorer les modifications pour %s",Done:v2,"Double click to write value":"Double clic pour écrire la valeur","Download as file":"Télécharger le fichier","Drop some files here or click...":"Déposer des fichiers ici ou cliquez sur ...","Duplicate name":"Nom en double","Edit script or just double click":"Modifiez le script ou double-cliquez simplement sur","Empty name is not allowed":"Le nom vide n'est pas autorisé","End search mode":"Fin du mode de recherche","Enter your question":"Entrez votre demande",Error:"Erreur","Error formatting code":"Erreur lors du formatage du code","Error was found":"Une erreur a été trouvée","Every day":"Tous les jours",Exec:y2,"Executes some shell command":"Exécute une commande shell","Existing scripts will be overwritten.":"Les scripts existants seront écrasés.","Expand all":"Développer tout","Expert mode":"Mode expert",Explanation:_2,Export:w2,"Export all scripts":"Exporter tous les scripts","Export blocks":"Blocs d'exportation","Export selected blocks":"Exporter les blocs sélectionnés",Februar:C2,February:T2,Filter:k2,Folder:S2,Fr:E2,Friday:I2,Function:"Fonction","Function editor":"Éditeur de fonction","Function: executed":"Fonction : exécutée","Go to next line":"Aller à la ligne suivante","HTTP Call":"Appel HTTP","Hide logs":"Masquer les journaux",ID:x2,ID1:D2,ID2:A2,Import:R2,"Import blocks":"Blocs d'importation","Import error":"Erreur d'importation","Import scripts":"Importer des scripts","Insert object ID":"Insérer un identifiant d'objet",Instance:O2,"Instance is disabled":"L'instance est désactivée","Instance:":"Exemple:",Instances:M2,Instructions:N2,"Invalid CRON":"CRON invalide","It will not be possible to revert this operation.":"Il ne sera pas possible de revenir sur cette opération.","JS description":"Créer des règles en écrivant du Javascript",Januar:L2,January:P2,July:B2,June:j2,"Just check":"Vérifiez simplement","Language:":"Langue:","Learn More":"Apprendre encore plus","Light style":"Style de lumière",Limit:F2,"Local time":"Heure locale","Locate file":"Localiser le fichier","Log outputs":"Journal des sorties","Log text":"Texte du journal","Log: %s":"Log : %s","Make a HTTP get request":"Faire une requête HTTP Get","Make a pause between actions":"Faites une pause entre les actions",March:z2,"March ":"mars",May:U2,Menu:H2,Message:W2,Mo:V2,Model:G2,Monday:K2,Month:Y2,More:J2,Name:q2,"No API key found":"Aucune clé API trouvée","No Chat GPT Key found":"Aucune clé GPT de chat trouvée","No active host found":"Aucun hôte actif trouvé","Nothing found":"Rien n'a été trouvé",November:X2,OK:Z2,October:Q2,Ok:ez,"On condition change":"En cas de changement de condition","On script save or adapter start":"Lors de l'enregistrement du script ou du démarrage de l'adaptateur","On weekdays":"En semaine","Open configuration":"Configuration ouverte","Operate two states":"Opérer deux états","Operations with two states":"Opérations à deux états","Paste your blocks here":"Collez vos blocs ici",Pause:tz,"Pause execution":"Suspendre l'exécution","Pause script":"Script de pause","Phone:":"Téléphone:","Please select object ID...":"Veuillez sélectionner l'ID d'objet ...","Press Ctrl+Enter to get the answer":"Appuyez sur Ctrl+Entrée pour obtenir la réponse","Prettify the script":"Embellir le scénario","Print some text in log":"Imprimer du texte dans le journal","Priority:":"Priorité:",Pushover:sz,Pushsafer:oz,"Read only ID selected: %s":"ID en lecture seule sélectionné: %s",Rename:iz,"Reorder scripts in folders":"Réorganiser les scripts dans des dossiers",Repeat:nz,Restart:rz,Result:az,"Resume execution":"Reprendre l'exécution","Root folder":"Dossier racine","Rules description":"Créer des règles avec des blocs IF, THEN, ELSE","Run script":"Script de lancement",Sa:lz,Saturday:cz,Save:uz,"Save all":"Sauver tous","Say It":"Say It","Say some text via sayit adapter":"Dites du texte via l'adaptateur sayit",Schedule:dz,Script:hz,"Script %s was modified on disk":"Le script %s a été modifié sur le disque","Script is not running":"Le script n'est pas en cours d'exécution","Search in scripts":"Rechercher dans les scripts","Search...":"Chercher...","Select all":"Tout sélectionner","Send email":"Envoyer un e-mail","Sends an email":"Envoie un e-mail","Sends message via Pushsafer":"Envoie un message via Pushsafer","Sends message via pushover":"Envoie un message via pushover","Sends message via telegram":"Envoie un message par télégramme","Sends message via whatsapp-cmb":"Envoie un message via whatsapp-cmb",September:pz,"Server time":"Heure du serveur","Set state action":"Définir l'action de l'état","Set with delay":"Set avec retard","Shell command":"Commande Shell","Show astronomical events":"Afficher les événements astronomiques","Show javascript code":"Afficher le code Javascript","Show logs":"Afficher les journaux","Show only paused scripts":"Afficher uniquement les scripts en pause","Show only running scripts":"Afficher uniquement les scripts en cours d'exécution","Show only scripts with problems":"Afficher uniquement les scripts avec des problèmes",Simulate:gz,"Some files will be rejected":"Certains fichiers seront rejetés","Sound:":"Sonner:",Stack:mz,Start:fz,"Start script":"Lancer le script",State:$z,"State condition":"État condition","Step into function":"Entrez dans la fonction","Step out from function":"Sortez de la fonction","Stop on exception":"Arrêt sur exception",Su:bz,"Subject:":"Sujet:",Sunday:vz,"TS description":"Créer des règles en écrivant des caractères dactylographiés",Telegram:yz,"Text:":"Texte:",Th:_z,"The script will be stopped and must be activated manually after debugging. Continue?":"Le script sera arrêté et doit être activé manuellement après le débogage. Continuez?","This is advances option. You can write your own code here and it will be executed on trigger":"C'est une option avancée. Vous pouvez écrire votre propre code ici et il sera exécuté au déclenchement",Thursday:wz,Time:Cz,"Time condition":"Condition de temps","Title:":"Titre:","To:":"À:","Trigger with value":"Déclencheur avec valeur",Triggered:Tz,Triggers:kz,"Triggers the on script saving or the javascript instance restart":"Déclenche l'enregistrement du script ou le redémarrage de l'instance javascript","Triggers the rule on update or change of some state":"Déclenche la règle sur la mise à jour ou le changement d'un état","Triggers the rule periodically or on some specific time":"Déclenche la règle périodiquement ou à une heure précise",Tu:Sz,Tuesday:Ez,URL:Iz,"Unknown error":"Erreur inconnue","Unknown error!":"Erreur inconnue!","Use generated code":"Utiliser le code généré","User function":"Fonction utilisateur","User:":"Utilisateur:",Value:xz,"Vibration:":"Vibration:",Volume:Dz,We:Az,Wednesday:Rz,"Whatsapp-cmb":"Whatsapp-cmb",Write:Oz,"Write your own code":"Écrivez votre propre code",Yes:Mz,"Yet exists!":"Pourtant existe!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Vous pouvez utiliser %s dans l'URL pour utiliser la valeur de déclenchement actuelle, %id pour utiliser l'ID de l'objet déclenché, %name pour afficher le nom de l'ID de l'objet déclenché ou %old pour utiliser l'ancienne valeur de déclenchement","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Vous pouvez utiliser %s dans la commande pour utiliser la valeur de déclenchement actuelle, %id pour utiliser l'ID de l'objet déclenché, %name pour afficher le nom de l'ID de l'objet déclenché ou %old pour utiliser l'ancienne valeur de déclenchement","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Vous pouvez utiliser %s dans le texte pour afficher la valeur de déclenchement actuelle, %id pour utiliser l'ID de l'objet déclenché, %name pour afficher le nom de l'ID de l'objet déclenché ou %old pour utiliser l'ancienne valeur de déclenchement","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Vous pouvez utiliser %s dans la valeur pour utiliser la valeur de déclenchement actuelle, %id pour utiliser l'ID de l'objet déclenché, %name pour afficher le nom de l'ID de l'objet déclenché ou %old pour utiliser l'ancienne valeur de déclenchement","You have to enter OpenAI API key in the configuration of javascript adapter.":"Vous devez entrer la clé API OpenAI dans la configuration de l'adaptateur javascript.","You have to enter at least one API key in the configuration of javascript adapter.":"Vous devez entrer au moins une clé API (OpenAI, Anthropic ou Gemini) dans la configuration de l'adaptateur javascript.","Please select a valid model":"Veuillez sélectionner un modèle valide","[equal]":"[égal]","[greater or equal]":"[supérieur ou égal]","[greater]":"[plus grand]","[hysteresis]":"[hystérèse]","[includes]":"[comprend]","[less or equal]":"[inférieur ou égal]","[less]":"[moins]","[not equal]":"[inégal]",acknowledgment:Nz,all:Lz,and:Pz,astro:Bz,at:jz,"clear running":"course claire",control:Fz,copy:zz,cron:Uz,dawn:Hz,debug_help:Wz,debug_label:Vz,default:"défaut",dusk:Gz,easy:Kz,else:"autre","equal to":"égal à",every:Yz,"every hour at 0 minutes":"toutes les heures à 0 minute",false:"faux","file reading has failed: %s":"La lecture du fichier a échoué: %s","file reading was aborted":"la lecture du fichier a été abandonnée",filter_func:Jz,filter_id:qz,filter_name:Xz,filter_role:Zz,filter_room:Qz,"for edit or create script":"pour éditer ou créer un nouveau script","for professionals":"pour les professionnels","for programmers":"pour les programmeurs",goldenHour:eU,goldenHourEnd:tU,"greater or equal":"supérieur ou égal","greater or equal to":"supérieur ou égal à","greater than":"plus grand que",help_just_check:sU,help_on_change:oU,"high priority":"haute priorité","high-priority":"haute priorité","highest priority":"priorité la plus élevée",hours:iU,includes:nU,interval:rU,"just check":"Vérifiez simplement","less or equal":"inférieur ou égal","less or equal to":"inférieur ou égal à","less than":"moins que","lower priority":"priorité inférieure","lowest priority":"priorité la plus basse",magic:aU,milliseconds:lU,minutes:cU,ms:uU,nadir:dU,nauticalDawn:hU,nauticalDusk:pU,nextSunrise:gU,nextSunset:mU,night:fU,nightEnd:$U,"no blocks found":"Aucun bloc trouvé","no group":"PAS DE GROUPE",normal:bU,"normal priority":"priorité normale","not equal to":"pas égal à","not properly connected":"Ce bloc n'est pas correctement connecté à d'autres blocs.",offset:vU,"on change":"sur le changement","on condition change":"sur changement de condition","on update":"sur mise à jour",one:yU,or:_U,quiet:wU,"reset search":"Réinitialiser la recherche",search:CU,seconds:TU,solarNoon:kU,"store in":"stocker dans",sunrise:SU,sunriseEnd:EU,sunset:IU,sunsetStart:xU,then:DU,"toggle value":"valeur de bascule",tooltip_ack:AU,tooltip_from:RU,tooltip_lc:OU,tooltip_quality:MU,tooltip_ts:NU,tooltip_user:LU,tooltip_value:PU,true:"vrai",two:BU,undefined:"indéfini",update:jU,"use seconds":"utiliser les secondes","use trigger value":"use trigger value",verbose_help:FU,verbose_label:zU,when:UU,with:"avec","with date":"avec date","with offset":"avec offset",wizard:HU,"Loading models...":"Chargement des modèles...","Could not connect to API at %s":"Impossible de se connecter à l'API sur %s","Invalid API key":"Clé API invalide","Access denied by API":"Accès refusé par l'API","API error: %s":"Erreur API : %s",'Model "%s" not found':'Modèle "%s" introuvable',"Request failed: %s":"Requête échouée : %s",Retry:WU,"No running javascript instance found":"Aucune instance JavaScript en cours d'exécution trouvée"},GU="Riconosciuto",KU="Azioni",YU="Inserisci",JU="Tutti",qU="Qualunque",XU="Applica",ZU="aprile",QU="Chiedere",eH="Astronomico",tH="agosto",sH="Annulla",oH="Vicino",iH="Condizione",nH="Condizioni",rH="Console",aH="Copiato",lH="dicembre",cH="Predefinito",uH="Ritardo",dH="Elimina",hH="Descrizione",pH="Fatto",gH="Execshell",mH="Spiegazione",fH="Esportare",$H="Februar",bH="febbraio",vH="Filtro",yH="Cartella",_H="P",wH="Venerdì",CH="ID",TH="ID1",kH="ID2",SH="Importare",EH="Esempio",IH="istanze",xH="Istruzioni",DH="Januar",AH="gennaio",RH="luglio",OH="giugno",MH="Limite",NH="marzo",LH="Maggio",PH="Menu",BH="Messaggio",jH="Mo",FH="Modello",zH="Lunedi",UH="Mese",HH="Di più",WH="Nome",VH="novembre",GH="OK",KH="ottobre",YH="Ok",JH="Pausa",qH="Pushover",XH="Pushsafer",ZH="Rinominare",QH="Ripetere",eW="Ricomincia",tW="Risultato",sW="Sa",oW="Sabato",iW="Salva",nW="Programma",rW="copione",aW="settembre",lW="Simulare",cW="Stack",uW="Cominciare",dW="Stato",hW="Su",pW="Domenica",gW="Telegramma",mW="4",fW="giovedi",$W="Tempo",bW="Innescato",vW="Trigger",yW="Tu",_W="martedì",wW="URL",CW="Valore",TW="Volume",kW="3",SW="mercoledì",EW="Scrivi",IW="sì",xW="riconoscimento",DW="tutti",AW="e",RW="astro",OW="a",MW="controllo",NW="copia",LW="CRON",PW="alba",BW="Questa è una modalità speciale in cui gli stati e gli oggetti non cambieranno. Ma nel protocollo verranno visualizzate solo le informazioni su ogni modifica pianificata.",jW="Debug",FW="crepuscolo",zW="facile",UW="ogni",HW="Funzione",WW="ID",VW="Nome",GW="Ruolo",KW="Camera",YW="Ora d'oro",JW="Fine dell'ora d'oro",qW='Il codice verrà eseguito solo ogni volta che la condizione è vera. Per esempio. se si attiva il valore del sensore di temperatura e la condizione è "se la temperatura è maggiore di 20 ° C", le azioni "allora" verranno eseguite ogni volta che il sensore invia la temperatura e questa è superiore a 20 ° C. Di 21 ° C, di 22 ° C e così via.',XW='Il codice verrà eseguito solo se il risultato della condizione cambia. Per esempio. se si attiva il valore del sensore di temperatura e la condizione è "se la temperatura è maggiore di 20 ° C", le azioni "allora" verranno eseguite una volta quando la temperatura è superiore a 20. La prossima volta le azioni "allora" verranno eseguite quando la temperatura fallisce sotto 20 e poi sale di nuovo oltre 20.',ZW="ore",QW="include",eV="intervallo",tV="Magia",sV="millisecondi",oV="minuti",iV="ms",nV="nadir",rV="Alba nautica",aV="Crepuscolo nautico",lV="Prossima alba",cV="Prossimo tramonto",uV="Notte",dV="Fine della notte",hV="normale",pV="compensare",gV="uno",mV="o",fV="silenzioso",$V="ricerca",bV="secondi",vV="Mezzogiorno solare",yV="Alba",_V="Fine dell'alba",wV="tramonto",CV="Inizio del tramonto",TV="poi",kV="Riconoscere",SV="A partire dal",EV="Ultima modifica",IV="Qualità",xV="timestamp",DV="Utente",AV="Valore",RV="Due",OV="aggiornare",MV="Aggiunge l'output di debug al registro per molti comandi di sistema",NV="Output di log dettagliati",LV="quando",PV="procedura guidata",BV="Riprova",jV={"%s not found":"%s non trovato","()":"()","(at %s)":"(a %s)","(optional)":"(opzionale)","-":"-",".":".","AI code generator":"Generatore di codice AI",Ack:GU,Actions:KU,"Actual time of day":"Ora effettiva della giornata",Add:YU,"Add new script":"Aggiungi nuovo script",All:JU,"All files will be accepted":"Tutti i file saranno accettati",Any:qU,"Any month":"Ogni mese",Apply:XU,April:ZU,"Are you sure?":"Sei sicuro?",Ask:QU,Astronomical:eH,"Astronomical events today":"Eventi astronomici oggi",August:tH,"Blockly description":"Creazione di regole tramite blocchi grafici","Body:":"Corpo:",Cancel:sH,"Cannot delete non empty item!":"Impossibile eliminare l'elemento non vuoto!","Change layout":"Cambia layout",'Change theme (actual "%s")':'Cambia tema (ora - "%s")',"Check blocks":"Controlla i blocchi","Check is not active, because javascript adapter is disabled":"Il controllo non è attivo perché l'adattatore Javascript è disabilitato","Clear search input":"Cancella input di ricerca","Click on this icon":"Clicca su questa icona",Close:oH,"Close all but current":"Chiudi tutto tranne corrente","Collapse all":"Comprimi tutto","Compares current time with astronomical event":"Confronta l'ora corrente con l'evento astronomico","Compares current time with the user specific time":"Confronta l'ora corrente con l'ora specifica dell'utente","Compares the state value with user defined value":"Confronta il valore dello stato con il valore definito dall'utente",Condition:iH,Conditions:nH,"Configuration not saved.":"Configurazione non salvata.",Console:rH,"Control or update some state":"Controlla o aggiorna uno stato","Control or update some state with delay":"Controlla o aggiorna uno stato con ritardo","Convert blockly to javascript for ever.":"Converti istantaneamente a blocchi in Javascript.",Copied:aH,"Copy script":"Copia script","Copy to clipboard":"Copia negli appunti","Create new":"Creare nuovo","Create new folder":"Crea una nuova cartella","Create new script":"Crea nuovo script","Create or edit CRON or time wizard":"Crea o modifica la procedura guidata CRON o time","Dark Theme":"Tema scuro","Dark style":"Stile scuro",Date:"Data","Debug instance":"Istanza di debug","Debug options":"Opzioni di debug",December:lH,Default:cH,"Define cron...":"Definisci cron ...","Define schedule...":"Definisci programma ...",Delay:uH,Delete:dH,"Delete %s":"Elimina %s ...","Delete folder":"Elimina cartella","Delete script":"Elimina script",Description:hH,"Deselect all":"Deselezionare tutto","Discard changes for %s":"Annulla modifiche per %s",Done:pH,"Double click to write value":"Doppio clic per scrivere il valore","Download as file":"Scarica come file","Drop some files here or click...":"Trascina alcuni file qui o fai clic su ...","Duplicate name":"Nome duplicato","Edit script or just double click":"Modifica lo script o fai doppio clic","Empty name is not allowed":"Il nome vuoto non è consentito","End search mode":"Termina la modalità di ricerca","Enter your question":"Inserisci la tua richiesta",Error:"Errore","Error formatting code":"Errore di formattazione del codice","Error was found":"Errore trovato","Every day":"Ogni giorno",Exec:gH,"Executes some shell command":"Esegue alcuni comandi della shell","Existing scripts will be overwritten.":"Gli script esistenti verranno sovrascritti.","Expand all":"Espandi tutto","Expert mode":"Modalità esperto",Explanation:mH,Export:fH,"Export all scripts":"Esporta tutti gli script","Export blocks":"Esporta blocchi","Export selected blocks":"Esporta i blocchi selezionati",Februar:$H,February:bH,Filter:vH,Folder:yH,Fr:_H,Friday:wH,Function:"Funzione","Function editor":"Editor di funzioni","Function: executed":"Funzione: eseguita","Go to next line":"Vai alla riga successiva","HTTP Call":"Chiamata HTTP","Hide logs":"Nascondi i registri",ID:CH,ID1:TH,ID2:kH,Import:SH,"Import blocks":"Importa blocchi","Import error":"Errore di importazione","Import scripts":"Importa script","Insert object ID":"Inserisci l'ID oggetto",Instance:EH,"Instance is disabled":"L'istanza è disabilitata","Instance:":"Esempio:",Instances:IH,Instructions:xH,"Invalid CRON":"CRON non valido","It will not be possible to revert this operation.":"Non sarà possibile ripristinare questa operazione.","JS description":"Creare regole scrivendo Javascript",Januar:DH,January:AH,July:RH,June:OH,"Just check":"Controlla solamente","Language:":"Linguaggio:","Learn More":"Per saperne di più","Light style":"Stile leggero",Limit:MH,"Local time":"Ora locale","Locate file":"Localizza file","Log outputs":"Registra le uscite","Log text":"Testo del registro","Log: %s":"Log: %s","Make a HTTP get request":"Effettua una richiesta get HTTP","Make a pause between actions":"Fai una pausa tra le azioni",March:NH,"March ":"marzo",May:LH,Menu:PH,Message:BH,Mo:jH,Model:FH,Monday:zH,Month:UH,More:HH,Name:WH,"No API key found":"Nessuna chiave API trovata","No Chat GPT Key found":"Nessuna chiave GPT chat trovata","No active host found":"Nessun host attivo trovato","Nothing found":"Non abbiamo trovato nulla",November:VH,OK:GH,October:KH,Ok:YH,"On condition change":"A condizione che cambino","On script save or adapter start":"Al salvataggio dello script o all'avvio dell'adattatore","On weekdays":"Nei giorni della settimana","Open configuration":"Configurazione aperta","Operate two states":"Gestisci due stati","Operations with two states":"Operazioni con due stati","Paste your blocks here":"Incolla qui i tuoi blocchi",Pause:JH,"Pause execution":"Metti in pausa l'esecuzione","Pause script":"Metti in pausa lo script","Phone:":"Telefono:","Please select object ID...":"Seleziona l'ID oggetto ...","Press Ctrl+Enter to get the answer":"Premi Ctrl+Invio per ottenere la risposta","Prettify the script":"Abbellire la sceneggiatura","Print some text in log":"Stampa del testo nel registro","Priority:":"Priorità:",Pushover:qH,Pushsafer:XH,"Read only ID selected: %s":"ID di sola lettura selezionato: %s",Rename:ZH,"Reorder scripts in folders":"Riordina gli script nelle cartelle",Repeat:QH,Restart:eW,Result:tW,"Resume execution":"Riprendi esecuzione","Root folder":"Cartella root","Rules description":"Crea regole con i blocchi IF, THEN, ELSE","Run script":"Esegui script",Sa:sW,Saturday:oW,Save:iW,"Save all":"Salva tutto","Say It":"Say It","Say some text via sayit adapter":"Pronuncia del testo tramite l'adattatore sayit",Schedule:nW,Script:rW,"Script %s was modified on disk":"Lo script %s è stato modificato sul disco","Script is not running":"Lo script non è in esecuzione","Search in scripts":"Cerca negli script","Search...":"Ricerca...","Select all":"Seleziona tutto","Send email":"Invia una email","Sends an email":"Invia un'e-mail","Sends message via Pushsafer":"Invia messaggio tramite Pushsafer","Sends message via pushover":"Invia messaggio tramite pushover","Sends message via telegram":"Invia messaggio tramite telegramma","Sends message via whatsapp-cmb":"Invia messaggio tramite whatsapp-cmb",September:aW,"Server time":"Ora del server","Set state action":"Imposta l'azione dello stato","Set with delay":"Impostato con ritardo","Shell command":"Comando Shell","Show astronomical events":"Mostra eventi astronomici","Show javascript code":"Mostra codice Javascript","Show logs":"Mostra i log","Show only paused scripts":"Mostra solo script in pausa","Show only running scripts":"Mostra solo gli script in esecuzione","Show only scripts with problems":"Mostra solo script con problemi",Simulate:lW,"Some files will be rejected":"Alcuni file verranno rifiutati","Sound:":"Suono:",Stack:cW,Start:uW,"Start script":"Avvia script",State:dW,"State condition":"Condizione dello stato","Step into function":"Entra in funzione","Step out from function":"Esci dalla funzione","Stop on exception":"Ferma in caso di eccezione",Su:hW,"Subject:":"Soggetto:",Sunday:pW,"TS description":"Creare regole scrivendo dattiloscritto",Telegram:gW,"Text:":"Testo:",Th:mW,"The script will be stopped and must be activated manually after debugging. Continue?":"Lo script verrà interrotto e dovrà essere attivato manualmente dopo il debug. Continua?","This is advances option. You can write your own code here and it will be executed on trigger":"Questa è un'opzione anticipata. Puoi scrivere il tuo codice qui e verrà eseguito al trigger",Thursday:fW,Time:$W,"Time condition":"Condizione temporale","Title:":"Titolo:","To:":"Per:","Trigger with value":"Trigger con valore",Triggered:bW,Triggers:vW,"Triggers the on script saving or the javascript instance restart":"Attiva il salvataggio dello script o il riavvio dell'istanza javascript","Triggers the rule on update or change of some state":"Attiva la regola in caso di aggiornamento o modifica di uno stato","Triggers the rule periodically or on some specific time":"Attiva la regola periodicamente o in un momento specifico",Tu:yW,Tuesday:_W,URL:wW,"Unknown error":"Errore sconosciuto","Unknown error!":"Errore sconosciuto!","Use generated code":"Usa il codice generato","User function":"Funzione utente","User:":"Utente:",Value:CW,"Vibration:":"Vibrazione:",Volume:TW,We:kW,Wednesday:SW,"Whatsapp-cmb":"Whatsapp-cmb",Write:EW,"Write your own code":"Scrivi il tuo codice",Yes:IW,"Yet exists!":"Esiste ancora!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"È possibile utilizzare %s nell'URL per utilizzare il valore di trigger corrente, %id per utilizzare l'ID dell'oggetto attivato, %name per mostrare il nome dell'ID dell'oggetto attivato o %old per utilizzare il vecchio valore di trigger","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"È possibile utilizzare %s nel comando per utilizzare il valore di trigger corrente, %id per utilizzare l'ID dell'oggetto attivato, %name per mostrare il nome dell'ID dell'oggetto attivato o %old per utilizzare il vecchio valore di trigger","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"È possibile utilizzare %s nel testo per visualizzare il valore di trigger corrente, %id per utilizzare l'ID dell'oggetto attivato, %name per mostrare il nome dell'ID dell'oggetto attivato o %old per utilizzare il vecchio valore di trigger","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"È possibile utilizzare %s nel valore per utilizzare il valore di trigger corrente, %id per utilizzare l'ID dell'oggetto attivato, %name per mostrare il nome dell'ID dell'oggetto attivato o %old per utilizzare il vecchio valore di trigger","You have to enter OpenAI API key in the configuration of javascript adapter.":"Devi inserire la chiave API OpenAI nella configurazione dell'adattatore javascript.","You have to enter at least one API key in the configuration of javascript adapter.":"Devi inserire almeno una chiave API (OpenAI, Anthropic o Gemini) nella configurazione dell'adattatore javascript.","Please select a valid model":"Seleziona un modello valido","[equal]":"[pari]","[greater or equal]":"[maggiore o uguale]","[greater]":"[maggiore]","[hysteresis]":"[isteresi]","[includes]":"[include]","[less or equal]":"[minore o uguale]","[less]":"[Di meno]","[not equal]":"[non uguale]",acknowledgment:xW,all:DW,and:AW,astro:RW,at:OW,"clear running":"chiara esecuzione",control:MW,copy:NW,cron:LW,dawn:PW,debug_help:BW,debug_label:jW,default:"predefinito",dusk:FW,easy:zW,else:"altro","equal to":"uguale a",every:UW,"every hour at 0 minutes":"ogni ora a 0 minuti",false:"falso","file reading has failed: %s":"lettura file non riuscita: %s","file reading was aborted":"la lettura del file è stata interrotta",filter_func:HW,filter_id:WW,filter_name:VW,filter_role:GW,filter_room:KW,"for edit or create script":"per modificare o creare un nuovo script","for professionals":"per i professionisti","for programmers":"per i programmatori",goldenHour:YW,goldenHourEnd:JW,"greater or equal":"maggiore o uguale","greater or equal to":"maggiore o uguale a","greater than":"più grande di",help_just_check:qW,help_on_change:XW,"high priority":"priorità alta","high-priority":"priorità alta","highest priority":"massima priorità",hours:ZW,includes:QW,interval:eV,"just check":"controlla solamente","less or equal":"inferiore o uguale","less or equal to":"minore o uguale a","less than":"meno di","lower priority":"priorità inferiore","lowest priority":"priorità più bassa",magic:tV,milliseconds:sV,minutes:oV,ms:iV,nadir:nV,nauticalDawn:rV,nauticalDusk:aV,nextSunrise:lV,nextSunset:cV,night:uV,nightEnd:dV,"no blocks found":"Nessun blocco trovato","no group":"NESSUN GRUPPO",normal:hV,"normal priority":"priorità normale","not equal to":"non uguale a","not properly connected":"Questo blocco non è correttamente collegato ad altri blocchi.",offset:pV,"on change":"sul cambiamento","on condition change":"a cambio di condizione","on update":"in aggiornamento",one:gV,or:mV,quiet:fV,"reset search":"resetta la ricerca",search:$V,seconds:bV,solarNoon:vV,"store in":"conservare in",sunrise:yV,sunriseEnd:_V,sunset:wV,sunsetStart:CV,then:TV,"toggle value":"alterna valore",tooltip_ack:kV,tooltip_from:SV,tooltip_lc:EV,tooltip_quality:IV,tooltip_ts:xV,tooltip_user:DV,tooltip_value:AV,true:"vero",two:RV,undefined:"non definito",update:OV,"use seconds":"usa i secondi","use trigger value":"usa il trigger",verbose_help:MV,verbose_label:NV,when:LV,with:"con","with date":"con data","with offset":"con offset",wizard:PV,"Loading models...":"Caricamento modelli...","Could not connect to API at %s":"Impossibile connettersi all'API su %s","Invalid API key":"Chiave API non valida","Access denied by API":"Accesso negato dall'API","API error: %s":"Errore API: %s",'Model "%s" not found':'Modello "%s" non trovato',"Request failed: %s":"Richiesta fallita: %s",Retry:BV,"No running javascript instance found":"Nessuna istanza JavaScript in esecuzione trovata"},FV="Erkend",zV="Acties",UV="Toevoegen",HV="Alle",WV="Ieder",VV="Solliciteer",GV="april",KV="Vragen",YV="Astronomisch",JV="augustus",qV="annuleren",XV="Dichtbij",ZV="Staat",QV="Voorwaarden",eG="Troosten",tG="Gekopieerd",sG="december",oG="Standaard",iG="Vertraging",nG="Verwijder",rG="Beschrijving",aG="Gedaan",lG="Exec shell",cG="Uitleg",uG="Exporteren",dG="Februari",hG="februari",pG="Filter",gG="Map",mG="Vr",fG="vrijdag",$G="ID kaart",bG="ID1",vG="ID2",yG="Importeren",_G="Voorbeeld",wG="Instanties",CG="Instructies",TG="Januar",kG="januari",SG="juli",EG="juni",IG="Begrenzing",xG="maart",DG="mei",AG="Menu",RG="Bericht",OG="Ma",MG="Model",NG="maandag",LG="Maand",PG="Meer",BG="Naam",jG="november",FG="OK",zG="oktober",UG="OK",HG="Pauze",WG="Pushover",VG="Duwijzer",GG="andere naam geven",KG="Herhaling",YG="Herstarten",JG="Resultaat",qG="Za",XG="zaterdag",ZG="Opslaan",QG="Schema",e5="Script",t5="september",s5="Simuleren",o5="Stack",i5="Begin",n5="Staat",r5="Zo",a5="zondag",l5="Telegram",c5="4",u5="donderdag",d5="Tijd",h5="Veroorzaakt",p5="Triggers",g5="Di",m5="dinsdag",f5="URL",$5="Waarde",b5="Volume",v5="3",y5="woensdag",_5="Schrijven",w5="Ja",C5="erkenning",T5="alle",k5="en",S5="astro",E5="Bij",I5="controle",x5="kopiëren",D5="cron",A5="dageraad",R5="Dit is een speciale modus waarin toestanden en objecten niet veranderen. Maar alleen informatie over elke geplande wijziging wordt in het protocol weergegeven.",O5="Debuggen",M5="schemer",N5="eenvoudig",L5="elke",P5="Functie",B5="ID kaart",j5="Naam",F5="Rol",z5="Kamer",U5="gouden uur",H5="Einde van gouden uur",W5='De code wordt alleen uitgevoerd als de voorwaarde waar is. Bijv. als het triggeren op de temperatuursensorwaarde en de conditie is "als de temperatuur hoger is dan 20 ° C", zullen de "dan" acties worden uitgevoerd elke keer dat de sensor de temperatuur verzendt en deze hoger is dan 20 ° C. Bij 21 ° C, bij 22 ° C enzovoort.',V5='De code wordt alleen uitgevoerd als het conditieresultaat verandert. Bijv. als de temperatuursensor wordt geactiveerd en de conditie is "als de temperatuur hoger is dan 20 ° C", worden de "dan" -acties eenmaal uitgevoerd wanneer de temperatuur hoger is dan 20. De volgende keer worden de "dan" -acties uitgevoerd wanneer de temperatuur faalt onder de 20 en stijgt dan weer boven de 20.',G5="uren",K5="omvat",Y5="interval",J5="magie",q5="milliseconden",X5="minuten",Z5="ms",Q5="nadir",e3="Nautische dageraad",t3="Nautische schemering",s3="Volgende zonsopgang",o3="Volgende zonsondergang",i3="nacht",n3="Einde van de nacht",r3="normaal",a3="compensatie",l3="een",c3="of",u3="stil",d3="zoeken",h3="seconden",p3="Zonne-middag",g3="zonsopkomst",m3="Einde zonsopgang",f3="zonsondergang",$3="Begin van de zonsondergang",b3="vervolgens",v3="Erkennen",y3="Van",_3="Laatst gewijzigd",w3="Kwaliteit",C3="tijdstempel",T3="Gebruiker",k3="Waarde",S3="twee",E3="bijwerken",I3="Voegt foutopsporingsuitvoer toe aan het logboek voor veel systeemopdrachten",x3="Uitgebreide log-uitgangen",D3="wanneer",A3="tovenaar",R3="Opnieuw proberen",O3={"%s not found":"%s niet gevonden","()":"()","(at %s)":"(op %s)","(optional)":"(optioneel)","-":"-",".":".","AI code generator":"AI-codegenerator",Ack:FV,Actions:zV,"Actual time of day":"Werkelijke tijd van de dag",Add:UV,"Add new script":"Nieuw script toevoegen",All:HV,"All files will be accepted":"Alle bestanden worden geaccepteerd",Any:WV,"Any month":"Elke maand",Apply:VV,April:GV,"Are you sure?":"Weet je zeker dat?",Ask:KV,Astronomical:YV,"Astronomical events today":"Astronomische gebeurtenissen vandaag",August:JV,"Blockly description":"Regels maken door grafische blokken","Body:":"Lichaam:",Cancel:qV,"Cannot delete non empty item!":"Kan niet leeg item niet verwijderen!","Change layout":"Opmaak veranderen",'Change theme (actual "%s")':'Thema wijzigen (nu - "%s")',"Check blocks":"Controleer blokken","Check is not active, because javascript adapter is disabled":"Controle is niet actief, omdat Javascript-adapter is uitgeschakeld","Clear search input":"Zoekopdracht wissen","Click on this icon":"Klik op dit pictogram",Close:XV,"Close all but current":"Alles sluiten behalve huidig","Collapse all":"Alles inklappen","Compares current time with astronomical event":"Vergelijkt huidige tijd met astronomische gebeurtenis","Compares current time with the user specific time":"Vergelijkt de huidige tijd met de gebruikerspecifieke tijd","Compares the state value with user defined value":"Vergelijkt de statuswaarde met de door de gebruiker gedefinieerde waarde",Condition:ZV,Conditions:QV,"Configuration not saved.":"Configuratie niet opgeslagen.",Console:eG,"Control or update some state":"Beheer of update een bepaalde staat","Control or update some state with delay":"Beheer of update een bepaalde staat met vertraging","Convert blockly to javascript for ever.":"Converteer direct blockly naar Javascript.",Copied:tG,"Copy script":"Kopieer script","Copy to clipboard":"Kopieer naar klembord","Create new":"Maak nieuw","Create new folder":"Maak een nieuwe map","Create new script":"Maak een nieuw script","Create or edit CRON or time wizard":"Creëer of bewerk CRON of tijdwizard","Dark Theme":"Donker thema","Dark style":"Donkere stijl",Date:"Datum","Debug instance":"Debug-instantie","Debug options":"Foutopsporingsopties",December:sG,Default:oG,"Define cron...":"Definieer cron ...","Define schedule...":"Definieer schema ...",Delay:iG,Delete:nG,"Delete %s":"%s verwijderen ...","Delete folder":"Verwijder map","Delete script":"Script verwijderen",Description:rG,"Deselect all":"Deselecteer alles","Discard changes for %s":"Wijzigingen voor %s annuleren",Done:aG,"Double click to write value":"Dubbelklikken om waarde te schrijven","Download as file":"Download","Drop some files here or click...":"Zet hier enkele bestanden neer of klik op ...","Duplicate name":"Dubbele naam","Edit script or just double click":"Bewerk het script of dubbelklik erop","Empty name is not allowed":"Lege naam is niet toegestaan","End search mode":"Zoekmodus beëindigen","Enter your question":"Voer uw verzoek in",Error:"Fout","Error formatting code":"Fout bij het opmaken van de code","Error was found":"Er is een fout gevonden","Every day":"Elke dag",Exec:lG,"Executes some shell command":"Voert een shell-commando uit","Existing scripts will be overwritten.":"Bestaande scripts worden overschreven.","Expand all":"Alles uitvouwen","Expert mode":"Expert modus",Explanation:cG,Export:uG,"Export all scripts":"Exporteer alle scripts","Export blocks":"Blokken exporteren","Export selected blocks":"Exporteer geselecteerde blokken",Februar:dG,February:hG,Filter:pG,Folder:gG,Fr:mG,Friday:fG,Function:"Functie","Function editor":"Functie-editor","Function: executed":"Functie: uitgevoerd","Go to next line":"Ga naar de volgende regel","HTTP Call":"HTTP-oproep","Hide logs":"Verberg logboeken",ID:$G,ID1:bG,ID2:vG,Import:yG,"Import blocks":"Blokken importeren","Import error":"Importfout","Import scripts":"Scripts importeren","Insert object ID":"Object-ID invoegen",Instance:_G,"Instance is disabled":"Exemplaar is uitgeschakeld","Instance:":"Voorbeeld:",Instances:wG,Instructions:CG,"Invalid CRON":"Ongeldige CRON","It will not be possible to revert this operation.":"Het is niet mogelijk om deze bewerking terug te zetten.","JS description":"Regels maken door Javascript te schrijven",Januar:TG,January:kG,July:SG,June:EG,"Just check":"Kijk maar","Language:":"Taal:","Learn More":"Leer meer","Light style":"Lichte stijl",Limit:IG,"Local time":"Lokale tijd","Locate file":"Vind het bestand","Log outputs":"Log uitgangen","Log text":"Log tekst","Log: %s":"Logboek: %s","Make a HTTP get request":"Maak een HTTP-ophaalverzoek","Make a pause between actions":"Pauzeer tussen acties",March:xG,"March ":"maart",May:DG,Menu:AG,Message:RG,Mo:OG,Model:MG,Monday:NG,Month:LG,More:PG,Name:BG,"No API key found":"Geen API-sleutel gevonden","No Chat GPT Key found":"Geen Chat GPT-sleutel gevonden","No active host found":"Geen actieve host gevonden","Nothing found":"Niets gevonden",November:jG,OK:FG,October:zG,Ok:UG,"On condition change":"Op voorwaarde verandering","On script save or adapter start":"Bij het opslaan van het script of het starten van de adapter","On weekdays":"Op weekdagen","Open configuration":"Configuratie openen","Operate two states":"Bedien twee toestanden:","Operations with two states":"Bewerkingen met twee toestanden","Paste your blocks here":"Plak hier je blokken",Pause:HG,"Pause execution":"Uitvoering pauzeren","Pause script":"Pauzeer script","Phone:":"Telefoon:","Please select object ID...":"Selecteer object-ID ...","Press Ctrl+Enter to get the answer":"Druk op Ctrl+Enter om het antwoord te krijgen","Prettify the script":"Maak het script mooier","Print some text in log":"Druk wat tekst af in het logboek","Priority:":"Prioriteit:",Pushover:WG,Pushsafer:VG,"Read only ID selected: %s":"Alleen-lezen ID geselecteerd: %s",Rename:GG,"Reorder scripts in folders":"Sorteer scripts in mappen opnieuw",Repeat:KG,Restart:YG,Result:JG,"Resume execution":"Uitvoering hervatten","Root folder":"Hoofdmap","Rules description":"Maak regels met IF, THEN, ELSE blokken","Run script":"Voer script uit",Sa:qG,Saturday:XG,Save:ZG,"Save all":"Sla alles op","Say It":"Say It","Say some text via sayit adapter":"Zeg wat tekst via de sayit-adapter",Schedule:QG,Script:e5,"Script %s was modified on disk":"Script %s is gewijzigd op schijf","Script is not running":"Script is niet actief","Search in scripts":"Zoeken in scripts","Search...":"Zoeken...","Select all":"Selecteer alles","Send email":"E-mail verzenden","Sends an email":"Stuurt een e-mail","Sends message via Pushsafer":"Stuurt bericht via Pushsafer","Sends message via pushover":"Stuurt bericht via pushover","Sends message via telegram":"Verzendt bericht via telegram","Sends message via whatsapp-cmb":"Stuurt bericht via whatsapp-cmb",September:t5,"Server time":"Servertijd","Set state action":"Stel statusactie in","Set with delay":"Met vertraging ingesteld","Shell command":"Shell-opdracht","Show astronomical events":"Laat astronomische gebeurtenissen zien","Show javascript code":"Javascript-code weergeven","Show logs":"Toon logboeken","Show only paused scripts":"Toon alleen onderbroken scripts","Show only running scripts":"Toon alleen actieve scripts","Show only scripts with problems":"Toon alleen scripts met problemen",Simulate:s5,"Some files will be rejected":"Sommige bestanden worden geweigerd","Sound:":"Geluid:",Stack:o5,Start:i5,"Start script":"Start het script",State:n5,"State condition":"Staat staat","Step into function":"Stap in functie","Step out from function":"Stap uit de functie","Stop on exception":"Stop bij uitzondering",Su:r5,"Subject:":"Onderwerpen:",Sunday:a5,"TS description":"Regels maken door Typescript te schrijven",Telegram:l5,"Text:":"Tekst:",Th:c5,"The script will be stopped and must be activated manually after debugging. Continue?":"Het script wordt gestopt en moet na het debuggen handmatig worden geactiveerd. Doorgaan met?","This is advances option. You can write your own code here and it will be executed on trigger":"Dit is een voorschotoptie. U kunt hier uw eigen code schrijven en deze wordt bij een trigger uitgevoerd",Thursday:u5,Time:d5,"Time condition":"Tijdsvoorwaarde","Title:":"Titel:","To:":"Naar:","Trigger with value":"Trigger met waarde",Triggered:h5,Triggers:p5,"Triggers the on script saving or the javascript instance restart":"Activeert het opslaan van het script of het opnieuw opstarten van de JavaScript-instantie","Triggers the rule on update or change of some state":"Activeert de regel voor het bijwerken of wijzigen van een bepaalde staat","Triggers the rule periodically or on some specific time":"Activeert de regel periodiek of op een specifieke tijd",Tu:g5,Tuesday:m5,URL:f5,"Unknown error":"Onbekende fout","Unknown error!":"Onbekende fout!","Use generated code":"Gebruik gegenereerde code","User function":"Gebruikersfunctie","User:":"Gebruiker:",Value:$5,"Vibration:":"Trilling:",Volume:b5,We:v5,Wednesday:y5,"Whatsapp-cmb":"Whatsapp-cmb",Write:_5,"Write your own code":"Schrijf je eigen code",Yes:w5,"Yet exists!":"Toch bestaat!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"U kunt %s in de URL gebruiken om de huidige triggerwaarde te gebruiken, %id om de geactiveerde object-ID te gebruiken, %name om de geactiveerde object-ID-naam te tonen of %old om de oude triggerwaarde te gebruiken","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"U kunt %s in de opdracht gebruiken om de huidige triggerwaarde te gebruiken, %id om de getriggerde object-ID te gebruiken, %name om de getriggerde object-ID-naam te tonen of %old om de oude triggerwaarde te gebruiken","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"U kunt %s in de tekst gebruiken om de huidige triggerwaarde weer te geven, %id om de geactiveerde object-ID te gebruiken, %name om de geactiveerde object-ID-naam weer te geven of %old om de oude triggerwaarde te gebruiken","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"U kunt %s in de waarde gebruiken om de huidige triggerwaarde te gebruiken, %id om de geactiveerde object-ID te gebruiken, %name om de geactiveerde object-ID-naam te tonen of %old om de oude triggerwaarde te gebruiken","You have to enter OpenAI API key in the configuration of javascript adapter.":"U moet de OpenAI API-sleutel invoeren in de configuratie van de javascript-adapter.","You have to enter at least one API key in the configuration of javascript adapter.":"U moet ten minste één API-sleutel (OpenAI, Anthropic of Gemini) invoeren in de configuratie van de javascript-adapter.","Please select a valid model":"Selecteer een geldig model","[equal]":"[Gelijk]","[greater or equal]":"[groter of gelijk]","[greater]":"[groter]","[hysteresis]":"[hysterese]","[includes]":"[inclusief]","[less or equal]":"[minder of gelijk]","[less]":"[minder]","[not equal]":"[niet gelijk]",acknowledgment:C5,all:T5,and:k5,astro:S5,at:E5,"clear running":"duidelijk rennen",control:I5,copy:x5,cron:D5,dawn:A5,debug_help:R5,debug_label:O5,default:"standaard",dusk:M5,easy:N5,else:"anders","equal to":"gelijk aan",every:L5,"every hour at 0 minutes":"elk uur op 0 minuten",false:"false","file reading has failed: %s":"bestands lezen is mislukt: %s","file reading was aborted":"bestands lezen is afgebroken",filter_func:P5,filter_id:B5,filter_name:j5,filter_role:F5,filter_room:z5,"for edit or create script":"voor bewerken of een nieuw script maken","for professionals":"voor professionals","for programmers":"voor programmeurs",goldenHour:U5,goldenHourEnd:H5,"greater or equal":"groter of gelijk","greater or equal to":"groter of gelijk aan","greater than":"groter dan",help_just_check:W5,help_on_change:V5,"high priority":"hoge prioriteit","high-priority":"hoge prioriteit","highest priority":"hoogste prioriteit",hours:G5,includes:K5,interval:Y5,"just check":"kijk maar","less or equal":"minder of gelijk","less or equal to":"minder of gelijk aan","less than":"minder dan","lower priority":"lagere prioriteit","lowest priority":"laagste prioriteit",magic:J5,milliseconds:q5,minutes:X5,ms:Z5,nadir:Q5,nauticalDawn:e3,nauticalDusk:t3,nextSunrise:s3,nextSunset:o3,night:i3,nightEnd:n3,"no blocks found":"Geen blokken gevonden","no group":"GEEN GROEP",normal:r3,"normal priority":"normale prioriteit","not equal to":"niet gelijk aan","not properly connected":"Dit blok is niet correct verbonden met andere blokken.",offset:a3,"on change":"bij verandering","on condition change":"op voorwaarde verandering","on update":"bij update",one:l3,or:c3,quiet:u3,"reset search":"reset zoeken",search:d3,seconds:h3,solarNoon:p3,"store in":"opslaan in",sunrise:g3,sunriseEnd:m3,sunset:f3,sunsetStart:$3,then:b3,"toggle value":"schakelwaarde",tooltip_ack:v3,tooltip_from:y3,tooltip_lc:_3,tooltip_quality:w3,tooltip_ts:C3,tooltip_user:T3,tooltip_value:k3,true:"waar",two:S3,undefined:"ongedefinieerd",update:E3,"use seconds":"gebruik seconden","use trigger value":"triggerwaarde gebruiken",verbose_help:I3,verbose_label:x3,when:D3,with:"met","with date":"met datum","with offset":"met offset",wizard:A3,"Loading models...":"Modellen laden...","Could not connect to API at %s":"Kan geen verbinding maken met API op %s","Invalid API key":"Ongeldige API-sleutel","Access denied by API":"Toegang geweigerd door API","API error: %s":"API-fout: %s",'Model "%s" not found':'Model "%s" niet gevonden',"Request failed: %s":"Verzoek mislukt: %s",Retry:R3,"No running javascript instance found":"Geen draaiende JavaScript-instantie gevonden"},M3="Potwierdzony",N3="Działania",L3="Dodaj",P3="Wszystko",B3="Każdy",j3="Zastosuj",F3="Kwiecień",z3="Zapytać",U3="Astronomiczny",H3="Sierpień",W3="Odwołaj",V3="Zamknij",G3="Stan",K3="Warunki",Y3="Konsola",J3="Skopiowano",q3="Grudzień",X3="Domyślna",Z3="Opóźnienie",Q3="Usuń",e4="Opis",t4="Gotowe",s4="Uruchom shell",o4="Wyjaśnienie",i4="Eksport",n4="Luty",r4="Luty",a4="Filtr",l4="Folder",c4="Pt",u4="Piątek",d4="ID",h4="ID1",p4="ID2",g4="Import",m4="Instancja",f4="Instancje",$4="Instrukcje",b4="Styczeń",v4="Styczeń",y4="Lipiec",_4="Czerwiec",w4="Limit",C4="Marzec",T4="Maj",k4="Menu",S4="Wiadomość",E4="Po",I4="Model",x4="Poniedziałek",D4="Miesiąc",A4="Więcej",R4="Nazwa",O4="Listopad",M4="OK",N4="Październik",L4="Ok",P4="Pauza",B4="Pushover",j4="Pushsafer",F4="Przemianuj",z4="Powtórz",U4="Uruchom ponownie",H4="Wynik",W4="So",V4="Sobota",G4="Zapisz",K4="Harmonogram",Y4="Skrypt",J4="Wrzesień",q4="Symulacja",X4="Stos",Z4="Początek",Q4="Stan",e8="Nd",t8="Niedziela",s8="Telegram",o8="Cz",i8="Czwartek",n8="Czas",r8="Wyzwolony",a8="Wyzwalacze",l8="Wt",c8="Wtorek",u8="URL",d8="Wartość",h8="Wolumen",p8="Śr",g8="Środa",m8="Pisać",f8="Tak",$8="potwierdzenie",b8="wszystko",v8="i",y8="Astro",_8="w",w8="kontrola",C8="Kopiuj",T8="CRON",k8="Świt",S8="Jest to specjalny tryb, w którym stany i obiekty się nie zmieniają. Jednak w protokole będą wyświetlane tylko informacje o każdej planowanej zmianie.",E8="Odpluskwić",I8="Zmierzch",x8="łatwy",D8="każdy",A8="Funkcja",R8="ID",O8="Nazwa",M8="Rola",N8="Pokój",L8="Złota godzina",P8="Koniec złotej godziny",B8="Kod zostanie wykonany tylko za każdym razem, gdy warunek będzie spełniony. Na przykład. jeśli wyzwalanie na wartość czujnika temperatury i warunek to „jeśli temperatura jest wyższa niż 20 ° C”, to działania „następnie” będą wykonywane za każdym razem, gdy czujnik wyśle temperaturę i jest powyżej 20 ° C. O 21 ° C, o 22 ° C i tak dalej.",j8="Kod zostanie wykonany tylko wtedy, gdy wynik warunku ulegnie zmianie. Na przykład. jeśli wyzwalanie na wartość czujnika temperatury i warunek „jeśli temperatura jest wyższa niż 20 ° C”, to akcje „następnie” zostaną wykonane raz, gdy temperatura przekroczy 20. Następnym razem działania „następnie” zostaną wykonane, gdy temperatura nie udaje się poniżej 20, a następnie ponownie wzrasta powyżej 20.",F8="godziny",z8="zawiera",U8="interwał",H8="magia",W8="milisekund",V8="minuty",G8="ms",K8="Północ słoneczna",Y8="Żeglarski świt",J8="Żeglarski zmierzch",q8="Następny wschód słońca",X8="Następny zachód słońca",Z8="Noc",Q8="Koniec nocy",e6="normalny",t6="przesunięcie",s6="jeden",o6="lub",i6="cisza",n6="Szukaj",r6="sekundy",a6="Południe słoneczne",l6="Wschód słońca",c6="Koniec wschodu słońca",u6="Zachód słońca",d6="Początek zachodu słońca",h6="następnie",p6="Akceptuj",g6="Od",m6="Ostatnia zmiana",f6="Jakość",$6="Znacznik czasu",b6="Użytkownik",v6="Wartość",y6="dwa",_6="aktualizacja",w6="Dodaje wyniki debugowania do dziennika dla wielu poleceń systemowych",C6="Pełne dane wyjściowe dziennika",T6="gdy",k6="Wizard",S6="Ponów próbę",E6={"%s not found":"%s nie znaleziono","()":"()","(at %s)":"(w %s)","(optional)":"(opcjonalny)","-":"-",".":".","AI code generator":"Generator kodu AI",Ack:M3,Actions:N3,"Actual time of day":"Aktualna pora dnia",Add:L3,"Add new script":"Dodaj nowy skrypt",All:P3,"All files will be accepted":"Wszystkie pliki zostaną zaakceptowane",Any:B3,"Any month":"Dowolny miesiąc",Apply:j3,April:F3,"Are you sure?":"Jesteś pewny?",Ask:z3,Astronomical:U3,"Astronomical events today":"Wydarzenia astronomiczne dzisiaj",August:H3,"Blockly description":"Tworzenie reguł za pomocą bloków graficznych","Body:":"Treść:",Cancel:W3,"Cannot delete non empty item!":"Nie można usunąć niepustego elementu!","Change layout":"Zmiana układu",'Change theme (actual "%s")':"Zmień motyw (obecnie - „%s”)","Check blocks":"Sprawdź bloki","Check is not active, because javascript adapter is disabled":"Sprawdzanie nie jest aktywne, ponieważ adapter Javascript jest wyłączony","Clear search input":"Wyczyść dane wyszukiwania","Click on this icon":"Kliknij tę ikonę",Close:V3,"Close all but current":"Zamknij wszystkie oprócz bieżących","Collapse all":"Zwinąć wszystkie","Compares current time with astronomical event":"Porównuje aktualny czas z wydarzeniem astronomicznym","Compares current time with the user specific time":"Porównuje aktualny czas z czasem określonym przez użytkownika","Compares the state value with user defined value":"Porównuje wartość stanu z wartością zdefiniowaną przez użytkownika",Condition:G3,Conditions:K3,"Configuration not saved.":"Konfiguracja nie została zapisana.",Console:Y3,"Control or update some state":"Kontroluj lub aktualizuj stan","Control or update some state with delay":"Kontroluj lub aktualizuj jakiś stan z opóźnieniem","Convert blockly to javascript for ever.":"Bezpowrotna konwersja Blockly na Javascript.",Copied:J3,"Copy script":"Skopiuj skrypt","Copy to clipboard":"Skopiuj do schowka","Create new":"Utwórz nowy","Create new folder":"Utwórz nowy folder","Create new script":"Utwórz nowy skrypt","Create or edit CRON or time wizard":"Utwórz lub edytuj CRON lub kreator czasu","Dark Theme":"Ciemny schemat","Dark style":"Ciemny styl",Date:"Data","Debug instance":"Debuguj instancję","Debug options":"Opcje debugowania",December:q3,Default:X3,"Define cron...":"Zdefiniuj CRON ...","Define schedule...":"Zdefiniuj harmonogram ...",Delay:Z3,Delete:Q3,"Delete %s":"Usuń %s ...","Delete folder":"Usuń folder","Delete script":"Usuń skrypt",Description:e4,"Deselect all":"Odznacz wszystkie","Discard changes for %s":"Odrzuć zmiany dla %s",Done:t4,"Double click to write value":"Kliknij dwukrotnie, aby zapisać wartość","Download as file":"Download jako plik plik","Drop some files here or click...":"Upuść niektóre pliki tutaj lub kliknij ...","Duplicate name":"Duplikat nazwy","Edit script or just double click":"Edytuj skrypt lub po prostu kliknij dwukrotnie","Empty name is not allowed":"Pusta nazwa jest niedozwolona","End search mode":"Zakończ tryb wyszukiwania","Enter your question":"Wpisz swoją prośbę",Error:"Błąd","Error formatting code":"Błąd formatowania kodu","Error was found":"Błąd został znaleziony","Every day":"Codziennie",Exec:s4,"Executes some shell command":"Wykonuje polecenie powłoki","Existing scripts will be overwritten.":"Istniejące skrypty zostaną zastąpione.","Expand all":"Rozwiń wszystkie","Expert mode":"Tryb ekspercki",Explanation:o4,Export:i4,"Export all scripts":"Wyeksportuj wszystkie skrypty","Export blocks":"Eksportuj bloki","Export selected blocks":"Eksportuj wybrane bloki",Februar:n4,February:r4,Filter:a4,Folder:l4,Fr:c4,Friday:u4,Function:"Funkcja","Function editor":"Edytor funkcji","Function: executed":"Funkcja: wykonywana","Go to next line":"Przejdź do następnej linii","HTTP Call":"Połączenie HTTP","Hide logs":"Ukryj dzienniki",ID:d4,ID1:h4,ID2:p4,Import:g4,"Import blocks":"Importuj bloki","Import error":"Błąd importowania","Import scripts":"Importuj skrypty","Insert object ID":"Wstaw identyfikator obiektu",Instance:m4,"Instance is disabled":"Instancja jest wyłączona","Instance:":"Instancja:",Instances:f4,Instructions:$4,"Invalid CRON":"Nieprawidłowy CRON","It will not be possible to revert this operation.":"Cofnięcie tej operacji nie będzie możliwe.","JS description":"Tworzenie reguł w Javascript",Januar:b4,January:v4,July:y4,June:_4,"Just check":"Po prostu sprawdź","Language:":"Język:","Learn More":"Ucz się więcej","Light style":"Lekki styl",Limit:w4,"Local time":"Czas lokalny","Locate file":"Znajdź plik","Log outputs":"Log dziennika","Log text":"Tekst dziennika","Log: %s":"Dziennik: %s","Make a HTTP get request":"Złóż żądanie HTTP get","Make a pause between actions":"Zrób przerwę między czynnościami",March:C4,"March ":"Marzec ",May:T4,Menu:k4,Message:S4,Mo:E4,Model:I4,Monday:x4,Month:D4,More:A4,Name:R4,"No API key found":"Nie znaleziono klucza API","No Chat GPT Key found":"Nie znaleziono klucza GPT czatu","No active host found":"Nie znaleziono aktywnego hosta","Nothing found":"Nic nie znaleziono",November:O4,OK:M4,October:N4,Ok:L4,"On condition change":"W przypadku zmiany warunków","On script save or adapter start":"Podczas zapisywania skryptu lub uruchamiania adaptera","On weekdays":"W dni powszednie","Open configuration":"Otwarta konfiguracja","Operate two states":"Obsługuj dwa stany","Operations with two states":"Operacje z dwoma stanami","Paste your blocks here":"Wklej tutaj swoje bloki",Pause:P4,"Pause execution":"Wstrzymaj wykonanie","Pause script":"Wstrzymaj skrypt","Phone:":"Telefon:","Please select object ID...":"Wybierz identyfikator obiektu ...","Press Ctrl+Enter to get the answer":"Naciśnij klawisze Ctrl+Enter, aby uzyskać odpowiedź","Prettify the script":"Upiększ skrypt","Print some text in log":"Wydrukuj tekst w dzienniku","Priority:":"Priorytet:",Pushover:B4,Pushsafer:j4,"Read only ID selected: %s":"Wybrano identyfikator tylko do odczytu: %s",Rename:F4,"Reorder scripts in folders":"Zmień kolejność skryptów w folderach",Repeat:z4,Restart:U4,Result:H4,"Resume execution":"Wznów wykonanie","Root folder":"Folder główny","Rules description":"Twórz reguły z blokami IF, THEN, ELSE","Run script":"Uruchom skrypt",Sa:W4,Saturday:V4,Save:G4,"Save all":"Zapisz wszystko","Say It":"Wypowiedz","Say some text via sayit adapter":"Powiedz tekst przez adapter sayit",Schedule:K4,Script:Y4,"Script %s was modified on disk":"Skrypt %s został zmodyfikowany na dysku","Script is not running":"Skrypt nie działa","Search in scripts":"Szukaj w skryptach","Search...":"Szukaj...","Select all":"Zaznacz wszystko","Send email":"Wysłać email","Sends an email":"Wysyła e-mail","Sends message via Pushsafer":"Wysyła wiadomość przez Pushsafer","Sends message via pushover":"Wysyła wiadomość przez pushover","Sends message via telegram":"Wysyła wiadomość telegramem","Sends message via whatsapp-cmb":"Wysyła wiadomość przez WhatsApp-cmb",September:J4,"Server time":"Czas serwera","Set state action":"Ustaw stan działania","Set with delay":"Ustaw z opóźnieniem","Shell command":"Polecenie powłoki","Show astronomical events":"Pokaż wydarzenia astronomiczne","Show javascript code":"Pokaż kod JavaScript","Show logs":"Pokaż dzienniki","Show only paused scripts":"Pokaż tylko wstrzymane skrypty","Show only running scripts":"Pokaż tylko działające skrypty","Show only scripts with problems":"Pokaż tylko skrypty z problemami",Simulate:q4,"Some files will be rejected":"Niektóre pliki zostaną odrzucone","Sound:":"Dźwięk:",Stack:X4,Start:Z4,"Start script":"Uruchom skrypt",State:Q4,"State condition":"Warunek stanu","Step into function":"Wejdź do funkcji","Step out from function":"Wyjdź z funkcji","Stop on exception":"Zatrzymaj się na wyjątku",Su:e8,"Subject:":"Temat:",Sunday:t8,"TS description":"Tworzenie reguł w Typescript",Telegram:s8,"Text:":"Tekst:",Th:o8,"The script will be stopped and must be activated manually after debugging. Continue?":"Skrypt zostanie zatrzymany i należy go aktywować ręcznie po debugowaniu. Kontyntynuj?","This is advances option. You can write your own code here and it will be executed on trigger":"To jest opcja zaawansowana. Możesz tutaj napisać własny kod, który zostanie wykonany po wyzwoleniu",Thursday:i8,Time:n8,"Time condition":"Warunek czasowy","Title:":"Tytuł:","To:":"Do:","Trigger with value":"Wyzwalacz z wartością",Triggered:r8,Triggers:a8,"Triggers the on script saving or the javascript instance restart":"Uruchamia zapisywanie skryptu lub restart instancji javascript","Triggers the rule on update or change of some state":"Uruchamia regułę przy aktualizacji lub zmianie jakiegoś stanu","Triggers the rule periodically or on some specific time":"Uruchamia regułę okresowo lub w określonym czasie",Tu:l8,Tuesday:c8,URL:u8,"Unknown error":"Nieznany błąd","Unknown error!":"Nieznany błąd!","Use generated code":"Użyj wygenerowanego kodu","User function":"Funkcja użytkownika","User:":"Użytkownik:",Value:d8,"Vibration:":"Wibracja:",Volume:h8,We:p8,Wednesday:g8,"Whatsapp-cmb":"Whatsapp-cmb",Write:m8,"Write your own code":"Napisz swój własny kod",Yes:f8,"Yet exists!":"A jednak istnieje!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Możesz użyć %s w adresie URL, aby użyć bieżącej wartości wyzwalacza, %id, aby użyć wyzwalanego identyfikatora obiektu, %name, aby wyświetlić nazwę identyfikatora wyzwalanego obiektu, lub %old, aby użyć starej wartości wyzwalacza","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Możesz użyć %s w poleceniu, aby użyć bieżącej wartości wyzwalającej, %id, aby użyć identyfikatora wyzwalanego obiektu, %name, aby wyświetlić nazwę identyfikatora wyzwalanego obiektu, lub %old, aby użyć starej wartości wyzwalającej","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Możesz użyć %s w tekście, aby wyświetlić aktualną wartość wyzwalającą, %id, aby użyć identyfikatora wyzwolonego obiektu, %name, aby wyświetlić nazwę identyfikatora wyzwolonego obiektu lub %old, aby użyć starej wartości wyzwalającej","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Możesz użyć %s w wartości, aby użyć bieżącej wartości wyzwalacza, %id, aby użyć identyfikatora wyzwalanego obiektu, %name, aby wyświetlić nazwę identyfikatora wyzwalanego obiektu, lub %old, aby użyć starej wartości wyzwalacza","You have to enter OpenAI API key in the configuration of javascript adapter.":"Należy wprowadzić klucz OpenAI API w konfiguracji adaptera javascript.","You have to enter at least one API key in the configuration of javascript adapter.":"Musisz wprowadzić co najmniej jeden klucz API (OpenAI, Anthropic lub Gemini) w konfiguracji adaptera javascript.","Please select a valid model":"Wybierz prawidłowy model","[equal]":"[równy]","[greater or equal]":"[większe lub równe]","[greater]":"[większe]","[hysteresis]":"[histereza]","[includes]":"[obejmuje]","[less or equal]":"[mniejsze lub równe]","[less]":"[mniejsze]","[not equal]":"[nie równe]",acknowledgment:$8,all:b8,and:v8,astro:y8,at:_8,"clear running":"czyste uruchomienie",control:w8,copy:C8,cron:T8,dawn:k8,debug_help:S8,debug_label:E8,default:"domyślna",dusk:I8,easy:x8,else:"inaczej","equal to":"równy",every:D8,"every hour at 0 minutes":"co godzinę po 0 minutach",false:"fałsz","file reading has failed: %s":"odczyt pliku nie powiódł się: %s","file reading was aborted":"odczyt pliku został przerwany",filter_func:A8,filter_id:R8,filter_name:O8,filter_role:M8,filter_room:N8,"for edit or create script":"do edycji lub utwórz nowy skrypt","for professionals":"dla profesjonalistów","for programmers":"dla programistów",goldenHour:L8,goldenHourEnd:P8,"greater or equal":"większe lub równe","greater or equal to":"więcej lub równo","greater than":"więcej niż",help_just_check:B8,help_on_change:j8,"high priority":"wysoki priorytet","high-priority":"wysoki priorytet","highest priority":"najwyższy priorytet",hours:F8,includes:z8,interval:U8,"just check":"po prostu sprawdź","less or equal":"mniejsze lub równe","less or equal to":"mniej lub równo","less than":"mniej niż","lower priority":"niższy priorytet","lowest priority":"najniższy priorytet",magic:H8,milliseconds:W8,minutes:V8,ms:G8,nadir:K8,nauticalDawn:Y8,nauticalDusk:J8,nextSunrise:q8,nextSunset:X8,night:Z8,nightEnd:Q8,"no blocks found":"Nie znaleziono bloków","no group":"BRAK GRUPY",normal:e6,"normal priority":"normalny priorytet","not equal to":"nie równa się","not properly connected":"Ten blok nie jest poprawnie podłączony do innych bloków.",offset:t6,"on change":"na zmianę","on condition change":"pod warunkiem zmiany warunków","on update":"po aktualizacji",one:s6,or:o6,quiet:i6,"reset search":"zresetuj wyszukiwanie",search:n6,seconds:r6,solarNoon:a6,"store in":"przechowaj w",sunrise:l6,sunriseEnd:c6,sunset:u6,sunsetStart:d6,then:h6,"toggle value":"wartość przełączania",tooltip_ack:p6,tooltip_from:g6,tooltip_lc:m6,tooltip_quality:f6,tooltip_ts:$6,tooltip_user:b6,tooltip_value:v6,true:"prawda",two:y6,undefined:"nieokreślony",update:_6,"use seconds":"użyj sekund","use trigger value":"użyj wartości wyzwalającej",verbose_help:w6,verbose_label:C6,when:T6,with:"z","with date":"z datą","with offset":"z przesunięciem",wizard:k6,"Loading models...":"Ładowanie modeli...","Could not connect to API at %s":"Nie można połączyć się z API pod adresem %s","Invalid API key":"Nieprawidłowy klucz API","Access denied by API":"Odmowa dostępu przez API","API error: %s":"Błąd API: %s",'Model "%s" not found':'Model "%s" nie znaleziony',"Request failed: %s":"Żądanie nie powiodło się: %s",Retry:S6,"No running javascript instance found":"Nie znaleziono uruchomionej instancji JavaScript"},I6="Reconhecido",x6="Ações",D6="Adicionar",A6="Todos",R6="Nenhum",O6="Aplique",M6="abril",N6="Perguntar",L6="Astronômico",P6="agosto",B6="Cancelar",j6="Fechar",F6="Doença",z6="Condições",U6="Console",H6="Copiado",W6="dezembro",V6="Predefinição",G6="Atraso",K6="Deletar",Y6="Descrição",J6="Pronto",q6="Exec shell",X6="Explicação",Z6="Exportação",Q6="Februar",e9="fevereiro",t9="Filtro",s9="Pasta",o9="Fr",i9="Sexta-feira",n9="ID",r9="ID1",a9="ID2",l9="Importar",c9="Instância",u9="Instâncias",d9="Instruções",h9="Januar",p9="janeiro",g9="julho",m9="junho",f9="Limite",$9="março",b9="maio",v9="Menu",y9="mensagem",_9="Mo",w9="Modelo",C9="Segunda-feira",T9="Mês",k9="Mais",S9="Nome",E9="novembro",I9="OK",x9="outubro",D9="Ok",A9="Pausa",R9="Pushover",O9="Pushsafer",M9="Renomear",N9="Repetir",L9="Reiniciar",P9="Resultado",B9="Sá",j9="Sábado",F9="Salve",z9="Cronograma",U9="Script",H9="setembro",W9="Simular",V9="Pilha",G9="Começar",K9="Estado",Y9="Su",J9="Domingo",q9="Telegrama",X9="4",Z9="Quinta-feira",Q9="Tempo",e7="Provocado",t7="Gatilhos",s7="Tu",o7="terça",i7="URL",n7="Valor",r7="Volume",a7="3",l7="quarta",c7="Escrever",u7="sim",d7="reconhecimento",h7="todos",p7="e",g7="astro",m7="no",f7="ao controle",$7="copiar",b7="CRON",v7="alvorecer",y7="Este é um modo especial no qual estados e objetos não serão alterados. Mas apenas as informações sobre cada mudança planejada serão exibidas no protocolo.",_7="Depurar",w7="Crepúsculo",C7="fácil",T7="cada",k7="Função",S7="ID",E7="Nome",I7="Tipo",x7="Quarto",D7="Hora dourada",A7="Fim da hora de ouro",R7='O código será executado apenas sempre que a condição for verdadeira. Por exemplo. se disparar no valor do sensor de temperatura e a condição for "se a temperatura for maior que 20 ° C", as ações "então" serão executadas toda vez que o sensor enviar a temperatura e ela estiver acima de 20 ° C. Por 21 ° C, por 22 ° C e assim por diante.',O7='O código será executado apenas se o resultado da condição mudar. Por exemplo. se disparar no valor do sensor de temperatura e a condição for "se a temperatura for maior que 20 ° C", as ações "então" serão executadas uma vez quando a temperatura estiver acima de 20. Na próxima vez, as ações "então" serão executadas quando a temperatura falha abaixo de 20 e sobe acima de 20 novamente.',M7="horas",N7="inclui",L7="intervalo",P7="Magia",B7="milissegundos",j7="minutos",F7="ms",z7="nadir",U7="Madrugada náutica",H7="Crepúsculo náutico",W7="próximo nascer do sol",V7="Próximo pôr do sol",G7="Noite",K7="Fim de noite",Y7="normal",J7="Deslocamento",q7="1",X7="ou",Z7="quieto",Q7="procurar",eK="segundos",tK="Meio-dia solar",sK="nascer do sol",oK="Fim do nascer do sol",iK="pôr do sol",nK="Começo do pôr do sol",rK="então",aK="reconhecer",lK="de",cK="Última alteração",uK="Qualidade",dK="timestamp",hK="usuário",pK="valor",gK="dois",mK="atualizar",fK="Adiciona saída de depuração ao log para muitos comandos do sistema",$K="Saídas de log detalhadas",bK="quando",vK="Wizard",yK="Tentar novamente",_K={"%s not found":"%s não encontrado","()":"()","(at %s)":"(em %s)","(optional)":"(opcional)","-":"-",".":".","AI code generator":"Gerador de código de IA",Ack:I6,Actions:x6,"Actual time of day":"Hora real do dia",Add:D6,"Add new script":"Adicionar novo script",All:A6,"All files will be accepted":"Todos os arquivos serão aceitos",Any:R6,"Any month":"Qualquer mês",Apply:O6,April:M6,"Are you sure?":"Você tem certeza?",Ask:N6,Astronomical:L6,"Astronomical events today":"Eventos astronômicos hoje",August:P6,"Blockly description":"Criando regras por blocos gráficos","Body:":"Corpo:",Cancel:B6,"Cannot delete non empty item!":"Não pode ser deletar, porque não está vazio!","Change layout":"Alterar layout",'Change theme (actual "%s")':'Alterar tema (agora - "%s")',"Check blocks":"Verificar blocos","Check is not active, because javascript adapter is disabled":"A verificação de sintaxe não está ativa porque o adaptador javascript não está rodando.","Clear search input":"Limpar entrada de pesquisa","Click on this icon":"Clique neste ícone",Close:j6,"Close all but current":"Fechar tudo, menos atual","Collapse all":"Recolher todos","Compares current time with astronomical event":"Compara o tempo atual com o evento astronômico","Compares current time with the user specific time":"Compara a hora atual com a hora específica do usuário","Compares the state value with user defined value":"Compara o valor do estado com o valor definido pelo usuário",Condition:F6,Conditions:z6,"Configuration not saved.":"Configuração não esta salva.",Console:U6,"Control or update some state":"Controlar ou atualizar algum estado","Control or update some state with delay":"Controlar ou atualizar algum estado com atraso","Convert blockly to javascript for ever.":"Converter Blockly em Javascript permanentemente.",Copied:H6,"Copy script":"Copiar script","Copy to clipboard":"Copiar para área de transferência","Create new":"Crie um novo","Create new folder":"Criar nova pasta","Create new script":"Criar novo script","Create or edit CRON or time wizard":"Criar ou editar o assistente cron ou o assistente de horário","Dark Theme":"Layout escuro","Dark style":"Estilo escuro",Date:"Encontro","Debug instance":"Instância de depuração","Debug options":"Opções de depuração",December:W6,Default:V6,"Define cron...":"Definir cron...","Define schedule...":"Definir agendamento ...",Delay:G6,Delete:K6,"Delete %s":"Deletar %s...","Delete folder":"Deletar pasta","Delete script":"Deletar script",Description:Y6,"Deselect all":"Desmarcar todos","Discard changes for %s":"Descartar alterações para %s",Done:J6,"Double click to write value":"Clique duas vezes para escrever o valor","Download as file":"Baixar como arquivo","Drop some files here or click...":"Solte alguns arquivos aqui ou clique em...","Duplicate name":"Nome duplicado","Edit script or just double click":"Edite o script ou clique duas vezes","Empty name is not allowed":"Nome vazio não é permitido","End search mode":"Finalizar modo de pesquisa","Enter your question":"Digite sua solicitação",Error:"Erro","Error formatting code":"Erro de formatação de código","Error was found":"Erro foi encontrado","Every day":"Todos os dias",Exec:q6,"Executes some shell command":"Executa algum comando shell","Existing scripts will be overwritten.":"Os scripts existentes serão substituídos.","Expand all":"Expandir todos","Expert mode":"Modo de especialista",Explanation:X6,Export:Z6,"Export all scripts":"Exportar todos os scripts","Export blocks":"Exportar blocos","Export selected blocks":"Exportar blocos selecionados",Februar:Q6,February:e9,Filter:t9,Folder:s9,Fr:o9,Friday:i9,Function:"Função","Function editor":"Editor de funções","Function: executed":"Função: executado","Go to next line":"Vá para a próxima linha","HTTP Call":"Chamada HTTP","Hide logs":"Ocultar logs",ID:n9,ID1:r9,ID2:a9,Import:l9,"Import blocks":"Importar blocos","Import error":"Erro de importação","Import scripts":"Importar script","Insert object ID":"Inserir ID do objeto",Instance:c9,"Instance is disabled":"Instância está desativada","Instance:":"Instância:",Instances:u9,Instructions:d9,"Invalid CRON":"CRON inválido","It will not be possible to revert this operation.":"Não será possível reverter esta operação.","JS description":"Criando regras escrevendo Javascript",Januar:h9,January:p9,July:g9,June:m9,"Just check":"Apenas verifique","Language:":"Língua:","Learn More":"Aprender mais","Light style":"Estilo claro",Limit:f9,"Local time":"Hora local","Locate file":"Localize o arquivo","Log outputs":"Saídas de log","Log text":"Texto de registro","Log: %s":"Log: %s","Make a HTTP get request":"Faça uma solicitação HTTP get","Make a pause between actions":"Faça uma pausa entre as ações",March:$9,"March ":"Março",May:b9,Menu:v9,Message:y9,Mo:_9,Model:w9,Monday:C9,Month:T9,More:k9,Name:S9,"No API key found":"Nenhuma chave API encontrada","No Chat GPT Key found":"Nenhuma chave GPT de bate-papo encontrada","No active host found":"Nenhum host ativo encontrado","Nothing found":"Nada encontrado",November:E9,OK:I9,October:x9,Ok:D9,"On condition change":"Na mudança de condição","On script save or adapter start":"Ao salvar o script ou iniciar o adaptador","On weekdays":"Nos dias úteis","Open configuration":"Configuração aberta","Operate two states":"Operar dois estados","Operations with two states":"Operações com dois estados","Paste your blocks here":"Cole seus blocos aqui",Pause:A9,"Pause execution":"Pausar a execução","Pause script":"Pausar script","Phone:":"Telefone:","Please select object ID...":"Selecione o ID do objeto...","Press Ctrl+Enter to get the answer":"Pressione Ctrl+Enter para obter a resposta","Prettify the script":"Embeleze o roteiro","Print some text in log":"Imprimir algum texto no log","Priority:":"Prioridade:",Pushover:R9,Pushsafer:O9,"Read only ID selected: %s":"ID somente leitura selecionada: %s",Rename:M9,"Reorder scripts in folders":"Reordenar scripts em pastas",Repeat:N9,Restart:L9,Result:P9,"Resume execution":"Retomar execução","Root folder":"Pasta principal","Rules description":"Crie regras com blocos IF, THEN, ELSE","Run script":"Executar script",Sa:B9,Saturday:j9,Save:F9,"Save all":"Salvar tudo","Say It":"Say It","Say some text via sayit adapter":"Diga algum texto através do adaptador sayit",Schedule:z9,Script:U9,"Script %s was modified on disk":'O script "%s" foi modificado no disco rígido',"Script is not running":"Script não está sendo executado","Search in scripts":"Pesquisa em scripts","Search...":"Procurar...","Select all":"Selecionar tudo","Send email":"Enviar email","Sends an email":"Envia um email","Sends message via Pushsafer":"Envia mensagem via Pushsafer","Sends message via pushover":"Envia mensagem via pushover","Sends message via telegram":"Envia mensagem via telegrama","Sends message via whatsapp-cmb":"Envia mensagem via whatsapp-cmb",September:H9,"Server time":"Tempo de servidor","Set state action":"Definir ação de estado","Set with delay":"Definido com atraso","Shell command":"Comando shell","Show astronomical events":"Mostrar eventos astronômicos","Show javascript code":"Mostrar código Javascript","Show logs":"Mostrar logs","Show only paused scripts":"Mostrar apenas scripts pausados","Show only running scripts":"Mostrar apenas scripts em execução","Show only scripts with problems":"Mostrar apenas scripts com problemas",Simulate:W9,"Some files will be rejected":"Alguns arquivos serão rejeitados","Sound:":"Som:",Stack:V9,Start:G9,"Start script":"Iniciar script",State:K9,"State condition":"Condição de estado","Step into function":"Entre na função","Step out from function":"Saia da função","Stop on exception":"Pare na exceção",Su:Y9,"Subject:":"Sujeito:",Sunday:J9,"TS description":"Criando regras escrevendo Typecript",Telegram:q9,"Text:":"Texto:",Th:X9,"The script will be stopped and must be activated manually after debugging. Continue?":"O script será interrompido e deve ser ativado manualmente após a depuração. Continuar?","This is advances option. You can write your own code here and it will be executed on trigger":"Esta é a opção de avanços. Você pode escrever seu próprio código aqui e ele será executado no gatilho",Thursday:Z9,Time:Q9,"Time condition":"Condição de tempo","Title:":"Título:","To:":"Para:","Trigger with value":"Trigger com valor",Triggered:e7,Triggers:t7,"Triggers the on script saving or the javascript instance restart":"Aciona o salvamento do script ou a reinicialização da instância javascript","Triggers the rule on update or change of some state":"Aciona a regra na atualização ou mudança de algum estado","Triggers the rule periodically or on some specific time":"Aciona a regra periodicamente ou em algum momento específico",Tu:s7,Tuesday:o7,URL:i7,"Unknown error":"Erro desconhecido","Unknown error!":"Erro desconhecido!","Use generated code":"Usar código gerado","User function":"Função do usuário","User:":"Do utilizador:",Value:n7,"Vibration:":"Vibração:",Volume:r7,We:a7,Wednesday:l7,"Whatsapp-cmb":"Whatsapp-cmb",Write:c7,"Write your own code":"Escreva seu próprio código",Yes:u7,"Yet exists!":"Ainda existe!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Você pode usar %s na URL para usar o valor do gatilho atual, %id para usar o ID do objeto acionado, %name para mostrar o nome do ID do objeto acionado ou %old para usar o valor do gatilho antigo","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Você pode usar %s no comando para usar o valor do acionador atual, %id para usar o ID do objeto acionado, %name para mostrar o nome do ID do objeto acionado ou %old para usar o valor do acionador antigo","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Você pode usar %s no texto para exibir o valor do acionador atual, %id para usar o ID do objeto acionado, %name para mostrar o nome do ID do objeto acionado ou %old para usar o valor do acionador antigo","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Você pode usar %s no valor para usar o valor do acionador atual, %id para usar o ID do objeto acionado, %name para mostrar o nome do ID do objeto acionado ou %old para usar o valor do acionador antigo","You have to enter OpenAI API key in the configuration of javascript adapter.":"Você deve inserir a chave da API OpenAI na configuração do adaptador javascript.","You have to enter at least one API key in the configuration of javascript adapter.":"Você deve inserir pelo menos uma chave API (OpenAI, Anthropic ou Gemini) na configuração do adaptador javascript.","Please select a valid model":"Selecione um modelo válido","[equal]":"[igual]","[greater or equal]":"[maior ou igual]","[greater]":"[maior]","[hysteresis]":"[histerese]","[includes]":"[inclui]","[less or equal]":"[menor ou igual]","[less]":"[menos]","[not equal]":"[não igual]",acknowledgment:d7,all:h7,and:p7,astro:g7,at:m7,"clear running":"corrida limpa",control:f7,copy:$7,cron:b7,dawn:v7,debug_help:y7,debug_label:_7,default:"predefinição",dusk:w7,easy:C7,else:"outro","equal to":"igual a",every:T7,"every hour at 0 minutes":"a cada hora em 0 minutos",false:"falso","file reading has failed: %s":"a leitura do arquivo falhou: %s","file reading was aborted":"a leitura do arquivo foi abortada",filter_func:k7,filter_id:S7,filter_name:E7,filter_role:I7,filter_room:x7,"for edit or create script":"para editar ou criar um novo script","for professionals":"para profissionais","for programmers":"para programadores",goldenHour:D7,goldenHourEnd:A7,"greater or equal":"maior ou igual","greater or equal to":"maior ou igual a","greater than":"Maior que",help_just_check:R7,help_on_change:O7,"high priority":"prioridade máxima","high-priority":"prioridade máxima","highest priority":"Prioridade máxima",hours:M7,includes:N7,interval:L7,"just check":"Apenas verifique","less or equal":"menor ou igual","less or equal to":"menor ou igual a","less than":"Menor que","lower priority":"prioridade mais baixa","lowest priority":"prioridade mais baixa",magic:P7,milliseconds:B7,minutes:j7,ms:F7,nadir:z7,nauticalDawn:U7,nauticalDusk:H7,nextSunrise:W7,nextSunset:V7,night:G7,nightEnd:K7,"no blocks found":"Nenhum bloco encontrado","no group":"SEM GRUPO",normal:Y7,"normal priority":"prioridade normal","not equal to":"não é igual a","not properly connected":"Este bloco não está conectado corretamente com outros blocos.",offset:J7,"on change":"em mudança","on condition change":"na mudança de condição","on update":"em atualização",one:q7,or:X7,quiet:Z7,"reset search":"redefinir pesquisa",search:Q7,seconds:eK,solarNoon:tK,"store in":"armazenar em",sunrise:sK,sunriseEnd:oK,sunset:iK,sunsetStart:nK,then:rK,"toggle value":"valor de alternância",tooltip_ack:aK,tooltip_from:lK,tooltip_lc:cK,tooltip_quality:uK,tooltip_ts:dK,tooltip_user:hK,tooltip_value:pK,true:"verdade",two:gK,undefined:"Indefinido",update:mK,"use seconds":"use segundos","use trigger value":"use o gatilho",verbose_help:fK,verbose_label:$K,when:bK,with:"com","with date":"com data","with offset":"com deslocamento",wizard:vK,"Loading models...":"Carregando modelos...","Could not connect to API at %s":"Não foi possível conectar à API em %s","Invalid API key":"Chave API inválida","Access denied by API":"Acesso negado pela API","API error: %s":"Erro de API: %s",'Model "%s" not found':'Modelo "%s" não encontrado',"Request failed: %s":"Solicitação falhou: %s",Retry:yK,"No running javascript instance found":"Nenhuma instância JavaScript em execução encontrada"},wK="Подтверждение",CK="Действия",TK="Добавить",kK="Все",SK="Любая",EK="Применить",IK="Апрель",xK="Спросить",DK="Aстрономический",AK="Август",RK="Отмена",OK="Закрыть",MK="Условие",NK="Условия",LK="Приставка",PK="Скопировано",BK="Декабрь",jK="Дефолт",FK="Задержка",zK="Удалить",UK="Описание",HK="Готово",WK="Исполнить shell",VK="Объяснение",GK="Экспорт",KK="Февраль",YK="Февраль",JK="Фильтр",qK="Папка",XK="Пт",ZK="пятница",QK="ID",eY="ID1",tY="ID2",sY="Импорт",oY="Экземпляр",iY="Экземпляры",nY="Инструкции",rY="Январь",aY="Январь",lY="Июль",cY="Июнь",uY="Предел",dY="Март",hY="Май",pY="Меню",gY="Сообщение",mY="Пн",fY="Модель",$Y="понедельник",bY="Месяц",vY="Более",yY="Имя",_Y="Ноябрь",wY="Ок",CY="Октябрь",TY="Ok",kY="Пауза",SY="Pushover",EY="Pushsafer",IY="Переименовать",xY="Повторение",DY="Перезапустить",AY="Результат",RY="Сб",OY="суббота",MY="Сохранить",NY="Расписание",LY="скрипт",PY="Сентябрь",BY="Симулировать",jY="Stack",FY="Начинать",zY="Состояние",UY="Вс",HY="Воскресенье",WY="Telegram",VY="Чт",GY="Четверг",KY="Время",YY="Срабатывает",JY="Триггеры",qY="Вт",XY="вторник",ZY="URL",QY="Значение",eJ="Громкость",tJ="Ср",sJ="среда",oJ="Напишите",iJ="Да",nJ="подтверждение",rJ="все",aJ="и",lJ="Астро",cJ="в",uJ="контроль",dJ="копия",hJ="CRON",pJ="Рассвет",gJ="Это особый режим, в котором состояния и объекты не будут меняться. Но в протоколе будет отображаться только информация о каждом планируемом изменении.",mJ="Отлаживать",fJ="Сумерки",$J="легкий",bJ="каждые(ый)",vJ="Функция",yJ="ID",_J="Название",wJ="Роль",CJ="Комната",TJ="Золотой час",kJ="Конец золотого часа",SJ="Код будет выполняться только каждый раз, когда условие истинно. Например. при срабатывании по значению датчика температуры и условию «если температура выше 20°C», действия «затем» будут выполняться каждый раз, когда датчик отправляет значение температуры, и оно превышает 20°C. На 21°С, на 22°С и так далее.",EJ="Код будет выполнен только в случае изменения результата условия. Например, при срабатывании по значению датчика температуры и условию «если температура больше 20°C», действия «затем» будут выполнены один раз, когда температура превысит 20°C. В следующий раз действия «затем» будут выполнены, когда температура опустится ниже 20°C, а затем снова поднимается выше 20°C.",IJ="час(ов)",xJ="содержит",DJ="интервал",AJ="магия",RJ="миллисекунды",OJ="минут(у)",MJ="мс",NJ="Надир",LJ="Морской рассвет",PJ="Морские сумерки",BJ="Следующий восход",jJ="Следующий закат",FJ="Ночь",zJ="Конец ночи",UJ="нормальный",HJ="сдвиг",WJ="один",VJ="или",GJ="тихий",KJ="поиск",YJ="секунд",JJ="Солнечный полдень",qJ="Восход солнца",XJ="Конец восхода",ZJ="Закат солнца",QJ="Начало заката",eq="тогда",tq="Подтверждено",sq="От",oq="Последнее изменение",iq="Качественный",nq="Время",rq="Пользователь",aq="Значение",lq="два",cq="обновить",uq="Добавляет вывод отладки в журнал для многих системных команд.",dq="Подробный протокол",hq="если",pq="Мастер",gq="Повторить",mq={"%s not found":"%s не найден","()":"()","(at %s)":"(в %s)","(optional)":"(необязательный)","-":"-",".":".","AI code generator":"ИИ Генератор кода",Ack:wK,Actions:CK,"Actual time of day":"Фактическое время суток",Add:TK,"Add new script":"Добавить новый скрипт",All:kK,"All files will be accepted":"Все файлы будут приняты",Any:SK,"Any month":"В любой месяц",Apply:EK,April:IK,"Are you sure?":"Вы уверены?",Ask:xK,Astronomical:DK,"Astronomical events today":"Астрономические события сегодня",August:AK,"Blockly description":"Создание правил графическими блоками","Body:":"Тело:",Cancel:RK,"Cannot delete non empty item!":"Не удается удалить непустой элемент!","Change layout":"Изменить макет",'Change theme (actual "%s")':'Сменить тему (сейчас - "%s")',"Check blocks":"Проверить блоки","Check is not active, because javascript adapter is disabled":"Проверка неактивна, потому что адаптер Javascript отключен","Clear search input":"Очистить ввод","Click on this icon":"Нажмите на этот значок",Close:OK,"Close all but current":"Закрыть все кроме текущего","Collapse all":"Свернуть все","Compares current time with astronomical event":"Сравнивает текущее время с астрономическим событием","Compares current time with the user specific time":"Сравнивает текущее время с конкретным временем пользователя","Compares the state value with user defined value":"Сравнивает значение состояния с пользовательским значением",Condition:MK,Conditions:NK,"Configuration not saved.":"Конфигурация не сохранена.",Console:LK,"Control or update some state":"Контролировать или обновлять какое-то состояние","Control or update some state with delay":"Контролировать или обновлять какое-либо состояние с задержкой","Convert blockly to javascript for ever.":"Преобразовать blockly в Javascript навсегда.",Copied:PK,"Copy script":"Скопировать скрипт","Copy to clipboard":"Скопировать в буфер обмена","Create new":"Создать новый","Create new folder":"Создать новую папку","Create new script":"Создать новый скрипт","Create or edit CRON or time wizard":"Создание или редактирование CRON или мастера времени","Dark Theme":"Тёмная тема","Dark style":"Темный стиль",Date:"Дата","Debug instance":"Экземпляр отладки","Debug options":"Варианты отладки",December:BK,Default:jK,"Define cron...":"Задать правило ...","Define schedule...":"Задать расписание...",Delay:FK,Delete:zK,"Delete %s":"Удалить %s...","Delete folder":"Удалить папку","Delete script":"Удалить скрипт",Description:UK,"Deselect all":"Снять выбор со всех","Discard changes for %s":"Отменить изменения для %s",Done:HK,"Double click to write value":"Двойной щелчок для записи значения","Download as file":"Скачать как файл","Drop some files here or click...":"Перетыщите сюда файлы или нажмите ...","Duplicate name":"Повторяющееся имя","Edit script or just double click":"Редактировать скрипт или просто дважды щелкнуть","Empty name is not allowed":"Пустое имя не допускается","End search mode":"Закончить поиск","Enter your question":"Введи свою просьбу",Error:"Ошибка","Error formatting code":"Ошибка форматирования кода","Error was found":"Ошибка была найдена","Every day":"Каждый день",Exec:WK,"Executes some shell command":"Выполняет некоторую команду оболочки","Existing scripts will be overwritten.":"Существующие скрипты будут перезаписаны.","Expand all":"Открыть все","Expert mode":"Экспертный режим",Explanation:VK,Export:GK,"Export all scripts":"Экспорт всех скриптов","Export blocks":"Экспортировать блоки","Export selected blocks":"Экспортировать выбранные блоки",Februar:KK,February:YK,Filter:JK,Folder:qK,Fr:XK,Friday:ZK,Function:"Функция","Function editor":"Редактор функции","Function: executed":"Функция: выполнено","Go to next line":"Перейти к следующей строке","HTTP Call":"HTTP-вызов","Hide logs":"Скрыть журналы",ID:QK,ID1:eY,ID2:tY,Import:sY,"Import blocks":"Импортировать блоки","Import error":"Ошибка импорта","Import scripts":"Импорт скриптов","Insert object ID":"Вставить ID объекта",Instance:oY,"Instance is disabled":"Экземпляр отключен","Instance:":"Пример:",Instances:iY,Instructions:nY,"Invalid CRON":"Неправильный CRON","It will not be possible to revert this operation.":"Невозможно вернуть эту операцию.","JS description":"Создание правил путём написания Javascript",Januar:rY,January:aY,July:lY,June:cY,"Just check":"Просто проверить","Language:":"Язык:","Learn More":"Узнать больше","Light style":"Светлый стиль",Limit:uY,"Local time":"Местное время","Locate file":"Показать файл в дереве","Log outputs":"Журнал","Log text":"Текст журнала","Log: %s":"Журнал: %s","Make a HTTP get request":"Сделайте HTTP-запрос на получение","Make a pause between actions":"Сделайте паузу между действиями",March:dY,"March ":"Март ",May:hY,Menu:pY,Message:gY,Mo:mY,Model:fY,Monday:$Y,Month:bY,More:vY,Name:yY,"No API key found":"API-ключ не найден","No Chat GPT Key found":"Ключ GPT для чата не найден","No active host found":"Активный host не найден","Nothing found":"Ничего не найдено",November:_Y,OK:wY,October:CY,Ok:TY,"On condition change":"При изменении реузльтата условий","On script save or adapter start":"При сохранении скрипта или запуске адаптера","On weekdays":"По дням недели","Open configuration":"Открыть настройки","Operate two states":"Операции над двумя состояниями","Operations with two states":"Операции с двумя состояниями","Paste your blocks here":"Вставьте свои блоки сюда",Pause:kY,"Pause execution":"Приостановить выполнение","Pause script":"Остановить скрипт","Phone:":"Телефон:","Please select object ID...":"Пожалуйста, выберите ID объекта ...","Press Ctrl+Enter to get the answer":"Нажмите Ctrl+Enter, чтобы получить ответ","Prettify the script":"Украсьте сценарий","Print some text in log":"Напечатать текст в журнале","Priority:":"Приоритет:",Pushover:SY,Pushsafer:EY,"Read only ID selected: %s":"Выбран идентификатор только для чтения: %s",Rename:IY,"Reorder scripts in folders":"Сортировать скрипты в папках",Repeat:xY,Restart:DY,Result:AY,"Resume execution":"Возобновить выполнение","Root folder":"Корневая папка","Rules description":"Создавайте правила с блоками ЕСЛИ, ТО, ИНАЧЕ","Run script":"Запустить скрипт",Sa:RY,Saturday:OY,Save:MY,"Save all":"Сохранить все","Say It":"Say It","Say some text via sayit adapter":"Произнесите текст через адаптер Sayit",Schedule:NY,Script:LY,"Script %s was modified on disk":'Скрипт "%s" был изменен на диске',"Script is not running":"Сценарий не запущен","Search in scripts":"Поиск в скриптах","Search...":"Поиск...","Select all":"Выбрать все","Send email":"Отправить email","Sends an email":"Отправляет электронное письмо","Sends message via Pushsafer":"Отправляет сообщение через Pushsafer","Sends message via pushover":"Отправляет сообщение через пустышку","Sends message via telegram":"Отправляет сообщение в телеграмме","Sends message via whatsapp-cmb":"Отправляет сообщение через whatsapp-cmb",September:PY,"Server time":"Время сервера","Set state action":"Установить состояние","Set with delay":"Установить с задержкой","Shell command":"Команда оболочки","Show astronomical events":"Показать астрономические события","Show javascript code":"Показать код Javascript","Show logs":"Показать журналы","Show only paused scripts":"Показывать только приостановленные сценарии","Show only running scripts":"Показывать только запущенные скрипты","Show only scripts with problems":"Показывать только скрипты с проблемами",Simulate:BY,"Some files will be rejected":"Некоторые файлы будут отклонены","Sound:":"Звук:",Stack:jY,Start:FY,"Start script":"Старт скрипта",State:zY,"State condition":"Сравнение состояния","Step into function":"Шаг в функционирование","Step out from function":"Выйти из функции","Stop on exception":"Остановить при исключении",Su:UY,"Subject:":"Предмет:",Sunday:HY,"TS description":"Создание правил путём написания Typescript",Telegram:WY,"Text:":"Текст:",Th:VY,"The script will be stopped and must be activated manually after debugging. Continue?":"Cкрипт будет остановлен и должен быть активирован вручную после отладки. Продолжать?","This is advances option. You can write your own code here and it will be executed on trigger":"Это расширеный вариант. Вы можете написать здесь свой код и он будет выполняться по триггеру",Thursday:GY,Time:KY,"Time condition":"Условие времени","Title:":"Заголовок:","To:":"К:","Trigger with value":"Триггер со значением",Triggered:YY,Triggers:JY,"Triggers the on script saving or the javascript instance restart":"Запускает при сохранении скрипта или перезапуске экземпляра javascript","Triggers the rule on update or change of some state":"Запускает правило при обновлении или изменении какого-либо состояния","Triggers the rule periodically or on some specific time":"Срабатывает правило периодически или в определенное время",Tu:qY,Tuesday:XY,URL:ZY,"Unknown error":"Неизвестная ошибка","Unknown error!":"Неизвестная ошибка!","Use generated code":"Использовать сгенерированный код","User function":"Функция пользователя","User:":"Пользователь:",Value:QY,"Vibration:":"Вибрация:",Volume:eJ,We:tJ,Wednesday:sJ,"Whatsapp-cmb":"Whatsapp-cmb",Write:oJ,"Write your own code":"Напишите свой код",Yes:iJ,"Yet exists!":"Имя уже существует!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Вы можете использовать %s в URL-адресе, чтобы использовать текущее значение триггера, %id, чтобы использовать идентификатор инициированного объекта, %name, чтобы показать имя идентификатора инициированного объекта, или %old, чтобы использовать старое значение триггера.","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Вы можете использовать %s в команде, чтобы использовать текущее значение триггера, %id, чтобы использовать идентификатор сработавшего объекта, %name, чтобы показать имя сработавшего идентификатора объекта, или %old, чтобы использовать старое значение триггера.","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Вы можете использовать %s в тексте для отображения текущего значения триггера, %id для использования идентификатора сработавшего объекта, %name для отображения имени сработавшего идентификатора объекта или %old для использования старого значения триггера.","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Вы можете использовать %s в значении, чтобы использовать текущее значение триггера, %id, чтобы использовать идентификатор инициированного объекта, %name, чтобы показать имя идентификатора инициированного объекта, или %old, чтобы использовать старое значение триггера.","You have to enter OpenAI API key in the configuration of javascript adapter.":"Вы должны ввести ключ OpenAI API в конфигурации адаптера javascript.","You have to enter at least one API key in the configuration of javascript adapter.":"Необходимо ввести хотя бы один API-ключ (OpenAI, Anthropic или Gemini) в конфигурации адаптера javascript.","Please select a valid model":"Пожалуйста, выберите допустимую модель","[equal]":"[равно]","[greater or equal]":"[больше или равно]","[greater]":"[больше]","[hysteresis]":"[гистерезис]","[includes]":"[содержит]","[less or equal]":"[меньше или равно]","[less]":"[меньше]","[not equal]":"[не равно]",acknowledgment:nJ,all:rJ,and:aJ,astro:lJ,at:cJ,"clear running":"остановить уже бегущие",control:uJ,copy:dJ,cron:hJ,dawn:pJ,debug_help:gJ,debug_label:mJ,default:"дефолт",dusk:fJ,easy:$J,else:"иначе","equal to":"равно",every:bJ,"every hour at 0 minutes":"каждый час через 0 минут",false:"false","file reading has failed: %s":"Ошибка чтения файла: %s","file reading was aborted":"Чтение файла было прервано",filter_func:vJ,filter_id:yJ,filter_name:_J,filter_role:wJ,filter_room:CJ,"for edit or create script":"для редактирования или создайте новый скрипт","for professionals":"для профессионалов","for programmers":"для программистов",goldenHour:TJ,goldenHourEnd:kJ,"greater or equal":"больше или равно","greater or equal to":"больше или равно","greater than":"больше чем",help_just_check:SJ,help_on_change:EJ,"high priority":"высокий приоритет","high-priority":"высокий-приоритет","highest priority":"высший приоритет",hours:IJ,includes:xJ,interval:DJ,"just check":"просто проверить","less or equal":"меньше или равно","less or equal to":"меньше или равно","less than":"меньше, чем","lower priority":"более низкий приоритет","lowest priority":"самый низкий приоритет",magic:AJ,milliseconds:RJ,minutes:OJ,ms:MJ,nadir:NJ,nauticalDawn:LJ,nauticalDusk:PJ,nextSunrise:BJ,nextSunset:jJ,night:FJ,nightEnd:zJ,"no blocks found":"Блоков нет","no group":"Нет группы",normal:UJ,"normal priority":"нормальный приоритет","not equal to":"не равно","not properly connected":"Этот блок неправильно соединён или не соединён с другими блоками.",offset:HJ,"on change":"по изменению","on condition change":"при изменении результата условия","on update":"при обновлении",one:WJ,or:VJ,quiet:GJ,"reset search":"Cбросить поиск",search:KJ,seconds:YJ,solarNoon:JJ,"store in":"сохранить в",sunrise:qJ,sunriseEnd:XJ,sunset:ZJ,sunsetStart:QJ,then:eq,"toggle value":"инвертировать текщее значение",tooltip_ack:tq,tooltip_from:sq,tooltip_lc:oq,tooltip_quality:iq,tooltip_ts:nq,tooltip_user:rq,tooltip_value:aq,true:"true",two:lq,undefined:"неопределенный",update:cq,"use seconds":"использовать секунды","use trigger value":"использовать значение триггера",verbose_help:uq,verbose_label:dq,when:hq,with:"с","with date":"с датой","with offset":"со сдвигом",wizard:pq,"Loading models...":"Загрузка моделей...","Could not connect to API at %s":"Не удалось подключиться к API по адресу %s","Invalid API key":"Недействительный ключ API","Access denied by API":"Доступ запрещён API","API error: %s":"Ошибка API: %s",'Model "%s" not found':'Модель "%s" не найдена',"Request failed: %s":"Запрос не удался: %s",Retry:gq,"No running javascript instance found":"Не найден работающий экземпляр JavaScript"},fq="Визнано",$q="Дії",bq="додати",vq="все",yq="Будь-який",_q="Застосувати",wq="квітень",Cq="Запитуйте",Tq="Астрономічний",kq="серпень",Sq="Скасувати",Eq="Закрити",Iq="Хвороба",xq="Умови",Dq="Консоль",Aq="Скопійовано",Rq="Грудень",Oq="За замовчуванням",Mq="Затримка",Nq="Видалити",Lq="опис",Pq="Готово",Bq="Виконавча оболонка",jq="Пояснення",Fq="Експорт",zq="Лютий",Uq="Лютий",Hq="фільтр",Wq="Папка",Vq="О",Gq="П'ятниця",Kq="ID",Yq="ID1",Jq="ID2",qq="Імпорт",Xq="Екземпляр",Zq="Примірники",Qq="Інструкції",eX="січень",tX="січня",sX="липень",oX="червень",iX="Ліміт",nX="березень",rX="Може",aX="Меню",lX="повідомлення",cX="пн",uX="Модель",dX="понеділок",hX="місяць",pX="Більше",gX="Ім'я",mX="Листопад",fX="в порядку",$X="жовтень",bX="В порядку",vX="Пауза",yX="Pushover",_X="Pushsafer",wX="Перейменувати",CX="Повторіть",TX="Перезапустіть",kX="Результат",SX="Sa",EX="Субота",IX="зберегти",xX="розклад",DX="Сценарій",AX="Вересень",RX="Симулювати",OX="Стек",MX="старт",NX="Держава",LX="Нд",PX="неділя",BX="Телеграма",jX="чт",FX="четвер",zX="час",UX="Спрацьовує",HX="Тригери",WX="вт",VX="вівторок",GX="URL",KX="Значення",YX="Обсяг",JX="ми",qX="Середа",XX="Напишіть",ZX="Так",QX="підтвердження",eZ="все",tZ="і",sZ="Астро",oZ="в",iZ="КОНТРОЛЬ",nZ="копія",rZ="CRON",aZ="Світанок",lZ="Це особливий режим, в якому стану та об'єкти не змінюватимуться. Але в протоколі відображатиметься лише інформація про кожну заплановану зміну.",cZ="Відлагоджувати",uZ="Сутінки",dZ="легко",hZ="кожен",pZ="функція",gZ="ID",mZ="Ім'я",fZ="Роль",$Z="Кімната",bZ="Золота година",vZ="Кінець золотої години",yZ="Код буде виконуватися лише щоразу, коли умова виконується. наприклад якщо спрацьовує значення датчика температури та умова «якщо температура перевищує 20°C», дії «тоді» виконуватимуться щоразу, коли датчик надсилає температуру, і вона перевищує 20°C. На 21°C, на 22°C і так далі.",_Z="Код буде виконано лише у разі зміни результату умови. наприклад якщо спрацьовує значення датчика температури та умова «якщо температура перевищує 20°C», дії «тоді» будуть виконані один раз, коли температура буде вище 20. Наступного разу дії «тоді» буде виконано, коли температура падає нижче 20, а потім знову піднімається вище 20.",wZ="години",CZ="включає в себе",TZ="інтервал",kZ="магія",SZ="мілісекунд",EZ="хвилин",IZ="РС",xZ="Надір",DZ="Морський світанок",AZ="Морські сутінки",RZ="Наступний схід сонця",OZ="Наступний захід сонця",MZ="ніч",NZ="Кінець ночі",LZ="нормально",PZ="зсув",BZ="один",jZ="або",FZ="тихо",zZ="пошук",UZ="секунд",HZ="Сонячний полудень",WZ="схід сонця",VZ="Кінець сходу сонця",GZ="Захід сонця",KZ="Початок заходу сонця",YZ="потім",JZ="Визнати",qZ="Від",XZ="Востаннє змінено",ZZ="якість",QZ="Мітка часу",eQ="Користувач",tQ="Значення",sQ="два",oQ="оновлення",iQ="Додає вихідні дані налагодження до журналу для багатьох системних команд",nQ="Докладні результати журналу",rQ="коли",aQ="майстер",lQ="Повторити",cQ={"%s not found":"%s не знайдено","()":"()","(at %s)":"(у %s)","(optional)":"(необов'язково)","-":"-",".":".","AI code generator":"Генератор коду ШІ",Ack:fq,Actions:$q,"Actual time of day":"Фактичний час доби",Add:bq,"Add new script":"Додати новий сценарій",All:vq,"All files will be accepted":"Усі файли будуть прийняті",Any:yq,"Any month":"Будь-який місяць",Apply:_q,April:wq,"Are you sure?":"Ти впевнений?",Ask:Cq,Astronomical:Tq,"Astronomical events today":"Астрономічні події сьогодні",August:kq,"Blockly description":"Створення правил за графічними блоками","Body:":"Тіло:",Cancel:Sq,"Cannot delete non empty item!":"Неможливо видалити непорожній елемент!","Change layout":"Змінити макет",'Change theme (actual "%s")':'Змінити тему (тепер - "%s")',"Check blocks":"Перевірте блоки","Check is not active, because javascript adapter is disabled":"Перевірка не активна, оскільки адаптер Javascript вимкнено","Clear search input":"Очистити пошуковий запит","Click on this icon":"Натисніть на цей значок",Close:Eq,"Close all but current":"Закрити всі, крім поточних","Collapse all":"Закрити всі","Compares current time with astronomical event":"Порівнює поточний час з астрономічною подією","Compares current time with the user specific time":"Порівнює поточний час із конкретним часом користувача","Compares the state value with user defined value":"Порівнює значення стану з визначеним користувачем значенням",Condition:Iq,Conditions:xq,"Configuration not saved.":"Конфігурація не збережена.",Console:Dq,"Control or update some state":"Контролюйте або оновлюйте певний стан","Control or update some state with delay":"Контролюйте або оновлюйте деякий стан із затримкою","Convert blockly to javascript for ever.":"Назавжди конвертуйте Blockly у Javascript.",Copied:Aq,"Copy script":"Копіювати сценарій","Copy to clipboard":"Копіювати в буфер обміну","Create new":"Створити новий","Create new folder":"Створити нову папку","Create new script":"Створіть новий сценарій","Create or edit CRON or time wizard":"Створення або редагування CRON або майстра часу","Dark Theme":"Темна тема","Dark style":"Темний стиль",Date:"Дата","Debug instance":"Екземпляр налагодження","Debug options":"Параметри налагодження",December:Rq,Default:Oq,"Define cron...":"Визначити cron...","Define schedule...":"Визначити розклад...",Delay:Mq,Delete:Nq,"Delete %s":"Видалити %s...","Delete folder":"Видалити папку","Delete script":"Видалити сценарій",Description:Lq,"Deselect all":"Зняти вибір із усіх","Discard changes for %s":"Скасувати зміни для %s",Done:Pq,"Double click to write value":"Двічі клацніть, щоб записати значення","Download as file":"Завантажити файл","Drop some files here or click...":"Перетягніть кілька файлів сюди або натисніть...","Duplicate name":"Повторюване ім'я","Edit script or just double click":"Відредагуйте сценарій або просто двічі клацніть","Empty name is not allowed":"Порожнє ім'я не допускається","End search mode":"Завершити режим пошуку","Enter your question":"Введи своє прохання",Error:"Помилка","Error formatting code":"Помилка форматування коду","Error was found":"Виявлено помилку","Every day":"Кожен день",Exec:Bq,"Executes some shell command":"Виконує певну команду оболонки","Existing scripts will be overwritten.":"Існуючі сценарії буде перезаписано.","Expand all":"Розгорнути все","Expert mode":"Експертний режим",Explanation:jq,Export:Fq,"Export all scripts":"Експортувати всі сценарії","Export blocks":"Експорт блоків","Export selected blocks":"Експортувати вибрані блоки",Februar:zq,February:Uq,Filter:Hq,Folder:Wq,Fr:Vq,Friday:Gq,Function:"функція","Function editor":"Редактор функцій","Function: executed":"Функція: виконано","Go to next line":"Перейти до наступного рядка","HTTP Call":"Виклик HTTP","Hide logs":"Приховати журнали",ID:Kq,ID1:Yq,ID2:Jq,Import:qq,"Import blocks":"Імпорт блоків","Import error":"Помилка імпорту","Import scripts":"Імпорт скриптів","Insert object ID":"Вставте ID об'єкта",Instance:Xq,"Instance is disabled":"Примірник вимкнено","Instance:":"екземпляр:",Instances:Zq,Instructions:Qq,"Invalid CRON":"Недійсний CRON","It will not be possible to revert this operation.":"Скасувати цю операцію буде неможливо.","JS description":"Створення правил шляхом написання Javascript",Januar:eX,January:tX,July:sX,June:oX,"Just check":"Просто перевірте","Language:":"Мову:","Learn More":"Вивчайте більше","Light style":"Легкий стиль",Limit:iX,"Local time":"Місцевий час","Locate file":"Знайти файл","Log outputs":"Виходи журналу","Log text":"Текст журналу","Log: %s":"Журнал: %s","Make a HTTP get request":"Зробіть HTTP-запит на отримання","Make a pause between actions":"Між діями робіть паузу",March:nX,"March ":"березень",May:rX,Menu:aX,Message:lX,Mo:cX,Model:uX,Monday:dX,Month:hX,More:pX,Name:gX,"No API key found":"API-ключ не знайдено","No Chat GPT Key found":"Ключ GPT для чату не знайдено","No active host found":"Активний хост не знайдено","Nothing found":"Нічого не знайдено",November:mX,OK:fX,October:$X,Ok:bX,"On condition change":"За умови зміни результату","On script save or adapter start":"Під час збереження сценарію або запуску адаптера","On weekdays":"В будні дні","Open configuration":"Відкрита конфігурація","Operate two states":"Керуйте двома станами","Operations with two states":"Операції з двома станами","Paste your blocks here":"Вставте сюди свої блоки",Pause:vX,"Pause execution":"Призупинити виконання","Pause script":"Призупинити сценарій","Phone:":"телефон:","Please select object ID...":"Виберіть ідентифікатор об'єкта...","Press Ctrl+Enter to get the answer":"Натисніть Ctrl+Enter, щоб отримати відповідь","Prettify the script":"Прикрасьте сценарій","Print some text in log":"Надрукувати текст у журналі","Priority:":"Пріоритет:",Pushover:yX,Pushsafer:_X,"Read only ID selected: %s":"Вибрано ідентифікатор лише для читання: %s",Rename:wX,"Reorder scripts in folders":"Зміна порядку сценаріїв у папках",Repeat:CX,Restart:TX,Result:kX,"Resume execution":"Відновити виконання","Root folder":"Коренева папка","Rules description":"Створюйте правила з блоками IF, THEN, ELSE","Run script":"Запустіть сценарій",Sa:SX,Saturday:EX,Save:IX,"Save all":"Зберегти все","Say It":"Скажи це","Say some text via sayit adapter":"Скажіть текст через адаптер sayit",Schedule:xX,Script:DX,"Script %s was modified on disk":"Сценарій %s змінено на диску","Script is not running":"Сценарій не працює","Search in scripts":"Пошук у скриптах","Search...":"пошук...","Select all":"Вибрати все","Send email":"Відправити лист","Sends an email":"Надсилає електронний лист","Sends message via Pushsafer":"Надсилає повідомлення через Pushsafer","Sends message via pushover":"Надсилає повідомлення через pushover","Sends message via telegram":"Надсилає повідомлення через телеграм","Sends message via whatsapp-cmb":"Надсилає повідомлення через whatsapp-cmb",September:AX,"Server time":"Час сервера","Set state action":"Встановити дію стану","Set with delay":"Встановити із затримкою","Shell command":"Команда оболонки","Show astronomical events":"Показати астрономічні події","Show javascript code":"Показати код Javascript","Show logs":"Показати журнали","Show only paused scripts":"Показувати лише призупинені сценарії","Show only running scripts":"Показувати лише запущені сценарії","Show only scripts with problems":"Показувати лише сценарії з проблемами",Simulate:RX,"Some files will be rejected":"Деякі файли буде відхилено","Sound:":"звук:",Stack:OX,Start:MX,"Start script":"Запустити сценарій",State:NX,"State condition":"Стан стану","Step into function":"Крок у функції","Step out from function":"Вийти з функції","Stop on exception":"Зупинка на винятках",Su:LX,"Subject:":"Тема:",Sunday:PX,"TS description":"Створення правил шляхом написання Typescript",Telegram:BX,"Text:":"Текст:",Th:jX,"The script will be stopped and must be activated manually after debugging. Continue?":"Сценарій буде зупинено, і його необхідно активувати вручну після налагодження. Продовжити?","This is advances option. You can write your own code here and it will be executed on trigger":"Це авансовий варіант. Ви можете написати тут свій власний код, і він буде виконано на тригері",Thursday:FX,Time:zX,"Time condition":"Умова часу","Title:":"Назва:","To:":"до:","Trigger with value":"Тригер зі значенням",Triggered:UX,Triggers:HX,"Triggers the on script saving or the javascript instance restart":"Ініціює збереження сценарію або перезапуск екземпляра JavaScript","Triggers the rule on update or change of some state":"Запускає правило при оновленні або зміні якогось стану","Triggers the rule periodically or on some specific time":"Спрацьовує правило періодично або в певний час",Tu:WX,Tuesday:VX,URL:GX,"Unknown error":"Невідома помилка","Unknown error!":"Невідома помилка!","Use generated code":"Використовуйте згенерований код","User function":"Функція користувача","User:":"Користувач:",Value:KX,"Vibration:":"Вібрація:",Volume:YX,We:JX,Wednesday:qX,"Whatsapp-cmb":"Whatsapp-cmb",Write:XX,"Write your own code":"Напишіть власний код",Yes:ZX,"Yet exists!":"Все ж існує!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"Ви можете використовувати %s в URL-адресі, щоб використовувати поточне значення тригера, %id, щоб використовувати ідентифікатор активованого об’єкта, %name, щоб показати назву ідентифікатора активованого об’єкта, або %old, щоб використовувати старе значення тригера","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"Ви можете використовувати %s у команді, щоб використовувати поточне значення тригера, %id, щоб використовувати ідентифікатор активованого об’єкта, %name, щоб показати назву ідентифікатора активованого об’єкта, або %old, щоб використовувати старе значення тригера","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"Ви можете використовувати %s у тексті для відображення поточного значення тригера, %id для використання ідентифікатора активованого об’єкта, %name для відображення імені ідентифікатора активованого об’єкта або %old для використання старого значення тригера","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"Ви можете використовувати %s у значенні, щоб використовувати поточне значення тригера, %id, щоб використовувати ідентифікатор активованого об’єкта, %name, щоб показати назву ідентифікатора активованого об’єкта, або %old, щоб використовувати старе значення тригера","You have to enter OpenAI API key in the configuration of javascript adapter.":"Ви повинні ввести ключ OpenAI API у конфігурації адаптера JavaScript.","You have to enter at least one API key in the configuration of javascript adapter.":"Необхідно ввести хоча б один API-ключ (OpenAI, Anthropic або Gemini) у конфігурації адаптера JavaScript.","Please select a valid model":"Будь ласка, виберіть дійсну модель","[equal]":"[рівний]","[greater or equal]":"[більше або дорівнює]","[greater]":"[більший]","[hysteresis]":"[гістерезис]","[includes]":"[включає]","[less or equal]":"[менше або рівно]","[less]":"[менше]","[not equal]":"[не дорівнює]",acknowledgment:QX,all:eZ,and:tZ,astro:sZ,at:oZ,"clear running":"чіткий біг",control:iZ,copy:nZ,cron:rZ,dawn:aZ,debug_help:lZ,debug_label:cZ,default:"за замовчуванням",dusk:uZ,easy:dZ,else:"інше","equal to":"дорівнює",every:hZ,"every hour at 0 minutes":"щогодини о 0 хвилин",false:"помилковий","file reading has failed: %s":"не вдалося прочитати файл: %s","file reading was aborted":"читання файлу було перервано",filter_func:pZ,filter_id:gZ,filter_name:mZ,filter_role:fZ,filter_room:$Z,"for edit or create script":"для редагування або створення нового сценарію","for professionals":"для професіоналів","for programmers":"для програмістів",goldenHour:bZ,goldenHourEnd:vZ,"greater or equal":"більший або рівний","greater or equal to":"більше або дорівнює","greater than":"більше, ніж, величніше ніж, крутіший за",help_just_check:yZ,help_on_change:_Z,"high priority":"високий пріоритет","high-priority":"високий пріоритет","highest priority":"найвищий пріоритет",hours:wZ,includes:CZ,interval:TZ,"just check":"просто перевірте","less or equal":"менше або дорівнює","less or equal to":"менше або дорівнює","less than":"менше ніж","lower priority":"нижчий пріоритет","lowest priority":"найнижчий пріоритет",magic:kZ,milliseconds:SZ,minutes:EZ,ms:IZ,nadir:xZ,nauticalDawn:DZ,nauticalDusk:AZ,nextSunrise:RZ,nextSunset:OZ,night:MZ,nightEnd:NZ,"no blocks found":"Блоків не знайдено","no group":"НЕМАЄ ГРУПИ",normal:LZ,"normal priority":"нормальний пріоритет","not equal to":"не дорівнює","not properly connected":"Цей блок неправильно з’єднаний з іншими блоками.",offset:PZ,"on change":"на зміну","on condition change":"про зміну умов","on update":"на оновлення",one:BZ,or:jZ,quiet:FZ,"reset search":"скинути пошук",search:zZ,seconds:UZ,solarNoon:HZ,"store in":"зберігати в",sunrise:WZ,sunriseEnd:VZ,sunset:GZ,sunsetStart:KZ,then:YZ,"toggle value":"значення перемикання",tooltip_ack:JZ,tooltip_from:qZ,tooltip_lc:XZ,tooltip_quality:ZZ,tooltip_ts:QZ,tooltip_user:eQ,tooltip_value:tQ,true:"правда",two:sQ,undefined:"невизначений",update:oQ,"use seconds":"використовуйте секунди","use trigger value":"використовувати значення тригера",verbose_help:iQ,verbose_label:nQ,when:rQ,with:"з","with date":"з датою","with offset":"зі зміщенням",wizard:aQ,"Loading models...":"Завантаження моделей...","Could not connect to API at %s":"Не вдалося підключитися до API за адресою %s","Invalid API key":"Недійсний ключ API","Access denied by API":"Доступ заборонено API","API error: %s":"Помилка API: %s",'Model "%s" not found':'Модель "%s" не знайдено',"Request failed: %s":"Запит не вдався: %s",Retry:lQ,"No running javascript instance found":"Не знайдено запущеного екземпляра JavaScript"},uQ="确认",dQ="动作",hQ="添加",pQ="所有",gQ="任何",mQ="申请",fQ="四月",$Q="问",bQ="天文",vQ="八月",yQ="取消",_Q="关闭",wQ="健康)状况",CQ="情况",TQ="安慰",kQ="复制的",SQ="十二月",EQ="默认",IQ="延迟",xQ="删除",DQ="描述",AQ="完成",RQ="执行力",OQ="解释",MQ="导出",NQ="二月",LQ="二月",PQ="筛选",BQ="文件夹",jQ="r",FQ="星期五",zQ="ID",UQ="ID1",HQ="ID2",WQ="导入",VQ="实例",GQ="实例",KQ="指示",YQ="亚努尔",JQ="一月",qQ="七月",XQ="六月",ZQ="限制",QQ="三月",eee="五月",tee="菜单",see="信息",oee="莫",iee="模型",nee="星期一",ree="月",aee="更多的",lee="名称",cee="十一月",uee="好的",dee="十月",hee="确定",pee="暂停",gee="俯卧撑",mee="推安全",fee="重命名",$ee="重复",bee="重启",vee="结果",yee="萨",_ee="星期六",wee="保存",Cee="日程",Tee="脚本",kee="九月",See="模拟",Eee="堆",Iee="开始",xee="状态",Dee="苏",Aee="星期日",Ree="电报",Oee="4",Mee="星期四",Nee="时间",Lee="触发",Pee="扳机",Bee="涂",jee="星期二",Fee="网址",zee="价值",Uee="体积",Hee="3",Wee="星期三",Vee="写",Gee="是的",Kee="致谢",Yee="全部",Jee="和",qee="天文",Xee="在",Zee="控制",Qee="复制",ete="克朗",tte="黎明",ste="这是一种特殊模式,其中状态和对象不会改变。但只有有关每个计划更改的信息才会显示在协议中。",ote="调试",ite="黄昏",nte="简单的",rte="每一个",ate="功能",lte="ID",cte="名字",ute="角色",dte="房间",hte="黄金时段",pte="黄金时段结束",gte="仅在条件为真时才执行代码。例如。如果触发温度传感器值并且条件为“如果温度大于20°C”,则每次传感器发送温度且温度超过20°C时,将执行“然后”动作。 21°C,22°C等。",mte="仅当条件结果更改时,代码才会执行。例如。如果触发温度传感器值且条件为“如果温度大于20°C”,则温度超过20时将执行一次“则”动作,下一次,当温度超过20时将执行“则”动作低于20失败,然后再次超过20。",fte="小时",$te="包括",bte="间隔",vte="魔法",yte="毫秒",_te="分钟",wte="毫秒",Cte="最低点",Tte="航海黎明",kte="航海黄昏",Ste="下一个日出",Ete="下一个日落",Ite="夜晚",xte="夜晚结束",Dte="普通的",Ate="抵消",Rte="一",Ote="或",Mte="安静的",Nte="搜索",Lte="秒",Pte="星期日正午",Bte="日出",jte="日出结束",Fte="日落",zte="日落开始",Ute="然后",Hte="确认",Wte="从",Vte="上一次改变",Gte="质量",Kte="时间戳",Yte="用户",Jte="值",qte="二",Xte="更新",Zte="将调试输出添加到许多系统命令的日志中",Qte="详细日志输出",ese="什么时候",tse="巫师",sse="重试",ose={"%s not found":"%s 未找到","()":"()","(at %s)":"(在 %s)","(optional)":"(选修的)","-":"-",".":".","AI code generator":"AI代码生成器",Ack:uQ,Actions:dQ,"Actual time of day":"一天中的实际时间",Add:hQ,"Add new script":"添加新脚本",All:pQ,"All files will be accepted":"所有文件都将被接受",Any:gQ,"Any month":"任何月份",Apply:mQ,April:fQ,"Are you sure?":"你确定吗?",Ask:$Q,Astronomical:bQ,"Astronomical events today":"今天的天文事件",August:vQ,"Blockly description":"按图形块创建规则","Body:":"身体:",Cancel:yQ,"Cannot delete non empty item!":"无法删除非空项目!","Change layout":"变更版面",'Change theme (actual "%s")':"更改主题(现在为“%s”)","Check blocks":"检查块","Check is not active, because javascript adapter is disabled":"检查未激活,因为禁用了Javascript适配器","Clear search input":"清除搜索输入","Click on this icon":"单击此图标",Close:_Q,"Close all but current":"关闭所有(当前除外)","Collapse all":"全部收缩","Compares current time with astronomical event":"将当前时间与天文事件进行比较","Compares current time with the user specific time":"将当前时间与用户特定时间进行比较","Compares the state value with user defined value":"比较状态值和用户定义的值",Condition:wQ,Conditions:CQ,"Configuration not saved.":"配置未保存。",Console:TQ,"Control or update some state":"控制或更新某些状态","Control or update some state with delay":"延迟控制或更新某些状态","Convert blockly to javascript for ever.":"立即将blockly转换为Javascript。",Copied:kQ,"Copy script":"复制脚本","Copy to clipboard":"复制到剪贴板","Create new":"创建新的","Create new folder":"创建新文件夹","Create new script":"创建新脚本","Create or edit CRON or time wizard":"创建或编辑周期任务或时间向导","Dark Theme":"深色调主题","Dark style":"深色调风格",Date:"日期","Debug instance":"调试实例","Debug options":"调试选项",December:SQ,Default:EQ,"Define cron...":"定义周期任务...","Define schedule...":"定义调度器......",Delay:IQ,Delete:xQ,"Delete %s":"删除%s...","Delete folder":"删除文件夹","Delete script":"删除脚本",Description:DQ,"Deselect all":"取消全选","Discard changes for %s":"放弃%s的更改",Done:AQ,"Double click to write value":"Double click to write value","Download as file":"档案","Drop some files here or click...":"将文件拖拽到这里或单击......","Duplicate name":"重名","Edit script or just double click":"双击编辑脚本","Empty name is not allowed":"不允许使用空名称","End search mode":"结束搜索模式","Enter your question":"输入您的要求",Error:"错误","Error formatting code":"代码格式错误","Error was found":"发现错误","Every day":"每天",Exec:RQ,"Executes some shell command":"执行一些shell命令","Existing scripts will be overwritten.":"现有脚本将被覆盖。","Expand all":"展开全部","Expert mode":"专家模式",Explanation:OQ,Export:MQ,"Export all scripts":"导出所有脚本","Export blocks":"导出块","Export selected blocks":"导出选定的块",Februar:NQ,February:LQ,Filter:PQ,Folder:BQ,Fr:jQ,Friday:FQ,Function:"功能","Function editor":"功能编辑器","Function: executed":"功能:执行","Go to next line":"转到下一行","HTTP Call":"HTTP呼叫","Hide logs":"隐藏日志",ID:zQ,ID1:UQ,ID2:HQ,Import:WQ,"Import blocks":"导入块","Import error":"导入错误","Import scripts":"导入脚本","Insert object ID":"插入对象ID",Instance:VQ,"Instance is disabled":"实例已禁用","Instance:":"实例:",Instances:GQ,Instructions:KQ,"Invalid CRON":"无效的周期任务","It will not be possible to revert this operation.":"无法恢复此操作。","JS description":"通过编写Javascript来创建规则",Januar:YQ,January:JQ,July:qQ,June:XQ,"Just check":"只是检查","Language:":"语言:","Learn More":"了解更多","Light style":"浅色调风格",Limit:ZQ,"Local time":"当地时间","Locate file":"定位文件","Log outputs":"记录输出","Log text":"记录文字","Log: %s":"日志:%s","Make a HTTP get request":"发出HTTP获取请求","Make a pause between actions":"在动作之间暂停",March:QQ,"March ":"行进",May:eee,Menu:tee,Message:see,Mo:oee,Model:iee,Monday:nee,Month:ree,More:aee,Name:lee,"No API key found":"未找到 API 密钥","No Chat GPT Key found":"找不到聊天 GPT 密钥","No active host found":"找不到活动主机","Nothing found":"没有发现",November:cee,OK:uee,October:dee,Ok:hee,"On condition change":"条件变化时","On script save or adapter start":"在脚本保存或适配器启动时","On weekdays":"在工作日","Open configuration":"开放配置","Operate two states":"操作两种状态","Operations with two states":"具有两种状态的操作","Paste your blocks here":"在此处粘贴您的区块",Pause:pee,"Pause execution":"暂停执行","Pause script":"暂停脚本","Phone:":"电话:","Please select object ID...":"请选择对象ID...","Press Ctrl+Enter to get the answer":"按 Ctrl+Enter 即可得到答案","Prettify the script":"美化脚本","Print some text in log":"在日志中打印一些文本","Priority:":"优先:",Pushover:gee,Pushsafer:mee,"Read only ID selected: %s":"选择的只读ID:%s",Rename:fee,"Reorder scripts in folders":"重新排序文件夹中的脚本",Repeat:$ee,Restart:bee,Result:vee,"Resume execution":"恢复执行","Root folder":"根文件夹","Rules description":"使用IF,THEN,ELSE块创建规则","Run script":"运行脚本",Sa:yee,Saturday:_ee,Save:wee,"Save all":"保存全部","Say It":"Say It","Say some text via sayit adapter":"通过sayit适配器说一些文字",Schedule:Cee,Script:Tee,"Script %s was modified on disk":"脚本%s已在磁盘上修改","Script is not running":"脚本没有运行","Search in scripts":"在脚本中搜索","Search...":"搜索...","Select all":"全选","Send email":"发送电子邮件","Sends an email":"发送邮件","Sends message via Pushsafer":"通过Pushsafer发送消息","Sends message via pushover":"通过推播发送消息","Sends message via telegram":"通过电报发送消息","Sends message via whatsapp-cmb":"通过whatsapp-cmb发送消息",September:kee,"Server time":"服务器时间","Set state action":"设定状态动作","Set with delay":"延迟设置","Shell command":"Shell命令","Show astronomical events":"显示天文事件","Show javascript code":"显示Javascript代码","Show logs":"显示记录","Show only paused scripts":"仅显示暂停的脚本","Show only running scripts":"仅显示正在运行的脚本","Show only scripts with problems":"仅显示有问题的脚本",Simulate:See,"Some files will be rejected":"有些文件将被拒绝","Sound:":"声音:",Stack:Eee,Start:Iee,"Start script":"启动脚本",State:xee,"State condition":"状态条件","Step into function":"进入功能","Step out from function":"退出函数","Stop on exception":"异常停止",Su:Dee,"Subject:":"学科:",Sunday:Aee,"TS description":"通过编写Typescript来创建规则",Telegram:Ree,"Text:":"文本:",Th:Oee,"The script will be stopped and must be activated manually after debugging. Continue?":"该脚本将停止,并且必须在调试后手动激活。继续?","This is advances option. You can write your own code here and it will be executed on trigger":"这是高级选项。您可以在此处编写自己的代码,它将在触发器上执行",Thursday:Mee,Time:Nee,"Time condition":"时间条件","Title:":"标题:","To:":"到:","Trigger with value":"用值触发",Triggered:Lee,Triggers:Pee,"Triggers the on script saving or the javascript instance restart":"触发脚本保存或javascript实例重启","Triggers the rule on update or change of some state":"在某些状态的更新或更改时触发规则","Triggers the rule periodically or on some specific time":"定期或在特定时间触发规则",Tu:Bee,Tuesday:jee,URL:Fee,"Unknown error":"未知错误","Unknown error!":"未知错误!","Use generated code":"使用生成的代码","User function":"用户功能","User:":"用户:",Value:zee,"Vibration:":"振动:",Volume:Uee,We:Hee,Wednesday:Wee,"Whatsapp-cmb":"Whatsapp的cmb",Write:Vee,"Write your own code":"编写自己的代码",Yes:Gee,"Yet exists!":"不存在!","You can use %s in the URL to use current trigger value or %id to use the triggered object ID":"您可以在 URL 中使用 %s 以使用当前触发值,%id 以使用触发对象 ID,%name 以显示触发对象 ID 名称或 %old 以使用旧触发值","You can use %s in the command to use current trigger value or %id to use the triggered object ID":"您可以在命令中使用 %s 以使用当前触发值,%id 使用触发对象 ID,%name 显示触发对象 ID 名称或 %old 使用旧触发值","You can use %s in the text to display current trigger value or %id to display the triggered object ID":"您可以在文本中使用 %s 显示当前触发值,%id 使用触发对象 ID,%name 显示触发对象 ID 名称或 %old 使用旧触发值","You can use %s in the value to use the current trigger value or %id to display the triggered object ID":"您可以在值中使用 %s 以使用当前触发器值,%id 使用触发对象 ID,%name 显示触发对象 ID 名称或 %old 使用旧触发器值","You have to enter OpenAI API key in the configuration of javascript adapter.":"您必须在 javascript 适配器的配置中输入 OpenAI API 密钥。","You have to enter at least one API key in the configuration of javascript adapter.":"您必须在 javascript 适配器的配置中输入至少一个 API 密钥(OpenAI、Anthropic 或 Gemini)。","Please select a valid model":"请选择一个有效的模型","[equal]":"[平等的]","[greater or equal]":"[大于等于]","[greater]":"[更大]","[hysteresis]":"[磁滞]","[includes]":"[包括]","[less or equal]":"[小于或等于]","[less]":"[较少的]","[not equal]":"[不相等]",acknowledgment:Kee,all:Yee,and:Jee,astro:qee,at:Xee,"clear running":"畅通无阻",control:Zee,copy:Qee,cron:ete,dawn:tte,debug_help:ste,debug_label:ote,default:"默认",dusk:ite,easy:nte,else:"别的","equal to":"等于",every:rte,"every hour at 0 minutes":"每小时0分钟",false:"错误的","file reading has failed: %s":"文件读取失败:%s","file reading was aborted":"文件读取中止",filter_func:ate,filter_id:lte,filter_name:cte,filter_role:ute,filter_room:dte,"for edit or create script":"用于编辑或创建脚本","for professionals":"对于专业人士","for programmers":"对于程序员",goldenHour:hte,goldenHourEnd:pte,"greater or equal":"大于或等于","greater or equal to":"大于或等于","greater than":"比...更棒",help_just_check:gte,help_on_change:mte,"high priority":"高优先级","high-priority":"高优先级","highest priority":"最高优先级",hours:fte,includes:$te,interval:bte,"just check":"只是检查","less or equal":"小于或等于","less or equal to":"小于或等于","less than":"少于","lower priority":"低优先级","lowest priority":"最低优先级",magic:vte,milliseconds:yte,minutes:_te,ms:wte,nadir:Cte,nauticalDawn:Tte,nauticalDusk:kte,nextSunrise:Ste,nextSunset:Ete,night:Ite,nightEnd:xte,"no blocks found":"找不到块","no group":"没有组",normal:Dte,"normal priority":"正常优先","not equal to":"不等于","not properly connected":"此块未正确连接到其他块。",offset:Ate,"on change":"在变化","on condition change":"在条件变化时","on update":"更新时",one:Rte,or:Ote,quiet:Mte,"reset search":"重置搜索",search:Nte,seconds:Lte,solarNoon:Pte,"store in":"存放在",sunrise:Bte,sunriseEnd:jte,sunset:Fte,sunsetStart:zte,then:Ute,"toggle value":"切换值",tooltip_ack:Hte,tooltip_from:Wte,tooltip_lc:Vte,tooltip_quality:Gte,tooltip_ts:Kte,tooltip_user:Yte,tooltip_value:Jte,true:"真的",two:qte,undefined:"不明确的",update:Xte,"use seconds":"精确到秒","use trigger value":"使用触发值",verbose_help:Zte,verbose_label:Qte,when:ese,with:"和","with date":"有日期","with offset":"带偏移",wizard:tse,"Loading models...":"加载模型...","Could not connect to API at %s":"无法连接到 %s 的 API","Invalid API key":"无效的 API 密钥","Access denied by API":"API 拒绝访问","API error: %s":"API 错误:%s",'Model "%s" not found':'未找到模型 "%s"',"Request failed: %s":"请求失败:%s",Retry:sse,"No running javascript instance found":"未找到正在运行的 JavaScript 实例"};function ise(a){const[s,i]=Y.useState(""),[r,l]=Y.useState("");return Mt(()=>{a.socket.decrypt(a.systemConfig.native.javascriptPassword).then(u=>l(u))},[a.systemConfig,a.socket]),g.jsxs(Vt,{open:!0,onClose:()=>a.onEntered(null),fullWidth:!0,maxWidth:"sm",children:[g.jsx(as,{children:b.I18n.t("Please enter a password for expert mode")}),g.jsx(Gt,{children:g.jsx(vo,{autoFocus:!0,margin:"dense",variant:"standard",label:b.I18n.t("Password"),type:"password",fullWidth:!0,value:s,onKeyDown:u=>{u.key==="Enter"&&s&&(u.preventDefault(),u.stopPropagation(),r===s?a.onEntered(s):a.onEntered(""))},onChange:u=>i(u.target.value)})}),g.jsxs(Kt,{children:[g.jsx(De,{variant:"contained",disabled:!s,onClick:()=>{r===s?a.onEntered(s):a.onEntered("")},startIcon:g.jsx(zo,{}),children:b.I18n.t("Ok")}),g.jsx(De,{color:"grey",variant:"contained",onClick:()=>a.onEntered(null),startIcon:g.jsx(qs,{}),children:b.I18n.t("Cancel")})]})]})}const Br={root:{flexGrow:1,display:"flex",width:"100%",height:"100%"},mainDiv:{width:"100%",height:"100%",overflow:"hidden"},content:a=>({width:"100%",height:"100%",backgroundColor:a.palette.background&&a.palette.background.default,position:"relative"}),menuOpenCloseButton:a=>({position:"absolute",left:0,borderRadius:"0 5px 5px 0",top:6,pt:1,cursor:"pointer",zIndex:1,height:25,width:20,background:a.palette.secondary.main,color:a.palette.primary.main,pl:"3px","&:hover":{color:"white"}}),showLogButton:a=>({position:"absolute",right:3,borderRadius:"5px 5px 0 0",bottom:0,pt:"3px",cursor:"pointer",zIndex:10,height:20,width:25,background:a.palette.secondary.main,color:a.palette.primary.main,pl:1,"&:hover":{color:"white"}})};class nse extends b.GenericApp{hosts=[];importFile=null;scripts={};confirmCallback=null;changedScripts={};javascriptPassword="";constructor(s){super(s,{Connection:b.AdminConnection,translations:{en:cL,de:oB,es:XF,fr:VU,it:jV,nl:O3,pl:E6,pt:_K,ru:mq,uk:cQ,"zh-cn":ose},bottomButtons:!1,socket:{autoSubscribeLog:!0},sentryDSN:window.sentryDSN});const i=window.localStorage.getItem("JS.logSizes");let r=[80,20];if(i)try{r=JSON.parse(i)}catch{}const l=window.localStorage.getItem("JS.splitSizes");let u=[20,80];if(l)try{u=JSON.parse(l)}catch{}this.state={...this.state,splitSizes:u,logSizes:r},window.alert=d=>{console.error(d),this.showJsError(d.toString())}}onScriptsChanged=(s,i)=>{if(!s)return;let r=!1;const l={};s.startsWith("script.js.")&&(i?JSON.stringify(this.scripts[s])!==JSON.stringify(i)&&(this.scripts[s]=i,r=!0,l.scriptsHash=this.state.scriptsHash+1):this.scripts[s]&&(delete this.scripts[s],r=!0,l.scriptsHash=this.state.scriptsHash+1)),r&&this.setState(l)};onInstanceChanged=(s,i)=>{var u;if(!s)return;let r=!1;const l={};if(s.match(/^system\.adapter\.[-_\w\d]+\$/)){if(s.startsWith(`system.adapter.${this.adapterName}.`)){const d=parseInt(s.split(".").pop()||"0",10)||0;if((i==null?void 0:i.type)==="instance")this.state.instances.includes(d)||(l.instances=[...this.state.instances],l.instances.push(d),l.instances.sort(),r=!0,this.socket.subscribeState(`${i._id}.alive`,this.onInstanceAliveChange));else if(!i&&this.state.instances.includes(d)){this.socket.unsubscribeState(`${s}.alive`,this.onInstanceAliveChange),l.instances=[...this.state.instances];const p=l.instances.indexOf(d);l.instances.splice(p,1),r=!0}}(u=i==null?void 0:i.common)!=null&&u.blockly&&(this.confirmCallback=d=>d&&window.location.reload(),l.confirm=b.I18n.t("Some blocks were updated. Reload admin?"),r=!0)}r&&this.setState(l)};onHostChanged=(s,i)=>{if(s&&s.startsWith("system.host.")){if((i==null?void 0:i.type)==="host")this.hosts.includes(s)||(this.hosts.push(s),this.hosts.sort());else if(!i&&this.hosts.includes(s)){const r=this.hosts.indexOf(s);this.hosts.splice(r,1)}}};onConnectionReady(){window.systemLang=this.socket.systemLang,this.setState({ready:!1,scriptsHash:0,instances:[],updating:!1,resizing:!1,selected:null,logMessage:{},editing:[],menuOpened:window.localStorage.getItem("App.menuOpened")!=="false",menuSelectId:"",expertMode:window.localStorage.getItem("App.expertMode")==="true",logHorzLayout:window.localStorage.getItem("App.logHorzLayout")==="true",runningInstances:{},confirm:"",importFile:!1,message:"",searchText:"",hideLog:window.localStorage.getItem("App.hideLog")==="true",debugMode:!1,debugInstance:null,splitSizes:[20,80],password:""},async()=>{var d;const s={},i=await this.subscribeOnInstances();s.instances=i.instances,s.runningInstances=i.runningInstances,this.javascriptPassword=((d=this.socket.systemConfig)==null?void 0:d.native.javascriptPassword)||"",await this.readAdaptersWithBlockly();const r=await this.socket.getHosts();this.hosts=r.map(p=>p._id);const l=await this.readAllScripts();window.localStorage.getItem("App.expertMode")!=="true"&&window.localStorage.getItem("App.expertMode")!=="false"&&!this.javascriptPassword?Object.keys(l).find(p=>p.startsWith("script.js.global.")&&l[p].type==="script")&&(s.expertMode=!0):this.javascriptPassword&&(s.expertMode=!1),this.scripts=l;let u=this.state.scriptsHash;this.compareScripts(l)&&u++,s.scriptsHash=u,s.ready=!0,this.setState(s),await this.socket.subscribeObject("script.*",this.onScriptsChanged),await this.socket.subscribeObject("system.adapter.*",this.onInstanceChanged),await this.socket.subscribeObject("system.host.*",this.onHostChanged)})}async subscribeOnInstances(){const i=(await this.socket.getAdapterInstances(this.adapterName)).map(l=>parseInt(l._id.split(".").pop()||"0")).sort(),r={};i.forEach(l=>r[`system.adapter.${this.adapterName}.${l}`]=!1);for(let l=0;l<i.length;l++){const u=`system.adapter.${this.adapterName}.${i[l]}`,d=`${u}.alive`,p=await this.socket.getState(d);r[u]=p?!!p.val:!1,await this.socket.subscribeState(d,this.onInstanceAliveChange)}return{instances:i,runningInstances:r}}async readAllScripts(){const s=await this.socket.getObjectViewSystem("channel","script.js.","script.js.香"),i=await this.socket.getObjectViewSystem("script","script.js.","script.js.香");return Object.keys(i).forEach(r=>s[r]=i[r]),s}async readAdaptersWithBlockly(){const s=await this.socket.getObjectViewSystem("adapter","system.adapter.","system.adapter.香");return new Promise(i=>Fe.loadCustomBlockly(s,()=>i()))}onInstanceAliveChange=(s,i)=>{if(s&&(s=s?s.substring(0,s.length-6):"",this.state.runningInstances[s]!==(i?i.val:!1))){const r=JSON.parse(JSON.stringify(this.state.runningInstances));r[s]=i?!!i.val:!1,this.setState({runningInstances:r})}};compareScripts(s){const i=Object.keys(this.scripts),r=Object.keys(s);if(i.length!==r.length)return this.scripts=s,!0;if(JSON.stringify(i)!==JSON.stringify(r))return this.scripts=s,!0;for(let l=0;l<i.length;l++){const u=this.scripts[i[l]].common,d=s[i[l]].common,p=this.scripts[i[l]].native,m=s[i[l]].native;if(u.name!==d.name)return this.scripts=s,!0;if(u.source!==d.source)return this.scripts=s,!0;if(u.engine!==d.engine)return this.scripts=s,!0;if(u.engineType!==d.engineType)return this.scripts=s,!0;if(u.enabled!==d.enabled)return this.scripts=s,!0;if(!!(p!=null&&p.protected)!=!!(m!=null&&m.protected))return this.scripts=s,!0}return!1}async onRename(s,i,r,l){var u;i.trim().endsWith(".")&&(i=i.replace(/\.\s*$/,"_")),console.log(`Rename ${s} => ${i}`),this.setState({updating:!0});try{if(((u=this.scripts[s])==null?void 0:u.type)==="script"){const d=JSON.parse(JSON.stringify(this.scripts[s].common));d.name=r||d.name,l!==void 0&&(d.engine=`system.adapter.javascript.${l}`);const p=i.split(".");p.pop();const m=p.join(".");this.scripts[m]&&this.scripts[m].type==="script"&&(p.pop(),i=`${p.join(".")}.${i.split(".").pop()}`),await this.updateScript(s,i,d)}else await this.renameGroup(s,i,r)}catch(d){d.toString().includes("canceled")||this.showJsError(d)}this.setState({updating:!1})}async renameGroup(s,i,r,l){if(l){if(l.length){let u=l.pop();if(u){const d=await this.socket.getObject(u);if(d){try{await this.socket.delObject(u)}catch{}u=i+u.substring(s.length),d._id=u,d.common=d.common||{},d.common.expert=!0,await this.socket.setObject(u,d),await this.renameGroup(s,i,r,l)}}}}else{l=[],l=Object.keys(this.scripts).filter(d=>d.startsWith(`${s}.`));let u=await this.socket.getObject(s);u=u||{common:{},type:"channel"},u.common.name=r||u.common.name||s.split(".").pop()||"",u._id=i;try{await this.socket.delObject(s)}catch{}try{await this.socket.setObject(i,u),await this.renameGroup(s,i,r,l)}catch(d){console.log(d);const p={_id:i,type:"channel",common:{name:r||s.split(".").pop()||"",expert:!0},native:{}};await this.socket.setObject(i,p),await this.renameGroup(s,i,r,l)}}}async onUpdateScript(s,i){var r;if(((r=this.scripts[s])==null?void 0:r.type)==="script")try{await this.updateScript(s,s,i)}catch(l){l.toString().includes("canceled")||this.showJsError(l)}}onSelect(s){this.scripts[s]&&this.scripts[s].common&&this.scripts[s].type==="script"&&this.setState({selected:s,menuSelectId:s},()=>setTimeout(()=>this.setState({menuSelectId:""}),300))}renderPasswordDialog(){return this.state.showPasswordDialog?g.jsx(ise,{socket:this.socket,systemConfig:this.socket.systemConfig,onEntered:s=>{s===null?this.setState({showPasswordDialog:!1,expertMode:!1,password:""}):s?this.setState({expertMode:!0,showPasswordDialog:!1,password:s}):this.setState({showPasswordDialog:!1,expertMode:!1,message:b.I18n.t("Wrong password"),password:""})}},"passwordDialog"):null}onExpertModeChange(s){var i;if(this.state.expertMode!==s)if(s&&this.javascriptPassword)this.setState({showPasswordDialog:!0});else{let r=this.state.selected;r&&!s&&((i=this.scripts[r].native)!=null&&i.protected)&&(r=this.state.editing.find(l=>{var u;return this.scripts[l]&&!((u=this.scripts[l].native)!=null&&u.protected)})||null),window.localStorage.setItem("App.expertMode",s?"true":"false"),this.setState({expertMode:s,password:"",selected:r})}}showJsError(s){this.setState({errorText:s?s.toString():""})}showMessage(s){this.setState({message:s?s.toString():""})}onDelete(s){this.socket.delObject(s).catch(i=>this.showJsError(i))}onEdit(s){this.state.selected!==s&&this.setState({selected:s})}onAddNew(s,i,r,l,u,d){const p=new RegExp(`^${s}\\.`);if(Object.keys(this.scripts).find(m=>s===m||p.test(s)))return this.showJsError(b.I18n.t("Yet exists!"));r?this.socket.setObject(s,{_id:s,type:"channel",common:{name:i,expert:!0},native:{}}).then(()=>setTimeout(()=>this.setState({menuSelectId:s},()=>setTimeout(()=>this.setState({menuSelectId:""}),300)),1e3)).catch(m=>this.showJsError(m)):(u==="Blockly"&&!d&&(d=`
1230
+ //${btoa(encodeURIComponent('<xml xmlns="https://developers.google.com/blockly/xml"></xml>'))}`),this.socket.setObject(s,{_id:s,type:"script",common:{name:i,expert:!0,engineType:u||"Javascript/js",enabled:!1,engine:`system.adapter.javascript.${l||0}`,source:d||"",debug:!1,verbose:!1},native:{}}).then(()=>setTimeout(()=>this.onSelect(s),1e3)).catch(m=>this.showJsError(m)))}async updateScript(s,i,r){let l=await this.socket.getObject(s);const u={common:{}};if(r.engine!==void 0&&(u.common.engine=r.engine),r.enabled!==void 0&&(u.common.enabled=r.enabled),r.source!==void 0&&(u.common.source=r.source),r.debug!==void 0&&(u.common.debug=r.debug),r.verbose!==void 0&&(u.common.verbose=r.verbose),u.from="system.adapter.admin.0",s===i&&(l!=null&&l.common)&&r.name===l.common.name){(!r.engineType||r.engineType!==l.common.engineType)&&r.engineType!==void 0&&(u.common.engineType=r.engineType||"Javascript/js"),u.type="script",await this.socket.extendObject(s,u);return}if(l!=null&&l.common){l.common.engineType=r.engineType||l.common.engineType||"Javascript/js",await this.socket.delObject(s),u.common.engine!==void 0&&(l.common.engine=u.common.engine),u.common.enabled!==void 0&&(l.common.enabled=u.common.enabled),u.common.source!==void 0&&(l.common.source=u.common.source),u.common.name!==void 0&&(l.common.name=u.common.name),u.common.debug!==void 0&&(l.common.debug=u.common.debug),u.common.verbose!==void 0&&(l.common.verbose=u.common.verbose),l._rev!==void 0&&delete l._rev,l.common.name=r.name,l.common.expert=!0,l.type="script",l._id=i,await this.socket.setObject(i,l);return}l=u,l.common.name=r.name,l.common.expert=!0,l.type="script",l._id=i,await this.socket.setObject(i,l)}onEnableDisable(s,i){var r;if(((r=this.scripts[s])==null?void 0:r.type)==="script"){const l=this.scripts[s].common;l.enabled=i,l.expert=!0,this.updateScript(s,s,l).catch(u=>u!=="canceled"&&this.showJsError(u))}}async getLiveHost(){for(let s=0;s<this.hosts.length;s++){const i=this.hosts[s],r=await this.socket.getState(`${i}.alive`);if(r&&(r!=null&&r.val))return i}}async onExport(){const s=await this.getLiveHost();if(!s){this.showJsError(b.I18n.t("No active host found"));return}const i=new Date;let r=i.getFullYear().toString(),l=i.getMonth()+1;l<10&&(l=`0${l}`),r+=`-${l}`,l=i.getDate(),l<10&&(l=`0${l}`),r+=`-${l}-`,this.socket.getRawSocket().emit("sendToHost",s,"readObjectsAsZip",{adapter:"javascript",id:"script.js",link:`${r}scripts.zip`,fileStorageNamespace:`admin.${this.instance}`},u=>{if(typeof u=="string"){const d=document.createElement("a");d.href=`../../files/${u}`,document.body.appendChild(d),d.click(),d.remove()}else if(u.error&&this.showJsError(u.error),u.data){const d=document.createElement("a");d.href=`data: application/zip;base64,${u.data}`,d.download=`${r}scripts.zip`,document.body.appendChild(d),d.click(),d.remove()}})}onImport(s){this.importFile=s||null,s?(this.confirmCallback=this.onImportConfirmed.bind(this),this.setState({importFile:!1,confirm:b.I18n.t("Existing scripts will be overwritten.")})):this.setState({importFile:!1})}async onImportConfirmed(s){let i=this.importFile;if(this.importFile=null,s&&i){i=i.split(",")[1];const r=await this.getLiveHost();if(!r){this.showJsError(b.I18n.t("No active host found"));return}this.socket.getRawSocket().emit("sendToHost",r,"writeObjectsAsZip",{data:i,adapter:"javascript",id:"script.js"},l=>{l==="permissionError"?this.showJsError(b.I18n.t(l)):!l||l.error?this.showJsError(l?b.I18n.t(l.error||""):b.I18n.t("Unknown error")):this.showMessage(b.I18n.t("Done"))})}}toggleLogLayout(){window.localStorage.setItem("App.logHorzLayout",this.state.logHorzLayout?"false":"true"),this.setState({logHorzLayout:!this.state.logHorzLayout})}renderEditor(){var i;const s=Object.keys(this.scripts).reduce((r,l)=>r+(this.scripts[l].common.engineType==="Rules"?1:0),0);return g.jsx(kn,{scriptsHash:this.state.scriptsHash,debugMode:this.state.debugMode,onDebugModeChange:r=>{r?this.setState({debugMode:!0}):this.setState({debugMode:!1,debugInstance:null})},visible:!this.state.resizing,socket:this.socket,adapterName:this.adapterName,onLocate:r=>this.setState({menuSelectId:r}),password:this.state.password,runningInstances:this.state.runningInstances,menuOpened:this.state.menuOpened,searchText:this.state.searchText,themeType:this.state.themeType,themeName:this.state.themeName,theme:this.state.theme,expertMode:this.state.expertMode,onChange:(r,l)=>this.onUpdateScript(r,l),isAnyRulesExists:s,debugInstance:this.state.debugInstance,onSelectedChange:(r,l)=>{const u={};let d=!1;r!==this.state.selected&&(d=!0,u.selected=r),JSON.stringify(l)!==JSON.stringify(this.state.editing)&&(d=!0,u.editing=[...l]),d&&this.setState(u)},onRestart:r=>this.socket.extendObject(r,{common:{enabled:!0}}),selected:this.state.selected&&((i=this.scripts[this.state.selected])==null?void 0:i.type)==="script"?this.state.selected:"",objects:this.scripts,resizing:this.state.resizing,onChangedChanged:r=>this.changedScripts=r},"editor")}showLogButton(){return g.jsx($t,{title:b.I18n.t("Show logs"),sx:Br.showLogButton,onClick:()=>{window.localStorage.setItem("App.hideLog","false"),this.setState({hideLog:!1,resizing:!0}),setTimeout(()=>this.setState({resizing:!1}),300)},children:g.jsx(wS,{})},"showLog")}renderErrorDialog(){return this.state.errorText?g.jsx(Zc,{onClose:()=>this.setState({errorText:""}),text:this.state.errorText},"dialogError"):null}renderMain(){let s;return this.state.debugMode||this.state.hideLog?s=g.jsxs(g.Fragment,{children:[!this.state.debugMode&&this.state.hideLog?this.showLogButton():void 0,this.renderEditor()]}):s=g.jsxs(l_,{direction:this.state.logHorzLayout?dt.Horizontal:dt.Vertical,initialSizes:this.state.logSizes,minWidths:[500,100],minHeights:[150,50],onResizeStarted:()=>this.setState({resizing:!0}),onResizeFinished:(i,r)=>{this.setState({logSizes:r,resizing:!1}),window.localStorage.setItem("JS.logSizes",JSON.stringify(r))},gutterClassName:this.state.themeType==="dark"?"Dark visGutter":"Light visGutter",children:[this.renderEditor(),g.jsx(bm,{verticalLayout:!this.state.logHorzLayout,onLayoutChange:()=>this.toggleLogLayout(),editing:this.state.editing,socket:this.socket,selected:this.state.selected,onHideLog:()=>{window.localStorage.setItem("App.hideLog","true"),this.setState({hideLog:!0,resizing:!0}),setTimeout(()=>this.setState({resizing:!1}),300)}},"log")]}),g.jsxs($t,{sx:Br.content,className:"iobVerticalSplitter",children:[g.jsx($t,{sx:Br.menuOpenCloseButton,onClick:()=>{window.localStorage.setItem("App.menuOpened",this.state.menuOpened?"false":"true"),this.setState({menuOpened:!this.state.menuOpened,resizing:!0}),setTimeout(()=>this.setState({resizing:!1}),300)},children:this.state.menuOpened?g.jsx(CS,{}):g.jsx(TS,{})},"closeMenu"),this.state.message?g.jsx(b.Message,{onClose:()=>this.setState({message:""}),text:this.state.message},"dialogMessage"):null,this.renderErrorDialog(),this.state.importFile?g.jsx(jm,{onClose:i=>this.onImport(i)},"dialogImportFile"):null,this.state.confirm?g.jsx(b.Confirm,{onClose:i=>{this.state.confirm&&this.setState({confirm:""}),this.confirmCallback&&this.confirmCallback(i),this.confirmCallback=null},text:this.state.confirm},"dialogConfirm"):null,this.renderPasswordDialog(),s]},"main")}render(){if(!this.state.ready)return g.jsx(i_,{injectFirst:!0,children:g.jsx(n_,{theme:this.state.theme,children:g.jsx(b.Loader,{themeType:this.state.themeType})})});let s;return this.state.menuOpened?s=g.jsxs(l_,{direction:dt.Horizontal,initialSizes:this.state.splitSizes,minWidths:[270,400],onResizeFinished:(i,r)=>{this.setState({splitSizes:r}),window.localStorage.setItem("JS.splitSizes",JSON.stringify(r))},gutterClassName:this.state.themeType==="dark"?"Dark visGutter":"Light visGutter",children:[g.jsx("div",{style:Br.mainDiv,children:g.jsx(bo,{password:this.state.password,debugMode:this.state.debugMode,onDebugInstance:i=>this.setState({debugInstance:i,debugMode:!!i}),scripts:this.scripts,scriptsHash:this.state.scriptsHash,instances:this.state.instances,onRename:this.onRename.bind(this),socket:this.socket,selectId:this.state.menuSelectId,onEdit:this.onEdit.bind(this),expertMode:this.state.expertMode,themeName:this.state.themeName,onThemeChange:i=>{b.Utils.setThemeName(i);const r=b.Utils.getThemeType(i);this.setState({themeName:i,themeType:r},()=>this.toggleTheme(i))},runningInstances:this.state.runningInstances,onExpertModeChange:i=>this.onExpertModeChange(i),onDelete:this.onDelete.bind(this),onAddNew:this.onAddNew.bind(this),onEnableDisable:this.onEnableDisable.bind(this),onExport:this.onExport.bind(this),width:500,onImport:()=>this.setState({importFile:!0}),onSearch:i=>this.setState({searchText:i}),version:this.props.version,changedScripts:this.changedScripts},"sidemenu")},"menu"),this.renderMain()]}):s=this.renderMain(),g.jsx(i_,{injectFirst:!0,children:g.jsx(n_,{theme:this.state.theme,children:g.jsx("div",{style:Br.root,children:g.jsx(mO,{socket:this.socket,children:s})})})})}}window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/);function rse(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(a=>{a.unregister()})}const ase="9.1.0",DT={version:ase};var Fo;(function(a){a.mouse="mouse",a.touch="touch",a.keyboard="keyboard"})(Fo||(Fo={}));class lse{get delay(){var s;return(s=this.args.delay)!==null&&s!==void 0?s:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var s;return(s=this.args.ignoreContextMenu)!==null&&s!==void 0?s:!1}get enableHoverOutsideTarget(){var s;return(s=this.args.enableHoverOutsideTarget)!==null&&s!==void 0?s:!1}get enableKeyboardEvents(){var s;return(s=this.args.enableKeyboardEvents)!==null&&s!==void 0?s:!1}get enableMouseEvents(){var s;return(s=this.args.enableMouseEvents)!==null&&s!==void 0?s:!1}get enableTouchEvents(){var s;return(s=this.args.enableTouchEvents)!==null&&s!==void 0?s:!0}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var s,i,r,l;return(l=(r=(s=this.args)===null||s===void 0?void 0:s.delayTouchStart)!==null&&r!==void 0?r:(i=this.args)===null||i===void 0?void 0:i.delay)!==null&&l!==void 0?l:0}get delayMouseStart(){var s,i,r,l;return(l=(r=(s=this.args)===null||s===void 0?void 0:s.delayMouseStart)!==null&&r!==void 0?r:(i=this.args)===null||i===void 0?void 0:i.delay)!==null&&l!==void 0?l:0}get window(){if(this.context&&this.context.window)return this.context.window;if(typeof window<"u")return window}get document(){var s;if(!((s=this.context)===null||s===void 0)&&s.document)return this.context.document;if(this.window)return this.window.document}get rootElement(){var s;return((s=this.args)===null||s===void 0?void 0:s.rootElement)||this.document}constructor(s,i){this.args=s,this.context=i}}function cse(a,s,i,r){return Math.sqrt(Math.pow(Math.abs(i-a),2)+Math.pow(Math.abs(r-s),2))}function use(a,s,i,r,l){if(!l)return!1;const u=Math.atan2(r-s,i-a)*180/Math.PI+180;for(let d=0;d<l.length;++d){const p=l[d];if(p&&(p.start==null||u>=p.start)&&(p.end==null||u<=p.end))return!0}return!1}const dse={Left:1},hse={Left:0};function Cg(a){return a.button===void 0||a.button===hse.Left}function pse(a){return a.buttons===void 0||(a.buttons&dse.Left)===0}function AT(a){return!!a.targetTouches}const gse=1;function mse(a){const s=a.nodeType===gse?a:a.parentElement;if(!s)return;const{top:i,left:r}=s.getBoundingClientRect();return{x:r,y:i}}function fse(a,s){if(a.targetTouches.length===1)return Hc(a.targetTouches[0]);if(s&&a.touches.length===1&&a.touches[0].target===s.target)return Hc(a.touches[0])}function Hc(a,s){return AT(a)?fse(a,s):{x:a.clientX,y:a.clientY}}const _w=(()=>{let a=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return a=!0,!0}}))}catch{}return a})(),jr={[Fo.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[Fo.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[Fo.keyboard]:{keydown:"keydown"}};class Vr{profile(){var s;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((s=this.dragOverTargetIds)===null||s===void 0?void 0:s.length)||0}}get document(){return this.options.document}setup(){const s=this.options.rootElement;s&&(Ie(!Vr.isSetUp,"Cannot have two Touch backends at the same time."),Vr.isSetUp=!0,this.addEventListener(s,"start",this.getTopMoveStartHandler()),this.addEventListener(s,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(s,"move",this.handleTopMove),this.addEventListener(s,"move",this.handleTopMoveCapture,!0),this.addEventListener(s,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(s,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(s,"keydown",this.handleCancelOnEscape,!0))}teardown(){const s=this.options.rootElement;s&&(Vr.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(s,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(s,"start",this.handleTopMoveStart),this.removeEventListener(s,"move",this.handleTopMoveCapture,!0),this.removeEventListener(s,"move",this.handleTopMove),this.removeEventListener(s,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(s,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(s,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(s,i,r,l=!1){const u=_w?{capture:l,passive:!1}:l;this.listenerTypes.forEach(function(d){const p=jr[d][i];p&&s.addEventListener(p,r,u)})}removeEventListener(s,i,r,l=!1){const u=_w?{capture:l,passive:!1}:l;this.listenerTypes.forEach(function(d){const p=jr[d][i];p&&s.removeEventListener(p,r,u)})}connectDragSource(s,i){const r=this.handleMoveStart.bind(this,s);return this.sourceNodes.set(s,i),this.addEventListener(i,"start",r),()=>{this.sourceNodes.delete(s),this.removeEventListener(i,"start",r)}}connectDragPreview(s,i,r){return this.sourcePreviewNodeOptions.set(s,r),this.sourcePreviewNodes.set(s,i),()=>{this.sourcePreviewNodes.delete(s),this.sourcePreviewNodeOptions.delete(s)}}connectDropTarget(s,i){const r=this.options.rootElement;if(!this.document||!r)return()=>{};const l=u=>{if(!this.document||!r||!this.monitor.isDragging())return;let d;switch(u.type){case jr.mouse.move:d={x:u.clientX,y:u.clientY};break;case jr.touch.move:var p,m;d={x:((p=u.touches[0])===null||p===void 0?void 0:p.clientX)||0,y:((m=u.touches[0])===null||m===void 0?void 0:m.clientY)||0};break}const f=d!=null?this.document.elementFromPoint(d.x,d.y):void 0,v=f&&i.contains(f);if(f===i||v)return this.handleMove(u,s)};return this.addEventListener(this.document.body,"move",l),this.targetNodes.set(s,i),()=>{this.document&&(this.targetNodes.delete(s),this.removeEventListener(this.document.body,"move",l))}}getTopMoveStartHandler(){return!this.options.delayTouchStart&&!this.options.delayMouseStart?this.handleTopMoveStart:this.handleTopMoveStartDelay}installSourceNodeRemovalObserver(s){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=s,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{s&&!s.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),!(!s||!s.parentElement)&&this.draggedSourceNodeRemovalObserver.observe(s.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(s,i,r){this.getSourceClientOffset=l=>{const u=this.sourceNodes.get(l);return u&&mse(u)},this.handleTopMoveStartCapture=l=>{Cg(l)&&(this.moveStartSourceIds=[])},this.handleMoveStart=l=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(l)},this.handleTopMoveStart=l=>{if(!Cg(l))return;const u=Hc(l);u&&(AT(l)&&(this.lastTargetTouchFallback=l.targetTouches[0]),this._mouseClientOffset=u),this.waitingForDelay=!1},this.handleTopMoveStartDelay=l=>{if(!Cg(l))return;const u=l.type===jr.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,l),u),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(l,u)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(u)},this.handleTopMove=l=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:u,dragOverTargetIds:d}=this,p=this.options.enableHoverOutsideTarget,m=Hc(l,this.lastTargetTouchFallback);if(!m)return;if(this._isScrolling||!this.monitor.isDragging()&&use(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,m.x,m.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&u&&cse(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,m.x,m.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(u,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const f=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(f),this.actions.publishDragSource(),l.cancelable&&l.preventDefault();const v=(d||[]).map(C=>this.targetNodes.get(C)).filter(C=>!!C),_=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(m.x,m.y,v):this.document.elementsFromPoint(m.x,m.y),y=[];for(const C in _){if(!_.hasOwnProperty(C))continue;let w=_[C];for(w!=null&&y.push(w);w;)w=w.parentElement,w&&y.indexOf(w)===-1&&y.push(w)}const k=y.filter(C=>v.indexOf(C)>-1).map(C=>this._getDropTargetId(C)).filter(C=>!!C).filter((C,w,E)=>E.indexOf(C)===w);if(p)for(const C in this.targetNodes){const w=this.targetNodes.get(C);if(f&&w&&w.contains(f)&&k.indexOf(C)===-1){k.unshift(C);break}}k.reverse(),this.actions.hover(k,{clientOffset:m})},this._getDropTargetId=l=>{const u=this.targetNodes.keys();let d=u.next();for(;d.done===!1;){const p=d.value;if(l===this.targetNodes.get(p))return p;d=u.next()}},this.handleTopMoveEndCapture=l=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!pse(l)){if(!this.monitor.isDragging()||this.monitor.didDrop()){this.moveStartSourceIds=void 0;return}l.cancelable&&l.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()}},this.handleCancelOnEscape=l=>{l.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new lse(r,i),this.actions=s.getActions(),this.monitor=s.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(Fo.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(Fo.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(Fo.keyboard)}}const $se=function(s,i={},r={}){return new Vr(s,i,r)};window.GenericBlock=Xe;window.adapterName="javascript";window.sentryDSN="https://504499a725eb4898930d3b9e9da95740@sentry.iobroker.net/56";console.log(`iobroker.${window.adapterName}@${DT.version}`);const bse=window.innerWidth<600,ww=document.getElementById("root");ww&&Pw(ww).render(g.jsx(Zw,{backend:bse?$se:uC,children:g.jsx(nse,{version:DT.version})}));rse();const uc=window.loadDynamicScript;uc&&uc(window.location.port==="3000"?`${window.location.protocol}//${window.location.hostname}:8081/lib/js/socket.io.js`:"./../../lib/js/socket.io.js",()=>uc("vs/loader.js",()=>uc("vs/configure.js",()=>typeof window.socketLoadedHandler=="function"&&window.socketLoadedHandler())));export{gO as C,Q0 as D,Xe as G,dC as I,mw as M,As as S,pI as a,RI as b,FI as c,bi as d,cne as e,zm as f,Zc as g,nx as h,une as j,l_ as m,Mn as u,dt as z};