iobroker.javascript 9.1.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -8
- package/admin/assets/AiChatPanel-sgt697A2.js +296 -0
- package/admin/assets/AiDatapointProvider-B0i3I5Fm.js +2 -0
- package/admin/assets/AiDiffView-RPozjjHf.js +1 -0
- package/admin/assets/AiInlineProvider-Dd7eKxk4.js +7 -0
- package/admin/assets/{Save-Cld9qv9i.js → Save-CkuNSiWL.js} +1 -1
- package/admin/assets/{ScriptEditor-BVaX7Hcs.js → ScriptEditor-CH4qJzqq.js} +2 -2
- package/admin/assets/ScriptEditorVanillaMonaco-cB_90T0P.js +1 -0
- package/admin/assets/{createSvgIcon-DPvF8xqu.js → createSvgIcon-DYs_tNrE.js} +1 -1
- package/admin/assets/docs-compact-CKNGiYh2.js +336 -0
- package/admin/assets/index-BI3JsAz_.js +1 -0
- package/admin/assets/{index-D8iYqogF.js → index-DAkyON1r.js} +5 -5
- package/admin/assets/index-DW5CwIma.js +1256 -0
- package/admin/assets/index-SHs7_wDh.js +1 -0
- package/admin/assets/{index-DlDUIfpA.js → index-dN73sbyQ.js} +1 -1
- package/admin/assets/index-hwplVCgv.js +986 -0
- package/admin/assets/index-wHNMOf-c.js +5 -0
- package/admin/assets/inheritsLoose-CIXm_zPk.js +29 -0
- package/admin/assets/{iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-QWG5Arqe.js → iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-CV1_X-Lf.js} +1 -1
- package/admin/assets/{localSharedImportMap-AxgBkrOR.js → localSharedImportMap-CqvxvyGG.js} +1 -1
- package/admin/assets/useTheme-DuTJsNQ-.js +1 -0
- package/admin/assets/{virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-C9suQF96.js → virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-BJ03G6Pu.js} +2 -2
- package/admin/custom/assets/{Components-FfVbavBM.js → Components-B9ZyjeRI.js} +1 -1
- package/admin/custom/assets/{index-Be7j5wvd.js → index-BVwMgafs.js} +1 -1
- package/admin/custom/assets/index-CVIpIckw.js +960 -0
- package/admin/custom/assets/{index-DNdWk-cT.js → index-DsIn9jH_.js} +1 -1
- package/admin/custom/assets/{localSharedImportMap-BRxFonIn.js → localSharedImportMap-C4qXtGUd.js} +1 -1
- package/admin/custom/assets/{virtualExposes-DyedJotb.js → virtualExposes-jSvr-kK3.js} +1 -1
- package/admin/custom/assets/{virtual_mf-REMOTE_ENTRY_ID_ConfigCustomJavascriptSet__customComponents_js-BtJxKB87.js → virtual_mf-REMOTE_ENTRY_ID_ConfigCustomJavascriptSet__customComponents_js-DFSXB0v2.js} +2 -2
- package/admin/custom/customComponents.js +1 -1
- package/admin/google-blockly/own/blocks_words.js +7 -0
- package/admin/google-blockly/own/field_oid.js +311 -37
- package/admin/i18n/de.json +8 -0
- package/admin/i18n/en.json +8 -0
- package/admin/i18n/es.json +8 -0
- package/admin/i18n/flat.txt +427 -0
- package/admin/i18n/fr.json +8 -0
- package/admin/i18n/it.json +8 -0
- package/admin/i18n/nl.json +8 -0
- package/admin/i18n/pl.json +8 -0
- package/admin/i18n/pt.json +8 -0
- package/admin/i18n/ru.json +8 -0
- package/admin/i18n/uk.json +8 -0
- package/admin/i18n/zh-cn.json +8 -0
- package/admin/img/anthropic.svg +1 -0
- package/admin/img/custom.svg +1 -0
- package/admin/img/deepseek.svg +1 -0
- package/admin/img/gemini.svg +1 -0
- package/admin/img/openai.svg +1 -0
- package/admin/jsonConfig.json +76 -14
- package/admin/mf-manifest.json +1 -1
- package/admin/remoteEntry.js +1 -1
- package/admin/tab.html +6 -6
- package/build/lib/debugger.js +2 -2
- package/build/lib/debugger.js.map +1 -1
- package/build/lib/inspect.js.map +1 -1
- package/build/lib/nodeModulesManagement.js +2 -2
- package/build/lib/nodeModulesManagement.js.map +1 -1
- package/build/lib/protectFs.js +5 -0
- package/build/lib/protectFs.js.map +1 -1
- package/build/lib/sandbox.js +2 -2
- package/build/lib/sandbox.js.map +1 -1
- package/build/main.js +72 -17
- package/build/main.js.map +1 -1
- package/build/types.d.ts +2 -0
- package/docs/de/README.md +21 -8
- package/docs/de/blockly.md +34 -0
- package/docs/en/README.md +21 -8
- package/docs/en/blockly.md +34 -0
- package/install/installTypings.js +1 -1
- package/io-package.json +27 -66
- package/package.json +7 -6
- package/admin/assets/OpenAiDialog-Dx-XNET0.js +0 -13
- package/admin/assets/ScriptEditorVanillaMonaco-yq11eIYC.js +0 -1
- package/admin/assets/docs-BrInh2Pn.js +0 -2036
- package/admin/assets/index-CLJ6-h9Q.js +0 -1
- package/admin/assets/index-COZhHfBn.js +0 -1230
- package/admin/assets/index-Cu-TydZj.js +0 -5
- package/admin/assets/index-Dnbw7_L3.js +0 -986
- package/admin/assets/index-gIA8x-8f.js +0 -1
- package/admin/assets/inheritsLoose-B0Ba5G9z.js +0 -29
- package/admin/assets/useTheme-hy6f3gra.js +0 -1
- package/admin/custom/assets/index-CYc31Gwg.js +0 -960
|
@@ -0,0 +1,1256 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BI3JsAz_.js","./createSvgIcon-DYs_tNrE.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-CV1_X-Lf.js","./index-wHNMOf-c.js","./virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-BJ03G6Pu.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-CIXm_zPk.js","./index-BCK6q-N6.css","./index-DAkyON1r.js","./ScriptEditorVanillaMonaco-cB_90T0P.js","./ScriptEditor-CH4qJzqq.js","./Save-CkuNSiWL.js","./AiChatPanel-sgt697A2.js","./index-SHs7_wDh.js","./AiDiffView-RPozjjHf.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{d as E_}from"./virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-BJ03G6Pu.js";import{j as g,c as vt,g as ok,r as ik,_ as Zg}from"./createSvgIcon-DYs_tNrE.js";import{r as kT}from"./iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-RQRRZMX5.js";import{a as pe,_ as CT,b as ji,c as Ft,d as ST,e as nk,f as Qg,g as jm,h as Fm,i as rk,j as St,k as zn,l as gs,m as TT,n as ak,o as em,p as IT,q as ET,r as lk,s as xT,t as Zo}from"./iobroker_javascript__loadShare__react__loadShare__.mjs-CTZOFJS2.js";import{_ as zt,a as ts,b as Yt,c as Oo,d as Ui,e as tm,f as Hi,g as et,h as Ut,i as je,j as $c,k as bc,l as yc,m as vc,n as _c,o as We,p as ck,q as Ni,r as sm,s as x_,t as om,u as im,v as Jn,w as uk,x as DT,y as Gc,z as bt,A as AT,B as nm,C as RT,D as mg,E as ua,F as OT,G as MT,H as NT,I as LT,J as dk,K as PT,L as BT,M as D_,N as Mn,O as jT,P as FT,Q as zT,R as UT,S as HT,T as hk,U as WT,V as rm,W as pk,X as GT}from"./iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-CV1_X-Lf.js";import{_ as x}from"./iobroker_javascript__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-DkBjPSMw.js";import{I as ni,a as ao,b as Mc,C as VT,c as gk,F as KT,d as YT,e as Vc,f as am,g as JT,h as qT,i as XT,j as ZT,M as QT,k as eI,l as tI,m as sI,_ as oI,n as wc,o as iI,p as nI,q as kc,r as A_,s as rI,t as aI,u as lI,v as cI,w as R_,x as $u,y as uI,z as dI,A as hI,B as pI,D as gI,E as mI,G as fI,H as $I,J as bI,K as mk,L as fk,N as $k,O as yI,P as vI,Q as _I,R as wI,S as kI,T as CI}from"./index-wHNMOf-c.js";import{y as SI,_ as TI,a as II,S as O_,T as M_}from"./inheritsLoose-CIXm_zPk.js";import{c as ro}from"./iobroker_javascript__loadShare__react__loadShare__.mjs_commonjs-proxy-CE9lvhW8.js";function ri(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}import{_ as Ki}from"./preload-helper-BDBacUwf.js";import{P as ve}from"./iobroker_javascript__loadShare__prop_mf_2_types__loadShare__.mjs-BCtSFofY.js";import{_ as EI}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"]'))a(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).observe(document,{childList:!0,subtree:!0});function i(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(l){if(l.ep)return;l.ep=!0;const c=i(l);fetch(l.href,c)}})();var bk,N_=kT;bk=N_.createRoot,N_.hydrateRoot;var yk={exports:{}},ht={};var bu=60103,yu=60106,Ca=60107,Sa=60108,Ta=60114,Ia=60109,Ea=60110,xa=60112,Da=60113,zm=60120,Aa=60115,Ra=60116,vk=60121,_k=60122,wk=60117,kk=60129,Ck=60131;if(typeof Symbol=="function"&&Symbol.for){var Bt=Symbol.for;bu=Bt("react.element"),yu=Bt("react.portal"),Ca=Bt("react.fragment"),Sa=Bt("react.strict_mode"),Ta=Bt("react.profiler"),Ia=Bt("react.provider"),Ea=Bt("react.context"),xa=Bt("react.forward_ref"),Da=Bt("react.suspense"),zm=Bt("react.suspense_list"),Aa=Bt("react.memo"),Ra=Bt("react.lazy"),vk=Bt("react.block"),_k=Bt("react.server.block"),wk=Bt("react.fundamental"),kk=Bt("react.debug_trace_mode"),Ck=Bt("react.legacy_hidden")}function js(r){if(typeof r=="object"&&r!==null){var s=r.$$typeof;switch(s){case bu:switch(r=r.type,r){case Ca:case Ta:case Sa:case Da:case zm:return r;default:switch(r=r&&r.$$typeof,r){case Ea:case xa:case Ra:case Aa:case Ia:return r;default:return s}}case yu:return s}}}var xI=Ia,DI=bu,AI=xa,RI=Ca,OI=Ra,MI=Aa,NI=yu,LI=Ta,PI=Sa,BI=Da;ht.ContextConsumer=Ea;ht.ContextProvider=xI;ht.Element=DI;ht.ForwardRef=AI;ht.Fragment=RI;ht.Lazy=OI;ht.Memo=MI;ht.Portal=NI;ht.Profiler=LI;ht.StrictMode=PI;ht.Suspense=BI;ht.isAsyncMode=function(){return!1};ht.isConcurrentMode=function(){return!1};ht.isContextConsumer=function(r){return js(r)===Ea};ht.isContextProvider=function(r){return js(r)===Ia};ht.isElement=function(r){return typeof r=="object"&&r!==null&&r.$$typeof===bu};ht.isForwardRef=function(r){return js(r)===xa};ht.isFragment=function(r){return js(r)===Ca};ht.isLazy=function(r){return js(r)===Ra};ht.isMemo=function(r){return js(r)===Aa};ht.isPortal=function(r){return js(r)===yu};ht.isProfiler=function(r){return js(r)===Ta};ht.isStrictMode=function(r){return js(r)===Sa};ht.isSuspense=function(r){return js(r)===Da};ht.isValidElementType=function(r){return typeof r=="string"||typeof r=="function"||r===Ca||r===Ta||r===kk||r===Sa||r===Da||r===zm||r===Ck||typeof r=="object"&&r!==null&&(r.$$typeof===Ra||r.$$typeof===Aa||r.$$typeof===Ia||r.$$typeof===Ea||r.$$typeof===xa||r.$$typeof===wk||r.$$typeof===vk||r[0]===_k)};ht.typeOf=js;yk.exports=ht;var jI=yk.exports;function Kc(r,s){const i=getComputedStyle(s);if(!i)return;let a=r===mt.Horizontal?s.clientWidth:s.clientHeight;return a!==0?(r===mt.Horizontal?a-=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight):a-=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom),a):void 0}function Cc(r,s,i=[],a={condition:!0}){const{condition:l}=a,c=(function(h,d){var p={};for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&d.indexOf(f)<0&&(p[f]=h[f]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function"){var b=0;for(f=Object.getOwnPropertySymbols(h);b<f.length;b++)d.indexOf(f[b])<0&&Object.prototype.propertyIsEnumerable.call(h,f[b])&&(p[f[b]]=h[f[b]])}return p})(a,["condition"]);Ft((()=>(l&&window.addEventListener(r,s,c),()=>{l&&window.removeEventListener(r,s)})),[r,s,l,...i])}(function(r,s){s===void 0&&(s={});var i=s.insertAt;if(typeof document<"u"){var a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css",i==="top"&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=r:l.appendChild(document.createTextNode(r))}})(`/* === 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 FI=pe.forwardRef((({className:r,theme:s,draggerClassName:i,direction:a=mt.Vertical,onDragging:l},c)=>{const h=`__dbk__gutter ${a} ${r||s}`,d=`__dbk__dragger ${a} ${i||s}`;return g.jsx("div",Object.assign({className:h,ref:c,dir:a,onMouseDown:l,onTouchStart:Nc?l:void 0},{children:g.jsx("div",{className:d},void 0)}),void 0)}));var Ss;function lm(r,s,i){let a,l;return s?(a=r/2,l=r):i?(a=r,l=r/2):(a=r,l=r),{aGutterSize:a,bGutterSize:l}}function zI(r,s){switch(s.type){case Ss.SetIsReadyToCompute:return Object.assign(Object.assign({},r),{isReady:s.payload.isReady});case Ss.CreatePairs:{const{direction:i,children:a,gutters:l}=s.payload,c=a[0].parentNode;if(!c)throw new Error("Cannot create pairs - parent is undefined.");const h=Kc(i,c);if(h===void 0)throw new Error(`Cannot create pairs - parent has undefined or zero size: ${h}.`);const d=[];return a.forEach(((p,f)=>{if(f>0){const b=a[f-1],v=a[f],_=l[f-1],y=i===mt.Horizontal?b.getBoundingClientRect().left:b.getBoundingClientRect().top,w=i===mt.Horizontal?v.getBoundingClientRect().right:v.getBoundingClientRect().bottom,$=i===mt.Horizontal?b.getBoundingClientRect().width+_.getBoundingClientRect().width+v.getBoundingClientRect().width:b.getBoundingClientRect().height+_.getBoundingClientRect().height+v.getBoundingClientRect().height,I=i===mt.Horizontal?_.getBoundingClientRect().width:_.getBoundingClientRect().height,T={idx:f-1,a:b,b:v,gutter:_,parent:c,start:y,end:w,size:$,gutterSize:I,aSizePct:100/a.length,bSizePct:100/a.length};d.push(T)}})),Object.assign(Object.assign({},r),{pairs:d})}case Ss.StartDragging:{const{gutterIdx:i}=s.payload;return Object.assign(Object.assign({},r),{isDragging:!0,draggingIdx:i})}case Ss.StopDragging:return Object.assign(Object.assign({},r),{isDragging:!1});case Ss.CalculateSizes:{const{direction:i,gutterIdx:a}=s.payload,l=r.pairs[a],c=Kc(i,l.parent);if(!c)throw new Error("Cannot calculate sizes - 'pair.parent' has undefined or zero size.");const h=l.gutter[i===mt.Horizontal?"clientWidth":"clientHeight"],d=a===0,p=a===r.pairs.length-1,{aGutterSize:f,bGutterSize:b}=lm(h,d,p);let v,_,y,w,$;return i===mt.Horizontal?(v=l.a.getBoundingClientRect().left,_=l.b.getBoundingClientRect().right,w=(l.a.getBoundingClientRect().width+f)/c*100,$=(l.b.getBoundingClientRect().width+b)/c*100,y=l.a.getBoundingClientRect().width+f+b+l.b.getBoundingClientRect().width):(v=l.a.getBoundingClientRect().top,_=l.b.getBoundingClientRect().bottom,w=(l.a.getBoundingClientRect().height+f)/c*100,$=(l.b.getBoundingClientRect().height+b)/c*100,y=l.a.getBoundingClientRect().height+f+b+l.b.getBoundingClientRect().height),r.pairs[a]=Object.assign(Object.assign({},l),{start:v,end:_,size:y,aSizePct:w,bSizePct:$,gutterSize:h}),Object.assign({},r)}default:return r}}function Sk(r,s=0,i=[]){return ST.toArray(r).reduce(((a,l,c)=>(jI.isFragment(l)?a.push.apply(a,Sk(l.props.children,s+1,i.concat(l.key||c))):nk(l)?a.push(Qg(l,{key:i.concat(String(l.key)).join(".")})):typeof l!="string"&&typeof l!="number"||a.push(l),a)),[])}(function(r){r[r.SetIsReadyToCompute=0]="SetIsReadyToCompute",r[r.CreatePairs=1]="CreatePairs",r[r.CalculateSizes=2]="CalculateSizes",r[r.StartDragging=3]="StartDragging",r[r.StopDragging=4]="StopDragging"})(Ss||(Ss={}));const L_=r=>"changedTouches"in r;var mt,cm;(function(r){r.Horizontal="Horizontal",r.Vertical="Vertical"})(mt||(mt={})),(function(r){r.Light="Light",r.Dark="Dark"})(cm||(cm={}));const Nc=typeof window<"u"&&"ontouchstart"in window;function fg(r){return r===mt.Horizontal?"col-resize":"row-resize"}const UI={isReady:!1,isDragging:!1,pairs:[]};function Yc({direction:r=mt.Horizontal,minWidths:s=[],minHeights:i=[],initialSizes:a,gutterTheme:l=cm.Dark,gutterClassName:c,draggerClassName:h,children:d,onResizeStarted:p,onResizeFinished:f,classes:b=[]}){const v=Sk(d),[_,y]=CT(zI,UI),w=ji(null),$=ji([]),I=ji([]);$.current=[],I.current=[];const T=pe.useCallback((M=>{y({type:Ss.SetIsReadyToCompute,payload:{isReady:M}})}),[]),C=pe.useCallback(((M,W)=>{y({type:Ss.StartDragging,payload:{gutterIdx:W}});const k=_.pairs[W];p==null||p(k.idx),k.a.style.userSelect="none",k.b.style.userSelect="none",k.gutter.style.cursor=fg(M),k.parent.style.cursor=fg(M),document.body.style.cursor=fg(M)}),[_.pairs]),D=pe.useCallback((()=>{y({type:Ss.StopDragging});const M=[];for(let k=0;k<_.pairs.length;k++){const X=_.pairs[k],ge=Kc(r,X.parent);if(ge===void 0)throw new Error("Cannot call the 'onResizeFinished' callback - parentSize is undefined");if(X.gutterSize===void 0)throw new Error("Cannot call 'onResizeFinished' callback - gutterSize is undefined");const ce=k===0,oe=k===_.pairs.length-1,le=X.a.getBoundingClientRect()[r===mt.Horizontal?"width":"height"],{aGutterSize:Q,bGutterSize:F}=lm(X.gutterSize,ce,oe),P=(le+Q)/ge*100;if(M.push(P),oe){const me=(X.b.getBoundingClientRect()[r===mt.Horizontal?"width":"height"]+F)/ge*100;M.push(me)}}if(_.draggingIdx===void 0)throw new Error("Could not reset cursor and user-select because 'state.draggingIdx' is undefined");const W=_.pairs[_.draggingIdx];f==null||f(W.idx,M),W.a.style.userSelect="",W.b.style.userSelect="",W.gutter.style.cursor="",W.parent.style.cursor="",document.body.style.cursor=""}),[_.draggingIdx,_.pairs,r]),R=pe.useCallback(((M,W)=>{y({type:Ss.CalculateSizes,payload:{direction:M,gutterIdx:W}})}),[]),N=pe.useCallback(((M,W,k)=>{y({type:Ss.CreatePairs,payload:{direction:M,children:W,gutters:k}})}),[]),U=pe.useCallback(((M,W,k,X)=>{const ge=W[0].parentNode;if(!ge)throw new Error("Cannot set initial sizes - parent is undefined");if(Kc(M,ge)===void 0)throw new Error("Cannot set initial sizes - parent has undefined size");W.forEach(((ce,oe)=>{const le=oe===0,Q=oe===W.length-1;let F,P=0;W.length>1&&(P=k[Q?oe-1:oe].getBoundingClientRect()[M===mt.Horizontal?"width":"height"],P=le||Q?P/2:P),F=X&&oe<X.length?`calc(${X[oe]}% - ${P}px)`:`calc(${100/W.length}% - ${P}px)`,M===mt.Horizontal?(ce.style.width=F,ce.style.height="100%"):(ce.style.height=F,ce.style.width="100%")}))}),[]),j=pe.useCallback(((M,W)=>{if(_.draggingIdx===void 0)throw new Error("Cannot adjust size - 'draggingIdx' is undefined");const k=_.pairs[_.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 X=k.aSizePct+k.bSizePct,ge=W/k.size*X,ce=X-W/k.size*X,oe=_.draggingIdx===0,le=_.draggingIdx===_.pairs.length-1,{aGutterSize:Q,bGutterSize:F}=lm(k.gutterSize,oe,le),P=`calc(${ge}% - ${Q}px)`,me=`calc(${ce}% - ${F}px)`;M===mt.Horizontal?(k.a.style.width=P,k.b.style.width=me):(k.a.style.height=P,k.b.style.height=me)}),[_.draggingIdx,_.pairs,r]),B=pe.useCallback(((M,W,k)=>{if(!_.isDragging)return;if(_.draggingIdx===void 0)throw new Error("Cannot drag - 'draggingIdx' is undefined");const X=_.pairs[_.draggingIdx];if(X.start===void 0)throw new Error("Cannot drag - 'pair.start' is undefined");if(X.size===void 0)throw new Error("Cannot drag - 'pair.size' is undefined");if(X.gutterSize===void 0)throw new Error("Cannot drag - 'pair.gutterSize' is undefined");let ge=(function(le,Q){const F=L_(Q)?Q.changedTouches[0]:Q;return le===mt.Horizontal?F.clientX:F.clientY})(W,M)-X.start,ce=16,oe=16;k.length>_.draggingIdx&&(ce=k[_.draggingIdx]),k.length>=_.draggingIdx+1&&(oe=k[_.draggingIdx+1]),ge<X.gutterSize+ce&&(ge=X.gutterSize+ce),ge>=X.size-(X.gutterSize+oe)&&(ge=X.size-(X.gutterSize+oe)),j(W,ge)}),[_.isDragging,_.draggingIdx,_.pairs,j]),J=()=>{if(_.isDragging){if(_.draggingIdx===void 0)throw new Error("Cannot calculate sizes after dragging = 'state.draggingIdx' is undefined");R(r,_.draggingIdx),D()}},ae=M=>{_.isDragging&&(L_(M)&&M.preventDefault(),B(M,r,r===mt.Horizontal?s:i))};function ye(M,W){if(!M.current)throw new Error("Can't add element to ref object - ref isn't initialized");W&&!M.current.includes(W)&&M.current.push(W)}return Cc("mouseup",J,[_.isDragging,D]),Cc("mousemove",ae,[r,_.isDragging,B,s,i]),Cc("touchend",J,[_.isDragging,D],{condition:Nc}),Cc("touchmove",ae,[r,_.isDragging,B,s,i],{condition:Nc,passive:!Nc}),Ft((function(){if(!w.current)return;const M=w.current.parentElement;if(!M)return;const W=new ResizeObserver((()=>{const k=getComputedStyle(M),X=r===mt.Horizontal?M.clientWidth:M.clientHeight;T(!!k&&!!X)}));return W.observe(M),()=>{W.disconnect()}}),[w.current,r]),Ft((function(){if(_.isReady&&(!$.current||$.current[0].offsetParent)){if(!$.current||!I.current)throw new Error("Cannot create pairs - either variable 'childRefs' or 'gutterRefs' is undefined");v.length<=1?U(r,$.current,I.current,a):(U(r,$.current,I.current,a),N(r,$.current,I.current))}}),[d,_.isReady,r,U,N,a]),g.jsx("div",Object.assign({className:`__dbk__container ${r}`,ref:w},{children:_.isReady&&v.map(((M,W)=>g.jsxs(pe.Fragment,{children:[g.jsx("div",Object.assign({ref:k=>ye($,k),className:"__dbk__child-wrapper "+(W<b.length?b[W]:"")},{children:M}),void 0),W<v.length-1&&g.jsx(FI,{ref:k=>ye(I,k),className:c,theme:l,draggerClassName:h,direction:r,onDragging:()=>{return R(r,k=W),void C(r,k);var k}},void 0)]},W)))}),void 0)}const Tk=jm({dragDropManager:void 0});function ba(r){"@babel/helpers - typeof";return ba=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},ba(r)}function HI(r,s){if(ba(r)!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var a=i.call(r,s);if(ba(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(r)}function WI(r){var s=HI(r,"string");return ba(s)=="symbol"?s:s+""}function GI(r,s,i){return(s=WI(s))in r?Object.defineProperty(r,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[s]=i,r}function ws(r){return"Minified Redux error #"+r+"; visit https://redux.js.org/Errors?code="+r+" for the full message or use the non-minified dev environment for full errors. "}var P_=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),B_=function(){return Math.random().toString(36).substring(7).split("").join(".")},j_={INIT:"@@redux/INIT"+B_(),REPLACE:"@@redux/REPLACE"+B_()};function VI(r){if(typeof r!="object"||r===null)return!1;for(var s=r;Object.getPrototypeOf(s)!==null;)s=Object.getPrototypeOf(s);return Object.getPrototypeOf(r)===s}function Ik(r,s,i){var a;if(typeof s=="function"&&typeof i=="function"||typeof i=="function"&&typeof arguments[3]=="function")throw new Error(ws(0));if(typeof s=="function"&&typeof i>"u"&&(i=s,s=void 0),typeof i<"u"){if(typeof i!="function")throw new Error(ws(1));return i(Ik)(r,s)}if(typeof r!="function")throw new Error(ws(2));var l=r,c=s,h=[],d=h,p=!1;function f(){d===h&&(d=h.slice())}function b(){if(p)throw new Error(ws(3));return c}function v($){if(typeof $!="function")throw new Error(ws(4));if(p)throw new Error(ws(5));var I=!0;return f(),d.push($),function(){if(I){if(p)throw new Error(ws(6));I=!1,f();var C=d.indexOf($);d.splice(C,1),h=null}}}function _($){if(!VI($))throw new Error(ws(7));if(typeof $.type>"u")throw new Error(ws(8));if(p)throw new Error(ws(9));try{p=!0,c=l(c,$)}finally{p=!1}for(var I=h=d,T=0;T<I.length;T++){var C=I[T];C()}return $}function y($){if(typeof $!="function")throw new Error(ws(10));l=$,_({type:j_.REPLACE})}function w(){var $,I=v;return $={subscribe:function(C){if(typeof C!="object"||C===null)throw new Error(ws(11));function D(){C.next&&C.next(b())}D();var R=I(D);return{unsubscribe:R}}},$[P_]=function(){return this},$}return _({type:j_.INIT}),a={dispatch:_,subscribe:v,getState:b,replaceReducer:y},a[P_]=w,a}function Ue(r,s,...i){if(KI()&&s===void 0)throw new Error("invariant requires an error message argument");if(!r){let a;if(s===void 0)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let l=0;a=new Error(s.replace(/%s/g,function(){return i[l++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}}function KI(){return typeof process<"u"&&!0}function YI(r,s,i){return s.split(".").reduce((a,l)=>a&&a[l]?a[l]:i||null,r)}function JI(r,s){return r.filter(i=>i!==s)}function Ek(r){return typeof r=="object"}function qI(r,s){const i=new Map,a=c=>{i.set(c,i.has(c)?i.get(c)+1:1)};r.forEach(a),s.forEach(a);const l=[];return i.forEach((c,h)=>{c===1&&l.push(h)}),l}function XI(r,s){return r.filter(i=>s.indexOf(i)>-1)}const Um="dnd-core/INIT_COORDS",vu="dnd-core/BEGIN_DRAG",Hm="dnd-core/PUBLISH_DRAG_SOURCE",_u="dnd-core/HOVER",wu="dnd-core/DROP",ku="dnd-core/END_DRAG";function F_(r,s){return{type:Um,payload:{sourceClientOffset:s||null,clientOffset:r||null}}}const ZI={type:Um,payload:{clientOffset:null,sourceClientOffset:null}};function QI(r){return function(i=[],a={publishSource:!0}){const{publishSource:l=!0,clientOffset:c,getSourceClientOffset:h}=a,d=r.getMonitor(),p=r.getRegistry();r.dispatch(F_(c)),eE(i,d,p);const f=oE(i,d);if(f==null){r.dispatch(ZI);return}let b=null;if(c){if(!h)throw new Error("getSourceClientOffset must be defined");tE(h),b=h(f)}r.dispatch(F_(c,b));const _=p.getSource(f).beginDrag(d,f);if(_==null)return;sE(_),p.pinSource(f);const y=p.getSourceType(f);return{type:vu,payload:{itemType:y,item:_,sourceId:f,clientOffset:c||null,sourceClientOffset:b||null,isSourcePublic:!!l}}}}function eE(r,s,i){Ue(!s.isDragging(),"Cannot call beginDrag while dragging."),r.forEach(function(a){Ue(i.getSource(a),"Expected sourceIds to be registered.")})}function tE(r){Ue(typeof r=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function sE(r){Ue(Ek(r),"Item must be an object.")}function oE(r,s){let i=null;for(let a=r.length-1;a>=0;a--)if(s.canDragSource(r[a])){i=r[a];break}return i}function iE(r,s,i){return s in r?Object.defineProperty(r,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[s]=i,r}function nE(r){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},a=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),a.forEach(function(l){iE(r,l,i[l])})}return r}function rE(r){return function(i={}){const a=r.getMonitor(),l=r.getRegistry();aE(a),uE(a).forEach((h,d)=>{const p=lE(h,d,l,a),f={type:wu,payload:{dropResult:nE({},i,p)}};r.dispatch(f)})}}function aE(r){Ue(r.isDragging(),"Cannot call drop while not dragging."),Ue(!r.didDrop(),"Cannot call drop twice during one drag operation.")}function lE(r,s,i,a){const l=i.getTarget(r);let c=l?l.drop(a,r):void 0;return cE(c),typeof c>"u"&&(c=s===0?{}:a.getDropResult()),c}function cE(r){Ue(typeof r>"u"||Ek(r),"Drop result must either be an object or undefined.")}function uE(r){const s=r.getTargetIds().filter(r.canDropOnTarget,r);return s.reverse(),s}function dE(r){return function(){const i=r.getMonitor(),a=r.getRegistry();hE(i);const l=i.getSourceId();return l!=null&&(a.getSource(l,!0).endDrag(i,l),a.unpinSource()),{type:ku}}}function hE(r){Ue(r.isDragging(),"Cannot call endDrag while not dragging.")}function um(r,s){return s===null?r===null:Array.isArray(r)?r.some(i=>i===s):r===s}function pE(r){return function(i,{clientOffset:a}={}){gE(i);const l=i.slice(0),c=r.getMonitor(),h=r.getRegistry(),d=c.getItemType();return fE(l,h,d),mE(l,c,h),$E(l,c,h),{type:_u,payload:{targetIds:l,clientOffset:a||null}}}}function gE(r){Ue(Array.isArray(r),"Expected targetIds to be an array.")}function mE(r,s,i){Ue(s.isDragging(),"Cannot call hover while not dragging."),Ue(!s.didDrop(),"Cannot call hover after drop.");for(let a=0;a<r.length;a++){const l=r[a];Ue(r.lastIndexOf(l)===a,"Expected targetIds to be unique in the passed array.");const c=i.getTarget(l);Ue(c,"Expected targetIds to be registered.")}}function fE(r,s,i){for(let a=r.length-1;a>=0;a--){const l=r[a],c=s.getTargetType(l);um(c,i)||r.splice(a,1)}}function $E(r,s,i){r.forEach(function(a){i.getTarget(a).hover(s,a)})}function bE(r){return function(){if(r.getMonitor().isDragging())return{type:Hm}}}function yE(r){return{beginDrag:QI(r),publishDragSource:bE(r),hover:pE(r),drop:rE(r),endDrag:dE(r)}}class vE{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 a(c){return(...h)=>{const d=c.apply(s,h);typeof d<"u"&&i(d)}}const l=yE(this);return Object.keys(l).reduce((c,h)=>{const d=l[h];return c[h]=a(d),c},{})}dispatch(s){this.store.dispatch(s)}constructor(s,i){this.isSetUp=!1,this.handleRefCountChange=()=>{const a=this.store.getState().refCount>0;this.backend&&(a&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!a&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=s,this.monitor=i,s.subscribe(this.handleRefCountChange)}}function _E(r,s){return{x:r.x+s.x,y:r.y+s.y}}function xk(r,s){return{x:r.x-s.x,y:r.y-s.y}}function wE(r){const{clientOffset:s,initialClientOffset:i,initialSourceClientOffset:a}=r;return!s||!i||!a?null:xk(_E(s,a),i)}function kE(r){const{clientOffset:s,initialClientOffset:i}=r;return!s||!i?null:xk(s,i)}const da=[],Wm=[];da.__IS_NONE__=!0;Wm.__IS_ALL__=!0;function CE(r,s){return r===da?!1:r===Wm||typeof s>"u"?!0:XI(s,r).length>0}class SE{subscribeToStateChange(s,i={}){const{handlerIds:a}=i;Ue(typeof s=="function","listener must be a function."),Ue(typeof a>"u"||Array.isArray(a),"handlerIds, when specified, must be an array of strings.");let l=this.store.getState().stateId;const c=()=>{const h=this.store.getState(),d=h.stateId;try{d===l||d===l+1&&!CE(h.dirtyHandlerIds,a)||s()}finally{l=d}};return this.store.subscribe(c)}subscribeToOffsetChange(s){Ue(typeof s=="function","listener must be a function.");let i=this.store.getState().dragOffset;const a=()=>{const l=this.store.getState().dragOffset;l!==i&&(i=l,s())};return this.store.subscribe(a)}canDragSource(s){if(!s)return!1;const i=this.registry.getSource(s);return Ue(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(Ue(i,`Expected to find a valid target. targetId=${s}`),!this.isDragging()||this.didDrop())return!1;const a=this.registry.getTargetType(s),l=this.getItemType();return um(a,l)&&i.canDrop(this,s)}isDragging(){return!!this.getItemType()}isDraggingSource(s){if(!s)return!1;const i=this.registry.getSource(s,!0);if(Ue(i,`Expected to find a valid source. sourceId=${s}`),!this.isDragging()||!this.isSourcePublic())return!1;const a=this.registry.getSourceType(s),l=this.getItemType();return a!==l?!1:i.isDragging(this,s)}isOverTarget(s,i={shallow:!1}){if(!s)return!1;const{shallow:a}=i;if(!this.isDragging())return!1;const l=this.registry.getTargetType(s),c=this.getItemType();if(c&&!um(l,c))return!1;const h=this.getTargetIds();if(!h.length)return!1;const d=h.indexOf(s);return a?d===h.length-1:d>-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 wE(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return kE(this.store.getState().dragOffset)}constructor(s,i){this.store=s,this.registry=i}}const z_=typeof global<"u"?global:self,Dk=z_.MutationObserver||z_.WebKitMutationObserver;function Ak(r){return function(){const i=setTimeout(l,0),a=setInterval(l,50);function l(){clearTimeout(i),clearInterval(a),r()}}}function TE(r){let s=1;const i=new Dk(r),a=document.createTextNode("");return i.observe(a,{characterData:!0}),function(){s=-s,a.data=s}}const IE=typeof Dk=="function"?TE:Ak;class EE{enqueueTask(s){const{queue:i,requestFlush:a}=this;i.length||(a(),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 a=0,l=s.length-this.index;a<l;a++)s[a]=s[a+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=Ak(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class xE{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 DE{create(s){const i=this.freeTasks,a=i.length?i.pop():new xE(this.onError,l=>i[i.length]=l);return a.task=s,a}constructor(s){this.onError=s,this.freeTasks=[]}}const Rk=new EE,AE=new DE(Rk.registerPendingError);function RE(r){Rk.enqueueTask(AE.create(r))}const Gm="dnd-core/ADD_SOURCE",Vm="dnd-core/ADD_TARGET",Km="dnd-core/REMOVE_SOURCE",Cu="dnd-core/REMOVE_TARGET";function OE(r){return{type:Gm,payload:{sourceId:r}}}function ME(r){return{type:Vm,payload:{targetId:r}}}function NE(r){return{type:Km,payload:{sourceId:r}}}function LE(r){return{type:Cu,payload:{targetId:r}}}function PE(r){Ue(typeof r.canDrag=="function","Expected canDrag to be a function."),Ue(typeof r.beginDrag=="function","Expected beginDrag to be a function."),Ue(typeof r.endDrag=="function","Expected endDrag to be a function.")}function BE(r){Ue(typeof r.canDrop=="function","Expected canDrop to be a function."),Ue(typeof r.hover=="function","Expected hover to be a function."),Ue(typeof r.drop=="function","Expected beginDrag to be a function.")}function dm(r,s){if(s&&Array.isArray(r)){r.forEach(i=>dm(i,!1));return}Ue(typeof r=="string"||typeof r=="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 Cs;(function(r){r.SOURCE="SOURCE",r.TARGET="TARGET"})(Cs||(Cs={}));let jE=0;function FE(){return jE++}function zE(r){const s=FE().toString();switch(r){case Cs.SOURCE:return`S${s}`;case Cs.TARGET:return`T${s}`;default:throw new Error(`Unknown Handler Role: ${r}`)}}function U_(r){switch(r[0]){case"S":return Cs.SOURCE;case"T":return Cs.TARGET;default:throw new Error(`Cannot parse handler ID: ${r}`)}}function H_(r,s){const i=r.entries();let a=!1;do{const{done:l,value:[,c]}=i.next();if(c===s)return!0;a=!!l}while(!a);return!1}class UE{addSource(s,i){dm(s),PE(i);const a=this.addHandler(Cs.SOURCE,s,i);return this.store.dispatch(OE(a)),a}addTarget(s,i){dm(s,!0),BE(i);const a=this.addHandler(Cs.TARGET,s,i);return this.store.dispatch(ME(a)),a}containsHandler(s){return H_(this.dragSources,s)||H_(this.dropTargets,s)}getSource(s,i=!1){return Ue(this.isSourceId(s),"Expected a valid source ID."),i&&s===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(s)}getTarget(s){return Ue(this.isTargetId(s),"Expected a valid target ID."),this.dropTargets.get(s)}getSourceType(s){return Ue(this.isSourceId(s),"Expected a valid source ID."),this.types.get(s)}getTargetType(s){return Ue(this.isTargetId(s),"Expected a valid target ID."),this.types.get(s)}isSourceId(s){return U_(s)===Cs.SOURCE}isTargetId(s){return U_(s)===Cs.TARGET}removeSource(s){Ue(this.getSource(s),"Expected an existing source."),this.store.dispatch(NE(s)),RE(()=>{this.dragSources.delete(s),this.types.delete(s)})}removeTarget(s){Ue(this.getTarget(s),"Expected an existing target."),this.store.dispatch(LE(s)),this.dropTargets.delete(s),this.types.delete(s)}pinSource(s){const i=this.getSource(s);Ue(i,"Expected an existing source."),this.pinnedSourceId=s,this.pinnedSource=i}unpinSource(){Ue(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(s,i,a){const l=zE(s);return this.types.set(l,i),s===Cs.SOURCE?this.dragSources.set(l,a):s===Cs.TARGET&&this.dropTargets.set(l,a),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 HE=(r,s)=>r===s;function WE(r,s){return!r&&!s?!0:!r||!s?!1:r.x===s.x&&r.y===s.y}function GE(r,s,i=HE){if(r.length!==s.length)return!1;for(let a=0;a<r.length;++a)if(!i(r[a],s[a]))return!1;return!0}function VE(r=da,s){switch(s.type){case _u:break;case Gm:case Vm:case Cu:case Km:return da;case vu:case Hm:case ku:case wu:default:return Wm}const{targetIds:i=[],prevTargetIds:a=[]}=s.payload,l=qI(i,a);if(!(l.length>0||!GE(i,a)))return da;const h=a[a.length-1],d=i[i.length-1];return h!==d&&(h&&l.push(h),d&&l.push(d)),l}function KE(r,s,i){return s in r?Object.defineProperty(r,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[s]=i,r}function YE(r){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},a=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),a.forEach(function(l){KE(r,l,i[l])})}return r}const W_={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function JE(r=W_,s){const{payload:i}=s;switch(s.type){case Um:case vu:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case _u:return WE(r.clientOffset,i.clientOffset)?r:YE({},r,{clientOffset:i.clientOffset});case ku:case wu:return W_;default:return r}}function qE(r,s,i){return s in r?Object.defineProperty(r,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[s]=i,r}function Nn(r){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},a=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),a.forEach(function(l){qE(r,l,i[l])})}return r}const XE={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function ZE(r=XE,s){const{payload:i}=s;switch(s.type){case vu:return Nn({},r,{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case Hm:return Nn({},r,{isSourcePublic:!0});case _u:return Nn({},r,{targetIds:i.targetIds});case Cu:return r.targetIds.indexOf(i.targetId)===-1?r:Nn({},r,{targetIds:JI(r.targetIds,i.targetId)});case wu:return Nn({},r,{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case ku:return Nn({},r,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return r}}function QE(r=0,s){switch(s.type){case Gm:case Vm:return r+1;case Km:case Cu:return r-1;default:return r}}function ex(r=0){return r+1}function tx(r,s,i){return s in r?Object.defineProperty(r,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[s]=i,r}function sx(r){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},a=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),a.forEach(function(l){tx(r,l,i[l])})}return r}function ox(r={},s){return{dirtyHandlerIds:VE(r.dirtyHandlerIds,{type:s.type,payload:sx({},s.payload,{prevTargetIds:YI(r,"dragOperation.targetIds",[])})}),dragOffset:JE(r.dragOffset,s),refCount:QE(r.refCount,s),dragOperation:ZE(r.dragOperation,s),stateId:ex(r.stateId)}}function ix(r,s=void 0,i={},a=!1){const l=nx(a),c=new SE(l,new UE(l)),h=new vE(l,c),d=r(h,s,i);return h.receiveBackend(d),h}function nx(r){const s=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Ik(ox,r&&s&&s({name:"dnd-core",instanceId:"dnd-core"}))}function rx(r,s){if(r==null)return{};var i=ax(r,s),a,l;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(r);for(l=0;l<c.length;l++)a=c[l],!(s.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(r,a)&&(i[a]=r[a])}return i}function ax(r,s){if(r==null)return{};var i={},a=Object.keys(r),l,c;for(c=0;c<a.length;c++)l=a[c],!(s.indexOf(l)>=0)&&(i[l]=r[l]);return i}let G_=0;const Lc=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Ok=Fm(function(s){var{children:i}=s,a=rx(s,["children"]);const[l,c]=lx(a);return Ft(()=>{if(c){const h=Mk();return++G_,()=>{--G_===0&&(h[Lc]=null)}}},[]),g.jsx(Tk.Provider,{value:l,children:i})});function lx(r){if("manager"in r)return[{dragDropManager:r.manager},!1];const s=cx(r.backend,r.context,r.options,r.debugMode),i=!r.context;return[s,i]}function cx(r,s=Mk(),i,a){const l=s;return l[Lc]||(l[Lc]={dragDropManager:ix(r,s,i,a)}),l[Lc]}function Mk(){return typeof global<"u"?global:window}var ux=function r(s,i){if(s===i)return!0;if(s&&i&&typeof s=="object"&&typeof i=="object"){if(s.constructor!==i.constructor)return!1;var a,l,c;if(Array.isArray(s)){if(a=s.length,a!=i.length)return!1;for(l=a;l--!==0;)if(!r(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(c=Object.keys(s),a=c.length,a!==Object.keys(i).length)return!1;for(l=a;l--!==0;)if(!Object.prototype.hasOwnProperty.call(i,c[l]))return!1;for(l=a;l--!==0;){var h=c[l];if(!r(s[h],i[h]))return!1}return!0}return s!==s&&i!==i};const dx=ri(ux),Wi=typeof window<"u"?rk:Ft;function hx(r,s,i){const[a,l]=St(()=>s(r)),c=zn(()=>{const h=s(r);dx(a,h)||(l(h),i&&i())},[a,r,i]);return Wi(c),[a,c]}function px(r,s,i){const[a,l]=hx(r,s,i);return Wi(function(){const h=r.getHandlerId();if(h!=null)return r.subscribeToStateChange(l,{handlerIds:[h]})},[r,l]),a}function Nk(r,s,i){return px(s,r||(()=>({})),()=>i.reconnect())}function Lk(r,s){const i=[];return typeof r!="function"&&i.push(r),gs(()=>typeof r=="function"?r():r,i)}function gx(r){return gs(()=>r.hooks.dragSource(),[r])}function mx(r){return gs(()=>r.hooks.dragPreview(),[r])}let $g=!1,bg=!1;class fx{receiveHandlerId(s){this.sourceId=s}getHandlerId(){return this.sourceId}canDrag(){Ue(!$g,"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 $g=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{$g=!1}}isDragging(){if(!this.sourceId)return!1;Ue(!bg,"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 bg=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{bg=!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 yg=!1;class $x{receiveHandlerId(s){this.targetId=s}getHandlerId(){return this.targetId}subscribeToStateChange(s,i){return this.internalMonitor.subscribeToStateChange(s,i)}canDrop(){if(!this.targetId)return!1;Ue(!yg,"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 yg=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{yg=!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 bx(r,s,i){const a=i.getRegistry(),l=a.addTarget(r,s);return[l,()=>a.removeTarget(l)]}function yx(r,s,i){const a=i.getRegistry(),l=a.addSource(r,s);return[l,()=>a.removeSource(l)]}function hm(r,s,i,a){let l;if(l!==void 0)return!!l;if(r===s)return!0;if(typeof r!="object"||!r||typeof s!="object"||!s)return!1;const c=Object.keys(r),h=Object.keys(s);if(c.length!==h.length)return!1;const d=Object.prototype.hasOwnProperty.bind(s);for(let p=0;p<c.length;p++){const f=c[p];if(!d(f))return!1;const b=r[f],v=s[f];if(l=void 0,l===!1||l===void 0&&b!==v)return!1}return!0}function pm(r){return r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,"current")}function vx(r){if(typeof r.type=="string")return;const s=r.type.displayName||r.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 _x(r){return(s=null,i=null)=>{if(!nk(s)){const c=s;return r(c,i),c}const a=s;return vx(a),wx(a,i?c=>r(c,i):r)}}function Pk(r){const s={};return Object.keys(r).forEach(i=>{const a=r[i];if(i.endsWith("Ref"))s[i]=r[i];else{const l=_x(a);s[i]=()=>l}}),s}function V_(r,s){typeof r=="function"?r(s):r.current=s}function wx(r,s){const i=r.ref;return Ue(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?Qg(r,{ref:a=>{V_(i,a),V_(s,a)}}):Qg(r,{ref:s})}class kx{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,a=s||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(a&&this.disconnectDragPreview(),!!this.handlerId){if(!i){this.lastConnectedDragPreview=i;return}a&&(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!hm(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!hm(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=Pk({dragSource:(i,a)=>{this.clearDragSource(),this.dragSourceOptions=a||null,pm(i)?this.dragSourceRef=i:this.dragSourceNode=i,this.reconnectDragSource()},dragPreview:(i,a)=>{this.clearDragPreview(),this.dragPreviewOptions=a||null,pm(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 Cx{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!hm(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=Pk({dropTarget:(i,a)=>{this.clearDropTarget(),this.dropTargetOptions=a,pm(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 er(){const{dragDropManager:r}=TT(Tk);return Ue(r!=null,"Expected drag drop context"),r}function Sx(r,s){const i=er(),a=gs(()=>new kx(i.getBackend()),[i]);return Wi(()=>(a.dragSourceOptions=r||null,a.reconnect(),()=>a.disconnectDragSource()),[a,r]),Wi(()=>(a.dragPreviewOptions=s||null,a.reconnect(),()=>a.disconnectDragPreview()),[a,s]),a}function Tx(){const r=er();return gs(()=>new fx(r),[r])}class Ix{beginDrag(){const s=this.spec,i=this.monitor;let a=null;return typeof s.item=="object"?a=s.item:typeof s.item=="function"?a=s.item(i):a={},a??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 a=this.spec,l=this.monitor,{isDragging:c}=a;return c?c(l):i===s.getSourceId()}endDrag(){const s=this.spec,i=this.monitor,a=this.connector,{end:l}=s;l&&l(i.getItem(),i),a.reconnect()}constructor(s,i,a){this.spec=s,this.monitor=i,this.connector=a}}function Ex(r,s,i){const a=gs(()=>new Ix(r,s,i),[s,i]);return Ft(()=>{a.spec=r},[r]),a}function xx(r){return gs(()=>{const s=r.type;return Ue(s!=null,"spec.type must be defined"),s},[r])}function Dx(r,s,i){const a=er(),l=Ex(r,s,i),c=xx(r);Wi(function(){if(c!=null){const[d,p]=yx(c,l,a);return s.receiveHandlerId(d),i.receiveHandlerId(d),p}},[a,s,i,l,c])}function Ax(r,s){const i=Lk(r);Ue(!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 a=Tx(),l=Sx(i.options,i.previewOptions);return Dx(i,a,l),[Nk(i.collect,a,l),gx(l),mx(l)]}function Rx(r){return gs(()=>r.hooks.dropTarget(),[r])}function Ox(r){const s=er(),i=gs(()=>new Cx(s.getBackend()),[s]);return Wi(()=>(i.dropTargetOptions=r||null,i.reconnect(),()=>i.disconnectDropTarget()),[r]),i}function Mx(){const r=er();return gs(()=>new $x(r),[r])}function Nx(r){const{accept:s}=r;return gs(()=>(Ue(r.accept!=null,"accept must be defined"),Array.isArray(s)?s:[s]),[s])}class Lx{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 Px(r,s){const i=gs(()=>new Lx(r,s),[s]);return Ft(()=>{i.spec=r},[r]),i}function Bx(r,s,i){const a=er(),l=Px(r,s),c=Nx(r);Wi(function(){const[d,p]=bx(c,l,a);return s.receiveHandlerId(d),i.receiveHandlerId(d),p},[a,s,l,i,c.map(h=>h.toString()).join("|")])}function jx(r,s){const i=Lk(r),a=Mx(),l=Ox(i.options);return Bx(i,a,l),[Nk(i.collect,a,l),Rx(l)]}function Bk(r){let s=null;return()=>(s==null&&(s=r()),s)}function Fx(r,s){return r.filter(i=>i!==s)}function zx(r,s){const i=new Set,a=c=>i.add(c);r.forEach(a),s.forEach(a);const l=[];return i.forEach(c=>l.push(c)),l}class Ux{enter(s){const i=this.entered.length,a=l=>this.isNodeInDocument(l)&&(!l.contains||l.contains(s));return this.entered=zx(this.entered.filter(a),[s]),i===0&&this.entered.length>0}leave(s){const i=this.entered.length;return this.entered=Fx(this.entered.filter(this.isNodeInDocument),s),i>0&&this.entered.length===0}reset(){this.entered=[]}constructor(s){this.entered=[],this.isNodeInDocument=s}}class Hx{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(a=>{const l=this.config.exposeProperties[a];l!=null&&(i[a]={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 jk="__NATIVE_FILE__",Fk="__NATIVE_URL__",zk="__NATIVE_TEXT__",Uk="__NATIVE_HTML__",K_=Object.freeze(Object.defineProperty({__proto__:null,FILE:jk,HTML:Uk,TEXT:zk,URL:Fk},Symbol.toStringTag,{value:"Module"}));function vg(r,s,i){const a=s.reduce((l,c)=>l||r.getData(c),"");return a??i}const gm={[jk]:{exposeProperties:{files:r=>Array.prototype.slice.call(r.files),items:r=>r.items,dataTransfer:r=>r},matchesTypes:["Files"]},[Uk]:{exposeProperties:{html:(r,s)=>vg(r,s,""),dataTransfer:r=>r},matchesTypes:["Html","text/html"]},[Fk]:{exposeProperties:{urls:(r,s)=>vg(r,s,"").split(`
|
|
92
|
+
`),dataTransfer:r=>r},matchesTypes:["Url","text/uri-list"]},[zk]:{exposeProperties:{text:(r,s)=>vg(r,s,""),dataTransfer:r=>r},matchesTypes:["Text","text/plain"]}};function Wx(r,s){const i=gm[r];if(!i)throw new Error(`native type ${r} has no configuration`);const a=new Hx(i);return a.loadDataTransfer(s),a}function _g(r){if(!r)return null;const s=Array.prototype.slice.call(r.types||[]);return Object.keys(gm).filter(i=>{const a=gm[i];return a!=null&&a.matchesTypes?a.matchesTypes.some(l=>s.indexOf(l)>-1):!1})[0]||null}const Gx=Bk(()=>/firefox/i.test(navigator.userAgent)),Hk=Bk(()=>!!window.safari);class Y_{interpolate(s){const{xs:i,ys:a,c1s:l,c2s:c,c3s:h}=this;let d=i.length-1;if(s===i[d])return a[d];let p=0,f=h.length-1,b;for(;p<=f;){b=Math.floor(.5*(p+f));const y=i[b];if(y<s)p=b+1;else if(y>s)f=b-1;else return a[b]}d=Math.max(0,f);const v=s-i[d],_=v*v;return a[d]+l[d]*v+c[d]*_+h[d]*v*_}constructor(s,i){const{length:a}=s,l=[];for(let y=0;y<a;y++)l.push(y);l.sort((y,w)=>s[y]<s[w]?-1:1);const c=[],h=[];let d,p;for(let y=0;y<a-1;y++)d=s[y+1]-s[y],p=i[y+1]-i[y],c.push(d),h.push(p/d);const f=[h[0]];for(let y=0;y<c.length-1;y++){const w=h[y],$=h[y+1];if(w*$<=0)f.push(0);else{d=c[y];const I=c[y+1],T=d+I;f.push(3*T/((T+I)/w+(T+d)/$))}}f.push(h[h.length-1]);const b=[],v=[];let _;for(let y=0;y<f.length-1;y++){_=h[y];const w=f[y],$=1/c[y],I=w+f[y+1]-_-_;b.push((_-w-I)*$),v.push(I*$*$)}this.xs=s,this.ys=i,this.c1s=f,this.c2s=b,this.c3s=v}}const Vx=1;function Wk(r){const s=r.nodeType===Vx?r:r.parentElement;if(!s)return null;const{top:i,left:a}=s.getBoundingClientRect();return{x:a,y:i}}function Sc(r){return{x:r.clientX,y:r.clientY}}function Kx(r){var s;return r.nodeName==="IMG"&&(Gx()||!(!((s=document.documentElement)===null||s===void 0)&&s.contains(r)))}function Yx(r,s,i,a){let l=r?s.width:i,c=r?s.height:a;return Hk()&&r&&(c/=window.devicePixelRatio,l/=window.devicePixelRatio),{dragPreviewWidth:l,dragPreviewHeight:c}}function Jx(r,s,i,a,l){const c=Kx(s),d=Wk(c?r:s),p={x:i.x-d.x,y:i.y-d.y},{offsetWidth:f,offsetHeight:b}=r,{anchorX:v,anchorY:_}=a,{dragPreviewWidth:y,dragPreviewHeight:w}=Yx(c,s,f,b),$=()=>{let U=new Y_([0,.5,1],[p.y,p.y/b*w,p.y+w-b]).interpolate(_);return Hk()&&c&&(U+=(window.devicePixelRatio-1)*w),U},I=()=>new Y_([0,.5,1],[p.x,p.x/f*y,p.x+y-f]).interpolate(v),{offsetX:T,offsetY:C}=l,D=T===0||T,R=C===0||C;return{x:D?T:I(),y:R?C:$()}}let qx=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 Xx(r,s,i){return s in r?Object.defineProperty(r,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[s]=i,r}function J_(r){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{},a=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(i).filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable}))),a.forEach(function(l){Xx(r,l,i[l])})}return r}class Zx{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,a){return this.sourcePreviewNodeOptions.set(s,a),this.sourcePreviewNodes.set(s,i),()=>{this.sourcePreviewNodes.delete(s),this.sourcePreviewNodeOptions.delete(s)}}connectDragSource(s,i,a){this.sourceNodes.set(s,i),this.sourceNodeOptions.set(s,a);const l=h=>this.handleDragStart(h,s),c=h=>this.handleSelectStart(h);return i.setAttribute("draggable","true"),i.addEventListener("dragstart",l),i.addEventListener("selectstart",c),()=>{this.sourceNodes.delete(s),this.sourceNodeOptions.delete(s),i.removeEventListener("dragstart",l),i.removeEventListener("selectstart",c),i.setAttribute("draggable","false")}}connectDropTarget(s,i){const a=h=>this.handleDragEnter(h,s),l=h=>this.handleDragOver(h,s),c=h=>this.handleDrop(h,s);return i.addEventListener("dragenter",a),i.addEventListener("dragover",l),i.addEventListener("drop",c),()=>{i.removeEventListener("dragenter",a),i.removeEventListener("dragover",l),i.removeEventListener("drop",c)}}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 J_({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 J_({anchorX:.5,anchorY:.5,captureDraggingState:!1},i||{})}isDraggingNativeItem(){const s=this.monitor.getItemType();return Object.keys(K_).some(i=>K_[i]===s)}beginDragNativeItem(s,i){this.clearCurrentDragSourceNode(),this.currentNativeSource=Wx(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 a;return(a=this.rootElement)===null||a===void 0?void 0:a.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,a){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 c=this.sourceNodes.get(l);return c&&Wk(c)||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:c}=this;this.dragStartSourceIds=null;const h=Sc(l);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(c||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:h});const{dataTransfer:d}=l,p=_g(d);if(this.monitor.isDragging()){if(d&&typeof d.setDragImage=="function"){const b=this.monitor.getSourceId(),v=this.sourceNodes.get(b),_=this.sourcePreviewNodes.get(b)||v;if(_){const{anchorX:y,anchorY:w,offsetX:$,offsetY:I}=this.getCurrentSourcePreviewNodeOptions(),D=Jx(v,_,h,{anchorX:y,anchorY:w},{offsetX:$,offsetY:I});d.setDragImage(_,D.x,D.y)}}try{d==null||d.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(l.target);const{captureDraggingState:f}=this.getCurrentSourcePreviewNodeOptions();f?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(p)this.beginDragNativeItem(p);else{if(d&&!d.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 c;(c=this.currentNativeSource)===null||c===void 0||c.loadDataTransfer(l.dataTransfer)}if(!this.enterLeaveCounter.enter(l.target)||this.monitor.isDragging())return;const{dataTransfer:d}=l,p=_g(d);p&&this.beginDragNativeItem(p,d)},this.handleTopDragEnter=l=>{const{dragEnterTargetIds:c}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=l.altKey,c.length>0&&this.actions.hover(c,{clientOffset:Sc(l)}),c.some(d=>this.monitor.canDropOnTarget(d))&&(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=l=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var c;(c=this.currentNativeSource)===null||c===void 0||c.loadDataTransfer(l.dataTransfer)}},this.handleTopDragOver=l=>{const{dragOverTargetIds:c}=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(c),(c||[]).some(d=>this.monitor.canDropOnTarget(d))?(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 c;l.preventDefault(),(c=this.currentNativeSource)===null||c===void 0||c.loadDataTransfer(l.dataTransfer)}else _g(l.dataTransfer)&&l.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=l=>{const{dropTargetIds:c}=this;this.dropTargetIds=[],this.actions.hover(c,{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 c=l.target;typeof c.dragDrop=="function"&&(c.tagName==="INPUT"||c.tagName==="SELECT"||c.tagName==="TEXTAREA"||c.isContentEditable||(l.preventDefault(),c.dragDrop()))},this.options=new qx(i,a),this.actions=s.getActions(),this.monitor=s.getMonitor(),this.registry=s.getRegistry(),this.enterLeaveCounter=new Ux(this.isNodeInDocument)}}const Gk=function(s,i,a){return new Zx(s,i,a)},Qx=vt([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"),e0=vt(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"),t0=vt(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"),s0=vt(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"),o0=vt(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"),i0=vt(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"),n0=vt(g.jsx("path",{d:"M7 2v11h3v9l7-12h-4l4-8z"}),"FlashOn"),r0=vt(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"),a0=vt(g.jsx("path",{d:"M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z"}),"Functions"),Vk=vt(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"),l0=vt(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"),q_=vt(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"),c0=vt(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"),u0=vt(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"),Pc=vt(g.jsx("path",{d:"M6 19h4V5H6zm8-14v14h4V5z"}),"Pause"),mm=vt(g.jsx("path",{d:"M8 5v14l11-7z"}),"PlayArrow"),d0=vt(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"),h0=vt(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"),p0=vt(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"),g0=vt(g.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}),"Storage"),m0=vt(g.jsx("path",{d:"M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z"}),"Subject"),f0=vt(g.jsx("path",{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99zM9 3 5 6.99h3V14h2V6.99h3z"}),"SwapVert"),$0=vt(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"),b0=vt(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"),Jc="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",Kk="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",Yk="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",Jk="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIj4KICAgIDxyYWRpYWxHcmFkaWVudCBpZD0ibXlHcmFkaWVudCI+CiAgICAgICAgPHN0b3Agb2Zmc2V0PSIxMCUiIHN0b3AtY29sb3I9IiMxQzJENUYiIC8+CiAgICAgICAgPHN0b3Agb2Zmc2V0PSI5NSUiIHN0b3AtY29sb3I9IiMwQjFENTMiIC8+CiAgICA8L3JhZGlhbEdyYWRpZW50PgogICAgPHBhdGggZmlsbD0idXJsKCcjbXlHcmFkaWVudCcpIiBkPSJNLS4xLS4xaDUxMnY1MTJILS4xVi0uMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNmOGY4ZmEiCiAgICAgICAgICBkPSJNNDgyLjUgMjMxLjV2NmgtMjVjLS45NzItOC4xNy01LjYzOS0xMi4xNy0xNC0xMi05LjUzMS4wMjktMTMuMzY1IDQuNjk1LTExLjUgMTRsNC41IDQuNSAzMyA4YzE5LjM4OCA5LjYzNCAyMy4zODggMjMuODAxIDEyIDQyLjVhMzUuMDYgMzUuMDYgMCAwIDAtOCA2Yy0xMy45MjUgNC43NjEtMjguMjU4IDYuMjYxLTQzIDQuNS0xMC42MDEtMS4wMjQtMTguOTM1LTUuODU3LTI1LTE0LjUtMS4wNzctMi4yMjktMS43NDQtNC41NjMtMi03di04aDI1YzEuNDk1IDQuMjc5IDMuODI4IDguMTEzIDcgMTEuNSA3LjQ3OCAyLjI1OCAxNC44MTEgMS45MjUgMjItMSAyLjg5NC0yLjkwOSAzLjcyNy02LjQwOSAyLjUtMTAuNWEzNi44IDM2LjggMCAwIDAtMTIuNS01LjUgNTM5Ljc5IDUzOS43OSAwIDAgMS0yOC04Yy0xMi44NzQtNi41NjItMTcuNzA3LTE3LjA2Mi0xNC41LTMxLjUgMy41Ny0xMC41NjkgMTAuNzM3LTE3LjQwMyAyMS41LTIwLjUgMTYuMTQ4LTQuNTM5IDMxLjQ4Mi0yLjcwNiA0NiA1LjUgMiAyLjY2NyA0LjMzMyA1IDcgNyAxLjg3MSAyLjczNCAyLjg3MSA1LjczNCAzIDl6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTRhYmJmIiBkPSJNMTUzLjUgMjA5LjVjLjA2LS41NDMuMzkzLS44NzYgMS0xYTEwMjQuNjMgMTAyNC42MyAwIDAgMSAxIDY0bC0yLTYzeiIvPgogICAgPHBhdGggZmlsbD0iI2ZhZmJmYyIKICAgICAgICAgIGQ9Ik0xNTMuNSAyMDkuNWwyIDYzYzEuMjc4IDExLjQ0NCA3LjYxMSAxNi4yNzcgMTkgMTQuNSA4LjcwNC0xLjM3OCAxMy4yMDQtNi41NDQgMTMuNS0xNS41LjUtMjAuNjY0LjY2Ny00MS4zMzEuNS02MiA5Ljc0My0uMjE5IDE5LjQwOS0uMjE5IDI5IDAgLjQwMSAyMy4zNjItLjA5OSA0Ni42OTYtMS41IDcwLTQuMjk4IDE0Ljk2OC0xNC4xMzEgMjMuNDY4LTI5LjUgMjUuNWEyMjUuMTQgMjI1LjE0IDAgMCAxLTMwIDBjLTE1LjgyMi0yLjE1NS0yNS42NTUtMTAuOTg4LTI5LjUtMjYuNWwtLjUtNjloMjd6Ii8+CiAgICA8cGF0aCBmaWxsPSIjZmVmZWZlIgogICAgICAgICAgZD0iTTIzMy41IDIwOS41aDI3Yy0uMzMxIDI1LjE3Mi4wMDIgNTAuMTcyIDEgNzUgMCAuNjY3LjMzMyAxIDEgMSAxMy4xNTYuOTk2IDI2LjQ5IDEuMzI5IDQwIDF2MTdoLTY5di05NHoiLz4KICAgIDxwYXRoIGZpbGw9IiNhNWFjYmYiIGQ9Ik0yMzMuNSAyMDkuNWM5LjE1Mi0uOTk0IDE4LjQ4NS0xLjMyNyAyOC0xdjc2Yy0uOTk4LTI0LjgyOC0xLjMzMS00OS44MjgtMS03NWgtMjd6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTdhZWMxIiBkPSJNMzE2LjUgMjA5LjVoNzNjLjMyMyA2LjE5LS4wMSAxMi4xOS0xIDE4di0xN2MtMjQuMTcyLjMzMS00OC4xNzItLjAwMi03Mi0xeiIvPgogICAgPHBhdGggZmlsbD0iI2E1YWNjMCIgZD0iTTg1LjUgMjEwLjVoLTU5djkzaDI3Yy0uMzI4LTExLjE3OS4wMDUtMjIuMTc5IDEtMzN2MzRoLTI5di05NWE5MDAuOTggOTAwLjk4IDAgMCAxIDYwIDF6Ii8+CiAgICA8cGF0aCBmaWxsPSIjZmNmY2ZjIgogICAgICAgICAgZD0iTTg1LjUgMjEwLjVjMjIuMjIzIDMuNzU4IDI5LjU1NiAxNi40MjUgMjIgMzgtNC4yMjggNS4zOTctOS4yMjggOS44OTctMTUgMTMuNS0xLjMwNS44MDQtMS45NzEgMS45NzEtMiAzLjVsMjMgMzZjLTQuNDUxIDEuMzI3LTkuMjg0IDEuOTk0LTE0LjUgMmExMjguMTkgMTI4LjE5IDAgMCAxLTE1LjUtMWMtNi45NTUtMTAuMzI2LTEzLjQ1NS0yMC45OTItMTkuNS0zMi0zLjI2OS0xLjMxOC02LjQzNS0xLjMxOC05LjUgMC0uOTk1IDEwLjgyMS0xLjMyOCAyMS44MjEtMSAzM2gtMjd2LTkzaDU5eiIvPgogICAgPHBhdGggZmlsbD0iI2ZlZmVmZSIKICAgICAgICAgIGQ9Ik0zMTYuNSAyMDkuNWMyMy44MjguOTk4IDQ3LjgyOCAxLjMzMSA3MiAxdjE3Yy0xNC42Ny0uMTY3LTI5LjMzNyAwLTQ0IC41LTEuMzI2IDYuNTk5LTEuMzI2IDEzLjA5OSAwIDE5LjUgMTQuNDkuOTk2IDI5LjE1NyAxLjMyOSA0NCAxdjE2Yy0xNC44NDMtLjMyOS0yOS41MS4wMDQtNDQgMWE1MC41MSA1MC41MSAwIDAgMCAwIDIwYzE0LjQ5Ljk5NiAyOS4xNTcgMS4zMjkgNDQgMXYxN2gtNzNjLS4zMzItMzEuNTA0LjAwMi02Mi44MzggMS05NHoiLz4KICAgIDxwYXRoIGZpbGw9IiMxODI3NWIiCiAgICAgICAgICBkPSJNNTUuNSAyMjkuNWM3LjA4OS0uMzg0IDE0LjA4OS4xMTYgMjEgMS41IDMuNDAxIDEuMzIgNC43MzUgMy44MiA0IDcuNWwtLjUgNWMtMS43NzEuODA0LTMuMjcxIDEuOTcxLTQuNSAzLjUtNi41OTIgMS4zMjktMTMuMjU5IDEuODI5LTIwIDEuNXYtMTl6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTVhY2MwIiBkPSJNNDgyLjUgMjMxLjVjLjk2OCAyLjEwNyAxLjMwMiA0LjQ0MSAxIDctOC44NDkuMzI2LTE3LjUxNi0uMDA3LTI2LTFoMjV2LTZ6Ii8+CiAgICA8cGF0aCBmaWxsPSIjYTZhZGMwIiBkPSJNMzQ0LjUgMjQ3LjVoNDV2MThoLTQ1YzE0LjQ5LS45OTYgMjkuMTU3LTEuMzI5IDQ0LTF2LTE2Yy0xNC44NDMuMzI5LTI5LjUxLS4wMDQtNDQtMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNhMmE5YmUiIGQ9Ik00MjguNSAyNzUuNWgtMjV2OGMtLjk3Ny0yLjc4Ny0xLjMxLTUuNzg3LTEtOSA4Ljg0OS0uMzI2IDE3LjUxNi4wMDcgMjYgMXoiLz4KICAgIDxwYXRoIGZpbGw9IiNhNWFjYmYiCiAgICAgICAgICBkPSJNMTEzLjUgMzAxLjVjLjk3OC4zMTEgMS42NDUuOTc4IDIgMmwtMTYgMWMtNS43MTEtLjAwNS0xMS4wNDQtLjY3Mi0xNi0yYTEyOC4xOSAxMjguMTkgMCAwIDAgMTUuNSAxYzUuMjE2LS4wMDYgMTAuMDQ5LS42NzMgMTQuNS0yeiIvPgogICAgPHBhdGggZmlsbD0iI2E1YWNjMCIgZD0iTTIzMy41IDIwOS41djk0aDY5di0xN2MtMTMuNTEuMzI5LTI2Ljg0NC0uMDA0LTQwLTFoNDF2MTloLTcxYTIyNTYuNDEgMjI1Ni40MSAwIDAgMSAxLTk1eiIvPgogICAgPHBhdGggZmlsbD0iI2E2YWNjMCIKICAgICAgICAgIGQ9Ik0zMTYuNSAyMDkuNWMtLjk5OCAzMS4xNjItMS4zMzIgNjIuNDk2LTEgOTRoNzN2LTE3Yy0xNC44NDMuMzI5LTI5LjUxLS4wMDQtNDQtMWg0NXYxOWgtNzVhMjMwNC45NSAyMzA0Ljk1IDAgMCAxIDEtOTZjLjYwNy4xMjQuOTQuNDU3IDEgMXoiLz4KPC9zdmc+";class Ym extends pe.Component{isShowInstance;oldId;constructor(s){super(s),this.state={name:s.name,id:s.id,instance:s.instance||0,prefix:Ym.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(zt,{onClose:()=>!1,maxWidth:"md",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(ts,{id:"confirmation-dialog-title",children:x.I18n.t("Rename")}),g.jsx(Yt,{children:g.jsxs("form",{noValidate:!0,autoComplete:"off",children:[g.jsx(Oo,{variant:"standard",style:{width:"100%"},id:"standard-name",autoFocus:!0,label:x.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(Oo,{variant:"standard",id:"standard-name-id",style:{width:"100%"},label:x.I18n.t("ID"),value:this.state.id,disabled:!0,margin:"normal"}),this.isShowInstance&&g.jsxs(Ui,{variant:"standard",children:[g.jsx(tm,{htmlFor:"instance",children:x.I18n.t("Instance")}),g.jsx(Hi,{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(et,{value:s,children:s||"0"},s))})]})]})}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",onClick:this.handleOk,color:"primary",startIcon:g.jsx(ni,{}),children:x.I18n.t("Ok")}),g.jsx(je,{color:"grey",variant:"contained",onClick:this.handleCancel,startIcon:g.jsx(ao,{}),children:x.I18n.t("Cancel")})]})]})}}class y0 extends pe.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(zt,{onClose:()=>!1,maxWidth:"md",open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(ts,{id:"confirmation-dialog-title",children:x.I18n.t("Are you sure?")}),g.jsxs(Yt,{children:[g.jsx(Mc,{}),g.jsx("span",{style:{fontSize:14,fontWeight:"bold"},children:x.I18n.t("Delete %s",this.state.name)})]}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",onClick:this.handleOk,color:"primary",startIcon:g.jsx(ni,{}),children:x.I18n.t("Ok")}),g.jsx(je,{color:"grey",variant:"contained",onClick:this.handleCancel,startIcon:g.jsx(ao,{}),children:x.I18n.t("Cancel")})]})]})}}const v0=""+new URL("tileJS-C48gYbHw.png",import.meta.url).href,_0=""+new URL("tileTS-CsXmgy4B.png",import.meta.url).href,w0=""+new URL("tileBlockly-BMpdinN3.png",import.meta.url).href,k0=""+new URL("tileRules-BkbaFIhs.png",import.meta.url).href,Vt={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 Un extends pe.Component{handleCancel=()=>{this.props.onClose()};static openHtml(s){const i=x.I18n.getLanguage();!s.includes("javascript.md")&&(i==="de"||i==="ru")&&(s=s.replace(/\/en\//,`/${i}/`));const a=window.open(s,"_blank");a==null||a.focus()}getJSCard(){return g.jsxs($c,{style:Vt.card,children:[g.jsxs(bc,{onClick:()=>this.props.onClose&&this.props.onClose("Javascript/js"),children:[g.jsx(yc,{style:Vt.media,image:v0,title:"JavaScript"}),g.jsxs(vc,{children:[g.jsx("h2",{children:"JavaScript"}),g.jsx("div",{style:Vt.complexity,children:x.I18n.t("for programmers")}),g.jsx("div",{style:Vt.text,children:x.I18n.t("JS description")})]})]}),g.jsxs(_c,{children:[g.jsx(je,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Javascript/js"),children:x.I18n.t("Add")}),g.jsx(je,{size:"small",color:"secondary",onClick:()=>Un.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:x.I18n.t("Learn More")})]})]})}getTSCard(){return g.jsxs($c,{style:Vt.card,children:[g.jsxs(bc,{onClick:()=>this.props.onClose&&this.props.onClose("TypeScript/ts"),children:[g.jsx(yc,{style:Vt.media,image:_0,title:"TypeScript"}),g.jsxs(vc,{children:[g.jsx("h2",{children:"TypeScript"}),g.jsx("div",{style:Vt.complexity,children:x.I18n.t("for professionals")}),g.jsx("div",{style:Vt.text,children:x.I18n.t("TS description")})]})]}),g.jsxs(_c,{children:[g.jsx(je,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("TypeScript/ts"),children:x.I18n.t("Add")}),g.jsx(je,{size:"small",color:"secondary",onClick:()=>Un.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:x.I18n.t("Learn More")})]})]})}getBlocklyCard(){return g.jsxs($c,{style:Vt.card,children:[g.jsxs(bc,{onClick:()=>this.props.onClose&&this.props.onClose("Blockly"),children:[g.jsx(yc,{style:Vt.media,image:w0,title:"Blockly"}),g.jsxs(vc,{children:[g.jsx("h2",{children:"Blockly"}),g.jsx("div",{style:Vt.complexity,children:x.I18n.t("normal")}),g.jsx("div",{style:Vt.text,children:x.I18n.t("Blockly description")})]})]}),g.jsxs(_c,{children:[g.jsx(je,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Blockly"),children:x.I18n.t("Add")}),g.jsx(je,{size:"small",color:"secondary",onClick:()=>Un.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/blockly.md"),children:x.I18n.t("Learn More")})]})]})}getRulesCard(){return g.jsxs($c,{style:Vt.card,children:[g.jsxs(bc,{onClick:()=>this.props.onClose&&this.props.onClose("Rules"),children:[g.jsx(yc,{style:Vt.media,image:k0,title:"Rules"}),g.jsxs(vc,{children:[g.jsx("h2",{children:"Rules"}),g.jsx("div",{style:Vt.complexity,children:x.I18n.t("easy")}),g.jsx("div",{style:Vt.text,children:x.I18n.t("Rules description")})]})]}),g.jsxs(_c,{children:[g.jsx(je,{size:"small",color:"primary",variant:"contained",onClick:()=>this.props.onClose&&this.props.onClose("Rules"),children:x.I18n.t("Add")}),g.jsx(je,{size:"small",color:"secondary",onClick:()=>Un.openHtml("https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md"),children:x.I18n.t("Learn More")})]})]})}render(){return g.jsxs(zt,{onClose:()=>!1,maxWidth:"lg",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(ts,{id:"confirmation-dialog-title",children:x.I18n.t("Add new script")}),g.jsxs(Yt,{style:{textAlign:"center"},children:[this.getRulesCard(),this.getBlocklyCard(),this.getJSCard(),this.getTSCard()]}),g.jsx(Ut,{children:g.jsx(je,{color:"grey",onClick:this.handleCancel,startIcon:g.jsx(ao,{}),children:x.I18n.t("Cancel")})})]})}}class wg extends pe.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 g.jsxs(zt,{onClose:()=>!1,maxWidth:"md",fullWidth:!0,open:!0,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(ts,{id:"confirmation-dialog-title",children:this.props.title||x.I18n.t("Create new")}),g.jsx(Yt,{children:g.jsxs("form",{noValidate:!0,autoComplete:"off",children:[g.jsx(Oo,{variant:"standard",style:{width:"100%"},id:"standard-name",autoFocus:!0,error:!!this.state.error,label:x.I18n.t("Name"),value:this.state.name||"",helperText:this.state.error,slotProps:{input:{endAdornment:this.state.name?g.jsx(We,{size:"small",onClick:()=>this.setState({name:""}),children:g.jsx(VT,{})}):void 0}},onKeyUp:i=>{i.preventDefault(),i.key==="Enter"&&!this.state.error&&setTimeout(()=>this.handleOk(),200)},onChange:i=>{var c;const a=i.target.value,l=this.getId(a);a?(c=this.props.existingItems)!=null&&c.includes(l)?this.setState({name:a,id:l,error:x.I18n.t("Duplicate name")}):this.setState({name:a,id:l,error:""}):this.setState({name:a,id:l,error:x.I18n.t("Empty name is not allowed")})},margin:"normal"}),g.jsxs(Ui,{variant:"standard",style:{width:"100%"},children:[g.jsx(tm,{htmlFor:"parent",children:x.I18n.t("Folder")}),g.jsx(Hi,{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 a=i.id.split(".");a.splice(0,2);const l=[];let c="script.js";return a.forEach(h=>{c+=`.${h}`;const d=this.props.parents.find(p=>p.id===c);d?l.push(d.name):l.push(h)}),l.length||l.push(i.name),g.jsx(et,{value:i.id,children:l.join(" / ")},i.id)})})]}),g.jsx(Oo,{variant:"standard",id:"standard-name-id",style:{width:"100%"},label:x.I18n.t("ID"),value:this.getId(),disabled:!0,margin:"normal"}),this.isShowInstance&&g.jsxs(Ui,{variant:"standard",children:[g.jsx(tm,{htmlFor:"instance",children:x.I18n.t("Instance")}),g.jsx(Hi,{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(et,{value:i,children:i||"0"},`instance${i}`))})]})]})}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",onClick:this.handleOk,disabled:!!this.state.error,color:"primary",startIcon:g.jsx(ni,{}),children:x.I18n.t("Ok")}),g.jsx(je,{color:"grey",variant:"contained",onClick:()=>this.props.onClose(),startIcon:g.jsx(ao,{}),children:x.I18n.t("Cancel")})]})]})}}const C0={title:r=>({background:r.palette.error.main,color:r.palette.error.contrastText,"&>h2":{color:r.palette.error.contrastText}})};class Su extends pe.Component{handleOk=()=>{this.props.onClose()};render(){return g.jsxs(zt,{open:!0,maxWidth:"sm",fullWidth:!0,onClose:()=>this.handleOk(),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[g.jsx(ts,{sx:C0.title,id:"alert-dialog-title",children:this.props.title||x.I18n.t("Error")}),g.jsx(Yt,{children:g.jsx(ck,{id:"alert-dialog-description",children:this.props.text||x.I18n.t("Unknown error!")})}),g.jsx(Ut,{children:g.jsx(je,{variant:"contained",onClick:()=>this.handleOk(),color:"primary",autoFocus:!0,startIcon:g.jsx(ni,{}),children:x.I18n.t("Ok")})})]})}}const ta={icon:{width:24,height:24},filterWithButton:{width:"100%"},title:{fontWeight:"bold",marginTop:16}};class S0 extends pe.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(d=>{var p;return d&&!((p=d.common)!=null&&p.onlyWWW)}).map(d=>{var b,v,_;const p=d._id.replace(/^system\.adapter\./,""),[f]=p.split(".");return{id:p,enabled:(b=d.common)==null?void 0:b.enabled,host:(v=d.common)==null?void 0:v.host,icon:(_=d.common)!=null&&_.icon?`../../adapter/${f}/${d.common.icon}`:""}});i.sort((d,p)=>d.id>p.id?1:d.id<p.id?-1:0);let a=this.state.jsInstance||"";const l=this.state.jsInstance?i.find(d=>d.id===this.state.jsInstance):null;let c;if(!this.state.jsInstance||!l){const d=i.find(p=>p.id.startsWith("javascript."));c=(d==null?void 0:d.host)||"",a=(d==null?void 0:d.id)||""}else c=(l==null?void 0:l.host)||"";let h=this.state.adapterToDebug||"";h&&!i.find(d=>d.id===h)&&(h=""),this.setState({instances:i,jsInstance:a,adapterToDebug:h,jsInstanceHost:c})})}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(Ni,{children:[g.jsx("div",{style:ta.title,children:x.I18n.t("Host")}),g.jsx(sm,{component:"nav",children:s.map(i=>g.jsxs(x_,{component:"div",selected:this.state.jsInstance===i.id,onClick:()=>this.setState({jsInstance:i.id,jsInstanceHost:i.host}),children:[g.jsx(om,{children:g.jsx("img",{src:i.icon,alt:i.id,style:ta.icon})}),g.jsx(im,{primary:i.id})]},i.id))})]})}renderInstances(){if(!this.state.jsInstance)return g.jsx(Ni,{});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(Ni,{children:[g.jsx("div",{style:ta.title,children:x.I18n.t("Instances")}),g.jsx(sm,{component:"nav",children:s.map(i=>g.jsxs(x_,{selected:this.state.adapterToDebug===i.id,onDoubleClick:()=>this.setState({adapterToDebug:i.id},()=>this.handleOk()),onClick:()=>this.setState({adapterToDebug:i.id}),children:[g.jsx(om,{children:g.jsx("img",{src:i.icon,alt:i.id,style:ta.icon})}),g.jsx(im,{primary:i.id})]},i.id))})]})}render(){return g.jsxs(zt,{maxWidth:"md",fullWidth:!1,open:!0,onClose:()=>!1,"aria-labelledby":"confirmation-dialog-title",children:[g.jsx(ts,{id:"confirmation-dialog-title",children:this.props.title||x.I18n.t("Debug instance")}),g.jsx(Yt,{children:g.jsxs(Ni,{container:!0,direction:"column",children:[g.jsx(Ni,{children:g.jsx(Jn,{style:ta.filterWithButton,value:this.state.filter,placeholder:x.I18n.t("Filter"),onChange:s=>{this.setState({filter:s.target.value}),window.localStorage.setItem("javascript.debug.filter",s.target.value)},endAdornment:g.jsx(uk,{position:"end",children:this.state.filter?g.jsx(We,{size:"small","aria-label":"toggle password visibility",onClick:()=>this.setState({filter:""}),children:g.jsx(gk,{})}):""})})}),g.jsx(Ni,{children:g.jsxs(Ni,{container:!0,children:[this.renderJavascriptList(),this.renderInstances()]})})]})}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",onClick:this.handleOk,disabled:!this.state.jsInstance||!this.state.adapterToDebug,color:"primary",startIcon:g.jsx(ni,{}),children:x.I18n.t("Start")}),g.jsx(je,{color:"grey",variant:"contained",onClick:()=>this.props.onClose(),startIcon:g.jsx(ao,{}),children:x.I18n.t("Close")})]})]})}}function qk(r){if(!r)throw new Error("Password must be a non-empty string.")}function fm(r){return new TextEncoder().encode(r)}function T0(r){return new TextDecoder().decode(r)}function I0(r){let s="";for(let i=0;i<r.length;i++)s+=String.fromCharCode(r[i]);return btoa(s)}function E0(r){const s=atob(r),i=new Uint8Array(s.length);for(let a=0;a<s.length;a++)i[a]=s.charCodeAt(a);return i}function Xk(r,s){const i=new Uint8Array(r.length);for(let a=0;a<r.length;a++)i[a]=r[a]^s[a%s.length];return i}function Bc(r,s){qk(r);const i=fm(s),a=fm(r),l=Xk(i,a);return I0(l)}function $m(r,s){qk(r);const i=E0(s),a=fm(r),l=Xk(i,a);return T0(l)}const x0=48,kg=ok[400],X_=SI[400],Cg=ik[400],es="script.js",Ln=`${es}.common`,Do=`${es}.global`,sa=350,D0=16,Oe={drawerPaper:{position:"relative",width:"100%",height:"100%",overflow:"hidden"},toolbar:r=>({height:r.toolbar.height}),toolbarButtons:r=>({color:r.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?r=>({backgroundColor:r.palette.primary.main,color:r.palette.text.primary}):{backgroundColor:"#164477",color:"white"},instances:{fontSize:"smaller",fontWeight:"bold",marginRight:4},childrenCount:{fontSize:10,opacity:.4},footer:{height:24,display:"flex"},footerButtons:r=>({"& img":{color:r.palette.mode==="dark"?"#ffffff":"#111111",cursor:"pointer",mt:"1px",mr:"2px",height:22,width:22,"&:hover":{backgroundColor:"#dbdbdb"}},"& svg":{color:r.palette.mode==="dark"?"#ffffff":"#111111",cursor:"pointer",mt:"1px",mr:"2px",height:22,width:22,"&:hover":{backgroundColor:"#dbdbdb"}}}),footerButtonsRight:{float:"right"}},Pn={Blockly:Kk,"Javascript/js":Jc,def:Jc,Rules:Jk,"TypeScript/ts":Yk};function bm(r,s,i){var a;return i=i||x.I18n.getLanguage(),(a=s==null?void 0:s.common)!=null&&a.name?typeof s.common.name=="object"?(s.common.name[i]||s.common.name.en||r.replace(/^script\.js./,"")).toString():s.common.name.toString():r.replace(/^script\.js./,"")}function Z_(r){var l;const s=[{id:es,depth:0,index:0,parent:null,title:"root",type:"folder",parentIndex:null}],i=Object.keys(r);for(let c=0;c<i.length;c++){const h=r[i[c]],d=i[c].split(".");d.pop(),h.type==="script"?s.push({id:i[c],title:bm(i[c],h),enabled:!!((l=h==null?void 0:h.common)!=null&&l.enabled),depth:d.length-1,type:h.common.engineType,parent:d.length>1?d.join("."):null,instance:h.common.engine?parseInt(h.common.engine.split(".").pop(),10)||0:null,index:0,parentIndex:0}):s.push({id:i[c],title:bm(i[c],h),depth:d.length-1,type:"folder",parent:d.length>1?d.join("."):null,index:0,parentIndex:null})}let a;do a=!1,s.forEach(c=>{if(c.parent&&!s.find(d=>d.id===c.parent)){const d=c.parent.split(".");d.pop(),s.push({id:c.parent,title:c.parent.split(".").pop()||"",depth:d.length-1,type:"folder",parent:d.length>1?d.join("."):null,index:0,parentIndex:null}),a=!0}});while(a);return s.sort((c,h)=>{const d=c.id.toLowerCase(),p=h.id.toLowerCase();return c.type==="folder"&&h.type!=="folder"?-1:h.type==="folder"&&c.type!=="folder"||d>p?1:d<p?-1:0}),s.forEach((c,h)=>c.index=h),s.forEach(c=>{if(c.parent){const h=s.find(d=>d.id===c.parent);h&&(c.parentIndex=h.index)}}),s}function A0(r){const{onDrop:s}=r,[{isOver:i,isOverAny:a},l]=jx({accept:"script",drop:c=>i?s(c):void 0,collect:c=>({isOver:c.isOver({shallow:!0}),isOverAny:c.isOver()})});return g.jsx("div",{ref:l,style:{background:i?"#40adff":void 0,opacity:a?.7:void 0},children:r.children},r.folderName)}function Q_(r){const{name:s}=r,[{opacity:i},a]=Ax({type:"script",item:()=>({name:s}),collect:l=>({opacity:l.isDragging()?.3:1})});return g.jsx("div",{ref:a,style:{opacity:i,transform:"translate3d(0, 0, 0)"},children:r.children},s)}class Ao extends pe.Component{inputRef;filterTimer;problems;problemsTimer;onProblemUpdatedBound;parent=null;constructor(s){super(s);const i=window.localStorage?window.localStorage.getItem("SideMenu.expanded"):"[]";let a;try{a=JSON.parse(i||"[]")||[]}catch{a=[]}this.inputRef=pe.createRef(),this.state={listItems:Z_(s.scripts||{}),expanded:a,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,showExportDialog:!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 a,l;if(i||(i=Object.keys(this.props.scripts)),!i||!i.length)s&&s();else{const c=i.shift(),h=this.props.scripts[c];if(((a=this.props.scripts)==null?void 0:a[c].type)==="script"&&((l=h.common)!=null&&l.enabled)&&!c.match(/^script\.js\.global\./)){const d=h.common.engine.split(".").pop(),p=this,f=`javascript.${d}.scriptProblem.${c.substring(es.length+1)}`;this.props.socket.getState(f).then(b=>{p.onProblemUpdated(f,b),setTimeout(()=>p.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=`${es}.${s.replace(/^javascript\.\d+\.scriptProblem\./,"")}`,this.problems||(this.problems=JSON.parse(JSON.stringify(this.state.problems))||[]);let a=!1;if(i.val)this.problems.includes(s)||(this.problems.push(s),a=!0);else{const l=this.problems.indexOf(s);l!==-1&&(this.problems.splice(l,1),a=!0)}a&&!this.problemsTimer&&(this.problemsTimer=setTimeout(()=>{this.problemsTimer=null,this.setState({problems:this.problems}),this.problems=null},300))}static filterListStatic(s,i,a,l,c){i=JSON.parse(JSON.stringify(i));let h=!1;const d={listItems:i};if(s&&a&&l){const p=l.toLowerCase();if(i.forEach(f=>{var y;const b=f.title.toLowerCase();f.filteredPartly=!1;let v=b.includes(p);const _=(y=c==null?void 0:c[f.id])==null?void 0:y.common;if(!v&&(_!=null&&_.source))if(_.engineType==="Blockly"){const w=_.source.lastIndexOf("//");v=_.source.substring(0,w).toLowerCase().includes(p)}else v=_.source.toLowerCase().includes(p);v?f.filtered&&(f.filtered=!1,h=!0):f.filtered||(f.filtered=!0,h=!0)}),h)for(let f=i.length-1;f>=0;f--){const b=i[f];if(!b.filtered||b.filteredPartly){let v=b;do v!=null&&v.parent&&i[v.parentIndex]&&(h=!0,i[v.parentIndex].filteredPartly=!0),v=v!=null&&v.parent&&i[v.parentIndex]?i[v.parentIndex]:null;while(v)}}}else i.forEach(p=>{(p.filtered||p.filteredPartly)&&(p.filtered=!1,p.filteredPartly=!1,h=!0)}),s||(d.searchText="",d.searchMode=!1,h=!0);return h?d:null}filterList(s,i){const a=Ao.filterListStatic(s,this.state.listItems,this.state.searchMode,this.state.searchText,this.props.scripts);a?this.setState(a,()=>i&&i()):i&&i()}static ensureSelectedIsVisibleStatic(s,i,a){i=JSON.parse(JSON.stringify(i));let l=!1,c=typeof s=="object"?s:a.find(h=>h.id===s);do{if(c!=null&&c.parent){const h=c.parent;c=a.find(d=>d.id===h)}else c=void 0;c&&(i.includes(c.id)||(i.push(c.id),l=!0))}while(c);return l?i:null}ensureSelectedIsVisible(s,i){return Ao.ensureSelectedIsVisibleStatic(s||this.state.selected,i||this.state.expanded,this.state.listItems)}static getDerivedStateFromProps(s,i){const a={};let l=!1;if(i.expertMode!==s.expertMode&&(l=!0,a.expertMode=s.expertMode),i.scriptsHash!==s.scriptsHash&&s.scripts){const c=Z_(s.scripts||{});if(a.listItems=c,i.searchText){const p=Ao.filterListStatic(!0,c,i.searchMode,i.searchText,s.scripts);p&&Object.assign(a,p)}const h=Ao.getIsAllZeroInstancesStatic(c,s.instances||[]),d=Ao.ensureSelectedIsVisibleStatic(i.selected,i.expanded,i.listItems);a.isAllZeroInstances=h,d&&(a.expanded=d),l=!0}if(i.width!==s.width&&(l=!0,a.width=s.width),i.themeName!==s.themeName&&(l=!0,a.themeName=s.themeName),s.selectId&&i.selected!==s.selectId){const c=i.listItems.find(h=>h.id===s.selectId);if(!i.reorder&&c){const h=Ao.ensureSelectedIsVisibleStatic(c,i.expanded,i.listItems);a.selected=c.id,h&&(a.expanded=h),l=!0,window.localStorage&&window.localStorage.setItem("SideMenu.selected",c.id)}}return l?a:null}static getIsAllZeroInstancesStatic(s,i){let a=!i[0]&&i.length<=1;return a&&s.forEach(l=>{l.type!=="folder"&&l.instance!==0&&(a=!1)}),a}getIsAllZeroInstances(s,i){return s=s||this.state.listItems,i=i||this.state.instances,Ao.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===es)return;const a=[...this.state.expanded],l=a.indexOf(s);l!==-1?(a.splice(l,1),this.state.selected&&this.state.selected.startsWith(`${s}.`)&&window.localStorage&&window.localStorage.setItem("SideMenu.selected",s)):(a.push(s),a.sort()),this.setState({expanded:a}),this.saveExpanded(a)}renderItemButtonsOnEnd(s,i){if(this.state.reorder)return null;if(s.type!=="folder"){let a=s.enabled?kg:Cg;return s.enabled&&this.state.problems.includes(s.id)&&(a=X_),[g.jsx(We,{onClick:l=>{l.stopPropagation(),this.props.onEnableDisable&&this.props.onEnableDisable(s.id,!s.enabled)},title:s.enabled?x.I18n.t("Pause script"):x.I18n.t("Run script"),disabled:this.props.debugMode,style:{...Oe.iconButtons,...this.props.debugMode?Oe.iconButtonsDisabled:void 0,color:a},size:"medium",children:s.enabled?g.jsx(Pc,{}):g.jsx(mm,{})},"startStop"),this.state.width>sa?g.jsx(We,{style:this.props.debugMode?Oe.iconButtonsDisabled:void 0,title:x.I18n.t("Delete script"),disabled:s.id===Do||s.id===Ln||this.props.debugMode,onClick:l=>this.onDelete(s,l),size:"medium",children:g.jsx(Mc,{})},"delete"):null,g.jsx(We,{style:this.props.debugMode?Oe.iconButtonsDisabled:void 0,disabled:this.props.debugMode,title:x.I18n.t("Edit script or just double click"),onClick:l=>this.onEdit(s,l),size:"medium",children:g.jsx(l0,{})},"openInEdit")]}return this.state.width>sa&&s.id!==es&&s.id!==Ln&&s.id!==Do&&!(i!=null&&i.length)?g.jsx(We,{style:this.props.debugMode?Oe.iconButtonsDisabled:void 0,title:x.I18n.t("Delete folder"),disabled:s.id===Do||s.id===Ln||this.props.debugMode,onClick:a=>this.onDelete(s,a),size:"medium",children:g.jsx(Mc,{})},"delete"):null}onDelete(s,i){return i==null||i.stopPropagation(),new Promise(a=>{if(!s){a();return}typeof s!="object"?this.setState({deleting:s},()=>a()):this.setState({deleting:s.id},()=>a())})}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>sa?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 a=this.ensureSelectedIsVisible(s),l={selected:s.id};a&&(l.expanded=a),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,a;return s.filtered&&!s.filteredPartly||this.state.typeFilter&&s.type!=="folder"&&s.type.toLowerCase()!==this.state.typeFilter.toLowerCase()||!this.state.expertMode&&((a=(i=this.props.scripts[s.id])==null?void 0:i.native)!=null&&a.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===Do&&!this.state.expertMode}renderListItem(s,i,a){var _,y;if(s.id===es&&!this.state.reorder)return null;const l=(this.state.reorder?s.depth:s.depth-1)*D0;let c=s.title;if(this.state.searchText){const w=c.toLowerCase().indexOf(this.state.searchText.toLowerCase());w!==-1&&(c=[g.jsx("span",{children:c.substring(0,w)},"first"),g.jsx("span",{style:{color:"orange"},children:c.substring(w,w+this.state.searchText.length)},"second"),g.jsx("span",{children:c.substring(w+this.state.searchText.length)},"third")])}if(!this.state.isAllZeroInstances&&s.type!=="folder"){const w=this.state.runningInstances[`system.adapter.javascript.${s.instance}`];c=[g.jsxs("span",{title:`${x.I18n.t("Instance")} ${s.instance}${w?"":` (${x.I18n.t("not running")})`}`,style:{...Oe.instances,color:w?kg:Cg},children:["[",s.instance,"]"]},"instance"),g.jsx("span",{children:c},"title")]}const h=this.state.reorder&&!this.props.debugMode,d={marginLeft:l,cursor:s.type==="folder"&&h?"default":"inherit",width:`calc(100% - ${l}px)`};h||(d.opacity=s.filteredPartly?.5:1),s.id===Do&&s.id!==this.state.selected&&(d.color="#00a200");let p=s.id===es;!p&&i&&(p=this.state.expanded.includes(s.id));let f;s.type==="folder"?f={...Oe.folderIcon,...h?Oe.folderIconReorder:Oe.folderIconNoReorder}:f={...Oe.scriptIcon},s.id===Do?f.color="#356956":s.id===Ln&&(f.color="#4899e1");let b=null;(a&&a.length||i&&i.length)&&(b=g.jsx("span",{style:Oe.childrenCount,children:a&&a.length!==i.length?`${a.length}(${i.length})`:i.length}));const v={...s.type==="folder"?Oe.folder:Oe.script,...h?Oe.reorder:void 0,...h&&s.type!=="folder"?Oe.scriptReorder:void 0,...h&&s.type==="folder"?Oe.folderReorder:void 0,...d};return g.jsxs(DT,{style:v,sx:s.id===this.state.selected&&!h?Oe.selected:void 0,className:x.Utils.clsx(h&&s.type==="folder"&&"folder-reorder",h&&s.type!=="folder"&&"script-reorder"),onClick:w=>this.onClick(s,w),onDoubleClick:w=>this.onDblClick(s,w),secondaryAction:this.renderItemButtonsOnEnd(s,i),children:[(y=(_=this.props.scripts[s.id])==null?void 0:_.native)!=null&&y.protected?g.jsx(q_,{style:{color:"orange",position:"absolute",right:5,width:10,height:10}}):null,g.jsx(om,{style:Oe.listItemIcon,children:s.type==="folder"?h||p?g.jsx(KT,{style:f,onClick:w=>!h&&this.onToggle(s.id,w)}):g.jsx(YT,{style:f,onClick:w=>!h&&this.onToggle(s.id,w)}):g.jsx("img",{style:f,alt:s.type,src:Pn[s.type]||Pn.def})}),g.jsx(im,{sx:{"& .MuiListItemText-primary":s.id===this.state.selected&&!h?Oe.selected:void 0},style:this.getTextStyle(s),primary:g.jsxs("span",{style:{display:"flex",alignItems:"center"},children:[g.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:c}),b]})})]},s.id)}onDragFinish(s,i){let a=`${i}.${s.split(".").pop()}`;a!==s&&(this.state.listItems.find(l=>l.id===a)&&(a+=`_${x.I18n.t("copy")}`),this.props.onRename&&this.props.onRename(s,a))}renderOneItem(s,i){const a=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)&&!a.length)return null;const c=this.state.reorder&&!this.props.debugMode,h=this.renderListItem(i,l,a),d=[];let p;return l&&(c||this.state.expanded.includes(i.id)||i.id===es)&&(p=l.map(f=>this.renderOneItem(s,f))),c?i.type==="folder"?d.push(g.jsxs(A0,{onDrop:f=>this.onDragFinish(f.name,i.id),folderName:i.id,children:[g.jsx(Q_,{name:i.id,children:h},`draggable_${i.id}`),p||null]},`droppable_${i.id}`)):d.push(g.jsxs(Q_,{name:i.id,children:[h,p||null]},`draggable_${i.id}`)):(d.push(h),p==null||p.forEach(f=>d.push(f))),d}renderAllItems(s){const i=s.filter(a=>!a.parent).map(a=>this.renderOneItem(s,a));return g.jsx(sm,{dense:!0,disablePadding:!0,sx:Oe.mainList,children:i})}onAddNew(s){s==null||s.stopPropagation();let i=this.state.listItems.find(l=>l.id===this.state.selected),a=es;for(;i&&i.type!=="folder";)i=this.state.listItems[i.parentIndex];i&&(a=i.id),this.parent=a,this.setState({choosingType:!0})}onCopy(s,i){s==null||s.stopPropagation();let a=this.state.listItems.find(c=>c.id===i),l=es;for(;a&&a.type!=="folder";)a=this.state.listItems[a.parentIndex];a&&(l=a.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),a=es;for(;i&&i.type!=="folder";)i=this.state.listItems[i.parentIndex];i&&(a=i.id),this.parent=a,this.setState({creatingFolder:!0})}onRename(s){s==null||s.stopPropagation(),this.setState({renaming:this.state.selected})}getUniqueName(s){let i=1,a=`${x.I18n.t("Script")} `;if(s){const l=bm(s,this.props.scripts[s]),c=l.match(/\d+$/);c?(a=l.replace(/\d+$/,""),i=parseInt(c[0],10)+1):a=l}for(;this.state.listItems.find(l=>l.id===`${this.parent}.${a.replace(/\.\s/g,"_")}${i}`);)i++;return a+i}getUniqueFolderName(){let s=1;for(;this.state.listItems.find(i=>i.id===`${this.parent}.${x.I18n.t("Folder")}_${s}`);)s++;return`${x.I18n.t("Folder")} ${s}`}onCloseMenu(s){this.setState({menuOpened:!1,menuAnchorEl:null,menuAnchorFilterEl:null},s)}getMainMenu(s,i){var l,c,h,d;const a=this.state.expertMode&&!!Object.keys(this.props.changedScripts).find(p=>{var f,b;return this.props.changedScripts[p]&&((b=(f=this.props.scripts[p])==null?void 0:f.native)==null?void 0:b.protected)});return g.jsxs(Gc,{id:"long-menu",anchorEl:this.state.menuAnchorEl,open:this.state.menuOpened,onClose:()=>this.setState({menuOpened:!1,menuAnchorEl:null}),slotProps:{paper:{style:{maxHeight:x0*7.5}}},children:[this.state.width<=sa?g.jsxs(et,{disabled:this.props.debugMode||!this.state.selected||this.state.selected===Do||this.state.selected===Ln||!!(s!=null&&s.length),onClick:p=>{if(p.stopPropagation(),p.preventDefault(),this.state.listItems.find(f=>f.parent===this.state.selected)){this.showError(x.I18n.t("Cannot delete non empty item!"));return}this.setState({menuOpened:!1,menuAnchorEl:null},()=>this.onDelete(this.state.selected).then(()=>{}))},children:[g.jsx(Mc,{style:{...Oe.iconDropdownMenu,color:"red"}}),x.I18n.t("Delete")]},"delete"):null,g.jsxs(et,{disabled:this.props.debugMode||a,selected:this.state.expertMode,onClick:p=>{p.stopPropagation(),p.preventDefault(),this.onCloseMenu(()=>this.props.onExpertModeChange&&this.props.onExpertModeChange(!this.state.expertMode))},children:[g.jsx(x.IconExpert,{style:{...Oe.iconDropdownMenu,color:this.state.expertMode?"orange":"inherit"}}),x.I18n.t("Expert mode")]},"expertMode"),this.props.onExport&&g.jsxs(et,{onClick:p=>{p.stopPropagation(),p.preventDefault(),this.onCloseMenu(()=>this.setState({showExportDialog:!0}))},children:[g.jsx(Vc,{style:Oe.iconDropdownMenu}),x.I18n.t("Export all scripts")]},"exportAll"),this.props.onImport&&g.jsxs(et,{disabled:this.props.debugMode,onClick:p=>{p.stopPropagation(),p.preventDefault(),this.onCloseMenu(()=>this.props.onImport())},children:[g.jsx(am,{style:Oe.iconDropdownMenu}),x.I18n.t("Import scripts")]},"import"),this.props.onThemeChange&&g.jsxs(et,{onClick:()=>this.onCloseMenu(()=>{this.props.onThemeChange&&this.props.onThemeChange(x.Utils.toggleTheme(this.state.themeName))}),children:[g.jsx(u0,{style:Oe.iconDropdownMenu}),x.I18n.t('Change theme (actual "%s")',this.state.themeName)]},"dark"),this.props.onAddNew&&g.jsxs(et,{disabled:!this.state.selected||!i||i.type==="folder",onClick:p=>{const f=this.state.selected;this.onCloseMenu(()=>this.onCopy(p,f))},children:[g.jsx(JT,{style:Oe.iconDropdownMenu}),x.I18n.t("Copy script")]},"copy"),this.state.expertMode&&g.jsxs(et,{disabled:this.props.debugMode,onClick:p=>{p.stopPropagation(),p.preventDefault(),this.onCloseMenu(()=>this.setState({showAdapterDebug:!0}))},children:[g.jsx(o0,{style:Oe.iconDropdownMenu}),x.I18n.t("Debug instance")]},"debugInstance"),this.state.selected&&this.props.password&&this.props.scripts[this.state.selected].type==="script"?g.jsxs(et,{disabled:this.props.debugMode||this.props.changedScripts[this.state.selected],onClick:p=>{p.stopPropagation(),p.preventDefault(),this.onCloseMenu(async()=>{var b;const f=await this.props.socket.getObject(this.state.selected);f&&((b=f.native)!=null&&b.protected?(delete f.native.protected,f.common.source=$m(this.props.password,f.common.source||"")):(f.native||={},f.native.protected=!0,f.common.source=Bc(this.props.password,f.common.source||"")),await this.props.socket.setObject(f._id,f))})},children:[g.jsx(q_,{style:{...Oe.iconDropdownMenu,color:"orange"}}),(c=(l=this.props.scripts[this.state.selected])==null?void 0:l.native)!=null&&c.protected?g.jsx("span",{style:{color:(d=(h=this.props.scripts[this.state.selected])==null?void 0:h.native)!=null&&d.protected?"orange":void 0},children:x.I18n.t("Unprotect script")}):x.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(Jn,{value:this.state.searchText,style:Oe.toolbarSearch,ref:this.inputRef,autoFocus:!0,placeholder:x.I18n.t("Search..."),onChange:a=>{this.setState({searchText:a.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(We,{sx:Oe.toolbarButtons,style:{float:"right"},title:x.I18n.t("End search mode"),onClick:a=>{a.stopPropagation(),this.filterList(!1,()=>this.props.onSearch&&this.props.onSearch(this.state.searchText))},size:"medium",children:g.jsx(r0,{})},"disableSearch")),this.state.searchText&&s.push(g.jsx(We,{title:x.I18n.t("Clear search input"),sx:Oe.toolbarButtons,style:{marginTop:7,float:"right"},onClick:a=>{a.stopPropagation(),this.setState({searchText:""},()=>{this.filterList(!0),this.props.onSearch&&this.props.onSearch(this.state.searchText)})},size:"medium",children:g.jsx(gk,{fontSize:"small"})},"cleanSearch"));else{if(!i){s.push(g.jsx(We,{"aria-label":"More","aria-owns":this.state.menuOpened?"long-menu":void 0,title:x.I18n.t("Menu"),"aria-haspopup":"true",onClick:c=>{c.stopPropagation(),c.preventDefault(),this.setState({menuOpened:!0,menuAnchorEl:c.currentTarget})},size:"medium",children:g.jsx(c0,{})},"menuButton"));const a=this.state.listItems.find(c=>c.id===this.state.selected);let l;a&&this.state.width<=sa&&a.type==="folder"&&(l=this.state.listItems.filter(c=>c.parent===this.state.selected)),s.push(this.getMainMenu(l,a)),s.push(g.jsx(We,{disabled:this.props.debugMode,title:x.I18n.t("Create new script"),sx:{...Oe.toolbarButtons,...this.props.debugMode?Oe.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit"},onClick:c=>this.onAddNew(c),size:"medium",children:g.jsx(qT,{})},"new-script")),s.push(g.jsx(We,{disabled:this.props.debugMode,title:x.I18n.t("Create new folder"),sx:{...Oe.toolbarButtons,...this.props.debugMode?Oe.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit"},onClick:c=>this.onAddNewFolder(c),size:"medium",children:g.jsx(XT,{})},"new-folder"))}s.push(g.jsx(We,{disabled:i||this.props.debugMode,sx:{...Oe.toolbarButtons,...this.props.debugMode?Oe.iconButtonsDisabled:void 0},title:x.I18n.t("Search in scripts"),style:{float:"right",opacity:this.props.debugMode?.5:i?0:1},onClick:a=>{a.stopPropagation(),this.setState({searchMode:!0})},size:"medium",children:g.jsx(h0,{})},"search")),s.push(g.jsx(We,{disabled:this.props.debugMode,title:x.I18n.t("Reorder scripts in folders"),sx:{...Oe.toolbarButtons,...this.props.debugMode?Oe.iconButtonsDisabled:void 0},style:{color:i?"red":"inherit",float:"right"},onClick:a=>{a.stopPropagation(),this.setState({reorder:!this.state.reorder})},size:"medium",children:g.jsx(f0,{})},"reorder")),!i&&this.state.selected&&this.state.selected!==Do&&this.state.selected!==Ln&&s.push(g.jsx(We,{sx:{...Oe.toolbarButtons,...this.props.debugMode?Oe.iconButtonsDisabled:void 0},disabled:this.props.debugMode,title:x.I18n.t("Rename"),onClick:a=>this.onRename(a),size:"medium",children:g.jsx(ZT,{})},"rename")),s.push(g.jsxs("span",{style:{opacity:.5,fontSize:10},children:["v",this.props.version]},"version"))}return s}getFolders(){const s=[{id:es,name:x.I18n.t("Root folder")}];return this.state.listItems.forEach(i=>{i.type==="folder"&&i.id!==es&&(!i.id.startsWith(Do)||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(a=>a.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(bt,{sx:Oe.footerButtons,title:x.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(Pc,{style:{color:kg,opacity:this.state.statusFilter==="running"?1:.3,background:this.state.statusFilter==="running"?"gray":"inherit"}})},"filterByRunning"),g.jsx(bt,{sx:Oe.footerButtons,title:x.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(mm,{style:{color:Cg,opacity:this.state.statusFilter==="paused"?1:.3,background:this.state.statusFilter==="paused"?"gray":"inherit"}})},"filterByPaused"),g.jsx(bt,{sx:Oe.footerButtons,style:{marginRight:16},title:x.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(Pc,{style:{color:X_,opacity:this.state.statusFilter==="problems"?1:.3,background:this.state.statusFilter==="problems"?"gray":"inherit"}})},"filterByProblem"),g.jsx(bt,{sx:Oe.footerButtons,children:g.jsx("img",{alt:"Blockly",style:{opacity:this.state.typeFilter==="Blockly"?1:.3,background:this.state.typeFilter==="Blockly"?"gray":"inherit"},src:Pn.Blockly,onClick:()=>{const s=this.state.typeFilter==="Blockly"?"":"Blockly";window.localStorage&&window.localStorage.setItem("SideMenu.typeFilter",s),this.setState({typeFilter:s})}})},"filterBlockly"),g.jsx(bt,{sx:Oe.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:Pn["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(bt,{sx:Oe.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:Pn["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(bt,{sx:Oe.footerButtons,children:g.jsx("img",{alt:"Rules",style:{opacity:this.state.typeFilter==="Rules"?1:.3,background:this.state.typeFilter==="Rules"?"gray":"inherit"},src:Pn.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(bt,{sx:Oe.footerButtons,onClick:()=>this.onExpandAll(),title:x.I18n.t("Expand all"),children:g.jsx(b0,{style:Oe.footerButtonsRight})},"expandAll"),this.state.expanded.length?g.jsx(bt,{sx:Oe.footerButtons,onClick:()=>this.onCollapseAll(),title:x.I18n.t("Collapse all"),children:g.jsx($0,{style:Oe.footerButtonsRight})},"collapseAll"):g.jsx("div",{style:{height:22,width:24}})]}getAdapterDebugDialog(){return this.state.showAdapterDebug?g.jsx(S0,{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 a,l,c;const s=this.state.renaming?this.state.listItems.find(h=>h.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(AT,{variant:"permanent",style:Oe.menu,sx:{"& .MuiDrawer-paper":Oe.drawerPaper},anchor:"left",onClick:()=>this.onClick({id:""}),children:[g.jsx(bt,{sx:Oe.toolbar,children:this.getToolbarButtons()}),g.jsx(nm,{}),g.jsx(Ok,{backend:Gk,children:g.jsx("div",{style:Oe.innerMenu,children:this.renderAllItems(this.state.listItems)})}),g.jsx(nm,{}),g.jsx("div",{style:Oe.footer,children:this.getBottomButtons()})]},"drawer"),s?g.jsx(Ym,{name:s.title,id:this.state.renaming||"",folder:s.type==="folder",instance:s.instance,instances:this.props.instances,onClose:()=>this.setState({renaming:null}),onRename:(h,d,p,f)=>this.props.onRename&&this.props.onRename(h,d,p,f)},"dialog-rename"):null,this.state.deleting?g.jsx(y0,{name:this.state.listItems.find(h=>h.id===this.state.deleting).title,id:this.state.deleting,onClose:()=>this.setState({deleting:null}),onDelete:h=>this.props.onDelete&&this.props.onDelete(h)},"dialog-delete"):null,this.state.choosingType?g.jsx(Un,{onClose:h=>{const d={choosingType:!1};h&&(d.creatingScript=h),this.setState(d)}},"dialog-script-type"):null,this.state.creatingScript?g.jsx(wg,{onClose:()=>this.setState({creatingScript:null}),title:x.I18n.t("Create new script"),name:this.getUniqueName(),parents:this.getFolders(),folder:!1,existingItems:this.state.listItems.map(h=>h.id),instance:this.props.instances[0]||0,instances:this.props.instances,type:this.state.creatingScript,parent:this.parent,onAdd:(h,d,p,f)=>this.props.onAddNew&&this.props.onAddNew(h,d,!1,p,f)},"dialog-new-script"):null,this.state.copingScript?g.jsx(wg,{onClose:()=>this.setState({copingScript:""}),title:x.I18n.t("Copy script"),name:this.getUniqueName(this.state.copingScript),parents:this.getFolders(),folder:!1,instance:parseInt((l=(a=i==null?void 0:i.common)==null?void 0:a.engine)==null?void 0:l.split(".").pop(),10)||0,instances:this.props.instances,type:((c=i==null?void 0:i.common)==null?void 0:c.engineType)||"Javascript/js",parent:this.parent,onAdd:(h,d,p,f)=>{var v;const b=this.state.copingScript&&this.props.scripts[this.state.copingScript].type==="script"?this.props.scripts[this.state.copingScript]:void 0;b!=null&&b.common&&(b.common.enabled=!1),this.props.onAddNew&&this.props.onAddNew(h,d,!1,p,f,(v=b==null?void 0:b.common)==null?void 0:v.source)}},"dialog-copy-script"):null,this.state.creatingFolder?g.jsx(wg,{onClose:()=>this.setState({creatingFolder:!1}),title:x.I18n.t("Create new folder"),parents:this.getFolders(),name:this.getUniqueFolderName(),parent:this.parent,onAdd:(h,d)=>this.props.onAddNew&&this.props.onAddNew(h,d,!0)},"dialog-new-folder"):null,this.state.errorText?g.jsx(Su,{onClose:()=>this.setState({errorText:""}),text:this.state.errorText},"error"):null,this.getAdapterDebugDialog(),this.state.showExportDialog?g.jsxs(zt,{open:!0,onClose:()=>this.setState({showExportDialog:!1}),children:[g.jsx(ts,{children:x.I18n.t("Export all scripts")}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",onClick:()=>{this.setState({showExportDialog:!1}),this.props.onExport(!0)},color:"primary",children:x.I18n.t("as JSON")}),g.jsx(je,{variant:"contained",onClick:()=>{this.setState({showExportDialog:!1}),this.props.onExport(!1)},color:"grey",children:x.I18n.t("as plain text")}),g.jsx(je,{variant:"contained",onClick:()=>this.setState({showExportDialog:!1}),color:"primary",children:x.I18n.t("Cancel")})]})]},"dialog-export-format"):null]}}const R0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAXRSTlMAQObYZgAAACFJREFUeAFjAIJRwP////8PYIKWHCigNQdKj/pn1D+jAABTG16wVQqVpQAAAABJRU5ErkJggg==",O0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAQMAAADYVuV7AAAABlBMVEUAAAAzMzPI8eYgAAAAAXRSTlMAQObYZgAAABtJREFUeAFjAIJRwP8fCj7QkENn/4z6Z5QzCgBjbWaoyx1PqQAAAABJRU5ErkJggg==";function M0(r){let s,i=r.getHours();return i<10&&(i=`0${i.toString()}`),s=`${i}:`,i=r.getMinutes(),i<10&&(i=`0${i.toString()}`),s+=`${i}:`,i=r.getSeconds(),i<10&&(i=`0${i.toString()}`),s+=`${i}.`,i=r.getMilliseconds(),i<10?i=`00${i.toString()}`:i<100&&(i=`0${i.toString()}`),s+=i,s}const ew=34,Kt={logBox:{width:"100%",height:"100%",position:"relative",overflow:"hidden"},logBoxInner:r=>({display:"inline-block",color:r.palette.mode==="dark"?"white":"black",width:`calc(100% - ${ew}px)`,height:"100%",overflow:"auto",position:"relative",verticalAlign:"top"}),info:r=>({background:r.palette.mode==="dark"?"darkgrey":"lightgrey",color:(r.palette.mode==="dark","black")}),error:r=>({background:"#FF0000",color:r.palette.mode==="dark"?"black":"white"}),warn:r=>({background:"#FF8000",color:r.palette.mode==="dark"?"black":"white"}),debug:r=>({background:"gray",opacity:.8,color:r.palette.mode==="dark"?"black":"white"}),silly:r=>({background:"gray",opacity:.6,color:r.palette.mode==="dark"?"black":"white"}),table:{fontFamily:"monospace",width:"100%"},toolbox:{width:ew,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:r=>({"& img":{width:24,height:24,background:r.palette.mode==="dark"?"#9d9d9d":void 0,borderRadius:r.palette.mode==="dark"?"30px":void 0}})};function N0(r){return r<10?`00${r}`:r<100?`0${r}`:r.toString()}const oo={};class Jm extends pe.Component{messagesEnd;constructor(s){super(s),this.state={lines:{},goBottom:!0,selected:null,editing:this.props.editing||[]},this.messagesEnd=pe.createRef()}static generateLine(s,i){let a=s.message||"";if(typeof a!="object"){const l=new RegExp(`${s.from.replace(".","\\.").replace(")","\\)").replace("(","\\(")} \\(\\d+\\) `,"g"),c=a.match(l);c?a=a.replace(c[0],""):a=a.replace(`${s.from} `,"")}return a.startsWith(`${i}: `)&&(a=a.substring(i.length+2)),g.jsxs(bt,{component:"tr",sx:Kt[s.severity],children:[g.jsx("td",{style:Kt.trFrom,children:s.from}),g.jsx("td",{style:Kt.trTime,children:M0(new Date(s.ts))}),g.jsx("td",{style:Kt.trSeverity,children:s.severity}),g.jsx("td",{children:g.jsx("pre",{style:Kt.trPreMessage,children:a})})]},`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,a=this.state.editing.filter(f=>s.message.includes(f));let l=null;if(!a.length||(a.length===1?l=a[0]:(a.sort(),l=a[a.length-1]),!l))return;const c=i[l]||[],h=oo[l]||[];c.push(Jm.generateLine(s,l));let d=s.severity;(d==="info"||d==="warn")&&(d+=" ");const p=new Date(s.ts);h.push(`${p.toLocaleString()}.${N0(p.getMilliseconds())} [${d}]: ${s.message}`),c.length>300&&(c.splice(0,c.length-300),h.splice(0,c.length-300)),oo[l]=h,i[l]=c,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 a=!1;const l={};if(s.selected!==i.selected){const c=s.selected,h=i.lines;c&&(h[c]=h[c]||[],oo[c]=oo[c]||[]),l.selected=c,a=!0}if(JSON.stringify(s.editing)!==JSON.stringify(i.editing)){const c=JSON.parse(JSON.stringify(s.editing));a=!0;const h=i.lines;for(const d in oo)Object.prototype.hasOwnProperty.call(oo,d)&&(c.includes(d)||(delete oo[d],delete h[d]));l.editing=c}return a?l:null}onCopy(){x.Utils.copyToClipboard((oo[this.state.selected]||[]).join(`
|
|
93
|
+
`))}clearLog(){const s=this.state.lines;s[this.state.selected]&&(s[this.state.selected]=[]),oo[this.state.selected]&&(oo[this.state.selected]=[]),this.setState({lines:s})}renderLogList(s){return this.state.selected&&(s!=null&&s.length)?g.jsxs(bt,{sx:Kt.logBoxInner,children:[g.jsx("table",{style:Kt.table,children:g.jsx("tbody",{children:s})},"logTable"),g.jsx("div",{ref:this.messagesEnd,style:{float:"left",clear:"both"}},"logScrollPoint")]},"logList"):g.jsx(bt,{sx:Kt.logBoxInner,style:{paddingLeft:10},children:x.I18n.t("Log outputs")},"logList")}render(){const s=this.state.selected?this.state.lines[this.state.selected]:null;return g.jsxs("div",{style:Kt.logBox,children:[g.jsxs("div",{style:Kt.toolbox,children:[g.jsx(We,{style:Kt.iconButtons,onClick:()=>this.setState({goBottom:!this.state.goBottom}),color:this.state.goBottom?"secondary":void 0,size:"medium",children:g.jsx(QT,{})}),s!=null&&s.length?g.jsx(We,{style:Kt.iconButtons,onClick:()=>this.clearLog(),size:"medium",children:g.jsx(eI,{})}):null,s!=null&&s.length?g.jsx(We,{style:Kt.iconButtons,onClick:()=>this.onCopy(),size:"medium",children:g.jsx(tI,{})}):null,this.props.onLayoutChange?g.jsx(We,{style:Kt.iconButtons,onClick:()=>this.props.onLayoutChange&&this.props.onLayoutChange(),title:x.I18n.t("Change layout"),size:"medium",sx:Kt.layoutIcon,children:g.jsx("img",{alt:"split",src:this.props.verticalLayout?R0:O0})}):null,g.jsx(We,{style:Kt.iconButtons,onClick:()=>this.props.onHideLog(),title:x.I18n.t("Hide logs"),size:"medium",children:g.jsx(sI,{})})]},"toolbox"),this.renderLogList(s)]})}}var tw="focus-outline-hidden";function Zk(){var r=this;document.addEventListener("keydown",function(s){r.focusByKeyboard=!0},!0),document.addEventListener("mousedown",function(s){r.focusByKeyboard=!1},!0),document.addEventListener("focus",function(s){r.updateVisibility()},!0),document.addEventListener("focusout",function(s){window.setTimeout(function(){document.hasFocus()||(r.focusByKeyboard=!0,r.updateVisibility())},0)}),this.updateVisibility()}Zk.prototype={focusByKeyboard:!0,updateVisibility:function(){this.hidden=!this.focusByKeyboard},set hidden(r){document.documentElement.classList.toggle(tw,r)},get hidden(){return document.documentElement.classList.contains(tw)}};new Zk;var Qk={exports:{}};(function(r){(function(){var s={}.hasOwnProperty;function i(){for(var a=[],l=0;l<arguments.length;l++){var c=arguments[l];if(c){var h=typeof c;if(h==="string"||h==="number")a.push(c);else if(Array.isArray(c)){if(c.length){var d=i.apply(null,c);d&&a.push(d)}}else if(h==="object")if(c.toString===Object.prototype.toString)for(var p in c)s.call(c,p)&&c[p]&&a.push(p);else a.push(c.toString())}}return a.join(" ")}r.exports?(i.default=i,r.exports=i):window.classNames=i})()})(Qk);var L0=Qk.exports;const sw=ri(L0);var ym={exports:{}},vm={exports:{}},Yi={};Object.defineProperty(Yi,"__esModule",{value:!0});var P0=Yi.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}},B0=Yi.isNumeric=function(s){return!isNaN(parseFloat(s))&&isFinite(s)};Yi.setPosition=function(s,i,a,l){var c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"easeInOutCubic";return a>l?i:s+(i-s)*P0[c](a/l)};Yi.calcEndPoint=function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:window,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(B0(s))return parseInt(s)+a;var l=i===window||i===document.documentElement?window.pageYOffset:i.scrollTop-i.getBoundingClientRect().top,c=s.nodeName.toLowerCase()==="html"?-l:s.getBoundingClientRect().top+l;return c+a};(function(r,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},a=Yi;s.default=function(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=c.duration,d=h===void 0?500:h,p=c.context,f=p===void 0?window:p,b=c.offset,v=b===void 0?0:b,_=c.ease,y=_===void 0?"easeInOutCubic":_,w=c.callback;if((typeof window>"u"?"undefined":i(window))==="object"){var $=f.scrollTop!==null&&f.scrollTop!==void 0?f.scrollTop:window.pageYOffset,I=(0,a.calcEndPoint)(l,f,v),T=performance.now(),C=window.requestAnimationFrame,D=function R(){var N=performance.now()-T,U=(0,a.setPosition)($,I,N,d,y);f!==window?f.scrollTop=U:window.scroll(0,U),N>d?typeof w=="function"&&w(l):C(R)};D()}},r.exports=s.default})(vm,vm.exports);var eC=vm.exports,_m={exports:{}};(function(r,s){Object.defineProperty(s,"__esModule",{value:!0});var i=Object.assign||function(h){for(var d=1;d<arguments.length;d++){var p=arguments[d];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&(h[f]=p[f])}return h},a=eC,l=c(a);function c(h){return h&&h.__esModule?h:{default:h}}s.default=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=h.query,p=d===void 0?'[href^="#"]:not([href="#"]':d,f=h.match,b=f===void 0?function(I){return document.getElementById(I.hash.substring(1))}:f,v=h.hashChange,_=v===void 0?!0:v,y=h.scrollSmoothConfig,w=document.querySelectorAll(p),$=function(T){T.preventDefault();var C=b(T.target);C&&(_&&history.replaceState(null,null,"#"+C.id),(0,l.default)(C,i({},y)))};Array.from(w).map(function(I){I.addEventListener("click",$,!1)})},r.exports=s.default})(_m,_m.exports);var j0=_m.exports,wm={exports:{}};(function(r,s){Object.defineProperty(s,"__esModule",{value:!0});function i(a){if(Array.isArray(a)){for(var l=0,c=Array(a.length);l<a.length;l++)c[l]=a[l];return c}else return Array.from(a)}s.default=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=a.activeClass,c=l===void 0?"active":l,h=a.query,d=h===void 0?'[href^="#"]:not([href="#"]):not([href="#0"])':h,p=a.threshold,f=p===void 0?[.25,.5,.75]:p,b=a.detectType,v=b===void 0?"max":b,_={threshold:f},y=function(U){return U.classList.remove(c)},w=function(U){return U.classList.add(c)},$=function(){document.querySelectorAll("."+c).forEach(y)},I=function(U){$(),w(document.querySelector('a[href="#'+U.id+'"]'))},T=function(U){U.forEach(function(j){j.intersectionRatio>=Math[v].apply(Math,i(f))&&I(j.target)})},C=document.querySelectorAll(d),D=new IntersectionObserver(T,_),R=function(U){var j=document.querySelector("#"+U.hash.slice(1));D.observe(j)};C.forEach(R)},r.exports=s.default})(wm,wm.exports);var F0=wm.exports;(function(r,s){Object.defineProperty(s,"__esModule",{value:!0});var i=eC,a=f(i),l=Yi,c=j0,h=f(c),d=F0,p=f(d);function f(b){return b&&b.__esModule?b:{default:b}}s.default={to:a.default,calcEndPoint:l.calcEndPoint,anchorScroll:h.default,observe:p.default},r.exports=s.default})(ym,ym.exports);var z0=ym.exports;const U0=ri(z0);var qm={exports:{}},H0=qm.exports;(function(r){(function(s,i){r.exports?r.exports=i():s.Scrollparent=i()})(H0,function(){var s=/(auto|scroll)/,i=function(d,p){return d.parentNode===null?p:i(d.parentNode,p.concat([d]))},a=function(d,p){return getComputedStyle(d,null).getPropertyValue(p)},l=function(d){return a(d,"overflow")+a(d,"overflow-y")+a(d,"overflow-x")},c=function(d){return s.test(l(d))},h=function(d){if(d instanceof HTMLElement||d instanceof SVGElement){for(var p=i(d.parentNode,[]),f=0;f<p.length;f+=1)if(c(p[f]))return p[f];return document.scrollingElement||document.documentElement}};return h})})(qm);var W0=qm.exports;const G0=ri(W0);var V0="Expected a function",ow=NaN,K0="[object Symbol]",Y0=/^\s+|\s+$/g,J0=/^[-+]0x[0-9a-f]+$/i,q0=/^0b[01]+$/i,X0=/^0o[0-7]+$/i,Z0=parseInt,Q0=typeof ro=="object"&&ro&&ro.Object===Object&&ro,eD=typeof self=="object"&&self&&self.Object===Object&&self,tD=Q0||eD||Function("return this")(),sD=Object.prototype,oD=sD.toString,iD=Math.max,nD=Math.min,Sg=function(){return tD.Date.now()};function rD(r,s,i){var a,l,c,h,d,p,f=0,b=!1,v=!1,_=!0;if(typeof r!="function")throw new TypeError(V0);s=iw(s)||0,km(i)&&(b=!!i.leading,v="maxWait"in i,c=v?iD(iw(i.maxWait)||0,s):c,_="trailing"in i?!!i.trailing:_);function y(U){var j=a,B=l;return a=l=void 0,f=U,h=r.apply(B,j),h}function w(U){return f=U,d=setTimeout(T,s),b?y(U):h}function $(U){var j=U-p,B=U-f,J=s-j;return v?nD(J,c-B):J}function I(U){var j=U-p,B=U-f;return p===void 0||j>=s||j<0||v&&B>=c}function T(){var U=Sg();if(I(U))return C(U);d=setTimeout(T,$(U))}function C(U){return d=void 0,_&&a?y(U):(a=l=void 0,h)}function D(){d!==void 0&&clearTimeout(d),f=0,a=p=l=d=void 0}function R(){return d===void 0?h:C(Sg())}function N(){var U=Sg(),j=I(U);if(a=arguments,l=this,p=U,j){if(d===void 0)return w(p);if(v)return d=setTimeout(T,s),y(p)}return d===void 0&&(d=setTimeout(T,s)),h}return N.cancel=D,N.flush=R,N}function km(r){var s=typeof r;return!!r&&(s=="object"||s=="function")}function aD(r){return!!r&&typeof r=="object"}function lD(r){return typeof r=="symbol"||aD(r)&&oD.call(r)==K0}function iw(r){if(typeof r=="number")return r;if(lD(r))return ow;if(km(r)){var s=typeof r.valueOf=="function"?r.valueOf():r;r=km(s)?s+"":s}if(typeof r!="string")return r===0?r:+r;r=r.replace(Y0,"");var i=q0.test(r);return i||X0.test(r)?Z0(r.slice(2),i?2:8):J0.test(r)?ow:+r}var cD=rD;const uD=ri(cD);var Cm="data-focus-lock",tC="data-focus-lock-disabled",dD="data-no-focus-lock",hD="data-autofocus-inside",pD="data-no-autofocus";function Tg(r,s){return typeof r=="function"?r(s):r&&(r.current=s),r}function gD(r,s){var i=St(function(){return{value:r,callback:s,facade:{get current(){return i.value},set current(a){var l=i.value;l!==a&&(i.value=a,i.callback(a,l))}}}})[0];return i.callback=s,i.facade}var mD=typeof window<"u"?rk:Ft,nw=new WeakMap;function fD(r,s){var i=gD(null,function(a){return r.forEach(function(l){return Tg(l,a)})});return mD(function(){var a=nw.get(i);if(a){var l=new Set(a),c=new Set(r),h=i.current;l.forEach(function(d){c.has(d)||Tg(d,null)}),c.forEach(function(d){l.has(d)||Tg(d,h)})}nw.set(i,r)},[r]),i}var Ig={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"};function sC(r){return r}function oC(r,s){s===void 0&&(s=sC);var i=[],a=!1,l={read:function(){if(a)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]:r},useMedium:function(c){var h=s(c,a);return i.push(h),function(){i=i.filter(function(d){return d!==h})}},assignSyncMedium:function(c){for(a=!0;i.length;){var h=i;i=[],h.forEach(c)}i={push:function(d){return c(d)},filter:function(){return i}}},assignMedium:function(c){a=!0;var h=[];if(i.length){var d=i;i=[],d.forEach(c),h=i}var p=function(){var b=h;h=[],b.forEach(c)},f=function(){return Promise.resolve().then(p)};f(),i={push:function(b){h.push(b),f()},filter:function(b){return h=h.filter(b),i}}}};return l}function Xm(r,s){return s===void 0&&(s=sC),oC(r,s)}function $D(r){r===void 0&&(r={});var s=oC(null);return s.options=oI({async:!0,ssr:!1},r),s}var iC=Xm({},function(r){var s=r.target,i=r.currentTarget;return{target:s,currentTarget:i}}),nC=Xm(),bD=Xm(),yD=$D({async:!0,ssr:typeof document<"u"}),vD=jm(void 0),_D=[],Zm=ak(function(s,i){var a,l=St(),c=l[0],h=l[1],d=ji(),p=ji(!1),f=ji(null),b=St({}),v=b[1],_=s.children,y=s.disabled,w=y===void 0?!1:y,$=s.noFocusGuards,I=$===void 0?!1:$,T=s.persistentFocus,C=T===void 0?!1:T,D=s.crossFrame,R=D===void 0?!0:D,N=s.autoFocus,U=N===void 0?!0:N;s.allowTextSelection;var j=s.group,B=s.className,J=s.whiteList,ae=s.hasPositiveIndices,ye=s.shards,M=ye===void 0?_D:ye,W=s.as,k=W===void 0?"div":W,X=s.lockProps,ge=X===void 0?{}:X,ce=s.sideCar,oe=s.returnFocus,le=oe===void 0?!1:oe,Q=s.focusOptions,F=s.onActivation,P=s.onDeactivation,me=St({}),ne=me[0],ie=zn(function(Y){var O=Y.captureFocusRestore;if(!f.current){var A,H=(A=document)==null?void 0:A.activeElement;f.current=H,H!==document.body&&(f.current=O(H))}d.current&&F&&F(d.current),p.current=!0,v()},[F]),ke=zn(function(){p.current=!1,P&&P(d.current),v()},[P]),Ne=zn(function(Y){var O=f.current;if(O){var A=(typeof O=="function"?O():O)||document.body,H=typeof le=="function"?le(A):le;if(H){var K=typeof H=="object"?H:void 0;f.current=null,Y?Promise.resolve().then(function(){return A.focus(K)}):A.focus(K)}}},[le]),Ae=zn(function(Y){p.current&&iC.useMedium(Y)},[]),xe=nC.useMedium,Pe=zn(function(Y){d.current!==Y&&(d.current=Y,h(Y))},[]),qe=Zg((a={},a[tC]=w&&"disabled",a[Cm]=j,a),ge),ct=I!==!0,ft=ct&&I!=="tail",S=fD([i,Pe]),te=gs(function(){return{observed:d,shards:M,enabled:!w,active:p.current}},[w,p.current,M,c]);return pe.createElement(em,null,ct&&[pe.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:w?-1:0,style:Ig}),ae?pe.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:w?-1:1,style:Ig}):null],!w&&pe.createElement(ce,{id:ne,sideCar:yD,observed:c,disabled:w,persistentFocus:C,crossFrame:R,autoFocus:U,whiteList:J,shards:M,onActivation:ie,onDeactivation:ke,returnFocus:Ne,focusOptions:Q,noFocusGuards:I}),pe.createElement(k,Zg({ref:S},qe,{className:B,onBlur:xe,onFocus:Ae}),pe.createElement(vD.Provider,{value:te},_)),ft&&pe.createElement("div",{"data-focus-guard":!0,tabIndex:w?-1:0,style:Ig}))});Zm.propTypes={};function wD(r,s){function i(a){return a.displayName||a.name||"Component"}return function(l){var c=[],h;function d(){h=r(c.map(function(f){return f.props})),s(h)}var p=(function(f){TI(b,f);function b(){return f.apply(this,arguments)||this}b.peek=function(){return h};var v=b.prototype;return v.componentDidMount=function(){c.push(this),d()},v.componentDidUpdate=function(){d()},v.componentWillUnmount=function(){var y=c.indexOf(this);c.splice(y,1),d()},v.render=function(){return pe.createElement(l,this.props)},b})(IT);return GI(p,"displayName","SideEffect("+i(l)+")"),p}}var lo=function(r){for(var s=Array(r.length),i=0;i<r.length;++i)s[i]=r[i];return s},Gi=function(r){return Array.isArray(r)?r:[r]},rC=function(r){return Array.isArray(r)?r[0]:r},kD=function(r){if(r.nodeType!==Node.ELEMENT_NODE)return!1;var s=window.getComputedStyle(r,null);return!s||!s.getPropertyValue?!1:s.getPropertyValue("display")==="none"||s.getPropertyValue("visibility")==="hidden"},aC=function(r){return r.parentNode&&r.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?r.parentNode.host:r.parentNode},lC=function(r){return r===document||r&&r.nodeType===Node.DOCUMENT_NODE},CD=function(r){return r.hasAttribute("inert")},SD=function(r,s){return!r||lC(r)||!kD(r)&&!CD(r)&&s(aC(r))},cC=function(r,s){var i=r.get(s);if(i!==void 0)return i;var a=SD(s,cC.bind(void 0,r));return r.set(s,a),a},TD=function(r,s){return r&&!lC(r)?xD(r)?s(aC(r)):!1:!0},uC=function(r,s){var i=r.get(s);if(i!==void 0)return i;var a=TD(s,uC.bind(void 0,r));return r.set(s,a),a},dC=function(r){return r.dataset},ID=function(r){return r.tagName==="BUTTON"},hC=function(r){return r.tagName==="INPUT"},pC=function(r){return hC(r)&&r.type==="radio"},ED=function(r){return!((hC(r)||ID(r))&&(r.type==="hidden"||r.disabled))},xD=function(r){var s=r.getAttribute(pD);return![!0,"true",""].includes(s)},Qm=function(r){var s;return!!(r&&(!((s=dC(r))===null||s===void 0)&&s.focusGuard))},Sm=function(r){return!Qm(r)},DD=function(r){return!!r},AD=function(r,s){var i=Math.max(0,r.tabIndex),a=Math.max(0,s.tabIndex),l=i-a,c=r.index-s.index;if(l){if(!i)return 1;if(!a)return-1}return l||c},RD=function(r){return r.tabIndex<0&&!r.hasAttribute("tabindex")?0:r.tabIndex},ef=function(r,s,i){return lo(r).map(function(a,l){var c=RD(a);return{node:a,index:l,tabIndex:i&&c===-1?(a.dataset||{}).focusGuard?0:-1:c}}).filter(function(a){return!s||a.tabIndex>=0}).sort(AD)},OD=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],tf=OD.join(","),MD="".concat(tf,", [data-focus-guard]"),gC=function(r,s){return lo((r.shadowRoot||r).children).reduce(function(i,a){return i.concat(a.matches(s?MD:tf)?[a]:[],gC(a))},[])},ND=function(r,s){var i;return r instanceof HTMLIFrameElement&&(!((i=r.contentDocument)===null||i===void 0)&&i.body)?qn([r.contentDocument.body],s):[r]},qn=function(r,s){return r.reduce(function(i,a){var l,c=gC(a,s),h=(l=[]).concat.apply(l,c.map(function(d){return ND(d,s)}));return i.concat(h,a.parentNode?lo(a.parentNode.querySelectorAll(tf)).filter(function(d){return d===a}):[])},[])},LD=function(r){var s=r.querySelectorAll("[".concat(hD,"]"));return lo(s).map(function(i){return qn([i])}).reduce(function(i,a){return i.concat(a)},[])},sf=function(r,s){return lo(r).filter(function(i){return cC(s,i)}).filter(function(i){return ED(i)})},rw=function(r,s){return s===void 0&&(s=new Map),lo(r).filter(function(i){return uC(s,i)})},of=function(r,s,i){return ef(sf(qn(r,i),s),!0,i)},ya=function(r,s){return ef(sf(qn(r),s),!1)},PD=function(r,s){return sf(LD(r),s)},Fi=function(r,s){return r.shadowRoot?Fi(r.shadowRoot,s):Object.getPrototypeOf(r).contains!==void 0&&Object.getPrototypeOf(r).contains.call(r,s)?!0:lo(r.children).some(function(i){var a;if(i instanceof HTMLIFrameElement){var l=(a=i.contentDocument)===null||a===void 0?void 0:a.body;return l?Fi(l,s):!1}return Fi(i,s)})},BD=function(r){for(var s=new Set,i=r.length,a=0;a<i;a+=1)for(var l=a+1;l<i;l+=1){var c=r[a].compareDocumentPosition(r[l]);(c&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&s.add(l),(c&Node.DOCUMENT_POSITION_CONTAINS)>0&&s.add(a)}return r.filter(function(h,d){return!s.has(d)})},mC=function(r){return r.parentNode?mC(r.parentNode):r},nf=function(r){var s=Gi(r);return s.filter(Boolean).reduce(function(i,a){var l=a.getAttribute(Cm);return i.push.apply(i,l?BD(lo(mC(a).querySelectorAll("[".concat(Cm,'="').concat(l,'"]:not([').concat(tC,'="disabled"])')))):[a]),i},[])},jD=function(r){try{return r()}catch{return}},va=function(r){if(r===void 0&&(r=document),!(!r||!r.activeElement)){var s=r.activeElement;return s.shadowRoot?va(s.shadowRoot):s instanceof HTMLIFrameElement&&jD(function(){return s.contentWindow.document})?va(s.contentWindow.document):s}},FD=function(r,s){return r===s},zD=function(r,s){return!!lo(r.querySelectorAll("iframe")).some(function(i){return FD(i,s)})},fC=function(r,s){return s===void 0&&(s=va(rC(r).ownerDocument)),!s||s.dataset&&s.dataset.focusGuard?!1:nf(r).some(function(i){return Fi(i,s)||zD(i,s)})},UD=function(r){r===void 0&&(r=document);var s=va(r);return s?lo(r.querySelectorAll("[".concat(dD,"]"))).some(function(i){return Fi(i,s)}):!1},HD=function(r,s){return s.filter(pC).filter(function(i){return i.name===r.name}).filter(function(i){return i.checked})[0]||r},rf=function(r,s){return pC(r)&&r.name?HD(r,s):r},WD=function(r){var s=new Set;return r.forEach(function(i){return s.add(rf(i,r))}),r.filter(function(i){return s.has(i)})},aw=function(r){return r[0]&&r.length>1?rf(r[0],r):r[0]},lw=function(r,s){return r.indexOf(rf(s,r))},Tm="NEW_FOCUS",GD=function(r,s,i,a,l){var c=r.length,h=r[0],d=r[c-1],p=Qm(a);if(!(a&&r.indexOf(a)>=0)){var f=a!==void 0?i.indexOf(a):-1,b=l?i.indexOf(l):f,v=l?r.indexOf(l):-1;if(f===-1)return v!==-1?v:Tm;if(v===-1)return Tm;var _=f-b,y=i.indexOf(h),w=i.indexOf(d),$=WD(i),I=a!==void 0?$.indexOf(a):-1,T=l?$.indexOf(l):I,C=$.filter(function(B){return B.tabIndex>=0}),D=a!==void 0?C.indexOf(a):-1,R=l?C.indexOf(l):D,N=D>=0&&R>=0?R-D:T-I;if(!_&&v>=0||s.length===0)return v;var U=lw(r,s[0]),j=lw(r,s[s.length-1]);if(f<=y&&p&&Math.abs(_)>1)return j;if(f>=w&&p&&Math.abs(_)>1)return U;if(_&&Math.abs(N)>1)return v;if(f<=y)return j;if(f>w)return U;if(_)return Math.abs(_)>1?v:(c+v+_)%c}},VD=function(r){return function(s){var i,a=(i=dC(s))===null||i===void 0?void 0:i.autofocus;return s.autofocus||a!==void 0&&a!=="false"||r.indexOf(s)>=0}},cw=function(r,s,i){var a=r.map(function(c){var h=c.node;return h}),l=rw(a.filter(VD(i)));return l&&l.length?aw(l):aw(rw(s))},Im=function(r,s){return s===void 0&&(s=[]),s.push(r),r.parentNode&&Im(r.parentNode.host||r.parentNode,s),s},Eg=function(r,s){for(var i=Im(r),a=Im(s),l=0;l<i.length;l+=1){var c=i[l];if(a.indexOf(c)>=0)return c}return!1},$C=function(r,s,i){var a=Gi(r),l=Gi(s),c=a[0],h=!1;return l.filter(Boolean).forEach(function(d){h=Eg(h||d,d)||h,i.filter(Boolean).forEach(function(p){var f=Eg(c,p);f&&(!h||Fi(f,h)?h=f:h=Eg(f,h))})}),h},uw=function(r,s){return r.reduce(function(i,a){return i.concat(PD(a,s))},[])},KD=function(r,s){var i=new Map;return s.forEach(function(a){return i.set(a.node,a)}),r.map(function(a){return i.get(a)}).filter(DD)},YD=function(r,s){var i=va(Gi(r).length>0?document:rC(r).ownerDocument),a=nf(r).filter(Sm),l=$C(i||r,r,a),c=new Map,h=ya(a,c),d=h.filter(function(w){var $=w.node;return Sm($)});if(d[0]){var p=ya([l],c).map(function(w){var $=w.node;return $}),f=KD(p,d),b=f.map(function(w){var $=w.node;return $}),v=f.filter(function(w){var $=w.tabIndex;return $>=0}).map(function(w){var $=w.node;return $}),_=GD(b,v,p,i,s);if(_===Tm){var y=cw(h,v,uw(a,c))||cw(h,b,uw(a,c));if(y)return{node:y};console.warn("focus-lock: cannot find any node to move focus into");return}return _===void 0?_:f[_]}},JD=function(r){var s=nf(r).filter(Sm),i=$C(r,r,s),a=ef(qn([i],!0),!0,!0),l=qn(s,!1);return a.map(function(c){var h=c.node,d=c.index;return{node:h,index:d,lockItem:l.indexOf(h)>=0,guard:Qm(h)}})},af=function(r,s){r&&("focus"in r&&r.focus(s),"contentWindow"in r&&r.contentWindow&&r.contentWindow.focus())},xg=0,Dg=!1,bC=function(r,s,i){i===void 0&&(i={});var a=YD(r,s);if(!Dg&&a){if(xg>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Dg=!0,setTimeout(function(){Dg=!1},1);return}xg++,af(a.node,i.focusOptions),xg--}};function oa(r){if(!r)return null;if(typeof WeakRef>"u")return function(){return r||null};var s=r?new WeakRef(r):null;return function(){return(s==null?void 0:s.deref())||null}}var qD=function(r){if(!r)return null;for(var s=[],i=r;i&&i!==document.body;)s.push({current:oa(i),parent:oa(i.parentElement),left:oa(i.previousElementSibling),right:oa(i.nextElementSibling)}),i=i.parentElement;return{element:oa(r),stack:s,ownerDocument:r.ownerDocument}},XD=function(r){var s,i,a,l,c;if(r)for(var h=r.stack,d=r.ownerDocument,p=new Map,f=0,b=h;f<b.length;f++){var v=b[f],_=(s=v.parent)===null||s===void 0?void 0:s.call(v);if(_&&d.contains(_)){for(var y=(i=v.left)===null||i===void 0?void 0:i.call(v),w=v.current(),$=_.contains(w)?w:void 0,I=(a=v.right)===null||a===void 0?void 0:a.call(v),T=of([_],p),C=(c=(l=$??(y==null?void 0:y.nextElementSibling))!==null&&l!==void 0?l:I)!==null&&c!==void 0?c:y;C;){for(var D=0,R=T;D<R.length;D++){var N=R[D];if(C!=null&&C.contains(N.node))return N.node}C=C.nextElementSibling}if(T.length)return T[0].node}}},yC=function(r){var s=qD(r);return function(){return XD(s)}},ZD=function(r,s,i){if(!r||!s)return console.error("no element or scope given"),{};var a=Gi(s);if(a.every(function(h){return!Fi(h,r)}))return console.error("Active element is not contained in the scope"),{};var l=i?of(a,new Map):ya(a,new Map),c=l.findIndex(function(h){var d=h.node;return d===r});if(c!==-1)return{prev:l[c-1],next:l[c+1],first:l[0],last:l[l.length-1]}},QD=function(r,s){var i=s?of(Gi(r),new Map):ya(Gi(r),new Map);return{first:i[0],last:i[i.length-1]}},eA=function(r){return Object.assign({scope:document.body,cycle:!0,onlyTabbable:!0},r)},vC=function(r,s,i){s===void 0&&(s={});var a=eA(s),l=ZD(r,a.scope,a.onlyTabbable);if(l){var c=i(l,a.cycle);c&&af(c.node,a.focusOptions)}},tA=function(r,s){s===void 0&&(s={}),vC(r,s,function(i,a){var l=i.next,c=i.first;return l||a&&c})},sA=function(r,s){s===void 0&&(s={}),vC(r,s,function(i,a){var l=i.prev,c=i.last;return l||a&&c})},_C=function(r,s,i){var a,l=QD(r,(a=s.onlyTabbable)!==null&&a!==void 0?a:!0),c=l[i];c&&af(c.node,s.focusOptions)},oA=function(r,s){s===void 0&&(s={}),_C(r,s,"first")},iA=function(r,s){s===void 0&&(s={}),_C(r,s,"last")};function lf(r){setTimeout(r,1)}var nA=function(s){return s&&"current"in s?s.current:s},wC=function(){return document&&document.activeElement===document.body},rA=function(){return wC()||UD()},Wn=null,rs=null,dw=function(){return null},Gn=null,_a=!1,cf=!1,aA=function(){return!0},lA=function(s){return(Wn.whiteList||aA)(s)},cA=function(s,i){Gn={observerNode:s,portaledElement:i}},uA=function(s){return Gn&&Gn.portaledElement===s};function hw(r,s,i,a){var l=null,c=r;do{var h=a[c];if(h.guard)h.node.dataset.focusAutoGuard&&(l=h);else if(h.lockItem){if(c!==r)return;l=null}else break}while((c+=i)!==s);l&&(l.node.tabIndex=0)}var dA=function(s){return s?!!_a:_a==="meanwhile"},hA=function r(s,i,a){return i&&(i.host===s&&(!i.activeElement||a.contains(i.activeElement))||i.parentNode&&r(s,i.parentNode,a))},pA=function(s,i){return i.some(function(a){return hA(s,a,a)})},kC=function(s){return ya(s,new Map)},gA=function(s){return!kC([s.parentNode]).some(function(i){return i.node===s})},qc=function(){var s=!1;if(Wn){var i=Wn,a=i.observed,l=i.persistentFocus,c=i.autoFocus,h=i.shards,d=i.crossFrame,p=i.focusOptions,f=i.noFocusGuards,b=a||Gn&&Gn.portaledElement;if(wC()&&rs&&rs!==document.body&&(!document.body.contains(rs)||gA(rs))){var v=dw();v&&v.focus()}var _=document&&document.activeElement;if(b){var y=[b].concat(h.map(nA).filter(Boolean)),w=function(){if(!dA(d)||!f||!rs||cf)return!1;var D=kC(y),R=D.findIndex(function(N){var U=N.node;return U===rs});return R===0||R===D.length-1};if((!_||lA(_))&&(l||w()||!rA()||!rs&&c)&&(b&&!(fC(y)||_&&pA(_,y)||uA(_))&&(document&&!rs&&_&&!c?(_.blur&&_.blur(),document.body.focus()):(s=bC(y,rs,{focusOptions:p}),Gn={})),rs=document&&document.activeElement,rs!==document.body&&(dw=yC(rs)),_a=!1),document&&_!==document.activeElement&&document.querySelector("[data-focus-auto-guard]")){var $=document&&document.activeElement,I=JD(y),T=I.map(function(C){var D=C.node;return D}).indexOf($);T>-1&&(I.filter(function(C){var D=C.guard,R=C.node;return D&&R.dataset.focusAutoGuard}).forEach(function(C){var D=C.node;return D.removeAttribute("tabIndex")}),hw(T,I.length,1,I),hw(T,-1,-1,I))}}}return s},CC=function(s){qc()&&s&&(s.stopPropagation(),s.preventDefault())},uf=function(){return lf(qc)},mA=function(s){var i=s.target,a=s.currentTarget;a.contains(i)||cA(a,i)},fA=function(){return null},SC=function(){cf=!0},TC=function(){cf=!1,_a="just",lf(function(){_a="meanwhile"})},$A=function(){document.addEventListener("focusin",CC),document.addEventListener("focusout",uf),window.addEventListener("focus",SC),window.addEventListener("blur",TC)},bA=function(){document.removeEventListener("focusin",CC),document.removeEventListener("focusout",uf),window.removeEventListener("focus",SC),window.removeEventListener("blur",TC)};function yA(r){return r.filter(function(s){var i=s.disabled;return!i})}var IC={moveFocusInside:bC,focusInside:fC,focusNextElement:tA,focusPrevElement:sA,focusFirstElement:oA,focusLastElement:iA,captureFocusRestore:yC};function vA(r){var s=r.slice(-1)[0];s&&!Wn&&$A();var i=Wn,a=i&&s&&s.id===i.id;Wn=s,i&&!a&&(i.onDeactivation(),r.filter(function(l){var c=l.id;return c===i.id}).length||i.returnFocus(!s)),s?(rs=null,(!a||i.observed!==s.observed)&&s.onActivation(IC),qc(),lf(qc)):(bA(),rs=null)}iC.assignSyncMedium(mA);nC.assignMedium(uf);bD.assignMedium(function(r){return r(IC)});const _A=wD(yA,vA)(fA);var EC=ak(function(s,i){return pe.createElement(Zm,Zg({sideCar:_A,ref:i},s))}),xC=Zm.propTypes||{};xC.sideCar;II(xC,["sideCar"]);EC.propTypes={};var $t="-ms-",ha="-moz-",nt="-webkit-",DC="comm",Tu="rule",df="decl",wA="@import",kA="@namespace",AC="@keyframes",CA="@layer",RC=Math.abs,hf=String.fromCharCode,Em=Object.assign;function SA(r,s){return Rt(r,0)^45?(((s<<2^Rt(r,0))<<2^Rt(r,1))<<2^Rt(r,2))<<2^Rt(r,3):0}function OC(r){return r.trim()}function Ro(r,s){return(r=s.exec(r))?r[0]:r}function Je(r,s,i){return r.replace(s,i)}function jc(r,s,i){return r.indexOf(s,i)}function Rt(r,s){return r.charCodeAt(s)|0}function Vi(r,s,i){return r.slice(s,i)}function Ls(r){return r.length}function MC(r){return r.length}function la(r,s){return s.push(r),r}function TA(r,s){return r.map(s).join("")}function pw(r,s){return r.filter(function(i){return!Ro(i,s)})}var Iu=1,Xn=1,NC=0,Ts=0,Et=0,tr="";function Eu(r,s,i,a,l,c,h,d){return{value:r,root:s,parent:i,type:a,props:l,children:c,line:Iu,column:Xn,length:h,return:"",siblings:d}}function ei(r,s){return Em(Eu("",null,null,"",null,null,0,r.siblings),r,{length:-r.length},s)}function Bn(r){for(;r.root;)r=ei(r.root,{children:[r]});la(r,r.siblings)}function IA(){return Et}function EA(){return Et=Ts>0?Rt(tr,--Ts):0,Xn--,Et===10&&(Xn=1,Iu--),Et}function Bs(){return Et=Ts<NC?Rt(tr,Ts++):0,Xn++,Et===10&&(Xn=1,Iu++),Et}function si(){return Rt(tr,Ts)}function Fc(){return Ts}function xu(r,s){return Vi(tr,r,s)}function wa(r){switch(r){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function xA(r){return Iu=Xn=1,NC=Ls(tr=r),Ts=0,[]}function DA(r){return tr="",r}function Ag(r){return OC(xu(Ts-1,xm(r===91?r+2:r===40?r+1:r)))}function AA(r){for(;(Et=si())&&Et<33;)Bs();return wa(r)>2||wa(Et)>3?"":" "}function RA(r,s){for(;--s&&Bs()&&!(Et<48||Et>102||Et>57&&Et<65||Et>70&&Et<97););return xu(r,Fc()+(s<6&&si()==32&&Bs()==32))}function xm(r){for(;Bs();)switch(Et){case r:return Ts;case 34:case 39:r!==34&&r!==39&&xm(Et);break;case 40:r===41&&xm(r);break;case 92:Bs();break}return Ts}function OA(r,s){for(;Bs()&&r+Et!==57;)if(r+Et===84&&si()===47)break;return"/*"+xu(s,Ts-1)+"*"+hf(r===47?r:Bs())}function MA(r){for(;!wa(si());)Bs();return xu(r,Ts)}function NA(r){return DA(zc("",null,null,null,[""],r=xA(r),0,[0],r))}function zc(r,s,i,a,l,c,h,d,p){for(var f=0,b=0,v=h,_=0,y=0,w=0,$=1,I=1,T=1,C=0,D="",R=l,N=c,U=a,j=D;I;)switch(w=C,C=Bs()){case 40:if(w!=108&&Rt(j,v-1)==58){jc(j+=Je(Ag(C),"&","&\f"),"&\f",RC(f?d[f-1]:0))!=-1&&(T=-1);break}case 34:case 39:case 91:j+=Ag(C);break;case 9:case 10:case 13:case 32:j+=AA(w);break;case 92:j+=RA(Fc()-1,7);continue;case 47:switch(si()){case 42:case 47:la(LA(OA(Bs(),Fc()),s,i,p),p),(wa(w||1)==5||wa(si()||1)==5)&&Ls(j)&&Vi(j,-1,void 0)!==" "&&(j+=" ");break;default:j+="/"}break;case 123*$:d[f++]=Ls(j)*T;case 125*$:case 59:case 0:switch(C){case 0:case 125:I=0;case 59+b:T==-1&&(j=Je(j,/\f/g,"")),y>0&&(Ls(j)-v||$===0&&w===47)&&la(y>32?mw(j+";",a,i,v-1,p):mw(Je(j," ","")+";",a,i,v-2,p),p);break;case 59:j+=";";default:if(la(U=gw(j,s,i,f,b,l,d,D,R=[],N=[],v,c),c),C===123)if(b===0)zc(j,s,U,U,R,c,v,d,N);else{switch(_){case 99:if(Rt(j,3)===110)break;case 108:if(Rt(j,2)===97)break;default:b=0;case 100:case 109:case 115:}b?zc(r,U,U,a&&la(gw(r,U,U,0,0,l,d,D,l,R=[],v,N),N),l,N,v,d,a?R:N):zc(j,U,U,U,[""],N,0,d,N)}}f=b=y=0,$=T=1,D=j="",v=h;break;case 58:v=1+Ls(j),y=w;default:if($<1){if(C==123)--$;else if(C==125&&$++==0&&EA()==125)continue}switch(j+=hf(C),C*$){case 38:T=b>0?1:(j+="\f",-1);break;case 44:d[f++]=(Ls(j)-1)*T,T=1;break;case 64:si()===45&&(j+=Ag(Bs())),_=si(),b=v=Ls(D=j+=MA(Fc())),C++;break;case 45:w===45&&Ls(j)==2&&($=0)}}return c}function gw(r,s,i,a,l,c,h,d,p,f,b,v){for(var _=l-1,y=l===0?c:[""],w=MC(y),$=0,I=0,T=0;$<a;++$)for(var C=0,D=Vi(r,_+1,_=RC(I=h[$])),R=r;C<w;++C)(R=OC(I>0?y[C]+" "+D:Je(D,/&\f/g,y[C])))&&(p[T++]=R);return Eu(r,s,i,l===0?Tu:d,p,f,b,v)}function LA(r,s,i,a){return Eu(r,s,i,DC,hf(IA()),Vi(r,2,-2),0,a)}function mw(r,s,i,a,l){return Eu(r,s,i,df,Vi(r,0,a),Vi(r,a+1,-1),a,l)}function LC(r,s,i){switch(SA(r,s)){case 5103:return nt+"print-"+r+r;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:case 6391:case 5879:case 5623:case 6135:case 4599:return nt+r+r;case 4855:return nt+r.replace("add","source-over").replace("substract","source-out").replace("intersect","source-in").replace("exclude","xor")+r;case 4789:return ha+r+r;case 5349:case 4246:case 4810:case 6968:case 2756:return nt+r+ha+r+$t+r+r;case 5936:switch(Rt(r,s+11)){case 114:return nt+r+$t+Je(r,/[svh]\w+-[tblr]{2}/,"tb")+r;case 108:return nt+r+$t+Je(r,/[svh]\w+-[tblr]{2}/,"tb-rl")+r;case 45:return nt+r+$t+Je(r,/[svh]\w+-[tblr]{2}/,"lr")+r}case 6828:case 4268:case 2903:return nt+r+$t+r+r;case 6165:return nt+r+$t+"flex-"+r+r;case 5187:return nt+r+Je(r,/(\w+).+(:[^]+)/,nt+"box-$1$2"+$t+"flex-$1$2")+r;case 5443:return nt+r+$t+"flex-item-"+Je(r,/flex-|-self/g,"")+(Ro(r,/flex-|baseline/)?"":$t+"grid-row-"+Je(r,/flex-|-self/g,""))+r;case 4675:return nt+r+$t+"flex-line-pack"+Je(r,/align-content|flex-|-self/g,"")+r;case 5548:return nt+r+$t+Je(r,"shrink","negative")+r;case 5292:return nt+r+$t+Je(r,"basis","preferred-size")+r;case 6060:return nt+"box-"+Je(r,"-grow","")+nt+r+$t+Je(r,"grow","positive")+r;case 4554:return nt+Je(r,/([^-])(transform)/g,"$1"+nt+"$2")+r;case 6187:return Je(Je(Je(r,/(zoom-|grab)/,nt+"$1"),/(image-set)/,nt+"$1"),r,"")+r;case 5495:case 3959:return Je(r,/(image-set\([^]*)/,nt+"$1$`$1");case 4968:return Je(Je(r,/(.+:)(flex-)?(.*)/,nt+"box-pack:$3"+$t+"flex-pack:$3"),/space-between/,"justify")+nt+r+r;case 4200:if(!Ro(r,/flex-|baseline/))return $t+"grid-column-align"+Vi(r,s)+r;break;case 2592:case 3360:return $t+Je(r,"template-","")+r;case 4384:case 3616:return i&&i.some(function(a,l){return s=l,Ro(a.props,/grid-\w+-end/)})?~jc(r+(i=i[s].value),"span",0)?r:$t+Je(r,"-start","")+r+$t+"grid-row-span:"+(~jc(i,"span",0)?Ro(i,/\d+/):+Ro(i,/\d+/)-+Ro(r,/\d+/))+";":$t+Je(r,"-start","")+r;case 4896:case 4128:return i&&i.some(function(a){return Ro(a.props,/grid-\w+-start/)})?r:$t+Je(Je(r,"-end","-span"),"span ","")+r;case 4095:case 3583:case 4068:case 2532:return Je(r,/(.+)-inline(.+)/,nt+"$1$2")+r;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ls(r)-1-s>6)switch(Rt(r,s+1)){case 109:if(Rt(r,s+4)!==45)break;case 102:return Je(r,/(.+:)(.+)-([^]+)/,"$1"+nt+"$2-$3$1"+ha+(Rt(r,s+3)==108?"$3":"$2-$3"))+r;case 115:return~jc(r,"stretch",0)?LC(Je(r,"stretch","fill-available"),s,i)+r:r}break;case 5152:case 5920:return Je(r,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(a,l,c,h,d,p,f){return $t+l+":"+c+f+(h?$t+l+"-span:"+(d?p:+p-+c)+f:"")+r});case 4949:if(Rt(r,s+6)===121)return Je(r,":",":"+nt)+r;break;case 6444:switch(Rt(r,Rt(r,14)===45?18:11)){case 120:return Je(r,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+nt+(Rt(r,14)===45?"inline-":"")+"box$3$1"+nt+"$2$3$1"+$t+"$2box$3")+r;case 100:return Je(r,":",":"+$t)+r}break;case 5719:case 2647:case 2135:case 3927:case 2391:return Je(r,"scroll-","scroll-snap-")+r}return r}function Xc(r,s){for(var i="",a=0;a<r.length;a++)i+=s(r[a],a,r,s)||"";return i}function PA(r,s,i,a){switch(r.type){case CA:if(r.children.length)break;case wA:case kA:case df:return r.return=r.return||r.value;case DC:return"";case AC:return r.return=r.value+"{"+Xc(r.children,a)+"}";case Tu:if(!Ls(r.value=r.props.join(",")))return""}return Ls(i=Xc(r.children,a))?r.return=r.value+"{"+i+"}":""}function BA(r){var s=MC(r);return function(i,a,l,c){for(var h="",d=0;d<s;d++)h+=r[d](i,a,l,c)||"";return h}}function jA(r){return function(s){s.root||(s=s.return)&&r(s)}}function FA(r,s,i,a){if(r.length>-1&&!r.return)switch(r.type){case df:r.return=LC(r.value,r.length,i);return;case AC:return Xc([ei(r,{value:Je(r.value,"@","@"+nt)})],a);case Tu:if(r.length)return TA(i=r.props,function(l){switch(Ro(l,a=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Bn(ei(r,{props:[Je(l,/:(read-\w+)/,":"+ha+"$1")]})),Bn(ei(r,{props:[l]})),Em(r,{props:pw(i,a)});break;case"::placeholder":Bn(ei(r,{props:[Je(l,/:(plac\w+)/,":"+nt+"input-$1")]})),Bn(ei(r,{props:[Je(l,/:(plac\w+)/,":"+ha+"$1")]})),Bn(ei(r,{props:[Je(l,/:(plac\w+)/,$t+"input-$1")]})),Bn(ei(r,{props:[l]})),Em(r,{props:pw(i,a)});break}return""})}}var Vn={},Rg,Og;const Zn=typeof process<"u"&&Vn!==void 0&&(Vn.REACT_APP_SC_ATTR||Vn.SC_ATTR)||"data-styled",PC="active",BC="data-styled-version",Du="6.4.0",pf=`/*!sc*/
|
|
94
|
+
`,pa=typeof window<"u"&&typeof document<"u";function fw(r){if(typeof process<"u"&&Vn!==void 0){const s=Vn[r];if(s!==void 0&&s!=="")return s!=="false"}}const zA=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:(Og=(Rg=fw("REACT_APP_SC_DISABLE_SPEEDY"))!==null&&Rg!==void 0?Rg:fw("SC_DISABLE_SPEEDY"))!==null&&Og!==void 0?Og:typeof process>"u"||Vn===void 0),UA="sc-keyframes-",HA={};function Au(r,...s){return new Error(`An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#${r} for more information.${s.length>0?` Args: ${s.join(", ")}`:""}`)}let Uc=new Map,Zc=new Map,Hc=1;const Tc=r=>{if(Uc.has(r))return Uc.get(r);for(;Zc.has(Hc);)Hc++;const s=Hc++;return Uc.set(r,s),Zc.set(s,r),s},WA=r=>Zc.get(r),GA=(r,s)=>{Hc=s+1,Uc.set(r,s),Zc.set(s,r)},gf=Object.freeze([]),Qn=Object.freeze({});function jC(r,s,i=Qn){return r.theme!==i.theme&&r.theme||s||i.theme}const VA=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,KA=/(^-|-$)/g;function FC(r){return r.replace(VA,"-").replace(KA,"")}const YA=/(a)(d)/gi,$w=r=>String.fromCharCode(r+(r>25?39:97));function zC(r){let s,i="";for(s=Math.abs(r);s>52;s=s/52|0)i=$w(s%52)+i;return($w(s%52)+i).replace(YA,"$1-$2")}const Dm=5381,zi=(r,s)=>{let i=s.length;for(;i;)r=33*r^s.charCodeAt(--i);return r},UC=r=>zi(Dm,r);function HC(r){return zC(UC(r)>>>0)}function JA(r){return r.displayName||r.name||"Component"}function Am(r){return typeof r=="string"&&!0}function qA(r){return Am(r)?`styled.${r}`:`Styled(${JA(r)})`}const WC=Symbol.for("react.memo"),XA=Symbol.for("react.forward_ref"),ZA={contextType:!0,defaultProps:!0,displayName:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,propTypes:!0,type:!0},QA={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},GC={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},eR={[XA]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[WC]:GC};function bw(r){return("type"in(s=r)&&s.type.$$typeof)===WC?GC:"$$typeof"in r?eR[r.$$typeof]:ZA;var s}const tR=Object.defineProperty,sR=Object.getOwnPropertyNames,oR=Object.getOwnPropertySymbols,iR=Object.getOwnPropertyDescriptor,nR=Object.getPrototypeOf,rR=Object.prototype;function VC(r,s,i){if(typeof s!="string"){const a=nR(s);a&&a!==rR&&VC(r,a,i);const l=sR(s).concat(oR(s)),c=bw(r),h=bw(s);for(let d=0;d<l.length;++d){const p=l[d];if(!(p in QA||i&&i[p]||h&&p in h||c&&p in c)){const f=iR(s,p);try{tR(r,p,f)}catch{}}}}return r}function Oa(r){return typeof r=="function"}function mf(r){return typeof r=="object"&&"styledComponentId"in r}function ca(r,s){return r&&s?r+" "+s:r||s||""}function Rm(r,s){return r.join("")}function ka(r){return r!==null&&typeof r=="object"&&r.constructor.name===Object.name&&!("props"in r&&r.$$typeof)}function Om(r,s,i=!1){if(!i&&!ka(r)&&!Array.isArray(r))return s;if(Array.isArray(s))for(let a=0;a<s.length;a++)r[a]=Om(r[a],s[a]);else if(ka(s))for(const a in s)r[a]=Om(r[a],s[a]);return r}function KC(r,s){Object.defineProperty(r,"toString",{value:s})}const aR=class{constructor(r){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=r,this._cGroup=0,this._cIndex=0}indexOfGroup(r){if(r===this._cGroup)return this._cIndex;let s=this._cIndex;if(r>this._cGroup)for(let i=this._cGroup;i<r;i++)s+=this.groupSizes[i];else for(let i=this._cGroup-1;i>=r;i--)s-=this.groupSizes[i];return this._cGroup=r,this._cIndex=s,s}insertRules(r,s){if(r>=this.groupSizes.length){const l=this.groupSizes,c=l.length;let h=c;for(;r>=h;)if(h<<=1,h<0)throw Au(16,`${r}`);this.groupSizes=new Uint32Array(h),this.groupSizes.set(l),this.length=h;for(let d=c;d<h;d++)this.groupSizes[d]=0}let i=this.indexOfGroup(r+1),a=0;for(let l=0,c=s.length;l<c;l++)this.tag.insertRule(i,s[l])&&(this.groupSizes[r]++,i++,a++);a>0&&this._cGroup>r&&(this._cIndex+=a)}clearGroup(r){if(r<this.length){const s=this.groupSizes[r],i=this.indexOfGroup(r),a=i+s;this.groupSizes[r]=0;for(let l=i;l<a;l++)this.tag.deleteRule(i);s>0&&this._cGroup>r&&(this._cIndex-=s)}}getGroup(r){let s="";if(r>=this.length||this.groupSizes[r]===0)return s;const i=this.groupSizes[r],a=this.indexOfGroup(r),l=a+i;for(let c=a;c<l;c++)s+=this.tag.getRule(c)+pf;return s}},lR=`style[${Zn}][${BC}="${Du}"]`,cR=new RegExp(`^${Zn}\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)`),yw=r=>typeof ShadowRoot<"u"&&r instanceof ShadowRoot||"host"in r&&r.nodeType===11,Mm=r=>{if(!r)return document;if(yw(r))return r;if("getRootNode"in r){const s=r.getRootNode();if(yw(s))return s}return document},uR=(r,s,i)=>{const a=i.split(",");let l;for(let c=0,h=a.length;c<h;c++)(l=a[c])&&r.registerName(s,l)},dR=(r,s)=>{var i;const a=((i=s.textContent)!==null&&i!==void 0?i:"").split(pf),l=[];for(let c=0,h=a.length;c<h;c++){const d=a[c].trim();if(!d)continue;const p=d.match(cR);if(p){const f=0|parseInt(p[1],10),b=p[2];f!==0&&(GA(b,f),uR(r,b,p[3]),r.getTag().insertRules(f,l)),l.length=0}else l.push(d)}},Mg=r=>{const s=Mm(r.options.target).querySelectorAll(lR);for(let i=0,a=s.length;i<a;i++){const l=s[i];l&&l.getAttribute(Zn)!==PC&&(dR(r,l),l.parentNode&&l.parentNode.removeChild(l))}};let ia=!1;function hR(){if(ia!==!1)return ia;if(typeof document<"u"){const r=document.head.querySelector('meta[property="csp-nonce"]');if(r)return ia=r.nonce||r.getAttribute("content")||void 0;const s=document.head.querySelector('meta[name="sc-nonce"]');if(s)return ia=s.getAttribute("content")||void 0}return ia=typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0}const YC=(r,s)=>{const i=document.head,a=r||i,l=document.createElement("style"),c=(p=>{const f=Array.from(p.querySelectorAll(`style[${Zn}]`));return f[f.length-1]})(a),h=c!==void 0?c.nextSibling:null;l.setAttribute(Zn,PC),l.setAttribute(BC,Du);const d=s||hR();return d&&l.setAttribute("nonce",d),a.insertBefore(l,h),l},pR=class{constructor(r,s){this.element=YC(r,s),this.element.appendChild(document.createTextNode("")),this.sheet=(i=>{var a;if(i.sheet)return i.sheet;const l=(a=i.getRootNode().styleSheets)!==null&&a!==void 0?a:document.styleSheets;for(let c=0,h=l.length;c<h;c++){const d=l[c];if(d.ownerNode===i)return d}throw Au(17)})(this.element),this.length=0}insertRule(r,s){try{return this.sheet.insertRule(s,r),this.length++,!0}catch{return!1}}deleteRule(r){this.sheet.deleteRule(r),this.length--}getRule(r){const s=this.sheet.cssRules[r];return s&&s.cssText?s.cssText:""}},gR=class{constructor(r,s){this.element=YC(r,s),this.nodes=this.element.childNodes,this.length=0}insertRule(r,s){if(r<=this.length&&r>=0){const i=document.createTextNode(s);return this.element.insertBefore(i,this.nodes[r]||null),this.length++,!0}return!1}deleteRule(r){this.element.removeChild(this.nodes[r]),this.length--}getRule(r){return r<this.length?this.nodes[r].textContent:""}};let vw=pa;const mR={isServer:!pa,useCSSOMInjection:!zA};class Ma{static registerId(s){return Tc(s)}constructor(s=Qn,i={},a){this.options=Object.assign(Object.assign({},mR),s),this.gs=i,this.keyframeIds=new Set,this.names=new Map(a),this.server=!!s.isServer,!this.server&&pa&&vw&&(vw=!1,Mg(this)),KC(this,()=>(l=>{const c=l.getTag(),{length:h}=c;let d="";for(let p=0;p<h;p++){const f=WA(p);if(f===void 0)continue;const b=l.names.get(f);if(b===void 0||!b.size)continue;const v=c.getGroup(p);if(v.length===0)continue;const _=Zn+".g"+p+'[id="'+f+'"]';let y="";for(const w of b)w.length>0&&(y+=w+",");d+=v+_+'{content:"'+y+'"}'+pf}return d})(this))}rehydrate(){!this.server&&pa&&Mg(this)}reconstructWithOptions(s,i=!0){const a=new Ma(Object.assign(Object.assign({},this.options),s),this.gs,i&&this.names||void 0);return a.keyframeIds=new Set(this.keyframeIds),!this.server&&pa&&s.target!==this.options.target&&Mm(this.options.target)!==Mm(s.target)&&Mg(a),a}allocateGSInstance(s){return this.gs[s]=(this.gs[s]||0)+1}getTag(){return this.tag||(this.tag=(s=(({useCSSOMInjection:i,target:a,nonce:l})=>i?new pR(a,l):new gR(a,l))(this.options),new aR(s)));var s}hasNameForId(s,i){var a,l;return(l=(a=this.names.get(s))===null||a===void 0?void 0:a.has(i))!==null&&l!==void 0&&l}registerName(s,i){Tc(s),s.startsWith(UA)&&this.keyframeIds.add(s);const a=this.names.get(s);a?a.add(i):this.names.set(s,new Set([i]))}insertRules(s,i,a){this.registerName(s,i),this.getTag().insertRules(Tc(s),a)}clearNames(s){this.names.has(s)&&this.names.get(s).clear()}clearRules(s){this.getTag().clearGroup(Tc(s)),this.clearNames(s)}clearTag(){this.tag=void 0}}const JC=new WeakSet,fR={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexShrink:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale: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};function $R(r,s){return s==null||typeof s=="boolean"||s===""?"":typeof s!="number"||s===0||r in fR||r.startsWith("--")?String(s).trim():s+"px"}const bR=r=>r>="A"&&r<="Z";function _w(r){let s="";for(let i=0;i<r.length;i++){const a=r[i];if(i===1&&a==="-"&&r[0]==="-")return r;bR(a)?s+="-"+a.toLowerCase():s+=a}return s.startsWith("ms-")?"-"+s:s}const yR=Symbol.for("sc-keyframes");function vR(r){return typeof r=="object"&&r!==null&&yR in r}function qC(r){return Oa(r)&&!(r.prototype&&r.prototype.isReactComponent)}const XC=r=>r==null||r===!1||r==="",_R=Symbol.for("react.client.reference");function ww(r){return r.$$typeof===_R}const ZC=r=>{const s=[];for(const i in r){const a=r[i];r.hasOwnProperty(i)&&!XC(a)&&(Array.isArray(a)&&JC.has(a)||Oa(a)?s.push(_w(i)+":",a,";"):ka(a)?s.push(i+" {",...ZC(a),"}"):s.push(_w(i)+": "+$R(i,a)+";"))}return s};function oi(r,s,i,a,l=[]){if(XC(r))return l;const c=typeof r;if(c==="string")return l.push(r),l;if(c==="function"){if(ww(r))return l;if(qC(r)&&s){const h=r(s);return oi(h,s,i,a,l)}return l.push(r),l}if(Array.isArray(r)){for(let h=0;h<r.length;h++)oi(r[h],s,i,a,l);return l}if(mf(r))return l.push(`.${r.styledComponentId}`),l;if(vR(r))return i?(r.inject(i,a),l.push(r.getName(a))):l.push(r),l;if(ww(r))return l;if(ka(r)){const h=ZC(r);for(let d=0;d<h.length;d++)l.push(h[d]);return l}return l.push(r.toString()),l}const wR=UC(Du);class kR{constructor(s,i,a){this.rules=s,this.componentId=i,this.baseHash=zi(wR,i),this.baseStyle=a,Ma.registerId(i)}generateAndInjectStyles(s,i,a){let l=this.baseStyle?this.baseStyle.generateAndInjectStyles(s,i,a):"";{let c="";for(let h=0;h<this.rules.length;h++){const d=this.rules[h];if(typeof d=="string")c+=d;else if(d)if(qC(d)){const p=d(s);typeof p=="string"?c+=p:p!=null&&p!==!1&&(c+=Rm(oi(p,s,i,a)))}else c+=Rm(oi(d,s,i,a))}if(c){this.dynamicNameCache||(this.dynamicNameCache=new Map);const h=a.hash?a.hash+c:c;let d=this.dynamicNameCache.get(h);if(!d){if(d=zC(zi(zi(this.baseHash,a.hash),c)>>>0),this.dynamicNameCache.size>=200){const p=this.dynamicNameCache.keys().next().value;p!==void 0&&this.dynamicNameCache.delete(p)}this.dynamicNameCache.set(h,d)}if(!i.hasNameForId(this.componentId,d)){const p=a(c,"."+d,void 0,this.componentId);i.insertRules(this.componentId,d,p)}l=ca(l,d)}}return l}}const CR=/&/g,Li=47;function QC(r,s){let i=0;for(;--s>=0&&r.charCodeAt(s)===92;)i++;return!(1&~i)}function Ng(r){const s=r.length;let i="",a=0,l=0,c=0,h=!1,d=!1;for(let p=0;p<s;p++){const f=r.charCodeAt(p);if(c!==0||h||f!==Li||r.charCodeAt(p+1)!==42)if(h)f===42&&r.charCodeAt(p+1)===Li&&(h=!1,p++);else if(f!==34&&f!==39||QC(r,p)){if(c===0)if(f===123)l++;else if(f===125){if(l--,l<0){d=!0;let b=p+1;for(;b<s;){const v=r.charCodeAt(b);if(v===59||v===10)break;b++}b<s&&r.charCodeAt(b)===59&&b++,l=0,p=b-1,a=b;continue}l===0&&(i+=r.substring(a,p+1),a=p+1)}else f===59&&l===0&&(i+=r.substring(a,p+1),a=p+1)}else c===0?c=f:c===f&&(c=0);else h=!0,p++}return d||l!==0||c!==0?(a<s&&l===0&&c===0&&(i+=r.substring(a)),i):r}function eS(r,s){for(let i=0;i<r.length;i++){const a=r[i];if(a.type==="rule"){a.value=s+" "+a.value,a.value=a.value.replaceAll(",",","+s+" ");const l=a.props,c=[];for(let h=0;h<l.length;h++)c[h]=s+" "+l[h];a.props=c}Array.isArray(a.children)&&a.type!=="@keyframes"&&(a.children=eS(a.children,s))}return r}function SR({options:r=Qn,plugins:s=gf}=Qn){let i,a,l;const c=(_,y,w)=>w.startsWith(a)&&w.endsWith(a)&&w.replaceAll(a,"").length>0?`.${i}`:_,h=s.slice();h.push(_=>{_.type===Tu&&_.value.includes("&")&&(l||(l=new RegExp(`\\${a}\\b`,"g")),_.props[0]=_.props[0].replace(CR,a).replace(l,c))}),r.prefix&&h.push(FA),h.push(PA);let d=[];const p=BA(h.concat(jA(_=>d.push(_)))),f=(_,y="",w="",$="&")=>{i=$,a=y,l=void 0;const I=(function(C){const D=C.indexOf("//")!==-1,R=C.indexOf("}")!==-1;if(!D&&!R)return C;if(!D)return Ng(C);const N=C.length;let U="",j=0,B=0,J=0,ae=0,ye=0,M=!1;for(;B<N;){const W=C.charCodeAt(B);if(W!==34&&W!==39||QC(C,B))if(J===0)if(W===Li&&B+1<N&&C.charCodeAt(B+1)===42){for(B+=2;B+1<N&&(C.charCodeAt(B)!==42||C.charCodeAt(B+1)!==Li);)B++;B+=2}else if(W!==40)if(W!==41)if(ae>0)B++;else if(W===42&&B+1<N&&C.charCodeAt(B+1)===Li)U+=C.substring(j,B),B+=2,j=B,M=!0;else if(W===Li&&B+1<N&&C.charCodeAt(B+1)===Li){for(U+=C.substring(j,B);B<N&&C.charCodeAt(B)!==10;)B++;j=B,M=!0}else W===123?ye++:W===125&&ye--,B++;else ae>0&&ae--,B++;else ae++,B++;else B++;else J===0?J=W:J===W&&(J=0),B++}return M?(j<N&&(U+=C.substring(j)),ye===0?U:Ng(U)):ye===0?C:Ng(C)})(_);let T=NA(w||y?w+" "+y+" { "+I+" }":I);return r.namespace&&(T=eS(T,r.namespace)),d=[],Xc(T,p),d},b=r;let v=Dm;for(let _=0;_<s.length;_++)s[_].name||Au(15),v=zi(v,s[_].name);return b!=null&&b.namespace&&(v=zi(v,b.namespace)),b!=null&&b.prefix&&(v=zi(v,"p")),f.hash=v!==Dm?v.toString():"",f}const TR=new Ma,IR=SR(),tS=pe.createContext({shouldForwardProp:void 0,styleSheet:TR,stylis:IR,stylisPlugins:void 0});tS.Consumer;function sS(){return pe.useContext(tS)}const ff=pe.createContext(void 0);ff.Consumer;const kw=Object.prototype.hasOwnProperty,Lg={};function ER(r,s){const i=typeof r!="string"?"sc":FC(r);Lg[i]=(Lg[i]||0)+1;const a=i+"-"+HC(Du+i+Lg[i]);return s?s+"-"+a:a}function xR(r,s,i){const a=mf(r),l=r,c=!Am(r),{attrs:h=gf,componentId:d=ER(s.displayName,s.parentComponentId),displayName:p=qA(r)}=s,f=s.displayName&&s.componentId?FC(s.displayName)+"-"+s.componentId:s.componentId||d,b=a&&l.attrs?l.attrs.concat(h).filter(Boolean):h;let{shouldForwardProp:v}=s;if(a&&l.shouldForwardProp){const $=l.shouldForwardProp;if(s.shouldForwardProp){const I=s.shouldForwardProp;v=(T,C)=>$(T,C)&&I(T,C)}else v=$}const _=new kR(i,f,a?l.componentStyle:void 0);function y($,I){return(function(T,C,D){const{attrs:R,componentStyle:N,defaultProps:U,foldedComponentIds:j,styledComponentId:B,target:J}=T,ae=pe.useContext(ff),ye=sS(),M=T.shouldForwardProp||ye.shouldForwardProp,W=jC(C,ae,U)||Qn;let k,X;{const le=pe.useRef(null),Q=le.current;if(Q!==null&&Q[1]===W&&Q[2]===ye.styleSheet&&Q[3]===ye.stylis&&Q[7]===N&&(function(F,P,me){const ne=F,ie=P;let ke=0;for(const Ne in ie)if(kw.call(ie,Ne)&&(ke++,ne[Ne]!==ie[Ne]))return!1;return ke===me})(Q[0],C,Q[4]))k=Q[5],X=Q[6];else{k=(function(P,me,ne){const ie=Object.assign(Object.assign({},me),{className:void 0,theme:ne}),ke=P.length>1;for(let Ne=0;Ne<P.length;Ne++){const Ae=P[Ne],xe=Oa(Ae)?Ae(ke?Object.assign({},ie):ie):Ae;for(const Pe in xe)Pe==="className"?ie.className=ca(ie.className,xe[Pe]):Pe==="style"?ie.style=Object.assign(Object.assign({},ie.style),xe[Pe]):Pe in me&&me[Pe]===void 0||(ie[Pe]=xe[Pe])}return"className"in me&&typeof me.className=="string"&&(ie.className=ca(ie.className,me.className)),ie})(R,C,W),X=(function(P,me,ne,ie){return P.generateAndInjectStyles(me,ne,ie)})(N,k,ye.styleSheet,ye.stylis);let F=0;for(const P in C)kw.call(C,P)&&F++;le.current=[C,W,ye.styleSheet,ye.stylis,F,k,X,N]}}const ge=k.as||J,ce=(function(le,Q,F,P){const me={};for(const ne in le)le[ne]===void 0||ne[0]==="$"||ne==="as"||ne==="theme"&&le.theme===F||(ne==="forwardedAs"?me.as=le.forwardedAs:P&&!P(ne,Q)||(me[ne]=le[ne]));return me})(k,ge,W,M);let oe=ca(j,B);return X&&(oe+=" "+X),k.className&&(oe+=" "+k.className),ce[Am(ge)&&ge.includes("-")?"class":"className"]=oe,D&&(ce.ref=D),ET(ge,ce)})(w,$,I)}y.displayName=p;let w=pe.forwardRef(y);return w.attrs=b,w.componentStyle=_,w.displayName=p,w.shouldForwardProp=v,w.foldedComponentIds=a?ca(l.foldedComponentIds,l.styledComponentId):"",w.styledComponentId=f,w.target=a?l.target:r,Object.defineProperty(w,"defaultProps",{get(){return this._foldedDefaultProps},set($){this._foldedDefaultProps=a?(function(I,...T){for(const C of T)Om(I,C,!0);return I})({},l.defaultProps,$):$}}),KC(w,()=>`.${w.styledComponentId}`),c&&VC(w,r,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),w}var DR=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","br","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","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]);function Cw(r,s){const i=[r[0]];for(let a=0,l=s.length;a<l;a+=1)i.push(s[a],r[a+1]);return i}const Sw=r=>(JC.add(r),r);function oS(r,...s){if(Oa(r)||ka(r))return Sw(oi(Cw(gf,[r,...s])));const i=r;return s.length===0&&i.length===1&&typeof i[0]=="string"?oi(i):Sw(oi(Cw(i,s)))}function Nm(r,s,i=Qn){if(!s)throw Au(1,s);const a=(l,...c)=>r(s,i,oS(l,...c));return a.attrs=l=>Nm(r,s,Object.assign(Object.assign({},i),{attrs:Array.prototype.concat(i.attrs,l).filter(Boolean)})),a.withConfig=l=>Nm(r,s,Object.assign(Object.assign({},i),l)),a}const iS=r=>Nm(xR,r),Fs=iS;DR.forEach(r=>{Fs[r]=iS(r)});class AR{constructor(s,i){this.instanceRules=new Map,this.rules=s,this.componentId=i,this.isStatic=(function(a){for(let l=0;l<a.length;l+=1){const c=a[l];if(Oa(c)&&!mf(c))return!1}return!0})(s),Ma.registerId(this.componentId)}removeStyles(s,i){this.instanceRules.delete(s),this.rebuildGroup(i)}renderStyles(s,i,a,l){const c=this.componentId;if(this.isStatic){if(a.hasNameForId(c,c+s))this.instanceRules.has(s)||this.computeRules(s,i,a,l);else{const d=this.computeRules(s,i,a,l);a.insertRules(c,d.name,d.rules)}return}const h=this.instanceRules.get(s);if(this.computeRules(s,i,a,l),!a.server&&h){const d=h.rules,p=this.instanceRules.get(s).rules;if(d.length===p.length){let f=!0;for(let b=0;b<d.length;b++)if(d[b]!==p[b]){f=!1;break}if(f)return}}this.rebuildGroup(a)}computeRules(s,i,a,l){const c=Rm(oi(this.rules,i,a,l)),h={name:this.componentId+s,rules:l(c,"")};return this.instanceRules.set(s,h),h}rebuildGroup(s){const i=this.componentId;s.clearRules(i);for(const a of this.instanceRules.values())s.insertRules(i,a.name,a.rules)}}function RR(r,...s){const i=oS(r,...s),a=`sc-global-${HC(JSON.stringify(i))}`,l=new AR(i,a),c=d=>{const p=sS(),f=pe.useContext(ff);let b;{const v=pe.useRef(null);v.current===null&&(v.current=p.styleSheet.allocateGSInstance(a)),b=v.current}p.styleSheet.server&&h(b,d,p.styleSheet,f,p.stylis);{const v=l.isStatic?[b,p.styleSheet,l]:[b,d,p.styleSheet,f,p.stylis,l],_=pe.useRef(l);pe.useLayoutEffect(()=>(p.styleSheet.server||(_.current!==l&&(p.styleSheet.clearRules(a),_.current=l),h(b,d,p.styleSheet,f,p.stylis)),()=>{l.removeStyles(b,p.styleSheet)}),v)}return p.styleSheet.server&&l.instanceRules.delete(b),null};function h(d,p,f,b,v){if(l.isStatic)l.renderStyles(d,HA,f,v);else{const _=Object.assign(Object.assign({},p),{theme:jC(p,b,c.defaultProps)});l.renderStyles(d,_,f,v)}}return pe.memo(c)}function Tw(r,s){(s==null||s>r.length)&&(s=r.length);for(var i=0,a=Array(s);i<s;i++)a[i]=r[i];return a}function OR(r){if(Array.isArray(r))return r}function MR(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function NR(r,s,i){return s=Qc(s),UR(r,nS()?Reflect.construct(s,[],Qc(r).constructor):s.apply(r,i))}function LR(r,s){if(!(r instanceof s))throw new TypeError("Cannot call a class as a function")}function PR(r,s){for(var i=0;i<s.length;i++){var a=s[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,rS(a.key),a)}}function BR(r,s,i){return s&&PR(r.prototype,s),Object.defineProperty(r,"prototype",{writable:!1}),r}function Kn(r,s){var i=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!i){if(Array.isArray(r)||(i=aS(r))||s){i&&(r=i);var a=0,l=function(){};return{s:l,n:function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(p){throw p},f:l}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
95
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var c,h=!0,d=!1;return{s:function(){i=i.call(r)},n:function(){var p=i.next();return h=p.done,p},e:function(p){d=!0,c=p},f:function(){try{h||i.return==null||i.return()}finally{if(d)throw c}}}}function ks(r,s,i){return(s=rS(s))in r?Object.defineProperty(r,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[s]=i,r}function Qc(r){return Qc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},Qc(r)}function jR(r,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(s&&s.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),s&&Lm(r,s)}function nS(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nS=function(){return!!r})()}function FR(r,s){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var a,l,c,h,d=[],p=!0,f=!1;try{if(c=(i=i.call(r)).next,s!==0)for(;!(p=(a=c.call(i)).done)&&(d.push(a.value),d.length!==s);p=!0);}catch(b){f=!0,l=b}finally{try{if(!p&&i.return!=null&&(h=i.return(),Object(h)!==h))return}finally{if(f)throw l}}return d}}function zR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
96
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Iw(r,s){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);s&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(r,l).enumerable})),i.push.apply(i,a)}return i}function eu(r){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{};s%2?Iw(Object(i),!0).forEach(function(a){ks(r,a,i[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):Iw(Object(i)).forEach(function(a){Object.defineProperty(r,a,Object.getOwnPropertyDescriptor(i,a))})}return r}function UR(r,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 MR(r)}function Lm(r,s){return Lm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,a){return i.__proto__=a,i},Lm(r,s)}function HR(r,s){return OR(r)||FR(r,s)||aS(r,s)||zR()}function zs(r,s){return s||(s=r.slice(0)),Object.freeze(Object.defineProperties(r,{raw:{value:Object.freeze(s)}}))}function WR(r,s){if(typeof r!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var a=i.call(r,s);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function rS(r){var s=WR(r,"string");return typeof s=="symbol"?s:s+""}function aS(r,s){if(r){if(typeof r=="string")return Tw(r,s);var i={}.toString.call(r).slice(8,-1);return i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set"?Array.from(r):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Tw(r,s):void 0}}var Ew,GR=RR(Ew||(Ew=zs([`
|
|
97
|
+
.focus-outline-hidden :focus {
|
|
98
|
+
outline: none;
|
|
99
|
+
}
|
|
100
|
+
`]))),xw,lS=Fs.button(xw||(xw=zs([`
|
|
101
|
+
display: block;
|
|
102
|
+
padding: 0;
|
|
103
|
+
border: 0;
|
|
104
|
+
background: none;
|
|
105
|
+
font-size: 0;
|
|
106
|
+
cursor: `,`;
|
|
107
|
+
`])),function(r){return r.disabled?"not-allowed":"pointer"}),Dw,Aw,VR=Fs.span(Dw||(Dw=zs([`
|
|
108
|
+
font-size: 12px;
|
|
109
|
+
line-height: 1;
|
|
110
|
+
`])));function cS(r){var s=r.className,i=r.onClick,a=r.inverted,l=r.label,c=r.disabled;return pe.createElement(lS,{className:s,onClick:i,"data-tour-elem":"".concat(a?"right":"left","-arrow"),disabled:c},l?pe.createElement(VR,null,l):pe.createElement("svg",{viewBox:"0 0 18.4 14.4"},pe.createElement("path",{d:a?"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"})))}cS.propTypes={className:ve.string.isRequired,onClick:ve.func.isRequired,inverted:ve.bool,label:ve.node,disabled:ve.bool};var Rw=Fs(cS)(Aw||(Aw=zs([`
|
|
111
|
+
color: `,`;
|
|
112
|
+
|
|
113
|
+
`,`;
|
|
114
|
+
`,`;
|
|
115
|
+
|
|
116
|
+
&:hover {
|
|
117
|
+
color: `,`;
|
|
118
|
+
}
|
|
119
|
+
`])),function(r){return r.disabled?"#caccce":"#646464"},function(r){return r.inverted?"margin-left: 24px;":"margin-right: 24px;"},function(r){return!r.label&&`
|
|
120
|
+
width: 16px;
|
|
121
|
+
height: 12px;
|
|
122
|
+
flex: 0 0 16px;
|
|
123
|
+
`},function(r){return r.disabled?"#caccce":"#000"}),Ow;function uS(r){var s=r.className,i=r.onClick,a=r.ariaLabel;return pe.createElement(lS,{className:s,onClick:i,"aria-label":a},pe.createElement("svg",{viewBox:"0 0 9.1 9.1","aria-hidden":!0,role:"presentation"},pe.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"})))}uS.propTypes={className:ve.string.isRequired,onClick:ve.func.isRequired,ariaLabel:ve.string};var KR=Fs(uS)(Ow||(Ow=zs([`
|
|
124
|
+
position: absolute;
|
|
125
|
+
top: 22px;
|
|
126
|
+
right: 22px;
|
|
127
|
+
width: 9px;
|
|
128
|
+
height: 9px;
|
|
129
|
+
color: #5e5e5e;
|
|
130
|
+
&:hover {
|
|
131
|
+
color: #000;
|
|
132
|
+
}
|
|
133
|
+
`])));function Wc(r){var s=r.getBoundingClientRect(),i=s.top,a=s.right,l=s.bottom,c=s.left,h=s.width,d=s.height;return{top:i,right:a,bottom:l,left:c,width:h,height:d}}function dS(r,s){if(!s.highlightedSelectors)return Wc(r);var i=Wc(r),a=Kn(s.highlightedSelectors),l;try{for(a.s();!(l=a.n()).done;){var c=l.value,h=document.querySelector(c);if(!(!h||h.style.display==="none"||h.style.visibility==="hidden")){var d=Wc(h);d.top<i.top&&(i.top=d.top),d.right>i.right&&(i.right=d.right),d.bottom>i.bottom&&(i.bottom=d.bottom),d.left<i.left&&(i.left=d.left)}}}catch(p){a.e(p)}finally{a.f()}return i.width=i.right-i.left,i.height=i.bottom-i.top,i}function YR(r){var s=r.top,i=r.right,a=r.bottom,l=r.left,c=r.w,h=r.h,d=r.threshold,p=d===void 0?0:d;return s>=0+p&&l>=0+p&&a<=h-p&&i<=c-p}function JR(r){return r===document.querySelector("body")||r===document.querySelector("html")}var qR=function(s){return/(left|right)/.test(s)},Pg=function(s,i){return s>i},Bg=function(s,i){return s>i},io=function(s){return s<0?0:s};function XR(r){return Object.keys(r).map(function(s){return{position:s,value:r[s]}}).sort(function(s,i){return i.value-s.value}).map(function(s){return s.position})}var Mw,ZR=Fs.div(Mw||(Mw=zs([`
|
|
134
|
+
--reactour-accent: `,`;
|
|
135
|
+
`,`
|
|
136
|
+
position: fixed;
|
|
137
|
+
transition: transform 0.3s;
|
|
138
|
+
top: 0;
|
|
139
|
+
left: 0;
|
|
140
|
+
z-index: 1000000;
|
|
141
|
+
|
|
142
|
+
transform: `,`;
|
|
143
|
+
`])),function(r){return r.accentColor},function(r){return r.defaultStyles?`
|
|
144
|
+
max-width: 331px;
|
|
145
|
+
min-width: 150px;
|
|
146
|
+
padding-right: 40px;
|
|
147
|
+
border-radius: `.concat(r.rounded,`px;
|
|
148
|
+
background-color: #fff;
|
|
149
|
+
padding: 24px 30px;
|
|
150
|
+
box-shadow: 0 0.5em 3em rgba(0, 0, 0, 0.3);
|
|
151
|
+
color: inherit;
|
|
152
|
+
`):""},function(r){var s=r.targetTop,i=r.targetRight,a=r.targetBottom,l=r.targetLeft,c=r.windowWidth,h=r.windowHeight,d=r.helperWidth,p=r.helperHeight,f=r.helperPosition,b=r.padding,v={left:l,right:c-i,top:s,bottom:h-a},_=function(T){return v[T]>(qR(T)?d+b*2:p+b*2)},y=function(T){for(var C=XR(v),D=0;D<C.length;D++)if(_(C[D]))return T[C[D]];return T.center},w=function(T){if(Array.isArray(T)){var C=Pg(T[0],c),D=Bg(T[1],h),R=function(ye,M){console.warn("".concat(ye,":").concat(M," is outside window, falling back to center"))};return C&&R("x",T[0]),D&&R("y",T[1]),[C?c/2-d/2:T[0],D?h/2-p/2:T[1]]}var N=Pg(l+d,c)?Pg(i+b,c)?i-d:i-d+b:l-b,U=N>b?N:b,j=Bg(s+p,h)?Bg(a+b,h)?a-p:a-p+b:s-b,B=j>b?j:b,J={top:[U,s-p-b*2],right:[i+b*2,B],bottom:[U,a+b*2],left:[l-d-b*2,B],center:[c/2-d/2,h/2-p/2]};return T==="center"||_(T)?J[T]:y(J)},$=w(f);return"translate(".concat(Math.round($[0]),"px, ").concat(Math.round($[1]),"px)")}),Nw,QR=Fs.span(Nw||(Nw=zs([`
|
|
153
|
+
position: absolute;
|
|
154
|
+
font-family: monospace;
|
|
155
|
+
background: var(--reactour-accent);
|
|
156
|
+
background: `,`;
|
|
157
|
+
height: 1.875em;
|
|
158
|
+
line-height: 2;
|
|
159
|
+
padding-left: 0.8125em;
|
|
160
|
+
padding-right: 0.8125em;
|
|
161
|
+
font-size: 1em;
|
|
162
|
+
border-radius: 1.625em;
|
|
163
|
+
color: white;
|
|
164
|
+
text-align: center;
|
|
165
|
+
box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.3);
|
|
166
|
+
top: -0.8125em;
|
|
167
|
+
left: -0.8125em;
|
|
168
|
+
`])),function(r){return r.accentColor}),Lw,eO=Fs.div(Lw||(Lw=zs([`
|
|
169
|
+
display: flex;
|
|
170
|
+
margin-top: 24px;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
`]))),Pw,tO=Fs.nav(Pw||(Pw=zs([`
|
|
174
|
+
counter-reset: dot;
|
|
175
|
+
display: flex;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
align-items: center;
|
|
178
|
+
flex-wrap: wrap;
|
|
179
|
+
`]))),Bw,sO=Fs.button(Bw||(Bw=zs([`
|
|
180
|
+
counter-increment: dot;
|
|
181
|
+
width: 8px;
|
|
182
|
+
height: 8px;
|
|
183
|
+
border: `,`;
|
|
184
|
+
|
|
185
|
+
border-radius: 100%;
|
|
186
|
+
padding: 0;
|
|
187
|
+
display: block;
|
|
188
|
+
margin: 4px;
|
|
189
|
+
transition: opacity 0.3s, transform 0.3s;
|
|
190
|
+
cursor: `,`;
|
|
191
|
+
transform: scale(`,`);
|
|
192
|
+
|
|
193
|
+
color: `,`;
|
|
194
|
+
background: `,`;
|
|
195
|
+
|
|
196
|
+
color: `,`;
|
|
197
|
+
background: `,`;
|
|
198
|
+
|
|
199
|
+
&:before {
|
|
200
|
+
content: counter(dot);
|
|
201
|
+
position: absolute;
|
|
202
|
+
bottom: calc(100% + 0.25em);
|
|
203
|
+
left: 50%;
|
|
204
|
+
opacity: 0;
|
|
205
|
+
transform: translate(-50%, 1em);
|
|
206
|
+
transition: 0.3s;
|
|
207
|
+
display: `,`;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&:hover {
|
|
211
|
+
background-color: currentColor;
|
|
212
|
+
|
|
213
|
+
&:before {
|
|
214
|
+
opacity: 0.5;
|
|
215
|
+
transform: translate(-50%, -2px);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
`])),function(r){return r.current===r.index?"0":"1px solid #caccce"},function(r){return r.disabled?"not-allowed":"pointer"},function(r){return r.current===r.index?1.25:1},function(r){return r.current===r.index?"var(--reactour-accent)":"#caccce"},function(r){return r.current===r.index?"var(--reactour-accent)":"none"},function(r){return r.current===r.index?r.accentColor:"#caccce"},function(r){return r.current===r.index?r.accentColor:"none"},function(r){return r.showNumber?"block":"none"}),jw,oO=Fs.div(jw||(jw=zs([`
|
|
219
|
+
opacity: `,`;
|
|
220
|
+
color: `,`;
|
|
221
|
+
width: 100%;
|
|
222
|
+
left: 0;
|
|
223
|
+
top: 0;
|
|
224
|
+
height: 100%;
|
|
225
|
+
position: fixed;
|
|
226
|
+
z-index: 99999;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
`])),function(r){return!r.maskClassName&&.7},function(r){return!r.maskClassName&&"#000"});function hS(r){var s=r.windowWidth,i=r.windowHeight,a=r.targetWidth,l=r.targetHeight,c=r.targetTop,h=r.targetLeft,d=r.padding,p=r.rounded,f=r.roundedStep,b=r.disableInteraction,v=r.disableInteractionClassName,_=r.className,y=r.onClick,w=r.highlightedBorder,$=io(a+d*2),I=io(l+d*2),T=io(c-d),C=io(h-d),D=f?Math.min($/2,I/2):p;return pe.createElement(oO,{onClick:y,maskClassName:_},pe.createElement("svg",{width:s,height:i,xmlns:"http://www.w3.org/2000/svg",className:_},pe.createElement("defs",null,pe.createElement("mask",{id:"mask-main"},pe.createElement("rect",{x:0,y:0,width:s,height:i,fill:"white"}),pe.createElement("rect",{x:C,y:T,width:$,height:I,fill:"black"}),pe.createElement("rect",{x:C-1,y:T-1,width:D,height:D,fill:"white"}),pe.createElement("circle",{cx:C+D,cy:T+D,r:D,fill:"black"}),pe.createElement("rect",{x:C+$-D+1,y:T-1,width:D,height:D,fill:"white"}),pe.createElement("circle",{cx:C+$-D,cy:T+D,r:D,fill:"black"}),pe.createElement("rect",{x:C-1,y:T+I-D+1,width:D,height:D,fill:"white"}),pe.createElement("circle",{cx:C+D,cy:T+I-D,r:D,fill:"black"}),pe.createElement("rect",{x:C+$-D+1,y:T+I-D+1,width:D,height:D,fill:"white"}),pe.createElement("circle",{cx:C+$-D,cy:T+I-D,r:D,fill:"black "})),pe.createElement("clipPath",{id:"clip-path"},pe.createElement("rect",{x:0,y:0,width:s,height:T}),pe.createElement("rect",{x:0,y:T,width:C,height:I}),pe.createElement("rect",{x:h+a+d,y:T,width:io(s-a-C),height:I}),pe.createElement("rect",{x:0,y:c+l+d,width:s,height:io(i-l-T)}))),pe.createElement("rect",{x:0,y:0,width:s,height:i,fill:"currentColor",mask:"url(#mask-main)"}),pe.createElement("rect",{x:0,y:0,width:s,height:i,fill:"currentColor",clipPath:"url(#clip-path)",pointerEvents:"auto"}),pe.createElement("rect",{x:C,y:T,width:$,height:I,pointerEvents:"auto",fill:"transparent",display:b?"block":"none",className:v}),w&&pe.createElement("rect",{x:io(C+w.width/2),y:io(T+w.width/2),width:io($-w.width),height:io(I-w.width),pointerEvents:"auto",fill:"none",strokeWidth:w.width,stroke:w.color,rx:D-2})))}hS.propTypes={windowWidth:ve.number.isRequired,windowHeight:ve.number.isRequired,targetWidth:ve.number.isRequired,targetHeight:ve.number.isRequired,targetTop:ve.number.isRequired,targetLeft:ve.number.isRequired,padding:ve.number.isRequired,rounded:ve.number.isRequired,roundedStep:ve.bool,disableInteraction:ve.bool.isRequired,disableInteractionClassName:ve.string.isRequired,highlightedBorder:ve.shape({color:ve.string.isRequired,width:ve.number.isRequired})};var iO=(function(r){var s=r.step,i=r.refresh,a=St(0),l=HR(a,2),c=l[0],h=l[1];return Ft(function(){if(s.resizeObservables){var d=function(_){var y=Kn(_),w;try{var $=function(){var T=w.value;if(!T.attributes)return 1;var C=s.resizeObservables.find(function(D){return T.matches(D)||T.querySelector(D)!=null});C&&h(c+1)};for(y.s();!(w=y.n()).done;)$()}catch(I){y.e(I)}finally{y.f()}},p=new MutationObserver(function(v){var _=Kn(v),y;try{for(_.s();!(y=_.n()).done;){var w=y.value;w.addedNodes.length!==0&&d(w.addedNodes),w.removedNodes.length!==0&&d(w.removedNodes)}}catch($){_.e($)}finally{_.f()}}),f=document.documentElement||document.body,b={childList:!0,subtree:!0};return p.observe(f,b),function(){p.disconnect()}}},[s,c]),Ft(function(){if(s.resizeObservables){var d=new ResizeObserver(function(_){i()}),p=Kn(s.resizeObservables),f;try{for(p.s();!(f=p.n()).done;){var b=f.value,v=document.querySelector(b);v&&d.observe(v)}}catch(_){p.e(_)}finally{p.f()}return function(){d.disconnect()}}},[s,c]),null}),nO=(function(r){var s=r.step,i=r.refresh;return Ft(function(){if(s.mutationObservables){var a=function(p){var f=Kn(p),b;try{var v=function(){var y=b.value;if(!y.attributes)return 1;var w=s.mutationObservables.find(function($){return y.matches($)||y.querySelector($)!=null});w&&i()};for(f.s();!(b=f.n()).done;)v()}catch(_){f.e(_)}finally{f.f()}},l=new MutationObserver(function(d){var p=Kn(d),f;try{for(p.s();!(f=p.n()).done;){var b=f.value;b.addedNodes.length!==0&&a(b.addedNodes),b.removedNodes.length!==0&&a(b.removedNodes)}}catch(v){p.e(v)}finally{p.f()}}),c=document.documentElement||document.body,h={childList:!0,subtree:!0};return l.observe(c,h),function(){l.disconnect()}}},[s]),null});function rO(r){var s=r.children,i=ji(null);return i.current===null&&(i.current=document.createElement("div"),i.current.setAttribute("id","___reactour")),Ft(function(){return document.body.appendChild(i.current),function(){document.body.removeChild(i.current)}},[i]),EI(s,i.current)}var aO={disableFocusLock:ve.bool,badgeContent:ve.func,highlightedMaskClassName:ve.string,children:ve.oneOfType([ve.node,ve.element]),className:ve.string,closeButtonAriaLabel:ve.string,closeWithMask:ve.bool,inViewThreshold:ve.number,isOpen:ve.bool.isRequired,lastStepNextButton:ve.node,maskClassName:ve.string,maskSpace:ve.number,nextButton:ve.node,onAfterOpen:ve.func,onBeforeClose:ve.func,onRequestClose:ve.func,prevButton:ve.node,scrollDuration:ve.number,scrollOffset:ve.number,showButtons:ve.bool,showCloseButton:ve.bool,showNavigation:ve.bool,showNavigationNumber:ve.bool,showNumber:ve.bool,startAt:ve.number,goToStep:ve.number,getCurrentStep:ve.func,nextStep:ve.func,prevStep:ve.func,steps:ve.arrayOf(ve.shape({selector:ve.string,content:ve.oneOfType([ve.node,ve.element,ve.func]).isRequired,position:ve.oneOfType([ve.arrayOf(ve.number),ve.oneOf(["top","right","bottom","left","center"])]),action:ve.func,style:ve.object,stepInteraction:ve.bool,navDotAriaLabel:ve.string,roundedStep:ve.bool})),update:ve.string,updateDelay:ve.number,disableInteraction:ve.bool,disableDotsNavigation:ve.bool,disableKeyboardNavigation:ve.oneOfType([ve.arrayOf(ve.oneOf(["esc","right","left"])),ve.bool]),rounded:ve.number,accentColor:ve.string,highlightedBorder:ve.shape({color:ve.string.isRequired,width:ve.number.isRequired})},lO={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},jn={mask:{disableInteraction:"reactour__mask--disable-interaction"},helper:{base:"reactour__helper",isOpen:"reactour__helper--is-open"},dot:{base:"reactour__dot",active:"reactour__dot--is-active"}},$f=(function(r){function s(){var i;return LR(this,s),i=NR(this,s),ks(i,"unlockFocus",function(a){i.setState({focusUnlocked:!0},a())}),ks(i,"showStep",function(){if(!(!i.helper||!i.helper.current)){var a=i.props.steps,l=i.state,c=l.current,h=l.focusUnlocked;h&&i.setState({focusUnlocked:!1});var d=a[c],p=d.selector?document.querySelector(d.selector):null,f=function(w){d.action&&typeof d.action=="function"&&i.unlockFocus(function(){return d.action(w)})};if(d.observe){var b=document.querySelector(d.observe),v={attributes:!0,childList:!0,characterData:!0};i.setState(function(y){return y.observer&&setTimeout(function(){y.observer.disconnect()},0),{observer:new MutationObserver(function(w){w.forEach(function($){if($.type==="childList"&&$.addedNodes.length>0){var I=function(){return f($.addedNodes[0])};setTimeout(function(){return i.calculateNode($.addedNodes[0],d,I)},100)}else if($.type==="childList"&&$.removedNodes.length>0){var T=function(){return f(p)};i.calculateNode(p,d,T)}})})}},function(){return i.state.observer.observe(b,v)})}else i.state.observer&&(i.state.observer.disconnect(),i.setState({observer:null}));if(p){var _=function(){return f(p)};i.calculateNode(p,d,_)}else i.setState(jg(null,d,i.helper.current),f),d.selector&&console.warn("Doesn't find a DOM node '".concat(d.selector,"'. Please check the 'steps' Tour prop Array at position ").concat(c,"."))}}),ks(i,"calculateNode",function(a,l,c){var h=i.props,d=h.scrollDuration,p=h.inViewThreshold,f=h.scrollOffset,b=dS(a,l),v=Math.max(document.documentElement.clientWidth,window.innerWidth||0),_=Math.max(document.documentElement.clientHeight,window.innerHeight||0);if(YR(eu(eu({},b),{},{w:v,h:_,threshold:p})))i.setState(jg(a,l,i.helper.current),c);else{var y=G0(a),w=f||(b.height>_?-25:-(_/2)+b.height/2);U0.to(a,{context:JR(y)?window:y,duration:d,offset:w,callback:function(I){i.setState(jg(I,l,i.helper.current),c)}})}}),ks(i,"recalculateNode",function(a){var l=document.querySelector(a.selector),c=function(d){a.action&&typeof a.action=="function"&&i.unlockFocus(function(){return a.action(d)})};i.calculateNode(l,a,function(){return c(l)})}),ks(i,"maskClickHandler",function(a){var l=i.props,c=l.closeWithMask,h=l.onRequestClose;c&&!a.target.classList.contains(jn.mask.disableInteraction)&&h(a)}),ks(i,"nextStep",function(){var a=i.props,l=a.steps,c=a.getCurrentStep;i.setState(function(h){var d=h.current<l.length-1?h.current+1:h.current;return typeof c=="function"&&c(d),{current:d}},i.showStep)}),ks(i,"prevStep",function(){var a=i.props.getCurrentStep;i.setState(function(l){var c=l.current>0?l.current-1:l.current;return typeof a=="function"&&a(c),{current:c}},i.showStep)}),ks(i,"gotoStep",function(a){var l=i.props,c=l.steps,h=l.getCurrentStep;i.setState(function(d){var p=c[a]?a:d.current;return typeof h=="function"&&h(p),{current:p}},i.showStep)}),ks(i,"keyDownHandler",function(a){var l=i.props,c=l.onRequestClose,h=l.nextStep,d=l.prevStep,p=l.disableKeyboardNavigation;if(a.stopPropagation(),p!==!0){var f,b,v;p&&(f=p.includes("esc"),b=p.includes("right"),v=p.includes("left")),a.keyCode===27&&!f&&(a.preventDefault(),c()),a.keyCode===39&&!b&&(a.preventDefault(),typeof h=="function"?h():i.nextStep()),a.keyCode===37&&!v&&(a.preventDefault(),typeof d=="function"?d():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=xT(),i.helperElement=null,i.debouncedShowStep=uD(i.showStep,70),i}return jR(s,r),BR(s,[{key:"componentDidMount",value:function(){var a=this.props,l=a.isOpen,c=a.startAt;l&&this.open(c)}},{key:"UNSAFE_componentWillReceiveProps",value:function(a){var l=this.props,c=l.isOpen,h=l.update,d=l.updateDelay;!c&&a.isOpen?this.open(a.startAt):c&&!a.isOpen&&this.close(),c&&h!==a.update&&(a.steps[this.state.current]?setTimeout(this.showStep,d):this.props.onRequestClose()),c&&a.isOpen&&this.state.current!==a.goToStep&&this.gotoStep(a.goToStep)}},{key:"componentWillUnmount",value:function(){var a=this.props.isOpen;a&&this.close(),this.state.observer&&this.state.observer.disconnect()}},{key:"open",value:function(a){var l=this,c=this.props.onAfterOpen;this.setState(function(h){return{isOpen:!0,current:a!==void 0?a:h.current}},function(){setTimeout(l.showStep,1),l.helperElement=l.helper.current,l.props.disableFocusLock||l.helper.current.focus(),c&&c(l.helperElement)}),window.addEventListener("resize",this.debouncedShowStep,!1),window.addEventListener("keydown",this.keyDownHandler,!1)}},{key:"close",value:function(){this.setState(function(a){return a.observer&&a.observer.disconnect(),{isOpen:!1,observer:null}},this.onBeforeClose),window.removeEventListener("resize",this.debouncedShowStep),window.removeEventListener("keydown",this.keyDownHandler)}},{key:"onBeforeClose",value:function(){var a=this.props.onBeforeClose;a&&a(this.helperElement)}},{key:"render",value:function(){var a=this,l=this.props,c=l.className,h=l.steps,d=l.maskClassName,p=l.showButtons,f=l.showCloseButton,b=l.closeButtonAriaLabel,v=l.showNavigation,_=l.showNavigationNumber,y=l.showNumber,w=l.onRequestClose,$=l.maskSpace,I=l.lastStepNextButton,T=l.nextButton,C=l.prevButton,D=l.badgeContent,R=l.highlightedMaskClassName,N=l.disableInteraction,U=l.disableDotsNavigation,j=l.nextStep,B=l.prevStep,J=l.rounded,ae=l.accentColor,ye=l.CustomHelper,M=l.disableFocusLock,W=l.highlightedBorder,k=this.state,X=k.isOpen,ge=k.current,ce=k.inDOM,oe=k.top,le=k.right,Q=k.bottom,F=k.left,P=k.width,me=k.height,ne=k.w,ie=k.h,ke=k.helperWidth,Ne=k.helperHeight,Ae=k.helperPosition;return X?pe.createElement(rO,null,pe.createElement(GR,null),pe.createElement(iO,{step:h[ge],refresh:function(){return a.recalculateNode(h[ge])}}),pe.createElement(nO,{step:h[ge],refresh:function(){return a.recalculateNode(h[ge])}}),pe.createElement(hS,{onClick:this.maskClickHandler,forwardRef:function(Pe){return a.mask=Pe},windowWidth:ne,windowHeight:ie,targetWidth:P,targetHeight:me,targetTop:oe,targetLeft:F,padding:$,rounded:J,roundedStep:h[ge].roundedStep,className:d,disableInteraction:h[ge].stepInteraction===!1||N?!h[ge].stepInteraction:N,disableInteractionClassName:"".concat(jn.mask.disableInteraction," ").concat(R),highlightedBorder:W}),pe.createElement(EC,{disabled:M,autoFocus:!1},pe.createElement(ZR,{ref:this.helper,targetHeight:me,targetWidth:P,targetTop:oe,targetRight:le,targetBottom:Q,targetLeft:F,windowWidth:ne,windowHeight:ie,helperWidth:ke,helperHeight:Ne,helperPosition:Ae,padding:$,tabIndex:-1,current:ge,style:h[ge].style?h[ge].style:{},rounded:J,className:sw(jn.helper.base,c,ks({},jn.helper.isOpen,X)),accentColor:ae,defaultStyles:!ye,role:"dialog"},ye?pe.createElement(ye,{current:ge,totalSteps:h.length,gotoStep:this.gotoStep,close:w,content:h[ge]&&(typeof h[ge].content=="function"?h[ge].content({close:w,goTo:this.gotoStep,inDOM:ce,step:ge+1}):h[ge].content)},this.props.children):pe.createElement(pe.Fragment,null,this.props.children,h[ge]&&(typeof h[ge].content=="function"?h[ge].content({close:w,goTo:this.gotoStep,inDOM:ce,step:ge+1}):h[ge].content),y&&pe.createElement(QR,{"data-tour-elem":"badge",accentColor:ae},typeof D=="function"?D(ge+1,h.length):ge+1),(p||v)&&pe.createElement(eO,{"data-tour-elem":"controls"},p&&pe.createElement(Rw,{onClick:typeof B=="function"?B:this.prevStep,disabled:ge===0,label:C||null}),v&&pe.createElement(tO,{"data-tour-elem":"navigation"},h.map(function(xe,Pe){return pe.createElement(sO,{key:"".concat(xe.selector?xe.selector:"undef","_").concat(Pe),onClick:function(){return a.gotoStep(Pe)},current:ge,index:Pe,accentColor:ae,disabled:ge===Pe||U,showNumber:_,"data-tour-elem":"dot",className:sw(jn.dot.base,ks({},jn.dot.active,ge===Pe)),"aria-label":xe.navDotAriaLabel})})),p&&pe.createElement(Rw,{onClick:ge===h.length-1?I?w:function(){}:typeof j=="function"?j:this.nextStep,disabled:!I&&ge===h.length-1,inverted:!0,label:I&&ge===h.length-1?I:T||null})),f&&pe.createElement(KR,{onClick:w,className:"reactour__close",ariaLabel:b}))))):null}}])})(lk),jg=function(s,i,a){if(a){var l=Math.max(document.documentElement.clientWidth,window.innerWidth||0),c=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=Wc(a),d=h.width,p=h.height,f={top:c+10,right:l/2+9,bottom:c/2+9,left:l/2-d/2,width:0,height:0,w:l,h:c,helperPosition:"center"};return s&&(f=dS(s,i)),function(){return eu(eu({w:l,h:c,helperWidth:d,helperHeight:p,helperPosition:i.position},f),{},{inDOM:!!s})}}};$f.propTypes=aO;$f.defaultProps=lO;const cO=""+new URL("blockly2js-B3Jxf2e-.svg",import.meta.url).href,uO=""+new URL("rules2js-DnYyR8mI.svg",import.meta.url).href,dO="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCAzMiIgd2lkdGg9IjY0IiBoZWlnaHQ9IjMyIj4KICA8cG9seWdvbiBwb2ludHM9IjgsMSA2MywxIDYzLDMxIDgsMzEgMSwxNiIgZmlsbD0iIzRhOTBkOSIgZmlsbC1vcGFjaXR5PSIwLjE1IiBzdHJva2U9IiM0YTkwZDkiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CiAgPGNpcmNsZSBjeD0iMTAuNSIgY3k9IjE2IiByPSIyIiBmaWxsPSJub25lIiBzdHJva2U9IiM0YTkwZDkiIHN0cm9rZS13aWR0aD0iMS4yIi8+CiAgPHRleHQgeD0iMzciIHk9IjIxIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiM0YTkwZDkiPk5hbWU8L3RleHQ+Cjwvc3ZnPgo=",hO="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCAzMiIgd2lkdGg9IjY0IiBoZWlnaHQ9IjMyIj4KICA8cG9seWdvbiBwb2ludHM9IjgsMSA2MywxIDYzLDMxIDgsMzEgMSwxNiIgZmlsbD0iIzRhOTBkOSIgc3Ryb2tlPSIjNGE5MGQ5IiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxjaXJjbGUgY3g9IjEwLjUiIGN5PSIxNiIgcj0iMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYThjZWYwIiBzdHJva2Utd2lkdGg9IjEuMiIvPgogIDx0ZXh0IHg9IjM3IiB5PSIxOCIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9IkFyaWFsLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTQiIGZvbnQtd2VpZ2h0PSJib2xkIiBmaWxsPSIjYThjZWYwIj5OYW1lPC90ZXh0PgogIDxjaXJjbGUgY3g9IjMwIiBjeT0iMjUiIHI9IjEuNSIgZmlsbD0iI2E4Y2VmMCIvPgogIDxjaXJjbGUgY3g9IjM3IiBjeT0iMjUiIHI9IjEuNSIgZmlsbD0iI2E4Y2VmMCIvPgogIDxjaXJjbGUgY3g9IjQ0IiBjeT0iMjUiIHI9IjEuNSIgZmlsbD0iI2E4Y2VmMCIvPgo8L3N2Zz4K",pO="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCAzMiIgd2lkdGg9IjY0IiBoZWlnaHQ9IjMyIj4KICA8cG9seWdvbiBwb2ludHM9IjgsMSA2MywxIDYzLDMxIDgsMzEgMSwxNiIgZmlsbD0iI2U2N2UyMiIgZmlsbC1vcGFjaXR5PSIwLjE1IiBzdHJva2U9IiNlNjdlMjIiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CiAgPGNpcmNsZSBjeD0iMTAuNSIgY3k9IjE2IiByPSIyIiBmaWxsPSJub25lIiBzdHJva2U9IiNlNjdlMjIiIHN0cm9rZS13aWR0aD0iMS4yIi8+CiAgPHRleHQgeD0iMzciIHk9IjIxIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiNlNjdlMjIiPklEPC90ZXh0Pgo8L3N2Zz4K",gO="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCAzMiIgd2lkdGg9IjY0IiBoZWlnaHQ9IjMyIj4KICA8cG9seWdvbiBwb2ludHM9IjgsMSA2MywxIDYzLDMxIDgsMzEgMSwxNiIgZmlsbD0iI2U2N2UyMiIgc3Ryb2tlPSIjZTY3ZTIyIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxjaXJjbGUgY3g9IjEwLjUiIGN5PSIxNiIgcj0iMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZjVjMjhhIiBzdHJva2Utd2lkdGg9IjEuMiIvPgogIDx0ZXh0IHg9IjM3IiB5PSIxOCIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9IkFyaWFsLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTQiIGZvbnQtd2VpZ2h0PSJib2xkIiBmaWxsPSIjZjVjMjhhIj5JRDwvdGV4dD4KICA8Y2lyY2xlIGN4PSIzMCIgY3k9IjI1IiByPSIxLjUiIGZpbGw9IiNmNWMyOGEiLz4KICA8Y2lyY2xlIGN4PSIzNyIgY3k9IjI1IiByPSIxLjUiIGZpbGw9IiNmNWMyOGEiLz4KICA8Y2lyY2xlIGN4PSI0NCIgY3k9IjI1IiByPSIxLjUiIGZpbGw9IiNmNWMyOGEiLz4KPC9zdmc+Cg==",Ps={selectTriggers:0,addScheduleByDoubleClick:1,openTagsMenu:2,selectIntervalTag:3,selectActions:4,addActionPrintText:5,showJavascript:6,switchBackToRules:7,saveTheScript:8},mO=[{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"}],Fg=187,Ic={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 Qo(){return g.jsxs("div",{style:Ic.root,children:[g.jsx("style",{children:`
|
|
229
|
+
' @keyframes admin-connecting-colors {
|
|
230
|
+
0% {
|
|
231
|
+
stroke: #4285F4;
|
|
232
|
+
}
|
|
233
|
+
25% {
|
|
234
|
+
stroke: #DE3E35;
|
|
235
|
+
}
|
|
236
|
+
50% {
|
|
237
|
+
stroke: #F7C223;
|
|
238
|
+
}
|
|
239
|
+
75% {
|
|
240
|
+
stroke: #1B9A59;
|
|
241
|
+
}
|
|
242
|
+
100% {
|
|
243
|
+
stroke: #4285F4;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
@keyframes admin-connecting-dash {
|
|
247
|
+
0% {
|
|
248
|
+
stroke-dashoffset: ${Fg};
|
|
249
|
+
}
|
|
250
|
+
50% {
|
|
251
|
+
stroke-dashoffset: ${Fg/4};
|
|
252
|
+
transform: rotate(135deg);
|
|
253
|
+
}
|
|
254
|
+
100% {
|
|
255
|
+
stroke-dashoffset: ${Fg};
|
|
256
|
+
transform: 'rotate(450deg);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
@keyframes admin-connecting-rotator {
|
|
260
|
+
0% {
|
|
261
|
+
transform: rotate(0deg);
|
|
262
|
+
}
|
|
263
|
+
100% {
|
|
264
|
+
transform: rotate(270deg);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
`}),g.jsx("div",{style:Ic.connecting,children:g.jsx("svg",{style:Ic.spinner,width:"100%",height:"100%",viewBox:"0 0 66 66",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("circle",{style:Ic.path,fill:"none",strokeWidth:"6",strokeLinecap:"round",cx:"33",cy:"33",r:"30"})})})]})}function fO(r){const s=[];for(const i of Object.keys(r)){const a=r[i];if((a==null?void 0:a.type)!=="script")continue;const l=a.common;if(!(l!=null&&l.source))continue;let c;typeof l.name=="object"&&l.name?c=l.name.en||l.name.de||i:c=l.name||i,s.push({id:i,name:c,source:l.source,engineType:l.engineType||"Javascript/js",enabled:l.enabled??!1})}return s}const $O=[{regex:r=>new RegExp(`getState\\s*\\(\\s*['"\`]${no(r)}['"\`]`,"g"),type:"read"},{regex:r=>new RegExp(`setState\\s*\\(\\s*['"\`]${no(r)}['"\`]`,"g"),type:"write"},{regex:r=>new RegExp(`setStateChanged\\s*\\(\\s*['"\`]${no(r)}['"\`]`,"g"),type:"write"},{regex:r=>new RegExp(`setStateDelayed\\s*\\(\\s*['"\`]${no(r)}['"\`]`,"g"),type:"write"},{regex:r=>new RegExp(`on\\s*\\(\\s*['"\`]${no(r)}['"\`]`,"g"),type:"subscribe"},{regex:r=>new RegExp(`on\\s*\\(\\s*\\{[^}]*id\\s*:\\s*['"\`]${no(r)}['"\`]`,"g"),type:"subscribe"},{regex:r=>new RegExp(`subscribe\\s*\\(\\s*['"\`]${no(r)}['"\`]`,"g"),type:"subscribe"},{regex:r=>new RegExp(`existsState\\s*\\(\\s*['"\`]${no(r)}['"\`]`,"g"),type:"exists"},{regex:r=>new RegExp(`existsObject\\s*\\(\\s*['"\`]${no(r)}['"\`]`,"g"),type:"exists"},{regex:r=>new RegExp(`=\\s*['"\`]${no(r)}['"\`]`,"g"),type:"read"}];function no(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $re(r,s){var a;const i=[];for(const l of r){if(!l.source.includes(s))continue;const c=l.source.split(`
|
|
268
|
+
`);for(const h of $O){const d=h.regex(s);let p;for(;(p=d.exec(l.source))!==null;){const b=l.source.substring(0,p.index).split(`
|
|
269
|
+
`).length,v=((a=c[b-1])==null?void 0:a.trim())||"";if(!i.some(_=>_.scriptId===l.id&&_.lineNumber===b&&_.usageType===h.type)){let _;typeof l.name=="string"?_=l.name:_=l.id,i.push({scriptId:l.id,scriptName:_,usageType:h.type,lineNumber:b,line:v})}}}}return i}const bO=2e5;function yO(r){const s=/\n\/\/((?:[A-Za-z0-9+/=]){50,})$/,i=r.match(s);if(i){const c=r.substring(0,r.length-i[0].length).trim();if(c&&!c.startsWith("<xml")&&!c.startsWith("<block"))return c}const a=r.split(`
|
|
270
|
+
`);for(let c=a.length-1;c>=0;c--){const h=a[c].trim();if(h.startsWith("//")&&h.length>200&&/^\/\/[A-Za-z0-9+/=%]+$/.test(h)){const d=a.slice(0,c).join(`
|
|
271
|
+
`).trim();if(d&&!d.startsWith("<xml")&&!d.startsWith("<block"))return d}}const l=r.trim();return!l.startsWith("<xml")&&!l.startsWith("<block")&&!l.startsWith("<?xml")?l:null}function vO(r){const s=[],i=/<field name="OID">([^<]+)<\/field>/gi,a=new Set;let l;for(;(l=i.exec(r))!==null;)a.add(l[1]);a.size>0&&s.push(`Datapoints used: ${[...a].join(", ")}`);const c=/<field name="(?:VALUE|TEXT|NUM|DELAY_MS|CRON)">([^<]+)<\/field>/gi,h=[];let d;for(;(d=c.exec(r))!==null;)d[1].trim()&&h.push(`${d[1].trim()}`);h.length>0&&s.push(`Values/parameters: ${h.join(", ")}`);const p=/<block type="([^"]+)"/gi,f=new Set;let b;for(;(b=p.exec(r))!==null;)f.add(b[1]);const v=[];for(const $ of f)($.includes("on_ext")||$.includes("on_source"))&&v.push("subscribes to state changes (trigger)"),($.includes("set")||$.includes("update"))&&v.push("sets state values"),$.includes("get")&&v.push("reads state values"),($.includes("cron")||$.includes("schedule"))&&v.push("uses time schedule/cron"),($.includes("telegram")||$.includes("sendto"))&&v.push("sends messages (sendTo)"),($.includes("timeout")||$.includes("delay"))&&v.push("uses delays/timeouts"),($.includes("log")||$.includes("debug"))&&v.push("logging"),($.includes("if")||$.includes("logic")||$.includes("controls_if"))&&v.push("conditional logic (if/else)");v.length>0&&s.push(`Actions: ${[...new Set(v)].join(", ")}`);const _=/<comment[^>]*>([^<]+)<\/comment>/gi,y=[];let w;for(;(w=_.exec(r))!==null;)w[1].trim()&&y.push(w[1].trim());return y.length>0&&s.push(`Comments: ${y.join("; ")}`),s.length>0?s.join(`
|
|
272
|
+
`):"No details could be extracted from the Blockly XML."}function bre(r,s=!1){if(r.length===0)return"No scripts found.";const i=[`All scripts in this ioBroker installation:
|
|
273
|
+
`];let a=0,l=!1;for(const c of r){const h=c.enabled?"active":"inactive",d=c.engineType==="Blockly"||c.engineType==="Rules",p=c.engineType.includes("TypeScript"),f=d?"Blockly":p?"TS":"JS",v=`### ${c.id.replace(/^script\.js\./,"").replace(/\./g,"/")} [${f}, ${h}] (${c.id})`;let _;if(d){const y=yO(c.source);if(y)_=`${v}
|
|
274
|
+
This is a Blockly script. Compiled JavaScript:
|
|
275
|
+
\`\`\`javascript
|
|
276
|
+
${y}
|
|
277
|
+
\`\`\`
|
|
278
|
+
`;else{const w=vO(c.source);_=`${v}
|
|
279
|
+
This is a Blockly (visual programming) script. Extracted information:
|
|
280
|
+
${w}
|
|
281
|
+
`}}else{const w=`\`\`\`${p?"typescript":"javascript"}
|
|
282
|
+
${c.source}
|
|
283
|
+
\`\`\``;_=`${v}
|
|
284
|
+
${w}
|
|
285
|
+
`}!s&&a+_.length>bO?(l=!0,i.push(`${v}
|
|
286
|
+
(source too large to include)
|
|
287
|
+
`)):(i.push(_),a+=_.length)}return l&&i.push(`
|
|
288
|
+
Note: Some script sources were omitted due to size. The user can ask about specific scripts by name.`),i.join(`
|
|
289
|
+
`)}const zg=[dO,hO,pO,gO],_O=pe.lazy(()=>Ki(()=>Promise.resolve().then(()=>ZO),void 0,import.meta.url)),wO=pe.lazy(()=>Ki(()=>import("./index-BI3JsAz_.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)),kO=pe.lazy(()=>Ki(()=>import("./index-DAkyON1r.js"),__vite__mapDeps([14,1,2,3,4,6,7,5,15,9,8,10,11,12]),import.meta.url)),CO=pe.lazy(()=>Ki(()=>import("./ScriptEditorVanillaMonaco-cB_90T0P.js"),__vite__mapDeps([15,9,1,2,3,4,6,7,5]),import.meta.url)),SO=pe.lazy(()=>Ki(()=>import("./ScriptEditor-CH4qJzqq.js"),__vite__mapDeps([16,1,2,3,4,6,5,15,9,7,17]),import.meta.url)),Fw=pe.lazy(()=>Ki(()=>import("./AiChatPanel-sgt697A2.js"),__vite__mapDeps([18,1,2,3,4,6,5,9,19,7,8,10,11,12]),import.meta.url)),TO=pe.lazy(()=>Ki(()=>import("./AiDiffView-RPozjjHf.js"),__vite__mapDeps([20,1,2,3,4,6,5,7]),import.meta.url)),zw={Blockly:Kk,"Javascript/js":Jc,Rules:Jk,def:Jc,"TypeScript/ts":Yk},IO=48,Uw="#02a102",Ug="#70aae9",EO=ok[400],xO=ik[400],Me={toolbar:r=>({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:r.palette.mode==="dark"?"#1e1e1e":"#E2E2E2"}),toolbarButtons:{padding:4,marginLeft:4},toolbarButtonsDisabled:{filter:"grayscale(100%)",opacity:.5},editorDiv:r=>({height:`calc(100% - ${(parseInt(r.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:r=>({color:r.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}};class Hn extends pe.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;blocklyEditorRef=pe.createRef();scriptEditorRef=pe.createRef();lastKnownTs={};constructor(s){var c,h;super(s);let i=window.localStorage.getItem("Editor.selected")||"";const a=window.localStorage.getItem("Editor.editing")||"[]";let l;try{l=JSON.parse(a)}catch{l=[]}i&&!l.includes(i)&&l.push(i),i&&!this.props.password&&((h=(c=this.props.objects[i])==null?void 0:c.native)!=null&&h.protected)&&(i=l.find(d=>{var p,f;return!((f=(p=this.props.objects[d])==null?void 0:p.native)!=null&&f.protected)})||""),!i&&l.length&&(this.props.password?i=l[0]:i=l.find(d=>{var p,f;return!((f=(p=this.props.objects[d])==null?void 0:p.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,menuOidDisplayAnchorEl:null,oidDisplayMode:parseInt(window.localStorage.getItem("Blockly.FieldOID.displayMode")||"0",10)||0,oidShowIcon:window.localStorage.getItem("Blockly.FieldOID.showIcon")==="true",menuOpened:!!this.props.menuOpened,menuTabsOpened:!1,aiChatOpen:window.localStorage.getItem("Editor.aiChatOpen")==="true",aiDiffView:null,aiCompletionsEnabled:window.localStorage.getItem("Editor.aiCompletions")!=="false",triggerPrettier:1,scriptConflict:"",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:Ps.selectTriggers,verboseEnabled:!1,visible:s.visible},this.setChangedInAdmin(),window.systemLang=x.I18n.getLanguage(),window.main={objects:{},getObject:(d,p)=>this.props.socket.getObject(d).then(f=>p==null?void 0:p(null,f)).catch(f=>p==null?void 0:p(f)),instances:[],selectIdDialog:(d,p,f)=>{typeof p=="function"&&(f=p,p=null),this.selectId.callback=f,this.selectId.initValue=d,this.selectId.type=p,this.setState({showSelectId:!0})},cronDialog:(d,p)=>{this.cron.callback=p,this.cron.initValue=d,this.setState({showCron:!0})},showScriptDialog:(d,p,f,b)=>{this.scriptDialog.callback=b,this.scriptDialog.initValue=d,this.scriptDialog.args=p,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={},a=s.map(l=>(i[l._id]=l,l._id));window.main.objects=i,window.main.instances=a,this.setState({instancesLoaded:!0})}static onInstanceChanged(s,i){if(s)if(!i&&window.main.instances.includes(s)){delete window.main.objects[s];const a=window.main.instances.indexOf(s);window.main.instances.splice(a,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.*",Hn.onInstanceChanged)}componentWillUnmount(){window.removeEventListener("beforeunload",this.onBrowserClose),this.props.socket.unsubscribeObject("system.adapter.*",Hn.onInstanceChanged)}componentDidUpdate(s){if(s.scriptsHash!==this.props.scriptsHash)for(const i of this.state.editing){const a=this.props.objects[i];if(!a||a.type!=="script")continue;const l=a.ts||0,c=this.lastKnownTs[i];c!==void 0&&l!==c&&(this.state.changed[i]?this.state.scriptConflict||this.setState({scriptConflict:i}):(this.scripts[i]=this.getScriptFromObject(i),this.lastKnownTs[i]=l))}}onBrowserClose=s=>{const i=Object.keys(this.scripts).find(a=>JSON.stringify(this.scripts[a])!==JSON.stringify(this.getScriptFromObject(a)));if(i){console.log(`Script ${JSON.stringify(this.scripts[i])}`);const a=x.I18n.t("Configuration not saved.");return s=s||window.event,s&&(s.returnValue=a),a}};removeNonExistingScripts(s,i){s=s||this.props,i=i||{};let a=!1;if(this.state.editing&&this.state.editing.find(c=>s&&!s.objects[c])){const c=[...this.state.editing];for(let h=c.length-1;h>=0;h--)this.objects[c[h]]||(a=!0,c.splice(h,1));a&&(i.editing=c),this.state.selected&&!this.objects[this.state.selected]&&(a=!0,i.selected=c[0]||"",i.selected&&this.scripts[i.selected]&&(this.state.blockly!==(this.scripts[i.selected].engineType==="Blockly")&&(i.blockly=this.scripts[i.selected].engineType==="Blockly",a=!0),this.state.rules!==(this.scripts[i.selected].engineType==="Rules")&&(i.rules=this.scripts[i.selected].engineType==="Rules",a=!0),this.state.verboseEnabled!==this.scripts[i.selected].verbose&&(i.verboseEnabled=this.scripts[i.selected].verbose,a=!0),this.state.debugEnabled!==this.scripts[i.selected].debug&&(i.debugEnabled=this.scripts[i.selected].debug,a=!0)))}return a}UNSAFE_componentWillReceiveProps(s){var l,c,h;const i={};let a=!1;if(JSON.stringify(s.runningInstances)!==JSON.stringify(this.state.runningInstances)&&(a=!0,i.runningInstances=s.runningInstances),this.state.menuOpened!==s.menuOpened&&(i.menuOpened=s.menuOpened,a=!0),this.state.themeType!==s.themeType&&(i.themeType=s.themeType,a=!0),this.removeNonExistingScripts(s,i)&&(a=!0),this.state.searchText!==s.searchText&&(i.searchText=s.searchText,a=!0),this.objects!==s.objects){this.objects=s.objects,window.main.objects=s.objects,Object.keys(this.scripts).forEach(p=>{const f=this.scripts[p].source;this.scripts[p]=JSON.parse(JSON.stringify(this.objects[p].common)),this.scripts[p].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",a=!0),this.state.rules!==(this.scripts[this.state.selected].engineType==="Rules")&&(i.rules=this.scripts[this.state.selected].engineType==="Rules",a=!0),this.state.verboseEnabled!==this.scripts[this.state.selected].verbose&&(i.verboseEnabled=this.scripts[this.state.selected].verbose,a=!0),this.state.debugEnabled!==this.scripts[this.state.selected].debug&&(i.debugEnabled=this.scripts[this.state.selected].debug,a=!0));const d=[...this.state.editing];for(let p=d.length-1;p>=0;p--)this.objects[d[p]]||(a=!0,d.splice(p,1),this.state.changed[d[p]]!==void 0&&(i.changed||={...this.state.changed},i.changed&&delete i.changed[d[p]]));this.state.selected&&!this.objects[this.state.selected]&&(i.selected=d[0]||""),a&&(i.editing=d)}else for(const d in this.scripts)if(Object.prototype.hasOwnProperty.call(this.scripts,d)){if((l=this.objects[d])!=null&&l.common){if(this.objects[d].type==="script"){const p=this.scripts[d].source,f=JSON.parse(JSON.stringify(this.scripts[d]));f.source=this.objects[d].common.source,JSON.stringify(f)!==JSON.stringify(this.objects[d].common)&&(this.scripts[d]=JSON.parse(JSON.stringify(this.objects[d].common)),this.scripts[d].source=p),p!==this.objects[d].common.source?this.state.changed[d]?(h=this.objects[d].from)!=null&&h.startsWith("system.adapter.javascript.")&&(this.objects[d].from="system.adapter.admin.0",this.setState({toast:x.I18n.t("Script %s was modified on disk.",d.split(".").pop())})):this.props.password&&((c=this.objects[d].native)!=null&&c.protected)?this.scripts[d].source=$m(this.props.password,this.objects[d].common.source):this.scripts[d].source=this.objects[d].common.source:this.state.changed[d]&&(i.changed||={...this.state.changed},i.changed&&(i.changed[d]=!1),a=!0)}}else if(this.scripts[d]&&(delete this.scripts[d],this.state.selected===d)){if(this.state.editing.indexOf(d)!==-1){const p=[...this.state.editing],f=p.indexOf(d);f!==-1&&(p.splice(f,1),i.editing=p,a=!0)}i.selected=this.state.editing[0]||"",a=!0}}if(s.selected&&this.state.selected!==s.selected){const d=this.getScriptFromObject(s.selected);this.scripts[s.selected]||=d;const p=d&&JSON.stringify(this.scripts[s.selected])!==JSON.stringify(d),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))),a=!0,i.changed||={...this.state.changed},i.changed[s.selected]=!!p,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&&(a=!0,i.visible=s.visible),a&&this.setState(i,()=>this.setChangedInAdmin())}onRestart(){var s,i;(i=(s=this.props).onRestart)==null||i.call(s,this.state.selected)}onStartStop(){var i,a,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=Bc(this.props.password,s.source)),(l=(a=this.props).onChange)==null||l.call(a,this.state.selected,s)}onSave(){if(this.state.isTourOpen&&this.state.tourStep===Ps.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 a,l,c;this.setChangedInAdmin();const i=JSON.parse(JSON.stringify(this.scripts[this.state.selected]));this.props.password&&((a=this.props.objects[this.state.selected].native)!=null&&a.protected)&&(i.source=Bc(this.props.password,i.source)),(c=(l=this.props).onChange)==null||c.call(l,this.state.selected,i)})}}onSaveAll(){const s={...this.state.changed};Object.keys(s).forEach(i=>{var a,l,c;if(s[i]){s[i]=!1;const h=JSON.parse(JSON.stringify(this.scripts[i]));this.props.password&&((a=this.props.objects[i].native)!=null&&a.protected)&&(h.source=Bc(this.props.password,h.source)),(c=(l=this.props).onChange)==null||c.call(l,i,h)}}),this.setState({changed:s},()=>this.setChangedInAdmin())}onCancel(){var i;this.scripts[this.state.selected]=this.getScriptFromObject(this.state.selected),this.lastKnownTs[this.state.selected]=((i=this.props.objects[this.state.selected])==null?void 0:i.ts)||0;const s={...this.state.changed};s[this.state.selected]=!1,this.setState({changed:s},()=>this.setChangedInAdmin())}onRegisterSelect(s){this.getSelect=s}onConvertBlockly2JS(){this.showConfirmDialog(x.I18n.t("It will not be possible to revert this operation."),s=>{if(s){this.scripts[this.state.selected].engineType="Javascript/js";const a=this.scripts[this.state.selected].source.split(`
|
|
290
|
+
`);a.pop(),this.scripts[this.state.selected].source=a.join(`
|
|
291
|
+
`);const l=this.state.selected,c={...this.state.changed};c[this.state.selected]=!0,this.setState({changed:c,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 a={...this.state.changed};a[this.state.selected]=i,this.objects[this.state.selected].from="system.adapter.admin.0",this.setState({changed:a},()=>this.setChangedInAdmin())}}onTabChange(s){var a,l;if(this.props.debugMode)return;window.localStorage.setItem("Editor.selected",s);const i=this.scripts[s]||this.getScriptFromObject(s);this.scripts[s]||(this.scripts[s]=i),this.lastKnownTs[s]===void 0&&this.props.objects[s]&&(this.lastKnownTs[s]=this.props.objects[s].ts||0),this.setState({selected:s,rules:i.engineType==="Rules",blockly:i.engineType==="Blockly",showCompiledCode:!1,verboseEnabled:i.verbose,debugEnabled:i.debug}),(l=(a=this.props).onSelectedChange)==null||l.call(a,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 a=this.state.editing.indexOf(s);if(this.state.editing.includes(s))if(this.isScriptChanged(s))this.showConfirmDialog(x.I18n.t("Discard changes for %s",this.props.objects[s].common.name),l=>{l&&(delete this.scripts[s],delete this.lastKnownTs[s],this.onTabClose(s))});else{const l=[...this.state.editing];l.splice(a,1);const c={editing:l};if(s===this.state.selected?l.length?a===0||l.length===1?c.selected=l[0]:c.selected=l[a-1]:c.selected="":this.state.selected&&!l.length&&(c.selected=""),window.localStorage.setItem("Editor.editing",JSON.stringify(l)),c.selected!==void 0){c.changed||={...this.state.changed},c.changed[c.selected]=this.isScriptChanged(c.selected);const h=c.selected?this.scripts[c.selected]||this.getScriptFromObject(c.selected):void 0;c.blockly=(h==null?void 0:h.engineType)==="Blockly",c.rules=(h==null?void 0:h.engineType)==="Rules",c.verboseEnabled=!!(h!=null&&h.verbose),c.debugEnabled=!!(h!=null&&h.debug),c.showCompiledCode=!1}this.setState(c,()=>{var h,d,p,f;this.setChangedInAdmin(),c.selected!==void 0?((d=(h=this.props).onSelectedChange)==null||d.call(h,c.selected,this.state.editing),window.localStorage.setItem("Editor.selected",c.selected)):(f=(p=this.props).onSelectedChange)==null||f.call(p,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[x.I18n.getLanguage()]||s.en:s}getScriptFullName(s){var c;const i=s.split(".");i.shift(),i.shift();const a=[];let l="script.js";for(let h=0;h<i.length;h++)l+=`.${i[h]}`,(c=this.props.objects[l])!=null&&c.common?a.push(Hn.getText(this.props.objects[l].common.name)):a.push(i[h]);return`/ ${a.join(" / ")}`}getTabs(){return this.state.editing.length?[g.jsxs(RT,{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 d,p;if(!this.props.objects[s]){const f=[g.jsx(bt,{sx:this.isScriptChanged(s)?Me.tabChanged:void 0,style:Me.tabText,children:s.split(".").pop()},"text"),g.jsx(We,{onClick:b=>this.onTabClose(s,b),style:Me.closeButton,size:"small",component:"span",children:g.jsx(wc,{})},"icon")];return g.jsx(mg,{wrapped:!0,href:`#${s}`,label:f,value:s,sx:{"& .MuiTab-wrapper":Me.tabButtonWrapper}},s)}if(!this.props.password&&((d=this.props.objects[s].native)!=null&&d.protected))return null;let i=Hn.getText(this.props.objects[s].common.name)||"";const a=this.getScriptFullName(s);i.length>18&&(i=`${i.substring(0,15)}...`);const l=(p=this.getScriptFromObject(s))==null?void 0:p.source,c=this.scripts[s]&&l!==this.scripts[s].source,h=[g.jsx(bt,{sx:this.isScriptChanged(s)?Me.tabChanged:void 0,style:Me.tabText,children:i},"text"),c?g.jsx("span",{style:Me.tabChangedIcon,children:"▣"},"changedSign"):null,!this.props.debugInstance&&(!this.props.debugMode||this.state.selected!==s)&&g.jsx(We,{onClick:f=>this.onTabClose(s,f),style:Me.closeButton,size:"small",component:"span",children:g.jsx(wc,{})},"icon")];return g.jsx(mg,{disabled:!!this.props.debugInstance||this.state.selected!==s&&this.props.debugMode,wrapped:!0,iconPosition:"start",icon:g.jsx("img",{alt:"",src:zw[this.props.objects[s].common.engineType]||zw.def,style:Me.tabIcon},"icon"),href:`#${s}`,label:h,style:Me.tabButton,value:s,title:a,sx:{"& .MuiTab-wrapper":Me.tabButtonWrapper}},s)}),this.props.debugInstance?g.jsx(mg,{disabled:!1,wrapped:!0,href:`#${this.props.debugInstance.adapter}`,label:this.props.debugInstance.adapter,style:Me.tabButton,value:this.props.debugInstance.adapter,title:this.props.debugInstance.adapter,sx:{"& .MuiTab-wrapper":Me.tabButtonWrapper}},this.props.debugInstance.adapter):""]},"tabs1"),this.state.editing.length>1?g.jsx(We,{href:"#","aria-label":"Close all but current",style:Me.tabMenuButton,title:x.I18n.t("Close all but current"),"aria-haspopup":"false",onClick:s=>{const i=[this.state.selected];Object.keys(this.scripts).forEach(a=>a!==this.state.selected&&JSON.stringify(this.scripts[a])!==JSON.stringify(this.getScriptFromObject(a))&&i.push(a)),window.localStorage.setItem("Editor.editing",JSON.stringify(i)),this.setState({menuTabsOpened:!1,editing:i})},size:"medium",children:g.jsx(iI,{})},"menuButton"):null]:g.jsx(bt,{sx:Me.toolbar,children:g.jsxs(je,{color:"grey",disabled:!0,style:Me.hintButton,href:"",children:[g.jsx("span",{children:x.I18n.t("Click on this icon")},"select2"),g.jsx(nI,{style:Me.hintIcon},"select3"),g.jsx("span",{children:x.I18n.t("for edit or create script")},"select4")]},"select1")},"tabs2")}getDebugMenu(){return this.state.showDebugMenu?g.jsxs(Gc,{id:"menu-debug",anchorEl:this.state.menuDebugAnchorEl,open:this.state.showDebugMenu,onClose:()=>this.setState({showDebugMenu:!1,menuDebugAnchorEl:null}),slotProps:{root:{style:{maxHeight:IO*7.5}}},children:[g.jsxs(et,{title:x.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(ua,{checked:this.state.debugEnabled}),g.jsx(kc,{style:{...Me.menuIcon,color:Uw}}),x.I18n.t("debug_label")]},"debugEnabled"),g.jsxs(et,{title:x.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(ua,{checked:this.state.verboseEnabled}),g.jsx(A_,{style:{...Me.menuIcon,color:Ug}}),x.I18n.t("verbose_label")]},"verboseEnabled")]},"menuDebug"):null}getDebugBadge(){return[this.state.debugEnabled&&this.state.verboseEnabled?g.jsx(kc,{style:{...Me.menuIcon,color:Ug}},"DebugVerbose"):null,this.state.debugEnabled&&!this.state.verboseEnabled?g.jsx(kc,{style:{...Me.menuIcon,color:Uw}},"DebugNoVerbose"):null,!this.state.debugEnabled&&this.state.verboseEnabled?g.jsx(A_,{style:{...Me.menuIcon,color:Ug}},"noDebugVerbose"):null]}getAskAboutDebug(){return this.state.askAboutDebug?g.jsx(x.DialogConfirm,{onClose:()=>{this.setState({askAboutDebug:!1},()=>this.props.onDebugModeChange(!0))},ok:x.I18n.t("Yes"),cancel:x.I18n.t("Cancel"),text:x.I18n.t("The script will be stopped and must be activated manually after debugging. Continue?")}):null}getToolbar(){var a,l;const s=!!(this.state.selected&&((a=this.scripts[this.state.selected])!=null&&a.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 c=Object.keys(this.state.changed).filter(d=>this.state.changed[d]).length,h=this.state.changed[this.state.selected];return g.jsxs(OT,{variant:"dense",sx:Me.toolbar,children:[!this.props.debugInstance&&this.state.menuOpened&&this.props.onLocate&&g.jsx(We,{style:Me.toolbarButtons,title:x.I18n.t("Locate file"),onClick:()=>this.props.onLocate(this.state.selected),size:"medium",children:g.jsx(rI,{})},"locate"),!this.props.debugInstance&&!h&&s?g.jsx(We,{disabled:this.props.debugMode,style:Me.toolbarButtons,onClick:()=>this.onRestart(),title:x.I18n.t("Restart"),size:"medium",children:g.jsx(aI,{})},"restart"):null,!this.props.debugInstance&&!h?g.jsx(We,{disabled:this.props.debugMode,onClick:()=>this.onStartStop(),title:i?x.I18n.t("Pause script"):x.I18n.t("Run script"),size:"medium",style:{...Me.toolbarButtons,color:i?EO:xO},children:i?g.jsx(lI,{}):g.jsx(cI,{})},"start-stop"):null,!this.props.debugInstance&&!h&&!i?g.jsx("span",{style:Me.notRunning,children:x.I18n.t("Script is not running")}):null,!h&&i&&!s?g.jsx("span",{style:Me.notRunning,children:x.I18n.t("Instance is disabled")}):null,h?g.jsx(je,{color:"grey",variant:"contained",style:{...Me.textButton,...Me.saveButton},className:"button-save",onClick:()=>this.onSave(),endIcon:g.jsx(R_,{}),children:x.I18n.t("Save")},"save"):null,c>1||c===1&&!h?g.jsx(je,{color:"grey",variant:"contained",style:Me.textButton,onClick:()=>this.onSaveAll(),endIcon:g.jsx(R_,{}),children:x.I18n.t("Save all")},"saveall"):null,h?g.jsx(je,{color:"grey",variant:"contained",style:Me.textButton,onClick:()=>this.onCancel(),endIcon:g.jsx($u,{}),children:x.I18n.t("Cancel")},"cancel"):null,!this.state.showCompiledCode&&!this.state.rules?g.jsx(We,{title:x.I18n.t("Undo"),style:Me.toolbarButtons,onClick:()=>{var d,p;if(this.state.blockly){const f=(d=this.blocklyEditorRef.current)==null?void 0:d.blocklyWorkspace;f==null||f.undo(!1)}else(p=this.scriptEditorRef.current)==null||p.undo()},size:"medium",children:g.jsx(uI,{})},"undo"):null,!this.state.showCompiledCode&&!this.state.rules?g.jsx(We,{title:x.I18n.t("Redo"),style:Me.toolbarButtons,onClick:()=>{var d,p;if(this.state.blockly){const f=(d=this.blocklyEditorRef.current)==null?void 0:d.blocklyWorkspace;f==null||f.undo(!0)}else(p=this.scriptEditorRef.current)==null||p.redo()},size:"medium",children:g.jsx(dI,{})},"redo"):null,g.jsx("div",{style:{flex:2}}),this.state.blockly&&!this.state.showCompiledCode&&g.jsx(We,{"aria-label":"OID display mode",title:x.I18n.t("OID display mode"),style:Me.toolbarButtons,onClick:d=>this.setState({menuOidDisplayAnchorEl:d.currentTarget}),size:"medium",children:g.jsx("img",{src:zg[this.state.oidDisplayMode]||zg[0],alt:"OID",width:36,height:22})},"oid-display-mode"),g.jsxs(Gc,{anchorEl:this.state.menuOidDisplayAnchorEl,open:!!this.state.menuOidDisplayAnchorEl,onClose:()=>this.setState({menuOidDisplayAnchorEl:null}),children:[zg.map((d,p)=>g.jsxs(et,{selected:this.state.oidDisplayMode===p,onClick:()=>{var b,v,_;this.setState({oidDisplayMode:p,menuOidDisplayAnchorEl:null});const f=(b=window.scripts)==null?void 0:b.blocklyWorkspace;f&&((_=(v=window.Blockly)==null?void 0:v.FieldOID)!=null&&_.setDisplayMode)&&window.Blockly.FieldOID.setDisplayMode(p,f)},children:[g.jsx("img",{src:d,alt:"",width:48,height:28,style:{marginRight:8}}),(()=>{var v,_,y,w,$,I,T,C,D;const f=(y=(_=(v=window.Blockly)==null?void 0:v.FieldOID)==null?void 0:_.DISPLAY_MODE_KEYS)==null?void 0:y[p],b=["Show name","Show name path","Show ID","Show full ID"];return f&&(((I=($=(w=window.Blockly)==null?void 0:w.Words)==null?void 0:$[f])==null?void 0:I[x.I18n.getLanguage()])||((D=(C=(T=window.Blockly)==null?void 0:T.Words)==null?void 0:C[f])==null?void 0:D.en))||b[p]})()]},`oid-mode-${p}`)),g.jsx(nm,{}),g.jsxs(et,{onClick:()=>{var f,b,v;const d=!this.state.oidShowIcon;this.setState({oidShowIcon:d});const p=(f=window.scripts)==null?void 0:f.blocklyWorkspace;p&&((v=(b=window.Blockly)==null?void 0:b.FieldOID)!=null&&v.setShowIcon)&&window.Blockly.FieldOID.setShowIcon(d,p)},children:[g.jsx(ua,{checked:this.state.oidShowIcon,style:{padding:0,marginRight:8}}),(()=>{var p,f,b,v,_,y;const d="oid_show_icon";return((b=(f=(p=window.Blockly)==null?void 0:p.Words)==null?void 0:f[d])==null?void 0:b[x.I18n.getLanguage()])||((y=(_=(v=window.Blockly)==null?void 0:v.Words)==null?void 0:_[d])==null?void 0:y.en)||"Show icon"})()]},"oid-show-icon")]},"menuOidDisplay"),!this.props.debugInstance&&!this.state.showCompiledCode&&g.jsx(We,{style:Me.toolbarButtons,title:x.I18n.t("Prettify the script"),onClick:()=>this.setState({triggerPrettier:this.state.triggerPrettier+1}),size:"medium",children:g.jsx(hI,{})},"prettier"),this.state.blockly&&!this.state.showCompiledCode?g.jsx(We,{"aria-label":"Export Blocks",title:x.I18n.t("Export blocks"),style:Me.toolbarButtons,onClick:()=>this.sendCommandToBlockly("export"),size:"medium",children:g.jsx(Vc,{})},"export"):null,this.state.blockly&&!this.state.showCompiledCode&&g.jsx(We,{"aria-label":"Import Blocks",title:x.I18n.t("Import blocks"),style:Me.toolbarButtons,onClick:()=>this.sendCommandToBlockly("import"),size:"medium",children:g.jsx(am,{})},"import"),this.state.blockly&&!this.state.showCompiledCode&&g.jsx(We,{"aria-label":"Check code",title:x.I18n.t("Check blocks"),style:Me.toolbarButtons,onClick:()=>this.sendCommandToBlockly("check"),size:"medium",children:g.jsx(pI,{})},"check"),!this.props.debugMode&&!this.state.blockly&&!this.state.rules&&!this.state.showCompiledCode?g.jsx(We,{"aria-label":"create CRON",title:x.I18n.t("Create or edit CRON or time wizard"),style:Me.toolbarButtons,onClick:()=>this.setState({showCron:!0}),size:"medium",children:g.jsx(gI,{})},"select-cron"):null,this.scripts[this.state.selected]&&this.scripts[this.state.selected].engineType!=="Rules"?g.jsx(g.Fragment,{children:g.jsx(We,{"aria-label":"AI",title:x.I18n.t("AI Chat"),style:{...Me.toolbarButtons,...this.state.aiChatOpen?{color:"#4caf50"}:{}},size:"medium",onClick:()=>{const d=!this.state.aiChatOpen;window.localStorage.setItem("Editor.aiChatOpen",String(d)),this.setState({aiChatOpen:d})},children:g.jsx(mI,{})},"ai")}):null,g.jsx(We,{"aria-label":"Show astronomical events",title:x.I18n.t("Show astronomical events"),style:Me.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(d=>this.setState({astroEvents:d}))},size:"medium",children:g.jsx(fI,{})},"show-astro"),!this.props.debugMode&&!this.state.blockly&&!this.state.rules&&!this.state.showCompiledCode&&g.jsx(We,{"aria-label":"select ID",title:x.I18n.t("Insert object ID"),style:Me.toolbarButtons,onClick:()=>this.setState({showSelectId:!0}),size:"medium",children:g.jsx($I,{})},"select-id"),this.state.blockly&&!this.state.rules&&this.state.showCompiledCode&&g.jsx(je,{color:"grey","aria-label":"convert to javascript",title:x.I18n.t("Convert blockly to javascript for ever."),onClick:()=>this.onConvertBlockly2JS(),children:"Blockly=>JS"},"convert2js"),this.state.rules&&!this.state.showCompiledCode&&g.jsx(We,{"aria-label":"Export Blocks",title:x.I18n.t("Export blocks"),style:Me.toolbarButtons,onClick:()=>this.sendCommandToRules("export"),size:"medium",children:g.jsx(Vc,{})},"export"),this.state.rules&&!this.state.showCompiledCode&&g.jsx(We,{"aria-label":"Import Blocks",title:x.I18n.t("Import blocks"),style:Me.toolbarButtons,onClick:()=>this.sendCommandToRules("import"),size:"medium",children:g.jsx(am,{})},"import"),this.props.expertMode&&!h&&(this.props.debugMode||!this.state.blockly&&!this.state.rules||(this.state.blockly||this.state.rules)&&this.state.showCompiledCode)&&g.jsx(We,{style:Me.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(kc,{style:{fontSize:32}})}),(this.state.blockly||this.state.rules)&&g.jsx(je,{"aria-label":"blockly",title:x.I18n.t("Show javascript code"),className:"button-js-code",color:this.state.showCompiledCode?"secondary":"inherit",disabled:this.props.debugMode,style:{...Me.toolbarButtons,...this.props.debugMode?Me.toolbarButtonsDisabled:void 0,padding:"0 5px"},onClick:()=>{this.props.debugMode||(this.setState({showCompiledCode:!this.state.showCompiledCode}),this.state.isTourOpen&&this.state.tourStep===Ps.showJavascript&&this.setState({tourStep:Ps.switchBackToRules}),this.state.isTourOpen&&this.state.tourStep===Ps.switchBackToRules&&this.setState({tourStep:Ps.saveTheScript}))},children:g.jsx("img",{alt:this.state.blockly?"blockly2js":"rules2js",src:this.state.blockly?cO:uO})},"blockly-code"),g.jsx(We,{disabled:this.props.debugMode,"aria-label":"Debug menu",title:x.I18n.t("Debug options"),style:Me.toolbarButtons,onClick:d=>this.setState({showDebugMenu:!0,menuDebugAnchorEl:d.currentTarget}),size:"medium",children:g.jsx(MT,{style:Me.badgeMargin,badgeContent:this.getDebugBadge(),children:g.jsx(bI,{})})},"debug")]},"toolbar1")}return null}cachedScriptInfos=null;lastObjectsHash="";getScriptInfos(){const s=Object.keys(this.props.objects).join(",");return this.cachedScriptInfos&&this.lastObjectsHash===s?this.cachedScriptInfos:(this.lastObjectsHash=s,this.cachedScriptInfos=fO(this.props.objects),this.cachedScriptInfos)}getScriptEditor(){var s,i;if(!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);const a=this.scripts[this.state.selected].engineType==="TypeScript/ts"?"typescript":"javascript",l=g.jsx(Zo,{fallback:g.jsx(Qo,{}),children:g.jsx(CO,{ref:this.scriptEditorRef,name:this.state.selected,adapterName:this.props.adapterName,insert:this.state.insert,onInserted:()=>this.setState({insert:""}),onForceSave:()=>this.onSave(),searchText:this.state.searchText,onRegisterSelect:c=>this.onRegisterSelect(c),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:c=>this.onChange({script:c}),language:a,aiCompletionsEnabled:this.state.aiCompletionsEnabled},"scriptEditor1")});if(this.state.aiDiffView)return g.jsx(bt,{sx:Me.editorDiv,children:g.jsx(Zo,{fallback:g.jsx(Qo,{}),children:g.jsx(TO,{originalCode:this.state.aiDiffView.original,modifiedCode:this.state.aiDiffView.modified,language:a,themeType:this.state.themeType,onAccept:c=>{this.onChange({script:c}),this.setState({aiDiffView:null})},onReject:()=>this.setState({aiDiffView:null})})})},"scriptEditorDiv");if(this.state.aiChatOpen){const c=window.localStorage.getItem("Editor.aiChatSizes");let h=[70,30];try{c&&(h=JSON.parse(c))}catch{}return g.jsx(bt,{sx:Me.editorDiv,children:g.jsxs(Yc,{direction:mt.Horizontal,initialSizes:h,minWidths:[200,250],gutterClassName:this.state.themeType==="dark"?"Dark visGutter":"Light visGutter",onResizeFinished:(d,p)=>{window.localStorage.setItem("Editor.aiChatSizes",JSON.stringify(p))},children:[l,g.jsx(Zo,{fallback:g.jsx(Qo,{}),children:g.jsx(Fw,{socket:this.props.socket,runningInstances:this.state.runningInstances,themeType:this.state.themeType,currentCode:((s=this.scripts[this.state.selected])==null?void 0:s.source)||"",currentLanguage:a,selectedCode:((i=this.getSelect)==null?void 0:i.call(this))||"",allScripts:this.getScriptInfos(),onInsertCode:d=>this.setState({insert:d}),onShowDiff:d=>{var p;return this.setState({aiDiffView:{original:((p=this.scripts[this.state.selected])==null?void 0:p.source)||"",modified:d}})},onClose:()=>{window.localStorage.setItem("Editor.aiChatOpen","false"),this.setState({aiChatOpen:!1})}})})]})},"scriptEditorDiv")}return g.jsx(bt,{sx:Me.editorDiv,children:l},"scriptEditorDiv")}return null}getBlocklyEditor(){if(!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);const s=g.jsx(Zo,{fallback:g.jsx(Qo,{}),children:g.jsx(_O,{ref:this.blocklyEditorRef,command:this.state.cmdToBlockly,themeType:this.state.themeType,searchText:this.state.searchText,code:this.scripts[this.state.selected].source||"",scriptId:this.state.selected,onChange:i=>this.onChange({script:i})},"BlocklyEditor")});if(this.state.aiChatOpen){const i=window.localStorage.getItem("Editor.aiBlocklyChatSizes");let a=[70,30];try{i&&(a=JSON.parse(i))}catch{}return g.jsx(bt,{sx:Me.editorDiv,children:g.jsxs(Yc,{direction:mt.Horizontal,initialSizes:a,minWidths:[200,250],gutterClassName:this.state.themeType==="dark"?"Dark visGutter":"Light visGutter",onResizeFinished:(l,c)=>{window.localStorage.setItem("Editor.aiBlocklyChatSizes",JSON.stringify(c))},children:[s,g.jsx(Zo,{fallback:g.jsx(Qo,{}),children:g.jsx(Fw,{socket:this.props.socket,runningInstances:this.state.runningInstances,themeType:this.state.themeType,currentCode:(()=>{const l=this.blocklyEditorRef.current;let c="",h="";try{c=(l==null?void 0:l.blocklyCode2JSCode(!0))||""}catch{}try{h=(l==null?void 0:l.getWorkspaceXml())||""}catch{}return`${c}
|
|
292
|
+
%%BLOCKLY_XML%%
|
|
293
|
+
${h}`})(),currentLanguage:"blockly",allScripts:this.getScriptInfos(),onInsertCode:l=>{const c=this.blocklyEditorRef.current;c&&c.appendBlocksFromXml(l)},onApplyCode:l=>{const c=this.blocklyEditorRef.current;c&&c.applyAiBlocks(l)},onClose:()=>{window.localStorage.setItem("Editor.aiChatOpen","false"),this.setState({aiChatOpen:!1})}})})]})},"blocklyEditorDiv")}return g.jsx(bt,{sx:Me.editorDiv,children:s},"blocklyEditorDiv")}return 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 a=!!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(bt,{sx:Me.editorDiv,children:g.jsx(Zo,{fallback:g.jsx(Qo,{}),children:g.jsx(wO,{scriptId:this.state.selected,setTourStep:this.setTourStep,tourStep:this.state.tourStep,isTourOpen:this.state.isTourOpen,changed:this.state.changed[this.state.selected],running:a&&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:c=>this.onChange({script:c})},"flowEditor")})},"flowEditorDiv")}return null}getScriptConflictDialog(){var a,l;if(!this.state.scriptConflict)return null;const s=this.state.scriptConflict,i=((l=(a=this.props.objects[s])==null?void 0:a.common)==null?void 0:l.name)||s;return g.jsxs(zt,{open:!0,onClose:()=>this.setState({scriptConflict:""}),children:[g.jsx(ts,{children:x.I18n.t("Script was modified externally")}),g.jsx(Yt,{children:x.I18n.t('The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?',i)}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",onClick:()=>{var h;this.scripts[s]=this.getScriptFromObject(s),this.lastKnownTs[s]=((h=this.props.objects[s])==null?void 0:h.ts)||0;const c={...this.state.changed};c[s]=!1,this.setState({scriptConflict:"",changed:c},()=>this.setChangedInAdmin())},color:"primary",autoFocus:!0,children:x.I18n.t("Reload")}),g.jsx(je,{variant:"contained",onClick:()=>{var c;this.lastKnownTs[s]=((c=this.props.objects[s])==null?void 0:c.ts)||0,this.setState({scriptConflict:""})},color:"secondary",children:x.I18n.t("Keep my changes")})]})]},"dialogScriptConflict")}getConfirmDialog(){return this.state.confirm?g.jsx(x.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"],a=["adapter","instance","enum","host","config","script","user","group"];let l=this.selectId.callback?this.selectId.initValue||"":this.getSelect&&this.getSelect()||"",c=l.indexOf("/*");c!==-1&&(l=l.substring(0,c)),c=l.indexOf("//"),c!==-1&&(l=l.substring(0,c));let h=l.match(/"([^"]+)"/);return h&&(l=h[1]),h=l.match(/'([^']+)'/),h&&(l=h[1]),g.jsx(x.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"&&a.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:(d,p)=>{this.selectId.initValue=null,this.selectId.callback?(this.selectId.callback(d),this.selectId.callback=null):this.setState({insert:`'${d}'/*${p}*/`})}},"dialogSelectID1")}return null}getCronDialog(){return this.state.showCron?g.jsx(x.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(zt,{open:!0,onClose:()=>this.setState({showAstro:!1}),children:[g.jsx(ts,{children:x.I18n.t("Astronomical events today")}),g.jsx(Yt,{children:this.state.astroEvents?g.jsx(LT,{component:dk,children:g.jsxs(PT,{size:"small",children:[g.jsx(BT,{children:g.jsxs(D_,{children:[g.jsx(Mn,{children:x.I18n.t("Name")}),g.jsx(Mn,{children:x.I18n.t("Server time")}),g.jsx(Mn,{children:x.I18n.t("Description")})]})}),g.jsx(jT,{children:Object.keys(this.state.astroEvents).map(s=>{var i,a,l,c;return g.jsxs(D_,{children:[g.jsx(Mn,{component:"th",scope:"row",children:s.startsWith("next")?"":s}),g.jsx(FT,{title:`${x.I18n.t("Local time")}: ${(i=this.state.astroEvents)!=null&&i[s].isValidDate?new Date((a=this.state.astroEvents)==null?void 0:a[s].date).toLocaleTimeString():"n/a"}`,children:g.jsx(Mn,{align:"right",children:(l=this.state.astroEvents)!=null&&l[s].isValidDate?(c=this.state.astroEvents)==null?void 0:c[s].serverTime:"n/a"})}),g.jsx(Mn,{children:x.I18n.t(s)})]},s)})})]})}):g.jsx(NT,{})}),g.jsx(Ut,{children:g.jsx(je,{variant:"contained",onClick:()=>this.setState({showAstro:!1}),color:"primary",startIcon:g.jsx(wc,{}),children:x.I18n.t("Close")})})]},"dialogAstro"):null}getEditorDialog(){return this.state.showScript?g.jsx(Zo,{fallback:g.jsx(Qo,{}),children:g.jsx(SO,{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(zT,{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(We,{"aria-label":"close",color:"inherit",style:Me.closeToast,onClick:()=>this.setState({toast:""}),size:"medium",children:g.jsx(wc,{})},"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($f,{steps:mO,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(Zo,{fallback:g.jsx(Qo,{}),children:g.jsx(kO,{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 a,l;if(!((a=this.props.objects[s])!=null&&a.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=$m(this.props.password,i.source)),i}render(){var s,i,a;return this.state.selected&&this.props.objects[this.state.selected]&&this.state.blockly===null&&this.state.rules===null&&(this.scripts[this.state.selected]||(this.scripts[this.state.selected]=this.getScriptFromObject(this.state.selected),this.lastKnownTs[this.state.selected]=((s=this.props.objects[this.state.selected])==null?void 0:s.ts)||0),setTimeout(()=>{const l={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,l),this.setState(l)},100)),this.state.selected&&!this.props.password&&((a=(i=this.props.objects[this.state.selected])==null?void 0:i.native)!=null&&a.protected)&&setTimeout(()=>{const l=this.state.editing.find(c=>{var h,d;return!((d=(h=this.props.objects[c])==null?void 0:h.native)!=null&&d.protected)})||"";Object.keys(this.scripts).forEach(c=>{var h,d;(d=(h=this.props.objects[c])==null?void 0:h.native)!=null&&d.protected&&delete this.scripts[c]}),this.setState({selected:l},()=>{var c,h;(h=(c=this.props).onSelectedChange)==null||h.call(c,l,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 l=this.state.editing[0];this.setState({selected:l},()=>{var c,h;(h=(c=this.props).onSelectedChange)==null||h.call(c,l,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.getScriptConflictDialog(),this.getSelectIdDialog(),this.getCronDialog(),this.getEditorDialog(),this.getAstroDialog(),this.getDebugMenu(),this.getToast(),this.getTour()]}}const Qt={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 bf extends pe.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 a=new FileReader;a.onload=()=>{i(null,{data:a.result,name:s.name})},a.onabort=()=>{console.error("file reading was aborted"),i(x.I18n.t("file reading was aborted"))},a.onerror=l=>{console.error("file reading has failed"),i(x.I18n.t("file reading has failed: %s",l))},a.readAsDataURL(s)}handleDropFile(s){if(!(s!=null&&s.length))return;const i=s[s.length-1];i&&bf.readFileDataUrl(i,(a,l)=>{var c;a||!l?this.setState({error:a||"No data"}):this.props.onClose(((c=l.data)==null?void 0:c.toString())||"",l.name)})}render(){const s={...Qt.dropzone,...this.state.imageStatus==="accepted"?Qt.dropzoneAccepted:this.state.imageStatus==="rejected"?Qt.dropzoneRejected:void 0};return g.jsxs(zt,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":Qt.dialog},fullWidth:!0,open:!0,"aria-labelledby":"import-dialog-title",PaperProps:{style:{minHeight:"90%",maxHeight:"90%"}},children:[g.jsx(ts,{id:"import-dialog-title",children:x.I18n.t("Import scripts")}),g.jsxs(Yt,{children:[g.jsx(mk,{maxSize:5e7,onDrop:(i,a)=>{var l,c,h;i.length?this.handleDropFile(i):window.alert(((h=(c=(l=a==null?void 0:a[0])==null?void 0:l.errors)==null?void 0:c[0])==null?void 0:h.message)||x.I18n.t("ra_Cannot upload"))},multiple:!1,accept:{"application/zip":[],"application/x-zip-compressed":[]},children:({getRootProps:i,getInputProps:a,isDragActive:l,isDragReject:c})=>c?(this.state.imageStatus!=="rejected"&&this.setState({imageStatus:"rejected"}),g.jsxs("div",{style:{...s,...Qt.dropzoneDiv},...i(),children:[g.jsx("input",{...a()}),g.jsx("span",{style:Qt.text,children:x.I18n.t("Some files will be rejected")},"text"),g.jsx($u,{style:{...Qt.icon,...Qt.iconError}},"icon")]})):l?(this.state.imageStatus!=="accepted"&&this.setState({imageStatus:"accepted"}),g.jsxs("div",{style:{...s,...Qt.dropzoneDiv},...i(),children:[g.jsx("input",{...a()}),g.jsx("span",{style:Qt.text,children:x.I18n.t("All files will be accepted")},"text"),g.jsx(fk,{style:{...Qt.icon,...Qt.iconOk}},"icon")]})):(this.state.imageStatus!=="wait"&&this.setState({imageStatus:"wait"}),g.jsxs("div",{style:{...s,...Qt.dropzoneDiv},...i(),children:[g.jsx("input",{...a()}),g.jsx("span",{style:Qt.text,children:x.I18n.t("Drop some files here or click...")},"text"),g.jsx($k,{style:Qt.icon},"icon")]}))},"image-drop"),this.state.error?g.jsx(Su,{text:this.state.error,onClose:()=>this.setState({error:""})}):null]}),g.jsx(Ut,{children:g.jsx(je,{color:"grey",variant:"contained",onClick:()=>this.handleCancel(),startIcon:g.jsx(ao,{}),children:x.I18n.t("Close")})})]})}}var yf={exports:{}},DO=yf.exports;(function(r,s){(function(i,a){r.exports=a()})(DO,function(){var i={},a,l,c,h,d,p,f,b,v,_,y,w,$,I,T,C,D,R,N,U,j,B,J,ae,ye,M,W,k,X,ge,ce,oe,le,Q,F,P,me,ne,ie,ke,Ne,Ae,xe,Pe,qe,ct,ft,S,te,Y,O,A,H,K,ue,G,$e,we,be,Re,Ge,Fe,Ht,ee,Ie,Us,Be,ai,Ze,Nt,li,co,uo,sr,Mo,Hs,ho,or,wf,Ru,Ws,No,Ou,Mu,Na,Nu,ir,La,Lu,Pu,kf,Cf,Sf,Ji,Tf,Pa,If,nr,Ba,Ef,ja,xf,Fa,Bu,ju,za,Ua,Ha,rr,Df,qi,ar,Wa,Af,Rf,Of,Lo,Ot,lr,Fu,Is,po,Mf,zu,Ga,Uu,Nf,Hu,cr,Lf,Va,Pf,Bf,Ka,jf,Xi,Ff,Wu,Ya,Gu,Vu,zf,Ja,Zi,qa,Uf,Ku,Yu,Hf,Wf,ci,Gf,ur,as,Vf,Kf,Yf,Jf,qf,Xf,Zf,Ju,go,Qi,qu,Qf,e$,t$,s$,o$,i$,n$,r$,a$,Xu,l$,en,Xa,c$,tn,Zu,Qu,ed,dr,Za,td,u$,sd,od,id,nd,rd,ad,ld,d$,hr,cd,Qa,el,Gs,ud,dd,pr,hd,pd,h$,tl,gd,p$,g$,m$,f$,$$,sn,md,fd,on,sl,b$,y$,$d,bd,mo,yd,vd,v$,_$,w$,k$,_d,C$,wd,S$,ui,gr,ol,il,di,kd,nl,Cd,_t,T$,nn,hi,I$,Sd,rl,rn,Td,pi,mr,Id,Ed,E$,x$,D$,xd,A$,Dd,fr,R$,O$,M$,N$,$r,Ad,Rd,al,ll,L$,br,Od,yr,P$,B$,Po,Md,Vs,j$,F$,Nd,z$,gi,Ld,U$,H$,W$,G$,V$,Pd,K$,Y$,cl,J$,q$,Bd,ul,jd,dl,Fd,zd,an,mi,fo,Ks,X$,Z$,Q$,Ud,hl,eb,tb,sb,Hd,pl,Wd,gl,ob,ib,nb,rb,De,ss,xt,pt,Ys,ln,Te,wt,Gd,ab,Bo,ml,fl,Vd,lb,Kd,$l,Yd,Jd,cb,qd,ub,bl,db,hb,pb,gb,mb,Xd,fb,vr,_r,$b,Zd,Qd,eh,th,yl,sh,bb,yb,vb,cn,oh,_b,vl,ms,wb,jo,ih,kb,wr,nh,rh,ah,lh,ch,uh,dh,hh,ph,gh,Cb,Sb,Tb,Ib,Eb,xb,_l,Db,Ab,mh,fh,$h,bh,yh,vh,_h,wl,kr,wh,Rb,kh,Ch,Sh,Th,Ih,Eh,xh,Dh,Ah,Rh,Ob,Mb,Nb,Oh,Lb,Pb,Bb,jb,Fb,de;a=function(e,t,o,n){if(!(e instanceof he)&&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 u=t.toLowerCase();if(!o)throw Error("Can not register a null value");let m=Fo[e],E=kl[e];if(m||(m=Fo[e]=Object.create(null),E=kl[e]=Object.create(null)),l(e,o),!n&&m[u]&&m[u]!==o)throw Error('Name "'+u+'" with type "'+e+'" already registered.');m[u]=o,E[u]=t},l=function(e,t){switch(e){case String(he.FIELD):if(typeof t.fromJson!="function")throw Error('Type "'+e+'" must have a fromJson function')}},c=function(e,t){e=`${e}`.toLowerCase(),t=t.toLowerCase();const o=Fo[e];o&&o[t]?(delete Fo[e][t],delete kl[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},h=function(e,t,o){e=`${e}`.toLowerCase(),t=t.toLowerCase();const n=Fo[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]},d=function(e,t){return e=`${e}`.toLowerCase(),t=t.toLowerCase(),(e=Fo[e])?!!e[t]:!1},p=function(e,t,o){return h(e,t,o)},f=function(e,t,o){return h(e,t,o)},b=function(e,t,o){e=`${e}`.toLowerCase();var n=Fo[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=kl[e],o=Object.create(null);for(const u of Object.keys(n))o[e[u]]=n[u];return o},v=function(e,t,o){return t=t.plugins[String(e)]||Js,typeof t=="function"?t:p(e,t,o)},_=function(e,t,o,n){e=e+" was deprecated in "+t+" and will be deleted in "+o+".",n&&(e+=`
|
|
294
|
+
Use `+n+" instead."),Ub.has(e)||(Ub.add(e),console.warn(e))},y=function(){return"blockly-"+(xS++).toString(36)},w=function(){return Gb.genUid()},$=function(e){return e.type===q.BLOCK_CREATE},I=function(e){return e.type===q.BLOCK_DELETE},T=function(e){return e.type===q.BLOCK_CHANGE},C=function(e){return e.type===q.BLOCK_FIELD_INTERMEDIATE_CHANGE},D=function(e){return e.type===q.BLOCK_MOVE},R=function(e){return e.type===q.CLICK},N=function(e){return e.type===q.BUBBLE_OPEN},U=function(e){return e.type===q.VIEWPORT_CHANGE},i.setRecordUndo$$module$build$src$core$events$utils=function(e){Cr=e},j=function(){return Cr},B=function(e){Kb.fireInternal(e)},J=function(e){if(k()){if(!bo.length)try{requestAnimationFrame(()=>{setTimeout(ae,0)})}catch{setTimeout(ae,0)}ye(e)}},ae=function(){const e=M(bo,!0);bo.length=0;for(const t of e){if(!t.workspaceId)continue;let o;(o=Q(t.workspaceId))==null||o.fireChangeListener(t)}},ye=function(e){if(T(e)&&e.element==="mutation"){let t;for(t=bo.length;0<t;t--){const o=bo[t-1];if(o.group!==e.group||o.workspaceId!==e.workspaceId||!D(o)||o.newParentId!==e.blockId)break}bo.splice(t,0,e)}else bo.push(e)},M=function(e,t=!0){t||(_("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(D(n)&&D(e)&&n.blockId===e.blockId){if(e.newParentId=n.newParentId,e.newInputName=n.newInputName,e.newCoordinate=n.newCoordinate,e.reason||n.reason){let u,m;e.reason=Array.from(new Set(((u=e.reason)!=null?u:[]).concat((m=n.reason)!=null?m:[])))}}else T(n)&&T(e)&&n.blockId===e.blockId&&n.element===e.element&&n.name===e.name?e.newValue=n.newValue:U(n)&&U(e)?(e.viewTop=n.viewTop,e.viewLeft=n.viewLeft,e.scale=n.scale,e.oldScale=n.oldScale):R(n)&&N(e)||o.push(n);else o.push(n);return e=o.filter(n=>!n.isNull()),t||e.reverse(),e},W=function(){for(let e=0,t;t=bo[e];e++)t.recordUndo=!1},i.disable$$module$build$src$core$events$utils=function(){Nh++},i.enable$$module$build$src$core$events$utils=function(){Nh--},k=function(){return Nh===0},i.getGroup$$module$build$src$core$events$utils=function(){return Vb},i.setGroup$$module$build$src$core$events$utils=function(e){Kb.setGroupInternal(e)},X=function(e){Vb=typeof e=="boolean"?e?w():"":e},ge=function(e){const t=[];e=e.getDescendants(!1);for(let o=0,n;n=e[o];o++)t[o]=n.id;return t},ce=function(e,t){const o=oe(e.type);if(!o)throw Error("Unknown event type.");return o.fromJson(e,t)},oe=function(e){const t=p(he.EVENT,e);if(!t)throw Error(`Event type ${e} not found in registry.`);return t},le=function(e){if((D(e)||$(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=Cr;try{Cr=!1;const n=e.getParent();if(n&&!n.hasDisabledReason(Lh)){const u=e.getDescendants(!1);for(let m=0,E;E=u[m];m++)E.setDisabledReason(!1,Lh)}else if((e.outputConnection||e.previousConnection)&&!t.isDragging())do e.setDisabledReason(!0,Lh),e=e.getNextBlock();while(e)}finally{Cr=o}}}},Q=function(e){return Sr[e]||null},F=function(){const e=[];for(const t in Sr)e.push(Sr[t]);return e},P=function(e){Sr[e.id]=e},me=function(e){delete Sr[e.id]},ne=function(){return Yb},ie=function(e){Yb=e},ke=function(){return fi},i.setSelected$$module$build$src$core$common=function(e){if(fi!==e){var t,o,n,u,m,E,L=new(oe(q.SELECTED))((n=(t=fi)==null?void 0:t.id)!=null?n:null,(u=e==null?void 0:e.id)!=null?u:null,(E=(m=e==null?void 0:e.workspace.id)!=null?m:(o=fi)==null?void 0:o.workspace.id)!=null?E:"");B(L);var se;(se=fi)==null||se.unselect(),fi=e;var Ce;(Ce=fi)==null||Ce.select()}},Ne=function(){return Jb},Ae=function(e){Jb=e},xe=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 u=n.offsetWidth;n=n.offsetHeight,o.width!==u&&(t.setAttribute("width",u+"px"),e.setCachedParentSvgSize(u,null)),o.height!==n&&(t.setAttribute("height",n+"px"),e.setCachedParentSvgSize(null,n)),e.resize()}},Pe=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 u=0,m;m=n[u];u++)o[m.type]?o[m.type]++:o[m.type]=1;return o},qe=function(e){return function(){this.jsonInit(e)}},ct=function(e){qb.defineBlocksWithJsonArrayInternal(e)},ft=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 u=n.type;u?t[u]={init:qe(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 os&&console.warn(`Block definition "${t}" overwrites previous definition.`),os[t]=o}},S=function(e,t){te(),Sl=setTimeout(function(){t&&t.handleRightClick(e)},DS)},te=function(){Sl&&(clearTimeout(Sl),Sl=0)},Y=function(){Cl=null},O=function(e){return!e.type.startsWith("pointer")||e instanceof PointerEvent&&H(e)},A=function(e){return`${e.pointerId}`},H=function(e){const t=A(e);return Cl?Cl===t:e.type==="pointerdown"?(Cl=t,!0):!1},K=function(e,t,o,n,u){function m(L){(u||O(L))&&(o?n.call(o,L):n(L))}const E=[];if(t in $i)for(let L=0;L<$i[t].length;L++){const se=$i[t][L];e.addEventListener(se,m,!1),E.push([e,se,m])}else e.addEventListener(t,m,!1),E.push([e,t,m]);return E},ue=function(e,t,o,n){function u(E){o?n.call(o,E):n(E)}const m=[];if(t in $i)for(let E=0;E<$i[t].length;E++){const L=$i[t][E];e.addEventListener(L,u,!1),m.push([e,L,u])}else e.addEventListener(t,u,!1),m.push([e,t,u]);return m},G=function(e){const t=e[e.length-1][2];for(;e.length;){const[o,n,u]=e.pop();o.removeEventListener(n,u,!1)}return t},$e=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},we=function(e){return e.ctrlKey&&Uh?!0:e.button===2},be=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)},Re=function(e){switch(e.deltaMode){default:return{x:e.deltaX,y:e.deltaY};case 1:return{x:e.deltaX*ly,y:e.deltaY*ly};case 2:return{x:e.deltaX*cy,y:e.deltaY*cy}}},Ge=function(e,t){return t=e.indexOf(t),t===-1?!1:(e.splice(t,1),!0)},Fe=function(e){if(Hh)throw Error("CSS already injected");Wh+=`
|
|
295
|
+
`+e},Ht=function(e,t){Hh||(Hh=!0,e&&(e=t.replace(/[\\/]$/,""),t=Wh.replace(/<<<PATH>>>/g,e),Wh="",e=document.createElement("style"),e.id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},ee=function(e,t,o){e=document.createElementNS(Ir,`${e}`);for(const n in t)e.setAttribute(n,`${t[n]}`);return o&&o.appendChild(e),e},Ie=function(e,t){return t=t.split(" "),t.every(o=>e.classList.contains(o))?!1:(e.classList.add(...t),!0)},Us=function(e,t){e.classList.remove(...t.split(" "))},Be=function(e,t){return t=t.split(" "),t.every(o=>!e.classList.contains(o))?!1:(e.classList.remove(...t),!0)},ai=function(e,t){return e.classList.contains(t)},Ze=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},Nt=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)},li=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},co=function(){Vh++,xs||(xs=Object.create(null))},uo=function(){Vh--,Vh||(xs=null)},sr=function(e){const t=e.textContent+`
|
|
296
|
+
`+e.className.baseVal;let o;if(xs&&(o=xs[t]))return o;try{o=e.getComputedTextLength()}catch{return 8*e.textContent.length}return xs&&(xs[t]=o),o},Mo=function(e,t,o,n){return Hs(e,t+"pt",o,n)},Hs=function(e,t,o,n){const u=e.textContent;e=u+`
|
|
297
|
+
`+e.className.baseVal;var m;return xs&&(m=xs[e])||(xl||(m=document.createElement("canvas"),m.className="blocklyComputeCanvas",document.body.appendChild(m),xl=m.getContext("2d")),xl.font=o+" "+t+" "+n,m=u?xl.measureText(u).width:0,xs&&(xs[e]=m)),m},ho=function(e,t,o,n){const u=document.createElement("span");u.style.font=o+" "+t+" "+n,u.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(u),t.appendChild(e),document.body.appendChild(t),o={height:0,baseline:0};try{t.style.alignItems="baseline",o.baseline=e.offsetTop-u.offsetTop,t.style.alignItems="flex-end",o.height=e.offsetTop-u.offsetTop}finally{document.body.removeChild(t)}return o},or=function(e){return dy.getSizeInternal(e)},wf=function(e){if(Ws(e,"display")!=="none")return Ru(e);const t=e.style,o=t.display,n=t.visibility,u=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";const m=e.offsetWidth;return e=e.offsetHeight,t.display=o,t.position=u,t.visibility=n,new Xe(m,e)},Ru=function(e){return new Xe(e.offsetWidth,e.offsetHeight)},Ws=function(e,t){return e=window.getComputedStyle(e),e[t]||e.getPropertyValue(t)},No=function(e){const t=new fe(0,0);e=e.getBoundingClientRect();var o=document.documentElement;return o=new fe(window.pageXOffset||o.scrollLeft,window.pageYOffset||o.scrollTop),t.x=e.left+o.x,t.y=e.top+o.y,t},Ou=function(){const e=document.body,t=document.documentElement;return new fe(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},Mu=function(e){const t=parseFloat(Ws(e,"borderLeftWidth")),o=parseFloat(Ws(e,"borderRightWidth")),n=parseFloat(Ws(e,"borderTopWidth"));return e=parseFloat(Ws(e,"borderBottomWidth")),new rt(n,e,t,o)},Na=function(e,t,o){e=Nu(e,t,o),t.scrollLeft=e.x,t.scrollTop=e.y},Nu=function(e,t,o){var n=No(e),u=No(t),m=Mu(t);const E=n.x-u.x-m.left;return n=n.y-u.y-m.top,u=Ru(e),e=t.clientWidth-u.width,u=t.clientHeight-u.height,m=t.scrollLeft,t=t.scrollTop,o?(m+=E-e/2,t+=n-u/2):(m+=Math.min(E,Math.max(E-e,0)),t+=Math.min(n,Math.max(n-u,0))),new fe(m,t)},ir=function(e){const t=new fe(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(hy))&&(t.x+=Number(o[1]),o[3]&&(t.y+=Number(o[3]))),(e=e.getAttribute("style"))&&e.includes("translate")&&(e=e.match(py))&&(t.x+=Number(e[1]),e[3]&&(t.y+=Number(e[3]))),t},La=function(e){let t=0,o=0;for(;e;){const n=ir(e);if(t+=n.x,o+=n.y,(" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv "))break;e=e.parentNode}return new fe(t,o)},Lu=function(){const e=Ou();return new rt(e.y,document.documentElement.clientHeight+e.y,e.x,document.documentElement.clientWidth+e.x)},Pu=function(){const e=document.documentElement,t=window;return new fe(t.pageXOffset||e.scrollLeft,t.pageYOffset||e.scrollTop)},kf=function(e,t){var o=t.x;t=t.y;const n=e.getInjectionDiv().getBoundingClientRect();return o=new fe(o-n.left,t-n.top),t=e.getOriginOffsetInPixels(),fe.difference(o,t).scale(1/e.scale)},Cf=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 fe(t+n.left+e.x,o+n.top+e.y)},Sf=function(e){({document:Al=Al,DOMParser:Er=Er,XMLSerializer:xr=xr}=e),Dl=new Er,Kh=new xr},i.createElement$$module$build$src$core$utils$xml=function(e){return Al.createElementNS(gy,e)},i.createTextNode$$module$build$src$core$utils$xml=function(e){return Al.createTextNode(e)},i.textToDom$$module$build$src$core$utils$xml=function(e){let t=Dl.parseFromString(e,"text/xml");if(t&&t.documentElement&&!t.getElementsByTagName("parsererror").length)return t.documentElement;if((t=Dl.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}`)},Ji=function(e){return Tf(Kh.serializeToString(e))},Tf=function(e){return e.replace(MS,t=>`&#${t.charCodeAt(0)};`)},Pa=function(e){return e?((e instanceof Element||typeof e=="string")&&(e=ju(e),e=xf(e)),If(e),e):null},If=function(e){const t=e.kind;if(e=e.contents,t&&t!==my&&t!==Yh)throw Error("Invalid toolbox kind "+t+". Please supply either "+my+" or "+Yh);if(!e)throw Error("Toolbox must have a contents attribute.")},nr=function(e){return e?e.contents?e.contents:Array.isArray(e)&&0<e.length&&!e[0].nodeType?e:Fa(e):[]},Ba=function(e){return fy.hasCategoriesInternal(e)},Ef=function(e){if(!e)return!1;const t=e.kind;return t?t===Yh:!!e.contents.filter(o=>o.kind.toUpperCase()==="CATEGORY").length},ja=function(e){return e&&e.contents?!!e.contents.filter(function(t){return t.kind.toUpperCase()==="CATEGORY"}).length:!1},xf=function(e){const t={contents:Fa(e)};return e instanceof Node&&Bu(e,t),t},Fa=function(e){const t=[];let o=e.childNodes;o||(o=e);for(let n=0,u;u=o[n];n++){if(!u.tagName)continue;e={};const m=u.tagName.toUpperCase();e.kind=m,m==="BLOCK"?e.blockxml=u:u.childNodes&&0<u.childNodes.length&&(e.contents=Fa(u)),Bu(u,e),t.push(e)}return t},Bu=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}},ju=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},za=function(e,t,o,n,u,m){const E=m.scrollbar&&m.scrollbar.canScrollVertically();return e.horizontal===hn.LEFT?(o=u.absoluteMetrics.left+o,E&&m.RTL&&(o+=kt.scrollbarThickness)):(o=u.absoluteMetrics.left+u.viewMetrics.width-t.width-o,E&&!m.RTL&&(o-=kt.scrollbarThickness)),e.vertical===wo.TOP?e=u.absoluteMetrics.top+n:(e=u.absoluteMetrics.top+u.viewMetrics.height-t.height-n,m.scrollbar&&m.scrollbar.canScrollHorizontally()&&(e-=kt.scrollbarThickness)),new rt(e,e+t.height,o,o+t.width)},Ua=function(e,t){return{horizontal:t.toolboxMetrics.position===ze.LEFT||e.horizontalLayout&&!e.RTL?hn.RIGHT:hn.LEFT,vertical:t.toolboxMetrics.position===ze.BOTTOM?wo.TOP:wo.BOTTOM}},Ha=function(e,t,o,n){const u=e.left,m=e.right-e.left,E=e.bottom-e.top;for(let L=0;L<n.length;L++){const se=n[L];e.intersects(se)&&(e=o===Ho.UP?se.top-E-t:se.bottom+t,e=new rt(e,e+E,u,u+m),L=-1)}return e},rr=function(e,t){a(he.SERIALIZER,e,t)},Df=function(e){c(he.SERIALIZER,e)},qi=function(e,{addCoordinates:t=!1,saveIds:o=!0}={}){const n=e.workspace,u=Object.create(null);return u.height=e.getSize().height,u.width=e.getSize().width,o&&(u.id=e.id),t&&(t=e.getRelativeToSurfaceXY(),u.x=n.RTL?n.getWidth()-t.x:t.x,u.y=t.y),e.getText()&&(u.text=e.getText()),e.isCollapsed()&&(u.collapsed=!0),e.isOwnEditable()||(u.editable=!1),e.isOwnMovable()||(u.movable=!1),e.isOwnDeletable()||(u.deletable=!1),u},ar=function(e,t,{recordUndo:o=!1}={}){const n=j();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 m=o.getRelativeToSurfaceXY();let E,L=(E=e.x)!=null?E:m.x;L=t.RTL?t.getWidth()-L:L;var u;t=(u=e.y)!=null?u:m.y,o.moveTo(new fe(L,t))}if(e.width!==void 0||e.height){u=o.getSize();let m,E;o.setSize(new Xe((m=e.width)!=null?m:u.width,(E=e.height)!=null?E:u.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},Wa=function(e,t){a(he.PASTER,e,t)},Af=function(e){c(he.PASTER,e)},Rf=function(e){const t=e.workspace,o=e.getRelativeToSurfaceXY(),n=new fe(0,0),u=t.getTopComments(!1).filter(m=>m.id!==e.id).map(m=>m.getRelativeToSurfaceXY());for(;Of(fe.sum(o,n),u);)n.translate(t.RTL?-30:30,30);e.moveTo(fe.sum(o,n))},Of=function(e,t){return t.some(o=>1>=Math.abs(o.x-e.x)&&1>=Math.abs(o.y-e.y))},Lo=function(e,t){e.setAttribute(PS,t)},Ot=function(e,t,o){Array.isArray(o)&&(o=o.join(" ")),e.setAttribute(LS+t,`${o}`)},lr=function(e){return e.saveState!==void 0&&e.loadState!==void 0},Fu=function(e){return zu(e),Mf()?(Ga(),Promise.resolve()):(pn||(pn=new Promise(t=>{sp=t,ky=window.requestAnimationFrame(()=>{Ga(),t()})})),pn)},Is=function(){return pn||Promise.resolve()},po=function(e){e||window.cancelAnimationFrame(ky),Ga(e),!e&&sp&&sp()},Mf=function(){return iy},zu=function(e){ep.add(e),tp.set(e,i.getGroup$$module$build$src$core$events$utils());const t=e.getParent();t?zu(t):Nl.add(e)},Ga=function(e){const t=e?new Set([e]):new Set([...Nl].map(m=>m.workspace)),o=[...Nl].filter(Nf).filter(m=>t.has(m.workspace));for(var n of o)Hu(n);for(const m of t)m.resizeContents();for(var u of o)n=u.getRelativeToSurfaceXY(),u.updateComponentLocations(n);for(const m of o)u=i.getGroup$$module$build$src$core$events$utils(),(n=tp.get(m))&&i.setGroup$$module$build$src$core$events$utils(n),m.bumpNeighbours(),i.setGroup$$module$build$src$core$events$utils(u);for(const m of o)Uu(m);e||(pn=null)},Uu=function(e){Nl.delete(e),ep.delete(e),tp.delete(e);for(const t of e.getChildren(!1))Uu(t)},Nf=function(e){return!e.isDisposed()&&!e.getParent()},Hu=function(e){if(ep.has(e)&&e.initialized){for(const t of e.getChildren(!1))Hu(t);e.renderEfficiently()}},cr=function(e,t){Cy(e,t)},Lf=function(e){Cy=e},Va=function(e,t){Iy.confirmInternal(e,t)},Pf=function(e,t){Sy(e,t)},Bf=function(e){Sy=e},Ka=function(e,t,o){Ty(e,t,o)},jf=function(e){Ty=e},Xi=function(e){return e.getProcedureDef!==void 0},Ff=function(e){return e.getProcedureCall!==void 0&&e.renameProcedure!==void 0},Wu=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 u=0;u<n.length;u++){const m=n[u];m.getId()&&t.add(m)}}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,u;u=e[n];n++){var o=u.getDeveloperVariables;if(o){o=o();for(let m=0;m<o.length;m++)t.add(o[m])}}return Array.from(t.values())},Ya=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){Zi(n.getTargetWorkspace())}),t.push(o),e=Gu(e),t=t.concat(e)},Gu=function(e){e=e.getVariablesOfType("");const t=[];if(0<e.length){var o=e[e.length-1];if(os.variables_set){var n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","variables_set"),n.setAttribute("gap",os.math_change?"8":"24"),n.appendChild(ci(o)),t.push(n)}if(os.math_change&&(n=i.createElement$$module$build$src$core$utils$xml("block"),n.setAttribute("type","math_change"),n.setAttribute("gap",os.variables_get?"20":"8"),n.appendChild(ci(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)),os.variables_get){e.sort(Or.compareByName);for(let u=0,m;m=e[u];u++)o=i.createElement$$module$build$src$core$utils$xml("block"),o.setAttribute("type","variables_get"),o.setAttribute("gap","8"),o.appendChild(ci(m)),t.push(o)}}return t},Vu=function(e){return xy.generateUniqueNameInternal(e)},zf=function(e){return Ja(rp.charAt(0),e.getAllVariableNames())},Ja=function(e,t){if(!t.length)return e;const o=rp;let n="",u=o.indexOf(e);for(;;){let m=!1;for(let E=0;E<t.length;E++)if(t[E].toLowerCase()===e){m=!0;break}if(!m)break;u++,u===o.length&&(u=0,n=`${Number(n)+1}`),e=o.charAt(u)+n}return e},Zi=function(e,t,o){function n(m){qa(i.Msg$$module$build$src$core$msg.NEW_VARIABLE_TITLE,m,function(E){if(E){var L=Ku(E,e);if(L){if(L.type===u)var se=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS.replace("%1",L.name);else se=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,se=se.replace("%1",L.name).replace("%2",L.type);cr(se,function(){n(E)})}else e.createVariable(E,u),t&&t(E)}else t&&t(null)})}const u=o||"";n("")},i.renameVariable$$module$build$src$core$variables=function(e,t,o){function n(u){const m=i.Msg$$module$build$src$core$msg.RENAME_VARIABLE_TITLE.replace("%1",t.name);qa(m,u,function(E){if(E){var L=Uf(E,t.type,e),se=Yu(t.name,E,e);if(L||se){var Ce="";L?Ce=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",L.name).replace("%2",L.type):se&&(Ce=i.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER.replace("%1",E).replace("%2",se)),cr(Ce,function(){n(E)})}else e.renameVariableById(t.getId(),E),o&&o(E)}else o&&o(null)})}n("")},qa=function(e,t,o){Ka(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)})},Uf=function(e,t,o){o=o.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let n=0,u;u=o[n];n++)if(u.name.toLowerCase()===e&&u.type!==t)return u;return null},Ku=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},Yu=function(e,t,o){return o.getProcedureMap().getProcedures().length?Hf(e,t,o):Wf(e,t,o)},Hf=function(e,t,o){e=e.toLowerCase(),t=t.toLowerCase(),o=o.getProcedureMap().getProcedures();for(const u of o){var n=u.getParameters().filter(Wu).map(m=>m.getVariableModel().name);if(n&&(o=n.some(m=>m.toLowerCase()===e),n=n.some(m=>m.toLowerCase()===t),o&&n))return u.getName()}return null},Wf=function(e,t,o){e=e.toLowerCase(),t=t.toLowerCase(),o=o.getAllBlocks(!1);for(const u of o){if(!Xi(u))continue;o=u.getProcedureDef();var n=o[1];const m=n.some(E=>E.toLowerCase()===e);if(n=n.some(E=>E.toLowerCase()===t),m&&n)return o[0]}return null},ci=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 u=i.getVariable$$module$build$src$core$variables(e,t,o,n);return u||(u=Gf(e,t,o,n)),u},i.getVariable$$module$build$src$core$variables=function(e,t,o,n){const u=e.getPotentialVariableMap();let m=null;if(t&&(m=e.getVariableById(t),!m&&u&&(m=u.getVariableById(t)),m))return m;if(o){if(n===void 0)throw Error("Tried to look up a variable by name without a type");m=e.getVariable(o,n),!m&&u&&(m=u.getVariable(o,n))}return m},Gf=function(e,t,o,n){const u=e.getPotentialVariableMap();return o||(o=Vu(e.isFlyout?e.targetWorkspace:e)),u?u.createVariable(o,n,t):e.createVariable(o,n,t)},ur=function(e,t){e=e.getAllVariables();const o=[];if(t.length!==e.length)for(let n=0;n<e.length;n++){const u=e[n];t.includes(u)||o.push(u)}return o},as=function(e,{addCoordinates:t=!1,addInputBlocks:o=!0,addNextBlocks:n=!0,doFullSerialization:u=!0,saveIds:m=!0}={}){if(e.isInsertionMarker())return null;const E={type:e.type,id:m?e.id:void 0};return t&&Kf(e,E),Vf(e,E),Yf(e,E,u),Jf(e,E,u),qf(e,E,u),o&&Xf(e,E,u,m),n&&Zf(e,E,u,m),E},Vf=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)},Kf=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)},Yf=function(e,t,o){e.saveExtraState?(e=e.saveExtraState(o),e!==null&&(t.extraState=e)):e.mutationToDom&&(e=e.mutationToDom(),e!==null&&(t.extraState=Vs(e).replace(' xmlns="https://developers.google.com/blockly/xml"',"")))},Jf=function(e,t,o){const n=Object.create(null);for(const u of e.getIcons())lr(u)&&(e=u.saveState(o))&&(n[u.getType().toString()]=e);Object.keys(n).length&&(t.icons=n)},qf=function(e,t,o){const n=Object.create(null);for(let u=0;u<e.inputList.length;u++){const m=e.inputList[u];for(let E=0;E<m.fieldRow.length;E++){const L=m.fieldRow[E];L.isSerializable()&&(n[L.name]=L.saveState(o))}}Object.keys(n).length&&(t.fields=n)},Xf=function(e,t,o,n){const u=Object.create(null);for(let m=0;m<e.inputList.length;m++){const E=e.inputList[m];if(!E.connection)continue;const L=Ju(E.connection,o,n);L&&(u[E.name]=L)}Object.keys(u).length&&(t.inputs=u)},Zf=function(e,t,o,n){e.nextConnection&&(e=Ju(e.nextConnection,o,n))&&(t.next=e)},Ju=function(e,t,o){const n=e.getShadowState(!0);if(e=e.targetBlock(),!n&&!e)return null;const u=Object.create(null);return n&&(u.shadow=n),e&&!e.isShadow()&&(u.block=as(e,{doFullSerialization:t,saveIds:o})),u},go=function(e,t,{recordUndo:o=!1}={}){return e=Qi(e,t,{recordUndo:o}),t.rendered&&po(),e},Qi=function(e,t,{parentConnection:o,isShadow:n=!1,recordUndo:u=!1}={}){const m=j();i.setRecordUndo$$module$build$src$core$events$utils(u),(u=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 E=t.getAllVariables();let L;try{L=qu(e,t,{parentConnection:o,isShadow:n})}finally{i.enable$$module$build$src$core$events$utils()}if(Qf(t,E),k()&&B(new(oe(q.BLOCK_CREATE))(L)),i.setGroup$$module$build$src$core$events$utils(u),i.setRecordUndo$$module$build$src$core$events$utils(m),t.rendered){const se=L;setTimeout(()=>{se.disposed||se.setConnectionTracking(!0)},1)}return L},qu=function(e,t,{parentConnection:o,isShadow:n=!1}={}){if(!e.type)throw new Dy(e);const u=t.newBlock(e.type,e.id);return u.setShadow(n),e$(u,e),t$(u,e),s$(u,e),o$(o,u,e),i$(u,e),n$(u,e),r$(u,e),a$(u,e),l$(u,t.rendered),u},Qf=function(e,t){if(k())for(e=ur(e,t),t=0;t<e.length;t++){const o=e[t];B(new(oe(q.VAR_CREATE))(o))}},e$=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)},t$=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,qt),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)},s$=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)))},o$=function(e,t,o){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new Ry(o);if(e.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var n=t.outputConnection;if(!n)throw new Mr("output",t,o)}else if(n=t.previousConnection,!n)throw new Mr("previous",t,o);if(!e.connect(n)){const u=t.workspace.connectionChecker;throw new Ay(u.getErrorMessage(u.canConnectWithReason(n,e,!1),n,e),e.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,o)}}},i$=function(e,t){if(t.icons){var o=Object.keys(t.icons);for(const u of o){o=t.icons[u];var n=e.getIcon(u);if(!n){if(n=p(he.ICON,u,!1),!n)throw new Oy(u,e,t);n=new n(e),e.addIcon(n)}lr(n)&&n.loadState(o)}}},n$=function(e,t){if(t.fields){var o=Object.keys(t.fields);for(let n=0;n<o.length;n++){const u=o[n],m=t.fields[u],E=e.getField(u);E?E.loadState(m):console.warn(`Ignoring non-existant field ${u} in block ${e.type}`)}}},r$=function(e,t){if(t.inputs){var o=Object.keys(t.inputs);for(let n=0;n<o.length;n++){const u=o[n],m=e.getInput(u);if(!m||!m.connection)throw new Mr(u,e,t);Xu(m.connection,t.inputs[u])}}},a$=function(e,t){if(t.next){if(!e.nextConnection)throw new Mr("next",e,t);Xu(e.nextConnection,t.next)}},Xu=function(e,t){t.shadow&&e.setShadowState(t.shadow),t.block&&qu(t.block,e.getSourceBlock().workspace,{parentConnection:e})},l$=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()},en=function(e){return e.bubbleIsVisible!==void 0&&e.setBubbleVisible!==void 0},Xa=function(e){return e*Math.PI/180},c$=function(e){return 180*e/Math.PI},tn=function(e,t,o){if(o<e){const n=o;o=e,e=n}return Math.max(e,Math.min(t,o))},Zu=function(){document.querySelector(".blocklyDropDownDiv")||(tt=document.createElement("div"),tt.className="blocklyDropDownDiv",(Ne()||document.body).appendChild(tt),$n=document.createElement("div"),$n.className="blocklyDropDownContent",tt.appendChild($n),Ti=document.createElement("div"),Ti.className="blocklyDropDownArrow",tt.appendChild(Ti),tt.style.opacity="0",tt.style.transition="transform "+jl+"s, opacity "+jl+"s",tt.addEventListener("focusin",function(){Ie(tt,"blocklyFocused")}),tt.addEventListener("focusout",function(){Be(tt,"blocklyFocused")}))},Qu=function(e){cp=e},ed=function(){return Wo},dr=function(){return $n},Za=function(){$n.textContent="",$n.style.width=""},td=function(e,t){tt.style.backgroundColor=e,tt.style.borderColor=t},u$=function(e,t,o,n){return nd(od(t),e,o,n)},sd=function(e,t,o){return Py=!0,nd(id(e),e,t,o)},od=function(e){var t=e.getSvgRoot();const o=e.workspace.scale,n=e.height*o;return e=e.width*o,t=No(t),new rt(t.y,t.y+n,t.x,t.x+e)},id=function(e){return e=e.getScaledBBox(),new rt(e.top,e.bottom,e.left,e.right)},nd=function(e,t,o,n){const u=e.left+(e.right-e.left)/2,m=e.bottom;e=e.top,n&&(e+=n),n=t.getSourceBlock();let E=n.workspace;for(;E.options.parentWorkspace;)E=E.options.parentWorkspace;return Qu(E.getParentSvg().parentNode),rd(t,n.RTL,u,m,u,e,o)},rd=function(e,t,o,n,u,m,E){return Wo=e,Si=E||null,tt.style.direction=t?"rtl":"ltr",e=ne(),mn=e.getRenderer().getClassName(),fn=e.getTheme().getClassName(),mn&&Ie(tt,mn),fn&&Ie(tt,fn),ud(o,n,u,m)},ad=function(e,t,o,n){return e=hr(e,o.left,o.right,n.width),{initialX:e.divX,initialY:t,finalX:e.divX,finalY:t+ap,arrowX:e.arrowX,arrowY:-9,arrowAtTop:!0,arrowVisible:!0}},ld=function(e,t,o,n){return e=hr(e,o.left,o.right,n.width),{initialX:e.divX,initialY:t-n.height,finalX:e.divX,finalY:t-n.height-ap,arrowX:e.arrowX,arrowY:n.height-2*Ny-Bl/2,arrowAtTop:!1,arrowVisible:!0}},d$=function(e,t,o){return e=hr(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}},hr=function(e,t,o,n){return t=tn(t,e-n/2,o-n),e=e-Bl/2-t,o=Ly,e=tn(o,e,n-o-Bl),{arrowX:e,divX:t}},cd=function(){return!!Wo},Qa=function(e,t){return Wo===e?(t?Gs():el(),!0):!1},el=function(){tt.style.transform="translate(0, 0)",tt.style.opacity="0",lp=setTimeout(function(){Gs()},1e3*jl),Si&&(Si(),Si=null)},Gs=function(){cd()&&(lp&&clearTimeout(lp),tt.style.transform="",tt.style.left="",tt.style.top="",tt.style.opacity="0",tt.style.display="none",tt.style.backgroundColor="",tt.style.borderColor="",Si&&(Si(),Si=null),Za(),Wo=null,mn&&(Be(tt,mn),mn=""),fn&&(Be(tt,fn),fn=""),ne().markFocused())},ud=function(e,t,o,n){e=up.getPositionMetrics(e,t,o,n),e.arrowVisible?(Ti.style.display="",Ti.style.transform="translate("+e.arrowX+"px,"+e.arrowY+"px) rotate(45deg)",Ti.setAttribute("class",e.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):Ti.style.display="none",t=Math.floor(e.initialX),o=Math.floor(e.initialY),n=Math.floor(e.finalX);const u=Math.floor(e.finalY);return tt.style.left=t+"px",tt.style.top=o+"px",tt.style.display="block",tt.style.opacity="1",tt.style.transform="translate("+(n-t)+"px,"+(u-o)+"px)",!!e.arrowAtTop},dd=function(){if(Wo){var e=Wo.getSourceBlock();e=Py?id(Wo):od(e);const t=e.left+(e.right-e.left)/2;ud(t,e.bottom,t,e.top)}else el()},pr=function(e){return e.length?e.reduce(function(t,o){return t.length<o.length?t:o}).length:0},hd=function(e,t){if(!e.length)return 0;if(e.length===1)return e[0].length;let o=0;t=t||pr(e);let n;for(n=0;n<t;n++){for(var u=e[0][n],m=1;m<e.length;m++)if(u!==e[m][n])return o;u===" "&&(o=n+1)}for(u=1;u<e.length;u++)if((m=e[u][n])&&m!==" ")return o;return t},pd=function(e,t){if(!e.length)return 0;if(e.length===1)return e[0].length;let o=0;t=t||pr(e);let n;for(n=0;n<t;n++){for(var u=e[0].substr(-n-1,1),m=1;m<e.length;m++)if(u!==e[m].substr(-n-1,1))return o;u===" "&&(o=n+1)}for(u=1;u<e.length;u++)if((m=e[u].charAt(e[u].length-n-1))&&m!==" ")return o;return t},i.wrap$$module$build$src$core$utils$string=function(e,t){e=e.split(`
|
|
298
|
+
`);for(let o=0;o<e.length;o++)e[o]=h$(e[o],t);return e.join(`
|
|
299
|
+
`)},h$=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 u=-1/0;let m,E=1;do{n=u,m=e,e=[],u=o.length/E;let L=1;for(let se=0;se<o.length-1;se++)L<(se+1.5)/u?(L++,e[se]=!0):e[se]=!1;e=gd(o,e,t),u=tl(o,e,t),e=p$(o,e),E++}while(u>n);return m},tl=function(e,t,o){const n=[0],u=[];for(var m=0;m<e.length;m++)n[n.length-1]+=e[m].length,t[m]===!0?(n.push(0),u.push(e[m].charAt(e[m].length-1))):t[m]===!1&&n[n.length-1]++;for(e=Math.max(...n),t=0,m=0;m<n.length;m++)t-=2*Math.pow(Math.abs(o-n[m]),1.5),t-=Math.pow(e-n[m],1.5),".?!".includes(u[m])?t+=o/3:",;)]}".includes(u[m])&&(t+=o/4);return 1<n.length&&n[n.length-1]<=n[n.length-2]&&(t+=.5),t},gd=function(e,t,o){let n=tl(e,t,o),u;for(let m=0;m<t.length-1;m++){if(t[m]===t[m+1])continue;const E=[].concat(t);E[m]=!E[m],E[m+1]=!E[m+1];const L=tl(e,E,o);L>n&&(n=L,u=E)}return u?gd(e,u,o):t},p$=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]?`
|
|
300
|
+
`:" ");return o.join("")},i.isNumber$$module$build$src$core$utils$string=function(e){return/^\s*-?\d+(\.\d+)?\s*$/.test(e)},g$=function(e){Fl=e},m$=function(){return Fl},f$=function(){return Pr},$$=function(){return It},sn=function(e){if(e=md(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""},md=function(e){for(;e&&e.tooltip;){if(typeof e.tooltip=="string"||typeof e.tooltip=="function")return e;e=e.tooltip}return null},fd=function(){document.querySelector(".blocklyTooltipDiv")||(It=document.createElement("div"),It.className="blocklyTooltipDiv",(Ne()||document.body).appendChild(It))},on=function(e){e.mouseOverWrapper_=ue(e,"pointerover",null,b$),e.mouseOutWrapper_=ue(e,"pointerout",null,y$),e.addEventListener("pointermove",$d,!1)},sl=function(e){e&&(G(e.mouseOverWrapper_),G(e.mouseOutWrapper_),e.removeEventListener("pointermove",$d))},b$=function(e){yn||(e=md(e.currentTarget),fs!==e&&(mo(),Br=null,fs=e),clearTimeout(jy))},y$=function(e){yn||(jy=setTimeout(function(){Br=fs=null,mo()},1),clearTimeout(Ii),Ii=0)},$d=function(e){if(fs&&fs.tooltip&&!yn)if(Pr){const t=dp-e.pageX;e=hp-e.pageY,Math.sqrt(t*t+e*e)>Fy&&mo()}else Br!==fs&&(clearTimeout(Ii),dp=e.pageX,hp=e.pageY,Ii=setTimeout(k$,zy))},bd=function(){Br=fs=null,mo()},mo=function(){Pr&&(Pr=!1,It&&(It.style.display="none")),Ii&&(clearTimeout(Ii),Ii=0)},yd=function(){mo(),yn=!0},vd=function(){yn=!1},v$=function(){It&&fs&&(typeof Fl=="function"?Fl(It,fs):_$())},_$=function(){var e=sn(fs);e=i.wrap$$module$build$src$core$utils$string(e,By),e=e.split(`
|
|
301
|
+
`);for(let t=0;t<e.length;t++){const o=document.createElement("div");o.appendChild(document.createTextNode(e[t])),It.appendChild(o)}},w$=function(e){const t=document.documentElement.clientWidth,o=document.documentElement.clientHeight;let n=dp;n=e?n-(pp+It.offsetWidth):n+pp;let u=hp+gp;return u+It.offsetHeight>o+window.scrollY&&(u-=It.offsetHeight+2*gp),e?n=Math.max(zl-window.scrollX,n):n+It.offsetWidth>t+window.scrollX-2*zl&&(n=t-It.offsetWidth-2*zl),{x:n,y:u}},k$=function(){if(!yn&&(Br=fs,It)){It.textContent="",v$();var e=fs.RTL;It.style.direction=e?"rtl":"ltr",It.style.display="block",Pr=!0;var{x:t,y:o}=w$(e);It.style.left=t+"px",It.style.top=o+"px"}},_d=function(){return mp},C$=function(e){mp=e},wd=function(){return fp},S$=function(e){fp=e},ui=function(e){e=`${e}`.toLowerCase().trim();var t=Uy[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)?gr(e,t,o):null},gr=function(e,t,o){return t=e<<16|t<<8|o,16>e?"#"+(16777216|t).toString(16).substr(1):"#"+t.toString(16)},ol=function(e){return e=ui(e),e?(e=parseInt(e.substr(1),16),[e>>16,e>>8&255,e&255]):[0,0,0]},il=function(e,t,o){let n=0,u=0,m=0;if(t===0)m=u=n=o;else{const E=Math.floor(e/60),L=e/60-E;e=o*(1-t);const se=o*(1-t*L);switch(t=o*(1-t*(1-L)),E){case 1:n=se,u=o,m=e;break;case 2:n=e,u=o,m=t;break;case 3:n=e,u=se,m=o;break;case 4:n=t,u=e,m=o;break;case 5:n=o,u=e,m=se;break;case 6:case 0:n=o,u=t,m=e}}return gr(Math.floor(n),Math.floor(u),Math.floor(m))},di=function(e,t,o){return e=ui(e),!e||(t=ui(t),!t)?null:(e=ol(e),t=ol(t),gr(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]))))},kd=function(e){return il(e,mp,255*fp)},nl=function(e,t,o){const n=[];var u=e.split("");u.push("");var m=0;e=[];let E=null;for(let Ce=0;Ce<u.length;Ce++){var L=u[Ce];if(m===0)if(L==="%")(m=e.join(""))&&n.push(m),e.length=0,m=1;else if(o&&L===`
|
|
302
|
+
`){const dt=e.join("");dt&&n.push(dt),e.length=0,n.push(L)}else e.push(L);else if(m===1)L==="%"?(e.push(L),m=0):t&&"0"<=L&&"9">=L?(m=2,E=L,(L=e.join(""))&&n.push(L),e.length=0):L==="{"?m=3:(e.push("%",L),m=0);else if(m===2)if("0"<=L&&"9">=L)E+=L;else{var se=void 0;n.push(parseInt((se=E)!=null?se:"",10)),Ce--,m=0}else m===3&&(L===""?(e.splice(0,0,"%{"),Ce--,m=0):L!=="}"?e.push(L):(m=e.join(""),/[A-Z]\w*/i.test(m)?(L=m.toUpperCase(),(L=L.startsWith("BKY_")?L.substring(4):null)&&L in i.Msg$$module$build$src$core$msg?(m=i.Msg$$module$build$src$core$msg[L],typeof m=="string"?Array.prototype.push.apply(n,nl(m,t,o)):t?n.push(`${m}`):n.push(m)):n.push("%{"+m+"}")):n.push("%{"+m+"}"),m=e.length=0))}for((t=e.join(""))&&n.push(t),se=[],e.length=0,u=0;u<n.length;u++)typeof n[u]!="string"||o&&n[u]===`
|
|
303
|
+
`?((t=e.join(""))&&se.push(t),e.length=0,se.push(n[u])):e.push(n[u]);return(t=e.join(""))&&se.push(t),e.length=0,se},Cd=function(e){return nl(e,!0,!0)},_t=function(e){return typeof e!="string"?e:(e=nl(e,!1,!1),e.length?String(e[0]):"")},T$=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 u=0;u<n.length;u++){const m=n[u].toUpperCase();o[m.slice(6,-1)]===void 0&&(console.warn("No message string for "+n[u]+" in "+e),t=!1)}return t},nn=function(e){const t=typeof e=="string"?_t(e):e;var o=Number(t);if(!isNaN(o)&&0<=o&&360>=o)return{hue:o,hex:il(o,_d(),255*wd())};if(o=ui(t))return{hue:null,hex:o};throw o='Invalid colour: "'+t+'"',e!==t&&(o+=' (from "'+e+'")'),Error(o)},hi=function(){return As},I$=function(e){if(As=e,e===null){let t;(t=document.querySelector("."+Hl))==null||t.remove()}},Sd=function(){const e=Ne()||document.body;document.querySelector("."+Hl)?As=document.querySelector("."+Hl):(As=document.createElement("div"),As.className=Hl),e.appendChild(As)},rl=function(e,t,o,n){if(rn(),vn=e,Ul=o,o=As){if(o.style.direction=t?"rtl":"ltr",o.style.display="block",!n&&e instanceof lt){let E;n=(E=e.getSourceBlock())==null?void 0:E.workspace}var u;$p=(u=n)!=null?u:null;var m;e=(m=n)!=null?m:ne(),_n=e.getRenderer().getClassName(),wn=e.getTheme().getClassName(),_n&&Ie(o,_n),wn&&Ie(o,wn)}},rn=function(){if(Td()){vn=null;var e=As;e&&(e.style.display="none",e.style.left="",e.style.top="",Ul&&Ul(),Ul=null,e.textContent="",_n&&(Be(e,_n),_n=""),wn&&(Be(e,wn),wn=""),ne().markFocused())}},Td=function(){return!!vn},pi=function(e){vn===e&&rn()},mr=function(e){$p!==null&&$p!==e||rn()},Id=function(e,t,o){As.style.left=e+"px",As.style.top=t+"px",As.style.height=o+"px"},Ed=function(e,t,o,n){const u=x$(e,t,o);e=E$(e,t,o,n),0>u?Id(e,0,o.height+u):Id(e,u,o.height)},E$=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)},x$=function(e,t,o){return t.bottom+o.height>=e.bottom?t.top-o.height:t.bottom},D$=function(e){return!(e==null||!e.repositionForWindowResize)},xd=function(){D$(vn)&&vn.repositionForWindowResize()||rn()},A$=function(){return Wl},Dd=function(e){Wl=e},fr=function(e,t,o,n){if(rl(Hy,o,Ad,n),t.length){var u=R$(t,o,e);Gl=u,O$(u,e,o),setTimeout(function(){u.focus()},1),Wl=null}else $r()},R$=function(e,t,o){const n=new Zh;n.setRole(Ds.MENU);for(let u=0;u<e.length;u++){const m=e[u],E=new Qh(m.text);E.setRightToLeft(t),E.setRole(Ds.MENUITEM),n.addChild(E),E.setEnabled(m.enabled),m.enabled&&E.onAction(function(){$r(),requestAnimationFrame(()=>{setTimeout(()=>{m.callback(m.scope,o)},0)})},{})}return n},O$=function(e,t,o){const n=Lu();t=new rt(t.clientY+n.top,t.clientY+n.top,t.clientX+n.left,t.clientX+n.left),M$(e);const u=e.getSize();o&&(t.left+=u.width,t.right+=u.width,n.left+=u.width,n.right+=u.width),Ed(n,t,u,o),e.focus()},M$=function(e){var t=hi();if(!t)throw Error("Attempting to create a context menu when widget div is null");t=e.render(t),Ie(t,"blocklyContextMenu"),K(t,"contextmenu",null,N$),e.focus()},N$=function(e){e.preventDefault(),e.stopPropagation()},$r=function(){pi(Hy),Wl=null},Ad=function(){Gl&&(Gl.dispose(),Gl=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?gi(t,e.workspace):Qi(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()&&B(new(oe(q.BLOCK_CREATE))(o)),i.setSelected$$module$build$src$core$common(o),o}},Rd=function(e,t){return t=be(t,e.getParentSvg(),e.getInverseScreenCTM()),t.x/=e.scale,t.y/=e.scale,t},al=function(e,t,o){t=Rd(e,t),Gy.set(e,fe.difference(o,t))},ll=function(e,t){if(t=Rd(e,t),e=Gy.get(e),!e)throw Error("Drag not initialized");return fe.sum(e,t)},L$=function(e,t=!1){const o=i.createElement$$module$build$src$core$utils$xml("xml");var n=Od(i.allUsedVarModels$$module$build$src$core$variables(e));n.hasChildNodes()&&o.appendChild(n);for(const u of e.getTopComments())o.appendChild(br(u,t));for(e=e.getTopBlocks(!0),n=0;n<e.length;n++)o.appendChild(yr(e[n],t));return o},br=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},Od=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],u=i.createElement$$module$build$src$core$utils$xml("variable");u.appendChild(i.createTextNode$$module$build$src$core$utils$xml(n.name)),n.type&&u.setAttribute("type",n.type),u.id=n.getId(),t.appendChild(u)}return t},yr=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=Po(e,t),Bd(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},P$=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},B$=function(e,t){for(let o=0;o<e.inputList.length;o++){const n=e.inputList[o];for(let u=0;u<n.fieldRow.length;u++){const m=P$(n.fieldRow[u]);m&&t.appendChild(m)}}},Po=function(e,t){if(e.isInsertionMarker())return(t=e.getChildren(!1)[0])?Po(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(B$(e,o),n=e.getCommentText()){var u=e.getIcon(Tt.COMMENT),m=u.getBubbleSize();u=u.bubbleIsVisible();var E=i.createElement$$module$build$src$core$utils$xml("comment");E.appendChild(i.createTextNode$$module$build$src$core$utils$xml(n)),E.setAttribute("pinned",`${u}`),E.setAttribute("h",String(m.height)),E.setAttribute("w",String(m.width)),o.appendChild(E)}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++){m=e.inputList[n];var L=void 0;if(u=!0,m.type!==i.inputTypes$$module$build$src$core$inputs$input_types.DUMMY&&m.type!==i.inputTypes$$module$build$src$core$inputs$input_types.END_ROW){E=m.connection.targetBlock(),m.type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE?L=i.createElement$$module$build$src$core$utils$xml("value"):m.type===i.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT&&(L=i.createElement$$module$build$src$core$utils$xml("statement"));const Ce=m.connection.getShadowDom();!Ce||E&&E.isShadow()||L.appendChild(Md(Ce,t)),E&&(E=Po(E,t),E.nodeType===_o.ELEMENT_NODE&&(L.appendChild(E),u=!1)),L.setAttribute("name",m.name),u||o.appendChild(L)}}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"),L=e.getNextBlock();let se;return L&&(n=Po(L,t),n.nodeType===_o.ELEMENT_NODE&&(se=i.createElement$$module$build$src$core$utils$xml("next"),se.appendChild(n),o.appendChild(se))),e=e.nextConnection&&e.nextConnection.getShadowDom(),!e||L&&L.isShadow()||se.appendChild(Md(e,t)),o},Md=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 u;n.nodeType===_o.TEXT_NODE&&n.data.trim()===""&&((u=o)==null?void 0:u.firstChild)!==n&&Ze(n)}o&&(n=o,o=o.nextSibling,n.nodeType===_o.TEXT_NODE&&n.data.trim()===""&&Ze(n))}return e},Vs=function(e){return Ji(e).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},j$=function(e){e=Vs(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(`
|
|
304
|
+
`),e=e.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>"),e.replace(/^\n/,"")},F$=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=[];co();const u=i.getGroup$$module$build$src$core$events$utils();u||i.setGroup$$module$build$src$core$events$utils(!0),t.setResizesEnabled&&t.setResizesEnabled(!1);let m=!0;try{for(let E=0,L;L=e.childNodes[E];E++){const se=L.nodeName.toLowerCase(),Ce=L;if(se==="block"||se==="shadow"&&!j()){const dt=gi(Ce,t);n.push(dt.id);let ut;const ns=parseInt((ut=Ce.getAttribute("x"))!=null?ut:"10",10);let On;const ea=parseInt((On=Ce.getAttribute("y"))!=null?On:"10",10);isNaN(ns)||isNaN(ea)||dt.moveBy(t.RTL?o-ns:ns,ea,["create"]),m=!1}else{if(se==="shadow")throw TypeError("Shadow block cannot be a top-level block.");if(se==="comment")Nd(Ce,t);else if(se==="variables"){if(m)Ld(Ce,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.");m=!1}}}}finally{i.setGroup$$module$build$src$core$events$utils(u),t.setResizesEnabled&&t.setResizesEnabled(!0),t.rendered&&po(),uo()}return B(new(oe(q.FINISHED_LOADING))(t)),n},Nd=function(e,t){var o;const n=(o=e.getAttribute("id"))!=null?o:void 0;o=t.rendered?new Yl(t,n):new Kl(t,n);var u;o.setText((u=e.textContent)!=null?u:"");var m;u=parseInt((m=e.getAttribute("x"))!=null?m:"",10);let E;m=parseInt((E=e.getAttribute("y"))!=null?E:"",10),isNaN(u)||isNaN(m)||(u=t.RTL?t.getWidth()-u:u,o.moveTo(new fe(u,m)));var L;t=parseInt((L=e.getAttribute("w"))!=null?L:"",10);let se;return L=parseInt((se=e.getAttribute("h"))!=null?se:"",10),isNaN(t)||isNaN(L)||o.setSize(new Xe(t,L)),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},z$=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 u=1/0;let m=-1/0,E=1/0;for(let L=0;L<e.length;L++){const se=t.getBlockById(e[L]).getRelativeToSurfaceXY();se.y<E&&(E=se.y),se.x<u&&(u=se.x),se.x>m&&(m=se.x)}for(n=n-E+10,o=t.RTL?o-m:o-u,u=0;u<e.length;u++)t.getBlockById(e[u]).moveBy(o,n,["create"])}return e},i.domToBlock$$module$build$src$core$xml=function(e,t){return e=gi(e,t),t.rendered&&po(),e},gi=function(e,t){i.disable$$module$build$src$core$events$utils();var o=t.getAllVariables();let n;try{if(n=cl(e,t),t.rendered){const u=n,m=n.getDescendants(!1);u.setConnectionTracking(!1);for(let E=m.length-1;0<=E;E--)m[E].initSvg();for(let E=m.length-1;0<=E;E--)m[E].queueRender();setTimeout(function(){u.disposed||u.setConnectionTracking(!0)},1),t.resizeContents()}else{const u=n.getDescendants(!1);for(let m=u.length-1;0<=m;m--)u[m].initModel()}}finally{i.enable$$module$build$src$core$events$utils()}if(k()){for(e=ur(t,o),t=0;t<e.length;t++)o=e[t],B(new(oe(q.VAR_CREATE))(o));B(new(oe(q.BLOCK_CREATE))(n))}return n},Ld=function(e,t){for(let n=0;n<e.children.length;n++){var o=e.children[n];const u=o.getAttribute("type"),m=o.getAttribute("id");if(o=o.textContent,!o)break;t.createVariable(o,u,m)}},U$=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!==_o.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 u=e[n];t.domToMutation&&(t.domToMutation(u),t.initSvg&&(o=!0))}return o},W$=function(e,t){for(let n=0;n<e.length;n++){var o=e[n];const u=o.textContent,m=o.getAttribute("pinned")==="true";let E;const L=parseInt((E=o.getAttribute("w"))!=null?E:"50",10);let se;o=parseInt((se=o.getAttribute("h"))!=null?se:"50",10),t.setCommentText(u);const Ce=t.getIcon(Tt.COMMENT);isNaN(L)||isNaN(o)||Ce.setBubbleSize(new Xe(L,o)),Ce.setBubbleVisible(m),setTimeout(()=>Ce.setBubbleVisible(m),1)}},G$=function(e,t){for(let o=0;o<e.length;o++)t.data=e[o].textContent},V$=function(e,t){for(let o=0;o<e.length;o++){const n=e[o],u=n.getAttribute("name");u?J$(t,u,n):console.warn(`Ignoring unnamed field in block ${t.type}`)}},Pd=function(e){let t=null,o=null;for(let n=0;n<e.childNodes.length;n++){const u=e.childNodes[n];Bd(u)&&(u.nodeName.toLowerCase()==="block"?t=u:u.nodeName.toLowerCase()==="shadow"&&(o=u))}return{childBlockElement:t,childShadowElement:o}},K$=function(e,t,o,n){for(let m=0;m<e.length;m++){var u=e[m];const E=u.getAttribute("name"),L=E?o.getInput(E):null;if(!L){console.warn("Ignoring non-existent input "+E+" in block "+n);break}if(u=Pd(u),u.childBlockElement){if(!L.connection)throw TypeError("Input connection does not exist.");cl(u.childBlockElement,t,L.connection,!1)}if(u.childShadowElement){let se;(se=L.connection)==null||se.setShadowDom(u.childShadowElement)}}},Y$=function(e,t,o){for(let n=0;n<e.length;n++){const u=Pd(e[n]);if(u.childBlockElement){if(!o.nextConnection)throw TypeError("Next statement does not exist.");if(o.nextConnection.isConnected())throw TypeError("Next statement is already connected.");cl(u.childBlockElement,t,o.nextConnection,!0)}u.childShadowElement&&o.nextConnection&&o.nextConnection.setShadowDom(u.childShadowElement)}},cl=function(e,t,o,n){var u;const m=e.getAttribute("type");if(!m)throw TypeError("Block type unspecified: "+e.outerHTML);var E=(u=e.getAttribute("id"))!=null?u:void 0;u=t.newBlock(m,E),E=U$(e);const L=H$(E.mutation,u);if(W$(E.comment,u),G$(E.data,u),o)if(n)if(u.previousConnection)o.connect(u.previousConnection);else throw TypeError("Next block does not have previous statement.");else if(u.outputConnection)o.connect(u.outputConnection);else if(u.previousConnection)o.connect(u.previousConnection);else throw TypeError("Child block does not have output or previous statement.");if(V$(E.field,u),K$(E.input,t,u,m),Y$(E.next,t,u),L&&u.initSvg(),(t=e.getAttribute("inline"))&&u.setInputsInline(t==="true"),(t=e.getAttribute("disabled"))&&u.setDisabledReason(t==="true"||t==="disabled",qt),t=e.getAttribute("disabled-reasons"),t!==null)for(var se of t.split(","))u.setDisabledReason(!0,decodeURIComponent(se));if((se=e.getAttribute("deletable"))&&u.setDeletable(se==="true"),(se=e.getAttribute("movable"))&&u.setMovable(se==="true"),(se=e.getAttribute("editable"))&&u.setEditable(se==="true"),(se=e.getAttribute("collapsed"))&&u.setCollapsed(se==="true"),e.nodeName.toLowerCase()==="shadow"){for(e=u.getChildren(!1),se=0;se<e.length;se++)if(!e[se].isShadow())throw TypeError("Shadow block not allowed non-shadow child.");u.setShadow(!0)}return u},J$=function(e,t,o){const n=e.getField(t);n?n.fromXml(o):console.warn("Ignoring non-existent field "+t+" in block "+e.type)},q$=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}}},Bd=function(e){return e.nodeType===_o.ELEMENT_NODE},ul=function(e){if(!(100<e.getDescendants(!1).length)){var t=e.workspace,o=e.getSvgRoot();t.getAudioManager().play("delete");var n=e.getRelativeToSurfaceXY(),u=o.cloneNode(!0);u.setAttribute("transform","translate("+n.x+","+n.y+")");var m;(m=t.getLayerManager())==null||m.appendToAnimationLayer({getSvgRoot:()=>u}),jd(u,{x:n.x,y:n.y,width:e.width,height:e.height},t.RTL,new Date)}},jd=function(e,t,o,n){const u=(new Date().getTime()-n.getTime())/150;1<u?Ze(e):(e.setAttribute("transform","translate("+(t.x+(o?-1:1)*t.width/2*u)+","+(t.y+t.height/2*u)+") scale("+(1-u)+")"),setTimeout(jd,10,e,t,o,n))},dl=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 u=ee(V.CIRCLE,{cx:n.x,cy:n.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg());e=ee(V.ANIMATE,{id:"animationCircle",begin:"indefinite",attributeName:"r",dur:"150ms",from:0,to:25*o},u),t=ee(V.ANIMATE,{id:"animationOpacity",begin:"indefinite",attributeName:"opacity",dur:"150ms",from:1,to:0},u),e.beginElement(),t.beginElement(),setTimeout(()=>{Ze(u)},150)}},Fd=function(e){if(an(),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),Fr=e,zd(e,t,new Date,0)}},zd=function(e,t,o,n){const u=[.66,1,.66,0,-.66,-1,-.66,0];let m="";o.getTime()+200>new Date().getTime()&&(m=`skewX(${Math.round(u[n%u.length]*t)})`,Jl=setTimeout(zd,15,e,t,o,n+1)),e.getSvgRoot().setAttribute("transform",`${e.getTranslation()} ${m}`)},an=function(){Fr&&(Jl&&(clearTimeout(Jl),Jl=null),Fr.getSvgRoot().setAttribute("transform",Fr.getTranslation()),Fr=null)},mi=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},fo=function(e,t){for(const o in t)e[o]=t[o]!==null&&typeof t[o]=="object"?fo(e[o]||Object.create(null),t[o]):t[o];return e},Ks=function(e,t){a(he.FIELD,e,t)},X$=function(e){c(he.FIELD,e)},i.fromJson$$module$build$src$core$field_registry=function(e){return Jy.fromJsonInternal(e)},Z$=function(e){const t=f(he.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(Cn[e])throw Error('Error: Extension "'+e+'" is already registered.');if(typeof t!="function")throw Error('Error: Extension "'+e+'" must be a function');Cn[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 u='Error when registering mutator "'+e+'": ';Wd(u,t);const m=Hd(t,u);if(o&&typeof o!="function")throw Error(u+'Extension "'+e+'" is not a function');i.register$$module$build$src$core$extensions(e,function(){m&&this.setMutator(new i.MutatorIcon$$module$build$src$core$icons$mutator_icon(n||[],this)),this.mixin(t),o&&o.apply(this)})},Q$=function(e){Ud(e)?delete Cn[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},Ud=function(e){return!!Cn[e]},hl=function(e,t,o){const n=Cn[e];if(typeof n!="function")throw Error('Error: Extension "'+e+'" not found.');let u;if(o?eb(e,t):u=gl(t),n.apply(t),o)Wd('Error after applying mutator "'+e+'": ',t);else if(!ob(u,t))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},eb=function(e,t){if(gl(t).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+t.id)},tb=function(e,t){return pl(e.mutationToDom,e.domToMutation,t+" mutationToDom/domToMutation")},sb=function(e,t){return pl(e.saveExtraState,e.loadExtraState,t+" saveExtraState/loadExtraState")},Hd=function(e,t){return pl(e.compose,e.decompose,t+" compose/decompose")},pl=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")},Wd=function(e,t){const o=tb(t,e),n=sb(t,e);if(!o&&!n)throw Error(e+"Mutations must contain either XML hooks, or JSON hooks, or both");Hd(t,e)},gl=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},ob=function(e,t){if(t=gl(t),t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(e[o]!==t[o])return!1;return!0},ib=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)||(nb(this,e,t),o.push(this.type)),this.setTooltip(function(){const n=String(this.getFieldValue(e));return _t(t[n])}.bind(this))}},nb=function(e,t,o){var n=e.getField(t);if(n instanceof is&&!n.isOptionListDynamic()){n=n.getOptions();for(const[,u]of n)o[u]===void 0&&console.warn(`No tooltip mapping for value ${u} 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 _t(e).replace("%1",o?o.getText():"")}.bind(this))}},rb=function(){const e=this.tooltip;this.setTooltip(function(){const t=this.getParent();return t&&t.getInputsInline()&&t.tooltip||e}.bind(this))},De=function(e,t){return" "+e+","+t+" "},ss=function(e,t){return" "+e+t.join("")},xt=function(e,t){return" M "+e+","+t+" "},pt=function(e,t){return" m "+e+","+t+" "},Ys=function(e,t){return" l "+e+","+t+" "},ln=function(e){return" l"+e.join("")},Te=function(e,t){return" "+e+" "+t+" "},wt=function(e,t,o,n){return e+" "+o+" "+o+" "+t+n},Gd=function(e,t){a(he.ICON,e.toString(),t)},ab=function(e){c(he.ICON,e)},Bo=function(e){return e.getProcedureModel!==void 0&&e.doProcedureUpdate!==void 0&&e.isProcedureDef!==void 0},ml=function(e){return e.startPublishing!==void 0&&e.stopPublishing!==void 0},fl=function(e){const t=e.getProcedureMap().getProcedures().filter(n=>!n.getReturnTypes()).map(n=>[n.getName(),n.getParameters().map(u=>u.getName()),!1]);e.getBlocksByType("procedures_defnoreturn",!1).forEach(n=>{!Bo(n)&&Xi(n)&&t.push(n.getProcedureDef())});const o=e.getProcedureMap().getProcedures().filter(n=>!!n.getReturnTypes()).map(n=>[n.getName(),n.getParameters().map(u=>u.getName()),!0]);return e.getBlocksByType("procedures_defreturn",!1).forEach(n=>{!Bo(n)&&Xi(n)&&o.push(n.getProcedureDef())}),t.sort(Vd),o.sort(Vd),[t,o]},Vd=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";!lb(e,t.workspace,t);){const o=e.match(/^(.*?)(\d+)$/);e=o?o[1]+(parseInt(o[2])+1):e+"2"}return e},lb=function(e,t,o){return!Kd(e,t,o)},Kd=function(e,t,o){for(const n of t.getAllBlocks(!1))if(n!==o&&Xi(n)&&i.Names$$module$build$src$core$names.equals(n.getProcedureDef()[0],e))return!0;o=o&&Bo(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 Ct;e=e.trim();const o=i.findLegalName$$module$build$src$core$procedures(e,t);Bo(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 u=e[t];u.renameProcedure&&u.renameProcedure(n,o)}return o},$l=function(e){function t(m,E){for(let se=0;se<m.length;se++){var L=m[se][0];const Ce=m[se][1],dt=i.createElement$$module$build$src$core$utils$xml("block");dt.setAttribute("type",E),dt.setAttribute("gap","16");const ut=i.createElement$$module$build$src$core$utils$xml("mutation");for(ut.setAttribute("name",L),dt.appendChild(ut),L=0;L<Ce.length;L++){const ns=i.createElement$$module$build$src$core$utils$xml("arg");ns.setAttribute("name",Ce[L]),ut.appendChild(ns)}o.push(dt)}}const o=[];if(os.procedures_defnoreturn){var n=i.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","procedures_defnoreturn"),n.setAttribute("gap","16");var u=i.createElement$$module$build$src$core$utils$xml("field");u.setAttribute("name","NAME"),u.appendChild(i.createTextNode$$module$build$src$core$utils$xml(i.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE)),n.appendChild(u),o.push(n)}return os.procedures_defreturn&&(n=i.createElement$$module$build$src$core$utils$xml("block"),n.setAttribute("type","procedures_defreturn"),n.setAttribute("gap","16"),u=i.createElement$$module$build$src$core$utils$xml("field"),u.setAttribute("name","NAME"),u.appendChild(i.createTextNode$$module$build$src$core$utils$xml(i.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),n.appendChild(u),o.push(n)),os.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=fl(e),t(e[0],"procedures_callnoreturn"),t(e[1],"procedures_callreturn"),o},Yd=function(e){var t=[],o=e.getBlocksByType("procedures_mutatorarg",!1);for(let m=0,E;E=o[m];m++)t.push(E.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 u=i.createElement$$module$build$src$core$utils$xml("field");u.setAttribute("name","NAME"),t=Ja(i.DEFAULT_ARG$$module$build$src$core$procedures,t),t=i.createTextNode$$module$build$src$core$utils$xml(t),u.appendChild(t),n.appendChild(u),o.appendChild(n),e.updateToolbox(o)},Jd=function(e){if(N(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(),Yd(e),e.addChangeListener(cb))}},cb=function(e){($(e)||I(e)||T(e)||C(e))&&(e=Q(e.workspaceId),Yd(e))},qd=function(e,t){return t.getAllBlocks(!1).filter(o=>ub(o,e)||Ff(o)&&i.Names$$module$build$src$core$names.equals(o.getProcedureCall(),e))},ub=function(e,t){return Bo(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=j();var o=e.getProcedureDef()[0];const n=e.mutationToDom(!0);e=qd(o,e.workspace);for(let m=0,E;E=e[m];m++){o=(o=E.mutationToDom())&&Ji(o),E.domToMutation&&E.domToMutation(n);var u=E.mutationToDom();u=u&&Ji(u),o!==u&&(i.setRecordUndo$$module$build$src$core$events$utils(!1),B(new(oe(q.BLOCK_CHANGE))(E,"mutation",null,o,u)),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(Bo(o)&&o.isProcedureDef()&&i.Names$$module$build$src$core$names.equals(o.getProcedureModel().getName(),e)||Xi(o)&&i.Names$$module$build$src$core$names.equals(o.getProcedureDef()[0],e))return o;return null},bl=function(e){return e.isDynamic},db=function(e){return e.pathDown!==void 0&&e.pathUp!==void 0},hb=function(e){return e.pathLeft!==void 0&&e.pathRight!==void 0},pb=function(e,t){if(!e||!t)throw Error("Cannot connect null connections.");e.targetConnection=t,t.targetConnection=e},gb=function(e,t){let o=null;t=t.outputConnection;const n=t==null?void 0:t.getConnectionChecker();for(let u=0,m;m=e.inputList[u];u++){const E=m.connection;let L;if(E&&((L=n)!=null&&L.canConnect(t,E,!1))){if(o)return null;o=E}}return o},mb=function(e,t){let o;for(;o=gb(e,t);)if(e=o.targetBlock(),!e||e.isShadow())return o;return null},Xd=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},fb=function(e){return Xd(e)&&en(e)&&lr(e)&&e.setText!==void 0&&e.getText!==void 0&&e.setBubbleSize!==void 0&&e.getBubbleSize!==void 0&&e.getType()===Tt.COMMENT},vr=function(e){let t=e.outputConnection;return(!t||e.previousConnection&&e.previousConnection.isConnected())&&(t=e.previousConnection),t},_r=function(e,t){a(he.RENDERER,e,t)},$b=function(e){c(he.RENDERER,e)},Zd=function(e,t,o){return e=new(p(he.RENDERER,e))(e),e.init(t,o),e},Qd=function(e){Zi(e.getTargetWorkspace(),void 0,"String")},eh=function(e){Zi(e.getTargetWorkspace(),void 0,"Number")},th=function(e){Zi(e.getTargetWorkspace(),void 0,"Colour")},yl=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",Qd),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",eh),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",th),e=sh(e),t=t.concat(e)},sh=function(e){e=e.getAllVariables();const t=[];if(0<e.length){if(os.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(ci(o)),t.push(n)}if(os.variables_get_dynamic){e.sort(Or.compareByName);for(let n=0,u;u=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(ci(u)),t.push(o)}}return t},bb=function(e,t){const o=e.workspace,n=i.config$$module$build$src$core$config.snapRadius,u=fe.difference(t,e.getRelativeToSurfaceXY()),m=new fe(0,0),E=o.getAllBlocks(!1).filter(L=>L.id!=e.id).map(L=>L.getRelativeToSurfaceXY());for(;yb(fe.sum(t,m),E)||vb(e,fe.sum(u,m),n);)o.RTL?m.translate(-n,2*n):m.translate(n,2*n);e.moveTo(fe.sum(t,m))},yb=function(e,t){return t.some(o=>1>=Math.abs(o.x-e.x)&&1>=Math.abs(o.y-e.y))},vb=function(e,t,o){return e.getConnections_(!1).some(n=>!!n.closest(o,t).connection)},cn=function(e,t,o){const n=o.getBoundingRectangle(),u=n.right-n.left,m=tn(t.top,n.top,t.top+t.height-(n.bottom-n.top))-n.top;let E=t.left;return t=t.left+t.width-u,e.RTL?E=Math.min(t,E):t=Math.max(E,t),(e=tn(E,n.left,t)-n.left)||m?(o.moveBy(e,m,["inbounds"]),!0):!1},oh=function(e){return t=>{var o=e.getMetricsManager();if(o.hasFixedEdges()&&!e.isDragging()){var n;if(zb.includes((n=t.type)!=null?n:"")){n=o.getScrollMetrics(!0);const u=_b(e,t);u&&(o=i.getGroup$$module$build$src$core$events$utils()||!1,i.setGroup$$module$build$src$core$events$utils(t.group),cn(e,n,u)&&!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 U(t)&&t.scale&&t.oldScale&&t.scale>t.oldScale&&vl(e)}}},_b=function(e,t){let o=null;switch(t.type){case q.BLOCK_CREATE:case q.BLOCK_MOVE:(o=e.getBlockById(t.blockId))&&(o=o.getRootBlock());break;case q.COMMENT_CREATE:case q.COMMENT_MOVE:case q.COMMENT_RESIZE:o=e.getCommentById(t.commentId)}return o},vl=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var o=e.getTopBoundedElements();for(let n=0,u;u=o[n];n++)cn(e,t,u)}},ms=function(e){return e.isDeletable!==void 0&&e.dispose!==void 0&&e.setDeleteStyle!==void 0},wb=function(e){const t=e.toCopyData();Gp=t;let o;return Vp=(o=e.workspace)!=null?o:null,t},jo=function(e,t,o){return e&&t?ih(e,t,o):Gp&&Vp?ih(Gp,Vp):null},ih=function(e,t,o){let n;t=t.isMutator?t:(n=t.getRootWorkspace())!=null?n:t;let u,m;return(m=(u=f(he.PASTER,e.paster,!1))==null?void 0:u.paste(e,t,o))!=null?m:null},kb=function(e){const t=e.toCopyData();return t?jo(t,e.workspace):null},wr=function(e){return e.toCopyData!==void 0},nh=function(){st.registry.register({name:Qs.ESCAPE,preconditionFn(e){return!e.options.readOnly},callback(e){return e.hideChaff(),!0},keyCodes:[Ve.ESC]})},rh=function(){st.registry.register({name:Qs.DELETE,preconditionFn(e){const t=ke();return!e.options.readOnly&&t!=null&&ms(t)&&t.isDeletable()&&!ko.inProgress()},callback(e,t){return t.preventDefault(),e=ke(),e instanceof _s?e.checkAndDelete():ms(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:[Ve.DELETE,Ve.BACKSPACE]})},ah=function(){const e=st.registry.createSerializedKey(Ve.C,[Ve.CTRL]),t=st.registry.createSerializedKey(Ve.C,[Ve.ALT]),o=st.registry.createSerializedKey(Ve.C,[Ve.META]);st.registry.register({name:Qs.COPY,preconditionFn(n){const u=ke();return!n.options.readOnly&&!ko.inProgress()&&u!=null&&ms(u)&&u.isDeletable()&&mi(u)&&u.isMovable()&&wr(u)},callback(n,u){return u.preventDefault(),n.hideChaff(),u=ke(),!u||!wr(u)?!1:(Jo=u.toCopyData(),qo=u.workspace instanceof ps?u.workspace:n,Dn=mi(u)?u.getRelativeToSurfaceXY():null,!!Jo)},keyCodes:[e,t,o]})},lh=function(){const e=st.registry.createSerializedKey(Ve.X,[Ve.CTRL]),t=st.registry.createSerializedKey(Ve.X,[Ve.ALT]),o=st.registry.createSerializedKey(Ve.X,[Ve.META]);st.registry.register({name:Qs.CUT,preconditionFn(n){const u=ke();return!n.options.readOnly&&!ko.inProgress()&&u!=null&&ms(u)&&u.isDeletable()&&mi(u)&&u.isMovable()&&!u.workspace.isFlyout},callback(n){const u=ke();return u instanceof _s?(Jo=u.toCopyData(),qo=n,Dn=u.getRelativeToSurfaceXY(),u.checkAndDelete(),!0):ms(u)&&u.isDeletable()&&wr(u)?(Jo=u.toCopyData(),qo=n,Dn=mi(u)?u.getRelativeToSurfaceXY():null,u.dispose(),!0):!1},keyCodes:[e,t,o]})},ch=function(){const e=st.registry.createSerializedKey(Ve.V,[Ve.CTRL]),t=st.registry.createSerializedKey(Ve.V,[Ve.ALT]),o=st.registry.createSerializedKey(Ve.V,[Ve.META]);st.registry.register({name:Qs.PASTE,preconditionFn(n){return!n.options.readOnly&&!ko.inProgress()},callback(){if(!Jo||!qo)return!1;if(!Dn)return!!jo(Jo,qo);const{left:n,top:u,width:m,height:E}=qo.getMetricsManager().getViewMetrics(!0);if(new rt(u,u+E,n,n+m).contains(Dn.x,Dn.y))return!!jo(Jo,qo);const L=new fe(n+m/2,u+E/2);return!!jo(Jo,qo,L)},keyCodes:[e,t,o]})},uh=function(){const e=st.registry.createSerializedKey(Ve.Z,[Ve.CTRL]),t=st.registry.createSerializedKey(Ve.Z,[Ve.ALT]),o=st.registry.createSerializedKey(Ve.Z,[Ve.META]);st.registry.register({name:Qs.UNDO,preconditionFn(n){return!n.options.readOnly&&!ko.inProgress()},callback(n,u){return n.hideChaff(),n.undo(!1),u.preventDefault(),!0},keyCodes:[e,t,o]})},dh=function(){const e=st.registry.createSerializedKey(Ve.Z,[Ve.SHIFT,Ve.CTRL]),t=st.registry.createSerializedKey(Ve.Z,[Ve.SHIFT,Ve.ALT]),o=st.registry.createSerializedKey(Ve.Z,[Ve.SHIFT,Ve.META]),n=st.registry.createSerializedKey(Ve.Y,[Ve.CTRL]);st.registry.register({name:Qs.REDO,preconditionFn(u){return!ko.inProgress()&&!u.options.readOnly},callback(u,m){return u.hideChaff(),u.undo(!0),m.preventDefault(),!0},keyCodes:[e,t,o,n]})},hh=function(){nh(),rh(),ah(),lh(),ch(),uh(),dh()},ph=function(e){const t=e.saveState();return e.getParameters().length&&(t.parameters=e.getParameters().map(o=>o.saveState())),t},gh=function(e,t,o,n){if(e=e.loadState(o,n),!o.parameters)return e;for(const[u,m]of o.parameters.entries())e.insertParameter(t.loadState(m,n),u);return e},Cb=function(e){const t=Object.create(null),o=b(he.SERIALIZER,!0);for(const n in o){let u;const m=(u=o[n])==null?void 0:u.save(e);m&&(t[n]=m)}return t},Sb=function(e,t,{recordUndo:o=!1}={}){var n=b(he.SERIALIZER,!0);if(n){n=Object.entries(n).sort((m,E)=>E[1].priority-m[1].priority);var u=j();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),co(),t instanceof ps&&t.setResizesEnabled(!1);for(const[,m]of n.reverse()){let E;(E=m)==null||E.clear(t)}for(const[m,E]of n.reverse())if(e[m]){let L;(L=E)==null||L.load(e[m],t)}t instanceof ps&&t.setResizesEnabled(!0),uo(),B(new(oe(q.FINISHED_LOADING))(t)),i.setGroup$$module$build$src$core$events$utils(o),i.setRecordUndo$$module$build$src$core$events$utils(u)}},Tb=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 bs(t||{}),n=document.createElement("div"),Ie(n,"injectionDiv"),t!=null&&t.rtl&&Ie(n,"blocklyRTL"),n.tabIndex=0,Ot(n,Dt.LABEL,i.Msg$$module$build$src$core$msg.WORKSPACE_ARIA_LABEL),o.appendChild(n),t=Ib(n,e);const u=Eb(n,t,e);return xb(u),ie(u),xe(u),n.addEventListener("focusin",function(){ie(u)}),K(n,"keydown",null,_l),K(dr(),"keydown",null,_l),(t=hi())&&K(t,"keydown",null,_l),u},Ib=function(e,t){e.setAttribute("dir","LTR"),Ht(t.hasCss,t.pathToMedia),e=ee(V.SVG,{xmlns:Ir,"xmlns:html":qs,"xmlns:xlink":ls,version:"1.1",class:"blocklySvg",tabindex:"0"},e);const o=ee(V.DEFS,{},e),n=String(Math.random()).substring(2);return t.gridPattern=_p.createDom(n,t.gridOptions,o),e},Eb=function(e,t,o){o.parentWorkspace=null,o=new ps(o);const n=o.options;o.scale=n.zoomOptions.startScale,t.appendChild(o.createDom("blocklyMainBackground",e));var u=o.getRenderer().getClassName();return u&&Ie(e,u),(u=o.getTheme().getClassName())&&Ie(e,u),!n.hasCategories&&n.languageTree&&(e=o.addFlyout(V.SVG),Nt(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(oh(o)),xe(o),Sd(),Zu(),fd(),o},xb=function(e){const t=e.options;var o=e.getParentSvg();if(K(o.parentNode,"contextmenu",null,function(n){$e(n)||n.preventDefault()}),o=K(window,"resize",null,function(){mo(),e.hideComponents(!0),dd(),xd(),xe(e),vl(e)}),e.setResizeHandlerWrapper(o),Db(),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 Yp(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&&Ab(t.pathToMedia,e)},_l=function(e){const t=ne();t&&!($e(e)||t.rendered&&!t.isVisible())&&st.registry.onKeyDown(t,e)},Db=function(){Mv||(K(document,"scroll",null,function(){const e=F();for(let t=0,o;o=e[t];t++)o instanceof ps&&o.updateInverseScreenCTM()}),ue(document,"touchend",null,te),ue(document,"touchcancel",null,te)),Mv=!0},Ab=function(e,t){function o(){for(;u.length;){const m=u.pop();m&&G(m)}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 u=[];u.push(K(document,"pointermove",null,o,!0)),u.push(K(document,"touchstart",null,o,!0))},mh=function(){He.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:He.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1})},fh=function(){He.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:He.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2})},$h=function(){He.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:He.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3})},bh=function(e,t){function o(m){u--,m.setCollapsed(e),u===0&&i.setGroup$$module$build$src$core$events$utils(!1)}let n=0,u=0;i.setGroup$$module$build$src$core$events$utils(!0);for(let m=0;m<t.length;m++){let E=t[m];for(;E;)u++,setTimeout(o.bind(null,E),n),E=E.getNextBlock(),n+=10}},yh=function(){He.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){bh(!0,e.workspace.getTopBlocks(!0))},scopeType:He.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})},vh=function(){He.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){bh(!1,e.workspace.getTopBlocks(!0))},scopeType:He.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})},_h=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++)_h(e[o],t)}},wl=function(e){const t=[];e=e.getTopBlocks(!0);for(let o=0;o<e.length;o++)_h(e[o],t);return t},kr=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()?kr(e,t):(o.dispose(!1,!0),setTimeout(kr,10,e,t))),i.setGroup$$module$build$src$core$events$utils(!1)},wh=function(){He.registry.register({displayText(e){return e.workspace?(e=wl(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<wl(e.workspace).length?"enabled":"disabled"},callback(e){if(e.workspace){e.workspace.cancelCurrentGesture();var t=wl(e.workspace);2>t.length?kr(t):Va(i.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),function(o){o&&kr(t)})}},scopeType:He.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},Rb=function(){mh(),fh(),$h(),yh(),vh(),wh()},kh=function(){He.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&&jo(t,e.block.workspace)}},scopeType:He.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},Ch=function(){He.registry.register({displayText(e){return e.block.hasIcon(To.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(To.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:He.ScopeType.BLOCK,id:"blockComment",weight:2})},Sh=function(){He.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 gc||e.inputList[t]instanceof gc))return"enabled"}return"hidden"},callback(e){e.block.setInputsInline(!e.block.getInputsInline())},scopeType:He.ScopeType.BLOCK,id:"blockInline",weight:3})},Th=function(){He.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:He.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},Ih=function(){He.registry.register({displayText(e){return e.block.hasDisabledReason(qt)?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(qt)?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(qt),qt),i.setGroup$$module$build$src$core$events$utils(t)},scopeType:He.ScopeType.BLOCK,id:"blockDisable",weight:5})},Eh=function(){He.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:He.ScopeType.BLOCK,id:"blockDelete",weight:6})},xh=function(){He.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:He.ScopeType.BLOCK,id:"blockHelp",weight:7})},Dh=function(){He.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:He.ScopeType.COMMENT,id:"commentDelete",weight:6})},Ah=function(){He.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&&jo(t,e.comment.workspace)}},scopeType:He.ScopeType.COMMENT,id:"commentDuplicate",weight:1})},Rh=function(){He.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 Yl(e);o.setText(i.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT),o.moveTo(Ob(new fe(t.clientX,t.clientY),e)),i.setSelected$$module$build$src$core$common(o),i.setGroup$$module$build$src$core$events$utils(!1)}},scopeType:He.ScopeType.WORKSPACE,id:"commentCreate",weight:8})},Ob=function(e,t){var o=t.getInjectionDiv().getBoundingClientRect();return e=new fe(e.x-o.left,e.y-o.top),o=t.getOriginOffsetInPixels(),e=fe.difference(e,o),e.scale(1/t.scale),e},Mb=function(){kh(),Ch(),Sh(),Th(),Ih(),Eh(),xh()},Nb=function(){Ah(),Dh(),Rh()},Oh=function(){Rb(),Mb()},Lb=function(e){return e.paste!==void 0},Pb=function(e){return e.getSvgRoot!==void 0},Bb=function(e){return typeof e.id=="string"&&e.workspace!==void 0&&e.select!==void 0&&e.unselect!==void 0},jb=function(e){return e.isSelectable()},Fb=function(e){ne().hideChaff(e)},de=de||{},de.scope={},de.ASSUME_ES5=!1,de.ASSUME_NO_NATIVE_MAP=!1,de.ASSUME_NO_NATIVE_SET=!1,de.SIMPLE_FROUND_POLYFILL=!1,de.ISOLATE_POLYFILLS=!1,de.FORCE_POLYFILL_PROMISE=!1,de.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,de.defineProperty=de.ASSUME_ES5||typeof Object.defineProperties=="function"?Object.defineProperty:function(e,t,o){return e==Array.prototype||e==Object.prototype||(e[t]=o.value),e},de.getGlobal=function(e){e=[typeof globalThis=="object"&&globalThis,e,typeof window=="object"&&window,typeof self=="object"&&self,typeof ro=="object"&&ro];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")},de.global=de.getGlobal(this),de.IS_SYMBOL_NATIVE=typeof Symbol=="function"&&typeof Symbol("x")=="symbol",de.TRUST_ES6_POLYFILLS=!de.ISOLATE_POLYFILLS||de.IS_SYMBOL_NATIVE,de.polyfills={},de.propertyToPolyfillSymbol={},de.POLYFILL_PREFIX="$jscp$",de.polyfill=function(e,t,o,n){t&&(de.ISOLATE_POLYFILLS?de.polyfillIsolated(e,t,o,n):de.polyfillUnisolated(e,t,o,n))},de.polyfillUnisolated=function(e,t,o,n){for(o=de.global,e=e.split("."),n=0;n<e.length-1;n++){var u=e[n];if(!(u in o))return;o=o[u]}e=e[e.length-1],n=o[e],t=t(n),t!=n&&t!=null&&de.defineProperty(o,e,{configurable:!0,writable:!0,value:t})},de.polyfillIsolated=function(e,t,o,n){var u=e.split(".");e=u.length===1,n=u[0],n=!e&&n in de.polyfills?de.polyfills:de.global;for(var m=0;m<u.length-1;m++){var E=u[m];if(!(E in n))return;n=n[E]}u=u[u.length-1],o=de.IS_SYMBOL_NATIVE&&o==="es6"?n[u]:null,t=t(o),t!=null&&(e?de.defineProperty(de.polyfills,u,{configurable:!0,writable:!0,value:t}):t!==o&&(de.propertyToPolyfillSymbol[u]===void 0&&(o=1e9*Math.random()>>>0,de.propertyToPolyfillSymbol[u]=de.IS_SYMBOL_NATIVE?de.global.Symbol(u):de.POLYFILL_PREFIX+o+"$"+u),de.defineProperty(n,de.propertyToPolyfillSymbol[u],{configurable:!0,writable:!0,value:t})))},de.underscoreProtoCanBeSet=function(){var e={a:!0},t={};try{return t.__proto__=e,t.a}catch{}return!1},de.setPrototypeOf=de.TRUST_ES6_POLYFILLS&&typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf:de.underscoreProtoCanBeSet()?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null,de.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}},de.arrayIterator=function(e){return{next:de.arrayIteratorImpl(e)}},de.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 de.arrayIterator(e);throw Error(String(e)+" is not an iterable or ArrayLike")},de.generator={},de.generator.ensureIteratorResultIsObject_=function(e){if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object")},de.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},de.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0},de.generator.Context.prototype.stop_=function(){this.isRunning_=!1},de.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_},de.generator.Context.prototype.next_=function(e){this.yieldResult=e},de.generator.Context.prototype.throw_=function(e){this.abruptCompletion_={exception:e,isException:!0},this.jumpToErrorHandler_()},de.generator.Context.prototype.return=function(e){this.abruptCompletion_={return:e},this.nextAddress=this.finallyAddress_},de.generator.Context.prototype.jumpThroughFinallyBlocks=function(e){this.abruptCompletion_={jumpTo:e},this.nextAddress=this.finallyAddress_},de.generator.Context.prototype.yield=function(e,t){return this.nextAddress=t,{value:e}},de.generator.Context.prototype.yieldAll=function(e,t){e=de.makeIterator(e);var o=e.next();if(de.generator.ensureIteratorResultIsObject_(o),o.done)this.yieldResult=o.value,this.nextAddress=t;else return this.yieldAllIterator_=e,this.yield(o.value,t)},de.generator.Context.prototype.jumpTo=function(e){this.nextAddress=e},de.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0},de.generator.Context.prototype.setCatchFinallyBlocks=function(e,t){this.catchAddress_=e,t!=null&&(this.finallyAddress_=t)},de.generator.Context.prototype.setFinallyBlock=function(e){this.catchAddress_=0,this.finallyAddress_=e||0},de.generator.Context.prototype.leaveTryBlock=function(e,t){this.nextAddress=e,this.catchAddress_=t||0},de.generator.Context.prototype.enterCatchBlock=function(e){return this.catchAddress_=e||0,e=this.abruptCompletion_.exception,this.abruptCompletion_=null,e},de.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},de.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},de.generator.Context.prototype.forIn=function(e){return new de.generator.Context.PropertyIterator(e)},de.generator.Context.PropertyIterator=function(e){this.object_=e,this.properties_=[];for(var t in e)this.properties_.push(t);this.properties_.reverse()},de.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},de.generator.Engine_=function(e){this.context_=new de.generator.Context,this.program_=e},de.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_())},de.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_())},de.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_())},de.generator.Engine_.prototype.yieldAllStep_=function(e,t,o){try{var n=e.call(this.context_.yieldAllIterator_,t);if(de.generator.ensureIteratorResultIsObject_(n),!n.done)return this.context_.stop_(),n;var u=n.value}catch(m){return this.context_.yieldAllIterator_=null,this.context_.throw_(m),this.nextStep_()}return this.context_.yieldAllIterator_=null,o.call(this.context_,u),this.nextStep_()},de.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}},de.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}},de.generator.createGenerator=function(e,t){return t=new de.generator.Generator_(new de.generator.Engine_(t)),de.setPrototypeOf&&e.prototype&&de.setPrototypeOf(t,e.prototype),t},de.asyncExecutePromiseGenerator=function(e){function t(n){return e.next(n)}function o(n){return e.throw(n)}return new Promise(function(n,u){function m(E){E.done?n(E.value):Promise.resolve(E.value).then(t,o).then(m,u)}m(e.next())})},de.asyncExecutePromiseGeneratorFunction=function(e){return de.asyncExecutePromiseGenerator(e())},de.asyncExecutePromiseGeneratorProgram=function(e){return de.asyncExecutePromiseGenerator(new de.generator.Generator_(new de.generator.Engine_(e)))},de.polyfill("globalThis",function(e){return e||de.global},"es_2020","es3"),de.polyfill("Array.prototype.includes",function(e){return e||function(t,o){var n=this;n instanceof String&&(n=String(n));var u=n.length;for(o=o||0,0>o&&(o=Math.max(o+u,0));o<u;o++){var m=n[o];if(m===t||Object.is(m,t))return!0}return!1}},"es7","es3"),de.initSymbol=function(){},de.iteratorPrototype=function(e){return e={next:e},e[Symbol.iterator]=function(){return this},e},de.iteratorFromArray=function(e,t){e instanceof String&&(e+="");var o=0,n=!1,u={next:function(){if(!n&&o<e.length){var m=o++;return{value:t(m,e[m]),done:!1}}return n=!0,{done:!0,value:void 0}}};return u[Symbol.iterator]=function(){return u},u},de.polyfill("Array.prototype.values",function(e){return e||function(){return de.iteratorFromArray(this,function(t,o){return o})}},"es8","es3"),de.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"),de.polyfill("Array.prototype.flatMap",function(e){return e||function(t,o){var n=[];return Array.prototype.forEach.call(this,function(u,m){u=t.call(o,u,m,this),Array.isArray(u)?n.push.apply(n,u):n.push(u)}),n}},"es9","es5"),de.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},de.polyfill("Object.entries",function(e){return e||function(t){var o=[],n;for(n in t)de.owns(t,n)&&o.push([n,t[n]]);return o}},"es8","es3"),de.polyfill("Object.values",function(e){return e||function(t){var o=[],n;for(n in t)de.owns(t,n)&&o.push(t[n]);return o}},"es8","es3");var Fo=Object.create(null),ES={typeMap:Fo},kl=Object.create(null),Js="default",he=class{constructor(e){this.name=e}toString(){return this.name}};he.CONNECTION_CHECKER=new he("connectionChecker"),he.CONNECTION_PREVIEWER=new he("connectionPreviewer"),he.CURSOR=new he("cursor"),he.EVENT=new he("event"),he.FIELD=new he("field"),he.INPUT=new he("input"),he.RENDERER=new he("renderer"),he.TOOLBOX=new he("toolbox"),he.THEME=new he("theme"),he.TOOLBOX_ITEM=new he("toolboxItem"),he.FLYOUTS_VERTICAL_TOOLBOX=new he("flyoutsVerticalToolbox"),he.FLYOUTS_HORIZONTAL_TOOLBOX=new he("flyoutsHorizontalToolbox"),he.METRICS_MANAGER=new he("metricsManager"),he.BLOCK_DRAGGER=new he("blockDragger"),he.SERIALIZER=new he("serializer"),he.ICON=new he("icon"),he.PASTER=new he("paster");var $o={DEFAULT:Js,TEST_ONLY:ES};$o.Type=he,$o.getAllItems=b,$o.getClass=p,$o.getClassFromOptions=v,$o.getObject=f,$o.hasItem=d,$o.register=a,$o.unregister=c;var os=Object.create(null),q;(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"})(q||(q={}));var zb=[q.BLOCK_CREATE,q.BLOCK_MOVE,q.COMMENT_CREATE,q.COMMENT_MOVE],Ub=new Set,Hb={};Hb.warn=_;var Wb="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Gb={genUid:()=>{const e=Wb.length,t=[];for(let o=0;20>o;o++)t[o]=Wb.charAt(Math.random()*e);return t.join("")}},xS=0,Mh={TEST_ONLY:Gb};Mh.genUid=w,Mh.getNextUniqueId=y;var Vb="",Cr=!0,Nh=0,Lh="ORPHANED_BLOCK",bo=[],Kb={FIRE_QUEUE:bo,enqueueEvent:ye,fireNow:ae,fireInternal:J,setGroupInternal:X};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 Sr=Object.create(null),Yb,fi=null,Jb,Tr=[],qb={defineBlocksWithJsonArrayInternal:ft},Lt={TEST_ONLY:qb};Lt.createBlockDefinitionsFromJsonArray=i.createBlockDefinitionsFromJsonArray$$module$build$src$core$common,Lt.defineBlocks=i.defineBlocks$$module$build$src$core$common,Lt.defineBlocksWithJsonArray=ct,Lt.draggingConnections=Tr,Lt.getAllWorkspaces=F,Lt.getBlockTypeCounts=Pe,Lt.getMainWorkspace=ne,Lt.getParentContainer=Ne,Lt.getSelected=ke,Lt.getWorkspaceById=Q,Lt.registerWorkspace=P,Lt.setMainWorkspace=ie,Lt.setParentContainer=Ae,Lt.setSelected=i.setSelected$$module$build$src$core$common,Lt.svgResize=xe,Lt.unregisterWorkpace=me;var un=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=i.getGroup$$module$build$src$core$events$utils(),this.recordUndo=j()}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}},Es=class extends un{constructor(e){super(),this.recordUndo=!1,this.isUiEvent=!0,this.isBlank=typeof e>"u",this.workspaceId=e||""}},Ph=class extends Es{constructor(e,t,o){t=e?e.workspace.id:t,t===null&&(t=void 0),super(t),this.type=q.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 Ph),t.targetType=e.targetType,t.blockId=e.blockId,t}},Bh;(function(e){e.BLOCK="block",e.WORKSPACE="workspace",e.ZOOM_CONTROLS="zoom_controls"})(Bh||(Bh={})),a(he.EVENT,q.CLICK,Ph);var DS=750,Xb="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),Cl=null,$i={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},Sl=0,bi={TOUCH_ENABLED:Xb,TOUCH_MAP:$i};bi.checkTouchIdentifier=H,bi.clearTouchIdentifier=Y,bi.getTouchIdentifierFromEvent=A,bi.longStart=S,bi.longStop=te,bi.shouldHandleEvent=O;var jh,Zb,Qb,ey,Tl,Il,Fh,ty,sy,oy;(function(e){function t(n){return o.includes(n.toUpperCase())}jh=e;const o=jh.toUpperCase();Zb=t("JavaFX"),Qb=t("WebKit"),ey=t("Gecko")&&!Qb,Tl=t("Android"),e=globalThis.navigator&&globalThis.navigator.maxTouchPoints,Il=t("iPad")||t("Macintosh")&&0<e,Fh=t("iPhone")&&!Il,ty=t("Macintosh"),sy=Il||Tl&&!t("Mobile")||t("Silk"),oy=!sy&&(Fh||Tl)})(globalThis.navigator&&globalThis.navigator.userAgent||"");var AS=jh,iy=Zb,ny=ey,zh=Tl,El=Il,ry=Fh,Uh=ty,ay=oy,RS={ANDROID:zh,GECKO:ny,IPAD:El,IPHONE:ry,JavaFx:iy,MAC:Uh,MOBILE:ay,raw:AS},ly=40,cy=125,yo={};yo.bind=ue,yo.conditionalBind=K,yo.getScrollDeltaPixels=Re,yo.isRightButton=we,yo.isTargetInput=$e,yo.mouseToSvg=be,yo.unbind=G;var uy={};uy.removeElem=Ge;var vo=class{constructor(e){this.name=e}toString(){return this.name}};vo.POSITIONABLE=new vo("positionable"),vo.DRAG_TARGET=new vo("drag_target"),vo.DELETE_AREA=new vo("delete_area"),vo.AUTOHIDEABLE=new vo("autohideable");var gt=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 u=String(e.capabilities[n]).toLowerCase();if(t.push(u),this.capabilityToComponentIds.has(u)){let m;(m=this.capabilityToComponentIds.get(u))==null||m.push(o)}else this.capabilityToComponentIds.set(u,[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();Ge(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(),Ge(this.componentData.get(e).capabilities,t),Ge(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(u=>{n.push(this.componentData.get(u))}),n.sort(function(u,m){return u.weight-m.weight}),n.forEach(function(u){o.push(u.component)})}else e.forEach(n=>{o.push(this.componentData.get(n).component)});return o}};gt.Capability=vo,(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"})(gt||(gt={})),gt.ComponentWeight;var Hh=!1,Wh=`
|
|
305
|
+
.blocklySvg {
|
|
306
|
+
background-color: #fff;
|
|
307
|
+
outline: none;
|
|
308
|
+
overflow: hidden; /* IE overflows by default. */
|
|
309
|
+
position: absolute;
|
|
310
|
+
display: block;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.blocklyWidgetDiv {
|
|
314
|
+
display: none;
|
|
315
|
+
position: absolute;
|
|
316
|
+
z-index: 99999; /* big value for bootstrap3 compatibility */
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.injectionDiv {
|
|
320
|
+
height: 100%;
|
|
321
|
+
position: relative;
|
|
322
|
+
overflow: hidden; /* So blocks in drag surface disappear at edges */
|
|
323
|
+
touch-action: none;
|
|
324
|
+
user-select: none;
|
|
325
|
+
-webkit-user-select: none;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.blocklyNonSelectable {
|
|
329
|
+
user-select: none;
|
|
330
|
+
-ms-user-select: none;
|
|
331
|
+
-webkit-user-select: none;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.blocklyBlockCanvas.blocklyCanvasTransitioning,
|
|
335
|
+
.blocklyBubbleCanvas.blocklyCanvasTransitioning {
|
|
336
|
+
transition: transform .5s;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.blocklyTooltipDiv {
|
|
340
|
+
background-color: #ffffc7;
|
|
341
|
+
border: 1px solid #ddc;
|
|
342
|
+
box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);
|
|
343
|
+
color: #000;
|
|
344
|
+
display: none;
|
|
345
|
+
font: 9pt sans-serif;
|
|
346
|
+
opacity: .9;
|
|
347
|
+
padding: 2px;
|
|
348
|
+
position: absolute;
|
|
349
|
+
z-index: 100000; /* big value for bootstrap3 compatibility */
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.blocklyDropDownDiv {
|
|
353
|
+
position: absolute;
|
|
354
|
+
left: 0;
|
|
355
|
+
top: 0;
|
|
356
|
+
z-index: 1000;
|
|
357
|
+
display: none;
|
|
358
|
+
border: 1px solid;
|
|
359
|
+
border-color: #dadce0;
|
|
360
|
+
background-color: #fff;
|
|
361
|
+
border-radius: 2px;
|
|
362
|
+
padding: 4px;
|
|
363
|
+
box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.blocklyDropDownDiv.blocklyFocused {
|
|
367
|
+
box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.blocklyDropDownContent {
|
|
371
|
+
max-height: 300px; /* @todo: spec for maximum height. */
|
|
372
|
+
overflow: auto;
|
|
373
|
+
overflow-x: hidden;
|
|
374
|
+
position: relative;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.blocklyDropDownArrow {
|
|
378
|
+
position: absolute;
|
|
379
|
+
left: 0;
|
|
380
|
+
top: 0;
|
|
381
|
+
width: 16px;
|
|
382
|
+
height: 16px;
|
|
383
|
+
z-index: -1;
|
|
384
|
+
background-color: inherit;
|
|
385
|
+
border-color: inherit;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.blocklyDropDownButton {
|
|
389
|
+
display: inline-block;
|
|
390
|
+
float: left;
|
|
391
|
+
padding: 0;
|
|
392
|
+
margin: 4px;
|
|
393
|
+
border-radius: 4px;
|
|
394
|
+
outline: none;
|
|
395
|
+
border: 1px solid;
|
|
396
|
+
transition: box-shadow .1s;
|
|
397
|
+
cursor: pointer;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.blocklyArrowTop {
|
|
401
|
+
border-top: 1px solid;
|
|
402
|
+
border-left: 1px solid;
|
|
403
|
+
border-top-left-radius: 4px;
|
|
404
|
+
border-color: inherit;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.blocklyArrowBottom {
|
|
408
|
+
border-bottom: 1px solid;
|
|
409
|
+
border-right: 1px solid;
|
|
410
|
+
border-bottom-right-radius: 4px;
|
|
411
|
+
border-color: inherit;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.blocklyResizeSE {
|
|
415
|
+
cursor: se-resize;
|
|
416
|
+
fill: #aaa;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.blocklyResizeSW {
|
|
420
|
+
cursor: sw-resize;
|
|
421
|
+
fill: #aaa;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.blocklyResizeLine {
|
|
425
|
+
stroke: #515A5A;
|
|
426
|
+
stroke-width: 1;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.blocklyHighlightedConnectionPath {
|
|
430
|
+
fill: none;
|
|
431
|
+
stroke: #fc3;
|
|
432
|
+
stroke-width: 4px;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.blocklyPathLight {
|
|
436
|
+
fill: none;
|
|
437
|
+
stroke-linecap: round;
|
|
438
|
+
stroke-width: 1;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.blocklySelected>.blocklyPathLight {
|
|
442
|
+
display: none;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.blocklyDraggable {
|
|
446
|
+
cursor: grab;
|
|
447
|
+
cursor: -webkit-grab;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.blocklyDragging {
|
|
451
|
+
cursor: grabbing;
|
|
452
|
+
cursor: -webkit-grabbing;
|
|
453
|
+
/* Drag surface disables events to not block the toolbox, so we have to
|
|
454
|
+
* reenable them here for the cursor values to work. */
|
|
455
|
+
pointer-events: auto;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/* Changes cursor on mouse down. Not effective in Firefox because of
|
|
459
|
+
https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */
|
|
460
|
+
.blocklyDraggable:active {
|
|
461
|
+
cursor: grabbing;
|
|
462
|
+
cursor: -webkit-grabbing;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.blocklyDragging.blocklyDraggingDelete {
|
|
466
|
+
cursor: url("<<<PATH>>>/handdelete.cur"), auto;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.blocklyDragging>.blocklyPath,
|
|
470
|
+
.blocklyDragging>.blocklyPathLight {
|
|
471
|
+
fill-opacity: .8;
|
|
472
|
+
stroke-opacity: .8;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.blocklyDragging>.blocklyPathDark {
|
|
476
|
+
display: none;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.blocklyDisabled>.blocklyPath {
|
|
480
|
+
fill-opacity: .5;
|
|
481
|
+
stroke-opacity: .5;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.blocklyDisabled>.blocklyPathLight,
|
|
485
|
+
.blocklyDisabled>.blocklyPathDark {
|
|
486
|
+
display: none;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.blocklyInsertionMarker>.blocklyPath,
|
|
490
|
+
.blocklyInsertionMarker>.blocklyPathLight,
|
|
491
|
+
.blocklyInsertionMarker>.blocklyPathDark {
|
|
492
|
+
fill-opacity: .2;
|
|
493
|
+
stroke: none;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.blocklyNonEditableText>text {
|
|
497
|
+
pointer-events: none;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.blocklyFlyout {
|
|
501
|
+
position: absolute;
|
|
502
|
+
z-index: 20;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.blocklyText text {
|
|
506
|
+
cursor: default;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.blocklyHidden {
|
|
510
|
+
display: none;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.blocklyFieldDropdown:not(.blocklyHidden) {
|
|
514
|
+
display: block;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.blocklyIconGroup {
|
|
518
|
+
cursor: default;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.blocklyIconGroup:not(:hover),
|
|
522
|
+
.blocklyIconGroupReadonly {
|
|
523
|
+
opacity: .6;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.blocklyIconShape {
|
|
527
|
+
fill: #00f;
|
|
528
|
+
stroke: #fff;
|
|
529
|
+
stroke-width: 1px;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.blocklyIconSymbol {
|
|
533
|
+
fill: #fff;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.blocklyMinimalBody {
|
|
537
|
+
margin: 0;
|
|
538
|
+
padding: 0;
|
|
539
|
+
height: 100%;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.blocklyHtmlInput {
|
|
543
|
+
border: none;
|
|
544
|
+
border-radius: 4px;
|
|
545
|
+
height: 100%;
|
|
546
|
+
margin: 0;
|
|
547
|
+
outline: none;
|
|
548
|
+
padding: 0;
|
|
549
|
+
width: 100%;
|
|
550
|
+
text-align: center;
|
|
551
|
+
display: block;
|
|
552
|
+
box-sizing: border-box;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/* Remove the increase and decrease arrows on the field number editor */
|
|
556
|
+
input.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,
|
|
557
|
+
input.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {
|
|
558
|
+
-webkit-appearance: none;
|
|
559
|
+
margin: 0;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
input[type=number] {
|
|
563
|
+
-moz-appearance: textfield;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.blocklyMainBackground {
|
|
567
|
+
stroke-width: 1;
|
|
568
|
+
stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.blocklyMutatorBackground {
|
|
572
|
+
fill: #fff;
|
|
573
|
+
stroke: #ddd;
|
|
574
|
+
stroke-width: 1;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.blocklyFlyoutBackground {
|
|
578
|
+
fill: #ddd;
|
|
579
|
+
fill-opacity: .8;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.blocklyMainWorkspaceScrollbar {
|
|
583
|
+
z-index: 20;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.blocklyFlyoutScrollbar {
|
|
587
|
+
z-index: 30;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.blocklyScrollbarHorizontal,
|
|
591
|
+
.blocklyScrollbarVertical {
|
|
592
|
+
position: absolute;
|
|
593
|
+
outline: none;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.blocklyScrollbarBackground {
|
|
597
|
+
opacity: 0;
|
|
598
|
+
pointer-events: none;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.blocklyScrollbarHandle {
|
|
602
|
+
fill: #ccc;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
|
|
606
|
+
.blocklyScrollbarHandle:hover {
|
|
607
|
+
fill: #bbb;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/* Darken flyout scrollbars due to being on a grey background. */
|
|
611
|
+
/* By contrast, workspace scrollbars are on a white background. */
|
|
612
|
+
.blocklyFlyout .blocklyScrollbarHandle {
|
|
613
|
+
fill: #bbb;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
|
|
617
|
+
.blocklyFlyout .blocklyScrollbarHandle:hover {
|
|
618
|
+
fill: #aaa;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.blocklyInvalidInput {
|
|
622
|
+
background: #faa;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.blocklyVerticalMarker {
|
|
626
|
+
stroke-width: 3px;
|
|
627
|
+
fill: rgba(255,255,255,.5);
|
|
628
|
+
pointer-events: none;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.blocklyComputeCanvas {
|
|
632
|
+
position: absolute;
|
|
633
|
+
width: 0;
|
|
634
|
+
height: 0;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.blocklyNoPointerEvents {
|
|
638
|
+
pointer-events: none;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.blocklyContextMenu {
|
|
642
|
+
border-radius: 4px;
|
|
643
|
+
max-height: 100%;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.blocklyDropdownMenu {
|
|
647
|
+
border-radius: 2px;
|
|
648
|
+
padding: 0 !important;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
.blocklyDropdownMenu .blocklyMenuItem {
|
|
652
|
+
/* 28px on the left for icon or checkbox. */
|
|
653
|
+
padding-left: 28px;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/* BiDi override for the resting state. */
|
|
657
|
+
.blocklyDropdownMenu .blocklyMenuItemRtl {
|
|
658
|
+
/* Flip left/right padding for BiDi. */
|
|
659
|
+
padding-left: 5px;
|
|
660
|
+
padding-right: 28px;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
.blocklyWidgetDiv .blocklyMenu {
|
|
664
|
+
background: #fff;
|
|
665
|
+
border: 1px solid transparent;
|
|
666
|
+
box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
|
|
667
|
+
font: normal 13px Arial, sans-serif;
|
|
668
|
+
margin: 0;
|
|
669
|
+
outline: none;
|
|
670
|
+
padding: 4px 0;
|
|
671
|
+
position: absolute;
|
|
672
|
+
overflow-y: auto;
|
|
673
|
+
overflow-x: hidden;
|
|
674
|
+
max-height: 100%;
|
|
675
|
+
z-index: 20000; /* Arbitrary, but some apps depend on it... */
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.blocklyWidgetDiv .blocklyMenu.blocklyFocused {
|
|
679
|
+
box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.blocklyDropDownDiv .blocklyMenu {
|
|
683
|
+
background: inherit; /* Compatibility with gapi, reset from goog-menu */
|
|
684
|
+
border: inherit; /* Compatibility with gapi, reset from goog-menu */
|
|
685
|
+
font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
|
|
686
|
+
outline: none;
|
|
687
|
+
position: relative; /* Compatibility with gapi, reset from goog-menu */
|
|
688
|
+
z-index: 20000; /* Arbitrary, but some apps depend on it... */
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/* State: resting. */
|
|
692
|
+
.blocklyMenuItem {
|
|
693
|
+
border: none;
|
|
694
|
+
color: #000;
|
|
695
|
+
cursor: pointer;
|
|
696
|
+
list-style: none;
|
|
697
|
+
margin: 0;
|
|
698
|
+
/* 7em on the right for shortcut. */
|
|
699
|
+
min-width: 7em;
|
|
700
|
+
padding: 6px 15px;
|
|
701
|
+
white-space: nowrap;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/* State: disabled. */
|
|
705
|
+
.blocklyMenuItemDisabled {
|
|
706
|
+
color: #ccc;
|
|
707
|
+
cursor: inherit;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/* State: hover. */
|
|
711
|
+
.blocklyMenuItemHighlight {
|
|
712
|
+
background-color: rgba(0,0,0,.1);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/* State: selected/checked. */
|
|
716
|
+
.blocklyMenuItemCheckbox {
|
|
717
|
+
height: 16px;
|
|
718
|
+
position: absolute;
|
|
719
|
+
width: 16px;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
.blocklyMenuItemSelected .blocklyMenuItemCheckbox {
|
|
723
|
+
background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;
|
|
724
|
+
float: left;
|
|
725
|
+
margin-left: -24px;
|
|
726
|
+
position: static; /* Scroll with the menu. */
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.blocklyMenuItemRtl .blocklyMenuItemCheckbox {
|
|
730
|
+
float: right;
|
|
731
|
+
margin-right: -24px;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
.blocklyBlockDragSurface, .blocklyAnimationLayer {
|
|
735
|
+
position: absolute;
|
|
736
|
+
top: 0;
|
|
737
|
+
left: 0;
|
|
738
|
+
right: 0;
|
|
739
|
+
bottom: 0;
|
|
740
|
+
overflow: visible !important;
|
|
741
|
+
z-index: 80;
|
|
742
|
+
pointer-events: none;
|
|
743
|
+
}
|
|
744
|
+
`,Gh={};Gh.inject=Ht,Gh.register=Fe;var fe=class{constructor(e,t){this.x=e,this.y=t}clone(){return new fe(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 fe(e.x-t.x,e.y-t.y)}static sum(e,t){return new fe(e.x+t.x,e.y+t.y)}},Ir="http://www.w3.org/2000/svg",qs="http://www.w3.org/1999/xhtml",ls="http://www.w3.org/1999/xlink",_o;(function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE"})(_o||(_o={}));var xs=null,Vh=0,xl=null,Mt={HTML_NS:qs};Mt.NodeType=_o,Mt.SVG_NS=Ir,Mt.XLINK_NS=ls,Mt.addClass=Ie,Mt.createSvgElement=ee,Mt.getFastTextWidth=Mo,Mt.getFastTextWidthWithSizeString=Hs,Mt.getTextWidth=sr,Mt.hasClass=ai,Mt.insertAfter=Nt,Mt.measureFontMetrics=ho,Mt.removeClass=Be,Mt.removeClasses=Us,Mt.removeNode=Ze,Mt.setCssTransform=li,Mt.startTextWidthCache=co,Mt.stopTextWidthCache=uo;var V=class{constructor(e){this.tagName=e}toString(){return this.tagName}};V.ANIMATE=new V("animate"),V.CIRCLE=new V("circle"),V.CLIPPATH=new V("clipPath"),V.DEFS=new V("defs"),V.FECOMPOSITE=new V("feComposite"),V.FECOMPONENTTRANSFER=new V("feComponentTransfer"),V.FEFLOOD=new V("feFlood"),V.FEFUNCA=new V("feFuncA"),V.FEGAUSSIANBLUR=new V("feGaussianBlur"),V.FEPOINTLIGHT=new V("fePointLight"),V.FESPECULARLIGHTING=new V("feSpecularLighting"),V.FILTER=new V("filter"),V.FOREIGNOBJECT=new V("foreignObject"),V.G=new V("g"),V.IMAGE=new V("image"),V.LINE=new V("line"),V.PATH=new V("path"),V.PATTERN=new V("pattern"),V.POLYGON=new V("polygon"),V.RECT=new V("rect"),V.SVG=new V("svg"),V.TEXT=new V("text"),V.TSPAN=new V("tspan");var rt=class{constructor(e,t,o,n){this.top=e,this.bottom=t,this.left=o,this.right=n}clone(){return new rt(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 rt(e,e+o,n,n+t)}},Xe=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 Xe(Math.max(e.width,t.width),Math.max(e.height,t.height))}static min(e,t){return new Xe(Math.min(e.width,t.width),Math.min(e.height,t.height))}},dy={getSizeInternal:wf},zo={TEST_ONLY:dy};zo.getBorderBox=Mu,zo.getComputedStyle=Ws,zo.getContainerOffsetToScrollInto=Nu,zo.getPageOffset=No,zo.getSize=or,zo.getViewportPageOffset=Ou,zo.scrollIntoContainerView=Na;var hy=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,py=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,OS={XY_REGEX:hy,XY_STYLE_REGEX:py},yi={TEST_ONLY:OS};yi.getDocumentScroll=Pu,yi.getInjectionDivXY=La,yi.getRelativeXY=ir,yi.getViewportBBox=Lu,yi.screenToWsCoordinates=kf,yi.wsToScreenCoordinates=Cf;var kt=class{constructor(e,t,o,n,u){this.workspace=e,this.horizontal=t,this.oldHostMetrics=null,this.ratio=1,this.origin=new fe(0,0),this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0,this.containerVisible=this.isHandleVisible=!0,this.position=new fe(0,0),this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null,this.pair=o||!1,this.margin=u!==void 0?u:kt.DEFAULT_SCROLLBAR_MARGIN,e="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical"),n&&(e+=" "+n),this.outerSvg=ee(V.SVG,{class:e}),n=ee(V.G,{},this.outerSvg),this.svgBackground=ee(V.RECT,{class:"blocklyScrollbarBackground"},n),e=Math.floor((kt.scrollbarThickness-5)/2),this.svgHandle=ee(V.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"),Nt(this.outerSvg,this.workspace.getParentSvg()),this.setInitialThickness(),t?(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=K(this.svgBackground,"pointerdown",this,this.onMouseDownBar),this.onMouseDownHandleWrapper_=K(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){const e=kt.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(),G(this.onMouseDownBarWrapper_),G(this.onMouseDownHandleWrapper_),Ze(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,li(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&&kt.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-=kt.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&(t+=kt.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-kt.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-=kt.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-kt.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(),Y(),this.cleanUp(),we(e))e.stopPropagation();else{var t=be(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var o=La(this.svgHandle);o=this.horizontal?o.x:o.y;var n=this.handlePosition,u=.95*this.handleLength;t<=o?n-=u:t>=o+this.handleLength&&(n+=u),this.setHandlePosition(this.constrainHandlePosition(n)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),we(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=K(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=K(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(){Y(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&(G(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onMouseMoveWrapper_&&(G(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 fe(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}};kt.scrollbarThickness=Xb?25:15,kt.DEFAULT_SCROLLBAR_MARGIN=.5;var Dl={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},Kh={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:Al,DOMParser:Er,XMLSerializer:xr}=globalThis;Er&&(Dl=new Er),xr&&(Kh=new xr);var gy="https://developers.google.com/blockly/xml",MS=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,dn={NAME_SPACE:gy};dn.createElement=i.createElement$$module$build$src$core$utils$xml,dn.createTextNode=i.createTextNode$$module$build$src$core$utils$xml,dn.domToText=Ji,dn.injectDependencies=Sf,dn.textToDom=i.textToDom$$module$build$src$core$utils$xml;var Yh="categoryToolbox",my="flyoutToolbox",ze;(function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"})(ze||(ze={}));var fy={hasCategoriesInternal:Ef},Uo={};Uo.Position=ze,Uo.TEST_ONLY=fy,Uo.convertFlyoutDefToJsonArray=nr,Uo.convertToolboxDefToJson=Pa,Uo.hasCategories=Ba,Uo.isCategoryCollapsible=ja,Uo.parseToolboxTree=ju;var wo;(function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM"})(wo||(wo={}));var hn;(function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT"})(hn||(hn={}));var Ho;(function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"})(Ho||(Ho={}));var vi={};vi.bumpDirection=Ho,vi.bumpPositionRect=Ha,vi.getCornerOppositeToolbox=Ua,vi.getStartPositionRect=za,vi.horizontalPosition=hn,vi.verticalPosition=wo;var Jt={width:96,height:124,url:"sprites.png"},$y=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=ee(V.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:gt.ComponentWeight.ZOOM_CONTROLS_WEIGHT,capabilities:[gt.Capability.POSITIONABLE]}),this.initialized=!0}dispose(){this.workspace.getComponentManager().removeComponent("zoomControls"),this.svgGroup&&Ze(this.svgGroup);for(const e of this.boundEvents)G(e);this.boundEvents.length=0}getBoundingRectangle(){let e=this.SMALL_SPACING+2*this.HEIGHT;return this.zoomResetGroup&&(e+=this.LARGE_SPACING+this.HEIGHT),new rt(this.top,this.top+e,this.left,this.left+this.WIDTH)}position(e,t){if(this.initialized){var o=Ua(this.workspace,e),n=this.SMALL_SPACING+2*this.HEIGHT;if(this.zoomResetGroup&&(n+=this.LARGE_SPACING+this.HEIGHT),e=za(o,new Xe(this.WIDTH,n),this.MARGIN_HORIZONTAL,this.MARGIN_VERTICAL,e,this.workspace),o=o.vertical,t=Ha(e,this.MARGIN_VERTICAL,o===wo.TOP?Ho.DOWN:Ho.UP,t),o===wo.TOP){var u=this.SMALL_SPACING+this.HEIGHT,m;(m=this.zoomInGroup)==null||m.setAttribute("transform","translate(0, "+u+")"),this.zoomResetGroup&&this.zoomResetGroup.setAttribute("transform","translate(0, "+(u+this.LARGE_SPACING+this.HEIGHT)+")")}else{m=this.zoomResetGroup?this.LARGE_SPACING+this.HEIGHT:0;let L;(L=this.zoomInGroup)==null||L.setAttribute("transform","translate(0, "+m+")"),m=m+this.SMALL_SPACING+this.HEIGHT,(u=this.zoomOutGroup)==null||u.setAttribute("transform","translate(0, "+m+")")}this.top=t.top,this.left=t.left;var E;(E=this.svgGroup)==null||E.setAttribute("transform","translate("+this.left+","+this.top+")")}}createZoomOutSvg(e){this.zoomOutGroup=ee(V.G,{class:"blocklyZoom blocklyZoomOut"},this.svgGroup);const t=ee(V.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup);ee(V.RECT,{width:32,height:32},t),ee(V.IMAGE,{width:Jt.width,height:Jt.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup).setAttributeNS(ls,"xlink:href",this.workspace.options.pathToMedia+Jt.url),this.boundEvents.push(K(this.zoomOutGroup,"pointerdown",null,this.zoom.bind(this,-1)))}createZoomInSvg(e){this.zoomInGroup=ee(V.G,{class:"blocklyZoom blocklyZoomIn"},this.svgGroup);const t=ee(V.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup);ee(V.RECT,{width:32,height:32},t),ee(V.IMAGE,{width:Jt.width,height:Jt.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup).setAttributeNS(ls,"xlink:href",this.workspace.options.pathToMedia+Jt.url),this.boundEvents.push(K(this.zoomInGroup,"pointerdown",null,this.zoom.bind(this,1)))}zoom(e,t){this.workspace.markFocused(),this.workspace.zoomCenter(e),this.fireZoomEvent(),Y(),t.stopPropagation(),t.preventDefault()}createZoomResetSvg(e){this.zoomResetGroup=ee(V.G,{class:"blocklyZoom blocklyZoomReset"},this.svgGroup);const t=ee(V.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup);ee(V.RECT,{width:32,height:32},t),ee(V.IMAGE,{width:Jt.width,height:Jt.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup).setAttributeNS(ls,"xlink:href",this.workspace.options.pathToMedia+Jt.url),this.boundEvents.push(K(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(),Y(),e.stopPropagation(),e.preventDefault()}fireZoomEvent(){const e=new(oe(q.CLICK))(null,this.workspace.id,"zoom_controls");B(e)}};Fe(`
|
|
745
|
+
.blocklyZoom>image, .blocklyZoom>svg>image {
|
|
746
|
+
opacity: .4;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {
|
|
750
|
+
opacity: .6;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
.blocklyZoom>image:active, .blocklyZoom>svg>image:active {
|
|
754
|
+
opacity: .8;
|
|
755
|
+
}
|
|
756
|
+
`);var by=100,yy=75,vy=50,_y=25,NS={BLOCKS:vy,PROCEDURES:yy,VARIABLES:by,WORKSPACE_COMMENTS:_y},Jh={};Jh.register=rr,Jh.unregister=Df;var wy=class{constructor(){this.priority=_y}save(e){const t=[];for(const o of e.getTopComments())(e=qi(o,{addCoordinates:!0,saveIds:!0}))&&t.push(e);return t.length?t:null}load(e,t){for(const o of e)ar(o,t,{recordUndo:j()})}clear(e){for(const t of e.getTopComments())t.dispose()}};rr("workspaceComments",new wy);var Rl={};Rl.WorkspaceCommentSerializer=wy,Rl.append=ar,Rl.save=qi;var qh={};qh.register=Wa,qh.unregister=Af;var Ol=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=ar(e,t),Rf(n)}finally{i.enable$$module$build$src$core$events$utils()}return n?(k()&&B(new(oe(q.COMMENT_CREATE))(n)),i.setSelected$$module$build$src$core$common(n),n):null}};Ol.TYPE="workspace-comment",Wa(Ol.TYPE,new Ol);var Xh;Xh=28,i.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:Xh,connectingSnapRadius:Xh,currentConnectionPreference:8,bumpDelay:250},i.config$$module$build$src$core$config;var LS="aria-",PS="role",Ds;(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"})(Ds||(Ds={}));var Dt;(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"})(Dt||(Dt={}));var Dr={};Dr.Role=Ds,Dr.State=Dt,Dr.setRole=Lo,Dr.setState=Ot;var Zh=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&&Lo(t,this.roleName),this.element=t;for(let o=0,n;n=this.menuItems[o];o++)t.appendChild(n.createDom());return this.pointerMoveHandler=K(t,"pointermove",this,this.handlePointerMove,!0),this.clickHandler=K(t,"pointerup",this,this.handleClick,!0),this.pointerEnterHandler=K(t,"pointerenter",this,this.handlePointerEnter,!0),this.pointerLeaveHandler=K(t,"pointerleave",this,this.handlePointerLeave,!0),this.onKeyDownHandler=K(t,"keydown",this,this.handleKeyEvent),e.appendChild(t),t}getElement(){return this.element}focus(){const e=this.getElement();e&&(e.focus({preventScroll:!0}),Ie(e,"blocklyFocused"))}blur(){const e=this.getElement();e&&(e.blur(),Be(e,"blocklyFocused"))}setRole(e){this.roleName=e}dispose(){this.pointerMoveHandler&&(G(this.pointerMoveHandler),this.pointerMoveHandler=null),this.clickHandler&&(G(this.clickHandler),this.clickHandler=null),this.pointerEnterHandler&&(G(this.pointerEnterHandler),this.pointerEnterHandler=null),this.pointerLeaveHandler&&(G(this.pointerLeaveHandler),this.pointerLeaveHandler=null),this.onKeyDownHandler&&(G(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&&(Na(n,o),Ot(t,Dt.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 fe(e.clientX,e.clientY);if(1>fe.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=or(e);return t.height=e.scrollHeight,t}},Qh=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=y(),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&&Lo(e,this.roleName),Ot(e,Dt.SELECTED,this.checkable&&this.checked||!1),Ot(e,Dt.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?(Ie(t,"blocklyMenuItemHighlight"),Ie(t,"goog-menuitem-highlight")):(Be(t,"blocklyMenuItemHighlight"),Be(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)}},Ar="_TEMP_COLLAPSED_INPUT",Ml="_TEMP_COLLAPSED_FIELD",qt="MANUALLY_DISABLED",BS={COLLAPSED_FIELD_NAME:Ml,COLLAPSED_INPUT_NAME:Ar,MANUALLY_DISABLED:qt};(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 Nl=new Set,ep=new WeakSet,tp=new WeakMap,pn=null,sp=null,ky=0,Ll={};Ll.finishQueuedRenders=Is,Ll.queueRender=Fu,Ll.triggerQueuedRenders=po;var Cy=function(e,t){window.alert(e),t&&t()},Sy=function(e,t){t(window.confirm(e))},Ty=function(e,t,o){o(window.prompt(e,t))},Iy={confirmInternal:Pf},_i={TEST_ONLY:Iy};_i.alert=cr,_i.confirm=Va,_i.prompt=Ka,_i.setAlert=Lf,_i.setConfirm=Bf,_i.setPrompt=jf;var op,Ey;i.Msg$$module$build$src$core$msg=Object.create(null),op=function(e){Object.keys(e).forEach(function(t){i.Msg$$module$build$src$core$msg[t]=e[t]})},Ey={Msg:i.Msg$$module$build$src$core$msg,setLocale:op};var Rr=class extends un{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 Rr),t.varId=e.varId,t}},ip=class extends Rr{constructor(e){super(e),this.type=q.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 ip),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)}};a(he.EVENT,q.VAR_CREATE,ip);var Or=class{constructor(e,t,o,n){this.workspace=e,this.name=t,this.type=o||"",this.id=n||w()}getId(){return this.id}static compareByName(e,t){return e.name.localeCompare(t.name,void 0,{sensitivity:"base"})}},np="VARIABLE",rp="ijkmnopqrstuvwxyzabcdefgh",xy={generateUniqueNameInternal:zf},Pt={CATEGORY_NAME:np,TEST_ONLY:xy,VAR_LETTER_OPTIONS:rp};Pt.allDeveloperVariables=i.allDeveloperVariables$$module$build$src$core$variables,Pt.allUsedVarModels=i.allUsedVarModels$$module$build$src$core$variables,Pt.createVariableButtonHandler=Zi,Pt.flyoutCategory=Ya,Pt.flyoutCategoryBlocks=Gu,Pt.generateUniqueName=Vu,Pt.generateUniqueNameFromOptions=Ja,Pt.generateVariableFieldDom=ci,Pt.getAddedVariables=ur,Pt.getOrCreateVariablePackage=i.getOrCreateVariablePackage$$module$build$src$core$variables,Pt.getVariable=i.getVariable$$module$build$src$core$variables,Pt.nameUsedWithAnyType=Ku,Pt.nameUsedWithConflictingParam=Yu,Pt.promptName=qa,Pt.renameVariable=i.renameVariable$$module$build$src$core$variables;var gn=class extends Error{},Dy=class extends gn{constructor(e){super("Expected to find a 'type' property, defining the block type"),this.state=e}},Mr=class extends gn{constructor(e,t,o){super(`The block ${t.toDevString()} is missing a(n) ${e}
|
|
757
|
+
connection`),this.block=t,this.state=o}},Ay=class extends gn{constructor(e,t,o,n){super(`The block ${o.toDevString()} could not connect its
|
|
758
|
+
${t} to its parent, because: ${e}`),this.childBlock=o,this.childState=n}},Ry=class extends gn{constructor(e){super(`Encountered a real block which is defined as a child of a shadow
|
|
759
|
+
block. It is an invariant of Blockly that shadow blocks only have shadow
|
|
760
|
+
children`),this.state=e}},Oy=class extends gn{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}},wi={};wi.BadConnectionCheck=Ay,wi.DeserializationError=gn,wi.MissingBlockType=Dy,wi.MissingConnection=Mr,wi.RealChildOfShadow=Ry,wi.UnregisteredIcon=Oy;var My=class{constructor(){this.priority=vy}save(e){const t=[];for(const o of e.getTopBlocks(!1))(e=as(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)go(o,t,{recordUndo:j()})}clear(e){for(const t of e.getTopBlocks(!1))t.dispose(!1)}};rr("blocks",new My);var Nr={};Nr.BlockSerializer=My,Nr.append=go,Nr.appendInternal=Qi,Nr.save=as;var Tt=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};Tt.MUTATOR=new Tt("mutator"),Tt.WARNING=new Tt("warning"),Tt.COMMENT=new Tt("comment");var ki=class extends un{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 ki),t.blockId=e.blockId,t}},Ci=class extends ki{constructor(e,t,o,n,u){super(e),this.type=q.BLOCK_CHANGE,e&&(this.element=t,this.name=o||void 0,this.oldValue=n,this.newValue=u)}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 Ci),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(Tt.MUTATOR);switch(o&&en(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:qt);break;case"inline":t.setInputsInline(!!e);break;case"mutation":n=Ci.getExtraBlockState_(t),t.loadExtraState?t.loadExtraState(JSON.parse(e||"{}")):t.domToMutation&&t.domToMutation(i.textToDom$$module$build$src$core$utils$xml(e||"<mutation/>")),B(new Ci(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())?Vs(e):""}};a(he.EVENT,q.BLOCK_CHANGE,Ci);var Pl={};Pl.clamp=tn,Pl.toDegrees=c$,Pl.toRadians=Xa;var Bl=16,Ny=1,Ly=12,ap=16,jl=.25,lp=null,Si=null,mn="",fn="",tt,$n,Ti,cp=null,Wo=null,Py=null,up={getBoundsInfo:function(){const e=No(cp),t=or(cp);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 u=up.getBoundsInfo(),m=or(tt);return t+m.height<u.bottom?ad(e,t,u,m):n-m.height>u.top?ld(o,n,u,m):t+m.height<document.documentElement.clientHeight?ad(e,t,u,m):n-m.height>document.documentElement.clientTop?ld(o,n,u,m):d$(e,u,m)}},Wt={ANIMATION_TIME:jl,ARROW_HORIZONTAL_PADDING:Ly,ARROW_SIZE:Bl,BORDER_SIZE:Ny,PADDING_Y:ap,TEST_ONLY:up};Wt.clearContent=Za,Wt.createDom=Zu,Wt.getContentDiv=dr,Wt.getOwner=ed,Wt.getPositionX=hr,Wt.hide=el,Wt.hideIfOwner=Qa,Wt.hideWithoutAnimation=Gs,Wt.isVisible=cd,Wt.repositionForWindowResize=dd,Wt.setBoundsElement=Qu,Wt.setColour=td,Wt.show=rd,Wt.showPositionedByBlock=u$,Wt.showPositionedByField=sd;var Lr=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)}};Lr.LOCAL_MARKER="local_marker_1";var bn={};bn.commonWordPrefix=hd,bn.commonWordSuffix=pd,bn.isNumber=i.isNumber$$module$build$src$core$utils$string,bn.shortestStringLength=pr,bn.wrap=i.wrap$$module$build$src$core$utils$string;var Fl=void 0,Pr=!1,yn=!1,By=50,jy=0,Ii=0,dp=0,hp=0,fs=null,Br=null,pp=0,gp=10,Fy=10,zy=750,zl=5,It=null,cs={HOVER_MS:zy,LIMIT:By,MARGINS:zl,OFFSET_X:pp,OFFSET_Y:gp,RADIUS_OK:Fy};cs.bindMouseEvents=on,cs.block=yd,cs.createDom=fd,cs.dispose=bd,cs.getCustomTooltip=m$,cs.getDiv=$$,cs.getTooltipOfObject=sn,cs.hide=mo,cs.isVisible=f$,cs.setCustomTooltip=g$,cs.unbindMouseEvents=sl,cs.unblock=vd;var mp=.45,fp=.65,Uy={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"},$s={};$s.blend=di,$s.getHsvSaturation=_d,$s.getHsvValue=wd,$s.hexToRgb=ol,$s.hsvToHex=il,$s.hueToHex=kd,$s.names=Uy,$s.parse=ui,$s.rgbToHex=gr,$s.setHsvSaturation=C$,$s.setHsvValue=S$;var jr={};jr.checkMessageReferences=T$,jr.parseBlockColour=nn,jr.replaceMessageReferences=_t,jr.tokenizeInterpolation=Cd;var lt=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 Xe(0,0),e!==lt.SKIP_SETUP&&(o&&this.configure_(o),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(_t(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_=ee(V.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_=ee(V.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_=ee(V.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.");on(e),this.mouseDownWrapper=K(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(lt),e!==null?e:this.getValue()}loadState(e){this.loadLegacyState(lt,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||""),Ji(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(){Qa(this),pi(this);let e;(e=this.getSourceBlock())!=null&&e.isDeadOrDying()||Ze(this.fieldGroup_),this.disposed=!0}updateEditable(){const e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(Ie(e,"blocklyEditableText"),Be(e,"blocklyNonEditableText"),e.style.cursor=this.CURSOR):(Ie(e,"blocklyNonEditableText"),Be(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_!==lt.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,u=0;this.textElement_&&(u=Mo(this.textElement_,t.FIELD_TEXT_FONTSIZE,t.FIELD_TEXT_FONTWEIGHT,t.FIELD_TEXT_FONTFAMILY),o+=u),this.isFullBlockField()||(n=Math.max(n,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=n,this.size_.width=o,this.positionTextElement_(e,u),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var o=this.getConstants(),n=this.size_.height/2,u;this.textElement_.setAttribute("x",String((u=this.getSourceBlock())!=null&&u.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 Xe(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new Ct;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,ny?(e.x+=1.5*n,e.y+=1.5*n):(e.x-=.5*n,e.y-=.5*n)}else o=this.borderRect_.getBoundingClientRect(),e=No(this.borderRect_),t=o.width,o=o.height;return new rt(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,lt.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+=""),e):lt.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 se=this.doClassValidation_(e),Ce=this.processValidation(e,se,t);if(!(Ce instanceof Error)){var n,u=(n=this.getValidator())==null?void 0:n.call(this,Ce),m=this.processValidation(Ce,u,t);if(!(m instanceof Error)){var E=this.sourceBlock_;if(!E||!E.disposed){var L=this.getValue();L===m?this.doValueUpdate_(m):(this.doValueUpdate_(m),t&&E&&k()&&B(new(oe(q.BLOCK_CHANGE))(E,"field",this.name||null,L,m)),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 sn(e||{tooltip:this.tooltip})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return No(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null;const t=this.getSourceBlock();if(!t)throw new Ct;const o=t.inputList;for(let n=0;n<t.inputList.length;n++){const u=o[n],m=u.fieldRow;for(let E=0;E<m.length;E++)if(m[E]===this){e=u;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 Ct;e=e.workspace,e.keyboardAccessibilityMode&&this.cursorSvg&&e.getCursor().draw(),e.keyboardAccessibilityMode&&this.markerSvg&&e.getMarker(Lr.LOCAL_MARKER).draw()}static fromJson(e){throw Error("Attempted to instantiate a field from the registry that hasn't defined a 'fromJson' method.")}};lt.NBSP=" ",lt.SKIP_SETUP=Symbol("SKIP_SETUP");var Ct=class extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}},vn=null,$p=null,Ul=null,Hl="blocklyWidgetDiv",_n="",wn="",As,Rs={};Rs.createDom=Sd,Rs.getDiv=hi,Rs.hide=rn,Rs.hideIfOwner=pi,Rs.hideIfOwnerIsInWorkspace=mr,Rs.isVisible=Td,Rs.positionWithAnchor=Ed,Rs.repositionForWindowResize=xd,Rs.show=rl,Rs.testOnly_setDiv=I$;var Wl=null,Hy={},Gl=null,Ei={};Ei.callbackFactory=i.callbackFactory$$module$build$src$core$contextmenu,Ei.dispose=Ad,Ei.getCurrentBlock=A$,Ei.hide=$r,Ei.setCurrentBlock=Dd,Ei.show=fr;var He=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 u of this.registeredItems.values())if(e===u.scopeType){var n=u.preconditionFn(t);n!=="hidden"&&(n={text:typeof u.displayText=="function"?u.displayText(t):u.displayText,enabled:n==="enabled",callback:u.callback,scope:t,weight:u.weight},o.push(n))}return o.sort(function(u,m){return u.weight-m.weight}),o}};(function(e){var t=e.ScopeType||(e.ScopeType={});t.BLOCK="block",t.WORKSPACE="workspace",t.COMMENT="comment",e.registry=new e})(He||(He={})),He.ScopeType;var Go=50,Vl=100,jS={BLOCK:Go,BUBBLE:Vl},Wy=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,Go),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(oe(q.COMMENT_DRAG))(this.comment,!0);B(e)}fireDragEndEvent(){const e=new(oe(q.COMMENT_DRAG))(this.comment,!1);B(e)}fireMoveEvent(){if(!this.comment.isDeadOrDying()){var e=new(oe(q.COMMENT_MOVE))(this.comment);e.setReason(["drag"]),e.oldCoordinate_=this.startLoc,e.recordNew(),B(e)}}revertDrag(){this.startLoc&&this.comment.moveDuringDrag(this.startLoc)}},Gy=new WeakMap,Vy=class{constructor(e){this.workspace=e,this.size=new Xe(120,100),this.collapsed=!1,this.editable=!0,this.location=new fe(0,0),this.text="",this.textChangeListeners=[],this.sizeChangeListeners=[],this.disposeListeners=[],this.collapseChangeListeners=[],this.resizePointerMoveListener=this.resizePointerUpListener=null,this.disposed=this.disposing=!1,this.svgRoot=ee(V.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,Go),this.setSizeWithoutFiringEvents(this.size),this.moveTo(new fe(0,0))}createHighlightRect(e){return ee(V.RECT,{class:"blocklyCommentHighlight"},e)}createTopBar(e,t){e=ee(V.G,{class:"blocklyCommentTopbar"},e);const o=ee(V.RECT,{class:"blocklyCommentTopbarBackground"},e),n=ee(V.IMAGE,{class:"blocklyDeleteIcon",href:`${t.options.pathToMedia}delete-icon.svg`},e);t=ee(V.IMAGE,{class:"blocklyFoldoutIcon",href:`${t.options.pathToMedia}foldout-icon.svg`},e);const u=ee(V.TEXT,{class:"blocklyCommentPreview blocklyCommentText blocklyText"},e),m=document.createTextNode("");return u.appendChild(m),K(t,"pointerdown",this,this.onFoldoutDown),K(n,"pointerdown",this,this.onDeleteDown),{topBarGroup:e,topBarBackground:o,deleteIcon:n,foldoutIcon:t,textPreview:u,textPreviewNode:m}}createTextArea(e){e=ee(V.FOREIGNOBJECT,{class:"blocklyCommentForeignObject"},e);const t=document.createElementNS(qs,"body");t.setAttribute("xmlns",qs),t.className="blocklyMinimalBody";const o=document.createElementNS(qs,"textarea");return Ie(o,"blocklyCommentText"),Ie(o,"blocklyTextarea"),Ie(o,"blocklyText"),t.appendChild(o),e.appendChild(t),K(o,"change",this,this.onTextChange),{foreignObject:e,textArea:o}}createResizeHandle(e,t){return e=ee(V.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),K(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(),u=this.textPreview.getBBox(),m=this.resizeHandle.getBBox();this.size=e=Xe.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,u,o,m),this.updateResizeHandlePosition(e,m)}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=sr(this.textPreview);const u=this.calcFoldoutMargin(e,t),m=this.calcDeleteMargin(e,o);let E=n;return this.foldoutIcon.checkVisibility()?E+=t.width+2*u:n&&(E+=4),this.deleteIcon.checkVisibility()?E+=o.width+2*m:n&&(E+=4),new Xe(E,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,u){const m=(t.height-o.height)/2,E=this.calcDeleteMargin(t,n);t=this.calcFoldoutMargin(t,u),e=e.width-u.width-2*t-n.width-2*E,this.textPreview.setAttribute("x",`${u.width+2*t*(this.workspace.RTL?-1:1)}`),this.textPreview.setAttribute("y",`${m+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(),we(e)||(this.preResizeSize=this.getSize(),al(this.workspace,e,new fe(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=K(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=K(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation())}onResizePointerUp(e){Y(),this.resizePointerUpListener&&(G(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(G(this.resizePointerMoveListener),this.resizePointerMoveListener=null),this.setSize(this.size),this.preResizeSize=void 0}onResizePointerMove(e){e=ll(this.workspace,e),this.setSizeWithoutFiringEvents(new Xe(this.workspace.RTL?-e.x:e.x,e.y))}isCollapsed(){return this.collapsed}setCollapsed(e){(this.collapsed=e)?Ie(this.svgRoot,"blocklyCollapsed"):Be(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){Y(),this.bringToFront(),we(e)||(this.setCollapsed(!this.collapsed),this.workspace.hideChaff()),e.stopPropagation()}isEditable(){return this.editable}setEditable(e){(this.editable=e)?(Ie(this.svgRoot,"blocklyEditable"),Be(this.svgRoot,"blocklyReadonly"),this.textArea.removeAttribute("readonly")):(Be(this.svgRoot,"blocklyEditable"),Ie(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){Y(),we(e)||this.dispose(),e.stopPropagation()}dispose(){this.disposing=!0,Ze(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)}};Fe(`
|
|
761
|
+
.injectionDiv {
|
|
762
|
+
--commentFillColour: #FFFCC7;
|
|
763
|
+
--commentBorderColour: #F2E49B;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
.blocklyComment .blocklyTextarea {
|
|
767
|
+
background-color: var(--commentFillColour);
|
|
768
|
+
border: 1px solid var(--commentBorderColour);
|
|
769
|
+
box-sizing: border-box;
|
|
770
|
+
display: block;
|
|
771
|
+
outline: 0;
|
|
772
|
+
padding: 5px;
|
|
773
|
+
resize: none;
|
|
774
|
+
width: 100%;
|
|
775
|
+
height: 100%;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
.blocklyReadonly.blocklyComment .blocklyTextarea {
|
|
779
|
+
cursor: inherit;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
.blocklyDeleteIcon {
|
|
783
|
+
width: 20px;
|
|
784
|
+
height: 20px;
|
|
785
|
+
display: none;
|
|
786
|
+
cursor: pointer;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.blocklyFoldoutIcon {
|
|
790
|
+
width: 20px;
|
|
791
|
+
height: 20px;
|
|
792
|
+
transform-origin: 12px 12px;
|
|
793
|
+
cursor: pointer;
|
|
794
|
+
}
|
|
795
|
+
.blocklyResizeHandle {
|
|
796
|
+
width: 12px;
|
|
797
|
+
height: 12px;
|
|
798
|
+
cursor: se-resize;
|
|
799
|
+
}
|
|
800
|
+
.blocklyReadonly.blocklyComment .blocklyResizeHandle {
|
|
801
|
+
cursor: inherit;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
.blocklyCommentTopbarBackground {
|
|
805
|
+
fill: var(--commentBorderColour);
|
|
806
|
+
height: 24px;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
.blocklyComment .blocklyCommentPreview.blocklyText {
|
|
810
|
+
fill: #000;
|
|
811
|
+
dominant-baseline: middle;
|
|
812
|
+
visibility: hidden;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
.blocklyCollapsed.blocklyComment .blocklyCommentPreview {
|
|
816
|
+
visibility: visible;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
.blocklyCollapsed.blocklyComment .blocklyCommentForeignObject,
|
|
820
|
+
.blocklyCollapsed.blocklyComment .blocklyResizeHandle {
|
|
821
|
+
display: none;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
.blocklyCollapsed.blocklyComment .blocklyFoldoutIcon {
|
|
825
|
+
transform: rotate(-90deg);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.blocklyRTL .blocklyCommentTopbar {
|
|
829
|
+
transform: scale(-1, 1);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.blocklyRTL .blocklyCommentForeignObject {
|
|
833
|
+
direction: rtl;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.blocklyRTL .blocklyCommentPreview {
|
|
837
|
+
/* Revert the scale and control RTL using direction instead. */
|
|
838
|
+
transform: scale(-1, 1);
|
|
839
|
+
direction: rtl;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
.blocklyRTL .blocklyResizeHandle {
|
|
843
|
+
transform: scale(-1, 1);
|
|
844
|
+
cursor: sw-resize;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
.blocklyCommentHighlight {
|
|
848
|
+
fill: none;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.blocklySelected .blocklyCommentHighlight {
|
|
852
|
+
stroke: #fc3;
|
|
853
|
+
stroke-width: 3px;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
.blocklyCollapsed.blocklySelected .blocklyCommentHighlight {
|
|
857
|
+
stroke: none;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
.blocklyCollapsed.blocklySelected .blocklyCommentTopbarBackground {
|
|
861
|
+
stroke: #fc3;
|
|
862
|
+
stroke-width: 3px;
|
|
863
|
+
}
|
|
864
|
+
`);var Kl=class{constructor(e,t){this.workspace=e,this.text="",this.size=new Xe(120,100),this.collapsed=!1,this.deletable=this.movable=this.editable=!0,this.location=new fe(0,0),this.disposing=this.disposed=!1,this.id=t&&!e.getCommentById(t)?t:w(),e.addTopComment(this),this.fireCreateEvent()}fireCreateEvent(){k()&&B(new(oe(q.COMMENT_CREATE))(this))}fireDeleteEvent(){k()&&B(new(oe(q.COMMENT_DELETE))(this))}fireChangeEvent(e,t){k()&&B(new(oe(q.COMMENT_CHANGE))(this,e,t))}fireCollapseEvent(e){k()&&B(new(oe(q.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(oe(q.COMMENT_RESIZE))(this);this.size=e,t.recordCurrentSizeAsNewSize(),B(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(oe(q.COMMENT_MOVE))(this);t&&o.setReason(t),this.location=e,o.recordNew(),B(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}},Yl=class extends Kl{constructor(e,t){super(e,t),this.dragStrategy=new Wy(this),this.workspace=e,this.view=new Vy(e),this.view.setSize(this.getSize()),this.view.setEditable(this.isEditable()),this.view.getSvgRoot().setAttribute("data-id",this.id),this.addModelUpdateBindings(),K(this.view.getSvgRoot(),"pointerdown",this,this.startGesture),K(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 rt(e.y,e.y+n.height,t,o)}moveBy(e,t,o){const n=this.getRelativeToSurfaceXY();e=new fe(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?Ie(this.getSvgRoot(),"blocklyDragging"):Be(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($e(e))e.stopPropagation();else{t.handleCommentStart(e,this);let o;(o=this.workspace.getLayerManager())==null||o.append(this,Go)}i.setSelected$$module$build$src$core$common(this)}}setDeleteStyle(e){e?Ie(this.getSvgRoot(),"blocklyDraggingDelete"):Be(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(){Ie(this.getSvgRoot(),"blocklySelected")}unselect(){Be(this.getSvgRoot(),"blocklySelected")}toCopyData(){return{paster:Ol.TYPE,commentState:qi(this,{addCoordinates:!0})}}showContextMenu(e){const t=He.registry.getContextMenuOptions(He.ScopeType.COMMENT,{comment:this});fr(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"])}}}},Gt={};Gt.appendDomToWorkspace=z$,Gt.blockToDom=Po,Gt.blockToDomWithXY=yr,Gt.clearWorkspaceAndLoadFromXml=F$,Gt.deleteNext=q$,Gt.domToBlock=i.domToBlock$$module$build$src$core$xml,Gt.domToBlockInternal=gi,Gt.domToPrettyText=j$,Gt.domToText=Vs,Gt.domToVariables=Ld,Gt.domToWorkspace=i.domToWorkspace$$module$build$src$core$xml,Gt.loadWorkspaceComment=Nd,Gt.saveWorkspaceComment=br,Gt.variablesToDom=Od,Gt.workspaceToDom=L$;var bp=class extends ki{constructor(e){super(e),this.type=q.BLOCK_CREATE,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=yr(e),this.ids=ge(e),this.json=as(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=Vs(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 bp),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(!FS(t,this.ids))if(e)go(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)}}},FS=function(e,t){return t.map(o=>e.getBlockById(o)).filter(o=>o&&o.isShadow()).length===t.length};a(he.EVENT,q.BLOCK_CREATE,bp);var yp=class extends Es{constructor(e,t){super(t),this.type=q.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 yp),t.themeName=e.themeName,t}};a(he.EVENT,q.THEME_CHANGE,yp);var vp=class extends Es{constructor(e,t,o,n,u){super(n),this.type=q.VIEWPORT_CHANGE,this.viewTop=e,this.viewLeft=t,this.scale=o,this.oldScale=u}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 vp),t.viewTop=e.viewTop,t.viewLeft=e.viewLeft,t.scale=e.scale,t.oldScale=e.oldScale,t}};a(he.EVENT,q.VIEWPORT_CHANGE,vp);var Se;(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"})(Se||(Se={}));var kn=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(Ce){const dt=u-n[Ce].x,ut=m-n[Ce].y;return Math.sqrt(dt*dt+ut*ut)<=t&&se.push(n[Ce]),ut<t}const n=this.connections,u=e.x,m=e.y;e=0;let E=n.length-2,L=E;for(;e<L;)n[L].y<m?e=L:E=L,L=Math.floor((e+E)/2);const se=[];if(E=e=L,n.length){for(;0<=e&&o(e);)e--;do E++;while(E<n.length&&o(E))}return se}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,u=e.x;e.x=u+o.x,e.y=n+o.y;var m=this.calculateIndexForYPos(e.y);o=null;let E=t,L,se=m-1;for(;0<=se&&this.isInYRange(se,e.y,t);)L=this.connections[se],this.connectionChecker.canConnect(e,L,!0,E)&&(o=L,E=L.distanceFrom(e)),se--;for(;m<this.connections.length&&this.isInYRange(m,e.y,t);)L=this.connections[m],this.connectionChecker.canConnect(e,L,!0,E)&&(o=L,E=L.distanceFrom(e)),m++;return e.x=u,e.y=n,{connection:o,radius:E}}static init(e){const t=[];return t[Se.INPUT_VALUE]=new kn(e),t[Se.OUTPUT_VALUE]=new kn(e),t[Se.NEXT_STATEMENT]=new kn(e),t[Se.PREVIOUS_STATEMENT]=new kn(e),t}},Jl=null,Fr=null,zr={};zr.connectionUiEffect=dl,zr.disconnectUiEffect=Fd,zr.disconnectUiStop=an,zr.disposeUiEffect=ul;var Ky=class{constructor(e){this.workspace=e,this.horizontalScrollEnabled=this.workspace.isMovableHorizontally(),this.verticalScrollEnabled=this.workspace.isMovableVertically(),this.startScrollXY_=new fe(e.scrollX,e.scrollY)}dispose(){this.workspace=null}startDrag(){ke()&&ke().unselect()}endDrag(e){this.drag(e)}drag(e){if(e=fe.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.")}},zS=5,US=6,ko=class{constructor(e,t){this.creatorWorkspace=t,this.mouseDownXY=new fe(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 fe(0,0)}dispose(){Y(),vd(),this.creatorWorkspace.clearGesture();for(const e of this.boundEvents)G(e);this.boundEvents.length=0,this.workspaceDragger&&this.workspaceDragger.dispose()}updateFromEvent(e){const t=new fe(e.clientX,e.clientY);this.updateDragDelta(t)&&(this.updateIsDragging(e),te()),this.mostRecentEvent=e}updateDragDelta(e){return this.currentDragDeltaXY=fe.difference(e,this.mouseDownXY),this.hasExceededDragRadius?!1:this.hasExceededDragRadius=fe.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 ' +
|
|
865
|
+
'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 Ky(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=ke();t&&mi(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(v(he.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,$e(e)?this.cancel():(this.gestureHasStarted=!0,an(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=ed(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,yd(),we(e)?this.handleRightClick(e):(e.type.toLowerCase()==="pointerdown"&&e.pointerType!=="mouse"&&S(e,this),this.mouseDownXY=new fe(e.clientX,e.clientY),this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(K(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(K(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(K(document,"pointerup",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&te())}handleMove(e){this.isDragging()&&O(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),te())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!O(e))return;if(this.updateFromEvent(e),te(),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=A(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=fe.distance(t,o),this.multiTouch=!0,e.preventDefault())}handleTouchMove(e){const t=A(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=fe.distance(o,t)/this.startDistance,0<this.previousScale&&1/0>this.previousScale){if(t=o-this.previousScale,t=0<t?t*zS:t*US,!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");const n=this.startWorkspace_,u=be(e,n.getParentSvg(),n.getInverseScreenCTM());n.zoom(u.x,u.y,t)}this.previousScale=o,e.preventDefault()}handleTouchEnd(e){e=A(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 fe(e.pageX,e.pageY):null}isMultiTouch(){return this.multiTouch}cancel(){this.isEnding_||(te(),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){B(new(oe(q.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(oe(q.CLICK))(this.startBlock,this.startWorkspace_.id,"block"),B(e)}this.bringBlockToFront(),i.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){e=this.creatorWorkspace,ke()&&ke().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=F();for(let t=0,o;o=e[t];t++)if(o.currentGesture_)return!0;return!1}},_p=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 u;this.snapToGrid=(u=t.snap)!=null?u:!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,u,m){e&&(e.setAttribute("stroke-width",`${t}`),e.setAttribute("x1",`${o}`),e.setAttribute("y1",`${u}`),e.setAttribute("x2",`${n}`),e.setAttribute("y2",`${m}`))}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 fe(n,t)}static createDom(e,t,o){e=ee(V.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},o);let n,u;if(0<((n=t.length)!=null?n:1)&&0<((u=t.spacing)!=null?u:0)){ee(V.LINE,{stroke:t.colour},e);let m;(m=t.length)!=null&&m&&ee(V.LINE,{stroke:t.colour},e)}else ee(V.LINE,{},e);return e}},HS=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(Go),Ie(e,"blocklyBlockCanvas"),e=this.createLayer(Vl),Ie(e,"blocklyBubbleCanvas")}createDragLayer(e){const t=ee(V.SVG,{class:"blocklyBlockDragSurface",xmlns:Ir,"xmlns:html":qs,"xmlns:xlink":ls,version:"1.1"});return e.append(t),ee(V.G,{},t)}createAnimationLayer(e){const t=ee(V.SVG,{class:"blocklyAnimationLayer",xmlns:Ir,"xmlns:html":qs,"xmlns:xlink":ls,version:"1.1"});return e.append(t),ee(V.G,{},t)}appendToAnimationLayer(e){let t;const o=(t=this.dragLayer)==null?void 0:t.getAttribute("transform");if(o){let u;(u=this.animationLayer)==null||u.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=ee(V.G,{});let n=!1;const u=[...this.layers].sort((m,E)=>m[0]-E[0]);for(const[m,E]of u)if(e<m){t.insertBefore(o,E),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(Go)}getBubbleLayer(){return this.layers.get(Vl)}},Yy={};Yy.deepMerge=fo;var xi=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),a(he.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 xi(e);let n=t.base;if(n){if(typeof n=="string"){let u;n=(u=f(he.THEME,n))!=null?u:void 0}n instanceof xi&&(fo(o,n),o.name=e)}return fo(o.blockStyles,t.blockStyles),fo(o.categoryStyles,t.categoryStyles),fo(o.componentStyles,t.componentStyles),fo(o.fontStyle,t.fontStyle),t.startHats!==null&&(o.startHats=t.startHats),o}},WS={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"}},GS={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"}},ql=new xi("classic",WS,GS),bs=class{constructor(e){this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let t=null,o=!1;var n=!1,u=!1,m=!1,E=!1,L=!1;const se=!!e.readOnly;if(!se){var Ce;t=Pa((Ce=e.toolbox)!=null?Ce:null),o=Ba(t),n=e.trashcan,n=n===void 0?o:n,u=e.collapse,u=u===void 0?o:u,m=e.comments,m=m===void 0?o:m,E=e.disable,E=E===void 0?o:E,L=e.sounds,L=L===void 0?!0:L}Ce=e.maxTrashcanContents,n?Ce===void 0&&(Ce=32):Ce=0;const dt=!!e.rtl;let ut=e.horizontalLayout;ut===void 0&&(ut=!1);var ns=e.toolboxPosition!=="end";ns=ut?ns?ze.TOP:ze.BOTTOM:ns===dt?ze.RIGHT:ze.LEFT;let On=e.css;On===void 0&&(On=!0);let ea="https://blockly-demo.appspot.com/static/media/";e.media&&(ea=e.media.endsWith("/")?e.media:e.media+"/");const C_=e.oneBasedIndex,_T=e.renderer||"geras",wT=e.plugins||{};let gg=e.modalInputs;gg===void 0&&(gg=!0),this.RTL=dt,this.oneBasedIndex=C_===void 0?!0:C_,this.collapse=u,this.comments=m,this.disable=E,this.readOnly=se,this.maxBlocks=e.maxBlocks||1/0;let S_;this.maxInstances=(S_=e.maxInstances)!=null?S_:null,this.modalInputs=gg,this.pathToMedia=ea,this.hasCategories=o,this.moveOptions=bs.parseMoveOptions(e,o),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=n,this.maxTrashcanContents=Ce,this.hasSounds=L,this.hasCss=On,this.horizontalLayout=ut,this.languageTree=t,this.gridOptions=bs.parseGridOptions(e),this.zoomOptions=bs.parseZoomOptions(e),this.toolboxPosition=ns,this.theme=bs.parseThemeOptions(e),this.renderer=_T;let T_;this.rendererOverrides=(T_=e.rendererOverrides)!=null?T_:null;let I_;this.parentWorkspace=(I_=e.parentWorkspace)!=null?I_:null,this.plugins=wT}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||ql,typeof e=="string"?f(he.THEME,e):e instanceof xi?e:xi.defineTheme(e.name||"builtin"+y(),e)}},Jy={fromJsonInternal:Z$},Xl={TEST_ONLY:Jy};Xl.fromJson=i.fromJson$$module$build$src$core$field_registry,Xl.register=Ks,Xl.unregister=X$;var is=class extends lt{constructor(e,t,o){super(lt.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!==lt.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(is,e)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement=ee(V.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&Ie(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=ee(V.TSPAN,{},this.textElement_);let e;this.arrow.appendChild(document.createTextNode((e=this.getSourceBlock())!=null&&e.RTL?is.ARROW_CHAR+" ":" "+is.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=ee(V.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow.setAttributeNS(ls,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(e){var t=this.getSourceBlock();if(!t)throw new Ct;this.dropdownCreate(),this.menu_.openingCoords=e&&typeof e.clientX=="number"?new fe(e.clientX,e.clientY):null,Za(),e=this.menu_.render(dr()),Ie(e,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(t=t.getColour(),e=this.sourceBlock_.getColourTertiary(),td(t,e)),sd(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem&&(this.menu_.setHighlighted(this.selectedMenuItem),Na(this.selectedMenuItem.getElement(),dr(),!0)),this.applyColour()}dropdownCreate(){const e=this.getSourceBlock();if(!e)throw new Ct;const t=new Zh;t.setRole(Ds.LISTBOX),this.menu_=t;const o=this.getOptions(!1);this.selectedMenuItem=null;for(let u=0;u<o.length;u++){const[m,E]=o[u];if(typeof m=="object"){var n=new Image(m.width,m.height);n.src=m.src,n.alt=m.alt||""}else n=m;n=new Qh(n,E),n.setRole(Ds.OPTION),n.setRightToLeft(e.RTL),n.setCheckable(!0),t.addChild(n),n.setChecked(E===this.value_),E===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){Qa(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 Ct;this.imageElement.style.display="",this.imageElement.setAttributeNS(ls,"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 u=Math.max(n?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,o+is.IMAGE_Y_PADDING);n=n?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let m;m=this.svgArrow?this.positionSVGArrow(e+n,u/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):Mo(this.arrow,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY),this.size_.width=e+m+2*n,this.size_.height=u;let E=0;t.RTL?this.imageElement.setAttribute("x",`${n+m}`):(E=e+m,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x",`${n}`)),this.imageElement.setAttribute("y",String(u/2-o/2)),this.positionTextElement_(E+n,e+m)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();Ie(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=Mo(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 Ct;const n=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,u=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,m=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(o.RTL?n:e+u)+","+t+")"),m+u}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(([E,L])=>typeof E=="string"?[_t(E),L]:(t=!0,[E.alt!==null?Object.assign({},E,{alt:_t(E.alt)}):Object.assign({},E),L]));if(t||2>e.length)return{options:o};var n=o.map(([E])=>E),u=pr(n);e=hd(n,u);const m=pd(n,u);return!e&&!m||u<=e+m?{options:o}:(u=e?n[0].substring(0,e-1):void 0,n=m?n[0].substr(1-m):void 0,{options:this.applyTrim(o,e,m),prefix:u,suffix:n})}applyTrim(e,t,o){return e.map(([n,u])=>[n.substring(t,n.length-o),u])}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.
|
|
866
|
+
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
|
|
867
|
+
label or image description. Found ${n[0]} in: ${n}`)):(t=!0,console.error(`Invalid option[${o}]: Each FieldDropdown option must be an array.
|
|
868
|
+
Found: ${n}`))}if(t)throw TypeError("Found invalid FieldDropdown options.")}};is.CHECKMARK_OVERHANG=25,is.MAX_MENU_HEIGHT_VH=.45,is.ARROW_CHAR="▾",is.IMAGE_Y_OFFSET=5,is.IMAGE_Y_PADDING=2*is.IMAGE_Y_OFFSET,Ks("field_dropdown",is);var qy=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,Vl),this.bubble.setDragging(!1)}revertDrag(){this.startLoc&&this.bubble.moveDuringDrag(this.startLoc)}},us,it=class{constructor(e,t,o){this.workspace=e,this.anchor=t,this.ownerRect=o,this.size=new Xe(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.dragStrategy=new qy(this,this.workspace),this.id=y(),this.svgRoot=ee(V.G,{class:"blocklyBubble"},e.getBubbleCanvas()),e=ee(V.G,{filter:`url(#${this.workspace.getRenderer().getConstants().embossFilterId})`},this.svgRoot),this.tail=ee(V.PATH,{class:"blocklyBubbleTail"},e),this.background=ee(V.RECT,{class:"blocklyDraggable",x:0,y:0,rx:us.BORDER_WIDTH,ry:us.BORDER_WIDTH},e),this.contentContainer=ee(V.G,{},this.svgRoot),K(this.background,"pointerdown",this,this.onMouseDown)}dispose(){Ze(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,us.MIN_SIZE),e.height=Math.max(e.height,us.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 rt(0,0,0,0)){var t=this.workspace.getMetricsManager().getViewMetrics(!0),o=this.getOptimalRelativeLeft(t),n=this.getOptimalRelativeTop(t);const u={x:o,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},m={x:-this.size.width-30,y:n};n={x:e.getWidth(),y:n};var E={x:o,y:e.getHeight()};o=e.getWidth()<e.getHeight()?n:E,e=e.getWidth()<e.getHeight()?E:n,n=this.getOverlap(u,t),E=this.getOverlap(m,t);const L=this.getOverlap(o,t);t=this.getOverlap(e,t),t=Math.max(n,E,L,t),n===t?(this.relativeLeft=u.x,this.relativeTop=u.y):E===t?(this.relativeLeft=m.x,this.relativeTop=m.y):L===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 rt(t,o,n,e)}getScrollbarThickness(){return kt.scrollbarThickness/this.workspace.scale}renderTail(){const e=[];var t=this.size.width/2,o=this.size.height/2,n=-this.relativeLeft,u=-this.relativeTop;if(t===n&&o===u)e.push("M "+t+","+o);else{u-=o,n-=t,this.workspace.RTL&&(n*=-1);var m=Math.sqrt(u*u+n*n),E=Math.acos(n/m);0>u&&(E=2*Math.PI-E);var L=E+Math.PI/2;L>2*Math.PI&&(L-=2*Math.PI);var se=Math.sin(L);const dt=Math.cos(L);let ut=(this.size.width+this.size.height)/us.TAIL_THICKNESS;ut=Math.min(ut,this.size.width,this.size.height)/4,L=1-us.ANCHOR_RADIUS/m,n=t+L*n,u=o+L*u,L=t+ut*dt;const ns=o+ut*se;t-=ut*dt,o-=ut*se,se=Xa(this.workspace.RTL?-us.TAIL_ANGLE:us.TAIL_ANGLE),se=E+se,se>2*Math.PI&&(se-=2*Math.PI),E=Math.sin(se)*m/us.TAIL_BEND,m=Math.cos(se)*m/us.TAIL_BEND,e.push("M"+L+","+ns),e.push("C"+(L+m)+","+(ns+E)+" "+n+","+u+" "+n+","+u),e.push("C"+n+","+u+" "+(t+m)+","+(o+E)+" "+t+","+o)}e.push("z");let Ce;(Ce=this.tail)==null||Ce.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 fe(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(){}};us=it,it.BORDER_WIDTH=6,it.DOUBLE_BORDER=2*us.BORDER_WIDTH,it.MIN_SIZE=us.DOUBLE_BORDER,it.TAIL_THICKNESS=1,it.TAIL_ANGLE=20,it.TAIL_BEND=4,it.ANCHOR_RADIUS=8;var Co=class extends it{constructor(e,t,o,n){super(t,o,n),this.workspace=t,this.anchor=o,this.ownerRect=n,this.autoLayout=!0,t=new bs(e),this.validateWorkspaceOptions(t),this.svgDialog=ee(V.SVG,{x:it.BORDER_WIDTH,y:it.BORDER_WIDTH},this.contentContainer),e.parentWorkspace=this.workspace,this.miniWorkspace=this.newWorkspaceSvg(new bs(e)),this.miniWorkspace.internalIsMutator=!0,e=this.miniWorkspace.createDom("blocklyMutatorBackground"),this.svgDialog.appendChild(e),t.languageTree&&(e.insertBefore(this.miniWorkspace.addFlyout(V.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 u,m;(u=this.miniWorkspace.getFlyout())==null||(m=u.getWorkspace())==null||m.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)<Co.MINIMUM_VIEW_CHANGE&&Math.abs(e.height-t.height)<Co.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 Xe(t.width+it.DOUBLE_BORDER,t.height+it.DOUBLE_BORDER),this.autoLayout),this.miniWorkspace.resize(),this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var e=this.miniWorkspace.getCanvas().getBBox();let t=e.width+Co.MARGIN;e=e.height+Co.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 Xe(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")}};Co.MINIMUM_VIEW_CHANGE=10,Co.MARGIN=3*it.DOUBLE_BORDER;var Zl=class{constructor(e){this.sourceBlock=e,this.offsetInBlock=new fe(0,0),this.workspaceLocation=new fe(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=ee(V.G,{class:"blocklyIconGroup"}),t.getSvgRoot().appendChild(this.svgRoot),this.updateSvgRootOffset(),K(this.svgRoot,"pointerdown",this,e),this.svgRoot.tooltip=this,on(this.svgRoot)}}dispose(){sl(this.svgRoot),Ze(this.svgRoot)}getWeight(){return-1}getSize(){return new Xe(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",en(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=fe.sum(e,this.offsetInBlock)}onClick(){}isClickableInFlyout(e){return!0}},Ql,ec;Ql=17,ec=16,i.MutatorIcon$$module$build$src$core$icons$mutator_icon=class extends Zl{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),ee(V.RECT,{class:"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},this.svgRoot),ee(V.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),ee(V.CIRCLE,{class:"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},this.svgRoot),Ie(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 Xe(Ql,Ql)}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 de.asyncExecutePromiseGeneratorFunction(function*(){if(t.bubbleIsVisible()!==e){if(yield Is(),e){t.miniWorkspaceBubble=new Co(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}B(new(oe(q.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=Ql/2;return fe.sum(this.workspaceLocation,new fe(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new rt(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,u;e=(u=(t=this.miniWorkspaceBubble)==null||(o=t.getWorkspace())==null||(n=o.getFlyout())==null?void 0:n.getWidth())!=null?u:0,this.rootBlock.moveBy(this.rootBlock.RTL?-(e+ec):ec,ec)}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||$(e)||T(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=Ci.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var o=Ci.getExtraBlockState_(this.sourceBlock);t!==o&&B(new(oe(q.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=Tt.MUTATOR,i.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1,i.MutatorIcon$$module$build$src$core$icons$mutator_icon;var Cn=Object.create(null),VS={allExtensions:Cn};i.register$$module$build$src$core$extensions("parent_tooltip_when_inline",rb);var Os={TEST_ONLY:VS};Os.apply=hl,Os.buildTooltipForDropdown=i.buildTooltipForDropdown$$module$build$src$core$extensions,Os.buildTooltipWithFieldText=i.buildTooltipWithFieldText$$module$build$src$core$extensions,Os.isRegistered=Ud,Os.register=i.register$$module$build$src$core$extensions,Os.registerMixin=i.registerMixin$$module$build$src$core$extensions,Os.registerMutator=i.registerMutator$$module$build$src$core$extensions,Os.runAfterPageLoad=ib,Os.unregister=Q$;var Ve;(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"})(Ve||(Ve={}));var So={};So.arc=wt,So.curve=ss,So.line=ln,So.lineOnAxis=Te,So.lineTo=Ys,So.moveBy=pt,So.moveTo=xt,So.point=De;var yt={};yt.Coordinate=fe,yt.KeyCodes=Ve,yt.Rect=rt,yt.Size=Xe,yt.Svg=V,yt.aria=Dr,yt.array=uy,yt.browserEvents=yo,yt.colour=$s,yt.deprecation=Hb,yt.dom=Mt,yt.extensions=Os,yt.idGenerator=Mh,yt.math=Pl,yt.object=Yy,yt.parsing=jr,yt.string=bn,yt.style=zo,yt.svgMath=yi,yt.svgPaths=So,yt.toolbox=Uo,yt.userAgent=RS,yt.xml=dn;var Xy=class extends it{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 Xe(160+it.DOUBLE_BORDER,80+it.DOUBLE_BORDER),this.MIN_SIZE=new Xe(45+it.DOUBLE_BORDER,20+it.DOUBLE_BORDER),this.editable=!0,Ie(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=ee(V.FOREIGNOBJECT,{x:it.BORDER_WIDTH,y:it.BORDER_WIDTH},e);const t=document.createElementNS(qs,"body");t.setAttribute("xmlns",qs),t.className="blocklyMinimalBody";const o=document.createElementNS(qs,"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){K(e,"wheel",this,t=>{t.stopPropagation()}),K(e,"focus",this,this.onStartEdit,!0),K(e,"change",this,this.onTextChange)}createResizeHandle(e,t){return e=ee(V.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),K(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-it.DOUBLE_BORDER,n=e.height-it.DOUBLE_BORDER;this.inputRoot.setAttribute("width",`${o}`),this.inputRoot.setAttribute("height",`${n}`),this.resizeGroup.setAttribute("y",`${n}`),this.workspace.RTL?this.resizeGroup.setAttribute("x",`${-it.DOUBLE_BORDER}`):this.resizeGroup.setAttribute("x",`${o}`),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}onResizePointerDown(e){this.bringToFront(),we(e)||(al(this.workspace,e,new fe(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=K(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=K(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){Y(),this.resizePointerUpListener&&(G(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(G(this.resizePointerMoveListener),this.resizePointerMoveListener=null)}onResizePointerMove(e){e=ll(this.workspace,e),this.setSize(new Xe(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()}};Fe(`
|
|
869
|
+
.blocklyTextInputBubble .blocklyTextarea {
|
|
870
|
+
background-color: var(--commentFillColour);
|
|
871
|
+
border: 0;
|
|
872
|
+
box-sizing: border-box;
|
|
873
|
+
display: block;
|
|
874
|
+
outline: 0;
|
|
875
|
+
padding: 5px;
|
|
876
|
+
resize: none;
|
|
877
|
+
width: 100%;
|
|
878
|
+
height: 100%;
|
|
879
|
+
}
|
|
880
|
+
`);var wp={};wp.register=Gd,wp.unregister=ab;var kp=17,Zy=160,Qy=80,To=class extends Zl{constructor(e){super(e),this.sourceBlock=e,this.textInputBubble=null,this.text="",this.bubbleSize=new Xe(Zy,Qy),this.bubbleVisiblity=!1}getType(){return To.TYPE}initView(e){this.svgRoot||(super.initView(e),ee(V.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),ee(V.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),ee(V.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),Ie(this.svgRoot,"blockly-icon-comment"))}dispose(){super.dispose();let e;(e=this.textInputBubble)==null||e.dispose()}getWeight(){return To.WEIGHT}getSize(){return new Xe(kp,kp)}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 de.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;B(new(oe(q.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 Xe((o=e.width)!=null?o:Zy,(n=e.height)!=null?n:Qy);let u;this.bubbleVisiblity=(u=e.pinned)!=null?u:!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&&(B(new(oe(q.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 de.asyncExecutePromiseGeneratorFunction(function*(){t.bubbleVisiblity!==e&&(t.bubbleVisiblity=e,yield Is(),!t.sourceBlock.rendered||t.sourceBlock.isInFlyout||t.sourceBlock.isInsertionMarker()||(e?(t.sourceBlock.isEditable()?t.showEditableBubble():t.showNonEditableBubble(),t.applyColour()):t.hideBubble(),B(new(oe(q.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 Xy(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=kp/2;return fe.sum(this.workspaceLocation,new fe(e,e))}getBubbleOwnerRect(){return this.sourceBlock.getBoundingRectangleWithoutChildren()}};To.TYPE=Tt.COMMENT,To.WEIGHT=3,Gd(To.TYPE,To);var ev=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=ev;var sv=class extends it{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,Ze(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 ee(V.G,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",transform:`translate(0,${it.BORDER_WIDTH})`,style:`direction: ${this.workspace.RTL?"rtl":"ltr"}`},e)}createTextFragments(e,t){let o=1;return t.split(`
|
|
881
|
+
`).map(n=>{const u=ee(V.TEXT,{y:`${o}em`,x:it.BORDER_WIDTH},e);return n=document.createTextNode(n),u.appendChild(n),o+=1,u})}rightAlignTextFragments(e,t){for(const o of t)o.setAttribute("text-anchor","start"),o.setAttribute("x",`${e+it.BORDER_WIDTH}`)}updateBubbleSize(){const e=this.paragraph.getBBox();this.setSize(new Xe(e.width+2*it.BORDER_WIDTH,e.height+2*it.BORDER_WIDTH),!0)}},Cp=17,Io=class extends Zl{constructor(e){super(e),this.sourceBlock=e,this.textMap=new Map,this.textBubble=null}getType(){return Io.TYPE}initView(e){this.svgRoot||(super.initView(e),ee(V.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),ee(V.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),ee(V.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot),Ie(this.svgRoot,"blockly-icon-warning"))}dispose(){super.dispose();let e;(e=this.textBubble)==null||e.dispose()}getWeight(){return Io.WEIGHT}getSize(){return new Xe(Cp,Cp)}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(`
|
|
882
|
+
`)}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.textBubble}setBubbleVisible(e){const t=this;return de.asyncExecutePromiseGeneratorFunction(function*(){if(t.bubbleIsVisible()!==e){if(yield Is(),e)t.textBubble=new sv(t.getText(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour();else{let o;(o=t.textBubble)==null||o.dispose(),t.textBubble=null}B(new(oe(q.BUBBLE_OPEN))(t.sourceBlock,e,"warning"))}})}getAnchorLocation(){const e=Cp/2;return fe.sum(this.workspaceLocation,new fe(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new rt(e.y,e.y+e.height,e.x,e.x+e.width)}};Io.TYPE=Tt.WARNING,Io.WEIGHT=2;var Vo={};Vo.CommentIcon=To,Vo.Icon=Zl,Vo.IconType=Tt,Vo.MutatorIcon=i.MutatorIcon$$module$build$src$core$icons$mutator_icon,Vo.WarningIcon=Io,Vo.exceptions=tv,Vo.registry=wp,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:
|
|
883
|
+
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 u=this.db.get(t);return u.has(e)?n+u.get(e):(t=this.getDistinctName(o,t),u.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,u;for(;this.dbReverse.has(e+((n=o)!=null?n:""))||this.reservedWords.has(e+((u=o)!=null?u:""));)o=o?o+1:2;let m;return e+=(m=o)!=null?m:"",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 ov=class extends Map{constructor(){super()}set(e,t){return this.get(e)===t?this:(super.set(e,t),ml(t)&&t.startPublishing(),this)}delete(e){const t=this.get(e);return e=super.delete(e),e&&(ml(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()]}},tc,Xt;tc="PROCEDURE",i.DEFAULT_ARG$$module$build$src$core$procedures="x",Xt={CATEGORY_NAME:tc,DEFAULT_ARG:i.DEFAULT_ARG$$module$build$src$core$procedures},Xt.ObservableProcedureMap=ov,Xt.allProcedures=fl,Xt.findLegalName=i.findLegalName$$module$build$src$core$procedures,Xt.flyoutCategory=$l,Xt.getCallers=qd,Xt.getDefinition=i.getDefinition$$module$build$src$core$procedures,Xt.isNameUsed=Kd,Xt.isProcedureBlock=Bo,Xt.mutateCallers=i.mutateCallers$$module$build$src$core$procedures,Xt.mutatorOpenListener=Jd,Xt.rename=i.rename$$module$build$src$core$procedures;var KS=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}},z=new KS,Xs=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=z.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},Ur=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=z.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(z.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(z.isSpacer(t))return t}return null}getLastSpacer(){for(let e=this.elements.length-1;0<=e;e--){const t=this.elements[e];if(z.isSpacer(t))return t}return null}},Sp=class extends Ur{constructor(e){super(e),this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0,this.type|=z.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 u=this.elements[n];t+=u.width,z.isSpacer(u)||(z.isNextConnection(u)?o=Math.max(o,u.height):e=Math.max(e,u.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}},Eo=class extends Xs{constructor(e,t){super(e),this.connectionModel=t,this.type|=z.CONNECTION,this.shape=this.constants_.shapeFor(t),this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic,this.highlighted=t.isHighlighted()}},Ko=class extends Eo{constructor(e,t){super(e,t.connection),this.input=t,this.connectionOffsetY=this.connectionOffsetX=0,this.type|=z.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}},sc=class extends Ko{constructor(e,t){super(e,t),this.height=0,this.type|=z.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}},Sn=class extends Xs{constructor(e,t,o){super(e),this.field=t,this.parentInput=o,this.isEditable=t.EDITABLE,this.flipRtl=t.getFlipRtl(),this.type|=z.FIELD,e=this.field.getSize(),this.height=e.height,this.width=e.width}},Tp=class extends Xs{constructor(e){super(e),this.type|=z.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height}},iv=class extends Xs{constructor(e,t){super(e),this.icon=t,this.flipRtl=!1,this.type|=z.ICON,e=t.getSize(),this.height=e.height,this.width=e.width}},ds=class extends Xs{constructor(e,t){super(e),this.type=this.type|z.SPACER|z.IN_ROW_SPACER,this.width=t,this.height=this.constants_.SPACER_DEFAULT_HEIGHT}},Ip=class extends Ko{constructor(e,t){super(e,t),this.type|=z.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}},Hr=class extends Ko{constructor(e,t){super(e,t),this.type|=z.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}},Ep=class extends Ur{constructor(e){super(e),this.connectedBlockWidths=0,this.type|=z.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,z.isInput(o)&&o instanceof Ko&&(z.isStatementInput(o)&&o instanceof Hr?e+=o.connectedBlockWidth:z.isExternalInput(o)&&o instanceof sc&&o.connectedBlockWidth!==0&&(e+=o.connectedBlockWidth-o.connectionWidth)),z.isSpacer(o)||(this.height=Math.max(this.height,o.height))}this.connectedBlockWidths=e,this.widthWithConnectedBlocks=this.width+e}endsWithElemSpacer(){return!this.hasExternalInput&&!this.hasStatement}},nv=class extends Xs{constructor(e){super(e),this.type|=z.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width}},rv=class extends Eo{constructor(e,t){super(e,t),this.type|=z.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},av=class extends Eo{constructor(e,t){super(e,t),this.connectionOffsetX=0,this.type|=z.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}},lv=class extends Eo{constructor(e,t){super(e,t),this.type|=z.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},Wr=class extends Xs{constructor(e,t){super(e),this.type=(t&&t!=="left"?z.RIGHT_ROUND_CORNER:z.LEFT_ROUND_CORNER)|z.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2}},xp=class extends Ur{constructor(e,t,o){super(e),this.height=t,this.width=o,this.precedesStatement=this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.type=this.type|z.SPACER|z.BETWEEN_ROW_SPACER,this.elements=[new ds(this.constants_,o)]}measure(){}},Gr=class extends Xs{constructor(e,t){super(e),this.type=(t&&t!=="left"?z.RIGHT_SQUARE_CORNER:z.LEFT_SQUARE_CORNER)|z.CORNER,this.width=this.height=this.constants_.NO_PADDING}},Dp=class extends Ur{constructor(e){super(e),this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null,this.type|=z.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 u=this.elements[n];t+=u.width,z.isSpacer(u)||(z.isHat(u)&&u instanceof Tp?o=Math.max(o,u.ascenderHeight):e=Math.max(e,u.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}},oc=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=pt(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=ho("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=nn(t.colourPrimary||"#000"),t.colourPrimary=e.hex,t.colourSecondary=t.colourSecondary?nn(t.colourSecondary).hex:this.generateSecondaryColour_(t.colourPrimary),t.colourTertiary=t.colourTertiary?nn(t.colourTertiary).hex:this.generateTertiaryColour_(t.colourPrimary),t.hat=t.hat||"",t}generateSecondaryColour_(e){return di("#fff",e,.6)||e}generateTertiaryColour_(e){return di("#fff",e,.3)||e}dispose(){this.embossFilter&&Ze(this.embossFilter),this.disabledPattern&&Ze(this.disabledPattern),this.debugFilter&&Ze(this.debugFilter),this.cssNode=null}makeJaggedTeeth(){const e=this.JAGGED_TEETH_HEIGHT,t=this.JAGGED_TEETH_WIDTH,o=ln([De(t,e/4),De(2*-t,e/2),De(t,e/4)]);return{height:e,width:t,path:o}}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,o=ss("c",[De(30,-e),De(70,-e),De(t,0)]);return{height:e,width:t,path:o}}makePuzzleTab(){function e(m){m=m?-1:1;const E=-m;var L=o/2;const se=L+2.5,Ce=L+.5,dt=De(-t,m*L);return L=De(t,m*L),ss("c",[De(0,m*se),De(-t,E*Ce),dt])+ss("s",[De(t,2.5*E),L])}const t=this.TAB_WIDTH,o=this.TAB_HEIGHT,n=e(!0),u=e(!1);return{type:this.SHAPES.PUZZLE,width:t,height:o,pathDown:u,pathUp:n}}makeNotch(){function e(E){return ln([De(E*n,o),De(3*E,0),De(E*n,-o)])}const t=this.NOTCH_WIDTH,o=this.NOTCH_HEIGHT,n=(t-3)/2,u=e(1),m=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:o,pathLeft:u,pathRight:m}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=wt("a","0 0,0",e,De(-e,e)),o=wt("a","0 0,0",e,De(e,e));return{width:e,height:e,pathTop:t,pathBottom:o}}makeOutsideCorners(){const e=this.CORNER_RADIUS,t=pt(0,e)+wt("a","0 0,1",e,De(e,-e)),o=wt("a","0 0,1",e,De(e,e)),n=wt("a","0 0,1",e,De(-e,-e)),u=wt("a","0 0,1",e,De(-e,e));return{topLeft:t,topRight:o,bottomRight:u,bottomLeft:n,rightHeight:e}}shapeFor(e){switch(e.type){case Se.INPUT_VALUE:case Se.OUTPUT_VALUE:return this.PUZZLE_TAB;case Se.PREVIOUS_STATEMENT:case Se.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type")}}createDom(e,t,o){this.injectCSS_(t,o),this.defs=ee(V.DEFS,{},e),e=ee(V.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},this.defs),ee(V.FEGAUSSIANBLUR,{in:"SourceAlpha",stdDeviation:1,result:"blur"},e),t=ee(V.FESPECULARLIGHTING,{in:"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},e),ee(V.FEPOINTLIGHT,{x:-5e3,y:-1e4,z:2e4},t),ee(V.FECOMPOSITE,{in:"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},e),ee(V.FECOMPOSITE,{in:"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},e),this.embossFilterId=e.id,this.embossFilter=e,e=ee(V.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs),ee(V.RECT,{width:10,height:10,fill:"#aaa"},e),ee(V.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=ee(V.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs),t=ee(V.FECOMPONENTTRANSFER,{result:"outBlur"},e);ee(V.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),ee(V.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},e),ee(V.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(`
|
|
884
|
+
`);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;","}"]}},ic=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_+`
|
|
885
|
+
`+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_+=pt(e.xPos,this.info_.startY);for(let o=0,n;n=t[o];o++)z.isLeftRoundedCorner(n)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:z.isRightRoundedCorner(n)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:z.isPreviousConnection(n)&&n instanceof Eo?this.outlinePath_+=n.shape.pathLeft:z.isHat(n)?this.outlinePath_+=this.constants_.START_HAT.path:z.isSpacer(n)&&(this.outlinePath_+=Te("h",n.width));this.outlinePath_+=Te("v",e.height)}drawJaggedEdge_(e){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+Te("v",e.height-this.constants_.JAGGED_TEETH.height)}drawValueInput_(e){const t=e.getLastInput();this.positionExternalValueConnection_(e);const o=bl(t.shape)?t.shape.pathDown(t.height):t.shape.pathDown;this.outlinePath_+=Te("H",t.xPos+t.width)+o+Te("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+Te("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_+=Te("H",o)+t+Te("v",n)+this.constants_.INSIDE_CORNERS.pathBottom+Te("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}}drawRightSideRow_(e){this.outlinePath_+=Te("V",e.yPos+e.height)}drawBottom_(){const e=this.info_.bottomRow,t=e.elements;this.positionNextConnection_();let o=0,n="";for(let u=t.length-1,m;m=t[u];u--)z.isNextConnection(m)&&m instanceof Eo?n+=m.shape.pathRight:z.isLeftSquareCorner(m)?n+=Te("H",e.xPos):z.isLeftRoundedCorner(m)?n+=this.constants_.OUTSIDE_CORNERS.bottomLeft:z.isRightRoundedCorner(m)?(n+=this.constants_.OUTSIDE_CORNERS.bottomRight,o=this.constants_.OUTSIDE_CORNERS.rightHeight):z.isSpacer(m)&&(n+=Te("h",-1*m.width));this.outlinePath_+=Te("V",e.baseline-o),this.outlinePath_+=n}drawLeft_(){var e=this.info_.outputConnection;if(this.positionOutputConnection_(),e){const t=e.connectionOffsetY+e.height;e=bl(e.shape)?e.shape.pathUp(e.height):e.shape.pathUp,this.outlinePath_+=Te("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++)z.isInlineInput(n)?this.drawInlineInput_(n):(z.isIcon(n)||z.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)")),z.isIcon(e)?(n=e.icon,n.setOffsetInBlock(new fe(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,u=e.connectionHeight+n;this.inlinePath_+=xt(e.xPos+e.connectionWidth,e.centerline-o/2)+Te("v",n)+e.shape.pathDown+Te("v",o-u)+Te("h",t-e.connectionWidth)+Te("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 Eo)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===Se.INPUT_VALUE||t.type===Se.OUTPUT_VALUE?this.getExpressionConnectionHighlightPath(e):this.getStatementConnectionHighlightPath(e);const o=t.getSourceBlock();let n,u;(u=(n=o.pathObject).addConnectionHighlight)==null||u.call(n,t,e,t.getOffsetInBlock(),o.RTL)}getExpressionConnectionHighlightPath(e){let t="";return bl(e.shape)?t=e.shape.pathDown(e.height):db(e.shape)&&(t=e.shape.pathDown),e=this.constants_.TAB_OFFSET_FROM_TOP,pt(0,-e)+Te("v",e)+t+Te("v",e)}getStatementConnectionHighlightPath(e){if(!hb(e.shape))throw Error("Statement connections should have notch shapes");const t=this.constants_.NOTCH_OFFSET_LEFT-this.constants_.CORNER_RADIUS;return pt(-t,0)+Te("h",t)+e.shape.pathLeft+Te("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 Di=class extends lt{constructor(e,t,o){super(lt.SKIP_SETUP),this.class=null,this.EDITABLE=!1,this.maxDisplayLength=1/0,e!==lt.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&&Ie(this.getTextElement(),this.class)}doClassValidation_(e){return e==null?null:`${e}`}setClass(e){this.textElement_&&(this.class&&Be(this.textElement_,this.class),e&&Ie(this.textElement_,e)),this.class=e}static fromJson(e){return new this(_t(e.text),void 0,e)}};Ks("field_label",Di),Di.prototype.DEFAULT_VALUE="";var Tn=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,u;u=this.fieldRow[n];n++)u.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)}},Zs=class extends Tn{constructor(e,t){super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.DUMMY}},xo=class extends Tn{constructor(e,t){super(e,t),this.name=e,this.type=i.inputTypes$$module$build$src$core$inputs$input_types.END_ROW}},hs=class extends Tn{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(Se.NEXT_STATEMENT)}},cv;i.ValueInput$$module$build$src$core$inputs$value_input=class extends Tn{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(Se.INPUT_VALUE)}},cv={},cv.ValueInput=i.ValueInput$$module$build$src$core$inputs$value_input;var Vr=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 av(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 Dp(this.constants_),this.bottomRow=new Sp(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 Ep(this.constants_);this.inputRows.push(e);var t=this.block_.getIcons();for(let o=0,n;n=t[o];o++){const u=new iv(this.constants_,n);this.isCollapsed&&!n.isShownWhenCollapsed()||e.elements.push(u)}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 Ep(this.constants_),this.inputRows.push(e));for(let u=0,m;m=n.fieldRow[u];u++)e.elements.push(new Sn(this.constants_,m,n));this.addInput_(n,e),t=n}this.isCollapsed&&(e.hasJaggedEdge=!0,e.elements.push(new nv(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_)?Gr:Wr;this.topRow.elements.push(new o(this.constants_)),t?(e=new Tp(this.constants_),this.topRow.elements.push(e),this.topRow.capline=e.ascenderHeight):e&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new lv(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0]instanceof hs&&!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_)?Gr:Wr,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 hs?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new Gr(this.constants_)):this.bottomRow.elements.push(new Wr(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new rv(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new Gr(this.constants_,"right")):this.bottomRow.elements.push(new Wr(this.constants_,"right"))}addInput_(e,t){this.isInline&&e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new Ip(this.constants_,e)),t.hasInlineInput=!0):e instanceof hs?(t.elements.push(new Hr(this.constants_,e)),t.hasStatement=!0):e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new sc(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Zs||e instanceof xo)&&(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 xo||e instanceof hs||t instanceof hs?!0:e instanceof i.ValueInput$$module$build$src$core$inputs$value_input||e instanceof Zs||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 ds(this.constants_,this.getInRowSpacing_(null,o[0]))),o.length){for(let n=0;n<o.length-1;n++){t.elements.push(o[n]);const u=this.getInRowSpacing_(o[n],o[n+1]);t.elements.push(new ds(this.constants_,u))}t.elements.push(o[o.length-1]),t.endsWithElemSpacer()&&t.elements.push(new ds(this.constants_,this.getInRowSpacing_(o[o.length-1],null)))}}}getInRowSpacing_(e,t){if(!e&&t&&z.isStatementInput(t))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(e&&z.isInput(e)&&!t){if(z.isExternalInput(e))return this.constants_.NO_PADDING;if(z.isInlineInput(e))return this.constants_.LARGE_PADDING;if(z.isStatementInput(e))return this.constants_.NO_PADDING}return e&&z.isLeftSquareCorner(e)&&t&&(z.isPreviousConnection(t)||z.isNextConnection(t))?t.notchOffset:e&&z.isLeftRoundedCorner(e)&&t&&(z.isPreviousConnection(t)||z.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING}computeBounds_(){let e=0,t=0,o=0;for(let u=0,m;m=this.rows[u];u++){if(m.measure(),t=Math.max(t,m.width),m.hasStatement){var n=m.getLastInput();let E,L;n=m.width-((L=(E=n)==null?void 0:E.width)!=null?L:0),e=Math.max(e,n)}o=Math.max(o,m.widthWithConnectedBlocks)}this.statementEdge=e,this.width=t;for(let u=0,m;m=this.rows[u];u++)m.hasStatement&&(m.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),z.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 xp(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 z.isSpacer(t)?e.yPos+t.height/2:z.isBottomRow(e)?(e=e.yPos+e.height-e.descenderHeight,z.isNextConnection(t)?e+t.height/2:e-t.height/2):z.isTopRow(e)?z.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++)z.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 Eo&&n.connectionModel===e)return n;return null}},Ap=class extends ki{constructor(e){if(super(e),this.type=q.BLOCK_DELETE,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=yr(e),this.ids=ge(e),this.wasShadow=e.isShadow(),this.oldJson=as(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=Vs(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 Ap),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 go(this.oldJson,t)}};a(he.EVENT,q.BLOCK_DELETE,Ap);var Qe=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=Se.INPUT_VALUE,o=this.getSourceBlock();var n=e.getSourceBlock();e.isConnected()&&e.disconnectInternal(!1);let u;if(this.isConnected()){const E=this.stashShadowState(),L=this.targetBlock();L.isShadow()?L.dispose(!1):(this.disconnectInternal(),u=L),this.applyShadowState(E)}let m;k()&&(m=new(oe(q.BLOCK_MOVE))(n),m.setReason(["connect"])),pb(this,e),n.setParent(o),m&&(m.recordNew(),B(m)),u&&(e=this.type===t?u.outputConnection:u.previousConnection)&&((n=Qe.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===Se.INPUT_VALUE||this.type===Se.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 u;k()&&(u=new(oe(q.BLOCK_MOVE))(o.getSourceBlock()),u.setReason(["disconnect"]));const m=this.targetConnection;m&&(m.targetConnection=null),this.targetConnection=null,e&&o.getSourceBlock().setParent(null),u&&(u.recordNew(),B(u)),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()?Po(this.targetBlock()):this.shadowDom}setShadowState(e){this.setShadowStateInternal({shadowState:e})}getShadowState(e){return e&&this.targetBlock()&&this.targetBlock().isShadow()?as(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=Qi(o,t.workspace,{parentConnection:e?this:void 0,isShadow:!0,recordUndo:!1});if(n){if(t=gi(n,t.workspace),e)if(this.type===Se.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===Se.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=Po(e),this.shadowState=as(e))}static getConnectionForOrphanedConnection(e,t){if(t.type===Se.OUTPUT_VALUE)return mb(e,t.getSourceBlock());e=e.lastConnectionInStack(!0);const o=t.getConnectionChecker();return e&&o.canConnect(t,e,!1)?e:null}};Qe.CAN_CONNECT=0,Qe.REASON_SELF_CONNECTION=1,Qe.REASON_WRONG_TYPE=2,Qe.REASON_TARGET_NULL=3,Qe.REASON_CHECKS_FAILED=4,Qe.REASON_DIFFERENT_WORKSPACES=5,Qe.REASON_SHADOW_PARENT=6,Qe.REASON_DRAG_CHECKS_FAILED=7,Qe.REASON_PREVIOUS_AND_OUTPUT=8;var Yo=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:w(),e.setBlockById(this.id,this),this.xy=new fe(0,0),this.isInFlyout=e.isFlyout,this.isInMutator=e.isMutator,this.RTL=e.RTL,t){if(this.type=t,o=os[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===Yo&&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=j();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()&&B(new(oe(q.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()&&B(new(oe(q.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===Se.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,u;e=(u=(n=this.nextConnection)==null?void 0:n.targetConnection)!=null?u: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_?Ge(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,u=0;n=o[u];u++)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(Pe(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,u;u=o.fieldRow[n];n++)u.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 sn(this)}getColour(){return this.colour_}getStyleName(){return this.styleName_}getHue(){return this.hue}setColour(e){e=nn(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,u;u=o.fieldRow[n];n++)if(u.name===e)return u;return null}getVars(){const e=[];for(let t=0,o;o=this.inputList[t];t++)for(let n=0,u;u=o.fieldRow[n];n++)u.referencesVariables()&&e.push(u.getValue());return e}getVarModels(){const e=[];for(let t=0,o;o=this.inputList[t];t++)for(let n=0,u;u=o.fieldRow[n];n++)if(u.referencesVariables()){const m=this.workspace.getVariableById(u.getValue());m&&e.push(m)}return e}updateVarName(e){for(let t=0,o;o=this.inputList[t];t++)for(let n=0,u;u=o.fieldRow[n];n++)u.referencesVariables()&&e.getId()===u.getValue()&&u.refreshVariableName()}renameVarById(e,t){for(let o=0,n;n=this.inputList[o];o++)for(let u=0,m;m=n.fieldRow[u];u++)m.referencesVariables()&&e===m.getValue()&&m.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_(Se.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_(Se.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_(Se.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&&(B(new(oe(q.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 Zs&&this.inputList[e]instanceof Zs)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 Zs)return!0;for(e=0;e<this.inputList.length;e++)if(this.inputList[e]instanceof xo)return!0;return!1}setOutputShape(e){this.outputShape_=e}getOutputShape(){return this.outputShape_}isEnabled(){return this.disabledReasons.size===0}get disabled(){return _("disabled","v11","v12","the isEnabled or hasDisabledReason methods of Block"),this.hasDisabledReason(qt)}set disabled(e){_("disabled","v11","v12","the setDisabledReason method of Block"),this.setDisabledReason(e,qt)}setEnabled(e){_("setEnabled","v11","v12","the setDisabledReason method of Block"),this.setDisabledReason(!e,qt)}setDisabledReason(e,t){e||this.workspace.options.disable||!this.hasDisabledReason(qt)||t==qt||this.setDisabledReason(!1,qt),this.disabledReasons.has(t)!==e&&(e?this.disabledReasons.add(t):this.disabledReasons.delete(t),e=new(oe(q.BLOCK_CHANGE))(this,"disabled",null,!e,e),e.setDisabledReason(t),B(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&&(B(new(oe(q.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,u)=>(n=n+(o==="("||u===")"?"":" ")+u,o=u[u.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!=Ar){for(const u of n.fieldRow)t.push(u.getText());if(n.connection){const u=n.connection.targetBlock();if(u){var o=n.connection;let m=o.getCheck();!m&&o.targetConnection&&(m=o.targetConnection.getCheck()),(o=!!m&&(m.includes("Boolean")||m.includes("Number")))&&t.push("("),t.push(...u.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 hs(e,this))}appendDummyInput(e=""){return this.appendInput(new Zs(e,this))}appendEndRowInput(e=""){return this.appendInput(new xo(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=p(he.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=_t(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=_t(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&&hl(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(t=0;t<e.length;t++)hl(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=Cd(e),this.validateTokens(e,t.length),t=this.interpolateArguments(e,t,o),o=[];for(let u=0,m;m=t[u];u++)if(this.isInputKeyword(m.type)){if(e=this.inputFromJson(m,n)){for(let E=0,L;L=o[E];E++)e.appendField(L[0],L[1]);o.length=0}}else(e=this.fieldFromJson(m))&&o.push([e,m.name])}validateTokens(e,t){const o=[];let n=0;for(let u=0;u<e.length;u++){const m=e[u];if(typeof m=="number"){if(1>m||m>t)throw Error('Block "'+this.type+'": Message index %'+m+" out of range.");if(o[m])throw Error('Block "'+this.type+'": Message index %'+m+" duplicated.");o[m]=!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 m=0;m<e.length;m++){var u=e[m];if(typeof u=="number"&&(u=t[u-1]),typeof u=="string"){if(u===`
|
|
886
|
+
`)u={type:"input_end_row"},o&&(u.align=o);else if(u=this.stringToFieldJson(u),!u)continue}n.push(u)}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"||d(he.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 u=0,m;m=this.inputList[u];u++)if(m.name===e){if(o=u,n!==-1)break}else if(t&&m.name===t&&(n=u,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 hs&&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(Tt.COMMENT))==null?void 0:e.getText())!=null?t:null}setCommentText(e){var t;let o;const n=(o=(t=this.getIcon(Tt.COMMENT))==null?void 0:t.getText())!=null?o:null;if(n!==e){if(e!==null){if(t=this.getIcon(Tt.COMMENT),!t){if(t=p(he.ICON,Tt.COMMENT.toString(),!1),!t)throw Error("No comment icon class is registered, so a comment cannot be set");if(t=new t(this),!fb(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(Tt.COMMENT);B(new(oe(q.BLOCK_CHANGE))(this,"comment",null,n,e))}}setWarningText(e,t){}setMutator(e){}addIcon(e){if(this.hasIcon(e.getType()))throw new ev(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 Tt?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(oe(q.BLOCK_MOVE))(this);o&&n.setReason(o),this.xy.translate(e,t),n.recordNew(),B(n)}makeConnection_(e){return new Qe(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}};Yo.COLLAPSED_INPUT_NAME=Ar,Yo.COLLAPSED_FIELD_NAME=Ml;var ys=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 fe(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=ee(V.G,{class:e},this.workspace.getCanvas());let t;this.isFlyoutLabel||(t=ee(V.RECT,{class:"blocklyFlyoutButtonShadow",rx:ys.BORDER_RADIUS,ry:ys.BORDER_RADIUS,x:1,y:1},this.svgGroup)),e=ee(V.RECT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:ys.BORDER_RADIUS,ry:ys.BORDER_RADIUS},this.svgGroup);const o=ee(V.TEXT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup);var n=_t(this.text);this.workspace.RTL&&(n+=""),o.textContent=n,this.isFlyoutLabel&&(this.svgText=o,this.workspace.getThemeManager().subscribe(this.svgText,"flyoutForegroundColour","fill"));const u=Ws(o,"fontSize"),m=Ws(o,"fontWeight"),E=Ws(o,"fontFamily");if(this.width=Hs(o,u,m,E),n=ho(n,u,m,E),this.height=n.height,!this.isFlyoutLabel){this.width+=2*ys.TEXT_MARGIN_X,this.height+=2*ys.TEXT_MARGIN_Y;let L;(L=t)==null||L.setAttribute("width",String(this.width));let se;(se=t)==null||se.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=K(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&&G(this.onMouseUpWrapper),this.svgGroup&&Ze(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)}};ys.TEXT_MARGIN_X=5,ys.TEXT_MARGIN_Y=2,ys.BORDER_RADIUS=4,Fe(`
|
|
887
|
+
.blocklyFlyoutButton {
|
|
888
|
+
fill: #888;
|
|
889
|
+
cursor: default;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
.blocklyFlyoutButtonShadow {
|
|
893
|
+
fill: #666;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
.blocklyFlyoutButton:hover {
|
|
897
|
+
fill: #aaa;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
.blocklyFlyoutLabel {
|
|
901
|
+
cursor: default;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
.blocklyFlyoutLabelBackground {
|
|
905
|
+
opacity: 0;
|
|
906
|
+
}
|
|
907
|
+
`);var re=class{constructor(e,t,o){if(this.wsCoordinate=null,!t)throw Error("Cannot create a node without a location.");this.type=e,this.isConnectionLocation=re.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 u=0;u<n.length;u++){const m=n[u];if(m.isClickable()||re.NAVIGATE_ALL_FIELDS)return re.createFieldNode(m)}if(o.connection)return re.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 u=t.fieldRow;for(;e<u.length;){if(u[e].isClickable()||re.NAVIGATE_ALL_FIELDS)return re.createFieldNode(u[e]);e++}if(e=0,t.connection)return re.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 re.createInputNode(n);n=n.fieldRow;for(let u=n.length-1;0<=u;u--){const m=n[u];if(m.isClickable()||re.NAVIGATE_ALL_FIELDS)return re.createFieldNode(m)}}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 u=o.inputList[n];if(u.connection&&u!==t)return re.createInputNode(u);for(u=u.fieldRow;-1<e;){if(u[e].isClickable()||re.NAVIGATE_ALL_FIELDS)return re.createFieldNode(u[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:re.createStackNode(t[e]);throw Error("Couldn't find "+(e?"next":"previous")+" stack?!")}navigateFlyoutContents(e){let t;switch(this.getType()){case re.types.STACK:t=this.getLocation();var o=t.workspace.targetWorkspace;break;case re.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?re.createButtonNode(e.button):e.type==="block"&&e.block?re.createStackNode(e.block):null:null}findNextLocationInFlyout(e,t,o){const n=e.findIndex(u=>t instanceof Yo&&u.block===t||t instanceof ys&&u.button===t);return 0>n?null:(o=o?n+1:n-1,o===-1||o===e.length?null:e[o])}findTopASTNodeForBlock(e){const t=vr(e);return t?re.createConnectionNode(t):re.createBlockNode(e)}getOutAstNodeForBlock(e){if(!e)return null;e=e.getTopStackBlock();const t=vr(e);return t&&t.targetConnection&&t.targetConnection.getParentInput()?re.createInputNode(t.targetConnection.getParentInput()):re.createStackNode(e)}findFirstFieldOrInput(e){e=e.inputList;for(let t=0;t<e.length;t++){const o=e[t],n=o.fieldRow;for(let u=0;u<n.length;u++){const m=n[u];if(m.isClickable()||re.NAVIGATE_ALL_FIELDS)return re.createFieldNode(m)}if(o.connection)return re.createInputNode(o)}return null}getSourceBlock(){return this.getType()===re.types.BLOCK?this.getLocation():this.getType()===re.types.STACK?this.getLocation():this.getType()===re.types.WORKSPACE||this.getType()===re.types.BUTTON?null:this.getLocation().getSourceBlock()}next(){switch(this.type){case re.types.STACK:return this.navigateBetweenStacks(!0);case re.types.OUTPUT:return re.createBlockNode(this.location.getSourceBlock());case re.types.FIELD:return this.findNextForField();case re.types.INPUT:return this.findNextForInput();case re.types.BLOCK:const e=this.location.nextConnection;if(!e)break;return re.createConnectionNode(e);case re.types.PREVIOUS:return re.createBlockNode(this.location.getSourceBlock());case re.types.NEXT:return re.createConnectionNode(this.location.targetConnection);case re.types.BUTTON:return this.navigateFlyoutContents(!0)}return null}in(){switch(this.type){case re.types.WORKSPACE:const e=this.location.getTopBlocks(!0);if(0<e.length)return re.createStackNode(e[0]);break;case re.types.STACK:return this.findTopASTNodeForBlock(this.location);case re.types.BLOCK:return this.findFirstFieldOrInput(this.location);case re.types.INPUT:return re.createConnectionNode(this.location.targetConnection)}return null}prev(){switch(this.type){case re.types.STACK:return this.navigateBetweenStacks(!1);case re.types.FIELD:return this.findPrevForField();case re.types.INPUT:return this.findPrevForInput();case re.types.BLOCK:var e=vr(this.location);if(!e)break;return re.createConnectionNode(e);case re.types.PREVIOUS:if((e=this.location.targetConnection)&&!e.getParentInput())return re.createConnectionNode(e);break;case re.types.NEXT:return re.createBlockNode(this.location.getSourceBlock());case re.types.BUTTON:return this.navigateFlyoutContents(!1)}return null}out(){switch(this.type){case re.types.STACK:var e=this.location,t=e.getRelativeToSurfaceXY();return t=new fe(t.x,t.y+re.DEFAULT_OFFSET_Y),re.createWorkspaceNode(e.workspace,t);case re.types.OUTPUT:return e=this.location,(t=e.targetConnection)?re.createConnectionNode(t):re.createStackNode(e.getSourceBlock());case re.types.FIELD:if(e=this.location.getSourceBlock(),!e)throw Error("The current AST location is not associated with a block");return re.createBlockNode(e);case re.types.INPUT:return re.createBlockNode(this.location.getSourceBlock());case re.types.BLOCK:return this.getOutAstNodeForBlock(this.location);case re.types.PREVIOUS:return this.getOutAstNodeForBlock(this.location.getSourceBlock());case re.types.NEXT:return this.getOutAstNodeForBlock(this.location.getSourceBlock())}return null}static isConnectionType(e){switch(e){case re.types.PREVIOUS:case re.types.NEXT:case re.types.INPUT:case re.types.OUTPUT:return!0}return!1}static createFieldNode(e){return e?new re(re.types.FIELD,e):null}static createConnectionNode(e){if(!e)return null;const t=e.type;return t===Se.INPUT_VALUE||t===Se.NEXT_STATEMENT&&e.getParentInput()?re.createInputNode(e.getParentInput()):t===Se.NEXT_STATEMENT?new re(re.types.NEXT,e):t===Se.OUTPUT_VALUE?new re(re.types.OUTPUT,e):t===Se.PREVIOUS_STATEMENT?new re(re.types.PREVIOUS,e):null}static createInputNode(e){return e&&e.connection?new re(re.types.INPUT,e.connection):null}static createBlockNode(e){return e?new re(re.types.BLOCK,e):null}static createStackNode(e){return e?new re(re.types.STACK,e):null}static createButtonNode(e){return e?new re(re.types.BUTTON,e):null}static createWorkspaceNode(e,t){return t&&e?new re(re.types.WORKSPACE,e,{wsCoordinate:t}):null}static createTopNode(e){const t=vr(e);return t?re.createConnectionNode(t):re.createBlockNode(e)}};re.NAVIGATE_ALL_FIELDS=!1,re.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"})(re||(re={}));var Rp=class extends Es{constructor(e,t,o,n){let u=e?e.workspace.id:void 0;n&&n.getType()===re.types.WORKSPACE&&(u=n.getLocation().id),super(u),this.type=q.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 Rp),t.isCursor=e.isCursor,t.blockId=e.blockId,t.oldNode=e.oldNode,t.newNode=e.newNode,t}};a(he.EVENT,q.MARKER_MOVE,Rp);var YS="blocklyCursor",JS="blocklyMarker",qS=.75,Op=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()?YS:JS;return this.svgGroup_=ee(V.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()===re.types.BLOCK?this.showWithBlock_(e):e.getType()===re.types.OUTPUT?this.showWithOutput_(e):t===Se.INPUT_VALUE?this.showWithInput_(e):t===Se.NEXT_STATEMENT?this.showWithNext_(e):e.getType()===re.types.PREVIOUS?this.showWithPrevious_(e):e.getType()===re.types.FIELD?this.showWithField_(e):e.getType()===re.types.WORKSPACE?this.showWithCoordinates_(e):e.getType()===re.types.STACK?this.showWithStack_(e):e.getType()===re.types.BUTTON&&this.showWithButton_(e)}showWithBlockPrevOutput(e){e=e.getSourceBlock();const t=e.width;var o=e.height,n=o*qS;const u=this.constants_.CURSOR_BLOCK_PADDING;e.previousConnection?(o=this.constants_.shapeFor(e.previousConnection),this.positionPrevious_(t,u,n,o)):e.outputConnection?(n=this.constants_.shapeFor(e.outputConnection),this.positionOutput_(t,o,n)):this.positionBlock_(t,u,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,u=-this.constants_.CURSOR_STACK_PADDING/2;let m=n;this.workspace.RTL&&(m=-(o+n)),this.positionRect_(m,u,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,u=-this.constants_.CURSOR_STACK_PADDING/2;let m=n;this.workspace.RTL&&(m=-(t+n)),this.positionRect_(m,u,t,o),this.setParent_(e),this.showCurrent_()}showCurrent_(){this.hide(),this.currentMarkerSvg&&(this.currentMarkerSvg.style.display="")}positionBlock_(e,t,o){if(e=pt(-t,o)+Te("V",-t)+Te("H",e+2*t)+Te("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=xt(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=pt(e,0)+Te("h",-(e-o.width))+Te("v",this.constants_.TAB_OFFSET_FROM_TOP)+o.pathDown+Te("V",t)+Te("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=pt(-t,o)+Te("V",-t)+Te("H",this.constants_.NOTCH_OFFSET_LEFT)+n.pathLeft+Te("H",e+2*t)+Te("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(oe(q.MARKER_MOVE))(o,this.isCursor(),e,t),B(e)}getBlinkProperties_(){return{attributeType:"XML",attributeName:"fill",dur:"1s",values:this.colour_+";transparent;transparent;",repeatCount:"indefinite"}}createDomInternal_(){if(this.markerSvg_=ee(V.G,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_),this.markerSvgLine_=ee(V.RECT,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.markerSvg_),this.markerSvgRect_=ee(V.RECT,{class:"blocklyVerticalMarker",rx:10,ry:10},this.markerSvg_),this.markerInput_=ee(V.PATH,{transform:""},this.markerSvg_),this.markerBlock_=ee(V.PATH,{transform:"",fill:"none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.hide(),this.isCursor()){const e=this.getBlinkProperties_();ee(V.ANIMATE,e,this.markerSvgLine_),ee(V.ANIMATE,e,this.markerInput_),ee(V.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_&&Ze(this.svgGroup_)}},nc=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=ee(V.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?Ie(this.svgRoot,e):Be(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=ee(V.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 u=(n=this.connectionHighlights.get(e))==null?void 0:n.getAttribute("d");return e=this.highlightOffsets.get(e),u===t&&fe.equals(e,o)}removeConnectionHighlight(e){const t=this.connectionHighlights.get(e);t&&(Ze(t),this.connectionHighlights.delete(e))}},vs=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();Is().then(()=>{dl(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=as(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!o)throw Error(`Failed to serialize source block. ${e.toDevString()}`);t=go(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 u=o.x+t.x-n.x;return t=o.y+t.y-n.y,e.radius<Math.sqrt(u*u+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 u=this.availableConnections[n],m=u.closest(t,e);m.connection&&(o={closest:m.connection,local:u,radius:m.radius},t=m.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,gt.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 vs.PREVIEW_TYPE.INPUT_OUTLINE:this.showInsertionInputOutline(e);break;case vs.PREVIEW_TYPE.INSERTION_MARKER:this.showInsertionMarker(e);break;case vs.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 u;try{u=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");u=n.getMatchingConnection(t.getSourceBlock(),t)}if(!u)throw Error("Cannot show the insertion marker because there is no associated connection");if(u===this.markerConnection)throw Error("Made it to showInsertionMarker_ even though the marker isn't changing");n.queueRender(),po(),u.connect(o);const m={x:o.x-u.x,y:o.y-u.y},E=u.getOffsetInBlock().clone(),L=u;Is().then(()=>{let se;(se=n)==null||se.positionNearConnection(L,m,E);let Ce;(Ce=n)==null||Ce.getSvgRoot().setAttribute("visibility","visible")}),this.markerConnection=u}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 u;(u=e.targetBlock())==null||u.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"})(vs||(vs={})),vs.PREVIEW_TYPE;var rc=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 oc}makeRenderInfo_(e){return new Vr(this,e)}makeDrawer_(e,t){return new ic(e,t)}makeMarkerDrawer(e,t){return new Op(e,this.getConstants(),t)}makePathObject(e,t){return new nc(e,t,this.constants_)}getConstants(){return this.constants_}shouldHighlightConnection(e){return!0}orphanCanConnectAtEnd(e,t,o){return!!Qe.getConnectionForOrphanedConnection(e,o===Se.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}getConnectionPreviewMethod(e,t,o){return _("getConnectionPreviewMethod","v10","v12","an IConnectionPreviewer, if it fulfills your use case."),t.type===Se.OUTPUT_VALUE||t.type===Se.PREVIOUS_STATEMENT?!e.isConnected()||this.orphanCanConnectAtEnd(o,e.targetBlock(),t.type)?vs.PREVIEW_TYPE.INSERTION_MARKER:vs.PREVIEW_TYPE.REPLACEMENT_FADE:vs.PREVIEW_TYPE.INSERTION_MARKER}render(e){const t=this.makeRenderInfo_(e);t.measure(),this.makeDrawer_(e,t).draw()}},ot={};ot.BottomRow=Sp,ot.Connection=Eo,ot.ConstantProvider=oc,ot.Drawer=ic,ot.ExternalValueInput=sc,ot.Field=Sn,ot.Hat=Tp,ot.Icon=iv,ot.InRowSpacer=ds,ot.InlineInput=Ip,ot.InputConnection=Ko,ot.InputRow=Ep,ot.JaggedEdge=nv,ot.MarkerSvg=Op,ot.Measurable=Xs,ot.NextConnection=rv,ot.OutputConnection=av,ot.PathObject=nc,ot.PreviousConnection=lv,ot.RenderInfo=Vr,ot.Renderer=rc,ot.RoundCorner=Wr,ot.Row=Ur,ot.SpacerRow=xp,ot.SquareCorner=Gr,ot.StatementInput=Hr,ot.TopRow=Dp,ot.Types=z,ot.init=Zd,ot.register=_r,ot.unregister=$b;var uv=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())&&Be(e,t),(t=this.theme.getClassName())&&Ie(e,t));for(let o=0,n;n=this.subscribedWorkspaces[o];o++)n.refreshTheme();for(const[o,n]of this.componentDB)for(const u of n){e=u.element,t=u.propertyName;const m=this.theme&&this.theme.getComponentStyle(o);e.style.setProperty(t,m||"")}for(const o of this.subscribedWorkspaces)o.hideChaff()}subscribeWorkspace(e){this.subscribedWorkspaces.push(e)}unsubscribeWorkspace(e){if(!Ge(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()}},Mp="VARIABLE_DYNAMIC",Ai={CATEGORY_NAME:Mp};Ai.flyoutCategory=yl,Ai.flyoutCategoryBlocks=sh,Ai.onCreateVariableButtonClick_Colour=th,Ai.onCreateVariableButtonClick_Number=eh,Ai.onCreateVariableButtonClick_String=Qd;var dv=30,Ri=[];Ri[Se.INPUT_VALUE]=Se.OUTPUT_VALUE,Ri[Se.OUTPUT_VALUE]=Se.INPUT_VALUE,Ri[Se.NEXT_STATEMENT]=Se.PREVIOUS_STATEMENT,Ri[Se.PREVIOUS_STATEMENT]=Se.NEXT_STATEMENT;var Np="RENAME_VARIABLE_ID",Lp="DELETE_VARIABLE_ID",hv=class{canConnect(e,t,o,n){return this.canConnectWithReason(e,t,o,n)===Qe.CAN_CONNECT}canConnectWithReason(e,t,o,n){const u=this.doSafetyChecks(e,t);return u!==Qe.CAN_CONNECT?u:this.doTypeChecks(e,t)?o&&!this.doDragChecks(e,t,n||0)?Qe.REASON_DRAG_CHECKS_FAILED:Qe.CAN_CONNECT:Qe.REASON_CHECKS_FAILED}getErrorMessage(e,t,o){switch(e){case Qe.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case Qe.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case Qe.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case Qe.REASON_TARGET_NULL:return"Target connection is null.";case Qe.REASON_CHECKS_FAILED:return"Connection checks failed. "+(t+" expected "+t.getCheck()+", found "+o.getCheck());case Qe.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case Qe.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case Qe.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 Qe.REASON_TARGET_NULL;let o,n,u;return e.isSuperior()?(o=e.getSourceBlock(),n=t.getSourceBlock(),u=t):(n=e.getSourceBlock(),o=t.getSourceBlock(),u=e,e=t),o===n?Qe.REASON_SELF_CONNECTION:u.type!==Ri[e.type]?Qe.REASON_WRONG_TYPE:o.workspace!==n.workspace?Qe.REASON_DIFFERENT_WORKSPACES:o.isShadow()&&!n.isShadow()?Qe.REASON_SHADOW_PARENT:u.type===Se.OUTPUT_VALUE&&n.previousConnection&&n.previousConnection.isConnected()||u.type===Se.PREVIOUS_STATEMENT&&n.outputConnection&&n.outputConnection.isConnected()?Qe.REASON_PREVIOUS_AND_OUTPUT:Qe.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 Se.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case Se.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case Se.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case Se.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!Tr.includes(t)}canConnectToPrevious_(e,t){return e.targetConnection||Tr.includes(t)?!1:t.targetConnection?(e=t.targetBlock(),e.isInsertionMarker()?!e.getPreviousBlock():!1):!0}};a(he.CONNECTION_CHECKER,Js,hv);var Pp=class extends Rr{constructor(e){super(e),this.type=q.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 Pp),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)}};a(he.EVENT,q.VAR_DELETE,Pp);var Bp=class extends Rr{constructor(e,t){super(e),this.type=q.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 Bp),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)}};a(he.EVENT,q.VAR_RENAME,Bp);var jp=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),u=i.getGroup$$module$build$src$core$events$utils();u||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(u)}}}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(B(new(oe(q.VAR_RENAME))(e,t)),e.name=t,t=0;t<o.length;t++)o[t].updateVarName(e)}renameVariableWithConflict(e,t,o,n){const u=e.type;for(t!==o.name&&this.renameVariableAndUses(o,t,n),t=0;t<n.length;t++)n[t].renameVarById(e.getId(),o.getId());B(new(oe(q.VAR_DELETE))(e)),Ge(this.variableMap.get(u),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||w(),t=t||"",n=new Or(this.workspace,e,t,n),e=this.variableMap.get(t)||[],e.push(n),this.variableMap.delete(t),this.variableMap.set(t,e),B(new(oe(q.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),B(new(oe(q.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 u=0,m;m=n[u];u++)if(m.type==="procedures_defnoreturn"||m.type==="procedures_defreturn"){e=String(m.getFieldValue("NAME")),o=i.Msg$$module$build$src$core$msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",o).replace("%2",e),cr(o);return}1<n.length?(o=i.Msg$$module$build$src$core$msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(n.length)).replace("%2",o),Va(o,u=>{u&&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 u=o[n].getVarModels();if(u)for(let m=0;m<u.length;m++)u[m].getId()===e&&t.push(o[n])}return t}},In=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 ov,this.potentialVariableMap=null,this.id=w(),P(this),this.options=e||new bs({}),this.RTL=!!this.options.RTL,this.horizontalLayout=!!this.options.horizontalLayout,this.toolboxPosition=this.options.toolboxPosition,this.connectionChecker=new(v(he.CONNECTION_CHECKER,this.options,!0))(this),this.variableMap=new jp(this)}dispose(){this.listeners.length=0,this.clear(),me(this)}sortObjects(e,t){const o=Math.sin(Xa(In.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(!Ge(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){Ge(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(!Ge(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 u=[n];t.length&&n.group&&n.group===t[t.length-1].group;){const m=t.pop();m&&u.push(m)}for(t=0;t<u.length;t++)o.push(u[t]);i.setRecordUndo$$module$build$src$core$events$utils(!1);try{for(o=0;o<u.length;o++)u[o].run(e)}finally{i.setRecordUndo$$module$build$src$core$events$utils(!0)}}}clearUndo(){this.undoStack_.length=0,this.redoStack_.length=0,W()}addChangeListener(e){return this.listeners.push(e),e}removeChangeListener(e){Ge(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 jp(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 F()}};In.SCAN_ANGLE=3;var XS=100,pv=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 u=0;u<e.length;u++){const m=e[u],E=m.match(/\.(\w+)$/);if(E&&o.canPlayType("audio/"+E[1])){var n=new globalThis.Audio(m);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(),El||ry)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()<XS||(this.lastSound=e,o=El||zh?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}},ZS=20,ps=class extends In{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(v(he.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager),this.setMetrics=e.setMetrics||ps.setTopLevelWorkspaceMetrics,this.componentManager=new gt,this.connectionDBList=kn.init(this.connectionChecker),this.audioManager=new pv(e.parentWorkspace),this.grid=this.options.gridPattern?new _p(this.options.gridPattern,e.gridOptions):null,this.markerManager=new Lr(this),Pt&&Ya&&this.registerToolboxCategoryCallback(np,Ya),Ai&&yl&&this.registerToolboxCategoryCallback(Mp,yl),Xt&&$l&&(this.registerToolboxCategoryCallback(tc,$l),this.addChangeListener(Jd)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new uv(this,this.options.theme||ql),this.themeManager_.subscribeWorkspace(this);let t;this.renderer=Zd(this.options.renderer||"geras",this.getTheme(),(t=this.options.rendererOverrides)!=null?t:void 0),this.cachedParentSvgSize=new Xe(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=ql),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(oe(q.THEME_CHANGE))(this.getTheme().name,this.id);B(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 u=ir(e);(e===this.getCanvas()||e===this.getBubbleCanvas())&&(n=1),t+=u.x*n,o+=u.y*n,e=e.parentNode}while(e&&e!==this.getParentSvg()&&e!==this.getInjectionDiv());return new fe(t,o)}getCachedParentSvgSize(){const e=this.cachedParentSvgSize;return new Xe(e.width,e.height)}getOriginOffsetInPixels(){return La(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_=ee(V.G,{class:"blocklyWorkspace"}),e&&(this.svgBackground_=ee(V.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 HS(this),this.svgBlockCanvas_=this.layerManager.getBlockLayer(),this.svgBubbleCanvas_=this.layerManager.getBubbleLayer(),this.isFlyout||(K(this.svgGroup_,"pointerdown",this,this.onMouseDown,!1),this.dummyWheelListener=()=>{},document.body.addEventListener("wheel",this.dummyWheelListener),K(this.svgGroup_,"wheel",this,this.onMouseWheel)),this.options.hasCategories&&(this.toolbox=new(v(he.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=v(he.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_&&Ze(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&&Ze(e.parentNode)}this.resizeHandlerWrapper&&(G(this.resizeHandlerWrapper),this.resizeHandlerWrapper=null),this.dummyWheelListener&&(document.body.removeEventListener("wheel",this.dummyWheelListener),this.dummyWheelListener=null)}addTrashcan(){this.trashcan=ps.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 $y(this);const e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}addFlyout(e){const t=new bs({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(v(he.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(v(he.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(gt.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),o=[];for(let n=0,u;u=e[n];n++){u.position(t,o);const m=u.getBoundingRectangle();m&&o.push(m)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations()}updateScreenCalculationsIfScrolled(){const e=Pu();fe.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(oe(q.VIEWPORT_CHANGE))(t,o,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=t,this.oldLeft=o,B(n)}}}translate(e,t){let o;(o=this.layerManager)==null||o.translateLayers(new fe(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()),Is().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):Ge(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(gt.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){al(this,e,t)}moveDrag(e){return ll(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(ko.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=Re(e);if(Uh)var u=e.metaKey;t&&(e.ctrlKey||u||!o)?(n=-n.y/50,t=be(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 rt(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(m=>m.isMovable());const o=e.filter(m=>!m.isMovable()).map(m=>m.getBoundingRectangle());e=function(m){for(const E of o)if(m.intersects(E))return E;return null};var n=0;const u=this.renderer.getConstants().MIN_BLOCK_HEIGHT;for(const m of t){for(t=m.getBoundingRectangle(),m.moveBy(-t.left,n-t.top,["cleanup"]),m.snapToGrid(),t=m.getBoundingRectangle(),n=e(t);n!=null;)n=n.top+n.getHeight()+u,m.moveBy(0,n-t.top,["cleanup"]),m.snapToGrid(),t=m.getBoundingRectangle(),n=e(t);n=m.getRelativeToSurfaceXY().y+m.getHeightWidth().height+u}i.setGroup$$module$build$src$core$events$utils(!1),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.options.readOnly&&!this.isFlyout){var t=He.registry.getContextMenuOptions(He.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(t,e),fr(e,t,this.RTL,this)}}updateToolbox(e){if(e=Pa(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(Ba(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():(ie(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 u=this.getCanvas().getCTM(),m=this.getParentSvg().createSVGPoint();m.x=e,m.y=t,m=m.matrixTransform(u.inverse()),e=m.x,t=m.y,u=u.translate(e*(1-o),t*(1-o)).scale(o),this.scrollX=u.e,this.scrollY=u.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*ZS,u=o.right-o.left+n;if(o=o.bottom-o.top+n,u){this.flyout&&(this.horizontalLayout?(e+=this.flyout.getHeight(),o+=this.flyout.getHeight()/this.scale):(t+=this.flyout.getWidth(),u+=this.flyout.getWidth()/this.scale)),t/=u,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(){Ie(this.getCanvas(),"blocklyCanvasTransitioning"),Ie(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}endCanvasTransition(){Be(this.getCanvas(),"blocklyCanvasTransitioning"),Be(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){Ge(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 ko(e,this):null}clearGesture(){this.currentGesture_=null}cancelCurrentGesture(){this.currentGesture_&&this.currentGesture_.cancel()}getAudioManager(){return this.audioManager}getGrid(){return this.grid}hideChaff(e=!1){mo(),mr(this),Gs(),this.hideComponents(e)}hideComponents(e=!1){this.getComponentManager().getComponents(gt.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)}},Fp=class extends Es{constructor(e,t,o){super(o),this.type=q.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 Fp),t.oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};a(he.EVENT,q.SELECTED,Fp);var Kr=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 fe(e.blockState.x||0,e.blockState.y||0),i.disable$$module$build$src$core$events$utils();let n;try{n=go(e.blockState,t),bb(n,o)}finally{i.enable$$module$build$src$core$events$utils()}return n&&(k()&&!n.isShadow()&&B(new(oe(q.BLOCK_CREATE))(n)),i.setSelected$$module$build$src$core$common(n),n)}};Kr.TYPE="block",Wa(Kr.TYPE,new Kr);var ac={};ac.bumpIntoBounds=cn,ac.bumpIntoBoundsHandler=oh,ac.bumpTopObjectsIntoBounds=vl;var gv=class{constructor(e){this.block=e,this.connectionPreviewer=this.connectionCandidate=this.startLoc=this.startChildConn=this.startParentConn=null,this.dragging=!1,this.dragOffset=new fe(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(v(he.CONNECTION_PREVIEWER,this.workspace.options))(this.block),co(),this.workspace.setResizesEnabled(!1),an(),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=fe.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 u;this.startChildConn=(u=this.block.nextConnection)==null?void 0:u.targetConnection}this.block.unplug(e),Fd(this.block)}fireDragStartEvent(){const e=new(oe(q.BLOCK_DRAG))(this.block,!0,this.block.getDescendants(!1));B(e)}fireDragEndEvent(){const e=new(oe(q.BLOCK_DRAG))(this.block,!1,this.block.getDescendants(!1));B(e)}fireMoveEvent(){if(!this.block.isDeadOrDying()){var e=new(oe(q.BLOCK_MOVE))(this.block);e.setReason(["drag"]),e.oldCoordinate=this.startLoc,e.recordNew(),B(e)}}drag(e){if(this.block.isShadow()){let t;(t=this.block.getParent())==null||t.drag(fe.sum(e,this.dragOffset))}else this.block.moveDuringDrag(e),this.updateConnectionPreview(this.block,fe.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:u,neighbour:m}=t;t=u.type===Se.OUTPUT_VALUE||u.type===Se.PREVIOUS_STATEMENT,o=m.isConnected()&&!m.targetBlock().isInsertionMarker(),t&&o&&!this.orphanCanConnectAtEnd(e,m.targetBlock(),u.type)?this.connectionPreviewer.previewReplacement(u,m,m.targetBlock()):this.connectionPreviewer.previewConnection(u,m)}else this.connectionPreviewer.hidePreview(),this.connectionCandidate=null}orphanCanConnectAtEnd(e,t,o){return!!Qe.getConnectionForOrphanedConnection(e,o===Se.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}currCandidateIsBetter(e,t,o){const{local:n,neighbour:u}=e;e=new fe(n.x,n.y);const m=new fe(u.x,u.y);return t=fe.distance(fe.sum(e,t),m),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 u of e){const{connection:m,radius:E}=u.closest(o,t);m&&(n={local:u,neighbour:m,distance:E},o=E)}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(),uo(),an(),this.connectionPreviewer.hidePreview(),!this.block.isDeadOrDying()&&this.dragging){let t;(t=this.workspace.getLayerManager())==null||t.moveOffDragLayer(this.block,Go),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,u=this.block.getRootBlock();Is().then(()=>{dl(n.getSourceBlock()),setTimeout(()=>{u.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 Se.INPUT_VALUE:this.startParentConn.connect(this.block.outputConnection);break;case Se.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,Go),cn(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}}},mv=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()}},zp=class extends mv{constructor(){super(),this.type="cursor"}next(){var e=this.getCurNode();if(!e)return null;for(e=e.next();e&&e.next()&&(e.getType()===re.types.NEXT||e.getType()===re.types.BLOCK);)e=e.next();return e&&this.setCurNode(e),e}in(){var e=this.getCurNode();if(!e)return null;(e.getType()===re.types.PREVIOUS||e.getType()===re.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()===re.types.NEXT||e.getType()===re.types.BLOCK);)e=e.prev();return e&&this.setCurNode(e),e}out(){var e=this.getCurNode();return e?((e=e.out())&&e.getType()===re.types.BLOCK&&(e=e.prev()||e),e&&this.setCurNode(e),e):null}};a(he.CURSOR,Js,zp);var Yr=class extends zp{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===re.types.OUTPUT||e===re.types.INPUT||e===re.types.FIELD||e===re.types.NEXT||e===re.types.PREVIOUS||e===re.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)}};Yr.registrationName="basicCursor",a(he.CURSOR,Yr.registrationName,Yr);var fv=class extends Yr{validNode_(e){let t=!1;const o=e&&e.getType();return e&&(e=e.getLocation(),o===re.types.FIELD&&e&&e.isTabNavigable()&&e.isClickable()&&(t=!0)),t}},$v=10,Zt=class extends Qe{constructor(e,t){super(e,t),this.highlighted=!1,this.targetConnection=null,this.db=e.workspace.connectionDBList[t],this.dbOpposite=e.workspace.connectionDBList[Ri[t]],this.offsetInBlock=new fe(0,0),this.trackedState=Zt.TrackedState.WILL_TRACK}dispose(){super.dispose(),this.trackedState===Zt.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()*$v),n=i.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*$v),u=e.sourceBlock_.getRootBlock(),m=this.sourceBlock_.getRootBlock();if(!u.isInFlyout&&!m.isInFlyout){var E=!0;if(m.isMovable())u.isMovable()&&t&&(n=-n);else if(u.isMovable())E=!1,o=-o,n=-n;else return;t=E?e:this,e=E?this:e,u=E?m:u,(m=ke()===u)||u.addSelect(),u.RTL&&(o=-o),u.moveBy(t.x+o-e.x,t.y+n-e.y,["bump"]),m||u.removeSelect()}}}moveTo(e,t){let o=!1;return this.trackedState===Zt.TrackedState.WILL_TRACK?(this.db.addConnection(this,t),this.trackedState=Zt.TrackedState.TRACKED,o=!0):this.trackedState===Zt.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=fe.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===Zt.TrackedState.TRACKED||!e&&this.trackedState===Zt.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db.addConnection(this,this.y),this.trackedState=Zt.TrackedState.TRACKED):(this.trackedState===Zt.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),this.trackedState=Zt.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 u=0;u<n.length;u++)n[u].setTracking(!1);for(const u of o.getIcons())en(u)&&u.setBubbleVisible(!1)}}}startTrackingAll(){this.setTracking(!0);let e=[];if(this.type!==Se.INPUT_VALUE&&this.type!==Se.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(j()){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 u=t.getSourceBlock(),m=o.getSourceBlock();super.disconnectInternal(e),u.queueRender(),m.updateDisabled(),m.queueRender(),m.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=ke();(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"})(Zt||(Zt={})),Zt.TrackedState;var _s=class extends Yo{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 fe(0,0),this.dragStrategy=new gv(this),!e.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=e,this.svgGroup=ee(V.G,{}),this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup,this.style),e=this.pathObject.svgPath,e.tooltip=this,on(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&&K(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){co(),super.setParent(e),uo();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 u=ir(n);t+=u.x,o+=u.y,n=n.parentNode}while(n&&!e.hasLayer(n));return new fe(t,o)}moveBy(e,t,o){if(this.parentBlock_)throw Error("Block has parent");const n=k();let u=null;n&&(u=new(oe(q.BLOCK_MOVE))(this),o&&u.setReason(o)),e=new fe(e,t),t=this.getRelativeToSurfaceXY(),e=fe.sum(t,e),this.translate(e.x,e.y),this.updateComponentLocations(e),n&&u&&(u.recordNew(),B(u)),this.workspace.resizeContents()}translate(e,t){this.translation=`translate(${e}, ${t})`,this.relativeCoords=new fe(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 rt(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=Ar,o=Ml;for(let u=0,m;m=this.inputList[u];u++)m.name!==t&&m.setVisible(!e);for(var n of this.getIcons())n.updateCollapsed();e?(e=this.toString(dv),(n=this.getField(o))?n.setValue(e):(this.getInput(t)||this.appendDummyInput(t)).appendField(new Di(e),o)):(this.updateDisabled(),this.removeInput(t))}tab(e,t){const o=new fv;o.setCurNode(re.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=He.registry.getContextMenuOptions(He.ScopeType.BLOCK,{block:this});return this.customContextMenu&&this.customContextMenu(e),e}showContextMenu(e){const t=this.generateContextMenu();t&&t.length&&(fr(e,t,this.RTL,this.workspace),Dd(this))}updateComponentLocations(e){this.dragging||this.updateConnectionLocations(e),this.updateIconLocations(e),this.updateFieldLocations(e);for(const t of this.getChildren(!1))t.updateComponentLocations(fe.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="",Tr.push(...this.getConnections_(!0)),Ie(this.svgGroup,"blocklyDragging")):(Tr.length=0,Be(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,bd(),$r(),t&&(this.unplug(e),ul(this)),t=ke(),t instanceof Yo){let o=t;for(;o!==null;)o===this&&t.unselect(),o=o.getParent()}super.dispose(!!e),Ze(this.svgGroup)}disposeInternal(){this.disposing=!0,super.disposeInternal(),ke()===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:Kr.TYPE,blockState:as(this,{addCoordinates:!0,addNextBlocks:!1}),typeCounts:Pe(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,u;u=o.fieldRow[n];n++)u.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(Io.TYPE),e){let n=this.getSurroundParent(),u=null;for(;n;)n.isCollapsed()&&(u=n),n=n.getSurroundParent();u&&u.setWarningText(i.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,_s.COLLAPSED_WARNING_ID),o?o.addMessage(e,t):this.addIcon(new Io(this).addMessage(e,t))}else o&&(t?(o.addMessage("",t),o.getText()||this.removeIcon(Io.TYPE)):this.removeIcon(Io.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){_("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,u=n.childNodes;if(u[u.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 Zt(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===Se.NEXT_STATEMENT||e.type===Se.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 Fu(this)}render(){this.queueRender(),po()}renderEfficiently(){co(),this.isCollapsed()&&this.updateCollapsed(),this.isEnabled()||this.updateDisabled(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),uo(),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(Lr.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"},as(this)),t=new Set(["id","height","width","pinned","enabled"]),o=function(n){for(const u in n)t.has(u)?delete n[u]:typeof n[u]=="object"&&o(n[u])};return o(e),[e]}};_s.INLINE=-1,_s.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var bv=class{constructor(){}onDragEnter(e){}onDragOver(e){}onDragExit(e){}onDrop(e){}getClientRect(){return null}shouldPreventMove(e){return!1}},lc=class extends bv{constructor(){super(),this.wouldDelete_=!1}wouldDelete(e){return e instanceof _s?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e)):this.updateWouldDelete_(ms(e)&&e.isDeletable()),this.wouldDelete_}updateWouldDelete_(e){this.wouldDelete_=e}},Up=class extends Es{constructor(e,t){super(t),this.type=q.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 Up),t.isOpen=e.isOpen,t}};a(he.EVENT,q.TRASHCAN_OPEN,Up);var yv=class extends lc{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 bs({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===ze.TOP?ze.BOTTOM:ze.TOP,this.flyout=new(v(he.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===ze.RIGHT?ze.LEFT:ze.RIGHT,this.flyout=new(v(he.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){this.svgGroup=ee(V.G,{class:"blocklyTrash"});let e;const t=String(Math.random()).substring(2);e=ee(V.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),ee(V.RECT,{width:En,height:cc,y:xn},e);const o=ee(V.IMAGE,{width:Jt.width,x:-Hp,height:Jt.height,y:-Wp,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return o.setAttributeNS(ls,"xlink:href",this.workspace.options.pathToMedia+Jt.url),e=ee(V.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),ee(V.RECT,{width:En,height:xn},e),this.svgLid=ee(V.IMAGE,{width:Jt.width,x:-Hp,height:Jt.height,y:-Wp,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(ls,"xlink:href",this.workspace.options.pathToMedia+Jt.url),ue(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),ue(this.svgGroup,"pointerup",this,this.click),ue(o,"pointerover",this,this.mouseOver),ue(o,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){0<this.workspace.options.maxTrashcanContents&&(Nt(this.flyout.createDom(V.SVG),this.workspace.getParentSvg()),this.flyout.init(this.workspace)),this.workspace.getComponentManager().addComponent({component:this,weight:gt.ComponentWeight.TRASHCAN_WEIGHT,capabilities:[gt.Capability.AUTOHIDEABLE,gt.Capability.DELETE_AREA,gt.Capability.DRAG_TARGET,gt.Capability.POSITIONABLE]}),this.initialized=!0,this.setLidOpen(!1)}dispose(){this.workspace.getComponentManager().removeComponent("trashcan"),this.svgGroup&&Ze(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=Ua(this.workspace,e);e=za(o,new Xe(En,cc+xn),QS,vv,e,this.workspace),t=Ha(e,vv,o.vertical===wo.TOP?Ho.DOWN:Ho.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 u;(u=this.flyout)==null||u.position()}}getBoundingRectangle(){return new rt(this.top,this.top+cc+xn,this.left,this.left+En)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();const t=e.top+Wp-uc;return e=e.left+Hp-uc,new rt(t,t+xn+cc+2*uc,e,e+En+2*uc)}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=sT;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*wv),t=_v+this.lidOpen*(oT-_v),this.svgGroup&&(this.svgGroup.style.opacity=`${t}`),this.lidOpen>this.minOpenness&&1>this.lidOpen&&(this.lidTask=setTimeout(this.animateLid.bind(this),tT/e))}setLidAngle(e){const t=this.workspace.toolboxPosition===ze.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;let o;(o=this.svgLid)==null||o.setAttribute("transform","rotate("+(t?-e:e)+","+(t?4:En-4)+","+(xn-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*wv)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&!this.workspace.isDragging()&&this.openFlyout()}fireUiEvent(e){e=new(oe(q.TRASHCAN_OPEN))(e,this.workspace.id),B(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||!I(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(eT)}}}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 u in n){var m=n[u];const E=m.block;m=m.shadow,E&&t(E),m&&t(m)}o.next&&(u=o.next,o=u.block,u=u.shadow,o&&t(o),u&&t(u))}}return e=JSON.parse(JSON.stringify(e)),t(e),Object.assign({},{kind:"BLOCK"},e)}},En=47,cc=44,xn=16,vv=20,QS=20,uc=10,Hp=0,Wp=32,eT=.1,tT=80,sT=4,_v=.4,oT=.8,wv=45,st=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 u=n.indexOf(t);return-1<u?(n.splice(u,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 fo(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 u,m;if((m=(u=o).callback)!=null&&m.call(u,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 st.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 st.modifierKeys))throw Error(t+" is not a valid modifier key.")}createSerializedKey(e,t){let o="";if(t){this.checkModifiers(t);for(const n in st.modifierKeys)t.includes(st.modifierKeys[n])&&(o!==""&&(o+="+"),o+=n)}return o!==""&&e?o+="+"+e:e&&(o=`${e}`),o}};st.registry=new st,(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"})(st||(st={}));var Gp=null,Vp=null,iT={duplicateInternal:kb,copyInternal:wb},Jr={};Jr.BlockPaster=Kr,Jr.TEST_ONLY=iT,Jr.paste=jo,Jr.registry=qh;var Qs;(function(e){e.ESCAPE="escape",e.DELETE="delete",e.COPY="copy",e.CUT="cut",e.PASTE="paste",e.UNDO="undo",e.REDO="redo"})(Qs||(Qs={}));var Jo=null,qo=null,Dn=null;hh();var eo={};eo.names=Qs,eo.registerCopy=ah,eo.registerCut=lh,eo.registerDefaultShortcuts=hh,eo.registerDelete=rh,eo.registerEscape=nh,eo.registerPaste=ch,eo.registerRedo=dh,eo.registerUndo=uh;var nT=class{constructor(e,t){this.procedureModelClass=e,this.parameterModelClass=t,this.priority=yy}save(e){return e=e.getProcedureMap().getProcedures().map(t=>ph(t)),e.length?e:null}load(e,t){const o=t.getProcedureMap();for(const n of e)o.add(gh(this.procedureModelClass,this.parameterModelClass,n,t))}clear(e){e.getProcedureMap().clear()}},dc={};dc.ProcedureSerializer=nT,dc.loadProcedure=gh,dc.saveProcedure=ph;var kv=class{constructor(){this.priority=by}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()}};rr("variables",new kv);var Cv={};Cv.VariableSerializer=kv;var Kp={};Kp.load=Sb,Kp.save=Cb;var rT={blocks:Nr,exceptions:wi,priorities:NS,procedures:dc,registry:Jh,variables:Cv,workspaceComments:Rl,workspaces:Kp},Yp=class{constructor(e,t,o,n,u){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 m=t&&o;t&&(this.hScroll=new kt(e,!0,m,n,u)),o&&(this.vScroll=new kt(e,!1,m,n,u)),m&&(this.corner_=ee(V.RECT,{height:kt.scrollbarThickness,width:kt.scrollbarThickness,class:"blocklyScrollbarBackground"}),Nt(this.corner_,e.getBubbleCanvas()))}dispose(){Ze(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)}},Jp=class{constructor(e){this.workspace_=e}getDimensionsPx_(e){let t=0,o=0;return e&&(t=e.getWidth(),o=e.getHeight()),new Xe(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(),u=!!this.workspace_.getToolbox();var m;const E=!((m=this.workspace_.getFlyout())!=null&&m.autoClose);m=u?o.position:n.position;const L=m===ze.TOP;return m===ze.LEFT&&(u&&(e+=o.width),E&&(e+=n.width)),L&&(u&&(t+=o.height),E&&(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(),u=!!this.workspace_.getToolbox();var m;const E=!((m=this.workspace_.getFlyout())!=null&&m.autoClose);m=u?o.position:n.position;const L=m===ze.LEFT||m===ze.RIGHT;return(m===ze.TOP||m===ze.BOTTOM)&&(u&&(t.height-=o.height),E&&(t.height-=n.height)),L&&(u&&(t.width-=o.width),E&&(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,u=e.width;e=e.height;const m=u/2,E=e/2;return{top:Math.min(t.top-E,o-e),bottom:Math.max(o+E,t.top+e),left:Math.min(t.left-m,n-u),right:Math.max(n+m,t.left+u)}}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 u=o.left!==void 0?o.left:t.left;return{top:n/e,left:u/e,width:((o.right!==void 0?o.right:t.right)-u)/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(),u=this.getViewMetrics(),m=this.getContentMetrics(),E=this.getScrollMetrics(!1,u,m);return{contentHeight:m.height,contentWidth:m.width,contentTop:m.top,contentLeft:m.left,scrollHeight:E.height,scrollWidth:E.width,scrollTop:E.top,scrollLeft:E.left,viewHeight:u.height,viewWidth:u.width,viewTop:u.top,viewLeft:u.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}}};a(he.METRICS_MANAGER,Js,Jp),"Blockly"in globalThis||(globalThis.Blockly={Msg:Ey});var Sv=class extends oc{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&&Ze(this.selectedGlowFilter),this.replacementGlowFilter&&Ze(this.replacementGlowFilter)}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,o=ss("c",[De(25,-e),De(71,-e),De(t,0)]);return{height:e,width:t,path:o}}makeHexagonal(){function e(o,n,u){var m=o/2;return m=m>t?t:m,u=u?-1:1,o=(n?-1:1)*o/2,Ys(-u*m,o)+Ys(u*m,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,u,m){const E=n>o?n-o:0;n=(n>o?o:n)/2;const L=m===u?"0":"1";return wt("a","0 0,"+L,n,De((m?1:-1)*n,(u?-1:1)*n))+Te("v",(u?-1:1)*E)+wt("a","0 0,"+L,n,De((m?-1:1)*n,(u?-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,u){o-=2*t;const m=u===n?"0":"1";return wt("a","0 0,"+m,t,De((u?1:-1)*t,(n?-1:1)*t))+Te("v",(n?-1:1)*o)+wt("a","0 0,"+m,t,De((u?-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 Se.INPUT_VALUE:case Se.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 Se.PREVIOUS_STATEMENT:case Se.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(Ce){return ss("c",[De(Ce*u/2,0),De(Ce*u*3/4,E/2),De(Ce*u,E)])+ln([De(Ce*u,m)])+ss("c",[De(Ce*u/4,E/2),De(Ce*u/2,E),De(Ce*u,E)])+Te("h",Ce*n)+ss("c",[De(Ce*u/2,0),De(Ce*u*3/4,-(E/2)),De(Ce*u,-E)])+ln([De(Ce*u,-m)])+ss("c",[De(Ce*u/4,-(E/2)),De(Ce*u/2,-E),De(Ce*u,-E)])}const t=this.NOTCH_WIDTH,o=this.NOTCH_HEIGHT,n=t/3,u=n/3,m=o/2,E=m/2,L=e(1),se=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:o,pathLeft:L,pathRight:se}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=wt("a","0 0,0",e,De(-e,e)),o=wt("a","0 0,1",e,De(-e,e)),n=wt("a","0 0,0",e,De(e,e)),u=wt("a","0 0,1",e,De(e,e));return{width:e,height:e,pathTop:t,pathBottom:n,rightWidth:e,rightHeight:e,pathTopRight:o,pathBottomRight:u}}generateSecondaryColour_(e){return di("#000",e,.15)||e}generateTertiaryColour_(e){return di("#000",e,.25)||e}createDom(e,t,o){super.createDom(e,t,o),e=ee(V.DEFS,{},e),t=ee(V.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),ee(V.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),o=ee(V.FECOMPONENTTRANSFER,{result:"outBlur"},t),ee(V.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},o),ee(V.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),ee(V.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=ee(V.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),ee(V.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=ee(V.FECOMPONENTTRANSFER,{result:"outBlur"},e),ee(V.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),ee(V.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),ee(V.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),ee(V.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;","}"]}},Tv=class extends ic{constructor(e,t){super(e,t)}draw(){const e=this.block_.pathObject;e.beginDrawing(),this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),e.setPath(this.outlinePath_+`
|
|
908
|
+
`+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(z.isSpacer(e)){const n=e.precedesStatement;var t=e.followsStatement;if(n||t){const u=this.constants_.INSIDE_CORNERS;var o=u.rightHeight;o=e.height-(n?o:0),t=t?u.pathBottomRight:"",e=0<o?Te("V",e.yPos+o):"",this.outlinePath_+=t+e+(n?u.pathTopRight:"");return}}this.outlinePath_+=Te("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_+=pt(e.xPos,this.info_.startY),this.outlinePath_+=Te("h",e.width)}drawFlatBottom_(){const e=this.info_.bottomRow;this.positionNextConnection_(),this.outlinePath_+=Te("V",e.baseline),this.outlinePath_+=Te("h",-e.width)}drawInlineInput_(e){this.positionInlineInputConnection_(e);const t=e.input.name;e.connectedBlock||this.info_.isInsertionMarker||(e=xt(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 Te("h",t)+e.shape.pathRightDown(o)+Te("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,u=t.shape.pathRight+Te("h",-(t.notchOffset-n.width))+n.pathTop,m=e.height-2*n.height;t=n.pathBottom+Te("h",t.notchOffset-n.width)+(t.connectedBottomNextConnection?"":t.shape.pathLeft),this.outlinePath_+=Te("H",o)+u+Te("v",m)+t+Te("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}drawConnectionHighlightPath(e){const t=e.connectionModel;if(t.type===Se.NEXT_STATEMENT||t.type===Se.PREVIOUS_STATEMENT||t.type===Se.OUTPUT_VALUE&&!e.isDynamicShape)super.drawConnectionHighlightPath(e);else{e=t.type===Se.INPUT_VALUE?xt(e.connectionWidth,-e.height/2)+this.getInlineInputPath(e):xt(e.width,-e.height/2)+e.shape.pathDown(e.height);var o=t.getSourceBlock(),n,u;(u=(n=o.pathObject).addConnectionHighlight)==null||u.call(n,t,e,t.getOffsetInBlock(),o.RTL)}}},Oi=class extends lt{constructor(e,t,o,n,u,m,E){if(super(lt.SKIP_SETUP),this.imageElement=this.clickHandler=null,this.flipRtl=this.isDirty_=this.EDITABLE=!1,this.altText="",o=Number(_t(o)),t=Number(_t(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 Xe(t,o+Oi.Y_PADDING),this.imageHeight=o,typeof u=="function"&&(this.clickHandler=u),e!==lt.SKIP_SETUP&&(E?this.configure_(E):(this.flipRtl=!!m,this.altText=_t(n)||""),this.setValue(_t(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=_t(e.alt))}initView(){this.imageElement=ee(V.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(ls,"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(ls,"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)}};Oi.Y_PADDING=1,Ks("field_image",Oi),Oi.prototype.DEFAULT_VALUE="";var hc=class extends lt{constructor(e,t,o){super(lt.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!==lt.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 Ct;super.initView(),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot())}isFullBlockField(){const e=this.getSourceBlock();if(!e)throw new Ct;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&&B(new(oe(q.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 Ct;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_?(Be(e,"blocklyInvalidInput"),Ot(e,Dt.INVALID,!1)):(Ie(e,"blocklyInvalidInput"),Ot(e,Dt.INVALID,!0))}if(e=this.getSourceBlock(),!e)throw new Ct;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&&(ay||zh||El)?this.showPromptEditor():this.showInlineEditor(t)}showPromptEditor(){Ka(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 Ct;rl(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 Ct;i.setGroup$$module$build$src$core$events$utils(!0);const t=hi();var o=this.getClickTarget_();if(!o)throw Error("A click target has not been set.");Ie(o,"editing"),o=document.createElement("input"),o.className="blocklyHtmlInput",o.setAttribute("spellcheck",this.spellcheck_);const n=this.workspace_.getScale();var u=this.getConstants().FIELD_TEXT_FONTSIZE*n+"pt";return t.style.fontSize=u,o.style.fontSize=u,u=hc.BORDERRADIUS*n+"px",this.isFullBlockField()&&(u=this.getScaledBBox(),u=(u.bottom-u.top)/2+"px",e=e.getParent()?e.getParent().getColourTertiary():this.sourceBlock_.getColourTertiary(),o.style.border=1*n+"px solid "+e,t.style.borderRadius=u,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=u,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_&&(B(new(oe(q.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=hi().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.");Be(e,"editing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper=K(e,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper=K(e,"input",this,this.onHtmlInputChange)}unbindInputEvents_(){this.onKeyDownWrapper&&(G(this.onKeyDownWrapper),this.onKeyDownWrapper=null),this.onKeyInputWrapper&&(G(this.onKeyInputWrapper),this.onKeyInputWrapper=null)}onHtmlInputKeyDown_(e){e.key==="Enter"?(pi(this),Gs()):e.key==="Escape"?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),pi(this),Gs()):e.key==="Tab"&&(pi(this),Gs(),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&&B(new(oe(q.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_(){Is().then(()=>{const e=this.getSourceBlock();if(!e)throw new Ct;const t=hi(),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 _s?(cn(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}};hc.BORDERRADIUS=4;var pc=class extends hc{constructor(e,t,o){super(e,t,o)}doClassValidation_(e){return e===void 0?null:`${e}`}static fromJson(e){return new this(_t(e.text),void 0,e)}};Ks("field_input",pc),pc.prototype.DEFAULT_VALUE="";var Iv=class extends Sp{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){return!!e.outputConnection}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},gc=class extends Hr{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)}}},Ev=class extends Xs{constructor(e){super(e),this.width=this.height=0,this.type|=z.getType("RIGHT_CONNECTION")}},xv=class extends Dp{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}},Dv=class extends Vr{constructor(e,t){super(e,t),this.isInline=!0,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.topRow=new xv(this.constants_),this.bottomRow=new Iv(this.constants_),this.isMultiRow=!t.getInputsInline()||t.isCollapsed(),this.hasStatementInput=0<t.statementInputCount,this.rightSide=this.outputConnection?new Ev(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 xo||e instanceof hs||t instanceof hs?!0:e instanceof i.ValueInput$$module$build$src$core$inputs$value_input||e instanceof Zs||e instanceof xo?!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&&z.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:e&&z.isLeftRoundedCorner(e)&&t&&(z.isPreviousConnection(t)||z.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&z.isLeftSquareCorner(e)&&t&&z.isHat(t)?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING}getSpacerRowHeight_(e,t){if(z.isTopRow(e)&&z.isBottomRow(t))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;const o=z.isInputRow(e)&&e.hasStatement,n=z.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):z.isTopRow(e)?e.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):z.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 z.isInputRow(e)&&e.hasStatement||z.isInputRow(t)&&t.hasStatement?Math.max(o,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):o}getElemCenterline_(e,t){if(e.hasStatement&&!z.isSpacer(t)&&!z.isStatementInput(t))return e.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(z.isInlineInput(t)&&t instanceof Ko){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 Zs||e instanceof xo)&&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 hs){t.elements.push(new gc(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 u=e.elements[n];if(z.isSpacer(u)&&(o=u),z.isField(u)&&u instanceof Sn&&u.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 u=2;u<this.rows.length-1;u+=2){var o=this.rows[u-1];const m=this.rows[u];var n=this.rows[u+1];if(o=u===2?!!this.topRow.hasPreviousConnection:!!o.followsStatement,n=u+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!n.precedesStatement,z.isInputRow(m)&&m.hasStatement){m.measure();let E,L;t=m.width-((L=(E=m.getLastInput())==null?void 0:E.width)!=null?L:0)+e}else if(o&&(u===2||n)&&z.isInputRow(m)&&!m.hasStatement){n=m.xPos,o=null;for(let E=0;E<m.elements.length;E++){const L=m.elements[E];z.isSpacer(L)&&(o=L),o&&(z.isField(L)||z.isInput(L))&&n<t&&!(z.isField(L)&&L instanceof Sn&&(L.field instanceof Di||L.field instanceof Oi))&&(o.width+=t-n),n+=L.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(!z.isInputRow(o))continue;e=o.elements[o.elements.length-2];let n=this.getNegativeSpacing_(o.elements[1]),u=this.getNegativeSpacing_(e);e=n+u;const m=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-e<m&&(e=this.width-m,n=e/2,u=e/2),o.elements.unshift(new ds(this.constants_,-n)),o.elements.push(new ds(this.constants_,-u))}if(e)for(this.width-=e,this.widthWithChildren-=e,this.rightSide.xPos-=e,t=0;t<this.rows.length;t++)o=this.rows[t],z.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(z.isInlineInput(e)&&e instanceof Ko){const u=e.connectedBlock;return e=u?u.pathObject.outputShapeType:e.shape.type,e==null||u&&u.outputConnection&&(u.statementInputCount||u.nextConnection)||o===n.SHAPES.HEXAGONAL&&o!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[o][e]}return z.isField(e)&&e instanceof Sn?o===n.SHAPES.ROUND&&e.field instanceof pc?t-2.75*n.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[o][0]:z.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let n=2;n<this.rows.length-1;n+=2){const u=this.rows[n-1],m=this.rows[n],E=this.rows[n+1];var e=n===2,t=n+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!E.precedesStatement;if(e?this.topRow.hasPreviousConnection:u.followsStatement){var o=m.elements[1];if(o=m.elements.length===3&&o instanceof Sn&&(o.field instanceof Di||o.field instanceof Oi),!e&&o)u.height-=this.constants_.SMALL_PADDING,E.height-=this.constants_.SMALL_PADDING,m.height-=this.constants_.MEDIUM_PADDING;else if(!e&&!t)u.height+=this.constants_.SMALL_PADDING;else if(t){for(e=!1,t=0;t<m.elements.length;t++)if(o=m.elements[t],o instanceof Ko&&z.isInlineInput(o)&&o.connectedBlock&&!o.connectedBlock.isShadow()&&40<=o.connectedBlock.getHeightWidth().height){e=!0;break}e&&(u.height-=this.constants_.SMALL_PADDING,E.height-=this.constants_.SMALL_PADDING)}}}}finalize_(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),super.finalize_(),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},Av=class extends Op{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=ee(V.CIRCLE,{r:this.constants_.CURSOR_RADIUS,"stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.hide(),this.isCursor()){const e=this.getBlinkProperties_();ee(V.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)}}},Rv=class extends nc{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,ee(V.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)}},qp=class extends rc{constructor(e){super(e)}makeConstants_(){return new Sv}makeRenderInfo_(e){return new Dv(this,e)}makeDrawer_(e,t){return new Tv(e,t)}makeMarkerDrawer(e,t){return new Av(e,this.getConstants(),t)}makePathObject(e,t){return new Rv(e,t,this.getConstants())}getConstants(){return this.constants_}getConnectionPreviewMethod(e,t,o){return _("getConnectionPreviewMethod","v10","v12","an IConnectionPreviewer, if it fulfills your use case."),t.type===Se.OUTPUT_VALUE?e.isConnected()?vs.PREVIEW_TYPE.REPLACEMENT_FADE:vs.PREVIEW_TYPE.INPUT_OUTLINE:super.getConnectionPreviewMethod(e,t,o)}};_r("zelos",qp);var Ov=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===Se.PREVIOUS_STATEMENT||t.type===Se.NEXT_STATEMENT||!(this.workspace.getRenderer()instanceof qp)}previewMarker(e,t){const o=e.getSourceBlock(),n=this.createInsertionMarker(o),u=this.getMatchingConnection(o,n,e);if(!u)return null;n.queueRender(),po(),u.connect(t);const m={x:t.x-u.x,y:t.y-u.y},E=u.getOffsetInBlock().clone();return Is().then(()=>{if(!n.isDeadOrDying()){i.disable$$module$build$src$core$events$utils();try{n==null||n.positionNearConnection(u,m,E),n==null||n.getSvgRoot().setAttribute("visibility","visible")}finally{i.enable$$module$build$src$core$events$utils()}}}),u}createInsertionMarker(e){const t=as(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!t)throw Error(`Failed to serialize source block. ${e.toDevString()}`);e=go(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 u;(u=e.targetBlock())==null||u.unplug(!1)}t.dispose()}dispose(){this.hidePreview()}};a(he.CONNECTION_PREVIEWER,Js,Ov);var Xo={};Xo.Align=i.Align$$module$build$src$core$inputs$align,Xo.DummyInput=Zs,Xo.EndRowInput=xo,Xo.Input=Tn,Xo.StatementInput=hs,Xo.ValueInput=i.ValueInput$$module$build$src$core$inputs$value_input,Xo.inputTypes=i.inputTypes$$module$build$src$core$inputs$input_types;var Mv=!1,Nv;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=ne());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let o=0,n;n=e[o];o++){let u=this.blockToCode(n);Array.isArray(u)&&(u=u[0]),u&&(n.outputConnection&&(u=this.scrubNakedValue(u),this.STATEMENT_PREFIX&&!n.suppressPrefixSuffix&&(u=this.injectId(this.STATEMENT_PREFIX,n)+u),this.STATEMENT_SUFFIX&&!n.suppressPrefixSuffix&&(u+=this.injectId(this.STATEMENT_SUFFIX,n))),t.push(u))}return t=t.join(`
|
|
909
|
+
`),t=this.finish(t),t=t.replace(/^\s+\n/,""),t=t.replace(/\n\s+$/,`
|
|
910
|
+
`),t=t.replace(/[ \t]+\n/g,`
|
|
911
|
+
`)}prefixLines(e,t){return t+e.replace(/(?!\n$)\n/g,`
|
|
912
|
+
`+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(`
|
|
913
|
+
`)}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 u=Math.floor(o);const m=Math.floor(t);if(u<=m&&(u!==m||u!==0&&u!==99)){for(n=!0,u=0;u<this.ORDER_OVERRIDES.length;u++)if(this.ORDER_OVERRIDES[u][0]===o&&this.ORDER_OVERRIDES[u][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(`
|
|
914
|
+
`)),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}},Nv={},Nv.CodeGenerator=i.CodeGenerator$$module$build$src$core$generator;var Lv=class extends Jp{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}}},An;(function(e){e.BLOCK="block",e.BUTTON="button"})(An||(An={}));var aT="WORKSPACE_AT_BLOCK_CAPACITY",mc=class extends lc{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 ps(e),this.workspace_.setMetricsManager(new Lv(this.workspace_,this)),this.workspace_.internalIsFlyout=!0,this.workspace_.setVisible(this.visible),this.id=w(),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_=ee(e,{class:"blocklyFlyout"}),this.svgGroup_.style.display="none",this.svgBackground_=ee(V.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 Yp(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),this.boundEvents.push(K(this.svgGroup_,"wheel",this,this.wheel_)),this.filterWrapper=this.filterForCapacity.bind(this),this.targetWorkspace.addChangeListener(this.filterWrapper),this.boundEvents.push(K(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:gt.ComponentWeight.FLYOUT_WEIGHT,capabilities:[gt.Capability.AUTOHIDEABLE,gt.Capability.DELETE_AREA,gt.Capability.DRAG_TARGET]})}dispose(){this.hide(),this.targetWorkspace.getComponentManager().removeComponent(this.id);for(const e of this.boundEvents)G(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_&&Ze(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 u;(u=this.svgGroup_)==null||u.setAttribute("width",`${e}`);let m;(m=this.svgGroup_)==null||m.setAttribute("height",`${t}`),this.workspace_.setCachedParentSvgSize(e,t),this.svgGroup_&&li(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)G(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=nr(e),e=this.createFlyoutInfo(e),po(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 u of e){if("custom"in u){e=this.getDynamicCategoryContents(u.custom),e=nr(e);const{contents:m,gaps:E}=this.createFlyoutInfo(e);t.push(...m),o.push(...E)}switch(u.kind.toUpperCase()){case"BLOCK":e=u;const m=this.createFlyoutBlock(e);t.push({type:An.BLOCK,block:m}),this.addBlockGap(e,o,n);break;case"SEP":this.addSeparatorGap(u,o,n);break;case"LABEL":e=this.createButton(u,!0),t.push({type:An.BUTTON,button:e}),o.push(n);break;case"BUTTON":e=this.createButton(u,!1),t.push({type:An.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 ys(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=gi(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=[qt]),t=Qi(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&&(sl(o),Ze(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(K(e,"pointerdown",null,this.blockMouseDown(t))),this.listeners.push(K(o,"pointerdown",null,this.blockMouseDown(t))),this.listeners.push(ue(e,"pointerenter",t,()=>{this.targetWorkspace.isDragging()||t.addSelect()})),this.listeners.push(ue(e,"pointerleave",t,()=>{this.targetWorkspace.isDragging()||t.removeSelect()})),this.listeners.push(ue(o,"pointerenter",t,()=>{this.targetWorkspace.isDragging()||t.addSelect()})),this.listeners.push(ue(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=ur(this.targetWorkspace,o),k()){for(i.setGroup$$module$build$src$core$events$utils(!0),o=0;o<e.length;o++){const n=e[o];B(new(oe(q.VAR_CREATE))(n))}B(new(oe(q.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(K(n,"pointerdown",this,this.onMouseDown)),this.buttons_.push(e)}createRect_(e,t,o,n,u){return t=ee(V.RECT,{"fill-opacity":0,x:t,y:o,height:n.height,width:n.width}),t.tooltip=e,on(t),this.workspace_.getCanvas().insertBefore(t,e.getSvgRoot()),this.rectMap_.set(e,t),this.mats[u]=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(Pe(o));for(;o;)o.setDisabledReason(!n,aT),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=go(o,t),this.positionNewBlock(e,t),t}serializeBlock(e){return as(e)}positionNewBlock(e,t){const o=this.targetWorkspace;var n=o.getOriginOffsetInPixels(),u=this.workspace_.getOriginOffsetInPixels();e=e.getRelativeToSurfaceXY(),e.scale(this.workspace_.scale),u=fe.sum(u,e),n=fe.difference(u,n),n.scale(1/o.scale),t.moveTo(new fe(n.x,n.y))}};mc.FlyoutItemType=An;var Xp=class extends mc{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_===ze.LEFT?e.width:o.width-this.width_:this.toolboxPosition_===ze.LEFT?0:o.width:this.toolboxPosition_===ze.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_===ze.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=Re(e);if(t.y){const o=this.workspace_.getMetricsManager(),n=o.getScrollMetrics();t=o.getViewMetrics().top-n.top+t.y;let u;(u=this.workspace_.scrollbar)==null||u.setY(t),mr(this.workspace_),Gs()}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 L=0,se;se=e[L];L++)if(se.type==="block"){var u=se.block;if(!u)continue;var m=u.getDescendants(!1);for(let dt=0,ut;ut=m[dt];dt++)ut.isInFlyout=!0;m=u.getSvgRoot();const Ce=u.getHeightWidth();var E=u.outputConnection?n-this.tabWidth_:n;u.moveBy(E,o),E=this.createRect_(u,this.RTL?E-Ce.width:E,o,Ce,L),this.addBlockListeners_(m,u,E),o+=Ce.height+t[L]}else se.type==="button"&&(u=se.button,this.initFlyoutButton_(u,n,o),o+=u.height+t[L])}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_===ze.LEFT?new rt(-1e9,1e9,-1e9,t+e.width):new rt(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;var t=this.workspace_.getTopBlocks(!1);for(let n=0,u;u=t[n];n++){var o=u.getHeightWidth().width;u.outputConnection&&(o-=this.tabWidth_),e=Math.max(e,o)}for(let n=0,u;u=this.buttons_[n];n++)e=Math.max(e,u.width);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=kt.scrollbarThickness,this.width_!==e){for(let n=0,u;u=t[n];n++){if(this.RTL){o=u.getRelativeToSurfaceXY().x;let m=e/this.workspace_.scale-this.MARGIN;u.outputConnection||(m-=this.tabWidth_),u.moveBy(m-o,0)}this.rectMap_.has(u)&&this.moveRectToBlock_(this.rectMap_.get(u),u)}if(this.RTL)for(let n=0,u;u=this.buttons_[n];n++)t=u.getPosition().y,u.moveTo(e/this.workspace_.scale-u.width-this.MARGIN-this.tabWidth_,t);this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==ze.LEFT||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};Xp.registryName="verticalFlyout",a(he.FLYOUTS_VERTICAL_TOOLBOX,Js,Xp);var Pv=class extends mc{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_===ze.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_===ze.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=Re(e);if(t=t.x||t.y){const o=this.workspace_.getMetricsManager(),n=o.getScrollMetrics();t=o.getViewMetrics().left-n.left+t;let u;(u=this.workspace_.scrollbar)==null||u.setX(t),mr(this.workspace_),Gs()}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 L=0,se;se=e[L];L++)if(se.type==="block"){var u=se.block;if(u==null)continue;var m=u.getDescendants(!1);for(let dt=0,ut;ut=m[dt];dt++)ut.isInFlyout=!0;m=u.getSvgRoot();const Ce=u.getHeightWidth();var E=u.outputConnection?this.tabWidth_:0;E=this.RTL?n+Ce.width:n-E,u.moveBy(E,o),E=this.createRect_(u,E,o,Ce,L),n+=Ce.width+t[L],this.addBlockListeners_(m,u,E)}else se.type==="button"&&(u=se.button,this.initFlyoutButton_(u,n,o),n+=u.width+t[L])}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_===ze.TOP?new rt(-1e9,t+e.height,-1e9,1e9):new rt(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;const t=this.workspace_.getTopBlocks(!1);for(let n=0,u;u=t[n];n++)e=Math.max(e,u.getHeightWidth().height);const o=this.buttons_;for(let n=0,u;u=o[n];n++)e=Math.max(e,u.height);if(e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=kt.scrollbarThickness,this.height_!==e){for(let n=0,u;u=t[n];n++)this.rectMap_.has(u)&&this.moveRectToBlock_(this.rectMap_.get(u),u);this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==ze.TOP||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};a(he.FLYOUTS_HORIZONTAL_TOOLBOX,Js,Pv);var qr=class extends is{constructor(e,t,o,n,u){super(lt.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=qr.dropdownCreate,this.defaultVariableName=typeof e=="string"?e:"",this.size_=new Xe(0,0),e!==lt.SKIP_SETUP&&(u?this.configure_(u):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 Ct;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 Ct;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 Ct;const o=e.getAttribute("id"),n=e.textContent,u=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=i.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,o,n,u),u!==null&&u!==t.type)throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.type+", and does not match variable field that references it: "+Vs(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(qr);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 Ct;this.loadLegacyState(qr,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 Ct;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 Ct;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===Np){i.renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable);return}if(e===Lp){this.sourceBlock_.workspace.deleteVariableById(this.variable.getId());return}}this.setValue(e)}referencesVariables(){return!0}static fromJson(e){return new this(_t(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 u=this.sourceBlock_.workspace.getVariablesOfType(o[n]);t=t.concat(u)}for(t.sort(Or.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,Np]),i.Msg$$module$build$src$core$msg.DELETE_VARIABLE&&o.push([i.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",e),Lp]),o}};Ks("field_variable",qr);var Zp=class extends hc{constructor(e,t,o,n,u,m){super(lt.SKIP_SETUP),this.min_=-1/0,this.max_=1/0,this.precision_=0,this.decimalPlaces=null,this.spellcheck_=!1,e!==lt.SKIP_SETUP&&(m?this.configure_(m):this.setConstraints(t,o,n),this.setValue(e),u&&this.setValidator(u))}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_}`,Ot(e,Dt.VALUEMIN,this.min_)),1/0>this.max_&&(e.max=`${this.max_}`,Ot(e,Dt.VALUEMAX,this.max_)),e}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};Ks("field_number",Zp),Zp.prototype.DEFAULT_VALUE=0;var Bv=class extends Di{constructor(e,t,o){super(String(e??""),t,o),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(_t(e.text),void 0,e)}};Ks("field_label_serializable",Bv);var Mi=class extends lt{constructor(e,t,o){super(lt.SKIP_SETUP),this.SERIALIZABLE=!0,this.CURSOR="default",this.value_=this.value_,this.checkChar=Mi.CHECK_CHAR,e!==lt.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(Mi);return e!==null?e:this.getValueBoolean()}initView(){super.initView();const e=this.getTextElement();Ie(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||Mi.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)}};Mi.CHECK_CHAR="✓",Ks("field_checkbox",Mi),Mi.prototype.DEFAULT_VALUE=!1;var jv=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),ms(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=fe.sum(this.startLoc,t),this.draggable.drag(t,e)}wouldDeleteDraggable(e,t){return(e=this.workspace.getDragTarget(e))&&this.workspace.getComponentManager().hasCapability(e.id,gt.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 u;(u=this.dragTarget)==null||u.onDrop(n)}this.shouldReturnToStart(e,n)&&this.draggable.revertDrag(),(o=ms(n)&&this.wouldDeleteDraggable(e,n))&&this.draggable instanceof _s&&ul(this.draggable.getRootBlock()),this.draggable.endDrag(e),o&&ms(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 _s?e.getRootBlock():e}shouldReturnToStart(e,t){return(e=this.workspace.getDragTarget(e))?e.shouldPreventMove(t):!1}pixelsToWorkspaceUnits(e){return e=new fe(e.x/this.workspace.scale,e.y/this.workspace.scale),this.workspace.isMutator&&e.scale(1/this.workspace.options.parentWorkspace.scale),e}};a(he.BLOCK_DRAGGER,Js,jv);var Xr={};Xr.BlockDragStrategy=gv,Xr.BubbleDragStrategy=qy,Xr.CommentDragStrategy=Wy,Xr.Dragger=jv;var Qp=class extends Es{constructor(e,t,o){super(e?e.workspace.id:void 0),this.type=q.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 Qp),t.isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};a(he.EVENT,q.BLOCK_DRAG,Qp);var eg=class extends ki{constructor(e,t,o,n){super(e),this.type=q.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 eg),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)}};a(he.EVENT,q.BLOCK_FIELD_INTERMEDIATE_CHANGE,eg);var tg=class extends ki{constructor(e){super(e),this.type=q.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 tg),t.oldParentId=e.oldParentId,t.oldInputName=e.oldInputName,e.oldCoordinate&&(o=e.oldCoordinate.split(","),t.oldCoordinate=new fe(Number(o[0]),Number(o[1]))),t.newParentId=e.newParentId,t.newInputName=e.newInputName,e.newCoordinate&&(o=e.newCoordinate.split(","),t.newCoordinate=new fe(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&&fe.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,u=e?this.newInputName:this.oldInputName;if(e=e?this.newCoordinate:this.oldCoordinate,n){var m=t.getBlockById(n);if(!m){console.warn("Can't connect to non-existent block: "+n);return}}if(o.getParent()&&o.unplug(),e)u=o.getRelativeToSurfaceXY(),o.moveBy(e.x-u.x,e.y-u.y,this.reason);else{t=o.outputConnection,(!t||o.previousConnection&&o.previousConnection.isConnected())&&(t=o.previousConnection);let E,L;o=(L=t)==null?void 0:L.type,u?(o=m.getInput(u))&&(E=o.connection):o===Se.PREVIOUS_STATEMENT&&(E=m.nextConnection),E&&t?t.connect(E):console.warn("Can't connect to non-existent input: "+u)}}else console.warn("Can't move non-existent block: "+this.blockId)}};a(he.EVENT,q.BLOCK_MOVE,tg);var sg=class extends Es{constructor(e,t,o){super(e?e.workspace.id:void 0),this.type=q.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 sg),t.isOpen=e.isOpen,t.bubbleType=e.bubbleType,t.blockId=e.blockId,t}},og;(function(e){e.MUTATOR="mutator",e.COMMENT="comment",e.WARNING="warning"})(og||(og={})),a(he.EVENT,q.BUBBLE_OPEN,sg);var to=class extends un{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=j())}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 to),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");ar(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)}}},ig=class extends to{constructor(e,t,o){super(e),this.type=q.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 ig),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)}};a(he.EVENT,q.COMMENT_CHANGE,ig);var ng=class extends to{constructor(e,t){super(e),this.newCollapsed=t,this.type=q.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 ng),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)}};a(he.EVENT,q.COMMENT_COLLAPSE,ng);var rg=class extends to{constructor(e){super(e),this.type=q.COMMENT_CREATE,e&&(this.xml=br(e),this.json=qi(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=Vs(this.xml),e.json=this.json,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new rg),t.xml=i.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}run(e){to.CommentCreateDeleteHelper(this,e)}};a(he.EVENT,q.COMMENT_CREATE,rg);var ag=class extends to{constructor(e){super(e),this.type=q.COMMENT_DELETE,e&&(this.xml=br(e),this.json=qi(e,{addCoordinates:!0}))}run(e){to.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=Vs(this.xml),e.json=this.json,e}static fromJson(e,t,o){return t=super.fromJson(e,t,o??new ag),t.xml=i.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}};a(he.EVENT,q.COMMENT_DELETE,ag);var lg=class extends Es{constructor(e,t){super(e?e.workspace.id:void 0),this.type=q.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 lg),t.isStart=e.isStart,t.commentId=e.commentId,t}};a(he.EVENT,q.COMMENT_DRAG,lg);var cg=class extends to{constructor(e){super(e),this.type=q.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 cg),o=e.oldCoordinate.split(","),t.oldCoordinate_=new fe(Number(o[0]),Number(o[1])),o=e.newCoordinate.split(","),t.newCoordinate_=new fe(Number(o[0]),Number(o[1])),t}isNull(){return fe.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)}};a(he.EVENT,q.COMMENT_MOVE,cg);var ug=class extends to{constructor(e){super(e),this.type=q.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 ug),t.oldSize=new Xe(e.oldWidth,e.oldHeight),t.newSize=new Xe(e.newWidth,e.newHeight),t}isNull(){return Xe.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)}};a(he.EVENT,q.COMMENT_RESIZE,ug);var dg=class extends Es{constructor(e,t,o){super(o),this.type=q.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 dg),t.oldItem=e.oldItem,t.newItem=e.newItem,t}};a(he.EVENT,q.TOOLBOX_ITEM_SELECT,dg);var Fv=class extends un{constructor(e){super(),this.isBlank=!0,this.recordUndo=!1,this.type=q.FINISHED_LOADING,this.isBlank=!!e,e&&(this.workspaceId=e.id)}};a(he.EVENT,q.FINISHED_LOADING,Fv);var zv,Uv,Hv,Wv,Gv,Vv,Kv,Yv,Jv,qv,Xv,Zv,Qv,e_,t_,s_,o_,i_,n_,r_,a_,l_,c_,u_,d_,_e;i.BLOCK_CHANGE$$module$build$src$core$events$events=q.BLOCK_CHANGE,i.BLOCK_CREATE$$module$build$src$core$events$events=q.BLOCK_CREATE,i.BLOCK_DELETE$$module$build$src$core$events$events=q.BLOCK_DELETE,zv=q.BLOCK_DRAG,i.BLOCK_MOVE$$module$build$src$core$events$events=q.BLOCK_MOVE,Uv=q.BLOCK_FIELD_INTERMEDIATE_CHANGE,Hv=q.BUBBLE_OPEN,Wv=q.BLOCK_CHANGE,Gv=q.CLICK,Vv=q.COMMENT_CHANGE,Kv=q.COMMENT_CREATE,Yv=q.COMMENT_DELETE,Jv=q.COMMENT_MOVE,qv=q.COMMENT_RESIZE,Xv=q.COMMENT_DRAG,Zv=q.BLOCK_CREATE,Qv=q.BLOCK_DELETE,e_=q.FINISHED_LOADING,t_=q.MARKER_MOVE,s_=q.BLOCK_MOVE,o_=q.SELECTED,i_=q.THEME_CHANGE,n_=q.TOOLBOX_ITEM_SELECT,r_=q.TRASHCAN_OPEN,a_=q.UI,l_=q.VAR_CREATE,c_=q.VAR_DELETE,u_=q.VAR_RENAME,d_=q.VIEWPORT_CHANGE,_e={},_e.Abstract=un,_e.BLOCK_CHANGE=i.BLOCK_CHANGE$$module$build$src$core$events$events,_e.BLOCK_CREATE=i.BLOCK_CREATE$$module$build$src$core$events$events,_e.BLOCK_DELETE=i.BLOCK_DELETE$$module$build$src$core$events$events,_e.BLOCK_DRAG=zv,_e.BLOCK_FIELD_INTERMEDIATE_CHANGE=Uv,_e.BLOCK_MOVE=i.BLOCK_MOVE$$module$build$src$core$events$events,_e.BUBBLE_OPEN=Hv,_e.BUMP_EVENTS=zb,_e.BlockBase=ki,_e.BlockChange=Ci,_e.BlockCreate=bp,_e.BlockDelete=Ap,_e.BlockDrag=Qp,_e.BlockFieldIntermediateChange=eg,_e.BlockMove=tg,_e.BubbleOpen=sg,_e.BubbleType=og,_e.CHANGE=Wv,_e.CLICK=Gv,_e.COMMENT_CHANGE=Vv,_e.COMMENT_CREATE=Kv,_e.COMMENT_DELETE=Yv,_e.COMMENT_DRAG=Xv,_e.COMMENT_MOVE=Jv,_e.COMMENT_RESIZE=qv,_e.CREATE=Zv,_e.Click=Ph,_e.ClickTarget=Bh,_e.CommentBase=to,_e.CommentChange=ig,_e.CommentCollapse=ng,_e.CommentCreate=rg,_e.CommentDelete=ag,_e.CommentDrag=lg,_e.CommentMove=cg,_e.CommentResize=ug,_e.DELETE=Qv,_e.FINISHED_LOADING=e_,_e.FinishedLoading=Fv,_e.MARKER_MOVE=t_,_e.MOVE=s_,_e.MarkerMove=Rp,_e.SELECTED=o_,_e.Selected=Fp,_e.THEME_CHANGE=i_,_e.TOOLBOX_ITEM_SELECT=n_,_e.TRASHCAN_OPEN=r_,_e.ThemeChange=yp,_e.ToolboxItemSelect=dg,_e.TrashcanOpen=Up,_e.UI=a_,_e.UiBase=Es,_e.VAR_CREATE=l_,_e.VAR_DELETE=c_,_e.VAR_RENAME=u_,_e.VIEWPORT_CHANGE=d_,_e.VarBase=Rr,_e.VarCreate=ip,_e.VarDelete=Pp,_e.VarRename=Bp,_e.ViewportChange=vp,_e.clearPendingUndo=W,_e.disable=i.disable$$module$build$src$core$events$utils,_e.disableOrphans=le,_e.enable=i.enable$$module$build$src$core$events$utils,_e.filter=M,_e.fire=B,_e.fromJson=ce,_e.get=oe,_e.getDescendantIds=ge,_e.getGroup=i.getGroup$$module$build$src$core$events$utils,_e.getRecordUndo=j,_e.isEnabled=k,_e.setGroup=i.setGroup$$module$build$src$core$events$utils,_e.setRecordUndo=i.setRecordUndo$$module$build$src$core$events$utils;var Ms={};Ms.BottomRow=Iv,Ms.ConstantProvider=Sv,Ms.Drawer=Tv,Ms.MarkerSvg=Av,Ms.PathObject=Rv,Ms.RenderInfo=Dv,Ms.Renderer=qp,Ms.RightConnectionShape=Ev,Ms.StatementInput=gc,Ms.TopRow=xv,Oh();var At={};At.registerCleanup=$h,At.registerCollapse=yh,At.registerCollapseExpandBlock=Th,At.registerComment=Ch,At.registerCommentCreate=Rh,At.registerCommentDelete=Dh,At.registerCommentDuplicate=Ah,At.registerCommentOptions=Nb,At.registerDefaultOptions=Oh,At.registerDelete=Eh,At.registerDeleteAll=wh,At.registerDisable=Ih,At.registerDuplicate=kh,At.registerExpand=vh,At.registerHelp=xh,At.registerInline=Sh,At.registerRedo=fh,At.registerUndo=mh;var fc={};fc.CommentView=Vy,fc.RenderedWorkspaceComment=Yl,fc.WorkspaceComment=Kl;var Zr={};Zr.Bubble=it,Zr.MiniWorkspaceBubble=Co,Zr.TextBubble=sv,Zr.TextInputBubble=Xy;var h_=class extends oc{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;","}"])}},p_=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_+`
|
|
915
|
+
`+this.inlineSteps_}drawTopCorner(e){this.steps_+=pt(e.xPos,this.info_.startY);for(let t=0,o;o=e.elements[t];t++)z.isLeftSquareCorner(o)?this.steps_+=this.highlightConstants_.START_POINT:z.isLeftRoundedCorner(o)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):z.isPreviousConnection(o)?this.steps_+=this.notchPaths_.pathLeft:z.isHat(o)?this.steps_+=this.startPaths_.path(this.RTL_):z.isSpacer(o)&&o.width!==0&&(this.steps_+=Te("H",o.xPos+o.width-this.highlightOffset));this.steps_+=Te("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+Te("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_+=xt(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+Te("v",o)}else this.steps_+=xt(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_+=xt(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+Te("v",o)+this.insideCornerPaths_.pathBottom(this.RTL_)+Ys(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=xt(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+Ys(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){const t=e.xPos+e.width-this.highlightOffset;e instanceof xp&&e.followsStatement&&(this.steps_+=Te("H",t)),this.RTL_&&(this.steps_+=Te("H",t),e.height>this.highlightOffset&&(this.steps_+=Te("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=Te("V",e.baseline-this.highlightOffset);else{const t=this.info_.bottomRow.elements[0];z.isLeftSquareCorner(t)?this.steps_+=xt(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):z.isLeftRoundedCorner(t)&&(this.steps_+=xt(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_+=xt(this.info_.startX,e):(this.steps_+=xt(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=Te("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,z.isLeftRoundedCorner(e.elements[0])?this.steps_+=Te("V",this.outsideCornerPaths_.height):this.steps_+=Te("V",e.capline+this.highlightOffset))}drawInlineInput(e){const t=this.highlightOffset,o=e.xPos+e.connectionWidth;var n=e.centerline-e.height/2;const u=e.width-e.connectionWidth,m=n+t;this.RTL_?(n=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=xt(o-t,m)+Te("v",n)+this.puzzleTabPaths_.pathDown(this.RTL_)+Te("v",e)+Te("h",u)):this.inlineSteps_+=xt(e.xPos+e.width+t,m)+Te("v",e.height)+Te("h",-u)+xt(o,n+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},g_=class extends ic{constructor(e,t){super(e,t),this.highlighter_=new p_(t)}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights();const e=this.block_.pathObject;e.setPath(this.outlinePath_+`
|
|
916
|
+
`+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_+=Te("H",e.xPos+e.width)+Te("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)}}},m_=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=pt(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=pt(o,o)+wt("a","0 0,0",e,De(-o-t,e-o)),u=wt("a","0 0,0",e+t,De(e+t,e+t)),m=pt(o,-o)+wt("a","0 0,0",e+t,De(e-o,o+t));return{width:e+t,height:e,pathTop(E){return E?n:""},pathBottom(E){return E?u:m}}}makeOutsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,o=(1-Math.SQRT1_2)*(e-t)+t,n=pt(o,o)+wt("a","0 0,1",e-t,De(e-o,-o+t)),u=pt(t,e)+wt("a","0 0,1",e-t,De(e,-e+t)),m=-o,E=pt(o,m)+wt("a","0 0,1",e-t,De(-o+t,-m-e));return{height:e,topLeft(L){return L?n:u},bottomLeft(){return E}}}makePuzzleTab(){const e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,o=pt(-2,-t+3.4)+Ys(-.45*e,-2.1),n=Te("v",2.5)+pt(.97*-e,2.5)+ss("q",[De(.05*-e,10),De(.3*e,9.5)])+pt(.67*e,-1.9)+Te("v",2.5),u=Te("v",-1.5)+pt(-.92*e,-.5)+ss("q",[De(-.19*e,-5.5),De(0,-11)])+pt(.92*e,1),m=pt(-5,t-.7)+Ys(.46*e,-2.1);return{width:e,height:t,pathUp(E){return E?o:u},pathDown(E){return E?n:m}}}makeNotch(){return{pathLeft:Te("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:Ys(5.1,2.6)+pt(-10.2,6.8)+Ys(5.1,2.6),height:12,width:10.2}}makeStartHat(){const e=this.constantProvider.START_HAT.height,t=pt(25,-8.7)+ss("c",[De(29.7,-6.2),De(57.2,-.5),De(75,8.7)]),o=ss("c",[De(17.8,-9.2),De(45.3,-14.9),De(75,-8.7)])+xt(100.5,e+.5);return{path(n){return n?t:o}}}},f_=class extends Ip{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)}},$_=class extends Hr{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},b_=class extends Vr{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 hs||(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 f_(this.constants_,e)),t.hasInlineInput=!0):e instanceof hs?(t.elements.push(new $_(this.constants_,e)),t.hasStatement=!0):e instanceof i.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new sc(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Zs||e instanceof xo)&&(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 ds(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let u=0;u<t.length-1;u++){n.elements.push(t[u]);const m=this.getInRowSpacing_(t[u],t[u+1]);n.elements.push(new ds(this.constants_,m))}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 ds(this.constants_,t)))}}}getInRowSpacing_(e,t){if(!e)return t&&z.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&z.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&z.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!z.isInput(e)&&(!t||z.isStatementInput(t)))return z.isField(e)&&e.isEditable?this.constants_.MEDIUM_PADDING:z.isIcon(e)?2*this.constants_.LARGE_PADDING+1:z.isHat(e)?this.constants_.NO_PADDING:z.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:z.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:z.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(z.isInput(e)&&!t){if(z.isExternalInput(e))return this.constants_.NO_PADDING;if(z.isInlineInput(e))return this.constants_.LARGE_PADDING;if(z.isStatementInput(e))return this.constants_.NO_PADDING}if(!z.isInput(e)&&t&&z.isInput(t)){if(z.isField(e)&&e.isEditable){if(z.isInlineInput(t)||z.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(z.isInlineInput(t)||z.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(z.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(z.isIcon(e)&&t&&!z.isInput(t))return this.constants_.LARGE_PADDING;if(z.isInlineInput(e)&&t&&z.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(z.isLeftSquareCorner(e)&&t){if(z.isHat(t))return this.constants_.NO_PADDING;if(z.isPreviousConnection(t))return t.notchOffset;if(z.isNextConnection(t))return t.notchOffset+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}if(z.isLeftRoundedCorner(e)&&t){if(z.isPreviousConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS;if(z.isNextConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}return z.isField(e)&&t&&z.isField(t)&&e.isEditable===t.isEditable||t&&z.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return z.isTopRow(e)&&z.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:z.isTopRow(e)||z.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(z.isSpacer(t))return e.yPos+t.height/2;if(z.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,z.isNextConnection(t)?e+t.height/2:e-t.height/2;if(z.isTopRow(e))return z.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let o=e.yPos;return z.isField(t)||z.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=z.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,u;u=this.rows[n];n--)t.set(u,e),z.isInputRow(u)&&(u.hasStatement&&this.alignStatementRow_(u),o&&o.hasStatement&&u.width<o.width?t.set(u,o.width):e=u.hasStatement?u.width:Math.max(e,u.width),o=u);e=0;for(let n=0,u;u=this.rows[n];n++)u.hasStatement?e=this.getDesiredRowWidth_(u):z.isSpacer(u)?u.width=Math.max(e,t.get(u)):(o=u.width,e=Math.max(e,t.get(u))-o,0<e&&this.addAlignmentPadding_(u,e),e=u.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,u;u=this.rows[n];n++){u.yPos=t,u.xPos=this.startX,t+=u.height,e=Math.max(e,u.widthWithConnectedBlocks);var o=t-this.topRow.ascenderHeight;u===this.bottomRow&&o<this.constants_.MIN_BLOCK_HEIGHT&&(o=this.constants_.MIN_BLOCK_HEIGHT-o,this.bottomRow.height+=o,t+=o),this.recordElemPositions_(u)}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}},y_=class extends nc{constructor(e,t,o){super(e,t,o),this.constants=o,this.colourDark="#000000",this.svgPathDark=ee(V.PATH,{class:"blocklyPathDark",transform:"translate(1,1)"}),this.svgRoot.insertBefore(this.svgPathDark,this.svgPath),this.svgPathLight=ee(V.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=di("#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")}},v_=class extends rc{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 h_}makeRenderInfo_(e){return new b_(this,e)}makeDrawer_(e,t){return new g_(e,t)}makePathObject(e,t){return new y_(e,t,this.getConstants())}makeHighlightConstants_(){return new m_(this.getConstants())}getHighlightConstants(){if(!this.highlightConstants)throw Error("Cannot access the highlight constants because init has not been called");return this.highlightConstants}};_r("geras",v_);var so={};so.ConstantProvider=h_,so.Drawer=g_,so.HighlightConstantProvider=m_,so.Highlighter=p_,so.InlineInput=f_,so.PathObject=y_,so.RenderInfo=b_,so.Renderer=v_,so.StatementInput=$_;var __=class extends Vr{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 ds(this.constants_,this.getInRowSpacing_(null,o[0]))),o.length){for(let u=0;u<o.length-1;u++){n.elements.push(o[u]);const m=this.getInRowSpacing_(o[u],o[u+1]);n.elements.push(new ds(this.constants_,m))}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 ds(this.constants_,o)))}}}getInRowSpacing_(e,t){if(!e)return t&&z.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&z.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&z.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!z.isInput(e)&&!t)return z.isField(e)&&e.isEditable?this.constants_.MEDIUM_PADDING:z.isIcon(e)?2*this.constants_.LARGE_PADDING+1:z.isHat(e)?this.constants_.NO_PADDING:z.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:z.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:z.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(z.isInput(e)&&!t){if(z.isExternalInput(e))return this.constants_.NO_PADDING;if(z.isInlineInput(e))return this.constants_.LARGE_PADDING;if(z.isStatementInput(e))return this.constants_.NO_PADDING}if(!z.isInput(e)&&t&&z.isInput(t)){if(z.isField(e)&&e.isEditable){if(z.isInlineInput(t)||z.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(z.isInlineInput(t)||z.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(z.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(z.isIcon(e)&&t&&!z.isInput(t))return this.constants_.LARGE_PADDING;if(z.isInlineInput(e)&&t&&z.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(z.isLeftSquareCorner(e)&&t){if(z.isHat(t))return this.constants_.NO_PADDING;if(z.isPreviousConnection(t)||z.isNextConnection(t))return t.notchOffset}return z.isLeftRoundedCorner(e)&&t?t.notchOffset-this.constants_.CORNER_RADIUS:z.isField(e)&&t&&z.isField(t)&&e.isEditable===t.isEditable||t&&z.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return z.isTopRow(e)&&z.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:z.isTopRow(e)||z.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(z.isSpacer(t))return e.yPos+t.height/2;if(z.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,z.isNextConnection(t)?e+t.height/2:e-t.height/2;if(z.isTopRow(e))return z.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let o=e.yPos;return o=z.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 u=this.rows[o];u.yPos=t,u.xPos=this.startX,t+=u.height,e=Math.max(e,u.widthWithConnectedBlocks);var n=t-this.topRow.ascenderHeight;u===this.bottomRow&&n<this.constants_.MIN_BLOCK_HEIGHT&&(n=this.constants_.MIN_BLOCK_HEIGHT-n,this.bottomRow.height+=n,t+=n),this.recordElemPositions_(u)}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}},w_=class extends rc{constructor(e){super(e)}makeRenderInfo_(e){return new __(this,e)}};_r("thrasos",w_);var hg={};hg.RenderInfo=__,hg.Renderer=w_;var lT={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"}},cT={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"}},uT=new xi("zelos",lT,cT),dT={Classic:ql,Zelos:uT},pg=class{constructor(e,t,o){this.id_=e.toolboxitemid||y(),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){}},Ns=class extends pg{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?_t(e.name):"",this.colour_=this.getColour_(e),Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}createDom_(){this.htmlDiv_=this.createContainer_(),Lo(this.htmlDiv_,Ds.TREEITEM),Ot(this.htmlDiv_,Dt.SELECTED,!1),Ot(this.htmlDiv_,Dt.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_(),Lo(this.iconDom_,Ds.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&&Ot(this.htmlDiv_,Dt.LABELLEDBY,e),this.addColourBorder_(this.colour_),this.htmlDiv_}createContainer_(){const e=document.createElement("div"),t=this.cssConfig_.container;return t&&Ie(e,t),e}createRowContainer_(){const e=document.createElement("div");var t=this.cssConfig_.row;return t&&Ie(e,t),t=`${Ns.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&&Ie(e,t),e}createIconDom_(){const e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){const t=this.cssConfig_.icon;t&&Ie(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)&&Ie(t,e),t}refreshTheme(){this.colour_=this.getColour_(this.toolboxItemDef_),this.addColourBorder_(this.colour_)}addColourBorder_(e){e&&(e=Ns.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=_t(e),e==null||e==="")return"";var t=Number(e);return isNaN(t)?(t=ui(e))?t:(console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+e),""):kd(t)}openIcon_(e){if(e){var t=this.cssConfig_.closedicon;t&&Us(e,t),(t=this.cssConfig_.openicon)&&Ie(e,t)}}closeIcon_(e){if(e){var t=this.cssConfig_.openicon;t&&Us(e,t),(t=this.cssConfig_.closedicon)&&Ie(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(Ns.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||o,t&&Ie(this.rowDiv_,t)}else this.rowDiv_.style.backgroundColor="",t&&Be(this.rowDiv_,t);Ot(this.htmlDiv_,Dt.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:nr(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(){Ze(this.htmlDiv_)}};Ns.registrationName="category",Ns.nestedPadding=19,Ns.borderWidth=8,Ns.defaultBackgroundColour="#57e",Fe(`
|
|
917
|
+
.blocklyTreeRow:not(.blocklyTreeSelected):hover {
|
|
918
|
+
background-color: rgba(255, 255, 255, .2);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
.blocklyToolboxDiv[layout="h"] .blocklyToolboxCategory {
|
|
922
|
+
margin: 1px 5px 1px 0;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
.blocklyToolboxDiv[dir="RTL"][layout="h"] .blocklyToolboxCategory {
|
|
926
|
+
margin: 1px 0 1px 5px;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.blocklyTreeRow {
|
|
930
|
+
height: 22px;
|
|
931
|
+
line-height: 22px;
|
|
932
|
+
margin-bottom: 3px;
|
|
933
|
+
padding-right: 8px;
|
|
934
|
+
white-space: nowrap;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {
|
|
938
|
+
margin-left: 8px;
|
|
939
|
+
padding-right: 0;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
.blocklyTreeIcon {
|
|
943
|
+
background-image: url(<<<PATH>>>/sprites.png);
|
|
944
|
+
height: 16px;
|
|
945
|
+
vertical-align: middle;
|
|
946
|
+
visibility: hidden;
|
|
947
|
+
width: 16px;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
.blocklyTreeIconClosed {
|
|
951
|
+
background-position: -32px -1px;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {
|
|
955
|
+
background-position: 0 -1px;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
.blocklyTreeSelected>.blocklyTreeIconClosed {
|
|
959
|
+
background-position: -32px -17px;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {
|
|
963
|
+
background-position: 0 -17px;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
.blocklyTreeIconOpen {
|
|
967
|
+
background-position: -16px -1px;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
.blocklyTreeSelected>.blocklyTreeIconOpen {
|
|
971
|
+
background-position: -16px -17px;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
.blocklyTreeLabel {
|
|
975
|
+
cursor: default;
|
|
976
|
+
font: 16px sans-serif;
|
|
977
|
+
padding: 0 3px;
|
|
978
|
+
vertical-align: middle;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
.blocklyToolboxDelete .blocklyTreeLabel {
|
|
982
|
+
cursor: url("<<<PATH>>>/handdelete.cur"), auto;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
.blocklyTreeSelected .blocklyTreeLabel {
|
|
986
|
+
color: #fff;
|
|
987
|
+
}
|
|
988
|
+
`),a(he.TOOLBOX_ITEM,Ns.registrationName,Ns);var Qr=class extends pg{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&&Ie(e,t),this.htmlDiv=e}getDiv(){return this.htmlDiv}dispose(){Ze(this.htmlDiv)}};Qr.registrationName="sep",Fe(`
|
|
989
|
+
.blocklyTreeSeparator {
|
|
990
|
+
border-bottom: solid #e5e5e5 1px;
|
|
991
|
+
height: 0;
|
|
992
|
+
margin: 5px 0;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {
|
|
996
|
+
border-right: solid #e5e5e5 1px;
|
|
997
|
+
border-bottom: none;
|
|
998
|
+
height: auto;
|
|
999
|
+
margin: 0 5px 0 5px;
|
|
1000
|
+
padding: 5px 0;
|
|
1001
|
+
width: 0;
|
|
1002
|
+
}
|
|
1003
|
+
`),a(he.TOOLBOX_ITEM,Qr.registrationName,Qr);var Rn=class extends Ns{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];!d(he.TOOLBOX_ITEM,n.kind)||n.kind.toLowerCase()===Qr.registrationName&&e?(this.flyoutItems_.push(n),e=!0):(this.createToolboxItem(n),e=!1)}}}}createToolboxItem(e){let t=e.kind;t.toUpperCase()==="CATEGORY"&&ja(e)&&(t=Rn.registrationName),e=new(p(he.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),Lo(this.subcategoriesDiv_,Ds.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.closeIcon_(this.iconDom_),Ot(this.htmlDiv_,Dt.EXPANDED,!1),this.htmlDiv_}createIconDom_(){const e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){const t=this.cssConfig_.icon;t&&Ie(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&&Ie(t,o),o=0;o<e.length;o++){const n=e[o];n.init();const u=n.getDiv();if(t.appendChild(u),n.getClickTarget){let m;(m=n.getClickTarget())==null||m.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_)}Ot(this.htmlDiv_,Dt.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_}};Rn.registrationName="collapsibleCategory",a(he.TOOLBOX_ITEM,Rn.registrationName,Rn);var k_=class extends lc{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_),Nt(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:gt.ComponentWeight.TOOLBOX_WEIGHT,capabilities:[gt.Capability.AUTOHIDEABLE,gt.Capability.DELETE_AREA,gt.Capability.DRAG_TARGET]})}createDom_(e){e=e.getParentSvg();const t=this.createContainer_();return this.contentsDiv_=this.createContentsContainer_(),this.contentsDiv_.tabIndex=0,Lo(this.contentsDiv_,Ds.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"),Ie(e,"blocklyToolboxDiv"),e.setAttribute("dir",this.RTL?"RTL":"LTR"),e}createContentsContainer_(){const e=document.createElement("div");return Ie(e,"blocklyToolboxContents"),this.isHorizontal()&&(e.style.flexDirection="row"),e}attachEvents_(e,t){e=K(e,"pointerdown",this,this.onClick_,!1),this.boundEvents_.push(e),t=K(t,"keydown",this,this.onKeyDown_,!1),this.boundEvents_.push(t)}onClick_(e){if(we(e)||e.target===this.HtmlDiv)ne().hideChaff(!1);else{var t=e.target.getAttribute("id");t&&(t=this.getToolboxItemById(t),t.isSelectable()&&(this.setSelectedItem(t),t.onClick(e))),ne().hideChaff(!0)}Y()}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 bs({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?v(he.FLYOUTS_HORIZONTAL_TOOLBOX,e.options,!0):v(he.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"&&ja(e)&&(o=Rn.registrationName),(o=p(he.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&&Ie(this.HtmlDiv,e)}removeStyle(e){e&&this.HtmlDiv&&Be(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===ze.TOP?new rt(-1e7,o,-1e7,1e7):this.toolboxPosition===ze.BOTTOM?new rt(t,1e7,-1e7,1e7):this.toolboxPosition===ze.LEFT?new rt(-1e7,1e7,-1e7,e):new rt(-1e7,1e7,n,1e7)}wouldDelete(e){return e instanceof _s?this.updateWouldDelete_(!e.getParent()&&e.isDeletable()):this.updateWouldDelete_(ms(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===ze.TOP?t.style.top="0":t.style.bottom="0"):(this.toolboxPosition===ze.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===ze.LEFT?e.scrollX+t.width:e.scrollX,this.toolboxPosition===ze.TOP?e.scrollY+t.height:e.scrollY),xe(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&&!jb(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),Ot(this.contentsDiv_,Dt.ACTIVEDESCENDANT,"")}selectItem_(e,t){this.selectedItem_=t,this.previouslySelectedItem_=e,t.setSelected(!0),Ot(this.contentsDiv_,Dt.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(oe(q.TOOLBOX_ITEM_SELECT))(o,n,this.workspace_.id),B(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++)G(this.boundEvents_[e]);this.boundEvents_=[],this.contents_=[],this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),Ze(this.HtmlDiv))}};Fe(`
|
|
1004
|
+
.blocklyToolboxDelete {
|
|
1005
|
+
cursor: url("<<<PATH>>>/handdelete.cur"), auto;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.blocklyToolboxGrab {
|
|
1009
|
+
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
|
|
1010
|
+
cursor: grabbing;
|
|
1011
|
+
cursor: -webkit-grabbing;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
/* Category tree in Toolbox. */
|
|
1015
|
+
.blocklyToolboxDiv {
|
|
1016
|
+
background-color: #ddd;
|
|
1017
|
+
overflow-x: visible;
|
|
1018
|
+
overflow-y: auto;
|
|
1019
|
+
padding: 4px 0 4px 0;
|
|
1020
|
+
position: absolute;
|
|
1021
|
+
z-index: 70; /* so blocks go under toolbox when dragging */
|
|
1022
|
+
-webkit-tap-highlight-color: transparent; /* issue #1345 */
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
.blocklyToolboxContents {
|
|
1026
|
+
display: flex;
|
|
1027
|
+
flex-wrap: wrap;
|
|
1028
|
+
flex-direction: column;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
.blocklyToolboxContents:focus {
|
|
1032
|
+
outline: none;
|
|
1033
|
+
}
|
|
1034
|
+
`),a(he.TOOLBOX,Js,k_);var hT="11.2.2",pT=Se.INPUT_VALUE,gT=Se.OUTPUT_VALUE,mT=Se.NEXT_STATEMENT,fT=Se.PREVIOUS_STATEMENT,$T=ze.TOP,bT=ze.BOTTOM,yT=ze.LEFT,vT=ze.RIGHT;In.prototype.newBlock=function(e,t){return new Yo(this,e,t)},ps.prototype.newBlock=function(e,t){return new _s(this,e,t)},In.prototype.newComment=function(e){return new Kl(this,e)},ps.prototype.newComment=function(e){return new Yl(this,e)},ps.newTrashcan=function(e){return new yv(e)},Co.prototype.newWorkspaceSvg=function(e){return new ps(e)},i.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=fl(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 Z={};return Z.ASTNode=re,Z.BasicCursor=Yr,Z.Block=Yo,Z.BlockSvg=_s,Z.Blocks=os,Z.COLLAPSED_FIELD_NAME=Ml,Z.COLLAPSED_INPUT_NAME=Ar,Z.COLLAPSE_CHARS=dv,Z.CodeGenerator=i.CodeGenerator$$module$build$src$core$generator,Z.CollapsibleToolboxCategory=Rn,Z.ComponentManager=gt,Z.Connection=Qe,Z.ConnectionChecker=hv,Z.ConnectionDB=kn,Z.ConnectionType=Se,Z.ContextMenu=Ei,Z.ContextMenuItems=At,Z.ContextMenuRegistry=He,Z.Css=Gh,Z.Cursor=zp,Z.DELETE_VARIABLE_ID=Lp,Z.DeleteArea=lc,Z.DragTarget=bv,Z.DropDownDiv=Wt,Z.Events=_e,Z.Extensions=Os,Z.Field=lt,Z.FieldCheckbox=Mi,Z.FieldDropdown=is,Z.FieldImage=Oi,Z.FieldLabel=Di,Z.FieldLabelSerializable=Bv,Z.FieldNumber=Zp,Z.FieldTextInput=pc,Z.FieldVariable=qr,Z.Flyout=mc,Z.FlyoutButton=ys,Z.FlyoutMetricsManager=Lv,Z.Generator=i.CodeGenerator$$module$build$src$core$generator,Z.Gesture=ko,Z.Grid=_p,Z.HorizontalFlyout=Pv,Z.INPUT_VALUE=pT,Z.Input=Tn,Z.InsertionMarkerManager=vs,Z.InsertionMarkerPreviewer=Ov,Z.Marker=mv,Z.MarkerManager=Lr,Z.Menu=Zh,Z.MenuItem=Qh,Z.MetricsManager=Jp,Z.Msg=i.Msg$$module$build$src$core$msg,Z.NEXT_STATEMENT=mT,Z.Names=i.Names$$module$build$src$core$names,Z.OPPOSITE_TYPE=Ri,Z.OUTPUT_VALUE=gT,Z.Options=bs,Z.PREVIOUS_STATEMENT=fT,Z.PROCEDURE_CATEGORY_NAME=tc,Z.Procedures=Xt,Z.RENAME_VARIABLE_ID=Np,Z.RenderedConnection=Zt,Z.Scrollbar=kt,Z.ScrollbarPair=Yp,Z.ShortcutItems=eo,Z.ShortcutRegistry=st,Z.TOOLBOX_AT_BOTTOM=bT,Z.TOOLBOX_AT_LEFT=yT,Z.TOOLBOX_AT_RIGHT=vT,Z.TOOLBOX_AT_TOP=$T,Z.TabNavigateCursor=fv,Z.Theme=xi,Z.ThemeManager=uv,Z.Themes=dT,Z.Toolbox=k_,Z.ToolboxCategory=Ns,Z.ToolboxItem=pg,Z.ToolboxSeparator=Qr,Z.Tooltip=cs,Z.Touch=bi,Z.Trashcan=yv,Z.UnattachedFieldError=Ct,Z.VARIABLE_CATEGORY_NAME=np,Z.VARIABLE_DYNAMIC_CATEGORY_NAME=Mp,Z.VERSION=hT,Z.VariableMap=jp,Z.VariableModel=Or,Z.Variables=Pt,Z.VariablesDynamic=Ai,Z.VerticalFlyout=Xp,Z.WidgetDiv=Rs,Z.Workspace=In,Z.WorkspaceAudio=pv,Z.WorkspaceDragger=Ky,Z.WorkspaceSvg=ps,Z.Xml=Gt,Z.ZoomControls=$y,Z.blockAnimations=zr,Z.blockRendering=ot,Z.browserEvents=yo,Z.bubbles=Zr,Z.bumpObjects=ac,Z.clipboard=Jr,Z.comments=fc,Z.common=Lt,Z.config=i.config$$module$build$src$core$config,Z.constants=BS,Z.defineBlocksWithJsonArray=ct,Z.dialog=_i,Z.dragging=Xr,Z.fieldRegistry=Xl,Z.geras=so,Z.getMainWorkspace=ne,Z.getSelected=ke,Z.hasBubble=en,Z.hideChaff=Fb,Z.icons=Vo,Z.inject=Tb,Z.inputs=Xo,Z.isCopyable=wr,Z.isDeletable=ms,Z.isDraggable=mi,Z.isIcon=Xd,Z.isObservable=ml,Z.isPaster=Lb,Z.isRenderedElement=Pb,Z.isSelectable=Bb,Z.isSerializable=lr,Z.isVariableBackedParameterModel=Wu,Z.layers=jS,Z.procedures=Xt,Z.registry=$o,Z.renderManagement=Ll,Z.serialization=rT,Z.setLocale=op,Z.setParentContainer=Ae,Z.svgResize=xe,Z.thrasos=hg,Z.uiPosition=vi,Z.utils=yt,Z.zelos=Ms,Z.__namespace__=i,Z})})(yf);var AO=yf.exports;const RO=ri(AO),{ASTNode:yre,BasicCursor:vre,Block:_re,BlockSvg:wre,Blocks:kre,COLLAPSED_FIELD_NAME:Cre,COLLAPSED_INPUT_NAME:Sre,COLLAPSE_CHARS:Tre,CodeGenerator:Ire,CollapsibleToolboxCategory:Ere,ComponentManager:xre,Connection:Dre,ConnectionChecker:Are,ConnectionDB:Rre,ConnectionType:Ore,ContextMenu:Mre,ContextMenuItems:Nre,ContextMenuRegistry:Lre,Css:Pre,Cursor:Bre,DELETE_VARIABLE_ID:jre,DeleteArea:Fre,DragTarget:zre,DropDownDiv:Ure,Events:Hre,Extensions:Wre,Field:Gre,FieldCheckbox:Vre,FieldDropdown:Kre,FieldImage:Yre,FieldLabel:Jre,FieldLabelSerializable:qre,FieldNumber:Xre,FieldTextInput:Zre,FieldVariable:Qre,Flyout:eae,FlyoutButton:tae,FlyoutMetricsManager:sae,Generator:oae,Gesture:iae,Grid:nae,HorizontalFlyout:rae,INPUT_VALUE:aae,Input:lae,InsertionMarkerManager:cae,InsertionMarkerPreviewer:uae,Marker:dae,MarkerManager:hae,Menu:pae,MenuItem:gae,MetricsManager:mae,Msg:fae,NEXT_STATEMENT:$ae,Names:bae,OPPOSITE_TYPE:yae,OUTPUT_VALUE:vae,Options:_ae,PREVIOUS_STATEMENT:wae,PROCEDURE_CATEGORY_NAME:kae,Procedures:Cae,RENAME_VARIABLE_ID:Sae,RenderedConnection:Tae,Scrollbar:Iae,ScrollbarPair:Eae,ShortcutItems:xae,ShortcutRegistry:Dae,TOOLBOX_AT_BOTTOM:Aae,TOOLBOX_AT_LEFT:Rae,TOOLBOX_AT_RIGHT:Oae,TOOLBOX_AT_TOP:Mae,TabNavigateCursor:Nae,Theme:OO,ThemeManager:Lae,Themes:MO,Toolbox:Pae,ToolboxCategory:Bae,ToolboxItem:jae,ToolboxSeparator:Fae,Tooltip:zae,Touch:Uae,Trashcan:Hae,UnattachedFieldError:Wae,VARIABLE_CATEGORY_NAME:Gae,VARIABLE_DYNAMIC_CATEGORY_NAME:Vae,VERSION:Kae,VariableMap:Yae,VariableModel:Jae,Variables:qae,VariablesDynamic:Xae,VerticalFlyout:Zae,WidgetDiv:Qae,Workspace:ele,WorkspaceAudio:tle,WorkspaceDragger:sle,WorkspaceSvg:ole,Xml:ile,ZoomControls:nle,blockAnimations:rle,blockRendering:ale,browserEvents:lle,bubbles:cle,bumpObjects:ule,clipboard:dle,comments:hle,common:ple,config:gle,constants:mle,defineBlocksWithJsonArray:fle,dialog:$le,dragging:ble,fieldRegistry:yle,geras:vle,getMainWorkspace:_le,getSelected:wle,hasBubble:kle,hideChaff:Cle,icons:Sle,inject:Tle,inputs:Ile,isCopyable:Ele,isDeletable:xle,isDraggable:Dle,isIcon:Ale,isObservable:Rle,isPaster:Ole,isRenderedElement:Mle,isSelectable:Nle,isSerializable:Lle,isVariableBackedParameterModel:Ple,layers:Ble,procedures:jle,registry:Fle,renderManagement:zle,serialization:Ule,setLocale:Hle,setParentContainer:Wle,svgResize:Gle,thrasos:Vle,uiPosition:Kle,utils:Yle,zelos:Jle}=RO;const Hw=OO.defineTheme("dark",{base:MO.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"}}),na={textArea:{width:"100%",height:"100%",overflow:"auto"},textAreaLight:{background:"lightgray"},dialog:{height:"95%"},typography:{padding:16},overflowY:{overflowY:"hidden"}};class NO extends pe.Component{constructor(s){super(s),this.state={anchorEl:null,popper:""}}handleCancel(){this.props.onClose()}onCopy(s){x.Utils.copyToClipboard(this.props.text);const i=s.currentTarget;setTimeout(()=>{this.setState({popper:x.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(zt,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":na.dialog},fullWidth:!0,open:!0,"aria-labelledby":"export-dialog-title",children:[g.jsx(ts,{id:"export-dialog-title",children:x.I18n.t("Export selected blocks")}),g.jsx(Yt,{style:na.overflowY,children:g.jsx("pre",{id:"export-text",style:{...na.textArea,...this.props.themeType==="dark"?void 0:na.textAreaLight},children:this.props.text})}),g.jsxs(Ut,{children:[g.jsx(je,{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:x.I18n.t("Download as file")})}),g.jsx(je,{variant:"contained",onClick:a=>this.onCopy(a),color:"secondary",startIcon:g.jsx(i0,{}),children:x.I18n.t("Copy to clipboard")}),g.jsx(je,{variant:"contained",onClick:()=>this.handleCancel(),color:"primary",startIcon:g.jsx(ao,{}),children:x.I18n.t("Close")}),g.jsx(UT,{id:"popper",style:{zIndex:1e4},open:!!this.state.popper,placement:"top",anchorEl:this.state.anchorEl,transition:!0,children:({TransitionProps:a})=>g.jsx(HT,{...a,timeout:350,children:g.jsx(dk,{children:g.jsx("p",{style:na.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 jt={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 vf extends pe.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 a=new FileReader;a.onload=()=>{i(null,{data:a.result,name:s.name})},a.onabort=()=>{console.error("file reading was aborted"),i(x.I18n.t("file reading was aborted"))},a.onerror=l=>{console.error("file reading has failed"),i(x.I18n.t("file reading has failed: %s",l))},a.readAsText(s)}handleDropFile(s){if(!(s!=null&&s.length))return;const i=s[s.length-1];i&&vf.readFileDataUrl(i,(a,l)=>{var c;a||!l?this.setState({error:a||"No data"}):this.setState({text:((c=l.data)==null?void 0:c.toString())||""})})}handleCancel(){this.props.onClose()}handleOk(){this.props.onClose(this.state.text)}onChange(s){this.setState({text:s.target.value})}render(){const s={...jt.dropzone,...this.state.imageStatus==="accepted"?jt.dropzoneAccepted:this.state.imageStatus==="rejected"?jt.dropzoneRejected:void 0};return g.jsxs(zt,{onClose:()=>!1,maxWidth:"lg",sx:{"& .MuiDialog-paper":jt.dialog},fullWidth:!0,open:!0,"aria-labelledby":"import-dialog-title",children:[g.jsx(ts,{id:"import-dialog-title",children:x.I18n.t("Import blocks")}),g.jsxs(Yt,{style:jt.fullHeight,children:[g.jsx("textarea",{autoFocus:!0,id:"import-text-area",placeholder:x.I18n.t("Paste your blocks here"),style:{...jt.textArea,color:this.props.themeType==="dark"?"#ffffff":"#000000"},onChange:i=>this.onChange(i),value:this.state.text}),g.jsx(mk,{maxSize:5e7,onDrop:(i,a)=>{var l,c,h;i.length?this.handleDropFile(i):window.alert(((h=(c=(l=a==null?void 0:a[0])==null?void 0:l.errors)==null?void 0:c[0])==null?void 0:h.message)||x.I18n.t("ra_Cannot upload"))},multiple:!1,accept:{"text/plain":[],"text/xml":[],"application/xml":[]},children:({getRootProps:i,getInputProps:a,isDragActive:l,isDragReject:c})=>c?(this.state.imageStatus!=="rejected"&&this.setState({imageStatus:"rejected"}),g.jsxs("div",{style:{...s,...jt.dropzoneDiv},...i(),children:[g.jsx("input",{...a()}),g.jsx("span",{style:jt.text,children:x.I18n.t("Some files will be rejected")},"text"),g.jsx($u,{style:{...jt.icon,...jt.iconError}},"icon")]})):l?(this.state.imageStatus!=="accepted"&&this.setState({imageStatus:"accepted"}),g.jsxs("div",{style:{...s,...jt.dropzoneDiv},...i(),children:[g.jsx("input",{...a()}),g.jsx("span",{style:jt.text,children:x.I18n.t("All files will be accepted")},"text"),g.jsx(fk,{style:{...jt.icon,...jt.iconOk}},"icon")]})):(this.state.imageStatus!=="wait"&&this.setState({imageStatus:"wait"}),g.jsxs("div",{style:{...s,...jt.dropzoneDiv},...i(),children:[g.jsx("input",{...a()}),g.jsx("span",{style:jt.text,children:x.I18n.t("Drop some files here or click...")},"text"),g.jsx($k,{style:jt.icon},"icon")]}))})]}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",disabled:!this.state.text,onClick:()=>this.handleOk(),color:"primary",startIcon:g.jsx(ni,{}),children:x.I18n.t("Import")}),g.jsx(je,{color:"grey",variant:"contained",onClick:()=>this.handleCancel(),startIcon:g.jsx(ao,{}),children:x.I18n.t("Close")})]})]})}}const Le=window.Blockly;class Hg extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}}class tu extends Le.Field{textGroup=null;borderRect_=null;maxLines_=1/0;isOverflowedY_=!1;constructor(s,i,a){super(s),s!==Symbol("SKIP_SETUP")&&(a&&this.configure_(a),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," "),s}fromXml(s){this.setValue(s.textContent.replace(/ /g,`
|
|
1035
|
+
`))}saveState(){const s=this.saveLegacyState(tu);return s!==null?s:this.getValue()}loadState(s){this.loadLegacyState(Le.Field,s)||this.setValue(s)}initView(){this.createBorderRect_(),this.textGroup=Le.utils.dom.createSvgElement(Le.utils.Svg.G,{class:"blocklyEditableText"},this.fieldGroup_)}onHtmlInputKeyDownSuper_(s){s.key==="Enter"?(Le.WidgetDiv.hideIfOwner(this),Le.dropDownDiv.hideWithoutAnimation()):s.key==="Escape"?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),Le.WidgetDiv.hideIfOwner(this),Le.dropDownDiv.hideWithoutAnimation()):s.key==="Tab"&&(Le.WidgetDiv.hideIfOwner(this),Le.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_&&Le.Events.isEnabled()&&this.value_!==i&&Le.Events.fire(new(Le.Events.get("block_field_intermediate_change"))(this.sourceBlock_,this.name||null,i,this.value_))}onFinishEditing_(s){}getValueFromEditorText_(s){return s}bindInputEvents_(s){this.onKeyDownWrapper_=Le.browserEvents.conditionalBind(s,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper_=Le.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 Le.Field.NBSP;const a=i.split(`
|
|
1036
|
+
`);i="";const l=this.isOverflowedY_?this.maxLines_:a.length;for(let c=0;c<l;c++){let h=a[c]||"";h.length>this.maxDisplayLength?h=`${h.substring(0,this.maxDisplayLength-4)}...`:this.isOverflowedY_&&c===l-1&&(h=`${h.substring(0,h.length-3)}...`),h=h.replace(/\s/g,Le.Field.NBSP),i+=h,c!==l-1&&(i+=`
|
|
1037
|
+
`)}return s.RTL&&(i+=""),i}doValueUpdate_(s){super.doValueUpdate_(s),this.value_!==null&&(this.isOverflowedY_=this.value_.split(`
|
|
1038
|
+
`).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 a=this.textGroup;for(;i=a.firstChild;)a.removeChild(i);const l=this.getConstants();if(!l)throw Error("Constants not found");const c=this.getDisplayText_().split(`
|
|
1039
|
+
`);let h=0;for(let d=0;d<c.length;d++){const p=l.FIELD_TEXT_HEIGHT+l.FIELD_BORDER_RECT_Y_PADDING;Le.utils.dom.createSvgElement(Le.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText",x:l.FIELD_BORDER_RECT_X_PADDING,y:h+l.FIELD_BORDER_RECT_Y_PADDING,dy:l.FIELD_TEXT_BASELINE},a).appendChild(document.createTextNode(c[d])),h+=p}if(this.isBeingEdited_){const d=this.htmlInput_;this.isOverflowedY_?Le.utils.dom.addClass(d,"blocklyHtmlTextAreaInputOverflowedY"):Le.utils.dom.removeClass(d,"blocklyHtmlTextAreaInputOverflowedY")}if(this.updateSize_(),this.isBeingEdited_){s.RTL?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();const d=this.htmlInput_;this.isTextValid_?(Le.utils.dom.removeClass(d,"blocklyInvalidInput"),Le.utils.aria.setState(d,Le.utils.aria.State.INVALID,!1)):(Le.utils.dom.addClass(d,"blocklyInvalidInput"),Le.utils.aria.setState(d,Le.utils.aria.State.INVALID,!0))}}updateSize_(){const s=this.getConstants();if(!s)throw Error("Constants not found");const i=this.textGroup.childNodes,a=s.FIELD_TEXT_FONTSIZE,l=s.FIELD_TEXT_FONTWEIGHT,c=s.FIELD_TEXT_FONTFAMILY;let h=0,d=0;for(let p=0;p<i.length;p++){const f=i[p],b=Le.utils.dom.getFastTextWidth(f,a,l,c);b>h&&(h=b),d+=s.FIELD_TEXT_HEIGHT+(p>0?s.FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){const p=String(this.value_).split(`
|
|
1040
|
+
`),f=Le.utils.dom.createSvgElement(Le.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText"});for(let _=0;_<p.length;_++){p[_].length>this.maxDisplayLength&&(p[_]=p[_].substring(0,this.maxDisplayLength)),f.textContent=p[_];const y=Le.utils.dom.getFastTextWidth(f,a,l,c);y>h&&(h=y)}const b=this.htmlInput_,v=b.offsetWidth-b.clientWidth;h+=v}this.borderRect_&&(d+=s.FIELD_BORDER_RECT_Y_PADDING*2,h+=s.FIELD_BORDER_RECT_X_PADDING*2+1,this.borderRect_.setAttribute("width",`${h}`),this.borderRect_.setAttribute("height",`${d}`)),this.size_.width=h,this.size_.height=d,this.positionBorderRect_()}showInlineEditor_(s){const i=this.getSourceBlock();if(!i)throw new Hg;Le.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,a;const l=this.getSourceBlock();if(!l)throw new Hg;if(this.isFullBlockField()){const c=this.sourceBlock_.getHeightWidth(),h=l.workspace.scale;a=this.getAbsoluteXY_(),s=(c.width+1)*h,i=(c.height+1)*h,Le.utils.userAgent.GECKO?(a.x+=1.5*h,a.y+=1.5*h):(a.x-=.5*h,a.y-=.5*h)}else{const c=this.borderRect_.getBoundingClientRect();a=Le.utils.style.getPageOffset(this.borderRect_),s=c.width,i=c.height}return new Le.utils.Rect(a.y,a.y+i,a.x,a.x+s)}resizeEditor_(){Le.renderManagement.finishQueuedRenders().then(()=>{const s=this.getSourceBlock();if(!s)throw new Hg;const i=Le.WidgetDiv.getDiv(),a=this.getScaledBBox();i.style.width=`${a.right-a.left}px`,i.style.height=`${a.bottom-a.top}px`;const l=s.RTL?a.right-i.offsetWidth:a.left,c=a.top;i.style.left=`${l}px`,i.style.top=`${c}px`})}unbindInputEvents_(){this.onKeyDownWrapper_&&(Le.browserEvents.unbind(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyInputWrapper_&&(Le.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_&&Le.Events.isEnabled()&&this.valueWhenEditorWasOpened_!==null&&this.valueWhenEditorWasOpened_!==this.value_&&(Le.Events.fire(new(Le.Events.get("change"))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),Le.Events.setGroup(!1),this.unbindInputEvents_();const s=Le.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.");Le.utils.dom.removeClass(i,"editing")}showEditor_(s,i){this.workspace_=this.sourceBlock_.workspace,!i&&this.workspace_.options.modalInputs&&(Le.utils.userAgent.MOBILE||Le.utils.userAgent.ANDROID||Le.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(!!i),this.forceRerender()}widgetCreate_(){const s=Le.WidgetDiv.getDiv(),i=this.workspace_.getScale(),a=this.getConstants();if(!a)throw Error("Constants not found");const l=document.createElement("textarea");l.className="blocklyHtmlInput blocklyHtmlTextAreaInput",l.setAttribute("spellcheck",String(this.spellcheck_));const c=`${a.FIELD_TEXT_FONTSIZE*i}pt`;s.style.fontSize=c,l.style.fontSize=c;const h=`${Le.FieldTextInput.BORDERRADIUS*i}px`;l.style.borderRadius=h;const d=a.FIELD_BORDER_RECT_X_PADDING*i,p=a.FIELD_BORDER_RECT_Y_PADDING*i/2;l.style.padding=`${p}px ${d}px ${p}px ${d}px`;const f=a.FIELD_TEXT_HEIGHT+a.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",""),Le.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=Le.utils.parsing.replaceMessageReferences(s.text);return new this(i,void 0,s)}}Le.Css.register(`
|
|
1041
|
+
.blocklyHtmlTextAreaInput {
|
|
1042
|
+
font-family: monospace;
|
|
1043
|
+
resize: none;
|
|
1044
|
+
overflow: hidden;
|
|
1045
|
+
height: 100%;
|
|
1046
|
+
text-align: left;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
.blocklyHtmlTextAreaInputOverflowedY {
|
|
1050
|
+
overflow-y: scroll;
|
|
1051
|
+
}
|
|
1052
|
+
`);const pS="text_multiline",LO={type:pS,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 PO(r,s){const i=s.multiline_quote_(r.getFieldValue("TEXT")),a=i.indexOf("+")!==-1?6.2:0;return[i,a]}const BO=window.Blockly.common.createBlockDefinitionsFromJsonArray([LO]);BO[pS];const Ke=window.Blockly;class Pm extends Ke.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,a){super(s),s!==Symbol("SKIP_SETUP")&&(a&&this.configure_(a),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 Ke.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 Ke.UnattachedFieldError;const i=this.getConstants();return this.blockIsSimpleReporter()&&!!(i!=null&&i.FIELD_COLOUR_FULL_BLOCK)}blockIsSimpleReporter(){const s=this.getSourceBlock();if(!s)throw new Ke.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 Ke.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 Ke.UnattachedFieldError;s.applyColour()}updateSize_(s){const i=this.getConstants();if(!i)return;let a,l;this.isFullBlockField()?(a=(s??0)*2,l=i.FIELD_TEXT_HEIGHT):(a=i.FIELD_COLOUR_DEFAULT_WIDTH,l=i.FIELD_COLOUR_DEFAULT_HEIGHT),this.size_.height=l,this.size_.width=a,this.positionBorderRect_()}doClassValidation_(s){return typeof s!="string"?null:Ke.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");Ke.DropDownDiv.getContentDiv().appendChild(this.picker),Ke.DropDownDiv.showPositionedByField(this,this.dropdownDispose.bind(this)),this.picker.focus({preventScroll:!0})}onClick(s){const i=s.target,a=i==null?void 0:i.getAttribute("data-colour");a!==null&&(this.setValue(a),Ke.DropDownDiv.hideIfOwner(this))}onKeyDown(s){let i=!0,a;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(a=this.getHighlighted(),a){const l=a.getAttribute("data-colour");l!==null&&this.setValue(l)}Ke.DropDownDiv.hideWithoutAnimation();break;default:i=!1}i&&s.stopPropagation()}moveHighlightBy(s,i){if(!this.highlightedIndex)return;const a=this.colours,l=this.columns;let c=this.highlightedIndex%l,h=Math.floor(this.highlightedIndex/l);c+=s,h+=i,s<0?c<0&&h>0?(c=l-1,h--):c<0&&(c=0):s>0?c>l-1&&h<Math.floor(a.length/l)-1?(c=0,h++):c>l-1&&c--:i<0?h<0&&(h=0):i>0&&h>Math.floor(a.length/l)-1&&(h=Math.floor(a.length/l)-1);const d=this.picker.childNodes[h].childNodes[c],p=h*l+c;this.setHighlightedCell(d,p)}onMouseMove(s){const i=s.target,a=i&&Number(i.getAttribute("data-index"));a!==null&&a!==this.highlightedIndex&&this.setHighlightedCell(i,a)}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&&Ke.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),a=(l=this.picker)==null?void 0:l.childNodes[i];return a?a.childNodes[s]:null}setHighlightedCell(s,i){const a=this.getHighlighted();a&&Ke.utils.dom.removeClass(a,"blocklyColourHighlighted"),Ke.utils.dom.addClass(s,"blocklyColourHighlighted"),this.highlightedIndex=i;const l=s.getAttribute("id");l&&this.picker&&Ke.utils.aria.setState(this.picker,Ke.utils.aria.State.ACTIVEDESCENDANT,l)}dropdownCreate(){const s=this.columns,i=this.colours,a=this.getValue(),l=document.createElement("table");l.className="blocklyColourTable",l.tabIndex=0,l.dir="ltr",Ke.utils.aria.setRole(l,Ke.utils.aria.Role.GRID),Ke.utils.aria.setState(l,Ke.utils.aria.State.EXPANDED,!0),Ke.utils.aria.setState(l,Ke.utils.aria.State.ROWCOUNT,Math.floor(i.length/s)),Ke.utils.aria.setState(l,Ke.utils.aria.State.COLCOUNT,s);let c=null;for(let h=0;h<i.length;h++){h%s===0&&(c=document.createElement("tr"),Ke.utils.aria.setRole(c,Ke.utils.aria.Role.ROW),l.appendChild(c));const d=document.createElement("td");c.appendChild(d),d.setAttribute("data-colour",i[h]),d.title=this.titles[h]||i[h],d.id=Ke.utils.idGenerator.getNextUniqueId(),d.setAttribute("data-index",`${h}`),Ke.utils.aria.setRole(d,Ke.utils.aria.Role.GRIDCELL),Ke.utils.aria.setState(d,Ke.utils.aria.State.LABEL,i[h]),Ke.utils.aria.setState(d,Ke.utils.aria.State.SELECTED,i[h]===a),d.style.backgroundColor=i[h],i[h]===a&&(d.className="blocklyColourSelected",this.highlightedIndex=h)}this.boundEvents.push(Ke.browserEvents.conditionalBind(l,"pointerdown",this,this.onClick,!0)),this.boundEvents.push(Ke.browserEvents.conditionalBind(l,"pointermove",this,this.onMouseMove,!0)),this.boundEvents.push(Ke.browserEvents.conditionalBind(l,"pointerenter",this,this.onMouseEnter,!0)),this.boundEvents.push(Ke.browserEvents.conditionalBind(l,"pointerleave",this,this.onMouseLeave,!0)),this.boundEvents.push(Ke.browserEvents.conditionalBind(l,"keydown",this,this.onKeyDown,!1)),this.picker=l}dropdownDispose(){for(const s of this.boundEvents)Ke.browserEvents.unbind(s);this.boundEvents.length=0,this.picker=null,this.highlightedIndex=null}static fromJson(s){return new this(s.colour,void 0,s)}}Pm.prototype.DEFAULT_VALUE="#ffffff";Ke.Css.register(`
|
|
1053
|
+
.blocklyColourTable {
|
|
1054
|
+
border-collapse: collapse;
|
|
1055
|
+
display: block;
|
|
1056
|
+
outline: none;
|
|
1057
|
+
padding: 1px;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
.blocklyColourTable>tr>td {
|
|
1061
|
+
border: 0.5px solid #888;
|
|
1062
|
+
box-sizing: border-box;
|
|
1063
|
+
cursor: pointer;
|
|
1064
|
+
display: inline-block;
|
|
1065
|
+
height: 20px;
|
|
1066
|
+
padding: 0;
|
|
1067
|
+
width: 20px;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
.blocklyColourTable>tr>td.blocklyColourHighlighted {
|
|
1071
|
+
border-color: #eee;
|
|
1072
|
+
box-shadow: 2px 2px 7px 2px rgba(0, 0, 0, 0.3);
|
|
1073
|
+
position: relative;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
.blocklyColourSelected, .blocklyColourSelected:hover {
|
|
1077
|
+
border-color: #eee !important;
|
|
1078
|
+
outline: 1px solid #333;
|
|
1079
|
+
position: relative;
|
|
1080
|
+
}
|
|
1081
|
+
`);const gS="colour_picker",jO={type:gS,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 FO(r,s){return[s.quote_(r.getFieldValue("COLOUR")),0]}const zO=window.Blockly.common.createBlockDefinitionsFromJsonArray([jO]);zO[gS];const mS="colour_random",UO={type:mS,message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"};function HO(r,s){return[`${s.provideFunction_("colourRandom",`
|
|
1082
|
+
function ${s.FUNCTION_NAME_PLACEHOLDER_}() {
|
|
1083
|
+
var num = Math.floor(Math.random() * 0x1000000);
|
|
1084
|
+
return '#' + ('00000' + num.toString(16)).substr(-6);
|
|
1085
|
+
}
|
|
1086
|
+
`)}()`,2]}const WO=window.Blockly.common.createBlockDefinitionsFromJsonArray([UO]);WO[mS];const fS="colour_rgb",GO={type:fS,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 VO(r,s){const i=s.valueToCode(r,"RED",99)||0,a=s.valueToCode(r,"GREEN",99)||0,l=s.valueToCode(r,"BLUE",99)||0;return[`${s.provideFunction_("colourRgb",`
|
|
1087
|
+
function ${s.FUNCTION_NAME_PLACEHOLDER_}(r, g, b) {
|
|
1088
|
+
r = Math.max(Math.min(Number(r), 100), 0) * 2.55;
|
|
1089
|
+
g = Math.max(Math.min(Number(g), 100), 0) * 2.55;
|
|
1090
|
+
b = Math.max(Math.min(Number(b), 100), 0) * 2.55;
|
|
1091
|
+
r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);
|
|
1092
|
+
g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);
|
|
1093
|
+
b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);
|
|
1094
|
+
return '#' + r + g + b;
|
|
1095
|
+
}
|
|
1096
|
+
`)}(${i}, ${a}, ${l})`,2]}const KO=window.Blockly.common.createBlockDefinitionsFromJsonArray([GO]);KO[fS];const $S="colour_blend",YO={type:$S,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 JO(r,s){const i=s.valueToCode(r,"COLOUR1",99)||"'#000000'",a=s.valueToCode(r,"COLOUR2",99)||"'#000000'",l=s.valueToCode(r,"RATIO",99)||.5;return[`${s.provideFunction_("colourBlend",`
|
|
1097
|
+
function ${s.FUNCTION_NAME_PLACEHOLDER_}(c1, c2, ratio) {
|
|
1098
|
+
ratio = Math.max(Math.min(Number(ratio), 1), 0);
|
|
1099
|
+
var r1 = parseInt(c1.substring(1, 3), 16);
|
|
1100
|
+
var g1 = parseInt(c1.substring(3, 5), 16);
|
|
1101
|
+
var b1 = parseInt(c1.substring(5, 7), 16);
|
|
1102
|
+
var r2 = parseInt(c2.substring(1, 3), 16);
|
|
1103
|
+
var g2 = parseInt(c2.substring(3, 5), 16);
|
|
1104
|
+
var b2 = parseInt(c2.substring(5, 7), 16);
|
|
1105
|
+
var r = Math.round(r1 * (1 - ratio) + r2 * ratio);
|
|
1106
|
+
var g = Math.round(g1 * (1 - ratio) + g2 * ratio);
|
|
1107
|
+
var b = Math.round(b1 * (1 - ratio) + b2 * ratio);
|
|
1108
|
+
r = ('0' + (r || 0).toString(16)).slice(-2);
|
|
1109
|
+
g = ('0' + (g || 0).toString(16)).slice(-2);
|
|
1110
|
+
b = ('0' + (b || 0).toString(16)).slice(-2);
|
|
1111
|
+
return '#' + r + g + b;
|
|
1112
|
+
}
|
|
1113
|
+
`)}(${i}, ${a}, ${l})`,2]}const qO=window.Blockly.common.createBlockDefinitionsFromJsonArray([YO]);qO[$S];function XO(){window.Blockly.FieldMultilineInput||(window.Blockly.fieldRegistry.register("field_multilinetext",tu),window.Blockly.JavaScript.forBlock.text_multiline=PO,window.Blockly.FieldMultilineInput=tu,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",Pm),window.Blockly.JavaScript.forBlock.colour_picker=FO,window.Blockly.JavaScript.forBlock.colour_blend=JO,window.Blockly.JavaScript.forBlock.colour_random=HO,window.Blockly.JavaScript.forBlock.colour_rgb=VO,window.Blockly.FieldColour=Pm,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 r=window.Blockly.JavaScript;r.forBlock&&Object.keys(r).forEach(s=>{typeof r[s]=="function"&&(r.forBlock[s]||(console.log(`Migrating Blockly.JavaScript.${s} to Blockly.JavaScript.forBlock.${s}`),r.forBlock[s]=r[s],delete r[s]))})}let Ec=!1,xc=!1,Wg=null,Gg=null;const Ww=[];function bS(r,s,i,a){var l;if(a=a||[],(r.tagName==="BLOCK"||r.tagName==="block")&&(i=r.id),r.tagName==="FIELD"||r.tagName==="field")for(let c=0;c<r.attributes.length;c++){const h=(r.attributes[c].value||"").toLowerCase();r.attributes[c].nodeName==="name"&&(h==="oid"||h==="text"||h==="var")&&i&&(l=r.innerHTML)!=null&&l.toLowerCase().includes(s)&&a.push(i)}return r.childNodes.forEach(c=>bS(c,s,i,a)),a}class Ye extends pe.Component{blockly=null;blocklyWorkspace=null;originalCode;someSelected=null;changeTimer=null;someSelectedTime=0;ignoreChanges=!1;blinkBlock;onResizeBind;resizeObserver=null;didUpdate=null;lastCommand="";lastSearch;static Blockly=window.Blockly;constructor(s){super(s),this.state={languageOwnLoaded:xc,languageBlocklyLoaded:Ec,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,XO(),Ye.Blockly.dialog.setPrompt(this.onShowNameDialog),this.loadLanguages()}onShowNameDialog=(s,i,a)=>{this.setState({showInputPrompt:{promptText:s,defaultText:i,callback:a,value:i}})};static loadJS(s,i,a){const l=document.createElement("script");try{l.src=s,l.onload=i,l.onerror=i,(a||window.document.body).appendChild(l)}catch(c){console.error(`Cannot load ${s}: ${c}`),i&&i()}}static loadScripts(s,i){if(!(s!=null&&s.length)){i&&i();return}const a=s.pop();a&&!Ww.includes(a)?(Ww.push(a),Ye.loadJS(`../../adapter/${a}/blockly.js`,()=>setTimeout(()=>Ye.loadScripts(s,i),0))):setTimeout(()=>Ye.loadScripts(s,i),0)}static loadCustomBlockly(s,i){var l;const a=[];for(const c in s)!Object.prototype.hasOwnProperty.call(s,c)||!s[c]||!c.match(/^system\.adapter\./)||s[c].type!=="adapter"||(l=s[c].common)!=null&&l.blockly&&(console.log(`Detected custom blockly: ${s[c].common.name}`),a.push(s[c].common.name));Ye.loadScripts(a,i)}static loadXMLDoc(s){let i;return window.DOMParser?i=a=>new window.DOMParser().parseFromString(a,"text/xml"):typeof window.ActiveXObject<"u"&&new window.ActiveXObject("Microsoft.XMLDOM")?i=a=>{const l=new window.ActiveXObject("Microsoft.XMLDOM");return l.async="false",l.loadXML(a),l}:i=()=>null,i(s)}searchBlocks(s){if(this.blocklyWorkspace){const i=Ye.Blockly.Xml.workspaceToDom(this.blocklyWorkspace),a=bS(i,s.toLowerCase());return console.log(`Search "${s}" found blocks: ${a.length?JSON.stringify(a):"none"}`),a}return[]}searchId(){const s=this.lastSearch?this.searchBlocks(this.lastSearch):null;s!=null&&s.length?(this.someSelected=s,this.someSelected.forEach(i=>{var a;return(a=this.blocklyWorkspace)==null?void 0:a.highlightBlock(i,!0)}),this.someSelectedTime=Date.now()):this.someSelected&&(this.someSelected.forEach(i=>{var a;return(a=this.blocklyWorkspace)==null?void 0:a.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,a)=>{i?(a&&Ye.blocklyBlinkBlock(a),this.setState({error:{text:x.I18n.t(i),title:x.I18n.t("Error was found")}}),this.blinkBlock=a):this.setState({message:x.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(!Ec){const s=window.document.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("src",`google-blockly/msg/js/${x.I18n.getLanguage()}.js`),s.onload=()=>{Ec=!0,this.setState({languageBlocklyLoaded:Ec})},window.document.getElementsByTagName("head")[0].appendChild(s)}if(!xc){const s=window.document.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("src",`google-blockly/own/msg/${x.I18n.getLanguage()}.js`),s.onload=()=>{xc=!0,this.setState({languageOwnLoaded:xc})},window.document.getElementsByTagName("head")[0].appendChild(s)}}onResize(){this.blocklyWorkspace&&Ye.Blockly.svgResize(this.blocklyWorkspace)}static jsCode2Blockly(s){s=s||"";const i=s.split(/[\r\n]+|\r|\n/g);let a="";for(let c=i.length-1;c>=0;c--)if(i[c].substring(0,2)==="//"){a=i[c].substring(2);break}if(a.substring(0,4)==="<xml")return a;let l;try{l=window.decodeURIComponent(window.atob(a))}catch(c){l=null,console.error(`cannot decode: ${a}`),console.error(c)}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 a=0;i=s[a];a++)if(i.isShadow()){const l=i.getConnections_(!0);let c;for(let h=0;c=l[h];h++)if(!c.targetConnection){i.dispose();break}}}}blocklyCheckBlocks(s){let i;if(!this.blocklyWorkspace||this.blocklyWorkspace.getAllBlocks().length===0)return s&&s("no blocks found"),!1;let a=this.blocklyGetUnconnectedBlock();return a?i="not properly connected":(a=this.blocklyGetBlockWithWarning(),a&&(i="warning on this block")),a?(s?s(i,a):Ye.blocklyBlinkBlock(a),!1):(s(),!0)}blocklyGetUnconnectedBlock(){var a;const s=(a=this.blocklyWorkspace)==null?void 0:a.getAllBlocks();let i;if(s)for(let l=0;i=s[l];l++){const c=i.getConnections_(!0);let h;for(let d=0;h=c[d];d++)if(!h.sourceBlock_||(h.type===Ye.Blockly.INPUT_VALUE||h.type===Ye.Blockly.OUTPUT_VALUE)&&!h.targetConnection&&!h._optional)return i}return null}blocklyGetBlockWithWarning(){var a;const s=(a=this.blocklyWorkspace)==null?void 0:a.getAllBlocks();let i;if(s){for(let l=0;i=s[l];l++)if(i.warning)return i}return null}appendBlocksFromXml(s){this.onImportBlocks(s)}applyAiBlocks(s){var i,a;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,"");const l=Ye.Blockly.utils.xml.textToDom(s),c=Array.from(l.querySelectorAll(":scope > block"));if(c.length===0)return;const h=C=>{const D=C.getAttribute("type")||"",R=[];for(const N of Array.from(C.children))N.tagName==="field"&&R.push(`${N.getAttribute("name")}=${N.textContent}`),N.tagName==="mutation"&&R.push(`mut:${N.outerHTML}`);return`${D}|${R.join(",")}`},d=C=>{const D=C.type||"",R=[];for(const N of C.inputList||[])for(const U of N.fieldRow||[])U.name&&U.getValue&&R.push(`${U.name}=${U.getValue()}`);if(C.mutationToDom)try{const N=C.mutationToDom();N&&R.push(`mut:${N.outerHTML}`)}catch{}return`${D}|${R.join(",")}`},p=c.map(C=>h(C)),f=this.blocklyWorkspace.getTopBlocks(!1),b=f.map(C=>d(C)),v=new Array(f.length).fill(!1),_=[];for(let C=0;C<p.length;C++){let D=!1;for(let R=0;R<b.length;R++)if(!v[R]&&p[C]===b[R]){v[R]=!0;const N=f[R].getRelativeToSurfaceXY();_.push({x:N.x,y:N.y}),D=!0;break}if(!D){const R=c[C].getAttribute("type")||"";for(let N=0;N<f.length;N++)if(!v[N]&&f[N].type===R){v[N]=!0;const U=f[N].getRelativeToSurfaceXY();_.push({x:U.x,y:U.y}),D=!0;break}}D||_.push(null)}const y=window.Blockly,w=y.utils.idGenerator.genUid();y.Events.setGroup(w),window.scripts.loading=!0;for(let C=0;C<f.length;C++)v[C]&&f[C].dispose(!1);if(c.length>1){const C=new Set;for(const D of c)C.add(`${D.getAttribute("x")||"0"},${D.getAttribute("y")||"0"}`);if(C.size===1){let D=10;for(const R of c)R.setAttribute("x","10"),R.setAttribute("y",String(D)),D+=200}}Ye.Blockly.Xml.appendDomToWorkspace(l,this.blocklyWorkspace);const $=this.blocklyWorkspace.getTopBlocks(!1),I=$.slice(-c.length);let T=10;for(const C of $.slice(0,-c.length)){const D=C.getRelativeToSurfaceXY(),R=C.getHeightWidth();T=Math.max(T,D.y+R.height+30)}for(let C=0;C<I.length;C++){const D=_[C];if(D){const R=I[C].getRelativeToSurfaceXY();I[C].moveBy(D.x-R.x,D.y-R.y)}else{const R=I[C].getRelativeToSurfaceXY();I[C].moveBy(10-R.x,T-R.y),T+=I[C].getHeightWidth().height+20}}window.scripts.loading=!1,y.Events.setGroup(!1),this.onBlocklyChanged()}catch(l){window.scripts.loading=!1,(a=(i=window.Blockly)==null?void 0:i.Events)==null||a.setGroup(!1),console.error("Error applying AI blocks:",l)}}getWorkspaceXml(){if(!this.blocklyWorkspace)return"";const s=Ye.Blockly.Xml.workspaceToDom(this.blocklyWorkspace);return Ye.Blockly.Xml.domToPrettyText(s)}blocklyCode2JSCode(s){if(!this.blocklyWorkspace)return"";let i=Ye.Blockly.JavaScript.workspaceToCode(this.blocklyWorkspace);if(!s){i+=`
|
|
1114
|
+
`;const a=Ye.Blockly.Xml.workspaceToDom(this.blocklyWorkspace),l=Ye.Blockly.Xml.domToText(a);i+=`//${btoa(encodeURIComponent(l))}`}return i}exportBlocks(){if(!this.blocklyWorkspace)return;let s;const i=Ye.Blockly.getSelected();if(i){const a=Ye.Blockly.Xml.blockToDom(i),l=i.getRelativeToSurfaceXY();a.setAttribute("x",(i.RTL?-l.x:l.x).toString()),a.setAttribute("y",l.y.toString()),s=Ye.Blockly.Xml.domToPrettyText(a)}else{const a=Ye.Blockly.Xml.workspaceToDom(this.blocklyWorkspace);s=Ye.Blockly.Xml.domToPrettyText(a)}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=Ye.Blockly.utils.xml.textToDom(s),a=Array.from(i.querySelectorAll(":scope > block"));if(a.length>1){const l=new Set;for(const c of a)l.add(`${c.getAttribute("x")||"0"},${c.getAttribute("y")||"0"}`);if(l.size===1){let c=parseInt(a[0].getAttribute("y")||"0",10);for(const h of a)h.setAttribute("y",String(c)),c+=200}}if(Ye.Blockly.Xml.appendDomToWorkspace(i,this.blocklyWorkspace),a.length>1){const c=this.blocklyWorkspace.getTopBlocks(!1).slice(-a.length);if(c.length>1){let h=c[0].getRelativeToSurfaceXY().y;for(const d of c){const p=d.getRelativeToSurfaceXY();d.moveBy(0,h-p.y),h+=d.getHeightWidth().height+20}}}window.scripts.loading=!1,this.onBlocklyChanged()}catch(i){this.setState({error:{text:i.toString(),title:x.I18n.t("Import error")}})}}loadCode(){if(this.blocklyWorkspace){this.ignoreChanges=!0,this.blocklyWorkspace.clear();try{const s=Ye.jsCode2Blockly(this.originalCode)||'<xml xmlns="https://developers.google.com/blockly/xml"></xml>';window.scripts.loading=!0;const i=Ye.Blockly.utils.xml.textToDom(s);Ye.Blockly.Xml.domToWorkspace(i,this.blocklyWorkspace),window.scripts.loading=!1}catch(s){console.error(s),setTimeout(()=>this.setState({error:x.I18n.t("Cannot extract Blockly code!")}))}setTimeout(()=>this.ignoreChanges=!1,100)}}onBlocklyChanged(){this.blocklyRemoveOrphanedShadows(),this.setState({changed:!0}),this.onChange()}async componentDidUpdate(){var i,a;if(!this.blockly||(this.didUpdate&&(clearTimeout(this.didUpdate),this.didUpdate=null),this.blocklyWorkspace))return;window.addEventListener("resize",this.onResizeBind,!1),!this.resizeObserver&&this.blockly&&(this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this.blockly)),Wg=Wg||await this.getToolbox(),Gg=Gg||Ye.Blockly.utils.xml.textToDom(Wg),this.blocklyWorkspace=Ye.Blockly.inject(this.blockly,{renderer:"thrasos",theme:this.state.themeType==="dark"?Hw:"classic",media:"google-blockly/media/",toolbox:Gg,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(l=>{var c;if(this.someSelected&&Date.now()-this.someSelectedTime>500){const h=(c=this.blocklyWorkspace)==null?void 0:c.getAllBlocks();this.someSelected=null,h==null||h.forEach(d=>d.removeSelect())}[Ye.Blockly.Events.UI,Ye.Blockly.Events.CREATE,Ye.Blockly.Events.VIEWPORT_CHANGE].includes(l.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];if(this.blockly.appendChild(s),(a=(i=window.Blockly)==null?void 0:i.FieldOID)!=null&&a.DISPLAY_MODE_KEYS){const l=this.blocklyWorkspace,c=l.configureContextMenu;l.configureContextMenu=(h,d)=>{var b,v,_,y;c&&c.call(l,h,d);const p=window.Blockly.FieldOID,f=p.DISPLAY_MODE_KEYS;for(let w=0;w<f.length;w++){const $=((v=(b=Ye.Blockly.Words)==null?void 0:b[f[w]])==null?void 0:v[x.I18n.getLanguage()])||((y=(_=Ye.Blockly.Words)==null?void 0:_[f[w]])==null?void 0:y.en)||f[w];h.push({text:`${p.displayMode===w?"✓ ":" "}${$}`,enabled:!0,callback:()=>p.setDisplayMode(w,l),scope:{workspace:l},weight:200+w})}}}this.updateBackground(),setTimeout(()=>this.searchId(),200)}updateBackground(){var s;this.state.themeType==="dark"?(s=this.blocklyWorkspace)==null||s.setTheme(Hw):this.blocklyWorkspace&&(this.blocklyWorkspace.getThemeManager(),this.blocklyWorkspace.setTheme(Ye.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),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null))}onChange(){this.originalCode=this.blocklyCode2JSCode(),this.props.onChange&&this.props.onChange(this.originalCode)}async getToolbox(s){const i=window.document.getElementById("toolbox");let a=i==null?void 0:i.outerHTML;if(!a)return s?(console.error("Cannot load blocks!"),""):new Promise(l=>{setTimeout(()=>l(this.getToolbox(!0)),500)});if(a=a.replace(/{(\w+)}/g,(l,c)=>window.MSG[c]),window.Blockly.CustomBlocks){let l="";const c=x.I18n.getLanguage();for(let h=0;h<window.Blockly.CustomBlocks.length;h++){const d=window.Blockly.CustomBlocks[h],p=window.Blockly[d];l+=`<category name="${window.Blockly.Words[d][c]}" colour="${p.HUE}">`;for(const f in p.blocks)Object.prototype.hasOwnProperty.call(p.blocks,f)&&(l+=p.blocks[f]);l+="</category>"}a=a.replace("<category><block>%%CUSTOM_BLOCKS%%</block></category>",l)}return a}renderMessageDialog(){return this.state.message?g.jsx(x.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(Su,{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&&(Ye.blocklyBlinkBlock(this.blinkBlock),this.blinkBlock=null),this.setState({error:""})}},"dialogError"):null}renderExportDialog(){return this.state.exportText?g.jsx(NO,{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(vf,{themeType:this.props.themeType,onClose:s=>{this.setState({importText:!1}),this.onImportBlocks(s)}},"dialogImport"):null}renderDialogPrompt(){return this.state.showInputPrompt?g.jsxs(zt,{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(ts,{children:this.state.showInputPrompt.promptText}),g.jsx(Yt,{children:g.jsx(Oo,{variant:"standard",fullWidth:!0,autoFocus:!0,value:this.state.showInputPrompt.value,onKeyUp:s=>{var i,a;if(s.key==="Enter"){const l=(i=this.state.showInputPrompt)==null?void 0:i.callback,c=(a=this.state.showInputPrompt)==null?void 0:a.value;l&&l(c===void 0?null:c),this.setState({showInputPrompt:null})}},onChange:s=>{var a,l;const i={...this.state.showInputPrompt};(a=this.state.showInputPrompt)!=null&&a.callback&&(i.callback=(l=this.state.showInputPrompt)==null?void 0:l.callback),i.value=s.target.value,this.setState({showInputPrompt:i})}})}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",disabled:!this.state.showInputPrompt.value,onClick:()=>{var a,l;const s=(a=this.state.showInputPrompt)==null?void 0:a.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(ni,{}),children:x.I18n.t("Apply")}),g.jsx(je,{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(ao,{}),children:x.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 ZO=Object.freeze(Object.defineProperty({__proto__:null,default:Ye},Symbol.toStringTag,{value:"Module"})),QO="_nameCard_15el3_28",e1="_iconThemCard_15el3_40",t1="_iconThemCardSelectable_15el3_49",s1="_iconHelp_15el3_53",o1="_blockName_15el3_64",i1="_controlMenuTop_15el3_123",n1="_debugInfo_15el3_132",r1="_tagCard_15el3_142",a1="_displayFlex_15el3_161",l1="_blockMarginTop_15el3_166",c1="_nameBlock_15el3_167",u1="_frontText_15el3_171",d1="_backText_15el3_177",h1="_iconTag_15el3_181",p1="_displayItalic_15el3_191",Ee={nameCard:QO,iconThemCard:e1,iconThemCardSelectable:t1,iconHelp:s1,blockName:o1,controlMenuTop:i1,debugInfo:n1,tagCard:r1,displayFlex:a1,blockMarginTop:l1,nameBlock:c1,frontText:u1,backText:d1,iconTag:h1,displayItalic:p1},g1="_root_1dr6a_1",m1="_square_1dr6a_11",f1="_icon_1dr6a_16",Vg={root:g1,square:m1,icon:f1},ga=({fullWidth:r,size:s,onClick:i,style:a,className:l,value:c,square:h,icon:d})=>g.jsx(je,{variant:"outlined",color:"primary",onClick:i,fullWidth:r,style:a,className:x.Utils.clsx(Vg.root,l,h?Vg.square:""),size:s||"medium",children:d?g.jsx(x.Icon,{className:Vg.icon,src:d}):c}),$1="_root_1ucda_1",b1={root:$1},y1=({size:r,value:s,title:i,onChange:a,className:l,customValue:c,disabled:h})=>{const[d,p]=St(!1);return g.jsxs(g.Fragment,{children:[g.jsx(ua,{disabled:h,checked:!!(c?s:d),className:x.Utils.clsx(b1.root,l),onChange:f=>{c&&p(f.target.checked),a&&a(f.target.checked)},size:r||"medium"}),i||null]})},yS=Fm(y1),v1="_root_19roy_1",Gw={root:v1},Pi=r=>{const[s,i]=St(""),{value:a,type:l,error:c,className:h,icon:d,label:p,style:f,onChange:b,fullWidth:v,autoComplete:_,customValue:y,autoFocus:w,rows:$,size:I,variant:T,multiline:C,disabled:D}=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},r);return g.jsx(Oo,{error:!!c,autoFocus:w,fullWidth:v,label:p,disabled:D,variant:T,multiline:C,rows:$,value:y?a:s,type:l,helperText:c,style:f,className:x.Utils.clsx(Gw.root,h),autoComplete:_,onChange:R=>{!y&&i(R.target.value),b&&b(R.target.value)},slotProps:{input:{endAdornment:d?g.jsx(uk,{position:"end",children:g.jsx(x.Icon,{className:Gw.icon,src:d})}):null}},margin:"normal",size:I})},_1={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"}}},w1=({multiple:r,value:s,customValue:i,socket:a,title:l,attr:c,adapter:h,style:d,onChange:p,onInstanceHide:f})=>{const[b,v]=St(s||"test1"),[_,y]=St([]);return Ft(()=>{a==null||a.getAdapterInstances(h).then(w=>{const $=w.map(I=>({value:I._id.replace("system.adapter.",""),title:I._id.replace("system.adapter.","")}));$.length===1?f($[0].value):$.unshift({value:h,title:x.I18n.t("All")}),y($)})},[a,h,f]),g.jsxs(Ui,{sx:_1.formControl,fullWidth:!0,style:d,children:[g.jsx(Hi,{variant:"standard",value:(i?s:b)||"_",fullWidth:!0,multiple:r,renderValue:w=>r&&Array.isArray(w)?w.join(", "):w,onChange:w=>{!i&&v(w.target.value),p(w.target.value)},input:c?g.jsx(Jn,{name:c,id:`${c}-helper`}):g.jsx(Jn,{name:c}),children:_.map(w=>g.jsx(et,{style:{placeContent:"space-between"},value:w.value||"_",children:x.I18n.t(w.title)},`key-${w.value}`))}),l?g.jsx(hk,{children:x.I18n.t(l)}):null]})},k1="_modalWrapper_587ci_33",C1="_modalDialog_587ci_40",Vw={modalWrapper:k1,modalDialog:C1},Bm=({onClose:r,children:s,titleButtonApply:i,titleButtonClose:a,onApply:l,className:c,textInput:h,defaultValue:d,disabled:p})=>{const[f,b]=St(d||""),[v]=St(d||"");return g.jsxs(zt,{open:!0,maxWidth:"md",disableEscapeKeyDown:!1,onClose:r,classes:{paper:Vw.modalDialog},className:Vw.modalWrapper,children:[g.jsxs(Yt,{children:[h&&g.jsx(Pi,{className:c,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"medium",rows:10,multiline:!0,value:f,onChange:b,customValue:!0}),!h&&s]}),g.jsxs(Ut,{children:[g.jsx(je,{disabled:p===void 0?v===f:p,onClick:()=>l(h?f:null),variant:"contained",color:"primary",children:x.I18n.t(i||"Ok")}),g.jsx(je,{color:"grey",onClick:r,variant:"contained",children:x.I18n.t(a||"Cancel")})]})]})},S1="_root_15mo1_1",T1={root:S1},I1=({multiple:r,value:s,customValue:i,title:a,attr:l,options:c,style:h,onChange:d,className:p,doNotTranslate:f,doNotTranslate2:b})=>{const[v,_]=St(s===void 0?c[0].value:s),y=i?s:v,w=y===""||y===null||y===void 0?"_":y;return g.jsxs(Ui,{variant:"standard",className:x.Utils.clsx(T1.root,p),fullWidth:!0,style:h,children:[g.jsxs(Hi,{variant:"standard",value:w,fullWidth:!0,multiple:r,renderValue:$=>{if(r&&Array.isArray($)){$.sort();let T=$.indexOf("0");T!==-1&&($.splice(T,1),$.push("0")),T=$.indexOf("_"),T!==-1&&($.splice(T,1),$.unshift("_"));const C=c.find(R=>R.only);return C&&$.includes(C.value)?C.titleShort?f?C.titleShort:x.I18n.t(C.titleShort):f?C.title:x.I18n.t(C.title):$.map(R=>c.find(N=>N.value===R||R==="_"&&N.value==="")||R).map(R=>typeof R=="object"?R.titleShort?f?R.titleShort:x.I18n.t(R.titleShort):f?R.title:x.I18n.t(R.title):f?R:x.I18n.t(R)).join(", ")}const I=c?c.find(T=>T.value===$||$==="_"&&T.value===""):null;return I!=null&&I.title?f?I==null?void 0:I.title:x.I18n.t(I==null?void 0:I.title):$},onChange:$=>{if(i||_($.target.value),r){const I=$.target.value,T=c.find(C=>C.only);if(T){const C=T.value;if(I.length===c.length-1&&I.includes(C))return d(I.filter(D=>D!==C),l);if(I.includes(C))return d(c.map(D=>D.value),l)}}d($.target.value,l)},input:l?g.jsx(Jn,{name:l,id:`${l}-helper`}):g.jsx(Jn,{name:l}),children:[!r&&(c==null?void 0:c.map($=>g.jsxs(et,{style:{placeContent:"space-between"},value:$.value===""||$.value===null||$.value===void 0?"_":$.value,children:[f?$.title:x.I18n.t($.title),$.title2&&g.jsx("div",{children:b?$.title2:x.I18n.t($.title2)})]},`key-${$.value}`))),r&&(c==null?void 0:c.map($=>g.jsxs(et,{style:{placeContent:"space-between"},value:$.value||"_",children:[f?$.title:x.I18n.t($.title)," ",g.jsx(yS,{customValue:!0,value:s==null?void 0:s.includes($.value)})]},`key-${$.value}`)))]}),a?g.jsx(hk,{children:x.I18n.t(a)}):null]})},E1="_root_1gt4d_1",x1="_mark_1gt4d_27",Kw={root:E1,mark:x1},D1=({size:r,value:s,style:i,onChange:a,className:l,customValue:c,min:h,max:d,step:p,unit:f})=>{const[b,v]=St(0);h=h!==void 0?h:0,d=d!==void 0?d:0,p=p!==void 0?p:(d-h)/100;const _=[{value:h,label:h+(f||"")},{value:d,label:d+(f||"")}];return g.jsx(WT,{defaultValue:c?s:b,"aria-labelledby":"discrete-slider",valueLabelDisplay:"auto",classes:{mark:Kw.mark},marks:_,step:p,min:h,max:d,value:c?s:b,style:i,className:x.Utils.clsx(Kw.root,l),onChange:(y,w)=>{Array.isArray(w)?(!c&&v(w[0]),a(w[0])):(!c&&v(w),a(w))},size:r||"medium"})},A1="_root_rzul6_1",R1={root:A1},O1=({label:r,size:s,value:i,style:a,onChange:l,className:c,customValue:h})=>{const[d,p]=St(!1);return g.jsx(rm,{className:R1.root,control:g.jsx(pk,{checked:h?i:d,style:a,className:c,onChange:f=>{h||p(f.target.checked),l(f.target.checked)},size:s||"medium"}),label:r??"all"})},M1=Fm(O1),N1="_root_135pm_1",L1={root:N1},P1=({value:r,style:s,onChange:i,className:a})=>g.jsx(Oo,{variant:"standard",id:"time",type:"time",onChange:l=>i(l.currentTarget.value),value:r,className:x.Utils.clsx(L1.root,a),fullWidth:!0,style:s,slotProps:{htmlInput:{step:300},inputLabel:{shrink:!0}}}),B1="_root_135pm_1",Dc={root:B1},Kg=[31,29,31,30,31,30,31,31,30,31,30,31],j1=({value:r,onChange:s,className:i,style:a})=>{const[l,c]=(r||"01.01").toString().split(".");let h=parseInt(c,10)||0,d=parseInt(l,10)||0;d>12?d=12:d<0&&(d=0),h>Kg[d]?h=Kg[d]:h<0&&(h=0);const p=[];for(let f=0;f<Kg[d];f++)p.push(f+1);return g.jsxs("div",{children:[g.jsx(Ui,{variant:"standard",className:x.Utils.clsx(Dc.root,i),style:a,children:g.jsxs(Hi,{variant:"standard",className:x.Utils.clsx(Dc.root,i),margin:"dense",label:x.I18n.t("Month"),onChange:f=>s(`${f.target.value.toString().padStart(2,"0")}.${h.toString().padStart(2,"0")}`),value:d,children:[g.jsx(et,{style:{placeContent:"space-between"},value:0,children:x.I18n.t("Any month")},0),g.jsx(et,{style:{placeContent:"space-between"},value:1,children:x.I18n.t("January")},1),g.jsx(et,{style:{placeContent:"space-between"},value:2,children:x.I18n.t("February")},2),g.jsx(et,{style:{placeContent:"space-between"},value:3,children:x.I18n.t("March")},3),g.jsx(et,{style:{placeContent:"space-between"},value:4,children:x.I18n.t("April")},4),g.jsx(et,{style:{placeContent:"space-between"},value:5,children:x.I18n.t("May")},5),g.jsx(et,{style:{placeContent:"space-between"},value:6,children:x.I18n.t("June")},6),g.jsx(et,{style:{placeContent:"space-between"},value:7,children:x.I18n.t("July")},7),g.jsx(et,{style:{placeContent:"space-between"},value:8,children:x.I18n.t("August")},8),g.jsx(et,{style:{placeContent:"space-between"},value:9,children:x.I18n.t("September")},9),g.jsx(et,{style:{placeContent:"space-between"},value:10,children:x.I18n.t("October")},10),g.jsx(et,{style:{placeContent:"space-between"},value:11,children:x.I18n.t("November")},11),g.jsx(et,{style:{placeContent:"space-between"},value:12,children:x.I18n.t("December")},12)]})}),g.jsx(Ui,{variant:"standard",className:x.Utils.clsx(Dc.root,i),style:a,children:g.jsxs(Hi,{variant:"standard",className:x.Utils.clsx(Dc.root,i),margin:"dense",label:x.I18n.t("Date"),onChange:f=>s(`${d.toString().padStart(2,"0")}.${f.target.value.toString().padStart(2,"0")}`),value:h,children:[g.jsx(et,{style:{placeContent:"space-between"},value:0,children:x.I18n.t("Any")},"A"),p.map(f=>g.jsx(et,{style:{placeContent:"space-between"},value:f,children:f},f))]})})]})},Yg={},F1={Shuffle:p0,Apps:t0,Functions:a0,Language:yI,AddBox:e0,Pause:Pc,Subject:m0,PlayForWork:d0,Brightness3:s0,HelpOutline:Vk,Storage:g0,AccessTime:Qx,PlayArrow:mm,FlashOn:n0};function Yw({iconName:r,className:s,adapter:i,socket:a,onClick:l,style:c}){const[h,d]=St("");if(Ft(()=>{i&&a&&(Yg[i]instanceof Promise||(Yg[i]=a.getObject(`system.adapter.${i}`)),Yg[i].then(f=>{var b;return((b=f==null?void 0:f.common)==null?void 0:b.icon)&&d(`../../adapter/${i}/${f.common.icon}`)}))},[i,a]),i)return g.jsx("img",{onClick:f=>l&&l(f),src:h||"",className:s,style:c,alt:""});const p=r&&F1[r]||vI;return g.jsx(p,{className:s,style:c,onClick:f=>l&&l(f)})}let Jg;function z1(r){return Jg=Jg||x.I18n.getLanguage(),r&&typeof r=="object"?r[Jg]||r.en:r||""}function Yn(r){return r===null?"null":r===void 0?"undefined":Array.isArray(r)?r.join(", "):typeof r=="object"?JSON.stringify(r):r.toString()}class at extends lk{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 a=s.settings||{tagCard:i.tagCardArray?typeof i.tagCardArray[0]!="string"?i.tagCardArray[0].title:i.tagCardArray[0]:""};!a.tagCard&&i.tagCardArray&&(a.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:a,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,a,l,c){let h=!1;const d=JSON.parse(JSON.stringify(this.state.settings));this.state.inputs.forEach(p=>{const f=p.attr,b=p.defaultValue;f&&b!==void 0&&d[f]===void 0&&(h=!0,d[f]=b)}),h?(this.setState({settings:d},()=>i==null?void 0:i()),this.props.onChange(d)):i&&i()}onUpdate(){}onValueChanged(s,i){}renderText(s,i,a){const{className:l}=this.props,{attr:c,frontText:h,backText:d,nameBlock:p,name:f,doNotTranslate:b,doNotTranslateBack:v}=s;return g.jsxs(em,{children:[g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),children:[h&&g.jsx("div",{className:Ee.frontText,children:b?h:x.I18n.t(h)}),g.jsx(Pi,{className:l,autoComplete:"off",label:z1(f),variant:"outlined",size:"small",fullWidth:!0,value:i,onChange:a,customValue:!0}),d&&g.jsx("div",{className:Ee.backText,children:v?d:x.I18n.t(d)})]}),p&&g.jsx("div",{className:Ee.nameBlock,children:x.I18n.t(p)})]},c)}renderSwitch(s,i,a){const{className:l}=this.props,{attr:c,frontText:h,backText:d,nameBlock:p,doNotTranslate:f,doNotTranslateBack:b}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),children:[h&&g.jsx("div",{className:Ee.frontText,children:f?h:x.I18n.t(h)}),g.jsx(M1,{className:l,label:"",customValue:!0,value:i,onChange:a}),d&&g.jsx("div",{className:Ee.backText,children:b?d:x.I18n.t(d)})]}),p&&g.jsx("div",{className:Ee.nameBlock,children:x.I18n.t(p)})]},c)}renderNameText({attr:s,signature:i,doNotTranslate:a,defaultValue:l},c){return g.jsx("div",{className:x.Utils.clsx(i?Ee.displayItalic:Ee.displayFlex,Ee.blockMarginTop),children:c?a?c:x.I18n.t(c):a?l:x.I18n.t(l)},s)}renderNumber(s,i,a){const{className:l}=this.props,{settings:c}=this.state,{attr:h,backText:d,frontText:p,openCheckbox:f,doNotTranslate:b,doNotTranslateBack:v}=s;let _=!0;return f&&(_=typeof c.offset=="boolean"?c.offset:!0),_?g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),children:[p&&g.jsx("div",{className:Ee.frontText,children:b?p:x.I18n.t(p)}),g.jsx(Pi,{className:x.Utils.clsx(l,s.className),fullWidth:!0,autoComplete:"off",label:s.noHelperText?"":"number",variant:"outlined",size:"small",type:"number",value:i,onChange:a,customValue:!0}),d&&g.jsx("div",{className:Ee.backText,children:v?d:x.I18n.t(d)})]},h):null}renderColor(s,i,a){const{className:l}=this.props,{attr:c,backText:h,frontText:d,doNotTranslate:p,doNotTranslateBack:f}=s;return g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),children:[d&&g.jsx("div",{className:Ee.frontText,children:p?d:x.I18n.t(d)}),g.jsx(Pi,{className:l,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",type:"color",value:i,onChange:a}),h&&g.jsx("div",{className:Ee.backText,children:f?h:x.I18n.t(h)})]},c)}renderCheckbox(s,i,a){const{className:l}=this.props,{settings:c}=this.state,{attr:h,backText:d,frontText:p,defaultValue:f,doNotTranslate:b,doNotTranslateBack:v}=s;return g.jsxs("div",{className:Ee.displayFlex,children:[p&&g.jsx("div",{className:Ee.frontText,children:b?p:x.I18n.t(p)}),g.jsx(yS,{className:l,size:"small",value:typeof c[h]=="boolean"?!!c[h]:!!f,customValue:!0,onChange:a}),d&&g.jsx("div",{onClick:()=>a(typeof c[h]=="boolean"?!c[h]:!f),className:Ee.backText,children:v?d:x.I18n.t(d)})]},h)}renderSlider(s,i,a){const{className:l}=this.props,{attr:c,frontText:h,backText:d,nameBlock:p,min:f,max:b,step:v,unit:_,doNotTranslate:y,doNotTranslateBack:w}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:Ee.displayFlex,style:{marginRight:20},children:[h&&g.jsx("div",{className:Ee.frontText,children:y?h:x.I18n.t(h)}),g.jsx(D1,{customValue:!0,min:f,max:b,step:v,unit:_,className:l,autoComplete:"off",label:"number",variant:"outlined",size:"small",value:i,onChange:$=>{console.log($),a($)}}),d&&g.jsx("div",{style:{marginLeft:20},className:Ee.backText,children:w?d:x.I18n.t(d)})]}),p&&g.jsx("div",{className:Ee.nameBlock,children:x.I18n.t(p)})]},c)}renderButton(s,i,a){const{className:l}=this.props,{attr:c,frontText:h,backText:d,doNotTranslate:p,doNotTranslateBack:f}=s;return g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),children:[h&&g.jsx("div",{className:Ee.frontText,children:p?h:x.I18n.t(h)}),g.jsx(ga,{fullWidth:!0,value:i.toString(),className:l,onClick:()=>a(i)}),d&&g.jsx("div",{className:Ee.backText,children:f?d:x.I18n.t(d)})]},c)}async findIcon(s){var i;if(!s)return null;if((i=s.common)!=null&&i.icon)return x.getSelectIdIcon(s,"../..");if(s.type==="state"||s.type==="channel"){const a=s._id.split(".");a.pop();const l=a.join(".");try{const c=await this.props.socket.getObject(l);return await this.findIcon(c)}catch{return null}}return null}renderObjectID(s,i,a){const{attr:l,openCheckbox:c,checkReadOnly:h}=s,{settings:d}=this.state,p=this.state[`showSelectId${l}`],{className:f,socket:b,style:v}=this.props;let _=!0;c&&(_=typeof d.offset=="boolean"?d.offset:!0);const y=d[l],w=y?this.state[y]:void 0;return y&&!w&&w!==!1&&setTimeout(async $=>{var D;const I=await b.getObject(i),T=await this.findIcon(I),C={[$]:I||!1,[`${$}___icon`]:T,error:h&&this.lastObjectIdChange&&Date.now()-this.lastObjectIdChange<1e3&&((D=I==null?void 0:I.common)==null?void 0:D.write)===!1?x.I18n.t("Read only ID selected: %s",d[$]):""};this.setState(C)},0,y),_?g.jsxs("div",{className:Ee.blockMarginTop,children:[g.jsxs("div",{className:Ee.displayFlex,children:[s.title?g.jsx("div",{children:x.I18n.t(s.title)}):null,g.jsx(Pi,{className:f,style:v,autoComplete:"off",fullWidth:!0,disabled:!0,variant:"outlined",size:"small",value:i,customValue:!0}),g.jsx(ga,{icon:this.state[`${y}___icon`],square:!0,style:{...v||void 0,marginLeft:7},value:"...",className:f,onClick:()=>{const $={};$[`showSelectId${l}`]=!0,this.setState($)}})]}),w?g.jsx("div",{className:x.Utils.clsx(Ee.nameBlock,Ee.displayItalic),children:x.Utils.getObjectNameFromObj(w,x.I18n.getLanguage())}):null,p?g.jsx(x.DialogSelectID,{theme:this.props.theme,imagePrefix:"../..",dialogName:"javascript",themeType:x.Utils.getThemeName(),socket:b,selected:i,onClose:()=>{const $={};$[`showSelectId${l}`]=!1,this.setState($)},onOk:($,I)=>{const T={};T[`showSelectId${l}`]=!1;const C=Array.isArray($)?$[0]:$;this.setState(T,async()=>{var R,N,U,j,B,J,ae,ye,M,W;const D=C?await b.getObject(C):void 0;this.lastObjectIdChange=Date.now(),a({[l]:$,[`${l}Role`]:(R=D==null?void 0:D.common)==null?void 0:R.role,[`${l}Type`]:(N=D==null?void 0:D.common)==null?void 0:N.type,[`${l}Unit`]:(U=D==null?void 0:D.common)==null?void 0:U.unit,[`${l}States`]:(j=D==null?void 0:D.common)==null?void 0:j.states,[`${l}Min`]:(B=D==null?void 0:D.common)==null?void 0:B.min,[`${l}Max`]:(J=D==null?void 0:D.common)==null?void 0:J.max,[`${l}Step`]:(ae=D==null?void 0:D.common)==null?void 0:ae.step,[`${l}Def`]:(ye=D==null?void 0:D.common)==null?void 0:ye.def,[`${l}Write`]:(M=D==null?void 0:D.common)==null?void 0:M.write,[`${l}Read`]:(W=D==null?void 0:D.common)==null?void 0:W.read},()=>this.props.setOnUpdate&&this.props.setOnUpdate(!0))})}}):null]},l):null}renderIconTag(){return g.jsx("div",{className:Ee.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,a){const{attr:l,backText:c,frontText:h,doNotTranslate:d,doNotTranslateBack:p}=s;return g.jsxs("div",{className:Ee.displayFlex,style:{whiteSpace:"nowrap"},children:[h&&g.jsx("div",{className:Ee.frontText,children:d?h:x.I18n.t(h)}),g.jsx(P1,{value:i,onChange:a}),c&&g.jsx("div",{className:Ee.backText,children:p?c:x.I18n.t(c)})]},l)}renderSelect(s,i,a){const{className:l,style:c}=this.props,{name:h,options:d,frontText:p,backText:f,attr:b,multiple:v,doNotTranslate:_,doNotTranslate2:y,doNotTranslateBack:w}=s;return g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),style:{whiteSpace:"nowrap"},children:[p&&g.jsx("div",{className:Ee.frontText,children:x.I18n.t(p)}),g.jsx(I1,{attr:b,doNotTranslate:_,doNotTranslate2:y,title:h,className:l,style:c,options:d,value:i,onChange:a,multiple:v,customValue:!0}),f&&g.jsx("div",{className:Ee.backText,children:w?f:x.I18n.t(f)})]},b)}renderInstance(s,i,a){const{socket:l}=this.props,{name:c,frontText:h,backText:d,attr:p,adapter:f,doNotTranslate:b,doNotTranslateBack:v}=s;return this.state.hideAttributes.includes(p)?null:g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),style:{whiteSpace:"nowrap"},children:[h&&g.jsx("div",{className:Ee.frontText,children:b?h:x.I18n.t(h)}),g.jsx(w1,{attr:p,socket:l,adapter:f,title:c,value:i,onChange:_=>{a(Array.isArray(_)?_[0]:_)},customValue:!0,onInstanceHide:_=>this.setState({hideAttributes:[...this.state.hideAttributes,p]},()=>a(_))}),d&&g.jsx("div",{className:Ee.backText,children:v?d:x.I18n.t(d)})]},p)}renderDialog(s){const{onShowDialog:i,frontText:a,backText:l,attr:c,icon:h,doNotTranslate:d,doNotTranslateBack:p}=s;return g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),style:{whiteSpace:"nowrap"},children:[a&&g.jsx("div",{className:Ee.frontText,children:d?a:x.I18n.t(a)}),g.jsx(Yw,{iconName:h,className:x.Utils.clsx(Ee.iconDialog),onClick:()=>i&&i()}),l&&g.jsx("div",{className:Ee.backText,children:p?l:x.I18n.t(l)})]},c)}renderModalInput(s,i,a){const{openModal:l}=this.state,{className:c}=this.props,{attr:h,nameBlock:d,frontText:p,backText:f,noTextEdit:b,doNotTranslate:v,doNotTranslateBack:_}=s;return g.jsxs("div",{children:[g.jsxs("div",{className:x.Utils.clsx(Ee.displayFlex,Ee.blockMarginTop),children:[p&&g.jsx("div",{className:Ee.frontText,children:v?p:x.I18n.t(p)}),g.jsx(Pi,{disabled:!!b,className:c,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",value:i,onChange:a,customValue:!0}),g.jsx(ga,{square:!0,style:{marginLeft:5},value:"...",className:c,onClick:()=>this.setState({openModal:!0})}),f&&g.jsx("div",{className:Ee.backText,children:_?f:x.I18n.t(f)})]}),l?g.jsx(Bm,{onApply:y=>this.setState({openModal:!1},()=>y!=null&&a(y)),onClose:()=>this.setState({openModal:!1}),defaultValue:i,textInput:!0}):null,d&&g.jsx("div",{className:Ee.nameBlock,children:x.I18n.t(d)})]},h)}renderDate(s,i,a){const{attr:l,backText:c,frontText:h,doNotTranslate:d,doNotTranslateBack:p}=s;return g.jsxs("div",{className:Ee.displayFlex,style:{whiteSpace:"nowrap"},children:[h&&g.jsx("div",{className:Ee.frontText,children:d?h:x.I18n.t(h)}),g.jsx(j1,{value:i,onChange:a}),c&&g.jsx("div",{className:Ee.backText,children:p?c:x.I18n.t(c)})]},l)}static getReplacesInText(s){var a;let i="";return(a=s.trigger)!=null&&a.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:a}=this.state.settings;let l=a!=="="&&a!=="<>"&&a!==">="&&a!=="()"&&a!=="."&&a!=="<="&&a!=="<"&&a!==">"&&a?x.I18n.t(a):a;return s.length>=3&&(l=g.jsxs("div",{children:[g.jsx("div",{"aria-controls":"simple-menu","aria-haspopup":"true",onClick:c=>{this.setState({openTagMenu:c.currentTarget},()=>{this.props.isTourOpen&&this.props.tourStep===Ps.openTagsMenu&&setTimeout(()=>this.props.setTourStep&&this.props.setTourStep(Ps.selectIntervalTag),300)})},children:l}),g.jsx(Gc,{id:"simple-menu",anchorEl:i,keepMounted:!0,open:!!i,onClose:()=>this.setState({openTagMenu:null}),children:s.map((c,h)=>{let d;return typeof c!="string"?d=c.title:d=c,g.jsxs(et,{selected:d===a,className:`tag-card-${d}`,style:{placeContent:"space-between"},onClick:p=>{p.stopPropagation(),this.props.isTourOpen&&(this.props.tourStep===Ps.openTagsMenu||this.props.tourStep===Ps.selectIntervalTag)&&d==="interval"&&setTimeout(()=>{var b,v;return(v=(b=this.props).setTourStep)==null?void 0:v.call(b,Ps.selectActions)},500);const f=JSON.parse(JSON.stringify(this.state.settings));f.tagCard=d,this.setState({openTagMenu:null,settings:f},()=>{this.props.onChange(this.state.settings),this.onTagChange(this.state.settings.tagCard)})},children:[d.search(/>|<|<>|<=|>=|=/)!==-1?d:x.I18n.t(d),typeof c!="string"&&c.title2&&g.jsx("div",{style:{marginLeft:4},children:x.I18n.t(c.title2)})]},`${d}_${h}`)})})]})),l}getData(){return{acceptedBy:"triggers",name:"",id:""}}onChangeTag(){const{tagCardArray:s,settings:i,settings:{tagCard:a}}=this.state;let l;if(typeof s[0]!="string"?l=s.map(c=>c.title):l=[...s],a&&l.length<3){const c={...i},h=l[(l.indexOf(a)+1)%l.length];c.tagCard=h,this.setState({settings:c},()=>{this.props.onChange(c),this.onTagChange(h)})}}componentDidMount(){this.onTagChange()}componentDidUpdate(){this.props.acceptedBy!=="triggers"&&this.props.onUpdate&&setTimeout(()=>this.onUpdate(),0)}onChangeInput(s){return(i,a,l)=>{const c=JSON.parse(JSON.stringify(this.state.settings));typeof i=="object"&&(!a||typeof a=="function")?(Object.keys(i).forEach(h=>c[h]=i[h]),typeof a=="function"&&(l=a,a=void 0)):c[a||s]=i,c.id=this.getData().id,c._id=this.props._id,this.setState({settings:c},()=>{this.onValueChanged(i,a||s),this.props.onChange(c),l==null||l()})}}renderSpecific(){return null}renderDebug(s){return""}renderDebugInfo(){return this.state.debugMessage?g.jsx("div",{className:Ee.debugInfo,style:{opacity:1,height:22,bottom:-22},children:this.renderDebug?this.renderDebug(this.state.debugMessage):x.I18n.t("executed")},this.state.debugMessage.ts):null}renderCron(s,i,a){return null}renderWizard(s,i,a){return null}renderWriteState(){return null}renderInputElement(s,i){const{nameRender:a,defaultValue:l,attr:c}=s,{settings:h}=this.state;let d=c?h[c]:void 0;switch(d===void 0&&(d=l),a){case"renderTime":return c?this.renderTime(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderTime")},`invalid_${i}`);case"renderNameText":return this.renderNameText(s,l);case"renderSelect":return c?this.renderSelect(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderSelect")},`invalid_${i}`);case"renderModalInput":return c?this.renderModalInput(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderModalInput")},`invalid_${i}`);case"renderObjectID":return c?this.renderObjectID(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderObjectID")},`invalid_${i}`);case"renderDialog":return c?this.renderDialog(s):g.jsx("div",{children:x.I18n.t("Invalid renderDialog")},`invalid_${i}`);case"renderInstance":return c?this.renderInstance(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderInstance")},`invalid_${i}`);case"renderText":return c?this.renderText(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderText")},`invalid_${i}`);case"renderSlider":return c?this.renderSlider(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderSlider")},`invalid_${i}`);case"renderCheckbox":return c?this.renderCheckbox(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderCheckbox")},`invalid_${i}`);case"renderButton":return c?this.renderButton(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderButton")},`invalid_${i}`);case"renderColor":return c?this.renderColor(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderColor")},`invalid_${i}`);case"renderSwitch":return c?this.renderSwitch(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderSwitch")},`invalid_${i}`);case"renderDate":return c?this.renderDate(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderDate")},`invalid_${i}`);case"renderCron":return c?this.renderCron(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderCron")},`invalid_${i}`);case"renderWizard":return c?this.renderWizard(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderWizard")},`invalid_${i}`);case"renderWriteState":return this.renderWriteState();case"renderNumber":return c?this.renderNumber(s,d,this.onChangeInput(c)):g.jsx("div",{children:x.I18n.t("Invalid renderNumber")},`invalid_${i}`);default:return this[a]?this[a](s,d,c?this.onChangeInput(c):null):g.jsx("div",{children:x.I18n.t("Invalid input type: %s",a)},`invalid_${i}`)}}render(){var _;const{inputs:s,name:i,icon:a,iconTag:l,settings:c,adapter:h,settings:{tagCard:d},helpDialog:p}=this.state,{socket:f,notFound:b}=this.props;this.state.settings&&!this.state.settings.tagCard&&((_=this.state.tagCardArray)!=null&&_.length)&&setTimeout(()=>{const y=JSON.parse(JSON.stringify(this.state.settings));y.tagCard=typeof this.state.tagCardArray[0]!="string"?this.state.tagCardArray[0].title:this.state.tagCardArray[0],this.setState({settings:y})},50),this.state.enableSimulation!==this.props.enableSimulation&&!this.enableSimulationProcessing&&(this.enableSimulationProcessing=!0,setTimeout(()=>{this.setState({enableSimulation:this.props.enableSimulation},()=>{this.enableSimulationProcessing=!1})},50));let v;if(this.props.onDebugMessage)for(let y=this.props.onDebugMessage.length-1;y>=0;y--){const w=this.props.onDebugMessage[y];if(w.blockId===this.props._id&&w.ts>this.lastDebugMessage&&w.ts>Date.now()-1e3){v=w;break}}return v&&(this.lastDebugMessage=v.ts,this.debugMessageTimeout&&clearTimeout(this.debugMessageTimeout),this.debugHideTimeout&&(clearTimeout(this.debugHideTimeout),this.debugHideTimeout=null),this.debugMessageTimeout=setTimeout(y=>{const w=JSON.parse(y),$=w.hideTimeout||5e3;this.debugMessageTimeout=null,this.setState({debugMessage:w},()=>{this.debugHideTimeout&&clearTimeout(this.debugHideTimeout),this.debugHideTimeout=setTimeout(()=>{this.debugHideTimeout=null,this.setState({debugMessage:null})},$)})},50,JSON.stringify(v))),g.jsxs(em,{children:[l?this.renderIconTag():g.jsx(Yw,{iconName:a,className:x.Utils.clsx(Ee.iconThemCard,d&&this.state.tagCardArray.length&&Ee.iconThemCardSelectable),adapter:h,socket:f,onClick:y=>{d&&(this.state.tagCardArray.length<3?this.onChangeTag():this.setState({openTagMenu:y.currentTarget}))}}),g.jsxs("div",{className:Ee.blockName,children:[g.jsxs("span",{className:Ee.nameCard,children:[x.I18n.t(i),b?x.I18n.t("%s not found",c.id):"",p?g.jsx(We,{className:Ee.iconHelp,size:"small",onClick:()=>this.setState({helpText:x.I18n.t(p)}),children:g.jsx(Vk,{})}):null]}),s.map((y,w)=>this.renderInputElement(y,w))]}),d&&g.jsx("div",{className:Ee.controlMenuTop,style:{opacity:1,height:22,top:-22},children:g.jsx("div",{onClick:()=>this.onChangeTag(),className:x.Utils.clsx(Ee.tagCard,"tag-card"),children:this.renderTags()})}),this.renderDebugInfo(),this.state.error?g.jsx(x.DialogError,{title:x.I18n.t("Warning"),text:this.state.error,onClose:()=>this.setState({error:""})}):null,this.state.helpText?g.jsx(x.DialogMessage,{title:x.I18n.t("Instructions"),text:this.state.helpText,onClose:()=>this.setState({helpText:""})}):null,this.renderSpecific()]})}}const Jw={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 su extends at{constructor(s){super(s,su.getStaticData())}static compile(s,i){return s.text?`// Sayit ${s.text||""}
|
|
1115
|
+
const subActionVar${s._id} = "${s.language&&s.language!=="_"?`${s.language};`:""}${s.volume?`${s.volume};`:""}${(s.text||"").replace(/"/g,'\\"')}"${at.getReplacesInText(i)};
|
|
1116
|
+
_sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
|
|
1117
|
+
await setStateAsync("${s.instance}.tts.text", subActionVar${s._id});`:`// no text defined
|
|
1118
|
+
_sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`${x.I18n.t("Say:")} ${s.data.text}`}onTagChange(){const s=x.I18n.getLanguage(),a=Object.keys(Jw).filter(l=>l.startsWith(s)).map(l=>({title:Jw[l].name,value:l}));a.unshift({title:"Default",value:"_"}),this.setState({inputs:[{attr:"instance",nameRender:"renderInstance",adapter:"sayit",defaultValue:"sayit.0",frontText:"Instance:"},{nameRender:"renderSelect",frontText:"Language:",options:a,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 su.getStaticData()}}class ou extends at{constructor(s){super(s,ou.getStaticData())}static compile(s,i){const a=(s.text||"").replace(/"/g,'\\"');return a?`// Pushover ${s.text||""}
|
|
1119
|
+
const subActionVar${s._id} = "${a}"${at.getReplacesInText(i)};
|
|
1120
|
+
_sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
|
|
1121
|
+
sendTo("${s.instance}", "send", {
|
|
1122
|
+
message: subActionVar${s._id},
|
|
1123
|
+
title: "${(s.title||"").replace(/"/g,'\\"')}"${at.getReplacesInText(i)},
|
|
1124
|
+
sound: "${s.sound}",
|
|
1125
|
+
priority: ${s.priority}
|
|
1126
|
+
});`:`// no text defined
|
|
1127
|
+
_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 ou.getStaticData()}}class iu extends at{constructor(s){super(s,iu.getStaticData())}static compile(s,i){const a=(s.text||"").replace(/"/g,'\\"');return a?`// whatsapp ${a||""}
|
|
1128
|
+
const subActionVar${s._id} = "${(a||"").replace(/"/g,'\\"')}"${at.getReplacesInText(i)};
|
|
1129
|
+
_sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
|
|
1130
|
+
sendTo("${s.instance}", "send", {text: subActionVar${s._id}${s.phone?`, phone: "${s.phone.replace(/"/g,'\\"')}"`:""}});`:`// no text defined
|
|
1131
|
+
_sendToFrontEnd(${s._id}, {text: 'No text defined'});`}renderDebug(s){return`${x.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 iu.getStaticData()}}class nu extends at{constructor(s){super(s,nu.getStaticData())}static compile(s,i){const a=(s.text||"").replace(/"/g,'\\"');return a?`// Pushsafer ${s.text||""}
|
|
1132
|
+
const subActionVar${s._id} = "${a}"${at.getReplacesInText(i)};
|
|
1133
|
+
_sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
|
|
1134
|
+
sendTo("${s.instance}", "send", {
|
|
1135
|
+
message: subActionVar${s._id},
|
|
1136
|
+
title: "${(s.title||"").replace(/"/g,'\\"')}"${at.getReplacesInText(i)},
|
|
1137
|
+
${s.sound&&s.sound!=="_"?`sound: "${s.sound}",`:""}
|
|
1138
|
+
priority: ${s.priority},
|
|
1139
|
+
${s.vibration&&s.vibration!=="_"?`vibration: ${s.vibration},`:""}
|
|
1140
|
+
});`:`// no text defined
|
|
1141
|
+
_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 nu.getStaticData()}}const vS=`async function (obj) {
|
|
1142
|
+
"__%%DEBUG_TRIGGER%%__";
|
|
1143
|
+
__%%CONDITIONS_VARS%%__
|
|
1144
|
+
const _cond = __%%CONDITION%%__;
|
|
1145
|
+
|
|
1146
|
+
"__%%DEBUG_CONDITIONS%%__";
|
|
1147
|
+
|
|
1148
|
+
if (_cond) {
|
|
1149
|
+
__%%THEN%%__
|
|
1150
|
+
} else {
|
|
1151
|
+
__%%ELSE%%__
|
|
1152
|
+
}
|
|
1153
|
+
}`,_S=`async function (obj) {
|
|
1154
|
+
"__%%DEBUG_TRIGGER%%__";
|
|
1155
|
+
__%%CONDITIONS_VARS%%__
|
|
1156
|
+
const _cond = __%%CONDITION%%__;
|
|
1157
|
+
|
|
1158
|
+
"__%%DEBUG_CONDITIONS%%__";
|
|
1159
|
+
|
|
1160
|
+
if (__%%STATE%%__ === false && _cond) {
|
|
1161
|
+
__%%STATE%%__ = true;
|
|
1162
|
+
__%%THEN%%__
|
|
1163
|
+
} else if (__%%STATE%%__ === true && !_cond) {
|
|
1164
|
+
__%%STATE%%__ = false;
|
|
1165
|
+
__%%ELSE%%__
|
|
1166
|
+
}
|
|
1167
|
+
}`,U1=`"__%%DEBUG_TRIGGER%%__";
|
|
1168
|
+
__%%CONDITIONS_VARS%%__
|
|
1169
|
+
const _cond = __%%CONDITION%%__;
|
|
1170
|
+
|
|
1171
|
+
"__%%DEBUG_CONDITIONS%%__";
|
|
1172
|
+
|
|
1173
|
+
if (_cond) {
|
|
1174
|
+
__%%THEN%%__
|
|
1175
|
+
} else {
|
|
1176
|
+
__%%ELSE%%__
|
|
1177
|
+
}`,qg={triggers:[],conditions:[[]],justCheck:!1,actions:{then:[],else:[]}};function H1(r,s,i){const a=[];let l=r.triggers;l.length||(l=[{id:"TriggerScriptSave"}]);const c=[],h=[],d=r.conditions.find(f=>f.find(b=>b.tagCard==="()"));l.forEach((f,b)=>{var _;const v=_f(f.id,i);if(v){const y={trigger:f,condition:{index:0},justCheck:d?!1:r.justCheck||!r.conditions.length||!r.conditions[0].length,conditionsDebug:[],conditionsVars:[],conditionsStates:[]},w=v.compile(f,y),$=W1(r.conditions,y,i),I=qw(r.actions.then,y,i),T=qw(r.actions.else,y,i);c.push(`cond${b}`),(_=y.prelines)!=null&&_.length&&y.prelines.forEach(C=>h.push(C)),w.includes(" __%%CONDITIONS_VARS%%__")&&(y.conditionsVars=y.conditionsVars.map((C,D)=>D?` ${C}`:C),y.conditionsDebug=y.conditionsDebug.map((C,D)=>D?` ${C}`:C)),a.push(w.replace("__%%CONDITIONS_VARS%%__",y.conditionsVars.join(`
|
|
1178
|
+
`)).replace('"__%%DEBUG_CONDITIONS%%__";',y.conditionsDebug.join(`
|
|
1179
|
+
`)).replace("__%%CONDITION%%__",$).replace("__%%THEN%%__",I||"// ignore").replace("__%%ELSE%%__",T||"// ignore").replace(/__%%STATE%%__/g,`cond${b}`))}});let p=a.join(`
|
|
1180
|
+
|
|
1181
|
+
`);return(!r.justCheck||d)&&(p=`${c.map(f=>`let ${f} = false;`).join(`
|
|
1182
|
+
`)}
|
|
1183
|
+
|
|
1184
|
+
${p}`),h&&(p=`${h.join(`
|
|
1185
|
+
`)}
|
|
1186
|
+
|
|
1187
|
+
${p}`),p}function _f(r,s){return s.find(i=>i.getStaticData&&i.getStaticData().id===r)}function qw(r,s,i){const a=[];return r==null||r.forEach(l=>{const c=_f(l.id,i);c&&a.push(c.compile(l,s))}),` ${a.join(`
|
|
1188
|
+
|
|
1189
|
+
`)}`}function W1(r,s,i){const a=[];let l=0;return r==null||r.forEach(c=>{const h=[];c!=null&&c.length&&(c.forEach(d=>{const p=_f(d.id,i);p&&(s.condition.index=l++,h.push(p.compile(d,s)))}),a.push(`(${h.join(`) &&
|
|
1190
|
+
(`)})`))}),a.length?a.length===1?a[0]||"true":`(${a.join(") || (")})`:"true"}function G1(r,s){return H1(r,null,s)}function qle(r){if(!r)return qg;const s=r.split(`
|
|
1191
|
+
`);try{const i=(s.pop()||"").replace(/^\/\//,"");let a=JSON.parse(i);return a.triggers||(a=qg),a}catch{return qg}}function Xle(r,s){let i="";const a=G1(r,s);return i+=a,i+=`
|
|
1192
|
+
/*
|
|
1193
|
+
const demo = ${JSON.stringify(r,null,2).replace(/\*\//g,"* /")};
|
|
1194
|
+
*/
|
|
1195
|
+
`,`${i}
|
|
1196
|
+
//${JSON.stringify(r)}`}class ru extends at{constructor(s){super(s,ru.getStaticData())}static compile(s,i){return U1.replace('"__%%DEBUG_TRIGGER%%__"',`_sendToFrontEnd(${s._id}, {trigger: true})`)}renderDebug(){return x.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 ru.getStaticData()}}var wS={exports:{}};(function(r,s){(function(){var i=Math.PI,a=Math.sin,l=Math.cos,c=Math.tan,h=Math.asin,d=Math.atan2,p=Math.acos,f=i/180,b=1e3*60*60*24,v=2440588,_=2451545;function y(Q){return Q.valueOf()/b-.5+v}function w(Q){return new Date((Q+.5-v)*b)}function $(Q){return y(Q)-_}var I=f*23.4397;function T(Q,F){return d(a(Q)*l(I)-c(F)*a(I),l(Q))}function C(Q,F){return h(a(F)*l(I)+l(F)*a(I)*a(Q))}function D(Q,F,P){return d(a(Q),l(Q)*a(F)-c(P)*l(F))}function R(Q,F,P){return h(a(F)*a(P)+l(F)*l(P)*l(Q))}function N(Q,F){return f*(280.16+360.9856235*Q)-F}function U(Q){return Q<0&&(Q=0),2967e-7/Math.tan(Q+.00312536/(Q+.08901179))}function j(Q){return f*(357.5291+.98560028*Q)}function B(Q){var F=f*(1.9148*a(Q)+.02*a(2*Q)+3e-4*a(3*Q)),P=f*102.9372;return Q+F+P+i}function J(Q){var F=j(Q),P=B(F);return{dec:C(P,0),ra:T(P,0)}}var ae={};ae.getPosition=function(Q,F,P){var me=f*-P,ne=f*F,ie=$(Q),ke=J(ie),Ne=N(ie,me)-ke.ra;return{azimuth:D(Ne,ne,ke.dec),altitude:R(Ne,ne,ke.dec)}};var ye=ae.times=[[-.833,"sunrise","sunset"],[-.3,"sunriseEnd","sunsetStart"],[-6,"dawn","dusk"],[-12,"nauticalDawn","nauticalDusk"],[-18,"nightEnd","night"],[6,"goldenHourEnd","goldenHour"]];ae.addTime=function(Q,F,P){ye.push([Q,F,P])};var M=9e-4;function W(Q,F){return Math.round(Q-M-F/(2*i))}function k(Q,F,P){return M+(Q+F)/(2*i)+P}function X(Q,F,P){return _+Q+.0053*a(F)-.0069*a(2*P)}function ge(Q,F,P){return p((a(Q)-a(F)*a(P))/(l(F)*l(P)))}function ce(Q,F,P,me,ne,ie,ke){var Ne=ge(Q,P,me),Ae=k(Ne,F,ne);return X(Ae,ie,ke)}ae.getTimes=function(Q,F,P){var me=f*-P,ne=f*F,ie=$(Q),ke=W(ie,me),Ne=k(0,me,ke),Ae=j(Ne),xe=B(Ae),Pe=C(xe,0),qe=X(Ne,Ae,xe),ct,ft,S,te,Y,O={solarNoon:w(qe),nadir:w(qe+.5)};for(ct=0,ft=ye.length;ct<ft;ct+=1)S=ye[ct],te=ce(S[0]*f,me,ne,Pe,ke,Ae,xe),Y=qe-(te-qe),O[S[1]]=w(Y),O[S[2]]=w(te);return O};function oe(Q){var F=f*(218.316+13.176396*Q),P=f*(134.963+13.064993*Q),me=f*(93.272+13.22935*Q),ne=F+f*6.289*a(P),ie=f*5.128*a(me),ke=385001-20905*l(P);return{ra:T(ne,ie),dec:C(ne,ie),dist:ke}}ae.getMoonPosition=function(Q,F,P){var me=f*-P,ne=f*F,ie=$(Q),ke=oe(ie),Ne=N(ie,me)-ke.ra,Ae=R(Ne,ne,ke.dec),xe=d(a(Ne),c(ne)*l(ke.dec)-a(ke.dec)*l(Ne));return Ae=Ae+U(Ae),{azimuth:D(Ne,ne,ke.dec),altitude:Ae,distance:ke.dist,parallacticAngle:xe}},ae.getMoonIllumination=function(Q){var F=$(Q||new Date),P=J(F),me=oe(F),ne=149598e3,ie=p(a(P.dec)*a(me.dec)+l(P.dec)*l(me.dec)*l(P.ra-me.ra)),ke=d(ne*a(ie),me.dist-ne*l(ie)),Ne=d(l(P.dec)*a(P.ra-me.ra),a(P.dec)*l(me.dec)-l(P.dec)*a(me.dec)*l(P.ra-me.ra));return{fraction:(1+l(ke))/2,phase:.5+.5*ke*(Ne<0?-1:1)/Math.PI,angle:Ne}};function le(Q,F){return new Date(Q.valueOf()+F*b/24)}ae.getMoonTimes=function(Q,F,P,me){var ne=new Date(Q);me?ne.setUTCHours(0,0,0,0):ne.setHours(0,0,0,0);for(var ie=.133*f,ke=ae.getMoonPosition(ne,F,P).altitude-ie,Ne,Ae,xe,Pe,qe,ct,ft,S,te,Y,O,A,H,K=1;K<=24&&(Ne=ae.getMoonPosition(le(ne,K),F,P).altitude-ie,Ae=ae.getMoonPosition(le(ne,K+1),F,P).altitude-ie,qe=(ke+Ae)/2-Ne,ct=(Ae-ke)/2,ft=-ct/(2*qe),S=(qe*ft+ct)*ft+Ne,te=ct*ct-4*qe*Ne,Y=0,te>=0&&(H=Math.sqrt(te)/(Math.abs(qe)*2),O=ft-H,A=ft+H,Math.abs(O)<=1&&Y++,Math.abs(A)<=1&&Y++,O<-1&&(O=A)),Y===1?ke<0?xe=K+O:Pe=K+O:Y===2&&(xe=K+(S<0?A:O),Pe=K+(S<0?O:A)),!(xe&&Pe));K+=2)ke=Ae;var ue={};return xe&&(ue.rise=le(ne,xe)),Pe&&(ue.set=le(ne,Pe)),!xe&&!Pe&&(ue[S>0?"alwaysUp":"alwaysDown"]=!0),ue},r.exports=ae})()})(wS);var V1=wS.exports;const kS=ri(V1),K1='{"time":{"start":"00:00","end":"24:00","mode":"hours","interval":1},"period":{"days":1}}';class Bi extends at{coordinates=null;constructor(s){super(s,Bi.getStaticData())}static compile(s,i){var c;let a="",l=i.justCheck?vS:_S;if(l=l.replace('"__%%DEBUG_TRIGGER%%__"',`_sendToFrontEnd(${s._id}, {trigger: true})`),s.tagCard==="interval")a=`setInterval(${l}, ${s.interval||1} * ${s.unit==="s"?1e3:s.unit==="m"?6e4:36e5});`;else if(s.tagCard==="cron")a=`schedule("${s.cron}", ${l});`;else if(s.tagCard==="at"){const[h,d]=(s.at||"").split(":");let p="*";if((c=s==null?void 0:s.dow)!=null&&c.length&&!s.dow.includes("_")){const f=[...s.dow].map(y=>parseInt(y,10));f.sort();const b=[];let v=f[0],_=1;for(;_<f.length;_++)f[_]-f[_-1]>1?(v===f[_-1]?b.push(v.toString()):f[_-1]-v===1?b.push(`${v},${f[_-1]}`):b.push(`${v}-${f[_-1]}`),v=f[_]):_===f.length-1&&(v===f[_-1]||f[_]-v===1?b.push(`${v},${f[_]}`):b.push(`${v}-${f[_]}`));p=b.join(",")}a=`schedule("${d||"0"} ${h||"0"} * * ${p}", ${l});`}else s.tagCard==="astro"?a=`schedule({astro: "${s.astro}", shift: ${s.offset?s.offsetValue:0}}, ${l});`:s.tagCard==="wizard"&&(a=`schedule('${s.wizard}', ${l});`);return a}static _time2String(s){return s?`${s.getHours().toString().padStart(2,"0")}:${s.getMinutes().toString().padStart(2,"0")}`:"--:--"}async _setAstro(s,i,a){var p,f;if(s||=this.state.settings.astro||"solarNoon",i??=this.state.settings.offset,a??=this.state.settings.offsetValue,a=parseInt(a,10)||0,!this.coordinates){const b=await this.props.socket.getObject("system.adapter.javascript.0"),v=(p=b==null?void 0:b.native)==null?void 0:p.latitude,_=(f=b==null?void 0:b.native)==null?void 0:f.longitude;if(!v&&!_){const y=await this.props.socket.getObject("system.config");y!=null&&y.common&&(y.common.latitude||y.common.longitude)?this.coordinates={latitude:parseFloat(y.common.latitude),longitude:parseFloat(y.common.longitude)}:this.coordinates=null}else this.coordinates={latitude:parseFloat(v),longitude:parseFloat(_)}}const l=this.coordinates&&kS.getTimes(new Date,this.coordinates.latitude,this.coordinates.longitude),c=l?Object.keys(l).map(b=>({value:b,title:b,title2:`[${Bi._time2String(l[b])}]`,order:l?Bi._time2String(l[b]):"??:??"})):[];c.sort((b,v)=>b.order>v.order?1:b.order<v.order?-1:0);let h="--:--";if(s&&l&&l[s]){const b=new Date(l[s]);i&&b.setMinutes(b.getMinutes()+parseInt(a,10)),h=x.I18n.t("(at %s)",Bi._time2String(b))}let d;i?d=[{frontText:"at",attr:"astro",nameRender:"renderSelect",options:c,defaultValue:"solarNoon",doNotTranslate2:!0},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{backText:a===1?"minute":"minutes",frontText:"offset",nameRender:"renderNumber",defaultValue:0,attr:"offsetValue",noHelperText:!0},{nameRender:"renderNameText",attr:"textTime",defaultValue:h,doNotTranslate:!0}]:d=[{frontText:"at",attr:"astro",nameRender:"renderSelect",options:c,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{nameRender:"renderNameText",attr:"textTime1",defaultValue:h,doNotTranslate:!0}],this.setState({inputs:d},()=>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 x.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,a){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,a)}),g.jsx(ga,{square:!0,style:{marginLeft:7},value:"...",className:l,onClick:()=>this.setState({openDialog:!0,textCron:this.state.settings.cron})})]}),this.state.openDialog?g.jsx(Bm,{disabled:this.state.settings.cron===this.state.textCron,onApply:()=>{const c=this.state.textCron;a(c,"cron",()=>{a(x.convertCronToText(c,x.I18n.getLanguage()),"addText"),this.setState({openDialog:!1})})},onClose:()=>this.setState({openDialog:!1,textCron:""}),children:g.jsx(x.ComplexCron,{cronExpression:this.state.settings.cron,onChange:c=>this.setState({textCron:c}),language:x.I18n.getLanguage()})}):null,this.renderNameText({nameRender:"renderNameText",defaultValue:x.I18n.t("every hour at 0 minutes"),attr:"addText",signature:!0,doNotTranslate:!0},this.state.settings.addText||x.I18n.t("every hour at 0 minutes"))]},"cron")}renderWizard(s,i,a){const{className:l}=this.props;return g.jsxs("div",{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",marginTop:7},children:[g.jsx(Pi,{className:l,autoComplete:"off",fullWidth:!0,variant:"outlined",size:"small",multiline:!0,rows:2,value:this.state.settings.wizardText,onChange:c=>a(c),customValue:!0}),g.jsx(ga,{square:!0,style:{marginLeft:7},value:"...",className:l,onClick:()=>this.setState({openDialog:!0,wizard:this.state.settings.wizard,wizardText:x.Schedule.state2text(this.state.settings.wizard)})})]}),this.state.openDialog?g.jsx(Bm,{disabled:this.state.settings.wizard===this.state.wizard,onApply:()=>this.setState({openDialog:!1},()=>{const c=JSON.parse(this.state.wizard);c.valid||={from:x.Schedule.now2string()},c.valid.from||=x.Schedule.now2string(),a({wizardText:this.state.wizardText,wizard:JSON.stringify(c)})}),onClose:()=>this.setState({openDialog:!1}),children:g.jsx(x.Schedule,{theme:this.props.theme,schedule:i,onChange:(c,h)=>this.setState({wizardText:h||"",wizard:c})})}):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(K1);i.valid||={from:x.Schedule.now2string()},i.valid.from||=x.Schedule.now2string(),this.setState({inputs:[{nameRender:"renderWizard",attr:"wizard",defaultValue:JSON.stringify(i)}]},()=>super.onTagChange(null,()=>{const a=x.Schedule.state2text(this.state.settings.wizard||i);if(this.state.settings.wizard!==a){const l=JSON.parse(JSON.stringify(this.state.settings));l.wizardText=a,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 Bi.getStaticData()}}const Fn={valueAck:{color:"#b02323"},valueNotAck:{color:"#12ac15"}},CS=pe.forwardRef((r,s)=>g.jsx(GT,{direction:"up",ref:s,...r}));CS.displayName="Transition";class au extends at{inputRef;constructor(s){super(s,au.getStaticData()),this.inputRef=pe.createRef()}static compile(s,i){let a=i.justCheck?vS:_S;return a=a.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"}"}, ${a});`}renderDebug(s){return s.data.valOld!==void 0?g.jsxs("span",{children:[x.I18n.t("Triggered")," ",g.jsx("span",{style:s.data.ackOld?Fn.valueAck:Fn.valueNotAck,children:Yn(s.data.valOld)})," ","→"," ",g.jsx("span",{style:s.data.ack?Fn.valueAck:Fn.valueNotAck,children:Yn(s.data.val)})]}):g.jsxs("span",{children:[x.I18n.t("Triggered")," ",g.jsx("span",{style:s.data.ack?Fn.valueAck:Fn.valueNotAck,children:Yn(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(je,{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:x.I18n.t("Simulate")},"buttonWrite"),g.jsxs(zt,{open:!!this.state.openSimulate,TransitionComponent:CS,keepMounted:!0,onClose:()=>this.setState({openSimulate:!1}),"aria-labelledby":"simulate-dialog-slide-title","aria-describedby":"simulate-dialog-slide-description",children:[g.jsx(ts,{id:"simulate-dialog-slide-title",children:x.I18n.t("Trigger with value")}),g.jsxs(Yt,{children:[this.state.settings.oidType==="boolean"?g.jsx(rm,{control:g.jsx(pk,{inputRef:this.inputRef,onKeyUp:s=>s.key==="Enter"&&this.onWriteValue(),value:!!this.state.simulateValue,onChange:s=>this.setState({simulateValue:s.target.checked})}),label:x.I18n.t("Value")}):g.jsx(Oo,{variant:"standard",inputRef:this.inputRef,label:x.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(rm,{control:g.jsx(ua,{checked:!!this.state.simulateAck,onChange:s=>this.setState({simulateAck:s.target.checked}),color:"primary"}),label:x.I18n.t("Ack")})]}),g.jsxs(Ut,{children:[g.jsxs(je,{variant:"contained",onClick:()=>this.onWriteValue(),color:"primary",children:[g.jsx(_I,{}),x.I18n.t("Write")]}),g.jsxs(je,{color:"grey",variant:"contained",onClick:()=>this.setState({openSimulate:!1}),children:[g.jsx($u,{}),x.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 au.getStaticData()}}const Y1=""+new URL("hysteresis-CLhhemcG.png",import.meta.url).href,Xw=`function __hysteresis(val, limit, state, hist, comp) {
|
|
1197
|
+
let cond1, cond2;
|
|
1198
|
+
if (comp === '>') {
|
|
1199
|
+
cond1 = val > limit + hist;
|
|
1200
|
+
cond2 = val <= limit - hist;
|
|
1201
|
+
} else if (comp === '<') {
|
|
1202
|
+
cond1 = val < limit - hist;
|
|
1203
|
+
cond2 = val >= limit + hist;
|
|
1204
|
+
} else if (comp === '>=') {
|
|
1205
|
+
cond1 = val >= limit + hist;
|
|
1206
|
+
cond2 = val < limit - hist;
|
|
1207
|
+
} else if (comp === '<=') {
|
|
1208
|
+
cond1 = val <= limit - hist;
|
|
1209
|
+
cond2 = val > limit + hist;
|
|
1210
|
+
} else if (comp === '=') {
|
|
1211
|
+
cond1 = val <= limit + hist && val > limit - hist;
|
|
1212
|
+
cond2 = val > limit + hist || val <= limit - hist;
|
|
1213
|
+
} else if (comp === '<>') {
|
|
1214
|
+
cond1 = val > limit + hist || val <= limit - hist;
|
|
1215
|
+
cond2 = val <= limit + hist && val > limit - hist;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
if (!state && cond1) {
|
|
1219
|
+
return true;
|
|
1220
|
+
} else if (state && cond2) {
|
|
1221
|
+
return false;
|
|
1222
|
+
} else {
|
|
1223
|
+
return state;
|
|
1224
|
+
}
|
|
1225
|
+
}`;class ma extends at{constructor(s){super(s,ma.getStaticData())}isAllTriggersOnState(){var s,i,a,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(c=>c.id==="TriggerState"))&&!((l=(a=this.props.userRules)==null?void 0:a.triggers)!=null&&l.find(c=>c.id!=="TriggerState"))}static compile(s,i){var h,d;let a=s.value;a==null&&(a=!1);let l,c;if(s.tagCard==="()")i.prelines||=[],i.prelines.find(p=>p!==Xw)||i.prelines.push(Xw),s.useTrigger?(l="obj.state.val",a===""&&(a=0),c=`__hysteresis(subCondVar${s._id}, ${a}, __%%STATE%%__, ${s.hist}, "${s.histComp}")`):(l=`(await getStateAsync("${s.oid}")).val`,a===""&&(a=0),typeof a=="string"&&parseFloat(a.trim()).toString()!==a.trim()&&(a=`"${a}"`),c=`__hysteresis(subCondVar${s._id}, ${a}, __%%STATE%%__, ${s.hist}, "${s.histComp}")`);else if(s.tagCard!=="includes"){const p=s.tagCard==="="?"==":s.tagCard==="<>"?"!=":s.tagCard;s.useTrigger?(l="obj.state.val",((h=i==null?void 0:i.trigger)==null?void 0:h.oidType)==="string"?(a=a.replace(/"/g,'\\"'),c=`subCondVar${s._id} ${p} "${a}"`):(a===""&&(a=0),typeof a=="string"&&parseFloat(a.trim()).toString()!==a.trim()&&(a=`"${a}"`),c=`subCondVar${s._id} ${p} ${a}`)):(l=`(await getStateAsync("${s.oid}")).val`,s.oidType==="string"?(a=a.replace(/"/g,'\\"'),c=`subCondVar${s._id} ${p} "${a}"`):(a===""&&(a=0),typeof a=="string"&&parseFloat(a.trim()).toString()!==a.trim()&&(a=`"${a}"`),c=`subCondVar${s._id} ${p} ${a}`))}else s.useTrigger?(l="obj.state.val",((d=i==null?void 0:i.trigger)==null?void 0:d.oidType)==="string"?(a=a.replace(/"/g,'\\"'),c=`obj.state.val.includes("${a}")`):c="false"):(l=`(await getStateAsync("${s.oid}")).val`,s.oidType==="string"?(a=a.replace(/"/g,'\\"'),c=`subCondVar${s._id}.includes("${a}")`):c="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} = ${c};`),i.conditionsDebug.push(`_sendToFrontEnd(${s._id}, {result: subCond${s._id}, value: subCondVar${s._id}, compareWith: "${a}"});`),`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}]`:x.I18n.t("Triggered")}onShowHelp=()=>this.setState({showHysteresisHelp:!0});_setInputs(s,i,a,l,c){var $,I;const h=this.isAllTriggersOnState();i=i||this.state.settings.tagCard,a=a||this.state.settings.oidType,l=l||this.state.settings.oidUnit,c=c||this.state.settings.oidStates,s===void 0&&(s=this.state.settings.useTrigger),h&&s&&((I=($=this.props.userRules)==null?void 0:$.triggers)==null?void 0:I.length)===1&&(a=this.props.userRules.triggers[0].oidType,l=this.props.userRules.triggers[0].oidUnit,c=this.props.userRules.triggers[0].oidStates);const d=ma.getStaticData().tagCardArray,p=d.find(T=>T.title===i)||d[0];let f,b=null;a==="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"}],c&&(b=Object.keys(c).map(T=>c?{value:T,title:c[T]}:null).filter(T=>T))):a==="boolean"?(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:"<>",title2:"[not equal]",text:"not equal to"}],b=[{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"}],c&&(b=Object.keys(c).map(T=>({value:T,title:c?c[T]:T.toString()}))));let v=null;f.find(T=>T.title===i)||(i=f[0].title,v=v||{...this.state.settings},v.tagCard=i);let _,y={nameRender:"renderText",defaultValue:"",attr:"value",frontText:i==="()"?"Limit":(p==null?void 0:p.text)||"compare with",doNotTranslateBack:!0,backText:l};b&&(y={nameRender:"renderSelect",defaultValue:b[0].value,options:b,attr:"value",frontText:(p==null?void 0:p.text)||"compare with",doNotTranslateBack:!0,backText:l},b.find(T=>T.value===this.state.settings.value)||(v=v||{...this.state.settings},v.value=b[0].value),b.length<=2&&(f=[{title:"=",title2:"[equal]",text:"equal to"},{title:"<>",title2:"[not equal]",text:"not equal to"}])),h&&s?_=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1},y]:h?_=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"},{nameRender:"renderObjectID",attr:"oid",defaultValue:""},y]:_=[{nameRender:"renderObjectID",attr:"oid",defaultValue:""},y],i==="()"&&(_.splice(1,0,{nameRender:"renderDialog",icon:"HelpOutline",frontText:"Explanation",onShowDialog:this.onShowHelp}),_.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:"<>"}]}),_.push({frontText:"Δ",doNotTranslate:!0,nameRender:"renderNumber",noHelperText:!0,attr:"hist",defaultValue:1,doNotTranslateBack:!0,backText:l}));const w={iconTag:!0,tagCardArray:f,inputs:_};this.setState(w,()=>super.onTagChange(null,()=>{v&&(this.setState({settings:v}),this.props.onChange(v))}))}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 ma.getStaticData()}renderSpecific(){return this.state.showHysteresisHelp?g.jsxs(zt,{open:!0,maxWidth:"md",onClose:()=>this.setState({showHysteresisHelp:!1}),"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[g.jsx(Yt,{children:g.jsx(ck,{id:"alert-dialog-description",children:g.jsx("img",{src:Y1,alt:"Hysteresis"})})}),g.jsx(Ut,{children:g.jsx(je,{onClick:()=>this.setState({showHysteresisHelp:!1}),color:"primary",autoFocus:!0,children:x.I18n.t("OK")})})]}):null}}const Zw=[31,29,31,30,31,30,31,31,30,31,30,31];class fa extends at{constructor(s){super(s,fa.getStaticData())}static compile(s,i){const a=s.tagCard==="="?"===":s.tagCard==="<>"?"!==":s.tagCard;let l;if(s.withDate){const[c,h]=(s.date||"01.01").toString().split(".");let d=parseInt(h,10)||0,p=parseInt(c,10)||0;p>12?p=12:p<0&&(p=0),d>Zw[p]?d=Zw[p]:d<0&&(d=0),d&&p?l=`formatDate(Date.now(), 'MM.DD-hh:mm') ${a} "${s.date}-${s.time}"`:d===0&&p?l=`formatDate(Date.now(), 'MM-hh:mm') ${a} "${p.toString().padStart(2,"0")}-${s.time}"`:p===0&&d?l=`formatDate(Date.now(), 'DD-hh:mm') ${a} "${d.toString().padStart(2,"0")}-${s.time}"`:l=`formatDate(Date.now(), 'hh:mm') ${a} "${s.time}"`}else l=`formatDate(Date.now(), 'hh:mm') ${a} "${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 a=fa.getStaticData().tagCardArray,l=a==null?void 0:a.find(h=>h.title===s),c=[{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&&c.push({nameRender:"renderDate",attr:"date",defaultValue:"01.01"}),this.setState({inputs:c,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 fa.getStaticData()}}class ti extends at{coordinates=null;constructor(s){super(s,ti.getStaticData())}static compile(s,i){const a=s.tagCard==="="?"===":s.tagCard==="<>"?"!==":s.tagCard;let l;s.offset&&(l=parseInt(s.offsetValue,10)||0);const c=`formatDate(Date.now(), 'hh:mm') ${a} formatDate(getAstroDate("${s.astro}"${l?`, undefined, ${l}`:""}), 'hh:mm')`;return i.conditionsVars.push(`const subCond${s._id} = ${c};`),i.conditionsDebug.push(`_sendToFrontEnd(${s._id}, {result: ${c}});`),c}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,a){if(s=s||this.state.settings.astro||"solarNoon",i=i===void 0?this.state.settings.offset:i,a=a===void 0?this.state.settings.offsetValue:a,a=parseInt(a,10)||0,!this.coordinates){const b=await this.props.socket.getObject("system.adapter.javascript.0");if(!(b!=null&&b.native.latitude)&&!(b!=null&&b.native.longitude)){const v=await this.props.socket.getObject("system.config");v&&(v.common.latitude||v.common.longitude)?this.coordinates={latitude:v.common.latitude,longitude:v.common.longitude}:this.coordinates=null}else this.coordinates={latitude:b==null?void 0:b.native.latitude,longitude:b==null?void 0:b.native.longitude}}const l=this.coordinates?kS.getTimes(new Date,this.coordinates.latitude,this.coordinates.longitude):null,c=l?Object.keys(l).map(b=>({value:b,title:b,title2:`[${ti._time2String(l[b])}]`,order:ti._time2String(l[b])})):[];c.sort((b,v)=>b.order>v.order?1:b.order<v.order?-1:0);const h=ti.getStaticData().tagCardArray,d=h.find(b=>b.title===this.state.settings.tagCard)||h[0];let p="--:--";if(s&&l&&l[s]){const b=new Date(l[s]);i&&b.setMinutes(b.getMinutes()+parseInt(a,10)),p=`(${x.I18n.t(d.text)} ${ti._time2String(b)})`}let f;i?f=[{nameRender:"renderNameText",defaultValue:"Actual time of day",attr:"text"},{frontText:d.text,attr:"astro",nameRender:"renderSelect",options:c,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{backText:a===1?"minute":"minutes",frontText:"offset",nameRender:"renderNumber",defaultValue:0,attr:"offsetValue",noHelperText:!0},{nameRender:"renderNameText",attr:"textTime",doNotTranslate:!0,defaultValue:p}]:f=[{nameRender:"renderNameText",defaultValue:"Actual time of day",attr:"text"},{frontText:d.text,attr:"astro",nameRender:"renderSelect",options:c,doNotTranslate2:!0,defaultValue:"solarNoon"},{backText:"with offset",nameRender:"renderCheckbox",attr:"offset"},{nameRender:"renderNameText",attr:"textTime",doNotTranslate:!0,defaultValue:p}],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 ti.getStaticData()}}const Qw={valueAck:{color:"#b02323"},valueNotAck:{color:"#12ac15"}};class lu extends at{constructor(s){super(s,lu.getStaticData())}isAllTriggersOnState(){var s,i,a,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(c=>c.id==="TriggerState"))&&!((l=(a=this.props.userRules)==null?void 0:a.triggers)!=null&&l.find(c=>c.id!=="TriggerState"))}static compile(s,i){let a=s.value;s.useTrigger?a=s.toggle?"!obj.state.val":"obj.state.val":(a==null&&(a=""),typeof s.value=="string"&&parseFloat(s.value).toString()!==s.value&&s.value!=="true"&&s.value!=="false"&&(a=`"${a.replace(/"/g,'\\"')}"${at.getReplacesInText(i)}`));let l;return s.toggle&&!s.useTrigger?l=`const subActionVar${s._id} = !(await getStateAsync("${s.oid}")).val`:l=`const subActionVar${s._id} = ${a}`,`// set state ${s.oid} to ${s.toggle&&!s.useTrigger?"toggle":a}
|
|
1226
|
+
${l};
|
|
1227
|
+
_sendToFrontEnd(${s._id}, {val: subActionVar${s._id}, ack: ${s.tagCard==="update"}});
|
|
1228
|
+
await setStateAsync("${s.oid}", subActionVar${s._id}, ${s.tagCard==="update"});`}renderDebug(s){return g.jsxs("span",{children:[x.I18n.t("Set:")," ",g.jsx("span",{style:s.data.ack?Qw.valueAck:Qw.valueNotAck,children:Yn(s.data.val)})]})}_setInputs(s,i){const a=this.isAllTriggersOnState();i=i===void 0?this.state.settings.toggle:i,s=s===void 0?this.state.settings.useTrigger:s;let l="",c;const{oidType:h,oidUnit:d,oidStates:p,oidMax:f,oidMin:b,oidRole:v,oidWrite:_,oidStep:y}=this.state.settings;let w;h&&(h==="number"?(l="number",f!==void 0&&b!==void 0&&(l="slider")):h==="boolean"?(l="boolean",v&&v.includes("button")&&_&&(l="button")):(l="",v&&v.includes("color")&&(l="color")),p&&(c=Object.keys(p).map(I=>({value:I,title:p[I]})),l="select"));let $;if(a&&s)$=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1}],l==="boolean"&&$.push({backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1});else{switch(l){case"number":$=[{backText:d||"",frontText:"with",nameRender:"renderNumber",defaultValue:f===void 0?0:f,attr:"value"}],this.state.settings.value!==void 0&&isNaN(parseFloat(this.state.settings.value))&&(w={value:f===void 0?0:f});break;case"slider":{$=[{nameRender:"renderSlider",defaultValue:f,min:b,max:f,unit:d,step:y,attr:"value"}];const I=parseFloat(this.state.settings.value);this.state.settings.value!==void 0&&(isNaN(I)||I<b||I>f)&&(w={value:f});break}case"select":$=[{nameRender:"renderSelect",frontText:"with",options:c,defaultValue:(c==null?void 0:c[0].value)||"",attr:"value"}],this.state.settings.value!==void 0&&!(c!=null&&c.find(I=>I.value===this.state.settings.value))&&(w={value:(c==null?void 0:c[0].value)||""});break;case"boolean":$=[{backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1}],i||$.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&&(w={value:!1});break;case"button":$=[{nameRender:"renderButton",defaultValue:!0,attr:"value"}],this.state.settings.value!==void 0&&this.state.settings.value!==!0&&(w={value:!0});break;case"color":$=[{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"))&&(w={value:"#FFFFFF"});break;default:$=[{backText:d||"",frontText:"with",nameRender:"renderText",defaultValue:"",attr:"value"}];break}a&&$.unshift({backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"})}return{inputs:$,newSettings:w}}onTagChange(s,i,a,l,c){c=c===void 0?this.state.settings.useTrigger:c;const{inputs:h,newSettings:d}=this._setInputs(c,l);h.unshift({nameRender:"renderObjectID",attr:"oid",defaultValue:"",checkReadOnly:!0}),this.setState({inputs:h},()=>super.onTagChange(null,()=>{if(d){const p=JSON.parse(JSON.stringify(this.state.settings));Object.assign(p,d),this.setState(p),this.props.onChange(p)}}))}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 lu.getStaticData()}}class cu extends at{constructor(s){super(s,cu.getStaticData())}static compile(s,i){return`// exec "${s.exec}"
|
|
1229
|
+
const subActionVar${s._id} = "${(s.exec||"").replace(/"/g,'\\"')}"${at.getReplacesInText(i)};
|
|
1230
|
+
_sendToFrontEnd(${s._id}, {exec: subActionVar${s._id}});
|
|
1231
|
+
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 cu.getStaticData()}}class uu extends at{constructor(s){super(s,uu.getStaticData())}static compile(s,i){return`// HTTP request ${s.url}
|
|
1232
|
+
const subActionVar${s._id} = "${(s.url||"").replace(/"/g,'\\"')}"${at.getReplacesInText(i)};
|
|
1233
|
+
_sendToFrontEnd(${s._id}, {url: subActionVar${s._id}});
|
|
1234
|
+
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 uu.getStaticData()}}class du extends at{constructor(s){super(s,du.getStaticData())}static compile(s,i){return`// Log ${s.text}
|
|
1235
|
+
const subActionVar${s._id} = "${(s.text||"").replace(/"/g,'\\"')}"${at.getReplacesInText(i)};
|
|
1236
|
+
_sendToFrontEnd(${s._id}, {text: subActionVar${s._id}});
|
|
1237
|
+
console.log(subActionVar${s._id});`}renderDebug(s){return x.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 du.getStaticData()}}class hu extends at{constructor(s){super(s,hu.getStaticData())}static compile(s){const i=s.unit==="ms"?1:s.unit==="s"?1e3:s.unit==="m"?6e4:36e5;return`// pause for ${i}ms
|
|
1238
|
+
_sendToFrontEnd(${s._id}, {paused: true});
|
|
1239
|
+
|
|
1240
|
+
await wait(${s.pause} * ${i});
|
|
1241
|
+
|
|
1242
|
+
_sendToFrontEnd(${s._id}, {paused: false});`}renderDebug(s){return x.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 hu.getStaticData()}}class pu extends at{constructor(s){super(s,pu.getStaticData())}static compile(s){const i=(s.func||"").split(`
|
|
1243
|
+
`).map(a=>` ${a}`);return i.unshift(` _sendToFrontEnd(${s._id}, {func: 'executed'});`),i.unshift("// user function"),i.join(`
|
|
1244
|
+
`)}renderDebug(){return x.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 pu.getStaticData()}}class gu extends at{constructor(s){super(s,gu.getStaticData())}isAllTriggersOnState(){var s,i,a,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(c=>c.id==="TriggerState"))&&!((l=(a=this.props.userRules)==null?void 0:a.triggers)!=null&&l.find(c=>c.id!=="TriggerState"))}static compile(s,i){let a=s.value;s.useTrigger?a=s.toggle?"!obj.state.val":"obj.state.val":(a==null&&(a=""),typeof s.value=="string"&&parseFloat(s.value).toString()!==s.value&&s.value!=="true"&&s.value!=="false"&&(a=`"${a.replace(/"/g,'\\"')}"${at.getReplacesInText(i)}`));let l;return s.toggle&&!s.useTrigger?l=`const subActionVar${s._id} = !(await getStateAsync("${s.oid}")).val`:l=`const subActionVar${s._id} = ${a}`,`// set delayed state ${s.oid} to ${s.toggle&&!s.useTrigger?"toggle":a} with delay of ${s.delay}ms
|
|
1245
|
+
${l};
|
|
1246
|
+
_sendToFrontEnd(${s._id}, {val: subActionVar${s._id}, ack: ${s.tagCard==="update"}});
|
|
1247
|
+
setStateDelayed("${s.oid}", subActionVar${s._id}, ${s.tagCard==="update"}, ${parseInt(s.delay,10)}, ${s.clearRunning?"true":"false"});`}renderDebug(s){var i,a;return g.jsxs("span",{children:[x.I18n.t("Set:")," ",g.jsx("span",{className:s.data.ack?(i=this.props.classes)==null?void 0:i.valueAck:(a=this.props.classes)==null?void 0:a.valueNotAck,children:Yn(s.data.val)})]})}_setInputs(s,i){const a=this.isAllTriggersOnState();i=i===void 0?this.state.settings.toggle:i,s=s===void 0?this.state.settings.useTrigger:s;let l="",c;const{oidType:h,oidUnit:d,oidStates:p,oidMax:f,oidMin:b,oidRole:v,oidWrite:_,oidStep:y}=this.state.settings;let w;h&&(h==="number"?(l="number",f!==void 0&&b!==void 0&&(l="slider")):h==="boolean"?(l="boolean",v&&v.includes("button")&&_&&(l="button")):(l="",v&&v.includes("color")&&(l="color")),p&&(c=Object.keys(p).map(I=>({value:I,title:p[I]})),l="select"));let $;if(a&&s)$=[{backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger",defaultValue:!1}],l==="boolean"&&$.push({backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1});else{switch(l){case"number":$=[{backText:d||"",frontText:"with",nameRender:"renderNumber",defaultValue:f===void 0?0:f,attr:"value"}],this.state.settings.value!==void 0&&isNaN(parseFloat(this.state.settings.value))&&(w={value:f===void 0?0:f});break;case"slider":{$=[{nameRender:"renderSlider",defaultValue:f,min:b,max:f,unit:d,step:y,attr:"value"}];const I=parseFloat(this.state.settings.value);this.state.settings.value!==void 0&&(isNaN(I)||I<b||I>f)&&(w={value:f});break}case"select":$=[{nameRender:"renderSelect",frontText:"with",options:c,defaultValue:(c==null?void 0:c[0].value)||"",attr:"value"}],this.state.settings.value!==void 0&&!(c!=null&&c.find(I=>I.value===this.state.settings.value))&&(w={value:(c==null?void 0:c[0].value)||""});break;case"boolean":$=[{backText:"toggle value",attr:"toggle",nameRender:"renderCheckbox",defaultValue:!1}],i||$.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&&(w={value:!1});break;case"button":$=[{nameRender:"renderButton",defaultValue:!0,attr:"value"}],this.state.settings.value!==void 0&&this.state.settings.value!==!0&&(w={value:!0});break;case"color":$=[{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"))&&(w={value:"#FFFFFF"});break;default:$=[{backText:d||"",frontText:"with",nameRender:"renderText",defaultValue:"",attr:"value"}];break}a&&$.unshift({backText:"use trigger value",nameRender:"renderCheckbox",attr:"useTrigger"})}return $.push({backText:"ms",frontText:"Delay",nameRender:"renderNumber",defaultValue:1e3,noHelperText:!0,attr:"delay"}),$.push({backText:"clear running",nameRender:"renderCheckbox",defaultValue:!0,attr:"clearRunning"}),{inputs:$,newSettings:w}}onTagChange(s,i,a,l,c){c=c===void 0?this.state.settings.useTrigger:c;const{inputs:h,newSettings:d}=this._setInputs(c,l);h.unshift({nameRender:"renderObjectID",attr:"oid",defaultValue:"",checkReadOnly:!0}),this.setState({inputs:h},()=>super.onTagChange(null,()=>{if(d){const p=JSON.parse(JSON.stringify(this.state.settings));Object.assign(p,d),this.setState(p),this.props.onChange(p)}}))}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 gu.getStaticData()}}class mu extends at{constructor(s){super(s,mu.getStaticData())}isAllTriggersOnState(){var s,i,a,l;return!!((i=(s=this.props.userRules)==null?void 0:s.triggers)!=null&&i.find(c=>c.id==="TriggerState"))&&!((l=(a=this.props.userRules)==null?void 0:a.triggers)!=null&&l.find(c=>c.id!=="TriggerState"))}static compile(s){const i=`const val2_${s._id} = (await getStateAsync("${s.oid1}")).val;`,a=`const val1_${s._id} = (await getStateAsync("${s.oid2}")).val;`;return`// ${s.oid1} ${s.operation} ${s.oid2} => ${s.oidResult}
|
|
1248
|
+
${i}
|
|
1249
|
+
${a}
|
|
1250
|
+
_sendToFrontEnd(${s._id}, {val: val1_${s._id} ${s.operation} val2_${s._id}, ack: ${s.tagCard==="update"}});
|
|
1251
|
+
await setStateAsync("${s.oidResult}", val1_${s._id} ${s.operation} val2_${s._id}, ${s.tagCard==="update"});`}renderDebug(s){var i,a;return g.jsxs("span",{children:[x.I18n.t("Set:")," ",g.jsx("span",{className:s.data.ack?(i=this.props.classes)==null?void 0:i.valueAck:(a=this.props.classes)==null?void 0:a.valueNotAck,children:Yn(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 mu.getStaticData()}}const J1=[Bi,ru,au,ma,fa,ti,lu,cu,uu,du,hu,pu,gu,mu],Ac={sayit:su,pushover:ou,"whatsapp-cmb":iu,pushsafer:nu},q1=jm({blocks:null,socket:null,onUpdate:!1,setOnUpdate:r=>{},setOnDebugMessage:r=>{},onDebugMessage:[],enableSimulation:!1,setEnableSimulation:r=>{},changedScripts:{},setChangedScripts:r=>{}}),X1=({children:r,socket:s})=>{const[i,a]=St(null),[l,c]=St(!1),[h,d]=St([]),[p,f]=St(!1),[b,v]=St({});return Ft(()=>{l&&c(!1)},[l]),Ft(()=>{(async()=>{const _=await s.getAdapterInstances(),y=Object.keys(Ac).filter(C=>_.find(D=>{var R;return((R=D==null?void 0:D.common)==null?void 0:R.name)===C})),w=[],$=_.filter(C=>C.common.javascriptRules),I=[];for(const C of $){if(I.includes(C.common.name)||!C.common.javascriptRules)continue;let D;if(C.common.javascriptRules.url.startsWith("http:")||C.common.javascriptRules.url.startsWith("https:")?D=C.common.javascriptRules.url:C.common.javascriptRules.url.startsWith("./")?D=`${window.location.protocol}//${window.location.host}${C.common.javascriptRules.url.replace(/^\./,"")}`:D=`${window.location.protocol}//${window.location.host}/adapter/${C.common.name}/${C.common.javascriptRules.url}`,C.common.javascriptRules.i18n===!0){const R=D.lastIndexOf("/");let N;R!==-1?N=D.substring(0,R):N=D;const U=x.I18n.getLanguage(),j=`${N}/i18n/${U}.json`;await fetch(j).then(B=>B.json()).then(B=>x.I18n.extendTranslations(B,U)).catch(B=>{if(U!=="en")return fetch(`${N}/i18n/en.json`).then(J=>J.json()).then(J=>x.I18n.extendTranslations(J,U)).catch(J=>console.error(`Cannot load i18n "${j}": ${J}`));console.log(`Cannot load i18n "${j}": ${B}`)})}else if(C.common.javascriptRules.i18n&&typeof C.common.javascriptRules.i18n=="object")try{x.I18n.extendTranslations(C.common.javascriptRules.i18n)}catch(R){console.error(`Cannot import i18n for "${C.common.javascriptRules.name}": ${R}`)}try{E_.registerRemotes([{name:C.common.javascriptRules.name,entry:D,type:C.common.javascriptRules.type}]);const R=(await E_.loadRemote(`${C.common.javascriptRules.name}/${C.common.javascriptRules.name}`)).default;R&&(w.push(R),I.push(C.common.name),Ac[C.common.name]=null)}catch(R){console.error(`Cannot load component "${C.common.javascriptRules.name}": ${R}`)}}const T=y.filter(C=>Ac[C]).map(C=>Ac[C]);a([...J1,...T,...w])})()},[]),g.jsx(q1.Provider,{value:{blocks:i,socket:s,onUpdate:l,setOnUpdate:c,onDebugMessage:h,setOnDebugMessage:d,enableSimulation:p,setEnableSimulation:f,changedScripts:b,setChangedScripts:v},children:r})},Z1="Acknowledged",Q1="Actions",eM="Add",tM="All",sM="Any",oM="Apply",iM="April",nM="Ask",rM="Astronomical",aM="August",lM="Cancel",cM="Close",uM="Condition",dM="Conditions",hM="Console",pM="Copied",gM="December",mM="Default",fM="Delay",$M="Delete",bM="Description",yM="Done",vM="Exec shell",_M="Explanation",wM="Export",kM="Februar",CM="February",SM="Filter",TM="Folder",IM="Fr",EM="Friday",xM="ID",DM="ID1",AM="ID2",RM="Import",OM="Instance",MM="Instances",NM="Instructions",LM="Januar",PM="January",BM="July",jM="June",FM="Limit",zM="March",UM="May",HM="Menu",WM="Message",GM="Mo",VM="Model",KM="Monday",YM="Month",JM="More",qM="Name",XM="November",ZM="OK",QM="October",eN="Ok",tN="Pause",sN="Pushover",oN="Pushsafer",iN="Reload",nN="Rename",rN="Repeat",aN="Restart",lN="Result",cN="Sa",uN="Saturday",dN="Save",hN="Schedule",pN="Script",gN="September",mN="Simulate",fN="Stack",$N="Start",bN="State",yN="Su",vN="Sunday",_N="Telegram",wN="Th",kN="Thursday",CN="Time",SN="Triggered",TN="Triggers",IN="Tu",EN="Tuesday",xN="URL",DN="Value",AN="Volume",RN="We",ON="Wednesday",MN="Write",NN="Yes",LN="acknowledgment",PN="all",BN="and",jN="Astro",FN="at",zN="control",UN="copy",HN="CRON",WN="Dawn",GN="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.",VN="Debug",KN="Dusk",YN="easy",JN="every",qN="Function",XN="ID",ZN="Name",QN="Role",eL="Room",tL="Golden hour",sL="End of golden hour",oL='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.',iL='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.',nL="hours",rL="includes",aL="interval",lL="magic",cL="milliseconds",uL="minutes",dL="ms",hL="Nadir",pL="Nautical dawn",gL="Nautical dusk",mL="Next Sunrise",fL="Next sunset",$L="Night",bL="Night end",yL="normal",vL="offset",_L="one",wL="or",kL="quiet",CL="search",SL="seconds",TL="Solar noon",IL="sunrise",EL="Sunrise end",xL="Sunset",DL="Sunset start",AL="then",RL="Acknowledge",OL="From",ML="Last changed",NL="Quality",LL="Timestamp",PL="User",BL="Value",jL="two",FL="update",zL="Adds debug output to the log for many system commands",UL="Verbose log outputs",HL="when",WL="Wizard",GL="Retry",VL="Undo",KL="Redo",YL="Accept",JL="Reject",qL="Context",XL="devices",ZL="Plan",QL="Send",eP="Copy",tP={"%s not found":"%s not found","()":"()","(at %s)":"(at %s)","(optional)":"(optional)","-":"-",".":".",Ack:Z1,Actions:Q1,"Actual time of day":"Actual time of day",Add:eM,"Add new script":"Add new script",All:tM,"All files will be accepted":"All files will be accepted",Any:sM,"Any month":"Any month",Apply:oM,April:iM,"Are you sure?":"Are you sure?",Ask:nM,Astronomical:rM,"Astronomical events today":"Astronomical events today",August:aM,"Blockly description":"Creating rules by graphic blocks","Body:":"Body:",Cancel:lM,"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:cM,"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:uM,Conditions:dM,"Configuration not saved.":"Configuration not saved.",Console:hM,"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:pM,"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:gM,Default:mM,"Define cron...":"Define cron...","Define schedule...":"Define schedule...",Delay:fM,Delete:$M,"Delete %s":"Delete %s...","Delete folder":"Delete folder","Delete script":"Delete script",Description:bM,"Deselect all":"Deselect all","Discard changes for %s":"Discard changes for %s",Done:yM,"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",Error:"Error","Error formatting code":"Error formatting code","Error was found":"Error was found","Every day":"Every day",Exec:vM,"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:_M,Export:wM,"Export all scripts":"Export all scripts","Export blocks":"Export blocks","Export selected blocks":"Export selected blocks",Februar:kM,February:CM,Filter:SM,Folder:TM,Fr:IM,Friday:EM,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:xM,ID1:DM,ID2:AM,Import:RM,"Import blocks":"Import blocks","Import error":"Import error","Import scripts":"Import scripts","Insert object ID":"Insert object ID",Instance:OM,"Instance is disabled":"Instance is disabled","Instance:":"Instance:",Instances:MM,Instructions:NM,"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:LM,January:PM,July:BM,June:jM,"Just check":"Just check","Keep my changes":"Keep my changes","Language:":"Language:","Learn More":"Learn More","Light style":"Light style",Limit:FM,"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:zM,"March ":"March ",May:UM,Menu:HM,Message:WM,Mo:GM,Model:VM,Monday:KM,Month:YM,More:JM,Name:qM,"No active host found":"No active host found","Nothing found":"Nothing found",November:XM,OK:ZM,October:QM,Ok:eN,"On condition change":"On condition result change","On script save or adapter start":"On script save or adapter start","On weekdays":"On weekdays","Operate two states":"Operate two states","Operations with two states":"Operations with two states","Paste your blocks here":"Paste your blocks here",Pause:tN,"Pause execution":"Pause execution","Pause script":"Pause script","Phone:":"Phone:","Please select object ID...":"Please select object ID...","Prettify the script":"Prettify the script","Print some text in log":"Print some text in log","Priority:":"Priority:",Pushover:sN,Pushsafer:oN,"Read only ID selected: %s":"Read only ID selected: %s",Reload:iN,Rename:nN,"Reorder scripts in folders":"Reorder scripts in folders",Repeat:rN,Restart:aN,Result:lN,"Resume execution":"Resume execution","Root folder":"Root folder","Rules description":"Create rules with IF, THEN, ELSE blocks","Run script":"Run script",Sa:cN,Saturday:uN,Save:dN,"Save all":"Save all","Say It":"Say It","Say some text via sayit adapter":"Say some text via sayit adapter",Schedule:hN,Script:pN,"Script %s was modified on disk":"Script %s was modified on disk","Script was modified externally":"Script was modified externally","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:gN,"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:mN,"Some files will be rejected":"Some files will be rejected","Sound:":"Sound:",Stack:fN,Start:$N,"Start script":"Start script",State:bN,"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:yN,"Subject:":"Subject:",Sunday:vN,"TS description":"Creating rules by writing Typescript",Telegram:_N,"Text:":"Text:",Th:wN,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?',"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:kN,Time:CN,"Time condition":"Time condition","Title:":"Title:","To:":"To:","Trigger with value":"Trigger with value",Triggered:SN,Triggers:TN,"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:IN,Tuesday:EN,URL:xN,"Unknown error":"Unknown error","Unknown error!":"Unknown error!","User function":"User function","User:":"User:",Value:DN,"Vibration:":"Vibration:",Volume:AN,We:RN,Wednesday:ON,"Whatsapp-cmb":"Whatsapp-cmb",Write:MN,"Write your own code":"Write your own code",Yes:NN,"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","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:LN,all:PN,and:BN,"as JSON":"as JSON","as plain text":"as plain text",astro:jN,at:FN,"clear running":"clear running",control:zN,copy:UN,cron:HN,dawn:WN,debug_help:GN,debug_label:VN,default:"default",dusk:KN,easy:YN,else:"else","equal to":"equal to",every:JN,"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:qN,filter_id:XN,filter_name:ZN,filter_role:QN,filter_room:eL,"for edit or create script":"for edit or create a new script","for professionals":"for professionals","for programmers":"for programmers",goldenHour:tL,goldenHourEnd:sL,"greater or equal":"greater or equal","greater or equal to":"greater or equal to","greater than":"greater than",help_just_check:oL,help_on_change:iL,"high priority":"high priority","high-priority":"high-priority","highest priority":"highest priority",hours:nL,includes:rL,interval:aL,"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:lL,milliseconds:cL,minutes:uL,ms:dL,nadir:hL,nauticalDawn:pL,nauticalDusk:gL,nextSunrise:mL,nextSunset:fL,night:$L,nightEnd:bL,"no blocks found":"No blocks found","no group":"NO GROUP",normal:yL,"normal priority":"normal priority","not running":"not running","not equal to":"not equal to","not properly connected":"This block is not properly connected to other blocks.",offset:vL,"on change":"on change","on condition change":"on condition change","on update":"on update",one:_L,or:wL,quiet:kL,"reset search":"reset search",search:CL,seconds:SL,solarNoon:TL,"store in":"store in",sunrise:IL,sunriseEnd:EL,sunset:xL,sunsetStart:DL,then:AL,"toggle value":"toggle value",tooltip_ack:RL,tooltip_from:OL,tooltip_lc:ML,tooltip_quality:NL,tooltip_ts:LL,tooltip_user:PL,tooltip_value:BL,true:"true",two:jL,undefined:"undefined",update:FL,"use seconds":"use seconds","use trigger value":"use trigger value",verbose_help:zL,verbose_label:UL,when:HL,with:"with","with date":"with date","with offset":"with offset",wizard:WL,"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:GL,"No running javascript instance found":"No running javascript instance found","OID display mode":"OID display mode","AI Chat":"AI Chat","AI inline completions":"AI inline completions","New chat":"New chat","Ask about your script...":"Ask about your script...","Insert blocks":"Insert blocks","Apply blocks":"Apply blocks",Undo:VL,Redo:KL,"Insert into editor":"Insert into editor","Show as diff":"Show as diff","Selected code as context":"Selected code as context","Ask questions about your script, request changes, or generate new code.":"Ask questions about your script, request changes, or generate new code.","to send":"to send","Thinking...":"Thinking...","AI suggested changes":"AI suggested changes",Accept:YL,Reject:JL,"No API keys configured":"No API keys configured","for new line":"for new line","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.",Context:qL,"current script":"current script","all scripts":"all scripts",devices:XL,"Searching datapoints":"Searching datapoints","Reading value":"Reading value","Loading object info":"Loading object info","Searching scripts":"Searching scripts","Reading script":"Reading script","Loading script list":"Loading script list","All scripts":"All scripts","Smart home devices":"Smart home devices","Generating plan...":"Generating plan...","Generating code...":"Generating code...",Plan:ZL,"mention @all":"@all","mention @devices":"@devices",Send:QL,Copy:eP},sP="Bestätigt",oP="Aktionen",iP="Hinzufügen",nP="Alle",rP="Egal",aP="Anwenden",lP="April",cP="Fragen",uP="Astronomisch",dP="August",hP="Abbrechen",pP="Schließen",gP="Bedingung",mP="Bedingungen",fP="Konsole",$P="Kopiert",bP="Dezember",yP="Standard",vP="Verzögerung",_P="Löschen",wP="Beschreibung",kP="Fertig",CP="Exec shell",SP="Erläuterung",TP="Export",IP="Februar",EP="Februar",xP="Filter",DP="Ordner",AP="Fr",RP="Freitag",OP="ID",MP="ID1",NP="ID2",LP="Import",PP="Instanz",BP="Instanzen",jP="Anleitung",FP="Januar",zP="Januar",UP="Juli",HP="Juni",WP="Grenze",GP="März",VP="Mai",KP="Menü",YP="Nachricht",JP="Mo",qP="Modell",XP="Montag",ZP="Monat",QP="Mehr",eB="Name",tB="November",sB="OK",oB="Oktober",iB="Ok",nB="Pause",rB="Pushover",aB="Pushsafer",lB="Neu laden",cB="Umbenennen",uB="Wiederholen",dB="Neustart",hB="Ergebnis",pB="Sa",gB="Samstag",mB="Speichern",fB="Zeitplan",$B="Skript",bB="September",yB="Simulieren",vB="Stack",_B="Start",wB="Zustand",kB="So",CB="Sonntag",SB="Telegram",TB="Do",IB="Donnerstag",EB="Zeit",xB="Ausgelöst",DB="Löst aus",AB="Di",RB="Dienstag",OB="URL",MB="Wert",NB="Volumen",LB="Mi",PB="Mittwoch",BB="Schreiben",jB="Ja",FB="Wissen",zB="alle",UB="und",HB="Astro",WB="um",GB="Steuerung",VB="Kopie",KB="CRON",YB="Morgendämmerung",JB="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.",qB="Debuggen",XB="Abenddämmerung",ZB="einfach",QB="jeder",e2="Funktion",t2="ID",s2="Name",o2="Rolle",i2="Raum",n2="Goldene Abendstunde",r2="Vormittag",a2='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.',l2='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.',c2="Stunden",u2="beinhaltet",d2="Intervall",h2="Magie",p2="Millisekunden",g2="Minuten",m2="ms",f2="Nadir",$2="nautische Morgendämmerung",b2="nautische Abenddämmerung",y2="Nächster Sonnenaufgang",v2="Nächster Sonnenuntergang",_2="Nacht",w2="astronomische Morgendämmerung",k2="Normal",C2="Versatz",S2="einer",T2="oder",I2="ruhig",E2="Suche",x2="Sekunden",D2="(Nach-)Mittag",A2="Sonnenaufgang",R2="Goldene Morgenstunde",O2="Sonnenuntergang",M2="Sonnenuntergang (Anfang)",N2="dann",L2="Bestätigen",P2="Von",B2="Zuletzt geändert",j2="Qualität",F2="Zeitstempel",z2="Benutzer",U2="Wert",H2="zwei",W2="Aktualisieren",G2="Fügt Debug-Ausgaben für viele Systembefehle zum Protokoll hinzu",V2="Ausführliche Protokollausgaben",K2="falls",Y2="Assistent",J2="Erneut versuchen",q2="Rückgängig",X2="Wiederherstellen",Z2="Akzeptieren",Q2="Ablehnen",ej="Kontext",tj="Geräte",sj="Plan",oj="Senden",ij="Kopieren",nj={"%s not found":"%s nicht gefunden","()":"()","(at %s)":"(um %s)","(optional)":"(optional)","-":"-",".":".",Ack:sP,Actions:oP,"Actual time of day":"Tatsächliche Tageszeit",Add:iP,"Add new script":"Neues Skript hinzufügen",All:nP,"All files will be accepted":"Alle Dateien werden akzeptiert",Any:rP,"Any month":"Jeden Monat",Apply:aP,April:lP,"Are you sure?":"Wirklich sicher?",Ask:cP,Astronomical:uP,"Astronomical events today":"Astronomische Ereignisse heute",August:dP,"Blockly description":"Erstellen von Regeln durch Grafikblöcke","Body:":"Körper:",Cancel:hP,"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:pP,"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:gP,Conditions:mP,"Configuration not saved.":"Die Konfiguration ist nicht gespeichert.",Console:fP,"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:$P,"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:bP,Default:yP,"Define cron...":"Cron definieren ...","Define schedule...":"Zeitplan definieren ...",Delay:vP,Delete:_P,"Delete %s":"Löschen %s...","Delete folder":"Ordner löschen","Delete script":"Skript löschen",Description:wP,"Deselect all":"Alles abwählen","Discard changes for %s":"Änderungen für %s verwerfen",Done:kP,"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",Error:"Fehler","Error formatting code":"Fehler beim Formatieren des Codes","Error was found":"Fehler wurde gefunden","Every day":"Täglich",Exec:CP,"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:SP,Export:TP,"Export all scripts":"Alle Skripte exportieren","Export blocks":"Blöcke exportieren","Export selected blocks":"Ausgewählte Blöcke exportieren",Februar:IP,February:EP,Filter:xP,Folder:DP,Fr:AP,Friday:RP,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:OP,ID1:MP,ID2:NP,Import:LP,"Import blocks":"Blöcke importieren","Import error":"Fehler beim Importieren","Import scripts":"Skripte importieren","Insert object ID":"Objekt-ID einfügen",Instance:PP,"Instance is disabled":"Instanz ist deaktiviert","Instance:":"Instanz:",Instances:BP,Instructions:jP,"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:FP,January:zP,July:UP,June:HP,"Just check":"Einfach überprüfen","Keep my changes":"Meine Änderungen behalten","Language:":"Sprache:","Learn More":"Mehr erfahren","Light style":"Heller Stil",Limit:WP,"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:GP,"March ":"März ",May:VP,Menu:KP,Message:YP,Mo:JP,Model:qP,Monday:XP,Month:ZP,More:QP,Name:eB,"No active host found":"Kein aktiver Host gefunden","Nothing found":"Nichts gefunden",November:tB,OK:sB,October:oB,Ok:iB,"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","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:nB,"Pause execution":"Ausführung pausieren","Pause script":"Skript anhalten","Phone:":"Telefon:","Please select object ID...":"Objekt-ID auswählen ...","Prettify the script":"Verschönern Sie das Skript","Print some text in log":"Einen Text im Protokoll ausdrucken","Priority:":"Priorität:",Pushover:rB,Pushsafer:aB,"Read only ID selected: %s":"Schreibgeschützte ID ausgewählt: %s",Reload:lB,Rename:cB,"Reorder scripts in folders":"Skripte in Ordnern neu ordnen",Repeat:uB,Restart:dB,Result:hB,"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:pB,Saturday:gB,Save:mB,"Save all":"Alle speichern","Say It":"Say It","Say some text via sayit adapter":"Einen Text über den Sayit-Adapter sagen",Schedule:fB,Script:$B,"Script %s was modified on disk":'Skript "%s" wurde auf der Festplatte geändert',"Script was modified externally":"Skript wurde extern 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:bB,"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:yB,"Some files will be rejected":"Einige Dateien werden abgelehnt","Sound:":"Klang:",Stack:vB,Start:_B,"Start script":"Skript starten",State:wB,"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:kB,"Subject:":"Gegenstand:",Sunday:CB,"TS description":"Regeln erstellen mit TypeScript",Telegram:SB,"Text:":"Text:",Th:TB,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'Das Skript "%s" wurde von einem anderen Benutzer oder in einem anderen Fenster geändert. Möchten Sie das Skript neu laden oder Ihre lokalen Änderungen behalten?',"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:IB,Time:EB,"Time condition":"Zeitbedingung","Title:":"Titel:","To:":"Zu:","Trigger with value":"Trigger mit Wert",Triggered:xB,Triggers:DB,"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:AB,Tuesday:RB,URL:OB,"Unknown error":"Unbekannter Fehler","Unknown error!":"Unbekannter Fehler!","User function":"Benutzerfunktion","User:":"Benutzer:",Value:MB,"Vibration:":"Vibration:",Volume:NB,We:LB,Wednesday:PB,"Whatsapp-cmb":"WhatsApp-cmb",Write:BB,"Write your own code":"Eigenen Code schreiben",Yes:jB,"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","Please select a valid model":"Bitte ein gültiges Modell auswählen","[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:FB,all:zB,and:UB,"as JSON":"als JSON","as plain text":"als Klartext",astro:HB,at:WB,"clear running":"laufende abbrechen",control:GB,copy:VB,cron:KB,dawn:YB,debug_help:JB,debug_label:qB,default:"Standard",dusk:XB,easy:ZB,else:"sonst","equal to":"gleich",every:QB,"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:e2,filter_id:t2,filter_name:s2,filter_role:o2,filter_room:i2,"for edit or create script":"zum Bearbeiten oder zum Erstellen eines neues Skripts","for professionals":"für Profis","for programmers":"für Programmierer",goldenHour:n2,goldenHourEnd:r2,"greater or equal":"größer oder gleich","greater or equal to":"größer oder gleich","greater than":"größer als",help_just_check:a2,help_on_change:l2,"high priority":"hohe Priorität","high-priority":"hohe Priorität","highest priority":"höchste Priorität",hours:c2,includes:u2,interval:d2,"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:h2,milliseconds:p2,minutes:g2,ms:m2,nadir:f2,nauticalDawn:$2,nauticalDusk:b2,nextSunrise:y2,nextSunset:v2,night:_2,nightEnd:w2,"no blocks found":"Keine Blöcke gefunden","no group":"KEINE GRUPPE",normal:k2,"normal priority":"normale Priorität","not running":"nicht gestartet","not equal to":"ungleich","not properly connected":"Dieser Block ist mit anderen nicht richtig verbunden.",offset:C2,"on change":"bei Änderung","on condition change":"bei Zustandsänderung","on update":"beim Aktualisieren",one:S2,or:T2,quiet:I2,"reset search":"Suche zurücksetzen",search:E2,seconds:x2,solarNoon:D2,"store in":"speichern in",sunrise:A2,sunriseEnd:R2,sunset:O2,sunsetStart:M2,then:N2,"toggle value":"Wert umschalten",tooltip_ack:L2,tooltip_from:P2,tooltip_lc:B2,tooltip_quality:j2,tooltip_ts:F2,tooltip_user:z2,tooltip_value:U2,true:"wahr",two:H2,undefined:"nicht definiert",update:W2,"use seconds":"Sekunden verwenden","use trigger value":"Triggerwert benutzen",verbose_help:G2,verbose_label:V2,when:K2,with:"mit","with date":"mit Datum","with offset":"mit Versatz",wizard:Y2,"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:J2,"No running javascript instance found":"Keine laufende JavaScript-Instanz gefunden","OID display mode":"OID-Anzeigemodus","AI Chat":"KI Chat","AI inline completions":"KI Inline-Vervollständigung","New chat":"Neuer Chat","Ask about your script...":"Frage zu deinem Script stellen...","Insert blocks":"Blöcke einfügen","Apply blocks":"Blöcke anwenden",Undo:q2,Redo:X2,"Insert into editor":"In Editor einfügen","Show as diff":"Als Diff anzeigen","Selected code as context":"Ausgewählter Code als Kontext","Ask questions about your script, request changes, or generate new code.":"Stelle Fragen zu deinem Script, fordere Änderungen an oder generiere neuen Code.","to send":"zum Senden","Thinking...":"Denke nach...","AI suggested changes":"KI-vorgeschlagene Änderungen",Accept:Z2,Reject:Q2,"No API keys configured":"Keine API-Schlüssel konfiguriert","for new line":"für neue Zeile","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Modus: Chat = nur Unterhaltung, Agent = kann Skripte lesen/analysieren, Code = kann Skripte lesen und ändern","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Skripte als Kontext für die KI erwähnen. Nutze @alle für alle Skripte oder @Skriptname für ein bestimmtes.",Context:ej,"current script":"aktuelles Script","all scripts":"alle Scripts",devices:tj,"Searching datapoints":"Suche Datenpunkte","Reading value":"Lese Wert","Loading object info":"Lade Objekt-Info","Searching scripts":"Durchsuche Scripts","Reading script":"Lese Script","Loading script list":"Lade Script-Liste","All scripts":"Alle Scripts","Smart home devices":"Smart-Home-Geräte","Generating plan...":"Erstelle Plan...","Generating code...":"Generiere Code...",Plan:sj,"mention @all":"@alle","mention @devices":"@geräte",Send:oj,Copy:ij},rj="Admitido",aj="Comportamiento",lj="Añadir",cj="Todos",uj="Alguna",dj="Apply",hj="abril",pj="Preguntar",gj="Astronómico",mj="agosto",fj="Cancelar",$j="Cerrar",bj="Condición",yj="Condiciones",vj="Consola",_j="Copiado",wj="diciembre",kj="Defecto",Cj="Demora",Sj="Eliminar",Tj="Descripción",Ij="Hecho",Ej="Ejecutivo shell",xj="Explicación",Dj="Exportar",Aj="Februar",Rj="febrero",Oj="Filtrar",Mj="Carpeta",Nj="P.",Lj="viernes",Pj="CARNÉ DE IDENTIDAD",Bj="ID1",jj="ID2",Fj="Importar",zj="Ejemplo",Uj="Instancias",Hj="Instrucciones",Wj="Enero",Gj="enero",Vj="julio",Kj="junio",Yj="Límite",Jj="marzo",qj="Mayo",Xj="Menú",Zj="Mensaje",Qj="Mes",eF="Modelo",tF="lunes",sF="Mes",oF="Más",iF="Nombre",nF="noviembre",rF="OK",aF="octubre",lF="Okay",cF="Pausa",uF="Persona fácil de convencer",dF="Pushsafer",hF="Recargar",pF="Rebautizar",gF="Repetir",mF="Reiniciar",fF="Resultado",$F="Sa",bF="sábado",yF="Salvar",vF="Calendario",_F="Guión",wF="septiembre",kF="Simular",CF="Stack",SF="Comienzo",TF="Expresar",IF="Su",EF="domingo",xF="Telegrama",DF="4",AF="jueves",RF="Tiempo",OF="Motivado",MF="Disparadores",NF="Tu",LF="martes",PF="URL",BF="Valor",jF="Volumen",FF="3",zF="miércoles",UF="Escribir",HF="sí",WF="Reconocimiento",GF="todos",VF="y",KF="astro",YF="a",JF="control",qF="Copiar",XF="CRON",ZF="Amanecer",QF="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.",ez="Depurar",tz="Oscuridad",sz="fácil",oz="cada",iz="Función",nz="CARNÉ DE IDENTIDAD",rz="Nombre",az="Papel",lz="Habitación",cz="hora dorada",uz="Fin de la hora dorada",dz='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.',hz='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.',pz="horas",gz="incluye",mz="intervalo",fz="magia",$z="milisegundos",bz="minutos",yz="ms",vz="nadir",_z="Amanecer náutico",wz="Atardecer náutico",kz="próximo amanecer",Cz="Próxima puesta de sol",Sz="Noche",Tz="Fin de la noche",Iz="normal",Ez="compensar",xz="uno",Dz="o",Az="tranquilo",Rz="buscar",Oz="segundos",Mz="Mediodía solar",Nz="amanecer",Lz="Final del amanecer",Pz="puesta de sol",Bz="Inicio al atardecer",jz="entonces",Fz="Reconocer",zz="De",Uz="Último cambio",Hz="Calidad",Wz="Marca de tiempo",Gz="Usuario",Vz="Valor",Kz="dos",Yz="actualizar",Jz="Agrega salida de depuración al registro para muchos comandos del sistema",qz="Salidas de registro detalladas",Xz="cuando",Zz="Wizard",Qz="Reintentar",eU="Aceptar",tU="Rechazar",sU="Contexto",oU="dispositivos",iU="Deshacer",nU="Rehacer",rU="Plan",aU="Enviar",lU="Copiar",cU={"%s not found":"%s no encontrado","()":"()","(at %s)":"(en %s)","(optional)":"(Opcional)","-":"-",".":".",Ack:rj,Actions:aj,"Actual time of day":"Hora real del día",Add:lj,"Add new script":"Agregar nuevo script",All:cj,"All files will be accepted":"Todos los archivos serán aceptados.",Any:uj,"Any month":"Cualquier mes",Apply:dj,April:hj,"Are you sure?":"¿Estás seguro?",Ask:pj,Astronomical:gj,"Astronomical events today":"Eventos astronómicos hoy",August:mj,"Blockly description":"Crear reglas por bloques gráficos","Body:":"Cuerpo:",Cancel:fj,"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:$j,"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:bj,Conditions:yj,"Configuration not saved.":"Configuración no guardada.",Console:vj,"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:_j,"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:wj,Default:kj,"Define cron...":"Definir cron ...","Define schedule...":"Definir horario ...",Delay:Cj,Delete:Sj,"Delete %s":"Eliminar %s ...","Delete folder":"Eliminar carpeta","Delete script":"Eliminar guión",Description:Tj,"Deselect all":"Deseleccionar todo","Discard changes for %s":"Descartar cambios para %s",Done:Ij,"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",Error:"Error","Error formatting code":"Código de formato de error","Error was found":"Error encontrado","Every day":"Diario",Exec:Ej,"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:xj,Export:Dj,"Export all scripts":"Exportar todos los scripts","Export blocks":"Exportar bloques","Export selected blocks":"Exportar bloques seleccionados",Februar:Aj,February:Rj,Filter:Oj,Folder:Mj,Fr:Nj,Friday:Lj,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:Pj,ID1:Bj,ID2:jj,Import:Fj,"Import blocks":"Importar bloques","Import error":"Error de importación","Import scripts":"Importar guiones","Insert object ID":"Insertar ID de objeto",Instance:zj,"Instance is disabled":"La instancia está deshabilitada","Instance:":"Ejemplo:",Instances:Uj,Instructions:Hj,"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:Wj,January:Gj,July:Vj,June:Kj,"Just check":"Sólo revisa","Keep my changes":"Mantener mis cambios","Language:":"Idioma:","Learn More":"Aprende más","Light style":"Estilo ligero",Limit:Yj,"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:Jj,"March ":"marzo",May:qj,Menu:Xj,Message:Zj,Mo:Qj,Model:eF,Monday:tF,Month:sF,More:oF,Name:iF,"No active host found":"No se encontró un host activo","Nothing found":"Nada Encontrado",November:nF,OK:rF,October:aF,Ok:lF,"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","Operate two states":"Operar dos estados","Operations with two states":"Operaciones con dos estados","Paste your blocks here":"Pega tus bloques aquí",Pause:cF,"Pause execution":"Pausar ejecución","Pause script":"Pausar guion","Phone:":"Teléfono:","Please select object ID...":"Por favor, seleccione la ID del objeto ...","Prettify the script":"Embellecer el guión","Print some text in log":"Imprime texto en el registro","Priority:":"Prioridad:",Pushover:uF,Pushsafer:dF,"Read only ID selected: %s":"ID de solo lectura seleccionado: %s",Reload:hF,Rename:pF,"Reorder scripts in folders":"Reordenar guiones en carpetas",Repeat:gF,Restart:mF,Result:fF,"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:$F,Saturday:bF,Save:yF,"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:vF,Script:_F,"Script %s was modified on disk":"El script %s fue modificado en el disco","Script was modified externally":"El script fue modificado externamente","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:wF,"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:kF,"Some files will be rejected":"Algunos archivos serán rechazados","Sound:":"Sonido:",Stack:CF,Start:SF,"Start script":"Iniciar guion",State:TF,"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:IF,"Subject:":"Sujeto:",Sunday:EF,"TS description":"Crear reglas escribiendo el mecanografiado",Telegram:xF,"Text:":"Texto:",Th:DF,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'El script "%s" ha sido modificado por otro usuario o en otra ventana. ¿Desea recargar el script o mantener sus cambios locales?',"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:AF,Time:RF,"Time condition":"Condición de tiempo","Title:":"Título:","To:":"A:","Trigger with value":"Activar con valor",Triggered:OF,Triggers:MF,"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:NF,Tuesday:LF,URL:PF,"Unknown error":"Error desconocido","Unknown error!":"¡Error desconocido!","User function":"Función de usuario","User:":"Usuario:",Value:BF,"Vibration:":"Vibración:",Volume:jF,We:FF,Wednesday:zF,"Whatsapp-cmb":"Whatsapp-cmb",Write:UF,"Write your own code":"Escribe tu propio código",Yes:HF,"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","Please select a valid model":"Por favor, 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:WF,all:GF,and:VF,"as JSON":"como JSON","as plain text":"como texto plano",astro:KF,at:YF,"clear running":"carrera clara",control:JF,copy:qF,cron:XF,dawn:ZF,debug_help:QF,debug_label:ez,default:"defecto",dusk:tz,easy:sz,else:"demás","equal to":"igual a",every:oz,"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:iz,filter_id:nz,filter_name:rz,filter_role:az,filter_room:lz,"for edit or create script":"para editar o crear un nuevo script","for professionals":"para profesionales","for programmers":"para programadores",goldenHour:cz,goldenHourEnd:uz,"greater or equal":"mayor o igual","greater or equal to":"mayor o igual a","greater than":"mas grande que",help_just_check:dz,help_on_change:hz,"high priority":"alta prioridad","high-priority":"alta prioridad","highest priority":"más alta prioridad",hours:pz,includes:gz,interval:mz,"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:fz,milliseconds:$z,minutes:bz,ms:yz,nadir:vz,nauticalDawn:_z,nauticalDusk:wz,nextSunrise:kz,nextSunset:Cz,night:Sz,nightEnd:Tz,"no blocks found":"No se encontraron bloques","no group":"NO GRUPO",normal:Iz,"normal priority":"prioridad normal","not running":"no está en ejecución","not equal to":"no igual a","not properly connected":"Este bloque no está conectado correctamente a otros bloques.",offset:Ez,"on change":"en el cambio","on condition change":"con cambio de condición","on update":"en actualización",one:xz,or:Dz,quiet:Az,"reset search":"restablecer la búsqueda",search:Rz,seconds:Oz,solarNoon:Mz,"store in":"almacenar en",sunrise:Nz,sunriseEnd:Lz,sunset:Pz,sunsetStart:Bz,then:jz,"toggle value":"alternar valor",tooltip_ack:Fz,tooltip_from:zz,tooltip_lc:Uz,tooltip_quality:Hz,tooltip_ts:Wz,tooltip_user:Gz,tooltip_value:Vz,true:"cierto",two:Kz,undefined:"indefinido",update:Yz,"use seconds":"usar segundos","use trigger value":"usar valor de activación",verbose_help:Jz,verbose_label:qz,when:Xz,with:"con","with date":"con fecha","with offset":"con desplazamiento",wizard:Zz,"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:Qz,"No running javascript instance found":"No se encontró ninguna instancia de JavaScript en ejecución","OID display mode":"Modo de visualización OID","Ask questions about your script, request changes, or generate new code.":"Haz preguntas sobre tu script, solicita cambios o genera nuevo código.","to send":"para enviar","Thinking...":"Pensando...","AI suggested changes":"Cambios sugeridos por IA",Accept:eU,Reject:tU,"No API keys configured":"No hay claves API configuradas","for new line":"para nueva línea","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Modo: Chat = solo conversación, Agent = puede leer/analizar scripts, Code = puede leer y modificar scripts","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Mencionar scripts como contexto para la IA. Usa @todos para todos los scripts o @nombreScript para uno específico.",Context:sU,"current script":"script actual","all scripts":"todos los scripts",devices:oU,"Searching datapoints":"Buscando puntos de datos","Reading value":"Leyendo valor","Loading object info":"Cargando información del objeto","Searching scripts":"Buscando scripts","Reading script":"Leyendo script","Loading script list":"Cargando lista de scripts","All scripts":"Todos los scripts","Smart home devices":"Dispositivos del hogar inteligente","AI Chat":"Chat IA","AI inline completions":"Completado en línea con IA","New chat":"Nuevo chat","Ask about your script...":"Pregunta sobre tu script...","Insert blocks":"Insertar bloques","Apply blocks":"Aplicar bloques",Undo:iU,Redo:nU,"Insert into editor":"Insertar en el editor","Show as diff":"Mostrar como diff","Selected code as context":"Código seleccionado como contexto","Generating plan...":"Generando plan...","Generating code...":"Generando código...",Plan:rU,"mention @all":"@todos","mention @devices":"@dispositivos",Send:aU,Copy:lU},uU="Reconnu",dU="Actions",hU="Ajouter",pU="Tout",gU="Tout",mU="Postuler",fU="avril",$U="Demander",bU="Astronomique",yU="août",vU="Annuler",_U="proche",wU="État",kU="Conditions",CU="Console",SU="Copié",TU="décembre",IU="Défaut",EU="Retard",xU="Effacer",DU="Description",AU="Terminé",RU="Exec shell",OU="Explication",MU="Exportation",NU="Février",LU="février",PU="Filtre",BU="Dossier",jU="Fr",FU="Vendredi",zU="ID",UU="ID1",HU="ID2",WU="Importation",GU="Exemple",VU="Instances",KU="Instructions",YU="Janvier",JU="janvier",qU="juillet",XU="juin",ZU="Limite",QU="Mars",eH="Mai",tH="M e n u",sH="Message",oH="Mo",iH="Modèle",nH="Lundi",rH="Mois",aH="Plus",lH="Nom",cH="novembre",uH="OK",dH="octobre",hH="D'accord",pH="Pause",gH="Pushover",mH="Pushsafer",fH="Recharger",$H="Renommer",bH="Répéter",yH="Redémarrer",vH="Résultat",_H="Sa",wH="samedi",kH="sauver",CH="Horaire",SH="Scénario",TH="septembre",IH="Simuler",EH="Stack",xH="Début",DH="État",AH="Su",RH="dimanche",OH="Télégramme",MH="4",NH="Jeudi",LH="Temps",PH="Déclenché",BH="Déclencheurs",jH="Tu",FH="Mardi",zH="URL",UH="Valeur",HH="Le volume",WH="3",GH="Mercredi",VH="Écrivez",KH="Oui",YH="reconnaissance",JH="tout",qH="et",XH="astro",ZH="à",QH="contrôler",eW="copie",tW="CRON",sW="Aube",oW="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.",iW="Déboguer",nW="Crépuscule",rW="facile",aW="chaque",lW="Une fonction",cW="ID",uW="Nom",dW="Rôle",hW="Pièce",pW="Heure d'or",gW="Fin de l'heure d'or",mW="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.",fW="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.",$W="les heures",bW="comprend",yW="intervalle",vW="la magie",_W="millisecondes",wW="minutes",kW="ms",CW="nadir",SW="Aube nautique",TW="Crépuscule nautique",IW="Prochain lever de soleil",EW="Prochain coucher de soleil",xW="Nuit",DW="Fin de nuit",AW="Ordinaire",RW="décalage",OW="une",MW="ou",NW="calmer",LW="chercher",PW="secondes",BW="Midi solaire",jW="lever du soleil",FW="Fin du lever du soleil",zW="le coucher du soleil",UW="Début du coucher du soleil",HW="alors",WW="Reconnaître",GW="De",VW="Dernière modification",KW="Qualité",YW="Horodatage",JW="Utilisateur",qW="Valeur",XW="deux",ZW="mettre à jour",QW="Ajoute une sortie de débogage au journal pour de nombreuses commandes système",e5="Sorties de journal détaillées",t5="lorsque",s5="Wizard",o5="Réessayer",i5="Accepter",n5="Rejeter",r5="Contexte",a5="appareils",l5="Annuler",c5="Rétablir",u5="Plan",d5="Envoyer",h5="Copier",p5={"%s not found":"%s non trouvé","()":"()","(at %s)":"(à %s)","(optional)":"(optionnel)","-":"-",".":".",Ack:uU,Actions:dU,"Actual time of day":"Heure réelle de la journée",Add:hU,"Add new script":"Ajouter un nouveau script",All:pU,"All files will be accepted":"Tous les fichiers seront acceptés",Any:gU,"Any month":"N'importe quel mois",Apply:mU,April:fU,"Are you sure?":"Êtes-vous sûr?",Ask:$U,Astronomical:bU,"Astronomical events today":"Événements astronomiques aujourd'hui",August:yU,"Blockly description":"Création de règles par blocs graphiques","Body:":"Corps:",Cancel:vU,"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:_U,"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:wU,Conditions:kU,"Configuration not saved.":"Configuration non enregistrée.",Console:CU,"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:SU,"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:TU,Default:IU,"Define cron...":"Définir le cron ...","Define schedule...":"Définir le calendrier ...",Delay:EU,Delete:xU,"Delete %s":"Supprimer %s ...","Delete folder":"Supprimer le dossier","Delete script":"Supprimer le script",Description:DU,"Deselect all":"Tout déselectionner","Discard changes for %s":"Ignorer les modifications pour %s",Done:AU,"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",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:RU,"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:OU,Export:MU,"Export all scripts":"Exporter tous les scripts","Export blocks":"Blocs d'exportation","Export selected blocks":"Exporter les blocs sélectionnés",Februar:NU,February:LU,Filter:PU,Folder:BU,Fr:jU,Friday:FU,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:zU,ID1:UU,ID2:HU,Import:WU,"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:GU,"Instance is disabled":"L'instance est désactivée","Instance:":"Exemple:",Instances:VU,Instructions:KU,"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:YU,January:JU,July:qU,June:XU,"Just check":"Vérifiez simplement","Keep my changes":"Garder mes modifications","Language:":"Langue:","Learn More":"Apprendre encore plus","Light style":"Style de lumière",Limit:ZU,"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:QU,"March ":"mars",May:eH,Menu:tH,Message:sH,Mo:oH,Model:iH,Monday:nH,Month:rH,More:aH,Name:lH,"No active host found":"Aucun hôte actif trouvé","Nothing found":"Rien n'a été trouvé",November:cH,OK:uH,October:dH,Ok:hH,"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","Operate two states":"Opérer deux états","Operations with two states":"Opérations à deux états","Paste your blocks here":"Collez vos blocs ici",Pause:pH,"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 ...","Prettify the script":"Embellir le scénario","Print some text in log":"Imprimer du texte dans le journal","Priority:":"Priorité:",Pushover:gH,Pushsafer:mH,"Read only ID selected: %s":"ID en lecture seule sélectionné: %s",Reload:fH,Rename:$H,"Reorder scripts in folders":"Réorganiser les scripts dans des dossiers",Repeat:bH,Restart:yH,Result:vH,"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:_H,Saturday:wH,Save:kH,"Save all":"Sauver tous","Say It":"Say It","Say some text via sayit adapter":"Dites du texte via l'adaptateur sayit",Schedule:CH,Script:SH,"Script %s was modified on disk":"Le script %s a été modifié sur le disque","Script was modified externally":"Le script a été modifié en externe","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:TH,"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:IH,"Some files will be rejected":"Certains fichiers seront rejetés","Sound:":"Sonner:",Stack:EH,Start:xH,"Start script":"Lancer le script",State:DH,"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:AH,"Subject:":"Sujet:",Sunday:RH,"TS description":"Créer des règles en écrivant des caractères dactylographiés",Telegram:OH,"Text:":"Texte:",Th:MH,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'Le script "%s" a été modifié par un autre utilisateur ou dans une autre fenêtre. Voulez-vous recharger le script ou garder vos modifications locales ?',"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:NH,Time:LH,"Time condition":"Condition de temps","Title:":"Titre:","To:":"À:","Trigger with value":"Déclencheur avec valeur",Triggered:PH,Triggers:BH,"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:jH,Tuesday:FH,URL:zH,"Unknown error":"Erreur inconnue","Unknown error!":"Erreur inconnue!","User function":"Fonction utilisateur","User:":"Utilisateur:",Value:UH,"Vibration:":"Vibration:",Volume:HH,We:WH,Wednesday:GH,"Whatsapp-cmb":"Whatsapp-cmb",Write:VH,"Write your own code":"Écrivez votre propre code",Yes:KH,"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","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:YH,all:JH,and:qH,"as JSON":"en JSON","as plain text":"en texte brut",astro:XH,at:ZH,"clear running":"course claire",control:QH,copy:eW,cron:tW,dawn:sW,debug_help:oW,debug_label:iW,default:"défaut",dusk:nW,easy:rW,else:"autre","equal to":"égal à",every:aW,"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:lW,filter_id:cW,filter_name:uW,filter_role:dW,filter_room:hW,"for edit or create script":"pour éditer ou créer un nouveau script","for professionals":"pour les professionnels","for programmers":"pour les programmeurs",goldenHour:pW,goldenHourEnd:gW,"greater or equal":"supérieur ou égal","greater or equal to":"supérieur ou égal à","greater than":"plus grand que",help_just_check:mW,help_on_change:fW,"high priority":"haute priorité","high-priority":"haute priorité","highest priority":"priorité la plus élevée",hours:$W,includes:bW,interval:yW,"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:vW,milliseconds:_W,minutes:wW,ms:kW,nadir:CW,nauticalDawn:SW,nauticalDusk:TW,nextSunrise:IW,nextSunset:EW,night:xW,nightEnd:DW,"no blocks found":"Aucun bloc trouvé","no group":"PAS DE GROUPE",normal:AW,"normal priority":"priorité normale","not running":"pas en cours d'exécution","not equal to":"pas égal à","not properly connected":"Ce bloc n'est pas correctement connecté à d'autres blocs.",offset:RW,"on change":"sur le changement","on condition change":"sur changement de condition","on update":"sur mise à jour",one:OW,or:MW,quiet:NW,"reset search":"Réinitialiser la recherche",search:LW,seconds:PW,solarNoon:BW,"store in":"stocker dans",sunrise:jW,sunriseEnd:FW,sunset:zW,sunsetStart:UW,then:HW,"toggle value":"valeur de bascule",tooltip_ack:WW,tooltip_from:GW,tooltip_lc:VW,tooltip_quality:KW,tooltip_ts:YW,tooltip_user:JW,tooltip_value:qW,true:"vrai",two:XW,undefined:"indéfini",update:ZW,"use seconds":"utiliser les secondes","use trigger value":"use trigger value",verbose_help:QW,verbose_label:e5,when:t5,with:"avec","with date":"avec date","with offset":"avec offset",wizard:s5,"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:o5,"No running javascript instance found":"Aucune instance JavaScript en cours d'exécution trouvée","OID display mode":"Mode d'affichage OID","Ask questions about your script, request changes, or generate new code.":"Posez des questions sur votre script, demandez des modifications ou générez du nouveau code.","to send":"pour envoyer","Thinking...":"Réflexion...","AI suggested changes":"Modifications suggérées par l'IA",Accept:i5,Reject:n5,"No API keys configured":"Aucune clé API configurée","for new line":"pour nouvelle ligne","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Mode : Chat = conversation uniquement, Agent = peut lire/analyser les scripts, Code = peut lire et modifier les scripts","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Mentionner des scripts comme contexte pour l'IA. Utilisez @tous pour tous les scripts ou @nomDuScript pour un script spécifique.",Context:r5,"current script":"script actuel","all scripts":"tous les scripts",devices:a5,"Searching datapoints":"Recherche de points de données","Reading value":"Lecture de la valeur","Loading object info":"Chargement des informations de l'objet","Searching scripts":"Recherche de scripts","Reading script":"Lecture du script","Loading script list":"Chargement de la liste des scripts","All scripts":"Tous les scripts","Smart home devices":"Appareils domotiques","AI Chat":"Chat IA","AI inline completions":"Complétions en ligne IA","New chat":"Nouveau chat","Ask about your script...":"Posez une question sur votre script...","Insert blocks":"Insérer des blocs","Apply blocks":"Appliquer les blocs",Undo:l5,Redo:c5,"Insert into editor":"Insérer dans l'éditeur","Show as diff":"Afficher comme diff","Selected code as context":"Code sélectionné comme contexte","Generating plan...":"Génération du plan...","Generating code...":"Génération du code...",Plan:u5,"mention @all":"@tous","mention @devices":"@appareils",Send:d5,Copy:h5},g5="Riconosciuto",m5="Azioni",f5="Inserisci",$5="Tutti",b5="Qualunque",y5="Applica",v5="aprile",_5="Chiedere",w5="Astronomico",k5="agosto",C5="Annulla",S5="Vicino",T5="Condizione",I5="Condizioni",E5="Console",x5="Copiato",D5="dicembre",A5="Predefinito",R5="Ritardo",O5="Elimina",M5="Descrizione",N5="Fatto",L5="Execshell",P5="Spiegazione",B5="Esportare",j5="Februar",F5="febbraio",z5="Filtro",U5="Cartella",H5="P",W5="Venerdì",G5="ID",V5="ID1",K5="ID2",Y5="Importare",J5="Esempio",q5="istanze",X5="Istruzioni",Z5="Januar",Q5="gennaio",e3="luglio",t3="giugno",s3="Limite",o3="marzo",i3="Maggio",n3="Menu",r3="Messaggio",a3="Mo",l3="Modello",c3="Lunedi",u3="Mese",d3="Di più",h3="Nome",p3="novembre",g3="OK",m3="ottobre",f3="Ok",$3="Pausa",b3="Pushover",y3="Pushsafer",v3="Ricaricare",_3="Rinominare",w3="Ripetere",k3="Ricomincia",C3="Risultato",S3="Sa",T3="Sabato",I3="Salva",E3="Programma",x3="copione",D3="settembre",A3="Simulare",R3="Stack",O3="Cominciare",M3="Stato",N3="Su",L3="Domenica",P3="Telegramma",B3="4",j3="giovedi",F3="Tempo",z3="Innescato",U3="Trigger",H3="Tu",W3="martedì",G3="URL",V3="Valore",K3="Volume",Y3="3",J3="mercoledì",q3="Scrivi",X3="sì",Z3="riconoscimento",Q3="tutti",eG="e",tG="astro",sG="a",oG="controllo",iG="copia",nG="CRON",rG="alba",aG="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.",lG="Debug",cG="crepuscolo",uG="facile",dG="ogni",hG="Funzione",pG="ID",gG="Nome",mG="Ruolo",fG="Camera",$G="Ora d'oro",bG="Fine dell'ora d'oro",yG='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.',vG='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.',_G="ore",wG="include",kG="intervallo",CG="Magia",SG="millisecondi",TG="minuti",IG="ms",EG="nadir",xG="Alba nautica",DG="Crepuscolo nautico",AG="Prossima alba",RG="Prossimo tramonto",OG="Notte",MG="Fine della notte",NG="normale",LG="compensare",PG="uno",BG="o",jG="silenzioso",FG="ricerca",zG="secondi",UG="Mezzogiorno solare",HG="Alba",WG="Fine dell'alba",GG="tramonto",VG="Inizio del tramonto",KG="poi",YG="Riconoscere",JG="A partire dal",qG="Ultima modifica",XG="Qualità",ZG="timestamp",QG="Utente",eV="Valore",tV="Due",sV="aggiornare",oV="Aggiunge l'output di debug al registro per molti comandi di sistema",iV="Output di log dettagliati",nV="quando",rV="procedura guidata",aV="Riprova",lV="Accetta",cV="Rifiuta",uV="Contesto",dV="dispositivi",hV="Annulla",pV="Ripristina",gV="Piano",mV="Invia",fV="Copia",$V={"%s not found":"%s non trovato","()":"()","(at %s)":"(a %s)","(optional)":"(opzionale)","-":"-",".":".",Ack:g5,Actions:m5,"Actual time of day":"Ora effettiva della giornata",Add:f5,"Add new script":"Aggiungi nuovo script",All:$5,"All files will be accepted":"Tutti i file saranno accettati",Any:b5,"Any month":"Ogni mese",Apply:y5,April:v5,"Are you sure?":"Sei sicuro?",Ask:_5,Astronomical:w5,"Astronomical events today":"Eventi astronomici oggi",August:k5,"Blockly description":"Creazione di regole tramite blocchi grafici","Body:":"Corpo:",Cancel:C5,"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:S5,"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:T5,Conditions:I5,"Configuration not saved.":"Configurazione non salvata.",Console:E5,"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:x5,"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:D5,Default:A5,"Define cron...":"Definisci cron ...","Define schedule...":"Definisci programma ...",Delay:R5,Delete:O5,"Delete %s":"Elimina %s ...","Delete folder":"Elimina cartella","Delete script":"Elimina script",Description:M5,"Deselect all":"Deselezionare tutto","Discard changes for %s":"Annulla modifiche per %s",Done:N5,"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",Error:"Errore","Error formatting code":"Errore di formattazione del codice","Error was found":"Errore trovato","Every day":"Ogni giorno",Exec:L5,"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:P5,Export:B5,"Export all scripts":"Esporta tutti gli script","Export blocks":"Esporta blocchi","Export selected blocks":"Esporta i blocchi selezionati",Februar:j5,February:F5,Filter:z5,Folder:U5,Fr:H5,Friday:W5,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:G5,ID1:V5,ID2:K5,Import:Y5,"Import blocks":"Importa blocchi","Import error":"Errore di importazione","Import scripts":"Importa script","Insert object ID":"Inserisci l'ID oggetto",Instance:J5,"Instance is disabled":"L'istanza è disabilitata","Instance:":"Esempio:",Instances:q5,Instructions:X5,"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:Z5,January:Q5,July:e3,June:t3,"Just check":"Controlla solamente","Keep my changes":"Mantieni le mie modifiche","Language:":"Linguaggio:","Learn More":"Per saperne di più","Light style":"Stile leggero",Limit:s3,"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:o3,"March ":"marzo",May:i3,Menu:n3,Message:r3,Mo:a3,Model:l3,Monday:c3,Month:u3,More:d3,Name:h3,"No active host found":"Nessun host attivo trovato","Nothing found":"Non abbiamo trovato nulla",November:p3,OK:g3,October:m3,Ok:f3,"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","Operate two states":"Gestisci due stati","Operations with two states":"Operazioni con due stati","Paste your blocks here":"Incolla qui i tuoi blocchi",Pause:$3,"Pause execution":"Metti in pausa l'esecuzione","Pause script":"Metti in pausa lo script","Phone:":"Telefono:","Please select object ID...":"Seleziona l'ID oggetto ...","Prettify the script":"Abbellire la sceneggiatura","Print some text in log":"Stampa del testo nel registro","Priority:":"Priorità:",Pushover:b3,Pushsafer:y3,"Read only ID selected: %s":"ID di sola lettura selezionato: %s",Reload:v3,Rename:_3,"Reorder scripts in folders":"Riordina gli script nelle cartelle",Repeat:w3,Restart:k3,Result:C3,"Resume execution":"Riprendi esecuzione","Root folder":"Cartella root","Rules description":"Crea regole con i blocchi IF, THEN, ELSE","Run script":"Esegui script",Sa:S3,Saturday:T3,Save:I3,"Save all":"Salva tutto","Say It":"Say It","Say some text via sayit adapter":"Pronuncia del testo tramite l'adattatore sayit",Schedule:E3,Script:x3,"Script %s was modified on disk":"Lo script %s è stato modificato sul disco","Script was modified externally":"Lo script è stato modificato esternamente","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:D3,"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:A3,"Some files will be rejected":"Alcuni file verranno rifiutati","Sound:":"Suono:",Stack:R3,Start:O3,"Start script":"Avvia script",State:M3,"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:N3,"Subject:":"Soggetto:",Sunday:L3,"TS description":"Creare regole scrivendo dattiloscritto",Telegram:P3,"Text:":"Testo:",Th:B3,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':`Lo script "%s" è stato modificato da un altro utente o in un'altra finestra. Vuoi ricaricare lo script o mantenere le tue modifiche locali?`,"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:j3,Time:F3,"Time condition":"Condizione temporale","Title:":"Titolo:","To:":"Per:","Trigger with value":"Trigger con valore",Triggered:z3,Triggers:U3,"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:H3,Tuesday:W3,URL:G3,"Unknown error":"Errore sconosciuto","Unknown error!":"Errore sconosciuto!","User function":"Funzione utente","User:":"Utente:",Value:V3,"Vibration:":"Vibrazione:",Volume:K3,We:Y3,Wednesday:J3,"Whatsapp-cmb":"Whatsapp-cmb",Write:q3,"Write your own code":"Scrivi il tuo codice",Yes:X3,"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","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:Z3,all:Q3,and:eG,"as JSON":"come JSON","as plain text":"come testo",astro:tG,at:sG,"clear running":"chiara esecuzione",control:oG,copy:iG,cron:nG,dawn:rG,debug_help:aG,debug_label:lG,default:"predefinito",dusk:cG,easy:uG,else:"altro","equal to":"uguale a",every:dG,"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:hG,filter_id:pG,filter_name:gG,filter_role:mG,filter_room:fG,"for edit or create script":"per modificare o creare un nuovo script","for professionals":"per i professionisti","for programmers":"per i programmatori",goldenHour:$G,goldenHourEnd:bG,"greater or equal":"maggiore o uguale","greater or equal to":"maggiore o uguale a","greater than":"più grande di",help_just_check:yG,help_on_change:vG,"high priority":"priorità alta","high-priority":"priorità alta","highest priority":"massima priorità",hours:_G,includes:wG,interval:kG,"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:CG,milliseconds:SG,minutes:TG,ms:IG,nadir:EG,nauticalDawn:xG,nauticalDusk:DG,nextSunrise:AG,nextSunset:RG,night:OG,nightEnd:MG,"no blocks found":"Nessun blocco trovato","no group":"NESSUN GRUPPO",normal:NG,"normal priority":"priorità normale","not running":"non in esecuzione","not equal to":"non uguale a","not properly connected":"Questo blocco non è correttamente collegato ad altri blocchi.",offset:LG,"on change":"sul cambiamento","on condition change":"a cambio di condizione","on update":"in aggiornamento",one:PG,or:BG,quiet:jG,"reset search":"resetta la ricerca",search:FG,seconds:zG,solarNoon:UG,"store in":"conservare in",sunrise:HG,sunriseEnd:WG,sunset:GG,sunsetStart:VG,then:KG,"toggle value":"alterna valore",tooltip_ack:YG,tooltip_from:JG,tooltip_lc:qG,tooltip_quality:XG,tooltip_ts:ZG,tooltip_user:QG,tooltip_value:eV,true:"vero",two:tV,undefined:"non definito",update:sV,"use seconds":"usa i secondi","use trigger value":"usa il trigger",verbose_help:oV,verbose_label:iV,when:nV,with:"con","with date":"con data","with offset":"con offset",wizard:rV,"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:aV,"No running javascript instance found":"Nessuna istanza JavaScript in esecuzione trovata","OID display mode":"Modalità di visualizzazione OID","Ask questions about your script, request changes, or generate new code.":"Fai domande sul tuo script, richiedi modifiche o genera nuovo codice.","to send":"per inviare","Thinking...":"Pensando...","AI suggested changes":"Modifiche suggerite dall'IA",Accept:lV,Reject:cV,"No API keys configured":"Nessuna chiave API configurata","for new line":"per nuova riga","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Modalità: Chat = solo conversazione, Agent = può leggere/analizzare gli script, Code = può leggere e modificare gli script","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Menziona script come contesto per l'IA. Usa @tutti per tutti gli script o @nomeScript per uno specifico.",Context:uV,"current script":"script corrente","all scripts":"tutti gli script",devices:dV,"Searching datapoints":"Ricerca punti dati","Reading value":"Lettura valore","Loading object info":"Caricamento info oggetto","Searching scripts":"Ricerca script","Reading script":"Lettura script","Loading script list":"Caricamento lista script","All scripts":"Tutti gli script","Smart home devices":"Dispositivi smart home","AI Chat":"Chat IA","AI inline completions":"Completamento in linea IA","New chat":"Nuova chat","Ask about your script...":"Chiedi informazioni sul tuo script...","Insert blocks":"Inserisci blocchi","Apply blocks":"Applica blocchi",Undo:hV,Redo:pV,"Insert into editor":"Inserisci nell'editor","Show as diff":"Mostra come diff","Selected code as context":"Codice selezionato come contesto","Generating plan...":"Generazione piano...","Generating code...":"Generazione codice...",Plan:gV,"mention @all":"@tutti","mention @devices":"@dispositivi",Send:mV,Copy:fV},bV="Erkend",yV="Acties",vV="Toevoegen",_V="Alle",wV="Ieder",kV="Solliciteer",CV="april",SV="Vragen",TV="Astronomisch",IV="augustus",EV="annuleren",xV="Dichtbij",DV="Staat",AV="Voorwaarden",RV="Troosten",OV="Gekopieerd",MV="december",NV="Standaard",LV="Vertraging",PV="Verwijder",BV="Beschrijving",jV="Gedaan",FV="Exec shell",zV="Uitleg",UV="Exporteren",HV="Februari",WV="februari",GV="Filter",VV="Map",KV="Vr",YV="vrijdag",JV="ID kaart",qV="ID1",XV="ID2",ZV="Importeren",QV="Voorbeeld",e4="Instanties",t4="Instructies",s4="Januar",o4="januari",i4="juli",n4="juni",r4="Begrenzing",a4="maart",l4="mei",c4="Menu",u4="Bericht",d4="Ma",h4="Model",p4="maandag",g4="Maand",m4="Meer",f4="Naam",$4="november",b4="OK",y4="oktober",v4="OK",_4="Pauze",w4="Pushover",k4="Duwijzer",C4="Herladen",S4="andere naam geven",T4="Herhaling",I4="Herstarten",E4="Resultaat",x4="Za",D4="zaterdag",A4="Opslaan",R4="Schema",O4="Script",M4="september",N4="Simuleren",L4="Stack",P4="Begin",B4="Staat",j4="Zo",F4="zondag",z4="Telegram",U4="4",H4="donderdag",W4="Tijd",G4="Veroorzaakt",V4="Triggers",K4="Di",Y4="dinsdag",J4="URL",q4="Waarde",X4="Volume",Z4="3",Q4="woensdag",e8="Schrijven",t8="Ja",s8="erkenning",o8="alle",i8="en",n8="astro",r8="Bij",a8="controle",l8="kopiëren",c8="cron",u8="dageraad",d8="Dit is een speciale modus waarin toestanden en objecten niet veranderen. Maar alleen informatie over elke geplande wijziging wordt in het protocol weergegeven.",h8="Debuggen",p8="schemer",g8="eenvoudig",m8="elke",f8="Functie",$8="ID kaart",b8="Naam",y8="Rol",v8="Kamer",_8="gouden uur",w8="Einde van gouden uur",k8='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.',C8='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.',S8="uren",T8="omvat",I8="interval",E8="magie",x8="milliseconden",D8="minuten",A8="ms",R8="nadir",O8="Nautische dageraad",M8="Nautische schemering",N8="Volgende zonsopgang",L8="Volgende zonsondergang",P8="nacht",B8="Einde van de nacht",j8="normaal",F8="compensatie",z8="een",U8="of",H8="stil",W8="zoeken",G8="seconden",V8="Zonne-middag",K8="zonsopkomst",Y8="Einde zonsopgang",J8="zonsondergang",q8="Begin van de zonsondergang",X8="vervolgens",Z8="Erkennen",Q8="Van",e6="Laatst gewijzigd",t6="Kwaliteit",s6="tijdstempel",o6="Gebruiker",i6="Waarde",n6="twee",r6="bijwerken",a6="Voegt foutopsporingsuitvoer toe aan het logboek voor veel systeemopdrachten",l6="Uitgebreide log-uitgangen",c6="wanneer",u6="tovenaar",d6="Opnieuw proberen",h6="Accepteren",p6="Afwijzen",g6="Context",m6="apparaten",f6="Ongedaan maken",$6="Opnieuw",b6="Plan",y6="Verzenden",v6="Kopiëren",_6={"%s not found":"%s niet gevonden","()":"()","(at %s)":"(op %s)","(optional)":"(optioneel)","-":"-",".":".",Ack:bV,Actions:yV,"Actual time of day":"Werkelijke tijd van de dag",Add:vV,"Add new script":"Nieuw script toevoegen",All:_V,"All files will be accepted":"Alle bestanden worden geaccepteerd",Any:wV,"Any month":"Elke maand",Apply:kV,April:CV,"Are you sure?":"Weet je zeker dat?",Ask:SV,Astronomical:TV,"Astronomical events today":"Astronomische gebeurtenissen vandaag",August:IV,"Blockly description":"Regels maken door grafische blokken","Body:":"Lichaam:",Cancel:EV,"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:DV,Conditions:AV,"Configuration not saved.":"Configuratie niet opgeslagen.",Console:RV,"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:OV,"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:MV,Default:NV,"Define cron...":"Definieer cron ...","Define schedule...":"Definieer schema ...",Delay:LV,Delete:PV,"Delete %s":"%s verwijderen ...","Delete folder":"Verwijder map","Delete script":"Script verwijderen",Description:BV,"Deselect all":"Deselecteer alles","Discard changes for %s":"Wijzigingen voor %s annuleren",Done:jV,"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",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:FV,"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:zV,Export:UV,"Export all scripts":"Exporteer alle scripts","Export blocks":"Blokken exporteren","Export selected blocks":"Exporteer geselecteerde blokken",Februar:HV,February:WV,Filter:GV,Folder:VV,Fr:KV,Friday:YV,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:JV,ID1:qV,ID2:XV,Import:ZV,"Import blocks":"Blokken importeren","Import error":"Importfout","Import scripts":"Scripts importeren","Insert object ID":"Object-ID invoegen",Instance:QV,"Instance is disabled":"Exemplaar is uitgeschakeld","Instance:":"Voorbeeld:",Instances:e4,Instructions:t4,"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:s4,January:o4,July:i4,June:n4,"Just check":"Kijk maar","Keep my changes":"Mijn wijzigingen behouden","Language:":"Taal:","Learn More":"Leer meer","Light style":"Lichte stijl",Limit:r4,"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:a4,"March ":"maart",May:l4,Menu:c4,Message:u4,Mo:d4,Model:h4,Monday:p4,Month:g4,More:m4,Name:f4,"No active host found":"Geen actieve host gevonden","Nothing found":"Niets gevonden",November:$4,OK:b4,October:y4,Ok:v4,"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","Operate two states":"Bedien twee toestanden:","Operations with two states":"Bewerkingen met twee toestanden","Paste your blocks here":"Plak hier je blokken",Pause:_4,"Pause execution":"Uitvoering pauzeren","Pause script":"Pauzeer script","Phone:":"Telefoon:","Please select object ID...":"Selecteer object-ID ...","Prettify the script":"Maak het script mooier","Print some text in log":"Druk wat tekst af in het logboek","Priority:":"Prioriteit:",Pushover:w4,Pushsafer:k4,"Read only ID selected: %s":"Alleen-lezen ID geselecteerd: %s",Reload:C4,Rename:S4,"Reorder scripts in folders":"Sorteer scripts in mappen opnieuw",Repeat:T4,Restart:I4,Result:E4,"Resume execution":"Uitvoering hervatten","Root folder":"Hoofdmap","Rules description":"Maak regels met IF, THEN, ELSE blokken","Run script":"Voer script uit",Sa:x4,Saturday:D4,Save:A4,"Save all":"Sla alles op","Say It":"Say It","Say some text via sayit adapter":"Zeg wat tekst via de sayit-adapter",Schedule:R4,Script:O4,"Script %s was modified on disk":"Script %s is gewijzigd op schijf","Script was modified externally":"Script is extern gewijzigd","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:M4,"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:N4,"Some files will be rejected":"Sommige bestanden worden geweigerd","Sound:":"Geluid:",Stack:L4,Start:P4,"Start script":"Start het script",State:B4,"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:j4,"Subject:":"Onderwerpen:",Sunday:F4,"TS description":"Regels maken door Typescript te schrijven",Telegram:z4,"Text:":"Tekst:",Th:U4,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'Het script "%s" is gewijzigd door een andere gebruiker of in een ander venster. Wilt u het script herladen of uw lokale wijzigingen behouden?',"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:H4,Time:W4,"Time condition":"Tijdsvoorwaarde","Title:":"Titel:","To:":"Naar:","Trigger with value":"Trigger met waarde",Triggered:G4,Triggers:V4,"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:K4,Tuesday:Y4,URL:J4,"Unknown error":"Onbekende fout","Unknown error!":"Onbekende fout!","User function":"Gebruikersfunctie","User:":"Gebruiker:",Value:q4,"Vibration:":"Trilling:",Volume:X4,We:Z4,Wednesday:Q4,"Whatsapp-cmb":"Whatsapp-cmb",Write:e8,"Write your own code":"Schrijf je eigen code",Yes:t8,"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","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:s8,all:o8,and:i8,"as JSON":"als JSON","as plain text":"als platte tekst",astro:n8,at:r8,"clear running":"duidelijk rennen",control:a8,copy:l8,cron:c8,dawn:u8,debug_help:d8,debug_label:h8,default:"standaard",dusk:p8,easy:g8,else:"anders","equal to":"gelijk aan",every:m8,"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:f8,filter_id:$8,filter_name:b8,filter_role:y8,filter_room:v8,"for edit or create script":"voor bewerken of een nieuw script maken","for professionals":"voor professionals","for programmers":"voor programmeurs",goldenHour:_8,goldenHourEnd:w8,"greater or equal":"groter of gelijk","greater or equal to":"groter of gelijk aan","greater than":"groter dan",help_just_check:k8,help_on_change:C8,"high priority":"hoge prioriteit","high-priority":"hoge prioriteit","highest priority":"hoogste prioriteit",hours:S8,includes:T8,interval:I8,"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:E8,milliseconds:x8,minutes:D8,ms:A8,nadir:R8,nauticalDawn:O8,nauticalDusk:M8,nextSunrise:N8,nextSunset:L8,night:P8,nightEnd:B8,"no blocks found":"Geen blokken gevonden","no group":"GEEN GROEP",normal:j8,"normal priority":"normale prioriteit","not running":"niet actief","not equal to":"niet gelijk aan","not properly connected":"Dit blok is niet correct verbonden met andere blokken.",offset:F8,"on change":"bij verandering","on condition change":"op voorwaarde verandering","on update":"bij update",one:z8,or:U8,quiet:H8,"reset search":"reset zoeken",search:W8,seconds:G8,solarNoon:V8,"store in":"opslaan in",sunrise:K8,sunriseEnd:Y8,sunset:J8,sunsetStart:q8,then:X8,"toggle value":"schakelwaarde",tooltip_ack:Z8,tooltip_from:Q8,tooltip_lc:e6,tooltip_quality:t6,tooltip_ts:s6,tooltip_user:o6,tooltip_value:i6,true:"waar",two:n6,undefined:"ongedefinieerd",update:r6,"use seconds":"gebruik seconden","use trigger value":"triggerwaarde gebruiken",verbose_help:a6,verbose_label:l6,when:c6,with:"met","with date":"met datum","with offset":"met offset",wizard:u6,"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:d6,"No running javascript instance found":"Geen draaiende JavaScript-instantie gevonden","OID display mode":"OID-weergavemodus","Ask questions about your script, request changes, or generate new code.":"Stel vragen over je script, vraag wijzigingen aan of genereer nieuwe code.","to send":"om te verzenden","Thinking...":"Nadenken...","AI suggested changes":"Door AI voorgestelde wijzigingen",Accept:h6,Reject:p6,"No API keys configured":"Geen API-sleutels geconfigureerd","for new line":"voor nieuwe regel","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Modus: Chat = alleen gesprek, Agent = kan scripts lezen/analyseren, Code = kan scripts lezen en wijzigen","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Vermeld scripts als context voor de AI. Gebruik @alle voor alle scripts of @scriptnaam voor een specifiek script.",Context:g6,"current script":"huidig script","all scripts":"alle scripts",devices:m6,"Searching datapoints":"Datapunten zoeken","Reading value":"Waarde lezen","Loading object info":"Objectinfo laden","Searching scripts":"Scripts zoeken","Reading script":"Script lezen","Loading script list":"Scriptlijst laden","All scripts":"Alle scripts","Smart home devices":"Slimme apparaten","AI Chat":"AI Chat","AI inline completions":"AI inline-aanvullingen","New chat":"Nieuwe chat","Ask about your script...":"Stel een vraag over je script...","Insert blocks":"Blokken invoegen","Apply blocks":"Blokken toepassen",Undo:f6,Redo:$6,"Insert into editor":"In editor invoegen","Show as diff":"Als diff tonen","Selected code as context":"Geselecteerde code als context","Generating plan...":"Plan genereren...","Generating code...":"Code genereren...",Plan:b6,"mention @all":"@alle","mention @devices":"@apparaten",Send:y6,Copy:v6},w6="Potwierdzony",k6="Działania",C6="Dodaj",S6="Wszystko",T6="Każdy",I6="Zastosuj",E6="Kwiecień",x6="Zapytać",D6="Astronomiczny",A6="Sierpień",R6="Odwołaj",O6="Zamknij",M6="Stan",N6="Warunki",L6="Konsola",P6="Skopiowano",B6="Grudzień",j6="Domyślna",F6="Opóźnienie",z6="Usuń",U6="Opis",H6="Gotowe",W6="Uruchom shell",G6="Wyjaśnienie",V6="Eksport",K6="Luty",Y6="Luty",J6="Filtr",q6="Folder",X6="Pt",Z6="Piątek",Q6="ID",e9="ID1",t9="ID2",s9="Import",o9="Instancja",i9="Instancje",n9="Instrukcje",r9="Styczeń",a9="Styczeń",l9="Lipiec",c9="Czerwiec",u9="Limit",d9="Marzec",h9="Maj",p9="Menu",g9="Wiadomość",m9="Po",f9="Model",$9="Poniedziałek",b9="Miesiąc",y9="Więcej",v9="Nazwa",_9="Listopad",w9="OK",k9="Październik",C9="Ok",S9="Pauza",T9="Pushover",I9="Pushsafer",E9="Przeładuj",x9="Przemianuj",D9="Powtórz",A9="Uruchom ponownie",R9="Wynik",O9="So",M9="Sobota",N9="Zapisz",L9="Harmonogram",P9="Skrypt",B9="Wrzesień",j9="Symulacja",F9="Stos",z9="Początek",U9="Stan",H9="Nd",W9="Niedziela",G9="Telegram",V9="Cz",K9="Czwartek",Y9="Czas",J9="Wyzwolony",q9="Wyzwalacze",X9="Wt",Z9="Wtorek",Q9="URL",eK="Wartość",tK="Wolumen",sK="Śr",oK="Środa",iK="Pisać",nK="Tak",rK="potwierdzenie",aK="wszystko",lK="i",cK="Astro",uK="w",dK="kontrola",hK="Kopiuj",pK="CRON",gK="Świt",mK="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.",fK="Odpluskwić",$K="Zmierzch",bK="łatwy",yK="każdy",vK="Funkcja",_K="ID",wK="Nazwa",kK="Rola",CK="Pokój",SK="Złota godzina",TK="Koniec złotej godziny",IK="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.",EK="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.",xK="godziny",DK="zawiera",AK="interwał",RK="magia",OK="milisekund",MK="minuty",NK="ms",LK="Północ słoneczna",PK="Żeglarski świt",BK="Żeglarski zmierzch",jK="Następny wschód słońca",FK="Następny zachód słońca",zK="Noc",UK="Koniec nocy",HK="normalny",WK="przesunięcie",GK="jeden",VK="lub",KK="cisza",YK="Szukaj",JK="sekundy",qK="Południe słoneczne",XK="Wschód słońca",ZK="Koniec wschodu słońca",QK="Zachód słońca",e7="Początek zachodu słońca",t7="następnie",s7="Akceptuj",o7="Od",i7="Ostatnia zmiana",n7="Jakość",r7="Znacznik czasu",a7="Użytkownik",l7="Wartość",c7="dwa",u7="aktualizacja",d7="Dodaje wyniki debugowania do dziennika dla wielu poleceń systemowych",h7="Pełne dane wyjściowe dziennika",p7="gdy",g7="Wizard",m7="Ponów próbę",f7="Akceptuj",$7="Odrzuć",b7="Kontekst",y7="urządzenia",v7="Cofnij",_7="Ponów",w7="Plan",k7="Wyślij",C7="Kopiuj",S7={"%s not found":"%s nie znaleziono","()":"()","(at %s)":"(w %s)","(optional)":"(opcjonalny)","-":"-",".":".",Ack:w6,Actions:k6,"Actual time of day":"Aktualna pora dnia",Add:C6,"Add new script":"Dodaj nowy skrypt",All:S6,"All files will be accepted":"Wszystkie pliki zostaną zaakceptowane",Any:T6,"Any month":"Dowolny miesiąc",Apply:I6,April:E6,"Are you sure?":"Jesteś pewny?",Ask:x6,Astronomical:D6,"Astronomical events today":"Wydarzenia astronomiczne dzisiaj",August:A6,"Blockly description":"Tworzenie reguł za pomocą bloków graficznych","Body:":"Treść:",Cancel:R6,"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:O6,"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:M6,Conditions:N6,"Configuration not saved.":"Konfiguracja nie została zapisana.",Console:L6,"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:P6,"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:B6,Default:j6,"Define cron...":"Zdefiniuj CRON ...","Define schedule...":"Zdefiniuj harmonogram ...",Delay:F6,Delete:z6,"Delete %s":"Usuń %s ...","Delete folder":"Usuń folder","Delete script":"Usuń skrypt",Description:U6,"Deselect all":"Odznacz wszystkie","Discard changes for %s":"Odrzuć zmiany dla %s",Done:H6,"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",Error:"Błąd","Error formatting code":"Błąd formatowania kodu","Error was found":"Błąd został znaleziony","Every day":"Codziennie",Exec:W6,"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:G6,Export:V6,"Export all scripts":"Wyeksportuj wszystkie skrypty","Export blocks":"Eksportuj bloki","Export selected blocks":"Eksportuj wybrane bloki",Februar:K6,February:Y6,Filter:J6,Folder:q6,Fr:X6,Friday:Z6,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:Q6,ID1:e9,ID2:t9,Import:s9,"Import blocks":"Importuj bloki","Import error":"Błąd importowania","Import scripts":"Importuj skrypty","Insert object ID":"Wstaw identyfikator obiektu",Instance:o9,"Instance is disabled":"Instancja jest wyłączona","Instance:":"Instancja:",Instances:i9,Instructions:n9,"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:r9,January:a9,July:l9,June:c9,"Just check":"Po prostu sprawdź","Keep my changes":"Zachowaj moje zmiany","Language:":"Język:","Learn More":"Ucz się więcej","Light style":"Lekki styl",Limit:u9,"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:d9,"March ":"Marzec ",May:h9,Menu:p9,Message:g9,Mo:m9,Model:f9,Monday:$9,Month:b9,More:y9,Name:v9,"No active host found":"Nie znaleziono aktywnego hosta","Nothing found":"Nic nie znaleziono",November:_9,OK:w9,October:k9,Ok:C9,"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","Operate two states":"Obsługuj dwa stany","Operations with two states":"Operacje z dwoma stanami","Paste your blocks here":"Wklej tutaj swoje bloki",Pause:S9,"Pause execution":"Wstrzymaj wykonanie","Pause script":"Wstrzymaj skrypt","Phone:":"Telefon:","Please select object ID...":"Wybierz identyfikator obiektu ...","Prettify the script":"Upiększ skrypt","Print some text in log":"Wydrukuj tekst w dzienniku","Priority:":"Priorytet:",Pushover:T9,Pushsafer:I9,"Read only ID selected: %s":"Wybrano identyfikator tylko do odczytu: %s",Reload:E9,Rename:x9,"Reorder scripts in folders":"Zmień kolejność skryptów w folderach",Repeat:D9,Restart:A9,Result:R9,"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:O9,Saturday:M9,Save:N9,"Save all":"Zapisz wszystko","Say It":"Wypowiedz","Say some text via sayit adapter":"Powiedz tekst przez adapter sayit",Schedule:L9,Script:P9,"Script %s was modified on disk":"Skrypt %s został zmodyfikowany na dysku","Script was modified externally":"Skrypt został zmodyfikowany zewnętrznie","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:B9,"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:j9,"Some files will be rejected":"Niektóre pliki zostaną odrzucone","Sound:":"Dźwięk:",Stack:F9,Start:z9,"Start script":"Uruchom skrypt",State:U9,"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:H9,"Subject:":"Temat:",Sunday:W9,"TS description":"Tworzenie reguł w Typescript",Telegram:G9,"Text:":"Tekst:",Th:V9,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'Skrypt "%s" został zmodyfikowany przez innego użytkownika lub w innym oknie. Czy chcesz przeładować skrypt, czy zachować lokalne zmiany?',"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:K9,Time:Y9,"Time condition":"Warunek czasowy","Title:":"Tytuł:","To:":"Do:","Trigger with value":"Wyzwalacz z wartością",Triggered:J9,Triggers:q9,"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:X9,Tuesday:Z9,URL:Q9,"Unknown error":"Nieznany błąd","Unknown error!":"Nieznany błąd!","User function":"Funkcja użytkownika","User:":"Użytkownik:",Value:eK,"Vibration:":"Wibracja:",Volume:tK,We:sK,Wednesday:oK,"Whatsapp-cmb":"Whatsapp-cmb",Write:iK,"Write your own code":"Napisz swój własny kod",Yes:nK,"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","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:rK,all:aK,and:lK,"as JSON":"jako JSON","as plain text":"jako zwykły tekst",astro:cK,at:uK,"clear running":"czyste uruchomienie",control:dK,copy:hK,cron:pK,dawn:gK,debug_help:mK,debug_label:fK,default:"domyślna",dusk:$K,easy:bK,else:"inaczej","equal to":"równy",every:yK,"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:vK,filter_id:_K,filter_name:wK,filter_role:kK,filter_room:CK,"for edit or create script":"do edycji lub utwórz nowy skrypt","for professionals":"dla profesjonalistów","for programmers":"dla programistów",goldenHour:SK,goldenHourEnd:TK,"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:IK,help_on_change:EK,"high priority":"wysoki priorytet","high-priority":"wysoki priorytet","highest priority":"najwyższy priorytet",hours:xK,includes:DK,interval:AK,"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:RK,milliseconds:OK,minutes:MK,ms:NK,nadir:LK,nauticalDawn:PK,nauticalDusk:BK,nextSunrise:jK,nextSunset:FK,night:zK,nightEnd:UK,"no blocks found":"Nie znaleziono bloków","no group":"BRAK GRUPY",normal:HK,"normal priority":"normalny priorytet","not running":"nie uruchomiony","not equal to":"nie równa się","not properly connected":"Ten blok nie jest poprawnie podłączony do innych bloków.",offset:WK,"on change":"na zmianę","on condition change":"pod warunkiem zmiany warunków","on update":"po aktualizacji",one:GK,or:VK,quiet:KK,"reset search":"zresetuj wyszukiwanie",search:YK,seconds:JK,solarNoon:qK,"store in":"przechowaj w",sunrise:XK,sunriseEnd:ZK,sunset:QK,sunsetStart:e7,then:t7,"toggle value":"wartość przełączania",tooltip_ack:s7,tooltip_from:o7,tooltip_lc:i7,tooltip_quality:n7,tooltip_ts:r7,tooltip_user:a7,tooltip_value:l7,true:"prawda",two:c7,undefined:"nieokreślony",update:u7,"use seconds":"użyj sekund","use trigger value":"użyj wartości wyzwalającej",verbose_help:d7,verbose_label:h7,when:p7,with:"z","with date":"z datą","with offset":"z przesunięciem",wizard:g7,"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:m7,"No running javascript instance found":"Nie znaleziono uruchomionej instancji JavaScript","OID display mode":"Tryb wyświetlania OID","Ask questions about your script, request changes, or generate new code.":"Zadawaj pytania o swój skrypt, proś o zmiany lub generuj nowy kod.","to send":"aby wysłać","Thinking...":"Myślenie...","AI suggested changes":"Zmiany sugerowane przez AI",Accept:f7,Reject:$7,"No API keys configured":"Brak skonfigurowanych kluczy API","for new line":"dla nowej linii","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Tryb: Chat = tylko rozmowa, Agent = może czytać/analizować skrypty, Code = może czytać i modyfikować skrypty","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Wspomnij skrypty jako kontekst dla AI. Użyj @wszystkie dla wszystkich skryptów lub @nazwaSkryptu dla konkretnego.",Context:b7,"current script":"bieżący skrypt","all scripts":"wszystkie skrypty",devices:y7,"Searching datapoints":"Wyszukiwanie punktów danych","Reading value":"Odczyt wartości","Loading object info":"Ładowanie informacji o obiekcie","Searching scripts":"Wyszukiwanie skryptów","Reading script":"Odczyt skryptu","Loading script list":"Ładowanie listy skryptów","All scripts":"Wszystkie skrypty","Smart home devices":"Urządzenia inteligentnego domu","AI Chat":"Czat AI","AI inline completions":"Uzupełnianie w linii AI","New chat":"Nowy czat","Ask about your script...":"Zapytaj o swój skrypt...","Insert blocks":"Wstaw bloki","Apply blocks":"Zastosuj bloki",Undo:v7,Redo:_7,"Insert into editor":"Wstaw do edytora","Show as diff":"Pokaż jako diff","Selected code as context":"Zaznaczony kod jako kontekst","Generating plan...":"Generowanie planu...","Generating code...":"Generowanie kodu...",Plan:w7,"mention @all":"@wszystkie","mention @devices":"@urządzenia",Send:k7,Copy:C7},T7="Reconhecido",I7="Ações",E7="Adicionar",x7="Todos",D7="Nenhum",A7="Aplique",R7="abril",O7="Perguntar",M7="Astronômico",N7="agosto",L7="Cancelar",P7="Fechar",B7="Doença",j7="Condições",F7="Console",z7="Copiado",U7="dezembro",H7="Predefinição",W7="Atraso",G7="Deletar",V7="Descrição",K7="Pronto",Y7="Exec shell",J7="Explicação",q7="Exportação",X7="Februar",Z7="fevereiro",Q7="Filtro",eY="Pasta",tY="Fr",sY="Sexta-feira",oY="ID",iY="ID1",nY="ID2",rY="Importar",aY="Instância",lY="Instâncias",cY="Instruções",uY="Januar",dY="janeiro",hY="julho",pY="junho",gY="Limite",mY="março",fY="maio",$Y="Menu",bY="mensagem",yY="Mo",vY="Modelo",_Y="Segunda-feira",wY="Mês",kY="Mais",CY="Nome",SY="novembro",TY="OK",IY="outubro",EY="Ok",xY="Pausa",DY="Pushover",AY="Pushsafer",RY="Recarregar",OY="Renomear",MY="Repetir",NY="Reiniciar",LY="Resultado",PY="Sá",BY="Sábado",jY="Salve",FY="Cronograma",zY="Script",UY="setembro",HY="Simular",WY="Pilha",GY="Começar",VY="Estado",KY="Su",YY="Domingo",JY="Telegrama",qY="4",XY="Quinta-feira",ZY="Tempo",QY="Provocado",eJ="Gatilhos",tJ="Tu",sJ="terça",oJ="URL",iJ="Valor",nJ="Volume",rJ="3",aJ="quarta",lJ="Escrever",cJ="sim",uJ="reconhecimento",dJ="todos",hJ="e",pJ="astro",gJ="no",mJ="ao controle",fJ="copiar",$J="CRON",bJ="alvorecer",yJ="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.",vJ="Depurar",_J="Crepúsculo",wJ="fácil",kJ="cada",CJ="Função",SJ="ID",TJ="Nome",IJ="Tipo",EJ="Quarto",xJ="Hora dourada",DJ="Fim da hora de ouro",AJ='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.',RJ='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.',OJ="horas",MJ="inclui",NJ="intervalo",LJ="Magia",PJ="milissegundos",BJ="minutos",jJ="ms",FJ="nadir",zJ="Madrugada náutica",UJ="Crepúsculo náutico",HJ="próximo nascer do sol",WJ="Próximo pôr do sol",GJ="Noite",VJ="Fim de noite",KJ="normal",YJ="Deslocamento",JJ="1",qJ="ou",XJ="quieto",ZJ="procurar",QJ="segundos",eq="Meio-dia solar",tq="nascer do sol",sq="Fim do nascer do sol",oq="pôr do sol",iq="Começo do pôr do sol",nq="então",rq="reconhecer",aq="de",lq="Última alteração",cq="Qualidade",uq="timestamp",dq="usuário",hq="valor",pq="dois",gq="atualizar",mq="Adiciona saída de depuração ao log para muitos comandos do sistema",fq="Saídas de log detalhadas",$q="quando",bq="Wizard",yq="Tentar novamente",vq="Aceitar",_q="Rejeitar",wq="Contexto",kq="dispositivos",Cq="Desfazer",Sq="Refazer",Tq="Plano",Iq="Enviar",Eq="Copiar",xq={"%s not found":"%s não encontrado","()":"()","(at %s)":"(em %s)","(optional)":"(opcional)","-":"-",".":".",Ack:T7,Actions:I7,"Actual time of day":"Hora real do dia",Add:E7,"Add new script":"Adicionar novo script",All:x7,"All files will be accepted":"Todos os arquivos serão aceitos",Any:D7,"Any month":"Qualquer mês",Apply:A7,April:R7,"Are you sure?":"Você tem certeza?",Ask:O7,Astronomical:M7,"Astronomical events today":"Eventos astronômicos hoje",August:N7,"Blockly description":"Criando regras por blocos gráficos","Body:":"Corpo:",Cancel:L7,"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:P7,"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:B7,Conditions:j7,"Configuration not saved.":"Configuração não esta salva.",Console:F7,"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:z7,"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:U7,Default:H7,"Define cron...":"Definir cron...","Define schedule...":"Definir agendamento ...",Delay:W7,Delete:G7,"Delete %s":"Deletar %s...","Delete folder":"Deletar pasta","Delete script":"Deletar script",Description:V7,"Deselect all":"Desmarcar todos","Discard changes for %s":"Descartar alterações para %s",Done:K7,"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",Error:"Erro","Error formatting code":"Erro de formatação de código","Error was found":"Erro foi encontrado","Every day":"Todos os dias",Exec:Y7,"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:J7,Export:q7,"Export all scripts":"Exportar todos os scripts","Export blocks":"Exportar blocos","Export selected blocks":"Exportar blocos selecionados",Februar:X7,February:Z7,Filter:Q7,Folder:eY,Fr:tY,Friday:sY,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:oY,ID1:iY,ID2:nY,Import:rY,"Import blocks":"Importar blocos","Import error":"Erro de importação","Import scripts":"Importar script","Insert object ID":"Inserir ID do objeto",Instance:aY,"Instance is disabled":"Instância está desativada","Instance:":"Instância:",Instances:lY,Instructions:cY,"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:uY,January:dY,July:hY,June:pY,"Just check":"Apenas verifique","Keep my changes":"Manter minhas alterações","Language:":"Língua:","Learn More":"Aprender mais","Light style":"Estilo claro",Limit:gY,"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:mY,"March ":"Março",May:fY,Menu:$Y,Message:bY,Mo:yY,Model:vY,Monday:_Y,Month:wY,More:kY,Name:CY,"No active host found":"Nenhum host ativo encontrado","Nothing found":"Nada encontrado",November:SY,OK:TY,October:IY,Ok:EY,"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","Operate two states":"Operar dois estados","Operations with two states":"Operações com dois estados","Paste your blocks here":"Cole seus blocos aqui",Pause:xY,"Pause execution":"Pausar a execução","Pause script":"Pausar script","Phone:":"Telefone:","Please select object ID...":"Selecione o ID do objeto...","Prettify the script":"Embeleze o roteiro","Print some text in log":"Imprimir algum texto no log","Priority:":"Prioridade:",Pushover:DY,Pushsafer:AY,"Read only ID selected: %s":"ID somente leitura selecionada: %s",Reload:RY,Rename:OY,"Reorder scripts in folders":"Reordenar scripts em pastas",Repeat:MY,Restart:NY,Result:LY,"Resume execution":"Retomar execução","Root folder":"Pasta principal","Rules description":"Crie regras com blocos IF, THEN, ELSE","Run script":"Executar script",Sa:PY,Saturday:BY,Save:jY,"Save all":"Salvar tudo","Say It":"Say It","Say some text via sayit adapter":"Diga algum texto através do adaptador sayit",Schedule:FY,Script:zY,"Script %s was modified on disk":'O script "%s" foi modificado no disco rígido',"Script was modified externally":"O script foi modificado externamente","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:UY,"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:HY,"Some files will be rejected":"Alguns arquivos serão rejeitados","Sound:":"Som:",Stack:WY,Start:GY,"Start script":"Iniciar script",State:VY,"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:KY,"Subject:":"Sujeito:",Sunday:YY,"TS description":"Criando regras escrevendo Typecript",Telegram:JY,"Text:":"Texto:",Th:qY,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'O script "%s" foi modificado por outro usuário ou em outra janela. Deseja recarregar o script ou manter suas alterações locais?',"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:XY,Time:ZY,"Time condition":"Condição de tempo","Title:":"Título:","To:":"Para:","Trigger with value":"Trigger com valor",Triggered:QY,Triggers:eJ,"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:tJ,Tuesday:sJ,URL:oJ,"Unknown error":"Erro desconhecido","Unknown error!":"Erro desconhecido!","User function":"Função do usuário","User:":"Do utilizador:",Value:iJ,"Vibration:":"Vibração:",Volume:nJ,We:rJ,Wednesday:aJ,"Whatsapp-cmb":"Whatsapp-cmb",Write:lJ,"Write your own code":"Escreva seu próprio código",Yes:cJ,"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","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:uJ,all:dJ,and:hJ,"as JSON":"como JSON","as plain text":"como texto simples",astro:pJ,at:gJ,"clear running":"corrida limpa",control:mJ,copy:fJ,cron:$J,dawn:bJ,debug_help:yJ,debug_label:vJ,default:"predefinição",dusk:_J,easy:wJ,else:"outro","equal to":"igual a",every:kJ,"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:CJ,filter_id:SJ,filter_name:TJ,filter_role:IJ,filter_room:EJ,"for edit or create script":"para editar ou criar um novo script","for professionals":"para profissionais","for programmers":"para programadores",goldenHour:xJ,goldenHourEnd:DJ,"greater or equal":"maior ou igual","greater or equal to":"maior ou igual a","greater than":"Maior que",help_just_check:AJ,help_on_change:RJ,"high priority":"prioridade máxima","high-priority":"prioridade máxima","highest priority":"Prioridade máxima",hours:OJ,includes:MJ,interval:NJ,"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:LJ,milliseconds:PJ,minutes:BJ,ms:jJ,nadir:FJ,nauticalDawn:zJ,nauticalDusk:UJ,nextSunrise:HJ,nextSunset:WJ,night:GJ,nightEnd:VJ,"no blocks found":"Nenhum bloco encontrado","no group":"SEM GRUPO",normal:KJ,"normal priority":"prioridade normal","not running":"não está em execução","not equal to":"não é igual a","not properly connected":"Este bloco não está conectado corretamente com outros blocos.",offset:YJ,"on change":"em mudança","on condition change":"na mudança de condição","on update":"em atualização",one:JJ,or:qJ,quiet:XJ,"reset search":"redefinir pesquisa",search:ZJ,seconds:QJ,solarNoon:eq,"store in":"armazenar em",sunrise:tq,sunriseEnd:sq,sunset:oq,sunsetStart:iq,then:nq,"toggle value":"valor de alternância",tooltip_ack:rq,tooltip_from:aq,tooltip_lc:lq,tooltip_quality:cq,tooltip_ts:uq,tooltip_user:dq,tooltip_value:hq,true:"verdade",two:pq,undefined:"Indefinido",update:gq,"use seconds":"use segundos","use trigger value":"use o gatilho",verbose_help:mq,verbose_label:fq,when:$q,with:"com","with date":"com data","with offset":"com deslocamento",wizard:bq,"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:yq,"No running javascript instance found":"Nenhuma instância JavaScript em execução encontrada","OID display mode":"Modo de exibição OID","Ask questions about your script, request changes, or generate new code.":"Faça perguntas sobre seu script, solicite alterações ou gere novo código.","to send":"para enviar","Thinking...":"Pensando...","AI suggested changes":"Alterações sugeridas pela IA",Accept:vq,Reject:_q,"No API keys configured":"Nenhuma chave API configurada","for new line":"para nova linha","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Modo: Chat = apenas conversa, Agent = pode ler/analisar scripts, Code = pode ler e modificar scripts","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Mencionar scripts como contexto para a IA. Use @todos para todos os scripts ou @nomeDoScript para um específico.",Context:wq,"current script":"script atual","all scripts":"todos os scripts",devices:kq,"Searching datapoints":"Pesquisando pontos de dados","Reading value":"Lendo valor","Loading object info":"Carregando informações do objeto","Searching scripts":"Pesquisando scripts","Reading script":"Lendo script","Loading script list":"Carregando lista de scripts","All scripts":"Todos os scripts","Smart home devices":"Dispositivos de casa inteligente","AI Chat":"Chat IA","AI inline completions":"Completações em linha IA","New chat":"Novo chat","Ask about your script...":"Pergunte sobre seu script...","Insert blocks":"Inserir blocos","Apply blocks":"Aplicar blocos",Undo:Cq,Redo:Sq,"Insert into editor":"Inserir no editor","Show as diff":"Mostrar como diff","Selected code as context":"Código selecionado como contexto","Generating plan...":"Gerando plano...","Generating code...":"Gerando código...",Plan:Tq,"mention @all":"@todos","mention @devices":"@dispositivos",Send:Iq,Copy:Eq},Dq="Подтверждение",Aq="Действия",Rq="Добавить",Oq="Все",Mq="Любая",Nq="Применить",Lq="Апрель",Pq="Спросить",Bq="Aстрономический",jq="Август",Fq="Отмена",zq="Закрыть",Uq="Условие",Hq="Условия",Wq="Приставка",Gq="Скопировано",Vq="Декабрь",Kq="Дефолт",Yq="Задержка",Jq="Удалить",qq="Описание",Xq="Готово",Zq="Исполнить shell",Qq="Объяснение",eX="Экспорт",tX="Февраль",sX="Февраль",oX="Фильтр",iX="Папка",nX="Пт",rX="пятница",aX="ID",lX="ID1",cX="ID2",uX="Импорт",dX="Экземпляр",hX="Экземпляры",pX="Инструкции",gX="Январь",mX="Январь",fX="Июль",$X="Июнь",bX="Предел",yX="Март",vX="Май",_X="Меню",wX="Сообщение",kX="Пн",CX="Модель",SX="понедельник",TX="Месяц",IX="Более",EX="Имя",xX="Ноябрь",DX="Ок",AX="Октябрь",RX="Ok",OX="Пауза",MX="Pushover",NX="Pushsafer",LX="Перезагрузить",PX="Переименовать",BX="Повторение",jX="Перезапустить",FX="Результат",zX="Сб",UX="суббота",HX="Сохранить",WX="Расписание",GX="скрипт",VX="Сентябрь",KX="Симулировать",YX="Stack",JX="Начинать",qX="Состояние",XX="Вс",ZX="Воскресенье",QX="Telegram",eZ="Чт",tZ="Четверг",sZ="Время",oZ="Срабатывает",iZ="Триггеры",nZ="Вт",rZ="вторник",aZ="URL",lZ="Значение",cZ="Громкость",uZ="Ср",dZ="среда",hZ="Напишите",pZ="Да",gZ="подтверждение",mZ="все",fZ="и",$Z="Астро",bZ="в",yZ="контроль",vZ="копия",_Z="CRON",wZ="Рассвет",kZ="Это особый режим, в котором состояния и объекты не будут меняться. Но в протоколе будет отображаться только информация о каждом планируемом изменении.",CZ="Отлаживать",SZ="Сумерки",TZ="легкий",IZ="каждые(ый)",EZ="Функция",xZ="ID",DZ="Название",AZ="Роль",RZ="Комната",OZ="Золотой час",MZ="Конец золотого часа",NZ="Код будет выполняться только каждый раз, когда условие истинно. Например. при срабатывании по значению датчика температуры и условию «если температура выше 20°C», действия «затем» будут выполняться каждый раз, когда датчик отправляет значение температуры, и оно превышает 20°C. На 21°С, на 22°С и так далее.",LZ="Код будет выполнен только в случае изменения результата условия. Например, при срабатывании по значению датчика температуры и условию «если температура больше 20°C», действия «затем» будут выполнены один раз, когда температура превысит 20°C. В следующий раз действия «затем» будут выполнены, когда температура опустится ниже 20°C, а затем снова поднимается выше 20°C.",PZ="час(ов)",BZ="содержит",jZ="интервал",FZ="магия",zZ="миллисекунды",UZ="минут(у)",HZ="мс",WZ="Надир",GZ="Морской рассвет",VZ="Морские сумерки",KZ="Следующий восход",YZ="Следующий закат",JZ="Ночь",qZ="Конец ночи",XZ="нормальный",ZZ="сдвиг",QZ="один",eQ="или",tQ="тихий",sQ="поиск",oQ="секунд",iQ="Солнечный полдень",nQ="Восход солнца",rQ="Конец восхода",aQ="Закат солнца",lQ="Начало заката",cQ="тогда",uQ="Подтверждено",dQ="От",hQ="Последнее изменение",pQ="Качественный",gQ="Время",mQ="Пользователь",fQ="Значение",$Q="два",bQ="обновить",yQ="Добавляет вывод отладки в журнал для многих системных команд.",vQ="Подробный протокол",_Q="если",wQ="Мастер",kQ="Повторить",CQ="Принять",SQ="Отклонить",TQ="Контекст",IQ="устройства",EQ="Отменить",xQ="Повторить",DQ="План",AQ="Отправить",RQ="Копировать",OQ={"%s not found":"%s не найден","()":"()","(at %s)":"(в %s)","(optional)":"(необязательный)","-":"-",".":".",Ack:Dq,Actions:Aq,"Actual time of day":"Фактическое время суток",Add:Rq,"Add new script":"Добавить новый скрипт",All:Oq,"All files will be accepted":"Все файлы будут приняты",Any:Mq,"Any month":"В любой месяц",Apply:Nq,April:Lq,"Are you sure?":"Вы уверены?",Ask:Pq,Astronomical:Bq,"Astronomical events today":"Астрономические события сегодня",August:jq,"Blockly description":"Создание правил графическими блоками","Body:":"Тело:",Cancel:Fq,"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:zq,"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:Uq,Conditions:Hq,"Configuration not saved.":"Конфигурация не сохранена.",Console:Wq,"Control or update some state":"Контролировать или обновлять какое-то состояние","Control or update some state with delay":"Контролировать или обновлять какое-либо состояние с задержкой","Convert blockly to javascript for ever.":"Преобразовать blockly в Javascript навсегда.",Copied:Gq,"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:Vq,Default:Kq,"Define cron...":"Задать правило ...","Define schedule...":"Задать расписание...",Delay:Yq,Delete:Jq,"Delete %s":"Удалить %s...","Delete folder":"Удалить папку","Delete script":"Удалить скрипт",Description:qq,"Deselect all":"Снять выбор со всех","Discard changes for %s":"Отменить изменения для %s",Done:Xq,"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":"Закончить поиск",Error:"Ошибка","Error formatting code":"Ошибка форматирования кода","Error was found":"Ошибка была найдена","Every day":"Каждый день",Exec:Zq,"Executes some shell command":"Выполняет некоторую команду оболочки","Existing scripts will be overwritten.":"Существующие скрипты будут перезаписаны.","Expand all":"Открыть все","Expert mode":"Экспертный режим",Explanation:Qq,Export:eX,"Export all scripts":"Экспорт всех скриптов","Export blocks":"Экспортировать блоки","Export selected blocks":"Экспортировать выбранные блоки",Februar:tX,February:sX,Filter:oX,Folder:iX,Fr:nX,Friday:rX,Function:"Функция","Function editor":"Редактор функции","Function: executed":"Функция: выполнено","Go to next line":"Перейти к следующей строке","HTTP Call":"HTTP-вызов","Hide logs":"Скрыть журналы",ID:aX,ID1:lX,ID2:cX,Import:uX,"Import blocks":"Импортировать блоки","Import error":"Ошибка импорта","Import scripts":"Импорт скриптов","Insert object ID":"Вставить ID объекта",Instance:dX,"Instance is disabled":"Экземпляр отключен","Instance:":"Пример:",Instances:hX,Instructions:pX,"Invalid CRON":"Неправильный CRON","It will not be possible to revert this operation.":"Невозможно вернуть эту операцию.","JS description":"Создание правил путём написания Javascript",Januar:gX,January:mX,July:fX,June:$X,"Just check":"Просто проверить","Keep my changes":"Сохранить мои изменения","Language:":"Язык:","Learn More":"Узнать больше","Light style":"Светлый стиль",Limit:bX,"Local time":"Местное время","Locate file":"Показать файл в дереве","Log outputs":"Журнал","Log text":"Текст журнала","Log: %s":"Журнал: %s","Make a HTTP get request":"Сделайте HTTP-запрос на получение","Make a pause between actions":"Сделайте паузу между действиями",March:yX,"March ":"Март ",May:vX,Menu:_X,Message:wX,Mo:kX,Model:CX,Monday:SX,Month:TX,More:IX,Name:EX,"No active host found":"Активный host не найден","Nothing found":"Ничего не найдено",November:xX,OK:DX,October:AX,Ok:RX,"On condition change":"При изменении реузльтата условий","On script save or adapter start":"При сохранении скрипта или запуске адаптера","On weekdays":"По дням недели","Operate two states":"Операции над двумя состояниями","Operations with two states":"Операции с двумя состояниями","Paste your blocks here":"Вставьте свои блоки сюда",Pause:OX,"Pause execution":"Приостановить выполнение","Pause script":"Остановить скрипт","Phone:":"Телефон:","Please select object ID...":"Пожалуйста, выберите ID объекта ...","Prettify the script":"Украсьте сценарий","Print some text in log":"Напечатать текст в журнале","Priority:":"Приоритет:",Pushover:MX,Pushsafer:NX,"Read only ID selected: %s":"Выбран идентификатор только для чтения: %s",Reload:LX,Rename:PX,"Reorder scripts in folders":"Сортировать скрипты в папках",Repeat:BX,Restart:jX,Result:FX,"Resume execution":"Возобновить выполнение","Root folder":"Корневая папка","Rules description":"Создавайте правила с блоками ЕСЛИ, ТО, ИНАЧЕ","Run script":"Запустить скрипт",Sa:zX,Saturday:UX,Save:HX,"Save all":"Сохранить все","Say It":"Say It","Say some text via sayit adapter":"Произнесите текст через адаптер Sayit",Schedule:WX,Script:GX,"Script %s was modified on disk":'Скрипт "%s" был изменен на диске',"Script was modified externally":"Скрипт был изменён извне","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:VX,"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:KX,"Some files will be rejected":"Некоторые файлы будут отклонены","Sound:":"Звук:",Stack:YX,Start:JX,"Start script":"Старт скрипта",State:qX,"State condition":"Сравнение состояния","Step into function":"Шаг в функционирование","Step out from function":"Выйти из функции","Stop on exception":"Остановить при исключении",Su:XX,"Subject:":"Предмет:",Sunday:ZX,"TS description":"Создание правил путём написания Typescript",Telegram:QX,"Text:":"Текст:",Th:eZ,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'Скрипт "%s" был изменён другим пользователем или в другом окне. Вы хотите перезагрузить скрипт или сохранить свои локальные изменения?',"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:tZ,Time:sZ,"Time condition":"Условие времени","Title:":"Заголовок:","To:":"К:","Trigger with value":"Триггер со значением",Triggered:oZ,Triggers:iZ,"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:nZ,Tuesday:rZ,URL:aZ,"Unknown error":"Неизвестная ошибка","Unknown error!":"Неизвестная ошибка!","User function":"Функция пользователя","User:":"Пользователь:",Value:lZ,"Vibration:":"Вибрация:",Volume:cZ,We:uZ,Wednesday:dZ,"Whatsapp-cmb":"Whatsapp-cmb",Write:hZ,"Write your own code":"Напишите свой код",Yes:pZ,"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, чтобы использовать старое значение триггера.","Please select a valid model":"Пожалуйста, выберите допустимую модель","[equal]":"[равно]","[greater or equal]":"[больше или равно]","[greater]":"[больше]","[hysteresis]":"[гистерезис]","[includes]":"[содержит]","[less or equal]":"[меньше или равно]","[less]":"[меньше]","[not equal]":"[не равно]",acknowledgment:gZ,all:mZ,and:fZ,"as JSON":"как JSON","as plain text":"как текст",astro:$Z,at:bZ,"clear running":"остановить уже бегущие",control:yZ,copy:vZ,cron:_Z,dawn:wZ,debug_help:kZ,debug_label:CZ,default:"дефолт",dusk:SZ,easy:TZ,else:"иначе","equal to":"равно",every:IZ,"every hour at 0 minutes":"каждый час через 0 минут",false:"false","file reading has failed: %s":"Ошибка чтения файла: %s","file reading was aborted":"Чтение файла было прервано",filter_func:EZ,filter_id:xZ,filter_name:DZ,filter_role:AZ,filter_room:RZ,"for edit or create script":"для редактирования или создайте новый скрипт","for professionals":"для профессионалов","for programmers":"для программистов",goldenHour:OZ,goldenHourEnd:MZ,"greater or equal":"больше или равно","greater or equal to":"больше или равно","greater than":"больше чем",help_just_check:NZ,help_on_change:LZ,"high priority":"высокий приоритет","high-priority":"высокий-приоритет","highest priority":"высший приоритет",hours:PZ,includes:BZ,interval:jZ,"just check":"просто проверить","less or equal":"меньше или равно","less or equal to":"меньше или равно","less than":"меньше, чем","lower priority":"более низкий приоритет","lowest priority":"самый низкий приоритет",magic:FZ,milliseconds:zZ,minutes:UZ,ms:HZ,nadir:WZ,nauticalDawn:GZ,nauticalDusk:VZ,nextSunrise:KZ,nextSunset:YZ,night:JZ,nightEnd:qZ,"no blocks found":"Блоков нет","no group":"Нет группы",normal:XZ,"normal priority":"нормальный приоритет","not running":"не запущен","not equal to":"не равно","not properly connected":"Этот блок неправильно соединён или не соединён с другими блоками.",offset:ZZ,"on change":"по изменению","on condition change":"при изменении результата условия","on update":"при обновлении",one:QZ,or:eQ,quiet:tQ,"reset search":"Cбросить поиск",search:sQ,seconds:oQ,solarNoon:iQ,"store in":"сохранить в",sunrise:nQ,sunriseEnd:rQ,sunset:aQ,sunsetStart:lQ,then:cQ,"toggle value":"инвертировать текщее значение",tooltip_ack:uQ,tooltip_from:dQ,tooltip_lc:hQ,tooltip_quality:pQ,tooltip_ts:gQ,tooltip_user:mQ,tooltip_value:fQ,true:"true",two:$Q,undefined:"неопределенный",update:bQ,"use seconds":"использовать секунды","use trigger value":"использовать значение триггера",verbose_help:yQ,verbose_label:vQ,when:_Q,with:"с","with date":"с датой","with offset":"со сдвигом",wizard:wQ,"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:kQ,"No running javascript instance found":"Не найден работающий экземпляр JavaScript","OID display mode":"Режим отображения OID","Ask questions about your script, request changes, or generate new code.":"Задавайте вопросы о вашем скрипте, запрашивайте изменения или генерируйте новый код.","to send":"для отправки","Thinking...":"Думаю...","AI suggested changes":"Изменения, предложенные ИИ",Accept:CQ,Reject:SQ,"No API keys configured":"API-ключи не настроены","for new line":"для новой строки","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Режим: Chat = только разговор, Agent = может читать/анализировать скрипты, Code = может читать и изменять скрипты","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Упомяните скрипты как контекст для ИИ. Используйте @все для всех скриптов или @имяСкрипта для конкретного.",Context:TQ,"current script":"текущий скрипт","all scripts":"все скрипты",devices:IQ,"Searching datapoints":"Поиск точек данных","Reading value":"Чтение значения","Loading object info":"Загрузка информации об объекте","Searching scripts":"Поиск скриптов","Reading script":"Чтение скрипта","Loading script list":"Загрузка списка скриптов","All scripts":"Все скрипты","Smart home devices":"Устройства умного дома","AI Chat":"ИИ Чат","AI inline completions":"ИИ автодополнение","New chat":"Новый чат","Ask about your script...":"Спросите о вашем скрипте...","Insert blocks":"Вставить блоки","Apply blocks":"Применить блоки",Undo:EQ,Redo:xQ,"Insert into editor":"Вставить в редактор","Show as diff":"Показать как diff","Selected code as context":"Выбранный код как контекст","Generating plan...":"Создание плана...","Generating code...":"Генерация кода...",Plan:DQ,"mention @all":"@все","mention @devices":"@устройства",Send:AQ,Copy:RQ},MQ="Визнано",NQ="Дії",LQ="додати",PQ="все",BQ="Будь-який",jQ="Застосувати",FQ="квітень",zQ="Запитуйте",UQ="Астрономічний",HQ="серпень",WQ="Скасувати",GQ="Закрити",VQ="Хвороба",KQ="Умови",YQ="Консоль",JQ="Скопійовано",qQ="Грудень",XQ="За замовчуванням",ZQ="Затримка",QQ="Видалити",eee="опис",tee="Готово",see="Виконавча оболонка",oee="Пояснення",iee="Експорт",nee="Лютий",ree="Лютий",aee="фільтр",lee="Папка",cee="О",uee="П'ятниця",dee="ID",hee="ID1",pee="ID2",gee="Імпорт",mee="Екземпляр",fee="Примірники",$ee="Інструкції",bee="січень",yee="січня",vee="липень",_ee="червень",wee="Ліміт",kee="березень",Cee="Може",See="Меню",Tee="повідомлення",Iee="пн",Eee="Модель",xee="понеділок",Dee="місяць",Aee="Більше",Ree="Ім'я",Oee="Листопад",Mee="в порядку",Nee="жовтень",Lee="В порядку",Pee="Пауза",Bee="Pushover",jee="Pushsafer",Fee="Перезавантажити",zee="Перейменувати",Uee="Повторіть",Hee="Перезапустіть",Wee="Результат",Gee="Sa",Vee="Субота",Kee="зберегти",Yee="розклад",Jee="Сценарій",qee="Вересень",Xee="Симулювати",Zee="Стек",Qee="старт",ete="Держава",tte="Нд",ste="неділя",ote="Телеграма",ite="чт",nte="четвер",rte="час",ate="Спрацьовує",lte="Тригери",cte="вт",ute="вівторок",dte="URL",hte="Значення",pte="Обсяг",gte="ми",mte="Середа",fte="Напишіть",$te="Так",bte="підтвердження",yte="все",vte="і",_te="Астро",wte="в",kte="КОНТРОЛЬ",Cte="копія",Ste="CRON",Tte="Світанок",Ite="Це особливий режим, в якому стану та об'єкти не змінюватимуться. Але в протоколі відображатиметься лише інформація про кожну заплановану зміну.",Ete="Відлагоджувати",xte="Сутінки",Dte="легко",Ate="кожен",Rte="функція",Ote="ID",Mte="Ім'я",Nte="Роль",Lte="Кімната",Pte="Золота година",Bte="Кінець золотої години",jte="Код буде виконуватися лише щоразу, коли умова виконується. наприклад якщо спрацьовує значення датчика температури та умова «якщо температура перевищує 20°C», дії «тоді» виконуватимуться щоразу, коли датчик надсилає температуру, і вона перевищує 20°C. На 21°C, на 22°C і так далі.",Fte="Код буде виконано лише у разі зміни результату умови. наприклад якщо спрацьовує значення датчика температури та умова «якщо температура перевищує 20°C», дії «тоді» будуть виконані один раз, коли температура буде вище 20. Наступного разу дії «тоді» буде виконано, коли температура падає нижче 20, а потім знову піднімається вище 20.",zte="години",Ute="включає в себе",Hte="інтервал",Wte="магія",Gte="мілісекунд",Vte="хвилин",Kte="РС",Yte="Надір",Jte="Морський світанок",qte="Морські сутінки",Xte="Наступний схід сонця",Zte="Наступний захід сонця",Qte="ніч",ese="Кінець ночі",tse="нормально",sse="зсув",ose="один",ise="або",nse="тихо",rse="пошук",ase="секунд",lse="Сонячний полудень",cse="схід сонця",use="Кінець сходу сонця",dse="Захід сонця",hse="Початок заходу сонця",pse="потім",gse="Визнати",mse="Від",fse="Востаннє змінено",$se="якість",bse="Мітка часу",yse="Користувач",vse="Значення",_se="два",wse="оновлення",kse="Додає вихідні дані налагодження до журналу для багатьох системних команд",Cse="Докладні результати журналу",Sse="коли",Tse="майстер",Ise="Повторити",Ese="Прийняти",xse="Відхилити",Dse="Контекст",Ase="пристрої",Rse="Скасувати",Ose="Повторити",Mse="План",Nse="Надіслати",Lse="Копіювати",Pse={"%s not found":"%s не знайдено","()":"()","(at %s)":"(у %s)","(optional)":"(необов'язково)","-":"-",".":".",Ack:MQ,Actions:NQ,"Actual time of day":"Фактичний час доби",Add:LQ,"Add new script":"Додати новий сценарій",All:PQ,"All files will be accepted":"Усі файли будуть прийняті",Any:BQ,"Any month":"Будь-який місяць",Apply:jQ,April:FQ,"Are you sure?":"Ти впевнений?",Ask:zQ,Astronomical:UQ,"Astronomical events today":"Астрономічні події сьогодні",August:HQ,"Blockly description":"Створення правил за графічними блоками","Body:":"Тіло:",Cancel:WQ,"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:GQ,"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:VQ,Conditions:KQ,"Configuration not saved.":"Конфігурація не збережена.",Console:YQ,"Control or update some state":"Контролюйте або оновлюйте певний стан","Control or update some state with delay":"Контролюйте або оновлюйте деякий стан із затримкою","Convert blockly to javascript for ever.":"Назавжди конвертуйте Blockly у Javascript.",Copied:JQ,"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:qQ,Default:XQ,"Define cron...":"Визначити cron...","Define schedule...":"Визначити розклад...",Delay:ZQ,Delete:QQ,"Delete %s":"Видалити %s...","Delete folder":"Видалити папку","Delete script":"Видалити сценарій",Description:eee,"Deselect all":"Зняти вибір із усіх","Discard changes for %s":"Скасувати зміни для %s",Done:tee,"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":"Завершити режим пошуку",Error:"Помилка","Error formatting code":"Помилка форматування коду","Error was found":"Виявлено помилку","Every day":"Кожен день",Exec:see,"Executes some shell command":"Виконує певну команду оболонки","Existing scripts will be overwritten.":"Існуючі сценарії буде перезаписано.","Expand all":"Розгорнути все","Expert mode":"Експертний режим",Explanation:oee,Export:iee,"Export all scripts":"Експортувати всі сценарії","Export blocks":"Експорт блоків","Export selected blocks":"Експортувати вибрані блоки",Februar:nee,February:ree,Filter:aee,Folder:lee,Fr:cee,Friday:uee,Function:"функція","Function editor":"Редактор функцій","Function: executed":"Функція: виконано","Go to next line":"Перейти до наступного рядка","HTTP Call":"Виклик HTTP","Hide logs":"Приховати журнали",ID:dee,ID1:hee,ID2:pee,Import:gee,"Import blocks":"Імпорт блоків","Import error":"Помилка імпорту","Import scripts":"Імпорт скриптів","Insert object ID":"Вставте ID об'єкта",Instance:mee,"Instance is disabled":"Примірник вимкнено","Instance:":"екземпляр:",Instances:fee,Instructions:$ee,"Invalid CRON":"Недійсний CRON","It will not be possible to revert this operation.":"Скасувати цю операцію буде неможливо.","JS description":"Створення правил шляхом написання Javascript",Januar:bee,January:yee,July:vee,June:_ee,"Just check":"Просто перевірте","Keep my changes":"Зберегти мої зміни","Language:":"Мову:","Learn More":"Вивчайте більше","Light style":"Легкий стиль",Limit:wee,"Local time":"Місцевий час","Locate file":"Знайти файл","Log outputs":"Виходи журналу","Log text":"Текст журналу","Log: %s":"Журнал: %s","Make a HTTP get request":"Зробіть HTTP-запит на отримання","Make a pause between actions":"Між діями робіть паузу",March:kee,"March ":"березень",May:Cee,Menu:See,Message:Tee,Mo:Iee,Model:Eee,Monday:xee,Month:Dee,More:Aee,Name:Ree,"No active host found":"Активний хост не знайдено","Nothing found":"Нічого не знайдено",November:Oee,OK:Mee,October:Nee,Ok:Lee,"On condition change":"За умови зміни результату","On script save or adapter start":"Під час збереження сценарію або запуску адаптера","On weekdays":"В будні дні","Operate two states":"Керуйте двома станами","Operations with two states":"Операції з двома станами","Paste your blocks here":"Вставте сюди свої блоки",Pause:Pee,"Pause execution":"Призупинити виконання","Pause script":"Призупинити сценарій","Phone:":"телефон:","Please select object ID...":"Виберіть ідентифікатор об'єкта...","Prettify the script":"Прикрасьте сценарій","Print some text in log":"Надрукувати текст у журналі","Priority:":"Пріоритет:",Pushover:Bee,Pushsafer:jee,"Read only ID selected: %s":"Вибрано ідентифікатор лише для читання: %s",Reload:Fee,Rename:zee,"Reorder scripts in folders":"Зміна порядку сценаріїв у папках",Repeat:Uee,Restart:Hee,Result:Wee,"Resume execution":"Відновити виконання","Root folder":"Коренева папка","Rules description":"Створюйте правила з блоками IF, THEN, ELSE","Run script":"Запустіть сценарій",Sa:Gee,Saturday:Vee,Save:Kee,"Save all":"Зберегти все","Say It":"Скажи це","Say some text via sayit adapter":"Скажіть текст через адаптер sayit",Schedule:Yee,Script:Jee,"Script %s was modified on disk":"Сценарій %s змінено на диску","Script was modified externally":"Скрипт було змінено ззовні","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:qee,"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:Xee,"Some files will be rejected":"Деякі файли буде відхилено","Sound:":"звук:",Stack:Zee,Start:Qee,"Start script":"Запустити сценарій",State:ete,"State condition":"Стан стану","Step into function":"Крок у функції","Step out from function":"Вийти з функції","Stop on exception":"Зупинка на винятках",Su:tte,"Subject:":"Тема:",Sunday:ste,"TS description":"Створення правил шляхом написання Typescript",Telegram:ote,"Text:":"Текст:",Th:ite,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'Скрипт "%s" було змінено іншим користувачем або в іншому вікні. Бажаєте перезавантажити скрипт чи зберегти свої локальні зміни?',"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:nte,Time:rte,"Time condition":"Умова часу","Title:":"Назва:","To:":"до:","Trigger with value":"Тригер зі значенням",Triggered:ate,Triggers:lte,"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:cte,Tuesday:ute,URL:dte,"Unknown error":"Невідома помилка","Unknown error!":"Невідома помилка!","User function":"Функція користувача","User:":"Користувач:",Value:hte,"Vibration:":"Вібрація:",Volume:pte,We:gte,Wednesday:mte,"Whatsapp-cmb":"Whatsapp-cmb",Write:fte,"Write your own code":"Напишіть власний код",Yes:$te,"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, щоб використовувати старе значення тригера","Please select a valid model":"Будь ласка, виберіть дійсну модель","[equal]":"[рівний]","[greater or equal]":"[більше або дорівнює]","[greater]":"[більший]","[hysteresis]":"[гістерезис]","[includes]":"[включає]","[less or equal]":"[менше або рівно]","[less]":"[менше]","[not equal]":"[не дорівнює]",acknowledgment:bte,all:yte,and:vte,"as JSON":"як JSON","as plain text":"як текст",astro:_te,at:wte,"clear running":"чіткий біг",control:kte,copy:Cte,cron:Ste,dawn:Tte,debug_help:Ite,debug_label:Ete,default:"за замовчуванням",dusk:xte,easy:Dte,else:"інше","equal to":"дорівнює",every:Ate,"every hour at 0 minutes":"щогодини о 0 хвилин",false:"помилковий","file reading has failed: %s":"не вдалося прочитати файл: %s","file reading was aborted":"читання файлу було перервано",filter_func:Rte,filter_id:Ote,filter_name:Mte,filter_role:Nte,filter_room:Lte,"for edit or create script":"для редагування або створення нового сценарію","for professionals":"для професіоналів","for programmers":"для програмістів",goldenHour:Pte,goldenHourEnd:Bte,"greater or equal":"більший або рівний","greater or equal to":"більше або дорівнює","greater than":"більше, ніж, величніше ніж, крутіший за",help_just_check:jte,help_on_change:Fte,"high priority":"високий пріоритет","high-priority":"високий пріоритет","highest priority":"найвищий пріоритет",hours:zte,includes:Ute,interval:Hte,"just check":"просто перевірте","less or equal":"менше або дорівнює","less or equal to":"менше або дорівнює","less than":"менше ніж","lower priority":"нижчий пріоритет","lowest priority":"найнижчий пріоритет",magic:Wte,milliseconds:Gte,minutes:Vte,ms:Kte,nadir:Yte,nauticalDawn:Jte,nauticalDusk:qte,nextSunrise:Xte,nextSunset:Zte,night:Qte,nightEnd:ese,"no blocks found":"Блоків не знайдено","no group":"НЕМАЄ ГРУПИ",normal:tse,"normal priority":"нормальний пріоритет","not running":"не запущено","not equal to":"не дорівнює","not properly connected":"Цей блок неправильно з’єднаний з іншими блоками.",offset:sse,"on change":"на зміну","on condition change":"про зміну умов","on update":"на оновлення",one:ose,or:ise,quiet:nse,"reset search":"скинути пошук",search:rse,seconds:ase,solarNoon:lse,"store in":"зберігати в",sunrise:cse,sunriseEnd:use,sunset:dse,sunsetStart:hse,then:pse,"toggle value":"значення перемикання",tooltip_ack:gse,tooltip_from:mse,tooltip_lc:fse,tooltip_quality:$se,tooltip_ts:bse,tooltip_user:yse,tooltip_value:vse,true:"правда",two:_se,undefined:"невизначений",update:wse,"use seconds":"використовуйте секунди","use trigger value":"використовувати значення тригера",verbose_help:kse,verbose_label:Cse,when:Sse,with:"з","with date":"з датою","with offset":"зі зміщенням",wizard:Tse,"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:Ise,"No running javascript instance found":"Не знайдено запущеного екземпляра JavaScript","OID display mode":"Режим відображення OID","Ask questions about your script, request changes, or generate new code.":"Задавайте питання про ваш скрипт, запитуйте зміни або генеруйте новий код.","to send":"для надсилання","Thinking...":"Думаю...","AI suggested changes":"Зміни, запропоновані ШІ",Accept:Ese,Reject:xse,"No API keys configured":"API-ключі не налаштовані","for new line":"для нового рядка","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"Режим: Chat = лише розмова, Agent = може читати/аналізувати скрипти, Code = може читати та змінювати скрипти","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"Згадайте скрипти як контекст для ШІ. Використовуйте @всі для всіх скриптів або @назваСкрипта для конкретного.",Context:Dse,"current script":"поточний скрипт","all scripts":"усі скрипти",devices:Ase,"Searching datapoints":"Пошук точок даних","Reading value":"Читання значення","Loading object info":"Завантаження інформації про об'єкт","Searching scripts":"Пошук скриптів","Reading script":"Читання скрипта","Loading script list":"Завантаження списку скриптів","All scripts":"Усі скрипти","Smart home devices":"Пристрої розумного дому","AI Chat":"ШІ Чат","AI inline completions":"ШІ автодоповнення","New chat":"Новий чат","Ask about your script...":"Запитайте про ваш скрипт...","Insert blocks":"Вставити блоки","Apply blocks":"Застосувати блоки",Undo:Rse,Redo:Ose,"Insert into editor":"Вставити в редактор","Show as diff":"Показати як diff","Selected code as context":"Вибраний код як контекст","Generating plan...":"Створення плану...","Generating code...":"Генерація коду...",Plan:Mse,"mention @all":"@усі","mention @devices":"@пристрої",Send:Nse,Copy:Lse},Bse="确认",jse="动作",Fse="添加",zse="所有",Use="任何",Hse="申请",Wse="四月",Gse="问",Vse="天文",Kse="八月",Yse="取消",Jse="关闭",qse="健康)状况",Xse="情况",Zse="安慰",Qse="复制的",eoe="十二月",toe="默认",soe="延迟",ooe="删除",ioe="描述",noe="完成",roe="执行力",aoe="解释",loe="导出",coe="二月",uoe="二月",doe="筛选",hoe="文件夹",poe="r",goe="星期五",moe="ID",foe="ID1",$oe="ID2",boe="导入",yoe="实例",voe="实例",_oe="指示",woe="亚努尔",koe="一月",Coe="七月",Soe="六月",Toe="限制",Ioe="三月",Eoe="五月",xoe="菜单",Doe="信息",Aoe="莫",Roe="模型",Ooe="星期一",Moe="月",Noe="更多的",Loe="名称",Poe="十一月",Boe="好的",joe="十月",Foe="确定",zoe="暂停",Uoe="俯卧撑",Hoe="推安全",Woe="重新加载",Goe="重命名",Voe="重复",Koe="重启",Yoe="结果",Joe="萨",qoe="星期六",Xoe="保存",Zoe="日程",Qoe="脚本",eie="九月",tie="模拟",sie="堆",oie="开始",iie="状态",nie="苏",rie="星期日",aie="电报",lie="4",cie="星期四",uie="时间",die="触发",hie="扳机",pie="涂",gie="星期二",mie="网址",fie="价值",$ie="体积",bie="3",yie="星期三",vie="写",_ie="是的",wie="致谢",kie="全部",Cie="和",Sie="天文",Tie="在",Iie="控制",Eie="复制",xie="克朗",Die="黎明",Aie="这是一种特殊模式,其中状态和对象不会改变。但只有有关每个计划更改的信息才会显示在协议中。",Rie="调试",Oie="黄昏",Mie="简单的",Nie="每一个",Lie="功能",Pie="ID",Bie="名字",jie="角色",Fie="房间",zie="黄金时段",Uie="黄金时段结束",Hie="仅在条件为真时才执行代码。例如。如果触发温度传感器值并且条件为“如果温度大于20°C”,则每次传感器发送温度且温度超过20°C时,将执行“然后”动作。 21°C,22°C等。",Wie="仅当条件结果更改时,代码才会执行。例如。如果触发温度传感器值且条件为“如果温度大于20°C”,则温度超过20时将执行一次“则”动作,下一次,当温度超过20时将执行“则”动作低于20失败,然后再次超过20。",Gie="小时",Vie="包括",Kie="间隔",Yie="魔法",Jie="毫秒",qie="分钟",Xie="毫秒",Zie="最低点",Qie="航海黎明",ene="航海黄昏",tne="下一个日出",sne="下一个日落",one="夜晚",ine="夜晚结束",nne="普通的",rne="抵消",ane="一",lne="或",cne="安静的",une="搜索",dne="秒",hne="星期日正午",pne="日出",gne="日出结束",mne="日落",fne="日落开始",$ne="然后",bne="确认",yne="从",vne="上一次改变",_ne="质量",wne="时间戳",kne="用户",Cne="值",Sne="二",Tne="更新",Ine="将调试输出添加到许多系统命令的日志中",Ene="详细日志输出",xne="什么时候",Dne="巫师",Ane="重试",Rne="接受",One="拒绝",Mne="上下文",Nne="设备",Lne="撤销",Pne="重做",Bne="计划",jne="发送",Fne="复制",zne={"%s not found":"%s 未找到","()":"()","(at %s)":"(在 %s)","(optional)":"(选修的)","-":"-",".":".",Ack:Bse,Actions:jse,"Actual time of day":"一天中的实际时间",Add:Fse,"Add new script":"添加新脚本",All:zse,"All files will be accepted":"所有文件都将被接受",Any:Use,"Any month":"任何月份",Apply:Hse,April:Wse,"Are you sure?":"你确定吗?",Ask:Gse,Astronomical:Vse,"Astronomical events today":"今天的天文事件",August:Kse,"Blockly description":"按图形块创建规则","Body:":"身体:",Cancel:Yse,"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:Jse,"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:qse,Conditions:Xse,"Configuration not saved.":"配置未保存。",Console:Zse,"Control or update some state":"控制或更新某些状态","Control or update some state with delay":"延迟控制或更新某些状态","Convert blockly to javascript for ever.":"立即将blockly转换为Javascript。",Copied:Qse,"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:eoe,Default:toe,"Define cron...":"定义周期任务...","Define schedule...":"定义调度器......",Delay:soe,Delete:ooe,"Delete %s":"删除%s...","Delete folder":"删除文件夹","Delete script":"删除脚本",Description:ioe,"Deselect all":"取消全选","Discard changes for %s":"放弃%s的更改",Done:noe,"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":"结束搜索模式",Error:"错误","Error formatting code":"代码格式错误","Error was found":"发现错误","Every day":"每天",Exec:roe,"Executes some shell command":"执行一些shell命令","Existing scripts will be overwritten.":"现有脚本将被覆盖。","Expand all":"展开全部","Expert mode":"专家模式",Explanation:aoe,Export:loe,"Export all scripts":"导出所有脚本","Export blocks":"导出块","Export selected blocks":"导出选定的块",Februar:coe,February:uoe,Filter:doe,Folder:hoe,Fr:poe,Friday:goe,Function:"功能","Function editor":"功能编辑器","Function: executed":"功能:执行","Go to next line":"转到下一行","HTTP Call":"HTTP呼叫","Hide logs":"隐藏日志",ID:moe,ID1:foe,ID2:$oe,Import:boe,"Import blocks":"导入块","Import error":"导入错误","Import scripts":"导入脚本","Insert object ID":"插入对象ID",Instance:yoe,"Instance is disabled":"实例已禁用","Instance:":"实例:",Instances:voe,Instructions:_oe,"Invalid CRON":"无效的周期任务","It will not be possible to revert this operation.":"无法恢复此操作。","JS description":"通过编写Javascript来创建规则",Januar:woe,January:koe,July:Coe,June:Soe,"Just check":"只是检查","Keep my changes":"保留我的更改","Language:":"语言:","Learn More":"了解更多","Light style":"浅色调风格",Limit:Toe,"Local time":"当地时间","Locate file":"定位文件","Log outputs":"记录输出","Log text":"记录文字","Log: %s":"日志:%s","Make a HTTP get request":"发出HTTP获取请求","Make a pause between actions":"在动作之间暂停",March:Ioe,"March ":"行进",May:Eoe,Menu:xoe,Message:Doe,Mo:Aoe,Model:Roe,Monday:Ooe,Month:Moe,More:Noe,Name:Loe,"No active host found":"找不到活动主机","Nothing found":"没有发现",November:Poe,OK:Boe,October:joe,Ok:Foe,"On condition change":"条件变化时","On script save or adapter start":"在脚本保存或适配器启动时","On weekdays":"在工作日","Operate two states":"操作两种状态","Operations with two states":"具有两种状态的操作","Paste your blocks here":"在此处粘贴您的区块",Pause:zoe,"Pause execution":"暂停执行","Pause script":"暂停脚本","Phone:":"电话:","Please select object ID...":"请选择对象ID...","Prettify the script":"美化脚本","Print some text in log":"在日志中打印一些文本","Priority:":"优先:",Pushover:Uoe,Pushsafer:Hoe,"Read only ID selected: %s":"选择的只读ID:%s",Reload:Woe,Rename:Goe,"Reorder scripts in folders":"重新排序文件夹中的脚本",Repeat:Voe,Restart:Koe,Result:Yoe,"Resume execution":"恢复执行","Root folder":"根文件夹","Rules description":"使用IF,THEN,ELSE块创建规则","Run script":"运行脚本",Sa:Joe,Saturday:qoe,Save:Xoe,"Save all":"保存全部","Say It":"Say It","Say some text via sayit adapter":"通过sayit适配器说一些文字",Schedule:Zoe,Script:Qoe,"Script %s was modified on disk":"脚本%s已在磁盘上修改","Script was modified externally":"脚本已被外部修改","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:eie,"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:tie,"Some files will be rejected":"有些文件将被拒绝","Sound:":"声音:",Stack:sie,Start:oie,"Start script":"启动脚本",State:iie,"State condition":"状态条件","Step into function":"进入功能","Step out from function":"退出函数","Stop on exception":"异常停止",Su:nie,"Subject:":"学科:",Sunday:rie,"TS description":"通过编写Typescript来创建规则",Telegram:aie,"Text:":"文本:",Th:lie,'The script "%s" has been modified by another user or in another window. Do you want to reload the script or keep your local changes?':'脚本 "%s" 已被其他用户或在其他窗口中修改。您想重新加载脚本还是保留您的本地更改?',"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:cie,Time:uie,"Time condition":"时间条件","Title:":"标题:","To:":"到:","Trigger with value":"用值触发",Triggered:die,Triggers:hie,"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:pie,Tuesday:gie,URL:mie,"Unknown error":"未知错误","Unknown error!":"未知错误!","User function":"用户功能","User:":"用户:",Value:fie,"Vibration:":"振动:",Volume:$ie,We:bie,Wednesday:yie,"Whatsapp-cmb":"Whatsapp的cmb",Write:vie,"Write your own code":"编写自己的代码",Yes:_ie,"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 使用旧触发器值","Please select a valid model":"请选择有效的模型","[equal]":"[平等的]","[greater or equal]":"[大于等于]","[greater]":"[更大]","[hysteresis]":"[磁滞]","[includes]":"[包括]","[less or equal]":"[小于或等于]","[less]":"[较少的]","[not equal]":"[不相等]",acknowledgment:wie,all:kie,and:Cie,"as JSON":"为 JSON","as plain text":"为纯文本",astro:Sie,at:Tie,"clear running":"畅通无阻",control:Iie,copy:Eie,cron:xie,dawn:Die,debug_help:Aie,debug_label:Rie,default:"默认",dusk:Oie,easy:Mie,else:"别的","equal to":"等于",every:Nie,"every hour at 0 minutes":"每小时0分钟",false:"错误的","file reading has failed: %s":"文件读取失败:%s","file reading was aborted":"文件读取中止",filter_func:Lie,filter_id:Pie,filter_name:Bie,filter_role:jie,filter_room:Fie,"for edit or create script":"用于编辑或创建脚本","for professionals":"对于专业人士","for programmers":"对于程序员",goldenHour:zie,goldenHourEnd:Uie,"greater or equal":"大于或等于","greater or equal to":"大于或等于","greater than":"比...更棒",help_just_check:Hie,help_on_change:Wie,"high priority":"高优先级","high-priority":"高优先级","highest priority":"最高优先级",hours:Gie,includes:Vie,interval:Kie,"just check":"只是检查","less or equal":"小于或等于","less or equal to":"小于或等于","less than":"少于","lower priority":"低优先级","lowest priority":"最低优先级",magic:Yie,milliseconds:Jie,minutes:qie,ms:Xie,nadir:Zie,nauticalDawn:Qie,nauticalDusk:ene,nextSunrise:tne,nextSunset:sne,night:one,nightEnd:ine,"no blocks found":"找不到块","no group":"没有组",normal:nne,"normal priority":"正常优先","not running":"未运行","not equal to":"不等于","not properly connected":"此块未正确连接到其他块。",offset:rne,"on change":"在变化","on condition change":"在条件变化时","on update":"更新时",one:ane,or:lne,quiet:cne,"reset search":"重置搜索",search:une,seconds:dne,solarNoon:hne,"store in":"存放在",sunrise:pne,sunriseEnd:gne,sunset:mne,sunsetStart:fne,then:$ne,"toggle value":"切换值",tooltip_ack:bne,tooltip_from:yne,tooltip_lc:vne,tooltip_quality:_ne,tooltip_ts:wne,tooltip_user:kne,tooltip_value:Cne,true:"真的",two:Sne,undefined:"不明确的",update:Tne,"use seconds":"精确到秒","use trigger value":"使用触发值",verbose_help:Ine,verbose_label:Ene,when:xne,with:"和","with date":"有日期","with offset":"带偏移",wizard:Dne,"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:Ane,"No running javascript instance found":"未找到正在运行的 JavaScript 实例","OID display mode":"OID显示模式","Ask questions about your script, request changes, or generate new code.":"询问有关脚本的问题、请求更改或生成新代码。","to send":"发送","Thinking...":"思考中...","AI suggested changes":"AI 建议的更改",Accept:Rne,Reject:One,"No API keys configured":"未配置 API 密钥","for new line":"换行","Mode: Chat = conversation only, Agent = can read/analyze scripts, Code = can read and modify scripts":"模式:Chat = 仅对话,Agent = 可读取/分析脚本,Code = 可读取和修改脚本","Mention scripts as context for the AI. Use @all for all scripts or @scriptName for a specific one.":"将脚本作为AI的上下文。使用 @全部 引用所有脚本,或 @脚本名称 引用特定脚本。",Context:Mne,"current script":"当前脚本","all scripts":"所有脚本",devices:Nne,"Searching datapoints":"搜索数据点","Reading value":"读取值","Loading object info":"加载对象信息","Searching scripts":"搜索脚本","Reading script":"读取脚本","Loading script list":"加载脚本列表","All scripts":"所有脚本","Smart home devices":"智能家居设备","AI Chat":"AI 聊天","AI inline completions":"AI 内联补全","New chat":"新聊天","Ask about your script...":"询问有关脚本的问题...","Insert blocks":"插入积木块","Apply blocks":"应用模块",Undo:Lne,Redo:Pne,"Insert into editor":"插入编辑器","Show as diff":"显示差异","Selected code as context":"选中的代码作为上下文","Generating plan...":"生成计划...","Generating code...":"生成代码...",Plan:Bne,"mention @all":"@全部","mention @devices":"@设备",Send:jne,Copy:Fne};function Rc(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var SS={exports:{}};(function(r,s){(function(i){r.exports=i()})(function(){return(function i(a,l,c){function h(f,b){if(!l[f]){if(!a[f]){var v=typeof Rc=="function"&&Rc;if(!b&&v)return v(f,!0);if(d)return d(f,!0);var _=new Error("Cannot find module '"+f+"'");throw _.code="MODULE_NOT_FOUND",_}var y=l[f]={exports:{}};a[f][0].call(y.exports,function(w){var $=a[f][1][w];return h($||w)},y,y.exports,i,a,l,c)}return l[f].exports}for(var d=typeof Rc=="function"&&Rc,p=0;p<c.length;p++)h(c[p]);return h})({1:[function(i,a,l){var c=i("./utils"),h=i("./support"),d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";l.encode=function(p){for(var f,b,v,_,y,w,$,I=[],T=0,C=p.length,D=C,R=c.getTypeOf(p)!=="string";T<p.length;)D=C-T,v=R?(f=p[T++],b=T<C?p[T++]:0,T<C?p[T++]:0):(f=p.charCodeAt(T++),b=T<C?p.charCodeAt(T++):0,T<C?p.charCodeAt(T++):0),_=f>>2,y=(3&f)<<4|b>>4,w=1<D?(15&b)<<2|v>>6:64,$=2<D?63&v:64,I.push(d.charAt(_)+d.charAt(y)+d.charAt(w)+d.charAt($));return I.join("")},l.decode=function(p){var f,b,v,_,y,w,$=0,I=0,T="data:";if(p.substr(0,T.length)===T)throw new Error("Invalid base64 input, it looks like a data url.");var C,D=3*(p=p.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(p.charAt(p.length-1)===d.charAt(64)&&D--,p.charAt(p.length-2)===d.charAt(64)&&D--,D%1!=0)throw new Error("Invalid base64 input, bad content length.");for(C=h.uint8array?new Uint8Array(0|D):new Array(0|D);$<p.length;)f=d.indexOf(p.charAt($++))<<2|(_=d.indexOf(p.charAt($++)))>>4,b=(15&_)<<4|(y=d.indexOf(p.charAt($++)))>>2,v=(3&y)<<6|(w=d.indexOf(p.charAt($++))),C[I++]=f,y!==64&&(C[I++]=b),w!==64&&(C[I++]=v);return C}},{"./support":30,"./utils":32}],2:[function(i,a,l){var c=i("./external"),h=i("./stream/DataWorker"),d=i("./stream/Crc32Probe"),p=i("./stream/DataLengthProbe");function f(b,v,_,y,w){this.compressedSize=b,this.uncompressedSize=v,this.crc32=_,this.compression=y,this.compressedContent=w}f.prototype={getContentWorker:function(){var b=new h(c.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new p("data_length")),v=this;return b.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),b},getCompressedWorker:function(){return new h(c.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},f.createWorkerFrom=function(b,v,_){return b.pipe(new d).pipe(new p("uncompressedSize")).pipe(v.compressWorker(_)).pipe(new p("compressedSize")).withStreamInfo("compression",v)},a.exports=f},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,a,l){var c=i("./stream/GenericWorker");l.STORE={magic:"\0\0",compressWorker:function(){return new c("STORE compression")},uncompressWorker:function(){return new c("STORE decompression")}},l.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,a,l){var c=i("./utils"),h=(function(){for(var d,p=[],f=0;f<256;f++){d=f;for(var b=0;b<8;b++)d=1&d?3988292384^d>>>1:d>>>1;p[f]=d}return p})();a.exports=function(d,p){return d!==void 0&&d.length?c.getTypeOf(d)!=="string"?(function(f,b,v,_){var y=h,w=_+v;f^=-1;for(var $=_;$<w;$++)f=f>>>8^y[255&(f^b[$])];return-1^f})(0|p,d,d.length,0):(function(f,b,v,_){var y=h,w=_+v;f^=-1;for(var $=_;$<w;$++)f=f>>>8^y[255&(f^b.charCodeAt($))];return-1^f})(0|p,d,d.length,0):0}},{"./utils":32}],5:[function(i,a,l){l.base64=!1,l.binary=!1,l.dir=!1,l.createFolders=!0,l.date=null,l.compression=null,l.compressionOptions=null,l.comment=null,l.unixPermissions=null,l.dosPermissions=null},{}],6:[function(i,a,l){var c=null;c=typeof Promise<"u"?Promise:i("lie"),a.exports={Promise:c}},{lie:37}],7:[function(i,a,l){var c=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",h=i("pako"),d=i("./utils"),p=i("./stream/GenericWorker"),f=c?"uint8array":"array";function b(v,_){p.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=_,this.meta={}}l.magic="\b\0",d.inherits(b,p),b.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(d.transformTo(f,v.data),!1)},b.prototype.flush=function(){p.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},b.prototype.cleanUp=function(){p.prototype.cleanUp.call(this),this._pako=null},b.prototype._createPako=function(){this._pako=new h[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(_){v.push({data:_,meta:v.meta})}},l.compressWorker=function(v){return new b("Deflate",v)},l.uncompressWorker=function(){return new b("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,a,l){function c(y,w){var $,I="";for($=0;$<w;$++)I+=String.fromCharCode(255&y),y>>>=8;return I}function h(y,w,$,I,T,C){var D,R,N=y.file,U=y.compression,j=C!==f.utf8encode,B=d.transformTo("string",C(N.name)),J=d.transformTo("string",f.utf8encode(N.name)),ae=N.comment,ye=d.transformTo("string",C(ae)),M=d.transformTo("string",f.utf8encode(ae)),W=J.length!==N.name.length,k=M.length!==ae.length,X="",ge="",ce="",oe=N.dir,le=N.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};w&&!$||(Q.crc32=y.crc32,Q.compressedSize=y.compressedSize,Q.uncompressedSize=y.uncompressedSize);var F=0;w&&(F|=8),j||!W&&!k||(F|=2048);var P=0,me=0;oe&&(P|=16),T==="UNIX"?(me=798,P|=(function(ie,ke){var Ne=ie;return ie||(Ne=ke?16893:33204),(65535&Ne)<<16})(N.unixPermissions,oe)):(me=20,P|=(function(ie){return 63&(ie||0)})(N.dosPermissions)),D=le.getUTCHours(),D<<=6,D|=le.getUTCMinutes(),D<<=5,D|=le.getUTCSeconds()/2,R=le.getUTCFullYear()-1980,R<<=4,R|=le.getUTCMonth()+1,R<<=5,R|=le.getUTCDate(),W&&(ge=c(1,1)+c(b(B),4)+J,X+="up"+c(ge.length,2)+ge),k&&(ce=c(1,1)+c(b(ye),4)+M,X+="uc"+c(ce.length,2)+ce);var ne="";return ne+=`
|
|
1252
|
+
\0`,ne+=c(F,2),ne+=U.magic,ne+=c(D,2),ne+=c(R,2),ne+=c(Q.crc32,4),ne+=c(Q.compressedSize,4),ne+=c(Q.uncompressedSize,4),ne+=c(B.length,2),ne+=c(X.length,2),{fileRecord:v.LOCAL_FILE_HEADER+ne+B+X,dirRecord:v.CENTRAL_FILE_HEADER+c(me,2)+ne+c(ye.length,2)+"\0\0\0\0"+c(P,4)+c(I,4)+B+X+ye}}var d=i("../utils"),p=i("../stream/GenericWorker"),f=i("../utf8"),b=i("../crc32"),v=i("../signature");function _(y,w,$,I){p.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=w,this.zipPlatform=$,this.encodeFileName=I,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}d.inherits(_,p),_.prototype.push=function(y){var w=y.meta.percent||0,$=this.entriesCount,I=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,p.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:$?(w+100*($-I-1))/$:100}}))},_.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var w=this.streamFiles&&!y.file.dir;if(w){var $=h(y,w,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:$.fileRecord,meta:{percent:0}})}else this.accumulate=!0},_.prototype.closedSource=function(y){this.accumulate=!1;var w=this.streamFiles&&!y.file.dir,$=h(y,w,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push($.dirRecord),w)this.push({data:(function(I){return v.DATA_DESCRIPTOR+c(I.crc32,4)+c(I.compressedSize,4)+c(I.uncompressedSize,4)})(y),meta:{percent:100}});else for(this.push({data:$.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},_.prototype.flush=function(){for(var y=this.bytesWritten,w=0;w<this.dirRecords.length;w++)this.push({data:this.dirRecords[w],meta:{percent:100}});var $=this.bytesWritten-y,I=(function(T,C,D,R,N){var U=d.transformTo("string",N(R));return v.CENTRAL_DIRECTORY_END+"\0\0\0\0"+c(T,2)+c(T,2)+c(C,4)+c(D,4)+c(U.length,2)+U})(this.dirRecords.length,$,y,this.zipComment,this.encodeFileName);this.push({data:I,meta:{percent:100}})},_.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},_.prototype.registerPrevious=function(y){this._sources.push(y);var w=this;return y.on("data",function($){w.processChunk($)}),y.on("end",function(){w.closedSource(w.previous.streamInfo),w._sources.length?w.prepareNextSource():w.end()}),y.on("error",function($){w.error($)}),this},_.prototype.resume=function(){return!!p.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},_.prototype.error=function(y){var w=this._sources;if(!p.prototype.error.call(this,y))return!1;for(var $=0;$<w.length;$++)try{w[$].error(y)}catch{}return!0},_.prototype.lock=function(){p.prototype.lock.call(this);for(var y=this._sources,w=0;w<y.length;w++)y[w].lock()},a.exports=_},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(i,a,l){var c=i("../compressions"),h=i("./ZipFileWorker");l.generateWorker=function(d,p,f){var b=new h(p.streamFiles,f,p.platform,p.encodeFileName),v=0;try{d.forEach(function(_,y){v++;var w=(function(C,D){var R=C||D,N=c[R];if(!N)throw new Error(R+" is not a valid compression method !");return N})(y.options.compression,p.compression),$=y.options.compressionOptions||p.compressionOptions||{},I=y.dir,T=y.date;y._compressWorker(w,$).withStreamInfo("file",{name:_,dir:I,date:T,comment:y.comment||"",unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions}).pipe(b)}),b.entriesCount=v}catch(_){b.error(_)}return b}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(i,a,l){function c(){if(!(this instanceof c))return new c;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var h=new c;for(var d in this)typeof this[d]!="function"&&(h[d]=this[d]);return h}}(c.prototype=i("./object")).loadAsync=i("./load"),c.support=i("./support"),c.defaults=i("./defaults"),c.version="3.10.1",c.loadAsync=function(h,d){return new c().loadAsync(h,d)},c.external=i("./external"),a.exports=c},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(i,a,l){var c=i("./utils"),h=i("./external"),d=i("./utf8"),p=i("./zipEntries"),f=i("./stream/Crc32Probe"),b=i("./nodejsUtils");function v(_){return new h.Promise(function(y,w){var $=_.decompressed.getContentWorker().pipe(new f);$.on("error",function(I){w(I)}).on("end",function(){$.streamInfo.crc32!==_.decompressed.crc32?w(new Error("Corrupted zip : CRC32 mismatch")):y()}).resume()})}a.exports=function(_,y){var w=this;return y=c.extend(y||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:d.utf8decode}),b.isNode&&b.isStream(_)?h.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):c.prepareContent("the loaded zip file",_,!0,y.optimizedBinaryString,y.base64).then(function($){var I=new p(y);return I.load($),I}).then(function($){var I=[h.Promise.resolve($)],T=$.files;if(y.checkCRC32)for(var C=0;C<T.length;C++)I.push(v(T[C]));return h.Promise.all(I)}).then(function($){for(var I=$.shift(),T=I.files,C=0;C<T.length;C++){var D=T[C],R=D.fileNameStr,N=c.resolve(D.fileNameStr);w.file(N,D.decompressed,{binary:!0,optimizedBinaryString:!0,date:D.date,dir:D.dir,comment:D.fileCommentStr.length?D.fileCommentStr:null,unixPermissions:D.unixPermissions,dosPermissions:D.dosPermissions,createFolders:y.createFolders}),D.dir||(w.file(N).unsafeOriginalName=R)}return I.zipComment.length&&(w.comment=I.zipComment),w})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(i,a,l){var c=i("../utils"),h=i("../stream/GenericWorker");function d(p,f){h.call(this,"Nodejs stream input adapter for "+p),this._upstreamEnded=!1,this._bindStream(f)}c.inherits(d,h),d.prototype._bindStream=function(p){var f=this;(this._stream=p).pause(),p.on("data",function(b){f.push({data:b,meta:{percent:0}})}).on("error",function(b){f.isPaused?this.generatedError=b:f.error(b)}).on("end",function(){f.isPaused?f._upstreamEnded=!0:f.end()})},d.prototype.pause=function(){return!!h.prototype.pause.call(this)&&(this._stream.pause(),!0)},d.prototype.resume=function(){return!!h.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},a.exports=d},{"../stream/GenericWorker":28,"../utils":32}],13:[function(i,a,l){var c=i("readable-stream").Readable;function h(d,p,f){c.call(this,p),this._helper=d;var b=this;d.on("data",function(v,_){b.push(v)||b._helper.pause(),f&&f(_)}).on("error",function(v){b.emit("error",v)}).on("end",function(){b.push(null)})}i("../utils").inherits(h,c),h.prototype._read=function(){this._helper.resume()},a.exports=h},{"../utils":32,"readable-stream":16}],14:[function(i,a,l){a.exports={isNode:typeof Buffer<"u",newBufferFrom:function(c,h){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(c,h);if(typeof c=="number")throw new Error('The "data" argument must not be a number');return new Buffer(c,h)},allocBuffer:function(c){if(Buffer.alloc)return Buffer.alloc(c);var h=new Buffer(c);return h.fill(0),h},isBuffer:function(c){return Buffer.isBuffer(c)},isStream:function(c){return c&&typeof c.on=="function"&&typeof c.pause=="function"&&typeof c.resume=="function"}}},{}],15:[function(i,a,l){function c(N,U,j){var B,J=d.getTypeOf(U),ae=d.extend(j||{},b);ae.date=ae.date||new Date,ae.compression!==null&&(ae.compression=ae.compression.toUpperCase()),typeof ae.unixPermissions=="string"&&(ae.unixPermissions=parseInt(ae.unixPermissions,8)),ae.unixPermissions&&16384&ae.unixPermissions&&(ae.dir=!0),ae.dosPermissions&&16&ae.dosPermissions&&(ae.dir=!0),ae.dir&&(N=T(N)),ae.createFolders&&(B=I(N))&&C.call(this,B,!0);var ye=J==="string"&&ae.binary===!1&&ae.base64===!1;j&&j.binary!==void 0||(ae.binary=!ye),(U instanceof v&&U.uncompressedSize===0||ae.dir||!U||U.length===0)&&(ae.base64=!1,ae.binary=!0,U="",ae.compression="STORE",J="string");var M=null;M=U instanceof v||U instanceof p?U:w.isNode&&w.isStream(U)?new $(N,U):d.prepareContent(N,U,ae.binary,ae.optimizedBinaryString,ae.base64);var W=new _(N,M,ae);this.files[N]=W}var h=i("./utf8"),d=i("./utils"),p=i("./stream/GenericWorker"),f=i("./stream/StreamHelper"),b=i("./defaults"),v=i("./compressedObject"),_=i("./zipObject"),y=i("./generate"),w=i("./nodejsUtils"),$=i("./nodejs/NodejsStreamInputAdapter"),I=function(N){N.slice(-1)==="/"&&(N=N.substring(0,N.length-1));var U=N.lastIndexOf("/");return 0<U?N.substring(0,U):""},T=function(N){return N.slice(-1)!=="/"&&(N+="/"),N},C=function(N,U){return U=U!==void 0?U:b.createFolders,N=T(N),this.files[N]||c.call(this,N,null,{dir:!0,createFolders:U}),this.files[N]};function D(N){return Object.prototype.toString.call(N)==="[object RegExp]"}var R={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(N){var U,j,B;for(U in this.files)B=this.files[U],(j=U.slice(this.root.length,U.length))&&U.slice(0,this.root.length)===this.root&&N(j,B)},filter:function(N){var U=[];return this.forEach(function(j,B){N(j,B)&&U.push(B)}),U},file:function(N,U,j){if(arguments.length!==1)return N=this.root+N,c.call(this,N,U,j),this;if(D(N)){var B=N;return this.filter(function(ae,ye){return!ye.dir&&B.test(ae)})}var J=this.files[this.root+N];return J&&!J.dir?J:null},folder:function(N){if(!N)return this;if(D(N))return this.filter(function(J,ae){return ae.dir&&N.test(J)});var U=this.root+N,j=C.call(this,U),B=this.clone();return B.root=j.name,B},remove:function(N){N=this.root+N;var U=this.files[N];if(U||(N.slice(-1)!=="/"&&(N+="/"),U=this.files[N]),U&&!U.dir)delete this.files[N];else for(var j=this.filter(function(J,ae){return ae.name.slice(0,N.length)===N}),B=0;B<j.length;B++)delete this.files[j[B].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(N){var U,j={};try{if((j=d.extend(N||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:h.utf8encode})).type=j.type.toLowerCase(),j.compression=j.compression.toUpperCase(),j.type==="binarystring"&&(j.type="string"),!j.type)throw new Error("No output type specified.");d.checkSupport(j.type),j.platform!=="darwin"&&j.platform!=="freebsd"&&j.platform!=="linux"&&j.platform!=="sunos"||(j.platform="UNIX"),j.platform==="win32"&&(j.platform="DOS");var B=j.comment||this.comment||"";U=y.generateWorker(this,j,B)}catch(J){(U=new p("error")).error(J)}return new f(U,j.type||"string",j.mimeType)},generateAsync:function(N,U){return this.generateInternalStream(N).accumulate(U)},generateNodeStream:function(N,U){return(N=N||{}).type||(N.type="nodebuffer"),this.generateInternalStream(N).toNodejsStream(U)}};a.exports=R},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(i,a,l){a.exports=i("stream")},{stream:void 0}],17:[function(i,a,l){var c=i("./DataReader");function h(d){c.call(this,d);for(var p=0;p<this.data.length;p++)d[p]=255&d[p]}i("../utils").inherits(h,c),h.prototype.byteAt=function(d){return this.data[this.zero+d]},h.prototype.lastIndexOfSignature=function(d){for(var p=d.charCodeAt(0),f=d.charCodeAt(1),b=d.charCodeAt(2),v=d.charCodeAt(3),_=this.length-4;0<=_;--_)if(this.data[_]===p&&this.data[_+1]===f&&this.data[_+2]===b&&this.data[_+3]===v)return _-this.zero;return-1},h.prototype.readAndCheckSignature=function(d){var p=d.charCodeAt(0),f=d.charCodeAt(1),b=d.charCodeAt(2),v=d.charCodeAt(3),_=this.readData(4);return p===_[0]&&f===_[1]&&b===_[2]&&v===_[3]},h.prototype.readData=function(d){if(this.checkOffset(d),d===0)return[];var p=this.data.slice(this.zero+this.index,this.zero+this.index+d);return this.index+=d,p},a.exports=h},{"../utils":32,"./DataReader":18}],18:[function(i,a,l){var c=i("../utils");function h(d){this.data=d,this.length=d.length,this.index=0,this.zero=0}h.prototype={checkOffset:function(d){this.checkIndex(this.index+d)},checkIndex:function(d){if(this.length<this.zero+d||d<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+d+"). Corrupted zip ?")},setIndex:function(d){this.checkIndex(d),this.index=d},skip:function(d){this.setIndex(this.index+d)},byteAt:function(){},readInt:function(d){var p,f=0;for(this.checkOffset(d),p=this.index+d-1;p>=this.index;p--)f=(f<<8)+this.byteAt(p);return this.index+=d,f},readString:function(d){return c.transformTo("string",this.readData(d))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var d=this.readInt(4);return new Date(Date.UTC(1980+(d>>25&127),(d>>21&15)-1,d>>16&31,d>>11&31,d>>5&63,(31&d)<<1))}},a.exports=h},{"../utils":32}],19:[function(i,a,l){var c=i("./Uint8ArrayReader");function h(d){c.call(this,d)}i("../utils").inherits(h,c),h.prototype.readData=function(d){this.checkOffset(d);var p=this.data.slice(this.zero+this.index,this.zero+this.index+d);return this.index+=d,p},a.exports=h},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,a,l){var c=i("./DataReader");function h(d){c.call(this,d)}i("../utils").inherits(h,c),h.prototype.byteAt=function(d){return this.data.charCodeAt(this.zero+d)},h.prototype.lastIndexOfSignature=function(d){return this.data.lastIndexOf(d)-this.zero},h.prototype.readAndCheckSignature=function(d){return d===this.readData(4)},h.prototype.readData=function(d){this.checkOffset(d);var p=this.data.slice(this.zero+this.index,this.zero+this.index+d);return this.index+=d,p},a.exports=h},{"../utils":32,"./DataReader":18}],21:[function(i,a,l){var c=i("./ArrayReader");function h(d){c.call(this,d)}i("../utils").inherits(h,c),h.prototype.readData=function(d){if(this.checkOffset(d),d===0)return new Uint8Array(0);var p=this.data.subarray(this.zero+this.index,this.zero+this.index+d);return this.index+=d,p},a.exports=h},{"../utils":32,"./ArrayReader":17}],22:[function(i,a,l){var c=i("../utils"),h=i("../support"),d=i("./ArrayReader"),p=i("./StringReader"),f=i("./NodeBufferReader"),b=i("./Uint8ArrayReader");a.exports=function(v){var _=c.getTypeOf(v);return c.checkSupport(_),_!=="string"||h.uint8array?_==="nodebuffer"?new f(v):h.uint8array?new b(c.transformTo("uint8array",v)):new d(c.transformTo("array",v)):new p(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,a,l){l.LOCAL_FILE_HEADER="PK",l.CENTRAL_FILE_HEADER="PK",l.CENTRAL_DIRECTORY_END="PK",l.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",l.ZIP64_CENTRAL_DIRECTORY_END="PK",l.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,a,l){var c=i("./GenericWorker"),h=i("../utils");function d(p){c.call(this,"ConvertWorker to "+p),this.destType=p}h.inherits(d,c),d.prototype.processChunk=function(p){this.push({data:h.transformTo(this.destType,p.data),meta:p.meta})},a.exports=d},{"../utils":32,"./GenericWorker":28}],25:[function(i,a,l){var c=i("./GenericWorker"),h=i("../crc32");function d(){c.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(d,c),d.prototype.processChunk=function(p){this.streamInfo.crc32=h(p.data,this.streamInfo.crc32||0),this.push(p)},a.exports=d},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,a,l){var c=i("../utils"),h=i("./GenericWorker");function d(p){h.call(this,"DataLengthProbe for "+p),this.propName=p,this.withStreamInfo(p,0)}c.inherits(d,h),d.prototype.processChunk=function(p){if(p){var f=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=f+p.data.length}h.prototype.processChunk.call(this,p)},a.exports=d},{"../utils":32,"./GenericWorker":28}],27:[function(i,a,l){var c=i("../utils"),h=i("./GenericWorker");function d(p){h.call(this,"DataWorker");var f=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,p.then(function(b){f.dataIsReady=!0,f.data=b,f.max=b&&b.length||0,f.type=c.getTypeOf(b),f.isPaused||f._tickAndRepeat()},function(b){f.error(b)})}c.inherits(d,h),d.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this.data=null},d.prototype.resume=function(){return!!h.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,c.delay(this._tickAndRepeat,[],this)),!0)},d.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(c.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},d.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var p=null,f=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":p=this.data.substring(this.index,f);break;case"uint8array":p=this.data.subarray(this.index,f);break;case"array":case"nodebuffer":p=this.data.slice(this.index,f)}return this.index=f,this.push({data:p,meta:{percent:this.max?this.index/this.max*100:0}})},a.exports=d},{"../utils":32,"./GenericWorker":28}],28:[function(i,a,l){function c(h){this.name=h||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}c.prototype={push:function(h){this.emit("data",h)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(h){this.emit("error",h)}return!0},error:function(h){return!this.isFinished&&(this.isPaused?this.generatedError=h:(this.isFinished=!0,this.emit("error",h),this.previous&&this.previous.error(h),this.cleanUp()),!0)},on:function(h,d){return this._listeners[h].push(d),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(h,d){if(this._listeners[h])for(var p=0;p<this._listeners[h].length;p++)this._listeners[h][p].call(this,d)},pipe:function(h){return h.registerPrevious(this)},registerPrevious:function(h){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=h.streamInfo,this.mergeStreamInfo(),this.previous=h;var d=this;return h.on("data",function(p){d.processChunk(p)}),h.on("end",function(){d.end()}),h.on("error",function(p){d.error(p)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var h=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),h=!0),this.previous&&this.previous.resume(),!h},flush:function(){},processChunk:function(h){this.push(h)},withStreamInfo:function(h,d){return this.extraStreamInfo[h]=d,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var h in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,h)&&(this.streamInfo[h]=this.extraStreamInfo[h])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var h="Worker "+this.name;return this.previous?this.previous+" -> "+h:h}},a.exports=c},{}],29:[function(i,a,l){var c=i("../utils"),h=i("./ConvertWorker"),d=i("./GenericWorker"),p=i("../base64"),f=i("../support"),b=i("../external"),v=null;if(f.nodestream)try{v=i("../nodejs/NodejsStreamOutputAdapter")}catch{}function _(w,$){return new b.Promise(function(I,T){var C=[],D=w._internalType,R=w._outputType,N=w._mimeType;w.on("data",function(U,j){C.push(U),$&&$(j)}).on("error",function(U){C=[],T(U)}).on("end",function(){try{var U=(function(j,B,J){switch(j){case"blob":return c.newBlob(c.transformTo("arraybuffer",B),J);case"base64":return p.encode(B);default:return c.transformTo(j,B)}})(R,(function(j,B){var J,ae=0,ye=null,M=0;for(J=0;J<B.length;J++)M+=B[J].length;switch(j){case"string":return B.join("");case"array":return Array.prototype.concat.apply([],B);case"uint8array":for(ye=new Uint8Array(M),J=0;J<B.length;J++)ye.set(B[J],ae),ae+=B[J].length;return ye;case"nodebuffer":return Buffer.concat(B);default:throw new Error("concat : unsupported type '"+j+"'")}})(D,C),N);I(U)}catch(j){T(j)}C=[]}).resume()})}function y(w,$,I){var T=$;switch($){case"blob":case"arraybuffer":T="uint8array";break;case"base64":T="string"}try{this._internalType=T,this._outputType=$,this._mimeType=I,c.checkSupport(T),this._worker=w.pipe(new h(T)),w.lock()}catch(C){this._worker=new d("error"),this._worker.error(C)}}y.prototype={accumulate:function(w){return _(this,w)},on:function(w,$){var I=this;return w==="data"?this._worker.on(w,function(T){$.call(I,T.data,T.meta)}):this._worker.on(w,function(){c.delay($,arguments,I)}),this},resume:function(){return c.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(w){if(c.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new v(this,{objectMode:this._outputType!=="nodebuffer"},w)}},a.exports=y},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(i,a,l){if(l.base64=!0,l.array=!0,l.string=!0,l.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",l.nodebuffer=typeof Buffer<"u",l.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")l.blob=!1;else{var c=new ArrayBuffer(0);try{l.blob=new Blob([c],{type:"application/zip"}).size===0}catch{try{var h=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);h.append(c),l.blob=h.getBlob("application/zip").size===0}catch{l.blob=!1}}}try{l.nodestream=!!i("readable-stream").Readable}catch{l.nodestream=!1}},{"readable-stream":16}],31:[function(i,a,l){for(var c=i("./utils"),h=i("./support"),d=i("./nodejsUtils"),p=i("./stream/GenericWorker"),f=new Array(256),b=0;b<256;b++)f[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;f[254]=f[254]=1;function v(){p.call(this,"utf-8 decode"),this.leftOver=null}function _(){p.call(this,"utf-8 encode")}l.utf8encode=function(y){return h.nodebuffer?d.newBufferFrom(y,"utf-8"):(function(w){var $,I,T,C,D,R=w.length,N=0;for(C=0;C<R;C++)(64512&(I=w.charCodeAt(C)))==55296&&C+1<R&&(64512&(T=w.charCodeAt(C+1)))==56320&&(I=65536+(I-55296<<10)+(T-56320),C++),N+=I<128?1:I<2048?2:I<65536?3:4;for($=h.uint8array?new Uint8Array(N):new Array(N),C=D=0;D<N;C++)(64512&(I=w.charCodeAt(C)))==55296&&C+1<R&&(64512&(T=w.charCodeAt(C+1)))==56320&&(I=65536+(I-55296<<10)+(T-56320),C++),I<128?$[D++]=I:(I<2048?$[D++]=192|I>>>6:(I<65536?$[D++]=224|I>>>12:($[D++]=240|I>>>18,$[D++]=128|I>>>12&63),$[D++]=128|I>>>6&63),$[D++]=128|63&I);return $})(y)},l.utf8decode=function(y){return h.nodebuffer?c.transformTo("nodebuffer",y).toString("utf-8"):(function(w){var $,I,T,C,D=w.length,R=new Array(2*D);for($=I=0;$<D;)if((T=w[$++])<128)R[I++]=T;else if(4<(C=f[T]))R[I++]=65533,$+=C-1;else{for(T&=C===2?31:C===3?15:7;1<C&&$<D;)T=T<<6|63&w[$++],C--;1<C?R[I++]=65533:T<65536?R[I++]=T:(T-=65536,R[I++]=55296|T>>10&1023,R[I++]=56320|1023&T)}return R.length!==I&&(R.subarray?R=R.subarray(0,I):R.length=I),c.applyFromCharCode(R)})(y=c.transformTo(h.uint8array?"uint8array":"array",y))},c.inherits(v,p),v.prototype.processChunk=function(y){var w=c.transformTo(h.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var $=w;(w=new Uint8Array($.length+this.leftOver.length)).set(this.leftOver,0),w.set($,this.leftOver.length)}else w=this.leftOver.concat(w);this.leftOver=null}var I=(function(C,D){var R;for((D=D||C.length)>C.length&&(D=C.length),R=D-1;0<=R&&(192&C[R])==128;)R--;return R<0||R===0?D:R+f[C[R]]>D?R:D})(w),T=w;I!==w.length&&(h.uint8array?(T=w.subarray(0,I),this.leftOver=w.subarray(I,w.length)):(T=w.slice(0,I),this.leftOver=w.slice(I,w.length))),this.push({data:l.utf8decode(T),meta:y.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:l.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},l.Utf8DecodeWorker=v,c.inherits(_,p),_.prototype.processChunk=function(y){this.push({data:l.utf8encode(y.data),meta:y.meta})},l.Utf8EncodeWorker=_},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,a,l){var c=i("./support"),h=i("./base64"),d=i("./nodejsUtils"),p=i("./external");function f($){return $}function b($,I){for(var T=0;T<$.length;++T)I[T]=255&$.charCodeAt(T);return I}i("setimmediate"),l.newBlob=function($,I){l.checkSupport("blob");try{return new Blob([$],{type:I})}catch{try{var T=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return T.append($),T.getBlob(I)}catch{throw new Error("Bug : can't construct the Blob.")}}};var v={stringifyByChunk:function($,I,T){var C=[],D=0,R=$.length;if(R<=T)return String.fromCharCode.apply(null,$);for(;D<R;)I==="array"||I==="nodebuffer"?C.push(String.fromCharCode.apply(null,$.slice(D,Math.min(D+T,R)))):C.push(String.fromCharCode.apply(null,$.subarray(D,Math.min(D+T,R)))),D+=T;return C.join("")},stringifyByChar:function($){for(var I="",T=0;T<$.length;T++)I+=String.fromCharCode($[T]);return I},applyCanBeUsed:{uint8array:(function(){try{return c.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return c.nodebuffer&&String.fromCharCode.apply(null,d.allocBuffer(1)).length===1}catch{return!1}})()}};function _($){var I=65536,T=l.getTypeOf($),C=!0;if(T==="uint8array"?C=v.applyCanBeUsed.uint8array:T==="nodebuffer"&&(C=v.applyCanBeUsed.nodebuffer),C)for(;1<I;)try{return v.stringifyByChunk($,T,I)}catch{I=Math.floor(I/2)}return v.stringifyByChar($)}function y($,I){for(var T=0;T<$.length;T++)I[T]=$[T];return I}l.applyFromCharCode=_;var w={};w.string={string:f,array:function($){return b($,new Array($.length))},arraybuffer:function($){return w.string.uint8array($).buffer},uint8array:function($){return b($,new Uint8Array($.length))},nodebuffer:function($){return b($,d.allocBuffer($.length))}},w.array={string:_,array:f,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return d.newBufferFrom($)}},w.arraybuffer={string:function($){return _(new Uint8Array($))},array:function($){return y(new Uint8Array($),new Array($.byteLength))},arraybuffer:f,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return d.newBufferFrom(new Uint8Array($))}},w.uint8array={string:_,array:function($){return y($,new Array($.length))},arraybuffer:function($){return $.buffer},uint8array:f,nodebuffer:function($){return d.newBufferFrom($)}},w.nodebuffer={string:_,array:function($){return y($,new Array($.length))},arraybuffer:function($){return w.nodebuffer.uint8array($).buffer},uint8array:function($){return y($,new Uint8Array($.length))},nodebuffer:f},l.transformTo=function($,I){if(I=I||"",!$)return I;l.checkSupport($);var T=l.getTypeOf(I);return w[T][$](I)},l.resolve=function($){for(var I=$.split("/"),T=[],C=0;C<I.length;C++){var D=I[C];D==="."||D===""&&C!==0&&C!==I.length-1||(D===".."?T.pop():T.push(D))}return T.join("/")},l.getTypeOf=function($){return typeof $=="string"?"string":Object.prototype.toString.call($)==="[object Array]"?"array":c.nodebuffer&&d.isBuffer($)?"nodebuffer":c.uint8array&&$ instanceof Uint8Array?"uint8array":c.arraybuffer&&$ instanceof ArrayBuffer?"arraybuffer":void 0},l.checkSupport=function($){if(!c[$.toLowerCase()])throw new Error($+" is not supported by this platform")},l.MAX_VALUE_16BITS=65535,l.MAX_VALUE_32BITS=-1,l.pretty=function($){var I,T,C="";for(T=0;T<($||"").length;T++)C+="\\x"+((I=$.charCodeAt(T))<16?"0":"")+I.toString(16).toUpperCase();return C},l.delay=function($,I,T){setImmediate(function(){$.apply(T||null,I||[])})},l.inherits=function($,I){function T(){}T.prototype=I.prototype,$.prototype=new T},l.extend=function(){var $,I,T={};for($=0;$<arguments.length;$++)for(I in arguments[$])Object.prototype.hasOwnProperty.call(arguments[$],I)&&T[I]===void 0&&(T[I]=arguments[$][I]);return T},l.prepareContent=function($,I,T,C,D){return p.Promise.resolve(I).then(function(R){return c.blob&&(R instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(R))!==-1)&&typeof FileReader<"u"?new p.Promise(function(N,U){var j=new FileReader;j.onload=function(B){N(B.target.result)},j.onerror=function(B){U(B.target.error)},j.readAsArrayBuffer(R)}):R}).then(function(R){var N=l.getTypeOf(R);return N?(N==="arraybuffer"?R=l.transformTo("uint8array",R):N==="string"&&(D?R=h.decode(R):T&&C!==!0&&(R=(function(U){return b(U,c.uint8array?new Uint8Array(U.length):new Array(U.length))})(R))),R):p.Promise.reject(new Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(i,a,l){var c=i("./reader/readerFor"),h=i("./utils"),d=i("./signature"),p=i("./zipEntry"),f=i("./support");function b(v){this.files=[],this.loadOptions=v}b.prototype={checkSignature:function(v){if(!this.reader.readAndCheckSignature(v)){this.reader.index-=4;var _=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+h.pretty(_)+", expected "+h.pretty(v)+")")}},isSignature:function(v,_){var y=this.reader.index;this.reader.setIndex(v);var w=this.reader.readString(4)===_;return this.reader.setIndex(y),w},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var v=this.reader.readData(this.zipCommentLength),_=f.uint8array?"uint8array":"array",y=h.transformTo(_,v);this.zipComment=this.loadOptions.decodeFileName(y)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var v,_,y,w=this.zip64EndOfCentralSize-44;0<w;)v=this.reader.readInt(2),_=this.reader.readInt(4),y=this.reader.readData(_),this.zip64ExtensibleData[v]={id:v,length:_,value:y}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var v,_;for(v=0;v<this.files.length;v++)_=this.files[v],this.reader.setIndex(_.localHeaderOffset),this.checkSignature(d.LOCAL_FILE_HEADER),_.readLocalPart(this.reader),_.handleUTF8(),_.processAttributes()},readCentralDir:function(){var v;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(d.CENTRAL_FILE_HEADER);)(v=new p({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(v);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var v=this.reader.lastIndexOfSignature(d.CENTRAL_DIRECTORY_END);if(v<0)throw this.isSignature(0,d.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(v);var _=v;if(this.checkSignature(d.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===h.MAX_VALUE_16BITS||this.diskWithCentralDirStart===h.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===h.MAX_VALUE_16BITS||this.centralDirRecords===h.MAX_VALUE_16BITS||this.centralDirSize===h.MAX_VALUE_32BITS||this.centralDirOffset===h.MAX_VALUE_32BITS){if(this.zip64=!0,(v=this.reader.lastIndexOfSignature(d.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(v),this.checkSignature(d.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,d.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(d.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(d.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var y=this.centralDirOffset+this.centralDirSize;this.zip64&&(y+=20,y+=12+this.zip64EndOfCentralSize);var w=_-y;if(0<w)this.isSignature(_,d.CENTRAL_FILE_HEADER)||(this.reader.zero=w);else if(w<0)throw new Error("Corrupted zip: missing "+Math.abs(w)+" bytes.")},prepareReader:function(v){this.reader=c(v)},load:function(v){this.prepareReader(v),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},a.exports=b},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(i,a,l){var c=i("./reader/readerFor"),h=i("./utils"),d=i("./compressedObject"),p=i("./crc32"),f=i("./utf8"),b=i("./compressions"),v=i("./support");function _(y,w){this.options=y,this.loadOptions=w}_.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(y){var w,$;if(y.skip(22),this.fileNameLength=y.readInt(2),$=y.readInt(2),this.fileName=y.readData(this.fileNameLength),y.skip($),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((w=(function(I){for(var T in b)if(Object.prototype.hasOwnProperty.call(b,T)&&b[T].magic===I)return b[T];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+h.pretty(this.compressionMethod)+" unknown (inner file : "+h.transformTo("string",this.fileName)+")");this.decompressed=new d(this.compressedSize,this.uncompressedSize,this.crc32,w,y.readData(this.compressedSize))},readCentralPart:function(y){this.versionMadeBy=y.readInt(2),y.skip(2),this.bitFlag=y.readInt(2),this.compressionMethod=y.readString(2),this.date=y.readDate(),this.crc32=y.readInt(4),this.compressedSize=y.readInt(4),this.uncompressedSize=y.readInt(4);var w=y.readInt(2);if(this.extraFieldsLength=y.readInt(2),this.fileCommentLength=y.readInt(2),this.diskNumberStart=y.readInt(2),this.internalFileAttributes=y.readInt(2),this.externalFileAttributes=y.readInt(4),this.localHeaderOffset=y.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");y.skip(w),this.readExtraFields(y),this.parseZIP64ExtraField(y),this.fileComment=y.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var y=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=c(this.extraFields[1].value);this.uncompressedSize===h.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===h.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===h.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===h.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var w,$,I,T=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4<T;)w=y.readInt(2),$=y.readInt(2),I=y.readData($),this.extraFields[w]={id:w,length:$,value:I};y.setIndex(T)},handleUTF8:function(){var y=v.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=f.utf8decode(this.fileName),this.fileCommentStr=f.utf8decode(this.fileComment);else{var w=this.findExtraFieldUnicodePath();if(w!==null)this.fileNameStr=w;else{var $=h.transformTo(y,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName($)}var I=this.findExtraFieldUnicodeComment();if(I!==null)this.fileCommentStr=I;else{var T=h.transformTo(y,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(T)}}},findExtraFieldUnicodePath:function(){var y=this.extraFields[28789];if(y){var w=c(y.value);return w.readInt(1)!==1||p(this.fileName)!==w.readInt(4)?null:f.utf8decode(w.readData(y.length-5))}return null},findExtraFieldUnicodeComment:function(){var y=this.extraFields[25461];if(y){var w=c(y.value);return w.readInt(1)!==1||p(this.fileComment)!==w.readInt(4)?null:f.utf8decode(w.readData(y.length-5))}return null}},a.exports=_},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(i,a,l){function c(w,$,I){this.name=w,this.dir=I.dir,this.date=I.date,this.comment=I.comment,this.unixPermissions=I.unixPermissions,this.dosPermissions=I.dosPermissions,this._data=$,this._dataBinary=I.binary,this.options={compression:I.compression,compressionOptions:I.compressionOptions}}var h=i("./stream/StreamHelper"),d=i("./stream/DataWorker"),p=i("./utf8"),f=i("./compressedObject"),b=i("./stream/GenericWorker");c.prototype={internalStream:function(w){var $=null,I="string";try{if(!w)throw new Error("No output type specified.");var T=(I=w.toLowerCase())==="string"||I==="text";I!=="binarystring"&&I!=="text"||(I="string"),$=this._decompressWorker();var C=!this._dataBinary;C&&!T&&($=$.pipe(new p.Utf8EncodeWorker)),!C&&T&&($=$.pipe(new p.Utf8DecodeWorker))}catch(D){($=new b("error")).error(D)}return new h($,I,"")},async:function(w,$){return this.internalStream(w).accumulate($)},nodeStream:function(w,$){return this.internalStream(w||"nodebuffer").toNodejsStream($)},_compressWorker:function(w,$){if(this._data instanceof f&&this._data.compression.magic===w.magic)return this._data.getCompressedWorker();var I=this._decompressWorker();return this._dataBinary||(I=I.pipe(new p.Utf8EncodeWorker)),f.createWorkerFrom(I,w,$)},_decompressWorker:function(){return this._data instanceof f?this._data.getContentWorker():this._data instanceof b?this._data:new d(this._data)}};for(var v=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],_=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},y=0;y<v.length;y++)c.prototype[v[y]]=_;a.exports=c},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(i,a,l){(function(c){var h,d,p=c.MutationObserver||c.WebKitMutationObserver;if(p){var f=0,b=new p(w),v=c.document.createTextNode("");b.observe(v,{characterData:!0}),h=function(){v.data=f=++f%2}}else if(c.setImmediate||c.MessageChannel===void 0)h="document"in c&&"onreadystatechange"in c.document.createElement("script")?function(){var $=c.document.createElement("script");$.onreadystatechange=function(){w(),$.onreadystatechange=null,$.parentNode.removeChild($),$=null},c.document.documentElement.appendChild($)}:function(){setTimeout(w,0)};else{var _=new c.MessageChannel;_.port1.onmessage=w,h=function(){_.port2.postMessage(0)}}var y=[];function w(){var $,I;d=!0;for(var T=y.length;T;){for(I=y,y=[],$=-1;++$<T;)I[$]();T=y.length}d=!1}a.exports=function($){y.push($)!==1||d||h()}}).call(this,typeof ro<"u"?ro:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(i,a,l){var c=i("immediate");function h(){}var d={},p=["REJECTED"],f=["FULFILLED"],b=["PENDING"];function v(T){if(typeof T!="function")throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,T!==h&&$(this,T)}function _(T,C,D){this.promise=T,typeof C=="function"&&(this.onFulfilled=C,this.callFulfilled=this.otherCallFulfilled),typeof D=="function"&&(this.onRejected=D,this.callRejected=this.otherCallRejected)}function y(T,C,D){c(function(){var R;try{R=C(D)}catch(N){return d.reject(T,N)}R===T?d.reject(T,new TypeError("Cannot resolve promise with itself")):d.resolve(T,R)})}function w(T){var C=T&&T.then;if(T&&(typeof T=="object"||typeof T=="function")&&typeof C=="function")return function(){C.apply(T,arguments)}}function $(T,C){var D=!1;function R(j){D||(D=!0,d.reject(T,j))}function N(j){D||(D=!0,d.resolve(T,j))}var U=I(function(){C(N,R)});U.status==="error"&&R(U.value)}function I(T,C){var D={};try{D.value=T(C),D.status="success"}catch(R){D.status="error",D.value=R}return D}(a.exports=v).prototype.finally=function(T){if(typeof T!="function")return this;var C=this.constructor;return this.then(function(D){return C.resolve(T()).then(function(){return D})},function(D){return C.resolve(T()).then(function(){throw D})})},v.prototype.catch=function(T){return this.then(null,T)},v.prototype.then=function(T,C){if(typeof T!="function"&&this.state===f||typeof C!="function"&&this.state===p)return this;var D=new this.constructor(h);return this.state!==b?y(D,this.state===f?T:C,this.outcome):this.queue.push(new _(D,T,C)),D},_.prototype.callFulfilled=function(T){d.resolve(this.promise,T)},_.prototype.otherCallFulfilled=function(T){y(this.promise,this.onFulfilled,T)},_.prototype.callRejected=function(T){d.reject(this.promise,T)},_.prototype.otherCallRejected=function(T){y(this.promise,this.onRejected,T)},d.resolve=function(T,C){var D=I(w,C);if(D.status==="error")return d.reject(T,D.value);var R=D.value;if(R)$(T,R);else{T.state=f,T.outcome=C;for(var N=-1,U=T.queue.length;++N<U;)T.queue[N].callFulfilled(C)}return T},d.reject=function(T,C){T.state=p,T.outcome=C;for(var D=-1,R=T.queue.length;++D<R;)T.queue[D].callRejected(C);return T},v.resolve=function(T){return T instanceof this?T:d.resolve(new this(h),T)},v.reject=function(T){var C=new this(h);return d.reject(C,T)},v.all=function(T){var C=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var D=T.length,R=!1;if(!D)return this.resolve([]);for(var N=new Array(D),U=0,j=-1,B=new this(h);++j<D;)J(T[j],j);return B;function J(ae,ye){C.resolve(ae).then(function(M){N[ye]=M,++U!==D||R||(R=!0,d.resolve(B,N))},function(M){R||(R=!0,d.reject(B,M))})}},v.race=function(T){var C=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var D=T.length,R=!1;if(!D)return this.resolve([]);for(var N=-1,U=new this(h);++N<D;)j=T[N],C.resolve(j).then(function(B){R||(R=!0,d.resolve(U,B))},function(B){R||(R=!0,d.reject(U,B))});var j;return U}},{immediate:36}],38:[function(i,a,l){var c={};(0,i("./lib/utils/common").assign)(c,i("./lib/deflate"),i("./lib/inflate"),i("./lib/zlib/constants")),a.exports=c},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(i,a,l){var c=i("./zlib/deflate"),h=i("./utils/common"),d=i("./utils/strings"),p=i("./zlib/messages"),f=i("./zlib/zstream"),b=Object.prototype.toString,v=0,_=-1,y=0,w=8;function $(T){if(!(this instanceof $))return new $(T);this.options=h.assign({level:_,method:w,chunkSize:16384,windowBits:15,memLevel:8,strategy:y,to:""},T||{});var C=this.options;C.raw&&0<C.windowBits?C.windowBits=-C.windowBits:C.gzip&&0<C.windowBits&&C.windowBits<16&&(C.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var D=c.deflateInit2(this.strm,C.level,C.method,C.windowBits,C.memLevel,C.strategy);if(D!==v)throw new Error(p[D]);if(C.header&&c.deflateSetHeader(this.strm,C.header),C.dictionary){var R;if(R=typeof C.dictionary=="string"?d.string2buf(C.dictionary):b.call(C.dictionary)==="[object ArrayBuffer]"?new Uint8Array(C.dictionary):C.dictionary,(D=c.deflateSetDictionary(this.strm,R))!==v)throw new Error(p[D]);this._dict_set=!0}}function I(T,C){var D=new $(C);if(D.push(T,!0),D.err)throw D.msg||p[D.err];return D.result}$.prototype.push=function(T,C){var D,R,N=this.strm,U=this.options.chunkSize;if(this.ended)return!1;R=C===~~C?C:C===!0?4:0,typeof T=="string"?N.input=d.string2buf(T):b.call(T)==="[object ArrayBuffer]"?N.input=new Uint8Array(T):N.input=T,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new h.Buf8(U),N.next_out=0,N.avail_out=U),(D=c.deflate(N,R))!==1&&D!==v)return this.onEnd(D),!(this.ended=!0);N.avail_out!==0&&(N.avail_in!==0||R!==4&&R!==2)||(this.options.to==="string"?this.onData(d.buf2binstring(h.shrinkBuf(N.output,N.next_out))):this.onData(h.shrinkBuf(N.output,N.next_out)))}while((0<N.avail_in||N.avail_out===0)&&D!==1);return R===4?(D=c.deflateEnd(this.strm),this.onEnd(D),this.ended=!0,D===v):R!==2||(this.onEnd(v),!(N.avail_out=0))},$.prototype.onData=function(T){this.chunks.push(T)},$.prototype.onEnd=function(T){T===v&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=T,this.msg=this.strm.msg},l.Deflate=$,l.deflate=I,l.deflateRaw=function(T,C){return(C=C||{}).raw=!0,I(T,C)},l.gzip=function(T,C){return(C=C||{}).gzip=!0,I(T,C)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(i,a,l){var c=i("./zlib/inflate"),h=i("./utils/common"),d=i("./utils/strings"),p=i("./zlib/constants"),f=i("./zlib/messages"),b=i("./zlib/zstream"),v=i("./zlib/gzheader"),_=Object.prototype.toString;function y($){if(!(this instanceof y))return new y($);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},$||{});var I=this.options;I.raw&&0<=I.windowBits&&I.windowBits<16&&(I.windowBits=-I.windowBits,I.windowBits===0&&(I.windowBits=-15)),!(0<=I.windowBits&&I.windowBits<16)||$&&$.windowBits||(I.windowBits+=32),15<I.windowBits&&I.windowBits<48&&(15&I.windowBits)==0&&(I.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b,this.strm.avail_out=0;var T=c.inflateInit2(this.strm,I.windowBits);if(T!==p.Z_OK)throw new Error(f[T]);this.header=new v,c.inflateGetHeader(this.strm,this.header)}function w($,I){var T=new y(I);if(T.push($,!0),T.err)throw T.msg||f[T.err];return T.result}y.prototype.push=function($,I){var T,C,D,R,N,U,j=this.strm,B=this.options.chunkSize,J=this.options.dictionary,ae=!1;if(this.ended)return!1;C=I===~~I?I:I===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof $=="string"?j.input=d.binstring2buf($):_.call($)==="[object ArrayBuffer]"?j.input=new Uint8Array($):j.input=$,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new h.Buf8(B),j.next_out=0,j.avail_out=B),(T=c.inflate(j,p.Z_NO_FLUSH))===p.Z_NEED_DICT&&J&&(U=typeof J=="string"?d.string2buf(J):_.call(J)==="[object ArrayBuffer]"?new Uint8Array(J):J,T=c.inflateSetDictionary(this.strm,U)),T===p.Z_BUF_ERROR&&ae===!0&&(T=p.Z_OK,ae=!1),T!==p.Z_STREAM_END&&T!==p.Z_OK)return this.onEnd(T),!(this.ended=!0);j.next_out&&(j.avail_out!==0&&T!==p.Z_STREAM_END&&(j.avail_in!==0||C!==p.Z_FINISH&&C!==p.Z_SYNC_FLUSH)||(this.options.to==="string"?(D=d.utf8border(j.output,j.next_out),R=j.next_out-D,N=d.buf2string(j.output,D),j.next_out=R,j.avail_out=B-R,R&&h.arraySet(j.output,j.output,D,R,0),this.onData(N)):this.onData(h.shrinkBuf(j.output,j.next_out)))),j.avail_in===0&&j.avail_out===0&&(ae=!0)}while((0<j.avail_in||j.avail_out===0)&&T!==p.Z_STREAM_END);return T===p.Z_STREAM_END&&(C=p.Z_FINISH),C===p.Z_FINISH?(T=c.inflateEnd(this.strm),this.onEnd(T),this.ended=!0,T===p.Z_OK):C!==p.Z_SYNC_FLUSH||(this.onEnd(p.Z_OK),!(j.avail_out=0))},y.prototype.onData=function($){this.chunks.push($)},y.prototype.onEnd=function($){$===p.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=$,this.msg=this.strm.msg},l.Inflate=y,l.inflate=w,l.inflateRaw=function($,I){return(I=I||{}).raw=!0,w($,I)},l.ungzip=w},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(i,a,l){var c=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";l.assign=function(p){for(var f=Array.prototype.slice.call(arguments,1);f.length;){var b=f.shift();if(b){if(typeof b!="object")throw new TypeError(b+"must be non-object");for(var v in b)b.hasOwnProperty(v)&&(p[v]=b[v])}}return p},l.shrinkBuf=function(p,f){return p.length===f?p:p.subarray?p.subarray(0,f):(p.length=f,p)};var h={arraySet:function(p,f,b,v,_){if(f.subarray&&p.subarray)p.set(f.subarray(b,b+v),_);else for(var y=0;y<v;y++)p[_+y]=f[b+y]},flattenChunks:function(p){var f,b,v,_,y,w;for(f=v=0,b=p.length;f<b;f++)v+=p[f].length;for(w=new Uint8Array(v),f=_=0,b=p.length;f<b;f++)y=p[f],w.set(y,_),_+=y.length;return w}},d={arraySet:function(p,f,b,v,_){for(var y=0;y<v;y++)p[_+y]=f[b+y]},flattenChunks:function(p){return[].concat.apply([],p)}};l.setTyped=function(p){p?(l.Buf8=Uint8Array,l.Buf16=Uint16Array,l.Buf32=Int32Array,l.assign(l,h)):(l.Buf8=Array,l.Buf16=Array,l.Buf32=Array,l.assign(l,d))},l.setTyped(c)},{}],42:[function(i,a,l){var c=i("./common"),h=!0,d=!0;try{String.fromCharCode.apply(null,[0])}catch{h=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{d=!1}for(var p=new c.Buf8(256),f=0;f<256;f++)p[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;function b(v,_){if(_<65537&&(v.subarray&&d||!v.subarray&&h))return String.fromCharCode.apply(null,c.shrinkBuf(v,_));for(var y="",w=0;w<_;w++)y+=String.fromCharCode(v[w]);return y}p[254]=p[254]=1,l.string2buf=function(v){var _,y,w,$,I,T=v.length,C=0;for($=0;$<T;$++)(64512&(y=v.charCodeAt($)))==55296&&$+1<T&&(64512&(w=v.charCodeAt($+1)))==56320&&(y=65536+(y-55296<<10)+(w-56320),$++),C+=y<128?1:y<2048?2:y<65536?3:4;for(_=new c.Buf8(C),$=I=0;I<C;$++)(64512&(y=v.charCodeAt($)))==55296&&$+1<T&&(64512&(w=v.charCodeAt($+1)))==56320&&(y=65536+(y-55296<<10)+(w-56320),$++),y<128?_[I++]=y:(y<2048?_[I++]=192|y>>>6:(y<65536?_[I++]=224|y>>>12:(_[I++]=240|y>>>18,_[I++]=128|y>>>12&63),_[I++]=128|y>>>6&63),_[I++]=128|63&y);return _},l.buf2binstring=function(v){return b(v,v.length)},l.binstring2buf=function(v){for(var _=new c.Buf8(v.length),y=0,w=_.length;y<w;y++)_[y]=v.charCodeAt(y);return _},l.buf2string=function(v,_){var y,w,$,I,T=_||v.length,C=new Array(2*T);for(y=w=0;y<T;)if(($=v[y++])<128)C[w++]=$;else if(4<(I=p[$]))C[w++]=65533,y+=I-1;else{for($&=I===2?31:I===3?15:7;1<I&&y<T;)$=$<<6|63&v[y++],I--;1<I?C[w++]=65533:$<65536?C[w++]=$:($-=65536,C[w++]=55296|$>>10&1023,C[w++]=56320|1023&$)}return b(C,w)},l.utf8border=function(v,_){var y;for((_=_||v.length)>v.length&&(_=v.length),y=_-1;0<=y&&(192&v[y])==128;)y--;return y<0||y===0?_:y+p[v[y]]>_?y:_}},{"./common":41}],43:[function(i,a,l){a.exports=function(c,h,d,p){for(var f=65535&c|0,b=c>>>16&65535|0,v=0;d!==0;){for(d-=v=2e3<d?2e3:d;b=b+(f=f+h[p++]|0)|0,--v;);f%=65521,b%=65521}return f|b<<16|0}},{}],44:[function(i,a,l){a.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(i,a,l){var c=(function(){for(var h,d=[],p=0;p<256;p++){h=p;for(var f=0;f<8;f++)h=1&h?3988292384^h>>>1:h>>>1;d[p]=h}return d})();a.exports=function(h,d,p,f){var b=c,v=f+p;h^=-1;for(var _=f;_<v;_++)h=h>>>8^b[255&(h^d[_])];return-1^h}},{}],46:[function(i,a,l){var c,h=i("../utils/common"),d=i("./trees"),p=i("./adler32"),f=i("./crc32"),b=i("./messages"),v=0,_=4,y=0,w=-2,$=-1,I=4,T=2,C=8,D=9,R=286,N=30,U=19,j=2*R+1,B=15,J=3,ae=258,ye=ae+J+1,M=42,W=113,k=1,X=2,ge=3,ce=4;function oe(S,te){return S.msg=b[te],te}function le(S){return(S<<1)-(4<S?9:0)}function Q(S){for(var te=S.length;0<=--te;)S[te]=0}function F(S){var te=S.state,Y=te.pending;Y>S.avail_out&&(Y=S.avail_out),Y!==0&&(h.arraySet(S.output,te.pending_buf,te.pending_out,Y,S.next_out),S.next_out+=Y,te.pending_out+=Y,S.total_out+=Y,S.avail_out-=Y,te.pending-=Y,te.pending===0&&(te.pending_out=0))}function P(S,te){d._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,te),S.block_start=S.strstart,F(S.strm)}function me(S,te){S.pending_buf[S.pending++]=te}function ne(S,te){S.pending_buf[S.pending++]=te>>>8&255,S.pending_buf[S.pending++]=255&te}function ie(S,te){var Y,O,A=S.max_chain_length,H=S.strstart,K=S.prev_length,ue=S.nice_match,G=S.strstart>S.w_size-ye?S.strstart-(S.w_size-ye):0,$e=S.window,we=S.w_mask,be=S.prev,Re=S.strstart+ae,Ge=$e[H+K-1],Fe=$e[H+K];S.prev_length>=S.good_match&&(A>>=2),ue>S.lookahead&&(ue=S.lookahead);do if($e[(Y=te)+K]===Fe&&$e[Y+K-1]===Ge&&$e[Y]===$e[H]&&$e[++Y]===$e[H+1]){H+=2,Y++;do;while($e[++H]===$e[++Y]&&$e[++H]===$e[++Y]&&$e[++H]===$e[++Y]&&$e[++H]===$e[++Y]&&$e[++H]===$e[++Y]&&$e[++H]===$e[++Y]&&$e[++H]===$e[++Y]&&$e[++H]===$e[++Y]&&H<Re);if(O=ae-(Re-H),H=Re-ae,K<O){if(S.match_start=te,ue<=(K=O))break;Ge=$e[H+K-1],Fe=$e[H+K]}}while((te=be[te&we])>G&&--A!=0);return K<=S.lookahead?K:S.lookahead}function ke(S){var te,Y,O,A,H,K,ue,G,$e,we,be=S.w_size;do{if(A=S.window_size-S.lookahead-S.strstart,S.strstart>=be+(be-ye)){for(h.arraySet(S.window,S.window,be,be,0),S.match_start-=be,S.strstart-=be,S.block_start-=be,te=Y=S.hash_size;O=S.head[--te],S.head[te]=be<=O?O-be:0,--Y;);for(te=Y=be;O=S.prev[--te],S.prev[te]=be<=O?O-be:0,--Y;);A+=be}if(S.strm.avail_in===0)break;if(K=S.strm,ue=S.window,G=S.strstart+S.lookahead,$e=A,we=void 0,we=K.avail_in,$e<we&&(we=$e),Y=we===0?0:(K.avail_in-=we,h.arraySet(ue,K.input,K.next_in,we,G),K.state.wrap===1?K.adler=p(K.adler,ue,we,G):K.state.wrap===2&&(K.adler=f(K.adler,ue,we,G)),K.next_in+=we,K.total_in+=we,we),S.lookahead+=Y,S.lookahead+S.insert>=J)for(H=S.strstart-S.insert,S.ins_h=S.window[H],S.ins_h=(S.ins_h<<S.hash_shift^S.window[H+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[H+J-1])&S.hash_mask,S.prev[H&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=H,H++,S.insert--,!(S.lookahead+S.insert<J)););}while(S.lookahead<ye&&S.strm.avail_in!==0)}function Ne(S,te){for(var Y,O;;){if(S.lookahead<ye){if(ke(S),S.lookahead<ye&&te===v)return k;if(S.lookahead===0)break}if(Y=0,S.lookahead>=J&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+J-1])&S.hash_mask,Y=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),Y!==0&&S.strstart-Y<=S.w_size-ye&&(S.match_length=ie(S,Y)),S.match_length>=J)if(O=d._tr_tally(S,S.strstart-S.match_start,S.match_length-J),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=J){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+J-1])&S.hash_mask,Y=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else O=d._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(O&&(P(S,!1),S.strm.avail_out===0))return k}return S.insert=S.strstart<J-1?S.strstart:J-1,te===_?(P(S,!0),S.strm.avail_out===0?ge:ce):S.last_lit&&(P(S,!1),S.strm.avail_out===0)?k:X}function Ae(S,te){for(var Y,O,A;;){if(S.lookahead<ye){if(ke(S),S.lookahead<ye&&te===v)return k;if(S.lookahead===0)break}if(Y=0,S.lookahead>=J&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+J-1])&S.hash_mask,Y=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=J-1,Y!==0&&S.prev_length<S.max_lazy_match&&S.strstart-Y<=S.w_size-ye&&(S.match_length=ie(S,Y),S.match_length<=5&&(S.strategy===1||S.match_length===J&&4096<S.strstart-S.match_start)&&(S.match_length=J-1)),S.prev_length>=J&&S.match_length<=S.prev_length){for(A=S.strstart+S.lookahead-J,O=d._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-J),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=A&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+J-1])&S.hash_mask,Y=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=J-1,S.strstart++,O&&(P(S,!1),S.strm.avail_out===0))return k}else if(S.match_available){if((O=d._tr_tally(S,0,S.window[S.strstart-1]))&&P(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return k}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(O=d._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<J-1?S.strstart:J-1,te===_?(P(S,!0),S.strm.avail_out===0?ge:ce):S.last_lit&&(P(S,!1),S.strm.avail_out===0)?k:X}function xe(S,te,Y,O,A){this.good_length=S,this.max_lazy=te,this.nice_length=Y,this.max_chain=O,this.func=A}function Pe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=C,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new h.Buf16(2*j),this.dyn_dtree=new h.Buf16(2*(2*N+1)),this.bl_tree=new h.Buf16(2*(2*U+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new h.Buf16(B+1),this.heap=new h.Buf16(2*R+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new h.Buf16(2*R+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function qe(S){var te;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=T,(te=S.state).pending=0,te.pending_out=0,te.wrap<0&&(te.wrap=-te.wrap),te.status=te.wrap?M:W,S.adler=te.wrap===2?0:1,te.last_flush=v,d._tr_init(te),y):oe(S,w)}function ct(S){var te=qe(S);return te===y&&(function(Y){Y.window_size=2*Y.w_size,Q(Y.head),Y.max_lazy_match=c[Y.level].max_lazy,Y.good_match=c[Y.level].good_length,Y.nice_match=c[Y.level].nice_length,Y.max_chain_length=c[Y.level].max_chain,Y.strstart=0,Y.block_start=0,Y.lookahead=0,Y.insert=0,Y.match_length=Y.prev_length=J-1,Y.match_available=0,Y.ins_h=0})(S.state),te}function ft(S,te,Y,O,A,H){if(!S)return w;var K=1;if(te===$&&(te=6),O<0?(K=0,O=-O):15<O&&(K=2,O-=16),A<1||D<A||Y!==C||O<8||15<O||te<0||9<te||H<0||I<H)return oe(S,w);O===8&&(O=9);var ue=new Pe;return(S.state=ue).strm=S,ue.wrap=K,ue.gzhead=null,ue.w_bits=O,ue.w_size=1<<ue.w_bits,ue.w_mask=ue.w_size-1,ue.hash_bits=A+7,ue.hash_size=1<<ue.hash_bits,ue.hash_mask=ue.hash_size-1,ue.hash_shift=~~((ue.hash_bits+J-1)/J),ue.window=new h.Buf8(2*ue.w_size),ue.head=new h.Buf16(ue.hash_size),ue.prev=new h.Buf16(ue.w_size),ue.lit_bufsize=1<<A+6,ue.pending_buf_size=4*ue.lit_bufsize,ue.pending_buf=new h.Buf8(ue.pending_buf_size),ue.d_buf=1*ue.lit_bufsize,ue.l_buf=3*ue.lit_bufsize,ue.level=te,ue.strategy=H,ue.method=Y,ct(S)}c=[new xe(0,0,0,0,function(S,te){var Y=65535;for(Y>S.pending_buf_size-5&&(Y=S.pending_buf_size-5);;){if(S.lookahead<=1){if(ke(S),S.lookahead===0&&te===v)return k;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var O=S.block_start+Y;if((S.strstart===0||S.strstart>=O)&&(S.lookahead=S.strstart-O,S.strstart=O,P(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-ye&&(P(S,!1),S.strm.avail_out===0))return k}return S.insert=0,te===_?(P(S,!0),S.strm.avail_out===0?ge:ce):(S.strstart>S.block_start&&(P(S,!1),S.strm.avail_out),k)}),new xe(4,4,8,4,Ne),new xe(4,5,16,8,Ne),new xe(4,6,32,32,Ne),new xe(4,4,16,16,Ae),new xe(8,16,32,32,Ae),new xe(8,16,128,128,Ae),new xe(8,32,128,256,Ae),new xe(32,128,258,1024,Ae),new xe(32,258,258,4096,Ae)],l.deflateInit=function(S,te){return ft(S,te,C,15,8,0)},l.deflateInit2=ft,l.deflateReset=ct,l.deflateResetKeep=qe,l.deflateSetHeader=function(S,te){return S&&S.state?S.state.wrap!==2?w:(S.state.gzhead=te,y):w},l.deflate=function(S,te){var Y,O,A,H;if(!S||!S.state||5<te||te<0)return S?oe(S,w):w;if(O=S.state,!S.output||!S.input&&S.avail_in!==0||O.status===666&&te!==_)return oe(S,S.avail_out===0?-5:w);if(O.strm=S,Y=O.last_flush,O.last_flush=te,O.status===M)if(O.wrap===2)S.adler=0,me(O,31),me(O,139),me(O,8),O.gzhead?(me(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),me(O,255&O.gzhead.time),me(O,O.gzhead.time>>8&255),me(O,O.gzhead.time>>16&255),me(O,O.gzhead.time>>24&255),me(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),me(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(me(O,255&O.gzhead.extra.length),me(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(S.adler=f(S.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(me(O,0),me(O,0),me(O,0),me(O,0),me(O,0),me(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),me(O,3),O.status=W);else{var K=C+(O.w_bits-8<<4)<<8;K|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(K|=32),K+=31-K%31,O.status=W,ne(O,K),O.strstart!==0&&(ne(O,S.adler>>>16),ne(O,65535&S.adler)),S.adler=1}if(O.status===69)if(O.gzhead.extra){for(A=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>A&&(S.adler=f(S.adler,O.pending_buf,O.pending-A,A)),F(S),A=O.pending,O.pending!==O.pending_buf_size));)me(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>A&&(S.adler=f(S.adler,O.pending_buf,O.pending-A,A)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){A=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>A&&(S.adler=f(S.adler,O.pending_buf,O.pending-A,A)),F(S),A=O.pending,O.pending===O.pending_buf_size)){H=1;break}H=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,me(O,H)}while(H!==0);O.gzhead.hcrc&&O.pending>A&&(S.adler=f(S.adler,O.pending_buf,O.pending-A,A)),H===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){A=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>A&&(S.adler=f(S.adler,O.pending_buf,O.pending-A,A)),F(S),A=O.pending,O.pending===O.pending_buf_size)){H=1;break}H=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,me(O,H)}while(H!==0);O.gzhead.hcrc&&O.pending>A&&(S.adler=f(S.adler,O.pending_buf,O.pending-A,A)),H===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&F(S),O.pending+2<=O.pending_buf_size&&(me(O,255&S.adler),me(O,S.adler>>8&255),S.adler=0,O.status=W)):O.status=W),O.pending!==0){if(F(S),S.avail_out===0)return O.last_flush=-1,y}else if(S.avail_in===0&&le(te)<=le(Y)&&te!==_)return oe(S,-5);if(O.status===666&&S.avail_in!==0)return oe(S,-5);if(S.avail_in!==0||O.lookahead!==0||te!==v&&O.status!==666){var ue=O.strategy===2?(function(G,$e){for(var we;;){if(G.lookahead===0&&(ke(G),G.lookahead===0)){if($e===v)return k;break}if(G.match_length=0,we=d._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++,we&&(P(G,!1),G.strm.avail_out===0))return k}return G.insert=0,$e===_?(P(G,!0),G.strm.avail_out===0?ge:ce):G.last_lit&&(P(G,!1),G.strm.avail_out===0)?k:X})(O,te):O.strategy===3?(function(G,$e){for(var we,be,Re,Ge,Fe=G.window;;){if(G.lookahead<=ae){if(ke(G),G.lookahead<=ae&&$e===v)return k;if(G.lookahead===0)break}if(G.match_length=0,G.lookahead>=J&&0<G.strstart&&(be=Fe[Re=G.strstart-1])===Fe[++Re]&&be===Fe[++Re]&&be===Fe[++Re]){Ge=G.strstart+ae;do;while(be===Fe[++Re]&&be===Fe[++Re]&&be===Fe[++Re]&&be===Fe[++Re]&&be===Fe[++Re]&&be===Fe[++Re]&&be===Fe[++Re]&&be===Fe[++Re]&&Re<Ge);G.match_length=ae-(Ge-Re),G.match_length>G.lookahead&&(G.match_length=G.lookahead)}if(G.match_length>=J?(we=d._tr_tally(G,1,G.match_length-J),G.lookahead-=G.match_length,G.strstart+=G.match_length,G.match_length=0):(we=d._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++),we&&(P(G,!1),G.strm.avail_out===0))return k}return G.insert=0,$e===_?(P(G,!0),G.strm.avail_out===0?ge:ce):G.last_lit&&(P(G,!1),G.strm.avail_out===0)?k:X})(O,te):c[O.level].func(O,te);if(ue!==ge&&ue!==ce||(O.status=666),ue===k||ue===ge)return S.avail_out===0&&(O.last_flush=-1),y;if(ue===X&&(te===1?d._tr_align(O):te!==5&&(d._tr_stored_block(O,0,0,!1),te===3&&(Q(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),F(S),S.avail_out===0))return O.last_flush=-1,y}return te!==_?y:O.wrap<=0?1:(O.wrap===2?(me(O,255&S.adler),me(O,S.adler>>8&255),me(O,S.adler>>16&255),me(O,S.adler>>24&255),me(O,255&S.total_in),me(O,S.total_in>>8&255),me(O,S.total_in>>16&255),me(O,S.total_in>>24&255)):(ne(O,S.adler>>>16),ne(O,65535&S.adler)),F(S),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?y:1)},l.deflateEnd=function(S){var te;return S&&S.state?(te=S.state.status)!==M&&te!==69&&te!==73&&te!==91&&te!==103&&te!==W&&te!==666?oe(S,w):(S.state=null,te===W?oe(S,-3):y):w},l.deflateSetDictionary=function(S,te){var Y,O,A,H,K,ue,G,$e,we=te.length;if(!S||!S.state||(H=(Y=S.state).wrap)===2||H===1&&Y.status!==M||Y.lookahead)return w;for(H===1&&(S.adler=p(S.adler,te,we,0)),Y.wrap=0,we>=Y.w_size&&(H===0&&(Q(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0),$e=new h.Buf8(Y.w_size),h.arraySet($e,te,we-Y.w_size,Y.w_size,0),te=$e,we=Y.w_size),K=S.avail_in,ue=S.next_in,G=S.input,S.avail_in=we,S.next_in=0,S.input=te,ke(Y);Y.lookahead>=J;){for(O=Y.strstart,A=Y.lookahead-(J-1);Y.ins_h=(Y.ins_h<<Y.hash_shift^Y.window[O+J-1])&Y.hash_mask,Y.prev[O&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=O,O++,--A;);Y.strstart=O,Y.lookahead=J-1,ke(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=J-1,Y.match_available=0,S.next_in=ue,S.input=G,S.avail_in=K,Y.wrap=H,y},l.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(i,a,l){a.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(i,a,l){a.exports=function(c,h){var d,p,f,b,v,_,y,w,$,I,T,C,D,R,N,U,j,B,J,ae,ye,M,W,k,X;d=c.state,p=c.next_in,k=c.input,f=p+(c.avail_in-5),b=c.next_out,X=c.output,v=b-(h-c.avail_out),_=b+(c.avail_out-257),y=d.dmax,w=d.wsize,$=d.whave,I=d.wnext,T=d.window,C=d.hold,D=d.bits,R=d.lencode,N=d.distcode,U=(1<<d.lenbits)-1,j=(1<<d.distbits)-1;e:do{D<15&&(C+=k[p++]<<D,D+=8,C+=k[p++]<<D,D+=8),B=R[C&U];t:for(;;){if(C>>>=J=B>>>24,D-=J,(J=B>>>16&255)===0)X[b++]=65535&B;else{if(!(16&J)){if((64&J)==0){B=R[(65535&B)+(C&(1<<J)-1)];continue t}if(32&J){d.mode=12;break e}c.msg="invalid literal/length code",d.mode=30;break e}ae=65535&B,(J&=15)&&(D<J&&(C+=k[p++]<<D,D+=8),ae+=C&(1<<J)-1,C>>>=J,D-=J),D<15&&(C+=k[p++]<<D,D+=8,C+=k[p++]<<D,D+=8),B=N[C&j];s:for(;;){if(C>>>=J=B>>>24,D-=J,!(16&(J=B>>>16&255))){if((64&J)==0){B=N[(65535&B)+(C&(1<<J)-1)];continue s}c.msg="invalid distance code",d.mode=30;break e}if(ye=65535&B,D<(J&=15)&&(C+=k[p++]<<D,(D+=8)<J&&(C+=k[p++]<<D,D+=8)),y<(ye+=C&(1<<J)-1)){c.msg="invalid distance too far back",d.mode=30;break e}if(C>>>=J,D-=J,(J=b-v)<ye){if($<(J=ye-J)&&d.sane){c.msg="invalid distance too far back",d.mode=30;break e}if(W=T,(M=0)===I){if(M+=w-J,J<ae){for(ae-=J;X[b++]=T[M++],--J;);M=b-ye,W=X}}else if(I<J){if(M+=w+I-J,(J-=I)<ae){for(ae-=J;X[b++]=T[M++],--J;);if(M=0,I<ae){for(ae-=J=I;X[b++]=T[M++],--J;);M=b-ye,W=X}}}else if(M+=I-J,J<ae){for(ae-=J;X[b++]=T[M++],--J;);M=b-ye,W=X}for(;2<ae;)X[b++]=W[M++],X[b++]=W[M++],X[b++]=W[M++],ae-=3;ae&&(X[b++]=W[M++],1<ae&&(X[b++]=W[M++]))}else{for(M=b-ye;X[b++]=X[M++],X[b++]=X[M++],X[b++]=X[M++],2<(ae-=3););ae&&(X[b++]=X[M++],1<ae&&(X[b++]=X[M++]))}break}}break}}while(p<f&&b<_);p-=ae=D>>3,C&=(1<<(D-=ae<<3))-1,c.next_in=p,c.next_out=b,c.avail_in=p<f?f-p+5:5-(p-f),c.avail_out=b<_?_-b+257:257-(b-_),d.hold=C,d.bits=D}},{}],49:[function(i,a,l){var c=i("../utils/common"),h=i("./adler32"),d=i("./crc32"),p=i("./inffast"),f=i("./inftrees"),b=1,v=2,_=0,y=-2,w=1,$=852,I=592;function T(M){return(M>>>24&255)+(M>>>8&65280)+((65280&M)<<8)+((255&M)<<24)}function C(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new c.Buf16(320),this.work=new c.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function D(M){var W;return M&&M.state?(W=M.state,M.total_in=M.total_out=W.total=0,M.msg="",W.wrap&&(M.adler=1&W.wrap),W.mode=w,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new c.Buf32($),W.distcode=W.distdyn=new c.Buf32(I),W.sane=1,W.back=-1,_):y}function R(M){var W;return M&&M.state?((W=M.state).wsize=0,W.whave=0,W.wnext=0,D(M)):y}function N(M,W){var k,X;return M&&M.state?(X=M.state,W<0?(k=0,W=-W):(k=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?y:(X.window!==null&&X.wbits!==W&&(X.window=null),X.wrap=k,X.wbits=W,R(M))):y}function U(M,W){var k,X;return M?(X=new C,(M.state=X).window=null,(k=N(M,W))!==_&&(M.state=null),k):y}var j,B,J=!0;function ae(M){if(J){var W;for(j=new c.Buf32(512),B=new c.Buf32(32),W=0;W<144;)M.lens[W++]=8;for(;W<256;)M.lens[W++]=9;for(;W<280;)M.lens[W++]=7;for(;W<288;)M.lens[W++]=8;for(f(b,M.lens,0,288,j,0,M.work,{bits:9}),W=0;W<32;)M.lens[W++]=5;f(v,M.lens,0,32,B,0,M.work,{bits:5}),J=!1}M.lencode=j,M.lenbits=9,M.distcode=B,M.distbits=5}function ye(M,W,k,X){var ge,ce=M.state;return ce.window===null&&(ce.wsize=1<<ce.wbits,ce.wnext=0,ce.whave=0,ce.window=new c.Buf8(ce.wsize)),X>=ce.wsize?(c.arraySet(ce.window,W,k-ce.wsize,ce.wsize,0),ce.wnext=0,ce.whave=ce.wsize):(X<(ge=ce.wsize-ce.wnext)&&(ge=X),c.arraySet(ce.window,W,k-X,ge,ce.wnext),(X-=ge)?(c.arraySet(ce.window,W,k-X,X,0),ce.wnext=X,ce.whave=ce.wsize):(ce.wnext+=ge,ce.wnext===ce.wsize&&(ce.wnext=0),ce.whave<ce.wsize&&(ce.whave+=ge))),0}l.inflateReset=R,l.inflateReset2=N,l.inflateResetKeep=D,l.inflateInit=function(M){return U(M,15)},l.inflateInit2=U,l.inflate=function(M,W){var k,X,ge,ce,oe,le,Q,F,P,me,ne,ie,ke,Ne,Ae,xe,Pe,qe,ct,ft,S,te,Y,O,A=0,H=new c.Buf8(4),K=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!M||!M.state||!M.output||!M.input&&M.avail_in!==0)return y;(k=M.state).mode===12&&(k.mode=13),oe=M.next_out,ge=M.output,Q=M.avail_out,ce=M.next_in,X=M.input,le=M.avail_in,F=k.hold,P=k.bits,me=le,ne=Q,te=_;e:for(;;)switch(k.mode){case w:if(k.wrap===0){k.mode=13;break}for(;P<16;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if(2&k.wrap&&F===35615){H[k.check=0]=255&F,H[1]=F>>>8&255,k.check=d(k.check,H,2,0),P=F=0,k.mode=2;break}if(k.flags=0,k.head&&(k.head.done=!1),!(1&k.wrap)||(((255&F)<<8)+(F>>8))%31){M.msg="incorrect header check",k.mode=30;break}if((15&F)!=8){M.msg="unknown compression method",k.mode=30;break}if(P-=4,S=8+(15&(F>>>=4)),k.wbits===0)k.wbits=S;else if(S>k.wbits){M.msg="invalid window size",k.mode=30;break}k.dmax=1<<S,M.adler=k.check=1,k.mode=512&F?10:12,P=F=0;break;case 2:for(;P<16;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if(k.flags=F,(255&k.flags)!=8){M.msg="unknown compression method",k.mode=30;break}if(57344&k.flags){M.msg="unknown header flags set",k.mode=30;break}k.head&&(k.head.text=F>>8&1),512&k.flags&&(H[0]=255&F,H[1]=F>>>8&255,k.check=d(k.check,H,2,0)),P=F=0,k.mode=3;case 3:for(;P<32;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}k.head&&(k.head.time=F),512&k.flags&&(H[0]=255&F,H[1]=F>>>8&255,H[2]=F>>>16&255,H[3]=F>>>24&255,k.check=d(k.check,H,4,0)),P=F=0,k.mode=4;case 4:for(;P<16;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}k.head&&(k.head.xflags=255&F,k.head.os=F>>8),512&k.flags&&(H[0]=255&F,H[1]=F>>>8&255,k.check=d(k.check,H,2,0)),P=F=0,k.mode=5;case 5:if(1024&k.flags){for(;P<16;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}k.length=F,k.head&&(k.head.extra_len=F),512&k.flags&&(H[0]=255&F,H[1]=F>>>8&255,k.check=d(k.check,H,2,0)),P=F=0}else k.head&&(k.head.extra=null);k.mode=6;case 6:if(1024&k.flags&&(le<(ie=k.length)&&(ie=le),ie&&(k.head&&(S=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),c.arraySet(k.head.extra,X,ce,ie,S)),512&k.flags&&(k.check=d(k.check,X,ie,ce)),le-=ie,ce+=ie,k.length-=ie),k.length))break e;k.length=0,k.mode=7;case 7:if(2048&k.flags){if(le===0)break e;for(ie=0;S=X[ce+ie++],k.head&&S&&k.length<65536&&(k.head.name+=String.fromCharCode(S)),S&&ie<le;);if(512&k.flags&&(k.check=d(k.check,X,ie,ce)),le-=ie,ce+=ie,S)break e}else k.head&&(k.head.name=null);k.length=0,k.mode=8;case 8:if(4096&k.flags){if(le===0)break e;for(ie=0;S=X[ce+ie++],k.head&&S&&k.length<65536&&(k.head.comment+=String.fromCharCode(S)),S&&ie<le;);if(512&k.flags&&(k.check=d(k.check,X,ie,ce)),le-=ie,ce+=ie,S)break e}else k.head&&(k.head.comment=null);k.mode=9;case 9:if(512&k.flags){for(;P<16;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if(F!==(65535&k.check)){M.msg="header crc mismatch",k.mode=30;break}P=F=0}k.head&&(k.head.hcrc=k.flags>>9&1,k.head.done=!0),M.adler=k.check=0,k.mode=12;break;case 10:for(;P<32;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}M.adler=k.check=T(F),P=F=0,k.mode=11;case 11:if(k.havedict===0)return M.next_out=oe,M.avail_out=Q,M.next_in=ce,M.avail_in=le,k.hold=F,k.bits=P,2;M.adler=k.check=1,k.mode=12;case 12:if(W===5||W===6)break e;case 13:if(k.last){F>>>=7&P,P-=7&P,k.mode=27;break}for(;P<3;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}switch(k.last=1&F,P-=1,3&(F>>>=1)){case 0:k.mode=14;break;case 1:if(ae(k),k.mode=20,W!==6)break;F>>>=2,P-=2;break e;case 2:k.mode=17;break;case 3:M.msg="invalid block type",k.mode=30}F>>>=2,P-=2;break;case 14:for(F>>>=7&P,P-=7&P;P<32;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if((65535&F)!=(F>>>16^65535)){M.msg="invalid stored block lengths",k.mode=30;break}if(k.length=65535&F,P=F=0,k.mode=15,W===6)break e;case 15:k.mode=16;case 16:if(ie=k.length){if(le<ie&&(ie=le),Q<ie&&(ie=Q),ie===0)break e;c.arraySet(ge,X,ce,ie,oe),le-=ie,ce+=ie,Q-=ie,oe+=ie,k.length-=ie;break}k.mode=12;break;case 17:for(;P<14;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if(k.nlen=257+(31&F),F>>>=5,P-=5,k.ndist=1+(31&F),F>>>=5,P-=5,k.ncode=4+(15&F),F>>>=4,P-=4,286<k.nlen||30<k.ndist){M.msg="too many length or distance symbols",k.mode=30;break}k.have=0,k.mode=18;case 18:for(;k.have<k.ncode;){for(;P<3;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}k.lens[K[k.have++]]=7&F,F>>>=3,P-=3}for(;k.have<19;)k.lens[K[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,Y={bits:k.lenbits},te=f(0,k.lens,0,19,k.lencode,0,k.work,Y),k.lenbits=Y.bits,te){M.msg="invalid code lengths set",k.mode=30;break}k.have=0,k.mode=19;case 19:for(;k.have<k.nlen+k.ndist;){for(;xe=(A=k.lencode[F&(1<<k.lenbits)-1])>>>16&255,Pe=65535&A,!((Ae=A>>>24)<=P);){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if(Pe<16)F>>>=Ae,P-=Ae,k.lens[k.have++]=Pe;else{if(Pe===16){for(O=Ae+2;P<O;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if(F>>>=Ae,P-=Ae,k.have===0){M.msg="invalid bit length repeat",k.mode=30;break}S=k.lens[k.have-1],ie=3+(3&F),F>>>=2,P-=2}else if(Pe===17){for(O=Ae+3;P<O;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}P-=Ae,S=0,ie=3+(7&(F>>>=Ae)),F>>>=3,P-=3}else{for(O=Ae+7;P<O;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}P-=Ae,S=0,ie=11+(127&(F>>>=Ae)),F>>>=7,P-=7}if(k.have+ie>k.nlen+k.ndist){M.msg="invalid bit length repeat",k.mode=30;break}for(;ie--;)k.lens[k.have++]=S}}if(k.mode===30)break;if(k.lens[256]===0){M.msg="invalid code -- missing end-of-block",k.mode=30;break}if(k.lenbits=9,Y={bits:k.lenbits},te=f(b,k.lens,0,k.nlen,k.lencode,0,k.work,Y),k.lenbits=Y.bits,te){M.msg="invalid literal/lengths set",k.mode=30;break}if(k.distbits=6,k.distcode=k.distdyn,Y={bits:k.distbits},te=f(v,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,Y),k.distbits=Y.bits,te){M.msg="invalid distances set",k.mode=30;break}if(k.mode=20,W===6)break e;case 20:k.mode=21;case 21:if(6<=le&&258<=Q){M.next_out=oe,M.avail_out=Q,M.next_in=ce,M.avail_in=le,k.hold=F,k.bits=P,p(M,ne),oe=M.next_out,ge=M.output,Q=M.avail_out,ce=M.next_in,X=M.input,le=M.avail_in,F=k.hold,P=k.bits,k.mode===12&&(k.back=-1);break}for(k.back=0;xe=(A=k.lencode[F&(1<<k.lenbits)-1])>>>16&255,Pe=65535&A,!((Ae=A>>>24)<=P);){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if(xe&&(240&xe)==0){for(qe=Ae,ct=xe,ft=Pe;xe=(A=k.lencode[ft+((F&(1<<qe+ct)-1)>>qe)])>>>16&255,Pe=65535&A,!(qe+(Ae=A>>>24)<=P);){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}F>>>=qe,P-=qe,k.back+=qe}if(F>>>=Ae,P-=Ae,k.back+=Ae,k.length=Pe,xe===0){k.mode=26;break}if(32&xe){k.back=-1,k.mode=12;break}if(64&xe){M.msg="invalid literal/length code",k.mode=30;break}k.extra=15&xe,k.mode=22;case 22:if(k.extra){for(O=k.extra;P<O;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}k.length+=F&(1<<k.extra)-1,F>>>=k.extra,P-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=23;case 23:for(;xe=(A=k.distcode[F&(1<<k.distbits)-1])>>>16&255,Pe=65535&A,!((Ae=A>>>24)<=P);){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if((240&xe)==0){for(qe=Ae,ct=xe,ft=Pe;xe=(A=k.distcode[ft+((F&(1<<qe+ct)-1)>>qe)])>>>16&255,Pe=65535&A,!(qe+(Ae=A>>>24)<=P);){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}F>>>=qe,P-=qe,k.back+=qe}if(F>>>=Ae,P-=Ae,k.back+=Ae,64&xe){M.msg="invalid distance code",k.mode=30;break}k.offset=Pe,k.extra=15&xe,k.mode=24;case 24:if(k.extra){for(O=k.extra;P<O;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}k.offset+=F&(1<<k.extra)-1,F>>>=k.extra,P-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){M.msg="invalid distance too far back",k.mode=30;break}k.mode=25;case 25:if(Q===0)break e;if(ie=ne-Q,k.offset>ie){if((ie=k.offset-ie)>k.whave&&k.sane){M.msg="invalid distance too far back",k.mode=30;break}ke=ie>k.wnext?(ie-=k.wnext,k.wsize-ie):k.wnext-ie,ie>k.length&&(ie=k.length),Ne=k.window}else Ne=ge,ke=oe-k.offset,ie=k.length;for(Q<ie&&(ie=Q),Q-=ie,k.length-=ie;ge[oe++]=Ne[ke++],--ie;);k.length===0&&(k.mode=21);break;case 26:if(Q===0)break e;ge[oe++]=k.length,Q--,k.mode=21;break;case 27:if(k.wrap){for(;P<32;){if(le===0)break e;le--,F|=X[ce++]<<P,P+=8}if(ne-=Q,M.total_out+=ne,k.total+=ne,ne&&(M.adler=k.check=k.flags?d(k.check,ge,ne,oe-ne):h(k.check,ge,ne,oe-ne)),ne=Q,(k.flags?F:T(F))!==k.check){M.msg="incorrect data check",k.mode=30;break}P=F=0}k.mode=28;case 28:if(k.wrap&&k.flags){for(;P<32;){if(le===0)break e;le--,F+=X[ce++]<<P,P+=8}if(F!==(4294967295&k.total)){M.msg="incorrect length check",k.mode=30;break}P=F=0}k.mode=29;case 29:te=1;break e;case 30:te=-3;break e;case 31:return-4;default:return y}return M.next_out=oe,M.avail_out=Q,M.next_in=ce,M.avail_in=le,k.hold=F,k.bits=P,(k.wsize||ne!==M.avail_out&&k.mode<30&&(k.mode<27||W!==4))&&ye(M,M.output,M.next_out,ne-M.avail_out)?(k.mode=31,-4):(me-=M.avail_in,ne-=M.avail_out,M.total_in+=me,M.total_out+=ne,k.total+=ne,k.wrap&&ne&&(M.adler=k.check=k.flags?d(k.check,ge,ne,M.next_out-ne):h(k.check,ge,ne,M.next_out-ne)),M.data_type=k.bits+(k.last?64:0)+(k.mode===12?128:0)+(k.mode===20||k.mode===15?256:0),(me==0&&ne===0||W===4)&&te===_&&(te=-5),te)},l.inflateEnd=function(M){if(!M||!M.state)return y;var W=M.state;return W.window&&(W.window=null),M.state=null,_},l.inflateGetHeader=function(M,W){var k;return M&&M.state?(2&(k=M.state).wrap)==0?y:((k.head=W).done=!1,_):y},l.inflateSetDictionary=function(M,W){var k,X=W.length;return M&&M.state?(k=M.state).wrap!==0&&k.mode!==11?y:k.mode===11&&h(1,W,X,0)!==k.check?-3:ye(M,W,X,X)?(k.mode=31,-4):(k.havedict=1,_):y},l.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(i,a,l){var c=i("../utils/common"),h=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],d=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],p=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],f=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];a.exports=function(b,v,_,y,w,$,I,T){var C,D,R,N,U,j,B,J,ae,ye=T.bits,M=0,W=0,k=0,X=0,ge=0,ce=0,oe=0,le=0,Q=0,F=0,P=null,me=0,ne=new c.Buf16(16),ie=new c.Buf16(16),ke=null,Ne=0;for(M=0;M<=15;M++)ne[M]=0;for(W=0;W<y;W++)ne[v[_+W]]++;for(ge=ye,X=15;1<=X&&ne[X]===0;X--);if(X<ge&&(ge=X),X===0)return w[$++]=20971520,w[$++]=20971520,T.bits=1,0;for(k=1;k<X&&ne[k]===0;k++);for(ge<k&&(ge=k),M=le=1;M<=15;M++)if(le<<=1,(le-=ne[M])<0)return-1;if(0<le&&(b===0||X!==1))return-1;for(ie[1]=0,M=1;M<15;M++)ie[M+1]=ie[M]+ne[M];for(W=0;W<y;W++)v[_+W]!==0&&(I[ie[v[_+W]]++]=W);if(j=b===0?(P=ke=I,19):b===1?(P=h,me-=257,ke=d,Ne-=257,256):(P=p,ke=f,-1),M=k,U=$,oe=W=F=0,R=-1,N=(Q=1<<(ce=ge))-1,b===1&&852<Q||b===2&&592<Q)return 1;for(;;){for(B=M-oe,ae=I[W]<j?(J=0,I[W]):I[W]>j?(J=ke[Ne+I[W]],P[me+I[W]]):(J=96,0),C=1<<M-oe,k=D=1<<ce;w[U+(F>>oe)+(D-=C)]=B<<24|J<<16|ae|0,D!==0;);for(C=1<<M-1;F&C;)C>>=1;if(C!==0?(F&=C-1,F+=C):F=0,W++,--ne[M]==0){if(M===X)break;M=v[_+I[W]]}if(ge<M&&(F&N)!==R){for(oe===0&&(oe=ge),U+=k,le=1<<(ce=M-oe);ce+oe<X&&!((le-=ne[ce+oe])<=0);)ce++,le<<=1;if(Q+=1<<ce,b===1&&852<Q||b===2&&592<Q)return 1;w[R=F&N]=ge<<24|ce<<16|U-$|0}}return F!==0&&(w[U+F]=M-oe<<24|64<<16|0),T.bits=ge,0}},{"../utils/common":41}],51:[function(i,a,l){a.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(i,a,l){var c=i("../utils/common"),h=0,d=1;function p(A){for(var H=A.length;0<=--H;)A[H]=0}var f=0,b=29,v=256,_=v+1+b,y=30,w=19,$=2*_+1,I=15,T=16,C=7,D=256,R=16,N=17,U=18,j=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],B=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],J=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ae=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ye=new Array(2*(_+2));p(ye);var M=new Array(2*y);p(M);var W=new Array(512);p(W);var k=new Array(256);p(k);var X=new Array(b);p(X);var ge,ce,oe,le=new Array(y);function Q(A,H,K,ue,G){this.static_tree=A,this.extra_bits=H,this.extra_base=K,this.elems=ue,this.max_length=G,this.has_stree=A&&A.length}function F(A,H){this.dyn_tree=A,this.max_code=0,this.stat_desc=H}function P(A){return A<256?W[A]:W[256+(A>>>7)]}function me(A,H){A.pending_buf[A.pending++]=255&H,A.pending_buf[A.pending++]=H>>>8&255}function ne(A,H,K){A.bi_valid>T-K?(A.bi_buf|=H<<A.bi_valid&65535,me(A,A.bi_buf),A.bi_buf=H>>T-A.bi_valid,A.bi_valid+=K-T):(A.bi_buf|=H<<A.bi_valid&65535,A.bi_valid+=K)}function ie(A,H,K){ne(A,K[2*H],K[2*H+1])}function ke(A,H){for(var K=0;K|=1&A,A>>>=1,K<<=1,0<--H;);return K>>>1}function Ne(A,H,K){var ue,G,$e=new Array(I+1),we=0;for(ue=1;ue<=I;ue++)$e[ue]=we=we+K[ue-1]<<1;for(G=0;G<=H;G++){var be=A[2*G+1];be!==0&&(A[2*G]=ke($e[be]++,be))}}function Ae(A){var H;for(H=0;H<_;H++)A.dyn_ltree[2*H]=0;for(H=0;H<y;H++)A.dyn_dtree[2*H]=0;for(H=0;H<w;H++)A.bl_tree[2*H]=0;A.dyn_ltree[2*D]=1,A.opt_len=A.static_len=0,A.last_lit=A.matches=0}function xe(A){8<A.bi_valid?me(A,A.bi_buf):0<A.bi_valid&&(A.pending_buf[A.pending++]=A.bi_buf),A.bi_buf=0,A.bi_valid=0}function Pe(A,H,K,ue){var G=2*H,$e=2*K;return A[G]<A[$e]||A[G]===A[$e]&&ue[H]<=ue[K]}function qe(A,H,K){for(var ue=A.heap[K],G=K<<1;G<=A.heap_len&&(G<A.heap_len&&Pe(H,A.heap[G+1],A.heap[G],A.depth)&&G++,!Pe(H,ue,A.heap[G],A.depth));)A.heap[K]=A.heap[G],K=G,G<<=1;A.heap[K]=ue}function ct(A,H,K){var ue,G,$e,we,be=0;if(A.last_lit!==0)for(;ue=A.pending_buf[A.d_buf+2*be]<<8|A.pending_buf[A.d_buf+2*be+1],G=A.pending_buf[A.l_buf+be],be++,ue===0?ie(A,G,H):(ie(A,($e=k[G])+v+1,H),(we=j[$e])!==0&&ne(A,G-=X[$e],we),ie(A,$e=P(--ue),K),(we=B[$e])!==0&&ne(A,ue-=le[$e],we)),be<A.last_lit;);ie(A,D,H)}function ft(A,H){var K,ue,G,$e=H.dyn_tree,we=H.stat_desc.static_tree,be=H.stat_desc.has_stree,Re=H.stat_desc.elems,Ge=-1;for(A.heap_len=0,A.heap_max=$,K=0;K<Re;K++)$e[2*K]!==0?(A.heap[++A.heap_len]=Ge=K,A.depth[K]=0):$e[2*K+1]=0;for(;A.heap_len<2;)$e[2*(G=A.heap[++A.heap_len]=Ge<2?++Ge:0)]=1,A.depth[G]=0,A.opt_len--,be&&(A.static_len-=we[2*G+1]);for(H.max_code=Ge,K=A.heap_len>>1;1<=K;K--)qe(A,$e,K);for(G=Re;K=A.heap[1],A.heap[1]=A.heap[A.heap_len--],qe(A,$e,1),ue=A.heap[1],A.heap[--A.heap_max]=K,A.heap[--A.heap_max]=ue,$e[2*G]=$e[2*K]+$e[2*ue],A.depth[G]=(A.depth[K]>=A.depth[ue]?A.depth[K]:A.depth[ue])+1,$e[2*K+1]=$e[2*ue+1]=G,A.heap[1]=G++,qe(A,$e,1),2<=A.heap_len;);A.heap[--A.heap_max]=A.heap[1],(function(Fe,Ht){var ee,Ie,Us,Be,ai,Ze,Nt=Ht.dyn_tree,li=Ht.max_code,co=Ht.stat_desc.static_tree,uo=Ht.stat_desc.has_stree,sr=Ht.stat_desc.extra_bits,Mo=Ht.stat_desc.extra_base,Hs=Ht.stat_desc.max_length,ho=0;for(Be=0;Be<=I;Be++)Fe.bl_count[Be]=0;for(Nt[2*Fe.heap[Fe.heap_max]+1]=0,ee=Fe.heap_max+1;ee<$;ee++)Hs<(Be=Nt[2*Nt[2*(Ie=Fe.heap[ee])+1]+1]+1)&&(Be=Hs,ho++),Nt[2*Ie+1]=Be,li<Ie||(Fe.bl_count[Be]++,ai=0,Mo<=Ie&&(ai=sr[Ie-Mo]),Ze=Nt[2*Ie],Fe.opt_len+=Ze*(Be+ai),uo&&(Fe.static_len+=Ze*(co[2*Ie+1]+ai)));if(ho!==0){do{for(Be=Hs-1;Fe.bl_count[Be]===0;)Be--;Fe.bl_count[Be]--,Fe.bl_count[Be+1]+=2,Fe.bl_count[Hs]--,ho-=2}while(0<ho);for(Be=Hs;Be!==0;Be--)for(Ie=Fe.bl_count[Be];Ie!==0;)li<(Us=Fe.heap[--ee])||(Nt[2*Us+1]!==Be&&(Fe.opt_len+=(Be-Nt[2*Us+1])*Nt[2*Us],Nt[2*Us+1]=Be),Ie--)}})(A,H),Ne($e,Ge,A.bl_count)}function S(A,H,K){var ue,G,$e=-1,we=H[1],be=0,Re=7,Ge=4;for(we===0&&(Re=138,Ge=3),H[2*(K+1)+1]=65535,ue=0;ue<=K;ue++)G=we,we=H[2*(ue+1)+1],++be<Re&&G===we||(be<Ge?A.bl_tree[2*G]+=be:G!==0?(G!==$e&&A.bl_tree[2*G]++,A.bl_tree[2*R]++):be<=10?A.bl_tree[2*N]++:A.bl_tree[2*U]++,$e=G,Ge=(be=0)===we?(Re=138,3):G===we?(Re=6,3):(Re=7,4))}function te(A,H,K){var ue,G,$e=-1,we=H[1],be=0,Re=7,Ge=4;for(we===0&&(Re=138,Ge=3),ue=0;ue<=K;ue++)if(G=we,we=H[2*(ue+1)+1],!(++be<Re&&G===we)){if(be<Ge)for(;ie(A,G,A.bl_tree),--be!=0;);else G!==0?(G!==$e&&(ie(A,G,A.bl_tree),be--),ie(A,R,A.bl_tree),ne(A,be-3,2)):be<=10?(ie(A,N,A.bl_tree),ne(A,be-3,3)):(ie(A,U,A.bl_tree),ne(A,be-11,7));$e=G,Ge=(be=0)===we?(Re=138,3):G===we?(Re=6,3):(Re=7,4)}}p(le);var Y=!1;function O(A,H,K,ue){ne(A,(f<<1)+(ue?1:0),3),(function(G,$e,we,be){xe(G),me(G,we),me(G,~we),c.arraySet(G.pending_buf,G.window,$e,we,G.pending),G.pending+=we})(A,H,K)}l._tr_init=function(A){Y||((function(){var H,K,ue,G,$e,we=new Array(I+1);for(G=ue=0;G<b-1;G++)for(X[G]=ue,H=0;H<1<<j[G];H++)k[ue++]=G;for(k[ue-1]=G,G=$e=0;G<16;G++)for(le[G]=$e,H=0;H<1<<B[G];H++)W[$e++]=G;for($e>>=7;G<y;G++)for(le[G]=$e<<7,H=0;H<1<<B[G]-7;H++)W[256+$e++]=G;for(K=0;K<=I;K++)we[K]=0;for(H=0;H<=143;)ye[2*H+1]=8,H++,we[8]++;for(;H<=255;)ye[2*H+1]=9,H++,we[9]++;for(;H<=279;)ye[2*H+1]=7,H++,we[7]++;for(;H<=287;)ye[2*H+1]=8,H++,we[8]++;for(Ne(ye,_+1,we),H=0;H<y;H++)M[2*H+1]=5,M[2*H]=ke(H,5);ge=new Q(ye,j,v+1,_,I),ce=new Q(M,B,0,y,I),oe=new Q(new Array(0),J,0,w,C)})(),Y=!0),A.l_desc=new F(A.dyn_ltree,ge),A.d_desc=new F(A.dyn_dtree,ce),A.bl_desc=new F(A.bl_tree,oe),A.bi_buf=0,A.bi_valid=0,Ae(A)},l._tr_stored_block=O,l._tr_flush_block=function(A,H,K,ue){var G,$e,we=0;0<A.level?(A.strm.data_type===2&&(A.strm.data_type=(function(be){var Re,Ge=4093624447;for(Re=0;Re<=31;Re++,Ge>>>=1)if(1&Ge&&be.dyn_ltree[2*Re]!==0)return h;if(be.dyn_ltree[18]!==0||be.dyn_ltree[20]!==0||be.dyn_ltree[26]!==0)return d;for(Re=32;Re<v;Re++)if(be.dyn_ltree[2*Re]!==0)return d;return h})(A)),ft(A,A.l_desc),ft(A,A.d_desc),we=(function(be){var Re;for(S(be,be.dyn_ltree,be.l_desc.max_code),S(be,be.dyn_dtree,be.d_desc.max_code),ft(be,be.bl_desc),Re=w-1;3<=Re&&be.bl_tree[2*ae[Re]+1]===0;Re--);return be.opt_len+=3*(Re+1)+5+5+4,Re})(A),G=A.opt_len+3+7>>>3,($e=A.static_len+3+7>>>3)<=G&&(G=$e)):G=$e=K+5,K+4<=G&&H!==-1?O(A,H,K,ue):A.strategy===4||$e===G?(ne(A,2+(ue?1:0),3),ct(A,ye,M)):(ne(A,4+(ue?1:0),3),(function(be,Re,Ge,Fe){var Ht;for(ne(be,Re-257,5),ne(be,Ge-1,5),ne(be,Fe-4,4),Ht=0;Ht<Fe;Ht++)ne(be,be.bl_tree[2*ae[Ht]+1],3);te(be,be.dyn_ltree,Re-1),te(be,be.dyn_dtree,Ge-1)})(A,A.l_desc.max_code+1,A.d_desc.max_code+1,we+1),ct(A,A.dyn_ltree,A.dyn_dtree)),Ae(A),ue&&xe(A)},l._tr_tally=function(A,H,K){return A.pending_buf[A.d_buf+2*A.last_lit]=H>>>8&255,A.pending_buf[A.d_buf+2*A.last_lit+1]=255&H,A.pending_buf[A.l_buf+A.last_lit]=255&K,A.last_lit++,H===0?A.dyn_ltree[2*K]++:(A.matches++,H--,A.dyn_ltree[2*(k[K]+v+1)]++,A.dyn_dtree[2*P(H)]++),A.last_lit===A.lit_bufsize-1},l._tr_align=function(A){ne(A,2,3),ie(A,D,ye),(function(H){H.bi_valid===16?(me(H,H.bi_buf),H.bi_buf=0,H.bi_valid=0):8<=H.bi_valid&&(H.pending_buf[H.pending++]=255&H.bi_buf,H.bi_buf>>=8,H.bi_valid-=8)})(A)}},{"../utils/common":41}],53:[function(i,a,l){a.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,a,l){(function(c){(function(h,d){if(!h.setImmediate){var p,f,b,v,_=1,y={},w=!1,$=h.document,I=Object.getPrototypeOf&&Object.getPrototypeOf(h);I=I&&I.setTimeout?I:h,p={}.toString.call(h.process)==="[object process]"?function(R){process.nextTick(function(){C(R)})}:(function(){if(h.postMessage&&!h.importScripts){var R=!0,N=h.onmessage;return h.onmessage=function(){R=!1},h.postMessage("","*"),h.onmessage=N,R}})()?(v="setImmediate$"+Math.random()+"$",h.addEventListener?h.addEventListener("message",D,!1):h.attachEvent("onmessage",D),function(R){h.postMessage(v+R,"*")}):h.MessageChannel?((b=new MessageChannel).port1.onmessage=function(R){C(R.data)},function(R){b.port2.postMessage(R)}):$&&"onreadystatechange"in $.createElement("script")?(f=$.documentElement,function(R){var N=$.createElement("script");N.onreadystatechange=function(){C(R),N.onreadystatechange=null,f.removeChild(N),N=null},f.appendChild(N)}):function(R){setTimeout(C,0,R)},I.setImmediate=function(R){typeof R!="function"&&(R=new Function(""+R));for(var N=new Array(arguments.length-1),U=0;U<N.length;U++)N[U]=arguments[U+1];var j={callback:R,args:N};return y[_]=j,p(_),_++},I.clearImmediate=T}function T(R){delete y[R]}function C(R){if(w)setTimeout(C,0,R);else{var N=y[R];if(N){w=!0;try{(function(U){var j=U.callback,B=U.args;switch(B.length){case 0:j();break;case 1:j(B[0]);break;case 2:j(B[0],B[1]);break;case 3:j(B[0],B[1],B[2]);break;default:j.apply(d,B)}})(N)}finally{T(R),w=!1}}}}function D(R){R.source===h&&typeof R.data=="string"&&R.data.indexOf(v)===0&&C(+R.data.slice(v.length))}})(typeof self>"u"?c===void 0?this:c:self)}).call(this,typeof ro<"u"?ro:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(SS);var Une=SS.exports;const ek=ri(Une);function Hne(r){const[s,i]=pe.useState(""),[a,l]=pe.useState("");return Ft(()=>{r.socket.decrypt(r.systemConfig.native.javascriptPassword).then(c=>l(c))},[r.systemConfig,r.socket]),g.jsxs(zt,{open:!0,onClose:()=>r.onEntered(null),fullWidth:!0,maxWidth:"sm",children:[g.jsx(ts,{children:x.I18n.t("Please enter a password for expert mode")}),g.jsx(Yt,{children:g.jsx(Oo,{autoFocus:!0,margin:"dense",variant:"standard",label:x.I18n.t("Password"),type:"password",fullWidth:!0,value:s,onKeyDown:c=>{c.key==="Enter"&&s&&(c.preventDefault(),c.stopPropagation(),a===s?r.onEntered(s):r.onEntered(""))},onChange:c=>i(c.target.value)})}),g.jsxs(Ut,{children:[g.jsx(je,{variant:"contained",disabled:!s,onClick:()=>{a===s?r.onEntered(s):r.onEntered("")},startIcon:g.jsx(ni,{}),children:x.I18n.t("Ok")}),g.jsx(je,{color:"grey",variant:"contained",onClick:()=>r.onEntered(null),startIcon:g.jsx(ao,{}),children:x.I18n.t("Cancel")})]})]})}const ra={root:{flexGrow:1,display:"flex",width:"100%",height:"100%"},mainDiv:{width:"100%",height:"100%",overflow:"hidden"},content:r=>({width:"100%",height:"100%",backgroundColor:r.palette.background&&r.palette.background.default,position:"relative"}),menuOpenCloseButton:r=>({position:"absolute",left:0,borderRadius:"0 5px 5px 0",top:6,pt:1,cursor:"pointer",zIndex:1,height:25,width:20,background:r.palette.secondary.main,color:r.palette.primary.main,pl:"3px","&:hover":{color:"white"}}),showLogButton:r=>({position:"absolute",right:3,borderRadius:"5px 5px 0 0",bottom:0,pt:"3px",cursor:"pointer",zIndex:10,height:20,width:25,background:r.palette.secondary.main,color:r.palette.primary.main,pl:1,"&:hover":{color:"white"}})};class Wne extends x.GenericApp{hosts=[];importFile=null;importFileName=null;scripts={};confirmCallback=null;changedScripts={};javascriptPassword="";constructor(s){super(s,{Connection:x.AdminConnection,translations:{en:tP,de:nj,es:cU,fr:p5,it:$V,nl:_6,pl:S7,pt:xq,ru:OQ,uk:Pse,"zh-cn":zne},bottomButtons:!1,socket:{autoSubscribeLog:!0},sentryDSN:window.sentryDSN});const i=window.localStorage.getItem("JS.logSizes");let a=[80,20];if(i)try{a=JSON.parse(i)}catch{}const l=window.localStorage.getItem("JS.splitSizes");let c=[20,80];if(l)try{c=JSON.parse(l)}catch{}this.state={...this.state,splitSizes:c,logSizes:a},window.alert=h=>{console.error(h),this.showJsError(h.toString())}}onScriptsChanged=(s,i)=>{if(!s)return;let a=!1;const l={};s.startsWith("script.js.")&&(i?JSON.stringify(this.scripts[s])!==JSON.stringify(i)&&(this.scripts[s]=i,a=!0,l.scriptsHash=this.state.scriptsHash+1):this.scripts[s]&&(delete this.scripts[s],a=!0,l.scriptsHash=this.state.scriptsHash+1)),a&&this.setState(l)};onInstanceChanged=(s,i)=>{var c;if(!s)return;let a=!1;const l={};if(s.match(/^system\.adapter\.[-_\w\d]+\$/)){if(s.startsWith(`system.adapter.${this.adapterName}.`)){const h=parseInt(s.split(".").pop()||"0",10)||0;if((i==null?void 0:i.type)==="instance")this.state.instances.includes(h)||(l.instances=[...this.state.instances],l.instances.push(h),l.instances.sort(),a=!0,this.socket.subscribeState(`${i._id}.alive`,this.onInstanceAliveChange));else if(!i&&this.state.instances.includes(h)){this.socket.unsubscribeState(`${s}.alive`,this.onInstanceAliveChange),l.instances=[...this.state.instances];const d=l.instances.indexOf(h);l.instances.splice(d,1),a=!0}}(c=i==null?void 0:i.common)!=null&&c.blockly&&(this.confirmCallback=h=>h&&window.location.reload(),l.confirm=x.I18n.t("Some blocks were updated. Reload admin?"),a=!0)}a&&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 a=this.hosts.indexOf(s);this.hosts.splice(a,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 h;const s={},i=await this.subscribeOnInstances();s.instances=i.instances,s.runningInstances=i.runningInstances,this.javascriptPassword=((h=this.socket.systemConfig)==null?void 0:h.native.javascriptPassword)||"",await this.readAdaptersWithBlockly();const a=await this.socket.getHosts();this.hosts=a.map(d=>d._id);const l=await this.readAllScripts();window.localStorage.getItem("App.expertMode")!=="true"&&window.localStorage.getItem("App.expertMode")!=="false"&&!this.javascriptPassword?Object.keys(l).find(d=>d.startsWith("script.js.global.")&&l[d].type==="script")&&(s.expertMode=!0):this.javascriptPassword&&(s.expertMode=!1),this.scripts=l;let c=this.state.scriptsHash;this.compareScripts(l)&&c++,s.scriptsHash=c,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(),a={};i.forEach(l=>a[`system.adapter.${this.adapterName}.${l}`]=!1);for(let l=0;l<i.length;l++){const c=`system.adapter.${this.adapterName}.${i[l]}`,h=`${c}.alive`,d=await this.socket.getState(h);a[c]=d?!!d.val:!1,await this.socket.subscribeState(h,this.onInstanceAliveChange)}return{instances:i,runningInstances:a}}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(a=>s[a]=i[a]),s}async readAdaptersWithBlockly(){const s=await this.socket.getObjectViewSystem("adapter","system.adapter.","system.adapter.香");return new Promise(i=>Ye.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 a=JSON.parse(JSON.stringify(this.state.runningInstances));a[s]=i?!!i.val:!1,this.setState({runningInstances:a})}};compareScripts(s){const i=Object.keys(this.scripts),a=Object.keys(s);if(i.length!==a.length)return this.scripts=s,!0;if(JSON.stringify(i)!==JSON.stringify(a))return this.scripts=s,!0;for(let l=0;l<i.length;l++){const c=this.scripts[i[l]].common,h=s[i[l]].common,d=this.scripts[i[l]].native,p=s[i[l]].native;if(c.name!==h.name)return this.scripts=s,!0;if(c.source!==h.source)return this.scripts=s,!0;if(c.engine!==h.engine)return this.scripts=s,!0;if(c.engineType!==h.engineType)return this.scripts=s,!0;if(c.enabled!==h.enabled)return this.scripts=s,!0;if(!!(d!=null&&d.protected)!=!!(p!=null&&p.protected))return this.scripts=s,!0}return!1}async onRename(s,i,a,l){var c;i.trim().endsWith(".")&&(i=i.replace(/\.\s*$/,"_")),console.log(`Rename ${s} => ${i}`),this.setState({updating:!0});try{if(((c=this.scripts[s])==null?void 0:c.type)==="script"){const h=JSON.parse(JSON.stringify(this.scripts[s].common));h.name=a||h.name,l!==void 0&&(h.engine=`system.adapter.javascript.${l}`);const d=i.split(".");d.pop();const p=d.join(".");this.scripts[p]&&this.scripts[p].type==="script"&&(d.pop(),i=`${d.join(".")}.${i.split(".").pop()}`),await this.updateScript(s,i,h)}else await this.renameGroup(s,i,a)}catch(h){h.toString().includes("canceled")||this.showJsError(h)}this.setState({updating:!1})}async renameGroup(s,i,a,l){if(l){if(l.length){let c=l.pop();if(c){const h=await this.socket.getObject(c);if(h){try{await this.socket.delObject(c)}catch{}c=i+c.substring(s.length),h._id=c,h.common=h.common||{},h.common.expert=!0,await this.socket.setObject(c,h),await this.renameGroup(s,i,a,l)}}}}else{l=[],l=Object.keys(this.scripts).filter(h=>h.startsWith(`${s}.`));let c=await this.socket.getObject(s);c=c||{common:{},type:"channel"},c.common.name=a||c.common.name||s.split(".").pop()||"",c._id=i;try{await this.socket.delObject(s)}catch{}try{await this.socket.setObject(i,c),await this.renameGroup(s,i,a,l)}catch(h){console.log(h);const d={_id:i,type:"channel",common:{name:a||s.split(".").pop()||"",expert:!0},native:{}};await this.socket.setObject(i,d),await this.renameGroup(s,i,a,l)}}}async onUpdateScript(s,i){var a;if(((a=this.scripts[s])==null?void 0:a.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(Hne,{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:x.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 a=this.state.selected;a&&!s&&((i=this.scripts[a].native)!=null&&i.protected)&&(a=this.state.editing.find(l=>{var c;return this.scripts[l]&&!((c=this.scripts[l].native)!=null&&c.protected)})||null),window.localStorage.setItem("App.expertMode",s?"true":"false"),this.setState({expertMode:s,password:"",selected:a})}}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,a,l,c,h){const d=new RegExp(`^${s}\\.`);if(Object.keys(this.scripts).find(p=>s===p||d.test(s)))return this.showJsError(x.I18n.t("Yet exists!"));a?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(p=>this.showJsError(p)):(c==="Blockly"&&!h&&(h=`
|
|
1253
|
+
//${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:c||"Javascript/js",enabled:!1,engine:`system.adapter.javascript.${l||0}`,source:h||"",debug:!1,verbose:!1},native:{}}).then(()=>setTimeout(()=>this.onSelect(s),1e3)).catch(p=>this.showJsError(p)))}async updateScript(s,i,a){let l=await this.socket.getObject(s);const c={common:{}};if(a.engine!==void 0&&(c.common.engine=a.engine),a.enabled!==void 0&&(c.common.enabled=a.enabled),a.source!==void 0&&(c.common.source=a.source),a.debug!==void 0&&(c.common.debug=a.debug),a.verbose!==void 0&&(c.common.verbose=a.verbose),c.from="system.adapter.admin.0",s===i&&(l!=null&&l.common)&&a.name===l.common.name){(!a.engineType||a.engineType!==l.common.engineType)&&a.engineType!==void 0&&(c.common.engineType=a.engineType||"Javascript/js"),c.type="script",await this.socket.extendObject(s,c);return}if(l!=null&&l.common){l.common.engineType=a.engineType||l.common.engineType||"Javascript/js",await this.socket.delObject(s),c.common.engine!==void 0&&(l.common.engine=c.common.engine),c.common.enabled!==void 0&&(l.common.enabled=c.common.enabled),c.common.source!==void 0&&(l.common.source=c.common.source),c.common.name!==void 0&&(l.common.name=c.common.name),c.common.debug!==void 0&&(l.common.debug=c.common.debug),c.common.verbose!==void 0&&(l.common.verbose=c.common.verbose),l._rev!==void 0&&delete l._rev,l.common.name=a.name,l.common.expert=!0,l.type="script",l._id=i,await this.socket.setObject(i,l);return}l=c,l.common.name=a.name,l.common.expert=!0,l.type="script",l._id=i,await this.socket.setObject(i,l)}onEnableDisable(s,i){var a;if(((a=this.scripts[s])==null?void 0:a.type)==="script"){const l=this.scripts[s].common;l.enabled=i,l.expert=!0,this.updateScript(s,s,l).catch(c=>c!=="canceled"&&this.showJsError(c))}}async getLiveHost(){for(let s=0;s<this.hosts.length;s++){const i=this.hosts[s],a=await this.socket.getState(`${i}.alive`);if(a&&(a!=null&&a.val))return i}}async onExport(s){const i=new Date;let a=i.getFullYear().toString(),l=i.getMonth()+1;if(l<10&&(l=`0${l}`),a+=`-${l}`,l=i.getDate(),l<10&&(l=`0${l}`),a+=`-${l}-`,s){const c=await this.getLiveHost();if(!c){this.showJsError(x.I18n.t("No active host found"));return}this.socket.getRawSocket().emit("sendToHost",c,"readObjectsAsZip",{adapter:"javascript",id:"script.js",link:`${a}scripts.zip`,fileStorageNamespace:`admin.${this.instance}`},h=>{if(typeof h=="string"){const d=document.createElement("a");d.href=`../../files/${h}`,document.body.appendChild(d),d.click(),d.remove()}else if(h.error&&this.showJsError(h.error),h.data){const d=document.createElement("a");d.href=`data: application/zip;base64,${h.data}`,d.download=`${a}scripts.zip`,document.body.appendChild(d),d.click(),d.remove()}})}else{const c=new ek;for(const[h,d]of Object.entries(this.scripts))if(d.type==="script"){const p=d,f=p.common.engineType==="TypeScript/ts"?"ts":p.common.engineType==="Blockly"?"blockly":p.common.engineType==="Rules"?"rules":"js";let b=`/******* (ext=${f}/engine=${p.common.engine}/debug=${p.common.debug}/verbose=${p.common.verbose}/enabled=${p.common.enabled}) *******/
|
|
1254
|
+
`;b+=p.common.source||"";const v=`${h.substring(10).replace(/\./g,"/")}.${f}`;c.file(v,b)}c.generateAsync({type:"blob"}).then(h=>{const d=document.createElement("a");d.href=URL.createObjectURL(h),d.download=`${a}scripts_plain.zip`,document.body.appendChild(d),d.click(),d.remove(),URL.revokeObjectURL(d.href)})}}onImport(s,i){this.importFile=s||null,this.importFileName=i||null,s?(this.confirmCallback=this.onImportConfirmed.bind(this),this.setState({importFile:!1,confirm:x.I18n.t("Existing scripts will be overwritten.")})):this.setState({importFile:!1})}async onImportConfirmed(s){let i=this.importFile;const a=this.importFileName;if(this.importFile=null,this.importFileName=null,s&&i)if(a&&/_(plain|text)\.zip$/i.test(a)){i=i.split(",")[1];try{const c=await ek.loadAsync(i,{base64:!0}),h=[];c.forEach((d,p)=>{p.dir||h.push(p.async("string").then(async f=>{const b=f.split(`
|
|
1255
|
+
`),v=b[0]||"",_=b.slice(1).join(`
|
|
1256
|
+
`),y=v.match(/\/\*{7}\s*\(ext=(\w+)\/engine=([^/]+)\/debug=(\w+)\/verbose=(\w+)\/enabled=(\w+)\)\s*\*{7}\//);let w="Javascript/js",$="system.adapter.javascript.0",I=!1,T=!1,C=!1;if(y){const j=y[1];$=y[2],I=y[3]==="true",T=y[4]==="true",C=y[5]==="true",j==="ts"?w="TypeScript/ts":j==="blockly"?w="Blockly":j==="rules"&&(w="Rules")}const D=d.replace(/\.\w+$/,"").replace(/\//g,"."),R=`script.js.${D}`,N=D.split(".").pop()||D,U=R.split(".");for(let j=3;j<U.length;j++){const B=U.slice(0,j).join(".");if(!this.scripts[B])try{await this.socket.setObject(B,{_id:B,type:"channel",common:{name:U[j-1],expert:!0},native:{}})}catch{}}await this.socket.setObject(R,{_id:R,type:"script",common:{name:N,expert:!0,engineType:w,engine:$,enabled:C,source:_,debug:I,verbose:T},native:{}})}))}),await Promise.all(h),this.showMessage(x.I18n.t("Done"))}catch(c){this.showJsError(c)}}else{i=i.split(",")[1];const c=await this.getLiveHost();if(!c){this.showJsError(x.I18n.t("No active host found"));return}this.socket.getRawSocket().emit("sendToHost",c,"writeObjectsAsZip",{data:i,adapter:"javascript",id:"script.js"},h=>{h==="permissionError"?this.showJsError(x.I18n.t(h)):!h||h.error?this.showJsError(h?x.I18n.t(h.error||""):x.I18n.t("Unknown error")):this.showMessage(x.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((a,l)=>a+(this.scripts[l].common.engineType==="Rules"?1:0),0);return g.jsx(Hn,{scriptsHash:this.state.scriptsHash,debugMode:this.state.debugMode,onDebugModeChange:a=>{a?this.setState({debugMode:!0}):this.setState({debugMode:!1,debugInstance:null})},visible:!this.state.resizing,socket:this.socket,adapterName:this.adapterName,onLocate:a=>this.setState({menuSelectId:a}),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:(a,l)=>this.onUpdateScript(a,l),isAnyRulesExists:s,debugInstance:this.state.debugInstance,onSelectedChange:(a,l)=>{const c={};let h=!1;a!==this.state.selected&&(h=!0,c.selected=a),JSON.stringify(l)!==JSON.stringify(this.state.editing)&&(h=!0,c.editing=[...l]),h&&this.setState(c)},onRestart:a=>this.socket.extendObject(a,{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:a=>this.changedScripts=a},"editor")}showLogButton(){return g.jsx(bt,{title:x.I18n.t("Show logs"),sx:ra.showLogButton,onClick:()=>{window.localStorage.setItem("App.hideLog","false"),this.setState({hideLog:!1,resizing:!0}),setTimeout(()=>this.setState({resizing:!1}),300)},children:g.jsx(wI,{})},"showLog")}renderErrorDialog(){return this.state.errorText?g.jsx(Su,{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(Yc,{direction:this.state.logHorzLayout?mt.Horizontal:mt.Vertical,initialSizes:this.state.logSizes,minWidths:[500,100],minHeights:[150,50],onResizeStarted:()=>this.setState({resizing:!0}),onResizeFinished:(i,a)=>{this.setState({logSizes:a,resizing:!1}),window.localStorage.setItem("JS.logSizes",JSON.stringify(a))},gutterClassName:this.state.themeType==="dark"?"Dark visGutter":"Light visGutter",children:[this.renderEditor(),g.jsx(Jm,{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(bt,{sx:ra.content,className:"iobVerticalSplitter",children:[g.jsx(bt,{sx:ra.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(kI,{}):g.jsx(CI,{})},"closeMenu"),this.state.message?g.jsx(x.Message,{onClose:()=>this.setState({message:""}),text:this.state.message},"dialogMessage"):null,this.renderErrorDialog(),this.state.importFile?g.jsx(bf,{onClose:(i,a)=>this.onImport(i,a)},"dialogImportFile"):null,this.state.confirm?g.jsx(x.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(O_,{injectFirst:!0,children:g.jsx(M_,{theme:this.state.theme,children:g.jsx(x.Loader,{themeType:this.state.themeType})})});let s;return this.state.menuOpened?s=g.jsxs(Yc,{direction:mt.Horizontal,initialSizes:this.state.splitSizes,minWidths:[270,400],onResizeFinished:(i,a)=>{this.setState({splitSizes:a}),window.localStorage.setItem("JS.splitSizes",JSON.stringify(a))},gutterClassName:this.state.themeType==="dark"?"Dark visGutter":"Light visGutter",children:[g.jsx("div",{style:ra.mainDiv,children:g.jsx(Ao,{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=>{x.Utils.setThemeName(i);const a=x.Utils.getThemeType(i);this.setState({themeName:i,themeType:a},()=>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(O_,{injectFirst:!0,children:g.jsx(M_,{theme:this.state.theme,children:g.jsx("div",{style:ra.root,children:g.jsx(X1,{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 Gne(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(r=>{r.unregister()})}const Vne="9.2.0",TS={version:Vne};var ii;(function(r){r.mouse="mouse",r.touch="touch",r.keyboard="keyboard"})(ii||(ii={}));class Kne{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,a,l;return(l=(a=(s=this.args)===null||s===void 0?void 0:s.delayTouchStart)!==null&&a!==void 0?a:(i=this.args)===null||i===void 0?void 0:i.delay)!==null&&l!==void 0?l:0}get delayMouseStart(){var s,i,a,l;return(l=(a=(s=this.args)===null||s===void 0?void 0:s.delayMouseStart)!==null&&a!==void 0?a:(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 Yne(r,s,i,a){return Math.sqrt(Math.pow(Math.abs(i-r),2)+Math.pow(Math.abs(a-s),2))}function Jne(r,s,i,a,l){if(!l)return!1;const c=Math.atan2(a-s,i-r)*180/Math.PI+180;for(let h=0;h<l.length;++h){const d=l[h];if(d&&(d.start==null||c>=d.start)&&(d.end==null||c<=d.end))return!0}return!1}const qne={Left:1},Xne={Left:0};function Xg(r){return r.button===void 0||r.button===Xne.Left}function Zne(r){return r.buttons===void 0||(r.buttons&qne.Left)===0}function IS(r){return!!r.targetTouches}const Qne=1;function ere(r){const s=r.nodeType===Qne?r:r.parentElement;if(!s)return;const{top:i,left:a}=s.getBoundingClientRect();return{x:a,y:i}}function tre(r,s){if(r.targetTouches.length===1)return fu(r.targetTouches[0]);if(s&&r.touches.length===1&&r.touches[0].target===s.target)return fu(r.touches[0])}function fu(r,s){return IS(r)?tre(r,s):{x:r.clientX,y:r.clientY}}const tk=(()=>{let r=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return r=!0,!0}}))}catch{}return r})(),aa={[ii.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[ii.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[ii.keyboard]:{keydown:"keydown"}};class $a{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&&(Ue(!$a.isSetUp,"Cannot have two Touch backends at the same time."),$a.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&&($a.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,a,l=!1){const c=tk?{capture:l,passive:!1}:l;this.listenerTypes.forEach(function(h){const d=aa[h][i];d&&s.addEventListener(d,a,c)})}removeEventListener(s,i,a,l=!1){const c=tk?{capture:l,passive:!1}:l;this.listenerTypes.forEach(function(h){const d=aa[h][i];d&&s.removeEventListener(d,a,c)})}connectDragSource(s,i){const a=this.handleMoveStart.bind(this,s);return this.sourceNodes.set(s,i),this.addEventListener(i,"start",a),()=>{this.sourceNodes.delete(s),this.removeEventListener(i,"start",a)}}connectDragPreview(s,i,a){return this.sourcePreviewNodeOptions.set(s,a),this.sourcePreviewNodes.set(s,i),()=>{this.sourcePreviewNodes.delete(s),this.sourcePreviewNodeOptions.delete(s)}}connectDropTarget(s,i){const a=this.options.rootElement;if(!this.document||!a)return()=>{};const l=c=>{if(!this.document||!a||!this.monitor.isDragging())return;let h;switch(c.type){case aa.mouse.move:h={x:c.clientX,y:c.clientY};break;case aa.touch.move:var d,p;h={x:((d=c.touches[0])===null||d===void 0?void 0:d.clientX)||0,y:((p=c.touches[0])===null||p===void 0?void 0:p.clientY)||0};break}const f=h!=null?this.document.elementFromPoint(h.x,h.y):void 0,b=f&&i.contains(f);if(f===i||b)return this.handleMove(c,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,a){this.getSourceClientOffset=l=>{const c=this.sourceNodes.get(l);return c&&ere(c)},this.handleTopMoveStartCapture=l=>{Xg(l)&&(this.moveStartSourceIds=[])},this.handleMoveStart=l=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(l)},this.handleTopMoveStart=l=>{if(!Xg(l))return;const c=fu(l);c&&(IS(l)&&(this.lastTargetTouchFallback=l.targetTouches[0]),this._mouseClientOffset=c),this.waitingForDelay=!1},this.handleTopMoveStartDelay=l=>{if(!Xg(l))return;const c=l.type===aa.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,l),c),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(l,c)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(c)},this.handleTopMove=l=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:c,dragOverTargetIds:h}=this,d=this.options.enableHoverOutsideTarget,p=fu(l,this.lastTargetTouchFallback);if(!p)return;if(this._isScrolling||!this.monitor.isDragging()&&Jne(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,p.x,p.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&c&&Yne(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,p.x,p.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(c,{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 b=(h||[]).map(w=>this.targetNodes.get(w)).filter(w=>!!w),v=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(p.x,p.y,b):this.document.elementsFromPoint(p.x,p.y),_=[];for(const w in v){if(!v.hasOwnProperty(w))continue;let $=v[w];for($!=null&&_.push($);$;)$=$.parentElement,$&&_.indexOf($)===-1&&_.push($)}const y=_.filter(w=>b.indexOf(w)>-1).map(w=>this._getDropTargetId(w)).filter(w=>!!w).filter((w,$,I)=>I.indexOf(w)===$);if(d)for(const w in this.targetNodes){const $=this.targetNodes.get(w);if(f&&$&&$.contains(f)&&y.indexOf(w)===-1){y.unshift(w);break}}y.reverse(),this.actions.hover(y,{clientOffset:p})},this._getDropTargetId=l=>{const c=this.targetNodes.keys();let h=c.next();for(;h.done===!1;){const d=h.value;if(l===this.targetNodes.get(d))return d;h=c.next()}},this.handleTopMoveEndCapture=l=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!Zne(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 Kne(a,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(ii.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(ii.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(ii.keyboard)}}const sre=function(s,i={},a={}){return new $a(s,i,a)};window.GenericBlock=at;window.adapterName="javascript";window.sentryDSN="https://504499a725eb4898930d3b9e9da95740@sentry.iobroker.net/56";console.log(`iobroker.${window.adapterName}@${TS.version}`);const ore=window.innerWidth<600,sk=document.getElementById("root");sk&&bk(sk).render(g.jsx(Ok,{backend:ore?sre:Gk,children:g.jsx(Wne,{version:TS.version})}));Gne();const Oc=window.loadDynamicScript;Oc&&Oc(window.location.port==="3000"?`${window.location.protocol}//${window.location.hostname}:8081/lib/js/socket.io.js`:"./../../lib/js/socket.io.js",()=>Oc("vs/loader.js",()=>Oc("vs/configure.js",()=>typeof window.socketLoadedHandler=="function"&&window.socketLoadedHandler())));export{q1 as C,NO as D,at as G,Vk as I,Yw as M,Ps as S,hx as a,Ax as b,jx as c,Pi as d,qle as e,vf as f,Su as g,yO as h,bre as i,Xle as j,$re as k,Hw as l,Yc as m,er as u,mt as z};
|