mc-shell 0.6.5__py3-none-any.whl → 0.6.6__py3-none-any.whl
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.
- {mc_shell-0.6.5.dist-info → mc_shell-0.6.6.dist-info}/METADATA +1 -1
- {mc_shell-0.6.5.dist-info → mc_shell-0.6.6.dist-info}/RECORD +14 -14
- mcshell/constants.py +1 -1
- mcshell/data/app/index.html +1 -1
- mcshell/data/app/{mced.c71c0778.js → mced.0c019c78.js} +51 -23
- mcshell/data/app/{mced.c71c0778.js.map → mced.0c019c78.js.map} +1 -1
- mcshell/data/materials/colourables.json +140 -140
- mcshell/data/materials/pickers.json +161 -161
- mcshell/mcactions.py +7 -6
- mcshell/mcclient.py +11 -3
- mcshell/pyncactions.py +2 -2
- {mc_shell-0.6.5.dist-info → mc_shell-0.6.6.dist-info}/WHEEL +0 -0
- {mc_shell-0.6.5.dist-info → mc_shell-0.6.6.dist-info}/entry_points.txt +0 -0
- {mc_shell-0.6.5.dist-info → mc_shell-0.6.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let e,t,i;import"./mced.a4de160c.js";var o,s,n,r=globalThis;function l(e){return e&&e.__esModule?e.default:e}var a={},c={},h=r.parcelRequirea483;null==h&&((h=function(e){if(e in a)return a[e].exports;if(e in c){var t=c[e];delete c[e];var i={id:e,exports:{}};return a[e]=i,t.call(i.exports,i,i.exports),i.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,t){c[e]=t},r.parcelRequirea483=h);var u=h.register;u("ca2Ll",function(e,t){e.exports=h("97Mr6")}),u("97Mr6",function(e,t){var i;e.exports,i=function(){var e,t,i,o,s,n,l,a,c,h,u,d,p,_,g,E,T,m,f,I,S,R,b,C,O,A,$={};ea=function(e,t,i,o){if(!(e instanceof D)&&"string"!=typeof e||""===`${e}`.trim())throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e=`${e}`.toLowerCase(),"string"!=typeof t||""===t.trim())throw Error('Invalid name "'+t+'". The name must be a non-empty string.');let s=t.toLowerCase();if(!i)throw Error("Can not register a null value");let n=N[e],r=L[e];if(n||(n=N[e]=Object.create(null),r=L[e]=Object.create(null)),ec(e,i),!o&&n[s]&&n[s]!==i)throw Error('Name "'+s+'" with type "'+e+'" already registered.');n[s]=i,r[s]=t},ec=function(e,t){if(e===String(D.FIELD)&&"function"!=typeof t.fromJson)throw Error('Type "'+e+'" must have a fromJson function')},eh=function(e,t){e=`${e}`.toLowerCase(),t=t.toLowerCase();let i=N[e];i&&i[t]?(delete N[e][t],delete L[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},eu=function(e,t,i){e=`${e}`.toLowerCase(),t=t.toLowerCase();let o=N[e];if(!o||!o[t]){if(t="Unable to find ["+t+"]["+e+"] in the registry.",i)throw Error(t+" You must require or register a "+e+" plugin.");return console.warn(t),null}return o[t]},ed=function(e,t){return e=`${e}`.toLowerCase(),t=t.toLowerCase(),!!(e=N[e])&&!!e[t]},ep=function(e,t,i){return eu(e,t,i)},e_=function(e,t,i){return eu(e,t,i)},eg=function(e,t,i){var o=N[e=`${e}`.toLowerCase()];if(!o){if(o=`Unable to find [${e}] in the registry.`,i)throw Error(`${o} You must require or register a ${e} plugin.`);return console.warn(o),null}if(!t)return o;for(let t of(e=L[e],i=Object.create(null),Object.keys(o)))i[e[t]]=o[t];return i},eE=function(e,t,i){return"function"==typeof(t=t.plugins[String(e)]||y)?t:ep(e,t,i)},eT=function(e,t){em(),x=setTimeout(function(){t&&t.handleRightClick(e)},v)},em=function(){x&&(clearTimeout(x),x=0)},ef=function(){P=null},eI=function(e){return!e.type.startsWith("pointer")||e instanceof PointerEvent&&eR(e)},eS=function(e){return`${e.pointerId}`},eR=function(e){let t=eS(e);return P?P===t:"pointerdown"===e.type&&(P=t,!0)},eb=function(e,t,i,o,s){function n(e){(s||eI(e))&&(i?o.call(i,e):o(e))}let r=[];if(t in B)for(let i=0;i<B[t].length;i++){let o=B[t][i];e.addEventListener(o,n,!1),r.push([e,o,n])}else e.addEventListener(t,n,!1),r.push([e,t,n]);return r},eC=function(e,t,i,o){function s(e){i?o.call(i,e):o(e)}let n=[];if(t in B)for(let i=0;i<B[t].length;i++){let o=B[t][i];e.addEventListener(o,s,!1),n.push([e,o,s])}else e.addEventListener(t,s,!1),n.push([e,t,s]);return n},eO=function(e){let t=e[e.length-1][2];for(;e.length;){let[t,i,o]=e.pop();t.removeEventListener(i,o,!1)}return t},eA=function(e){if(e.target instanceof HTMLElement){if(e.target.isContentEditable||"true"===e.target.getAttribute("data-is-text-input"))return!0;if(e.target instanceof HTMLInputElement)return"text"===(e=e.target).type||"number"===e.type||"email"===e.type||"password"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type;if(e.target instanceof HTMLTextAreaElement)return!0}return!1},e$=function(e){return!!e.ctrlKey&&!!V||2===e.button},eN=function(e,t,i){let o=t.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,i||(i=t.getScreenCTM().inverse()),o.matrixTransform(i)},eL=function(e){switch(e.deltaMode){default:return{x:e.deltaX,y:e.deltaY};case 1:return{x:e.deltaX*K,y:e.deltaY*K};case 2:return{x:e.deltaX*X,y:e.deltaY*X}}},ey=function(){return"blockly-"+(Z++).toString(36)},eD=function(){return J.genUid()},ek=function(e){return e.type===rL.BLOCK_CREATE},ew=function(e){return e.type===rL.BLOCK_DELETE},ev=function(e){return e.type===rL.BLOCK_CHANGE},eM=function(e){return e.type===rL.BLOCK_FIELD_INTERMEDIATE_CHANGE},eP=function(e){return e.type===rL.BLOCK_MOVE},eB=function(e){return e.type===rL.CLICK},ex=function(e){return e.type===rL.BUBBLE_OPEN},eF=function(e){return e.type===rL.VIEWPORT_CHANGE},$.setRecordUndo$$module$build$src$core$events$utils=function(e){et=e},eG=function(){return et},eH=function(e){en.fireInternal(e)},eU=function(){let e=eV(es);for(let t of(es.length=0,e)){let e;t.workspaceId&&(null==(e=to(t.workspaceId))||e.fireChangeListener(t))}},eW=function(e){if(ev(e)&&"mutation"===e.element){let t;for(t=es.length;t>0;t--){let i=es[t-1];if(i.group!==e.group||i.workspaceId!==e.workspaceId||!eP(i)||i.newParentId!==e.blockId)break}es.splice(t,0,e)}else es.push(e)},eV=function(e){let t=[];for(let i of e)if(e=t[t.length-1],!i.isNull())if(e&&e.workspaceId===i.workspaceId&&e.group===i.group)if(eP(i)&&eP(e)&&i.blockId===e.blockId){if(e.newParentId=i.newParentId,e.newInputName=i.newInputName,e.newCoordinate=i.newCoordinate,e.reason||i.reason){let t,o;e.reason=Array.from(new Set((null!=(t=e.reason)?t:[]).concat(null!=(o=i.reason)?o:[])))}}else ev(i)&&ev(e)&&i.blockId===e.blockId&&i.element===e.element&&i.name===e.name?e.newValue=i.newValue:eF(i)&&eF(e)?(e.viewTop=i.viewTop,e.viewLeft=i.viewLeft,e.scale=i.scale,e.oldScale=i.oldScale):eB(i)&&ex(e)||t.push(i);else t.push(i);return t.filter(e=>!e.isNull())},eK=function(){for(let e=0,t;t=es[e];e++)t.recordUndo=!1},$.disable$$module$build$src$core$events$utils=function(){ei++},$.enable$$module$build$src$core$events$utils=function(){ei--},eX=function(){return 0===ei},$.getGroup$$module$build$src$core$events$utils=function(){return ee},$.setGroup$$module$build$src$core$events$utils=function(e){en.setGroupInternal(e)},eY=function(e){let t=[];e=e.getDescendants(!1);for(let i=0,o;o=e[i];i++)t[i]=o.id;return t},ez=function(e,t){let i=ej(e.type);if(!i)throw Error("Unknown event type.");return i.fromJson(e,t)},ej=function(e){let t=ep(D.EVENT,e);if(!t)throw Error(`Event type ${e} not found in registry.`);return t},eJ=function(e){if((eP(e)||ek(e))&&e.workspaceId){var t=to(e.workspaceId);if(!e.blockId)throw Error("Encountered a blockEvent without a proper blockId");if(e=t.getBlockById(e.blockId)){let i=et;try{et=!1;let i=e.getParent();if(i&&!i.hasDisabledReason(eo)){let t=e.getDescendants(!1);for(let e=0,i;i=t[e];e++)i.setDisabledReason(!1,eo)}else if((e.outputConnection||e.previousConnection)&&!t.isDragging())do e.setDisabledReason(!0,eo),e=e.getNextBlock();while(e)}finally{et=i}}}},eZ=function(e,t,i){for(let i in e=document.createElementNS(rD,`${e}`),t)e.setAttribute(i,`${t[i]}`);return i&&i.appendChild(e),e},eq=function(e,t){return!(t=t.split(" ")).every(t=>e.classList.contains(t))&&(e.classList.add(...t),!0)},eQ=function(e,t){e.classList.remove(...t.split(" "))},e0=function(e,t){return!(t=t.split(" ")).every(t=>!e.classList.contains(t))&&(e.classList.remove(...t),!0)},e1=function(e,t){return e.classList.contains(t)},e2=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},e3=function(e,t){let i=t.nextSibling;if(!(t=t.parentNode))throw Error("Reference node has no parent.");i?t.insertBefore(e,i):t.appendChild(e)},e5=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},e6=function(){rM++,rv||(rv=Object.create(null))},e4=function(){--rM||(rv=null)},e8=function(e){var t;let i=e.textContent+"\n"+e.className.baseVal;return rv&&(t=rv[i])||(t=window.getComputedStyle(e),t=e9(e,t.fontSize,t.fontWeight,t.fontFamily),rv&&(rv[i]=t)),t},e9=function(e,t,i,o){var s;let n=e.textContent;return e=n+"\n"+e.className.baseVal,rv&&(s=rv[e])||(rP||((s=document.createElement("canvas")).className="blocklyComputeCanvas",document.body.appendChild(s),rP=s.getContext("2d")),n&&rP?(rP.font=i+" "+t+" "+o,s=rP.measureText(n).width):s=0,rv&&(rv[e]=s)),s},e7=function(e,t,i,o){let s=document.createElement("span");s.style.font=i+" "+t+" "+o,s.textContent=e,(e=document.createElement("div")).style.width="1px",e.style.height="0",(t=document.createElement("div")).style.display="flex",t.style.position="fixed",t.style.top="0",t.style.left="0",t.appendChild(s),t.appendChild(e),document.body.appendChild(t),i={height:0,baseline:0};try{t.style.alignItems="baseline",i.baseline=e.offsetTop-s.offsetTop,t.style.alignItems="flex-end",i.height=e.offsetTop-s.offsetTop}finally{document.body.removeChild(t)}return i},$.getFocusManager$$module$build$src$core$focus_manager=function(){return rG.getFocusManager()},te=function(e){return e&&"function"==typeof e.getFocusableElement&&"function"==typeof e.getFocusableTree&&"function"==typeof e.onNodeFocus&&"function"==typeof e.onNodeBlur&&"function"==typeof e.canBeFocused},tt=function(e){return te(e)&&"string"==typeof e.id&&"object"==typeof e.workspace&&"function"==typeof e.select&&"function"==typeof e.unselect},ti=function(e,t){for(let i in t)null!==t[i]&&Array.isArray(t[i])?e[i]=ti(e[i]||[],t[i]):e[i]=null!==t[i]&&"object"==typeof t[i]?ti(e[i]||Object.create(null),t[i]):t[i];return e},to=function(e){return rz[e]||null},ts=function(){let e=[];for(let t in rz)e.push(rz[t]);return e},tn=function(e){rz[e.id]=e},tr=function(e){delete rz[e.id]},tl=function(){return rX},ta=function(e){rX=e},tc=function(){let e=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode();return e&&tt(e)?e:null},th=function(e){let t,i,o,s,n=tc();eH(new(ej(rL.SELECTED))(null!=(t=null==n?void 0:n.id)?t:null,null!=(i=null==e?void 0:e.id)?i:null,null!=(s=null!=(o=null==e?void 0:e.workspace.id)?o:null==n?void 0:n.workspace.id)?s:""))},tu=function(){return rY},td=function(e){rY=e},tp=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;let t=e.getParentSvg(),i=e.getCachedParentSvgSize();var o=t.parentElement;if(o instanceof HTMLElement){var s=o.offsetWidth;o=o.offsetHeight,i.width!==s&&(t.setAttribute("width",s+"px"),e.setCachedParentSvgSize(s,null)),i.height!==o&&(t.setAttribute("height",o+"px"),e.setCachedParentSvgSize(null,o)),e.resize()}},t_=function(e,t){let i=Object.create(null),o=e.getDescendants(!0);t&&(e=e.getNextBlock())&&(e=o.indexOf(e),o.splice(e,o.length-e));for(let e=0,t;t=o[e];e++)i[t.type]?i[t.type]++:i[t.type]=1;return i},tg=function(e){return function(){this.jsonInit(e)}},tE=function(e){rJ.defineBlocksWithJsonArrayInternal(e)},$.createBlockDefinitionsFromJsonArray$$module$build$src$core$common=function(e){let t={};for(let i=0;i<e.length;i++){let o=e[i];if(!o){console.warn(`Block definition #${i} in JSON array is ${o}. Skipping`);continue}let s=o.type;s?t[s]={init:tg(o)}:console.warn(`Block definition #${i} in JSON array is missing a type attribute. Skipping.`)}return t},$.defineBlocks$$module$build$src$core$common=function(e){for(let t of Object.keys(e)){let i=e[t];t in w&&console.warn(`Block definition "${t}" overwrites previous definition.`),w[t]=i}},tT=function(e){let t=tl(),i=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedTree();for(let e of ts())if(i===e){t=e;break}!eA(e)&&t&&(!t.rendered||t.isFlyout||t.isVisible())&&rW.registry.onKeyDown(t,e)},tm=function(e,t){return -1!==(t=e.indexOf(t))&&(e.splice(t,1),!0)},tf=function(e){if(r9)throw Error("CSS already injected");r7+="\n"+e},tI=function(e,t){r9||(r9=!0,e&&(e=t.replace(/[\\/]$/,""),t=r7.replace(/<<<PATH>>>/g,e),r7="",(e=document.createElement("style")).id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},tS=function(e){return ln.getSizeInternal(e)},tR=function(e){return new ls(e.offsetWidth,e.offsetHeight)},tb=function(e,t){return(e=window.getComputedStyle(e))[t]||e.getPropertyValue(t)},tC=function(e){let t=new lt(0,0);e=e.getBoundingClientRect();var i=document.documentElement;return i=new lt(window.pageXOffset||i.scrollLeft,window.pageYOffset||i.scrollTop),t.x=e.left+i.x,t.y=e.top+i.y,t},tO=function(){let e=document.body,t=document.documentElement;return new lt(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},tA=function(e){let t=parseFloat(tb(e,"borderLeftWidth")),i=parseFloat(tb(e,"borderRightWidth"));return new lo(parseFloat(tb(e,"borderTopWidth")),e=parseFloat(tb(e,"borderBottomWidth")),t,i)},t$=function(e,t,i){e=tN(e,t,i),t.scrollLeft=e.x,t.scrollTop=e.y},tN=function(e,t,i){var o=tC(e),s=tC(t),n=tA(t);let r=o.x-s.x-n.left;return o=o.y-s.y-n.top,s=tR(e),e=t.clientWidth-s.width,s=t.clientHeight-s.height,n=t.scrollLeft,t=t.scrollTop,i?(n+=r-e/2,t+=o-s/2):(n+=Math.min(r,Math.max(r-e,0)),t+=Math.min(o,Math.max(o-s,0))),new lt(n,t)},tL=function(e){let t=new lt(0,0);var i=e.x&&e.getAttribute("x");let o=e.y&&e.getAttribute("y");return i&&(t.x=parseInt(i)),o&&(t.y=parseInt(o)),(i=(i=e.getAttribute("transform"))&&i.match(ll))&&(t.x+=Number(i[1]),i[3]&&(t.y+=Number(i[3]))),(e=e.getAttribute("style"))&&e.includes("translate")&&(e=e.match(la))&&(t.x+=Number(e[1]),e[3]&&(t.y+=Number(e[3]))),t},ty=function(e){let t=0,i=0;for(;e;){let o=tL(e);if(t+=o.x,i+=o.y,(" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv "))break;e=e.parentNode}return new lt(t,i)},tD=function(){let e=tO();return new lo(e.y,document.documentElement.clientHeight+e.y,e.x,document.documentElement.clientWidth+e.x)},tk=function(){let e=document.documentElement,t=window;return new lt(t.pageXOffset||e.scrollLeft,t.pageYOffset||e.scrollTop)},tw=function(e,t){var i=t.x;t=t.y;let o=e.getInjectionDiv().getBoundingClientRect();return i=new lt(i-o.left,t-o.top),t=e.getOriginOffsetInPixels(),lt.difference(i,t).scale(1/e.scale)},tv=function(e,t){var i=t.scale(e.scale);t=i.x,i=i.y;let o=e.getInjectionDiv().getBoundingClientRect();return e=e.getOriginOffsetInPixels(),new lt(t+o.left+e.x,i+o.top+e.y)},$.createElement$$module$build$src$core$utils$xml=function(e){return lp.createElementNS(lE,e)},$.createTextNode$$module$build$src$core$utils$xml=function(e){return lp.createTextNode(e)},$.textToDom$$module$build$src$core$utils$xml=function(e){let t=lu.parseFromString(e,"text/xml");if(t&&t.documentElement&&!t.getElementsByTagName("parsererror").length)return t.documentElement;if((t=lu.parseFromString(e,"text/html"))&&t.body.firstChild&&"xml"===t.body.firstChild.nodeName.toLowerCase())return t.body.firstChild;throw Error(`DOMParser was unable to parse: ${e}`)},tM=function(e){return tP(ld.serializeToString(e))},tP=function(e){return e.replace(lT,e=>`&#${e.charCodeAt(0)};`)},tB=function(e){return e?((e instanceof Element||"string"==typeof e)&&(e=tK(e),e=tU(e)),tx(e),e):null},tx=function(e){let t=e.kind;if(e=e.contents,t&&t!==lb&&t!==lR)throw Error("Invalid toolbox kind "+t+". Please supply either "+lb+" or "+lR);if(!e)throw Error("Toolbox must have a contents attribute.")},tF=function(e){return e?e.contents?e.contents:Array.isArray(e)&&e.length>0&&!e[0].nodeType?e:tW(e):[]},tG=function(e){return lC.hasCategoriesInternal(e)},tH=function(e){return!!e&&!!e.contents&&!!e.contents.filter(function(e){return"CATEGORY"===e.kind.toUpperCase()}).length},tU=function(e){let t={contents:tW(e)};return e instanceof Node&&tV(e,t),t},tW=function(e){let t=[],i=e.childNodes;i||(i=e);for(let o=0,s;s=i[o];o++){if(!s.tagName)continue;e={};let i=s.tagName.toUpperCase();e.kind=i,"BLOCK"===i?e.blockxml=s:s.childNodes&&s.childNodes.length>0&&(e.contents=tW(s)),tV(s,e),t.push(e)}return t},tV=function(e,t){for(let i=0;i<e.attributes.length;i++){let o=e.attributes[i];o.nodeName.includes("css-")?(t.cssconfig=t.cssconfig||{},t.cssconfig[o.nodeName.replace("css-","")]=o.value):t[o.nodeName]=o.value}},tK=function(e){let t=null;if(e)if("string"==typeof e){if("xml"!==(t=$.textToDom$$module$build$src$core$utils$xml(e)).nodeName.toLowerCase())throw TypeError("Toolbox should be an <xml> document.")}else e instanceof Element&&(t=e);return t},tX=function(e,t,i,o,s,n){let r=n.scrollbar&&n.scrollbar.canScrollVertically();return e.horizontal===lF.LEFT?(i=s.absoluteMetrics.left+i,r&&n.RTL&&(i+=lh.scrollbarThickness)):(i=s.absoluteMetrics.left+s.viewMetrics.width-t.width-i,r&&!n.RTL&&(i-=lh.scrollbarThickness)),e.vertical===lx.TOP?e=s.absoluteMetrics.top+o:(e=s.absoluteMetrics.top+s.viewMetrics.height-t.height-o,n.scrollbar&&n.scrollbar.canScrollHorizontally()&&(e-=lh.scrollbarThickness)),new lo(e,e+t.height,i,i+t.width)},tY=function(e,t){return{horizontal:t.toolboxMetrics.position===lS.LEFT||e.horizontalLayout&&!e.RTL?lF.RIGHT:lF.LEFT,vertical:t.toolboxMetrics.position===lS.BOTTOM?lx.TOP:lx.BOTTOM}},tz=function(e,t,i,o){let s=e.left,n=e.right-e.left,r=e.bottom-e.top;for(let l=0;l<o.length;l++){let a=o[l];e.intersects(a)&&(e=new lo(e=i===lG.UP?a.top-r-t:a.bottom+t,e+r,s,s+n),l=-1)}return e},tj=function(e,t){ea(D.SERIALIZER,e,t)},tJ=function(e,{addCoordinates:t=!1,saveIds:i=!0}={}){let o=e.workspace,s=Object.create(null);return s.height=e.getSize().height,s.width=e.getSize().width,i&&(s.id=e.id),t&&(t=e.getRelativeToSurfaceXY(),s.x=o.RTL?o.getWidth()-t.x:t.x,s.y=t.y),e.getText()&&(s.text=e.getText()),e.isCollapsed()&&(s.collapsed=!0),e.isOwnEditable()||(s.editable=!1),e.isOwnMovable()||(s.movable=!1),e.isOwnDeletable()||(s.deletable=!1),s},tZ=function(e,t,{recordUndo:i=!1}={}){let o=eG();if($.setRecordUndo$$module$build$src$core$events$utils(i),i=t.newComment(e.id),void 0!==e.text&&i.setText(e.text),void 0!==e.x||void 0!==e.y){var s;let o=i.getRelativeToSurfaceXY(),n,r=null!=(n=e.x)?n:o.x;r=t.RTL?t.getWidth()-r:r,t=null!=(s=e.y)?s:o.y,i.moveTo(new lt(r,t))}if(void 0!==e.width||e.height){let t,o;s=i.getSize(),i.setSize(new ls(null!=(t=e.width)?t:s.width,null!=(o=e.height)?o:s.height))}return void 0!==e.collapsed&&i.setCollapsed(e.collapsed),void 0!==e.editable&&i.setEditable(e.editable),void 0!==e.movable&&i.setMovable(e.movable),void 0!==e.deletable&&i.setDeletable(e.deletable),$.setRecordUndo$$module$build$src$core$events$utils(o),i},tq=function(e,t){ea(D.PASTER,e,t)},tQ=function(e){let t=e.workspace,i=e.getRelativeToSurfaceXY(),o=new lt(0,0),s=t.getTopComments(!1).filter(t=>t.id!==e.id).map(e=>e.getRelativeToSurfaceXY());for(;t0(lt.sum(i,o),s);)o.translate(t.RTL?-30:30,30);e.moveTo(lt.sum(i,o))},t0=function(e,t){return t.some(t=>1>=Math.abs(t.x-e.x)&&1>=Math.abs(t.y-e.y))},t1=function(e,t){e.setAttribute(lW,t)},t2=function(e,t,i){Array.isArray(i)&&(i=i.join(" ")),e.setAttribute(lU+t,`${i}`)},t3=function(e){return e&&"function"==typeof e.saveState&&"function"==typeof e.loadState},t5=function(e){return(t9(e),t8())?(t7(),Promise.resolve()):(l0||(l0=new Promise(e=>{l1=e,l2=window.requestAnimationFrame(()=>{t7(),e()})})),l0)},t6=function(){return l0||Promise.resolve()},t4=function(e){e||window.cancelAnimationFrame(l2),t7(e),!e&&l1&&l1()},t8=function(){return W},t9=function(e){lq.add(e),lQ.set(e,$.getGroup$$module$build$src$core$events$utils());let t=e.getParent();t?t9(t):lZ.add(e)},t7=function(e){let t=new Set(e?[e]:[...lZ].map(e=>e.workspace)),i=[...lZ].filter(it).filter(e=>t.has(e.workspace));for(var o of i)ii(o);for(let e of t)e.resizeContents();for(var s of i)o=s.getRelativeToSurfaceXY(),s.updateComponentLocations(o);for(let e of i)s=$.getGroup$$module$build$src$core$events$utils(),(o=lQ.get(e))&&$.setGroup$$module$build$src$core$events$utils(o),e.bumpNeighbours(),$.setGroup$$module$build$src$core$events$utils(s);for(let e of i)ie(e);e||(l0=null)},ie=function(e){for(let t of(lZ.delete(e),lq.delete(e),lQ.delete(e),e.getChildren(!1)))ie(t)},it=function(e){return!e.isDisposed()&&!e.getParent()},ii=function(e){if(lq.has(e)&&e.initialized){for(let t of e.getChildren(!1))ii(t);e.renderEfficiently()}},io=function(e,t){l7(e,t)},is=function(e,t){at(e,t)},ir=function(e,t,i){ao(e,t,i)},il=function(e){return e&&"function"==typeof e.getProcedureDef},ia=function(e){return e&&"function"==typeof e.getProcedureCall&&"function"==typeof e.renameProcedure},ic=function(e){return void 0!==e.getVariableModel},ih=function(e,t,i,o){e=e+" was deprecated in "+t+" and will be deleted in "+i+".",o&&(e+="\nUse "+o+" instead."),aa.has(e)||(aa.add(e),console.warn(e))},$.allUsedVarModels$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);let t=new Set;for(let i=0;i<e.length;i++){let o=e[i].getVarModels();if(o)for(let e=0;e<o.length;e++){let i=o[e];i.getId()&&t.add(i)}}return Array.from(t.values())},$.allDeveloperVariables$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);let t=new Set;for(let o=0,s;s=e[o];o++){var i=s.getDeveloperVariables;if(i){i=i();for(let e=0;e<i.length;e++)t.add(i[e])}}return Array.from(t.values())},iu=function(e){return id(e,!1)},id=function(e,t=!0){return(w.variables_set||w.variables_get||console.warn("There are no variable blocks, but there is a variable category."),t)?(ih("The XML return value of Blockly.Variables.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),ig(e)):(e.registerButtonCallback("CREATE_VARIABLE",function(e){iI(e.getTargetWorkspace())}),[{kind:"button",text:"%{BKY_NEW_VARIABLE}",callbackkey:"CREATE_VARIABLE"},...i_(e,e.getVariableMap().getVariablesOfType(""),!0)])},ip=function(e){return{VAR:{name:e.getName(),type:e.getType()}}},i_=function(e,t,i,o="variables_get",s="variables_set"){i&&(i=w.math_change),e=[];let n=t.slice(-1)[0];return n&&(w[s]&&e.push({kind:"block",type:s,gap:i?8:24,fields:ip(n)}),i&&e.push({kind:"block",type:"math_change",gap:w[o]?20:8,fields:ip(n),inputs:{DELTA:{shadow:{type:"math_number",fields:{NUM:1}}}}})),w[o]&&e.push(...t.sort(iy).map(e=>({kind:"block",type:o,gap:8,fields:ip(e)}))),e},ig=function(e){let t=[],i=document.createElement("button");return i.setAttribute("text","%{BKY_NEW_VARIABLE}"),i.setAttribute("callbackKey","CREATE_VARIABLE"),e.registerButtonCallback("CREATE_VARIABLE",function(e){iI(e.getTargetWorkspace())}),t.push(i),t.concat(e=iE(e))},iE=function(e){e=e.getVariableMap().getVariablesOfType("");let t=[];if(e.length>0){var i=e[e.length-1];if(w.variables_set){var o=$.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","variables_set"),o.setAttribute("gap",w.math_change?"8":"24"),o.appendChild(i$(i)),t.push(o)}if(w.math_change&&((o=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","math_change"),o.setAttribute("gap",w.variables_get?"20":"8"),o.appendChild(i$(i)),i=$.textToDom$$module$build$src$core$utils$xml('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),o.appendChild(i),t.push(o)),w.variables_get){e.sort(iy);for(let o=0,s;s=e[o];o++)(i=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get"),i.setAttribute("gap","8"),i.appendChild(i$(s)),t.push(i)}}return t},iT=function(e){return ad.generateUniqueNameInternal(e)},im=function(e,t){if(!t.length)return e;let i="",o=au.indexOf(e);for(;;){let s=!1;for(let i=0;i<t.length;i++)if(t[i].toLowerCase()===e){s=!0;break}if(!s)break;++o===au.length&&(o=0,i=`${Number(i)+1}`),e=au.charAt(o)+i}return e},iI=function(e,t,i){let o=i||"";!function i(s){iS($.Msg$$module$build$src$core$msg.NEW_VARIABLE_TITLE,s,function(s){if(s){var n=ib(s,e);if(n){if(n.getType()===o)var r=$.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS.replace("%1",n.getName());else r=(r=$.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE).replace("%1",n.getName()).replace("%2",n.getType());io(r,function(){i(s)})}else e.getVariableMap().createVariable(s,o),t&&t(s)}else t&&t(null)})}("")},$.renameVariable$$module$build$src$core$variables=function(e,t,i){!function o(s){let n=$.Msg$$module$build$src$core$msg.RENAME_VARIABLE_TITLE.replace("%1",t.getName());iS(n,s,function(s){if(s){var n=iR(s,t.getType(),e),r=iC(t.getName(),s,e);if(n||r){var l="";n?l=$.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",n.getName()).replace("%2",n.getType()):r&&(l=$.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER.replace("%1",s).replace("%2",r)),io(l,function(){o(s)})}else e.getVariableMap().renameVariable(t,s),i&&i(s)}else i&&i(null)})}("")},iS=function(e,t,i){ir(e,t,function(e){e&&((e=e.replace(/[\s\xa0]+/g," ").trim())===$.Msg$$module$build$src$core$msg.RENAME_VARIABLE||e===$.Msg$$module$build$src$core$msg.NEW_VARIABLE)&&(e=null),i(e)})},iR=function(e,t,i){i=i.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let o=0,s;s=i[o];o++)if(s.getName().toLowerCase()===e&&s.getType()!==t)return s;return null},ib=function(e,t){t=t.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let i=0,o;o=t[i];i++)if(o.getName().toLowerCase()===e)return o;return null},iC=function(e,t,i){return i.getProcedureMap().getProcedures().length?iO(e,t,i):iA(e,t,i)},iO=function(e,t,i){for(let s of(e=e.toLowerCase(),t=t.toLowerCase(),i=i.getProcedureMap().getProcedures())){var o=s.getParameters().filter(ic).map(e=>e.getVariableModel().getName());if(o&&(i=o.some(t=>t.toLowerCase()===e),o=o.some(e=>e.toLowerCase()===t),i&&o))return s.getName()}return null},iA=function(e,t,i){for(let s of(e=e.toLowerCase(),t=t.toLowerCase(),i=i.getAllBlocks(!1))){if(!il(s))continue;var o=(i=s.getProcedureDef())[1];let n=o.some(t=>t.toLowerCase()===e);if(o=o.some(e=>e.toLowerCase()===t),n&&o)return i[0]}return null},i$=function(e){let t=$.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name","VAR"),t.setAttribute("id",e.getId()),t.setAttribute("variabletype",e.getType()),e=$.createTextNode$$module$build$src$core$utils$xml(e.getName()),t.appendChild(e),t},$.getOrCreateVariablePackage$$module$build$src$core$variables=function(e,t,i,o){let s=$.getVariable$$module$build$src$core$variables(e,t,i,o);return s||(s=iN(e,t,i,o)),s},$.getVariable$$module$build$src$core$variables=function(e,t,i,o){let s=e.getPotentialVariableMap(),n=null;if(t&&((n=e.getVariableById(t))||!s||(n=s.getVariableById(t)),n))return n;if(i){if(void 0===o)throw Error("Tried to look up a variable by name without a type");(n=e.getVariable(i,o))||!s||(n=s.getVariable(i,o))}return n},iN=function(e,t,i,o){let s=e.getVariableMap(),n=e.getPotentialVariableMap();return i||(i=iT(e.isFlyout?e.targetWorkspace:e)),n?n.createVariable(i,o,null!=t?t:void 0):s.createVariable(i,o,t)},iL=function(e,t){e=e.getAllVariables();let i=[];if(t.length!==e.length)for(let o=0;o<e.length;o++){let s=e[o];t.includes(s)||i.push(s)}return i},iy=function(e,t){return e.getName().localeCompare(t.getName(),void 0,{sensitivity:"base"})},iD=function(e,t){let i=[];e=e.getAllBlocks(!1);for(let o=0;o<e.length;o++){let s=e[o].getVarModels();if(s)for(let n=0;n<s.length;n++)s[n].getId()===t&&i.push(e[o])}return i},$.deleteVariable$$module$build$src$core$variables=function(e,t,i){var o=t.getName();let s=iD(e,t.getId());for(let e=s.length-1;e>=0;e--){let t=s[e];if("procedures_defnoreturn"===t.type||"procedures_defreturn"===t.type){i=String(t.getFieldValue("NAME")),io(o=$.Msg$$module$build$src$core$msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",o).replace("%2",i));return}t===i&&s.splice(e,1)}i&&s.length||s.length>1?is(o=$.Msg$$module$build$src$core$msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(s.length+(i&&!i.workspace.isFlyout?1:0))).replace("%2",o),i=>{i&&t&&e.getVariableMap().deleteVariable(t)}):e.getVariableMap().deleteVariable(t)},ik=function(e,{addCoordinates:t=!1,addInputBlocks:i=!0,addNextBlocks:o=!0,doFullSerialization:s=!0,saveIds:n=!0}={}){if(e.isInsertionMarker())return null;let r={type:e.type,id:n?e.id:void 0};return t&&iv(e,r),iw(e,r),iM(e,r,s),iP(e,r,s),iB(e,r,s),i&&ix(e,r,s,n),o&&iF(e,r,s,n),r},iw=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),void 0!==e.inputsInline&&e.inputsInline!==e.inputsInlineDefault&&(t.inline=e.inputsInline),e.data&&(t.data=e.data)},iv=function(e,t){let i=e.workspace;e=e.getRelativeToSurfaceXY(),t.x=Math.round(i.RTL?i.getWidth()-e.x:e.x),t.y=Math.round(e.y)},iM=function(e,t,i){e.saveExtraState?null!==(e=e.saveExtraState(i))&&(t.extraState=e):e.mutationToDom&&null!==(e=e.mutationToDom())&&(t.extraState=sg(e).replace(' xmlns="https://developers.google.com/blockly/xml"',""))},iP=function(e,t,i){let o=Object.create(null);for(let t of e.getIcons())t3(t)&&(e=t.saveState(i))&&(o[t.getType().toString()]=e);Object.keys(o).length&&(t.icons=o)},iB=function(e,t,i){let o=Object.create(null);for(let t of e.getFields())t.isSerializable()&&(o[t.name]=t.saveState(i));Object.keys(o).length&&(t.fields=o)},ix=function(e,t,i,o){let s=Object.create(null);for(let t=0;t<e.inputList.length;t++){let n=e.inputList[t];if(!n.connection)continue;let r=iG(n.connection,i,o);r&&(s[n.name]=r)}Object.keys(s).length&&(t.inputs=s)},iF=function(e,t,i,o){e.nextConnection&&(e=iG(e.nextConnection,i,o))&&(t.next=e)},iG=function(e,t,i){let o=e.getShadowState(!0);if(e=e.targetBlock(),!o&&!e)return null;let s=Object.create(null);return o&&(s.shadow=o),e&&!e.isShadow()&&(s.block=ik(e,{doFullSerialization:t,saveIds:i})),s},iH=function(e,t,{recordUndo:i=!1}={}){return e=iU(e,t,{recordUndo:i}),t.rendered&&t4(),e},iU=function(e,t,{parentConnection:i,isShadow:o=!1,recordUndo:s=!1}={}){let n,r=eG();$.setRecordUndo$$module$build$src$core$events$utils(s),(s=$.getGroup$$module$build$src$core$events$utils())||$.setGroup$$module$build$src$core$events$utils(!0),$.disable$$module$build$src$core$events$utils();let l=t.getAllVariables();try{n=iW(e,t,{parentConnection:i,isShadow:o})}finally{$.enable$$module$build$src$core$events$utils()}if(iV(t,l),eX()&&eH(new(ej(rL.BLOCK_CREATE))(n)),$.setGroup$$module$build$src$core$events$utils(s),$.setRecordUndo$$module$build$src$core$events$utils(r),t.rendered){let e=n;setTimeout(()=>{e.disposed||e.setConnectionTracking(!0)},1)}return n},iW=function(e,t,{parentConnection:i,isShadow:o=!1}={}){if(!e.type)throw new ag(e);let s=t.newBlock(e.type,e.id);return s.setShadow(o),iK(s,e),iX(s,e),iY(s,e),iz(i,s,e),ij(s,e),iJ(s,e),iZ(s,e),iq(s,e),i0(s,t.rendered),s},iV=function(e,t){if(eX())for(e=iL(e,t),t=0;t<e.length;t++){let i=e[t];eH(new(ej(rL.VAR_CREATE))(i))}},iK=function(e,t){let i=void 0===t.x?0:t.x;t=void 0===t.y?0:t.y;let o=e.workspace;i=o.RTL?o.getWidth()-i:i,e.moveBy(i,t)},iX=function(e,t){if(t.collapsed&&e.setCollapsed(!0),!1===t.deletable&&e.setDeletable(!1),!1===t.movable&&e.setMovable(!1),!1===t.editable&&e.setEditable(!1),!1===t.enabled&&e.setDisabledReason(!0,lJ),Array.isArray(t.disabledReasons))for(let i of t.disabledReasons)e.setDisabledReason(!0,i);void 0!==t.inline&&e.setInputsInline(t.inline),void 0!==t.data&&(e.data=t.data)},iY=function(e,t){t.extraState&&(e.loadExtraState?e.loadExtraState(t.extraState):e.domToMutation&&e.domToMutation($.textToDom$$module$build$src$core$utils$xml(t.extraState)))},iz=function(e,t,i){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new am(i);if(e.type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var o=t.outputConnection;if(!o)throw new aE("output",t,i)}else if(!(o=t.previousConnection))throw new aE("previous",t,i);if(!e.connect(o)){let s=t.workspace.connectionChecker;throw new aT(s.getErrorMessage(s.canConnectWithReason(o,e,!1),o,e),e.type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,i)}}},ij=function(e,t){if(t.icons){var i=Object.keys(t.icons);for(let s of i){i=t.icons[s];var o=e.getIcon(s);if(!o){if(!(o=ep(D.ICON,s,!1)))throw new af(s,e,t);o=new o(e),e.addIcon(o)}t3(o)&&o.loadState(i)}}},iJ=function(e,t){if(t.fields){var i=Object.keys(t.fields);for(let o=0;o<i.length;o++){let s=i[o],n=t.fields[s],r=e.getField(s);r?r.loadState(n):console.warn(`Ignoring non-existant field ${s} in block ${e.type}`)}}},iZ=function(e,t){if(t.inputs){var i=Object.keys(t.inputs);for(let o=0;o<i.length;o++){let s=i[o],n=e.getInput(s);if(!n||!n.connection)throw new aE(s,e,t);iQ(n.connection,t.inputs[s])}}},iq=function(e,t){if(t.next){if(!e.nextConnection)throw new aE("next",e,t);iQ(e.nextConnection,t.next)}},iQ=function(e,t){t.shadow&&e.setShadowState(t.shadow),t.block&&iW(t.block,e.getSourceBlock().workspace,{parentConnection:e})},i0=function(e,t){if(t)for(let t of(e.setConnectionTracking(!1),e.initSvg(),e.queueRender(),e.getIcons()))t.onLocationChange(e.getRelativeToSurfaceXY());else e.initModel()},i1=function(e){return"function"==typeof e.bubbleIsVisible&&"function"==typeof e.setBubbleVisible&&"function"==typeof e.getBubble},i2=function(e){return e*Math.PI/180},i3=function(e,t,i){if(i<e){let t=i;i=e,e=t}return Math.max(e,Math.min(t,i))},i5=function(){document.querySelector(".blocklyDropDownDiv")||((av=document.createElement("div")).className="blocklyDropDownDiv",av.tabIndex=-1,(tu()||document.body).appendChild(av),(aM=document.createElement("div")).className="blocklyDropDownContent",av.appendChild(aM),aJ=eb(aM,"keydown",null,tT),(aP=document.createElement("div")).className="blocklyDropDownArrow",av.appendChild(aP),av.style.opacity="0",av.style.transition="transform "+aH+"s, opacity "+aH+"s")},i6=function(e){aX=e},i4=function(){return aY},i8=function(){return aM},i9=function(){aJ&&(eO(aJ),aJ=null),av.remove(),i5()},i7=function(e,t){av.style.backgroundColor=e,av.style.borderColor=t},oe=function(e,t,i,o=!0){return az=!0,oo(oi(e),e,o,t,i)},ot=function(e){var t=e.getSvgRoot();let i=e.workspace.scale,o=e.height*i;return e=e.width*i,new lo((t=tC(t)).y,t.y+o,t.x,t.x+e)},oi=function(e){return new lo((e=e.getScaledBBox()).top,e.bottom,e.left,e.right)},oo=function(e,t,i,o,s){let n=e.left+(e.right-e.left)/2,r=e.bottom;e=e.top,s&&(e+=s);let l=(s=t.getSourceBlock()).workspace;for(;l.options.parentWorkspace;)l=l.options.parentWorkspace;return i6(l.getParentSvg().parentNode),os(t,s.RTL,n,r,n,e,i,o)},os=function(e,t,i,o,s,n,r,l){return aY=e,aW=l||null,av.style.direction=t?"rtl":"ltr",aV=(e=tl()).getRenderer().getClassName(),aK=e.getTheme().getClassName(),eq(av,aV),eq(av,aK),i=od(i,o,s,n),r&&(aj=$.getFocusManager$$module$build$src$core$focus_manager().takeEphemeralFocus(av)),i},on=function(e,t,i,o){return{initialX:(e=ol(e,i.left,i.right,o.width)).divX,initialY:t,finalX:e.divX,finalY:t+aG,arrowX:e.arrowX,arrowY:-(aB/2+ax),arrowAtTop:!0,arrowVisible:!0}},or=function(e,t,i,o){return{initialX:(e=ol(e,i.left,i.right,o.width)).divX,initialY:t-o.height,finalX:e.divX,finalY:t-o.height-aG,arrowX:e.arrowX,arrowY:o.height-2*ax-aB/2,arrowAtTop:!1,arrowVisible:!0}},ol=function(e,t,i,o){return t=i3(t,e-o/2,i-o),e=e-aB/2-t,{arrowX:e=i3(i=aF,e,o-i-aB),divX:t}},oa=function(){return!!aY},oc=function(e,t){return aY===e&&(t?ou():oh(),!0)},oh=function(){av.style.transform="translate(0, 0)",av.style.opacity="0",aU=setTimeout(function(){ou()},1e3*aH),aW&&(aW(),aW=null)},ou=function(){oa()&&(aU&&clearTimeout(aU),aW&&(aW(),aW=null),i9(),aY=null,tl().markFocused(),aj&&(aj(),aj=null))},od=function(e,t,i,o){(e=aZ.getPositionMetrics(e,t,i,o)).arrowVisible?(t=e.arrowX,i=e.arrowY,o=e.arrowAtTop?45:225,aP.style.display="",aP.style.transform=`translate(${t}px, ${i}px) rotate(${o}deg)`,aP.setAttribute("class","blocklyDropDownArrow")):aP.style.display="none",t=Math.floor(e.initialX),i=Math.floor(e.initialY),o=Math.floor(e.finalX);let s=Math.floor(e.finalY);return av.style.left=t+"px",av.style.top=i+"px",av.style.display="block",av.style.opacity="1",av.style.transform="translate("+(o-t)+"px,"+(s-i)+"px)",!!e.arrowAtTop},op=function(){if(aY){var e=aY.getSourceBlock();let t=(e=az?oi(aY):ot(e)).left+(e.right-e.left)/2;od(t,e.bottom,t,e.top)}else oh()},o_=function(e){return e.length?e.reduce(function(e,t){return e.length<t.length?e:t}).length:0},og=function(e,t){let i;if(!e.length)return 0;if(1===e.length)return e[0].length;let o=0;for(i=0,t=t||o_(e);i<t;i++){for(var s=e[0][i],n=1;n<e.length;n++)if(s!==e[n][i])return o;" "===s&&(o=i+1)}for(s=1;s<e.length;s++)if((n=e[s][i])&&" "!==n)return o;return t},oE=function(e,t){let i;if(!e.length)return 0;if(1===e.length)return e[0].length;let o=0;for(i=0,t=t||o_(e);i<t;i++){for(var s=e[0].substr(-i-1,1),n=1;n<e.length;n++)if(s!==e[n].substr(-i-1,1))return o;" "===s&&(o=i+1)}for(s=1;s<e.length;s++)if((n=e[s].charAt(e[s].length-i-1))&&" "!==n)return o;return t},$.wrap$$module$build$src$core$utils$string=function(e,t){e=e.split("\n");for(let i=0;i<e.length;i++)e[i]=oT(e[i],t);return e.join("\n")},oT=function(e,t){if(e.length<=t)return e;let i=e.trim().split(/\s+/);for(var o=0;o<i.length;o++)i[o].length>t&&(t=i[o].length);var s=-1/0;let n,r=1;do{o=s,n=e,e=[],s=i.length/r;let l=1;for(let t=0;t<i.length-1;t++)l<(t+1.5)/s?(l++,e[t]=!0):e[t]=!1;e=of(i,e,t),s=om(i,e,t),e=oI(i,e),r++}while(s>o)return n},om=function(e,t,i){let o=[0],s=[];for(var n=0;n<e.length;n++)o[o.length-1]+=e[n].length,!0===t[n]?(o.push(0),s.push(e[n].charAt(e[n].length-1))):!1===t[n]&&o[o.length-1]++;for(n=0,e=Math.max(...o),t=0;n<o.length;n++)t-=2*Math.pow(Math.abs(i-o[n]),1.5),t-=Math.pow(e-o[n],1.5),".?!".includes(s[n])?t+=i/3:",;)]}".includes(s[n])&&(t+=i/4);return o.length>1&&o[o.length-1]<=o[o.length-2]&&(t+=.5),t},of=function(e,t,i){let o=om(e,t,i),s;for(let n=0;n<t.length-1;n++){if(t[n]===t[n+1])continue;let r=[].concat(t);r[n]=!r[n],r[n+1]=!r[n+1];let l=om(e,r,i);l>o&&(o=l,s=r)}return s?of(e,s,i):t},oI=function(e,t){let i=[];for(let o=0;o<e.length;o++)i.push(e[o]),void 0!==t[o]&&i.push(t[o]?"\n":" ");return i.join("")},$.isNumber$$module$build$src$core$utils$string=function(e){return/^\s*-?\d+(\.\d+)?\s*$/.test(e)},oS=function(e){if(e=oR(e)){for(e=e.tooltip;"function"==typeof e;)e=e();if("string"!=typeof e)throw Error("Tooltip function must return a string.");return e}return""},oR=function(e){for(;e&&e.tooltip;){if("string"==typeof e.tooltip||"function"==typeof e.tooltip)return e;e=e.tooltip}return null},ob=function(){document.querySelector(".blocklyTooltipDiv")||((cn=document.createElement("div")).className="blocklyTooltipDiv",(tu()||document.body).appendChild(cn))},oC=function(e){e.mouseOverWrapper_=eC(e,"pointerover",null,oA),e.mouseOutWrapper_=eC(e,"pointerout",null,o$),e.addEventListener("pointermove",oN,!1)},oO=function(e){e&&(eO(e.mouseOverWrapper_),eO(e.mouseOutWrapper_),e.removeEventListener("pointermove",oN))},oA=function(e){a2||(e=oR(e.currentTarget),a9!==e&&(oy(),a7=null,a9=e),clearTimeout(a5))},o$=function(e){a2||(a5=setTimeout(function(){a7=a9=null,oy()},1),clearTimeout(a6),a6=0)},oN=function(e){if(a9&&a9.tooltip&&!a2)if(a1){let t=a4-e.pageX;Math.sqrt(t*t+(e=a8-e.pageY)*e)>ci&&oy()}else a7!==a9&&(clearTimeout(a6),a4=e.pageX,a8=e.pageY,a6=setTimeout(oP,co))},oL=function(){a7=a9=null,oy()},oy=function(){a1&&(a1=!1,cn&&(cn.style.display="none")),a6&&(clearTimeout(a6),a6=0)},oD=function(){oy(),a2=!0},ok=function(){a2=!1},ow=function(){cn&&a9&&("function"==typeof a0?a0(cn,a9):ov())},ov=function(){var e=oS(a9);e=(e=$.wrap$$module$build$src$core$utils$string(e,a3)).split("\n");for(let t=0;t<e.length;t++){let i=document.createElement("div");i.appendChild(document.createTextNode(e[t])),cn.appendChild(i)}},oM=function(e){let t=document.documentElement.clientWidth,i=document.documentElement.clientHeight,o=a4;o=e?o-(ce+cn.offsetWidth):o+ce;let s=a8+ct;return s+cn.offsetHeight>i+window.scrollY&&(s-=cn.offsetHeight+2*ct),e?o=Math.max(cs-window.scrollX,o):o+cn.offsetWidth>t+window.scrollX-2*cs&&(o=t-cn.offsetWidth-2*cs),{x:o,y:s}},oP=function(){if(!a2&&(a7=a9,cn)){cn.textContent="",ow();var e=a9.RTL;cn.style.direction=e?"rtl":"ltr",cn.style.display="block",a1=!0;var{x:t,y:i}=oM(e);cn.style.left=t+"px",cn.style.top=i+"px"}},oB=function(){return cl},ox=function(){return ca},oF=function(e){var t=cc[e=`${e}`.toLowerCase().trim()];if(t||(t="#"===(t="0x"===e.substring(0,2)?"#"+e.substring(2):e)[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];var i=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return i&&(e=Number(i[1]),t=Number(i[2]),i=Number(i[3]),e>=0&&e<256&&t>=0&&t<256&&i>=0&&i<256)?oG(e,t,i):null},oG=function(e,t,i){return t=e<<16|t<<8|i,e<16?"#"+(0x1000000|t).toString(16).substr(1):"#"+t.toString(16)},oH=function(e){return(e=oF(e))?[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]:[0,0,0]},oU=function(e,t,i){let o=0,s=0,n=0;if(0===t)n=s=o=i;else{let r=Math.floor(e/60),l=e/60-r;e=i*(1-t);let a=i*(1-t*l);switch(t=i*(1-t*(1-l)),r){case 1:o=a,s=i,n=e;break;case 2:o=e,s=i,n=t;break;case 3:o=e,s=a,n=i;break;case 4:o=t,s=e,n=i;break;case 5:o=i,s=e,n=a;break;case 6:case 0:o=i,s=t,n=e}}return oG(Math.floor(o),Math.floor(s),Math.floor(n))},oW=function(e,t,i){return(e=oF(e))&&(t=oF(t))?(e=oH(e),t=oH(t),oG(Math.round(t[0]+i*(e[0]-t[0])),Math.round(t[1]+i*(e[1]-t[1])),Math.round(t[2]+i*(e[2]-t[2])))):null},oV=function(e){return oU(e,cl,255*ca)},oK=function(e,t,i){let o=[];var s=e.split("");s.push("");var n=0;e=[];let r=null;for(let c=0;c<s.length;c++){var l=s[c];if(0===n)if("%"===l)(n=e.join(""))&&o.push(n),e.length=0,n=1;else if(i&&"\n"===l){let t=e.join("");t&&o.push(t),e.length=0,o.push(l)}else e.push(l);else if(1===n)"%"===l?(e.push(l),n=0):t&&"0"<=l&&l<="9"?(n=2,r=l,(l=e.join(""))&&o.push(l),e.length=0):"{"===l?n=3:(e.push("%",l),n=0);else if(2===n)if("0"<=l&&l<="9")r+=l;else{var a=void 0;o.push(parseInt(null!=(a=r)?a:"",10)),c--,n=0}else 3===n&&(""===l?(e.splice(0,0,"%{"),c--,n=0):"}"!==l?e.push(l):(n=e.join(""),/[A-Z]\w*/i.test(n)&&(l=(l=n.toUpperCase()).startsWith("BKY_")?l.substring(4):null)&&l in $.Msg$$module$build$src$core$msg?"string"==typeof(n=$.Msg$$module$build$src$core$msg[l])?Array.prototype.push.apply(o,oK(n,t,i)):t?o.push(`${n}`):o.push(n):o.push("%{"+n+"}"),n=e.length=0))}for((t=e.join(""))&&o.push(t),a=[],e.length=0,s=0;s<o.length;s++)"string"!=typeof o[s]||i&&"\n"===o[s]?((t=e.join(""))&&a.push(t),e.length=0,a.push(o[s])):e.push(o[s]);return(t=e.join(""))&&a.push(t),e.length=0,a},oX=function(e){return oK(e,!0,!0)},oY=function(e){return"string"!=typeof e?e:(e=oK(e,!1,!1)).length?String(e[0]):""},oz=function(e){let t="string"==typeof e?oY(e):e;var i=Number(t);if(!isNaN(i)&&0<=i&&i<=360)return{hue:i,hex:oU(i,oB(),255*ox())};if(i=oF(t))return{hue:null,hex:i};throw i='Invalid colour: "'+t+'"',e!==t&&(i+=' (from "'+e+'")'),Error(i)},oj=function(){return cg},oJ=function(){let e=tu()||document.body,t=document.querySelector("div."+cf);t?cg=t:((cg=document.createElement("div")).className=cf,cg.tabIndex=-1),eb(cg,"keydown",null,tT),e.appendChild(cg)},oZ=function(e,t,i,o,s=!0){if(oq(),cE=e,cm=i,i=cg){var n,r;if(i.style.direction=t?"rtl":"ltr",i.style.display="block",!o&&e instanceof cd){let t;o=null==(t=e.getSourceBlock())?void 0:t.workspace}cT=null!=(n=o)?n:null,cI=(e=null!=(r=o)?r:tl()).getRenderer().getClassName(),cS=e.getTheme().getClassName(),cI&&eq(i,cI),cS&&eq(i,cS),s&&(cR=$.getFocusManager$$module$build$src$core$focus_manager().takeEphemeralFocus(i))}},oq=function(){if(oQ()){cE=null;var e=cg;e&&(e.style.display="none",e.style.left="",e.style.top="",cm&&(cm(),cm=null),e.textContent="",cI&&(e0(e,cI),cI=""),cS&&(e0(e,cS),cS=""),tl().markFocused(),cR&&(cR(),cR=null))}},oQ=function(){return!!cE},o0=function(e){cE===e&&oq()},o1=function(e){let t=null===cT,i=e;for(;!t&&i;){if(i===e){t=!0;break}i=e.options.parentWorkspace}t&&oq()},o2=function(e,t,i){cg.style.left=e+"px",cg.style.top=t+"px",cg.style.height=i+"px"},o3=function(e,t,i,o){let s=o6(e,t,i);e=o5(e,t,i,o),s<0?o2(e,0,i.height+s):o2(e,s,i.height)},o5=function(e,t,i,o){return o?Math.min(Math.max(t.right-i.width,e.left),e.right-i.width):Math.max(Math.min(t.left,e.right-i.width),e.left)},o6=function(e,t,i){return t.bottom+i.height>=e.bottom?t.top-i.height:t.bottom},o4=function(){var e;!(null==(e=cE)||!e.repositionForWindowResize)&&cE.repositionForWindowResize()||oq()},o8=function(e){cC=e},o9=function(e,t,i,o,s){if(oZ(cO,i,ss,o),t.length){s||(e instanceof PointerEvent?s=new lt(e.clientX,e.clientY):(console.warn("Context menu opened with keyboard but no location given"),s=new lt(0,0)));var n=o7(t,i,e,s);cA=n,se(n,i,s),setTimeout(function(){n.focus()},1),cC=null}else so()},o7=function(e,t,i,o){let s=new lX;s.setRole(lH.MENU);for(let n=0;n<e.length;n++){let r=e[n];if(r.separator){s.addChild(new lY);continue}let l=new lK(r.text);l.setRightToLeft(t),l.setRole(lH.MENUITEM),s.addChild(l),l.setEnabled(r.enabled),r.enabled&&l.onAction(function(e,t){so(),requestAnimationFrame(()=>{setTimeout(()=>{r.callback(r.scope,i,t,o)},0)})},{})}return s},se=function(e,t,i){let o=tD();i=new lo(i.y+o.top,i.y+o.top,i.x+o.left,i.x+o.left),st(e);let s=e.getSize();t&&(i.left+=s.width,i.right+=s.width,o.left+=s.width,o.right+=s.width),o3(o,i,s,t),e.focus()},st=function(e){var t=oj();if(!t)throw Error("Attempting to create a context menu when widget div is null");eq(t=e.render(t),"blocklyContextMenu"),eb(t,"contextmenu",null,si),e.focus()},si=function(e){e.preventDefault(),e.stopPropagation()},so=function(){o0(cO),cC=null},ss=function(){cA&&(cA.dispose(),cA=null)},$.callbackFactory$$module$build$src$core$contextmenu=function(e,t){return()=>{let i;$.disable$$module$build$src$core$events$utils();try{i=t instanceof Element?sT(t,e.workspace):iU(t,e.workspace);let o=e.getRelativeToSurfaceXY();o.x=e.RTL?o.x-$.config$$module$build$src$core$config.snapRadius:o.x+$.config$$module$build$src$core$config.snapRadius,o.y+=2*$.config$$module$build$src$core$config.snapRadius,i.moveBy(o.x,o.y)}finally{$.enable$$module$build$src$core$events$utils()}return eX()&&!i.isShadow()&&eH(new(ej(rL.BLOCK_CREATE))(i)),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(i),i}},sn=function(e,t){return t=eN(t,e.getParentSvg(),e.getInverseScreenCTM()),t.x/=e.scale,t.y/=e.scale,t},sr=function(e,t,i){t=sn(e,t),ck.set(e,lt.difference(i,t))},sl=function(e,t){if(t=sn(e,t),!(e=ck.get(e)))throw Error("Drag not initialized");return lt.sum(e,t)},sa=function(e,t=!1){let i=$.createElement$$module$build$src$core$utils$xml("comment");t||i.setAttribute("id",e.id),t=e.workspace;let o=e.getRelativeToSurfaceXY();return o.x=t.RTL?t.getWidth()-o.x:o.x,i.setAttribute("x",`${o.x}`),i.setAttribute("y",`${o.y}`),i.setAttribute("w",`${e.getSize().width}`),i.setAttribute("h",`${e.getSize().height}`),e.getText()&&(i.textContent=e.getText()),e.isCollapsed()&&i.setAttribute("collapsed","true"),e.isOwnEditable()||i.setAttribute("editable","false"),e.isOwnMovable()||i.setAttribute("movable","false"),e.isOwnDeletable()||i.setAttribute("deletable","false"),i},sc=function(e){let t=$.createElement$$module$build$src$core$utils$xml("variables");for(let i=0;i<e.length;i++){let o=e[i],s=$.createElement$$module$build$src$core$utils$xml("variable");s.appendChild($.createTextNode$$module$build$src$core$utils$xml(o.getName())),o.getType()&&s.setAttribute("type",o.getType()),s.id=o.getId(),t.appendChild(s)}return t},sh=function(e,t){if(e.isInsertionMarker()&&!(e=e.getChildren(!1)[0]))return new DocumentFragment;let i=0;if(e.workspace.RTL&&(i=e.workspace.getWidth()),t=sp(e,t),sL(t)){let o=e.getRelativeToSurfaceXY();t.setAttribute("x",String(Math.round(e.workspace.RTL?i-o.x:o.x))),t.setAttribute("y",String(Math.round(o.y)))}return t},su=function(e){if(e.isSerializable()){let t=$.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name",e.name||""),e.toXml(t)}return null},sd=function(e,t){for(let i of e.getFields())(e=su(i))&&t.appendChild(e)},sp=function(e,t){let i;if(e.isInsertionMarker())return(t=e.getChildren(!1)[0])?sp(t):new DocumentFragment;let o=$.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 s=e.mutationToDom();s&&(s.hasChildNodes()||s.hasAttributes())&&o.appendChild(s)}if(sd(e,o),s=e.getCommentText()){var n=e.getIcon(ab.COMMENT),r=n.getBubbleSize(),l=n.bubbleIsVisible();n=n.getBubbleLocation();var a=$.createElement$$module$build$src$core$utils$xml("comment");a.appendChild($.createTextNode$$module$build$src$core$utils$xml(s)),a.setAttribute("pinned",`${l}`),a.setAttribute("h",`${r.height}`),a.setAttribute("w",`${r.width}`),n&&(a.setAttribute("x",`${e.workspace.RTL?e.workspace.getWidth()-(n.x+r.width):n.x}`),a.setAttribute("y",`${n.y}`)),o.appendChild(a)}for(e.data&&((s=$.createElement$$module$build$src$core$utils$xml("data")).appendChild($.createTextNode$$module$build$src$core$utils$xml(e.data)),o.appendChild(s)),s=0;s<e.inputList.length;s++){r=e.inputList[s];var c=void 0;l=!0,r.type!==$.inputTypes$$module$build$src$core$inputs$input_types.DUMMY&&r.type!==$.inputTypes$$module$build$src$core$inputs$input_types.END_ROW&&(n=r.connection.targetBlock(),r.type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE?c=$.createElement$$module$build$src$core$utils$xml("value"):r.type===$.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT&&(c=$.createElement$$module$build$src$core$utils$xml("statement")),!(a=r.connection.getShadowDom())||n&&n.isShadow()||c.appendChild(s_(a,t)),n&&(n=sp(n,t)).nodeType===ry.ELEMENT_NODE&&(c.appendChild(n),l=!1),c.setAttribute("name",r.name),l||o.appendChild(c))}return void 0!==e.inputsInline&&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"),(c=e.getNextBlock())&&(s=sp(c,t)).nodeType===ry.ELEMENT_NODE&&((i=$.createElement$$module$build$src$core$utils$xml("next")).appendChild(s),o.appendChild(i)),!(e=e.nextConnection&&e.nextConnection.getShadowDom())||c&&c.isShadow()||i.appendChild(s_(e,t)),o},s_=function(e,t){let i=e=e.cloneNode(!0),o;for(;i;)if(t&&"shadow"===i.nodeName&&i.removeAttribute("id"),i.firstChild)i=i.firstChild;else{for(;i&&!i.nextSibling;){let e;o=i,i=i.parentNode,o.nodeType===ry.TEXT_NODE&&""===o.data.trim()&&(null==(e=i)?void 0:e.firstChild)!==o&&e2(o)}i&&(o=i,i=i.nextSibling,o.nodeType===ry.TEXT_NODE&&""===o.data.trim()&&e2(o))}return e},sg=function(e){return tM(e).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},$.domToWorkspace$$module$build$src$core$xml=function(e,t){let i=0;t.RTL&&(i=t.getWidth());let o=[];e6();let s=$.getGroup$$module$build$src$core$events$utils();s||$.setGroup$$module$build$src$core$events$utils(!0),t.setResizesEnabled&&t.setResizesEnabled(!1);let n=!0;try{for(let s=0,r;r=e.childNodes[s];s++){let e=r.nodeName.toLowerCase(),s=r;if("block"!==e&&("shadow"!==e||eG())){if("shadow"===e)throw TypeError("Shadow block cannot be a top-level block.");if("comment"===e)sE(s,t);else if("variables"===e){if(n)sm(s,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.");n=!1}}else{let e,r,l=sT(s,t);o.push(l.id);let a=parseInt(null!=(e=s.getAttribute("x"))?e:"10",10),c=parseInt(null!=(r=s.getAttribute("y"))?r:"10",10);isNaN(a)||isNaN(c)||l.moveBy(t.RTL?i-a:a,c,["create"]),n=!1}}}finally{$.setGroup$$module$build$src$core$events$utils(s),t.setResizesEnabled&&t.setResizesEnabled(!0),t.rendered&&t4(),e4()}return eH(new(ej(rL.FINISHED_LOADING))(t)),o},sE=function(e,t){var i,o,s,n;let r,l,a=null!=(i=e.getAttribute("id"))?i:void 0;return(i=t.rendered?new cW(t,a):new cU(t,a)).setText(null!=(o=e.textContent)?o:""),o=parseInt(null!=(s=e.getAttribute("x"))?s:"",10),s=parseInt(null!=(r=e.getAttribute("y"))?r:"",10),isNaN(o)||isNaN(s)||(o=t.RTL?t.getWidth()-o:o,i.moveTo(new lt(o,s))),t=parseInt(null!=(n=e.getAttribute("w"))?n:"",10),n=parseInt(null!=(l=e.getAttribute("h"))?l:"",10),isNaN(t)||isNaN(n)||i.setSize(new ls(t,n)),"true"===e.getAttribute("collapsed")&&i.setCollapsed(!0),"false"===e.getAttribute("editable")&&i.setEditable(!1),"false"===e.getAttribute("movable")&&i.setMovable(!1),"false"===e.getAttribute("deletable")&&i.setDeletable(!1),i},$.domToBlock$$module$build$src$core$xml=function(e,t){return e=sT(e,t),t.rendered&&t4(),e},sT=function(e,t){let i;$.disable$$module$build$src$core$events$utils();var o=t.getAllVariables();try{if(i=s$(e,t),t.rendered){let e=i,o=i.getDescendants(!1);e.setConnectionTracking(!1);for(let e=o.length-1;e>=0;e--)o[e].initSvg();for(let e=o.length-1;e>=0;e--)o[e].queueRender();setTimeout(function(){e.disposed||e.setConnectionTracking(!0)},1),t.resizeContents()}else{let e=i.getDescendants(!1);for(let t=e.length-1;t>=0;t--)e[t].initModel()}}finally{$.enable$$module$build$src$core$events$utils()}if(eX()){for(e=iL(t,o),t=0;t<e.length;t++)o=e[t],eH(new(ej(rL.VAR_CREATE))(o));eH(new(ej(rL.BLOCK_CREATE))(i))}return i},sm=function(e,t){for(let o=0;o<e.children.length;o++){var i=e.children[o];let s=i.getAttribute("type"),n=i.getAttribute("id");if(!(i=i.textContent))break;t.getVariableMap().createVariable(i,null!=s?s:void 0,n)}},sf=function(e){let t={mutation:[],comment:[],data:[],field:[],input:[],next:[]};for(let i=0;i<e.children.length;i++){let o=e.children[i];if(o.nodeType!==ry.TEXT_NODE)switch(o.nodeName.toLowerCase()){case"mutation":t.mutation.push(o);break;case"comment":t.comment.push(o);break;case"data":t.data.push(o);break;case"title":case"field":t.field.push(o);break;case"value":case"statement":t.input.push(o);break;case"next":t.next.push(o);break;default:console.warn("Ignoring unknown tag: "+o.nodeName)}}return t},sI=function(e,t){let i=!1;for(let o=0;o<e.length;o++){let s=e[o];t.domToMutation&&(t.domToMutation(s),t.initSvg&&(i=!0))}return i},sS=function(e,t){for(let i=0;i<e.length;i++){let o,s,n=e[i],r=n.textContent,l="true"===n.getAttribute("pinned"),a=parseInt(null!=(o=n.getAttribute("w"))?o:"50",10),c=parseInt(null!=(s=n.getAttribute("h"))?s:"50",10),h,u=parseInt(null!=(h=n.getAttribute("x"))?h:"",10),d,p=parseInt(null!=(d=n.getAttribute("y"))?d:"",10);t.setCommentText(r);let _=t.getIcon(ab.COMMENT);isNaN(a)||isNaN(c)||_.setBubbleSize(new ls(a,c)),_.setBubbleVisible(l),setTimeout(()=>{isNaN(u)||isNaN(p)||(u=t.workspace.RTL?t.workspace.getWidth()-(u+a):u,_.setBubbleLocation(new lt(u,p))),_.setBubbleVisible(l)},1)}},sR=function(e,t){for(let i=0;i<e.length;i++)t.data=e[i].textContent},sb=function(e,t){for(let i=0;i<e.length;i++){let o=e[i],s=o.getAttribute("name");s?sN(t,s,o):console.warn(`Ignoring unnamed field in block ${t.type}`)}},sC=function(e){let t=null,i=null;for(let o=0;o<e.childNodes.length;o++){let s=e.childNodes[o];sL(s)&&("block"===s.nodeName.toLowerCase()?t=s:"shadow"===s.nodeName.toLowerCase()&&(i=s))}return{childBlockElement:t,childShadowElement:i}},sO=function(e,t,i,o){for(let n=0;n<e.length;n++){var s=e[n];let r=s.getAttribute("name"),l=r?i.getInput(r):null;if(!l){console.warn("Ignoring non-existent input "+r+" in block "+o);break}if((s=sC(s)).childBlockElement){if(!l.connection)throw TypeError("Input connection does not exist.");s$(s.childBlockElement,t,l.connection,!1)}if(s.childShadowElement){let e;null==(e=l.connection)||e.setShadowDom(s.childShadowElement)}}},sA=function(e,t,i){for(let o=0;o<e.length;o++){let s=sC(e[o]);if(s.childBlockElement){if(!i.nextConnection)throw TypeError("Next statement does not exist.");if(i.nextConnection.isConnected())throw TypeError("Next statement is already connected.");s$(s.childBlockElement,t,i.nextConnection,!0)}s.childShadowElement&&i.nextConnection&&i.nextConnection.setShadowDom(s.childShadowElement)}},s$=function(e,t,i,o){let s=e.getAttribute("type");if(!s)throw TypeError("Block type unspecified: "+e.outerHTML);var n,r=null!=(n=e.getAttribute("id"))?n:void 0;n=t.newBlock(s,r);let l=sI((r=sf(e)).mutation,n);if(sS(r.comment,n),sR(r.data,n),i)if(o)if(n.previousConnection)i.connect(n.previousConnection);else throw TypeError("Next block does not have previous statement.");else if(n.outputConnection)i.connect(n.outputConnection);else if(n.previousConnection)i.connect(n.previousConnection);else throw TypeError("Child block does not have output or previous statement.");if(sb(r.field,n),sO(r.input,t,n,s),sA(r.next,t,n),l&&n.initSvg(),(t=e.getAttribute("inline"))&&n.setInputsInline("true"===t),(t=e.getAttribute("disabled"))&&n.setDisabledReason("true"===t||"disabled"===t,lJ),null!==(t=e.getAttribute("disabled-reasons")))for(var a of t.split(","))n.setDisabledReason(!0,decodeURIComponent(a));if((a=e.getAttribute("deletable"))&&n.setDeletable("true"===a),(a=e.getAttribute("movable"))&&n.setMovable("true"===a),(a=e.getAttribute("editable"))&&n.setEditable("true"===a),(a=e.getAttribute("collapsed"))&&n.setCollapsed("true"===a),"shadow"===e.nodeName.toLowerCase()){for(a=0,e=n.getChildren(!1);a<e.length;a++)if(!e[a].isShadow())throw TypeError("Shadow block not allowed non-shadow child.");n.setShadow(!0)}return n},sN=function(e,t,i){let o=e.getField(t);o?o.fromXml(i):console.warn("Ignoring non-existent field "+t+" in block "+e.type)},sL=function(e){return e.nodeType===ry.ELEMENT_NODE},sy=function(e,t){ea(D.FIELD,e,t)},$.fromJson$$module$build$src$core$field_registry=function(e){return cq.fromJsonInternal(e)},sD=function(e){return e&&"object"==typeof e&&"src"in e&&"string"==typeof e.src&&"alt"in e&&"string"==typeof e.alt&&"width"in e&&"number"==typeof e.width&&"height"in e&&"number"==typeof e.height},$.register$$module$build$src$core$extensions=function(e,t){if("string"!=typeof e||""===e.trim())throw Error('Error: Invalid extension name "'+e+'"');if(ho[e])throw Error('Error: Extension "'+e+'" is already registered.');if("function"!=typeof t)throw Error('Error: Extension "'+e+'" must be a function');ho[e]=t},$.registerMixin$$module$build$src$core$extensions=function(e,t){if(!t||"object"!=typeof t)throw Error('Error: Mixin "'+e+'" must be a object');$.register$$module$build$src$core$extensions(e,function(){this.mixin(t)})},$.registerMutator$$module$build$src$core$extensions=function(e,t,i,o){let s='Error when registering mutator "'+e+'": ';sB(s,t);let n=sM(t,s);if(i&&"function"!=typeof i)throw Error(s+'Extension "'+e+'" is not a function');$.register$$module$build$src$core$extensions(e,function(){n&&this.setMutator(new $.MutatorIcon$$module$build$src$core$icons$mutator_icon(o||[],this)),this.mixin(t),i&&i.apply(this)})},sk=function(e){return!!ho[e]},sw=function(e,t,i){let o,s=ho[e];if("function"!=typeof s)throw Error('Error: Extension "'+e+'" not found.');if(i?sv(e,t):o=sx(t),s.apply(t),i)sB('Error after applying mutator "'+e+'": ',t);else if(!sF(o,t))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},sv=function(e,t){if(sx(t).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+t.id)},sM=function(e,t){return sP(e.compose,e.decompose,t+" compose/decompose")},sP=function(e,t,i){if(e&&t){if("function"!=typeof e||"function"!=typeof t)throw Error(i+" must be a function");return!0}if(!e&&!t)return!1;throw Error(i+"Must have both or neither functions")},sB=function(e,t){let i=sP(t.mutationToDom,t.domToMutation,e+" mutationToDom/domToMutation"),o=sP(t.saveExtraState,t.loadExtraState,e+" saveExtraState/loadExtraState");if(!i&&!o)throw Error(e+"Mutations must contain either XML hooks, or JSON hooks, or both");sM(t,e)},sx=function(e){let t=[];return void 0!==e.domToMutation&&t.push(e.domToMutation),void 0!==e.mutationToDom&&t.push(e.mutationToDom),void 0!==e.saveExtraState&&t.push(e.saveExtraState),void 0!==e.loadExtraState&&t.push(e.loadExtraState),void 0!==e.compose&&t.push(e.compose),void 0!==e.decompose&&t.push(e.decompose),t},sF=function(e,t){if((t=sx(t)).length!==e.length)return!1;for(let i=0;i<t.length;i++)if(e[i]!==t[i])return!1;return!0},$.buildTooltipForDropdown$$module$build$src$core$extensions=function(e,t){let i=[];return function(){i.includes(this.type)||(sG(this,e,t),i.push(this.type)),this.setTooltip((function(){return oY(t[String(this.getFieldValue(e))])}).bind(this))}},sG=function(e,t,i){var o=e.getField(t);if(o instanceof c0&&!o.isOptionListDynamic())for(let s of o=o.getOptions())s!==c0.SEPARATOR&&([,o]=s,void 0===i[o]&&console.warn(`No tooltip mapping for value ${o} of field ${t} of block type ${e.type}.`))},$.buildTooltipWithFieldText$$module$build$src$core$extensions=function(e,t){return function(){this.setTooltip((function(){let i=this.getField(t);return oY(e).replace("%1",i?i.getText():"")}).bind(this))}},sH=function(e,t){return" "+e+","+t+" "},sU=function(e,t){return" "+e+t.join("")},sW=function(e,t){return" M "+e+","+t+" "},sV=function(e,t){return" m "+e+","+t+" "},sK=function(e,t){return" l "+e+","+t+" "},sX=function(e){return" l"+e.join("")},sY=function(e,t){return" "+e+" "+t+" "},sz=function(e,t,i,o){return e+" "+i+" "+i+" "+t+o},sj=function(e,t){if(!e||!t)throw Error("Cannot connect null connections.");e.targetConnection=t,t.targetConnection=e},sJ=function(e,t){let i=null,o=null==(t=t.outputConnection)?void 0:t.getConnectionChecker();for(let s=0,n;n=e.inputList[s];s++){let e=n.connection;if(e&&(null==o?0:o.canConnect(t,e,!1))){if(i)return null;i=e}}return i},sZ=function(e,t){let i;for(;i=sJ(e,t);)if(!(e=i.targetBlock())||e.isShadow())return i;return null},sq=function(e){return te(e)&&"function"==typeof e.getType&&"function"==typeof e.initView&&"function"==typeof e.dispose&&"function"==typeof e.getWeight&&"function"==typeof e.getSize&&"function"==typeof e.applyColour&&"function"==typeof e.hideForInsertionMarker&&"function"==typeof e.updateEditable&&"function"==typeof e.updateCollapsed&&"function"==typeof e.isShownWhenCollapsed&&"function"==typeof e.setOffsetInBlock&&"function"==typeof e.onLocationChange&&"function"==typeof e.onClick},sQ=function(e){if(!(e.getDescendants(!1).length>100)){var t,i=e.workspace,o=e.getSvgRoot();i.getAudioManager().play("delete");var s=e.getRelativeToSurfaceXY(),n=o.cloneNode(!0);n.setAttribute("transform","translate("+s.x+","+s.y+")"),null==(t=i.getLayerManager())||t.appendToAnimationLayer({getSvgRoot:()=>n}),s0(n,{x:s.x,y:s.y,width:e.width,height:e.height},i.RTL,new Date)}},s0=function(e,t,i,o){let s=((new Date).getTime()-o.getTime())/150;s>1?e2(e):(e.setAttribute("transform","translate("+(t.x+(i?-1:1)*t.width/2*s)+","+(t.y+t.height/2*s)+") scale("+(1-s)+")"),setTimeout(s0,10,e,t,i,o))},s1=function(e){var t=e.workspace;let i=t.scale;if(t.getAudioManager().play("click"),!(i<1)){var o=t.getSvgXY(e.getSvgRoot());e.outputConnection?(o.x+=(e.RTL?3:-3)*i,o.y+=13*i):e.previousConnection&&(o.x+=(e.RTL?-23:23)*i,o.y+=3*i);var s=eZ(li.CIRCLE,{cx:o.x,cy:o.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg());e=eZ(li.ANIMATE,{id:"animationCircle",begin:"indefinite",attributeName:"r",dur:"150ms",from:0,to:25*i},s),t=eZ(li.ANIMATE,{id:"animationOpacity",begin:"indefinite",attributeName:"opacity",dur:"150ms",from:1,to:0},s),e.beginElement(),t.beginElement(),setTimeout(()=>void e2(s),150)}},s2=function(e){if(s5(),e.workspace.getAudioManager().play("disconnect"),!(e.workspace.scale<1)){var t=e.getHeightWidth().height;t=Math.atan(10/t)/Math.PI*180,e.RTL||(t*=-1),hb=e,s3(e,t,new Date,0)}},s3=function(e,t,i,o){let s=[.66,1,.66,0,-.66,-1,-.66,0],n="";i.getTime()+200>(new Date).getTime()&&(n=`skewX(${Math.round(s[o%s.length]*t)})`,hR=setTimeout(s3,15,e,t,i,o+1)),e.getSvgRoot().setAttribute("transform",`${e.getTranslation()} ${n}`)},s5=function(){hb&&(hR&&(clearTimeout(hR),hR=null),hb.getSvgRoot().setAttribute("transform",hb.getTranslation()),hb=null)},s6=function(e,t){let i=e.workspace,o=$.config$$module$build$src$core$config.snapRadius,s=lt.difference(t,e.getRelativeToSurfaceXY()),n=new lt(0,0),r=i.getAllBlocks(!1).filter(t=>t.id!=e.id).map(e=>e.getRelativeToSurfaceXY());for(;s4(lt.sum(t,n),r)||s8(e,lt.sum(s,n),o);)i.RTL?n.translate(-o,2*o):n.translate(o,2*o);e.moveTo(lt.sum(t,n))},s4=function(e,t){return t.some(t=>1>=Math.abs(t.x-e.x)&&1>=Math.abs(t.y-e.y))},s8=function(e,t,i){return e.getConnections_(!1).some(e=>!!e.closest(i,t).connection)},s9=function(e,t,i){let o=i.getBoundingRectangle(),s=o.right-o.left,n=i3(t.top,o.top,t.top+t.height-(o.bottom-o.top))-o.top,r=t.left;return t=t.left+t.width-s,e.RTL?r=Math.min(t,r):t=Math.max(r,t),(!!(e=i3(r,o.left,t)-o.left)||!!n)&&(i.moveBy(e,n,["inbounds"]),!0)},s7=function(e){return t=>{var i,o=e.getMetricsManager();if(o.hasFixedEdges()&&!e.isDragging())if(z.includes(null!=(i=t.type)?i:"")){i=o.getScrollMetrics(!0);let s=ne(e,t);s&&(o=$.getGroup$$module$build$src$core$events$utils()||!1,$.setGroup$$module$build$src$core$events$utils(t.group),s9(e,i,s)&&!t.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),$.setGroup$$module$build$src$core$events$utils(o))}else eF(t)&&t.scale&&t.oldScale&&t.scale>t.oldScale&&nt(e)}},ne=function(e,t){let i=null;switch(t.type){case rL.BLOCK_CREATE:case rL.BLOCK_MOVE:(i=e.getBlockById(t.blockId))&&(i=i.getRootBlock());break;case rL.COMMENT_CREATE:case rL.COMMENT_MOVE:case rL.COMMENT_RESIZE:i=e.getCommentById(t.commentId)}return i},nt=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var i=e.getTopBoundedElements();for(let o=0,s;s=i[o];o++)s9(e,t,s)}},ni=function(e){return e&&"function"==typeof e.isDeletable&&"function"==typeof e.dispose&&"function"==typeof e.setDeleteStyle},no=function(e,t){let i=e.getIcons();for(let o of e.inputList){let s;if(o.isVisible())if(i.push(...o.fieldRow),null==(s=o.connection)?0:s.targetBlock())if(e=o.connection.targetBlock(),o.connection.type!==c5.NEXT_STATEMENT||t)i.push(e);else{let t;(e=null==(t=e.lastConnectionInStack(!1))?void 0:t.getSourceBlock())&&i.push(e)}else{let e;(null==(e=o.connection)?void 0:e.type)===c5.INPUT_VALUE&&i.push(o.connection)}}return i},ns=function(e,t){let i=e.workspace.getTopBoundedElements(!0).filter(e=>te(e));e=i.indexOf(e instanceof hD?e.getRootBlock():e)+t;let o=null;if(e>=0&&e<i.length?o=i[e]:e<0?o=i[i.length-1]:e>=i.length&&(o=i[0]),t<0&&o instanceof hD){let e,t;return null!=(t=null==(e=o.lastConnectionInStack(!1))?void 0:e.getSourceBlock())?t:o}return o},nn=function(e,t){var i;let o,s=e instanceof hD?null!=(o=null==(i=e.outputConnection)?void 0:i.targetBlock())?o:e.getSurroundParent():e.getSourceBlock();return s instanceof hD&&-1!==(e=(i=no(s,t>0)).indexOf(e))&&(t=e+t)>=0&&t<i.length?i[t]:null},nr=function(e){return e&&"function"==typeof e.getRelativeToSurfaceXY&&"function"==typeof e.isMovable&&"function"==typeof e.startDrag&&"function"==typeof e.drag&&"function"==typeof e.endDrag&&"function"==typeof e.revertDrag},nl=function(e){return e&&"function"==typeof e.autoHide},na=function(e,t){ea(D.ICON,e.toString(),t)},nc=function(e){return"function"==typeof e.getProcedureModel&&"function"==typeof e.doProcedureUpdate&&"function"==typeof e.isProcedureDef},nh=function(e){return e&&"function"==typeof e.startPublishing&&"function"==typeof e.stopPublishing},nu=function(e){let t=e.getProcedureMap().getProcedures().filter(e=>!e.getReturnTypes()).map(e=>[e.getName(),e.getParameters().map(e=>e.getName()),!1]);e.getBlocksByType("procedures_defnoreturn",!1).forEach(e=>{!nc(e)&&il(e)&&t.push(e.getProcedureDef())});let i=e.getProcedureMap().getProcedures().filter(e=>!!e.getReturnTypes()).map(e=>[e.getName(),e.getParameters().map(e=>e.getName()),!0]);return e.getBlocksByType("procedures_defreturn",!1).forEach(e=>{!nc(e)&&il(e)&&i.push(e.getProcedureDef())}),t.sort(nd),i.sort(nd),[t,i]},nd=function(e,t){return e[0].localeCompare(t[0],void 0,{sensitivity:"base"})},$.findLegalName$$module$build$src$core$procedures=function(e,t){if(t.isInFlyout)return e;for(e=e||$.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!np(e,t.workspace,t);){let t=e.match(/^(.*?)(\d+)$/);e=t?t[1]+(parseInt(t[2])+1):e+"2"}return e},np=function(e,t,i){return!n_(e,t,i)},n_=function(e,t,i){for(let o of t.getAllBlocks(!1))if(o!==i&&il(o)&&$.Names$$module$build$src$core$names.equals(o.getProcedureDef()[0],e))return!0;for(let o of(i=i&&nc(i)?null==i?void 0:i.getProcedureModel():void 0,t.getProcedureMap().getProcedures()))if(o!==i&&$.Names$$module$build$src$core$names.equals(o.getName(),e))return!0;return!1},$.rename$$module$build$src$core$procedures=function(e){var t=this.getSourceBlock();if(!t)throw new cp;e=e.trim();let i=$.findLegalName$$module$build$src$core$procedures(e,t);nc(t)&&!t.isInsertionMarker()&&t.getProcedureModel().setName(i);let o=this.getValue();if(o!==e&&o!==i)for(e=t.workspace.getAllBlocks(!1),t=0;t<e.length;t++){let s=e[t];s.renameProcedure&&s.renameProcedure(o,i)}return i},ng=function(e){function t(e,t){for(let s=0;s<e.length;s++){var o=e[s][0];let n=e[s][1],r=$.createElement$$module$build$src$core$utils$xml("block");r.setAttribute("type",t),r.setAttribute("gap","16");let l=$.createElement$$module$build$src$core$utils$xml("mutation");for(l.setAttribute("name",o),r.appendChild(l),o=0;o<n.length;o++){let e=$.createElement$$module$build$src$core$utils$xml("arg");e.setAttribute("name",n[o]),l.appendChild(e)}i.push(r)}}let i=[];if(w.procedures_defnoreturn){var o=$.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","procedures_defnoreturn"),o.setAttribute("gap","16");var s=$.createElement$$module$build$src$core$utils$xml("field");s.setAttribute("name","NAME"),s.appendChild($.createTextNode$$module$build$src$core$utils$xml($.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE)),o.appendChild(s),i.push(o)}return w.procedures_defreturn&&((o=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","procedures_defreturn"),o.setAttribute("gap","16"),(s=$.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name","NAME"),s.appendChild($.createTextNode$$module$build$src$core$utils$xml($.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),o.appendChild(s),i.push(o)),w.procedures_ifreturn&&((o=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","procedures_ifreturn"),o.setAttribute("gap","16"),i.push(o)),i.length&&i[i.length-1].setAttribute("gap","24"),t((e=nu(e))[0],"procedures_callnoreturn"),t(e[1],"procedures_callreturn"),i},nE=function(e){return nT(e,!1)},nT=function(e,t=!0){function i(e,t){for(let[i,s]of e)o.push({kind:"block",type:t,gap:16,extraState:{name:i,params:s}})}if(t)return ih("The XML return value of Blockly.Procedures.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),ng(e);let o=[];return w.procedures_defnoreturn&&o.push({kind:"block",type:"procedures_defnoreturn",gap:16,fields:{NAME:$.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE}}),w.procedures_defreturn&&o.push({kind:"block",type:"procedures_defreturn",gap:16,fields:{NAME:$.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE}}),w.procedures_ifreturn&&o.push({kind:"block",type:"procedures_ifreturn",gap:16}),o.length&&(o[o.length-1].gap=24),i((e=nu(e))[0],"procedures_callnoreturn"),i(e[1],"procedures_callreturn"),o},nm=function(e){var t=[],i=e.getBlocksByType("procedures_mutatorarg",!1);for(let e=0,o;o=i[e];e++)t.push(o.getFieldValue("NAME"));i=$.createElement$$module$build$src$core$utils$xml("xml");let o=$.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","procedures_mutatorarg");let s=$.createElement$$module$build$src$core$utils$xml("field");s.setAttribute("name","NAME"),t=im($.DEFAULT_ARG$$module$build$src$core$procedures,t),t=$.createTextNode$$module$build$src$core$utils$xml(t),s.appendChild(t),o.appendChild(s),i.appendChild(o),e.updateToolbox(i)},nf=function(e){if(ex(e)&&"mutator"===e.bubbleType&&e.isOpen&&e.blockId){var t=(e=to(e.workspaceId).getBlockById(e.blockId)).type;("procedures_defnoreturn"===t||"procedures_defreturn"===t)&&(nm(e=e.getIcon($.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE).getWorkspace()),e.addChangeListener(nI))}},nI=function(e){(ek(e)||ew(e)||ev(e)||eM(e))&&nm(e=to(e.workspaceId))},nS=function(e,t){return t.getAllBlocks(!1).filter(t=>nR(t,e)||ia(t)&&$.Names$$module$build$src$core$names.equals(t.getProcedureCall(),e))},nR=function(e,t){return nc(e)&&!e.isProcedureDef()&&e.getProcedureModel()&&$.Names$$module$build$src$core$names.equals(e.getProcedureModel().getName(),t)},$.mutateCallers$$module$build$src$core$procedures=function(e){let t=eG();var i=e.getProcedureDef()[0];let o=e.mutationToDom(!0);e=nS(i,e.workspace);for(let n=0,r;r=e[n];n++){i=(i=r.mutationToDom())&&tM(i),r.domToMutation&&r.domToMutation(o);var s=r.mutationToDom();i!==(s=s&&tM(s))&&($.setRecordUndo$$module$build$src$core$events$utils(!1),eH(new(ej(rL.BLOCK_CHANGE))(r,"mutation",null,i,s)),$.setRecordUndo$$module$build$src$core$events$utils(t))}},$.getDefinition$$module$build$src$core$procedures=function(e,t){for(let i of t.getAllBlocks(!1))if(nc(i)&&i.isProcedureDef()&&$.Names$$module$build$src$core$names.equals(i.getProcedureModel().getName(),e)||il(i)&&$.Names$$module$build$src$core$names.equals(i.getProcedureDef()[0],e))return i;return null},nb=function(e){return e.isDynamic},nC=function(e){return void 0!==e.pathDown&&void 0!==e.pathUp},nO=function(e){return void 0!==e.pathLeft&&void 0!==e.pathRight},nA=function(e,t){ea(D.RENDERER,e,t)},n$=function(e,t,i){return(e=new(ep(D.RENDERER,e))(e)).init(t,i),e},nN=function(e){iI(e.getTargetWorkspace(),void 0,"String")},nL=function(e){iI(e.getTargetWorkspace(),void 0,"Number")},ny=function(e){iI(e.getTargetWorkspace(),void 0,"Colour")},nD=function(e){return nk(e,!1)},nk=function(e,t=!0){return(w.variables_set_dynamic||w.variables_get_dynamic||console.warn("There are no dynamic variable blocks, but there is a dynamic variable category."),t)?(ih("The XML return value of Blockly.VariablesDynamic.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),nw(e)):(e.registerButtonCallback("CREATE_VARIABLE_STRING",nN),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",nL),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",ny),[{kind:"button",text:$.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE,callbackkey:"CREATE_VARIABLE_STRING"},{kind:"button",text:$.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE,callbackkey:"CREATE_VARIABLE_NUMBER"},{kind:"button",text:$.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE,callbackkey:"CREATE_VARIABLE_COLOUR"},...i_(e,e.getVariableMap().getAllVariables(),!1,"variables_get_dynamic","variables_set_dynamic")])},nw=function(e){let t=[],i=document.createElement("button");return i.setAttribute("text",$.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),t.push(i),(i=document.createElement("button")).setAttribute("text",$.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),t.push(i),(i=document.createElement("button")).setAttribute("text",$.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),t.push(i),e.registerButtonCallback("CREATE_VARIABLE_STRING",nN),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",nL),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",ny),t.concat(e=nv(e))},nv=function(e){e=e.getVariableMap().getAllVariables();let t=[];if(e.length>0){if(w.variables_set_dynamic){var i=e[e.length-1];let o=$.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","variables_set_dynamic"),o.setAttribute("gap","24"),o.appendChild(i$(i)),t.push(o)}if(w.variables_get_dynamic){e.sort(iy);for(let o=0,s;s=e[o];o++)(i=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get_dynamic"),i.setAttribute("gap","8"),i.appendChild(i$(s)),t.push(i)}}return t},nM=function(e,t){let i=e.toCopyData();return dt=i,di=tt(e)&&e.workspace instanceof uH?e.workspace:null,ds=t,i},nP=function(){return dt},nB=function(){return di},nx=function(){return ds},nF=function(e,t,i){return e&&t?nG(e,t,i):dt&&di?nG(dt,di,ds):null},nG=function(e,t,i){let o,s,n;return t=t.isMutator?t:null!=(o=t.options.parentWorkspace)?o:t,null!=(n=null==(s=e_(D.PASTER,e.paster,!1))?void 0:s.paste(e,t,i))?n:null},nH=function(e){return e&&"function"==typeof e.toCopyData},nU=function(){rW.registry.register({name:dz.ESCAPE,preconditionFn:e=>!e.isReadOnly(),callback:e=>(e.hideChaff(),!0),keyCodes:[dK.ESC]})},nW=function(){rW.registry.register({name:dz.DELETE,preconditionFn:(e,t)=>(t=t.focusedNode,!e.isReadOnly()&&null!=t&&ni(t)&&t.isDeletable()&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()),callback:(e,t,i,o)=>(t.preventDefault(),(e=o.focusedNode)instanceof hD?e.checkAndDelete():ni(e)&&e.isDeletable()&&($.setGroup$$module$build$src$core$events$utils(!0),e.dispose(),$.setGroup$$module$build$src$core$events$utils(!1)),!0),keyCodes:[dK.DELETE,dK.BACKSPACE]})},nV=function(e){return!!(nH(e)&&ni(e)&&nr(e))&&(e.isCopyable?e.isCopyable():e instanceof hD||e instanceof cW?e.isOwnDeletable()&&e.isOwnMovable():e.isDeletable()&&e.isMovable())},nK=function(e){return nV(e)&&ni(e)&&e.isDeletable()},nX=function(){let e=rW.registry.createSerializedKey(dK.C,[dK.CTRL]),t=rW.registry.createSerializedKey(dK.C,[dK.META]);rW.registry.register({name:dz.COPY,preconditionFn:(e,t)=>(t=t.focusedNode,e=e.isFlyout?e.targetWorkspace:e,!!t&&!!e&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()&&nV(t)),callback:(e,t,i,o)=>(t.preventDefault(),!!(t=o.focusedNode)&&!!nH(t)&&!!nV(t)&&!!(e=e.isFlyout?e.targetWorkspace:e)&&(t.workspace.isFlyout||e.hideChaff(),e=nr(t)&&t.workspace==e?t.getRelativeToSurfaceXY():void 0,!!nM(t,e))),keyCodes:[e,t]})},nY=function(){let e=rW.registry.createSerializedKey(dK.X,[dK.CTRL]),t=rW.registry.createSerializedKey(dK.X,[dK.META]);rW.registry.register({name:dz.CUT,preconditionFn:(e,t)=>!!(t=t.focusedNode)&&!e.isReadOnly()&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()&&nK(t),callback:(e,t,i,o)=>!!(e=o.focusedNode)&&!!nK(e)&&!!nH(e)&&(t=nr(e)?e.getRelativeToSurfaceXY():void 0,t=nM(e,t),e instanceof hD?e.checkAndDelete():ni(e)&&e.dispose(),!!t),keyCodes:[e,t]})},nz=function(){let e=rW.registry.createSerializedKey(dK.V,[dK.CTRL]),t=rW.registry.createSerializedKey(dK.V,[dK.META]);rW.registry.register({name:dz.PASTE,preconditionFn(){var e=nB();return!!e&&!!e.rendered&&(e=e.isFlyout?e.targetWorkspace:e,!!nP()&&!!e&&!e.isReadOnly()&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken())},callback(e,t){if(!(e=nP()))return!1;var i=nB();if(!i||!(i=i.isFlyout?i.targetWorkspace:i)||i.isReadOnly())return!1;if(t instanceof PointerEvent)return t=tw(i,new lt(t.clientX,t.clientY)),!!nF(e,i,t);if(!(t=nx()))return!!nF(e,i);let{left:o,top:s,width:n,height:r}=i.getMetricsManager().getViewMetrics(!0);return new lo(s,s+r,o,o+n).contains(t.x,t.y)?!!nF(e,i):(t=new lt(o+n/2,s+r/2),!!nF(e,i,t))},keyCodes:[e,t]})},nj=function(){let e=rW.registry.createSerializedKey(dK.Z,[dK.CTRL]),t=rW.registry.createSerializedKey(dK.Z,[dK.META]);rW.registry.register({name:dz.UNDO,preconditionFn:e=>!e.isReadOnly()&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken(),callback:(e,t)=>(e.hideChaff(),e.undo(!1),t.preventDefault(),!0),keyCodes:[e,t]})},nJ=function(){let e=rW.registry.createSerializedKey(dK.Z,[dK.CTRL,dK.SHIFT]),t=rW.registry.createSerializedKey(dK.Z,[dK.META,dK.SHIFT]),i=rW.registry.createSerializedKey(dK.Y,[dK.CTRL]);rW.registry.register({name:dz.REDO,preconditionFn:e=>!e.isDragging()&&!e.isReadOnly()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken(),callback:(e,t)=>(e.hideChaff(),e.undo(!0),t.preventDefault(),!0),keyCodes:[e,t,i]})},nZ=function(){nU(),nW(),nX(),nY(),nz(),nj(),nJ()},nq=function(e){let t=e.saveState();return e.getParameters().length&&(t.parameters=e.getParameters().map(e=>e.saveState())),t},nQ=function(e,t,i,o){if(e=e.loadState(i,o),!i.parameters)return e;for(let[s,n]of i.parameters.entries())e.insertParameter(t.loadState(n,o),s);return e},n0=function(e,t){e.setAttribute("dir","LTR"),tI(t.hasCss,t.pathToMedia);let i=eZ(li.SVG,{xmlns:rD,"xmlns:html":rk,"xmlns:xlink":rw,version:"1.1",class:"blocklySvg"},e),o=eZ(li.DEFS,{},i),s=String(Math.random()).substring(2);return t.gridPattern=h4.createDom(s,t.gridOptions,o,e),i},n1=function(e,t,i){i.parentWorkspace=null;let o=(i=new uH(i)).options;i.scale=o.zoomOptions.startScale,t.appendChild(i.createDom("blocklyMainBackground",e));var s=i.getRenderer().getClassName();return s&&eq(e,s),(s=i.getTheme().getClassName())&&eq(e,s),!o.hasCategories&&o.languageTree&&e3(e=i.addFlyout(li.SVG),t),o.hasTrashcan&&i.addTrashcan(),o.zoomOptions&&o.zoomOptions.controls&&i.addZoomControls(),i.getThemeManager().subscribe(t,"workspaceBackgroundColour","background-color"),i.translate(0,0),i.addChangeListener(s7(i)),tp(i),oJ(),i5(),ob(),i},n2=function(e){let t=e.options;var i=e.getParentSvg();if(eb(i.parentNode,"contextmenu",null,function(e){eA(e)||e.preventDefault()}),i=eb(window,"resize",null,function(){oy(),e.hideComponents(!0),op(),o4(),tp(e),nt(e)}),e.setResizeHandlerWrapper(i),n3(),t.languageTree){i=e.getToolbox();let o=e.getFlyout(!0);i?i.init():o&&(o.init(e),o.show(t.languageTree),"function"==typeof o.scrollToStart&&o.scrollToStart())}t.hasTrashcan&&e.trashcan.init(),t.zoomOptions&&t.zoomOptions.controls&&e.zoomControls_.init(),t.moveOptions&&t.moveOptions.scrollbars?(e.scrollbar=new hq(e,!0===t.moveOptions.scrollbars||!!t.moveOptions.scrollbars.horizontal,!0===t.moveOptions.scrollbars||!!t.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),e.scrollbar.resize()):e.setMetrics({x:.5,y:.5}),t.hasSounds&&n5(t.pathToMedia,e)},n3=function(){dN||(eb(document,"scroll",null,function(){let e=ts();for(let t=0,i;i=e[t];t++)i instanceof uH&&i.updateInverseScreenCTM()}),eC(document,"touchend",null,em),eC(document,"touchcancel",null,em)),dN=!0},n5=function(e,t){function i(){for(;s.length;){let e=s.pop();e&&eO(e)}o.preload()}let o=t.getAudioManager();o.load([e+"click.mp3",e+"click.wav",e+"click.ogg"],"click"),o.load([e+"disconnect.wav",e+"disconnect.mp3",e+"disconnect.ogg"],"disconnect"),o.load([e+"delete.mp3",e+"delete.ogg",e+"delete.wav"],"delete");let s=[];s.push(eb(document,"pointermove",null,i,!0)),s.push(eb(document,"touchstart",null,i,!0))},n6=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.UNDO,preconditionFn:e=>e.workspace.getUndoStack().length>0?"enabled":"disabled",callback(e){e.workspace.undo(!1)},scopeType:cN.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1})},n4=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.REDO,preconditionFn:e=>e.workspace.getRedoStack().length>0?"enabled":"disabled",callback(e){e.workspace.undo(!0)},scopeType:cN.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2})},n8=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.CLEAN_UP,preconditionFn:e=>e.workspace.isMovable()?e.workspace.getTopBlocks(!1).length>1?"enabled":"disabled":"hidden",callback(e){e.workspace.cleanUp()},scopeType:cN.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3})},n9=function(e,t){function i(t){s--,t.setCollapsed(e),0===s&&$.setGroup$$module$build$src$core$events$utils(!1)}let o=0,s=0;$.setGroup$$module$build$src$core$events$utils(!0);for(let e=0;e<t.length;e++){let n=t[e];for(;n;)s++,setTimeout(i.bind(null,n),o),n=n.getNextBlock(),o+=10}},n7=function(){cN.registry.register({displayText:()=>$.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 i=e[t];for(;i;){if(!i.isCollapsed())return"enabled";i=i.getNextBlock()}}return"disabled"}return"hidden"},callback(e){n9(!0,e.workspace.getTopBlocks(!0))},scopeType:cN.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})},re=function(){cN.registry.register({displayText:()=>$.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 i=e[t];for(;i;){if(i.isCollapsed())return"enabled";i=i.getNextBlock()}}return"disabled"}return"hidden"},callback(e){n9(!1,e.workspace.getTopBlocks(!0))},scopeType:cN.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})},rt=function(e,t){if(e.isDeletable())Array.prototype.push.apply(t,e.getDescendants(!1));else{e=e.getChildren(!1);for(let i=0;i<e.length;i++)rt(e[i],t)}},ri=function(e){let t=[];e=e.getTopBlocks(!0);for(let i=0;i<e.length;i++)rt(e[i],t);return t},ro=function(e,t){t?$.setGroup$$module$build$src$core$events$utils(t):($.setGroup$$module$build$src$core$events$utils(!0),t=$.getGroup$$module$build$src$core$events$utils());let i=e.shift();i&&(i.isDeadOrDying()?ro(e,t):(i.dispose(!1,!0),setTimeout(ro,10,e,t))),$.setGroup$$module$build$src$core$events$utils(!1)},rs=function(){cN.registry.register({displayText:e=>e.workspace?1===(e=ri(e.workspace).length)?$.Msg$$module$build$src$core$msg.DELETE_BLOCK:$.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`):"",preconditionFn:e=>e.workspace&&ri(e.workspace).length>0?"enabled":"disabled",callback(e){if(e.workspace){e.workspace.cancelCurrentGesture();var t=ri(e.workspace);t.length<2?ro(t):is($.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),function(e){e&&ro(t)})}},scopeType:cN.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},rn=function(){n6(),n4(),n8(),n7(),re(),rs()},rr=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.DUPLICATE_BLOCK,preconditionFn:e=>!(e=e.block).isInFlyout&&e.isDeletable()&&e.isMovable()?e.isDuplicatable()?"enabled":"disabled":"hidden",callback(e){if(e.block){var t=e.block.toCopyData();t&&nF(t,e.block.workspace)}},scopeType:cN.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},rl=function(){cN.registry.register({displayText:e=>e.block.hasIcon(uo.TYPE)?$.Msg$$module$build$src$core$msg.REMOVE_COMMENT:$.Msg$$module$build$src$core$msg.ADD_COMMENT,preconditionFn:e=>!(e=e.block).isInFlyout&&e.workspace.options.comments&&!e.isCollapsed()&&e.isEditable()?"enabled":"hidden",callback(e){(e=e.block).hasIcon(uo.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:cN.ScopeType.BLOCK,id:"blockComment",weight:2})},ra=function(){cN.registry.register({displayText:e=>e.block.getInputsInline()?$.Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:$.Msg$$module$build$src$core$msg.INLINE_INPUTS,preconditionFn(e){if(!(e=e.block).isInFlyout&&e.isMovable()&&!e.isCollapsed()){for(let t=1;t<e.inputList.length;t++)if(!(e.inputList[t-1]instanceof dI||e.inputList[t]instanceof dI))return"enabled"}return"hidden"},callback(e){e.block.setInputsInline(!e.block.getInputsInline())},scopeType:cN.ScopeType.BLOCK,id:"blockInline",weight:3})},rc=function(){cN.registry.register({displayText:e=>e.block.isCollapsed()?$.Msg$$module$build$src$core$msg.EXPAND_BLOCK:$.Msg$$module$build$src$core$msg.COLLAPSE_BLOCK,preconditionFn:e=>!(e=e.block).isInFlyout&&e.isMovable()&&e.workspace.options.collapse?"enabled":"hidden",callback(e){e.block.setCollapsed(!e.block.isCollapsed())},scopeType:cN.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},rh=function(){cN.registry.register({displayText:e=>e.block.hasDisabledReason(lJ)?$.Msg$$module$build$src$core$msg.ENABLE_BLOCK:$.Msg$$module$build$src$core$msg.DISABLE_BLOCK,preconditionFn(e){if(!(e=e.block).isInFlyout&&e.workspace.options.disable&&e.isEditable()){var t=e.getDisabledReasons();return t=t.size>+!!t.has(lJ),e.getInheritedDisabled()||t?"disabled":"enabled"}return"hidden"},callback(e){e=e.block;let t=$.getGroup$$module$build$src$core$events$utils();t||$.setGroup$$module$build$src$core$events$utils(!0),e.setDisabledReason(!e.hasDisabledReason(lJ),lJ),$.setGroup$$module$build$src$core$events$utils(t)},scopeType:cN.ScopeType.BLOCK,id:"blockDisable",weight:5})},ru=function(){cN.registry.register({displayText(e){var t=e.block;return e=t.getDescendants(!1).length,(t=t.getNextBlock())&&(e-=t.getDescendants(!1).length),1===e?$.Msg$$module$build$src$core$msg.DELETE_BLOCK:$.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`)},preconditionFn:e=>!e.block.isInFlyout&&e.block.isDeletable()?"enabled":"hidden",callback(e){e.block&&e.block.checkAndDelete()},scopeType:cN.ScopeType.BLOCK,id:"blockDelete",weight:6})},rd=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.HELP,preconditionFn:e=>("function"==typeof(e=e.block).helpUrl?e.helpUrl():e.helpUrl)?"enabled":"hidden",callback(e){e.block.showHelp()},scopeType:cN.ScopeType.BLOCK,id:"blockHelp",weight:7})},rp=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.REMOVE_COMMENT,preconditionFn(e){let t;return(null==(t=e.comment)?0:t.isDeletable())?"enabled":"hidden"},callback(e){let t;$.setGroup$$module$build$src$core$events$utils(!0),null==(t=e.comment)||t.dispose(),$.setGroup$$module$build$src$core$events$utils(!1)},scopeType:cN.ScopeType.COMMENT,id:"commentDelete",weight:6})},r_=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,preconditionFn(e){let t;return(null==(t=e.comment)?0:t.isMovable())?"enabled":"hidden"},callback(e){if(e.comment){var t=e.comment.toCopyData();t&&nF(t,e.comment.workspace)}},scopeType:cN.ScopeType.COMMENT,id:"commentDuplicate",weight:1})},rg=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.ADD_COMMENT,preconditionFn:e=>{let t;return(null==(t=e.workspace)?0:t.isMutator)?"hidden":"enabled"},callback:(e,t,i,o)=>{(e=e.workspace)&&($.setGroup$$module$build$src$core$events$utils(!0),(t=new cW(e)).setPlaceholderText($.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT),t.moveTo(rE(new lt(o.x,o.y),e)),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(t),$.setGroup$$module$build$src$core$events$utils(!1))},scopeType:cN.ScopeType.WORKSPACE,id:"commentCreate",weight:8})},rE=function(e,t){var i=t.getInjectionDiv().getBoundingClientRect();return e=new lt(e.x-i.left,e.y-i.top),i=t.getOriginOffsetInPixels(),(e=lt.difference(e,i)).scale(1/t.scale),e},rT=function(){rr(),rl(),ra(),rc(),rh(),ru(),rd()},rm=function(){rn(),rT()},(rf=rf||{}).scope={},rf.ASSUME_ES5=!1,rf.ASSUME_ES6=!1,rf.ASSUME_ES2020=!1,rf.ASSUME_NO_NATIVE_MAP=!1,rf.ASSUME_NO_NATIVE_SET=!1,rf.ISOLATE_POLYFILLS=!1,rf.FORCE_POLYFILL_PROMISE=!1,rf.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,rf.INSTRUMENT_ASYNC_CONTEXT=!0,rf.objectCreate=rf.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(e){var t=function(){};return t.prototype=e,new t},rf.defineProperty=rf.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,i){return e==Array.prototype||e==Object.prototype||(e[t]=i.value),e},rf.getGlobal=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof r&&r];for(var t=0;t<e.length;++t){var i=e[t];if(i&&i.Math==Math)return i}throw Error("Cannot find global object")},rf.global=rf.ASSUME_ES2020?globalThis:rf.getGlobal(this),rf.IS_SYMBOL_NATIVE="function"==typeof Symbol&&"symbol"==typeof Symbol("x"),rf.TRUST_ES6_POLYFILLS=!rf.ISOLATE_POLYFILLS||rf.IS_SYMBOL_NATIVE,rf.polyfills={},rf.propertyToPolyfillSymbol={},rf.POLYFILL_PREFIX="$jscp$",rf.polyfill=function(e,t,i,o){t&&(rf.ISOLATE_POLYFILLS?rf.polyfillIsolated(e,t,i,o):rf.polyfillUnisolated(e,t,i,o))},rf.polyfillUnisolated=function(e,t,i,o){for(o=0,i=rf.global,e=e.split(".");o<e.length-1;o++){var s=e[o];if(!(s in i))return;i=i[s]}(t=t(o=i[e=e[e.length-1]]))!=o&&null!=t&&rf.defineProperty(i,e,{configurable:!0,writable:!0,value:t})},rf.polyfillIsolated=function(e,t,i,o){var s=e.split(".");e=1===s.length,o=s[0],o=!e&&o in rf.polyfills?rf.polyfills:rf.global;for(var n=0;n<s.length-1;n++){var r=s[n];if(!(r in o))return;o=o[r]}s=s[s.length-1],null!=(t=t(i=rf.IS_SYMBOL_NATIVE&&"es6"===i?o[s]:null))&&(e?rf.defineProperty(rf.polyfills,s,{configurable:!0,writable:!0,value:t}):t!==i&&(void 0===rf.propertyToPolyfillSymbol[s]&&(i=1e9*Math.random()>>>0,rf.propertyToPolyfillSymbol[s]=rf.IS_SYMBOL_NATIVE?rf.global.Symbol(s):rf.POLYFILL_PREFIX+i+"$"+s),rf.defineProperty(o,rf.propertyToPolyfillSymbol[s],{configurable:!0,writable:!0,value:t})))},rf.getConstructImplementation=function(){if(rf.TRUST_ES6_POLYFILLS&&"u">typeof Reflect&&Reflect.construct){if(function(){function e(){}return new e,Reflect.construct(e,[],function(){}),new e instanceof e}())return Reflect.construct;var e=Reflect.construct;return function(t,i,o){return t=e(t,i),o&&Reflect.setPrototypeOf(t,o.prototype),t}}return function(e,t,i){return void 0===i&&(i=e),i=rf.objectCreate(i.prototype||Object.prototype),Function.prototype.apply.call(e,i,t)||i}},rf.construct=({valueOf:rf.getConstructImplementation}).valueOf(),rf.underscoreProtoCanBeSet=function(){var e={};try{return e.__proto__={a:!0},e.a}catch(e){}return!1},rf.setPrototypeOf=rf.ASSUME_ES6||rf.TRUST_ES6_POLYFILLS&&"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:rf.underscoreProtoCanBeSet()?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw TypeError(e+" is not extensible");return e}:null,rf.inherits=function(e,t){if(e.prototype=rf.objectCreate(t.prototype),e.prototype.constructor=e,rf.ASSUME_ES6||rf.setPrototypeOf){var i=rf.setPrototypeOf;i(e,t)}else for(i in t)if("prototype"!=i)if(Object.defineProperties){var o=Object.getOwnPropertyDescriptor(t,i);o&&Object.defineProperty(e,i,o)}else e[i]=t[i];e.superClass_=t.prototype},rf.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}},rf.arrayIterator=function(e){return{next:rf.arrayIteratorImpl(e)}},rf.makeIterator=function(e){var t="u">typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];if(t)return t.call(e);if("number"==typeof e.length)return rf.arrayIterator(e);throw Error(String(e)+" is not an iterable or ArrayLike")},rf.arrayFromIterator=function(e){for(var t,i=[];!(t=e.next()).done;)i.push(t.value);return i},rf.arrayFromIterable=function(e){return e instanceof Array?e:rf.arrayFromIterator(rf.makeIterator(e))},rf.generator={},rf.generator.ensureIteratorResultIsObject_=function(e){if(!(e instanceof Object))throw TypeError("Iterator result "+e+" is not an object")},rf.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},rf.generator.Context.prototype.start_=function(){if(this.isRunning_)throw TypeError("Generator is already running");this.isRunning_=!0},rf.generator.Context.prototype.stop_=function(){this.isRunning_=!1},rf.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_},rf.generator.Context.prototype.next_=function(e){this.yieldResult=e},rf.generator.Context.prototype.throw_=function(e){this.abruptCompletion_={exception:e,isException:!0},this.jumpToErrorHandler_()},rf.generator.Context.prototype.return=function(e){this.abruptCompletion_={return:e},this.nextAddress=this.finallyAddress_},rf.generator.Context.prototype.jumpThroughFinallyBlocks=function(e){this.abruptCompletion_={jumpTo:e},this.nextAddress=this.finallyAddress_},rf.generator.Context.prototype.yield=function(e,t){return this.nextAddress=t,{value:e}},rf.generator.Context.prototype.yieldAll=function(e,t){var i=(e=rf.makeIterator(e)).next();if(rf.generator.ensureIteratorResultIsObject_(i),!i.done)return this.yieldAllIterator_=e,this.yield(i.value,t);this.yieldResult=i.value,this.nextAddress=t},rf.generator.Context.prototype.jumpTo=function(e){this.nextAddress=e},rf.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0},rf.generator.Context.prototype.setCatchFinallyBlocks=function(e,t){this.catchAddress_=e,void 0!=t&&(this.finallyAddress_=t)},rf.generator.Context.prototype.setFinallyBlock=function(e){this.catchAddress_=0,this.finallyAddress_=e||0},rf.generator.Context.prototype.leaveTryBlock=function(e,t){this.nextAddress=e,this.catchAddress_=t||0},rf.generator.Context.prototype.enterCatchBlock=function(e){return this.catchAddress_=e||0,e=this.abruptCompletion_.exception,this.abruptCompletion_=null,e},rf.generator.Context.prototype.enterFinallyBlock=function(e,t,i){i?this.finallyContexts_[i]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_],this.catchAddress_=e||0,this.finallyAddress_=t||0},rf.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_();void 0!=t.jumpTo&&this.finallyAddress_<t.jumpTo?(this.nextAddress=t.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=e},rf.generator.Context.prototype.forIn=function(e){return new rf.generator.Context.PropertyIterator(e)},rf.generator.Context.PropertyIterator=function(e){for(var t in this.object_=e,this.properties_=[],e)this.properties_.push(t);this.properties_.reverse()},rf.generator.Context.PropertyIterator.prototype.getNext=function(){for(;this.properties_.length>0;){var e=this.properties_.pop();if(e in this.object_)return e}return null},rf.generator.Engine_=function(e){this.context_=new rf.generator.Context,this.program_=e},rf.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_())},rf.generator.Engine_.prototype.return_=function(e){this.context_.start_();var t=this.context_.yieldAllIterator_;return t?this.yieldAllStep_("return"in t?t.return:function(e){return{value:e,done:!0}},e,this.context_.return):(this.context_.return(e),this.nextStep_())},rf.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_())},rf.generator.Engine_.prototype.yieldAllStep_=function(e,t,i){try{var o=e.call(this.context_.yieldAllIterator_,t);if(rf.generator.ensureIteratorResultIsObject_(o),!o.done)return this.context_.stop_(),o;var s=o.value}catch(e){return this.context_.yieldAllIterator_=null,this.context_.throw_(e),this.nextStep_()}return this.context_.yieldAllIterator_=null,i.call(this.context_,s),this.nextStep_()},rf.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(e){this.context_.yieldResult=void 0,this.context_.throw_(e)}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}},rf.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}},rf.generator.createGenerator=function(e,t){return t=new rf.generator.Generator_(new rf.generator.Engine_(t)),rf.setPrototypeOf&&e.prototype&&rf.setPrototypeOf(t,e.prototype),t},rf.asyncExecutePromiseGenerator=function(e){function t(t){return e.next(t)}function i(t){return e.throw(t)}return new Promise(function(o,s){!function e(n){n.done?o(n.value):Promise.resolve(n.value).then(t,i).then(e,s)}(e.next())})},rf.asyncExecutePromiseGeneratorFunction=function(e){return rf.asyncExecutePromiseGenerator(e())},rf.asyncExecutePromiseGeneratorProgram=function(e){return rf.asyncExecutePromiseGenerator(new rf.generator.Generator_(new rf.generator.Engine_(e)))},rf.polyfill("globalThis",function(e){return e||rf.global},"es_2020","es3"),rf.polyfill("Array.prototype.includes",function(e){return e||function(e,t){var i=this;i instanceof String&&(i=String(i));var o=i.length;for((t=t||0)<0&&(t=Math.max(t+o,0));t<o;t++){var s=i[t];if(s===e||Object.is(s,e))return!0}return!1}},"es7","es3"),rf.checkEs6ConformanceViaProxy=function(){try{var e={},t=Object.create(new rf.global.Proxy(e,{get:function(i,o,s){return i==e&&"q"==o&&s==t}}));return!0===t.q}catch(e){return!1}},rf.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1,rf.ES6_CONFORMANCE=rf.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&rf.checkEs6ConformanceViaProxy(),rf.initSymbol=function(){},rf.iteratorPrototype=function(e){return(e={next:e})[Symbol.iterator]=function(){return this},e},rf.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},rf.MapEntry=function(){},rf.polyfill("Set.prototype.difference",function(e){return e||function(e){rf.checkIsSetInstance(this),rf.checkIsSetLike(e);var t=rf.getSmallerAndLargerSets(this,e);e=new Set(this);var i=t.smallerSetIterator;t=t.largerSet;for(var o=i.next();!o.done;)t.has(o.value)&&e.delete(o.value),o=i.next();return e}},"es_next","es6"),rf.checkIsSetLike=function(e){if("object"!=typeof e||null===e||"number"!=typeof e.size||e.size<0||"function"!=typeof e.keys||"function"!=typeof e.has)throw TypeError("Argument must be set-like")},rf.checkIsValidIterator=function(e){if("object"!=typeof e||null===e||"function"!=typeof e.next)throw TypeError("Invalid iterator.");return e},rf.getSmallerAndLargerSets=function(e,t){return e.size<=t.size?{smallerSetIterator:e.keys(),largerSet:t}:{smallerSetIterator:rf.checkIsValidIterator(t.keys()),largerSet:e}},rf.checkIsSetInstance=function(e){if(!(e instanceof Set))throw TypeError("Method must be called on an instance of Set.")},rf.iteratorFromArray=function(e,t){if(rf.ASSUME_ES6)return e[Symbol.iterator]();e instanceof String&&(e+="");var i=0,o=!1,s={next:function(){if(!o&&i<e.length){var s=i++;return{value:t(s,e[s]),done:!1}}return o=!0,{done:!0,value:void 0}}};return s[Symbol.iterator]=function(){return s},s},rf.polyfill("Array.prototype.values",function(e){return e||function(){return rf.iteratorFromArray(this,function(e,t){return t})}},"es8","es3"),rf.polyfill("Array.prototype.flatMap",function(e){return e||function(e,t){var i=[];return Array.prototype.forEach.call(this,function(o,s){Array.isArray(o=e.call(t,o,s,this))?i.push.apply(i,o):i.push(o)}),i}},"es9","es5"),rf.polyfill("Array.prototype.flat",function(e){return e||function(e){e=void 0===e?1:e;var t=[];return Array.prototype.forEach.call(this,function(i){Array.isArray(i)&&e>0?(i=Array.prototype.flat.call(i,e-1),t.push.apply(t,i)):t.push(i)}),t}},"es9","es5"),rf.polyfill("Object.entries",function(e){return e||function(e){var t,i=[];for(t in e)rf.owns(e,t)&&i.push([t,e[t]]);return i}},"es8","es3"),rf.polyfill("Object.values",function(e){return e||function(e){var t,i=[];for(t in e)rf.owns(e,t)&&i.push(e[t]);return i}},"es8","es3");var N=Object.create(null),L=Object.create(null),y="default",D=class{constructor(e){this.name=e}toString(){return this.name}};D.CONNECTION_CHECKER=new D("connectionChecker"),D.CONNECTION_PREVIEWER=new D("connectionPreviewer"),D.CURSOR=new D("cursor"),D.EVENT=new D("event"),D.FIELD=new D("field"),D.INPUT=new D("input"),D.RENDERER=new D("renderer"),D.TOOLBOX=new D("toolbox"),D.THEME=new D("theme"),D.TOOLBOX_ITEM=new D("toolboxItem"),D.FLYOUTS_VERTICAL_TOOLBOX=new D("flyoutsVerticalToolbox"),D.FLYOUTS_HORIZONTAL_TOOLBOX=new D("flyoutsHorizontalToolbox"),D.FLYOUT_INFLATER=new D("flyoutInflater"),D.METRICS_MANAGER=new D("metricsManager"),D.BLOCK_DRAGGER=new D("blockDragger"),D.SERIALIZER=new D("serializer"),D.ICON=new D("icon"),D.PASTER=new D("paster"),D.VARIABLE_MODEL=new D("variableModel"),D.VARIABLE_MAP=new D("variableMap");var k={DEFAULT:y,TEST_ONLY:{typeMap:N}};k.Type=D,k.getAllItems=eg,k.getClass=ep,k.getClassFromOptions=eE,k.getObject=e_,k.hasItem=ed,k.register=ea,k.unregister=eh;var w=Object.create(null),v=750,M="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),P=null,B={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},x=0,F={TOUCH_ENABLED:M,TOUCH_MAP:B};F.checkTouchIdentifier=eR,F.clearTouchIdentifier=ef,F.getTouchIdentifierFromEvent=eS,F.longStart=eT,F.longStop=em,F.shouldHandleEvent=eI;var G=globalThis.navigator&&globalThis.navigator.userAgent||"";function H(e){return U.includes(e.toUpperCase())}let U=(rI=G).toUpperCase();rS=H("JavaFX"),rR=H("WebKit"),rb=H("Gecko")&&!rR,rC=H("Android"),G=globalThis.navigator&&globalThis.navigator.maxTouchPoints,rO=H("iPad")||H("Macintosh")&&G>0,rA=H("iPhone")&&!rO,r$=H("Macintosh"),rN=!(rO||rC&&!H("Mobile")||H("Silk"))&&(rA||rC);var W=rS,V=r$,K=40,X=125,Y={};Y.bind=eC,Y.conditionalBind=eb,Y.getScrollDeltaPixels=eL,Y.isRightButton=e$,Y.isTargetInput=eA,Y.mouseToSvg=eN,Y.unbind=eO,(el=rL||(rL={})).BLOCK_CREATE="create",el.BLOCK_DELETE="delete",el.BLOCK_CHANGE="change",el.BLOCK_FIELD_INTERMEDIATE_CHANGE="block_field_intermediate_change",el.BLOCK_MOVE="move",el.VAR_CREATE="var_create",el.VAR_DELETE="var_delete",el.VAR_RENAME="var_rename",el.VAR_TYPE_CHANGE="var_type_change",el.UI="ui",el.BLOCK_DRAG="drag",el.SELECTED="selected",el.CLICK="click",el.MARKER_MOVE="marker_move",el.BUBBLE_OPEN="bubble_open",el.TRASHCAN_OPEN="trashcan_open",el.TOOLBOX_ITEM_SELECT="toolbox_item_select",el.THEME_CHANGE="theme_change",el.VIEWPORT_CHANGE="viewport_change",el.COMMENT_CREATE="comment_create",el.COMMENT_DELETE="comment_delete",el.COMMENT_CHANGE="comment_change",el.COMMENT_MOVE="comment_move",el.COMMENT_RESIZE="comment_resize",el.COMMENT_DRAG="comment_drag",el.COMMENT_COLLAPSE="comment_collapse",el.FINISHED_LOADING="finished_loading";var z=[rL.BLOCK_CREATE,rL.BLOCK_MOVE,rL.COMMENT_CREATE,rL.COMMENT_MOVE],j="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",J={genUid:()=>{let e=j.length,t=[];for(let i=0;i<20;i++)t[i]=j.charAt(Math.random()*e);return t.join("")}},Z=0,q={TEST_ONLY:J};q.genUid=eD,q.getNextUniqueId=ey;var Q={};Q.isBlockChange=ev,Q.isBlockCreate=ek,Q.isBlockDelete=ew,Q.isBlockDrag=function(e){return e.type===rL.BLOCK_DRAG},Q.isBlockFieldIntermediateChange=eM,Q.isBlockMove=eP,Q.isBubbleOpen=ex,Q.isClick=eB,Q.isCommentChange=function(e){return e.type===rL.COMMENT_CHANGE},Q.isCommentCollapse=function(e){return e.type===rL.COMMENT_COLLAPSE},Q.isCommentCreate=function(e){return e.type===rL.COMMENT_CREATE},Q.isCommentDelete=function(e){return e.type===rL.COMMENT_DELETE},Q.isCommentDrag=function(e){return e.type===rL.COMMENT_DRAG},Q.isCommentMove=function(e){return e.type===rL.COMMENT_MOVE},Q.isCommentResize=function(e){return e.type===rL.COMMENT_RESIZE},Q.isFinishedLoading=function(e){return e.type===rL.FINISHED_LOADING},Q.isSelected=function(e){return e.type===rL.SELECTED},Q.isThemeChange=function(e){return e.type===rL.THEME_CHANGE},Q.isToolboxItemSelect=function(e){return e.type===rL.TOOLBOX_ITEM_SELECT},Q.isTrashcanOpen=function(e){return e.type===rL.TRASHCAN_OPEN},Q.isVarCreate=function(e){return e.type===rL.VAR_CREATE},Q.isVarDelete=function(e){return e.type===rL.VAR_DELETE},Q.isVarRename=function(e){return e.type===rL.VAR_RENAME},Q.isViewportChange=eF;var ee="",et=!0,ei=0,eo="ORPHANED_BLOCK",es=[],en={FIRE_QUEUE:es,enqueueEvent:eW,fireNow:eU,fireInternal:function(e){if(eX()){if(!es.length)try{requestAnimationFrame(()=>{setTimeout(eU,0)})}catch(e){setTimeout(eU,0)}eW(e)}},setGroupInternal:function(e){ee="boolean"==typeof e?e?eD():"":e}},er={TEST_ONLY:en};er.clearPendingUndo=eK,er.disable=$.disable$$module$build$src$core$events$utils,er.disableOrphans=eJ,er.enable=$.enable$$module$build$src$core$events$utils,er.filter=eV,er.fire=eH,er.fromJson=ez,er.get=ej,er.getDescendantIds=eY,er.getGroup=$.getGroup$$module$build$src$core$events$utils,er.getRecordUndo=eG,er.isEnabled=eX,er.setGroup=$.setGroup$$module$build$src$core$events$utils,er.setRecordUndo=$.setRecordUndo$$module$build$src$core$events$utils;var el,ea,ec,eh,eu,ed,ep,e_,eg,eE,eT,em,ef,eI,eS,eR,eb,eC,eO,eA,e$,eN,eL,ey,eD,ek,ew,ev,eM,eP,eB,ex,eF,eG,eH,eU,eW,eV,eK,eX,eY,ez,ej,eJ,eZ,eq,eQ,e0,e1,e2,e3,e5,e6,e4,e8,e9,e7,te,tt,ti,to,ts,tn,tr,tl,ta,tc,th,tu,td,tp,t_,tg,tE,tT,tm,tf,tI,tS,tR,tb,tC,tO,tA,t$,tN,tL,ty,tD,tk,tw,tv,tM,tP,tB,tx,tF,tG,tH,tU,tW,tV,tK,tX,tY,tz,tj,tJ,tZ,tq,tQ,t0,t1,t2,t3,t5,t6,t4,t8,t9,t7,ie,it,ii,io,is,ir,il,ia,ic,ih,iu,id,ip,i_,ig,iE,iT,im,iI,iS,iR,ib,iC,iO,iA,i$,iN,iL,iy,iD,ik,iw,iv,iM,iP,iB,ix,iF,iG,iH,iU,iW,iV,iK,iX,iY,iz,ij,iJ,iZ,iq,iQ,i0,i1,i2,i3,i5,i6,i4,i8,i9,i7,oe,ot,oi,oo,os,on,or,ol,oa,oc,oh,ou,od,op,o_,og,oE,oT,om,of,oI,oS,oR,ob,oC,oO,oA,o$,oN,oL,oy,oD,ok,ow,ov,oM,oP,oB,ox,oF,oG,oH,oU,oW,oV,oK,oX,oY,oz,oj,oJ,oZ,oq,oQ,o0,o1,o2,o3,o5,o6,o4,o8,o9,o7,se,st,si,so,ss,sn,sr,sl,sa,sc,sh,su,sd,sp,s_,sg,sE,sT,sm,sf,sI,sS,sR,sb,sC,sO,sA,s$,sN,sL,sy,sD,sk,sw,sv,sM,sP,sB,sx,sF,sG,sH,sU,sW,sV,sK,sX,sY,sz,sj,sJ,sZ,sq,sQ,s0,s1,s2,s3,s5,s6,s4,s8,s9,s7,ne,nt,ni,no,ns,nn,nr,nl,na,nc,nh,nu,nd,np,n_,ng,nE,nT,nm,nf,nI,nS,nR,nb,nC,nO,nA,n$,nN,nL,ny,nD,nk,nw,nv,nM,nP,nB,nx,nF,nG,nH,nU,nW,nV,nK,nX,nY,nz,nj,nJ,nZ,nq,nQ,n0,n1,n2,n3,n5,n6,n4,n8,n9,n7,re,rt,ri,ro,rs,rn,rr,rl,ra,rc,rh,ru,rd,rp,r_,rg,rE,rT,rm,rf,rI,rS,rR,rb,rC,rO,rA,r$,rN,rL,ry,rD="http://www.w3.org/2000/svg",rk="http://www.w3.org/1999/xhtml",rw="http://www.w3.org/1999/xlink";(rV=ry||(ry={}))[rV.ELEMENT_NODE=1]="ELEMENT_NODE",rV[rV.TEXT_NODE=3]="TEXT_NODE",rV[rV.COMMENT_NODE=8]="COMMENT_NODE";var rv=null,rM=0,rP=null,rB={HTML_NS:rk};rB.NodeType=ry,rB.SVG_NS=rD,rB.XLINK_NS=rw,rB.addClass=eq,rB.createSvgElement=eZ,rB.getFastTextWidth=function(e,t,i,o){return e9(e,t+"pt",i,o)},rB.getFastTextWidthWithSizeString=e9,rB.getTextWidth=e8,rB.hasClass=e1,rB.insertAfter=e3,rB.measureFontMetrics=e7,rB.removeClass=e0,rB.removeClasses=eQ,rB.removeNode=e2,rB.setCssTransform=e5,rB.startTextWidthCache=e6,rB.stopTextWidthCache=e4;var rx=class{static findFocusedNode(e){var t=e.getRootFocusableNode();if(!t.canBeFocused())return null;var i=t.getFocusableElement();return e1(i,rx.ACTIVE_CLASS_NAME)||e1(i,rx.PASSIVE_CSS_CLASS_NAME)||((t=i.querySelector(this.ACTIVE_FOCUS_NODE_CSS_SELECTOR))instanceof HTMLElement||t instanceof SVGElement)&&(t=rx.findFocusableNodeFor(t,e))?t:((i=i.querySelector(this.PASSIVE_FOCUS_NODE_CSS_SELECTOR))instanceof HTMLElement||i instanceof SVGElement)&&(e=rx.findFocusableNodeFor(i,e))?e:null}static findFocusableNodeFor(e,t){if(!e.id||"null"===e.id||-1!==t.getNestedTrees().map(t=>rx.findFocusableNodeFor(e,t)).findIndex(e=>!!e))return null;var i,o=t.getRootFocusableNode();return o.canBeFocused()&&e===o.getFocusableElement()||(o=null!=(i=t.lookUpFocusableNode(e.id))?i:null)?o:(i=e.parentElement,!o&&i?rx.findFocusableNodeFor(i,t):null)}};rx.ACTIVE_CLASS_NAME="blocklyActiveFocus",rx.PASSIVE_CSS_CLASS_NAME="blocklyPassiveFocus",rx.ACTIVE_FOCUS_NODE_CSS_SELECTOR=`.${rx.ACTIVE_CLASS_NAME}`,rx.PASSIVE_FOCUS_NODE_CSS_SELECTOR=`.${rx.PASSIVE_CSS_CLASS_NAME}`;var rF=class{constructor(e,t){this.tree=e,this.rootShouldBeAutoTabbable=t}},rG=class{constructor(e){this.previouslyFocusedNode=this.focusedNode=null,this.registeredTrees=[],this.isUpdatingFocusedNode=this.recentlyLostAllFocus=this.lockFocusStateChanges=this.currentlyHoldsEphemeralFocus=!1;let t=e=>{if(!this.isUpdatingFocusedNode){this.recentlyLostAllFocus=!e;var t=null;if(e instanceof HTMLElement||e instanceof SVGElement){for(var i of this.registeredTrees)if(t=rx.findFocusableNodeFor(e,i.tree))break}if(t&&t.canBeFocused()){let o;e=t.getFocusableTree(),i=null==(o=this.focusedNode)?void 0:o.getFocusableTree(),t===e.getRootFocusableNode()&&e!==i?this.focusTree(e):this.focusNode(t)}else this.defocusCurrentFocusedNode()}};e("focusin",e=>{e instanceof FocusEvent&&t(document.activeElement)}),e("focusout",e=>{e instanceof FocusEvent&&t(e.relatedTarget)})}registerTree(e,t=!1){if(this.ensureManagerIsUnlocked(),this.isRegistered(e))throw Error(`Attempted to re-register already registered tree: ${e}.`);this.registeredTrees.push(new rF(e,t));let i=e.getRootFocusableNode().getFocusableElement();if(!i.id||"null"===i.id)throw Error(`Attempting to register a tree with a root element that has an invalid ID: ${e}.`);t&&(i.tabIndex=0)}isRegistered(e){return!!this.lookUpRegistration(e)}lookUpRegistration(e){let t;return null!=(t=this.registeredTrees.find(t=>t.tree===e))?t:null}unregisterTree(e){if(this.ensureManagerIsUnlocked(),!this.isRegistered(e))throw Error(`Attempted to unregister not registered tree: ${e}.`);var t=this.registeredTrees.findIndex(t=>t.tree===e);let i=this.registeredTrees[t];this.registeredTrees.splice(t,1),t=rx.findFocusedNode(e);let o=e.getRootFocusableNode();t&&this.removeHighlight(t),this.focusedNode!==t&&this.focusedNode!==o||this.updateFocusedNode(null),this.removeHighlight(o),i.rootShouldBeAutoTabbable&&e.getRootFocusableNode().getFocusableElement().removeAttribute("tabindex")}getFocusedTree(){let e,t;return null!=(t=null==(e=this.focusedNode)?void 0:e.getFocusableTree())?t:null}getFocusedNode(){return this.focusedNode}focusTree(e){let t;if(this.ensureManagerIsUnlocked(),!this.isRegistered(e))throw Error(`Attempted to focus unregistered tree: ${e}.`);let i=rx.findFocusedNode(e),o=e.getRestoredFocusableNode(i);e=e.getRootFocusableNode(),this.focusNode(null!=(t=null!=o?o:i)?t:e)}focusNode(e){this.ensureManagerIsUnlocked();let t=!this.currentlyHoldsEphemeralFocus;t&&(this.isUpdatingFocusedNode=!0);var i,o=(null==(i=this.focusedNode)?void 0:i.getFocusableElement())!==document.activeElement;if(this.focusedNode!==e||o)if(e.canBeFocused()){if(i=e.getFocusableTree(),!this.isRegistered(i))throw Error(`Attempted to focus unregistered node: ${e}.`);(o=e.getFocusableElement()).id&&"null"!==o.id||console.warn("Trying to focus a node that has an invalid ID.");var s,n=rx.findFocusableNodeFor(o,i);o=rx.findFocusedNode(i);var r=e;n!==e&&(r=i.getRestoredFocusableNode(o),e=i.getRootFocusableNode(),r=null!=(s=null!=r?r:o)?s:e),s=null==(e=this.focusedNode)?void 0:e.getFocusableTree(),e&&this.passivelyFocusNode(e,i),i=i.getRootFocusableNode(),o&&this.removeHighlight(o),i!==r&&this.removeHighlight(i),this.currentlyHoldsEphemeralFocus||this.activelyFocusNode(r,null!=s?s:null),this.updateFocusedNode(r)}else console.warn("Trying to focus a node that can't be focused.");t&&(this.isUpdatingFocusedNode=!1)}takeEphemeralFocus(e){if(this.ensureManagerIsUnlocked(),this.currentlyHoldsEphemeralFocus)throw Error(`Attempted to take ephemeral focus when it's already held, with new element: ${e}.`);this.currentlyHoldsEphemeralFocus=!0,this.focusedNode&&this.passivelyFocusNode(this.focusedNode,null),e.focus();let t=!1;return()=>{if(t)throw Error(`Attempted to finish ephemeral focus twice for element: ${e}.`);if(t=!0,this.currentlyHoldsEphemeralFocus=!1,this.focusedNode){this.activelyFocusNode(this.focusedNode,null);let e=this.focusedNode;setTimeout(()=>{!this.focusedNode&&this.previouslyFocusedNode===e&&this.recentlyLostAllFocus&&this.focusNode(e)},0)}}}ephemeralFocusTaken(){return this.currentlyHoldsEphemeralFocus}ensureManagerIsUnlocked(){if(this.lockFocusStateChanges)throw Error("FocusManager state changes cannot happen in a tree/node focus/blur callback.")}updateFocusedNode(e){this.previouslyFocusedNode=this.focusedNode,this.focusedNode=e}defocusCurrentFocusedNode(){this.focusedNode&&!this.currentlyHoldsEphemeralFocus&&(this.passivelyFocusNode(this.focusedNode,null),this.updateFocusedNode(null))}activelyFocusNode(e,t){let i;this.lockFocusStateChanges=!0;let o=e.getFocusableTree(),s=e.getFocusableElement(),n=null==(i=this.lookUpRegistration(o))?void 0:i.rootShouldBeAutoTabbable;o!==t&&(o.onTreeFocus(e,t),n&&(o.getRootFocusableNode().getFocusableElement().tabIndex=-1)),e.onNodeFocus(),this.lockFocusStateChanges=!1,n&&e===o.getRootFocusableNode()||s.hasAttribute("tabindex")||(s.tabIndex=-1),this.setNodeToVisualActiveFocus(e),s.focus()}passivelyFocusNode(e,t){this.lockFocusStateChanges=!0;let i=e.getFocusableTree();if(i!==t){let e;i.onTreeBlur(t),(null==(e=this.lookUpRegistration(i))?0:e.rootShouldBeAutoTabbable)&&(i.getRootFocusableNode().getFocusableElement().tabIndex=0)}e.onNodeBlur(),this.lockFocusStateChanges=!1,i!==t&&this.setNodeToVisualPassiveFocus(e)}setNodeToVisualActiveFocus(e){eq(e=e.getFocusableElement(),rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),e0(e,rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}setNodeToVisualPassiveFocus(e){e0(e=e.getFocusableElement(),rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),eq(e,rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}removeHighlight(e){e0(e=e.getFocusableElement(),rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),e0(e,rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}static getFocusManager(){return rG.focusManager||(rG.focusManager=new rG(document.addEventListener)),rG.focusManager}};rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME="blocklyActiveFocus",rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME="blocklyPassiveFocus",rG.focusManager=null;var rH={};rH.FocusManager=rG,rH.getFocusManager=$.getFocusManager$$module$build$src$core$focus_manager;var rU={};rU.deepMerge=ti;var rW=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),null==(t=e.keyCodes)?0:t.length)for(let i of t)this.addKeyMapping(i,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,i){e=`${e}`;let o=this.keyMap.get(e);if(o&&!i)throw Error(`Shortcut named "${t}" collides with shortcuts "${o}"`);o&&i?o.unshift(t):this.keyMap.set(e,[t])}removeKeyMapping(e,t,i){let o=this.keyMap.get(e);if(!o)return i||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1;let s=o.indexOf(t);return s>-1?(o.splice(s,1),0===o.length&&this.keyMap.delete(e),!0):(i||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1)}removeAllKeyMappings(e){for(let t of this.keyMap.keys())this.removeKeyMapping(t,e,!0)}setKeyMap(e){for(let t in this.keyMap.clear(),e)this.keyMap.set(t,e[t])}getKeyMap(){let e=Object.create(null);for(let[t,i]of this.keyMap)e[t]=i;return e}getRegistry(){let e=Object.create(null);for(let[t,i]of this.shortcuts)e[t]=i;return ti(Object.create(null),e)}onKeyDown(e,t){var i=this.serializeKeyEvent(t);if(!(i=this.getShortcutNamesByKeyCode(i)))return!1;for(let o of i){let s,n,r,l;if((i=this.shortcuts.get(o))&&(!i.preconditionFn||i.preconditionFn(e,{focusedNode:null!=(s=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode())?s:void 0}))&&(null==(r=(n=i).callback)?0:r.call(n,e,t,i,{focusedNode:null!=(l=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode())?l:void 0})))return!0}return!1}getShortcutNamesByKeyCode(e){let t;return(null==(t=this.keyMap.get(e))?void 0:t.slice())||[]}getKeyCodesByShortcutName(e){let t=[];for(let[i,o]of this.keyMap)o.indexOf(e)>-1&&t.push(i);return t}serializeKeyEvent(e){let t="";for(let i in rW.modifierKeys)e.getModifierState(i)&&(""!==t&&(t+="+"),t+=i);return""!==t&&e.keyCode?t+="+"+e.keyCode:e.keyCode&&(t=String(e.keyCode)),t}checkModifiers(e){for(let t of e)if(!(t in rW.modifierKeys))throw Error(t+" is not a valid modifier key.")}createSerializedKey(e,t){let i="";if(t)for(let e in this.checkModifiers(t),rW.modifierKeys)t.includes(rW.modifierKeys[e])&&(""!==i&&(i+="+"),i+=e);return""!==i&&e?i+="+"+e:e&&(i=`${e}`),i}};rW.registry=new rW,(rK=(rK=rW||(rW={})).modifierKeys||(rK.modifierKeys={}))[rK.Shift=16]="Shift",rK[rK.Control=17]="Control",rK[rK.Alt=18]="Alt",rK[rK.Meta=91]="Meta";var rV,rK,rX,rY,rz=Object.create(null),rj=[],rJ={defineBlocksWithJsonArrayInternal:function(e){$.defineBlocks$$module$build$src$core$common($.createBlockDefinitionsFromJsonArray$$module$build$src$core$common(e))}},rZ={TEST_ONLY:rJ};rZ.createBlockDefinitionsFromJsonArray=$.createBlockDefinitionsFromJsonArray$$module$build$src$core$common,rZ.defineBlocks=$.defineBlocks$$module$build$src$core$common,rZ.defineBlocksWithJsonArray=tE,rZ.draggingConnections=rj,rZ.fireSelectedEvent=th,rZ.getAllWorkspaces=ts,rZ.getBlockTypeCounts=t_,rZ.getMainWorkspace=tl,rZ.getParentContainer=tu,rZ.getSelected=tc,rZ.getWorkspaceById=to,rZ.globalShortcutHandler=tT,rZ.registerWorkspace=tn,rZ.setMainWorkspace=ta,rZ.setParentContainer=td,rZ.setSelected=function(e){$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)},rZ.svgResize=tp,rZ.unregisterWorkpace=tr;var rq,rQ=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=$.getGroup$$module$build$src$core$events$utils(),this.recordUndo=eG()}toJson(){return{type:this.type,group:this.group}}static fromJson(e,t,i){return i.isBlank=!1,i.group=e.group||"",i.workspaceId=t.id,i}isNull(){return!1}run(e){}getEventWorkspace_(){let e;if(this.workspaceId&&(e=to(this.workspaceId)),!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e}},r0=class extends rQ{constructor(e){super(),this.recordUndo=!1,this.isUiEvent=!0,this.isBlank=void 0===e,this.workspaceId=e||""}},r1=class extends r0{constructor(e,t,i){null===(t=e?e.workspace.id:t)&&(t=void 0),super(t),this.type=rL.CLICK,this.blockId=e?e.id:void 0,this.targetType=i}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new r1)).targetType=e.targetType,t.blockId=e.blockId,t}};(lf=rq||(rq={})).BLOCK="block",lf.WORKSPACE="workspace",lf.ZOOM_CONTROLS="zoom_controls",ea(D.EVENT,rL.CLICK,r1);var r2={};r2.Click=r1,r2.ClickTarget=rq;var r3={};r3.removeElem=tm;var r5=class{constructor(e){this.name=e}toString(){return this.name}};r5.POSITIONABLE=new r5("positionable"),r5.DRAG_TARGET=new r5("drag_target"),r5.DELETE_AREA=new r5("delete_area"),r5.AUTOHIDEABLE=new r5("autohideable");var r6=class{constructor(){this.componentData=new Map,this.capabilityToComponentIds=new Map}addComponent(e,t){let i=e.component.id;if(!t&&this.componentData.has(i)){var o;throw Error('Plugin "'+i+'" with capabilities "'+(null==(o=this.componentData.get(i))?void 0:o.capabilities)+'" already added.')}for(this.componentData.set(i,e),t=[],o=0;o<e.capabilities.length;o++){let s=String(e.capabilities[o]).toLowerCase();if(t.push(s),this.capabilityToComponentIds.has(s)){let e;null==(e=this.capabilityToComponentIds.get(s))||e.push(i)}else this.capabilityToComponentIds.set(s,[i])}this.componentData.get(i).capabilities=t}removeComponent(e){let t=this.componentData.get(e);if(t){for(let i=0;i<t.capabilities.length;i++){let o=String(t.capabilities[i]).toLowerCase();tm(this.capabilityToComponentIds.get(o),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{var i,o;t=`${t}`.toLowerCase(),null==(i=this.componentData.get(e))||i.capabilities.push(t),null==(o=this.capabilityToComponentIds.get(t))||o.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(),tm(this.componentData.get(e).capabilities,t),tm(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 null==(t=this.componentData.get(e))?void 0:t.component}getComponents(e,t){if(e=`${e}`.toLowerCase(),!(e=this.capabilityToComponentIds.get(e)))return[];let i=[];if(t){let t=[];e.forEach(e=>{t.push(this.componentData.get(e))}),t.sort(function(e,t){return e.weight-t.weight}),t.forEach(function(e){i.push(e.component)})}else e.forEach(e=>{i.push(this.componentData.get(e).component)});return i}};r6.Capability=r5,(lI=(lI=r6||(r6={})).ComponentWeight||(lI.ComponentWeight={}))[lI.TOOLBOX_WEIGHT=0]="TOOLBOX_WEIGHT",lI[lI.FLYOUT_WEIGHT=1]="FLYOUT_WEIGHT",lI[lI.TRASHCAN_WEIGHT=2]="TRASHCAN_WEIGHT",lI[lI.ZOOM_CONTROLS_WEIGHT=3]="ZOOM_CONTROLS_WEIGHT";var r4=r6.ComponentWeight,r8={};r8.ComponentManager=r6,r8.ComponentWeight=r4;var r9=!1,r7='\n.blocklySvg {\n background-color: #fff;\n outline: none;\n overflow: hidden; /* IE overflows by default. */\n position: absolute;\n display: block;\n}\n\n.blocklyWidgetDiv {\n display: none;\n position: absolute;\n z-index: 99999; /* big value for bootstrap3 compatibility */\n}\n\n.injectionDiv {\n height: 100%;\n position: relative;\n overflow: hidden; /* So blocks in drag surface disappear at edges */\n touch-action: none;\n user-select: none;\n -webkit-user-select: none;\n}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\n}\n\n.blocklyEmboss {\n filter: var(--blocklyEmbossFilter);\n}\n\n.blocklyTooltipDiv {\n background-color: #ffffc7;\n border: 1px solid #ddc;\n box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);\n color: #000;\n display: none;\n font: 9pt sans-serif;\n opacity: .9;\n padding: 2px;\n position: absolute;\n z-index: 100000; /* big value for bootstrap3 compatibility */\n}\n\n.blocklyDropDownDiv {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n display: none;\n border: 1px solid;\n border-color: #dadce0;\n background-color: #fff;\n border-radius: 2px;\n padding: 4px;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv:focus {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownContent {\n max-height: 300px; /* @todo: spec for maximum height. */\n}\n\n.blocklyDropDownArrow {\n position: absolute;\n left: 0;\n top: 0;\n width: 16px;\n height: 16px;\n z-index: -1;\n background-color: inherit;\n border-color: inherit;\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyHighlighted>.blocklyPath {\n filter: var(--blocklyEmbossFilter);\n}\n\n.blocklyHighlightedConnectionPath {\n fill: none;\n stroke: #fc3;\n stroke-width: 4px;\n}\n\n.blocklyPathLight {\n fill: none;\n stroke-linecap: round;\n stroke-width: 1;\n}\n\n.blocklySelected>.blocklyPathLight {\n display: none;\n}\n\n.blocklyDraggable {\n cursor: grab;\n cursor: -webkit-grab;\n}\n\n.blocklyDragging {\n cursor: grabbing;\n cursor: -webkit-grabbing;\n /* Drag surface disables events to not block the toolbox, so we have to\n * reenable them here for the cursor values to work. */\n pointer-events: auto;\n}\n\n /* Changes cursor on mouse down. Not effective in Firefox because of\n https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */\n.blocklyDraggable:active {\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n.blocklyDragging.blocklyDraggingDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyDragging>.blocklyPath,\n.blocklyDragging>.blocklyPathLight {\n fill-opacity: .8;\n stroke-opacity: .8;\n}\n\n.blocklyDragging>.blocklyPathDark {\n display: none;\n}\n\n.blocklyDisabledPattern>.blocklyPath {\n fill: var(--blocklyDisabledPattern);\n fill-opacity: .5;\n stroke-opacity: .5;\n}\n\n.blocklyDisabled>.blocklyPathLight,\n.blocklyDisabled>.blocklyPathDark {\n display: none;\n}\n\n.blocklyInsertionMarker>.blocklyPath,\n.blocklyInsertionMarker>.blocklyPathLight,\n.blocklyInsertionMarker>.blocklyPathDark {\n fill-opacity: .2;\n stroke: none;\n}\n\n.blocklyNonEditableField>text {\n pointer-events: none;\n}\n\n.blocklyFlyout {\n position: absolute;\n z-index: 20;\n}\n\n.blocklyText text {\n cursor: default;\n}\n\n/*\n Don\'t allow users to select text. It gets annoying when trying to\n drag a block and selected text moves instead.\n*/\n.blocklySvg text {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n cursor: inherit;\n}\n\n.blocklyIconGroup {\n cursor: default;\n}\n\n.blocklyIconGroup:not(:hover),\n.blocklyIconGroupReadonly {\n opacity: .6;\n}\n\n.blocklyIconShape {\n fill: #00f;\n stroke: #fff;\n stroke-width: 1px;\n}\n\n.blocklyIconSymbol {\n fill: #fff;\n}\n\n.blocklyMinimalBody {\n margin: 0;\n padding: 0;\n height: 100%;\n}\n\n.blocklyHtmlInput {\n border: none;\n border-radius: 4px;\n height: 100%;\n margin: 0;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: center;\n display: block;\n box-sizing: border-box;\n}\n\n/* Remove the increase and decrease arrows on the field number editor */\ninput.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,\ninput.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\ninput[type=number] {\n -moz-appearance: textfield;\n}\n\n.blocklyMainBackground {\n stroke-width: 1;\n stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */\n}\n\n.blocklyMutatorBackground {\n fill: #fff;\n stroke: #ddd;\n stroke-width: 1;\n}\n\n.blocklyFlyoutBackground {\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyMainWorkspaceScrollbar {\n z-index: 20;\n}\n\n.blocklyFlyoutScrollbar {\n z-index: 30;\n}\n\n.blocklyScrollbarHorizontal,\n.blocklyScrollbarVertical {\n position: absolute;\n outline: none;\n}\n\n.blocklyScrollbarBackground {\n opacity: 0;\n pointer-events: none;\n}\n\n.blocklyScrollbarHandle {\n fill: #ccc;\n}\n\n.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyScrollbarHandle:hover {\n fill: #bbb;\n}\n\n/* Darken flyout scrollbars due to being on a grey background. */\n/* By contrast, workspace scrollbars are on a white background. */\n.blocklyFlyout .blocklyScrollbarHandle {\n fill: #bbb;\n}\n\n.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyFlyout .blocklyScrollbarHandle:hover {\n fill: #aaa;\n}\n\n.blocklyInvalidInput {\n background: #faa;\n}\n\n.blocklyVerticalMarker {\n stroke-width: 3px;\n fill: rgba(255,255,255,.5);\n pointer-events: none;\n}\n\n.blocklyComputeCanvas {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.blocklyNoPointerEvents {\n pointer-events: none;\n}\n\n.blocklyContextMenu {\n border-radius: 4px;\n max-height: 100%;\n}\n\n.blocklyDropdownMenu {\n border-radius: 2px;\n padding: 0 !important;\n}\n\n.blocklyDropdownMenu .blocklyMenuItem {\n /* 28px on the left for icon or checkbox. */\n padding-left: 28px;\n}\n\n/* BiDi override for the resting state. */\n.blocklyDropdownMenu .blocklyMenuItemRtl {\n /* Flip left/right padding for BiDi. */\n padding-left: 5px;\n padding-right: 28px;\n}\n\n.blocklyWidgetDiv .blocklyMenu {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background: #fff;\n border: 1px solid transparent;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n font: normal 13px Arial, sans-serif;\n margin: 0;\n outline: none;\n padding: 4px 0;\n position: absolute;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n.blocklyWidgetDiv .blocklyMenu:focus {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background: inherit; /* Compatibility with gapi, reset from goog-menu */\n border: inherit; /* Compatibility with gapi, reset from goog-menu */\n font: normal 13px "Helvetica Neue", Helvetica, sans-serif;\n outline: none;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n/* State: resting. */\n.blocklyMenuItem {\n border: none;\n color: #000;\n cursor: pointer;\n list-style: none;\n margin: 0;\n /* 7em on the right for shortcut. */\n min-width: 7em;\n padding: 6px 15px;\n white-space: nowrap;\n}\n\n/* State: disabled. */\n.blocklyMenuItemDisabled {\n color: #ccc;\n cursor: inherit;\n}\n\n/* State: hover. */\n.blocklyMenuItemHighlight {\n background-color: rgba(0,0,0,.1);\n}\n\n/* State: selected/checked. */\n.blocklyMenuItemCheckbox {\n height: 16px;\n position: absolute;\n width: 16px;\n}\n\n.blocklyMenuItemSelected .blocklyMenuItemCheckbox {\n background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;\n float: left;\n margin-left: -24px;\n position: static; /* Scroll with the menu. */\n}\n\n.blocklyMenuItemRtl .blocklyMenuItemCheckbox {\n float: right;\n margin-right: -24px;\n}\n\n.blocklyMenuSeparator {\n background-color: #ccc;\n height: 1px;\n border: 0;\n margin-left: 4px;\n margin-right: 4px;\n}\n\n.blocklyBlockDragSurface, .blocklyAnimationLayer {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: visible !important;\n z-index: 80;\n pointer-events: none;\n}\n\n.blocklyField {\n cursor: default;\n}\n\n.blocklyInputField {\n cursor: text;\n}\n\n.blocklyDragging .blocklyField,\n.blocklyDragging .blocklyIconGroup {\n cursor: grabbing;\n}\n\n.blocklyActiveFocus:is(\n .blocklyFlyout,\n .blocklyWorkspace,\n .blocklyField,\n .blocklyPath,\n .blocklyHighlightedConnectionPath,\n .blocklyComment,\n .blocklyBubble,\n .blocklyIconGroup,\n .blocklyTextarea\n) {\n outline: none;\n}\n',le={};le.inject=tI,le.register=tf;var lt=class{constructor(e,t){this.x=e,this.y=t}clone(){return new lt(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||!!e&&!!t&&e.x===t.x&&e.y===t.y}static distance(e,t){let i=e.x-t.x;return Math.sqrt(i*i+(e=e.y-t.y)*e)}static magnitude(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static difference(e,t){return new lt(e.x-t.x,e.y-t.y)}static sum(e,t){return new lt(e.x+t.x,e.y+t.y)}},li=class{constructor(e){this.tagName=e}toString(){return this.tagName}};li.ANIMATE=new li("animate"),li.CIRCLE=new li("circle"),li.CLIPPATH=new li("clipPath"),li.DEFS=new li("defs"),li.FECOMPOSITE=new li("feComposite"),li.FECOMPONENTTRANSFER=new li("feComponentTransfer"),li.FEFLOOD=new li("feFlood"),li.FEFUNCA=new li("feFuncA"),li.FEGAUSSIANBLUR=new li("feGaussianBlur"),li.FEPOINTLIGHT=new li("fePointLight"),li.FESPECULARLIGHTING=new li("feSpecularLighting"),li.FILTER=new li("filter"),li.FOREIGNOBJECT=new li("foreignObject"),li.G=new li("g"),li.IMAGE=new li("image"),li.LINE=new li("line"),li.PATH=new li("path"),li.PATTERN=new li("pattern"),li.POLYGON=new li("polygon"),li.RECT=new li("rect"),li.SVG=new li("svg"),li.TEXT=new li("text"),li.TSPAN=new li("tspan");var lo=class{constructor(e,t,i,o){this.top=e,this.bottom=t,this.left=i,this.right=o}static from(e){return new lo(e.y,e.y+e.height,e.x,e.x+e.width)}clone(){return new lo(this.top,this.bottom,this.left,this.right)}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}getOrigin(){return new lt(this.left,this.top)}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||!!e&&!!t&&e.top===t.top&&e.bottom===t.bottom&&e.left===t.left&&e.right===t.right}static createFromPoint(e,t,i){let o=e.x;return new lo(e=e.y,e+i,o,o+t)}},ls=class{constructor(e,t){this.width=e,this.height=t}static equals(e,t){return e===t||!!e&&!!t&&e.width===t.width&&e.height===t.height}static max(e,t){return new ls(Math.max(e.width,t.width),Math.max(e.height,t.height))}static min(e,t){return new ls(Math.min(e.width,t.width),Math.min(e.height,t.height))}},ln={getSizeInternal:function(e){if("none"!==tb(e,"display"))return tR(e);let t=e.style,i=t.display,o=t.visibility,s=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";let n=e.offsetWidth;return e=e.offsetHeight,t.display=i,t.position=s,t.visibility=o,new ls(n,e)}},lr={TEST_ONLY:ln};lr.getBorderBox=tA,lr.getComputedStyle=tb,lr.getContainerOffsetToScrollInto=tN,lr.getPageOffset=tC,lr.getSize=tS,lr.getViewportPageOffset=tO,lr.scrollIntoContainerView=t$;var ll=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,la=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,lc={TEST_ONLY:{XY_REGEX:ll,XY_STYLE_REGEX:la}};lc.getDocumentScroll=tk,lc.getInjectionDivXY=ty,lc.getRelativeXY=tL,lc.getViewportBBox=tD,lc.screenToWsCoordinates=tw,lc.wsToScreenCoordinates=tv;var lh=class{constructor(e,t,i,o,s){this.workspace=e,this.horizontal=t,this.oldHostMetrics=null,this.ratio=1,this.origin=new lt(0,0),this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0,this.containerVisible=this.isHandleVisible=!0,this.position=new lt(0,0),this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null,this.pair=i||!1,this.margin=void 0!==s?s:lh.DEFAULT_SCROLLBAR_MARGIN,e="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical"),o&&(e+=" "+o),this.outerSvg=eZ(li.SVG,{class:e}),o=eZ(li.G,{},this.outerSvg),this.svgBackground=eZ(li.RECT,{class:"blocklyScrollbarBackground"},o),e=Math.floor((lh.scrollbarThickness-5)/2),this.svgHandle=eZ(li.RECT,{class:"blocklyScrollbarHandle",rx:e,ry:e},o),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarColour","fill"),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarOpacity","fill-opacity"),e3(this.outerSvg,this.workspace.getParentSvg()),this.setInitialThickness(),t?(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=eb(this.svgBackground,"pointerdown",this,this.onMouseDownBar),this.onMouseDownHandleWrapper_=eb(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){let e=lh.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(),eO(this.onMouseDownBarWrapper_),eO(this.onMouseDownHandleWrapper_),e2(this.outerSvg),this.workspace.getThemeManager().unsubscribe(this.svgHandle)}constrainHandleLength(e){return e=e<=0||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=e<=0||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,e5(this.outerSvg,"translate("+(this.position.x+this.origin.x)+"px,"+(this.position.y+this.origin.y)+"px)")}resize(e){(e||(e=this.workspace.getMetrics()))&&(this.oldHostMetrics&&lh.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}resizeHorizontal(e){this.requiresViewResize(e)?this.resizeViewHorizontal(e):this.resizeContentHorizontal(e)}resizeViewHorizontal(e){var t=e.viewWidth-2*this.margin;this.pair&&(t-=lh.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&(t+=lh.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-lh.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 i=this.scrollbarLength-this.handleLength;e=(e.viewLeft-e.scrollLeft)/t*i,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=i/t}}resizeVertical(e){this.requiresViewResize(e)?this.resizeViewVertical(e):this.resizeContentVertical(e)}resizeViewVertical(e){let t=e.viewHeight-2*this.margin;this.pair&&(t-=lh.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-lh.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 i=this.scrollbarLength-this.handleLength;e=(e.viewTop-e.scrollTop)/t*i,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=i/t}}isVisible(){return this.isHandleVisible}setContainerVisible(e){let 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){let 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(),ef(),this.cleanUp(),e$(e))e.stopPropagation();else{var t=eN(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var i=ty(this.svgHandle);i=this.horizontal?i.x:i.y;var o=this.handlePosition,s=.95*this.handleLength;t<=i?o-=s:t>=i+this.handleLength&&(o+=s),this.setHandlePosition(this.constrainHandlePosition(o)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),e$(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=eb(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=eb(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(){ef(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&(eO(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onMouseMoveWrapper_&&(eO(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){let e=this.handlePosition/(this.scrollbarLength-this.handleLength);return isNaN(e)&&(e=0),e}updateMetrics(){let 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||void 0===t)&&this.updateMetrics()}setOrigin(e,t){this.origin=new lt(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}};lh.scrollbarThickness=M?25:15,lh.DEFAULT_SCROLLBAR_MARGIN=.5;var lu={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},ld={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:lp,DOMParser:l_,XMLSerializer:lg}=globalThis;l_&&(lu=new l_),lg&&(ld=new lg);var lE="https://developers.google.com/blockly/xml",lT=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,lm={NAME_SPACE:lE};lm.createElement=$.createElement$$module$build$src$core$utils$xml,lm.createTextNode=$.createTextNode$$module$build$src$core$utils$xml,lm.domToText=tM,lm.injectDependencies=function(e){({document:lp=lp,DOMParser:l_=l_,XMLSerializer:lg=lg}=e),lu=new l_,ld=new lg},lm.textToDom=$.textToDom$$module$build$src$core$utils$xml;var lf,lI,lS,lR="categoryToolbox",lb="flyoutToolbox";(lv=lS||(lS={}))[lv.TOP=0]="TOP",lv[lv.BOTTOM=1]="BOTTOM",lv[lv.LEFT=2]="LEFT",lv[lv.RIGHT=3]="RIGHT";var lC={hasCategoriesInternal:function(e){if(!e)return!1;let t=e.kind;return t?t===lR:!!e.contents.filter(e=>"CATEGORY"===e.kind.toUpperCase()).length}},lO={};lO.Position=lS,lO.TEST_ONLY=lC,lO.convertFlyoutDefToJsonArray=tF,lO.convertToolboxDefToJson=tB,lO.hasCategories=tG,lO.isCategoryCollapsible=tH,lO.parseToolboxTree=tK,(lM=lx||(lx={}))[lM.TOP=0]="TOP",lM[lM.BOTTOM=1]="BOTTOM",(lP=lF||(lF={}))[lP.LEFT=0]="LEFT",lP[lP.RIGHT=1]="RIGHT",(lB=lG||(lG={}))[lB.UP=0]="UP",lB[lB.DOWN=1]="DOWN";var lA={};lA.bumpDirection=lG,lA.bumpPositionRect=tz,lA.getCornerOppositeToolbox=tY,lA.getStartPositionRect=tX,lA.horizontalPosition=lF,lA.verticalPosition=lx;var l$="sprites.png",lN=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=eZ(li.G,{});let 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:r6.ComponentWeight.ZOOM_CONTROLS_WEIGHT,capabilities:[r6.Capability.POSITIONABLE]}),this.initialized=!0}dispose(){for(let e of(this.workspace.getComponentManager().removeComponent("zoomControls"),this.svgGroup&&e2(this.svgGroup),this.boundEvents))eO(e);this.boundEvents.length=0}getBoundingRectangle(){let e=this.SMALL_SPACING+2*this.HEIGHT;return this.zoomResetGroup&&(e+=this.LARGE_SPACING+this.HEIGHT),new lo(this.top,this.top+e,this.left,this.left+this.WIDTH)}position(e,t){if(this.initialized){var i,o=tY(this.workspace,e),s=this.SMALL_SPACING+2*this.HEIGHT;if(this.zoomResetGroup&&(s+=this.LARGE_SPACING+this.HEIGHT),e=tX(o,new ls(this.WIDTH,s),this.MARGIN_HORIZONTAL,this.MARGIN_VERTICAL,e,this.workspace),o=o.vertical,t=tz(e,this.MARGIN_VERTICAL,o===lx.TOP?lG.DOWN:lG.UP,t),o===lx.TOP){var n,r=this.SMALL_SPACING+this.HEIGHT;null==(n=this.zoomInGroup)||n.setAttribute("transform","translate(0, "+r+")"),this.zoomResetGroup&&this.zoomResetGroup.setAttribute("transform","translate(0, "+(r+this.LARGE_SPACING+this.HEIGHT)+")")}else{let e;n=this.zoomResetGroup?this.LARGE_SPACING+this.HEIGHT:0,null==(e=this.zoomInGroup)||e.setAttribute("transform","translate(0, "+n+")"),n=n+this.SMALL_SPACING+this.HEIGHT,null==(r=this.zoomOutGroup)||r.setAttribute("transform","translate(0, "+n+")")}this.top=t.top,this.left=t.left,null==(i=this.svgGroup)||i.setAttribute("transform","translate("+this.left+","+this.top+")")}}createZoomOutSvg(e){this.zoomOutGroup=eZ(li.G,{class:"blocklyZoom blocklyZoomOut"},this.svgGroup);let t=eZ(li.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup);eZ(li.RECT,{width:32,height:32},t),eZ(li.IMAGE,{width:96,height:124,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup).setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),this.boundEvents.push(eb(this.zoomOutGroup,"pointerdown",null,this.zoom.bind(this,-1)))}createZoomInSvg(e){this.zoomInGroup=eZ(li.G,{class:"blocklyZoom blocklyZoomIn"},this.svgGroup);let t=eZ(li.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup);eZ(li.RECT,{width:32,height:32},t),eZ(li.IMAGE,{width:96,height:124,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup).setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),this.boundEvents.push(eb(this.zoomInGroup,"pointerdown",null,this.zoom.bind(this,1)))}zoom(e,t){this.workspace.markFocused(),this.workspace.zoomCenter(e),this.fireZoomEvent(),ef(),t.stopPropagation(),t.preventDefault()}createZoomResetSvg(e){this.zoomResetGroup=eZ(li.G,{class:"blocklyZoom blocklyZoomReset"},this.svgGroup);let t=eZ(li.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup);eZ(li.RECT,{width:32,height:32},t),eZ(li.IMAGE,{width:96,height:124,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup).setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),this.boundEvents.push(eb(this.zoomResetGroup,"pointerdown",null,this.resetZoom.bind(this)))}resetZoom(e){this.workspace.markFocused();let 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(),ef(),e.stopPropagation(),e.preventDefault()}fireZoomEvent(){eH(new(ej(rL.CLICK))(null,this.workspace.id,"zoom_controls"))}};tf("\n.blocklyZoom>image, .blocklyZoom>svg>image {\n opacity: .4;\n}\n\n.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {\n opacity: .6;\n}\n\n.blocklyZoom>image:active, .blocklyZoom>svg>image:active {\n opacity: .8;\n}\n");var lL={};lL.register=tj,lL.unregister=function(e){eh(D.SERIALIZER,e)};var ly=class{constructor(){this.priority=25}save(e){let t=[];for(let i of e.getTopComments())(e=tJ(i,{addCoordinates:!0,saveIds:!0}))&&t.push(e);return t.length?t:null}load(e,t){for(let i of e)tZ(i,t,{recordUndo:eG()})}clear(e){for(let t of e.getTopComments())t.dispose()}};tj("workspaceComments",new ly);var lD={};lD.WorkspaceCommentSerializer=ly,lD.append=tZ,lD.save=tJ;var lk={};lk.register=tq,lk.unregister=function(e){eh(D.PASTER,e)};var lw=class{paste(e,t,i){let o;e=e.commentState,i&&(e.x=i.x,e.y=i.y),$.disable$$module$build$src$core$events$utils();try{o=tZ(e,t),tQ(o)}finally{$.enable$$module$build$src$core$events$utils()}return o?(eX()&&eH(new(ej(rL.COMMENT_CREATE))(o)),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(o),o):null}};lw.TYPE="workspace-comment",tq(lw.TYPE,new lw),$.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:28,connectingSnapRadius:28,currentConnectionPreference:8,bumpDelay:250},$.config$$module$build$src$core$config;var lv,lM,lP,lB,lx,lF,lG,lH,lU="aria-",lW="role";(a$=lH||(lH={})).GRID="grid",a$.GRIDCELL="gridcell",a$.GROUP="group",a$.LISTBOX="listbox",a$.MENU="menu",a$.MENUITEM="menuitem",a$.MENUITEMCHECKBOX="menuitemcheckbox",a$.OPTION="option",a$.PRESENTATION="presentation",a$.ROW="row",a$.TREE="tree",a$.TREEITEM="treeitem",a$.SEPARATOR="separator",a$.STATUS="status",(aN=aD||(aD={})).ACTIVEDESCENDANT="activedescendant",aN.COLCOUNT="colcount",aN.DISABLED="disabled",aN.EXPANDED="expanded",aN.INVALID="invalid",aN.LABEL="label",aN.LABELLEDBY="labelledby",aN.LEVEL="level",aN.ORIENTATION="orientation",aN.POSINSET="posinset",aN.ROWCOUNT="rowcount",aN.SELECTED="selected",aN.SETSIZE="setsize",aN.VALUEMAX="valuemax",aN.VALUEMIN="valuemin",aN.LIVE="live",aN.HIDDEN="hidden";var lV={};lV.Role=lH,lV.State=aD,lV.setRole=t1,lV.setState=t2;var lK=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(){let e=document.createElement("div");e.id=ey(),this.element=e,e.className="blocklyMenuItem "+(this.enabled?"":"blocklyMenuItemDisabled ")+(this.checked?"blocklyMenuItemSelected ":"")+(this.highlight?"blocklyMenuItemHighlight ":"")+(this.rightToLeft?"blocklyMenuItemRtl ":"");let t=document.createElement("div");if(t.className="blocklyMenuItemContent",this.checkable){var i=document.createElement("div");i.className="blocklyMenuItemCheckbox ",t.appendChild(i)}return i=this.content,"string"==typeof this.content&&(i=document.createTextNode(this.content)),t.appendChild(i),e.appendChild(t),this.roleName&&t1(e,this.roleName),t2(e,aD.SELECTED,this.checkable&&this.checked||!1),t2(e,aD.DISABLED,!this.enabled),e}dispose(){this.element=null}getElement(){return this.element}getId(){return this.element.id}getValue(){let e;return null!=(e=this.opt_value)?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;let t=this.getElement();t&&this.isEnabled()&&(e?eq(t,"blocklyMenuItemHighlight"):e0(t,"blocklyMenuItemHighlight"))}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}performAction(e){this.isEnabled()&&this.actionHandler&&this.actionHandler(this,e)}onAction(e,t){this.actionHandler=e.bind(t)}},lX=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){let t=document.createElement("div");t.className="blocklyMenu",t.tabIndex=0,this.roleName&&t1(t,this.roleName),this.element=t;for(let e=0,i;i=this.menuItems[e];e++)t.appendChild(i.createDom());return this.pointerMoveHandler=eb(t,"pointermove",this,this.handlePointerMove,!0),this.clickHandler=eb(t,"pointerup",this,this.handleClick,!0),this.pointerEnterHandler=eb(t,"pointerenter",this,this.handlePointerEnter,!0),this.pointerLeaveHandler=eb(t,"pointerleave",this,this.handlePointerLeave,!0),this.onKeyDownHandler=eb(t,"keydown",this,this.handleKeyEvent),e.appendChild(t),t}getElement(){return this.element}focus(){let e=this.getElement();e&&e.focus({preventScroll:!0})}blur(){let e=this.getElement();e&&e.blur()}setRole(e){this.roleName=e}dispose(){this.pointerMoveHandler&&(eO(this.pointerMoveHandler),this.pointerMoveHandler=null),this.clickHandler&&(eO(this.clickHandler),this.clickHandler=null),this.pointerEnterHandler&&(eO(this.pointerEnterHandler),this.pointerEnterHandler=null),this.pointerLeaveHandler&&(eO(this.pointerLeaveHandler),this.pointerLeaveHandler=null),this.onKeyDownHandler&&(eO(this.onKeyDownHandler),this.onKeyDownHandler=null);for(let e=0,t;t=this.menuItems[e];e++)t.dispose();this.element=null}getMenuItem(e){let t=this.getElement();for(;e&&e!==t;){if(e.classList.contains("blocklyMenuItem")){let t=this.getMenuItems();for(let i=0,o;o=t[i];i++)if(o.getElement()===e)return o}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();let i=e.getElement();t&&i&&(t$(i,t),t2(t,aD.ACTIVEDESCENDANT,e.getId()))}}highlightNext(){let e=this.highlightedItem?this.menuItems.indexOf(this.highlightedItem):-1;this.highlightHelper(e,1)}highlightPrevious(){let e=this.highlightedItem?this.menuItems.indexOf(this.highlightedItem):-1;this.highlightHelper(e<0?this.menuItems.length:e,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(e,t){let i;e+=t;let o=this.getMenuItems();for(;i=o[e];){if(i.isEnabled()){this.setHighlighted(i);break}e+=t}}handlePointerMove(e){0!==Math.max(Math.abs(e.movementX),Math.abs(e.movementY))&&(e=this.getMenuItem(e.target))&&(e.isEnabled()?this.highlightedItem!==e&&this.setHighlighted(e):this.setHighlighted(null))}handleClick(e){var t=this.openingCoords;if(this.openingCoords=null,t&&"number"==typeof e.clientX){let i=new lt(e.clientX,e.clientY);if(1>lt.distance(t,i))return}(t=this.getMenuItem(e.target))&&t.performAction(e)}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(e);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(){let e=this.getElement(),t=tS(e);return t.height=e.scrollHeight,t}getMenuItems(){return this.menuItems.filter(e=>e instanceof lK)}},lY=class{constructor(){this.element=null}createDom(){return this.element=document.createElement("hr"),this.element.className="blocklyMenuSeparator",t1(this.element,lH.SEPARATOR),this.element}dispose(){let e;null==(e=this.element)||e.remove(),this.element=null}},lz="_TEMP_COLLAPSED_INPUT",lj="_TEMP_COLLAPSED_FIELD",lJ="MANUALLY_DISABLED";(aL=$.inputTypes$$module$build$src$core$inputs$input_types||($.inputTypes$$module$build$src$core$inputs$input_types={}))[aL.VALUE=1]="VALUE",aL[aL.STATEMENT=3]="STATEMENT",aL[aL.DUMMY=5]="DUMMY",aL[aL.CUSTOM=6]="CUSTOM",aL[aL.END_ROW=7]="END_ROW",$.inputTypes$$module$build$src$core$inputs$input_types;var lZ=new Set,lq=new WeakSet,lQ=new WeakMap,l0=null,l1=null,l2=0,l3={};l3.finishQueuedRenders=t6,l3.queueRender=t5,l3.triggerQueuedRenders=t4,$.Msg$$module$build$src$core$msg=Object.create(null),ak=function(e){Object.keys(e).forEach(function(t){$.Msg$$module$build$src$core$msg[t]=e[t]})},aw={Msg:$.Msg$$module$build$src$core$msg,setLocale:ak};var l5="blocklyToast",l6="blocklyToastMessage",l4="blocklyToastCloseButton",l8=class{static show(e,t){if(t.oncePerSession&&t.id){if(this.shownIds.has(t.id))return;this.shownIds.add(t.id)}this.hide(e);let i=this.createDom(e,t);requestAnimationFrame(()=>{i.style.bottom="2rem"})}static createDom(e,t){let i,{message:o,duration:s=5,assertiveness:n=l8.Assertiveness.POLITE}=t,r=document.createElement("div");e.getInjectionDiv().appendChild(r),r.dataset.toastId=t.id,r.className=l5,t1(r,lH.STATUS),t2(r,aD.LIVE,n),(t=r.appendChild(document.createElement("div"))).className=l6,t.innerText=o,(t=r.appendChild(document.createElement("button"))).className=l4,t2(t,aD.LABEL,$.Msg$$module$build$src$core$msg.CLOSE);var l=eZ(li.SVG,{width:24,height:24,viewBox:"0 0 24 24",fill:"none"},t);return t2(l,aD.HIDDEN,!0),eZ(li.RECT,{x:19.7782,y:2.80762,width:2,height:24,transform:"rotate(45, 19.7782, 2.80762)",fill:"black"},l),eZ(li.RECT,{x:2.80762,y:4.22183,width:2,height:24,transform:"rotate(-45, 2.80762, 4.22183)",fill:"black"},l),t.addEventListener("click",()=>{r.remove(),e.markFocused()}),t=()=>{i=setTimeout(()=>r.remove(),1e3*s)},l=()=>clearTimeout(i),r.addEventListener("focusin",l),r.addEventListener("focusout",t),r.addEventListener("mouseenter",l),r.addEventListener("mousemove",l),r.addEventListener("mouseleave",t),t(),r}static hide(e,t){(e=e.getInjectionDiv().querySelector(`.${l5}`))instanceof HTMLElement&&(!t||t===e.dataset.toastId)&&e.remove()}};l8.shownIds=new Set,(ay=(ay=l8||(l8={})).Assertiveness||(ay.Assertiveness={})).ASSERTIVE="assertive",ay.POLITE="polite",tf(`
|
|
1
|
+
let e,t,i;import"./mced.a4de160c.js";var o,s,n,r=globalThis;function l(e){return e&&e.__esModule?e.default:e}var a={},c={},h=r.parcelRequirea483;null==h&&((h=function(e){if(e in a)return a[e].exports;if(e in c){var t=c[e];delete c[e];var i={id:e,exports:{}};return a[e]=i,t.call(i.exports,i,i.exports),i.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,t){c[e]=t},r.parcelRequirea483=h);var u=h.register;u("ca2Ll",function(e,t){e.exports=h("97Mr6")}),u("97Mr6",function(e,t){var i;e.exports,i=function(){var e,t,i,o,s,n,l,a,c,h,u,d,p,_,g,E,T,m,f,I,S,R,b,C,O,A,$={};ea=function(e,t,i,o){if(!(e instanceof D)&&"string"!=typeof e||""===`${e}`.trim())throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e=`${e}`.toLowerCase(),"string"!=typeof t||""===t.trim())throw Error('Invalid name "'+t+'". The name must be a non-empty string.');let s=t.toLowerCase();if(!i)throw Error("Can not register a null value");let n=N[e],r=L[e];if(n||(n=N[e]=Object.create(null),r=L[e]=Object.create(null)),ec(e,i),!o&&n[s]&&n[s]!==i)throw Error('Name "'+s+'" with type "'+e+'" already registered.');n[s]=i,r[s]=t},ec=function(e,t){if(e===String(D.FIELD)&&"function"!=typeof t.fromJson)throw Error('Type "'+e+'" must have a fromJson function')},eh=function(e,t){e=`${e}`.toLowerCase(),t=t.toLowerCase();let i=N[e];i&&i[t]?(delete N[e][t],delete L[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},eu=function(e,t,i){e=`${e}`.toLowerCase(),t=t.toLowerCase();let o=N[e];if(!o||!o[t]){if(t="Unable to find ["+t+"]["+e+"] in the registry.",i)throw Error(t+" You must require or register a "+e+" plugin.");return console.warn(t),null}return o[t]},ed=function(e,t){return e=`${e}`.toLowerCase(),t=t.toLowerCase(),!!(e=N[e])&&!!e[t]},ep=function(e,t,i){return eu(e,t,i)},e_=function(e,t,i){return eu(e,t,i)},eg=function(e,t,i){var o=N[e=`${e}`.toLowerCase()];if(!o){if(o=`Unable to find [${e}] in the registry.`,i)throw Error(`${o} You must require or register a ${e} plugin.`);return console.warn(o),null}if(!t)return o;for(let t of(e=L[e],i=Object.create(null),Object.keys(o)))i[e[t]]=o[t];return i},eE=function(e,t,i){return"function"==typeof(t=t.plugins[String(e)]||y)?t:ep(e,t,i)},eT=function(e,t){em(),x=setTimeout(function(){t&&t.handleRightClick(e)},M)},em=function(){x&&(clearTimeout(x),x=0)},ef=function(){P=null},eI=function(e){return!e.type.startsWith("pointer")||e instanceof PointerEvent&&eR(e)},eS=function(e){return`${e.pointerId}`},eR=function(e){let t=eS(e);return P?P===t:"pointerdown"===e.type&&(P=t,!0)},eb=function(e,t,i,o,s){function n(e){(s||eI(e))&&(i?o.call(i,e):o(e))}let r=[];if(t in B)for(let i=0;i<B[t].length;i++){let o=B[t][i];e.addEventListener(o,n,!1),r.push([e,o,n])}else e.addEventListener(t,n,!1),r.push([e,t,n]);return r},eC=function(e,t,i,o){function s(e){i?o.call(i,e):o(e)}let n=[];if(t in B)for(let i=0;i<B[t].length;i++){let o=B[t][i];e.addEventListener(o,s,!1),n.push([e,o,s])}else e.addEventListener(t,s,!1),n.push([e,t,s]);return n},eO=function(e){let t=e[e.length-1][2];for(;e.length;){let[t,i,o]=e.pop();t.removeEventListener(i,o,!1)}return t},eA=function(e){if(e.target instanceof HTMLElement){if(e.target.isContentEditable||"true"===e.target.getAttribute("data-is-text-input"))return!0;if(e.target instanceof HTMLInputElement)return"text"===(e=e.target).type||"number"===e.type||"email"===e.type||"password"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type;if(e.target instanceof HTMLTextAreaElement)return!0}return!1},e$=function(e){return!!e.ctrlKey&&!!V||2===e.button},eN=function(e,t,i){let o=t.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,i||(i=t.getScreenCTM().inverse()),o.matrixTransform(i)},eL=function(e){switch(e.deltaMode){default:return{x:e.deltaX,y:e.deltaY};case 1:return{x:e.deltaX*K,y:e.deltaY*K};case 2:return{x:e.deltaX*Y,y:e.deltaY*Y}}},ey=function(){return"blockly-"+(Z++).toString(36)},eD=function(){return J.genUid()},ek=function(e){return e.type===rL.BLOCK_CREATE},ew=function(e){return e.type===rL.BLOCK_DELETE},eM=function(e){return e.type===rL.BLOCK_CHANGE},ev=function(e){return e.type===rL.BLOCK_FIELD_INTERMEDIATE_CHANGE},eP=function(e){return e.type===rL.BLOCK_MOVE},eB=function(e){return e.type===rL.CLICK},ex=function(e){return e.type===rL.BUBBLE_OPEN},eF=function(e){return e.type===rL.VIEWPORT_CHANGE},$.setRecordUndo$$module$build$src$core$events$utils=function(e){et=e},eG=function(){return et},eH=function(e){en.fireInternal(e)},eU=function(){let e=eV(es);for(let t of(es.length=0,e)){let e;t.workspaceId&&(null==(e=to(t.workspaceId))||e.fireChangeListener(t))}},eW=function(e){if(eM(e)&&"mutation"===e.element){let t;for(t=es.length;t>0;t--){let i=es[t-1];if(i.group!==e.group||i.workspaceId!==e.workspaceId||!eP(i)||i.newParentId!==e.blockId)break}es.splice(t,0,e)}else es.push(e)},eV=function(e){let t=[];for(let i of e)if(e=t[t.length-1],!i.isNull())if(e&&e.workspaceId===i.workspaceId&&e.group===i.group)if(eP(i)&&eP(e)&&i.blockId===e.blockId){if(e.newParentId=i.newParentId,e.newInputName=i.newInputName,e.newCoordinate=i.newCoordinate,e.reason||i.reason){let t,o;e.reason=Array.from(new Set((null!=(t=e.reason)?t:[]).concat(null!=(o=i.reason)?o:[])))}}else eM(i)&&eM(e)&&i.blockId===e.blockId&&i.element===e.element&&i.name===e.name?e.newValue=i.newValue:eF(i)&&eF(e)?(e.viewTop=i.viewTop,e.viewLeft=i.viewLeft,e.scale=i.scale,e.oldScale=i.oldScale):eB(i)&&ex(e)||t.push(i);else t.push(i);return t.filter(e=>!e.isNull())},eK=function(){for(let e=0,t;t=es[e];e++)t.recordUndo=!1},$.disable$$module$build$src$core$events$utils=function(){ei++},$.enable$$module$build$src$core$events$utils=function(){ei--},eY=function(){return 0===ei},$.getGroup$$module$build$src$core$events$utils=function(){return ee},$.setGroup$$module$build$src$core$events$utils=function(e){en.setGroupInternal(e)},eX=function(e){let t=[];e=e.getDescendants(!1);for(let i=0,o;o=e[i];i++)t[i]=o.id;return t},ez=function(e,t){let i=ej(e.type);if(!i)throw Error("Unknown event type.");return i.fromJson(e,t)},ej=function(e){let t=ep(D.EVENT,e);if(!t)throw Error(`Event type ${e} not found in registry.`);return t},eJ=function(e){if((eP(e)||ek(e))&&e.workspaceId){var t=to(e.workspaceId);if(!e.blockId)throw Error("Encountered a blockEvent without a proper blockId");if(e=t.getBlockById(e.blockId)){let i=et;try{et=!1;let i=e.getParent();if(i&&!i.hasDisabledReason(eo)){let t=e.getDescendants(!1);for(let e=0,i;i=t[e];e++)i.setDisabledReason(!1,eo)}else if((e.outputConnection||e.previousConnection)&&!t.isDragging())do e.setDisabledReason(!0,eo),e=e.getNextBlock();while(e)}finally{et=i}}}},eZ=function(e,t,i){for(let i in e=document.createElementNS(rD,`${e}`),t)e.setAttribute(i,`${t[i]}`);return i&&i.appendChild(e),e},eq=function(e,t){return!(t=t.split(" ")).every(t=>e.classList.contains(t))&&(e.classList.add(...t),!0)},eQ=function(e,t){e.classList.remove(...t.split(" "))},e0=function(e,t){return!(t=t.split(" ")).every(t=>!e.classList.contains(t))&&(e.classList.remove(...t),!0)},e1=function(e,t){return e.classList.contains(t)},e2=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},e3=function(e,t){let i=t.nextSibling;if(!(t=t.parentNode))throw Error("Reference node has no parent.");i?t.insertBefore(e,i):t.appendChild(e)},e5=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},e6=function(){rv++,rM||(rM=Object.create(null))},e4=function(){--rv||(rM=null)},e8=function(e){var t;let i=e.textContent+"\n"+e.className.baseVal;return rM&&(t=rM[i])||(t=window.getComputedStyle(e),t=e9(e,t.fontSize,t.fontWeight,t.fontFamily),rM&&(rM[i]=t)),t},e9=function(e,t,i,o){var s;let n=e.textContent;return e=n+"\n"+e.className.baseVal,rM&&(s=rM[e])||(rP||((s=document.createElement("canvas")).className="blocklyComputeCanvas",document.body.appendChild(s),rP=s.getContext("2d")),n&&rP?(rP.font=i+" "+t+" "+o,s=rP.measureText(n).width):s=0,rM&&(rM[e]=s)),s},e7=function(e,t,i,o){let s=document.createElement("span");s.style.font=i+" "+t+" "+o,s.textContent=e,(e=document.createElement("div")).style.width="1px",e.style.height="0",(t=document.createElement("div")).style.display="flex",t.style.position="fixed",t.style.top="0",t.style.left="0",t.appendChild(s),t.appendChild(e),document.body.appendChild(t),i={height:0,baseline:0};try{t.style.alignItems="baseline",i.baseline=e.offsetTop-s.offsetTop,t.style.alignItems="flex-end",i.height=e.offsetTop-s.offsetTop}finally{document.body.removeChild(t)}return i},$.getFocusManager$$module$build$src$core$focus_manager=function(){return rG.getFocusManager()},te=function(e){return e&&"function"==typeof e.getFocusableElement&&"function"==typeof e.getFocusableTree&&"function"==typeof e.onNodeFocus&&"function"==typeof e.onNodeBlur&&"function"==typeof e.canBeFocused},tt=function(e){return te(e)&&"string"==typeof e.id&&"object"==typeof e.workspace&&"function"==typeof e.select&&"function"==typeof e.unselect},ti=function(e,t){for(let i in t)null!==t[i]&&Array.isArray(t[i])?e[i]=ti(e[i]||[],t[i]):e[i]=null!==t[i]&&"object"==typeof t[i]?ti(e[i]||Object.create(null),t[i]):t[i];return e},to=function(e){return rz[e]||null},ts=function(){let e=[];for(let t in rz)e.push(rz[t]);return e},tn=function(e){rz[e.id]=e},tr=function(e){delete rz[e.id]},tl=function(){return rY},ta=function(e){rY=e},tc=function(){let e=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode();return e&&tt(e)?e:null},th=function(e){let t,i,o,s,n=tc();eH(new(ej(rL.SELECTED))(null!=(t=null==n?void 0:n.id)?t:null,null!=(i=null==e?void 0:e.id)?i:null,null!=(s=null!=(o=null==e?void 0:e.workspace.id)?o:null==n?void 0:n.workspace.id)?s:""))},tu=function(){return rX},td=function(e){rX=e},tp=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;let t=e.getParentSvg(),i=e.getCachedParentSvgSize();var o=t.parentElement;if(o instanceof HTMLElement){var s=o.offsetWidth;o=o.offsetHeight,i.width!==s&&(t.setAttribute("width",s+"px"),e.setCachedParentSvgSize(s,null)),i.height!==o&&(t.setAttribute("height",o+"px"),e.setCachedParentSvgSize(null,o)),e.resize()}},t_=function(e,t){let i=Object.create(null),o=e.getDescendants(!0);t&&(e=e.getNextBlock())&&(e=o.indexOf(e),o.splice(e,o.length-e));for(let e=0,t;t=o[e];e++)i[t.type]?i[t.type]++:i[t.type]=1;return i},tg=function(e){return function(){this.jsonInit(e)}},tE=function(e){rJ.defineBlocksWithJsonArrayInternal(e)},$.createBlockDefinitionsFromJsonArray$$module$build$src$core$common=function(e){let t={};for(let i=0;i<e.length;i++){let o=e[i];if(!o){console.warn(`Block definition #${i} in JSON array is ${o}. Skipping`);continue}let s=o.type;s?t[s]={init:tg(o)}:console.warn(`Block definition #${i} in JSON array is missing a type attribute. Skipping.`)}return t},$.defineBlocks$$module$build$src$core$common=function(e){for(let t of Object.keys(e)){let i=e[t];t in w&&console.warn(`Block definition "${t}" overwrites previous definition.`),w[t]=i}},tT=function(e){let t=tl(),i=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedTree();for(let e of ts())if(i===e){t=e;break}!eA(e)&&t&&(!t.rendered||t.isFlyout||t.isVisible())&&rW.registry.onKeyDown(t,e)},tm=function(e,t){return -1!==(t=e.indexOf(t))&&(e.splice(t,1),!0)},tf=function(e){if(r9)throw Error("CSS already injected");r7+="\n"+e},tI=function(e,t){r9||(r9=!0,e&&(e=t.replace(/[\\/]$/,""),t=r7.replace(/<<<PATH>>>/g,e),r7="",(e=document.createElement("style")).id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},tS=function(e){return ln.getSizeInternal(e)},tR=function(e){return new ls(e.offsetWidth,e.offsetHeight)},tb=function(e,t){return(e=window.getComputedStyle(e))[t]||e.getPropertyValue(t)},tC=function(e){let t=new lt(0,0);e=e.getBoundingClientRect();var i=document.documentElement;return i=new lt(window.pageXOffset||i.scrollLeft,window.pageYOffset||i.scrollTop),t.x=e.left+i.x,t.y=e.top+i.y,t},tO=function(){let e=document.body,t=document.documentElement;return new lt(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},tA=function(e){let t=parseFloat(tb(e,"borderLeftWidth")),i=parseFloat(tb(e,"borderRightWidth"));return new lo(parseFloat(tb(e,"borderTopWidth")),e=parseFloat(tb(e,"borderBottomWidth")),t,i)},t$=function(e,t,i){e=tN(e,t,i),t.scrollLeft=e.x,t.scrollTop=e.y},tN=function(e,t,i){var o=tC(e),s=tC(t),n=tA(t);let r=o.x-s.x-n.left;return o=o.y-s.y-n.top,s=tR(e),e=t.clientWidth-s.width,s=t.clientHeight-s.height,n=t.scrollLeft,t=t.scrollTop,i?(n+=r-e/2,t+=o-s/2):(n+=Math.min(r,Math.max(r-e,0)),t+=Math.min(o,Math.max(o-s,0))),new lt(n,t)},tL=function(e){let t=new lt(0,0);var i=e.x&&e.getAttribute("x");let o=e.y&&e.getAttribute("y");return i&&(t.x=parseInt(i)),o&&(t.y=parseInt(o)),(i=(i=e.getAttribute("transform"))&&i.match(ll))&&(t.x+=Number(i[1]),i[3]&&(t.y+=Number(i[3]))),(e=e.getAttribute("style"))&&e.includes("translate")&&(e=e.match(la))&&(t.x+=Number(e[1]),e[3]&&(t.y+=Number(e[3]))),t},ty=function(e){let t=0,i=0;for(;e;){let o=tL(e);if(t+=o.x,i+=o.y,(" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv "))break;e=e.parentNode}return new lt(t,i)},tD=function(){let e=tO();return new lo(e.y,document.documentElement.clientHeight+e.y,e.x,document.documentElement.clientWidth+e.x)},tk=function(){let e=document.documentElement,t=window;return new lt(t.pageXOffset||e.scrollLeft,t.pageYOffset||e.scrollTop)},tw=function(e,t){var i=t.x;t=t.y;let o=e.getInjectionDiv().getBoundingClientRect();return i=new lt(i-o.left,t-o.top),t=e.getOriginOffsetInPixels(),lt.difference(i,t).scale(1/e.scale)},tM=function(e,t){var i=t.scale(e.scale);t=i.x,i=i.y;let o=e.getInjectionDiv().getBoundingClientRect();return e=e.getOriginOffsetInPixels(),new lt(t+o.left+e.x,i+o.top+e.y)},$.createElement$$module$build$src$core$utils$xml=function(e){return lp.createElementNS(lE,e)},$.createTextNode$$module$build$src$core$utils$xml=function(e){return lp.createTextNode(e)},$.textToDom$$module$build$src$core$utils$xml=function(e){let t=lu.parseFromString(e,"text/xml");if(t&&t.documentElement&&!t.getElementsByTagName("parsererror").length)return t.documentElement;if((t=lu.parseFromString(e,"text/html"))&&t.body.firstChild&&"xml"===t.body.firstChild.nodeName.toLowerCase())return t.body.firstChild;throw Error(`DOMParser was unable to parse: ${e}`)},tv=function(e){return tP(ld.serializeToString(e))},tP=function(e){return e.replace(lT,e=>`&#${e.charCodeAt(0)};`)},tB=function(e){return e?((e instanceof Element||"string"==typeof e)&&(e=tK(e),e=tU(e)),tx(e),e):null},tx=function(e){let t=e.kind;if(e=e.contents,t&&t!==lb&&t!==lR)throw Error("Invalid toolbox kind "+t+". Please supply either "+lb+" or "+lR);if(!e)throw Error("Toolbox must have a contents attribute.")},tF=function(e){return e?e.contents?e.contents:Array.isArray(e)&&e.length>0&&!e[0].nodeType?e:tW(e):[]},tG=function(e){return lC.hasCategoriesInternal(e)},tH=function(e){return!!e&&!!e.contents&&!!e.contents.filter(function(e){return"CATEGORY"===e.kind.toUpperCase()}).length},tU=function(e){let t={contents:tW(e)};return e instanceof Node&&tV(e,t),t},tW=function(e){let t=[],i=e.childNodes;i||(i=e);for(let o=0,s;s=i[o];o++){if(!s.tagName)continue;e={};let i=s.tagName.toUpperCase();e.kind=i,"BLOCK"===i?e.blockxml=s:s.childNodes&&s.childNodes.length>0&&(e.contents=tW(s)),tV(s,e),t.push(e)}return t},tV=function(e,t){for(let i=0;i<e.attributes.length;i++){let o=e.attributes[i];o.nodeName.includes("css-")?(t.cssconfig=t.cssconfig||{},t.cssconfig[o.nodeName.replace("css-","")]=o.value):t[o.nodeName]=o.value}},tK=function(e){let t=null;if(e)if("string"==typeof e){if("xml"!==(t=$.textToDom$$module$build$src$core$utils$xml(e)).nodeName.toLowerCase())throw TypeError("Toolbox should be an <xml> document.")}else e instanceof Element&&(t=e);return t},tY=function(e,t,i,o,s,n){let r=n.scrollbar&&n.scrollbar.canScrollVertically();return e.horizontal===lF.LEFT?(i=s.absoluteMetrics.left+i,r&&n.RTL&&(i+=lh.scrollbarThickness)):(i=s.absoluteMetrics.left+s.viewMetrics.width-t.width-i,r&&!n.RTL&&(i-=lh.scrollbarThickness)),e.vertical===lx.TOP?e=s.absoluteMetrics.top+o:(e=s.absoluteMetrics.top+s.viewMetrics.height-t.height-o,n.scrollbar&&n.scrollbar.canScrollHorizontally()&&(e-=lh.scrollbarThickness)),new lo(e,e+t.height,i,i+t.width)},tX=function(e,t){return{horizontal:t.toolboxMetrics.position===lS.LEFT||e.horizontalLayout&&!e.RTL?lF.RIGHT:lF.LEFT,vertical:t.toolboxMetrics.position===lS.BOTTOM?lx.TOP:lx.BOTTOM}},tz=function(e,t,i,o){let s=e.left,n=e.right-e.left,r=e.bottom-e.top;for(let l=0;l<o.length;l++){let a=o[l];e.intersects(a)&&(e=new lo(e=i===lG.UP?a.top-r-t:a.bottom+t,e+r,s,s+n),l=-1)}return e},tj=function(e,t){ea(D.SERIALIZER,e,t)},tJ=function(e,{addCoordinates:t=!1,saveIds:i=!0}={}){let o=e.workspace,s=Object.create(null);return s.height=e.getSize().height,s.width=e.getSize().width,i&&(s.id=e.id),t&&(t=e.getRelativeToSurfaceXY(),s.x=o.RTL?o.getWidth()-t.x:t.x,s.y=t.y),e.getText()&&(s.text=e.getText()),e.isCollapsed()&&(s.collapsed=!0),e.isOwnEditable()||(s.editable=!1),e.isOwnMovable()||(s.movable=!1),e.isOwnDeletable()||(s.deletable=!1),s},tZ=function(e,t,{recordUndo:i=!1}={}){let o=eG();if($.setRecordUndo$$module$build$src$core$events$utils(i),i=t.newComment(e.id),void 0!==e.text&&i.setText(e.text),void 0!==e.x||void 0!==e.y){var s;let o=i.getRelativeToSurfaceXY(),n,r=null!=(n=e.x)?n:o.x;r=t.RTL?t.getWidth()-r:r,t=null!=(s=e.y)?s:o.y,i.moveTo(new lt(r,t))}if(void 0!==e.width||e.height){let t,o;s=i.getSize(),i.setSize(new ls(null!=(t=e.width)?t:s.width,null!=(o=e.height)?o:s.height))}return void 0!==e.collapsed&&i.setCollapsed(e.collapsed),void 0!==e.editable&&i.setEditable(e.editable),void 0!==e.movable&&i.setMovable(e.movable),void 0!==e.deletable&&i.setDeletable(e.deletable),$.setRecordUndo$$module$build$src$core$events$utils(o),i},tq=function(e,t){ea(D.PASTER,e,t)},tQ=function(e){let t=e.workspace,i=e.getRelativeToSurfaceXY(),o=new lt(0,0),s=t.getTopComments(!1).filter(t=>t.id!==e.id).map(e=>e.getRelativeToSurfaceXY());for(;t0(lt.sum(i,o),s);)o.translate(t.RTL?-30:30,30);e.moveTo(lt.sum(i,o))},t0=function(e,t){return t.some(t=>1>=Math.abs(t.x-e.x)&&1>=Math.abs(t.y-e.y))},t1=function(e,t){e.setAttribute(lW,t)},t2=function(e,t,i){Array.isArray(i)&&(i=i.join(" ")),e.setAttribute(lU+t,`${i}`)},t3=function(e){return e&&"function"==typeof e.saveState&&"function"==typeof e.loadState},t5=function(e){return(t9(e),t8())?(t7(),Promise.resolve()):(l0||(l0=new Promise(e=>{l1=e,l2=window.requestAnimationFrame(()=>{t7(),e()})})),l0)},t6=function(){return l0||Promise.resolve()},t4=function(e){e||window.cancelAnimationFrame(l2),t7(e),!e&&l1&&l1()},t8=function(){return W},t9=function(e){lq.add(e),lQ.set(e,$.getGroup$$module$build$src$core$events$utils());let t=e.getParent();t?t9(t):lZ.add(e)},t7=function(e){let t=new Set(e?[e]:[...lZ].map(e=>e.workspace)),i=[...lZ].filter(it).filter(e=>t.has(e.workspace));for(var o of i)ii(o);for(let e of t)e.resizeContents();for(var s of i)o=s.getRelativeToSurfaceXY(),s.updateComponentLocations(o);for(let e of i)s=$.getGroup$$module$build$src$core$events$utils(),(o=lQ.get(e))&&$.setGroup$$module$build$src$core$events$utils(o),e.bumpNeighbours(),$.setGroup$$module$build$src$core$events$utils(s);for(let e of i)ie(e);e||(l0=null)},ie=function(e){for(let t of(lZ.delete(e),lq.delete(e),lQ.delete(e),e.getChildren(!1)))ie(t)},it=function(e){return!e.isDisposed()&&!e.getParent()},ii=function(e){if(lq.has(e)&&e.initialized){for(let t of e.getChildren(!1))ii(t);e.renderEfficiently()}},io=function(e,t){l7(e,t)},is=function(e,t){at(e,t)},ir=function(e,t,i){ao(e,t,i)},il=function(e){return e&&"function"==typeof e.getProcedureDef},ia=function(e){return e&&"function"==typeof e.getProcedureCall&&"function"==typeof e.renameProcedure},ic=function(e){return void 0!==e.getVariableModel},ih=function(e,t,i,o){e=e+" was deprecated in "+t+" and will be deleted in "+i+".",o&&(e+="\nUse "+o+" instead."),aa.has(e)||(aa.add(e),console.warn(e))},$.allUsedVarModels$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);let t=new Set;for(let i=0;i<e.length;i++){let o=e[i].getVarModels();if(o)for(let e=0;e<o.length;e++){let i=o[e];i.getId()&&t.add(i)}}return Array.from(t.values())},$.allDeveloperVariables$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);let t=new Set;for(let o=0,s;s=e[o];o++){var i=s.getDeveloperVariables;if(i){i=i();for(let e=0;e<i.length;e++)t.add(i[e])}}return Array.from(t.values())},iu=function(e){return id(e,!1)},id=function(e,t=!0){return(w.variables_set||w.variables_get||console.warn("There are no variable blocks, but there is a variable category."),t)?(ih("The XML return value of Blockly.Variables.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),ig(e)):(e.registerButtonCallback("CREATE_VARIABLE",function(e){iI(e.getTargetWorkspace())}),[{kind:"button",text:"%{BKY_NEW_VARIABLE}",callbackkey:"CREATE_VARIABLE"},...i_(e,e.getVariableMap().getVariablesOfType(""),!0)])},ip=function(e){return{VAR:{name:e.getName(),type:e.getType()}}},i_=function(e,t,i,o="variables_get",s="variables_set"){i&&(i=w.math_change),e=[];let n=t.slice(-1)[0];return n&&(w[s]&&e.push({kind:"block",type:s,gap:i?8:24,fields:ip(n)}),i&&e.push({kind:"block",type:"math_change",gap:w[o]?20:8,fields:ip(n),inputs:{DELTA:{shadow:{type:"math_number",fields:{NUM:1}}}}})),w[o]&&e.push(...t.sort(iy).map(e=>({kind:"block",type:o,gap:8,fields:ip(e)}))),e},ig=function(e){let t=[],i=document.createElement("button");return i.setAttribute("text","%{BKY_NEW_VARIABLE}"),i.setAttribute("callbackKey","CREATE_VARIABLE"),e.registerButtonCallback("CREATE_VARIABLE",function(e){iI(e.getTargetWorkspace())}),t.push(i),t.concat(e=iE(e))},iE=function(e){e=e.getVariableMap().getVariablesOfType("");let t=[];if(e.length>0){var i=e[e.length-1];if(w.variables_set){var o=$.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","variables_set"),o.setAttribute("gap",w.math_change?"8":"24"),o.appendChild(i$(i)),t.push(o)}if(w.math_change&&((o=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","math_change"),o.setAttribute("gap",w.variables_get?"20":"8"),o.appendChild(i$(i)),i=$.textToDom$$module$build$src$core$utils$xml('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),o.appendChild(i),t.push(o)),w.variables_get){e.sort(iy);for(let o=0,s;s=e[o];o++)(i=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get"),i.setAttribute("gap","8"),i.appendChild(i$(s)),t.push(i)}}return t},iT=function(e){return ad.generateUniqueNameInternal(e)},im=function(e,t){if(!t.length)return e;let i="",o=au.indexOf(e);for(;;){let s=!1;for(let i=0;i<t.length;i++)if(t[i].toLowerCase()===e){s=!0;break}if(!s)break;++o===au.length&&(o=0,i=`${Number(i)+1}`),e=au.charAt(o)+i}return e},iI=function(e,t,i){let o=i||"";!function i(s){iS($.Msg$$module$build$src$core$msg.NEW_VARIABLE_TITLE,s,function(s){if(s){var n=ib(s,e);if(n){if(n.getType()===o)var r=$.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS.replace("%1",n.getName());else r=(r=$.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE).replace("%1",n.getName()).replace("%2",n.getType());io(r,function(){i(s)})}else e.getVariableMap().createVariable(s,o),t&&t(s)}else t&&t(null)})}("")},$.renameVariable$$module$build$src$core$variables=function(e,t,i){!function o(s){let n=$.Msg$$module$build$src$core$msg.RENAME_VARIABLE_TITLE.replace("%1",t.getName());iS(n,s,function(s){if(s){var n=iR(s,t.getType(),e),r=iC(t.getName(),s,e);if(n||r){var l="";n?l=$.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",n.getName()).replace("%2",n.getType()):r&&(l=$.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER.replace("%1",s).replace("%2",r)),io(l,function(){o(s)})}else e.getVariableMap().renameVariable(t,s),i&&i(s)}else i&&i(null)})}("")},iS=function(e,t,i){ir(e,t,function(e){e&&((e=e.replace(/[\s\xa0]+/g," ").trim())===$.Msg$$module$build$src$core$msg.RENAME_VARIABLE||e===$.Msg$$module$build$src$core$msg.NEW_VARIABLE)&&(e=null),i(e)})},iR=function(e,t,i){i=i.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let o=0,s;s=i[o];o++)if(s.getName().toLowerCase()===e&&s.getType()!==t)return s;return null},ib=function(e,t){t=t.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let i=0,o;o=t[i];i++)if(o.getName().toLowerCase()===e)return o;return null},iC=function(e,t,i){return i.getProcedureMap().getProcedures().length?iO(e,t,i):iA(e,t,i)},iO=function(e,t,i){for(let s of(e=e.toLowerCase(),t=t.toLowerCase(),i=i.getProcedureMap().getProcedures())){var o=s.getParameters().filter(ic).map(e=>e.getVariableModel().getName());if(o&&(i=o.some(t=>t.toLowerCase()===e),o=o.some(e=>e.toLowerCase()===t),i&&o))return s.getName()}return null},iA=function(e,t,i){for(let s of(e=e.toLowerCase(),t=t.toLowerCase(),i=i.getAllBlocks(!1))){if(!il(s))continue;var o=(i=s.getProcedureDef())[1];let n=o.some(t=>t.toLowerCase()===e);if(o=o.some(e=>e.toLowerCase()===t),n&&o)return i[0]}return null},i$=function(e){let t=$.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name","VAR"),t.setAttribute("id",e.getId()),t.setAttribute("variabletype",e.getType()),e=$.createTextNode$$module$build$src$core$utils$xml(e.getName()),t.appendChild(e),t},$.getOrCreateVariablePackage$$module$build$src$core$variables=function(e,t,i,o){let s=$.getVariable$$module$build$src$core$variables(e,t,i,o);return s||(s=iN(e,t,i,o)),s},$.getVariable$$module$build$src$core$variables=function(e,t,i,o){let s=e.getPotentialVariableMap(),n=null;if(t&&((n=e.getVariableById(t))||!s||(n=s.getVariableById(t)),n))return n;if(i){if(void 0===o)throw Error("Tried to look up a variable by name without a type");(n=e.getVariable(i,o))||!s||(n=s.getVariable(i,o))}return n},iN=function(e,t,i,o){let s=e.getVariableMap(),n=e.getPotentialVariableMap();return i||(i=iT(e.isFlyout?e.targetWorkspace:e)),n?n.createVariable(i,o,null!=t?t:void 0):s.createVariable(i,o,t)},iL=function(e,t){e=e.getAllVariables();let i=[];if(t.length!==e.length)for(let o=0;o<e.length;o++){let s=e[o];t.includes(s)||i.push(s)}return i},iy=function(e,t){return e.getName().localeCompare(t.getName(),void 0,{sensitivity:"base"})},iD=function(e,t){let i=[];e=e.getAllBlocks(!1);for(let o=0;o<e.length;o++){let s=e[o].getVarModels();if(s)for(let n=0;n<s.length;n++)s[n].getId()===t&&i.push(e[o])}return i},$.deleteVariable$$module$build$src$core$variables=function(e,t,i){var o=t.getName();let s=iD(e,t.getId());for(let e=s.length-1;e>=0;e--){let t=s[e];if("procedures_defnoreturn"===t.type||"procedures_defreturn"===t.type){i=String(t.getFieldValue("NAME")),io(o=$.Msg$$module$build$src$core$msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",o).replace("%2",i));return}t===i&&s.splice(e,1)}i&&s.length||s.length>1?is(o=$.Msg$$module$build$src$core$msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(s.length+(i&&!i.workspace.isFlyout?1:0))).replace("%2",o),i=>{i&&t&&e.getVariableMap().deleteVariable(t)}):e.getVariableMap().deleteVariable(t)},ik=function(e,{addCoordinates:t=!1,addInputBlocks:i=!0,addNextBlocks:o=!0,doFullSerialization:s=!0,saveIds:n=!0}={}){if(e.isInsertionMarker())return null;let r={type:e.type,id:n?e.id:void 0};return t&&iM(e,r),iw(e,r),iv(e,r,s),iP(e,r,s),iB(e,r,s),i&&ix(e,r,s,n),o&&iF(e,r,s,n),r},iw=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),void 0!==e.inputsInline&&e.inputsInline!==e.inputsInlineDefault&&(t.inline=e.inputsInline),e.data&&(t.data=e.data)},iM=function(e,t){let i=e.workspace;e=e.getRelativeToSurfaceXY(),t.x=Math.round(i.RTL?i.getWidth()-e.x:e.x),t.y=Math.round(e.y)},iv=function(e,t,i){e.saveExtraState?null!==(e=e.saveExtraState(i))&&(t.extraState=e):e.mutationToDom&&null!==(e=e.mutationToDom())&&(t.extraState=sg(e).replace(' xmlns="https://developers.google.com/blockly/xml"',""))},iP=function(e,t,i){let o=Object.create(null);for(let t of e.getIcons())t3(t)&&(e=t.saveState(i))&&(o[t.getType().toString()]=e);Object.keys(o).length&&(t.icons=o)},iB=function(e,t,i){let o=Object.create(null);for(let t of e.getFields())t.isSerializable()&&(o[t.name]=t.saveState(i));Object.keys(o).length&&(t.fields=o)},ix=function(e,t,i,o){let s=Object.create(null);for(let t=0;t<e.inputList.length;t++){let n=e.inputList[t];if(!n.connection)continue;let r=iG(n.connection,i,o);r&&(s[n.name]=r)}Object.keys(s).length&&(t.inputs=s)},iF=function(e,t,i,o){e.nextConnection&&(e=iG(e.nextConnection,i,o))&&(t.next=e)},iG=function(e,t,i){let o=e.getShadowState(!0);if(e=e.targetBlock(),!o&&!e)return null;let s=Object.create(null);return o&&(s.shadow=o),e&&!e.isShadow()&&(s.block=ik(e,{doFullSerialization:t,saveIds:i})),s},iH=function(e,t,{recordUndo:i=!1}={}){return e=iU(e,t,{recordUndo:i}),t.rendered&&t4(),e},iU=function(e,t,{parentConnection:i,isShadow:o=!1,recordUndo:s=!1}={}){let n,r=eG();$.setRecordUndo$$module$build$src$core$events$utils(s),(s=$.getGroup$$module$build$src$core$events$utils())||$.setGroup$$module$build$src$core$events$utils(!0),$.disable$$module$build$src$core$events$utils();let l=t.getAllVariables();try{n=iW(e,t,{parentConnection:i,isShadow:o})}finally{$.enable$$module$build$src$core$events$utils()}if(iV(t,l),eY()&&eH(new(ej(rL.BLOCK_CREATE))(n)),$.setGroup$$module$build$src$core$events$utils(s),$.setRecordUndo$$module$build$src$core$events$utils(r),t.rendered){let e=n;setTimeout(()=>{e.disposed||e.setConnectionTracking(!0)},1)}return n},iW=function(e,t,{parentConnection:i,isShadow:o=!1}={}){if(!e.type)throw new ag(e);let s=t.newBlock(e.type,e.id);return s.setShadow(o),iK(s,e),iY(s,e),iX(s,e),iz(i,s,e),ij(s,e),iJ(s,e),iZ(s,e),iq(s,e),i0(s,t.rendered),s},iV=function(e,t){if(eY())for(e=iL(e,t),t=0;t<e.length;t++){let i=e[t];eH(new(ej(rL.VAR_CREATE))(i))}},iK=function(e,t){let i=void 0===t.x?0:t.x;t=void 0===t.y?0:t.y;let o=e.workspace;i=o.RTL?o.getWidth()-i:i,e.moveBy(i,t)},iY=function(e,t){if(t.collapsed&&e.setCollapsed(!0),!1===t.deletable&&e.setDeletable(!1),!1===t.movable&&e.setMovable(!1),!1===t.editable&&e.setEditable(!1),!1===t.enabled&&e.setDisabledReason(!0,lJ),Array.isArray(t.disabledReasons))for(let i of t.disabledReasons)e.setDisabledReason(!0,i);void 0!==t.inline&&e.setInputsInline(t.inline),void 0!==t.data&&(e.data=t.data)},iX=function(e,t){t.extraState&&(e.loadExtraState?e.loadExtraState(t.extraState):e.domToMutation&&e.domToMutation($.textToDom$$module$build$src$core$utils$xml(t.extraState)))},iz=function(e,t,i){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new am(i);if(e.type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var o=t.outputConnection;if(!o)throw new aE("output",t,i)}else if(!(o=t.previousConnection))throw new aE("previous",t,i);if(!e.connect(o)){let s=t.workspace.connectionChecker;throw new aT(s.getErrorMessage(s.canConnectWithReason(o,e,!1),o,e),e.type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,i)}}},ij=function(e,t){if(t.icons){var i=Object.keys(t.icons);for(let s of i){i=t.icons[s];var o=e.getIcon(s);if(!o){if(!(o=ep(D.ICON,s,!1)))throw new af(s,e,t);o=new o(e),e.addIcon(o)}t3(o)&&o.loadState(i)}}},iJ=function(e,t){if(t.fields){var i=Object.keys(t.fields);for(let o=0;o<i.length;o++){let s=i[o],n=t.fields[s],r=e.getField(s);r?r.loadState(n):console.warn(`Ignoring non-existant field ${s} in block ${e.type}`)}}},iZ=function(e,t){if(t.inputs){var i=Object.keys(t.inputs);for(let o=0;o<i.length;o++){let s=i[o],n=e.getInput(s);if(!n||!n.connection)throw new aE(s,e,t);iQ(n.connection,t.inputs[s])}}},iq=function(e,t){if(t.next){if(!e.nextConnection)throw new aE("next",e,t);iQ(e.nextConnection,t.next)}},iQ=function(e,t){t.shadow&&e.setShadowState(t.shadow),t.block&&iW(t.block,e.getSourceBlock().workspace,{parentConnection:e})},i0=function(e,t){if(t)for(let t of(e.setConnectionTracking(!1),e.initSvg(),e.queueRender(),e.getIcons()))t.onLocationChange(e.getRelativeToSurfaceXY());else e.initModel()},i1=function(e){return"function"==typeof e.bubbleIsVisible&&"function"==typeof e.setBubbleVisible&&"function"==typeof e.getBubble},i2=function(e){return e*Math.PI/180},i3=function(e,t,i){if(i<e){let t=i;i=e,e=t}return Math.max(e,Math.min(t,i))},i5=function(){document.querySelector(".blocklyDropDownDiv")||((aM=document.createElement("div")).className="blocklyDropDownDiv",aM.tabIndex=-1,(tu()||document.body).appendChild(aM),(av=document.createElement("div")).className="blocklyDropDownContent",aM.appendChild(av),aJ=eb(av,"keydown",null,tT),(aP=document.createElement("div")).className="blocklyDropDownArrow",aM.appendChild(aP),aM.style.opacity="0",aM.style.transition="transform "+aH+"s, opacity "+aH+"s")},i6=function(e){aY=e},i4=function(){return aX},i8=function(){return av},i9=function(){aJ&&(eO(aJ),aJ=null),aM.remove(),i5()},i7=function(e,t){aM.style.backgroundColor=e,aM.style.borderColor=t},oe=function(e,t,i,o=!0){return az=!0,oo(oi(e),e,o,t,i)},ot=function(e){var t=e.getSvgRoot();let i=e.workspace.scale,o=e.height*i;return e=e.width*i,new lo((t=tC(t)).y,t.y+o,t.x,t.x+e)},oi=function(e){return new lo((e=e.getScaledBBox()).top,e.bottom,e.left,e.right)},oo=function(e,t,i,o,s){let n=e.left+(e.right-e.left)/2,r=e.bottom;e=e.top,s&&(e+=s);let l=(s=t.getSourceBlock()).workspace;for(;l.options.parentWorkspace;)l=l.options.parentWorkspace;return i6(l.getParentSvg().parentNode),os(t,s.RTL,n,r,n,e,i,o)},os=function(e,t,i,o,s,n,r,l){return aX=e,aW=l||null,aM.style.direction=t?"rtl":"ltr",aV=(e=tl()).getRenderer().getClassName(),aK=e.getTheme().getClassName(),eq(aM,aV),eq(aM,aK),i=od(i,o,s,n),r&&(aj=$.getFocusManager$$module$build$src$core$focus_manager().takeEphemeralFocus(aM)),i},on=function(e,t,i,o){return{initialX:(e=ol(e,i.left,i.right,o.width)).divX,initialY:t,finalX:e.divX,finalY:t+aG,arrowX:e.arrowX,arrowY:-(aB/2+ax),arrowAtTop:!0,arrowVisible:!0}},or=function(e,t,i,o){return{initialX:(e=ol(e,i.left,i.right,o.width)).divX,initialY:t-o.height,finalX:e.divX,finalY:t-o.height-aG,arrowX:e.arrowX,arrowY:o.height-2*ax-aB/2,arrowAtTop:!1,arrowVisible:!0}},ol=function(e,t,i,o){return t=i3(t,e-o/2,i-o),e=e-aB/2-t,{arrowX:e=i3(i=aF,e,o-i-aB),divX:t}},oa=function(){return!!aX},oc=function(e,t){return aX===e&&(t?ou():oh(),!0)},oh=function(){aM.style.transform="translate(0, 0)",aM.style.opacity="0",aU=setTimeout(function(){ou()},1e3*aH),aW&&(aW(),aW=null)},ou=function(){oa()&&(aU&&clearTimeout(aU),aW&&(aW(),aW=null),i9(),aX=null,tl().markFocused(),aj&&(aj(),aj=null))},od=function(e,t,i,o){(e=aZ.getPositionMetrics(e,t,i,o)).arrowVisible?(t=e.arrowX,i=e.arrowY,o=e.arrowAtTop?45:225,aP.style.display="",aP.style.transform=`translate(${t}px, ${i}px) rotate(${o}deg)`,aP.setAttribute("class","blocklyDropDownArrow")):aP.style.display="none",t=Math.floor(e.initialX),i=Math.floor(e.initialY),o=Math.floor(e.finalX);let s=Math.floor(e.finalY);return aM.style.left=t+"px",aM.style.top=i+"px",aM.style.display="block",aM.style.opacity="1",aM.style.transform="translate("+(o-t)+"px,"+(s-i)+"px)",!!e.arrowAtTop},op=function(){if(aX){var e=aX.getSourceBlock();let t=(e=az?oi(aX):ot(e)).left+(e.right-e.left)/2;od(t,e.bottom,t,e.top)}else oh()},o_=function(e){return e.length?e.reduce(function(e,t){return e.length<t.length?e:t}).length:0},og=function(e,t){let i;if(!e.length)return 0;if(1===e.length)return e[0].length;let o=0;for(i=0,t=t||o_(e);i<t;i++){for(var s=e[0][i],n=1;n<e.length;n++)if(s!==e[n][i])return o;" "===s&&(o=i+1)}for(s=1;s<e.length;s++)if((n=e[s][i])&&" "!==n)return o;return t},oE=function(e,t){let i;if(!e.length)return 0;if(1===e.length)return e[0].length;let o=0;for(i=0,t=t||o_(e);i<t;i++){for(var s=e[0].substr(-i-1,1),n=1;n<e.length;n++)if(s!==e[n].substr(-i-1,1))return o;" "===s&&(o=i+1)}for(s=1;s<e.length;s++)if((n=e[s].charAt(e[s].length-i-1))&&" "!==n)return o;return t},$.wrap$$module$build$src$core$utils$string=function(e,t){e=e.split("\n");for(let i=0;i<e.length;i++)e[i]=oT(e[i],t);return e.join("\n")},oT=function(e,t){if(e.length<=t)return e;let i=e.trim().split(/\s+/);for(var o=0;o<i.length;o++)i[o].length>t&&(t=i[o].length);var s=-1/0;let n,r=1;do{o=s,n=e,e=[],s=i.length/r;let l=1;for(let t=0;t<i.length-1;t++)l<(t+1.5)/s?(l++,e[t]=!0):e[t]=!1;e=of(i,e,t),s=om(i,e,t),e=oI(i,e),r++}while(s>o)return n},om=function(e,t,i){let o=[0],s=[];for(var n=0;n<e.length;n++)o[o.length-1]+=e[n].length,!0===t[n]?(o.push(0),s.push(e[n].charAt(e[n].length-1))):!1===t[n]&&o[o.length-1]++;for(n=0,e=Math.max(...o),t=0;n<o.length;n++)t-=2*Math.pow(Math.abs(i-o[n]),1.5),t-=Math.pow(e-o[n],1.5),".?!".includes(s[n])?t+=i/3:",;)]}".includes(s[n])&&(t+=i/4);return o.length>1&&o[o.length-1]<=o[o.length-2]&&(t+=.5),t},of=function(e,t,i){let o=om(e,t,i),s;for(let n=0;n<t.length-1;n++){if(t[n]===t[n+1])continue;let r=[].concat(t);r[n]=!r[n],r[n+1]=!r[n+1];let l=om(e,r,i);l>o&&(o=l,s=r)}return s?of(e,s,i):t},oI=function(e,t){let i=[];for(let o=0;o<e.length;o++)i.push(e[o]),void 0!==t[o]&&i.push(t[o]?"\n":" ");return i.join("")},$.isNumber$$module$build$src$core$utils$string=function(e){return/^\s*-?\d+(\.\d+)?\s*$/.test(e)},oS=function(e){if(e=oR(e)){for(e=e.tooltip;"function"==typeof e;)e=e();if("string"!=typeof e)throw Error("Tooltip function must return a string.");return e}return""},oR=function(e){for(;e&&e.tooltip;){if("string"==typeof e.tooltip||"function"==typeof e.tooltip)return e;e=e.tooltip}return null},ob=function(){document.querySelector(".blocklyTooltipDiv")||((cn=document.createElement("div")).className="blocklyTooltipDiv",(tu()||document.body).appendChild(cn))},oC=function(e){e.mouseOverWrapper_=eC(e,"pointerover",null,oA),e.mouseOutWrapper_=eC(e,"pointerout",null,o$),e.addEventListener("pointermove",oN,!1)},oO=function(e){e&&(eO(e.mouseOverWrapper_),eO(e.mouseOutWrapper_),e.removeEventListener("pointermove",oN))},oA=function(e){a2||(e=oR(e.currentTarget),a9!==e&&(oy(),a7=null,a9=e),clearTimeout(a5))},o$=function(e){a2||(a5=setTimeout(function(){a7=a9=null,oy()},1),clearTimeout(a6),a6=0)},oN=function(e){if(a9&&a9.tooltip&&!a2)if(a1){let t=a4-e.pageX;Math.sqrt(t*t+(e=a8-e.pageY)*e)>ci&&oy()}else a7!==a9&&(clearTimeout(a6),a4=e.pageX,a8=e.pageY,a6=setTimeout(oP,co))},oL=function(){a7=a9=null,oy()},oy=function(){a1&&(a1=!1,cn&&(cn.style.display="none")),a6&&(clearTimeout(a6),a6=0)},oD=function(){oy(),a2=!0},ok=function(){a2=!1},ow=function(){cn&&a9&&("function"==typeof a0?a0(cn,a9):oM())},oM=function(){var e=oS(a9);e=(e=$.wrap$$module$build$src$core$utils$string(e,a3)).split("\n");for(let t=0;t<e.length;t++){let i=document.createElement("div");i.appendChild(document.createTextNode(e[t])),cn.appendChild(i)}},ov=function(e){let t=document.documentElement.clientWidth,i=document.documentElement.clientHeight,o=a4;o=e?o-(ce+cn.offsetWidth):o+ce;let s=a8+ct;return s+cn.offsetHeight>i+window.scrollY&&(s-=cn.offsetHeight+2*ct),e?o=Math.max(cs-window.scrollX,o):o+cn.offsetWidth>t+window.scrollX-2*cs&&(o=t-cn.offsetWidth-2*cs),{x:o,y:s}},oP=function(){if(!a2&&(a7=a9,cn)){cn.textContent="",ow();var e=a9.RTL;cn.style.direction=e?"rtl":"ltr",cn.style.display="block",a1=!0;var{x:t,y:i}=ov(e);cn.style.left=t+"px",cn.style.top=i+"px"}},oB=function(){return cl},ox=function(){return ca},oF=function(e){var t=cc[e=`${e}`.toLowerCase().trim()];if(t||(t="#"===(t="0x"===e.substring(0,2)?"#"+e.substring(2):e)[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];var i=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return i&&(e=Number(i[1]),t=Number(i[2]),i=Number(i[3]),e>=0&&e<256&&t>=0&&t<256&&i>=0&&i<256)?oG(e,t,i):null},oG=function(e,t,i){return t=e<<16|t<<8|i,e<16?"#"+(0x1000000|t).toString(16).substr(1):"#"+t.toString(16)},oH=function(e){return(e=oF(e))?[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]:[0,0,0]},oU=function(e,t,i){let o=0,s=0,n=0;if(0===t)n=s=o=i;else{let r=Math.floor(e/60),l=e/60-r;e=i*(1-t);let a=i*(1-t*l);switch(t=i*(1-t*(1-l)),r){case 1:o=a,s=i,n=e;break;case 2:o=e,s=i,n=t;break;case 3:o=e,s=a,n=i;break;case 4:o=t,s=e,n=i;break;case 5:o=i,s=e,n=a;break;case 6:case 0:o=i,s=t,n=e}}return oG(Math.floor(o),Math.floor(s),Math.floor(n))},oW=function(e,t,i){return(e=oF(e))&&(t=oF(t))?(e=oH(e),t=oH(t),oG(Math.round(t[0]+i*(e[0]-t[0])),Math.round(t[1]+i*(e[1]-t[1])),Math.round(t[2]+i*(e[2]-t[2])))):null},oV=function(e){return oU(e,cl,255*ca)},oK=function(e,t,i){let o=[];var s=e.split("");s.push("");var n=0;e=[];let r=null;for(let c=0;c<s.length;c++){var l=s[c];if(0===n)if("%"===l)(n=e.join(""))&&o.push(n),e.length=0,n=1;else if(i&&"\n"===l){let t=e.join("");t&&o.push(t),e.length=0,o.push(l)}else e.push(l);else if(1===n)"%"===l?(e.push(l),n=0):t&&"0"<=l&&l<="9"?(n=2,r=l,(l=e.join(""))&&o.push(l),e.length=0):"{"===l?n=3:(e.push("%",l),n=0);else if(2===n)if("0"<=l&&l<="9")r+=l;else{var a=void 0;o.push(parseInt(null!=(a=r)?a:"",10)),c--,n=0}else 3===n&&(""===l?(e.splice(0,0,"%{"),c--,n=0):"}"!==l?e.push(l):(n=e.join(""),/[A-Z]\w*/i.test(n)&&(l=(l=n.toUpperCase()).startsWith("BKY_")?l.substring(4):null)&&l in $.Msg$$module$build$src$core$msg?"string"==typeof(n=$.Msg$$module$build$src$core$msg[l])?Array.prototype.push.apply(o,oK(n,t,i)):t?o.push(`${n}`):o.push(n):o.push("%{"+n+"}"),n=e.length=0))}for((t=e.join(""))&&o.push(t),a=[],e.length=0,s=0;s<o.length;s++)"string"!=typeof o[s]||i&&"\n"===o[s]?((t=e.join(""))&&a.push(t),e.length=0,a.push(o[s])):e.push(o[s]);return(t=e.join(""))&&a.push(t),e.length=0,a},oY=function(e){return oK(e,!0,!0)},oX=function(e){return"string"!=typeof e?e:(e=oK(e,!1,!1)).length?String(e[0]):""},oz=function(e){let t="string"==typeof e?oX(e):e;var i=Number(t);if(!isNaN(i)&&0<=i&&i<=360)return{hue:i,hex:oU(i,oB(),255*ox())};if(i=oF(t))return{hue:null,hex:i};throw i='Invalid colour: "'+t+'"',e!==t&&(i+=' (from "'+e+'")'),Error(i)},oj=function(){return cg},oJ=function(){let e=tu()||document.body,t=document.querySelector("div."+cf);t?cg=t:((cg=document.createElement("div")).className=cf,cg.tabIndex=-1),eb(cg,"keydown",null,tT),e.appendChild(cg)},oZ=function(e,t,i,o,s=!0){if(oq(),cE=e,cm=i,i=cg){var n,r;if(i.style.direction=t?"rtl":"ltr",i.style.display="block",!o&&e instanceof cd){let t;o=null==(t=e.getSourceBlock())?void 0:t.workspace}cT=null!=(n=o)?n:null,cI=(e=null!=(r=o)?r:tl()).getRenderer().getClassName(),cS=e.getTheme().getClassName(),cI&&eq(i,cI),cS&&eq(i,cS),s&&(cR=$.getFocusManager$$module$build$src$core$focus_manager().takeEphemeralFocus(i))}},oq=function(){if(oQ()){cE=null;var e=cg;e&&(e.style.display="none",e.style.left="",e.style.top="",cm&&(cm(),cm=null),e.textContent="",cI&&(e0(e,cI),cI=""),cS&&(e0(e,cS),cS=""),tl().markFocused(),cR&&(cR(),cR=null))}},oQ=function(){return!!cE},o0=function(e){cE===e&&oq()},o1=function(e){let t=null===cT,i=e;for(;!t&&i;){if(i===e){t=!0;break}i=e.options.parentWorkspace}t&&oq()},o2=function(e,t,i){cg.style.left=e+"px",cg.style.top=t+"px",cg.style.height=i+"px"},o3=function(e,t,i,o){let s=o6(e,t,i);e=o5(e,t,i,o),s<0?o2(e,0,i.height+s):o2(e,s,i.height)},o5=function(e,t,i,o){return o?Math.min(Math.max(t.right-i.width,e.left),e.right-i.width):Math.max(Math.min(t.left,e.right-i.width),e.left)},o6=function(e,t,i){return t.bottom+i.height>=e.bottom?t.top-i.height:t.bottom},o4=function(){var e;!(null==(e=cE)||!e.repositionForWindowResize)&&cE.repositionForWindowResize()||oq()},o8=function(e){cC=e},o9=function(e,t,i,o,s){if(oZ(cO,i,ss,o),t.length){s||(e instanceof PointerEvent?s=new lt(e.clientX,e.clientY):(console.warn("Context menu opened with keyboard but no location given"),s=new lt(0,0)));var n=o7(t,i,e,s);cA=n,se(n,i,s),setTimeout(function(){n.focus()},1),cC=null}else so()},o7=function(e,t,i,o){let s=new lY;s.setRole(lH.MENU);for(let n=0;n<e.length;n++){let r=e[n];if(r.separator){s.addChild(new lX);continue}let l=new lK(r.text);l.setRightToLeft(t),l.setRole(lH.MENUITEM),s.addChild(l),l.setEnabled(r.enabled),r.enabled&&l.onAction(function(e,t){so(),requestAnimationFrame(()=>{setTimeout(()=>{r.callback(r.scope,i,t,o)},0)})},{})}return s},se=function(e,t,i){let o=tD();i=new lo(i.y+o.top,i.y+o.top,i.x+o.left,i.x+o.left),st(e);let s=e.getSize();t&&(i.left+=s.width,i.right+=s.width,o.left+=s.width,o.right+=s.width),o3(o,i,s,t),e.focus()},st=function(e){var t=oj();if(!t)throw Error("Attempting to create a context menu when widget div is null");eq(t=e.render(t),"blocklyContextMenu"),eb(t,"contextmenu",null,si),e.focus()},si=function(e){e.preventDefault(),e.stopPropagation()},so=function(){o0(cO),cC=null},ss=function(){cA&&(cA.dispose(),cA=null)},$.callbackFactory$$module$build$src$core$contextmenu=function(e,t){return()=>{let i;$.disable$$module$build$src$core$events$utils();try{i=t instanceof Element?sT(t,e.workspace):iU(t,e.workspace);let o=e.getRelativeToSurfaceXY();o.x=e.RTL?o.x-$.config$$module$build$src$core$config.snapRadius:o.x+$.config$$module$build$src$core$config.snapRadius,o.y+=2*$.config$$module$build$src$core$config.snapRadius,i.moveBy(o.x,o.y)}finally{$.enable$$module$build$src$core$events$utils()}return eY()&&!i.isShadow()&&eH(new(ej(rL.BLOCK_CREATE))(i)),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(i),i}},sn=function(e,t){return t=eN(t,e.getParentSvg(),e.getInverseScreenCTM()),t.x/=e.scale,t.y/=e.scale,t},sr=function(e,t,i){t=sn(e,t),ck.set(e,lt.difference(i,t))},sl=function(e,t){if(t=sn(e,t),!(e=ck.get(e)))throw Error("Drag not initialized");return lt.sum(e,t)},sa=function(e,t=!1){let i=$.createElement$$module$build$src$core$utils$xml("comment");t||i.setAttribute("id",e.id),t=e.workspace;let o=e.getRelativeToSurfaceXY();return o.x=t.RTL?t.getWidth()-o.x:o.x,i.setAttribute("x",`${o.x}`),i.setAttribute("y",`${o.y}`),i.setAttribute("w",`${e.getSize().width}`),i.setAttribute("h",`${e.getSize().height}`),e.getText()&&(i.textContent=e.getText()),e.isCollapsed()&&i.setAttribute("collapsed","true"),e.isOwnEditable()||i.setAttribute("editable","false"),e.isOwnMovable()||i.setAttribute("movable","false"),e.isOwnDeletable()||i.setAttribute("deletable","false"),i},sc=function(e){let t=$.createElement$$module$build$src$core$utils$xml("variables");for(let i=0;i<e.length;i++){let o=e[i],s=$.createElement$$module$build$src$core$utils$xml("variable");s.appendChild($.createTextNode$$module$build$src$core$utils$xml(o.getName())),o.getType()&&s.setAttribute("type",o.getType()),s.id=o.getId(),t.appendChild(s)}return t},sh=function(e,t){if(e.isInsertionMarker()&&!(e=e.getChildren(!1)[0]))return new DocumentFragment;let i=0;if(e.workspace.RTL&&(i=e.workspace.getWidth()),t=sp(e,t),sL(t)){let o=e.getRelativeToSurfaceXY();t.setAttribute("x",String(Math.round(e.workspace.RTL?i-o.x:o.x))),t.setAttribute("y",String(Math.round(o.y)))}return t},su=function(e){if(e.isSerializable()){let t=$.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name",e.name||""),e.toXml(t)}return null},sd=function(e,t){for(let i of e.getFields())(e=su(i))&&t.appendChild(e)},sp=function(e,t){let i;if(e.isInsertionMarker())return(t=e.getChildren(!1)[0])?sp(t):new DocumentFragment;let o=$.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 s=e.mutationToDom();s&&(s.hasChildNodes()||s.hasAttributes())&&o.appendChild(s)}if(sd(e,o),s=e.getCommentText()){var n=e.getIcon(ab.COMMENT),r=n.getBubbleSize(),l=n.bubbleIsVisible();n=n.getBubbleLocation();var a=$.createElement$$module$build$src$core$utils$xml("comment");a.appendChild($.createTextNode$$module$build$src$core$utils$xml(s)),a.setAttribute("pinned",`${l}`),a.setAttribute("h",`${r.height}`),a.setAttribute("w",`${r.width}`),n&&(a.setAttribute("x",`${e.workspace.RTL?e.workspace.getWidth()-(n.x+r.width):n.x}`),a.setAttribute("y",`${n.y}`)),o.appendChild(a)}for(e.data&&((s=$.createElement$$module$build$src$core$utils$xml("data")).appendChild($.createTextNode$$module$build$src$core$utils$xml(e.data)),o.appendChild(s)),s=0;s<e.inputList.length;s++){r=e.inputList[s];var c=void 0;l=!0,r.type!==$.inputTypes$$module$build$src$core$inputs$input_types.DUMMY&&r.type!==$.inputTypes$$module$build$src$core$inputs$input_types.END_ROW&&(n=r.connection.targetBlock(),r.type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE?c=$.createElement$$module$build$src$core$utils$xml("value"):r.type===$.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT&&(c=$.createElement$$module$build$src$core$utils$xml("statement")),!(a=r.connection.getShadowDom())||n&&n.isShadow()||c.appendChild(s_(a,t)),n&&(n=sp(n,t)).nodeType===ry.ELEMENT_NODE&&(c.appendChild(n),l=!1),c.setAttribute("name",r.name),l||o.appendChild(c))}return void 0!==e.inputsInline&&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"),(c=e.getNextBlock())&&(s=sp(c,t)).nodeType===ry.ELEMENT_NODE&&((i=$.createElement$$module$build$src$core$utils$xml("next")).appendChild(s),o.appendChild(i)),!(e=e.nextConnection&&e.nextConnection.getShadowDom())||c&&c.isShadow()||i.appendChild(s_(e,t)),o},s_=function(e,t){let i=e=e.cloneNode(!0),o;for(;i;)if(t&&"shadow"===i.nodeName&&i.removeAttribute("id"),i.firstChild)i=i.firstChild;else{for(;i&&!i.nextSibling;){let e;o=i,i=i.parentNode,o.nodeType===ry.TEXT_NODE&&""===o.data.trim()&&(null==(e=i)?void 0:e.firstChild)!==o&&e2(o)}i&&(o=i,i=i.nextSibling,o.nodeType===ry.TEXT_NODE&&""===o.data.trim()&&e2(o))}return e},sg=function(e){return tv(e).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},$.domToWorkspace$$module$build$src$core$xml=function(e,t){let i=0;t.RTL&&(i=t.getWidth());let o=[];e6();let s=$.getGroup$$module$build$src$core$events$utils();s||$.setGroup$$module$build$src$core$events$utils(!0),t.setResizesEnabled&&t.setResizesEnabled(!1);let n=!0;try{for(let s=0,r;r=e.childNodes[s];s++){let e=r.nodeName.toLowerCase(),s=r;if("block"!==e&&("shadow"!==e||eG())){if("shadow"===e)throw TypeError("Shadow block cannot be a top-level block.");if("comment"===e)sE(s,t);else if("variables"===e){if(n)sm(s,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.");n=!1}}else{let e,r,l=sT(s,t);o.push(l.id);let a=parseInt(null!=(e=s.getAttribute("x"))?e:"10",10),c=parseInt(null!=(r=s.getAttribute("y"))?r:"10",10);isNaN(a)||isNaN(c)||l.moveBy(t.RTL?i-a:a,c,["create"]),n=!1}}}finally{$.setGroup$$module$build$src$core$events$utils(s),t.setResizesEnabled&&t.setResizesEnabled(!0),t.rendered&&t4(),e4()}return eH(new(ej(rL.FINISHED_LOADING))(t)),o},sE=function(e,t){var i,o,s,n;let r,l,a=null!=(i=e.getAttribute("id"))?i:void 0;return(i=t.rendered?new cW(t,a):new cU(t,a)).setText(null!=(o=e.textContent)?o:""),o=parseInt(null!=(s=e.getAttribute("x"))?s:"",10),s=parseInt(null!=(r=e.getAttribute("y"))?r:"",10),isNaN(o)||isNaN(s)||(o=t.RTL?t.getWidth()-o:o,i.moveTo(new lt(o,s))),t=parseInt(null!=(n=e.getAttribute("w"))?n:"",10),n=parseInt(null!=(l=e.getAttribute("h"))?l:"",10),isNaN(t)||isNaN(n)||i.setSize(new ls(t,n)),"true"===e.getAttribute("collapsed")&&i.setCollapsed(!0),"false"===e.getAttribute("editable")&&i.setEditable(!1),"false"===e.getAttribute("movable")&&i.setMovable(!1),"false"===e.getAttribute("deletable")&&i.setDeletable(!1),i},$.domToBlock$$module$build$src$core$xml=function(e,t){return e=sT(e,t),t.rendered&&t4(),e},sT=function(e,t){let i;$.disable$$module$build$src$core$events$utils();var o=t.getAllVariables();try{if(i=s$(e,t),t.rendered){let e=i,o=i.getDescendants(!1);e.setConnectionTracking(!1);for(let e=o.length-1;e>=0;e--)o[e].initSvg();for(let e=o.length-1;e>=0;e--)o[e].queueRender();setTimeout(function(){e.disposed||e.setConnectionTracking(!0)},1),t.resizeContents()}else{let e=i.getDescendants(!1);for(let t=e.length-1;t>=0;t--)e[t].initModel()}}finally{$.enable$$module$build$src$core$events$utils()}if(eY()){for(e=iL(t,o),t=0;t<e.length;t++)o=e[t],eH(new(ej(rL.VAR_CREATE))(o));eH(new(ej(rL.BLOCK_CREATE))(i))}return i},sm=function(e,t){for(let o=0;o<e.children.length;o++){var i=e.children[o];let s=i.getAttribute("type"),n=i.getAttribute("id");if(!(i=i.textContent))break;t.getVariableMap().createVariable(i,null!=s?s:void 0,n)}},sf=function(e){let t={mutation:[],comment:[],data:[],field:[],input:[],next:[]};for(let i=0;i<e.children.length;i++){let o=e.children[i];if(o.nodeType!==ry.TEXT_NODE)switch(o.nodeName.toLowerCase()){case"mutation":t.mutation.push(o);break;case"comment":t.comment.push(o);break;case"data":t.data.push(o);break;case"title":case"field":t.field.push(o);break;case"value":case"statement":t.input.push(o);break;case"next":t.next.push(o);break;default:console.warn("Ignoring unknown tag: "+o.nodeName)}}return t},sI=function(e,t){let i=!1;for(let o=0;o<e.length;o++){let s=e[o];t.domToMutation&&(t.domToMutation(s),t.initSvg&&(i=!0))}return i},sS=function(e,t){for(let i=0;i<e.length;i++){let o,s,n=e[i],r=n.textContent,l="true"===n.getAttribute("pinned"),a=parseInt(null!=(o=n.getAttribute("w"))?o:"50",10),c=parseInt(null!=(s=n.getAttribute("h"))?s:"50",10),h,u=parseInt(null!=(h=n.getAttribute("x"))?h:"",10),d,p=parseInt(null!=(d=n.getAttribute("y"))?d:"",10);t.setCommentText(r);let _=t.getIcon(ab.COMMENT);isNaN(a)||isNaN(c)||_.setBubbleSize(new ls(a,c)),_.setBubbleVisible(l),setTimeout(()=>{isNaN(u)||isNaN(p)||(u=t.workspace.RTL?t.workspace.getWidth()-(u+a):u,_.setBubbleLocation(new lt(u,p))),_.setBubbleVisible(l)},1)}},sR=function(e,t){for(let i=0;i<e.length;i++)t.data=e[i].textContent},sb=function(e,t){for(let i=0;i<e.length;i++){let o=e[i],s=o.getAttribute("name");s?sN(t,s,o):console.warn(`Ignoring unnamed field in block ${t.type}`)}},sC=function(e){let t=null,i=null;for(let o=0;o<e.childNodes.length;o++){let s=e.childNodes[o];sL(s)&&("block"===s.nodeName.toLowerCase()?t=s:"shadow"===s.nodeName.toLowerCase()&&(i=s))}return{childBlockElement:t,childShadowElement:i}},sO=function(e,t,i,o){for(let n=0;n<e.length;n++){var s=e[n];let r=s.getAttribute("name"),l=r?i.getInput(r):null;if(!l){console.warn("Ignoring non-existent input "+r+" in block "+o);break}if((s=sC(s)).childBlockElement){if(!l.connection)throw TypeError("Input connection does not exist.");s$(s.childBlockElement,t,l.connection,!1)}if(s.childShadowElement){let e;null==(e=l.connection)||e.setShadowDom(s.childShadowElement)}}},sA=function(e,t,i){for(let o=0;o<e.length;o++){let s=sC(e[o]);if(s.childBlockElement){if(!i.nextConnection)throw TypeError("Next statement does not exist.");if(i.nextConnection.isConnected())throw TypeError("Next statement is already connected.");s$(s.childBlockElement,t,i.nextConnection,!0)}s.childShadowElement&&i.nextConnection&&i.nextConnection.setShadowDom(s.childShadowElement)}},s$=function(e,t,i,o){let s=e.getAttribute("type");if(!s)throw TypeError("Block type unspecified: "+e.outerHTML);var n,r=null!=(n=e.getAttribute("id"))?n:void 0;n=t.newBlock(s,r);let l=sI((r=sf(e)).mutation,n);if(sS(r.comment,n),sR(r.data,n),i)if(o)if(n.previousConnection)i.connect(n.previousConnection);else throw TypeError("Next block does not have previous statement.");else if(n.outputConnection)i.connect(n.outputConnection);else if(n.previousConnection)i.connect(n.previousConnection);else throw TypeError("Child block does not have output or previous statement.");if(sb(r.field,n),sO(r.input,t,n,s),sA(r.next,t,n),l&&n.initSvg(),(t=e.getAttribute("inline"))&&n.setInputsInline("true"===t),(t=e.getAttribute("disabled"))&&n.setDisabledReason("true"===t||"disabled"===t,lJ),null!==(t=e.getAttribute("disabled-reasons")))for(var a of t.split(","))n.setDisabledReason(!0,decodeURIComponent(a));if((a=e.getAttribute("deletable"))&&n.setDeletable("true"===a),(a=e.getAttribute("movable"))&&n.setMovable("true"===a),(a=e.getAttribute("editable"))&&n.setEditable("true"===a),(a=e.getAttribute("collapsed"))&&n.setCollapsed("true"===a),"shadow"===e.nodeName.toLowerCase()){for(a=0,e=n.getChildren(!1);a<e.length;a++)if(!e[a].isShadow())throw TypeError("Shadow block not allowed non-shadow child.");n.setShadow(!0)}return n},sN=function(e,t,i){let o=e.getField(t);o?o.fromXml(i):console.warn("Ignoring non-existent field "+t+" in block "+e.type)},sL=function(e){return e.nodeType===ry.ELEMENT_NODE},sy=function(e,t){ea(D.FIELD,e,t)},$.fromJson$$module$build$src$core$field_registry=function(e){return cq.fromJsonInternal(e)},sD=function(e){return e&&"object"==typeof e&&"src"in e&&"string"==typeof e.src&&"alt"in e&&"string"==typeof e.alt&&"width"in e&&"number"==typeof e.width&&"height"in e&&"number"==typeof e.height},$.register$$module$build$src$core$extensions=function(e,t){if("string"!=typeof e||""===e.trim())throw Error('Error: Invalid extension name "'+e+'"');if(ho[e])throw Error('Error: Extension "'+e+'" is already registered.');if("function"!=typeof t)throw Error('Error: Extension "'+e+'" must be a function');ho[e]=t},$.registerMixin$$module$build$src$core$extensions=function(e,t){if(!t||"object"!=typeof t)throw Error('Error: Mixin "'+e+'" must be a object');$.register$$module$build$src$core$extensions(e,function(){this.mixin(t)})},$.registerMutator$$module$build$src$core$extensions=function(e,t,i,o){let s='Error when registering mutator "'+e+'": ';sB(s,t);let n=sv(t,s);if(i&&"function"!=typeof i)throw Error(s+'Extension "'+e+'" is not a function');$.register$$module$build$src$core$extensions(e,function(){n&&this.setMutator(new $.MutatorIcon$$module$build$src$core$icons$mutator_icon(o||[],this)),this.mixin(t),i&&i.apply(this)})},sk=function(e){return!!ho[e]},sw=function(e,t,i){let o,s=ho[e];if("function"!=typeof s)throw Error('Error: Extension "'+e+'" not found.');if(i?sM(e,t):o=sx(t),s.apply(t),i)sB('Error after applying mutator "'+e+'": ',t);else if(!sF(o,t))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},sM=function(e,t){if(sx(t).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+t.id)},sv=function(e,t){return sP(e.compose,e.decompose,t+" compose/decompose")},sP=function(e,t,i){if(e&&t){if("function"!=typeof e||"function"!=typeof t)throw Error(i+" must be a function");return!0}if(!e&&!t)return!1;throw Error(i+"Must have both or neither functions")},sB=function(e,t){let i=sP(t.mutationToDom,t.domToMutation,e+" mutationToDom/domToMutation"),o=sP(t.saveExtraState,t.loadExtraState,e+" saveExtraState/loadExtraState");if(!i&&!o)throw Error(e+"Mutations must contain either XML hooks, or JSON hooks, or both");sv(t,e)},sx=function(e){let t=[];return void 0!==e.domToMutation&&t.push(e.domToMutation),void 0!==e.mutationToDom&&t.push(e.mutationToDom),void 0!==e.saveExtraState&&t.push(e.saveExtraState),void 0!==e.loadExtraState&&t.push(e.loadExtraState),void 0!==e.compose&&t.push(e.compose),void 0!==e.decompose&&t.push(e.decompose),t},sF=function(e,t){if((t=sx(t)).length!==e.length)return!1;for(let i=0;i<t.length;i++)if(e[i]!==t[i])return!1;return!0},$.buildTooltipForDropdown$$module$build$src$core$extensions=function(e,t){let i=[];return function(){i.includes(this.type)||(sG(this,e,t),i.push(this.type)),this.setTooltip((function(){return oX(t[String(this.getFieldValue(e))])}).bind(this))}},sG=function(e,t,i){var o=e.getField(t);if(o instanceof c0&&!o.isOptionListDynamic())for(let s of o=o.getOptions())s!==c0.SEPARATOR&&([,o]=s,void 0===i[o]&&console.warn(`No tooltip mapping for value ${o} of field ${t} of block type ${e.type}.`))},$.buildTooltipWithFieldText$$module$build$src$core$extensions=function(e,t){return function(){this.setTooltip((function(){let i=this.getField(t);return oX(e).replace("%1",i?i.getText():"")}).bind(this))}},sH=function(e,t){return" "+e+","+t+" "},sU=function(e,t){return" "+e+t.join("")},sW=function(e,t){return" M "+e+","+t+" "},sV=function(e,t){return" m "+e+","+t+" "},sK=function(e,t){return" l "+e+","+t+" "},sY=function(e){return" l"+e.join("")},sX=function(e,t){return" "+e+" "+t+" "},sz=function(e,t,i,o){return e+" "+i+" "+i+" "+t+o},sj=function(e,t){if(!e||!t)throw Error("Cannot connect null connections.");e.targetConnection=t,t.targetConnection=e},sJ=function(e,t){let i=null,o=null==(t=t.outputConnection)?void 0:t.getConnectionChecker();for(let s=0,n;n=e.inputList[s];s++){let e=n.connection;if(e&&(null==o?0:o.canConnect(t,e,!1))){if(i)return null;i=e}}return i},sZ=function(e,t){let i;for(;i=sJ(e,t);)if(!(e=i.targetBlock())||e.isShadow())return i;return null},sq=function(e){return te(e)&&"function"==typeof e.getType&&"function"==typeof e.initView&&"function"==typeof e.dispose&&"function"==typeof e.getWeight&&"function"==typeof e.getSize&&"function"==typeof e.applyColour&&"function"==typeof e.hideForInsertionMarker&&"function"==typeof e.updateEditable&&"function"==typeof e.updateCollapsed&&"function"==typeof e.isShownWhenCollapsed&&"function"==typeof e.setOffsetInBlock&&"function"==typeof e.onLocationChange&&"function"==typeof e.onClick},sQ=function(e){if(!(e.getDescendants(!1).length>100)){var t,i=e.workspace,o=e.getSvgRoot();i.getAudioManager().play("delete");var s=e.getRelativeToSurfaceXY(),n=o.cloneNode(!0);n.setAttribute("transform","translate("+s.x+","+s.y+")"),null==(t=i.getLayerManager())||t.appendToAnimationLayer({getSvgRoot:()=>n}),s0(n,{x:s.x,y:s.y,width:e.width,height:e.height},i.RTL,new Date)}},s0=function(e,t,i,o){let s=((new Date).getTime()-o.getTime())/150;s>1?e2(e):(e.setAttribute("transform","translate("+(t.x+(i?-1:1)*t.width/2*s)+","+(t.y+t.height/2*s)+") scale("+(1-s)+")"),setTimeout(s0,10,e,t,i,o))},s1=function(e){var t=e.workspace;let i=t.scale;if(t.getAudioManager().play("click"),!(i<1)){var o=t.getSvgXY(e.getSvgRoot());e.outputConnection?(o.x+=(e.RTL?3:-3)*i,o.y+=13*i):e.previousConnection&&(o.x+=(e.RTL?-23:23)*i,o.y+=3*i);var s=eZ(li.CIRCLE,{cx:o.x,cy:o.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg());e=eZ(li.ANIMATE,{id:"animationCircle",begin:"indefinite",attributeName:"r",dur:"150ms",from:0,to:25*i},s),t=eZ(li.ANIMATE,{id:"animationOpacity",begin:"indefinite",attributeName:"opacity",dur:"150ms",from:1,to:0},s),e.beginElement(),t.beginElement(),setTimeout(()=>void e2(s),150)}},s2=function(e){if(s5(),e.workspace.getAudioManager().play("disconnect"),!(e.workspace.scale<1)){var t=e.getHeightWidth().height;t=Math.atan(10/t)/Math.PI*180,e.RTL||(t*=-1),hb=e,s3(e,t,new Date,0)}},s3=function(e,t,i,o){let s=[.66,1,.66,0,-.66,-1,-.66,0],n="";i.getTime()+200>(new Date).getTime()&&(n=`skewX(${Math.round(s[o%s.length]*t)})`,hR=setTimeout(s3,15,e,t,i,o+1)),e.getSvgRoot().setAttribute("transform",`${e.getTranslation()} ${n}`)},s5=function(){hb&&(hR&&(clearTimeout(hR),hR=null),hb.getSvgRoot().setAttribute("transform",hb.getTranslation()),hb=null)},s6=function(e,t){let i=e.workspace,o=$.config$$module$build$src$core$config.snapRadius,s=lt.difference(t,e.getRelativeToSurfaceXY()),n=new lt(0,0),r=i.getAllBlocks(!1).filter(t=>t.id!=e.id).map(e=>e.getRelativeToSurfaceXY());for(;s4(lt.sum(t,n),r)||s8(e,lt.sum(s,n),o);)i.RTL?n.translate(-o,2*o):n.translate(o,2*o);e.moveTo(lt.sum(t,n))},s4=function(e,t){return t.some(t=>1>=Math.abs(t.x-e.x)&&1>=Math.abs(t.y-e.y))},s8=function(e,t,i){return e.getConnections_(!1).some(e=>!!e.closest(i,t).connection)},s9=function(e,t,i){let o=i.getBoundingRectangle(),s=o.right-o.left,n=i3(t.top,o.top,t.top+t.height-(o.bottom-o.top))-o.top,r=t.left;return t=t.left+t.width-s,e.RTL?r=Math.min(t,r):t=Math.max(r,t),(!!(e=i3(r,o.left,t)-o.left)||!!n)&&(i.moveBy(e,n,["inbounds"]),!0)},s7=function(e){return t=>{var i,o=e.getMetricsManager();if(o.hasFixedEdges()&&!e.isDragging())if(z.includes(null!=(i=t.type)?i:"")){i=o.getScrollMetrics(!0);let s=ne(e,t);s&&(o=$.getGroup$$module$build$src$core$events$utils()||!1,$.setGroup$$module$build$src$core$events$utils(t.group),s9(e,i,s)&&!t.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),$.setGroup$$module$build$src$core$events$utils(o))}else eF(t)&&t.scale&&t.oldScale&&t.scale>t.oldScale&&nt(e)}},ne=function(e,t){let i=null;switch(t.type){case rL.BLOCK_CREATE:case rL.BLOCK_MOVE:(i=e.getBlockById(t.blockId))&&(i=i.getRootBlock());break;case rL.COMMENT_CREATE:case rL.COMMENT_MOVE:case rL.COMMENT_RESIZE:i=e.getCommentById(t.commentId)}return i},nt=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var i=e.getTopBoundedElements();for(let o=0,s;s=i[o];o++)s9(e,t,s)}},ni=function(e){return e&&"function"==typeof e.isDeletable&&"function"==typeof e.dispose&&"function"==typeof e.setDeleteStyle},no=function(e,t){let i=e.getIcons();for(let o of e.inputList){let s;if(o.isVisible())if(i.push(...o.fieldRow),null==(s=o.connection)?0:s.targetBlock())if(e=o.connection.targetBlock(),o.connection.type!==c5.NEXT_STATEMENT||t)i.push(e);else{let t;(e=null==(t=e.lastConnectionInStack(!1))?void 0:t.getSourceBlock())&&i.push(e)}else{let e;(null==(e=o.connection)?void 0:e.type)===c5.INPUT_VALUE&&i.push(o.connection)}}return i},ns=function(e,t){let i=e.workspace.getTopBoundedElements(!0).filter(e=>te(e));e=i.indexOf(e instanceof hD?e.getRootBlock():e)+t;let o=null;if(e>=0&&e<i.length?o=i[e]:e<0?o=i[i.length-1]:e>=i.length&&(o=i[0]),t<0&&o instanceof hD){let e,t;return null!=(t=null==(e=o.lastConnectionInStack(!1))?void 0:e.getSourceBlock())?t:o}return o},nn=function(e,t){var i;let o,s=e instanceof hD?null!=(o=null==(i=e.outputConnection)?void 0:i.targetBlock())?o:e.getSurroundParent():e.getSourceBlock();return s instanceof hD&&-1!==(e=(i=no(s,t>0)).indexOf(e))&&(t=e+t)>=0&&t<i.length?i[t]:null},nr=function(e){return e&&"function"==typeof e.getRelativeToSurfaceXY&&"function"==typeof e.isMovable&&"function"==typeof e.startDrag&&"function"==typeof e.drag&&"function"==typeof e.endDrag&&"function"==typeof e.revertDrag},nl=function(e){return e&&"function"==typeof e.autoHide},na=function(e,t){ea(D.ICON,e.toString(),t)},nc=function(e){return"function"==typeof e.getProcedureModel&&"function"==typeof e.doProcedureUpdate&&"function"==typeof e.isProcedureDef},nh=function(e){return e&&"function"==typeof e.startPublishing&&"function"==typeof e.stopPublishing},nu=function(e){let t=e.getProcedureMap().getProcedures().filter(e=>!e.getReturnTypes()).map(e=>[e.getName(),e.getParameters().map(e=>e.getName()),!1]);e.getBlocksByType("procedures_defnoreturn",!1).forEach(e=>{!nc(e)&&il(e)&&t.push(e.getProcedureDef())});let i=e.getProcedureMap().getProcedures().filter(e=>!!e.getReturnTypes()).map(e=>[e.getName(),e.getParameters().map(e=>e.getName()),!0]);return e.getBlocksByType("procedures_defreturn",!1).forEach(e=>{!nc(e)&&il(e)&&i.push(e.getProcedureDef())}),t.sort(nd),i.sort(nd),[t,i]},nd=function(e,t){return e[0].localeCompare(t[0],void 0,{sensitivity:"base"})},$.findLegalName$$module$build$src$core$procedures=function(e,t){if(t.isInFlyout)return e;for(e=e||$.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!np(e,t.workspace,t);){let t=e.match(/^(.*?)(\d+)$/);e=t?t[1]+(parseInt(t[2])+1):e+"2"}return e},np=function(e,t,i){return!n_(e,t,i)},n_=function(e,t,i){for(let o of t.getAllBlocks(!1))if(o!==i&&il(o)&&$.Names$$module$build$src$core$names.equals(o.getProcedureDef()[0],e))return!0;for(let o of(i=i&&nc(i)?null==i?void 0:i.getProcedureModel():void 0,t.getProcedureMap().getProcedures()))if(o!==i&&$.Names$$module$build$src$core$names.equals(o.getName(),e))return!0;return!1},$.rename$$module$build$src$core$procedures=function(e){var t=this.getSourceBlock();if(!t)throw new cp;e=e.trim();let i=$.findLegalName$$module$build$src$core$procedures(e,t);nc(t)&&!t.isInsertionMarker()&&t.getProcedureModel().setName(i);let o=this.getValue();if(o!==e&&o!==i)for(e=t.workspace.getAllBlocks(!1),t=0;t<e.length;t++){let s=e[t];s.renameProcedure&&s.renameProcedure(o,i)}return i},ng=function(e){function t(e,t){for(let s=0;s<e.length;s++){var o=e[s][0];let n=e[s][1],r=$.createElement$$module$build$src$core$utils$xml("block");r.setAttribute("type",t),r.setAttribute("gap","16");let l=$.createElement$$module$build$src$core$utils$xml("mutation");for(l.setAttribute("name",o),r.appendChild(l),o=0;o<n.length;o++){let e=$.createElement$$module$build$src$core$utils$xml("arg");e.setAttribute("name",n[o]),l.appendChild(e)}i.push(r)}}let i=[];if(w.procedures_defnoreturn){var o=$.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","procedures_defnoreturn"),o.setAttribute("gap","16");var s=$.createElement$$module$build$src$core$utils$xml("field");s.setAttribute("name","NAME"),s.appendChild($.createTextNode$$module$build$src$core$utils$xml($.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE)),o.appendChild(s),i.push(o)}return w.procedures_defreturn&&((o=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","procedures_defreturn"),o.setAttribute("gap","16"),(s=$.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name","NAME"),s.appendChild($.createTextNode$$module$build$src$core$utils$xml($.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),o.appendChild(s),i.push(o)),w.procedures_ifreturn&&((o=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","procedures_ifreturn"),o.setAttribute("gap","16"),i.push(o)),i.length&&i[i.length-1].setAttribute("gap","24"),t((e=nu(e))[0],"procedures_callnoreturn"),t(e[1],"procedures_callreturn"),i},nE=function(e){return nT(e,!1)},nT=function(e,t=!0){function i(e,t){for(let[i,s]of e)o.push({kind:"block",type:t,gap:16,extraState:{name:i,params:s}})}if(t)return ih("The XML return value of Blockly.Procedures.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),ng(e);let o=[];return w.procedures_defnoreturn&&o.push({kind:"block",type:"procedures_defnoreturn",gap:16,fields:{NAME:$.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE}}),w.procedures_defreturn&&o.push({kind:"block",type:"procedures_defreturn",gap:16,fields:{NAME:$.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE}}),w.procedures_ifreturn&&o.push({kind:"block",type:"procedures_ifreturn",gap:16}),o.length&&(o[o.length-1].gap=24),i((e=nu(e))[0],"procedures_callnoreturn"),i(e[1],"procedures_callreturn"),o},nm=function(e){var t=[],i=e.getBlocksByType("procedures_mutatorarg",!1);for(let e=0,o;o=i[e];e++)t.push(o.getFieldValue("NAME"));i=$.createElement$$module$build$src$core$utils$xml("xml");let o=$.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","procedures_mutatorarg");let s=$.createElement$$module$build$src$core$utils$xml("field");s.setAttribute("name","NAME"),t=im($.DEFAULT_ARG$$module$build$src$core$procedures,t),t=$.createTextNode$$module$build$src$core$utils$xml(t),s.appendChild(t),o.appendChild(s),i.appendChild(o),e.updateToolbox(i)},nf=function(e){if(ex(e)&&"mutator"===e.bubbleType&&e.isOpen&&e.blockId){var t=(e=to(e.workspaceId).getBlockById(e.blockId)).type;("procedures_defnoreturn"===t||"procedures_defreturn"===t)&&(nm(e=e.getIcon($.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE).getWorkspace()),e.addChangeListener(nI))}},nI=function(e){(ek(e)||ew(e)||eM(e)||ev(e))&&nm(e=to(e.workspaceId))},nS=function(e,t){return t.getAllBlocks(!1).filter(t=>nR(t,e)||ia(t)&&$.Names$$module$build$src$core$names.equals(t.getProcedureCall(),e))},nR=function(e,t){return nc(e)&&!e.isProcedureDef()&&e.getProcedureModel()&&$.Names$$module$build$src$core$names.equals(e.getProcedureModel().getName(),t)},$.mutateCallers$$module$build$src$core$procedures=function(e){let t=eG();var i=e.getProcedureDef()[0];let o=e.mutationToDom(!0);e=nS(i,e.workspace);for(let n=0,r;r=e[n];n++){i=(i=r.mutationToDom())&&tv(i),r.domToMutation&&r.domToMutation(o);var s=r.mutationToDom();i!==(s=s&&tv(s))&&($.setRecordUndo$$module$build$src$core$events$utils(!1),eH(new(ej(rL.BLOCK_CHANGE))(r,"mutation",null,i,s)),$.setRecordUndo$$module$build$src$core$events$utils(t))}},$.getDefinition$$module$build$src$core$procedures=function(e,t){for(let i of t.getAllBlocks(!1))if(nc(i)&&i.isProcedureDef()&&$.Names$$module$build$src$core$names.equals(i.getProcedureModel().getName(),e)||il(i)&&$.Names$$module$build$src$core$names.equals(i.getProcedureDef()[0],e))return i;return null},nb=function(e){return e.isDynamic},nC=function(e){return void 0!==e.pathDown&&void 0!==e.pathUp},nO=function(e){return void 0!==e.pathLeft&&void 0!==e.pathRight},nA=function(e,t){ea(D.RENDERER,e,t)},n$=function(e,t,i){return(e=new(ep(D.RENDERER,e))(e)).init(t,i),e},nN=function(e){iI(e.getTargetWorkspace(),void 0,"String")},nL=function(e){iI(e.getTargetWorkspace(),void 0,"Number")},ny=function(e){iI(e.getTargetWorkspace(),void 0,"Colour")},nD=function(e){return nk(e,!1)},nk=function(e,t=!0){return(w.variables_set_dynamic||w.variables_get_dynamic||console.warn("There are no dynamic variable blocks, but there is a dynamic variable category."),t)?(ih("The XML return value of Blockly.VariablesDynamic.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),nw(e)):(e.registerButtonCallback("CREATE_VARIABLE_STRING",nN),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",nL),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",ny),[{kind:"button",text:$.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE,callbackkey:"CREATE_VARIABLE_STRING"},{kind:"button",text:$.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE,callbackkey:"CREATE_VARIABLE_NUMBER"},{kind:"button",text:$.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE,callbackkey:"CREATE_VARIABLE_COLOUR"},...i_(e,e.getVariableMap().getAllVariables(),!1,"variables_get_dynamic","variables_set_dynamic")])},nw=function(e){let t=[],i=document.createElement("button");return i.setAttribute("text",$.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),t.push(i),(i=document.createElement("button")).setAttribute("text",$.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),t.push(i),(i=document.createElement("button")).setAttribute("text",$.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),t.push(i),e.registerButtonCallback("CREATE_VARIABLE_STRING",nN),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",nL),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",ny),t.concat(e=nM(e))},nM=function(e){e=e.getVariableMap().getAllVariables();let t=[];if(e.length>0){if(w.variables_set_dynamic){var i=e[e.length-1];let o=$.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","variables_set_dynamic"),o.setAttribute("gap","24"),o.appendChild(i$(i)),t.push(o)}if(w.variables_get_dynamic){e.sort(iy);for(let o=0,s;s=e[o];o++)(i=$.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get_dynamic"),i.setAttribute("gap","8"),i.appendChild(i$(s)),t.push(i)}}return t},nv=function(e,t){let i=e.toCopyData();return dt=i,di=tt(e)&&e.workspace instanceof uH?e.workspace:null,ds=t,i},nP=function(){return dt},nB=function(){return di},nx=function(){return ds},nF=function(e,t,i){return e&&t?nG(e,t,i):dt&&di?nG(dt,di,ds):null},nG=function(e,t,i){let o,s,n;return t=t.isMutator?t:null!=(o=t.options.parentWorkspace)?o:t,null!=(n=null==(s=e_(D.PASTER,e.paster,!1))?void 0:s.paste(e,t,i))?n:null},nH=function(e){return e&&"function"==typeof e.toCopyData},nU=function(){rW.registry.register({name:dz.ESCAPE,preconditionFn:e=>!e.isReadOnly(),callback:e=>(e.hideChaff(),!0),keyCodes:[dK.ESC]})},nW=function(){rW.registry.register({name:dz.DELETE,preconditionFn:(e,t)=>(t=t.focusedNode,!e.isReadOnly()&&null!=t&&ni(t)&&t.isDeletable()&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()),callback:(e,t,i,o)=>(t.preventDefault(),(e=o.focusedNode)instanceof hD?e.checkAndDelete():ni(e)&&e.isDeletable()&&($.setGroup$$module$build$src$core$events$utils(!0),e.dispose(),$.setGroup$$module$build$src$core$events$utils(!1)),!0),keyCodes:[dK.DELETE,dK.BACKSPACE]})},nV=function(e){return!!(nH(e)&&ni(e)&&nr(e))&&(e.isCopyable?e.isCopyable():e instanceof hD||e instanceof cW?e.isOwnDeletable()&&e.isOwnMovable():e.isDeletable()&&e.isMovable())},nK=function(e){return nV(e)&&ni(e)&&e.isDeletable()},nY=function(){let e=rW.registry.createSerializedKey(dK.C,[dK.CTRL]),t=rW.registry.createSerializedKey(dK.C,[dK.META]);rW.registry.register({name:dz.COPY,preconditionFn:(e,t)=>(t=t.focusedNode,e=e.isFlyout?e.targetWorkspace:e,!!t&&!!e&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()&&nV(t)),callback:(e,t,i,o)=>(t.preventDefault(),!!(t=o.focusedNode)&&!!nH(t)&&!!nV(t)&&!!(e=e.isFlyout?e.targetWorkspace:e)&&(t.workspace.isFlyout||e.hideChaff(),e=nr(t)&&t.workspace==e?t.getRelativeToSurfaceXY():void 0,!!nv(t,e))),keyCodes:[e,t]})},nX=function(){let e=rW.registry.createSerializedKey(dK.X,[dK.CTRL]),t=rW.registry.createSerializedKey(dK.X,[dK.META]);rW.registry.register({name:dz.CUT,preconditionFn:(e,t)=>!!(t=t.focusedNode)&&!e.isReadOnly()&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()&&nK(t),callback:(e,t,i,o)=>!!(e=o.focusedNode)&&!!nK(e)&&!!nH(e)&&(t=nr(e)?e.getRelativeToSurfaceXY():void 0,t=nv(e,t),e instanceof hD?e.checkAndDelete():ni(e)&&e.dispose(),!!t),keyCodes:[e,t]})},nz=function(){let e=rW.registry.createSerializedKey(dK.V,[dK.CTRL]),t=rW.registry.createSerializedKey(dK.V,[dK.META]);rW.registry.register({name:dz.PASTE,preconditionFn(){var e=nB();return!!e&&!!e.rendered&&(e=e.isFlyout?e.targetWorkspace:e,!!nP()&&!!e&&!e.isReadOnly()&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken())},callback(e,t){if(!(e=nP()))return!1;var i=nB();if(!i||!(i=i.isFlyout?i.targetWorkspace:i)||i.isReadOnly())return!1;if(t instanceof PointerEvent)return t=tw(i,new lt(t.clientX,t.clientY)),!!nF(e,i,t);if(!(t=nx()))return!!nF(e,i);let{left:o,top:s,width:n,height:r}=i.getMetricsManager().getViewMetrics(!0);return new lo(s,s+r,o,o+n).contains(t.x,t.y)?!!nF(e,i):(t=new lt(o+n/2,s+r/2),!!nF(e,i,t))},keyCodes:[e,t]})},nj=function(){let e=rW.registry.createSerializedKey(dK.Z,[dK.CTRL]),t=rW.registry.createSerializedKey(dK.Z,[dK.META]);rW.registry.register({name:dz.UNDO,preconditionFn:e=>!e.isReadOnly()&&!e.isDragging()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken(),callback:(e,t)=>(e.hideChaff(),e.undo(!1),t.preventDefault(),!0),keyCodes:[e,t]})},nJ=function(){let e=rW.registry.createSerializedKey(dK.Z,[dK.CTRL,dK.SHIFT]),t=rW.registry.createSerializedKey(dK.Z,[dK.META,dK.SHIFT]),i=rW.registry.createSerializedKey(dK.Y,[dK.CTRL]);rW.registry.register({name:dz.REDO,preconditionFn:e=>!e.isDragging()&&!e.isReadOnly()&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken(),callback:(e,t)=>(e.hideChaff(),e.undo(!0),t.preventDefault(),!0),keyCodes:[e,t,i]})},nZ=function(){nU(),nW(),nY(),nX(),nz(),nj(),nJ()},nq=function(e){let t=e.saveState();return e.getParameters().length&&(t.parameters=e.getParameters().map(e=>e.saveState())),t},nQ=function(e,t,i,o){if(e=e.loadState(i,o),!i.parameters)return e;for(let[s,n]of i.parameters.entries())e.insertParameter(t.loadState(n,o),s);return e},n0=function(e,t){e.setAttribute("dir","LTR"),tI(t.hasCss,t.pathToMedia);let i=eZ(li.SVG,{xmlns:rD,"xmlns:html":rk,"xmlns:xlink":rw,version:"1.1",class:"blocklySvg"},e),o=eZ(li.DEFS,{},i),s=String(Math.random()).substring(2);return t.gridPattern=h4.createDom(s,t.gridOptions,o,e),i},n1=function(e,t,i){i.parentWorkspace=null;let o=(i=new uH(i)).options;i.scale=o.zoomOptions.startScale,t.appendChild(i.createDom("blocklyMainBackground",e));var s=i.getRenderer().getClassName();return s&&eq(e,s),(s=i.getTheme().getClassName())&&eq(e,s),!o.hasCategories&&o.languageTree&&e3(e=i.addFlyout(li.SVG),t),o.hasTrashcan&&i.addTrashcan(),o.zoomOptions&&o.zoomOptions.controls&&i.addZoomControls(),i.getThemeManager().subscribe(t,"workspaceBackgroundColour","background-color"),i.translate(0,0),i.addChangeListener(s7(i)),tp(i),oJ(),i5(),ob(),i},n2=function(e){let t=e.options;var i=e.getParentSvg();if(eb(i.parentNode,"contextmenu",null,function(e){eA(e)||e.preventDefault()}),i=eb(window,"resize",null,function(){oy(),e.hideComponents(!0),op(),o4(),tp(e),nt(e)}),e.setResizeHandlerWrapper(i),n3(),t.languageTree){i=e.getToolbox();let o=e.getFlyout(!0);i?i.init():o&&(o.init(e),o.show(t.languageTree),"function"==typeof o.scrollToStart&&o.scrollToStart())}t.hasTrashcan&&e.trashcan.init(),t.zoomOptions&&t.zoomOptions.controls&&e.zoomControls_.init(),t.moveOptions&&t.moveOptions.scrollbars?(e.scrollbar=new hq(e,!0===t.moveOptions.scrollbars||!!t.moveOptions.scrollbars.horizontal,!0===t.moveOptions.scrollbars||!!t.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),e.scrollbar.resize()):e.setMetrics({x:.5,y:.5}),t.hasSounds&&n5(t.pathToMedia,e)},n3=function(){dN||(eb(document,"scroll",null,function(){let e=ts();for(let t=0,i;i=e[t];t++)i instanceof uH&&i.updateInverseScreenCTM()}),eC(document,"touchend",null,em),eC(document,"touchcancel",null,em)),dN=!0},n5=function(e,t){function i(){for(;s.length;){let e=s.pop();e&&eO(e)}o.preload()}let o=t.getAudioManager();o.load([e+"click.mp3",e+"click.wav",e+"click.ogg"],"click"),o.load([e+"disconnect.wav",e+"disconnect.mp3",e+"disconnect.ogg"],"disconnect"),o.load([e+"delete.mp3",e+"delete.ogg",e+"delete.wav"],"delete");let s=[];s.push(eb(document,"pointermove",null,i,!0)),s.push(eb(document,"touchstart",null,i,!0))},n6=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.UNDO,preconditionFn:e=>e.workspace.getUndoStack().length>0?"enabled":"disabled",callback(e){e.workspace.undo(!1)},scopeType:cN.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1})},n4=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.REDO,preconditionFn:e=>e.workspace.getRedoStack().length>0?"enabled":"disabled",callback(e){e.workspace.undo(!0)},scopeType:cN.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2})},n8=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.CLEAN_UP,preconditionFn:e=>e.workspace.isMovable()?e.workspace.getTopBlocks(!1).length>1?"enabled":"disabled":"hidden",callback(e){e.workspace.cleanUp()},scopeType:cN.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3})},n9=function(e,t){function i(t){s--,t.setCollapsed(e),0===s&&$.setGroup$$module$build$src$core$events$utils(!1)}let o=0,s=0;$.setGroup$$module$build$src$core$events$utils(!0);for(let e=0;e<t.length;e++){let n=t[e];for(;n;)s++,setTimeout(i.bind(null,n),o),n=n.getNextBlock(),o+=10}},n7=function(){cN.registry.register({displayText:()=>$.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 i=e[t];for(;i;){if(!i.isCollapsed())return"enabled";i=i.getNextBlock()}}return"disabled"}return"hidden"},callback(e){n9(!0,e.workspace.getTopBlocks(!0))},scopeType:cN.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})},re=function(){cN.registry.register({displayText:()=>$.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 i=e[t];for(;i;){if(i.isCollapsed())return"enabled";i=i.getNextBlock()}}return"disabled"}return"hidden"},callback(e){n9(!1,e.workspace.getTopBlocks(!0))},scopeType:cN.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})},rt=function(e,t){if(e.isDeletable())Array.prototype.push.apply(t,e.getDescendants(!1));else{e=e.getChildren(!1);for(let i=0;i<e.length;i++)rt(e[i],t)}},ri=function(e){let t=[];e=e.getTopBlocks(!0);for(let i=0;i<e.length;i++)rt(e[i],t);return t},ro=function(e,t){t?$.setGroup$$module$build$src$core$events$utils(t):($.setGroup$$module$build$src$core$events$utils(!0),t=$.getGroup$$module$build$src$core$events$utils());let i=e.shift();i&&(i.isDeadOrDying()?ro(e,t):(i.dispose(!1,!0),setTimeout(ro,10,e,t))),$.setGroup$$module$build$src$core$events$utils(!1)},rs=function(){cN.registry.register({displayText:e=>e.workspace?1===(e=ri(e.workspace).length)?$.Msg$$module$build$src$core$msg.DELETE_BLOCK:$.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`):"",preconditionFn:e=>e.workspace&&ri(e.workspace).length>0?"enabled":"disabled",callback(e){if(e.workspace){e.workspace.cancelCurrentGesture();var t=ri(e.workspace);t.length<2?ro(t):is($.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),function(e){e&&ro(t)})}},scopeType:cN.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},rn=function(){n6(),n4(),n8(),n7(),re(),rs()},rr=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.DUPLICATE_BLOCK,preconditionFn:e=>!(e=e.block).isInFlyout&&e.isDeletable()&&e.isMovable()?e.isDuplicatable()?"enabled":"disabled":"hidden",callback(e){if(e.block){var t=e.block.toCopyData();t&&nF(t,e.block.workspace)}},scopeType:cN.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},rl=function(){cN.registry.register({displayText:e=>e.block.hasIcon(uo.TYPE)?$.Msg$$module$build$src$core$msg.REMOVE_COMMENT:$.Msg$$module$build$src$core$msg.ADD_COMMENT,preconditionFn:e=>!(e=e.block).isInFlyout&&e.workspace.options.comments&&!e.isCollapsed()&&e.isEditable()?"enabled":"hidden",callback(e){(e=e.block).hasIcon(uo.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:cN.ScopeType.BLOCK,id:"blockComment",weight:2})},ra=function(){cN.registry.register({displayText:e=>e.block.getInputsInline()?$.Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:$.Msg$$module$build$src$core$msg.INLINE_INPUTS,preconditionFn(e){if(!(e=e.block).isInFlyout&&e.isMovable()&&!e.isCollapsed()){for(let t=1;t<e.inputList.length;t++)if(!(e.inputList[t-1]instanceof dI||e.inputList[t]instanceof dI))return"enabled"}return"hidden"},callback(e){e.block.setInputsInline(!e.block.getInputsInline())},scopeType:cN.ScopeType.BLOCK,id:"blockInline",weight:3})},rc=function(){cN.registry.register({displayText:e=>e.block.isCollapsed()?$.Msg$$module$build$src$core$msg.EXPAND_BLOCK:$.Msg$$module$build$src$core$msg.COLLAPSE_BLOCK,preconditionFn:e=>!(e=e.block).isInFlyout&&e.isMovable()&&e.workspace.options.collapse?"enabled":"hidden",callback(e){e.block.setCollapsed(!e.block.isCollapsed())},scopeType:cN.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},rh=function(){cN.registry.register({displayText:e=>e.block.hasDisabledReason(lJ)?$.Msg$$module$build$src$core$msg.ENABLE_BLOCK:$.Msg$$module$build$src$core$msg.DISABLE_BLOCK,preconditionFn(e){if(!(e=e.block).isInFlyout&&e.workspace.options.disable&&e.isEditable()){var t=e.getDisabledReasons();return t=t.size>+!!t.has(lJ),e.getInheritedDisabled()||t?"disabled":"enabled"}return"hidden"},callback(e){e=e.block;let t=$.getGroup$$module$build$src$core$events$utils();t||$.setGroup$$module$build$src$core$events$utils(!0),e.setDisabledReason(!e.hasDisabledReason(lJ),lJ),$.setGroup$$module$build$src$core$events$utils(t)},scopeType:cN.ScopeType.BLOCK,id:"blockDisable",weight:5})},ru=function(){cN.registry.register({displayText(e){var t=e.block;return e=t.getDescendants(!1).length,(t=t.getNextBlock())&&(e-=t.getDescendants(!1).length),1===e?$.Msg$$module$build$src$core$msg.DELETE_BLOCK:$.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`)},preconditionFn:e=>!e.block.isInFlyout&&e.block.isDeletable()?"enabled":"hidden",callback(e){e.block&&e.block.checkAndDelete()},scopeType:cN.ScopeType.BLOCK,id:"blockDelete",weight:6})},rd=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.HELP,preconditionFn:e=>("function"==typeof(e=e.block).helpUrl?e.helpUrl():e.helpUrl)?"enabled":"hidden",callback(e){e.block.showHelp()},scopeType:cN.ScopeType.BLOCK,id:"blockHelp",weight:7})},rp=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.REMOVE_COMMENT,preconditionFn(e){let t;return(null==(t=e.comment)?0:t.isDeletable())?"enabled":"hidden"},callback(e){let t;$.setGroup$$module$build$src$core$events$utils(!0),null==(t=e.comment)||t.dispose(),$.setGroup$$module$build$src$core$events$utils(!1)},scopeType:cN.ScopeType.COMMENT,id:"commentDelete",weight:6})},r_=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,preconditionFn(e){let t;return(null==(t=e.comment)?0:t.isMovable())?"enabled":"hidden"},callback(e){if(e.comment){var t=e.comment.toCopyData();t&&nF(t,e.comment.workspace)}},scopeType:cN.ScopeType.COMMENT,id:"commentDuplicate",weight:1})},rg=function(){cN.registry.register({displayText:()=>$.Msg$$module$build$src$core$msg.ADD_COMMENT,preconditionFn:e=>{let t;return(null==(t=e.workspace)?0:t.isMutator)?"hidden":"enabled"},callback:(e,t,i,o)=>{(e=e.workspace)&&($.setGroup$$module$build$src$core$events$utils(!0),(t=new cW(e)).setPlaceholderText($.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT),t.moveTo(rE(new lt(o.x,o.y),e)),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(t),$.setGroup$$module$build$src$core$events$utils(!1))},scopeType:cN.ScopeType.WORKSPACE,id:"commentCreate",weight:8})},rE=function(e,t){var i=t.getInjectionDiv().getBoundingClientRect();return e=new lt(e.x-i.left,e.y-i.top),i=t.getOriginOffsetInPixels(),(e=lt.difference(e,i)).scale(1/t.scale),e},rT=function(){rr(),rl(),ra(),rc(),rh(),ru(),rd()},rm=function(){rn(),rT()},(rf=rf||{}).scope={},rf.ASSUME_ES5=!1,rf.ASSUME_ES6=!1,rf.ASSUME_ES2020=!1,rf.ASSUME_NO_NATIVE_MAP=!1,rf.ASSUME_NO_NATIVE_SET=!1,rf.ISOLATE_POLYFILLS=!1,rf.FORCE_POLYFILL_PROMISE=!1,rf.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,rf.INSTRUMENT_ASYNC_CONTEXT=!0,rf.objectCreate=rf.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(e){var t=function(){};return t.prototype=e,new t},rf.defineProperty=rf.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,i){return e==Array.prototype||e==Object.prototype||(e[t]=i.value),e},rf.getGlobal=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof r&&r];for(var t=0;t<e.length;++t){var i=e[t];if(i&&i.Math==Math)return i}throw Error("Cannot find global object")},rf.global=rf.ASSUME_ES2020?globalThis:rf.getGlobal(this),rf.IS_SYMBOL_NATIVE="function"==typeof Symbol&&"symbol"==typeof Symbol("x"),rf.TRUST_ES6_POLYFILLS=!rf.ISOLATE_POLYFILLS||rf.IS_SYMBOL_NATIVE,rf.polyfills={},rf.propertyToPolyfillSymbol={},rf.POLYFILL_PREFIX="$jscp$",rf.polyfill=function(e,t,i,o){t&&(rf.ISOLATE_POLYFILLS?rf.polyfillIsolated(e,t,i,o):rf.polyfillUnisolated(e,t,i,o))},rf.polyfillUnisolated=function(e,t,i,o){for(o=0,i=rf.global,e=e.split(".");o<e.length-1;o++){var s=e[o];if(!(s in i))return;i=i[s]}(t=t(o=i[e=e[e.length-1]]))!=o&&null!=t&&rf.defineProperty(i,e,{configurable:!0,writable:!0,value:t})},rf.polyfillIsolated=function(e,t,i,o){var s=e.split(".");e=1===s.length,o=s[0],o=!e&&o in rf.polyfills?rf.polyfills:rf.global;for(var n=0;n<s.length-1;n++){var r=s[n];if(!(r in o))return;o=o[r]}s=s[s.length-1],null!=(t=t(i=rf.IS_SYMBOL_NATIVE&&"es6"===i?o[s]:null))&&(e?rf.defineProperty(rf.polyfills,s,{configurable:!0,writable:!0,value:t}):t!==i&&(void 0===rf.propertyToPolyfillSymbol[s]&&(i=1e9*Math.random()>>>0,rf.propertyToPolyfillSymbol[s]=rf.IS_SYMBOL_NATIVE?rf.global.Symbol(s):rf.POLYFILL_PREFIX+i+"$"+s),rf.defineProperty(o,rf.propertyToPolyfillSymbol[s],{configurable:!0,writable:!0,value:t})))},rf.getConstructImplementation=function(){if(rf.TRUST_ES6_POLYFILLS&&"u">typeof Reflect&&Reflect.construct){if(function(){function e(){}return new e,Reflect.construct(e,[],function(){}),new e instanceof e}())return Reflect.construct;var e=Reflect.construct;return function(t,i,o){return t=e(t,i),o&&Reflect.setPrototypeOf(t,o.prototype),t}}return function(e,t,i){return void 0===i&&(i=e),i=rf.objectCreate(i.prototype||Object.prototype),Function.prototype.apply.call(e,i,t)||i}},rf.construct=({valueOf:rf.getConstructImplementation}).valueOf(),rf.underscoreProtoCanBeSet=function(){var e={};try{return e.__proto__={a:!0},e.a}catch(e){}return!1},rf.setPrototypeOf=rf.ASSUME_ES6||rf.TRUST_ES6_POLYFILLS&&"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:rf.underscoreProtoCanBeSet()?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw TypeError(e+" is not extensible");return e}:null,rf.inherits=function(e,t){if(e.prototype=rf.objectCreate(t.prototype),e.prototype.constructor=e,rf.ASSUME_ES6||rf.setPrototypeOf){var i=rf.setPrototypeOf;i(e,t)}else for(i in t)if("prototype"!=i)if(Object.defineProperties){var o=Object.getOwnPropertyDescriptor(t,i);o&&Object.defineProperty(e,i,o)}else e[i]=t[i];e.superClass_=t.prototype},rf.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}},rf.arrayIterator=function(e){return{next:rf.arrayIteratorImpl(e)}},rf.makeIterator=function(e){var t="u">typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];if(t)return t.call(e);if("number"==typeof e.length)return rf.arrayIterator(e);throw Error(String(e)+" is not an iterable or ArrayLike")},rf.arrayFromIterator=function(e){for(var t,i=[];!(t=e.next()).done;)i.push(t.value);return i},rf.arrayFromIterable=function(e){return e instanceof Array?e:rf.arrayFromIterator(rf.makeIterator(e))},rf.generator={},rf.generator.ensureIteratorResultIsObject_=function(e){if(!(e instanceof Object))throw TypeError("Iterator result "+e+" is not an object")},rf.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},rf.generator.Context.prototype.start_=function(){if(this.isRunning_)throw TypeError("Generator is already running");this.isRunning_=!0},rf.generator.Context.prototype.stop_=function(){this.isRunning_=!1},rf.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_},rf.generator.Context.prototype.next_=function(e){this.yieldResult=e},rf.generator.Context.prototype.throw_=function(e){this.abruptCompletion_={exception:e,isException:!0},this.jumpToErrorHandler_()},rf.generator.Context.prototype.return=function(e){this.abruptCompletion_={return:e},this.nextAddress=this.finallyAddress_},rf.generator.Context.prototype.jumpThroughFinallyBlocks=function(e){this.abruptCompletion_={jumpTo:e},this.nextAddress=this.finallyAddress_},rf.generator.Context.prototype.yield=function(e,t){return this.nextAddress=t,{value:e}},rf.generator.Context.prototype.yieldAll=function(e,t){var i=(e=rf.makeIterator(e)).next();if(rf.generator.ensureIteratorResultIsObject_(i),!i.done)return this.yieldAllIterator_=e,this.yield(i.value,t);this.yieldResult=i.value,this.nextAddress=t},rf.generator.Context.prototype.jumpTo=function(e){this.nextAddress=e},rf.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0},rf.generator.Context.prototype.setCatchFinallyBlocks=function(e,t){this.catchAddress_=e,void 0!=t&&(this.finallyAddress_=t)},rf.generator.Context.prototype.setFinallyBlock=function(e){this.catchAddress_=0,this.finallyAddress_=e||0},rf.generator.Context.prototype.leaveTryBlock=function(e,t){this.nextAddress=e,this.catchAddress_=t||0},rf.generator.Context.prototype.enterCatchBlock=function(e){return this.catchAddress_=e||0,e=this.abruptCompletion_.exception,this.abruptCompletion_=null,e},rf.generator.Context.prototype.enterFinallyBlock=function(e,t,i){i?this.finallyContexts_[i]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_],this.catchAddress_=e||0,this.finallyAddress_=t||0},rf.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_();void 0!=t.jumpTo&&this.finallyAddress_<t.jumpTo?(this.nextAddress=t.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=e},rf.generator.Context.prototype.forIn=function(e){return new rf.generator.Context.PropertyIterator(e)},rf.generator.Context.PropertyIterator=function(e){for(var t in this.object_=e,this.properties_=[],e)this.properties_.push(t);this.properties_.reverse()},rf.generator.Context.PropertyIterator.prototype.getNext=function(){for(;this.properties_.length>0;){var e=this.properties_.pop();if(e in this.object_)return e}return null},rf.generator.Engine_=function(e){this.context_=new rf.generator.Context,this.program_=e},rf.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_())},rf.generator.Engine_.prototype.return_=function(e){this.context_.start_();var t=this.context_.yieldAllIterator_;return t?this.yieldAllStep_("return"in t?t.return:function(e){return{value:e,done:!0}},e,this.context_.return):(this.context_.return(e),this.nextStep_())},rf.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_())},rf.generator.Engine_.prototype.yieldAllStep_=function(e,t,i){try{var o=e.call(this.context_.yieldAllIterator_,t);if(rf.generator.ensureIteratorResultIsObject_(o),!o.done)return this.context_.stop_(),o;var s=o.value}catch(e){return this.context_.yieldAllIterator_=null,this.context_.throw_(e),this.nextStep_()}return this.context_.yieldAllIterator_=null,i.call(this.context_,s),this.nextStep_()},rf.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(e){this.context_.yieldResult=void 0,this.context_.throw_(e)}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}},rf.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}},rf.generator.createGenerator=function(e,t){return t=new rf.generator.Generator_(new rf.generator.Engine_(t)),rf.setPrototypeOf&&e.prototype&&rf.setPrototypeOf(t,e.prototype),t},rf.asyncExecutePromiseGenerator=function(e){function t(t){return e.next(t)}function i(t){return e.throw(t)}return new Promise(function(o,s){!function e(n){n.done?o(n.value):Promise.resolve(n.value).then(t,i).then(e,s)}(e.next())})},rf.asyncExecutePromiseGeneratorFunction=function(e){return rf.asyncExecutePromiseGenerator(e())},rf.asyncExecutePromiseGeneratorProgram=function(e){return rf.asyncExecutePromiseGenerator(new rf.generator.Generator_(new rf.generator.Engine_(e)))},rf.polyfill("globalThis",function(e){return e||rf.global},"es_2020","es3"),rf.polyfill("Array.prototype.includes",function(e){return e||function(e,t){var i=this;i instanceof String&&(i=String(i));var o=i.length;for((t=t||0)<0&&(t=Math.max(t+o,0));t<o;t++){var s=i[t];if(s===e||Object.is(s,e))return!0}return!1}},"es7","es3"),rf.checkEs6ConformanceViaProxy=function(){try{var e={},t=Object.create(new rf.global.Proxy(e,{get:function(i,o,s){return i==e&&"q"==o&&s==t}}));return!0===t.q}catch(e){return!1}},rf.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1,rf.ES6_CONFORMANCE=rf.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&rf.checkEs6ConformanceViaProxy(),rf.initSymbol=function(){},rf.iteratorPrototype=function(e){return(e={next:e})[Symbol.iterator]=function(){return this},e},rf.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},rf.MapEntry=function(){},rf.polyfill("Set.prototype.difference",function(e){return e||function(e){rf.checkIsSetInstance(this),rf.checkIsSetLike(e);var t=rf.getSmallerAndLargerSets(this,e);e=new Set(this);var i=t.smallerSetIterator;t=t.largerSet;for(var o=i.next();!o.done;)t.has(o.value)&&e.delete(o.value),o=i.next();return e}},"es_next","es6"),rf.checkIsSetLike=function(e){if("object"!=typeof e||null===e||"number"!=typeof e.size||e.size<0||"function"!=typeof e.keys||"function"!=typeof e.has)throw TypeError("Argument must be set-like")},rf.checkIsValidIterator=function(e){if("object"!=typeof e||null===e||"function"!=typeof e.next)throw TypeError("Invalid iterator.");return e},rf.getSmallerAndLargerSets=function(e,t){return e.size<=t.size?{smallerSetIterator:e.keys(),largerSet:t}:{smallerSetIterator:rf.checkIsValidIterator(t.keys()),largerSet:e}},rf.checkIsSetInstance=function(e){if(!(e instanceof Set))throw TypeError("Method must be called on an instance of Set.")},rf.iteratorFromArray=function(e,t){if(rf.ASSUME_ES6)return e[Symbol.iterator]();e instanceof String&&(e+="");var i=0,o=!1,s={next:function(){if(!o&&i<e.length){var s=i++;return{value:t(s,e[s]),done:!1}}return o=!0,{done:!0,value:void 0}}};return s[Symbol.iterator]=function(){return s},s},rf.polyfill("Array.prototype.values",function(e){return e||function(){return rf.iteratorFromArray(this,function(e,t){return t})}},"es8","es3"),rf.polyfill("Array.prototype.flatMap",function(e){return e||function(e,t){var i=[];return Array.prototype.forEach.call(this,function(o,s){Array.isArray(o=e.call(t,o,s,this))?i.push.apply(i,o):i.push(o)}),i}},"es9","es5"),rf.polyfill("Array.prototype.flat",function(e){return e||function(e){e=void 0===e?1:e;var t=[];return Array.prototype.forEach.call(this,function(i){Array.isArray(i)&&e>0?(i=Array.prototype.flat.call(i,e-1),t.push.apply(t,i)):t.push(i)}),t}},"es9","es5"),rf.polyfill("Object.entries",function(e){return e||function(e){var t,i=[];for(t in e)rf.owns(e,t)&&i.push([t,e[t]]);return i}},"es8","es3"),rf.polyfill("Object.values",function(e){return e||function(e){var t,i=[];for(t in e)rf.owns(e,t)&&i.push(e[t]);return i}},"es8","es3");var N=Object.create(null),L=Object.create(null),y="default",D=class{constructor(e){this.name=e}toString(){return this.name}};D.CONNECTION_CHECKER=new D("connectionChecker"),D.CONNECTION_PREVIEWER=new D("connectionPreviewer"),D.CURSOR=new D("cursor"),D.EVENT=new D("event"),D.FIELD=new D("field"),D.INPUT=new D("input"),D.RENDERER=new D("renderer"),D.TOOLBOX=new D("toolbox"),D.THEME=new D("theme"),D.TOOLBOX_ITEM=new D("toolboxItem"),D.FLYOUTS_VERTICAL_TOOLBOX=new D("flyoutsVerticalToolbox"),D.FLYOUTS_HORIZONTAL_TOOLBOX=new D("flyoutsHorizontalToolbox"),D.FLYOUT_INFLATER=new D("flyoutInflater"),D.METRICS_MANAGER=new D("metricsManager"),D.BLOCK_DRAGGER=new D("blockDragger"),D.SERIALIZER=new D("serializer"),D.ICON=new D("icon"),D.PASTER=new D("paster"),D.VARIABLE_MODEL=new D("variableModel"),D.VARIABLE_MAP=new D("variableMap");var k={DEFAULT:y,TEST_ONLY:{typeMap:N}};k.Type=D,k.getAllItems=eg,k.getClass=ep,k.getClassFromOptions=eE,k.getObject=e_,k.hasItem=ed,k.register=ea,k.unregister=eh;var w=Object.create(null),M=750,v="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),P=null,B={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},x=0,F={TOUCH_ENABLED:v,TOUCH_MAP:B};F.checkTouchIdentifier=eR,F.clearTouchIdentifier=ef,F.getTouchIdentifierFromEvent=eS,F.longStart=eT,F.longStop=em,F.shouldHandleEvent=eI;var G=globalThis.navigator&&globalThis.navigator.userAgent||"";function H(e){return U.includes(e.toUpperCase())}let U=(rI=G).toUpperCase();rS=H("JavaFX"),rR=H("WebKit"),rb=H("Gecko")&&!rR,rC=H("Android"),G=globalThis.navigator&&globalThis.navigator.maxTouchPoints,rO=H("iPad")||H("Macintosh")&&G>0,rA=H("iPhone")&&!rO,r$=H("Macintosh"),rN=!(rO||rC&&!H("Mobile")||H("Silk"))&&(rA||rC);var W=rS,V=r$,K=40,Y=125,X={};X.bind=eC,X.conditionalBind=eb,X.getScrollDeltaPixels=eL,X.isRightButton=e$,X.isTargetInput=eA,X.mouseToSvg=eN,X.unbind=eO,(el=rL||(rL={})).BLOCK_CREATE="create",el.BLOCK_DELETE="delete",el.BLOCK_CHANGE="change",el.BLOCK_FIELD_INTERMEDIATE_CHANGE="block_field_intermediate_change",el.BLOCK_MOVE="move",el.VAR_CREATE="var_create",el.VAR_DELETE="var_delete",el.VAR_RENAME="var_rename",el.VAR_TYPE_CHANGE="var_type_change",el.UI="ui",el.BLOCK_DRAG="drag",el.SELECTED="selected",el.CLICK="click",el.MARKER_MOVE="marker_move",el.BUBBLE_OPEN="bubble_open",el.TRASHCAN_OPEN="trashcan_open",el.TOOLBOX_ITEM_SELECT="toolbox_item_select",el.THEME_CHANGE="theme_change",el.VIEWPORT_CHANGE="viewport_change",el.COMMENT_CREATE="comment_create",el.COMMENT_DELETE="comment_delete",el.COMMENT_CHANGE="comment_change",el.COMMENT_MOVE="comment_move",el.COMMENT_RESIZE="comment_resize",el.COMMENT_DRAG="comment_drag",el.COMMENT_COLLAPSE="comment_collapse",el.FINISHED_LOADING="finished_loading";var z=[rL.BLOCK_CREATE,rL.BLOCK_MOVE,rL.COMMENT_CREATE,rL.COMMENT_MOVE],j="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",J={genUid:()=>{let e=j.length,t=[];for(let i=0;i<20;i++)t[i]=j.charAt(Math.random()*e);return t.join("")}},Z=0,q={TEST_ONLY:J};q.genUid=eD,q.getNextUniqueId=ey;var Q={};Q.isBlockChange=eM,Q.isBlockCreate=ek,Q.isBlockDelete=ew,Q.isBlockDrag=function(e){return e.type===rL.BLOCK_DRAG},Q.isBlockFieldIntermediateChange=ev,Q.isBlockMove=eP,Q.isBubbleOpen=ex,Q.isClick=eB,Q.isCommentChange=function(e){return e.type===rL.COMMENT_CHANGE},Q.isCommentCollapse=function(e){return e.type===rL.COMMENT_COLLAPSE},Q.isCommentCreate=function(e){return e.type===rL.COMMENT_CREATE},Q.isCommentDelete=function(e){return e.type===rL.COMMENT_DELETE},Q.isCommentDrag=function(e){return e.type===rL.COMMENT_DRAG},Q.isCommentMove=function(e){return e.type===rL.COMMENT_MOVE},Q.isCommentResize=function(e){return e.type===rL.COMMENT_RESIZE},Q.isFinishedLoading=function(e){return e.type===rL.FINISHED_LOADING},Q.isSelected=function(e){return e.type===rL.SELECTED},Q.isThemeChange=function(e){return e.type===rL.THEME_CHANGE},Q.isToolboxItemSelect=function(e){return e.type===rL.TOOLBOX_ITEM_SELECT},Q.isTrashcanOpen=function(e){return e.type===rL.TRASHCAN_OPEN},Q.isVarCreate=function(e){return e.type===rL.VAR_CREATE},Q.isVarDelete=function(e){return e.type===rL.VAR_DELETE},Q.isVarRename=function(e){return e.type===rL.VAR_RENAME},Q.isViewportChange=eF;var ee="",et=!0,ei=0,eo="ORPHANED_BLOCK",es=[],en={FIRE_QUEUE:es,enqueueEvent:eW,fireNow:eU,fireInternal:function(e){if(eY()){if(!es.length)try{requestAnimationFrame(()=>{setTimeout(eU,0)})}catch(e){setTimeout(eU,0)}eW(e)}},setGroupInternal:function(e){ee="boolean"==typeof e?e?eD():"":e}},er={TEST_ONLY:en};er.clearPendingUndo=eK,er.disable=$.disable$$module$build$src$core$events$utils,er.disableOrphans=eJ,er.enable=$.enable$$module$build$src$core$events$utils,er.filter=eV,er.fire=eH,er.fromJson=ez,er.get=ej,er.getDescendantIds=eX,er.getGroup=$.getGroup$$module$build$src$core$events$utils,er.getRecordUndo=eG,er.isEnabled=eY,er.setGroup=$.setGroup$$module$build$src$core$events$utils,er.setRecordUndo=$.setRecordUndo$$module$build$src$core$events$utils;var el,ea,ec,eh,eu,ed,ep,e_,eg,eE,eT,em,ef,eI,eS,eR,eb,eC,eO,eA,e$,eN,eL,ey,eD,ek,ew,eM,ev,eP,eB,ex,eF,eG,eH,eU,eW,eV,eK,eY,eX,ez,ej,eJ,eZ,eq,eQ,e0,e1,e2,e3,e5,e6,e4,e8,e9,e7,te,tt,ti,to,ts,tn,tr,tl,ta,tc,th,tu,td,tp,t_,tg,tE,tT,tm,tf,tI,tS,tR,tb,tC,tO,tA,t$,tN,tL,ty,tD,tk,tw,tM,tv,tP,tB,tx,tF,tG,tH,tU,tW,tV,tK,tY,tX,tz,tj,tJ,tZ,tq,tQ,t0,t1,t2,t3,t5,t6,t4,t8,t9,t7,ie,it,ii,io,is,ir,il,ia,ic,ih,iu,id,ip,i_,ig,iE,iT,im,iI,iS,iR,ib,iC,iO,iA,i$,iN,iL,iy,iD,ik,iw,iM,iv,iP,iB,ix,iF,iG,iH,iU,iW,iV,iK,iY,iX,iz,ij,iJ,iZ,iq,iQ,i0,i1,i2,i3,i5,i6,i4,i8,i9,i7,oe,ot,oi,oo,os,on,or,ol,oa,oc,oh,ou,od,op,o_,og,oE,oT,om,of,oI,oS,oR,ob,oC,oO,oA,o$,oN,oL,oy,oD,ok,ow,oM,ov,oP,oB,ox,oF,oG,oH,oU,oW,oV,oK,oY,oX,oz,oj,oJ,oZ,oq,oQ,o0,o1,o2,o3,o5,o6,o4,o8,o9,o7,se,st,si,so,ss,sn,sr,sl,sa,sc,sh,su,sd,sp,s_,sg,sE,sT,sm,sf,sI,sS,sR,sb,sC,sO,sA,s$,sN,sL,sy,sD,sk,sw,sM,sv,sP,sB,sx,sF,sG,sH,sU,sW,sV,sK,sY,sX,sz,sj,sJ,sZ,sq,sQ,s0,s1,s2,s3,s5,s6,s4,s8,s9,s7,ne,nt,ni,no,ns,nn,nr,nl,na,nc,nh,nu,nd,np,n_,ng,nE,nT,nm,nf,nI,nS,nR,nb,nC,nO,nA,n$,nN,nL,ny,nD,nk,nw,nM,nv,nP,nB,nx,nF,nG,nH,nU,nW,nV,nK,nY,nX,nz,nj,nJ,nZ,nq,nQ,n0,n1,n2,n3,n5,n6,n4,n8,n9,n7,re,rt,ri,ro,rs,rn,rr,rl,ra,rc,rh,ru,rd,rp,r_,rg,rE,rT,rm,rf,rI,rS,rR,rb,rC,rO,rA,r$,rN,rL,ry,rD="http://www.w3.org/2000/svg",rk="http://www.w3.org/1999/xhtml",rw="http://www.w3.org/1999/xlink";(rV=ry||(ry={}))[rV.ELEMENT_NODE=1]="ELEMENT_NODE",rV[rV.TEXT_NODE=3]="TEXT_NODE",rV[rV.COMMENT_NODE=8]="COMMENT_NODE";var rM=null,rv=0,rP=null,rB={HTML_NS:rk};rB.NodeType=ry,rB.SVG_NS=rD,rB.XLINK_NS=rw,rB.addClass=eq,rB.createSvgElement=eZ,rB.getFastTextWidth=function(e,t,i,o){return e9(e,t+"pt",i,o)},rB.getFastTextWidthWithSizeString=e9,rB.getTextWidth=e8,rB.hasClass=e1,rB.insertAfter=e3,rB.measureFontMetrics=e7,rB.removeClass=e0,rB.removeClasses=eQ,rB.removeNode=e2,rB.setCssTransform=e5,rB.startTextWidthCache=e6,rB.stopTextWidthCache=e4;var rx=class{static findFocusedNode(e){var t=e.getRootFocusableNode();if(!t.canBeFocused())return null;var i=t.getFocusableElement();return e1(i,rx.ACTIVE_CLASS_NAME)||e1(i,rx.PASSIVE_CSS_CLASS_NAME)||((t=i.querySelector(this.ACTIVE_FOCUS_NODE_CSS_SELECTOR))instanceof HTMLElement||t instanceof SVGElement)&&(t=rx.findFocusableNodeFor(t,e))?t:((i=i.querySelector(this.PASSIVE_FOCUS_NODE_CSS_SELECTOR))instanceof HTMLElement||i instanceof SVGElement)&&(e=rx.findFocusableNodeFor(i,e))?e:null}static findFocusableNodeFor(e,t){if(!e.id||"null"===e.id||-1!==t.getNestedTrees().map(t=>rx.findFocusableNodeFor(e,t)).findIndex(e=>!!e))return null;var i,o=t.getRootFocusableNode();return o.canBeFocused()&&e===o.getFocusableElement()||(o=null!=(i=t.lookUpFocusableNode(e.id))?i:null)?o:(i=e.parentElement,!o&&i?rx.findFocusableNodeFor(i,t):null)}};rx.ACTIVE_CLASS_NAME="blocklyActiveFocus",rx.PASSIVE_CSS_CLASS_NAME="blocklyPassiveFocus",rx.ACTIVE_FOCUS_NODE_CSS_SELECTOR=`.${rx.ACTIVE_CLASS_NAME}`,rx.PASSIVE_FOCUS_NODE_CSS_SELECTOR=`.${rx.PASSIVE_CSS_CLASS_NAME}`;var rF=class{constructor(e,t){this.tree=e,this.rootShouldBeAutoTabbable=t}},rG=class{constructor(e){this.previouslyFocusedNode=this.focusedNode=null,this.registeredTrees=[],this.isUpdatingFocusedNode=this.recentlyLostAllFocus=this.lockFocusStateChanges=this.currentlyHoldsEphemeralFocus=!1;let t=e=>{if(!this.isUpdatingFocusedNode){this.recentlyLostAllFocus=!e;var t=null;if(e instanceof HTMLElement||e instanceof SVGElement){for(var i of this.registeredTrees)if(t=rx.findFocusableNodeFor(e,i.tree))break}if(t&&t.canBeFocused()){let o;e=t.getFocusableTree(),i=null==(o=this.focusedNode)?void 0:o.getFocusableTree(),t===e.getRootFocusableNode()&&e!==i?this.focusTree(e):this.focusNode(t)}else this.defocusCurrentFocusedNode()}};e("focusin",e=>{e instanceof FocusEvent&&t(document.activeElement)}),e("focusout",e=>{e instanceof FocusEvent&&t(e.relatedTarget)})}registerTree(e,t=!1){if(this.ensureManagerIsUnlocked(),this.isRegistered(e))throw Error(`Attempted to re-register already registered tree: ${e}.`);this.registeredTrees.push(new rF(e,t));let i=e.getRootFocusableNode().getFocusableElement();if(!i.id||"null"===i.id)throw Error(`Attempting to register a tree with a root element that has an invalid ID: ${e}.`);t&&(i.tabIndex=0)}isRegistered(e){return!!this.lookUpRegistration(e)}lookUpRegistration(e){let t;return null!=(t=this.registeredTrees.find(t=>t.tree===e))?t:null}unregisterTree(e){if(this.ensureManagerIsUnlocked(),!this.isRegistered(e))throw Error(`Attempted to unregister not registered tree: ${e}.`);var t=this.registeredTrees.findIndex(t=>t.tree===e);let i=this.registeredTrees[t];this.registeredTrees.splice(t,1),t=rx.findFocusedNode(e);let o=e.getRootFocusableNode();t&&this.removeHighlight(t),this.focusedNode!==t&&this.focusedNode!==o||this.updateFocusedNode(null),this.removeHighlight(o),i.rootShouldBeAutoTabbable&&e.getRootFocusableNode().getFocusableElement().removeAttribute("tabindex")}getFocusedTree(){let e,t;return null!=(t=null==(e=this.focusedNode)?void 0:e.getFocusableTree())?t:null}getFocusedNode(){return this.focusedNode}focusTree(e){let t;if(this.ensureManagerIsUnlocked(),!this.isRegistered(e))throw Error(`Attempted to focus unregistered tree: ${e}.`);let i=rx.findFocusedNode(e),o=e.getRestoredFocusableNode(i);e=e.getRootFocusableNode(),this.focusNode(null!=(t=null!=o?o:i)?t:e)}focusNode(e){this.ensureManagerIsUnlocked();let t=!this.currentlyHoldsEphemeralFocus;t&&(this.isUpdatingFocusedNode=!0);var i,o=(null==(i=this.focusedNode)?void 0:i.getFocusableElement())!==document.activeElement;if(this.focusedNode!==e||o)if(e.canBeFocused()){if(i=e.getFocusableTree(),!this.isRegistered(i))throw Error(`Attempted to focus unregistered node: ${e}.`);(o=e.getFocusableElement()).id&&"null"!==o.id||console.warn("Trying to focus a node that has an invalid ID.");var s,n=rx.findFocusableNodeFor(o,i);o=rx.findFocusedNode(i);var r=e;n!==e&&(r=i.getRestoredFocusableNode(o),e=i.getRootFocusableNode(),r=null!=(s=null!=r?r:o)?s:e),s=null==(e=this.focusedNode)?void 0:e.getFocusableTree(),e&&this.passivelyFocusNode(e,i),i=i.getRootFocusableNode(),o&&this.removeHighlight(o),i!==r&&this.removeHighlight(i),this.currentlyHoldsEphemeralFocus||this.activelyFocusNode(r,null!=s?s:null),this.updateFocusedNode(r)}else console.warn("Trying to focus a node that can't be focused.");t&&(this.isUpdatingFocusedNode=!1)}takeEphemeralFocus(e){if(this.ensureManagerIsUnlocked(),this.currentlyHoldsEphemeralFocus)throw Error(`Attempted to take ephemeral focus when it's already held, with new element: ${e}.`);this.currentlyHoldsEphemeralFocus=!0,this.focusedNode&&this.passivelyFocusNode(this.focusedNode,null),e.focus();let t=!1;return()=>{if(t)throw Error(`Attempted to finish ephemeral focus twice for element: ${e}.`);if(t=!0,this.currentlyHoldsEphemeralFocus=!1,this.focusedNode){this.activelyFocusNode(this.focusedNode,null);let e=this.focusedNode;setTimeout(()=>{!this.focusedNode&&this.previouslyFocusedNode===e&&this.recentlyLostAllFocus&&this.focusNode(e)},0)}}}ephemeralFocusTaken(){return this.currentlyHoldsEphemeralFocus}ensureManagerIsUnlocked(){if(this.lockFocusStateChanges)throw Error("FocusManager state changes cannot happen in a tree/node focus/blur callback.")}updateFocusedNode(e){this.previouslyFocusedNode=this.focusedNode,this.focusedNode=e}defocusCurrentFocusedNode(){this.focusedNode&&!this.currentlyHoldsEphemeralFocus&&(this.passivelyFocusNode(this.focusedNode,null),this.updateFocusedNode(null))}activelyFocusNode(e,t){let i;this.lockFocusStateChanges=!0;let o=e.getFocusableTree(),s=e.getFocusableElement(),n=null==(i=this.lookUpRegistration(o))?void 0:i.rootShouldBeAutoTabbable;o!==t&&(o.onTreeFocus(e,t),n&&(o.getRootFocusableNode().getFocusableElement().tabIndex=-1)),e.onNodeFocus(),this.lockFocusStateChanges=!1,n&&e===o.getRootFocusableNode()||s.hasAttribute("tabindex")||(s.tabIndex=-1),this.setNodeToVisualActiveFocus(e),s.focus()}passivelyFocusNode(e,t){this.lockFocusStateChanges=!0;let i=e.getFocusableTree();if(i!==t){let e;i.onTreeBlur(t),(null==(e=this.lookUpRegistration(i))?0:e.rootShouldBeAutoTabbable)&&(i.getRootFocusableNode().getFocusableElement().tabIndex=0)}e.onNodeBlur(),this.lockFocusStateChanges=!1,i!==t&&this.setNodeToVisualPassiveFocus(e)}setNodeToVisualActiveFocus(e){eq(e=e.getFocusableElement(),rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),e0(e,rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}setNodeToVisualPassiveFocus(e){e0(e=e.getFocusableElement(),rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),eq(e,rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}removeHighlight(e){e0(e=e.getFocusableElement(),rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),e0(e,rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}static getFocusManager(){return rG.focusManager||(rG.focusManager=new rG(document.addEventListener)),rG.focusManager}};rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME="blocklyActiveFocus",rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME="blocklyPassiveFocus",rG.focusManager=null;var rH={};rH.FocusManager=rG,rH.getFocusManager=$.getFocusManager$$module$build$src$core$focus_manager;var rU={};rU.deepMerge=ti;var rW=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),null==(t=e.keyCodes)?0:t.length)for(let i of t)this.addKeyMapping(i,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,i){e=`${e}`;let o=this.keyMap.get(e);if(o&&!i)throw Error(`Shortcut named "${t}" collides with shortcuts "${o}"`);o&&i?o.unshift(t):this.keyMap.set(e,[t])}removeKeyMapping(e,t,i){let o=this.keyMap.get(e);if(!o)return i||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1;let s=o.indexOf(t);return s>-1?(o.splice(s,1),0===o.length&&this.keyMap.delete(e),!0):(i||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1)}removeAllKeyMappings(e){for(let t of this.keyMap.keys())this.removeKeyMapping(t,e,!0)}setKeyMap(e){for(let t in this.keyMap.clear(),e)this.keyMap.set(t,e[t])}getKeyMap(){let e=Object.create(null);for(let[t,i]of this.keyMap)e[t]=i;return e}getRegistry(){let e=Object.create(null);for(let[t,i]of this.shortcuts)e[t]=i;return ti(Object.create(null),e)}onKeyDown(e,t){var i=this.serializeKeyEvent(t);if(!(i=this.getShortcutNamesByKeyCode(i)))return!1;for(let o of i){let s,n,r,l;if((i=this.shortcuts.get(o))&&(!i.preconditionFn||i.preconditionFn(e,{focusedNode:null!=(s=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode())?s:void 0}))&&(null==(r=(n=i).callback)?0:r.call(n,e,t,i,{focusedNode:null!=(l=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode())?l:void 0})))return!0}return!1}getShortcutNamesByKeyCode(e){let t;return(null==(t=this.keyMap.get(e))?void 0:t.slice())||[]}getKeyCodesByShortcutName(e){let t=[];for(let[i,o]of this.keyMap)o.indexOf(e)>-1&&t.push(i);return t}serializeKeyEvent(e){let t="";for(let i in rW.modifierKeys)e.getModifierState(i)&&(""!==t&&(t+="+"),t+=i);return""!==t&&e.keyCode?t+="+"+e.keyCode:e.keyCode&&(t=String(e.keyCode)),t}checkModifiers(e){for(let t of e)if(!(t in rW.modifierKeys))throw Error(t+" is not a valid modifier key.")}createSerializedKey(e,t){let i="";if(t)for(let e in this.checkModifiers(t),rW.modifierKeys)t.includes(rW.modifierKeys[e])&&(""!==i&&(i+="+"),i+=e);return""!==i&&e?i+="+"+e:e&&(i=`${e}`),i}};rW.registry=new rW,(rK=(rK=rW||(rW={})).modifierKeys||(rK.modifierKeys={}))[rK.Shift=16]="Shift",rK[rK.Control=17]="Control",rK[rK.Alt=18]="Alt",rK[rK.Meta=91]="Meta";var rV,rK,rY,rX,rz=Object.create(null),rj=[],rJ={defineBlocksWithJsonArrayInternal:function(e){$.defineBlocks$$module$build$src$core$common($.createBlockDefinitionsFromJsonArray$$module$build$src$core$common(e))}},rZ={TEST_ONLY:rJ};rZ.createBlockDefinitionsFromJsonArray=$.createBlockDefinitionsFromJsonArray$$module$build$src$core$common,rZ.defineBlocks=$.defineBlocks$$module$build$src$core$common,rZ.defineBlocksWithJsonArray=tE,rZ.draggingConnections=rj,rZ.fireSelectedEvent=th,rZ.getAllWorkspaces=ts,rZ.getBlockTypeCounts=t_,rZ.getMainWorkspace=tl,rZ.getParentContainer=tu,rZ.getSelected=tc,rZ.getWorkspaceById=to,rZ.globalShortcutHandler=tT,rZ.registerWorkspace=tn,rZ.setMainWorkspace=ta,rZ.setParentContainer=td,rZ.setSelected=function(e){$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)},rZ.svgResize=tp,rZ.unregisterWorkpace=tr;var rq,rQ=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=$.getGroup$$module$build$src$core$events$utils(),this.recordUndo=eG()}toJson(){return{type:this.type,group:this.group}}static fromJson(e,t,i){return i.isBlank=!1,i.group=e.group||"",i.workspaceId=t.id,i}isNull(){return!1}run(e){}getEventWorkspace_(){let e;if(this.workspaceId&&(e=to(this.workspaceId)),!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e}},r0=class extends rQ{constructor(e){super(),this.recordUndo=!1,this.isUiEvent=!0,this.isBlank=void 0===e,this.workspaceId=e||""}},r1=class extends r0{constructor(e,t,i){null===(t=e?e.workspace.id:t)&&(t=void 0),super(t),this.type=rL.CLICK,this.blockId=e?e.id:void 0,this.targetType=i}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new r1)).targetType=e.targetType,t.blockId=e.blockId,t}};(lf=rq||(rq={})).BLOCK="block",lf.WORKSPACE="workspace",lf.ZOOM_CONTROLS="zoom_controls",ea(D.EVENT,rL.CLICK,r1);var r2={};r2.Click=r1,r2.ClickTarget=rq;var r3={};r3.removeElem=tm;var r5=class{constructor(e){this.name=e}toString(){return this.name}};r5.POSITIONABLE=new r5("positionable"),r5.DRAG_TARGET=new r5("drag_target"),r5.DELETE_AREA=new r5("delete_area"),r5.AUTOHIDEABLE=new r5("autohideable");var r6=class{constructor(){this.componentData=new Map,this.capabilityToComponentIds=new Map}addComponent(e,t){let i=e.component.id;if(!t&&this.componentData.has(i)){var o;throw Error('Plugin "'+i+'" with capabilities "'+(null==(o=this.componentData.get(i))?void 0:o.capabilities)+'" already added.')}for(this.componentData.set(i,e),t=[],o=0;o<e.capabilities.length;o++){let s=String(e.capabilities[o]).toLowerCase();if(t.push(s),this.capabilityToComponentIds.has(s)){let e;null==(e=this.capabilityToComponentIds.get(s))||e.push(i)}else this.capabilityToComponentIds.set(s,[i])}this.componentData.get(i).capabilities=t}removeComponent(e){let t=this.componentData.get(e);if(t){for(let i=0;i<t.capabilities.length;i++){let o=String(t.capabilities[i]).toLowerCase();tm(this.capabilityToComponentIds.get(o),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{var i,o;t=`${t}`.toLowerCase(),null==(i=this.componentData.get(e))||i.capabilities.push(t),null==(o=this.capabilityToComponentIds.get(t))||o.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(),tm(this.componentData.get(e).capabilities,t),tm(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 null==(t=this.componentData.get(e))?void 0:t.component}getComponents(e,t){if(e=`${e}`.toLowerCase(),!(e=this.capabilityToComponentIds.get(e)))return[];let i=[];if(t){let t=[];e.forEach(e=>{t.push(this.componentData.get(e))}),t.sort(function(e,t){return e.weight-t.weight}),t.forEach(function(e){i.push(e.component)})}else e.forEach(e=>{i.push(this.componentData.get(e).component)});return i}};r6.Capability=r5,(lI=(lI=r6||(r6={})).ComponentWeight||(lI.ComponentWeight={}))[lI.TOOLBOX_WEIGHT=0]="TOOLBOX_WEIGHT",lI[lI.FLYOUT_WEIGHT=1]="FLYOUT_WEIGHT",lI[lI.TRASHCAN_WEIGHT=2]="TRASHCAN_WEIGHT",lI[lI.ZOOM_CONTROLS_WEIGHT=3]="ZOOM_CONTROLS_WEIGHT";var r4=r6.ComponentWeight,r8={};r8.ComponentManager=r6,r8.ComponentWeight=r4;var r9=!1,r7='\n.blocklySvg {\n background-color: #fff;\n outline: none;\n overflow: hidden; /* IE overflows by default. */\n position: absolute;\n display: block;\n}\n\n.blocklyWidgetDiv {\n display: none;\n position: absolute;\n z-index: 99999; /* big value for bootstrap3 compatibility */\n}\n\n.injectionDiv {\n height: 100%;\n position: relative;\n overflow: hidden; /* So blocks in drag surface disappear at edges */\n touch-action: none;\n user-select: none;\n -webkit-user-select: none;\n}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\n}\n\n.blocklyEmboss {\n filter: var(--blocklyEmbossFilter);\n}\n\n.blocklyTooltipDiv {\n background-color: #ffffc7;\n border: 1px solid #ddc;\n box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);\n color: #000;\n display: none;\n font: 9pt sans-serif;\n opacity: .9;\n padding: 2px;\n position: absolute;\n z-index: 100000; /* big value for bootstrap3 compatibility */\n}\n\n.blocklyDropDownDiv {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n display: none;\n border: 1px solid;\n border-color: #dadce0;\n background-color: #fff;\n border-radius: 2px;\n padding: 4px;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv:focus {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownContent {\n max-height: 300px; /* @todo: spec for maximum height. */\n}\n\n.blocklyDropDownArrow {\n position: absolute;\n left: 0;\n top: 0;\n width: 16px;\n height: 16px;\n z-index: -1;\n background-color: inherit;\n border-color: inherit;\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyHighlighted>.blocklyPath {\n filter: var(--blocklyEmbossFilter);\n}\n\n.blocklyHighlightedConnectionPath {\n fill: none;\n stroke: #fc3;\n stroke-width: 4px;\n}\n\n.blocklyPathLight {\n fill: none;\n stroke-linecap: round;\n stroke-width: 1;\n}\n\n.blocklySelected>.blocklyPathLight {\n display: none;\n}\n\n.blocklyDraggable {\n cursor: grab;\n cursor: -webkit-grab;\n}\n\n.blocklyDragging {\n cursor: grabbing;\n cursor: -webkit-grabbing;\n /* Drag surface disables events to not block the toolbox, so we have to\n * reenable them here for the cursor values to work. */\n pointer-events: auto;\n}\n\n /* Changes cursor on mouse down. Not effective in Firefox because of\n https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */\n.blocklyDraggable:active {\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n.blocklyDragging.blocklyDraggingDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyDragging>.blocklyPath,\n.blocklyDragging>.blocklyPathLight {\n fill-opacity: .8;\n stroke-opacity: .8;\n}\n\n.blocklyDragging>.blocklyPathDark {\n display: none;\n}\n\n.blocklyDisabledPattern>.blocklyPath {\n fill: var(--blocklyDisabledPattern);\n fill-opacity: .5;\n stroke-opacity: .5;\n}\n\n.blocklyDisabled>.blocklyPathLight,\n.blocklyDisabled>.blocklyPathDark {\n display: none;\n}\n\n.blocklyInsertionMarker>.blocklyPath,\n.blocklyInsertionMarker>.blocklyPathLight,\n.blocklyInsertionMarker>.blocklyPathDark {\n fill-opacity: .2;\n stroke: none;\n}\n\n.blocklyNonEditableField>text {\n pointer-events: none;\n}\n\n.blocklyFlyout {\n position: absolute;\n z-index: 20;\n}\n\n.blocklyText text {\n cursor: default;\n}\n\n/*\n Don\'t allow users to select text. It gets annoying when trying to\n drag a block and selected text moves instead.\n*/\n.blocklySvg text {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n cursor: inherit;\n}\n\n.blocklyIconGroup {\n cursor: default;\n}\n\n.blocklyIconGroup:not(:hover),\n.blocklyIconGroupReadonly {\n opacity: .6;\n}\n\n.blocklyIconShape {\n fill: #00f;\n stroke: #fff;\n stroke-width: 1px;\n}\n\n.blocklyIconSymbol {\n fill: #fff;\n}\n\n.blocklyMinimalBody {\n margin: 0;\n padding: 0;\n height: 100%;\n}\n\n.blocklyHtmlInput {\n border: none;\n border-radius: 4px;\n height: 100%;\n margin: 0;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: center;\n display: block;\n box-sizing: border-box;\n}\n\n/* Remove the increase and decrease arrows on the field number editor */\ninput.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,\ninput.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\ninput[type=number] {\n -moz-appearance: textfield;\n}\n\n.blocklyMainBackground {\n stroke-width: 1;\n stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */\n}\n\n.blocklyMutatorBackground {\n fill: #fff;\n stroke: #ddd;\n stroke-width: 1;\n}\n\n.blocklyFlyoutBackground {\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyMainWorkspaceScrollbar {\n z-index: 20;\n}\n\n.blocklyFlyoutScrollbar {\n z-index: 30;\n}\n\n.blocklyScrollbarHorizontal,\n.blocklyScrollbarVertical {\n position: absolute;\n outline: none;\n}\n\n.blocklyScrollbarBackground {\n opacity: 0;\n pointer-events: none;\n}\n\n.blocklyScrollbarHandle {\n fill: #ccc;\n}\n\n.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyScrollbarHandle:hover {\n fill: #bbb;\n}\n\n/* Darken flyout scrollbars due to being on a grey background. */\n/* By contrast, workspace scrollbars are on a white background. */\n.blocklyFlyout .blocklyScrollbarHandle {\n fill: #bbb;\n}\n\n.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyFlyout .blocklyScrollbarHandle:hover {\n fill: #aaa;\n}\n\n.blocklyInvalidInput {\n background: #faa;\n}\n\n.blocklyVerticalMarker {\n stroke-width: 3px;\n fill: rgba(255,255,255,.5);\n pointer-events: none;\n}\n\n.blocklyComputeCanvas {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.blocklyNoPointerEvents {\n pointer-events: none;\n}\n\n.blocklyContextMenu {\n border-radius: 4px;\n max-height: 100%;\n}\n\n.blocklyDropdownMenu {\n border-radius: 2px;\n padding: 0 !important;\n}\n\n.blocklyDropdownMenu .blocklyMenuItem {\n /* 28px on the left for icon or checkbox. */\n padding-left: 28px;\n}\n\n/* BiDi override for the resting state. */\n.blocklyDropdownMenu .blocklyMenuItemRtl {\n /* Flip left/right padding for BiDi. */\n padding-left: 5px;\n padding-right: 28px;\n}\n\n.blocklyWidgetDiv .blocklyMenu {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background: #fff;\n border: 1px solid transparent;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n font: normal 13px Arial, sans-serif;\n margin: 0;\n outline: none;\n padding: 4px 0;\n position: absolute;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n.blocklyWidgetDiv .blocklyMenu:focus {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background: inherit; /* Compatibility with gapi, reset from goog-menu */\n border: inherit; /* Compatibility with gapi, reset from goog-menu */\n font: normal 13px "Helvetica Neue", Helvetica, sans-serif;\n outline: none;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n/* State: resting. */\n.blocklyMenuItem {\n border: none;\n color: #000;\n cursor: pointer;\n list-style: none;\n margin: 0;\n /* 7em on the right for shortcut. */\n min-width: 7em;\n padding: 6px 15px;\n white-space: nowrap;\n}\n\n/* State: disabled. */\n.blocklyMenuItemDisabled {\n color: #ccc;\n cursor: inherit;\n}\n\n/* State: hover. */\n.blocklyMenuItemHighlight {\n background-color: rgba(0,0,0,.1);\n}\n\n/* State: selected/checked. */\n.blocklyMenuItemCheckbox {\n height: 16px;\n position: absolute;\n width: 16px;\n}\n\n.blocklyMenuItemSelected .blocklyMenuItemCheckbox {\n background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;\n float: left;\n margin-left: -24px;\n position: static; /* Scroll with the menu. */\n}\n\n.blocklyMenuItemRtl .blocklyMenuItemCheckbox {\n float: right;\n margin-right: -24px;\n}\n\n.blocklyMenuSeparator {\n background-color: #ccc;\n height: 1px;\n border: 0;\n margin-left: 4px;\n margin-right: 4px;\n}\n\n.blocklyBlockDragSurface, .blocklyAnimationLayer {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: visible !important;\n z-index: 80;\n pointer-events: none;\n}\n\n.blocklyField {\n cursor: default;\n}\n\n.blocklyInputField {\n cursor: text;\n}\n\n.blocklyDragging .blocklyField,\n.blocklyDragging .blocklyIconGroup {\n cursor: grabbing;\n}\n\n.blocklyActiveFocus:is(\n .blocklyFlyout,\n .blocklyWorkspace,\n .blocklyField,\n .blocklyPath,\n .blocklyHighlightedConnectionPath,\n .blocklyComment,\n .blocklyBubble,\n .blocklyIconGroup,\n .blocklyTextarea\n) {\n outline: none;\n}\n',le={};le.inject=tI,le.register=tf;var lt=class{constructor(e,t){this.x=e,this.y=t}clone(){return new lt(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||!!e&&!!t&&e.x===t.x&&e.y===t.y}static distance(e,t){let i=e.x-t.x;return Math.sqrt(i*i+(e=e.y-t.y)*e)}static magnitude(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static difference(e,t){return new lt(e.x-t.x,e.y-t.y)}static sum(e,t){return new lt(e.x+t.x,e.y+t.y)}},li=class{constructor(e){this.tagName=e}toString(){return this.tagName}};li.ANIMATE=new li("animate"),li.CIRCLE=new li("circle"),li.CLIPPATH=new li("clipPath"),li.DEFS=new li("defs"),li.FECOMPOSITE=new li("feComposite"),li.FECOMPONENTTRANSFER=new li("feComponentTransfer"),li.FEFLOOD=new li("feFlood"),li.FEFUNCA=new li("feFuncA"),li.FEGAUSSIANBLUR=new li("feGaussianBlur"),li.FEPOINTLIGHT=new li("fePointLight"),li.FESPECULARLIGHTING=new li("feSpecularLighting"),li.FILTER=new li("filter"),li.FOREIGNOBJECT=new li("foreignObject"),li.G=new li("g"),li.IMAGE=new li("image"),li.LINE=new li("line"),li.PATH=new li("path"),li.PATTERN=new li("pattern"),li.POLYGON=new li("polygon"),li.RECT=new li("rect"),li.SVG=new li("svg"),li.TEXT=new li("text"),li.TSPAN=new li("tspan");var lo=class{constructor(e,t,i,o){this.top=e,this.bottom=t,this.left=i,this.right=o}static from(e){return new lo(e.y,e.y+e.height,e.x,e.x+e.width)}clone(){return new lo(this.top,this.bottom,this.left,this.right)}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}getOrigin(){return new lt(this.left,this.top)}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||!!e&&!!t&&e.top===t.top&&e.bottom===t.bottom&&e.left===t.left&&e.right===t.right}static createFromPoint(e,t,i){let o=e.x;return new lo(e=e.y,e+i,o,o+t)}},ls=class{constructor(e,t){this.width=e,this.height=t}static equals(e,t){return e===t||!!e&&!!t&&e.width===t.width&&e.height===t.height}static max(e,t){return new ls(Math.max(e.width,t.width),Math.max(e.height,t.height))}static min(e,t){return new ls(Math.min(e.width,t.width),Math.min(e.height,t.height))}},ln={getSizeInternal:function(e){if("none"!==tb(e,"display"))return tR(e);let t=e.style,i=t.display,o=t.visibility,s=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";let n=e.offsetWidth;return e=e.offsetHeight,t.display=i,t.position=s,t.visibility=o,new ls(n,e)}},lr={TEST_ONLY:ln};lr.getBorderBox=tA,lr.getComputedStyle=tb,lr.getContainerOffsetToScrollInto=tN,lr.getPageOffset=tC,lr.getSize=tS,lr.getViewportPageOffset=tO,lr.scrollIntoContainerView=t$;var ll=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,la=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,lc={TEST_ONLY:{XY_REGEX:ll,XY_STYLE_REGEX:la}};lc.getDocumentScroll=tk,lc.getInjectionDivXY=ty,lc.getRelativeXY=tL,lc.getViewportBBox=tD,lc.screenToWsCoordinates=tw,lc.wsToScreenCoordinates=tM;var lh=class{constructor(e,t,i,o,s){this.workspace=e,this.horizontal=t,this.oldHostMetrics=null,this.ratio=1,this.origin=new lt(0,0),this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0,this.containerVisible=this.isHandleVisible=!0,this.position=new lt(0,0),this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null,this.pair=i||!1,this.margin=void 0!==s?s:lh.DEFAULT_SCROLLBAR_MARGIN,e="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical"),o&&(e+=" "+o),this.outerSvg=eZ(li.SVG,{class:e}),o=eZ(li.G,{},this.outerSvg),this.svgBackground=eZ(li.RECT,{class:"blocklyScrollbarBackground"},o),e=Math.floor((lh.scrollbarThickness-5)/2),this.svgHandle=eZ(li.RECT,{class:"blocklyScrollbarHandle",rx:e,ry:e},o),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarColour","fill"),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarOpacity","fill-opacity"),e3(this.outerSvg,this.workspace.getParentSvg()),this.setInitialThickness(),t?(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=eb(this.svgBackground,"pointerdown",this,this.onMouseDownBar),this.onMouseDownHandleWrapper_=eb(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){let e=lh.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(),eO(this.onMouseDownBarWrapper_),eO(this.onMouseDownHandleWrapper_),e2(this.outerSvg),this.workspace.getThemeManager().unsubscribe(this.svgHandle)}constrainHandleLength(e){return e=e<=0||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=e<=0||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,e5(this.outerSvg,"translate("+(this.position.x+this.origin.x)+"px,"+(this.position.y+this.origin.y)+"px)")}resize(e){(e||(e=this.workspace.getMetrics()))&&(this.oldHostMetrics&&lh.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}resizeHorizontal(e){this.requiresViewResize(e)?this.resizeViewHorizontal(e):this.resizeContentHorizontal(e)}resizeViewHorizontal(e){var t=e.viewWidth-2*this.margin;this.pair&&(t-=lh.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&(t+=lh.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-lh.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 i=this.scrollbarLength-this.handleLength;e=(e.viewLeft-e.scrollLeft)/t*i,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=i/t}}resizeVertical(e){this.requiresViewResize(e)?this.resizeViewVertical(e):this.resizeContentVertical(e)}resizeViewVertical(e){let t=e.viewHeight-2*this.margin;this.pair&&(t-=lh.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-lh.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 i=this.scrollbarLength-this.handleLength;e=(e.viewTop-e.scrollTop)/t*i,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=i/t}}isVisible(){return this.isHandleVisible}setContainerVisible(e){let 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){let 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(),ef(),this.cleanUp(),e$(e))e.stopPropagation();else{var t=eN(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var i=ty(this.svgHandle);i=this.horizontal?i.x:i.y;var o=this.handlePosition,s=.95*this.handleLength;t<=i?o-=s:t>=i+this.handleLength&&(o+=s),this.setHandlePosition(this.constrainHandlePosition(o)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),e$(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=eb(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=eb(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(){ef(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&(eO(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onMouseMoveWrapper_&&(eO(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){let e=this.handlePosition/(this.scrollbarLength-this.handleLength);return isNaN(e)&&(e=0),e}updateMetrics(){let 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||void 0===t)&&this.updateMetrics()}setOrigin(e,t){this.origin=new lt(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}};lh.scrollbarThickness=v?25:15,lh.DEFAULT_SCROLLBAR_MARGIN=.5;var lu={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},ld={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:lp,DOMParser:l_,XMLSerializer:lg}=globalThis;l_&&(lu=new l_),lg&&(ld=new lg);var lE="https://developers.google.com/blockly/xml",lT=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,lm={NAME_SPACE:lE};lm.createElement=$.createElement$$module$build$src$core$utils$xml,lm.createTextNode=$.createTextNode$$module$build$src$core$utils$xml,lm.domToText=tv,lm.injectDependencies=function(e){({document:lp=lp,DOMParser:l_=l_,XMLSerializer:lg=lg}=e),lu=new l_,ld=new lg},lm.textToDom=$.textToDom$$module$build$src$core$utils$xml;var lf,lI,lS,lR="categoryToolbox",lb="flyoutToolbox";(lM=lS||(lS={}))[lM.TOP=0]="TOP",lM[lM.BOTTOM=1]="BOTTOM",lM[lM.LEFT=2]="LEFT",lM[lM.RIGHT=3]="RIGHT";var lC={hasCategoriesInternal:function(e){if(!e)return!1;let t=e.kind;return t?t===lR:!!e.contents.filter(e=>"CATEGORY"===e.kind.toUpperCase()).length}},lO={};lO.Position=lS,lO.TEST_ONLY=lC,lO.convertFlyoutDefToJsonArray=tF,lO.convertToolboxDefToJson=tB,lO.hasCategories=tG,lO.isCategoryCollapsible=tH,lO.parseToolboxTree=tK,(lv=lx||(lx={}))[lv.TOP=0]="TOP",lv[lv.BOTTOM=1]="BOTTOM",(lP=lF||(lF={}))[lP.LEFT=0]="LEFT",lP[lP.RIGHT=1]="RIGHT",(lB=lG||(lG={}))[lB.UP=0]="UP",lB[lB.DOWN=1]="DOWN";var lA={};lA.bumpDirection=lG,lA.bumpPositionRect=tz,lA.getCornerOppositeToolbox=tX,lA.getStartPositionRect=tY,lA.horizontalPosition=lF,lA.verticalPosition=lx;var l$="sprites.png",lN=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=eZ(li.G,{});let 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:r6.ComponentWeight.ZOOM_CONTROLS_WEIGHT,capabilities:[r6.Capability.POSITIONABLE]}),this.initialized=!0}dispose(){for(let e of(this.workspace.getComponentManager().removeComponent("zoomControls"),this.svgGroup&&e2(this.svgGroup),this.boundEvents))eO(e);this.boundEvents.length=0}getBoundingRectangle(){let e=this.SMALL_SPACING+2*this.HEIGHT;return this.zoomResetGroup&&(e+=this.LARGE_SPACING+this.HEIGHT),new lo(this.top,this.top+e,this.left,this.left+this.WIDTH)}position(e,t){if(this.initialized){var i,o=tX(this.workspace,e),s=this.SMALL_SPACING+2*this.HEIGHT;if(this.zoomResetGroup&&(s+=this.LARGE_SPACING+this.HEIGHT),e=tY(o,new ls(this.WIDTH,s),this.MARGIN_HORIZONTAL,this.MARGIN_VERTICAL,e,this.workspace),o=o.vertical,t=tz(e,this.MARGIN_VERTICAL,o===lx.TOP?lG.DOWN:lG.UP,t),o===lx.TOP){var n,r=this.SMALL_SPACING+this.HEIGHT;null==(n=this.zoomInGroup)||n.setAttribute("transform","translate(0, "+r+")"),this.zoomResetGroup&&this.zoomResetGroup.setAttribute("transform","translate(0, "+(r+this.LARGE_SPACING+this.HEIGHT)+")")}else{let e;n=this.zoomResetGroup?this.LARGE_SPACING+this.HEIGHT:0,null==(e=this.zoomInGroup)||e.setAttribute("transform","translate(0, "+n+")"),n=n+this.SMALL_SPACING+this.HEIGHT,null==(r=this.zoomOutGroup)||r.setAttribute("transform","translate(0, "+n+")")}this.top=t.top,this.left=t.left,null==(i=this.svgGroup)||i.setAttribute("transform","translate("+this.left+","+this.top+")")}}createZoomOutSvg(e){this.zoomOutGroup=eZ(li.G,{class:"blocklyZoom blocklyZoomOut"},this.svgGroup);let t=eZ(li.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup);eZ(li.RECT,{width:32,height:32},t),eZ(li.IMAGE,{width:96,height:124,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup).setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),this.boundEvents.push(eb(this.zoomOutGroup,"pointerdown",null,this.zoom.bind(this,-1)))}createZoomInSvg(e){this.zoomInGroup=eZ(li.G,{class:"blocklyZoom blocklyZoomIn"},this.svgGroup);let t=eZ(li.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup);eZ(li.RECT,{width:32,height:32},t),eZ(li.IMAGE,{width:96,height:124,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup).setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),this.boundEvents.push(eb(this.zoomInGroup,"pointerdown",null,this.zoom.bind(this,1)))}zoom(e,t){this.workspace.markFocused(),this.workspace.zoomCenter(e),this.fireZoomEvent(),ef(),t.stopPropagation(),t.preventDefault()}createZoomResetSvg(e){this.zoomResetGroup=eZ(li.G,{class:"blocklyZoom blocklyZoomReset"},this.svgGroup);let t=eZ(li.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup);eZ(li.RECT,{width:32,height:32},t),eZ(li.IMAGE,{width:96,height:124,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup).setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),this.boundEvents.push(eb(this.zoomResetGroup,"pointerdown",null,this.resetZoom.bind(this)))}resetZoom(e){this.workspace.markFocused();let 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(),ef(),e.stopPropagation(),e.preventDefault()}fireZoomEvent(){eH(new(ej(rL.CLICK))(null,this.workspace.id,"zoom_controls"))}};tf("\n.blocklyZoom>image, .blocklyZoom>svg>image {\n opacity: .4;\n}\n\n.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {\n opacity: .6;\n}\n\n.blocklyZoom>image:active, .blocklyZoom>svg>image:active {\n opacity: .8;\n}\n");var lL={};lL.register=tj,lL.unregister=function(e){eh(D.SERIALIZER,e)};var ly=class{constructor(){this.priority=25}save(e){let t=[];for(let i of e.getTopComments())(e=tJ(i,{addCoordinates:!0,saveIds:!0}))&&t.push(e);return t.length?t:null}load(e,t){for(let i of e)tZ(i,t,{recordUndo:eG()})}clear(e){for(let t of e.getTopComments())t.dispose()}};tj("workspaceComments",new ly);var lD={};lD.WorkspaceCommentSerializer=ly,lD.append=tZ,lD.save=tJ;var lk={};lk.register=tq,lk.unregister=function(e){eh(D.PASTER,e)};var lw=class{paste(e,t,i){let o;e=e.commentState,i&&(e.x=i.x,e.y=i.y),$.disable$$module$build$src$core$events$utils();try{o=tZ(e,t),tQ(o)}finally{$.enable$$module$build$src$core$events$utils()}return o?(eY()&&eH(new(ej(rL.COMMENT_CREATE))(o)),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(o),o):null}};lw.TYPE="workspace-comment",tq(lw.TYPE,new lw),$.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:28,connectingSnapRadius:28,currentConnectionPreference:8,bumpDelay:250},$.config$$module$build$src$core$config;var lM,lv,lP,lB,lx,lF,lG,lH,lU="aria-",lW="role";(a$=lH||(lH={})).GRID="grid",a$.GRIDCELL="gridcell",a$.GROUP="group",a$.LISTBOX="listbox",a$.MENU="menu",a$.MENUITEM="menuitem",a$.MENUITEMCHECKBOX="menuitemcheckbox",a$.OPTION="option",a$.PRESENTATION="presentation",a$.ROW="row",a$.TREE="tree",a$.TREEITEM="treeitem",a$.SEPARATOR="separator",a$.STATUS="status",(aN=aD||(aD={})).ACTIVEDESCENDANT="activedescendant",aN.COLCOUNT="colcount",aN.DISABLED="disabled",aN.EXPANDED="expanded",aN.INVALID="invalid",aN.LABEL="label",aN.LABELLEDBY="labelledby",aN.LEVEL="level",aN.ORIENTATION="orientation",aN.POSINSET="posinset",aN.ROWCOUNT="rowcount",aN.SELECTED="selected",aN.SETSIZE="setsize",aN.VALUEMAX="valuemax",aN.VALUEMIN="valuemin",aN.LIVE="live",aN.HIDDEN="hidden";var lV={};lV.Role=lH,lV.State=aD,lV.setRole=t1,lV.setState=t2;var lK=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(){let e=document.createElement("div");e.id=ey(),this.element=e,e.className="blocklyMenuItem "+(this.enabled?"":"blocklyMenuItemDisabled ")+(this.checked?"blocklyMenuItemSelected ":"")+(this.highlight?"blocklyMenuItemHighlight ":"")+(this.rightToLeft?"blocklyMenuItemRtl ":"");let t=document.createElement("div");if(t.className="blocklyMenuItemContent",this.checkable){var i=document.createElement("div");i.className="blocklyMenuItemCheckbox ",t.appendChild(i)}return i=this.content,"string"==typeof this.content&&(i=document.createTextNode(this.content)),t.appendChild(i),e.appendChild(t),this.roleName&&t1(e,this.roleName),t2(e,aD.SELECTED,this.checkable&&this.checked||!1),t2(e,aD.DISABLED,!this.enabled),e}dispose(){this.element=null}getElement(){return this.element}getId(){return this.element.id}getValue(){let e;return null!=(e=this.opt_value)?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;let t=this.getElement();t&&this.isEnabled()&&(e?eq(t,"blocklyMenuItemHighlight"):e0(t,"blocklyMenuItemHighlight"))}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}performAction(e){this.isEnabled()&&this.actionHandler&&this.actionHandler(this,e)}onAction(e,t){this.actionHandler=e.bind(t)}},lY=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){let t=document.createElement("div");t.className="blocklyMenu",t.tabIndex=0,this.roleName&&t1(t,this.roleName),this.element=t;for(let e=0,i;i=this.menuItems[e];e++)t.appendChild(i.createDom());return this.pointerMoveHandler=eb(t,"pointermove",this,this.handlePointerMove,!0),this.clickHandler=eb(t,"pointerup",this,this.handleClick,!0),this.pointerEnterHandler=eb(t,"pointerenter",this,this.handlePointerEnter,!0),this.pointerLeaveHandler=eb(t,"pointerleave",this,this.handlePointerLeave,!0),this.onKeyDownHandler=eb(t,"keydown",this,this.handleKeyEvent),e.appendChild(t),t}getElement(){return this.element}focus(){let e=this.getElement();e&&e.focus({preventScroll:!0})}blur(){let e=this.getElement();e&&e.blur()}setRole(e){this.roleName=e}dispose(){this.pointerMoveHandler&&(eO(this.pointerMoveHandler),this.pointerMoveHandler=null),this.clickHandler&&(eO(this.clickHandler),this.clickHandler=null),this.pointerEnterHandler&&(eO(this.pointerEnterHandler),this.pointerEnterHandler=null),this.pointerLeaveHandler&&(eO(this.pointerLeaveHandler),this.pointerLeaveHandler=null),this.onKeyDownHandler&&(eO(this.onKeyDownHandler),this.onKeyDownHandler=null);for(let e=0,t;t=this.menuItems[e];e++)t.dispose();this.element=null}getMenuItem(e){let t=this.getElement();for(;e&&e!==t;){if(e.classList.contains("blocklyMenuItem")){let t=this.getMenuItems();for(let i=0,o;o=t[i];i++)if(o.getElement()===e)return o}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();let i=e.getElement();t&&i&&(t$(i,t),t2(t,aD.ACTIVEDESCENDANT,e.getId()))}}highlightNext(){let e=this.highlightedItem?this.menuItems.indexOf(this.highlightedItem):-1;this.highlightHelper(e,1)}highlightPrevious(){let e=this.highlightedItem?this.menuItems.indexOf(this.highlightedItem):-1;this.highlightHelper(e<0?this.menuItems.length:e,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(e,t){let i;e+=t;let o=this.getMenuItems();for(;i=o[e];){if(i.isEnabled()){this.setHighlighted(i);break}e+=t}}handlePointerMove(e){0!==Math.max(Math.abs(e.movementX),Math.abs(e.movementY))&&(e=this.getMenuItem(e.target))&&(e.isEnabled()?this.highlightedItem!==e&&this.setHighlighted(e):this.setHighlighted(null))}handleClick(e){var t=this.openingCoords;if(this.openingCoords=null,t&&"number"==typeof e.clientX){let i=new lt(e.clientX,e.clientY);if(1>lt.distance(t,i))return}(t=this.getMenuItem(e.target))&&t.performAction(e)}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(e);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(){let e=this.getElement(),t=tS(e);return t.height=e.scrollHeight,t}getMenuItems(){return this.menuItems.filter(e=>e instanceof lK)}},lX=class{constructor(){this.element=null}createDom(){return this.element=document.createElement("hr"),this.element.className="blocklyMenuSeparator",t1(this.element,lH.SEPARATOR),this.element}dispose(){let e;null==(e=this.element)||e.remove(),this.element=null}},lz="_TEMP_COLLAPSED_INPUT",lj="_TEMP_COLLAPSED_FIELD",lJ="MANUALLY_DISABLED";(aL=$.inputTypes$$module$build$src$core$inputs$input_types||($.inputTypes$$module$build$src$core$inputs$input_types={}))[aL.VALUE=1]="VALUE",aL[aL.STATEMENT=3]="STATEMENT",aL[aL.DUMMY=5]="DUMMY",aL[aL.CUSTOM=6]="CUSTOM",aL[aL.END_ROW=7]="END_ROW",$.inputTypes$$module$build$src$core$inputs$input_types;var lZ=new Set,lq=new WeakSet,lQ=new WeakMap,l0=null,l1=null,l2=0,l3={};l3.finishQueuedRenders=t6,l3.queueRender=t5,l3.triggerQueuedRenders=t4,$.Msg$$module$build$src$core$msg=Object.create(null),ak=function(e){Object.keys(e).forEach(function(t){$.Msg$$module$build$src$core$msg[t]=e[t]})},aw={Msg:$.Msg$$module$build$src$core$msg,setLocale:ak};var l5="blocklyToast",l6="blocklyToastMessage",l4="blocklyToastCloseButton",l8=class{static show(e,t){if(t.oncePerSession&&t.id){if(this.shownIds.has(t.id))return;this.shownIds.add(t.id)}this.hide(e);let i=this.createDom(e,t);requestAnimationFrame(()=>{i.style.bottom="2rem"})}static createDom(e,t){let i,{message:o,duration:s=5,assertiveness:n=l8.Assertiveness.POLITE}=t,r=document.createElement("div");e.getInjectionDiv().appendChild(r),r.dataset.toastId=t.id,r.className=l5,t1(r,lH.STATUS),t2(r,aD.LIVE,n),(t=r.appendChild(document.createElement("div"))).className=l6,t.innerText=o,(t=r.appendChild(document.createElement("button"))).className=l4,t2(t,aD.LABEL,$.Msg$$module$build$src$core$msg.CLOSE);var l=eZ(li.SVG,{width:24,height:24,viewBox:"0 0 24 24",fill:"none"},t);return t2(l,aD.HIDDEN,!0),eZ(li.RECT,{x:19.7782,y:2.80762,width:2,height:24,transform:"rotate(45, 19.7782, 2.80762)",fill:"black"},l),eZ(li.RECT,{x:2.80762,y:4.22183,width:2,height:24,transform:"rotate(-45, 2.80762, 4.22183)",fill:"black"},l),t.addEventListener("click",()=>{r.remove(),e.markFocused()}),t=()=>{i=setTimeout(()=>r.remove(),1e3*s)},l=()=>clearTimeout(i),r.addEventListener("focusin",l),r.addEventListener("focusout",t),r.addEventListener("mouseenter",l),r.addEventListener("mousemove",l),r.addEventListener("mouseleave",t),t(),r}static hide(e,t){(e=e.getInjectionDiv().querySelector(`.${l5}`))instanceof HTMLElement&&(!t||t===e.dataset.toastId)&&e.remove()}};l8.shownIds=new Set,(ay=(ay=l8||(l8={})).Assertiveness||(ay.Assertiveness={})).ASSERTIVE="assertive",ay.POLITE="polite",tf(`
|
|
2
2
|
.${l5} {
|
|
3
3
|
font-size: 1.2rem;
|
|
4
4
|
position: absolute;
|
|
@@ -31,10 +31,10 @@ let e,t,i;import"./mced.a4de160c.js";var o,s,n,r=globalThis;function l(e){return
|
|
|
31
31
|
}
|
|
32
32
|
`);var l9=function(e,t){window.alert(e),t&&t()},l7=l9,ae=function(e,t){t(window.confirm(e))},at=ae,ai=function(e,t,i){i(window.prompt(e,t))},ao=ai,as=l8.show.bind(l8),an=as,ar={};ar.alert=io,ar.confirm=is,ar.prompt=ir,ar.setAlert=function(e=l9){l7=e},ar.setConfirm=function(e=ae){at=e},ar.setPrompt=function(e=ai){ao=e},ar.setToast=function(e=as){an=e},ar.toast=function(e,t){an(e,t)};var al={};al.isLegacyProcedureCallBlock=ia,al.isLegacyProcedureDefBlock=il;var aa=new Set,ac={};ac.warn=ih;var ah="VARIABLE",au="ijkmnopqrstuvwxyzabcdefgh",ad={generateUniqueNameInternal:function(e){return im(au.charAt(0),e.getVariableMap().getAllVariables().map(e=>e.getName()))}},ap={CATEGORY_NAME:ah,TEST_ONLY:ad,VAR_LETTER_OPTIONS:au};ap.allDeveloperVariables=$.allDeveloperVariables$$module$build$src$core$variables,ap.allUsedVarModels=$.allUsedVarModels$$module$build$src$core$variables,ap.compareByName=iy,ap.createVariableButtonHandler=iI,ap.deleteVariable=$.deleteVariable$$module$build$src$core$variables,ap.flyoutCategory=id,ap.flyoutCategoryBlocks=iE,ap.generateUniqueName=iT,ap.generateUniqueNameFromOptions=im,ap.generateVariableFieldDom=i$,ap.getAddedVariables=iL,ap.getOrCreateVariablePackage=$.getOrCreateVariablePackage$$module$build$src$core$variables,ap.getVariable=$.getVariable$$module$build$src$core$variables,ap.getVariableUsesById=iD,ap.internalFlyoutCategory=iu,ap.jsonFlyoutCategoryBlocks=i_,ap.nameUsedWithAnyType=ib,ap.nameUsedWithConflictingParam=iC,ap.promptName=iS,ap.renameVariable=$.renameVariable$$module$build$src$core$variables;var a_=class extends Error{},ag=class extends a_{constructor(e){super("Expected to find a 'type' property, defining the block type"),this.state=e}},aE=class extends a_{constructor(e,t,i){super(`The block ${t.toDevString()} is missing a(n) ${e}
|
|
33
33
|
connection`),this.block=t,this.state=i}},aT=class extends a_{constructor(e,t,i,o){super(`The block ${i.toDevString()} could not connect its
|
|
34
|
-
${t} to its parent, because: ${e}`),this.childBlock=i,this.childState=o}},am=class extends a_{constructor(e){super("Encountered a real block which is defined as a child of a shadow\nblock. It is an invariant of Blockly that shadow blocks only have shadow\nchildren"),this.state=e}},af=class extends a_{constructor(e,t,i){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=i}},aI={};aI.BadConnectionCheck=aT,aI.DeserializationError=a_,aI.MissingBlockType=ag,aI.MissingConnection=aE,aI.RealChildOfShadow=am,aI.UnregisteredIcon=af;var aS=class{constructor(){this.priority=50}save(e){let t=[];for(let i of e.getTopBlocks(!1))(e=ik(i,{addCoordinates:!0,doFullSerialization:!1}))&&t.push(e);return t.length?{languageVersion:0,blocks:t}:null}load(e,t){for(let i of e=e.blocks)iH(i,t,{recordUndo:eG()})}clear(e){for(let t of e.getTopBlocks(!1))t.dispose(!1)}};tj("blocks",new aS);var aR={};aR.BlockSerializer=aS,aR.append=iH,aR.appendInternal=iU,aR.save=ik;var ab=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};ab.MUTATOR=new ab("mutator"),ab.WARNING=new ab("warning"),ab.COMMENT=new ab("comment");var aC=class extends rQ{constructor(e){super(),this.isBlank=!e,e&&(this.blockId=e.id,this.workspaceId=e.workspace.id)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new aC)).blockId=e.blockId,t}},aO=class extends aC{constructor(e,t,i,o,s){super(e),this.type=rL.BLOCK_CHANGE,e&&(this.element=t,this.name=i||void 0,this.oldValue=o,this.newValue=s)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new aO)).element=e.element,t.name=e.name,t.oldValue=e.oldValue,t.newValue=e.newValue,void 0!==e.disabledReason&&(t.disabledReason=e.disabledReason),t}setDisabledReason(e){if("disabled"!==this.element)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,i=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");if(!(i=i.getBlockById(this.blockId)))throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");let o=i.getIcon(ab.MUTATOR);switch(o&&i1(o)&&o.bubbleIsVisible()&&o.setBubbleVisible(!1),e=e?this.newValue:this.oldValue,this.element){case"field":(i=i.getField(this.name))?i.setValue(e):console.warn("Can't set non-existent field: "+this.name);break;case"comment":i.setCommentText(e||null);break;case"collapsed":i.setCollapsed(!!e);break;case"disabled":i.setDisabledReason(!!e,null!=(t=this.disabledReason)?t:lJ);break;case"inline":i.setInputsInline(!!e);break;case"mutation":t=aO.getExtraBlockState_(i),i.loadExtraState?i.loadExtraState(JSON.parse(e||"{}")):i.domToMutation&&i.domToMutation($.textToDom$$module$build$src$core$utils$xml(e||"<mutation/>")),eH(new aO(i,"mutation",null,t,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())?sg(e):""}};ea(D.EVENT,rL.BLOCK_CHANGE,aO);var aA={};aA.clamp=i3,aA.toDegrees=function(e){return 180*e/Math.PI},aA.toRadians=i2;var a$,aN,aL,ay,aD,ak,aw,av,aM,aP,aB=16,ax=1,aF=12,aG=16,aH=.25,aU=null,aW=null,aV="",aK="",aX=null,aY=null,az=null,aj=null,aJ=null,aZ={getBoundsInfo:function(){let e=tC(aX),t=tS(aX);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,i,o){var s;let n=aZ.getBoundsInfo(),r=tS(av);return t+r.height<n.bottom?on(e,t,n,r):o-r.height>n.top?or(i,o,n,r):t+r.height<document.documentElement.clientHeight?on(e,t,n,r):o-r.height>document.documentElement.clientTop?or(i,o,n,r):{initialX:(s=ol(s=e,n.left,n.right,r.width)).divX,initialY:0,finalX:s.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}}},aq={ANIMATION_TIME:.25,ARROW_HORIZONTAL_PADDING:12,ARROW_SIZE:16,BORDER_SIZE:1,PADDING_Y:16,TEST_ONLY:aZ};aq.clearContent=i9,aq.createDom=i5,aq.getContentDiv=i8,aq.getOwner=i4,aq.getPositionX=ol,aq.hide=oh,aq.hideIfOwner=oc,aq.hideWithoutAnimation=ou,aq.isVisible=oa,aq.repositionForWindowResize=op,aq.setBoundsElement=i6,aq.setColour=i7,aq.show=os,aq.showPositionedByBlock=function(e,t,i,o,s=!0){return oo(ot(t),e,s,i,o)},aq.showPositionedByField=oe;var aQ={};aQ.commonWordPrefix=og,aQ.commonWordSuffix=oE,aQ.isNumber=$.isNumber$$module$build$src$core$utils$string,aQ.shortestStringLength=o_,aQ.wrap=$.wrap$$module$build$src$core$utils$string;var a0=void 0,a1=!1,a2=!1,a3=50,a5=0,a6=0,a4=0,a8=0,a9=null,a7=null,ce=0,ct=10,ci=10,co=750,cs=5,cn=null,cr={HOVER_MS:750,LIMIT:50,MARGINS:5,OFFSET_X:0,OFFSET_Y:10,RADIUS_OK:10};cr.bindMouseEvents=oC,cr.block=oD,cr.createDom=ob,cr.dispose=oL,cr.getCustomTooltip=function(){return a0},cr.getDiv=function(){return cn},cr.getTooltipOfObject=oS,cr.hide=oy,cr.isVisible=function(){return a1},cr.setCustomTooltip=function(e){a0=e},cr.unbindMouseEvents=oO,cr.unblock=ok;var cl=.45,ca=.65,cc={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"},ch={};ch.blend=oW,ch.getHsvSaturation=oB,ch.getHsvValue=ox,ch.hexToRgb=oH,ch.hsvToHex=oU,ch.hueToHex=oV,ch.names=cc,ch.parse=oF,ch.rgbToHex=oG,ch.setHsvSaturation=function(e){cl=e},ch.setHsvValue=function(e){ca=e};var cu={};cu.checkMessageReferences=function(e){let t=!0,i=$.Msg$$module$build$src$core$msg,o=e.match(/%{BKY_[A-Z]\w*}/gi);if(o)for(let s=0;s<o.length;s++)void 0===i[o[s].toUpperCase().slice(6,-1)]&&(console.warn("No message string for "+o[s]+" in "+e),t=!1);return t},cu.parseBlockColour=oz,cu.replaceMessageReferences=oY,cu.tokenizeInterpolation=oX;var cd=class{get size_(){return this.size}set size_(e){this.size=e}constructor(e,t,i){this.DEFAULT_VALUE=null,this.name=void 0,this.tooltip=this.validator_=null,this.size=new ls(0,0),this.constants_=this.mouseDownWrapper=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=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.id_=null,this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE,this.size_=new ls(0,0),e!==cd.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(oY(e.tooltip))}setSourceBlock(e){if(this.sourceBlock_)throw Error("Field already bound to a block");if(this.sourceBlock_=e,e.id.includes("_field"))throw Error(`Field ID indicator is contained in block ID. This may cause problems with focus: ${e.id}.`);this.id_=`${e.id}_field_${ey()}`}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(){if(!this.fieldGroup_){var e=this.id_;if(!e)throw Error("Expected ID to be defined prior to init.");this.fieldGroup_=eZ(li.G,{id:e}),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_(),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyField")}initModel(){}isFullBlockField(){return!this.borderRect_}createBorderRect_(){this.borderRect_=eZ(li.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_=eZ(li.TEXT,{class:"blocklyText blocklyFieldText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)}bindEvents_(){let e=this.getClickTarget_();if(!e)throw Error("A click target has not been set.");oC(e),this.mouseDownWrapper=eb(e,"pointerdown",this,this.onMouseDown_)}fromXml(e){this.setValue(e.textContent)}toXml(e){return e.textContent=this.getValue(),e}saveState(e){return null!==(e=this.saveLegacyState(cd))?e:this.getValue()}loadState(e){this.loadLegacyState(cd,e)||this.setValue(e)}saveLegacyState(e){return e.prototype.saveState===this.saveState&&e.prototype.toXml!==this.toXml?((e=$.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name",this.name||""),tM(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($.textToDom$$module$build$src$core$utils$xml(t)),!0)}dispose(){let e;oc(this),o0(this),(null==(e=this.getSourceBlock())?0:e.isDeadOrDying())||e2(this.fieldGroup_),this.disposed=!0}updateEditable(){let e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(eq(e,"blocklyEditableField"),e0(e,"blocklyNonEditableField")):(eq(e,"blocklyNonEditableField"),e0(e,"blocklyEditableField")))}setEnabled(e){this.enabled_=e,this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==cd.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){let t=this.getConstants(),i=2*(e=void 0!==e?e:this.isFullBlockField()?0:this.getConstants().FIELD_BORDER_RECT_X_PADDING),o=t.FIELD_TEXT_HEIGHT,s=0;this.textElement_&&(i+=s=e8(this.textElement_)),this.isFullBlockField()||(o=Math.max(o,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=o,this.size_.width=i,this.positionTextElement_(e,s),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var i,o=this.getConstants(),s=this.size_.height/2;this.textElement_.setAttribute("x",String((null==(i=this.getSourceBlock())?0:i.RTL)?this.size_.width-t-e:e)),this.textElement_.setAttribute("y",String(o.FIELD_TEXT_BASELINE_CENTER?s:s-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.size_):new ls(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new cp;if(this.isFullBlockField()){var i=this.sourceBlock_.getHeightWidth();let o=t.workspace.scale;e=this.getAbsoluteXY_(),t=(i.width+1)*o,i=(i.height+1)*o,rb?(e.x+=1.5*o,e.y+=1.5*o):(e.x-=.5*o,e.y-=.5*o)}else i=this.borderRect_.getBoundingClientRect(),e=tC(this.borderRect_),t=i.width,i=i.height;return new lo(e.y,e.y+i,e.x,e.x+t)}onLocationChange(e){}getDisplayText_(){let e=this.getText();return e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,cd.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+=""),e}getText(){let e=this.getText_();return null!==e?String(e):String(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(null!==e){var i=$.getGroup$$module$build$src$core$events$utils();i||$.setGroup$$module$build$src$core$events$utils(!0);try{let i=this.doClassValidation_(e),a=this.processValidation(e,i,t);if(!(a instanceof Error)){var o,s=null==(o=this.getValidator())?void 0:o.call(this,a),n=this.processValidation(a,s,t);if(!(n instanceof Error)){var r=this.sourceBlock_;if(!r||!r.disposed){var l=this.getValue();l===n?this.doValueUpdate_(n):(this.doValueUpdate_(n),t&&r&&eX()&&eH(new(ej(rL.BLOCK_CHANGE))(r,"field",this.name||null,l,n)),this.isDirty_&&this.forceRerender())}}}}finally{$.setGroup$$module$build$src$core$events$utils(i)}}}processValidation(e,t,i){return null===t?(this.doValueInvalid_(e,i),this.isDirty_&&this.forceRerender(),Error()):void 0===t?e:t}getValue(){return this.value_}doClassValidation_(e){return null==e?null:e}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_);let t=this.getClickTarget_();t?t.tooltip=e:this.tooltip=e}getTooltip(){let e=this.getClickTarget_();return e?oS(e):oS({tooltip:this.tooltip})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return tC(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null,t=this.getSourceBlock();if(!t)throw new cp;let i=t.inputList;for(let o=0;o<t.inputList.length;o++){let t=i[o],s=t.fieldRow;for(let i=0;i<s.length;i++)if(s[i]===this){e=t;break}}return e}getFlipRtl(){return!1}onShortcut(e){return!1}getFocusableElement(){if(!this.fieldGroup_)throw Error("This field currently has no representative DOM element.");return this.fieldGroup_}getFocusableTree(){let e=this.getSourceBlock();if(!e)throw new cp;return e.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}static fromJson(e){throw Error("Attempted to instantiate a field from the registry that hasn't defined a 'fromJson' method.")}};cd.NBSP=" ",cd.SKIP_SETUP=Symbol("SKIP_SETUP");var cp=class extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}},c_={};c_.Field=cd,c_.UnattachedFieldError=cp;var cg,cE=null,cT=null,cm=null,cf="blocklyWidgetDiv",cI="",cS="",cR=null,cb={};cb.createDom=oJ,cb.getDiv=oj,cb.hide=oq,cb.hideIfOwner=o0,cb.hideIfOwnerIsInWorkspace=o1,cb.isVisible=oQ,cb.positionWithAnchor=o3,cb.repositionForWindowResize=o4,cb.show=oZ,cb.testOnly_setDiv=function(e){if(cg=e,null===e){let e;null==(e=document.querySelector("."+cf))||e.remove()}};var cC=null,cO={},cA=null,c$={};c$.callbackFactory=$.callbackFactory$$module$build$src$core$contextmenu,c$.dispose=ss,c$.getCurrentBlock=function(){return cC},c$.hide=so,c$.setCurrentBlock=o8,c$.show=o9;var cN=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 null!=(t=this.registeredItems.get(e))?t:null}getContextMenuOptions(e,t){let i=[];for(let o of this.registeredItems.values()){let s;if(!o.scopeType||(o.scopeType!==cL.BLOCK||e.block)&&(o.scopeType!==cL.COMMENT||e.comment)&&(o.scopeType!==cL.WORKSPACE||e.workspace)){if(s={scope:e,weight:o.weight},o.separator)s=Object.assign({},s,{separator:!0});else{let i=o.preconditionFn(e,t);if("hidden"===i)continue;s=Object.assign({},s,{text:"function"==typeof o.displayText?o.displayText(e):o.displayText,callback:o.callback,enabled:"enabled"===i})}i.push(s)}}return i.sort(function(e,t){return e.weight-t.weight}),i}};(c2=(c1=cN||(cN={})).ScopeType||(c1.ScopeType={})).BLOCK="block",c2.WORKSPACE="workspace",c2.COMMENT="comment",c1.registry=new c1;var cL=cN.ScopeType,cy={};cy.ContextMenuRegistry=cN,cy.ScopeType=cL;var cD=class{constructor(e){this.comment=e,this.startLoc=null,this.workspace=e.workspace}isMovable(){return this.comment.isOwnMovable()&&!this.comment.isDeadOrDying()&&!this.workspace.isReadOnly()}startDrag(){let e;this.fireDragStartEvent(),this.startLoc=this.comment.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1),null==(e=this.workspace.getLayerManager())||e.moveToDragLayer(this.comment),this.comment.setDragging(!0)}drag(e){this.comment.moveDuringDrag(e)}endDrag(){let e;this.fireDragEndEvent(),this.fireMoveEvent(),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.comment,50),this.comment.setDragging(!1),this.comment.snapToGrid(),this.workspace.setResizesEnabled(!0)}fireDragStartEvent(){eH(new(ej(rL.COMMENT_DRAG))(this.comment,!0))}fireDragEndEvent(){eH(new(ej(rL.COMMENT_DRAG))(this.comment,!1))}fireMoveEvent(){if(!this.comment.isDeadOrDying()){var e=new(ej(rL.COMMENT_MOVE))(this.comment);e.setReason(["drag"]),e.oldCoordinate_=this.startLoc,e.recordNew(),eH(e)}}revertDrag(){this.startLoc&&this.comment.moveDuringDrag(this.startLoc)}},ck=new WeakMap,cw={};cw.move=sl,cw.start=sr;var cv=class{constructor(e,t,i){this.id=e,this.workspace=t,this.container=i}isVisible(){return this.icon.checkVisibility()}getParentComment(){let e=this.workspace.getCommentById(this.id);if(!e)throw Error(`Comment bar button ${this.id} has no corresponding comment`);return e}getSize(e=!1){var t=this.icon.getBBox();return t=lo.from(t),e&&(e=this.getMargin(),t.left-=e,t.top-=e,t.bottom+=e,t.right+=e),t}getMargin(){return(this.container.getBBox().height-this.icon.getBBox().height)/2}getFocusableElement(){return this.icon}getFocusableTree(){return this.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return this.isVisible()}},cM="_collapse_bar_button",cP=class extends cv{constructor(e,t,i){super(e,t,i),this.id=e,this.workspace=t,this.container=i,this.icon=eZ(li.IMAGE,{class:"blocklyFoldoutIcon",href:`${this.workspace.options.pathToMedia}foldout-icon.svg`,id:`${this.id}${cM}`},this.container),this.bindId=eb(this.icon,"pointerdown",this,this.performAction.bind(this))}dispose(){eO(this.bindId)}reposition(){let e=this.getMargin();this.icon.setAttribute("y",`${e}`),this.icon.setAttribute("x",`${e}`)}performAction(e){ef();let t=this.getParentComment();t.view.bringToFront(),e&&e instanceof PointerEvent&&e$(e)?e.stopPropagation():(t.setCollapsed(!t.isCollapsed()),this.workspace.hideChaff(),null==e||e.stopPropagation())}},cB="_comment_textarea_",cx=class{constructor(e,t,i){this.workspace=e,this.onFinishEditing=i,this.textChangeListeners=[],this.text="",this.foreignObject=eZ(li.FOREIGNOBJECT,{class:"blocklyCommentForeignObject"}),(e=document.createElementNS(rk,"body")).setAttribute("xmlns",rk),e.className="blocklyMinimalBody",this.textArea=document.createElementNS(rk,"textarea"),this.textArea.setAttribute("tabindex","-1"),eq(this.textArea,"blocklyCommentText"),eq(this.textArea,"blocklyTextarea"),eq(this.textArea,"blocklyText"),e.appendChild(this.textArea),this.foreignObject.appendChild(e),t&&(this.id=t+cB,this.textArea.setAttribute("id",this.id)),eb(this.textArea,"change",this,this.onTextChange),eb(this.textArea,"pointerdown",this,e=>{e.stopPropagation(),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this),ef()}),eb(this.textArea,"keydown",this,this.handleKeyDown)}getDom(){return this.foreignObject}getText(){return this.text}setText(e){this.textArea.value=e,this.onTextChange()}onTextChange(){let e=this.text;this.text=this.textArea.value;for(let t=this.textChangeListeners.length-1;t>=0;t--)this.textChangeListeners[t](e,this.text)}handleKeyDown(e){("Escape"===e.key||"Enter"===e.key&&(e.ctrlKey||e.metaKey))&&(this.onFinishEditing&&this.onFinishEditing(),e.stopPropagation())}addTextChangeListener(e){this.textChangeListeners.push(e)}removeTextChangeListener(e){this.textChangeListeners.splice(this.textChangeListeners.indexOf(e),1)}setPlaceholderText(e){this.textArea.placeholder=e}setEditable(e){e?this.textArea.removeAttribute("readonly"):this.textArea.setAttribute("readonly","true")}updateSize(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}`)}getFocusableElement(){return this.textArea}getFocusableTree(){return this.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!!this.id}},cF="_delete_bar_button",cG=class extends cv{constructor(e,t,i){super(e,t,i),this.id=e,this.workspace=t,this.container=i,this.icon=eZ(li.IMAGE,{class:"blocklyDeleteIcon",href:`${this.workspace.options.pathToMedia}delete-icon.svg`,id:`${this.id}${cF}`},i),this.bindId=eb(this.icon,"pointerdown",this,this.performAction.bind(this))}dispose(){eO(this.bindId)}reposition(){let e=this.getMargin();this.icon.setAttribute("x","0");let t=this.container.getBBox();this.icon.setAttribute("y",`${e}`),this.icon.setAttribute("x",`${t.width-this.getSize(!0).getWidth()}`)}performAction(e){ef(),e&&e instanceof PointerEvent&&e$(e)?e.stopPropagation():(this.getParentComment().dispose(),null==e||e.stopPropagation(),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.workspace))}},cH=class{constructor(e,t){let i;this.workspace=e,this.commentId=t,this.collapsed=!1,this.editable=!0,this.location=new lt(0,0),this.sizeChangeListeners=[],this.disposeListeners=[],this.collapseChangeListeners=[],this.resizePointerMoveListener=this.resizePointerUpListener=null,this.disposed=this.disposing=!1,this.svgRoot=eZ(li.G,{class:"blocklyComment blocklyEditable blocklyDraggable"}),this.highlightRect=this.createHighlightRect(this.svgRoot),({topBarGroup:this.topBarGroup,topBarBackground:this.topBarBackground,deleteButton:this.deleteButton,foldoutButton:this.foldoutButton,textPreview:this.textPreview,textPreviewNode:this.textPreviewNode}=this.createTopBar(this.svgRoot)),this.commentEditor=this.createTextArea(),this.resizeHandle=this.createResizeHandle(this.svgRoot,e),null==(i=e.getLayerManager())||i.append(this,50),this.size=cH.defaultCommentSize,this.setSizeWithoutFiringEvents(this.size),this.moveTo(new lt(0,0))}createHighlightRect(e){return eZ(li.RECT,{class:"blocklyCommentHighlight"},e)}createTopBar(e){e=eZ(li.G,{class:"blocklyCommentTopbar"},e);let t=eZ(li.RECT,{class:"blocklyCommentTopbarBackground"},e),i=new cG(this.commentId,this.workspace,e),o=new cP(this.commentId,this.workspace,e),s=eZ(li.TEXT,{class:"blocklyCommentPreview blocklyCommentText blocklyText"},e),n=document.createTextNode("");return s.appendChild(n),{topBarGroup:e,topBarBackground:t,deleteButton:i,foldoutButton:o,textPreview:s,textPreviewNode:n}}createTextArea(){let e=new cx(this.workspace,this.commentId,()=>this.svgRoot.focus());return this.svgRoot.appendChild(e.getDom()),e.addTextChangeListener((e,t)=>{this.updateTextPreview(t),this.setSize(this.size)}),e}getEditorFocusableNode(){return this.commentEditor}createResizeHandle(e,t){return eb(e=eZ(li.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),"pointerdown",this,this.onResizePointerDown),e}getSvgRoot(){return this.svgRoot}getSize(){return this.collapsed?this.topBarBackground.getBBox():this.size}setSizeWithoutFiringEvents(e){let t=this.topBarBackground.getBBox(),i=this.textPreview.getBBox(),o=this.resizeHandle.getBBox();this.size=e=ls.max(e,this.calcMinSize(t)),this.svgRoot.setAttribute("height",`${e.height}`),this.svgRoot.setAttribute("width",`${e.width}`),this.updateHighlightRect(e),this.updateTopBarSize(e),this.commentEditor.updateSize(e,t),this.deleteButton.reposition(),this.foldoutButton.reposition(),this.updateTextPreviewSize(e,t,i),this.updateResizeHandlePosition(e,o)}setSize(e){let t=this.preResizeSize||this.size;this.setSizeWithoutFiringEvents(e),this.onSizeChange(t,this.size)}calcMinSize(e){var t;this.updateTextPreview(null!=(t=this.commentEditor.getText())?t:"");let i=t=e8(this.textPreview);return this.foldoutButton.isVisible()?i+=this.foldoutButton.getSize(!0).getWidth():t&&(i+=4),this.deleteButton.isVisible()?i+=this.deleteButton.getSize(!0).getWidth():t&&(i+=4),new ls(i,e.height+20)}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}`)}updateTextPreviewSize(e,t,i){t=(t.height-i.height)/2;let o=this.foldoutButton.getSize(!0),s=this.deleteButton.getSize(!0);e=e.width-o.getWidth()-s.getWidth(),this.textPreview.setAttribute("x",`${o.getWidth()}`),this.textPreview.setAttribute("y",`${t+i.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 i=this.sizeChangeListeners.length-1;i>=0;i--)this.sizeChangeListeners[i](e,t)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}removeSizeChangeListener(e){this.sizeChangeListeners.splice(this.sizeChangeListeners.indexOf(e),1)}onResizePointerDown(e){this.isEditable()&&(this.bringToFront(),e$(e)||(this.preResizeSize=this.getSize(),sr(this.workspace,e,new lt(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=eb(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=eb(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation())}onResizePointerUp(e){ef(),this.resizePointerUpListener&&(eO(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(eO(this.resizePointerMoveListener),this.resizePointerMoveListener=null),this.setSize(this.size),this.preResizeSize=void 0}onResizePointerMove(e){e=sl(this.workspace,e),this.setSizeWithoutFiringEvents(new ls(this.workspace.RTL?-e.x:e.x,e.y))}isCollapsed(){return this.collapsed}setCollapsed(e){(this.collapsed=e)?eq(this.svgRoot,"blocklyCollapsed"):e0(this.svgRoot,"blocklyCollapsed"),this.setSizeWithoutFiringEvents(this.size),this.onCollapse()}onCollapse(){for(let e=this.collapseChangeListeners.length-1;e>=0;e--)this.collapseChangeListeners[e](this.collapsed)}addOnCollapseListener(e){this.collapseChangeListeners.push(e)}removeOnCollapseListener(e){this.collapseChangeListeners.splice(this.collapseChangeListeners.indexOf(e),1)}isEditable(){return this.editable}setEditable(e){(this.editable=e)?(eq(this.svgRoot,"blocklyEditable"),e0(this.svgRoot,"blocklyReadonly")):(e0(this.svgRoot,"blocklyEditable"),eq(this.svgRoot,"blocklyReadonly")),this.commentEditor.setEditable(e)}getRelativeToSurfaceXY(){return this.location}moveTo(e){this.location=e,this.svgRoot.setAttribute("transform",`translate(${e.x}, ${e.y})`)}getText(){return this.commentEditor.getText()}setText(e){this.commentEditor.setText(e)}setPlaceholderText(e){this.commentEditor.setPlaceholderText(e)}addTextChangeListener(e){this.commentEditor.addTextChangeListener(e)}removeTextChangeListener(e){this.commentEditor.removeTextChangeListener(e)}updateTextPreview(e){this.textPreviewNode.textContent=this.truncateText(e)}truncateText(e){return e.length>=12?`${e.substring(0,9)}...`:e}bringToFront(){let e=this.svgRoot.parentNode,t=e.childNodes;t[t.length-1]!==this.svgRoot&&e.appendChild(this.svgRoot)}onDeleteDown(e){ef(),e$(e)||this.dispose(),e.stopPropagation()}dispose(){this.disposing=!0,this.foldoutButton.dispose(),this.deleteButton.dispose(),e2(this.svgRoot);for(let e=this.disposeListeners.length-1;e>=0;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)}getCommentBarButtons(){return[this.foldoutButton,this.deleteButton]}};cH.defaultCommentSize=new ls(120,100),tf("\n.injectionDiv {\n --commentFillColour: #FFFCC7;\n --commentBorderColour: #F2E49B;\n}\n\n.blocklyComment .blocklyTextarea {\n background-color: var(--commentFillColour);\n border: 1px solid var(--commentBorderColour);\n box-sizing: border-box;\n display: block;\n outline: 0;\n padding: 5px;\n resize: none;\n width: 100%;\n height: 100%;\n}\n\n.blocklyReadonly.blocklyComment .blocklyTextarea {\n cursor: inherit;\n}\n\n.blocklyDeleteIcon {\n width: 20px;\n height: 20px;\n display: none;\n cursor: pointer;\n}\n\n.blocklyFoldoutIcon {\n width: 20px;\n height: 20px;\n transform-origin: 12px 12px;\n cursor: pointer;\n}\n.blocklyResizeHandle {\n width: 12px;\n height: 12px;\n cursor: se-resize;\n}\n.blocklyReadonly.blocklyComment .blocklyResizeHandle {\n cursor: inherit;\n}\n\n.blocklyCommentTopbarBackground {\n fill: var(--commentBorderColour);\n height: 24px;\n}\n\n.blocklyComment .blocklyCommentPreview.blocklyText {\n fill: #000;\n dominant-baseline: middle;\n visibility: hidden;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentPreview {\n visibility: visible;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentForeignObject,\n.blocklyCollapsed.blocklyComment .blocklyResizeHandle {\n display: none;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyFoldoutIcon {\n transform: rotate(-90deg);\n}\n\n.blocklyRTL .blocklyCommentTopbar {\n transform: scale(-1, 1);\n}\n\n.blocklyRTL .blocklyCommentForeignObject {\n direction: rtl;\n}\n\n.blocklyRTL .blocklyCommentPreview {\n /* Revert the scale and control RTL using direction instead. */\n transform: scale(-1, 1);\n direction: rtl;\n}\n\n.blocklyRTL .blocklyResizeHandle {\n transform: scale(-1, 1);\n cursor: sw-resize;\n}\n\n.blocklyCommentHighlight {\n fill: none;\n}\n\n.blocklyCommentText.blocklyActiveFocus {\n border-color: #fc3;\n border-width: 2px;\n}\n\n.blocklySelected .blocklyCommentHighlight {\n stroke: #fc3;\n stroke-width: 3px;\n}\n\n.blocklyCollapsed.blocklySelected .blocklyCommentHighlight {\n stroke: none;\n}\n\n.blocklyCollapsed.blocklySelected .blocklyCommentTopbarBackground {\n stroke: #fc3;\n stroke-width: 3px;\n}\n");var cU=class{constructor(e,t){this.workspace=e,this.text="",this.collapsed=!1,this.deletable=this.movable=this.editable=!0,this.location=new lt(0,0),this.disposing=this.disposed=!1,this.id=t&&!e.getCommentById(t)?t:eD(),this.size=cH.defaultCommentSize,e.addTopComment(this),this.fireCreateEvent()}fireCreateEvent(){eX()&&eH(new(ej(rL.COMMENT_CREATE))(this))}fireDeleteEvent(){eX()&&eH(new(ej(rL.COMMENT_DELETE))(this))}fireChangeEvent(e,t){eX()&&eH(new(ej(rL.COMMENT_CHANGE))(this,e,t))}fireCollapseEvent(e){eX()&&eH(new(ej(rL.COMMENT_COLLAPSE))(this,e))}setText(e){let t=this.text;this.text=e,this.fireChangeEvent(t,e)}getText(){return this.text}setSize(e){let t=new(ej(rL.COMMENT_RESIZE))(this);this.size=e,t.recordCurrentSizeAsNewSize(),eH(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.isReadOnly()}isOwnEditable(){return this.editable}setMovable(e){this.movable=e}isMovable(){return this.isOwnMovable()&&!this.workspace.isReadOnly()&&!this.workspace.isFlyout}isOwnMovable(){return this.movable}setDeletable(e){this.deletable=e}isDeletable(){return this.isOwnDeletable()&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()&&!this.workspace.isFlyout}isOwnDeletable(){return this.deletable}moveTo(e,t){let i=new(ej(rL.COMMENT_MOVE))(this);t&&i.setReason(t),this.location=e,i.recordNew(),eH(i)}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}},cW=class extends cU{constructor(e,t){super(e,t),this.dragStrategy=new cD(this),this.workspace=e,this.view=new cH(e,this.id),this.view.setSize(this.getSize()),this.view.setEditable(this.isEditable()),this.view.getSvgRoot().setAttribute("data-id",this.id),this.view.getSvgRoot().setAttribute("id",this.id),this.addModelUpdateBindings(),eb(this.view.getSvgRoot(),"pointerdown",this,this.startGesture),eb(this.view.getSvgRoot(),"wheel",this,e=>{e.stopPropagation()})}addModelUpdateBindings(){this.view.addTextChangeListener((e,t)=>void super.setText(t)),this.view.addSizeChangeListener((e,t)=>void super.setSize(t)),this.view.addOnCollapseListener(()=>void super.setCollapsed(this.view.isCollapsed())),this.view.addDisposeListener(()=>{this.isDeadOrDying()||this.dispose()})}setText(e){this.view.setText(e)}setPlaceholderText(e){this.view.setPlaceholderText(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(){var e,t;let i=this.getRelativeToSurfaceXY(),o=null!=(t=null==(e=this.view)?void 0:e.getSize())?t:this.getSize();return this.workspace.RTL?(e=i.x-o.width,t=i.x):(e=i.x,t=i.x+o.width),new lo(i.y,i.y+o.height,e,t)}moveBy(e,t,i){let o=this.getRelativeToSurfaceXY();e=new lt(o.x+e,o.y+t),this.moveTo(e,i)}moveTo(e,t){super.moveTo(e,t),this.view.moveTo(e)}moveDuringDrag(e){this.location=e,this.view.moveTo(e)}setDragging(e){e?eq(this.getSvgRoot(),"blocklyDragging"):e0(this.getSvgRoot(),"blocklyDragging")}dispose(){this.disposing=!0;let e=$.getFocusManager$$module$build$src$core$focus_manager();e.getFocusedNode()===this&&setTimeout(()=>e.focusTree(this.workspace),0),this.view.isDeadOrDying()||this.view.dispose(),super.dispose()}startGesture(e){let t=this.workspace.getGesture(e);t&&(t.handleCommentStart(e,this),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this))}setDeleteStyle(e){e?eq(this.getSvgRoot(),"blocklyDraggingDelete"):e0(this.getSvgRoot(),"blocklyDraggingDelete")}isCopyable(){return this.isOwnMovable()&&this.isOwnDeletable()}isMovable(){return this.dragStrategy.isMovable()}startDrag(){this.dragStrategy.startDrag()}drag(e){this.dragStrategy.drag(e)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){eq(this.getSvgRoot(),"blocklySelected"),th(this)}unselect(){e0(this.getSvgRoot(),"blocklySelected"),th(null)}toCopyData(){return{paster:lw.TYPE,commentState:tJ(this,{addCoordinates:!0})}}showContextMenu(e){let t,i=cN.registry.getContextMenuOptions({comment:this,focusedNode:this},e);t=e instanceof PointerEvent?new lt(e.clientX,e.clientY):tv(this.workspace,this.getRelativeToSurfaceXY()).translate(10,10),o9(e,i,this.workspace.RTL,this.workspace,t)}snapToGrid(){if(!this.isDeadOrDying()){var e=this.workspace.getGrid();if(null!=e&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();(e=e.alignXY(t))!==t&&this.moveTo(e,["snap"])}}}getEditorFocusableNode(){return this.view.getEditorFocusableNode()}getFocusableElement(){return this.getSvgRoot()}getFocusableTree(){return this.workspace}onNodeFocus(){let e;this.select(),null==(e=this.workspace.getLayerManager())||e.append(this,50)}onNodeBlur(){this.unselect()}canBeFocused(){return!0}},cV={};cV.appendDomToWorkspace=function(e,t){if(!t.getBlocksBoundingBox)return $.domToWorkspace$$module$build$src$core$xml(e,t);var i=t.getBlocksBoundingBox();if(e=$.domToWorkspace$$module$build$src$core$xml(e,t),i&&i.top!==i.bottom){var o=i.bottom;i=t.RTL?i.right:i.left;var s=1/0;let n=-1/0,r=1/0;for(let i=0;i<e.length;i++){let o=t.getBlockById(e[i]).getRelativeToSurfaceXY();o.y<r&&(r=o.y),o.x<s&&(s=o.x),o.x>n&&(n=o.x)}for(o=o-r+10,i=t.RTL?i-n:i-s,s=0;s<e.length;s++)t.getBlockById(e[s]).moveBy(i,o,["create"])}return e},cV.blockToDom=sp,cV.blockToDomWithXY=sh,cV.clearWorkspaceAndLoadFromXml=function(e,t){return t.setResizesEnabled(!1),t.clear(),e=$.domToWorkspace$$module$build$src$core$xml(e,t),t.setResizesEnabled(!0),e},cV.deleteNext=function(e){for(let t=0;t<e.childNodes.length;t++){let i=e.childNodes[t];if("next"===i.nodeName.toLowerCase()){e.removeChild(i);break}}},cV.domToBlock=$.domToBlock$$module$build$src$core$xml,cV.domToBlockInternal=sT,cV.domToPrettyText=function(e){e=sg(e).split("<");let t="";for(let i=1;i<e.length;i++){let o=e[i];"/"===o[0]&&(t=t.substring(2)),e[i]=t+"<"+o,"/"!==o[0]&&"/>"!==o.slice(-2)&&(t+=" ")}return(e=(e=e.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>")).replace(/^\n/,"")},cV.domToText=sg,cV.domToVariables=sm,cV.domToWorkspace=$.domToWorkspace$$module$build$src$core$xml,cV.loadWorkspaceComment=sE,cV.saveWorkspaceComment=sa,cV.variablesToDom=sc,cV.workspaceToDom=function(e,t=!1){let i=$.createElement$$module$build$src$core$utils$xml("xml");var o=sc($.allUsedVarModels$$module$build$src$core$variables(e));for(let s of(o.hasChildNodes()&&i.appendChild(o),e.getTopComments()))i.appendChild(sa(s,t));for(o=0,e=e.getTopBlocks(!0);o<e.length;o++)i.appendChild(sh(e[o],t));return i};var cK=class extends aC{constructor(e){super(e),this.type=rL.BLOCK_CREATE,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=sh(e),this.ids=eY(e),this.json=ik(e,{addCoordinates:!0}))}toJson(){let 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=sg(this.xml),e.ids=this.ids,e.json=this.json,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new cK)).xml=$.textToDom$$module$build$src$core$utils$xml(e.xml),t.ids=e.ids,t.json=e.json,void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}run(e){let 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(!cX(t,this.ids))if(e)iH(this.json,t);else for(e=0;e<this.ids.length;e++){let i=this.ids[e],o=t.getBlockById(i);o?o.dispose(!1):i===this.blockId&&console.warn("Can't uncreate non-existent block: "+i)}}},cX=function(e,t){return t.map(t=>e.getBlockById(t)).filter(e=>e&&e.isShadow()).length===t.length};ea(D.EVENT,rL.BLOCK_CREATE,cK);var cY=class extends r0{constructor(e,t){super(t),this.type=rL.THEME_CHANGE,this.themeName=e}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new cY)).themeName=e.themeName,t}};ea(D.EVENT,rL.THEME_CHANGE,cY);var cz=class extends r0{constructor(e,t,i,o,s){super(o),this.type=rL.VIEWPORT_CHANGE,this.viewTop=e,this.viewLeft=t,this.scale=i,this.oldScale=s}toJson(){let e=super.toJson();if(void 0===this.viewTop)throw Error("The view top is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.viewLeft)throw Error("The view left is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.scale)throw Error("The scale is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.oldScale)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,i){return(t=super.fromJson(e,t,null!=i?i:new cz)).viewTop=e.viewTop,t.viewLeft=e.viewLeft,t.scale=e.scale,t.oldScale=e.oldScale,t}};ea(D.EVENT,rL.VIEWPORT_CHANGE,cz),(c3=c5||(c5={}))[c3.INPUT_VALUE=1]="INPUT_VALUE",c3[c3.OUTPUT_VALUE=2]="OUTPUT_VALUE",c3[c3.NEXT_STATEMENT=3]="NEXT_STATEMENT",c3[c3.PREVIOUS_STATEMENT=4]="PREVIOUS_STATEMENT";var cj=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;let i=this.calculateIndexForYPos(t);if(i>=this.connections.length)return -1;t=e.y;let o=i;for(;o>=0&&this.connections[o].y===t;){if(this.connections[o]===e)return o;o--}for(o=i;o<this.connections.length&&this.connections[o].y===t;){if(this.connections[o]===e)return o;o++}return -1}calculateIndexForYPos(e){if(!this.connections.length)return 0;let t=0,i=this.connections.length;for(;t<i;){let o=Math.floor((t+i)/2);if(this.connections[o].y<e)t=o+1;else if(this.connections[o].y>e)i=o;else{t=o;break}}return t}removeConnection(e,t){if(-1===(e=this.findIndexOfConnection(e,t)))throw Error("Unable to find connection in connectionDB.");this.connections.splice(e,1)}getNeighbours(e,t){function i(e){let i=s-o[e].x,r=n-o[e].y;return Math.sqrt(i*i+r*r)<=t&&a.push(o[e]),r<t}let o=this.connections,s=e.x,n=e.y;e=0;let r=o.length-2,l=r;for(;e<l;)o[l].y<n?e=l:r=l,l=Math.floor((e+r)/2);let a=[];if(r=e=l,o.length){for(;e>=0&&i(e);)e--;do r++;while(r<o.length&&i(r))}return a}isInYRange(e,t,i){return Math.abs(this.connections[e].y-t)<=i}searchForClosest(e,t,i){if(!this.connections.length)return{connection:null,radius:t};let o=e.y,s=e.x;e.x=s+i.x,e.y=o+i.y;var n=this.calculateIndexForYPos(e.y);i=null;let r=t,l,a=n-1;for(;a>=0&&this.isInYRange(a,e.y,t);)l=this.connections[a],this.connectionChecker.canConnect(e,l,!0,r)&&(i=l,r=l.distanceFrom(e)),a--;for(;n<this.connections.length&&this.isInYRange(n,e.y,t);)l=this.connections[n],this.connectionChecker.canConnect(e,l,!0,r)&&(i=l,r=l.distanceFrom(e)),n++;return e.x=s,e.y=o,{connection:i,radius:r}}static init(e){let t=[];return t[c5.INPUT_VALUE]=new cj(e),t[c5.OUTPUT_VALUE]=new cj(e),t[c5.NEXT_STATEMENT]=new cj(e),t[c5.PREVIOUS_STATEMENT]=new cj(e),t}},cJ=class extends r0{constructor(e,t,i){super(i),this.type=rL.SELECTED,this.oldElementId=null!=e?e:void 0,this.newElementId=null!=t?t:void 0}toJson(){let e=super.toJson();return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new cJ)).oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};ea(D.EVENT,rL.SELECTED,cJ);var cZ=class extends aC{constructor(e){if(super(e),this.type=rL.BLOCK_DELETE,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=sh(e),this.ids=eY(e),this.wasShadow=e.isShadow(),this.oldJson=ik(e,{addCoordinates:!0})}}toJson(){let 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(void 0===this.wasShadow)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=sg(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,i){return(t=super.fromJson(e,t,null!=i?i:new cZ)).oldXml=$.textToDom$$module$build$src$core$utils$xml(e.oldXml),t.ids=e.ids,t.wasShadow=e.wasShadow||"shadow"===t.oldXml.tagName.toLowerCase(),t.oldJson=e.oldJson,void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}run(e){let 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++){let i=this.ids[e],o=t.getBlockById(i);o?o.dispose(!1):i===this.blockId&&console.warn("Can't delete non-existent block: "+i)}else iH(this.oldJson,t)}};ea(D.EVENT,rL.BLOCK_DELETE,cZ);var cq={fromJsonInternal:function(e){let t=e_(D.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)}},cQ={TEST_ONLY:cq};cQ.fromJson=$.fromJson$$module$build$src$core$field_registry,cQ.register=sy,cQ.unregister=function(e){eh(D.FIELD,e)};var c0=class extends cd{constructor(e,t,i){super(cd.SKIP_SETUP),this.svgArrow=this.arrow=this.imageElement=this.menu_=this.selectedMenuItem=null,this.SERIALIZABLE=!0,this.clickTarget_=this.suffixField=this.prefixField=this.generatedOptions=null,e!==cd.SKIP_SETUP&&(this.setOptions(e),i&&this.configure_(i),t&&this.setValidator(t))}fromXml(e){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e.textContent)}loadState(e){this.loadLegacyState(c0,e)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement=eZ(li.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&eq(this.borderRect_,"blocklyDropdownRect"),this.fieldGroup_&&(eq(this.fieldGroup_,"blocklyField"),eq(this.fieldGroup_,"blocklyDropdownField"))}shouldAddBorderRect_(){let e;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!(null==(e=this.getSourceBlock())?0:e.isShadow())}createTextArrow_(){let e,t;this.arrow=eZ(li.TSPAN,{},this.textElement_),this.arrow.appendChild(document.createTextNode((null==(e=this.getSourceBlock())?0:e.RTL)?c0.ARROW_CHAR+" ":" "+c0.ARROW_CHAR)),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.arrow.setAttribute("dominant-baseline","central"),(null==(t=this.getSourceBlock())?0:t.RTL)?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=eZ(li.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow.setAttributeNS(rw,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(e){var t=this.getSourceBlock();if(!t)throw new cp;this.dropdownCreate(),this.menu_&&(this.menu_.openingCoords=e&&"number"==typeof e.clientX?new lt(e.clientX,e.clientY):null,i9(),eq(e=this.menu_.render(i8()),"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&i7(t=t.getColour(),e=this.sourceBlock_.getColourTertiary()),oe(this,this.dropdownDispose_.bind(this)),i8().style.height=`${this.menu_.getSize().height}px`,this.menu_.focus(),this.selectedMenuItem&&this.menu_.setHighlighted(this.selectedMenuItem),this.applyColour())}dropdownCreate(){let e=this.getSourceBlock();if(!e)throw new cp;let t=new lX;t.setRole(lH.LISTBOX),this.menu_=t;let i=this.getOptions(!1);this.selectedMenuItem=null;for(let s=0;s<i.length;s++){var o=i[s];if(o===c0.SEPARATOR){t.addChild(new lY);continue}let[n,r]=o;sD(n)?((o=new Image(n.width,n.height)).src=n.src,o.alt=n.alt):o=n,(o=new lK(o,r)).setRole(lH.OPTION),o.setRightToLeft(e.RTL),o.setCheckable(!0),t.addChild(o),o.setChecked(r===this.value_),r===this.value_&&(this.selectedMenuItem=o),o.onAction(this.handleMenuActionEvent,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose(),this.selectedMenuItem=this.menu_=null,this.applyColour()}handleMenuActionEvent(e){oc(this,!0),this.onItemSelected_(this.menu_,e)}onItemSelected_(e,t){this.setValue(t.getValue())}isOptionListDynamic(){return"function"==typeof this.menuGenerator_}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.menuGenerator_(),this.validateOptions(this.generatedOptions)),this.generatedOptions)}setOptions(e){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],this.setValue(this.selectedOption[1])}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,i;i=e[t];t++)i[1]===this.value_&&(this.selectedOption=i)}applyColour(){let 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";let e=this.selectedOption&&this.selectedOption[0];sD(e)?this.renderSelectedImage(e):this.renderSelectedText(),this.positionBorderRect_()}renderSelectedImage(e){let t,i=this.getSourceBlock();if(!i)throw new cp;this.imageElement.style.display="",this.imageElement.setAttributeNS(rw,"xlink:href",e.src),this.imageElement.setAttribute("height",String(e.height)),this.imageElement.setAttribute("width",String(e.width));let o=Number(e.height);e=Number(e.width);var s=!!this.borderRect_;let n=Math.max(s?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,o+c0.IMAGE_Y_PADDING);s=s?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,t=this.svgArrow?this.positionSVGArrow(e+s,n/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):e8(this.arrow),this.size_.width=e+t+2*s,this.size_.height=n;let r=0;i.RTL?this.imageElement.setAttribute("x",`${s+t}`):(r=e+t,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x",`${s}`)),this.imageElement.setAttribute("y",String(n/2-o/2)),this.positionTextElement_(r+s,e+t)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();eq(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);let i=e8(this.getTextElement());t=t?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let o=0;this.svgArrow&&(o=this.positionSVGArrow(i+t,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_.width=i+o+2*t,this.size_.height=e,this.positionTextElement_(t,i)}positionSVGArrow(e,t){if(!this.svgArrow)return 0;let i=this.getSourceBlock();if(!i)throw new cp;let o=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,s=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,n=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(i.RTL?o:e+s)+","+t+")"),n+s}getText_(){if(!this.selectedOption)return null;let e=this.selectedOption[0];if(sD(e))return e.alt;if("u">typeof HTMLElement&&e instanceof HTMLElement){let t,i;return null!=(i=null!=(t=e.title)?t:e.ariaLabel)?i:e.innerText}return"string"==typeof e?e:(console.warn("Can't get text for existing dropdown option. If you're using HTMLElement dropdown options in node, ensure you're using jsdom-global or similar."),null)}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,i=e.map(e=>{if(e===c0.SEPARATOR)return e;let[i,o]=e;return"string"==typeof i?[oY(i),o]:(t=!0,[sD(i)?Object.assign({},i,{alt:oY(i.alt)}):Object.assign({},i),o])});if(t||e.length<2)return{options:i};var o=i.map(([e])=>e),s=o_(o);e=og(o,s);let n=oE(o,s);return(e||n)&&!(s<=e+n)?(s=e?o[0].substring(0,e-1):void 0,o=n?o[0].substr(1-n):void 0,{options:this.applyTrim(i,e,n),prefix:s,suffix:o}):{options:i}}applyTrim(e,t,i){return e.map(([e,o])=>[e.substring(t,e.length-i),o])}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 i=0;i<e.length;i++){let o=e[i];Array.isArray(o)||o===c0.SEPARATOR?"string"!=typeof o[1]?(t=!0,console.error(`Invalid option[${i}]: Each FieldDropdown option id must be a string.
|
|
34
|
+
${t} to its parent, because: ${e}`),this.childBlock=i,this.childState=o}},am=class extends a_{constructor(e){super("Encountered a real block which is defined as a child of a shadow\nblock. It is an invariant of Blockly that shadow blocks only have shadow\nchildren"),this.state=e}},af=class extends a_{constructor(e,t,i){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=i}},aI={};aI.BadConnectionCheck=aT,aI.DeserializationError=a_,aI.MissingBlockType=ag,aI.MissingConnection=aE,aI.RealChildOfShadow=am,aI.UnregisteredIcon=af;var aS=class{constructor(){this.priority=50}save(e){let t=[];for(let i of e.getTopBlocks(!1))(e=ik(i,{addCoordinates:!0,doFullSerialization:!1}))&&t.push(e);return t.length?{languageVersion:0,blocks:t}:null}load(e,t){for(let i of e=e.blocks)iH(i,t,{recordUndo:eG()})}clear(e){for(let t of e.getTopBlocks(!1))t.dispose(!1)}};tj("blocks",new aS);var aR={};aR.BlockSerializer=aS,aR.append=iH,aR.appendInternal=iU,aR.save=ik;var ab=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};ab.MUTATOR=new ab("mutator"),ab.WARNING=new ab("warning"),ab.COMMENT=new ab("comment");var aC=class extends rQ{constructor(e){super(),this.isBlank=!e,e&&(this.blockId=e.id,this.workspaceId=e.workspace.id)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new aC)).blockId=e.blockId,t}},aO=class extends aC{constructor(e,t,i,o,s){super(e),this.type=rL.BLOCK_CHANGE,e&&(this.element=t,this.name=i||void 0,this.oldValue=o,this.newValue=s)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new aO)).element=e.element,t.name=e.name,t.oldValue=e.oldValue,t.newValue=e.newValue,void 0!==e.disabledReason&&(t.disabledReason=e.disabledReason),t}setDisabledReason(e){if("disabled"!==this.element)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,i=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");if(!(i=i.getBlockById(this.blockId)))throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");let o=i.getIcon(ab.MUTATOR);switch(o&&i1(o)&&o.bubbleIsVisible()&&o.setBubbleVisible(!1),e=e?this.newValue:this.oldValue,this.element){case"field":(i=i.getField(this.name))?i.setValue(e):console.warn("Can't set non-existent field: "+this.name);break;case"comment":i.setCommentText(e||null);break;case"collapsed":i.setCollapsed(!!e);break;case"disabled":i.setDisabledReason(!!e,null!=(t=this.disabledReason)?t:lJ);break;case"inline":i.setInputsInline(!!e);break;case"mutation":t=aO.getExtraBlockState_(i),i.loadExtraState?i.loadExtraState(JSON.parse(e||"{}")):i.domToMutation&&i.domToMutation($.textToDom$$module$build$src$core$utils$xml(e||"<mutation/>")),eH(new aO(i,"mutation",null,t,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())?sg(e):""}};ea(D.EVENT,rL.BLOCK_CHANGE,aO);var aA={};aA.clamp=i3,aA.toDegrees=function(e){return 180*e/Math.PI},aA.toRadians=i2;var a$,aN,aL,ay,aD,ak,aw,aM,av,aP,aB=16,ax=1,aF=12,aG=16,aH=.25,aU=null,aW=null,aV="",aK="",aY=null,aX=null,az=null,aj=null,aJ=null,aZ={getBoundsInfo:function(){let e=tC(aY),t=tS(aY);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,i,o){var s;let n=aZ.getBoundsInfo(),r=tS(aM);return t+r.height<n.bottom?on(e,t,n,r):o-r.height>n.top?or(i,o,n,r):t+r.height<document.documentElement.clientHeight?on(e,t,n,r):o-r.height>document.documentElement.clientTop?or(i,o,n,r):{initialX:(s=ol(s=e,n.left,n.right,r.width)).divX,initialY:0,finalX:s.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}}},aq={ANIMATION_TIME:.25,ARROW_HORIZONTAL_PADDING:12,ARROW_SIZE:16,BORDER_SIZE:1,PADDING_Y:16,TEST_ONLY:aZ};aq.clearContent=i9,aq.createDom=i5,aq.getContentDiv=i8,aq.getOwner=i4,aq.getPositionX=ol,aq.hide=oh,aq.hideIfOwner=oc,aq.hideWithoutAnimation=ou,aq.isVisible=oa,aq.repositionForWindowResize=op,aq.setBoundsElement=i6,aq.setColour=i7,aq.show=os,aq.showPositionedByBlock=function(e,t,i,o,s=!0){return oo(ot(t),e,s,i,o)},aq.showPositionedByField=oe;var aQ={};aQ.commonWordPrefix=og,aQ.commonWordSuffix=oE,aQ.isNumber=$.isNumber$$module$build$src$core$utils$string,aQ.shortestStringLength=o_,aQ.wrap=$.wrap$$module$build$src$core$utils$string;var a0=void 0,a1=!1,a2=!1,a3=50,a5=0,a6=0,a4=0,a8=0,a9=null,a7=null,ce=0,ct=10,ci=10,co=750,cs=5,cn=null,cr={HOVER_MS:750,LIMIT:50,MARGINS:5,OFFSET_X:0,OFFSET_Y:10,RADIUS_OK:10};cr.bindMouseEvents=oC,cr.block=oD,cr.createDom=ob,cr.dispose=oL,cr.getCustomTooltip=function(){return a0},cr.getDiv=function(){return cn},cr.getTooltipOfObject=oS,cr.hide=oy,cr.isVisible=function(){return a1},cr.setCustomTooltip=function(e){a0=e},cr.unbindMouseEvents=oO,cr.unblock=ok;var cl=.45,ca=.65,cc={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"},ch={};ch.blend=oW,ch.getHsvSaturation=oB,ch.getHsvValue=ox,ch.hexToRgb=oH,ch.hsvToHex=oU,ch.hueToHex=oV,ch.names=cc,ch.parse=oF,ch.rgbToHex=oG,ch.setHsvSaturation=function(e){cl=e},ch.setHsvValue=function(e){ca=e};var cu={};cu.checkMessageReferences=function(e){let t=!0,i=$.Msg$$module$build$src$core$msg,o=e.match(/%{BKY_[A-Z]\w*}/gi);if(o)for(let s=0;s<o.length;s++)void 0===i[o[s].toUpperCase().slice(6,-1)]&&(console.warn("No message string for "+o[s]+" in "+e),t=!1);return t},cu.parseBlockColour=oz,cu.replaceMessageReferences=oX,cu.tokenizeInterpolation=oY;var cd=class{get size_(){return this.size}set size_(e){this.size=e}constructor(e,t,i){this.DEFAULT_VALUE=null,this.name=void 0,this.tooltip=this.validator_=null,this.size=new ls(0,0),this.constants_=this.mouseDownWrapper=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=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.id_=null,this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE,this.size_=new ls(0,0),e!==cd.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(oX(e.tooltip))}setSourceBlock(e){if(this.sourceBlock_)throw Error("Field already bound to a block");if(this.sourceBlock_=e,e.id.includes("_field"))throw Error(`Field ID indicator is contained in block ID. This may cause problems with focus: ${e.id}.`);this.id_=`${e.id}_field_${ey()}`}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(){if(!this.fieldGroup_){var e=this.id_;if(!e)throw Error("Expected ID to be defined prior to init.");this.fieldGroup_=eZ(li.G,{id:e}),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_(),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyField")}initModel(){}isFullBlockField(){return!this.borderRect_}createBorderRect_(){this.borderRect_=eZ(li.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_=eZ(li.TEXT,{class:"blocklyText blocklyFieldText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)}bindEvents_(){let e=this.getClickTarget_();if(!e)throw Error("A click target has not been set.");oC(e),this.mouseDownWrapper=eb(e,"pointerdown",this,this.onMouseDown_)}fromXml(e){this.setValue(e.textContent)}toXml(e){return e.textContent=this.getValue(),e}saveState(e){return null!==(e=this.saveLegacyState(cd))?e:this.getValue()}loadState(e){this.loadLegacyState(cd,e)||this.setValue(e)}saveLegacyState(e){return e.prototype.saveState===this.saveState&&e.prototype.toXml!==this.toXml?((e=$.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name",this.name||""),tv(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($.textToDom$$module$build$src$core$utils$xml(t)),!0)}dispose(){let e;oc(this),o0(this),(null==(e=this.getSourceBlock())?0:e.isDeadOrDying())||e2(this.fieldGroup_),this.disposed=!0}updateEditable(){let e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(eq(e,"blocklyEditableField"),e0(e,"blocklyNonEditableField")):(eq(e,"blocklyNonEditableField"),e0(e,"blocklyEditableField")))}setEnabled(e){this.enabled_=e,this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==cd.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){let t=this.getConstants(),i=2*(e=void 0!==e?e:this.isFullBlockField()?0:this.getConstants().FIELD_BORDER_RECT_X_PADDING),o=t.FIELD_TEXT_HEIGHT,s=0;this.textElement_&&(i+=s=e8(this.textElement_)),this.isFullBlockField()||(o=Math.max(o,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=o,this.size_.width=i,this.positionTextElement_(e,s),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var i,o=this.getConstants(),s=this.size_.height/2;this.textElement_.setAttribute("x",String((null==(i=this.getSourceBlock())?0:i.RTL)?this.size_.width-t-e:e)),this.textElement_.setAttribute("y",String(o.FIELD_TEXT_BASELINE_CENTER?s:s-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.size_):new ls(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new cp;if(this.isFullBlockField()){var i=this.sourceBlock_.getHeightWidth();let o=t.workspace.scale;e=this.getAbsoluteXY_(),t=(i.width+1)*o,i=(i.height+1)*o,rb?(e.x+=1.5*o,e.y+=1.5*o):(e.x-=.5*o,e.y-=.5*o)}else i=this.borderRect_.getBoundingClientRect(),e=tC(this.borderRect_),t=i.width,i=i.height;return new lo(e.y,e.y+i,e.x,e.x+t)}onLocationChange(e){}getDisplayText_(){let e=this.getText();return e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,cd.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+=""),e}getText(){let e=this.getText_();return null!==e?String(e):String(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(null!==e){var i=$.getGroup$$module$build$src$core$events$utils();i||$.setGroup$$module$build$src$core$events$utils(!0);try{let i=this.doClassValidation_(e),a=this.processValidation(e,i,t);if(!(a instanceof Error)){var o,s=null==(o=this.getValidator())?void 0:o.call(this,a),n=this.processValidation(a,s,t);if(!(n instanceof Error)){var r=this.sourceBlock_;if(!r||!r.disposed){var l=this.getValue();l===n?this.doValueUpdate_(n):(this.doValueUpdate_(n),t&&r&&eY()&&eH(new(ej(rL.BLOCK_CHANGE))(r,"field",this.name||null,l,n)),this.isDirty_&&this.forceRerender())}}}}finally{$.setGroup$$module$build$src$core$events$utils(i)}}}processValidation(e,t,i){return null===t?(this.doValueInvalid_(e,i),this.isDirty_&&this.forceRerender(),Error()):void 0===t?e:t}getValue(){return this.value_}doClassValidation_(e){return null==e?null:e}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_);let t=this.getClickTarget_();t?t.tooltip=e:this.tooltip=e}getTooltip(){let e=this.getClickTarget_();return e?oS(e):oS({tooltip:this.tooltip})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return tC(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null,t=this.getSourceBlock();if(!t)throw new cp;let i=t.inputList;for(let o=0;o<t.inputList.length;o++){let t=i[o],s=t.fieldRow;for(let i=0;i<s.length;i++)if(s[i]===this){e=t;break}}return e}getFlipRtl(){return!1}onShortcut(e){return!1}getFocusableElement(){if(!this.fieldGroup_)throw Error("This field currently has no representative DOM element.");return this.fieldGroup_}getFocusableTree(){let e=this.getSourceBlock();if(!e)throw new cp;return e.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}static fromJson(e){throw Error("Attempted to instantiate a field from the registry that hasn't defined a 'fromJson' method.")}};cd.NBSP=" ",cd.SKIP_SETUP=Symbol("SKIP_SETUP");var cp=class extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}},c_={};c_.Field=cd,c_.UnattachedFieldError=cp;var cg,cE=null,cT=null,cm=null,cf="blocklyWidgetDiv",cI="",cS="",cR=null,cb={};cb.createDom=oJ,cb.getDiv=oj,cb.hide=oq,cb.hideIfOwner=o0,cb.hideIfOwnerIsInWorkspace=o1,cb.isVisible=oQ,cb.positionWithAnchor=o3,cb.repositionForWindowResize=o4,cb.show=oZ,cb.testOnly_setDiv=function(e){if(cg=e,null===e){let e;null==(e=document.querySelector("."+cf))||e.remove()}};var cC=null,cO={},cA=null,c$={};c$.callbackFactory=$.callbackFactory$$module$build$src$core$contextmenu,c$.dispose=ss,c$.getCurrentBlock=function(){return cC},c$.hide=so,c$.setCurrentBlock=o8,c$.show=o9;var cN=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 null!=(t=this.registeredItems.get(e))?t:null}getContextMenuOptions(e,t){let i=[];for(let o of this.registeredItems.values()){let s;if(!o.scopeType||(o.scopeType!==cL.BLOCK||e.block)&&(o.scopeType!==cL.COMMENT||e.comment)&&(o.scopeType!==cL.WORKSPACE||e.workspace)){if(s={scope:e,weight:o.weight},o.separator)s=Object.assign({},s,{separator:!0});else{let i=o.preconditionFn(e,t);if("hidden"===i)continue;s=Object.assign({},s,{text:"function"==typeof o.displayText?o.displayText(e):o.displayText,callback:o.callback,enabled:"enabled"===i})}i.push(s)}}return i.sort(function(e,t){return e.weight-t.weight}),i}};(c2=(c1=cN||(cN={})).ScopeType||(c1.ScopeType={})).BLOCK="block",c2.WORKSPACE="workspace",c2.COMMENT="comment",c1.registry=new c1;var cL=cN.ScopeType,cy={};cy.ContextMenuRegistry=cN,cy.ScopeType=cL;var cD=class{constructor(e){this.comment=e,this.startLoc=null,this.workspace=e.workspace}isMovable(){return this.comment.isOwnMovable()&&!this.comment.isDeadOrDying()&&!this.workspace.isReadOnly()}startDrag(){let e;this.fireDragStartEvent(),this.startLoc=this.comment.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1),null==(e=this.workspace.getLayerManager())||e.moveToDragLayer(this.comment),this.comment.setDragging(!0)}drag(e){this.comment.moveDuringDrag(e)}endDrag(){let e;this.fireDragEndEvent(),this.fireMoveEvent(),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.comment,50),this.comment.setDragging(!1),this.comment.snapToGrid(),this.workspace.setResizesEnabled(!0)}fireDragStartEvent(){eH(new(ej(rL.COMMENT_DRAG))(this.comment,!0))}fireDragEndEvent(){eH(new(ej(rL.COMMENT_DRAG))(this.comment,!1))}fireMoveEvent(){if(!this.comment.isDeadOrDying()){var e=new(ej(rL.COMMENT_MOVE))(this.comment);e.setReason(["drag"]),e.oldCoordinate_=this.startLoc,e.recordNew(),eH(e)}}revertDrag(){this.startLoc&&this.comment.moveDuringDrag(this.startLoc)}},ck=new WeakMap,cw={};cw.move=sl,cw.start=sr;var cM=class{constructor(e,t,i){this.id=e,this.workspace=t,this.container=i}isVisible(){return this.icon.checkVisibility()}getParentComment(){let e=this.workspace.getCommentById(this.id);if(!e)throw Error(`Comment bar button ${this.id} has no corresponding comment`);return e}getSize(e=!1){var t=this.icon.getBBox();return t=lo.from(t),e&&(e=this.getMargin(),t.left-=e,t.top-=e,t.bottom+=e,t.right+=e),t}getMargin(){return(this.container.getBBox().height-this.icon.getBBox().height)/2}getFocusableElement(){return this.icon}getFocusableTree(){return this.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return this.isVisible()}},cv="_collapse_bar_button",cP=class extends cM{constructor(e,t,i){super(e,t,i),this.id=e,this.workspace=t,this.container=i,this.icon=eZ(li.IMAGE,{class:"blocklyFoldoutIcon",href:`${this.workspace.options.pathToMedia}foldout-icon.svg`,id:`${this.id}${cv}`},this.container),this.bindId=eb(this.icon,"pointerdown",this,this.performAction.bind(this))}dispose(){eO(this.bindId)}reposition(){let e=this.getMargin();this.icon.setAttribute("y",`${e}`),this.icon.setAttribute("x",`${e}`)}performAction(e){ef();let t=this.getParentComment();t.view.bringToFront(),e&&e instanceof PointerEvent&&e$(e)?e.stopPropagation():(t.setCollapsed(!t.isCollapsed()),this.workspace.hideChaff(),null==e||e.stopPropagation())}},cB="_comment_textarea_",cx=class{constructor(e,t,i){this.workspace=e,this.onFinishEditing=i,this.textChangeListeners=[],this.text="",this.foreignObject=eZ(li.FOREIGNOBJECT,{class:"blocklyCommentForeignObject"}),(e=document.createElementNS(rk,"body")).setAttribute("xmlns",rk),e.className="blocklyMinimalBody",this.textArea=document.createElementNS(rk,"textarea"),this.textArea.setAttribute("tabindex","-1"),eq(this.textArea,"blocklyCommentText"),eq(this.textArea,"blocklyTextarea"),eq(this.textArea,"blocklyText"),e.appendChild(this.textArea),this.foreignObject.appendChild(e),t&&(this.id=t+cB,this.textArea.setAttribute("id",this.id)),eb(this.textArea,"change",this,this.onTextChange),eb(this.textArea,"pointerdown",this,e=>{e.stopPropagation(),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this),ef()}),eb(this.textArea,"keydown",this,this.handleKeyDown)}getDom(){return this.foreignObject}getText(){return this.text}setText(e){this.textArea.value=e,this.onTextChange()}onTextChange(){let e=this.text;this.text=this.textArea.value;for(let t=this.textChangeListeners.length-1;t>=0;t--)this.textChangeListeners[t](e,this.text)}handleKeyDown(e){("Escape"===e.key||"Enter"===e.key&&(e.ctrlKey||e.metaKey))&&(this.onFinishEditing&&this.onFinishEditing(),e.stopPropagation())}addTextChangeListener(e){this.textChangeListeners.push(e)}removeTextChangeListener(e){this.textChangeListeners.splice(this.textChangeListeners.indexOf(e),1)}setPlaceholderText(e){this.textArea.placeholder=e}setEditable(e){e?this.textArea.removeAttribute("readonly"):this.textArea.setAttribute("readonly","true")}updateSize(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}`)}getFocusableElement(){return this.textArea}getFocusableTree(){return this.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!!this.id}},cF="_delete_bar_button",cG=class extends cM{constructor(e,t,i){super(e,t,i),this.id=e,this.workspace=t,this.container=i,this.icon=eZ(li.IMAGE,{class:"blocklyDeleteIcon",href:`${this.workspace.options.pathToMedia}delete-icon.svg`,id:`${this.id}${cF}`},i),this.bindId=eb(this.icon,"pointerdown",this,this.performAction.bind(this))}dispose(){eO(this.bindId)}reposition(){let e=this.getMargin();this.icon.setAttribute("x","0");let t=this.container.getBBox();this.icon.setAttribute("y",`${e}`),this.icon.setAttribute("x",`${t.width-this.getSize(!0).getWidth()}`)}performAction(e){ef(),e&&e instanceof PointerEvent&&e$(e)?e.stopPropagation():(this.getParentComment().dispose(),null==e||e.stopPropagation(),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.workspace))}},cH=class{constructor(e,t){let i;this.workspace=e,this.commentId=t,this.collapsed=!1,this.editable=!0,this.location=new lt(0,0),this.sizeChangeListeners=[],this.disposeListeners=[],this.collapseChangeListeners=[],this.resizePointerMoveListener=this.resizePointerUpListener=null,this.disposed=this.disposing=!1,this.svgRoot=eZ(li.G,{class:"blocklyComment blocklyEditable blocklyDraggable"}),this.highlightRect=this.createHighlightRect(this.svgRoot),({topBarGroup:this.topBarGroup,topBarBackground:this.topBarBackground,deleteButton:this.deleteButton,foldoutButton:this.foldoutButton,textPreview:this.textPreview,textPreviewNode:this.textPreviewNode}=this.createTopBar(this.svgRoot)),this.commentEditor=this.createTextArea(),this.resizeHandle=this.createResizeHandle(this.svgRoot,e),null==(i=e.getLayerManager())||i.append(this,50),this.size=cH.defaultCommentSize,this.setSizeWithoutFiringEvents(this.size),this.moveTo(new lt(0,0))}createHighlightRect(e){return eZ(li.RECT,{class:"blocklyCommentHighlight"},e)}createTopBar(e){e=eZ(li.G,{class:"blocklyCommentTopbar"},e);let t=eZ(li.RECT,{class:"blocklyCommentTopbarBackground"},e),i=new cG(this.commentId,this.workspace,e),o=new cP(this.commentId,this.workspace,e),s=eZ(li.TEXT,{class:"blocklyCommentPreview blocklyCommentText blocklyText"},e),n=document.createTextNode("");return s.appendChild(n),{topBarGroup:e,topBarBackground:t,deleteButton:i,foldoutButton:o,textPreview:s,textPreviewNode:n}}createTextArea(){let e=new cx(this.workspace,this.commentId,()=>this.svgRoot.focus());return this.svgRoot.appendChild(e.getDom()),e.addTextChangeListener((e,t)=>{this.updateTextPreview(t),this.setSize(this.size)}),e}getEditorFocusableNode(){return this.commentEditor}createResizeHandle(e,t){return eb(e=eZ(li.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),"pointerdown",this,this.onResizePointerDown),e}getSvgRoot(){return this.svgRoot}getSize(){return this.collapsed?this.topBarBackground.getBBox():this.size}setSizeWithoutFiringEvents(e){let t=this.topBarBackground.getBBox(),i=this.textPreview.getBBox(),o=this.resizeHandle.getBBox();this.size=e=ls.max(e,this.calcMinSize(t)),this.svgRoot.setAttribute("height",`${e.height}`),this.svgRoot.setAttribute("width",`${e.width}`),this.updateHighlightRect(e),this.updateTopBarSize(e),this.commentEditor.updateSize(e,t),this.deleteButton.reposition(),this.foldoutButton.reposition(),this.updateTextPreviewSize(e,t,i),this.updateResizeHandlePosition(e,o)}setSize(e){let t=this.preResizeSize||this.size;this.setSizeWithoutFiringEvents(e),this.onSizeChange(t,this.size)}calcMinSize(e){var t;this.updateTextPreview(null!=(t=this.commentEditor.getText())?t:"");let i=t=e8(this.textPreview);return this.foldoutButton.isVisible()?i+=this.foldoutButton.getSize(!0).getWidth():t&&(i+=4),this.deleteButton.isVisible()?i+=this.deleteButton.getSize(!0).getWidth():t&&(i+=4),new ls(i,e.height+20)}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}`)}updateTextPreviewSize(e,t,i){t=(t.height-i.height)/2;let o=this.foldoutButton.getSize(!0),s=this.deleteButton.getSize(!0);e=e.width-o.getWidth()-s.getWidth(),this.textPreview.setAttribute("x",`${o.getWidth()}`),this.textPreview.setAttribute("y",`${t+i.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 i=this.sizeChangeListeners.length-1;i>=0;i--)this.sizeChangeListeners[i](e,t)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}removeSizeChangeListener(e){this.sizeChangeListeners.splice(this.sizeChangeListeners.indexOf(e),1)}onResizePointerDown(e){this.isEditable()&&(this.bringToFront(),e$(e)||(this.preResizeSize=this.getSize(),sr(this.workspace,e,new lt(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=eb(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=eb(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation())}onResizePointerUp(e){ef(),this.resizePointerUpListener&&(eO(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(eO(this.resizePointerMoveListener),this.resizePointerMoveListener=null),this.setSize(this.size),this.preResizeSize=void 0}onResizePointerMove(e){e=sl(this.workspace,e),this.setSizeWithoutFiringEvents(new ls(this.workspace.RTL?-e.x:e.x,e.y))}isCollapsed(){return this.collapsed}setCollapsed(e){(this.collapsed=e)?eq(this.svgRoot,"blocklyCollapsed"):e0(this.svgRoot,"blocklyCollapsed"),this.setSizeWithoutFiringEvents(this.size),this.onCollapse()}onCollapse(){for(let e=this.collapseChangeListeners.length-1;e>=0;e--)this.collapseChangeListeners[e](this.collapsed)}addOnCollapseListener(e){this.collapseChangeListeners.push(e)}removeOnCollapseListener(e){this.collapseChangeListeners.splice(this.collapseChangeListeners.indexOf(e),1)}isEditable(){return this.editable}setEditable(e){(this.editable=e)?(eq(this.svgRoot,"blocklyEditable"),e0(this.svgRoot,"blocklyReadonly")):(e0(this.svgRoot,"blocklyEditable"),eq(this.svgRoot,"blocklyReadonly")),this.commentEditor.setEditable(e)}getRelativeToSurfaceXY(){return this.location}moveTo(e){this.location=e,this.svgRoot.setAttribute("transform",`translate(${e.x}, ${e.y})`)}getText(){return this.commentEditor.getText()}setText(e){this.commentEditor.setText(e)}setPlaceholderText(e){this.commentEditor.setPlaceholderText(e)}addTextChangeListener(e){this.commentEditor.addTextChangeListener(e)}removeTextChangeListener(e){this.commentEditor.removeTextChangeListener(e)}updateTextPreview(e){this.textPreviewNode.textContent=this.truncateText(e)}truncateText(e){return e.length>=12?`${e.substring(0,9)}...`:e}bringToFront(){let e=this.svgRoot.parentNode,t=e.childNodes;t[t.length-1]!==this.svgRoot&&e.appendChild(this.svgRoot)}onDeleteDown(e){ef(),e$(e)||this.dispose(),e.stopPropagation()}dispose(){this.disposing=!0,this.foldoutButton.dispose(),this.deleteButton.dispose(),e2(this.svgRoot);for(let e=this.disposeListeners.length-1;e>=0;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)}getCommentBarButtons(){return[this.foldoutButton,this.deleteButton]}};cH.defaultCommentSize=new ls(120,100),tf("\n.injectionDiv {\n --commentFillColour: #FFFCC7;\n --commentBorderColour: #F2E49B;\n}\n\n.blocklyComment .blocklyTextarea {\n background-color: var(--commentFillColour);\n border: 1px solid var(--commentBorderColour);\n box-sizing: border-box;\n display: block;\n outline: 0;\n padding: 5px;\n resize: none;\n width: 100%;\n height: 100%;\n}\n\n.blocklyReadonly.blocklyComment .blocklyTextarea {\n cursor: inherit;\n}\n\n.blocklyDeleteIcon {\n width: 20px;\n height: 20px;\n display: none;\n cursor: pointer;\n}\n\n.blocklyFoldoutIcon {\n width: 20px;\n height: 20px;\n transform-origin: 12px 12px;\n cursor: pointer;\n}\n.blocklyResizeHandle {\n width: 12px;\n height: 12px;\n cursor: se-resize;\n}\n.blocklyReadonly.blocklyComment .blocklyResizeHandle {\n cursor: inherit;\n}\n\n.blocklyCommentTopbarBackground {\n fill: var(--commentBorderColour);\n height: 24px;\n}\n\n.blocklyComment .blocklyCommentPreview.blocklyText {\n fill: #000;\n dominant-baseline: middle;\n visibility: hidden;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentPreview {\n visibility: visible;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentForeignObject,\n.blocklyCollapsed.blocklyComment .blocklyResizeHandle {\n display: none;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyFoldoutIcon {\n transform: rotate(-90deg);\n}\n\n.blocklyRTL .blocklyCommentTopbar {\n transform: scale(-1, 1);\n}\n\n.blocklyRTL .blocklyCommentForeignObject {\n direction: rtl;\n}\n\n.blocklyRTL .blocklyCommentPreview {\n /* Revert the scale and control RTL using direction instead. */\n transform: scale(-1, 1);\n direction: rtl;\n}\n\n.blocklyRTL .blocklyResizeHandle {\n transform: scale(-1, 1);\n cursor: sw-resize;\n}\n\n.blocklyCommentHighlight {\n fill: none;\n}\n\n.blocklyCommentText.blocklyActiveFocus {\n border-color: #fc3;\n border-width: 2px;\n}\n\n.blocklySelected .blocklyCommentHighlight {\n stroke: #fc3;\n stroke-width: 3px;\n}\n\n.blocklyCollapsed.blocklySelected .blocklyCommentHighlight {\n stroke: none;\n}\n\n.blocklyCollapsed.blocklySelected .blocklyCommentTopbarBackground {\n stroke: #fc3;\n stroke-width: 3px;\n}\n");var cU=class{constructor(e,t){this.workspace=e,this.text="",this.collapsed=!1,this.deletable=this.movable=this.editable=!0,this.location=new lt(0,0),this.disposing=this.disposed=!1,this.id=t&&!e.getCommentById(t)?t:eD(),this.size=cH.defaultCommentSize,e.addTopComment(this),this.fireCreateEvent()}fireCreateEvent(){eY()&&eH(new(ej(rL.COMMENT_CREATE))(this))}fireDeleteEvent(){eY()&&eH(new(ej(rL.COMMENT_DELETE))(this))}fireChangeEvent(e,t){eY()&&eH(new(ej(rL.COMMENT_CHANGE))(this,e,t))}fireCollapseEvent(e){eY()&&eH(new(ej(rL.COMMENT_COLLAPSE))(this,e))}setText(e){let t=this.text;this.text=e,this.fireChangeEvent(t,e)}getText(){return this.text}setSize(e){let t=new(ej(rL.COMMENT_RESIZE))(this);this.size=e,t.recordCurrentSizeAsNewSize(),eH(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.isReadOnly()}isOwnEditable(){return this.editable}setMovable(e){this.movable=e}isMovable(){return this.isOwnMovable()&&!this.workspace.isReadOnly()&&!this.workspace.isFlyout}isOwnMovable(){return this.movable}setDeletable(e){this.deletable=e}isDeletable(){return this.isOwnDeletable()&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()&&!this.workspace.isFlyout}isOwnDeletable(){return this.deletable}moveTo(e,t){let i=new(ej(rL.COMMENT_MOVE))(this);t&&i.setReason(t),this.location=e,i.recordNew(),eH(i)}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}},cW=class extends cU{constructor(e,t){super(e,t),this.dragStrategy=new cD(this),this.workspace=e,this.view=new cH(e,this.id),this.view.setSize(this.getSize()),this.view.setEditable(this.isEditable()),this.view.getSvgRoot().setAttribute("data-id",this.id),this.view.getSvgRoot().setAttribute("id",this.id),this.addModelUpdateBindings(),eb(this.view.getSvgRoot(),"pointerdown",this,this.startGesture),eb(this.view.getSvgRoot(),"wheel",this,e=>{e.stopPropagation()})}addModelUpdateBindings(){this.view.addTextChangeListener((e,t)=>void super.setText(t)),this.view.addSizeChangeListener((e,t)=>void super.setSize(t)),this.view.addOnCollapseListener(()=>void super.setCollapsed(this.view.isCollapsed())),this.view.addDisposeListener(()=>{this.isDeadOrDying()||this.dispose()})}setText(e){this.view.setText(e)}setPlaceholderText(e){this.view.setPlaceholderText(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(){var e,t;let i=this.getRelativeToSurfaceXY(),o=null!=(t=null==(e=this.view)?void 0:e.getSize())?t:this.getSize();return this.workspace.RTL?(e=i.x-o.width,t=i.x):(e=i.x,t=i.x+o.width),new lo(i.y,i.y+o.height,e,t)}moveBy(e,t,i){let o=this.getRelativeToSurfaceXY();e=new lt(o.x+e,o.y+t),this.moveTo(e,i)}moveTo(e,t){super.moveTo(e,t),this.view.moveTo(e)}moveDuringDrag(e){this.location=e,this.view.moveTo(e)}setDragging(e){e?eq(this.getSvgRoot(),"blocklyDragging"):e0(this.getSvgRoot(),"blocklyDragging")}dispose(){this.disposing=!0;let e=$.getFocusManager$$module$build$src$core$focus_manager();e.getFocusedNode()===this&&setTimeout(()=>e.focusTree(this.workspace),0),this.view.isDeadOrDying()||this.view.dispose(),super.dispose()}startGesture(e){let t=this.workspace.getGesture(e);t&&(t.handleCommentStart(e,this),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this))}setDeleteStyle(e){e?eq(this.getSvgRoot(),"blocklyDraggingDelete"):e0(this.getSvgRoot(),"blocklyDraggingDelete")}isCopyable(){return this.isOwnMovable()&&this.isOwnDeletable()}isMovable(){return this.dragStrategy.isMovable()}startDrag(){this.dragStrategy.startDrag()}drag(e){this.dragStrategy.drag(e)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){eq(this.getSvgRoot(),"blocklySelected"),th(this)}unselect(){e0(this.getSvgRoot(),"blocklySelected"),th(null)}toCopyData(){return{paster:lw.TYPE,commentState:tJ(this,{addCoordinates:!0})}}showContextMenu(e){let t,i=cN.registry.getContextMenuOptions({comment:this,focusedNode:this},e);t=e instanceof PointerEvent?new lt(e.clientX,e.clientY):tM(this.workspace,this.getRelativeToSurfaceXY()).translate(10,10),o9(e,i,this.workspace.RTL,this.workspace,t)}snapToGrid(){if(!this.isDeadOrDying()){var e=this.workspace.getGrid();if(null!=e&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();(e=e.alignXY(t))!==t&&this.moveTo(e,["snap"])}}}getEditorFocusableNode(){return this.view.getEditorFocusableNode()}getFocusableElement(){return this.getSvgRoot()}getFocusableTree(){return this.workspace}onNodeFocus(){let e;this.select(),null==(e=this.workspace.getLayerManager())||e.append(this,50)}onNodeBlur(){this.unselect()}canBeFocused(){return!0}},cV={};cV.appendDomToWorkspace=function(e,t){if(!t.getBlocksBoundingBox)return $.domToWorkspace$$module$build$src$core$xml(e,t);var i=t.getBlocksBoundingBox();if(e=$.domToWorkspace$$module$build$src$core$xml(e,t),i&&i.top!==i.bottom){var o=i.bottom;i=t.RTL?i.right:i.left;var s=1/0;let n=-1/0,r=1/0;for(let i=0;i<e.length;i++){let o=t.getBlockById(e[i]).getRelativeToSurfaceXY();o.y<r&&(r=o.y),o.x<s&&(s=o.x),o.x>n&&(n=o.x)}for(o=o-r+10,i=t.RTL?i-n:i-s,s=0;s<e.length;s++)t.getBlockById(e[s]).moveBy(i,o,["create"])}return e},cV.blockToDom=sp,cV.blockToDomWithXY=sh,cV.clearWorkspaceAndLoadFromXml=function(e,t){return t.setResizesEnabled(!1),t.clear(),e=$.domToWorkspace$$module$build$src$core$xml(e,t),t.setResizesEnabled(!0),e},cV.deleteNext=function(e){for(let t=0;t<e.childNodes.length;t++){let i=e.childNodes[t];if("next"===i.nodeName.toLowerCase()){e.removeChild(i);break}}},cV.domToBlock=$.domToBlock$$module$build$src$core$xml,cV.domToBlockInternal=sT,cV.domToPrettyText=function(e){e=sg(e).split("<");let t="";for(let i=1;i<e.length;i++){let o=e[i];"/"===o[0]&&(t=t.substring(2)),e[i]=t+"<"+o,"/"!==o[0]&&"/>"!==o.slice(-2)&&(t+=" ")}return(e=(e=e.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>")).replace(/^\n/,"")},cV.domToText=sg,cV.domToVariables=sm,cV.domToWorkspace=$.domToWorkspace$$module$build$src$core$xml,cV.loadWorkspaceComment=sE,cV.saveWorkspaceComment=sa,cV.variablesToDom=sc,cV.workspaceToDom=function(e,t=!1){let i=$.createElement$$module$build$src$core$utils$xml("xml");var o=sc($.allUsedVarModels$$module$build$src$core$variables(e));for(let s of(o.hasChildNodes()&&i.appendChild(o),e.getTopComments()))i.appendChild(sa(s,t));for(o=0,e=e.getTopBlocks(!0);o<e.length;o++)i.appendChild(sh(e[o],t));return i};var cK=class extends aC{constructor(e){super(e),this.type=rL.BLOCK_CREATE,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=sh(e),this.ids=eX(e),this.json=ik(e,{addCoordinates:!0}))}toJson(){let 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=sg(this.xml),e.ids=this.ids,e.json=this.json,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new cK)).xml=$.textToDom$$module$build$src$core$utils$xml(e.xml),t.ids=e.ids,t.json=e.json,void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}run(e){let 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(!cY(t,this.ids))if(e)iH(this.json,t);else for(e=0;e<this.ids.length;e++){let i=this.ids[e],o=t.getBlockById(i);o?o.dispose(!1):i===this.blockId&&console.warn("Can't uncreate non-existent block: "+i)}}},cY=function(e,t){return t.map(t=>e.getBlockById(t)).filter(e=>e&&e.isShadow()).length===t.length};ea(D.EVENT,rL.BLOCK_CREATE,cK);var cX=class extends r0{constructor(e,t){super(t),this.type=rL.THEME_CHANGE,this.themeName=e}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new cX)).themeName=e.themeName,t}};ea(D.EVENT,rL.THEME_CHANGE,cX);var cz=class extends r0{constructor(e,t,i,o,s){super(o),this.type=rL.VIEWPORT_CHANGE,this.viewTop=e,this.viewLeft=t,this.scale=i,this.oldScale=s}toJson(){let e=super.toJson();if(void 0===this.viewTop)throw Error("The view top is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.viewLeft)throw Error("The view left is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.scale)throw Error("The scale is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.oldScale)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,i){return(t=super.fromJson(e,t,null!=i?i:new cz)).viewTop=e.viewTop,t.viewLeft=e.viewLeft,t.scale=e.scale,t.oldScale=e.oldScale,t}};ea(D.EVENT,rL.VIEWPORT_CHANGE,cz),(c3=c5||(c5={}))[c3.INPUT_VALUE=1]="INPUT_VALUE",c3[c3.OUTPUT_VALUE=2]="OUTPUT_VALUE",c3[c3.NEXT_STATEMENT=3]="NEXT_STATEMENT",c3[c3.PREVIOUS_STATEMENT=4]="PREVIOUS_STATEMENT";var cj=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;let i=this.calculateIndexForYPos(t);if(i>=this.connections.length)return -1;t=e.y;let o=i;for(;o>=0&&this.connections[o].y===t;){if(this.connections[o]===e)return o;o--}for(o=i;o<this.connections.length&&this.connections[o].y===t;){if(this.connections[o]===e)return o;o++}return -1}calculateIndexForYPos(e){if(!this.connections.length)return 0;let t=0,i=this.connections.length;for(;t<i;){let o=Math.floor((t+i)/2);if(this.connections[o].y<e)t=o+1;else if(this.connections[o].y>e)i=o;else{t=o;break}}return t}removeConnection(e,t){if(-1===(e=this.findIndexOfConnection(e,t)))throw Error("Unable to find connection in connectionDB.");this.connections.splice(e,1)}getNeighbours(e,t){function i(e){let i=s-o[e].x,r=n-o[e].y;return Math.sqrt(i*i+r*r)<=t&&a.push(o[e]),r<t}let o=this.connections,s=e.x,n=e.y;e=0;let r=o.length-2,l=r;for(;e<l;)o[l].y<n?e=l:r=l,l=Math.floor((e+r)/2);let a=[];if(r=e=l,o.length){for(;e>=0&&i(e);)e--;do r++;while(r<o.length&&i(r))}return a}isInYRange(e,t,i){return Math.abs(this.connections[e].y-t)<=i}searchForClosest(e,t,i){if(!this.connections.length)return{connection:null,radius:t};let o=e.y,s=e.x;e.x=s+i.x,e.y=o+i.y;var n=this.calculateIndexForYPos(e.y);i=null;let r=t,l,a=n-1;for(;a>=0&&this.isInYRange(a,e.y,t);)l=this.connections[a],this.connectionChecker.canConnect(e,l,!0,r)&&(i=l,r=l.distanceFrom(e)),a--;for(;n<this.connections.length&&this.isInYRange(n,e.y,t);)l=this.connections[n],this.connectionChecker.canConnect(e,l,!0,r)&&(i=l,r=l.distanceFrom(e)),n++;return e.x=s,e.y=o,{connection:i,radius:r}}static init(e){let t=[];return t[c5.INPUT_VALUE]=new cj(e),t[c5.OUTPUT_VALUE]=new cj(e),t[c5.NEXT_STATEMENT]=new cj(e),t[c5.PREVIOUS_STATEMENT]=new cj(e),t}},cJ=class extends r0{constructor(e,t,i){super(i),this.type=rL.SELECTED,this.oldElementId=null!=e?e:void 0,this.newElementId=null!=t?t:void 0}toJson(){let e=super.toJson();return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new cJ)).oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};ea(D.EVENT,rL.SELECTED,cJ);var cZ=class extends aC{constructor(e){if(super(e),this.type=rL.BLOCK_DELETE,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=sh(e),this.ids=eX(e),this.wasShadow=e.isShadow(),this.oldJson=ik(e,{addCoordinates:!0})}}toJson(){let 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(void 0===this.wasShadow)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=sg(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,i){return(t=super.fromJson(e,t,null!=i?i:new cZ)).oldXml=$.textToDom$$module$build$src$core$utils$xml(e.oldXml),t.ids=e.ids,t.wasShadow=e.wasShadow||"shadow"===t.oldXml.tagName.toLowerCase(),t.oldJson=e.oldJson,void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}run(e){let 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++){let i=this.ids[e],o=t.getBlockById(i);o?o.dispose(!1):i===this.blockId&&console.warn("Can't delete non-existent block: "+i)}else iH(this.oldJson,t)}};ea(D.EVENT,rL.BLOCK_DELETE,cZ);var cq={fromJsonInternal:function(e){let t=e_(D.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)}},cQ={TEST_ONLY:cq};cQ.fromJson=$.fromJson$$module$build$src$core$field_registry,cQ.register=sy,cQ.unregister=function(e){eh(D.FIELD,e)};var c0=class extends cd{constructor(e,t,i){super(cd.SKIP_SETUP),this.svgArrow=this.arrow=this.imageElement=this.menu_=this.selectedMenuItem=null,this.SERIALIZABLE=!0,this.clickTarget_=this.suffixField=this.prefixField=this.generatedOptions=null,e!==cd.SKIP_SETUP&&(this.setOptions(e),i&&this.configure_(i),t&&this.setValidator(t))}fromXml(e){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e.textContent)}loadState(e){this.loadLegacyState(c0,e)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement=eZ(li.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&eq(this.borderRect_,"blocklyDropdownRect"),this.fieldGroup_&&(eq(this.fieldGroup_,"blocklyField"),eq(this.fieldGroup_,"blocklyDropdownField"))}shouldAddBorderRect_(){let e;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!(null==(e=this.getSourceBlock())?0:e.isShadow())}createTextArrow_(){let e,t;this.arrow=eZ(li.TSPAN,{},this.textElement_),this.arrow.appendChild(document.createTextNode((null==(e=this.getSourceBlock())?0:e.RTL)?c0.ARROW_CHAR+" ":" "+c0.ARROW_CHAR)),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.arrow.setAttribute("dominant-baseline","central"),(null==(t=this.getSourceBlock())?0:t.RTL)?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=eZ(li.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow.setAttributeNS(rw,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(e){var t=this.getSourceBlock();if(!t)throw new cp;this.dropdownCreate(),this.menu_&&(this.menu_.openingCoords=e&&"number"==typeof e.clientX?new lt(e.clientX,e.clientY):null,i9(),eq(e=this.menu_.render(i8()),"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&i7(t=t.getColour(),e=this.sourceBlock_.getColourTertiary()),oe(this,this.dropdownDispose_.bind(this)),i8().style.height=`${this.menu_.getSize().height}px`,this.menu_.focus(),this.selectedMenuItem&&this.menu_.setHighlighted(this.selectedMenuItem),this.applyColour())}dropdownCreate(){let e=this.getSourceBlock();if(!e)throw new cp;let t=new lY;t.setRole(lH.LISTBOX),this.menu_=t;let i=this.getOptions(!1);this.selectedMenuItem=null;for(let s=0;s<i.length;s++){var o=i[s];if(o===c0.SEPARATOR){t.addChild(new lX);continue}let[n,r]=o;sD(n)?((o=new Image(n.width,n.height)).src=n.src,o.alt=n.alt):o=n,(o=new lK(o,r)).setRole(lH.OPTION),o.setRightToLeft(e.RTL),o.setCheckable(!0),t.addChild(o),o.setChecked(r===this.value_),r===this.value_&&(this.selectedMenuItem=o),o.onAction(this.handleMenuActionEvent,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose(),this.selectedMenuItem=this.menu_=null,this.applyColour()}handleMenuActionEvent(e){oc(this,!0),this.onItemSelected_(this.menu_,e)}onItemSelected_(e,t){this.setValue(t.getValue())}isOptionListDynamic(){return"function"==typeof this.menuGenerator_}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.menuGenerator_(),this.validateOptions(this.generatedOptions)),this.generatedOptions)}setOptions(e){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],this.setValue(this.selectedOption[1])}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,i;i=e[t];t++)i[1]===this.value_&&(this.selectedOption=i)}applyColour(){let 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";let e=this.selectedOption&&this.selectedOption[0];sD(e)?this.renderSelectedImage(e):this.renderSelectedText(),this.positionBorderRect_()}renderSelectedImage(e){let t,i=this.getSourceBlock();if(!i)throw new cp;this.imageElement.style.display="",this.imageElement.setAttributeNS(rw,"xlink:href",e.src),this.imageElement.setAttribute("height",String(e.height)),this.imageElement.setAttribute("width",String(e.width));let o=Number(e.height);e=Number(e.width);var s=!!this.borderRect_;let n=Math.max(s?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,o+c0.IMAGE_Y_PADDING);s=s?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,t=this.svgArrow?this.positionSVGArrow(e+s,n/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):e8(this.arrow),this.size_.width=e+t+2*s,this.size_.height=n;let r=0;i.RTL?this.imageElement.setAttribute("x",`${s+t}`):(r=e+t,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x",`${s}`)),this.imageElement.setAttribute("y",String(n/2-o/2)),this.positionTextElement_(r+s,e+t)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();eq(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);let i=e8(this.getTextElement());t=t?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let o=0;this.svgArrow&&(o=this.positionSVGArrow(i+t,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_.width=i+o+2*t,this.size_.height=e,this.positionTextElement_(t,i)}positionSVGArrow(e,t){if(!this.svgArrow)return 0;let i=this.getSourceBlock();if(!i)throw new cp;let o=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,s=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,n=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(i.RTL?o:e+s)+","+t+")"),n+s}getText_(){if(!this.selectedOption)return null;let e=this.selectedOption[0];if(sD(e))return e.alt;if("u">typeof HTMLElement&&e instanceof HTMLElement){let t,i;return null!=(i=null!=(t=e.title)?t:e.ariaLabel)?i:e.innerText}return"string"==typeof e?e:(console.warn("Can't get text for existing dropdown option. If you're using HTMLElement dropdown options in node, ensure you're using jsdom-global or similar."),null)}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,i=e.map(e=>{if(e===c0.SEPARATOR)return e;let[i,o]=e;return"string"==typeof i?[oX(i),o]:(t=!0,[sD(i)?Object.assign({},i,{alt:oX(i.alt)}):Object.assign({},i),o])});if(t||e.length<2)return{options:i};var o=i.map(([e])=>e),s=o_(o);e=og(o,s);let n=oE(o,s);return(e||n)&&!(s<=e+n)?(s=e?o[0].substring(0,e-1):void 0,o=n?o[0].substr(1-n):void 0,{options:this.applyTrim(i,e,n),prefix:s,suffix:o}):{options:i}}applyTrim(e,t,i){return e.map(([e,o])=>[e.substring(t,e.length-i),o])}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 i=0;i<e.length;i++){let o=e[i];Array.isArray(o)||o===c0.SEPARATOR?"string"!=typeof o[1]?(t=!0,console.error(`Invalid option[${i}]: Each FieldDropdown option id must be a string.
|
|
35
35
|
Found ${o[1]} in: ${o}`)):!o[0]||"string"==typeof o[0]||sD(o[0])||"u">typeof HTMLElement&&o[0]instanceof HTMLElement||(t=!0,console.error(`Invalid option[${i}]: Each FieldDropdown option must have a string
|
|
36
36
|
label, image description, or HTML element. Found ${o[0]} in: ${o}`)):(t=!0,console.error(`Invalid option[${i}]: Each FieldDropdown option must be an array or
|
|
37
|
-
the string literal 'separator'. Found: ${o}`))}if(t)throw TypeError("Found invalid FieldDropdown options.")}};c0.SEPARATOR="separator",c0.ARROW_CHAR="▾",c0.IMAGE_Y_OFFSET=5,c0.IMAGE_Y_PADDING=2*c0.IMAGE_Y_OFFSET,sy("field_dropdown",c0);var c1,c2,c3,c5,c6,c4=class{constructor(e,t,i,o){this.name=e,this.startHats=!1,this.blockStyles=t||Object.create(null),this.categoryStyles=i||Object.create(null),this.componentStyles=o||Object.create(null),this.fontStyle=Object.create(null),ea(D.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]))return null;if("string"==typeof e){let 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){let i=new c4(e=e.toLowerCase()),o=t.base;if(o){if("string"==typeof o){let e;o=null!=(e=e_(D.THEME,o))?e:void 0}o instanceof c4&&(ti(i,o),i.name=e)}return ti(i.blockStyles,t.blockStyles),ti(i.categoryStyles,t.categoryStyles),ti(i.componentStyles,t.componentStyles),ti(i.fontStyle,t.fontStyle),null!==t.startHats&&(i.startHats=t.startHats),i}},c8=new c4("classic",{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"}},{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"}}),c9=class{constructor(e){let t,i,o;this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let s=null,n=!1;var r,l=!1,a=!1,c=!1,h=!1,u=!1;let d=!!e.readOnly;d||(n=tG(s=tB(null!=(r=e.toolbox)?r:null)),l=void 0===(l=e.trashcan)?n:l,a=void 0===(a=e.collapse)?n:a,c=void 0===(c=e.comments)?n:c,h=void 0===(h=e.disable)?n:h,u=void 0===(u=e.sounds)||u),r=e.maxTrashcanContents,l?void 0===r&&(r=32):r=0;let p=!!e.rtl,_=e.horizontalLayout;void 0===_&&(_=!1);var g="end"!==e.toolboxPosition;g=_?g?lS.TOP:lS.BOTTOM:g===p?lS.RIGHT:lS.LEFT;let E=e.css;void 0===E&&(E=!0);let T="https://blockly-demo.appspot.com/static/media/";e.media&&(T=e.media.endsWith("/")?e.media:e.media+"/");let m=e.oneBasedIndex,f=e.renderer||"geras",I=e.plugins||{},S=e.modalInputs;void 0===S&&(S=!0),this.RTL=p,this.oneBasedIndex=void 0===m||m,this.collapse=a,this.comments=c,this.disable=h,this.readOnly=d,this.maxBlocks=e.maxBlocks||1/0,this.maxInstances=null!=(t=e.maxInstances)?t:null,this.modalInputs=S,this.pathToMedia=T,this.hasCategories=n,this.moveOptions=c9.parseMoveOptions(e,n),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=l,this.maxTrashcanContents=r,this.hasSounds=u,this.hasCss=E,this.horizontalLayout=_,this.languageTree=s,this.gridOptions=c9.parseGridOptions(e),this.zoomOptions=c9.parseZoomOptions(e),this.toolboxPosition=g,this.theme=c9.parseThemeOptions(e),this.renderer=f,this.rendererOverrides=null!=(i=e.rendererOverrides)?i:null,this.parentWorkspace=null!=(o=e.parentWorkspace)?o:null,this.plugins=I}static parseMoveOptions(e,t){let i=e.move||{},o={};return void 0===i.scrollbars&&void 0===e.scrollbars?o.scrollbars=t:"object"==typeof i.scrollbars?(o.scrollbars={horizontal:!!i.scrollbars.horizontal,vertical:!!i.scrollbars.vertical},o.scrollbars.horizontal&&o.scrollbars.vertical?o.scrollbars=!0:o.scrollbars.horizontal||o.scrollbars.vertical||(o.scrollbars=!1)):o.scrollbars=!!i.scrollbars||!!e.scrollbars,o.wheel=o.scrollbars&&void 0!==i.wheel?!!i.wheel:"object"==typeof o.scrollbars,o.drag=!!o.scrollbars&&(void 0===i.drag||!!i.drag),o}static parseZoomOptions(e){e=e.zoom||{};let t={};return t.controls=void 0!==e.controls&&!!e.controls,t.wheel=void 0!==e.wheel&&!!e.wheel,t.startScale=void 0===e.startScale?1:Number(e.startScale),t.maxScale=void 0===e.maxScale?3:Number(e.maxScale),t.minScale=void 0===e.minScale?.3:Number(e.minScale),t.scaleSpeed=void 0===e.scaleSpeed?1.2:Number(e.scaleSpeed),t.pinch=void 0===e.pinch?t.wheel||t.controls:!!e.pinch,t}static parseGridOptions(e){e=e.grid||{};let t={};return t.spacing=Number(e.spacing)||0,t.colour=e.colour||"#888",t.length=void 0===e.length?1:Number(e.length),t.snap=t.spacing>0&&!!e.snap,t}static parseThemeOptions(e){return"string"==typeof(e=e.theme||c8)?e_(D.THEME,e):e instanceof c4?e:c4.defineTheme(e.name||"builtin"+ey(),e)}},c7=class{constructor(e,t){this.bubble=e,this.workspace=t,this.startLoc=null}isMovable(){return!0}startDrag(){let e;this.startLoc=this.bubble.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1),null==(e=this.workspace.getLayerManager())||e.moveToDragLayer(this.bubble),this.bubble.setDragging&&this.bubble.setDragging(!0)}drag(e){this.bubble.moveDuringDrag(e)}endDrag(){let e;this.workspace.setResizesEnabled(!0),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.bubble,100),this.bubble.setDragging(!1)}revertDrag(){this.startLoc&&this.bubble.moveDuringDrag(this.startLoc)}},he=class{constructor(e,t,i,o){this.workspace=e,this.anchor=t,this.ownerRect=i,this.size=new ls(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.dragStrategy=new c7(this,this.workspace),this.id=ey(),this.svgRoot=eZ(li.G,{class:"blocklyBubble"},e.getBubbleCanvas()),e=eZ(li.G,{class:"blocklyEmboss"},this.svgRoot),this.tail=eZ(li.PATH,{class:"blocklyBubbleTail"},e),this.background=eZ(li.RECT,{class:"blocklyDraggable",x:0,y:0,rx:c6.BORDER_WIDTH,ry:c6.BORDER_WIDTH},e),this.contentContainer=eZ(li.G,{},this.svgRoot),this.focusableElement=null!=o?o:this.svgRoot,this.focusableElement.setAttribute("id",this.id),eb(this.background,"pointerdown",this,this.onMouseDown)}dispose(){e2(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,c6.MIN_SIZE),e.height=Math.max(e.height,c6.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;null==(t=this.workspace.getGesture(e))||t.handleBubbleStart(e,this),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(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 lo(0,0,0,0)){var t=this.workspace.getMetricsManager().getViewMetrics(!0),i=this.getOptimalRelativeLeft(t),o=this.getOptimalRelativeTop(t);let s={x:i,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},n={x:-this.size.width-30,y:o};o={x:e.getWidth(),y:o};var r={x:i,y:e.getHeight()};i=e.getWidth()<e.getHeight()?o:r,e=e.getWidth()<e.getHeight()?r:o,o=this.getOverlap(s,t),r=this.getOverlap(n,t);let l=this.getOverlap(i,t);t=Math.max(o,r,l,t=this.getOverlap(e,t)),o===t?(this.relativeLeft=s.x,this.relativeTop=s.y):r===t?(this.relativeLeft=n.x,this.relativeTop=n.y):l===t?(this.relativeLeft=i.x,this.relativeTop=i.y):(this.relativeLeft=e.x,this.relativeTop=e.y),this.positionRelativeToAnchor()}getOverlap(e,t){var i=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(i+this.size.width,t.left+t.width)-Math.max(i,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 i=this.anchor.x-t;i-this.size.width<e.left?t=-(e.left-this.anchor.x+this.size.width):i>e.right&&(t=-(e.right-this.anchor.x))}else{let o=(i=t+this.anchor.x)+this.size.width;i<e.left?t=e.left-this.anchor.x:o>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;let i=this.anchor.y+t,o=i+this.size.height;return i<(e=this.getWorkspaceViewRect(e)).top?t=e.top-this.anchor.y:o>e.bottom&&(t=e.bottom-this.anchor.y-this.size.height),t}getWorkspaceViewRect(e){let t=e.top,i=e.top+e.height,o=e.left;return e=e.left+e.width,i-=this.getScrollbarThickness(),this.workspace.RTL?o-=this.getScrollbarThickness():e-=this.getScrollbarThickness(),new lo(t,i,o,e)}getScrollbarThickness(){return lh.scrollbarThickness/this.workspace.scale}renderTail(){let e,t=[];var i=this.size.width/2,o=this.size.height/2,s=-this.relativeLeft,n=-this.relativeTop;if(i===s&&o===n)t.push("M "+i+","+o);else{n-=o,s-=i,this.workspace.RTL&&(s*=-1);var r=Math.sqrt(n*n+s*s),l=Math.acos(s/r);n<0&&(l=2*Math.PI-l);var a=l+Math.PI/2;a>2*Math.PI&&(a-=2*Math.PI);var c=Math.sin(a);let e=Math.cos(a),h=(this.size.width+this.size.height)/c6.TAIL_THICKNESS;h=Math.min(h,this.size.width,this.size.height)/4,s=i+(a=1-c6.ANCHOR_RADIUS/r)*s,n=o+a*n,a=i+h*e;let u=o+h*c;i-=h*e,o-=h*c,(c=l+(c=i2(this.workspace.RTL?-c6.TAIL_ANGLE:c6.TAIL_ANGLE)))>2*Math.PI&&(c-=2*Math.PI),l=Math.sin(c)*r/c6.TAIL_BEND,r=Math.cos(c)*r/c6.TAIL_BEND,t.push("M"+a+","+u),t.push("C"+(a+r)+","+(u+l)+" "+s+","+n+" "+s+","+n),t.push("C"+s+","+n+" "+(i+r)+","+(o+l)+" "+i+","+o)}t.push("z"),null==(e=this.tail)||e.setAttribute("d",t.join(" "))}bringToFront(){let e,t=null==(e=this.svgRoot)?void 0:e.parentNode;return!!this.svgRoot&&(null==t?void 0:t.lastChild)!==this.svgRoot&&(null==t||t.appendChild(this.svgRoot),!0)}getRelativeToSurfaceXY(){return new lt(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(){th(this)}unselect(){th(null)}getFocusableElement(){return this.focusableElement}getFocusableTree(){return this.workspace}onNodeFocus(){this.select(),this.bringToFront()}onNodeBlur(){this.unselect()}canBeFocused(){return!0}};c6=he,he.BORDER_WIDTH=6,he.DOUBLE_BORDER=2*c6.BORDER_WIDTH,he.MIN_SIZE=c6.DOUBLE_BORDER,he.TAIL_THICKNESS=1,he.TAIL_ANGLE=20,he.TAIL_BEND=4,he.ANCHOR_RADIUS=8;var ht=class extends he{constructor(e,t,i,o){let s,n;super(t,i,o),this.workspace=t,this.anchor=i,this.ownerRect=o,this.autoLayout=!0,t=new c9(e),this.validateWorkspaceOptions(t),this.svgDialog=eZ(li.SVG,{x:he.BORDER_WIDTH,y:he.BORDER_WIDTH},this.contentContainer),e.parentWorkspace=this.workspace,this.miniWorkspace=this.newWorkspaceSvg(new c9(e)),this.miniWorkspace.internalIsMutator=!0,e=this.miniWorkspace.createDom("blocklyMutatorBackground"),this.svgDialog.appendChild(e),t.languageTree&&(e.insertBefore(this.miniWorkspace.addFlyout(li.G),this.miniWorkspace.getCanvas()),null==(e=this.miniWorkspace.getFlyout())||e.init(this.miniWorkspace),null==e||e.show(t.languageTree)),eq(this.svgRoot,"blocklyMiniWorkspaceBubble"),this.miniWorkspace.addChangeListener(this.onWorkspaceChange.bind(this)),null==(s=this.miniWorkspace.getFlyout())||null==(n=s.getWorkspace())||n.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()||this.miniWorkspace.keyboardMoveInProgress)for(let e of this.miniWorkspace.getTopBlocks(!1)){let t=e.getRelativeToSurfaceXY();if(t.y<20&&e.moveBy(0,20-t.y),e.RTL){let i=-20,o=this.miniWorkspace.getFlyout();o&&(i-=o.getWidth()),t.x>i&&e.moveBy(i-t.x,0)}else t.x<20&&e.moveBy(20-t.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()||this.miniWorkspace.keyboardMoveInProgress){this.autoLayout&&(this.autoLayout=!this.miniWorkspace.keyboardMoveInProgress);var e=this.getSize(),t=this.calculateWorkspaceSize();Math.abs(e.width-t.width)<ht.MINIMUM_VIEW_CHANGE&&Math.abs(e.height-t.height)<ht.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 ls(t.width+he.DOUBLE_BORDER,t.height+he.DOUBLE_BORDER),this.autoLayout),this.miniWorkspace.resize(),this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var e=this.miniWorkspace.getCanvas().getBBox();let t=e.width+ht.MARGIN;e=e.height+ht.MARGIN;let i=this.miniWorkspace.getFlyout();return i&&(e=Math.max(e,i.getWorkspace().getMetricsManager().getScrollMetrics().height+20),t+=i.getWidth()),new ls(t,e)}updateBlockStyles(){let e;for(var t of this.miniWorkspace.getAllBlocks(!1))t.setStyle(t.getStyleName());if(t=null==(e=this.miniWorkspace.getFlyout())?void 0:e.getWorkspace())for(let e of t.getAllBlocks(!1))e.setStyle(e.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")}};ht.MINIMUM_VIEW_CHANGE=10,ht.MARGIN=3*he.DOUBLE_BORDER;var hi=class{constructor(e){this.sourceBlock=e,this.offsetInBlock=new lt(0,0),this.workspaceLocation=new lt(0,0),this.svgRoot=null,this.tooltip=e,this.id=ey()}getType(){throw Error("Icons must implement getType")}initView(e){if(!this.svgRoot){var t=this.sourceBlock;this.svgRoot=eZ(li.G,{class:"blocklyIconGroup",id:this.id}),t.getSvgRoot().appendChild(this.svgRoot),this.updateSvgRootOffset(),eb(this.svgRoot,"pointerdown",this,e),this.svgRoot.tooltip=this,oC(this.svgRoot)}}dispose(){oO(this.svgRoot),e2(this.svgRoot)}getWeight(){return -1}getSize(){return new ls(0,0)}setTooltip(e){this.tooltip=null!=e?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",i1(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;null==(e=this.svgRoot)||e.setAttribute("transform",`translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`)}onLocationChange(e){this.workspaceLocation=lt.sum(e,this.offsetInBlock)}onClick(){}isClickableInFlyout(e){return!0}getFocusableElement(){let e=this.svgRoot;if(!e)throw Error("Attempting to focus uninitialized icon.");return e}getFocusableTree(){return this.sourceBlock.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getSourceBlock(){return this.sourceBlock}};$.MutatorIcon$$module$build$src$core$icons$mutator_icon=class extends hi{constructor(e,t){super(t),this.flyoutBlockTypes=e,this.sourceBlock=t,this.saveConnectionsListener=this.updateWorkspacePid=this.rootBlock=this.miniWorkspaceBubble=null}getType(){return $.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE}initView(e){this.svgRoot||(super.initView(e),eZ(li.RECT,{class:"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},this.svgRoot),eZ(li.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),eZ(li.CIRCLE,{class:"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},this.svgRoot),eq(this.svgRoot,"blocklyMutatorIcon"))}dispose(){let e;super.dispose(),null==(e=this.miniWorkspaceBubble)||e.dispose()}getWeight(){return $.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT}getSize(){return new ls(17,17)}applyColour(){let e,t;super.applyColour(),null==(e=this.miniWorkspaceBubble)||e.setColour(this.sourceBlock.getColour()),null==(t=this.miniWorkspaceBubble)||t.updateBlockStyles()}updateCollapsed(){super.updateCollapsed(),this.sourceBlock.isCollapsed()&&this.setBubbleVisible(!1)}onLocationChange(e){let t;super.onLocationChange(e),null==(t=this.miniWorkspaceBubble)||t.setAnchorLocation(this.getAnchorLocation())}onClick(){super.onClick(),this.sourceBlock.isEditable()&&this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.miniWorkspaceBubble}setBubbleVisible(e){let t=this;return(0,rf.asyncExecutePromiseGeneratorFunction)(function*(){if(t.bubbleIsVisible()!==e){if(yield t6(),e){let e;t.miniWorkspaceBubble=new ht(t.getMiniWorkspaceConfig(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour(),t.createRootBlock(),t.addSaveConnectionsListener(),null==(e=t.miniWorkspaceBubble)||e.addWorkspaceChangeListener(t.createMiniWorkspaceChangeListener())}else{let e;null==(e=t.miniWorkspaceBubble)||e.dispose(),t.miniWorkspaceBubble=null,t.saveConnectionsListener&&t.sourceBlock.workspace.removeChangeListener(t.saveConnectionsListener),t.saveConnectionsListener=null}eH(new(ej(rL.BUBBLE_OPEN))(t.sourceBlock,e,"mutator"))}})}getBubble(){return this.miniWorkspaceBubble}getMiniWorkspaceConfig(){let e,t={disable:!1,media:this.sourceBlock.workspace.options.pathToMedia,rtl:this.sourceBlock.RTL,renderer:this.sourceBlock.workspace.options.renderer,rendererOverrides:null!=(e=this.sourceBlock.workspace.options.rendererOverrides)?e:void 0};return this.flyoutBlockTypes.length&&(t.toolbox={kind:"flyoutToolbox",contents:this.flyoutBlockTypes.map(e=>({kind:"block",type:e}))}),t}getAnchorLocation(){return lt.sum(this.workspaceLocation,new lt(8.5,8.5))}getBubbleOwnerRect(){let e=this.sourceBlock.getSvgRoot().getBBox();return new lo(e.y,e.y+e.height,e.x,e.x+e.width)}createRootBlock(){let e,t,i,o;if(!this.sourceBlock.decompose)throw Error("Blocks with mutator icons must include a decompose method");for(var s of(this.rootBlock=this.sourceBlock.decompose(this.miniWorkspaceBubble.getWorkspace()),this.rootBlock.getDescendants(!1)))s.queueRender();this.rootBlock.setMovable(!1),this.rootBlock.setDeletable(!1),s=null!=(o=null==(e=this.miniWorkspaceBubble)||null==(t=e.getWorkspace())||null==(i=t.getFlyout())?void 0:i.getWidth())?o:0,this.rootBlock.moveBy(this.rootBlock.RTL?-(s+16):16,16)}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=>{$.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||ek(e)||ev(e)&&"disabled"===e.element}recomposeSourceBlock(){if(this.rootBlock){if(!this.sourceBlock.compose)throw Error("Blocks with mutator icons must include a compose method");var e=$.getGroup$$module$build$src$core$events$utils();e||$.setGroup$$module$build$src$core$events$utils(!0);var t=aO.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var i=aO.getExtraBlockState_(this.sourceBlock);t!==i&&eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock,"mutation",null,t,i)),$.setGroup$$module$build$src$core$events$utils(e)}}getWorkspace(){let e;return null==(e=this.miniWorkspaceBubble)?void 0:e.getWorkspace()}},$.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE=ab.MUTATOR,$.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1,$.MutatorIcon$$module$build$src$core$icons$mutator_icon;var ho=Object.create(null);$.register$$module$build$src$core$extensions("parent_tooltip_when_inline",function(){let e=this.tooltip;this.setTooltip((function(){let t=this.getParent();return t&&t.getInputsInline()&&t.tooltip||e}).bind(this))});var hs={TEST_ONLY:{allExtensions:ho}};hs.apply=sw,hs.buildTooltipForDropdown=$.buildTooltipForDropdown$$module$build$src$core$extensions,hs.buildTooltipWithFieldText=$.buildTooltipWithFieldText$$module$build$src$core$extensions,hs.isRegistered=sk,hs.register=$.register$$module$build$src$core$extensions,hs.registerMixin=$.registerMixin$$module$build$src$core$extensions,hs.registerMutator=$.registerMutator$$module$build$src$core$extensions,hs.runAfterPageLoad=function(e){if("object"!=typeof document)throw Error("runAfterPageLoad() requires browser document.");if("complete"===document.readyState)e();else{let t=setInterval(function(){"complete"===document.readyState&&(clearInterval(t),e())},10)}},hs.unregister=function(e){sk(e)?delete ho[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},(dG=dK||(dK={}))[dG.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX",dG[dG.MAC_ENTER=3]="MAC_ENTER",dG[dG.BACKSPACE=8]="BACKSPACE",dG[dG.TAB=9]="TAB",dG[dG.NUM_CENTER=12]="NUM_CENTER",dG[dG.ENTER=13]="ENTER",dG[dG.SHIFT=16]="SHIFT",dG[dG.CTRL=17]="CTRL",dG[dG.ALT=18]="ALT",dG[dG.PAUSE=19]="PAUSE",dG[dG.CAPS_LOCK=20]="CAPS_LOCK",dG[dG.ESC=27]="ESC",dG[dG.SPACE=32]="SPACE",dG[dG.PAGE_UP=33]="PAGE_UP",dG[dG.PAGE_DOWN=34]="PAGE_DOWN",dG[dG.END=35]="END",dG[dG.HOME=36]="HOME",dG[dG.LEFT=37]="LEFT",dG[dG.UP=38]="UP",dG[dG.RIGHT=39]="RIGHT",dG[dG.DOWN=40]="DOWN",dG[dG.PLUS_SIGN=43]="PLUS_SIGN",dG[dG.PRINT_SCREEN=44]="PRINT_SCREEN",dG[dG.INSERT=45]="INSERT",dG[dG.DELETE=46]="DELETE",dG[dG.ZERO=48]="ZERO",dG[dG.ONE=49]="ONE",dG[dG.TWO=50]="TWO",dG[dG.THREE=51]="THREE",dG[dG.FOUR=52]="FOUR",dG[dG.FIVE=53]="FIVE",dG[dG.SIX=54]="SIX",dG[dG.SEVEN=55]="SEVEN",dG[dG.EIGHT=56]="EIGHT",dG[dG.NINE=57]="NINE",dG[dG.FF_SEMICOLON=59]="FF_SEMICOLON",dG[dG.FF_EQUALS=61]="FF_EQUALS",dG[dG.FF_DASH=173]="FF_DASH",dG[dG.FF_HASH=163]="FF_HASH",dG[dG.QUESTION_MARK=63]="QUESTION_MARK",dG[dG.AT_SIGN=64]="AT_SIGN",dG[dG.A=65]="A",dG[dG.B=66]="B",dG[dG.C=67]="C",dG[dG.D=68]="D",dG[dG.E=69]="E",dG[dG.F=70]="F",dG[dG.G=71]="G",dG[dG.H=72]="H",dG[dG.I=73]="I",dG[dG.J=74]="J",dG[dG.K=75]="K",dG[dG.L=76]="L",dG[dG.M=77]="M",dG[dG.N=78]="N",dG[dG.O=79]="O",dG[dG.P=80]="P",dG[dG.Q=81]="Q",dG[dG.R=82]="R",dG[dG.S=83]="S",dG[dG.T=84]="T",dG[dG.U=85]="U",dG[dG.V=86]="V",dG[dG.W=87]="W",dG[dG.X=88]="X",dG[dG.Y=89]="Y",dG[dG.Z=90]="Z",dG[dG.META=91]="META",dG[dG.WIN_KEY_RIGHT=92]="WIN_KEY_RIGHT",dG[dG.CONTEXT_MENU=93]="CONTEXT_MENU",dG[dG.NUM_ZERO=96]="NUM_ZERO",dG[dG.NUM_ONE=97]="NUM_ONE",dG[dG.NUM_TWO=98]="NUM_TWO",dG[dG.NUM_THREE=99]="NUM_THREE",dG[dG.NUM_FOUR=100]="NUM_FOUR",dG[dG.NUM_FIVE=101]="NUM_FIVE",dG[dG.NUM_SIX=102]="NUM_SIX",dG[dG.NUM_SEVEN=103]="NUM_SEVEN",dG[dG.NUM_EIGHT=104]="NUM_EIGHT",dG[dG.NUM_NINE=105]="NUM_NINE",dG[dG.NUM_MULTIPLY=106]="NUM_MULTIPLY",dG[dG.NUM_PLUS=107]="NUM_PLUS",dG[dG.NUM_MINUS=109]="NUM_MINUS",dG[dG.NUM_PERIOD=110]="NUM_PERIOD",dG[dG.NUM_DIVISION=111]="NUM_DIVISION",dG[dG.F1=112]="F1",dG[dG.F2=113]="F2",dG[dG.F3=114]="F3",dG[dG.F4=115]="F4",dG[dG.F5=116]="F5",dG[dG.F6=117]="F6",dG[dG.F7=118]="F7",dG[dG.F8=119]="F8",dG[dG.F9=120]="F9",dG[dG.F10=121]="F10",dG[dG.F11=122]="F11",dG[dG.F12=123]="F12",dG[dG.NUMLOCK=144]="NUMLOCK",dG[dG.SCROLL_LOCK=145]="SCROLL_LOCK",dG[dG.FIRST_MEDIA_KEY=166]="FIRST_MEDIA_KEY",dG[dG.LAST_MEDIA_KEY=183]="LAST_MEDIA_KEY",dG[dG.SEMICOLON=186]="SEMICOLON",dG[dG.DASH=189]="DASH",dG[dG.EQUALS=187]="EQUALS",dG[dG.COMMA=188]="COMMA",dG[dG.PERIOD=190]="PERIOD",dG[dG.SLASH=191]="SLASH",dG[dG.APOSTROPHE=192]="APOSTROPHE",dG[dG.TILDE=192]="TILDE",dG[dG.SINGLE_QUOTE=222]="SINGLE_QUOTE",dG[dG.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET",dG[dG.BACKSLASH=220]="BACKSLASH",dG[dG.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET",dG[dG.WIN_KEY=224]="WIN_KEY",dG[dG.MAC_FF_META=224]="MAC_FF_META",dG[dG.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT",dG[dG.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT",dG[dG.WIN_IME=229]="WIN_IME",dG[dG.VK_NONAME=252]="VK_NONAME",dG[dG.PHANTOM=255]="PHANTOM";var hn={};hn.arc=sz,hn.curve=sU,hn.line=sX,hn.lineOnAxis=sY,hn.lineTo=sK,hn.moveBy=sV,hn.moveTo=sW,hn.point=sH;var hr={};hr.Coordinate=lt,hr.KeyCodes=dK,hr.Rect=lo,hr.Size=ls,hr.Svg=li,hr.aria=lV,hr.array=r3,hr.browserEvents=Y,hr.colour=ch,hr.deprecation=ac,hr.dom=rB,hr.extensions=hs,hr.idGenerator=q,hr.math=aA,hr.object=rU,hr.parsing=cu,hr.string=aQ,hr.style=lr,hr.svgMath=lc,hr.svgPaths=hn,hr.toolbox=lO,hr.userAgent={ANDROID:rC,GECKO:rb,IPAD:rO,IPHONE:rA,JavaFx:W,MAC:V,MOBILE:rN,raw:rI},hr.xml=lm;var hl=class{constructor(e,t){if(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,e.id.includes("_connection"))throw Error(`Connection ID indicator is contained in block ID. This will cause problems with focus: ${e.id}.`);this.id=`${e.id}_connection_${ey()}`}connect_(e){let t,i,o=c5.INPUT_VALUE,s=this.getSourceBlock();var n=e.getSourceBlock();if(e.isConnected()&&e.disconnectInternal(!1),this.isConnected()){let e=this.stashShadowState(),i=this.targetBlock();i.isShadow()?i.dispose(!1):(this.disconnectInternal(),t=i),this.applyShadowState(e)}eX()&&(i=new(ej(rL.BLOCK_MOVE))(n)).setReason(["connect"]),sj(this,e),n.setParent(s),i&&(i.recordNew(),eH(i)),t&&(e=this.type===o?t.outputConnection:t.previousConnection)&&((n=hl.getConnectionForOrphanedConnection(n,e))?e.connect(n):e.onFailedConnect(this))}dispose(){if(this.isConnected()){this.isSuperior()&&this.setShadowStateInternal();let e=this.targetBlock();e&&!e.isDeadOrDying()&&e.unplug()}this.disposed=!0}getSourceBlock(){return this.sourceBlock_}isSuperior(){return this.type===c5.INPUT_VALUE||this.type===c5.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)){let t=$.getGroup$$module$build$src$core$events$utils();t||$.setGroup$$module$build$src$core$events$utils(!0),this.isSuperior()?this.connect_(e):e.connect_(this),$.setGroup$$module$build$src$core$events$utils(t)}return this.isConnected()}disconnect(){this.disconnectInternal()}disconnectInternal(e=!0){let t,{parentConnection:i,childConnection:o}=this.getParentAndChildConnections();if(!i||!o)throw Error("Source connection not connected.");let s=$.getGroup$$module$build$src$core$events$utils();s||$.setGroup$$module$build$src$core$events$utils(!0),eX()&&(t=new(ej(rL.BLOCK_MOVE))(o.getSourceBlock())).setReason(["disconnect"]);let n=this.targetConnection;n&&(n.targetConnection=null),this.targetConnection=null,e&&o.getSourceBlock().setParent(null),t&&(t.recordNew(),eH(t)),o.getSourceBlock().isShadow()||i.respawnShadow_(),$.setGroup$$module$build$src$core$events$utils(s)}getParentAndChildConnections(){return this.targetConnection?this.isSuperior()?{parentConnection:this,childConnection:this.targetConnection}:{parentConnection:this.targetConnection,childConnection:this}:{}}respawnShadow_(){this.createShadowBlock(!0)}reconnect(e,t){var i;return!this.getSourceBlock().isDeadOrDying()&&(t=null==(i=e.getInput(t))?void 0:i.connection,(!(i=this.targetBlock())||i===e)&&!!t&&t.targetConnection!==this&&(t.isConnected()&&t.disconnect(),t.connect(this),!0))}targetBlock(){if(this.isConnected()){let e,t;return null!=(t=null==(e=this.targetConnection)?void 0:e.getSourceBlock())?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()?sp(this.targetBlock()):this.shadowDom}setShadowState(e){this.setShadowStateInternal({shadowState:e})}getShadowState(e){return e&&this.targetBlock()&&this.targetBlock().isShadow()?ik(this.targetBlock()):this.shadowState}neighbours(e){return[]}getParentInput(){let e=null,t=this.sourceBlock_.inputList;for(let i=0;i<t.length;i++)if(t[i].connection===this){e=t[i];break}return e}toString(){let 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 i=0,o;o=e.inputList[i];i++)if(o.connection===this){t=o;break}if(!t)return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection";t='Input "'+t.name+'" connection on '}return t+e.toDevString()}stashShadowState(){let 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();let i=this.getShadowState(),o=this.getShadowDom();if(t.isDeadOrDying()||!i&&!o)return null;if(i)return iU(i,t.workspace,{parentConnection:e?this:void 0,isShadow:!0,recordUndo:!1});if(o){if(t=sT(o,t.workspace),e)if(this.type===c5.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===c5.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=sp(e),this.shadowState=ik(e))}static getConnectionForOrphanedConnection(e,t){if(t.type===c5.OUTPUT_VALUE)return sZ(e,t.getSourceBlock());e=e.lastConnectionInStack(!0);let i=t.getConnectionChecker();return e&&i.canConnect(t,e,!1)?e:null}};hl.CAN_CONNECT=0,hl.REASON_SELF_CONNECTION=1,hl.REASON_WRONG_TYPE=2,hl.REASON_TARGET_NULL=3,hl.REASON_CHECKS_FAILED=4,hl.REASON_DIFFERENT_WORKSPACES=5,hl.REASON_SHADOW_PARENT=6,hl.REASON_DRAG_CHECKS_FAILED=7,hl.REASON_PREVIOUS_AND_OUTPUT=8;var ha=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}},hc={};hc.DuplicateIconType=ha,(dH=$.Align$$module$build$src$core$inputs$align||($.Align$$module$build$src$core$inputs$align={}))[dH.LEFT=-1]="LEFT",dH[dH.CENTRE=0]="CENTRE",dH[dH.RIGHT=1]="RIGHT",$.Align$$module$build$src$core$inputs$align;var hh=class extends cd{constructor(e,t,i){super(cd.SKIP_SETUP),this.class=null,this.EDITABLE=!1,this.maxDisplayLength=1/0,e!==cd.SKIP_SETUP&&(i?this.configure_(i):this.class=t||null,this.setValue(e))}configure_(e){super.configure_(e),e.class&&(this.class=e.class)}initView(){this.createTextElement_(),this.class&&eq(this.getTextElement(),this.class),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyLabelField")}doClassValidation_(e){return null==e?null:`${e}`}setClass(e){this.textElement_&&(this.class&&e0(this.textElement_,this.class),e&&eq(this.textElement_,e)),this.class=e}static fromJson(e){return new this(oY(e.text),void 0,e)}};sy("field_label",hh),hh.prototype.DEFAULT_VALUE="";var hu=[];hu[c5.INPUT_VALUE]=c5.OUTPUT_VALUE,hu[c5.OUTPUT_VALUE]=c5.INPUT_VALUE,hu[c5.NEXT_STATEMENT]=c5.PREVIOUS_STATEMENT,hu[c5.PREVIOUS_STATEMENT]=c5.NEXT_STATEMENT;var hd="RENAME_VARIABLE_ID",hp="DELETE_VARIABLE_ID",h_=class extends hl{constructor(e,t){super(e,t),this.highlighted=!1,this.targetConnection=null,this.db=e.workspace.connectionDBList[t],this.dbOpposite=e.workspace.connectionDBList[hu[t]],this.offsetInBlock=new lt(0,0),this.trackedState=h_.TrackedState.WILL_TRACK}dispose(){let e,t;super.dispose(),this.trackedState===h_.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),null==(t=(e=this.sourceBlock_.pathObject).removeConnectionHighlight)||t.call(e,this)}getSourceBlock(){return super.getSourceBlock()}targetBlock(){return super.targetBlock()}distanceFrom(e){let t=this.x-e.x;return Math.sqrt(t*t+(e=this.y-e.y)*e)}bumpAwayFrom(e,t=!1){if(!this.sourceBlock_.workspace.isDragging()){var i=$.config$$module$build$src$core$config.snapRadius+Math.floor(10*Math.random()),o=$.config$$module$build$src$core$config.snapRadius+Math.floor(10*Math.random()),s=e.sourceBlock_.getRootBlock(),n=this.sourceBlock_.getRootBlock();if(!s.isInFlyout&&!n.isInFlyout){var r=!0;if(n.isMovable())s.isMovable()&&t&&(o=-o);else{if(!s.isMovable())return;r=!1,i=-i,o=-o}t=r?e:this,e=r?this:e,(s=r?n:s).RTL&&(i=-i),s.moveBy(t.x+i-e.x,t.y+o-e.y,["bump"])}}}moveTo(e,t){let i=!1;return this.trackedState===h_.TrackedState.WILL_TRACK?(this.db.addConnection(this,t),this.trackedState=h_.TrackedState.TRACKED,i=!0):this.trackedState===h_.TrackedState.TRACKED&&(this.db.removeConnection(this,this.y),this.db.addConnection(this,t),i=!0),this.x=e,this.y=t,i}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;let t=this.targetBlock();e&&t&&(e=lt.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;let e=this.findHighlightSvg();e&&(e.style.display="")}unhighlight(){this.highlighted=!1;let e=this.findHighlightSvg();e&&(e.style.display="none")}isHighlighted(){return this.highlighted}setTracking(e){e&&this.trackedState===h_.TrackedState.TRACKED||!e&&this.trackedState===h_.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db.addConnection(this,this.y),this.trackedState=h_.TrackedState.TRACKED):(this.trackedState===h_.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),this.trackedState=h_.TrackedState.UNTRACKED))}stopTrackingAll(){if(this.setTracking(!1),this.targetConnection){let e=this.targetBlock().getDescendants(!1);for(let t=0;t<e.length;t++){let i=e[t],o=i.getConnections_(!0);for(let e=0;e<o.length;e++)o[e].setTracking(!1);for(let e of i.getIcons())i1(e)&&e.setBubbleVisible(!1)}}}startTrackingAll(){this.setTracking(!0);let e=[];if(this.type!==c5.INPUT_VALUE&&this.type!==c5.NEXT_STATEMENT)return e;let t=this.targetBlock();if(t){let i;t.isCollapsed()?(i=[],t.outputConnection&&i.push(t.outputConnection),t.nextConnection&&i.push(t.nextConnection),t.previousConnection&&i.push(t.previousConnection)):i=t.getConnections_(!0);for(let t=0;t<i.length;t++)e.push(...i[t].startTrackingAll());e.length||(e=[t])}return e}onFailedConnect(e){let t=this.getSourceBlock();if(eG()){let i=$.getGroup$$module$build$src$core$events$utils();setTimeout((function(){t.isDisposed()||t.getParent()||($.setGroup$$module$build$src$core$events$utils(i),this.bumpAwayFrom(e),$.setGroup$$module$build$src$core$events$utils(!1))}).bind(this),$.config$$module$build$src$core$config.bumpDelay)}}disconnectInternal(e=!0){let{parentConnection:t,childConnection:i}=this.getParentAndChildConnections();if(t&&i){var o=$.getGroup$$module$build$src$core$events$utils();o||$.setGroup$$module$build$src$core$events$utils(!0);var s=t.getSourceBlock(),n=i.getSourceBlock();super.disconnectInternal(e),s.queueRender(),n.updateDisabled(),n.queueRender(),n.getSvgRoot().style.display="block",$.setGroup$$module$build$src$core$events$utils(o)}}respawnShadow_(){super.respawnShadow_();let 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(),(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}showContextMenu(e){let t=cN.registry.getContextMenuOptions({focusedNode:this},e);if(t.length){var i=this.getSourceBlock(),o=i.workspace;if(e instanceof PointerEvent)var s=new lt(e.clientX,e.clientY);else s=tv(o,s=new lt(this.x,this.y)).translate(i.RTL?-5:5,5);o9(e,t,i.RTL,o,s)}}getFocusableElement(){let e=this.findHighlightSvg();if(e)return e;throw Error("No highlight SVG found corresponding to this connection.")}getFocusableTree(){return this.getSourceBlock().workspace}onNodeFocus(){this.highlight()}onNodeBlur(){this.unhighlight()}canBeFocused(){return!0}findHighlightSvg(){return document.getElementById(this.id)}};(dU=(dU=h_||(h_={})).TrackedState||(dU.TrackedState={}))[dU.WILL_TRACK=-1]="WILL_TRACK",dU[dU.UNTRACKED=0]="UNTRACKED",dU[dU.TRACKED=1]="TRACKED";var hg=h_.TrackedState,hE={};hE.RenderedConnection=h_,hE.TrackedState=hg;var hT=class{constructor(e,t){this.name=e,this.sourceBlock=t,this.fieldRow=[],this.align=$.Align$$module$build$src$core$inputs$align.LEFT,this.visible=!0,this.type=$.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,i){if(e<0||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return(t||""===t&&i)&&("string"==typeof t&&(t=$.fromJson$$module$build$src$core$field_registry({type:"field_label",text:t})),t.setSourceBlock(this.sourceBlock),this.sourceBlock.initialized&&this.initField(t),t.name=i,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 t=0,i;i=this.fieldRow[t];t++)if(i.name===e)return i.dispose(),this.fieldRow.splice(t,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 t=0,i;i=this.fieldRow[t];t++)i.setVisible(e);if(this.connection&&this.connection instanceof h_){e?t=this.connection.startTrackingAll():this.connection.stopTrackingAll();let i=this.connection.targetBlock();i&&(i.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(let e of this.fieldRow)e.init()}initModel(){for(let 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)}},hm=class extends hT{constructor(e,t){super(e,t),this.name=e,this.type=$.inputTypes$$module$build$src$core$inputs$input_types.DUMMY}},hf=class extends hT{constructor(e,t){super(e,t),this.name=e,this.type=$.inputTypes$$module$build$src$core$inputs$input_types.END_ROW}},hI=class extends hT{constructor(e,t){if(!e)throw Error("Statement inputs must have a non-empty name");super(e,t),this.name=e,this.type=$.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT,this.connection=this.makeConnection(c5.NEXT_STATEMENT)}};$.ValueInput$$module$build$src$core$inputs$value_input=class extends hT{constructor(e,t){if(!e)throw Error("Value inputs must have a non-empty name");super(e,t),this.name=e,this.type=$.inputTypes$$module$build$src$core$inputs$input_types.VALUE,this.connection=this.makeConnection(c5.INPUT_VALUE)}},$.ValueInput$$module$build$src$core$inputs$value_input;var hS=class{constructor(e,t,i){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=i&&!e.getBlockById(i)?i:eD(),e.setBlockById(this.id,this),this.xy=new lt(0,0),this.isInFlyout=e.isFlyout,this.isInMutator=e.isMutator,this.RTL=e.RTL,t){if(this.type=t,!(i=w[t])||"object"!=typeof i)throw TypeError("Invalid block definition for type: "+t);Object.assign(this,i)}e.addTopBlock(this),e.addTypedBlock(this),new.target===hS&&this.doInit_()}doInit_(){let e=$.getGroup$$module$build$src$core$events$utils();e||$.setGroup$$module$build$src$core$events$utils(!0);let t=eG();try{"function"==typeof this.init&&($.setRecordUndo$$module$build$src$core$events$utils(!1),this.init(),$.setRecordUndo$$module$build$src$core$events$utils(t)),eX()&&eH(new(ej(rL.BLOCK_CREATE))(this))}finally{$.setGroup$$module$build$src$core$events$utils(e),$.setRecordUndo$$module$build$src$core$events$utils(t)}this.inputsInlineDefault=this.inputsInline,"function"==typeof this.onchange&&this.setOnChange(this.onchange)}dispose(e=!1){this.disposing=!0,this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.unplug(e),eX()&&eH(new(ej(rL.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),"function"==typeof this.destroy&&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(let 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,i;(null==(i=this.outputConnection)?0:i.isConnected())&&(t=this.outputConnection.targetConnection,this.outputConnection.disconnect()),t&&e&&(e=this.getOnlyValueConnection())&&e.isConnected()&&!e.targetBlock().isShadow()&&(null==(e=e.targetConnection)||e.disconnect(),this.workspace.connectionChecker.canConnect(e,t,!1)?t.connect(e):null==e||e.onFailedConnect(t))}getOnlyValueConnection(){let e=null;for(let t=0;t<this.inputList.length;t++){let i=this.inputList[t].connection;if(i&&i.type===c5.INPUT_VALUE&&i.targetConnection){if(e)return null;e=i}}return e}unplugFromStack(e){var t;let i=null;if((null==(t=this.previousConnection)?0:t.isConnected())&&(i=this.previousConnection.targetConnection,this.previousConnection.disconnect()),t=this.getNextBlock(),e&&t&&!t.isShadow()){let t,o;null==(e=null!=(o=null==(t=this.nextConnection)?void 0:t.targetConnection)?o:null)||e.disconnect(),i&&this.workspace.connectionChecker.canConnect(i,e,!1)&&i.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,i;i=this.inputList[t];t++)i.connection&&e.push(i.connection);return e}lastConnectionInStack(e){let t=this.nextConnection;for(;t;){let i=t.targetBlock();if(!i||e&&i.isShadow())return t;t=i.nextConnection}return null}bumpNeighbours(){}getParent(){return this.parentBlock_}getInputWithBlock(e){for(let t=0,i;i=this.inputList[t];t++)if(i.connection&&i.connection.targetBlock()===e)return i;return null}getSurroundParent(){let e=this,t;do if(t=e,!(e=e.getParent()))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 t=(e=t).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 i=0,o;o=this.inputList[i];i++)if(o.connection){var t=o.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(),i=!!t;if(i&&e&&t!==e)throw Error("Block connected to superior one that is not new parent.");if(!i&&e)throw Error("Block not connected to new parent.");if(i&&!e)throw Error("Cannot set parent to null while block is still connected to superior block.");this.parentBlock_?tm(this.parentBlock_.childBlocks_,this):this.workspace.removeTopBlock(this),(this.parentBlock_=e)?e.childBlocks_.push(this):this.workspace.addTopBlock(this)}}getDescendants(e){let t=[this],i=this.getChildren(e);for(let o,s=0;o=i[s];s++)t.push(...o.getDescendants(e));return t}isDeletable(){return this.deletable&&!this.isInFlyout&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()}isOwnDeletable(){return this.deletable}setDeletable(e){this.deletable=e}isMovable(){return this.movable&&!this.isInFlyout&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()}isOwnMovable(){return this.movable}setMovable(e){this.movable=e}isDuplicatable(){return!this.workspace.hasBlockLimits()||this.workspace.isCapacityAvailable(t_(this,!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.isReadOnly()}isOwnEditable(){return this.editable}setEditable(e){for(let t of(this.editable=e,this.getFields()))t.updateEditable()}isDisposed(){return this.disposed}isSimpleReporter(){if(!this.outputConnection)return!1;for(let e of this.inputList)if(e.connection||e.fieldRow.length>1)return!1;return!0}getMatchingConnection(e,t){let i=this.getConnections_(!0);if(e=e.getConnections_(!0),i.length!==e.length)throw Error("Connection lists did not match in length.");for(let o=0;o<e.length;o++)if(e[o]===t)return i[o];return null}setHelpUrl(e){this.helpUrl=e}setTooltip(e){this.tooltip=e}getTooltip(){return oS(this)}getColour(){return this.colour_}getStyleName(){return this.styleName_}getHue(){return this.hue}setColour(e){e=oz(e),this.hue=e.hue,this.colour_=e.hex}setStyle(e){this.styleName_=e}setOnChange(e){if(e&&"function"!=typeof e)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("string"!=typeof e)throw TypeError("Block.prototype.getField expects a string with the field name but received "+(void 0===e?"nothing":e+" of type "+typeof e)+" instead");for(let t of this.getFields())if(t.name===e)return t;return null}*getFields(){for(let e of this.inputList)for(let t of e.fieldRow)yield t}getVars(){let e=[];for(let t of this.getFields())t.referencesVariables()&&e.push(t.getValue());return e}getVarModels(){let e=[];for(let t of this.getFields())if(t.referencesVariables()){let i=this.workspace.getVariableById(t.getValue());i&&e.push(i)}return e}updateVarName(e){for(let t of this.getFields())t.referencesVariables()&&e.getId()===t.getValue()&&t.refreshVariableName()}renameVarById(e,t){for(let i of this.getFields())i.referencesVariables()&&e===i.getValue()&&i.setValue(t)}getFieldValue(e){return(e=this.getField(e))?e.getValue():null}setFieldValue(e,t){let i=this.getField(t);if(!i)throw Error('Field "'+t+'" not found.');i.setValue(e)}setPreviousStatement(e,t){if(e)void 0===t&&(t=null),this.previousConnection||(this.previousConnection=this.makeConnection_(c5.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)void 0===t&&(t=null),this.nextConnection||(this.nextConnection=this.makeConnection_(c5.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)void 0===t&&(t=null),this.outputConnection||(this.outputConnection=this.makeConnection_(c5.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&&(eH(new(ej(rL.BLOCK_CHANGE))(this,"inline",null,this.inputsInline,e)),this.inputsInline=e)}getInputsInline(){if(void 0!==this.inputsInline)return this.inputsInline;for(var e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof hm&&this.inputList[e]instanceof hm)return!1;for(e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof $.ValueInput$$module$build$src$core$inputs$value_input&&this.inputList[e]instanceof hm)return!0;for(e=0;e<this.inputList.length;e++)if(this.inputList[e]instanceof hf)return!0;return!1}setOutputShape(e){this.outputShape_=e}getOutputShape(){return this.outputShape_}isEnabled(){return 0===this.disabledReasons.size}setDisabledReason(e,t){e||this.workspace.options.disable||!this.hasDisabledReason(lJ)||t==lJ||this.setDisabledReason(!1,lJ),this.disabledReasons.has(t)!==e&&(e?this.disabledReasons.add(t):this.disabledReasons.delete(t),(e=new(ej(rL.BLOCK_CHANGE))(this,"disabled",null,!e,e)).setDisabledReason(t),eH(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&&(eH(new(ej(rL.BLOCK_CHANGE))(this,"collapsed",null,this.collapsed_,e)),this.collapsed_=e)}toString(e,t){t=this.toTokens(t);for(let e=2;e<t.length;e++)"("===t[e-2]&&")"===t[e]&&(t[e-2]=t[e-1],t.splice(e-1,2));let i="";return t=(t=t.reduce((e,t)=>(e=e+("("===i||")"===t?"":" ")+t,i=t[t.length-1],e),"")).trim()||"???",e&&t.length>e&&(t=t.substring(0,e-3)+"..."),t}toTokens(e="?"){let t=[];for(let o of this.inputList)if(o.name!=lz){for(let e of o.fieldRow)t.push(e.getText());if(o.connection){let s=o.connection.targetBlock();if(s){var i=o.connection;let n=i.getCheck();!n&&i.targetConnection&&(n=i.targetConnection.getCheck()),(i=!!n&&(n.includes("Boolean")||n.includes("Number")))&&t.push("("),t.push(...s.toTokens(e)),i&&t.push(")")}else t.push(e)}}return t}appendValueInput(e){return this.appendInput(new $.ValueInput$$module$build$src$core$inputs$value_input(e,this))}appendStatementInput(e){return this.statementInputCount++,this.appendInput(new hI(e,this))}appendDummyInput(e=""){return this.appendInput(new hm(e,this))}appendEndRowInput(e=""){return this.appendInput(new hf(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=ep(D.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 i=0;e["args"+i];){if(void 0===e["message"+i])throw Error(t+`args${i} must have a corresponding message (message${i}).`);i++}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),i=0;void 0!==e["message"+i];)this.interpolate(e["message"+i],e["args"+i]||[],e["implicitAlign"+i]||e["lastDummyAlign"+i],t),i++;if(void 0!==e.inputsInline&&($.disable$$module$build$src$core$events$utils(),this.setInputsInline(e.inputsInline),$.enable$$module$build$src$core$events$utils()),void 0!==e.output&&this.setOutput(!0,e.output),void 0!==e.outputShape&&this.setOutputShape(e.outputShape),void 0!==e.previousStatement&&this.setPreviousStatement(!0,e.previousStatement),void 0!==e.nextStatement&&this.setNextStatement(!0,e.nextStatement),void 0!==e.tooltip&&(i=oY(e.tooltip),this.setTooltip(i)),void 0!==e.enableContextMenu&&(this.contextMenu=!!e.enableContextMenu),void 0!==e.suppressPrefixSuffix&&(this.suppressPrefixSuffix=!!e.suppressPrefixSuffix),void 0!==e.helpUrl&&(i=oY(e.helpUrl),this.setHelpUrl(i)),"string"==typeof e.extensions&&(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]),void 0!==e.mutator&&sw(e.mutator,this,!0),Array.isArray(e=e.extensions))for(t=0;t<e.length;t++)sw(e[t],this,!1)}jsonInitColour(e,t){if("colour"in e)if(void 0===e.colour)console.warn(t+"Undefined colour value.");else{e=e.colour;try{this.setColour(e)}catch(i){console.warn(t+"Illegal colour value: ",e)}}}jsonInitStyle(e,t){e=e.style;try{this.setStyle(e)}catch(i){console.warn(t+"Style does not exist: ",e)}}mixin(e,t){if(void 0!==t&&"boolean"!=typeof t)throw Error("opt_disableCheck must be a boolean if provided");if(!t){for(let i in t=[],e)void 0!==this[i]&&t.push(i);if(t.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(t))}Object.assign(this,e)}interpolate(e,t,i,o){e=oX(e),this.validateTokens(e,t.length),t=this.interpolateArguments(e,t,i),i=[];for(let s=0,n;n=t[s];s++)if(this.isInputKeyword(n.type)){if(e=this.inputFromJson(n,o)){for(let t=0,o;o=i[t];t++)e.appendField(o[0],o[1]);i.length=0}}else(e=this.fieldFromJson(n))&&i.push([e,n.name])}validateTokens(e,t){let i=[],o=0;for(let s=0;s<e.length;s++){let n=e[s];if("number"==typeof n){if(n<1||n>t)throw Error('Block "'+this.type+'": Message index %'+n+" out of range.");if(i[n])throw Error('Block "'+this.type+'": Message index %'+n+" duplicated.");i[n]=!0,o++}}if(o!==t)throw Error('Block "'+this.type+'": Message does not reference all '+t+" arg(s).")}interpolateArguments(e,t,i){let o=[];for(let n=0;n<e.length;n++){var s=e[n];if("number"==typeof s&&(s=t[s-1]),"string"==typeof s){if("\n"===s)s={type:"input_end_row"},i&&(s.align=i);else if(!(s=this.stringToFieldJson(s)))continue}o.push(s)}return(e=o.length)&&!this.isInputKeyword(o[e-1].type)&&(e={type:"input_dummy"},i&&(e.align=i),o.push(e)),o}fieldFromJson(e){let t=$.fromJson$$module$build$src$core$field_registry(e);return!t&&e.alt?"string"==typeof e.alt?(e=this.stringToFieldJson(e.alt))?this.fieldFromJson(e):null:this.fieldFromJson(e.alt):t}inputFromJson(e,t){let i;var o={LEFT:$.Align$$module$build$src$core$inputs$align.LEFT,RIGHT:$.Align$$module$build$src$core$inputs$align.RIGHT,CENTRE:$.Align$$module$build$src$core$inputs$align.CENTRE,CENTER:$.Align$$module$build$src$core$inputs$align.CENTRE};switch(e.type){case"input_value":i=this.appendValueInput(e.name);break;case"input_statement":i=this.appendStatementInput(e.name);break;case"input_dummy":i=this.appendDummyInput(e.name);break;case"input_end_row":i=this.appendEndRowInput(e.name);break;default:i=this.appendInputFromRegistry(e.type,e.name)}return i?(e.check&&i.setCheck(e.check),e.align&&(void 0===(o=o[e.align.toUpperCase()])?console.warn(t+"Illegal align value: ",e.align):i.setAlign(o)),i):null}isInputKeyword(e){return"input_value"===e||"input_statement"===e||"input_dummy"===e||"input_end_row"===e||ed(D.INPUT,e)}stringToFieldJson(e){return(e=e.trim())?{type:"field_label",text:e}:null}moveInputBefore(e,t){if(e!==t){var i=-1,o=t?-1:this.inputList.length;for(let s=0,n;n=this.inputList[s];s++)if(n.name===e){if(i=s,-1!==o)break}else if(t&&n.name===t&&(o=s,-1!==i))break;if(-1===i)throw Error('Named input "'+e+'" not found.');if(-1===o)throw Error('Reference input "'+t+'" not found.');this.moveNumberedInputBefore(i,o)}}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.");let i=this.inputList[e];this.inputList.splice(e,1),e<t&&t--,this.inputList.splice(t,0,i)}removeInput(e,t){for(let t=0,i;i=this.inputList[t];t++)if(i.name===e)return i instanceof hI&&this.statementInputCount--,i.dispose(),this.inputList.splice(t,1),!0;if(t)return!1;throw Error("Input not found: "+e)}getInput(e){for(let t=0,i;i=this.inputList[t];t++)if(i.name===e)return i;return null}getInputTargetBlock(e){return(e=this.getInput(e))&&e.connection&&e.connection.targetBlock()}getCommentText(){let e,t;return null!=(t=null==(e=this.getIcon(ab.COMMENT))?void 0:e.getText())?t:null}setCommentText(e){var t,i;let o,s=null!=(o=null==(t=this.getIcon(ab.COMMENT))?void 0:t.getText())?o:null;if(s!==e){if(null!==e){if(!(t=this.getIcon(ab.COMMENT))){if(!(t=ep(D.ICON,ab.COMMENT.toString(),!1)))throw Error("No comment icon class is registered, so a comment cannot be set");if(!(sq(i=t=new t(this))&&i1(i)&&t3(i)&&"function"==typeof i.setText&&"function"==typeof i.getText&&"function"==typeof i.setBubbleSize&&"function"==typeof i.getBubbleSize&&"function"==typeof i.setBubbleLocation&&"function"==typeof i.getBubbleLocation&&i.getType()===ab.COMMENT))throw Error("The class registered as a comment icon does not conform to the ICommentIcon interface");t=this.addIcon(t)}$.disable$$module$build$src$core$events$utils(),t.setText(e),$.enable$$module$build$src$core$events$utils()}else this.removeIcon(ab.COMMENT);eH(new(ej(rL.BLOCK_CHANGE))(this,"comment",null,s,e))}}setWarningText(e,t){}setMutator(e){}addIcon(e){if(this.hasIcon(e.getType()))throw new ha(e);return this.icons.push(e),this.icons.sort((e,t)=>e.getWeight()-t.getWeight()),e}removeIcon(e){let t;return!!this.hasIcon(e)&&(null==(t=this.getIcon(e))||t.dispose(),this.icons=this.icons.filter(t=>!t.getType().equals(e)),!0)}hasIcon(e){return this.icons.some(t=>t.getType().equals(e))}getIcon(e){return e instanceof ab?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,i){if(this.parentBlock_)throw Error("Block has parent");let o=new(ej(rL.BLOCK_MOVE))(this);i&&o.setReason(i),this.xy.translate(e,t),o.recordNew(),eH(o)}makeConnection_(e){return new hl(this,e)}allInputsFilled(e){if(void 0===e&&(e=!0),!e&&this.isShadow())return!1;for(let i=0,o;o=this.inputList[i];i++)if(o.connection){var t=o.connection.targetBlock();if(!t||!t.allInputsFilled(e))return!1}return!(t=this.getNextBlock())||t.allInputsFilled(e)}toDevString(){let e=this.type?'"'+this.type+'" block':"Block";return this.id&&(e+=' (id="'+this.id+'")'),e}};hS.COLLAPSED_INPUT_NAME=lz,hS.COLLAPSED_FIELD_NAME=lj;var hR=null,hb=null,hC={};hC.connectionUiEffect=s1,hC.disconnectUiEffect=s2,hC.disconnectUiStop=s5,hC.disposeUiEffect=sQ;var hO=class{paste(e,t,i){let o;if(!t.isCapacityAvailable(e.typeCounts))return null;i&&(e.blockState.x=i.x,e.blockState.y=i.y),i=i||new lt(e.blockState.x||0,e.blockState.y||0),$.disable$$module$build$src$core$events$utils();try{o=iH(e.blockState,t),s6(o,i)}finally{$.enable$$module$build$src$core$events$utils()}if(!o)return o;eX()&&!o.isShadow()&&eH(new(ej(rL.BLOCK_CREATE))(o));let s=o;return t6().then(()=>$.getFocusManager$$module$build$src$core$focus_manager().focusNode(s)),o}};hO.TYPE="block",tq(hO.TYPE,new hO);var hA={};hA.BlockPaster=hO,hA.moveBlockToNotConflict=s6;var h$={};h$.bumpIntoBounds=s9,h$.bumpIntoBoundsHandler=s7,h$.bumpTopObjectsIntoBounds=nt;var hN=class{constructor(e){this.block=e,this.connectionPreviewer=this.connectionCandidate=this.startLoc=this.startChildConn=this.startParentConn=null,this.dragging=!1,this.dragOffset=new lt(0,0),this.originalEventGroup="",this.workspace=e.workspace}isMovable(){if(this.block.isShadow()){let e,t;return null!=(t=null==(e=this.block.getParent())?void 0:e.isMovable())&&t}return this.block.isOwnMovable()&&!this.block.isDeadOrDying()&&!this.workspace.isReadOnly()&&!this.block.isInFlyout}startDrag(e){if(this.block.isShadow())this.startDraggingShadow(e);else{var t;this.dragging=!0,this.fireDragStartEvent(),this.startLoc=this.block.getRelativeToSurfaceXY(),this.connectionCandidate=null,this.connectionPreviewer=new(eE(D.CONNECTION_PREVIEWER,this.workspace.options))(this.block),e6(),this.workspace.setResizesEnabled(!1),s5(),e=this.shouldHealStack(e),this.shouldDisconnect(e)&&this.disconnectBlock(e),this.block.setDragging(!0),null==(t=this.workspace.getLayerManager())||t.moveToDragLayer(this.block)}}shouldHealStack(e){return!!e&&(e.altKey||e.ctrlKey||e.metaKey)}startDraggingShadow(e){let 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=lt.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,i,o;if(this.startParentConn=null!=(o=null==(t=this.block.outputConnection)?void 0:t.targetConnection)?o:null==(i=this.block.previousConnection)?void 0:i.targetConnection,e){let e;this.startChildConn=null==(e=this.block.nextConnection)?void 0:e.targetConnection}this.block.unplug(e),s2(this.block)}fireDragStartEvent(){eH(new(ej(rL.BLOCK_DRAG))(this.block,!0,this.block.getDescendants(!1)))}fireDragEndEvent(){eH(new(ej(rL.BLOCK_DRAG))(this.block,!1,this.block.getDescendants(!1)))}fireMoveEvent(){if(!this.block.isDeadOrDying()){var e=new(ej(rL.BLOCK_MOVE))(this.block);e.setReason(["drag"]),e.oldCoordinate=this.startLoc,e.recordNew(),eH(e)}}drag(e){if(this.block.isShadow()){let t;null==(t=this.block.getParent())||t.drag(lt.sum(e,this.dragOffset))}else this.block.moveDuringDrag(e),this.updateConnectionPreview(this.block,lt.difference(e,this.startLoc))}updateConnectionPreview(e,t){var i=this.connectionCandidate;let o=this.getConnectionCandidate(e,t);if(o){this.connectionCandidate=t=i&&this.currCandidateIsBetter(i,t,o)?i:o;var s,n,{local:r,neighbour:l}=t;if(t=r.type===c5.OUTPUT_VALUE||r.type===c5.PREVIOUS_STATEMENT,i=l.isConnected()&&!(null==(s=l.targetBlock())?0:s.isInsertionMarker()),t&&i&&!this.orphanCanConnectAtEnd(e,l.targetBlock(),r.type)){let e;null==(e=this.connectionPreviewer)||e.previewReplacement(r,l,l.targetBlock())}else null==(n=this.connectionPreviewer)||n.previewConnection(r,l)}else{let e;null==(e=this.connectionPreviewer)||e.hidePreview(),this.connectionCandidate=null}}orphanCanConnectAtEnd(e,t,i){return!!hl.getConnectionForOrphanedConnection(e,i===c5.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}currCandidateIsBetter(e,t,i){let{local:o,neighbour:s}=e;e=new lt(o.x,o.y);let n=new lt(s.x,s.y);return t=lt.distance(lt.sum(e,t),n),i.distance>t-$.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(e,t){e=this.getLocalConnections(e);let i=this.getSearchRadius(),o=null;for(let s of e){let{connection:e,radius:n}=s.closest(i,t);e&&(o={local:s,neighbour:e,distance:n},i=n)}return o}getSearchRadius(){return this.connectionCandidate?$.config$$module$build$src$core$config.connectingSnapRadius:$.config$$module$build$src$core$config.snapRadius}getLocalConnections(e){let t=e.getConnections_(!1),i=e.lastConnectionInStack(!0);return i&&i!==e.nextConnection&&t.push(i),t}endDrag(e){if(this.block.isShadow()){let t;null==(t=this.block.getParent())||t.endDrag(e)}else{var t;if(this.originalEventGroup=$.getGroup$$module$build$src$core$events$utils(),this.fireDragEndEvent(),this.fireMoveEvent(),e4(),s5(),null==(t=this.connectionPreviewer)||t.hidePreview(),!this.block.isDeadOrDying()&&this.dragging){let e;null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.block,50),this.block.setDragging(!1)}this.connectionCandidate?(this.applyConnections(this.connectionCandidate),this.disposeStep()):this.block.queueRender().then(()=>this.disposeStep())}}disposeStep(){let e,t=$.getGroup$$module$build$src$core$events$utils();$.setGroup$$module$build$src$core$events$utils(this.originalEventGroup),this.block.snapToGrid(),null==(e=this.connectionPreviewer)||e.dispose(),this.workspace.setResizesEnabled(!0),$.setGroup$$module$build$src$core$events$utils(t)}applyConnections(e){let{local:t,neighbour:i}=e;t.connect(i);let o=t.isSuperior()?i:t,s=this.block.getRootBlock();t6().then(()=>{s1(o.getSourceBlock()),setTimeout(()=>{s.bringToFront()},0)})}revertDrag(){if(this.block.isShadow()){let e;null==(e=this.block.getParent())||e.revertDrag()}else{var e,t;if(null==(e=this.connectionPreviewer)||e.hidePreview(),this.connectionCandidate=null,null==(t=this.startChildConn)||t.connect(this.block.nextConnection),this.startParentConn)switch(this.startParentConn.type){case c5.INPUT_VALUE:this.startParentConn.connect(this.block.outputConnection);break;case c5.NEXT_STATEMENT:this.startParentConn.connect(this.block.previousConnection)}else{let e;this.block.moveTo(this.startLoc,["drag"]),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.block,50),s9(this.workspace,this.workspace.getMetricsManager().getScrollMetrics(!0),this.block)}this.startParentConn=this.startChildConn=null,this.block.setDragging(!1),this.dragging=!1}}},hL=class extends he{constructor(e,t,i,o){super(t,i,o),this.text=e,this.workspace=t,this.anchor=i,this.ownerRect=o,this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize(),eq(this.svgRoot,"blocklyTextBubble")}getText(){return this.text}setText(e){this.text=e,e2(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 eZ(li.G,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",transform:`translate(0,${he.BORDER_WIDTH})`,style:`direction: ${this.workspace.RTL?"rtl":"ltr"}`},e)}createTextFragments(e,t){let i=1;return t.split("\n").map(t=>{let o=eZ(li.TEXT,{y:`${i}em`,x:he.BORDER_WIDTH},e);return t=document.createTextNode(t),o.appendChild(t),i+=1,o})}rightAlignTextFragments(e,t){for(let i of t)i.setAttribute("text-anchor","start"),i.setAttribute("x",`${e+he.BORDER_WIDTH}`)}updateBubbleSize(){let e=this.paragraph.getBBox();this.setSize(new ls(e.width+2*he.BORDER_WIDTH,e.height+2*he.BORDER_WIDTH),!0)}},hy=class extends hi{constructor(e){super(e),this.sourceBlock=e,this.textMap=new Map,this.textBubble=null}getType(){return hy.TYPE}initView(e){this.svgRoot||(super.initView(e),eZ(li.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),eZ(li.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),eZ(li.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot),eq(this.svgRoot,"blocklyWarningIcon"))}dispose(){let e;super.dispose(),null==(e=this.textBubble)||e.dispose()}getWeight(){return hy.WEIGHT}getSize(){return new ls(17,17)}applyColour(){let e;super.applyColour(),null==(e=this.textBubble)||e.setColour(this.sourceBlock.getColour())}updateCollapsed(){}isShownWhenCollapsed(){return!0}onLocationChange(e){let t;super.onLocationChange(e),null==(t=this.textBubble)||t.setAnchorLocation(this.getAnchorLocation())}addMessage(e,t){let i;return this.textMap.get(t)===e||(e?this.textMap.set(t,e):this.textMap.delete(t),null==(i=this.textBubble)||i.setText(this.getText())),this}getText(){return[...this.textMap.values()].join("\n")}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.textBubble}setBubbleVisible(e){let t=this;return(0,rf.asyncExecutePromiseGeneratorFunction)(function*(){if(t.bubbleIsVisible()!==e){if(yield t6(),e)t.textBubble=new hL(t.getText(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour();else{let e;null==(e=t.textBubble)||e.dispose(),t.textBubble=null}eH(new(ej(rL.BUBBLE_OPEN))(t.sourceBlock,e,"warning"))}})}getBubble(){return this.textBubble}getAnchorLocation(){return lt.sum(this.workspaceLocation,new lt(8.5,8.5))}getBubbleOwnerRect(){let e=this.sourceBlock.getSvgRoot().getBBox();return new lo(e.y,e.y+e.height,e.x,e.x+e.width)}};hy.TYPE=ab.WARNING,hy.WEIGHT=2;var hD=class extends hS{constructor(e,t,i){if(super(e,t,i),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 lt(0,0),this.dragStrategy=new hN(this),!e.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=e,this.svgGroup=eZ(li.G,{}),t&&eq(this.svgGroup,t),this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup,this.style),(e=this.pathObject.svgPath).tooltip=this,oC(e),this.svgGroup.setAttribute("data-id",this.id),e.id=ey(),this.doInit_()}initSvg(){if(!this.initialized){for(var e of this.inputList)e.init();for(let e of this.getIcons())e.initView(this.createIconPointerDownListener(e)),e.updateEditable();this.applyColour(),this.pathObject.updateMovable(this.isMovable()||this.isInFlyout),(e=this.getSvgRoot())&&eb(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(){this.addSelect(),th(this)}unselect(){this.removeSelect(),th(null)}setParent(e){var t=this.parentBlock_;if(e!==t){e6(),super.setParent(e),e4();var i=this.getSvgRoot();if(!this.workspace.isClearing&&i){var o,s=this.getRelativeToSurfaceXY(),n=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode(),r=this.getSvgRoot().contains(null!=(o=null==n?void 0:n.getFocusableElement())?o:null);e?(e.getSvgRoot().appendChild(i),r&&n&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(n)):t&&((t=null==(e=this.workspace.getCanvas().querySelector(".blocklyDragging"))?void 0:e.parentElement)===(o=this.workspace.getCanvas())?o.insertBefore(i,e):(o.appendChild(i),r&&n&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(n)),this.translate(s.x,s.y)),this.applyColour()}}}getRelativeToSurfaceXY(){let e=this.workspace.getLayerManager();if(!e)throw Error("Cannot calculate position because the workspace has not been appended");let t=0,i=0,o=this.getSvgRoot();if(o)do{let e=tL(o);t+=e.x,i+=e.y,o=o.parentNode}while(o&&!e.hasLayer(o))return new lt(t,i)}moveBy(e,t,i){if(this.parentBlock_)throw Error("Block has parent");let o=eX(),s=null;o&&(s=new(ej(rL.BLOCK_MOVE))(this),i&&s.setReason(i)),e=new lt(e,t),t=this.getRelativeToSurfaceXY(),e=lt.sum(t,e),this.translate(e.x,e.y),this.updateComponentLocations(e),o&&s&&(s.recordNew(),eH(s)),this.workspace.resizeContents()}translate(e,t){this.translation=`translate(${e}, ${t})`,this.relativeCoords=new lt(e,t),this.getSvgRoot().setAttribute("transform",this.getTranslation())}getTranslation(){return this.translation}moveTo(e,t){let i=this.getRelativeToSurfaceXY();this.moveBy(e.x-i.x,e.y-i.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(null!=e&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();(e=e.alignXY(t))!==t&&this.moveTo(e,["snap"])}}}getBoundingRectangle(){return this.getBoundingRectangleWithDimensions(this.getHeightWidth())}getBoundingRectangleWithoutChildren(){return this.getBoundingRectangleWithDimensions({height:this.height,width:this.childlessWidth})}getBoundingRectangleWithDimensions(e){let t,i,o=this.getRelativeToSurfaceXY();return this.RTL?(t=o.x-e.width,i=o.x):(t=o.x,i=o.x+e.width),new lo(o.y,o.y+e.height,t,i)}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())}childHasWarning(){for(let e of this.getChildren(!1))if(e.getIcon(hy.TYPE)||e.childHasWarning())return!0;return!1}updateCollapsed(){var e=this.isCollapsed();for(let t=0,i;i=this.inputList[t];t++)i.name!==lz&&i.setVisible(!e);for(var t of this.getIcons())t.updateCollapsed();e?(eq(this.svgGroup,"blocklyCollapsed"),this.childHasWarning()&&this.setWarningText($.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,hD.COLLAPSED_WARNING_ID),e=this.toString(30),(t=this.getField(lj))?t.setValue(e):(this.getInput(lz)||this.appendDummyInput(lz)).appendField(new hh(e),lj)):(this.updateDisabled(),this.removeInput(lz),e0(this.svgGroup,"blocklyCollapsed"),this.setWarningText(null,hD.COLLAPSED_WARNING_ID))}onMouseDown(e){if(!this.workspace.isReadOnly()){var t=this.workspace.getGesture(e);t&&t.handleBlockStart(e,this)}}showHelp(){let e="function"==typeof this.helpUrl?this.helpUrl():this.helpUrl;e&&window.open(e)}generateContextMenu(e){return this.workspace.isReadOnly()||!this.contextMenu?null:(e=cN.registry.getContextMenuOptions({block:this,focusedNode:this},e),this.customContextMenu&&this.customContextMenu(e),e)}calculateContextMenuLocation(e){let t,i;if(e instanceof PointerEvent)return new lt(e.clientX,e.clientY);e=tv(this.workspace,this.getRelativeToSurfaceXY());let o=null==(t=this.inputList.filter(e=>e.isVisible()).flatMap(e=>e.fieldRow).find(e=>e.isVisible()))||null==(i=t.getSvgRoot())?void 0:i.getBoundingClientRect();return new lt(this.RTL?e.x-5:e.x+5,(o&&o.height?o.y+o.height:e.y+this.height)+5)}showContextMenu(e){let t=this.generateContextMenu(e),i=this.calculateContextMenuLocation(e);t&&t.length&&(o9(e,t,this.RTL,this.workspace,i),o8(this))}updateComponentLocations(e){for(let t of(this.dragging||this.updateConnectionLocations(e),this.updateIconLocations(e),this.updateFieldLocations(e),this.getChildren(!1)))t.updateComponentLocations(lt.sum(e,t.relativeCoords))}updateConnectionLocations(e){for(let t of this.getConnections_(!1))t.moveToOffset(e)}updateIconLocations(e){for(let t of this.getIcons())t.onLocationChange(e)}updateFieldLocations(e){for(let t of this.inputList)for(let i of t.fieldRow)i.onLocationChange(e)}addClass(e){eq(this.svgGroup,e)}removeClass(e){e0(this.svgGroup,e)}setDragging(e){(this.dragging=e)?(this.translation="",rj.push(...this.getConnections_(!0)),this.addClass("blocklyDragging")):(rj.length=0,this.removeClass("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?e0(this.svgGroup,"blocklyNotEditable"):eq(this.svgGroup,"blocklyNotEditable"),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){var i,o;this.disposing=!0,oL(),so();let s=$.getFocusManager$$module$build$src$core$focus_manager();if(this.getSvgRoot().contains(null!=(o=null==(i=s.getFocusedNode())?void 0:i.getFocusableElement())?o:null)){if(!(i=this.getParent())){let e;if(o=null!=(e=this.outputConnection)?e:this.previousConnection){let e;i=null==(e=o.closest(0,new lt(0,0)).connection)?void 0:e.getSourceBlock()}}i?s.focusNode(i):setTimeout(()=>s.focusTree(this.workspace),0)}t&&(this.unplug(e),sQ(this)),super.dispose(!!e),e2(this.svgGroup)}disposeInternal(){this.disposing=!0,super.disposeInternal(),$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()===this&&this.workspace.cancelCurrentGesture(),[...this.warningTextDb.values()].forEach(e=>clearTimeout(e)),this.warningTextDb.clear(),this.getIcons().forEach(e=>e.dispose())}checkAndDelete(){this.workspace.isFlyout||($.setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),$.setGroup$$module$build$src$core$events$utils(!1))}toCopyData(){return this.isInsertionMarker_?null:{paster:hO.TYPE,blockState:ik(this,{addCoordinates:!0,addNextBlocks:!1}),typeCounts:t_(this,!0)}}applyColour(){var e,t;for(null==(t=(e=this.pathObject).applyColour)||t.call(e,this),e=this.getIcons(),t=0;t<e.length;t++)e[t].applyColour();for(let e of this.getFields())e.applyColour()}updateDisabled(){let e=!this.isEnabled()||this.getInheritedDisabled();if(this.visuallyDisabled===e){let e;null==(e=this.getNextBlock())||e.updateDisabled()}else for(let t of(this.applyColour(),this.visuallyDisabled=e,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 i of this.warningTextDb.values())clearTimeout(i);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),i=this.getIcon(hy.TYPE),e){let o=this.getSurroundParent(),s=null;for(;o;)o.isCollapsed()&&(s=o),o=o.getSurroundParent();s&&s.setWarningText($.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,hD.COLLAPSED_WARNING_ID),i?i.addMessage(e,t):this.addIcon(new hy(this).addMessage(e,t))}else i&&(t?(i.addMessage("",t),i.getText()||this.removeIcon(hy.TYPE)):this.removeIcon(hy.TYPE))}setMutator(e){this.removeIcon($.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE),e&&this.addIcon(e)}addIcon(e){return super.addIcon(e),e instanceof $.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){let t=super.removeIcon(e);return e.equals($.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE)&&(this.mutator=null),this.queueRender(),t}setDisabledReason(e,t){let i=this.isEnabled();super.setDisabledReason(e,t),this.isEnabled()===i||this.getInheritedDisabled()||this.updateDisabled()}setDeletable(e){super.setDeletable(e),e?e0(this.svgGroup,"blocklyNotDeletable"):eq(this.svgGroup,"blocklyNotDeletable")}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){let t,i;super.setColour(e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),null==(i=(t=this.pathObject).setStyle)||i.call(t,e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()}setStyle(e){let t=this.workspace.getRenderer().getConstants().getBlockStyle(e);if(this.styleName_&&e0(this.svgGroup,this.styleName_),t){let i,o;this.hat=t.hat,null==(o=(i=this.pathObject).setStyle)||o.call(i,t),this.colour_=t.colourPrimary,this.style=t,this.applyColour(),eq(this.svgGroup,e),this.styleName_=e}else throw Error("Invalid style name: "+e)}getStyle(){return this.style}bringToFront(e=!1){let t=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode(),i=this;if(!i.isDeadOrDying()){do{let t=i.getSvgRoot(),o=t.parentNode,s=o.childNodes;if(s[s.length-1]!==t&&o.appendChild(t),e)break;i=i.getParent()}while(i)t&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(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 i=this.inputList[t].connection;i&&(i.setTracking(e),(i=i.targetBlock())&&i.setConnectionTracking(e))}}getConnections_(e){let 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 e=0,i;i=this.inputList[e];e++)i.connection&&t.push(i.connection);return t}lastConnectionInStack(e){return super.lastConnectionInStack(e)}getMatchingConnection(e,t){return super.getMatchingConnection(e,t)}makeConnection_(e){return new h_(this,e)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){let e=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||e.isInFlyout))for(let t of this.getConnections_(!1)){if(t.isSuperior()){let e;null==(e=t.targetBlock())||e.bumpNeighbours()}for(let i of t.neighbours($.config$$module$build$src$core$config.snapRadius))i.getSourceBlock().getRootBlock()!==e&&(t.isConnected()&&i.isConnected()||(t.isSuperior()?i.bumpAwayFrom(t,!1):t.bumpAwayFrom(i,!0)))}}scheduleSnapAndBump(){this.snapToGrid(),this.bumpNeighbours()}positionNearConnection(e,t,i){if(e.type===c5.NEXT_STATEMENT||e.type===c5.INPUT_VALUE){let o=t.x;t=t.y,o+=i.x-e.getOffsetInBlock().x,t+=i.y-e.getOffsetInBlock().y,this.moveBy(o,t)}}getChildren(e){return super.getChildren(e)}queueRender(){return t5(this)}render(){this.queueRender(),t4()}renderEfficiently(){e6(),this.isCollapsed()&&this.updateCollapsed(),this.isEnabled()||this.updateDisabled(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),e4()}tightenChildrenEfficiently(){for(let e of this.inputList){let t=e.connection;t&&t.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}getHeightWidth(){let e=this.height,t=this.width;var i=this.getNextBlock();if(i){i=i.getHeightWidth();let o=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;e+=i.height-o,t=Math.max(t,i.width)}return{height:e,width:t}}fadeForReplacement(e){this.pathObject.updateReplacementFade(e)}highlightShapeForInput(e,t){this.pathObject.updateShapeForInputHighlight(e,t)}getDragStrategy(){return this.dragStrategy}setDragStrategy(e){this.dragStrategy=e}isCopyable(){return this.isOwnDeletable()&&this.isOwnMovable()}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(){let e=Object.assign({},{kind:"BLOCK"},ik(this)),t=new Set(["id","height","width","pinned","enabled"]),i=function(e){for(let o in e)t.has(o)?delete e[o]:"object"==typeof e[o]&&i(e[o])};return i(e),[e]}jsonInit(e){super.jsonInit(e),e.classes&&this.addClass(Array.isArray(e.classes)?e.classes.join(" "):e.classes)}getFocusableElement(){return this.pathObject.svgPath}getFocusableTree(){return this.workspace}onNodeFocus(){this.select()}onNodeBlur(){this.unselect()}canBeFocused(){return!0}};hD.INLINE=-1,hD.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var hk=class{onDragEnter(e){}onDragOver(e){}onDragExit(e){}onDrop(e){}getClientRect(){return null}shouldPreventMove(e){return!1}},hw=class extends hk{constructor(){super(),this.wouldDelete_=!1}wouldDelete(e){return e instanceof hD?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e)):this.updateWouldDelete_(ni(e)&&e.isDeletable()),this.wouldDelete_}updateWouldDelete_(e){this.wouldDelete_=e}},hv=class{constructor(e,t){this.element=e,this.type=t}getElement(){return this.element}getType(){return this.type}},hM=class{constructor(e){this.workspace_=e}getDimensionsPx_(e){let t=0,i=0;return e&&(t=e.getWidth(),i=e.getHeight()),new ls(t,i)}getFlyoutMetrics(e){return{width:(e=this.getDimensionsPx_(this.workspace_.getFlyout(e))).width,height:e.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){let e=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:e.width,height:e.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){var e;let t=0,i=0,o=this.getToolboxMetrics(),s=this.getFlyoutMetrics(),n=!!this.workspace_.getToolbox(),r=!(null==(e=this.workspace_.getFlyout())?0:e.autoClose),l=(e=n?o.position:s.position)===lS.TOP;return e===lS.LEFT&&(n&&(t+=o.width),r&&(t+=s.width)),l&&(n&&(i+=o.height),r&&(i+=s.height)),{top:i,left:t}}getViewMetrics(e){var t;e=e?this.workspace_.scale:1;let i=this.getSvgMetrics(),o=this.getToolboxMetrics(),s=this.getFlyoutMetrics(),n=!!this.workspace_.getToolbox(),r=!(null==(t=this.workspace_.getFlyout())?0:t.autoClose),l=(t=n?o.position:s.position)===lS.LEFT||t===lS.RIGHT;return(t===lS.TOP||t===lS.BOTTOM)&&(n&&(i.height-=o.height),r&&(i.height-=s.height)),l&&(n&&(i.width-=o.width),r&&(i.width-=s.width)),{height:i.height/e,width:i.width/e,top:-this.workspace_.scrollY/e,left:-this.workspace_.scrollX/e}}getContentMetrics(e){e=e?1:this.workspace_.scale;let 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{};let t=this.workspace_.isMovableHorizontally(),i=this.workspace_.isMovableVertically();e=e||this.getViewMetrics(!1);let o={};return i||(o.top=e.top,o.bottom=e.top+e.height),t||(o.left=e.left,o.right=e.left+e.width),o}getPaddedContent_(e,t){let i=t.top+t.height,o=t.left+t.width,s=e.width;e=e.height;let n=s/2,r=e/2;return{top:Math.min(t.top-r,i-e),bottom:Math.max(i+r,t.top+e),left:Math.min(t.left-n,o-s),right:Math.max(o+n,t.left+s)}}getScrollMetrics(e,t,i){e=e?this.workspace_.scale:1,t=t||this.getViewMetrics(!1);var o=i||this.getContentMetrics();i=this.getComputedFixedEdges_(t),t=this.getPaddedContent_(t,o),o=void 0!==i.top?i.top:t.top;let s=void 0!==i.left?i.left:t.left;return{top:o/e,left:s/e,width:((void 0!==i.right?i.right:t.right)-s)/e,height:((void 0!==i.bottom?i.bottom:t.bottom)-o)/e}}getUiMetrics(){return{viewMetrics:this.getViewMetrics(),absoluteMetrics:this.getAbsoluteMetrics(),toolboxMetrics:this.getToolboxMetrics()}}getMetrics(){let e=this.getToolboxMetrics(),t=this.getFlyoutMetrics(!0),i=this.getSvgMetrics(),o=this.getAbsoluteMetrics(),s=this.getViewMetrics(),n=this.getContentMetrics(),r=this.getScrollMetrics(!1,s,n);return{contentHeight:n.height,contentWidth:n.width,contentTop:n.top,contentLeft:n.left,scrollHeight:r.height,scrollWidth:r.width,scrollTop:r.top,scrollLeft:r.left,viewHeight:s.height,viewWidth:s.width,viewTop:s.top,viewLeft:s.left,absoluteTop:o.top,absoluteLeft:o.left,svgHeight:i.height,svgWidth:i.width,toolboxWidth:e.width,toolboxHeight:e.height,toolboxPosition:e.position,flyoutWidth:t.width,flyoutHeight:t.height}}};ea(D.METRICS_MANAGER,y,hM);var hP=class extends hM{constructor(e,t){super(e),this.flyout_=t}getBoundingBox(){let e;try{e=this.workspace_.getCanvas().getBBox()}catch(t){e={height:0,y:0,width:0,x:0}}return e}getContentMetrics(e){let 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,i){return t=i||this.getContentMetrics(),i=this.flyout_.MARGIN*this.workspace_.scale,e=e?this.workspace_.scale:1,{height:(t.height+2*i)/e,width:(t.width+t.left+i)/e,top:0,left:0}}},hB=class{constructor(e,t,i,o){let s;this.workspace=e,this.targetWorkspace=t,this.isFlyoutLabel=o,this.height=this.width=0,this.cursorSvg=this.svgText=null,this.text=i.text,this.position=new lt(0,0),this.callbackKey=i.callbackKey||i.callbackkey,this.cssClass=i["web-class"]||null,this.info=i,e=this.isFlyoutLabel?"blocklyFlyoutLabel":"blocklyFlyoutButton",this.cssClass&&(e+=" "+this.cssClass),this.id=ey(),this.svgGroup=eZ(li.G,{id:this.id,class:e},this.workspace.getCanvas()),this.isFlyoutLabel||(s=eZ(li.RECT,{class:"blocklyFlyoutButtonShadow",rx:hB.BORDER_RADIUS,ry:hB.BORDER_RADIUS,x:1,y:1},this.svgGroup)),e=eZ(li.RECT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:hB.BORDER_RADIUS,ry:hB.BORDER_RADIUS},this.svgGroup),t=eZ(li.TEXT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup),i=oY(this.text),this.workspace.RTL&&(i+=""),t.textContent=i,this.isFlyoutLabel&&(this.svgText=t,this.workspace.getThemeManager().subscribe(this.svgText,"flyoutForegroundColour","fill")),o=tb(t,"fontSize");let n=tb(t,"fontWeight"),r=tb(t,"fontFamily");if(this.width=e9(t,o,n,r),i=e7(i,o,n,r),this.height=this.height||i.height,!this.isFlyoutLabel){let e,t;this.width+=2*hB.TEXT_MARGIN_X,this.height+=2*hB.TEXT_MARGIN_Y,null==(e=s)||e.setAttribute("width",String(this.width)),null==(t=s)||t.setAttribute("height",String(this.height))}e.setAttribute("width",String(this.width)),e.setAttribute("height",String(this.height)),t.setAttribute("x",String(this.width/2)),t.setAttribute("y",String(this.height/2-i.height/2+i.baseline)),this.updateTransform(),this.onMouseDownWrapper=eb(this.svgGroup,"pointerdown",this,this.onMouseDown),this.onMouseUpWrapper=eb(this.svgGroup,"pointerup",this,this.onMouseUp)}createDom(){return 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()}moveBy(e,t,i){this.moveTo(this.position.x+e,this.position.y+t)}isLabel(){return this.isFlyoutLabel}getPosition(){return this.position}getBoundingRectangle(){return new lo(this.position.y,this.position.y+this.height,this.position.x,this.position.x+this.width)}getButtonText(){return this.text}getTargetWorkspace(){return this.targetWorkspace}getWorkspace(){return this.workspace}dispose(){eO(this.onMouseDownWrapper),eO(this.onMouseUpWrapper),this.svgGroup&&e2(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}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)}onMouseDown(e){let t=this.targetWorkspace.getGesture(e),i=this.targetWorkspace.getFlyout();t&&i&&t.handleFlyoutStart(e,i)}getSvgRoot(){return this.svgGroup}getFocusableElement(){return this.svgGroup}getFocusableTree(){return this.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}};hB.TEXT_MARGIN_X=5,hB.TEXT_MARGIN_Y=2,hB.BORDER_RADIUS=4,tf("\n.blocklyFlyoutButton {\n fill: #888;\n cursor: default;\n}\n\n.blocklyFlyoutButtonShadow {\n fill: #666;\n}\n\n.blocklyFlyoutButton:hover {\n fill: #aaa;\n}\n\n.blocklyFlyoutLabel {\n cursor: default;\n}\n\n.blocklyFlyoutLabelBackground {\n opacity: 0;\n}\n");var hx=class{getFirstChild(e){return null}getParent(e){return e.getWorkspace()}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof hB}},hF=class{constructor(e,t){this.policy=e,this.flyout=t}getFirstChild(e){return null}getParent(e){return this.policy.getParent(e)}getNextSibling(e){let t=this.flyout.getContents();if(!t)return null;let i=t.findIndex(t=>t.getElement()===e);return -1===i?null:(++i>=t.length&&(i=0),t[i].getElement())}getPreviousSibling(e){let t=this.flyout.getContents();if(!t)return null;let i=t.findIndex(t=>t.getElement()===e);return -1===i?null:(--i<0&&(i=t.length-1),t[i].getElement())}isNavigable(e){return this.policy.isNavigable(e)}isApplicable(e){return this.policy.isApplicable(e)}},hG=class{constructor(e,t){this.gap=e,this.axis=t,this.y=this.x=0}getBoundingRectangle(){switch(this.axis){case"x":return new lo(this.y,this.y,this.x,this.x+this.gap);case"y":return new lo(this.y,this.y+this.gap,this.x,this.x)}}moveBy(e,t,i){this.x+=e,this.y+=t}isNavigable(){return!1}getFocusableElement(){throw Error("Cannot be focused")}getFocusableTree(){throw Error("Cannot be focused")}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!1}},hH=class{getFirstChild(e){return null}getParent(e){return null}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return!1}isApplicable(e){return e instanceof hG}},hU=class{getFirstChild(e){return no(e,!0)[0]}getParent(e){var t;if(null==(t=e.previousConnection)?0:t.targetBlock()){if(t=e.getSurroundParent())return t}else{let t;if(null==(t=e.outputConnection)?0:t.targetBlock())return e.outputConnection.targetBlock()}return e.workspace}getNextSibling(e){let t,i;if(null==(t=e.nextConnection)?0:t.targetBlock()){let t;return null==(t=e.nextConnection)?void 0:t.targetBlock()}return(null==(i=e.outputConnection)?0:i.targetBlock())?nn(e,1):e.getSurroundParent()?nn(e.getTopStackBlock(),1):this.getParent(e)instanceof uH?ns(e,1):null}getPreviousSibling(e){let t,i;if(null==(t=e.previousConnection)?0:t.targetBlock()){let t;return null==(t=e.previousConnection)?void 0:t.targetBlock()}return(null==(i=e.outputConnection)?0:i.targetBlock())?nn(e,-1):this.getParent(e)instanceof uH?ns(e,-1):null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof hD}},hW={};hW.BlockNavigationPolicy=hU,hW.navigateBlock=nn,hW.navigateStacks=ns;var hV=class{getFirstChild(e){return null}getParent(e){return e.getParentComment()}getNextSibling(e){let t=e.getParentComment().view.getCommentBarButtons();return(e=t.indexOf(e))>=0&&e+1<t.length?t[e+1]:null}getPreviousSibling(e){let t=e.getParentComment().view.getCommentBarButtons();return(e=t.indexOf(e))>0?t[e-1]:null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof cv}},hK=class{getFirstChild(e){return e.getParentInput()?e.targetConnection:null}getParent(e){return e.getSourceBlock()}getNextSibling(e){if(e.getParentInput())return nn(e,1);if(e.type===c5.NEXT_STATEMENT){let i=e.targetConnection;var t=e.getSourceBlock();if(!i&&t.getRootBlock().lastConnectionInStack(!1)===e){let i;return(t=(e=t.workspace.getTopBlocks(!0)).indexOf(t.getRootBlock())+1)>=e.length&&(t=0),t=e[t],null!=(i=this.getParentConnection(t))?i:t}return i}return e.getSourceBlock()}getPreviousSibling(e){if(e.getParentInput())return nn(e,-1);if(e.type===c5.PREVIOUS_STATEMENT||e.type===c5.OUTPUT_VALUE){let i=e.targetConnection&&!e.targetConnection.getParentInput()?e.targetConnection:null;var t=e.getSourceBlock();if(!i&&this.getParentConnection(t.getRootBlock())===e){let i;return(t=(e=t.workspace.getTopBlocks(!0)).indexOf(t.getRootBlock())-1)<0&&(t=e.length-1),null!=(i=(t=e[t]).lastConnectionInStack(!1))?i:t}return i}return e.type===c5.NEXT_STATEMENT?e.getSourceBlock():null}getParentConnection(e){let t;return!e.outputConnection||(null==(t=e.previousConnection)?0:t.isConnected())?e.previousConnection:e.outputConnection}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof h_}},hX=class{getFirstChild(e){return null}getParent(e){return e.getSourceBlock()}getNextSibling(e){return nn(e,1)}getPreviousSibling(e){return nn(e,-1)}isNavigable(e){let t;return e.canBeFocused()&&e.isVisible()&&(e.isClickable()||e.isCurrentlyEditable())&&!((null==(t=e.getSourceBlock())?0:t.isSimpleReporter())&&e.isFullBlockField())&&e.getParentInput().isVisible()}isApplicable(e){return e instanceof cd}},hY=class{getFirstChild(e){if(e instanceof $.MutatorIcon$$module$build$src$core$icons$mutator_icon&&e.bubbleIsVisible()&&$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()===e){let t,i;return null!=(i=null==(t=e.getBubble())?void 0:t.getWorkspace())?i:null}return null}getParent(e){return e.getSourceBlock()}getNextSibling(e){return nn(e,1)}getPreviousSibling(e){return nn(e,-1)}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof hi}},hz=class{getFirstChild(e){return e.view.getCommentBarButtons()[0]}getParent(e){return e.workspace}getNextSibling(e){return ns(e,1)}getPreviousSibling(e){return ns(e,-1)}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof cW}},hj=class{getFirstChild(e){return(e=e.getTopBlocks(!0)).length?e[0]:null}getParent(e){return null}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return e.canBeFocused()&&!e.isMutator}isApplicable(e){return e instanceof uH}},hJ=class{constructor(){this.rules=[new hU,new hX,new hK,new hj,new hY,new hz,new hV]}addNavigationPolicy(e){this.rules.push(e)}get(e){return this.rules.find(t=>t.isApplicable(e))}getFirstChild(e){let t,i,o=null==(t=this.get(e))?void 0:t.getFirstChild(e);return o?null!=(i=this.get(o))&&i.isNavigable(o)?o:this.getFirstChild(o)||this.getNextSibling(o):null}getParent(e){let t,i,o=null==(t=this.get(e))?void 0:t.getParent(e);return o?null!=(i=this.get(o))&&i.isNavigable(o)?o:this.getParent(o):null}getNextSibling(e){let t,i,o=null==(t=this.get(e))?void 0:t.getNextSibling(e);return o?null!=(i=this.get(o))&&i.isNavigable(o)?o:this.getNextSibling(o):null}getPreviousSibling(e){let t,i,o=null==(t=this.get(e))?void 0:t.getPreviousSibling(e);return o?null!=(i=this.get(o))&&i.isNavigable(o)?o:this.getPreviousSibling(o):null}},hZ=class extends hJ{constructor(e){super(),this.rules.push(new hx,new hH),this.rules=this.rules.map(t=>new hF(t,e))}},hq=class{constructor(e,t,i,o,s){this.workspace=e,this.oldHostMetrics=this.corner_=this.vScroll=this.hScroll=null,i=void 0===i||i;let n=(t=void 0===t||t)&&i;t&&(this.hScroll=new lh(e,!0,n,o,s)),i&&(this.vScroll=new lh(e,!1,n,o,s)),n&&(this.corner_=eZ(li.RECT,{height:lh.scrollbarThickness,width:lh.scrollbarThickness,class:"blocklyScrollbarBackground"}),e3(this.corner_,e.getBubbleCanvas()))}dispose(){e2(this.corner_),this.oldHostMetrics=this.corner_=null,this.hScroll&&(this.hScroll.dispose(),this.hScroll=null),this.vScroll&&(this.vScroll.dispose(),this.vScroll=null)}resize(){let e=this.workspace.getMetrics();if(e){var t=!1,i=!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||(i=!0)):i=t=!0,t||i){try{$.disable$$module$build$src$core$events$utils(),this.hScroll&&t&&this.hScroll.resize(e),this.vScroll&&i&&this.vScroll.resize(e)}finally{$.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 e;null==(e=this.corner_)||e.setAttribute("x",String(this.vScroll.position.x))}if(!this.oldHostMetrics||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteTop!==e.absoluteTop){let e;null==(e=this.corner_)||e.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,i){this.hScroll&&this.hScroll.set(e,!1),this.vScroll&&this.vScroll.set(t,!1),(i||void 0===i)&&(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)}},hQ=class{load(e,t){return new hv(new hG(0,t.horizontalLayout?"x":"y"),"sep")}gapForItem(e,t){let i;return null!=(i=parseInt(String(e.gap)))?i:t}disposeItem(e){}getType(){return"sep"}};ea(D.FLYOUT_INFLATER,"sep",hQ);var h0=class extends hw{constructor(e){super(),this.horizontalLayout=!1,this.boundEvents=[],this.reflowWrapper=null,this.contents=[],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,this.inflaters=new Map,e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new uH(e),this.workspace_.setMetricsManager(new hP(this.workspace_,this)),this.workspace_.internalIsFlyout=!0,this.workspace_.setVisible(this.visible),this.workspace_.setNavigator(new hZ(this)),this.id=eD(),this.RTL=!!e.RTL,this.toolboxPosition_=e.toolboxPosition,this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH,this.MARGIN=this.CORNER_RADIUS,this.GAP_X=3*this.MARGIN,this.GAP_Y=3*this.MARGIN}createDom(e){return this.svgGroup_=eZ(e,{class:"blocklyFlyout"}),this.svgGroup_.style.display="none",this.svgBackground_=eZ(li.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 hq(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),this.boundEvents.push(eb(this.svgGroup_,"wheel",this,this.wheel_)),this.boundEvents.push(eb(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:r6.ComponentWeight.FLYOUT_WEIGHT,capabilities:[r6.Capability.AUTOHIDEABLE,r6.Capability.DELETE_AREA,r6.Capability.DRAG_TARGET]})}dispose(){for(let e of(this.hide(),this.targetWorkspace.getComponentManager().removeComponent(this.id),this.boundEvents))eO(e);this.boundEvents.length=0,this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.dispose()),this.svgGroup_&&e2(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){let t=e!==this.isVisible();this.visible=e,t&&(this.autoClose||this.targetWorkspace.recordDragTargets(),this.updateDisplay())}setContainerVisible(e){let t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay()}getContents(){return this.contents}setContents(e){this.contents=e}updateDisplay(){let e,t;e=!!this.containerVisible&&this.isVisible(),this.svgGroup_&&(this.svgGroup_.style.display=e?"block":"none"),null==(t=this.workspace_.scrollbar)||t.setContainerVisible(e)}positionAt_(e,t,i,o){let s,n;null==(s=this.svgGroup_)||s.setAttribute("width",`${e}`),null==(n=this.svgGroup_)||n.setAttribute("height",`${t}`),this.workspace_.setCachedParentSvgSize(e,t),this.svgGroup_&&e5(this.svgGroup_,"translate("+i+"px,"+o+"px)"),(e=this.workspace_.scrollbar)&&(e.setOrigin(i,o),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(){this.isVisible()&&(this.setVisible(!1),this.reflowWrapper&&(this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowWrapper=null))}show(e){this.workspace_.setResizesEnabled(!1),this.hide(),this.clearOldBlocks(),"string"==typeof e&&(e=this.getDynamicCategoryContents(e)),this.setVisible(!0),e=tF(e),e=this.createFlyoutInfo(e),t4(this.workspace_),this.setContents(e),this.layout_(e),this.horizontalLayout?this.height_=0:this.width_=0,this.reflow(),this.workspace_.setResizesEnabled(!0),this.reflowWrapper=e=>{e.type!==rL.BLOCK_CHANGE&&e.type!==rL.BLOCK_FIELD_INTERMEDIATE_CHANGE||this.reflow()},this.workspace_.addChangeListener(this.reflowWrapper)}createFlyoutInfo(e){let t=[],i=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(let o of e)"custom"in o&&(e=tF(e=this.getDynamicCategoryContents(o.custom)),t.push(...this.createFlyoutInfo(e))),e=o.kind.toLowerCase(),(e=this.getInflaterForType(e))&&(t.push(e.load(o,this)),(e=e.gapForItem(o,i))&&t.push(new hv(new hG(e,this.horizontalLayout?"x":"y"),"sep")));return this.normalizeSeparators(t)}normalizeSeparators(e){for(let t=e.length-1;t>0;t--){let i=e[t].getType().toLowerCase(),o=e[t-1].getType().toLowerCase();"sep"===i&&"sep"===o&&e.splice(t-1,1)}return e}getDynamicCategoryContents(e){if("function"!=typeof(e=this.workspace_.targetWorkspace.getToolboxCategoryCallback(e)))throw TypeError("Couldn't find a callback function when opening a toolbox category.");return e(this.workspace_.targetWorkspace)}clearOldBlocks(){let e;this.getContents().forEach(e=>{let t;null==(t=this.getInflaterForType(e.getType()))||t.disposeItem(e)}),null==(e=this.workspace_.getPotentialVariableMap())||e.clear()}onMouseDown(e){let t=this.targetWorkspace.getGesture(e);t&&t.handleFlyoutStart(e,this)}isBlockCreatable(e){return e.isEnabled()&&!this.getTargetWorkspace().isReadOnly()}createBlock(e){let t=null;$.disable$$module$build$src$core$events$utils();var i=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{t=this.placeNewBlock(e)}finally{$.enable$$module$build$src$core$events$utils()}if(this.targetWorkspace.hideChaff(),e=iL(this.targetWorkspace,i),eX()){for($.setGroup$$module$build$src$core$events$utils(!0),i=0;i<e.length;i++){let t=e[i];eH(new(ej(rL.VAR_CREATE))(t))}eH(new(ej(rL.BLOCK_CREATE))(t))}return this.autoClose&&this.hide(),t}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()}placeNewBlock(e){var t=this.targetWorkspace;if(!e.getSvgRoot())throw Error("oldBlock is not rendered");let i=this.serializeBlock(e);return t.setResizesEnabled(!1),t=iH(i,t),this.positionNewBlock(e,t),t}serializeBlock(e){return ik(e)}positionNewBlock(e,t){let i=this.targetWorkspace;var o=i.getOriginOffsetInPixels(),s=this.workspace_.getOriginOffsetInPixels();(e=e.getRelativeToSurfaceXY()).scale(this.workspace_.scale),s=lt.sum(s,e),(o=lt.difference(s,o)).scale(1/i.scale),t.moveTo(new lt(o.x,o.y))}getInflaterForType(e){if(this.inflaters.has(e)){var t;return null!=(t=this.inflaters.get(e))?t:null}return(t=ep(D.FLYOUT_INFLATER,e))?(t=new t,this.inflaters.set(e,t),t):null}getFocusableElement(){throw Error("Flyouts are not directly focusable.")}getFocusableTree(){throw Error("Flyouts are not directly focusable.")}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!1}getRootFocusableNode(){throw Error("Flyouts are not directly focusable.")}getRestoredFocusableNode(e){throw Error("Flyouts are not directly focusable.")}getNestedTrees(){throw Error("Flyouts are not directly focusable.")}lookUpFocusableNode(e){throw Error("Flyouts are not directly focusable.")}onTreeFocus(e,t){}onTreeBlur(e){throw Error("Flyouts are not directly focusable.")}},h1=class{constructor(){this.isActive=!1,this.activeClassName="blocklyKeyboardNavigation"}setIsActive(e=!0){this.isActive=e,this.updateActiveVisualization()}getIsActive(){return this.isActive}updateActiveVisualization(){this.isActive?document.body.classList.add(this.activeClassName):document.body.classList.remove(this.activeClassName)}},h2=new h1,h3={};h3.KeyboardNavigationController=h1,h3.keyboardNavigationController=h2;var h5=class{constructor(e){this.workspace=e,this.horizontalScrollEnabled=this.workspace.isMovableHorizontally(),this.verticalScrollEnabled=this.workspace.isMovableVertically(),this.startScrollXY_=new lt(e.scrollX,e.scrollY)}dispose(){this.workspace=null}startDrag(){}endDrag(e){this.drag(e)}drag(e){if(e=lt.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 TypeError("Invalid state.")}},h6=class{constructor(e,t){this.creatorWorkspace=t,this.mouseDownXY=new lt(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 lt(0,0)}dispose(){for(let e of(ef(),ok(),this.creatorWorkspace.clearGesture(),this.boundEvents))eO(e);this.boundEvents.length=0,this.workspaceDragger&&this.workspaceDragger.dispose()}updateFromEvent(e){let t=new lt(e.clientX,e.clientY);this.updateDragDelta(t)&&(this.updateIsDragging(e),em()),this.mostRecentEvent=e}updateDragDelta(e){return this.currentDragDeltaXY=lt.difference(e,this.mouseDownXY),!this.hasExceededDragRadius&&(this.hasExceededDragRadius=lt.magnitude(this.currentDragDeltaXY)>(this.flyout?$.config$$module$build$src$core$config.flyoutDragRadius:$.config$$module$build$src$core$config.dragRadius))}updateIsDraggingFromFlyout(){let e;if(!this.targetBlock||null==(e=this.flyout)||!e.isBlockCreatable(this.targetBlock))return!1;if(!this.flyout.targetWorkspace)throw Error("Cannot update dragging from the flyout because the ' +\n 'flyout's target workspace is undefined");return!!(!this.flyout.isScrollable()||this.flyout.isDragTowardWorkspace(this.currentDragDeltaXY))&&(this.startWorkspace_=this.flyout.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),$.getGroup$$module$build$src$core$events$utils()||$.setGroup$$module$build$src$core$events$utils(!0),this.startBlock=null,this.targetBlock=this.flyout.createBlock(this.targetBlock),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.targetBlock),!0)}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 h5(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();let t=tc();t&&nr(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(eE(D.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,eA(e)?this.cancel():(this.gestureHasStarted=!0,s5(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=i4(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,oD(),e$(e)?this.handleRightClick(e):("pointerdown"===e.type.toLowerCase()&&"mouse"!==e.pointerType&&eT(e,this),this.mouseDownXY=new lt(e.clientX,e.clientY),this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(eb(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(eb(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(eb(document,"pointerup",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&em())}handleMove(e){this.isDragging()&&eI(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),em())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!eI(e))return;if(this.updateFromEvent(e),em(),this.isEnding_)return void console.log("Trying to end a gesture recursively.");this.isEnding_=!0,this.dragger?(h2.setIsActive(!1),this.dragger.onDragEnd(e,this.currentDragDeltaXY)):this.workspaceDragger?(h2.setIsActive(!1),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=eS(e);this.cachedPoints.set(t,this.getTouchPoint(e));var i=Array.from(this.cachedPoints.keys());2===i.length&&(t=this.cachedPoints.get(i[0]),i=this.cachedPoints.get(i[1]),this.startDistance=lt.distance(t,i),this.multiTouch=!0,e.preventDefault())}handleTouchMove(e){let t=eS(e);this.cachedPoints.set(t,this.getTouchPoint(e)),this.isPinchZoomEnabled&&2===this.cachedPoints.size?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()),i=this.cachedPoints.get(t[0]);if(t=this.cachedPoints.get(t[1]),i=lt.distance(i,t)/this.startDistance,this.previousScale>0&&this.previousScale<1/0){if(t=(t=i-this.previousScale)>0?5*t:6*t,!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");let o=this.startWorkspace_,s=eN(e,o.getParentSvg(),o.getInverseScreenCTM());o.zoom(s.x,s.y,t)}this.previousScale=i,e.preventDefault()}handleTouchEnd(e){e=eS(e),this.cachedPoints.has(e)&&this.cachedPoints.delete(e),this.cachedPoints.size<2&&(this.cachedPoints.clear(),this.previousScale=0)}getTouchPoint(e){return this.startWorkspace_?new lt(e.pageX,e.pageY):null}isMultiTouch(){return this.multiTouch}cancel(){this.isEnding_||(em(),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(),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.startWorkspace_),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),h2.setIsActive(!1),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?this.startBlock&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.startBlock):$.getFocusManager$$module$build$src$core$focus_manager().focusNode(t),this.doStart(e)}fireWorkspaceClick(e){eH(new(ej(rL.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.bringBlockToFront(),this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent)}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.flyout.isBlockCreatable(this.targetBlock)){$.getGroup$$module$build$src$core$events$utils()||$.setGroup$$module$build$src$core$events$utils(!0);var e=this.flyout.createBlock(this.targetBlock);e.snapToGrid(),e.bumpNeighbours(),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");eH(e=new(ej(rL.CLICK))(this.startBlock,this.startWorkspace_.id,"block"))}this.bringBlockToFront(),$.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){this.fireWorkspaceClick(this.startWorkspace_||this.creatorWorkspace)}bringBlockToFront(){this.targetBlock&&!this.flyout&&($.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.targetBlock),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,e.isInFlyout&&e!==e.getRootBlock()?this.setTargetBlock(e.getRootBlock()):this.setTargetBlock(e))}setTargetBlock(e){e.isShadow()?this.setTargetBlock(e.getParent()):(this.targetBlock=e,$.getFocusManager$$module$build$src$core$focus_manager().focusNode(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))}isIconClick(){if(!this.startIcon)return!1;let 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 null!=(t=null!=(e=this.workspaceDragger)?e:this.dragger)?t:null}isDragging(){return this.dragging}hasStarted(){return this.gestureHasStarted}static inProgress(){let e=ts();for(let t=0,i;i=e[t];t++)if(i.currentGesture_)return!0;return!1}},h4=class{constructor(e,t){let i,o,s;this.pattern=e,this.scale=1,this.spacing=null!=(i=t.spacing)?i:0,this.length=null!=(o=t.length)?o:1,this.line2=(this.line1=e.firstChild)&&this.line1.nextSibling,this.snapToGrid=null!=(s=t.snap)&&s}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}`);let i=(t=Math.floor(this.spacing/2)+.5)-this.length/2,o=t+this.length/2;t*=e,i*=e,o*=e,this.setLineAttributes(this.line1,e,i,o,t,t),this.setLineAttributes(this.line2,e,t,t,i,o)}setLineAttributes(e,t,i,o,s,n){e&&(e.setAttribute("stroke-width",`${t}`),e.setAttribute("x1",`${i}`),e.setAttribute("y1",`${s}`),e.setAttribute("x2",`${o}`),e.setAttribute("y2",`${n}`))}moveTo(e,t){this.pattern.setAttribute("x",`${e}`),this.pattern.setAttribute("y",`${t}`)}alignXY(e){var t=this.getSpacing();let i=t/2,o=Math.round(Math.round((e.x-i)/t)*t+i);return t=Math.round(Math.round((e.y-i)/t)*t+i),o===e.x&&t===e.y?e:new lt(o,t)}static createDom(e,t,i,o){let s,n;if(e=eZ(li.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},i),(null!=(s=t.length)?s:1)>0&&(null!=(n=t.spacing)?n:0)>0){let i;eZ(li.LINE,{stroke:t.colour},e),null!=(i=t.length)&&i&&eZ(li.LINE,{stroke:t.colour},e)}else eZ(li.LINE,{},e);return o&&o.style.setProperty("--blocklyGridPattern",`url(#${e.id})`),e}},h8=class{constructor(e){this.workspace=e,this.layers=new Map,(e=e.getInjectionDiv())&&(this.dragLayer=this.createDragLayer(e),this.animationLayer=this.createAnimationLayer(e)),eq(e=this.createLayer(50),"blocklyBlockCanvas"),eq(e=this.createLayer(100),"blocklyBubbleCanvas")}createDragLayer(e){let t=eZ(li.SVG,{class:"blocklyBlockDragSurface",xmlns:rD,"xmlns:html":rk,"xmlns:xlink":rw,version:"1.1"});return e.append(t),eZ(li.G,{},t)}createAnimationLayer(e){let t=eZ(li.SVG,{class:"blocklyAnimationLayer",xmlns:rD,"xmlns:html":rk,"xmlns:xlink":rw,version:"1.1"});return e.append(t),eZ(li.G,{},t)}appendToAnimationLayer(e){let t,i,o=null==(t=this.dragLayer)?void 0:t.getAttribute("transform");if(o){let e;null==(e=this.animationLayer)||e.setAttribute("transform",o)}null==(i=this.animationLayer)||i.appendChild(e.getSvgRoot())}translateLayers(e,t){let i;for(let[,o]of(e=`translate(${e.x}, ${e.y}) scale(${t})`,null==(i=this.dragLayer)||i.setAttribute("transform",e),this.layers))o.setAttribute("transform",e)}moveToDragLayer(e){let t;null==(t=this.dragLayer)||t.appendChild(e.getSvgRoot()),e.canBeFocused()&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}moveOffDragLayer(e,t){this.append(e,t),e.canBeFocused()&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}append(e,t){let i;if(this.layers.has(t)||this.createLayer(t),e=e.getSvgRoot(),(null==(i=this.layers.get(t))?void 0:i.lastChild)!==e){let i;null==(i=this.layers.get(t))||i.appendChild(e)}}createLayer(e){let t=this.workspace.getSvgGroup(),i=eZ(li.G,{}),o=!1;for(let[s,n]of[...this.layers].sort((e,t)=>e[0]-t[0]))if(e<s){t.insertBefore(i,n),o=!0;break}return o||t.appendChild(i),this.layers.set(e,i),i}hasLayer(e){return e===this.dragLayer||new Set(this.layers.values()).has(e)}getBlockLayer(){return this.layers.get(50)}getBubbleLayer(){return this.layers.get(100)}},h9=class{constructor(){this.curNode=this.colour=null,this.type="marker"}getCurNode(){return this.curNode}setCurNode(e){this.curNode=e}dispose(){this.curNode=null}getSourceBlockFromNode(e){return e instanceof hD?e:e instanceof cd||e instanceof h_?e.getSourceBlock():null}getSourceBlock(){return this.getSourceBlockFromNode(this.getCurNode())}},h7=class extends h9{constructor(e){super(),this.workspace=e,this.type="cursor",this.potentialNodes=null}next(){var e=this.getCurNode();return e?((e=this.getNextNode(e,e=>{let t;return e instanceof hD&&!(null==(t=e.outputConnection)?0:t.targetBlock())||e instanceof cW},!0))&&this.setCurNode(e),e):null}in(){var e=this.getCurNode();return e?((e=this.getNextNode(e,()=>!0,!0))&&this.setCurNode(e),e):null}prev(){var e=this.getCurNode();return e?((e=this.getPreviousNode(e,e=>{let t;return e instanceof hD&&!(null==(t=e.outputConnection)?0:t.targetBlock())||e instanceof cW},!0))&&this.setCurNode(e),e):null}out(){var e=this.getCurNode();return e?((e=this.getPreviousNode(e,()=>!0,!0))&&this.setCurNode(e),e):null}atEndOfLine(){var e=this.getCurNode();return!!e&&this.getNextNode(e,()=>!0,!0)===(e=this.getNextNode(e,e=>{let t;return e instanceof hD&&!(null==(t=e.outputConnection)?0:t.targetBlock())},!0))}getNextNodeImpl(e,t,i=new Set){if(!e||i.has(e))return null;let o=this.workspace.getNavigator().getFirstChild(e)||this.workspace.getNavigator().getNextSibling(e);for(var s=e;s&&!o&&(s=this.workspace.getNavigator().getParent(s));)o=this.workspace.getNavigator().getNextSibling(s);return t(o)?o:o?(i.add(e),this.getNextNodeImpl(o,t,i)):null}getNextNode(e,t,i){return e&&(i||this.getLastNode()!==e)?this.getNextNodeImpl(e,t):null}getPreviousNodeImpl(e,t,i=new Set){if(!e||i.has(e))return null;let o=this.getRightMostChild(this.workspace.getNavigator().getPreviousSibling(e),e)||this.workspace.getNavigator().getParent(e);return t(o)?o:o?(i.add(e),this.getPreviousNodeImpl(o,t,i)):null}getPreviousNode(e,t,i){return e&&(i||this.getFirstNode()!==e)?this.getPreviousNodeImpl(e,t):null}getRightMostChild(e,t){if(!e)return e;let i=this.workspace.getNavigator().getFirstChild(e);if(!i||i===t)return e;for(e=i;e&&e!==t;e=this.workspace.getNavigator().getNextSibling(i))i=e;return this.getRightMostChild(i,t)}preDelete(e){let t,i;var o,s=this.getCurNode();s=s?[s]:[];let n=null!=(i=null==(o=e.previousConnection)?void 0:o.targetConnection)?i:null==(t=e.outputConnection)?void 0:t.targetConnection;n&&s.push(n),(o=e.getNextBlock())&&s.push(o),(e=e.getParent())&&s.push(e),s.push(this.workspace),this.potentialNodes=s}postDelete(){let e=this.potentialNodes;if(this.potentialNodes=null,!e)throw Error("must call preDelete first");for(let t of e){let e;if(null==(e=this.getSourceBlockFromNode(t))||!e.disposed)return void this.setCurNode(t)}throw Error("no valid nodes in this.potentialNodes")}getCurNode(){return $.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()}setCurNode(e){$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e),e instanceof hD?e.workspace.scrollBoundsIntoView(e.getBoundingRectangleWithoutChildren()):e instanceof cd?(e=e.getSourceBlock()).workspace.scrollBoundsIntoView(e.getBoundingRectangleWithoutChildren()):e instanceof cW&&e.workspace.scrollBoundsIntoView(e.getBoundingRectangle())}getFirstNode(){return this.workspace.getNavigator().getFirstChild(this.workspace)}getLastNode(){let e=this.getFirstNode();return this.getPreviousNode(e,()=>!0,!0)}};ea(D.CURSOR,y,h7);var ue=class{constructor(e){this.workspace=e,this.markers=new Map,this.cursor=new h7(this.workspace)}registerMarker(e,t){this.markers.has(e)&&this.unregisterMarker(e),this.markers.set(e,t)}unregisterMarker(e){let 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=e}dispose(){let e=Object.keys(this.markers);for(let t=0,i;i=e[t];t++)this.unregisterMarker(i);this.markers.clear(),this.cursor.dispose()}};ue.LOCAL_MARKER="local_marker_1";var ut=class extends he{constructor(e,t,i){super(e,t,i,ut.createTextArea()),this.workspace=e,this.anchor=t,this.ownerRect=i,this.resizePointerMoveListener=this.resizePointerUpListener=null,this.textChangeListeners=[],this.sizeChangeListeners=[],this.locationChangeListeners=[],this.text="",this.DEFAULT_SIZE=new ls(160+he.DOUBLE_BORDER,80+he.DOUBLE_BORDER),this.MIN_SIZE=new ls(45+he.DOUBLE_BORDER,20+he.DOUBLE_BORDER),this.editable=!0,eq(this.svgRoot,"blocklyTextInputBubble"),this.textArea=this.getFocusableElement(),this.inputRoot=this.createEditor(this.contentContainer,this.textArea),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)}addLocationChangeListener(e){this.locationChangeListeners.push(e)}static createTextArea(){let e=document.createElementNS(rk,"textarea");return e.className="blocklyTextarea blocklyText",e}createEditor(e,t){e=eZ(li.FOREIGNOBJECT,{x:he.BORDER_WIDTH,y:he.BORDER_WIDTH},e);let i=document.createElementNS(rk,"body");return i.setAttribute("xmlns",rk),i.className="blocklyMinimalBody",t.setAttribute("dir",this.workspace.RTL?"RTL":"LTR"),i.appendChild(t),e.appendChild(i),this.bindTextAreaEvents(t),e}bindTextAreaEvents(e){eb(e,"wheel",this,e=>{e.stopPropagation()}),eb(e,"pointerdown",this,e=>{e.stopPropagation(),ef()}),eb(e,"change",this,this.onTextChange)}createResizeHandle(e,t){return eb(e=eZ(li.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},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);let i=e.width-he.DOUBLE_BORDER,o=e.height-he.DOUBLE_BORDER;this.inputRoot.setAttribute("width",`${i}`),this.inputRoot.setAttribute("height",`${o}`),this.resizeGroup.setAttribute("y",`${o}`),this.workspace.RTL?this.resizeGroup.setAttribute("x",`${-he.DOUBLE_BORDER}`):this.resizeGroup.setAttribute("x",`${i}`),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}moveDuringDrag(e){super.moveDuringDrag(e),this.onLocationChange()}setPositionRelativeToAnchor(e,t){super.setPositionRelativeToAnchor(e,t),this.onLocationChange()}positionByRect(e=new lo(0,0,0,0)){super.positionByRect(e),this.onLocationChange()}onResizePointerDown(e){this.bringToFront(),e$(e)||(sr(this.workspace,e,new lt(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=eb(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=eb(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){ef(),this.resizePointerUpListener&&(eO(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(eO(this.resizePointerMoveListener),this.resizePointerMoveListener=null)}onResizePointerMove(e){e=sl(this.workspace,e),this.setSize(new ls(this.workspace.RTL?-e.x:e.x,e.y),!1),this.onSizeChange()}onTextChange(){for(let e of(this.text=this.textArea.value,this.textChangeListeners))e()}onSizeChange(){for(let e of this.sizeChangeListeners)e()}onLocationChange(){for(let e of this.locationChangeListeners)e()}};tf("\n.blocklyTextInputBubble .blocklyTextarea {\n background-color: var(--commentFillColour);\n border: 0;\n box-sizing: border-box;\n display: block;\n outline: 0;\n padding: 5px;\n resize: none;\n width: 100%;\n height: 100%;\n}\n");var ui={};ui.register=na,ui.unregister=function(e){eh(D.ICON,e)};var uo=class extends hi{constructor(e){super(e),this.sourceBlock=e,this.textInputBubble=null,this.text="",this.bubbleSize=new ls(160,80),this.bubbleVisiblity=!1}getType(){return uo.TYPE}initView(e){this.svgRoot||(super.initView(e),eZ(li.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),eZ(li.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),eZ(li.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),eq(this.svgRoot,"blocklyCommentIcon"))}dispose(){let e;super.dispose(),null==(e=this.textInputBubble)||e.dispose()}getWeight(){return uo.WEIGHT}getSize(){return new ls(17,17)}applyColour(){let e;super.applyColour();let t=this.sourceBlock.getColour();null==(e=this.textInputBubble)||e.setColour(t)}updateEditable(){let e=this,t=()=>super.updateEditable;return(0,rf.asyncExecutePromiseGeneratorFunction)(function*(){t().call(e),e.bubbleIsVisible()&&(yield e.setBubbleVisible(!1),yield e.setBubbleVisible(!0))})}onLocationChange(e){let t,i=this.workspaceLocation;super.onLocationChange(e),this.bubbleLocation&&(e=lt.difference(this.workspaceLocation,i),this.bubbleLocation=lt.sum(this.bubbleLocation,e)),e=this.getAnchorLocation(),null==(t=this.textInputBubble)||t.setAnchorLocation(e)}setText(e){let t,i=this.text;eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock,"comment",null,i,e)),this.text=e,null==(t=this.textInputBubble)||t.setText(this.text)}getText(){return this.text}setBubbleSize(e){let t;this.bubbleSize=e,null==(t=this.textInputBubble)||t.setSize(this.bubbleSize,!0)}getBubbleSize(){return this.bubbleSize}setBubbleLocation(e){let t;this.bubbleLocation=e,null==(t=this.textInputBubble)||t.moveDuringDrag(e)}getBubbleLocation(){return this.bubbleLocation}saveState(){if(this.text){let e={text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width},t=this.getBubbleLocation();return t&&(e.x=this.sourceBlock.workspace.RTL?this.sourceBlock.workspace.getWidth()-(t.x+this.bubbleSize.width):t.x,e.y=t.y),e}return null}loadState(e){let t,i,o,s;this.text=null!=(t=e.text)?t:"",this.bubbleSize=new ls(null!=(i=e.width)?i:160,null!=(o=e.height)?o:80),this.bubbleVisiblity=null!=(s=e.pinned)&&s,this.setBubbleVisible(this.bubbleVisiblity);let n=e.x,r=e.y;t6().then(()=>{n&&r&&(n=this.sourceBlock.workspace.RTL?this.sourceBlock.workspace.getWidth()-(n+this.bubbleSize.width):n,this.setBubbleLocation(new lt(n,r)))})}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}onTextChange(){if(this.textInputBubble){var e=this.textInputBubble.getText();this.text!==e&&(eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock,"comment",null,this.text,e)),this.text=e)}}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}onBubbleLocationChange(){this.textInputBubble&&(this.bubbleLocation=this.textInputBubble.getRelativeToSurfaceXY())}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(e){let t=this;return(0,rf.asyncExecutePromiseGeneratorFunction)(function*(){t.bubbleVisiblity!==e&&(t.bubbleVisiblity=e,yield t6(),!t.sourceBlock.rendered||t.sourceBlock.isInFlyout||t.sourceBlock.isInsertionMarker()||(e?(t.sourceBlock.isEditable()?t.showEditableBubble():t.showNonEditableBubble(),t.applyColour()):t.hideBubble(),eH(new(ej(rL.BUBBLE_OPEN))(t.sourceBlock,e,"comment"))))})}getBubble(){return this.textInputBubble}showEditableBubble(){let e,t;this.createBubble(),null==(e=this.textInputBubble)||e.addTextChangeListener(()=>this.onTextChange()),null==(t=this.textInputBubble)||t.addSizeChangeListener(()=>this.onSizeChange())}showNonEditableBubble(){let e;this.createBubble(),null==(e=this.textInputBubble)||e.setEditable(!1)}createBubble(){this.textInputBubble=new ut(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.textInputBubble.setText(this.getText()),this.textInputBubble.setSize(this.bubbleSize,!0),this.bubbleLocation&&this.textInputBubble.moveDuringDrag(this.bubbleLocation),this.textInputBubble.addTextChangeListener(()=>this.onTextChange()),this.textInputBubble.addSizeChangeListener(()=>this.onSizeChange()),this.textInputBubble.addLocationChangeListener(()=>this.onBubbleLocationChange())}hideBubble(){let e;null==(e=this.textInputBubble)||e.dispose(),this.textInputBubble=null}getAnchorLocation(){return lt.sum(this.workspaceLocation,new lt(8.5,8.5))}getBubbleOwnerRect(){return this.sourceBlock.getBoundingRectangleWithoutChildren()}};uo.TYPE=ab.COMMENT,uo.WEIGHT=3,na(uo.TYPE,uo);var us={};us.CommentIcon=uo,us.Icon=hi,us.IconType=ab,us.MutatorIcon=$.MutatorIcon$$module$build$src$core$icons$mutator_icon,us.WarningIcon=hy,us.exceptions=hc,us.registry=ui,$.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.getName():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:\nBlockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());"),null)}populateVariables(e){e=$.allUsedVarModels$$module$build$src$core$variables(e);for(let t=0;t<e.length;t++)this.getName(e[t].getId(),$.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 i=e;t===$.NameType$$module$build$src$core$names.VARIABLE&&(e=this.getNameForUserVariable(e))&&(i=e),e=i.toLowerCase();let o=t===$.NameType$$module$build$src$core$names.VARIABLE||t===$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix:"";this.db.has(t)||this.db.set(t,new Map);let s=this.db.get(t);return s.has(e)?o+s.get(e):(t=this.getDistinctName(i,t),s.set(e,t.substr(o.length)),t)}getUserNames(e){let t;return(e=null==(t=this.db.get(e))?void 0:t.keys())?Array.from(e):[]}getDistinctName(e,t){let i;e=this.safeName(e);let o=null,s,n;for(;this.dbReverse.has(e+(null!=(s=o)?s:""))||this.reservedWords.has(e+(null!=(n=o)?n:""));)o=o?o+1:2;return e+=null!=(i=o)?i:"",this.dbReverse.add(e),(t===$.NameType$$module$build$src$core$names.VARIABLE||t===$.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=$.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed",e}static equals(e,t){return e.toLowerCase()===t.toLowerCase()}},(dW=(dW=$.Names$$module$build$src$core$names||($.Names$$module$build$src$core$names={})).NameType||(dW.NameType={})).DEVELOPER_VARIABLE="DEVELOPER_VARIABLE",dW.VARIABLE="VARIABLE",dW.PROCEDURE="PROCEDURE",$.NameType$$module$build$src$core$names=$.Names$$module$build$src$core$names.NameType,$.Names$$module$build$src$core$names.DEVELOPER_VARIABLE_TYPE=$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE,({NameType:$.NameType$$module$build$src$core$names}).Names=$.Names$$module$build$src$core$names;var un=class extends Map{constructor(){super()}set(e,t){return this.get(e)===t||(super.set(e,t),nh(t)&&t.startPublishing()),this}delete(e){let t=this.get(e);return(e=super.delete(e))&&nh(t)&&t.stopPublishing(),e}clear(){if(this.size)for(let e of this.keys())this.delete(e)}add(e){return this.set(e.getId(),e)}getProcedures(){return[...this.values()]}};dX="PROCEDURE",$.DEFAULT_ARG$$module$build$src$core$procedures="x",(dY={CATEGORY_NAME:dX,DEFAULT_ARG:$.DEFAULT_ARG$$module$build$src$core$procedures}).ObservableProcedureMap=un,dY.allProcedures=nu,dY.findLegalName=$.findLegalName$$module$build$src$core$procedures,dY.flyoutCategory=nT,dY.getCallers=nS,dY.getDefinition=$.getDefinition$$module$build$src$core$procedures,dY.internalFlyoutCategory=nE,dY.isNameUsed=n_,dY.isProcedureBlock=nc,dY.mutateCallers=$.mutateCallers$$module$build$src$core$procedures,dY.mutatorOpenListener=nf,dY.rename=$.rename$$module$build$src$core$procedures;var ur=new 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_=0x1000000}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)>=1}isHat(e){return(e.type&this.HAT)>=1}isIcon(e){return(e.type&this.ICON)>=1}isSpacer(e){return(e.type&this.SPACER)>=1}isInRowSpacer(e){return(e.type&this.IN_ROW_SPACER)>=1}isSpacerRow(e){return(e.type&this.BETWEEN_ROW_SPACER)>=1}isInput(e){return(e.type&this.INPUT)>=1}isExternalInput(e){return(e.type&this.EXTERNAL_VALUE_INPUT)>=1}isInlineInput(e){return(e.type&this.INLINE_INPUT)>=1}isStatementInput(e){return(e.type&this.STATEMENT_INPUT)>=1}isPreviousConnection(e){return(e.type&this.PREVIOUS_CONNECTION)>=1}isNextConnection(e){return(e.type&this.NEXT_CONNECTION)>=1}isPreviousOrNextConnection(e){return this.isPreviousConnection(e)||this.isNextConnection(e)}isRoundCorner(e){return(e.type&this.LEFT_ROUND_CORNER)>=1||(e.type&this.RIGHT_ROUND_CORNER)>=1}isLeftRoundedCorner(e){return this.isRoundCorner(e)&&(e.type&this.LEFT_ROUND_CORNER)>=1}isRightRoundedCorner(e){return this.isRoundCorner(e)&&(e.type&this.RIGHT_ROUND_CORNER)>=1}isLeftSquareCorner(e){return(e.type&this.LEFT_SQUARE_CORNER)>=1}isRightSquareCorner(e){return(e.type&this.RIGHT_SQUARE_CORNER)>=1}isCorner(e){return(e.type&this.CORNER)>=1}isJaggedEdge(e){return(e.type&this.JAGGED_EDGE)>=1}isRow(e){return(e.type&this.ROW)>=1}isBetweenRowSpacer(e){return(e.type&this.BETWEEN_ROW_SPACER)>=1}isTopRow(e){return(e.type&this.TOP_ROW)>=1}isBottomRow(e){return(e.type&this.BOTTOM_ROW)>=1}isTopOrBottomRow(e){return this.isTopRow(e)||this.isBottomRow(e)}isInputRow(e){return(e.type&this.INPUT_ROW)>=1}},ul=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=ur.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},ua=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=ur.ROW,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}getLastInput(){for(let e=this.elements.length-1;e>=0;e--){let t=this.elements[e];if(ur.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++){let t=this.elements[e];if(ur.isInRowSpacer(t))return t}return null}getLastSpacer(){for(let e=this.elements.length-1;e>=0;e--){let t=this.elements[e];if(ur.isInRowSpacer(t))return t}return null}},uc=class extends ua{constructor(e){super(e),this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0,this.type|=ur.BOTTOM_ROW}hasLeftSquareCorner(e){return!!e.outputConnection||!!e.getNextBlock()}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,i=0;for(let o=0;o<this.elements.length;o++){let s=this.elements[o];t+=s.width,ur.isSpacer(s)||(ur.isNextConnection(s)?i=Math.max(i,s.height):e=Math.max(e,s.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+i,this.descenderHeight=i,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},uh=class extends ul{constructor(e,t){super(e),this.connectionModel=t,this.type|=ur.CONNECTION,this.shape=this.constants_.shapeFor(t),this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic,this.highlighted=t.isHighlighted()}},uu=class extends uh{constructor(e,t){super(e,t.connection),this.input=t,this.connectionOffsetY=this.connectionOffsetX=0,this.type|=ur.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}},ud=class extends uu{constructor(e,t){super(e,t),this.height=0,this.type|=ur.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}},up=class extends ul{constructor(e,t,i){super(e),this.field=t,this.parentInput=i,this.isEditable=t.EDITABLE,this.flipRtl=t.getFlipRtl(),this.type|=ur.FIELD,e=this.field.getSize(),this.height=e.height,this.width=e.width}},u_=class extends ul{constructor(e){super(e),this.type|=ur.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height}},ug=class extends ul{constructor(e,t){super(e),this.icon=t,this.flipRtl=!1,this.type|=ur.ICON,e=t.getSize(),this.height=e.height,this.width=e.width}},uE=class extends ul{constructor(e,t){super(e),this.type|=ur.SPACER|ur.IN_ROW_SPACER,this.width=t,this.height=this.constants_.SPACER_DEFAULT_HEIGHT}},uT=class extends uu{constructor(e,t){super(e,t),this.type|=ur.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}},um=class extends ua{constructor(e){super(e),this.connectedBlockWidths=0,this.type|=ur.INPUT_ROW}measure(){this.width=this.minWidth,this.height=this.minHeight;let e=0;for(let t=0;t<this.elements.length;t++){let i=this.elements[t];this.width+=i.width,ur.isInput(i)&&(ur.isStatementInput(i)?e+=i.connectedBlockWidth:ur.isExternalInput(i)&&0!==i.connectedBlockWidth&&(e+=i.connectedBlockWidth-i.connectionWidth)),ur.isSpacer(i)||(this.height=Math.max(this.height,i.height))}this.connectedBlockWidths=e,this.widthWithConnectedBlocks=this.width+e}endsWithElemSpacer(){return!this.hasExternalInput&&!this.hasStatement}},uf=class extends ul{constructor(e){super(e),this.type|=ur.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width}},uI=class extends uh{constructor(e,t){super(e,t),this.type|=ur.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},uS=class extends uh{constructor(e,t){super(e,t),this.connectionOffsetX=0,this.type|=ur.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}},uR=class extends uh{constructor(e,t){super(e,t),this.type|=ur.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},ub=class extends ul{constructor(e,t){super(e),this.type=(t&&"left"!==t?ur.RIGHT_ROUND_CORNER:ur.LEFT_ROUND_CORNER)|ur.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2}},uC=class extends ua{constructor(e,t,i){super(e),this.height=t,this.width=i,this.precedesStatement=this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.type|=ur.SPACER|ur.BETWEEN_ROW_SPACER,this.elements=[new uE(this.constants_,i)]}measure(){}},uO=class extends ul{constructor(e,t){super(e),this.type=(t&&"left"!==t?ur.RIGHT_SQUARE_CORNER:ur.LEFT_SQUARE_CORNER)|ur.CORNER,this.width=this.height=this.constants_.NO_PADDING}},uA=class extends uu{constructor(e,t){super(e,t),this.type|=ur.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}},u$=class extends ua{constructor(e){super(e),this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null,this.type|=ur.TOP_ROW}hasLeftSquareCorner(e){let t=(e.hat?"cap"===e.hat:this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection,i=e.getPreviousBlock();return!!e.outputConnection||t||!!i&&i.getNextBlock()===e}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,i=0;for(let o=0;o<this.elements.length;o++){let s=this.elements[o];t+=s.width,ur.isSpacer(s)||(ur.isHat(s)?i=Math.max(i,s.ascenderHeight):e=Math.max(e,s.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+i,this.capline=this.ascenderHeight=i,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},uN=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=sV(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);let t=e.blockStyles;for(let e in t)this.blockStyles[e]=this.validatedBlockStyle_(t[e]);this.setDynamicProperties_(e)}setDynamicProperties_(e){this.setFontConstants_(e),this.setComponentConstants_(e),this.ADD_START_HATS=void 0!==e.startHats?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=e7("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){let 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){let t={};return e&&Object.assign(t,e),e=oz(t.colourPrimary||"#000"),t.colourPrimary=e.hex,t.colourSecondary=t.colourSecondary?oz(t.colourSecondary).hex:this.generateSecondaryColour_(t.colourPrimary),t.colourTertiary=t.colourTertiary?oz(t.colourTertiary).hex:this.generateTertiaryColour_(t.colourPrimary),t.hat=t.hat||"",t}generateSecondaryColour_(e){return oW("#fff",e,.6)||e}generateTertiaryColour_(e){return oW("#fff",e,.3)||e}dispose(){this.embossFilter&&e2(this.embossFilter),this.disabledPattern&&e2(this.disabledPattern),this.debugFilter&&e2(this.debugFilter),this.cssNode=null}makeJaggedTeeth(){let e=this.JAGGED_TEETH_HEIGHT,t=this.JAGGED_TEETH_WIDTH,i=sX([sH(t,e/4),sH(-(2*t),e/2),sH(t,e/4)]);return{height:e,width:t,path:i}}makeStartHat(){let e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,i=sU("c",[sH(30,-e),sH(70,-e),sH(t,0)]);return{height:.75*e,width:t,path:i}}makePuzzleTab(){function e(e){let o=-(e=e?-1:1);var s=i/2;let n=s+2.5,r=s+.5,l=sH(-t,e*s);return s=sH(t,e*s),sU("c",[sH(0,e*n),sH(-t,o*r),l])+sU("s",[sH(t,2.5*o),s])}let t=this.TAB_WIDTH,i=this.TAB_HEIGHT,o=e(!0),s=e(!1);return{type:this.SHAPES.PUZZLE,width:t,height:i,pathDown:s,pathUp:o}}makeNotch(){function e(e){return sX([sH(e*o,i),sH(3*e,0),sH(e*o,-i)])}let t=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,o=(t-3)/2,s=e(1),n=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:i,pathLeft:s,pathRight:n}}makeInsideCorners(){let e=this.CORNER_RADIUS,t=sz("a","0 0,0",e,sH(-e,e)),i=sz("a","0 0,0",e,sH(e,e));return{width:e,height:e,pathTop:t,pathBottom:i}}makeOutsideCorners(){let e=this.CORNER_RADIUS,t=sV(0,e)+sz("a","0 0,1",e,sH(e,-e)),i=sz("a","0 0,1",e,sH(e,e)),o=sz("a","0 0,1",e,sH(-e,-e));return{topLeft:t,topRight:i,bottomRight:sz("a","0 0,1",e,sH(-e,e)),bottomLeft:o,rightHeight:e}}shapeFor(e){switch(e.type){case c5.INPUT_VALUE:case c5.OUTPUT_VALUE:return this.PUZZLE_TAB;case c5.PREVIOUS_STATEMENT:case c5.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type")}}createDom(e,t,i,o){this.injectCSS_(t,i),this.defs=eZ(li.DEFS,{},e),e=eZ(li.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},this.defs),eZ(li.FEGAUSSIANBLUR,{in:"SourceAlpha",stdDeviation:1,result:"blur"},e),t=eZ(li.FESPECULARLIGHTING,{in:"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},e),eZ(li.FEPOINTLIGHT,{x:-5e3,y:-1e4,z:2e4},t),eZ(li.FECOMPOSITE,{in:"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},e),eZ(li.FECOMPOSITE,{in:"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},e),this.embossFilterId=e.id,this.embossFilter=e,e=eZ(li.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs),eZ(li.RECT,{width:10,height:10,fill:"#aaa"},e),eZ(li.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(),o&&(o.style.setProperty("--blocklyEmbossFilter",`url(#${this.embossFilterId})`),o.style.setProperty("--blocklyDisabledPattern",`url(#${this.disabledPatternId})`),o.style.setProperty("--blocklyDebugFilter",`url(#${this.debugFilterId})`))}createDebugFilter(){if(!this.debugFilter){let e=eZ(li.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs),t=eZ(li.FECOMPONENTTRANSFER,{result:"outBlur"},e);eZ(li.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),eZ(li.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},e),eZ(li.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);let i=t.join("\n");this.cssNode?this.cssNode.firstChild.textContent=i:((t=document.createElement("style")).id=e,e=document.createTextNode(i),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} .blocklyNonEditableField>rect,`,`${e} .blocklyEditableField>rect {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"fill-opacity: .6;","stroke: none;","}",`${e} .blocklyNonEditableField>text,`,`${e} .blocklyEditableField>text {`,"fill: #000;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #000;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #000;","}",`${e} .blocklyEditableField:not(.blocklyEditing):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;","}"]}},uL={};uL.ConstantProvider=uN,uL.isDynamicShape=nb,uL.isNotch=nO,uL.isPuzzleTab=nC;var uy=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_+"\n"+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++){let 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_(){let e=this.info_.topRow,t=e.elements;this.positionPreviousConnection_(),this.outlinePath_+=sV(e.xPos,this.info_.startY);for(let e=0,i;i=t[e];e++)ur.isLeftRoundedCorner(i)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:ur.isRightRoundedCorner(i)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:ur.isPreviousConnection(i)?this.outlinePath_+=i.shape.pathLeft:ur.isHat(i)?this.outlinePath_+=this.constants_.START_HAT.path:ur.isSpacer(i)&&(this.outlinePath_+=sY("h",i.width));this.outlinePath_+=sY("v",e.height)}drawJaggedEdge_(e){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+sY("v",e.height-this.constants_.JAGGED_TEETH.height)}drawValueInput_(e){let t=e.getLastInput();this.positionExternalValueConnection_(e);let i=nb(t.shape)?t.shape.pathDown(t.height):t.shape.pathDown;this.outlinePath_+=sY("H",t.xPos+t.width)+i+sY("v",e.height-t.connectionHeight)}drawStatementInput_(e){var t=e.getLastInput();if(t){var i=t.xPos+t.notchOffset+t.shape.width;t=t.shape.pathRight+sY("h",-(t.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var o=e.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=sY("H",i)+t+sY("v",o)+this.constants_.INSIDE_CORNERS.pathBottom+sY("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}}drawRightSideRow_(e){this.outlinePath_+=sY("V",e.yPos+e.height)}drawBottom_(){let e=this.info_.bottomRow,t=e.elements;this.positionNextConnection_();let i=0,o="";for(let s=t.length-1,n;n=t[s];s--)ur.isNextConnection(n)?o+=n.shape.pathRight:ur.isLeftSquareCorner(n)?o+=sY("H",e.xPos):ur.isLeftRoundedCorner(n)?o+=this.constants_.OUTSIDE_CORNERS.bottomLeft:ur.isRightRoundedCorner(n)?(o+=this.constants_.OUTSIDE_CORNERS.bottomRight,i=this.constants_.OUTSIDE_CORNERS.rightHeight):ur.isSpacer(n)&&(o+=sY("h",-1*n.width));this.outlinePath_+=sY("V",e.baseline-i),this.outlinePath_+=o}drawLeft_(){var e=this.info_.outputConnection;if(this.positionOutputConnection_(),e){let t=e.connectionOffsetY+e.height;e=nb(e.shape)?e.shape.pathUp(e.height):e.shape.pathUp,this.outlinePath_+=sY("V",t)+e}this.outlinePath_+="z"}drawInternals_(){for(let e=0,t;t=this.info_.rows[e];e++)for(let e=0,i;i=t.elements[e];e++)ur.isInlineInput(i)?this.drawInlineInput_(i):(ur.isIcon(i)||ur.isField(i))&&this.layoutField_(i)}layoutField_(e){let t=e.centerline-e.height/2,i=e.xPos;var o="";this.info_.RTL&&(i=-(i+e.width),e.flipRtl&&(i+=e.width,o="scale(-1 1)")),ur.isIcon(e)?((o=e.icon).setOffsetInBlock(new lt(i,t)),this.info_.isInsertionMarker&&o.hideForInsertionMarker()):((e=e.field.getSvgRoot()).setAttribute("transform","translate("+i+","+t+")"+o),this.info_.isInsertionMarker&&e.setAttribute("display","none"))}drawInlineInput_(e){let t=e.width,i=e.height,o=e.connectionOffsetY,s=e.connectionHeight+o;this.inlinePath_+=sW(e.xPos+e.connectionWidth,e.centerline-i/2)+sY("v",o)+e.shape.pathDown+sY("v",i-s)+sY("h",t-e.connectionWidth)+sY("v",-i)+"z",this.positionInlineInputConnection_(e)}positionInlineInputConnection_(e){let t=e.centerline-e.height/2;if(e.connectionModel){let i=e.xPos+e.connectionWidth+e.connectionOffsetX;this.info_.RTL&&(i*=-1),e.connectionModel.setOffsetInBlock(i,t+e.connectionOffsetY)}}positionStatementInputConnection_(e){let t=e.getLastInput();if(null==t?0:t.connectionModel){let i=e.xPos+e.statementEdge+t.notchOffset;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionExternalValueConnection_(e){let t=e.getLastInput();if(t&&t.connectionModel){let i=e.xPos+e.width;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionPreviousConnection_(){let e=this.info_.topRow;if(e.connection){let t=e.xPos+e.notchOffset;e.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-t:t,0)}}positionNextConnection_(){let e=this.info_.bottomRow;if(e.connection){let t=e.connection,i=t.xPos;t.connectionModel.setOffsetInBlock(this.info_.RTL?-i:i,e.baseline)}}positionOutputConnection_(){if(this.info_.outputConnection){let e=this.info_.startX+this.info_.outputConnection.connectionOffsetX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-e:e,this.info_.outputConnection.connectionOffsetY)}}updateConnectionHighlights(){for(let e of this.info_.rows)for(let t of e.elements){if(!(t instanceof uh))continue;let e=this.drawConnectionHighlightPath(t);e&&(e.style.display=t.highlighted?"":"none")}}drawConnectionHighlightPath(e){let t,i,o=e.connectionModel;e=o.type===c5.INPUT_VALUE||o.type===c5.OUTPUT_VALUE?this.getExpressionConnectionHighlightPath(e):this.getStatementConnectionHighlightPath(e);let s=o.getSourceBlock();return null==(i=(t=s.pathObject).addConnectionHighlight)?void 0:i.call(t,o,e,o.getOffsetInBlock(),s.RTL)}getExpressionConnectionHighlightPath(e){let t="";return nb(e.shape)?t=e.shape.pathDown(e.height):nC(e.shape)&&(t=e.shape.pathDown),sV(0,-(e=this.constants_.TAB_OFFSET_FROM_TOP))+sY("v",e)+t+sY("v",e)}getStatementConnectionHighlightPath(e){if(!nO(e.shape))throw Error("Statement connections should have notch shapes");let t=this.constants_.NOTCH_OFFSET_LEFT-this.constants_.CORNER_RADIUS;return sV(-t,0)+sY("h",t)+e.shape.pathLeft+sY("h",t)}},uD=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 uS(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 u$(this.constants_),this.bottomRow=new uc(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 um(this.constants_);this.inputRows.push(e);var t=this.block_.getIcons();for(let i=0,o;o=t[i];i++){let t=new ug(this.constants_,o);this.isCollapsed&&!o.isShownWhenCollapsed()||e.elements.push(t)}t=void 0;for(let i=0,o;o=this.block_.inputList[i];i++)if(o.isVisible()){this.shouldStartNewRow_(o,t)&&(this.rows.push(e),e=new um(this.constants_),this.inputRows.push(e));for(let t=0,i;i=o.fieldRow[t];t++)e.elements.push(new up(this.constants_,i,o));this.addInput_(o,e),t=o}this.isCollapsed&&(e.hasJaggedEdge=!0,e.elements.push(new uf(this.constants_))),(e.elements.length||e.hasDummyInput)&&this.rows.push(e),this.populateBottomRow_(),this.rows.push(this.bottomRow)}populateTopRow_(){var e=!!this.block_.previousConnection;let t=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!e,i=this.topRow.hasLeftSquareCorner(this.block_)?uO:ub;this.topRow.elements.push(new i(this.constants_)),t?(e=new u_(this.constants_),this.topRow.elements.push(e)):e&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new uR(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0]instanceof hI&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT,i=this.topRow.hasRightSquareCorner(this.block_)?uO:ub,this.topRow.elements.push(new i(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 hI?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new uO(this.constants_)):this.bottomRow.elements.push(new ub(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new uI(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new uO(this.constants_,"right")):this.bottomRow.elements.push(new ub(this.constants_,"right"))}addInput_(e,t){this.isInline&&e instanceof $.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new uT(this.constants_,e)),t.hasInlineInput=!0):e instanceof hI?(t.elements.push(new uA(this.constants_,e)),t.hasStatement=!0):e instanceof $.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new ud(this.constants_,e)),t.hasExternalInput=!0):(e instanceof hm||e instanceof hf)&&(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),null===t.align&&(t.align=e.align)}shouldStartNewRow_(e,t){return!!t&&(t instanceof hf||e instanceof hI||t instanceof hI||(e instanceof $.ValueInput$$module$build$src$core$inputs$value_input||e instanceof hm||t instanceof $.ValueInput$$module$build$src$core$inputs$value_input)&&!this.isInline)}addElemSpacing_(){for(let e=0,t;t=this.rows[e];e++){let e=t.elements;if(t.elements=[],t.startsWithElemSpacer()&&t.elements.push(new uE(this.constants_,this.getInRowSpacing_(null,e[0]))),e.length){for(let i=0;i<e.length-1;i++){t.elements.push(e[i]);let o=this.getInRowSpacing_(e[i],e[i+1]);t.elements.push(new uE(this.constants_,o))}t.elements.push(e[e.length-1]),t.endsWithElemSpacer()&&t.elements.push(new uE(this.constants_,this.getInRowSpacing_(e[e.length-1],null)))}}}getInRowSpacing_(e,t){if(!e&&t&&ur.isStatementInput(t))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(e&&ur.isInput(e)&&!t){if(ur.isExternalInput(e))return this.constants_.NO_PADDING;if(ur.isInlineInput(e))return this.constants_.LARGE_PADDING;if(ur.isStatementInput(e))return this.constants_.NO_PADDING}return e&&ur.isLeftSquareCorner(e)&&t&&(ur.isPreviousConnection(t)||ur.isNextConnection(t))?t.notchOffset:e&&ur.isLeftRoundedCorner(e)&&t&&(ur.isPreviousConnection(t)||ur.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&ur.isField(e)&&0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING}computeBounds_(){let e=0,t=0,i=0;for(let s=0,n;n=this.rows[s];s++){if(n.measure(),t=Math.max(t,n.width),n.hasStatement){let t,i;var o=n.getLastInput();e=Math.max(e,o=n.width-(null!=(i=null==(t=o)?void 0:t.width)?i:0))}i=Math.max(i,n.widthWithConnectedBlocks)}this.statementEdge=e,this.width=t;for(let e=0,t;t=this.rows[e];e++)t.hasStatement&&(t.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(t,i),this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)}alignRowElements_(){for(let t=0,i;i=this.rows[t];t++)if(i.hasStatement)this.alignStatementRow_(i);else{var e=i.width;(e=this.getDesiredRowWidth_(i)-e)>0&&this.addAlignmentPadding_(i,e),ur.isTopOrBottomRow(i)&&(i.widthWithConnectedBlocks=i.width)}}getDesiredRowWidth_(e){return this.width-this.startX}addAlignmentPadding_(e,t){let i=e.getFirstSpacer(),o=e.getLastSpacer();if((e.hasExternalInput||e.hasStatement)&&(e.widthWithConnectedBlocks+=t),e.align===$.Align$$module$build$src$core$inputs$align.LEFT&&o)o.width+=t;else if(e.align===$.Align$$module$build$src$core$inputs$align.CENTRE&&i&&o)i.width+=t/2,o.width+=t/2;else if(e.align===$.Align$$module$build$src$core$inputs$align.RIGHT&&i)i.width+=t;else{if(!o)return;o.width+=t}e.width+=t}alignStatementRow_(e){let t=e.getLastInput();if(t){var i=e.width-t.width,o=this.statementEdge;(i=o-i)>0&&this.addAlignmentPadding_(e,i),i=e.width,o=this.getDesiredRowWidth_(e),t.width+=o-i,t.height=Math.max(t.height,e.height),e.width+=o-i,e.widthWithConnectedBlocks=Math.max(e.width,this.statementEdge+e.connectedBlockWidths)}}addRowSpacing_(){let 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 i=this.getSpacerRowHeight_(e,t);let o=this.getSpacerRowWidth_(e,t);return i=new uC(this.constants_,i,o),e.hasStatement&&(i.followsStatement=!0),t.hasStatement&&(i.precedesStatement=!0),i}getSpacerRowWidth_(e,t){return this.width-this.startX}getSpacerRowHeight_(e,t){return this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){return ur.isSpacer(t)?e.yPos+t.height/2:ur.isBottomRow(e)?(e=e.yPos+e.height-e.descenderHeight,ur.isNextConnection(t)?e+t.height/2:e-t.height/2):ur.isTopRow(e)?ur.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 i=0,o;o=e.elements[i];i++)ur.isSpacer(o)&&(o.height=e.height),o.xPos=t,o.centerline=this.getElemCenterline_(e,o),t+=o.width}finalize_(){let e=0,t=0;for(let i=0,o;o=this.rows[i];i++)o.yPos=t,o.xPos=this.startX,t+=o.height,e=Math.max(e,o.widthWithConnectedBlocks),this.recordElemPositions_(o);if(this.outputConnection&&this.block_.nextConnection){let t=this.block_.nextConnection.targetBlock();t&&(e=Math.max(e,t.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((null==(t=this.outputConnection)?void 0:t.connectionModel)===e)return this.outputConnection;for(let t of this.rows)for(let i of t.elements)if(i instanceof uh&&i.connectionModel===e)return i;return null}},uk=class{constructor(e,t,i){this.connectionHighlights=new WeakMap,this.highlightOffsets=new WeakMap,this.constants=i,this.style=t,this.svgRoot=e,this.svgPath=eZ(li.PATH,{class:"blocklyPath"},this.svgRoot),this.setClass_("blocklyBlock",!0)}setPath(e){this.svgPath.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)")}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?eq(this.svgRoot,e):e0(this.svgRoot,e))}updateHighlighted(e){e?this.setClass_("blocklyHighlighted",!0):this.setClass_("blocklyHighlighted",!1)}updateShadow_(e){e?(this.setClass_("blocklyShadow",!0),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary)):this.setClass_("blocklyShadow",!1)}updateDisabled_(e){this.setClass_("blocklyDisabled",e),this.setClass_("blocklyDisabledPattern",e)}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,i,o){return(i=`translate(${i.x}, ${i.y})`+(o?" scale(-1 1)":""),o=this.connectionHighlights.get(e))?(o.setAttribute("d",t),o.setAttribute("transform",i),o):(t=eZ(li.PATH,{id:e.id,class:"blocklyHighlightedConnectionPath",style:"display: none;",d:t,transform:i},this.svgRoot),this.connectionHighlights.set(e,t),t)}removeConnectionHighlight(e){let t=this.connectionHighlights.get(e);t&&(e2(t),this.connectionHighlights.delete(e))}},uw=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,i){this.constants_.createDom(e,this.name+"-"+t.name,"."+this.getClassName()+"."+t.getClassName(),i)}refreshDom(e,t,i){let 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,i)}dispose(){this.constants_&&this.constants_.dispose()}makeConstants_(){return new uN}makeRenderInfo_(e){return new uD(this,e)}makeDrawer_(e,t){return new uy(e,t)}makePathObject(e,t){return new uk(e,t,this.constants_)}getConstants(){return this.constants_}shouldHighlightConnection(e){return!0}orphanCanConnectAtEnd(e,t,i){return!!hl.getConnectionForOrphanedConnection(e,i===c5.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}render(e){let t=this.makeRenderInfo_(e);t.measure(),this.makeDrawer_(e,t).draw()}},uv={};uv.BottomRow=uc,uv.Connection=uh,uv.ConstantProvider=uN,uv.Drawer=uy,uv.ExternalValueInput=ud,uv.Field=up,uv.Hat=u_,uv.Icon=ug,uv.InRowSpacer=uE,uv.InlineInput=uT,uv.InputConnection=uu,uv.InputRow=um,uv.JaggedEdge=uf,uv.Measurable=ul,uv.NextConnection=uI,uv.OutputConnection=uS,uv.PathObject=uk,uv.PreviousConnection=uR,uv.RenderInfo=uD,uv.Renderer=uw,uv.RoundCorner=ub,uv.Row=ua,uv.SpacerRow=uC,uv.SquareCorner=uO,uv.StatementInput=uA,uv.TopRow=u$,uv.Types=ur,uv.init=n$,uv.register=nA,uv.unregister=function(e){eh(D.RENDERER,e)};var uM=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())&&e0(e,t),(t=this.theme.getClassName())&&eq(e,t));for(let e=0,t;t=this.subscribedWorkspaces[e];e++)t.refreshTheme();for(let[i,o]of this.componentDB)for(let s of o){e=s.element,t=s.propertyName;let o=this.theme&&this.theme.getComponentStyle(i);e.style.setProperty(t,o||"")}for(let e of this.subscribedWorkspaces)e.hideChaff()}subscribeWorkspace(e){this.subscribedWorkspaces.push(e)}unsubscribeWorkspace(e){if(!tm(this.subscribedWorkspaces,e))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.")}subscribe(e,t,i){this.componentDB.has(t)||this.componentDB.set(t,[]),this.componentDB.get(t).push({element:e,propertyName:i}),t=this.theme&&this.theme.getComponentStyle(t),e.style.setProperty(i,t||"")}unsubscribe(e){if(e)for(let[t,i]of this.componentDB){for(let t=i.length-1;t>=0;t--)i[t].element===e&&i.splice(t,1);i.length||this.componentDB.delete(t)}}dispose(){this.subscribedWorkspaces.length=0,this.componentDB.clear()}},uP="VARIABLE_DYNAMIC",uB={CATEGORY_NAME:uP};uB.flyoutCategory=nk,uB.flyoutCategoryBlocks=nv,uB.internalFlyoutCategory=nD,uB.onCreateVariableButtonClick_Colour=ny,uB.onCreateVariableButtonClick_Number=nL,uB.onCreateVariableButtonClick_String=nN;var ux=class{canConnect(e,t,i,o){return this.canConnectWithReason(e,t,i,o)===hl.CAN_CONNECT}canConnectWithReason(e,t,i,o){let s=this.doSafetyChecks(e,t);return s!==hl.CAN_CONNECT?s:this.doTypeChecks(e,t)?i&&!this.doDragChecks(e,t,o||0)?hl.REASON_DRAG_CHECKS_FAILED:hl.CAN_CONNECT:hl.REASON_CHECKS_FAILED}getErrorMessage(e,t,i){switch(e){case hl.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case hl.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case hl.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case hl.REASON_TARGET_NULL:return"Target connection is null.";case hl.REASON_CHECKS_FAILED:return"Connection checks failed. "+(t+" expected "+t.getCheck())+", found "+i.getCheck();case hl.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case hl.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case hl.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){let i,o,s;return e&&t?(e.isSuperior()?(i=e.getSourceBlock(),o=t.getSourceBlock(),s=t):(o=e.getSourceBlock(),i=t.getSourceBlock(),s=e,e=t),i===o?hl.REASON_SELF_CONNECTION:s.type!==hu[e.type]?hl.REASON_WRONG_TYPE:i.workspace!==o.workspace?hl.REASON_DIFFERENT_WORKSPACES:i.isShadow()&&!o.isShadow()?hl.REASON_SHADOW_PARENT:s.type===c5.OUTPUT_VALUE&&o.previousConnection&&o.previousConnection.isConnected()||s.type===c5.PREVIOUS_STATEMENT&&o.outputConnection&&o.outputConnection.isConnected()?hl.REASON_PREVIOUS_AND_OUTPUT:hl.CAN_CONNECT):hl.REASON_TARGET_NULL}doTypeChecks(e,t){if(e=e.getCheck(),t=t.getCheck(),!e||!t)return!0;for(let i=0;i<e.length;i++)if(t.includes(e[i]))return!0;return!1}doDragChecks(e,t,i){if(e.distanceFrom(t)>i||t.getSourceBlock().isInsertionMarker())return!1;switch(t.type){case c5.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case c5.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case c5.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case c5.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!rj.includes(t)}canConnectToPrevious_(e,t){return!(e.targetConnection||rj.includes(t))&&(!t.targetConnection||!!(e=t.targetBlock()).isInsertionMarker()&&!e.getPreviousBlock())}};ea(D.CONNECTION_CHECKER,y,ux);var uF=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 un,this.readOnly=!1,this.potentialVariableMap=null,this.id=eD(),tn(this),this.options=e||new c9({}),this.RTL=!!this.options.RTL,this.horizontalLayout=!!this.options.horizontalLayout,this.toolboxPosition=this.options.toolboxPosition,this.connectionChecker=new(eE(D.CONNECTION_CHECKER,this.options,!0))(this),this.variableMap=new(this.getVariableMapClass())(this),this.setIsReadOnly(this.options.readOnly)}dispose(){this.listeners.length=0,this.clear(),tr(this)}sortObjects(e,t){let i=e=>({getBoundingRectangle:()=>{let t=e.getRelativeToSurfaceXY();return new lo(t.y,t.y,t.x,t.x)},moveBy:()=>{}});return this.sortByOrigin(i(e),i(t))}sortByOrigin(e,t){let i=Math.sin(i2(uF.SCAN_ANGLE))*(this.RTL?-1:1);return e=e.getBoundingRectangle().getOrigin(),t=t.getBoundingRectangle().getOrigin(),e.y+i*e.x-(t.y+i*t.x)}addTopBlock(e){this.topBlocks.push(e)}removeTopBlock(e){if(!tm(this.topBlocks,e))throw Error("Block not present in workspace's list of top-most blocks.")}getTopBlocks(e=!1){let t=[].concat(this.topBlocks);return e&&t.length>1&&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){tm(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&&e.length>1&&e.sort(this.sortObjects.bind(this)),e.filter(e=>!e.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(!tm(this.topComments,e))throw Error("Comment not present in workspace's list of top-most comments.");this.commentDB.delete(e.id)}getTopComments(e=!1){let t=[].concat(this.topComments);return e&&t.length>1&&t.sort(this.sortObjects.bind(this)),t}getAllBlocks(e=!1){if(e){var t=this.getTopBlocks(!0);e=[];for(let i=0;i<t.length;i++)e.push(...t[i].getDescendants(!0))}else for(e=this.getTopBlocks(!1),t=0;t<e.length;t++)e.push(...e[t].getChildren(!1));return e.filter(e=>!e.isInsertionMarker())}clear(){this.isClearing=!0;try{let e=$.getGroup$$module$build$src$core$events$utils();for(e||$.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();$.setGroup$$module$build$src$core$events$utils(e),this.isFlyout||this.variableMap.clear(),this.potentialVariableMap&&this.potentialVariableMap.clear()}finally{this.isClearing=!1}}renameVariableById(e,t){ih("Blockly.Workspace.renameVariableById","v12","v13","Blockly.Workspace.getVariableMap().renameVariable"),(e=this.variableMap.getVariableById(e))&&this.variableMap.renameVariable(e,t)}createVariable(e,t,i){return ih("Blockly.Workspace.createVariable","v12","v13","Blockly.Workspace.getVariableMap().createVariable"),this.variableMap.createVariable(e,null!=t?t:void 0,null!=i?i:void 0)}getVariableUsesById(e){return ih("Blockly.Workspace.getVariableUsesById","v12","v13","Blockly.Workspace.getVariableMap().getVariableUsesById"),iD(this,e)}deleteVariableById(e){ih("Blockly.Workspace.deleteVariableById","v12","v13","Blockly.Workspace.getVariableMap().deleteVariable");let t=this.variableMap.getVariableById(e);t?$.deleteVariable$$module$build$src$core$variables(this,t):console.warn(`Can't delete non-existent variable: ${e}`)}getVariable(e,t){return ih("Blockly.Workspace.getVariable","v12","v13","Blockly.Workspace.getVariableMap().getVariable"),this.variableMap.getVariable(e,t)}getVariableById(e){return ih("Blockly.Workspace.getVariableById","v12","v13","Blockly.Workspace.getVariableMap().getVariableById"),this.variableMap.getVariableById(e)}getVariablesOfType(e){return ih("Blockly.Workspace.getVariablesOfType","v12","v13","Blockly.Workspace.getVariableMap().getVariablesOfType"),this.variableMap.getVariablesOfType(null!=e?e:"")}getAllVariables(){return ih("Blockly.Workspace.getAllVariables","v12","v13","Blockly.Workspace.getVariableMap().getAllVariables"),this.variableMap.getAllVariables()}getAllVariableNames(){return ih("Blockly.Workspace.getAllVariableNames","v12","v13","Blockly.Workspace.getVariableMap().getAllVariables"),this.variableMap.getAllVariables().map(e=>e.getName())}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?(void 0!==this.options.maxInstances[e]?this.options.maxInstances[e]:1/0)-this.getBlocksByType(e,!1).length:1/0}isCapacityAvailable(e){if(!this.hasBlockLimits())return!0;let t=0;for(let i in e){if(e[i]>this.remainingCapacityOfType(i))return!1;t+=e[i]}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_,i=e?this.undoStack_:this.redoStack_;let o=t.pop();if(o){for(var s=[o];t.length&&o.group&&o.group===t[t.length-1].group;){let e=t.pop();e&&s.push(e)}for(t=0;t<s.length;t++)i.push(s[t]);$.setRecordUndo$$module$build$src$core$events$utils(!1);try{for(i=0;i<s.length;i++)s[i].run(e)}finally{$.setRecordUndo$$module$build$src$core$events$utils(!0)}}}clearUndo(){this.undoStack_.length=0,this.redoStack_.length=0,eK()}addChangeListener(e){return this.listeners.push(e),e}removeChangeListener(e){tm(this.listeners,e)}fireChangeListener(e){if(e.recordUndo)for(this.undoStack_.push(e),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&this.MAX_UNDO>=0;)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 null!=(t=this.commentDB.get(e))?t:null}allInputsFilled(e){let t=this.getTopBlocks(!1);for(let i=0;i<t.length;i++)if(!t[i].allInputsFilled(e))return!1;return!0}getPotentialVariableMap(){return this.potentialVariableMap}createPotentialVariableMap(){this.potentialVariableMap=new(this.getVariableMapClass())(this,!0)}getVariableMap(){return this.variableMap}setVariableMap(e){this.variableMap=e}getProcedureMap(){return this.procedureMap}getRootWorkspace(){let e=null,t=this.options.parentWorkspace;return this.isFlyout?t&&t.options&&(e=t.options.parentWorkspace):t&&(e=t),e}static getById(e){return to(e)}static getAll(){return ts()}getVariableMapClass(){let e=eE(D.VARIABLE_MAP,this.options,!0);if(!e)throw Error("No variable map is registered.");return e}isReadOnly(){return this.readOnly}setIsReadOnly(e){this.readOnly=e,this.options.readOnly=e}};uF.SCAN_ANGLE=3;var uG=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 i=new globalThis.Audio}catch(e){return}for(let t=0;t<e.length;t++){let s=e[t],n=s.match(/\.(\w+)$/);if(n&&i.canPlayType("audio/"+n[1])){var o=new globalThis.Audio(s);break}}o&&this.sounds.set(t,o)}}preload(){for(let e of this.sounds.values()){e.volume=.01;let t=e.play();if(void 0!==t?t.then(e.pause).catch(function(){}):e.pause(),rO||rA)break}}play(e,t){if(!this.muted){var i=this.sounds.get(e);i?(e=new Date,null!==this.lastSound&&e.getTime()-this.lastSound.getTime()<100||(this.lastSound=e,(i=rO||rC?i:i.cloneNode()).volume=void 0===t?1:t,i.play())):this.parentWorkspace&&this.parentWorkspace.getAudioManager().play(e,t)}}setMuted(e){this.muted=e}getMuted(){return this.muted}},uH=class extends uF{constructor(e){let t;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.keyboardMoveInProgress=this.keyboardAccessibilityMode=!1,this.topBoundedElements=[],this.dragTargetAreas=[],this.zoomControls_=this.layerManager=null,this.navigator=new hJ,this.metricsManager=new(eE(D.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager),this.setMetrics=e.setMetrics||uH.setTopLevelWorkspaceMetrics,this.componentManager=new r6,this.connectionDBList=cj.init(this.connectionChecker),this.audioManager=new uG(e.parentWorkspace),this.grid=this.options.gridPattern?new h4(this.options.gridPattern,e.gridOptions):null,this.markerManager=new ue(this),ap&&iu&&this.registerToolboxCategoryCallback(ah,iu),uB&&nD&&this.registerToolboxCategoryCallback(uP,nD),dY&&nE&&(this.registerToolboxCategoryCallback(dX,nE),this.addChangeListener(nf)),this.addChangeListener(this.variableChangeCallback.bind(this)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new uM(this,this.options.theme||c8),this.themeManager_.subscribeWorkspace(this),this.renderer=n$(this.options.renderer||"geras",this.getTheme(),null!=(t=this.options.rendererOverrides)?t:void 0),this.cachedParentSvgSize=new ls(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}getMarker(e){return this.markerManager.getMarker(e)}getCursor(){return this.markerManager.getCursor()}getRenderer(){return this.renderer}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(e){e||(e=c8),this.themeManager_.setTheme(e)}refreshTheme(){if(this.svgGroup_){var e=null===this.options.parentWorkspace;this.renderer.refreshDom(this.svgGroup_,this.getTheme(),e?this.getInjectionDiv():void 0)}this.updateBlockStyles(this.getAllBlocks(!1).filter(e=>!!e.getStyleName())),this.refreshToolboxSelection(),this.toolbox&&this.toolbox.refreshTheme(),this.isVisible()&&this.setVisible(!0),eH(e=new(ej(rL.THEME_CHANGE))(this.getTheme().name,this.id))}updateBlockStyles(e){for(let t=0,i;i=e[t];t++){let e=i.getStyleName();e&&i.setStyle(e)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){let 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,i=0,o=1;(this.getCanvas().contains(e)||this.getBubbleCanvas().contains(e))&&(o=this.scale);do{let s=tL(e);(e===this.getCanvas()||e===this.getBubbleCanvas())&&(o=1),t+=s.x*o,i+=s.y*o,e=e.parentNode}while(e&&e!==this.getParentSvg()&&e!==this.getInjectionDiv())return new lt(t,i)}getCachedParentSvgSize(){let e=this.cachedParentSvgSize;return new ls(e.width,e.height)}getOriginOffsetInPixels(){return ty(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=null!=t?t:null),this.svgGroup_=eZ(li.G,{class:"blocklyWorkspace",id:this.id}),t&&t2(this.svgGroup_,aD.LABEL,$.Msg$$module$build$src$core$msg.WORKSPACE_ARIA_LABEL),e&&(this.svgBackground_=eZ(li.RECT,{height:"100%",width:"100%",class:e},this.svgGroup_),"blocklyMainBackground"===e&&this.grid?this.svgBackground_.style.fill="var(--blocklyGridPattern)":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill")),this.layerManager=new h8(this),this.svgBlockCanvas_=this.layerManager.getBlockLayer(),this.svgBubbleCanvas_=this.layerManager.getBubbleLayer(),this.isFlyout||(eb(this.svgGroup_,"pointerdown",this,this.onMouseDown,!1),this.dummyWheelListener=()=>{},document.body.addEventListener("wheel",this.dummyWheelListener),eb(this.svgGroup_,"wheel",this,this.onMouseWheel)),this.options.hasCategories&&(this.toolbox=new(eE(D.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=eE(D.CURSOR,this.options))&&this.markerManager.setCursor(new e(this)),e=null===this.options.parentWorkspace,this.renderer.createDom(this.svgGroup_,this.getTheme(),e?this.getInjectionDiv():void 0),$.getFocusManager$$module$build$src$core$focus_manager().registerTree(this,!!this.injectionDiv||this.isFlyout),this.svgGroup_}dispose(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&e2(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.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){let e=this.getParentSvg();e&&e.parentNode&&e2(e.parentNode)}this.resizeHandlerWrapper&&(eO(this.resizeHandlerWrapper),this.resizeHandlerWrapper=null),this.dummyWheelListener&&(document.body.removeEventListener("wheel",this.dummyWheelListener),this.dummyWheelListener=null),$.getFocusManager$$module$build$src$core$focus_manager().isRegistered(this)&&$.getFocusManager$$module$build$src$core$focus_manager().unregisterTree(this)}addTrashcan(){this.trashcan=uH.newTrashcan(this);let 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 lN(this);let e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}copyOptionsForFlyout(){return new c9({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,plugins:this.options.plugins,modalInputs:this.options.modalInputs,move:{scrollbars:!0}})}addFlyout(e){let t=this.copyOptionsForFlyout();return t.toolboxPosition=this.options.toolboxPosition,this.flyout=this.horizontalLayout?new(eE(D.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(eE(D.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();let e=this.componentManager.getComponents(r6.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),i=[];for(let o=0,s;s=e[o];o++){s.position(t,i);let e=s.getBoundingRectangle();e&&i.push(e)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations()}updateScreenCalculationsIfScrolled(){let e=tk();lt.equals(this.lastRecordedPageScroll,e)||(this.lastRecordedPageScroll=e,this.updateScreenCalculations())}getLayerManager(){return this.layerManager}getCanvas(){return this.layerManager.getBlockLayer()}setCachedParentSvgSize(e,t){let i=this.getParentSvg();null!=e&&(this.cachedParentSvgSize.width=e,i.setAttribute("data-cached-width",`${e}`)),null!=t&&(this.cachedParentSvgSize.height=t,i.setAttribute("data-cached-height",`${t}`))}getBubbleCanvas(){return this.layerManager.getBubbleLayer()}getParentSvg(){if(!this.cachedParentSvg){let e=this.svgGroup_;for(;e;){if("svg"===e.tagName){this.cachedParentSvg=e;break}e=e.parentNode}}return this.cachedParentSvg}maybeFireViewportChangeEvent(){if(eX()){var e=this.scale,t=-this.scrollY,i=-this.scrollX;if(!(e===this.oldScale&&1>Math.abs(t-this.oldTop)&&1>Math.abs(i-this.oldLeft))){var o=new(ej(rL.VIEWPORT_CHANGE))(t,i,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=t,this.oldLeft=i,eH(o)}}}translate(e,t){let i,o;null==(i=this.layerManager)||i.translateLayers(new lt(e,t),this.scale),null==(o=this.grid)||o.moveTo(e,t),this.maybeFireViewportChangeEvent()}getWidth(){let 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(){let e=this.getAllBlocks(!1);for(let t=e.length-1;t>=0;t--)e[t].queueRender();this.getTopBlocks().flatMap(e=>e.getDescendants(!1)).filter(e=>e.isInsertionMarker()).forEach(e=>e.queueRender())}highlightBlock(e,t){if(void 0===t){for(let e=0,t;t=this.highlightedBlocks[e];e++)t.setHighlighted(!1);this.highlightedBlocks.length=0}(e=e?this.getBlockById(e):null)&&((t=void 0===t||t)?this.highlightedBlocks.includes(e)||this.highlightedBlocks.push(e):tm(this.highlightedBlocks,e),e.setHighlighted(t))}variableChangeCallback(e){switch(e.type){case rL.VAR_CREATE:case rL.VAR_DELETE:case rL.VAR_RENAME:case rL.VAR_TYPE_CHANGE:this.refreshToolboxSelection()}}refreshToolboxSelection(){let e=this.isFlyout?this.targetWorkspace:this;e&&!e.currentGesture_&&e.toolbox&&e.toolbox.getFlyout()&&e.toolbox.refreshSelection()}recordDragTargets(){let e=this.componentManager.getComponents(r6.Capability.DRAG_TARGET,!0);this.dragTargetAreas=[];for(let t=0,i;i=e[t];t++){let e=i.getClientRect();e&&this.dragTargetAreas.push({component:i,clientRect:e})}}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,i;i=this.dragTargetAreas[t];t++)if(i.clientRect.contains(e.clientX,e.clientY))return i.component;return null}onMouseDown(e){let t=this.getGesture(e);t&&t.handleWsStart(e,this)}startDrag(e,t){sr(this,e,t)}moveDrag(e){return sl(this,e)}setKeyboardMoveInProgress(e){this.keyboardMoveInProgress=e}isDragging(){return this.keyboardMoveInProgress||null!==this.currentGesture_&&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(){let e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){let e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollVertically())}onMouseWheel(e){if(h6.inProgress())e.preventDefault(),e.stopPropagation();else{var t=this.options.zoomOptions&&this.options.zoomOptions.wheel,i=this.options.moveOptions&&this.options.moveOptions.wheel;if(t||i){var o=eL(e);if(V)var s=e.metaKey;t&&(e.ctrlKey||s||!i)?(o=-o.y/50,t=eN(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(t.x,t.y,o)):(t=this.scrollX-o.x,i=this.scrollY-o.y,e.shiftKey&&!o.x&&(t=this.scrollX-o.y,i=this.scrollY),this.scroll(t,i)),e.preventDefault()}}}getBlocksBoundingBox(){let e=this.getTopBoundedElements();if(!e.length)return new lo(0,0,0,0);let t=e[0].getBoundingRectangle();for(let o=1;o<e.length;o++){var i=e[o];i.isInsertionMarker&&i.isInsertionMarker()||((i=i.getBoundingRectangle()).top<t.top&&(t.top=i.top),i.bottom>t.bottom&&(t.bottom=i.bottom),i.left<t.left&&(t.left=i.left),i.right>t.right&&(t.right=i.right))}return t}cleanUp(){this.setResizesEnabled(!1),$.setGroup$$module$build$src$core$events$utils(!0);var e=this.getTopBlocks(!0),t=e.filter(e=>e.isMovable());let i=e.filter(e=>!e.isMovable()).map(e=>e.getBoundingRectangle());e=function(e){for(let t of i)if(e.intersects(t))return t;return null};var o=0;let s=this.renderer.getConstants().MIN_BLOCK_HEIGHT;for(let i of t){for(t=i.getBoundingRectangle(),i.moveBy(-t.left,o-t.top,["cleanup"]),i.snapToGrid(),o=e(t=i.getBoundingRectangle());null!=o;)o=o.top+o.getHeight()+s,i.moveBy(0,o-t.top,["cleanup"]),i.snapToGrid(),o=e(t=i.getBoundingRectangle());o=i.getRelativeToSurfaceXY().y+i.getHeightWidth().height+s}$.setGroup$$module$build$src$core$events$utils(!1),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.isReadOnly()&&!this.isFlyout){var t=cN.registry.getContextMenuOptions({workspace:this,focusedNode:this},e);this.configureContextMenu&&this.configureContextMenu(t,e);var i=e instanceof PointerEvent?new lt(e.clientX,e.clientY):tv(this,new lt(5,5));o9(e,t,this.RTL,this,i)}}updateToolbox(e){if(e=tB(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(tG(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():(ta(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(e,t,i){i=Math.pow(this.options.zoomOptions.scaleSpeed,i);let o=this.scale*i;if(this.scale!==o){o>this.options.zoomOptions.maxScale?i=this.options.zoomOptions.maxScale/this.scale:o<this.options.zoomOptions.minScale&&(i=this.options.zoomOptions.minScale/this.scale);var s=this.getCanvas().getCTM(),n=this.getParentSvg().createSVGPoint();n.x=e,n.y=t,e=(n=n.matrixTransform(s.inverse())).x,t=n.y,s=s.translate(e*(1-i),t*(1-i)).scale(i),this.scrollX=s.e,this.scrollY=s.f,this.setScale(o)}}zoomCenter(e){let t;var i=this.getMetrics();this.flyout?(t=i.svgWidth?i.svgWidth/2:0,i=i.svgHeight?i.svgHeight/2:0):(t=i.viewWidth/2+i.absoluteLeft,i=i.viewHeight/2+i.absoluteTop),this.zoom(t,i,e)}zoomToFit(){if(this.isMovable()){var e=this.getMetrics(),t=e.viewWidth;e=e.viewHeight;var i=this.getBlocksBoundingBox(),o=i.right-i.left+40;if(i=i.bottom-i.top+40,o){this.flyout&&(this.horizontalLayout?(e+=this.flyout.getHeight(),i+=this.flyout.getHeight()/this.scale):(t+=this.flyout.getWidth(),o+=this.flyout.getWidth()/this.scale)),t/=o,e/=i,$.disable$$module$build$src$core$events$utils();try{this.setScale(Math.min(t,e)),this.scrollCenter()}finally{$.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(){eq(this.getCanvas(),"blocklyCanvasTransitioning"),eq(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}endCanvasTransition(){e0(this.getCanvas(),"blocklyCanvasTransitioning"),e0(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}scrollCenter(){if(this.isMovable()){var e=this.getMetrics(),t=(e.scrollWidth-e.viewWidth)/2,i=(e.scrollHeight-e.viewHeight)/2;t=-t-e.scrollLeft,i=-i-e.scrollTop,this.scroll(t,i)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}centerOnBlock(e,t){if(this.isMovable()){var i=e?this.getBlockById(e):null;if(i){e=i.getRelativeToSurfaceXY(),i=t?{height:i.height,width:i.width}:i.getHeightWidth();var o=this.scale;t=(e.x+(this.RTL?-1:1)*i.width/2)*o,e=(e.y+i.height/2)*o,i=this.getMetrics(),this.scroll(-(t-i.viewWidth/2),-(e-i.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.scale}getAbsoluteScale(){let e=e=>{if(e.isFlyout){let t,i=null==(t=e.targetWorkspace)?void 0:t.getFlyout();if(i instanceof h0)return i.getFlyoutScale()}return e.getScale()},t=(i,o)=>i.options.parentWorkspace&&i.options.parentWorkspace.getSvgGroup().contains(i.getSvgGroup())?t(i.options.parentWorkspace,o*e(i)):o*e(i);return t(this,1)}scroll(e,t){this.hideChaff(!0);let i=this.getMetrics();e=Math.min(e,-i.scrollLeft),t=Math.min(t,-i.scrollTop);let o=i.scrollTop+Math.max(0,i.scrollHeight-i.viewHeight);e=Math.max(e,-(i.scrollLeft+Math.max(0,i.scrollWidth-i.viewWidth))),t=Math.max(t,-o),this.scrollX=e,this.scrollY=t,this.scrollbar&&this.scrollbar.set(-(e+i.scrollLeft),-(t+i.scrollTop),!1),e+=i.absoluteLeft,t+=i.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)}getTopComments(e=!1){return super.getTopComments(e)}getCommentById(e){return super.getCommentById(e)}getRootWorkspace(){return super.getRootWorkspace()}addTopBoundedElement(e){this.topBoundedElements.push(e)}removeTopBoundedElement(e){tm(this.topBoundedElements,e)}getTopBoundedElements(e=!1){let t=[].concat(this.topBoundedElements);return e&&t.sort(this.sortByOrigin.bind(this)),t}setResizesEnabled(e){let 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("function"!=typeof t)throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks.set(e,t)}getButtonCallback(e){let t;return null!=(t=this.flyoutButtonCallbacks.get(e))?t:null}removeButtonCallback(e){this.flyoutButtonCallbacks.delete(e)}registerToolboxCategoryCallback(e,t){if("function"!=typeof t)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){let t;if(this.keyboardMoveInProgress)return e.preventDefault(),e.stopPropagation(),null;let i="pointerdown"===e.type;return i&&(null==(t=this.currentGesture_)?0:t.hasStarted())&&(console.warn("Tried to start the same gesture twice."),this.currentGesture_.cancel()),!this.currentGesture_&&i&&(this.currentGesture_=new h6(e,this)),this.currentGesture_}clearGesture(){this.currentGesture_=null}cancelCurrentGesture(){this.currentGesture_&&this.currentGesture_.cancel()}getAudioManager(){return this.audioManager}getGrid(){return this.grid}hideChaff(e=!1){oy(),o1(this),ou(),this.hideComponents(e)}hideComponents(e=!1){this.getComponentManager().getComponents(r6.Capability.AUTOHIDEABLE,!0).forEach(t=>t.autoHide(e))}static setTopLevelWorkspaceMetrics(e){let t=this.getMetrics();"number"==typeof e.x&&(this.scrollX=-(t.scrollLeft+(t.scrollWidth-t.viewWidth)*e.x)),"number"==typeof e.y&&(this.scrollY=-(t.scrollTop+(t.scrollHeight-t.viewHeight)*e.y)),this.translate(this.scrollX+t.absoluteLeft,this.scrollY+t.absoluteTop)}addClass(e){this.injectionDiv&&eq(this.injectionDiv,e)}removeClass(e){this.injectionDiv&&e0(this.injectionDiv,e)}setIsReadOnly(e){super.setIsReadOnly(e),e?this.addClass("blocklyReadOnly"):this.removeClass("blocklyReadOnly")}scrollBoundsIntoView(e,t=10){if(!h6.inProgress()){var i=this.getScale(),o=this.getMetricsManager().getViewMetrics(!0);if(o=new lo(o.top,o.top+o.height,o.left,o.left+o.width),!(e.left>=o.left&&e.top>=o.top&&e.right<=o.right&&e.bottom<=o.bottom)){e=e.clone(),e.top-=t,e.bottom+=t,e.left-=t,e.right+=t;var s=t=0;e.left<o.left?t=this.RTL?Math.min(o.left-e.left,o.right-e.right):o.left-e.left:e.right>o.right&&(t=this.RTL?o.right-e.right:Math.max(o.right-e.right,o.left-e.left)),e.top<o.top?s=o.top-e.top:e.bottom>o.bottom&&(s=Math.max(o.bottom-e.bottom,o.top-e.top)),this.scroll(this.scrollX+t*i,this.scrollY+s*i)}}}getFocusableElement(){return this.svgGroup_}getFocusableTree(){return this.isMutator&&this.options.parentWorkspace||this}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getRootFocusableNode(){return this}getRestoredFocusableNode(e){let t;return e?null:null!=(t=this.getTopBlocks(!0)[0])?t:null}getNestedTrees(){let e=this.getAllBlocks().map(e=>e.getIcons()).flat().filter(e=>e instanceof $.MutatorIcon$$module$build$src$core$icons$mutator_icon&&e.bubbleIsVisible()).map(e=>{let t;return null==(t=e.getBubble())?void 0:t.getWorkspace()}).filter(e=>!!e),t=this.getFlyout(!0);return t&&e.push(t.getWorkspace()),e}searchForWorkspaceComment(e){for(let t of this.getTopComments())if(t instanceof cW&&t.canBeFocused()&&t.getFocusableElement().id===e)return t}lookUpFocusableNode(e){let t=null==(o=this.targetWorkspace)?void 0:o.getFlyout();if(this.isFlyout&&t){for(var i of t.getContents())if(te(o=i.getElement())&&o.canBeFocused()&&o.getFocusableElement().id===e)return o}if(i=e.indexOf("_field_"),o=e.indexOf("_connection_"),-1!==i){var o,s,n=e.substring(0,i);if(n=this.getBlockById(n)){for(var r of n.getFields())if(r.canBeFocused()&&r.getFocusableElement().id===e)return r}return null}if(-1!==o){if(n=e.substring(0,o),n=this.getBlockById(n)){for(let t of n.getConnections_(!0))if(t.id===e)return t}return null}if(-1!==(r=Math.max(e.indexOf(cB),e.indexOf(cM),e.indexOf(cF)))&&(r=e.substring(0,r),r=this.searchForWorkspaceComment(r)))return e.indexOf(cB)>-1?r.getEditorFocusableNode():null!=(s=r.view.getCommentBarButtons().find(t=>t.getFocusableElement().id.includes(e)))?s:null;if((s=this.getAllBlocks(!1).find(t=>t.getFocusableElement().id===e))||(s=this.searchForWorkspaceComment(e)))return s;for(n of s=this.getAllBlocks().map(e=>e.getIcons()).flat()){if(n.canBeFocused()&&n.getFocusableElement().id===e)return n;if(i1(n)&&(s=n.getBubble())&&s.canBeFocused()&&s.getFocusableElement().id===e)return s}return null}onTreeFocus(e,t){}onTreeBlur(e){if(this.isFlyout&&this.targetWorkspace&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()){var t=this.targetWorkspace.getFlyout(),i=this.targetWorkspace.getToolbox();i&&e===i||(i&&i.clearSelection(),t&&nl(t)&&t.autoHide(!1))}}getNavigator(){return this.navigator}setNavigator(e){this.navigator=e}},uU={};uU.WorkspaceSvg=uH,uU.resizeSvgContents=function(e){e.resizeContents()};var uW=class extends rQ{constructor(e){super(),this.isBlank=void 0===e,e&&(this.varId=e.getId(),this.workspaceId=e.getWorkspace().id)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new uW)).varId=e.varId,t}},uV=class extends uW{constructor(e){super(e),this.type=rL.VAR_CREATE,e&&(this.varType=e.getType(),this.varName=e.getName())}toJson(){let e=super.toJson();if(void 0===this.varType)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,i){return(t=super.fromJson(e,t,null!=i?i:new uV)).varType=e.varType,t.varName=e.varName,t}run(e){var 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");t=t.getVariableMap(),e?t.createVariable(this.varName,this.varType,this.varId):(e=t.getVariableById(this.varId))&&t.deleteVariable(e)}};ea(D.EVENT,rL.VAR_CREATE,uV);var uK=class{constructor(e,t,i,o){this.workspace=e,this.name=t,this.type=i||"",this.id=o||eD()}getId(){return this.id}getName(){return this.name}setName(e){return this.name=e,this}getType(){return this.type}setType(e){return this.type=e,this}getWorkspace(){return this.workspace}save(){let e={name:this.getName(),id:this.getId()},t=this.getType();return t&&(e.type=t),e}static load(e,t){e=new this(t,e.name,e.type,e.id),t.getVariableMap().addVariable(e),eH(new(ej(rL.VAR_CREATE))(e))}};ea(D.VARIABLE_MODEL,y,uK);var uX=class extends uW{constructor(e){super(e),this.type=rL.VAR_DELETE,e&&(this.varType=e.getType(),this.varName=e.getName())}toJson(){let e=super.toJson();if(void 0===this.varType)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,i){return(t=super.fromJson(e,t,null!=i?i:new uX)).varType=e.varType,t.varName=e.varName,t}run(e){var 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");t=t.getVariableMap(),e?(e=t.getVariableById(this.varId))&&t.deleteVariable(e):t.createVariable(this.varName,this.varType,this.varId)}};ea(D.EVENT,rL.VAR_DELETE,uX);var uY=class extends uW{constructor(e,t){super(e),this.type=rL.VAR_RENAME,e&&(this.oldName=e.getName(),this.newName=void 0===t?"":t)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new uY)).oldName=e.oldName,t.newName=e.newName,t}run(e){var 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");let i=(t=t.getVariableMap()).getVariableById(this.varId);e?i&&t.renameVariable(i,this.newName):i&&t.renameVariable(i,this.oldName)}};ea(D.EVENT,rL.VAR_RENAME,uY);var uz=class{constructor(e,t=!1){this.workspace=e,this.potentialMap=t,this.variableMap=new Map}clear(){for(let e of this.variableMap.values())for(let t of e.values())this.deleteVariable(t);if(0!==this.variableMap.size)throw Error("Non-empty variable map")}renameVariable(e,t){if(e.getName()===t)return e;var i=e.getType();i=this.getVariable(t,i);let o=this.workspace.getAllBlocks(!1),s="";this.potentialMap||(s=$.getGroup$$module$build$src$core$events$utils())||$.setGroup$$module$build$src$core$events$utils(!0);try{i&&i.getId()!==e.getId()?this.renameVariableWithConflict(e,t,i,o):this.renameVariableAndUses(e,t,o)}finally{this.potentialMap||$.setGroup$$module$build$src$core$events$utils(s)}return e}changeVariableType(e,t){var i;let o;return null==(i=this.variableMap.get(e.getType()))||i.delete(e.getId()),e.setType(t),(i=null!=(o=this.variableMap.get(t))?o:new Map).set(e.getId(),e),this.variableMap.has(t)||this.variableMap.set(t,i),e}renameVariableById(e,t){ih("VariableMap.renameVariableById","v12","v13","VariableMap.renameVariable");let i=this.getVariableById(e);if(!i)throw Error("Tried to rename a variable that didn't exist. ID: "+e);this.renameVariable(i,t)}renameVariableAndUses(e,t,i){for(this.potentialMap||eH(new(ej(rL.VAR_RENAME))(e,t)),e.setName(t),t=0;t<i.length;t++)i[t].updateVarName(e)}renameVariableWithConflict(e,t,i,o){let s,n=e.getType(),r=i.getName();for(t!==r&&this.renameVariableAndUses(i,t,o),t=0;t<o.length;t++)o[t].renameVarById(e.getId(),i.getId());this.potentialMap||eH(new(ej(rL.VAR_DELETE))(e)),null==(s=this.variableMap.get(n))||s.delete(e.getId())}createVariable(e,t,i){let o;var s=this.getVariable(e,t);if(s){if(i&&s.getId()!==i)throw Error('Variable "'+e+'" is already in use and its id is "'+s.getId()+'" which conflicts with the passed in id, "'+i+'".');return s}if(i&&this.getVariableById(i))throw Error('Variable id, "'+i+'", is already in use.');if(s=i||eD(),t=t||"",!(i=e_(D.VARIABLE_MODEL,y,!0)))throw Error("No variable model is registered.");return s=new i(this.workspace,e,t,s),(e=null!=(o=this.variableMap.get(t))?o:new Map).set(s.getId(),s),this.variableMap.has(t)||this.variableMap.set(t,e),this.potentialMap||eH(new(ej(rL.VAR_CREATE))(s)),s}addVariable(e){let t,i=e.getType();this.variableMap.has(i)||this.variableMap.set(i,new Map),null==(t=this.variableMap.get(i))||t.set(e.getId(),e)}deleteVariable(e){let t=iD(this.workspace,e.getId()),i="";this.potentialMap||(i=$.getGroup$$module$build$src$core$events$utils())||$.setGroup$$module$build$src$core$events$utils(!0);try{for(let e=0;e<t.length;e++)t[e].dispose(!0);let i=this.variableMap.get(e.getType());i&&i.has(e.getId())&&(i.delete(e.getId()),this.potentialMap||eH(new(ej(rL.VAR_DELETE))(e)),0===i.size&&this.variableMap.delete(e.getType()))}finally{this.potentialMap||$.setGroup$$module$build$src$core$events$utils(i)}}deleteVariableById(e){ih("VariableMap.deleteVariableById","v12","v13","Blockly.Variables.deleteVariable"),(e=this.getVariableById(e))&&$.deleteVariable$$module$build$src$core$variables(this.workspace,e)}getVariable(e,t){let i;return(t=this.variableMap.get(t||""))&&null!=(i=[...t.values()].find(t=>$.Names$$module$build$src$core$names.equals(t.getName(),e)))?i:null}getVariableById(e){for(let t of this.variableMap.values())if(t.has(e)){let i;return null!=(i=t.get(e))?i:null}return null}getVariablesOfType(e){return(e=this.variableMap.get(e||""))?[...e.values()]:[]}getTypes(){return[...this.variableMap.keys()]}getAllVariables(){let e=[];for(let t of this.variableMap.values())e=e.concat(...t.values());return e}getAllVariableNames(){ih("VariableMap.getAllVariableNames","v12","v13","Blockly.Variables.getAllVariables");let e=[];for(let t of this.variableMap.values())for(let i of t.values())e.push(i.getName());return e}getVariableUsesById(e){return ih("VariableMap.getVariableUsesById","v12","v13","Blockly.Variables.getVariableUsesById"),iD(this.workspace,e)}};ea(D.VARIABLE_MAP,y,uz);var uj=class extends r0{constructor(e,t){super(t),this.type=rL.TRASHCAN_OPEN,this.isOpen=e}toJson(){let e=super.toJson();if(void 0===this.isOpen)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,i){return(t=super.fromJson(e,t,null!=i?i:new uj)).isOpen=e.isOpen,t}};ea(D.EVENT,rL.TRASHCAN_OPEN,uj);var uJ=class extends hw{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,this.workspace.options.maxTrashcanContents<=0||(e=this.workspace.copyOptionsForFlyout(),this.workspace.horizontalLayout?(e.toolboxPosition=this.workspace.toolboxPosition===lS.TOP?lS.BOTTOM:lS.TOP,this.flyout=new(eE(D.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===lS.RIGHT?lS.LEFT:lS.RIGHT,this.flyout=new(eE(D.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){let e;this.svgGroup=eZ(li.G,{class:"blocklyTrash"});let t=String(Math.random()).substring(2);e=eZ(li.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),eZ(li.RECT,{width:uZ,height:uq,y:uQ},e);let i=eZ(li.IMAGE,{width:96,x:-u3,height:124,y:-u5,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return i.setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),e=eZ(li.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),eZ(li.RECT,{width:uZ,height:uQ},e),this.svgLid=eZ(li.IMAGE,{width:96,x:-u3,height:124,y:-u5,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),eC(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),eC(this.svgGroup,"pointerup",this,this.click),eC(i,"pointerover",this,this.mouseOver),eC(i,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){if(this.workspace.options.maxTrashcanContents>0){let e=this.flyout.createDom(li.SVG);eq(e,"blocklyTrashcanFlyout"),e3(e,this.workspace.getParentSvg()),this.flyout.init(this.workspace)}this.workspace.getComponentManager().addComponent({component:this,weight:r6.ComponentWeight.TRASHCAN_WEIGHT,capabilities:[r6.Capability.AUTOHIDEABLE,r6.Capability.DELETE_AREA,r6.Capability.DRAG_TARGET,r6.Capability.POSITIONABLE]}),this.initialized=!0,this.setLidOpen(!1)}dispose(){this.workspace.getComponentManager().removeComponent("trashcan"),this.svgGroup&&e2(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(e){return JSON.parse(e)}),t=this.workspace.getParentSvg().style;t.cursor="wait",setTimeout(()=>{let i,o;null==(i=this.flyout)||i.show(e),t.cursor="",null==(o=this.workspace.scrollbar)||o.setVisible(!1)},10),this.fireUiEvent(!0)}}closeFlyout(){if(this.contentsIsOpen()){var e,t;null==(e=this.flyout)||e.hide(),null==(t=this.workspace.scrollbar)||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 i,o,s=tY(this.workspace,e);t=tz(e=tX(s,new ls(uZ,uq+uQ),u1,u0,e,this.workspace),u0,s.vertical===lx.TOP?lG.DOWN:lG.UP,t),this.top=t.top,this.left=t.left,null==(i=this.svgGroup)||i.setAttribute("transform","translate("+this.left+","+this.top+")"),null==(o=this.flyout)||o.position()}}getBoundingRectangle(){return new lo(this.top,this.top+uq+uQ,this.left,this.left+uZ)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();let t=e.top+u5-u2;return e=e.left+u3-u2,new lo(t,t+uQ+uq+2*u2,e,e+uZ+2*u2)}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(){var e=1/(u8+1);this.lidOpen+=this.isLidOpen?e:-e,this.lidOpen=Math.min(Math.max(this.lidOpen,this.minOpenness),1),this.setLidAngle(this.lidOpen*de),e=u9+this.lidOpen*(u7-u9),this.svgGroup&&(this.svgGroup.style.opacity=`${e}`),this.lidOpen>this.minOpenness&&this.lidOpen<1&&(this.lidTask=setTimeout(this.animateLid.bind(this),u4/u8))}setLidAngle(e){let t,i=this.workspace.toolboxPosition===lS.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;null==(t=this.svgLid)||t.setAttribute("transform","rotate("+(i?-e:e)+","+(i?4:uZ-4)+","+(uQ-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*de)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&!this.workspace.isDragging()&&this.openFlyout()}fireUiEvent(e){eH(e=new(ej(rL.TRASHCAN_OPEN))(e,this.workspace.id))}blockMouseDownWhenOpenable(e){!this.contentsIsOpen()&&this.hasContents()&&e.stopPropagation()}mouseOver(){this.hasContents()&&this.setLidOpen(!0)}mouseOut(){this.setLidOpen(!1)}onDelete(e){if(!(this.workspace.options.maxTrashcanContents<=0||!ew(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(u6)}}}cleanBlockJson(e){return!function e(t){if(t){if(delete t.id,delete t.x,delete t.y,delete t.enabled,delete t.disabledReasons,t.icons&&t.icons.comment){var i=t.icons.comment;delete i.height,delete i.width,delete i.pinned}for(var o in i=t.inputs){var s=i[o];let t=s.block;s=s.shadow,t&&e(t),s&&e(s)}t.next&&(t=(o=t.next).block,o=o.shadow,t&&e(t),o&&e(o))}}(e=JSON.parse(JSON.stringify(e))),Object.assign({},{kind:"BLOCK"},e)}},uZ=47,uq=44,uQ=16,u0=20,u1=20,u2=10,u3=0,u5=32,u6=.1,u4=80,u8=4,u9=.4,u7=.8,de=45,dt=null,di=null,ds=void 0,dn={};dn.BlockPaster=hO,dn.copy=nM,dn.getLastCopiedData=nP,dn.getLastCopiedLocation=nx,dn.getLastCopiedWorkspace=nB,dn.paste=nF,dn.registry=lk,dn.setLastCopiedData=function(e){dt=e},dn.setLastCopiedLocation=function(e){ds=e},dn.setLastCopiedWorkspace=function(e){di=e};var dr={};dr.CollapseCommentBarButton=cP,dr.CommentBarButton=cv,dr.CommentEditor=cx,dr.CommentView=cH,dr.DeleteCommentBarButton=cG,dr.RenderedWorkspaceComment=cW,dr.WorkspaceComment=cU,(dV=dz||(dz={})).ESCAPE="escape",dV.DELETE="delete",dV.COPY="copy",dV.CUT="cut",dV.PASTE="paste",dV.UNDO="undo",dV.REDO="redo",nZ();var dl={};dl.names=dz,dl.registerCopy=nX,dl.registerCut=nY,dl.registerDefaultShortcuts=nZ,dl.registerDelete=nW,dl.registerEscape=nU,dl.registerPaste=nz,dl.registerRedo=nJ,dl.registerUndo=nj;var da=class{constructor(e,t){this.procedureModelClass=e,this.parameterModelClass=t,this.priority=75}save(e){return(e=e.getProcedureMap().getProcedures().map(e=>nq(e))).length?e:null}load(e,t){let i=t.getProcedureMap();for(let o of e)i.add(nQ(this.procedureModelClass,this.parameterModelClass,o,t))}clear(e){e.getProcedureMap().clear()}},dc={};dc.ProcedureSerializer=da,dc.loadProcedure=nQ,dc.saveProcedure=nq;var dh=class{constructor(){this.priority=100}save(e){return(e=e.getAllVariables().map(e=>e.save())).length?e:null}load(e,t){let i=e_(D.VARIABLE_MODEL,y);e.forEach(e=>{null==i||i.load(e,t)})}clear(e){e.getVariableMap().clear()}};tj("variables",new dh);var du={};du.VariableSerializer=dh;var dd={};dd.load=function(e,t,{recordUndo:i=!1}={}){var o=eg(D.SERIALIZER,!0);if(o){o=Object.entries(o).sort((e,t)=>t[1].priority-e[1].priority);var s=eG();for(let[,e]of($.setRecordUndo$$module$build$src$core$events$utils(i),(i=$.getGroup$$module$build$src$core$events$utils())||$.setGroup$$module$build$src$core$events$utils(!0),e6(),t instanceof uH&&t.setResizesEnabled(!1),o.reverse()))null==e||e.clear(t);for(let[i,s]of o.reverse())e[i]&&(null==s||s.load(e[i],t));t instanceof uH&&t.setResizesEnabled(!0),e4(),eH(new(ej(rL.FINISHED_LOADING))(t)),$.setGroup$$module$build$src$core$events$utils(i),$.setRecordUndo$$module$build$src$core$events$utils(s)}},dd.save=function(e){let t=Object.create(null),i=eg(D.SERIALIZER,!0);for(let o in i){let s,n=null==(s=i[o])?void 0:s.save(e);n&&(t[o]=n)}return t},"Blockly"in globalThis||(globalThis.Blockly={Msg:aw});var dp="label",d_=class{load(e,t){return(e=new hB(t.getWorkspace(),t.targetWorkspace,e,!0)).show(),new hv(e,dp)}gapForItem(e,t){return t}disposeItem(e){(e=e.getElement())instanceof hB&&e.dispose()}getType(){return dp}};ea(D.FLYOUT_INFLATER,dp,d_);var dg=class extends uN{constructor(e){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:+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,e&&(this.GRID_UNIT=e),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=+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=+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;let 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&&e2(this.selectedGlowFilter),this.replacementGlowFilter&&e2(this.replacementGlowFilter)}makeStartHat(){let e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,i=sU("c",[sH(25,-e),sH(71,-e),sH(t,0)]);return{height:.75*e,width:t,path:i}}makeHexagonal(){function e(e,i,o){var s=e/2;return sK(-(o=o?-1:1)*(s=s>t?t:s),e=(i?-1:1)*e/2)+sK(o*s,e)}let t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width:e=>(e/=2)>t?t:e,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}makeRounded(){function e(e,t,o){let s=e>i?e-i:0,n=o===t?"0":"1";return sz("a","0 0,"+n,e=(e>i?i:e)/2,sH((o?1:-1)*e,(t?-1:1)*e))+sY("v",(t?-1:1)*s)+sz("a","0 0,"+n,e,sH((o?-1:1)*e,(t?-1:1)*e))}let t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,i=2*t;return{type:this.SHAPES.ROUND,isDynamic:!0,width:e=>(e/=2)>t?t:e,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}makeSquared(){function e(e,i,o){e-=2*t;let s=o===i?"0":"1";return sz("a","0 0,"+s,t,sH((o?1:-1)*t,(i?-1:1)*t))+sY("v",(i?-1:1)*e)+sz("a","0 0,"+s,t,sH((o?-1:1)*t,(i?-1:1)*t))}let t=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width:e=>t,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}shapeFor(e){let t=e.getCheck();switch(!t&&e.targetConnection&&(t=e.targetConnection.getCheck()),e.type){case c5.INPUT_VALUE:case c5.OUTPUT_VALUE:if(null!==(e=e.getSourceBlock().getOutputShape()))switch(e){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}if(t&&t.includes("Boolean"))return this.HEXAGONAL;if(t&&t.includes("Number"))return this.ROUNDED;return t&&t.includes("String"),this.ROUNDED;case c5.PREVIOUS_STATEMENT:case c5.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(e){return sU("c",[sH(e*s/2,0),sH(e*s*3/4,r/2),sH(e*s,r)])+sX([sH(e*s,n)])+sU("c",[sH(e*s/4,r/2),sH(e*s/2,r),sH(e*s,r)])+sY("h",e*o)+sU("c",[sH(e*s/2,0),sH(e*s*3/4,-(r/2)),sH(e*s,-r)])+sX([sH(e*s,-n)])+sU("c",[sH(e*s/4,-(r/2)),sH(e*s/2,-r),sH(e*s,-r)])}let t=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,o=t/3,s=o/3,n=i/2,r=n/2,l=e(1),a=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:i,pathLeft:l,pathRight:a}}makeInsideCorners(){let e=this.CORNER_RADIUS,t=sz("a","0 0,0",e,sH(-e,e)),i=sz("a","0 0,1",e,sH(-e,e)),o=sz("a","0 0,0",e,sH(e,e)),s=sz("a","0 0,1",e,sH(e,e));return{width:e,height:e,pathTop:t,pathBottom:o,rightWidth:e,rightHeight:e,pathTopRight:i,pathBottomRight:s}}generateSecondaryColour_(e){return oW("#000",e,.15)||e}generateTertiaryColour_(e){return oW("#000",e,.25)||e}createDom(e,t,i,o){super.createDom(e,t,i,o),e=eZ(li.DEFS,{},e),t=eZ(li.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),eZ(li.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),i=eZ(li.FECOMPONENTTRANSFER,{result:"outBlur"},t),eZ(li.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},i),eZ(li.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),eZ(li.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=eZ(li.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),eZ(li.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=eZ(li.FECOMPONENTTRANSFER,{result:"outBlur"},e),eZ(li.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),eZ(li.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),eZ(li.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),eZ(li.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter=e,o&&(o.style.setProperty("--blocklySelectedGlowFilter",`url(#${this.selectedGlowFilterId})`),o.style.setProperty("--blocklyReplacementGlowFilter",`url(#${this.replacementGlowFilterId})`))}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} .blocklyNonEditableField>rect:not(.blocklyDropdownRect),`,`${e} .blocklyEditableField>rect:not(.blocklyDropdownRect) {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"}",`${e} .blocklyNonEditableField>text,`,`${e} .blocklyEditableField>text,`,`${e} .blocklyNonEditableField>g>text,`,`${e} .blocklyEditableField>g>text {`,"fill: #575E75;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #575E75;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #575E75;","}",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableField:not(.blocklyEditing):hover>rect,",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableField:not(.blocklyEditing):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} .blocklyDisabledPattern > .blocklyOutlinePath {`,"fill: var(--blocklyDisabledPattern)","}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}",`${e} .blocklySelected>.blocklyPath.blocklyPathSelected {`,"fill: none;","filter: var(--blocklySelectedGlowFilter);","}",`${e} .blocklyReplaceable>.blocklyPath {`,"filter: var(--blocklyReplacementGlowFilter);","}"]}},dE=class extends uy{constructor(e,t){super(e,t)}draw(){let e=this.block_.pathObject;e.beginDrawing(),this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),e.setPath(this.outlinePath_+"\n"+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(!(e.height<=0)){if(ur.isSpacer(e)){let o=e.precedesStatement;var t=e.followsStatement;if(o||t){let s=this.constants_.INSIDE_CORNERS;var i=s.rightHeight;i=e.height-(o?i:0),t=t?s.pathBottomRight:"",e=i>0?sY("V",e.yPos+i):"",this.outlinePath_+=t+e+(o?s.pathTopRight:"");return}}this.outlinePath_+=sY("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_(){let e=this.info_.topRow;this.positionPreviousConnection_(),this.outlinePath_+=sV(e.xPos,this.info_.startY),this.outlinePath_+=sY("h",e.width)}drawFlatBottom_(){let e=this.info_.bottomRow;this.positionNextConnection_(),this.outlinePath_+=sY("V",e.baseline),this.outlinePath_+=sY("h",-e.width)}drawInlineInput_(e){this.positionInlineInputConnection_(e);let t=e.input.name;e.connectedBlock||this.info_.isInsertionMarker||(e=sW(e.xPos+e.connectionWidth,e.centerline-e.height/2)+this.getInlineInputPath(e),this.block_.pathObject.setOutlinePath(t,e))}getInlineInputPath(e){let t=e.width-2*e.connectionWidth,i=e.height;return sY("h",t)+e.shape.pathRightDown(i)+sY("h",-t)+e.shape.pathUp(i)+"z"}drawStatementInput_(e){var t=e.getLastInput();let i=t.xPos+t.notchOffset+t.shape.width,o=this.constants_.INSIDE_CORNERS,s=t.shape.pathRight+sY("h",-(t.notchOffset-o.width))+o.pathTop,n=e.height-2*o.height;t=o.pathBottom+sY("h",t.notchOffset-o.width)+(t.connectedBottomNextConnection?"":t.shape.pathLeft),this.outlinePath_+=sY("H",i)+s+sY("v",n)+t+sY("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}drawConnectionHighlightPath(e){let t,i,o=e.connectionModel;if(o.type===c5.NEXT_STATEMENT||o.type===c5.PREVIOUS_STATEMENT||o.type===c5.OUTPUT_VALUE&&!e.isDynamicShape)return super.drawConnectionHighlightPath(e);e=o.type===c5.INPUT_VALUE?sW(e.connectionWidth,-e.height/2)+this.getInlineInputPath(e):sW(e.width,-e.height/2)+e.shape.pathDown(e.height);let s=o.getSourceBlock();return null==(i=(t=s.pathObject).addConnectionHighlight)?void 0:i.call(t,o,e,o.getOffsetInBlock(),s.RTL)}},dT=class extends cd{constructor(e,t,i,o,s,n,r){if(super(cd.SKIP_SETUP),this.imageElement=this.clickHandler=null,this.flipRtl=this.isDirty_=this.EDITABLE=!1,this.altText="",i=Number(oY(i)),t=Number(oY(t)),isNaN(i)||isNaN(t))throw Error("Height and width values of an image field must cast to numbers.");if(i<=0||t<=0)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new ls(t,i+dT.Y_PADDING),this.imageHeight=i,"function"==typeof s&&(this.clickHandler=s),e!==cd.SKIP_SETUP&&(r?this.configure_(r):(this.flipRtl=!!n,this.altText=oY(o)||""),this.setValue(oY(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=oY(e.alt))}initView(){this.imageElement=eZ(li.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(rw,"xlink:href",this.value_),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyImageField"),this.clickHandler&&(this.imageElement.style.cursor="pointer")}updateSize_(){}doClassValidation_(e){return"string"!=typeof e?null:e}doValueUpdate_(e){this.value_=e,this.imageElement&&this.imageElement.setAttributeNS(rw,"xlink:href",this.value_)}getFlipRtl(){return this.flipRtl}setAlt(e){e!==this.altText&&(this.altText=e||"",this.imageElement&&this.imageElement.setAttribute("alt",this.altText))}isClickable(){return super.isClickable()&&!!this.clickHandler}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)}};dT.Y_PADDING=1,sy("field_image",dT),dT.prototype.DEFAULT_VALUE="";var dm=class extends cd{set size_(e){super.size_=e}get size_(){let e=super.size_;return e.width<14&&(e.width=14),e}constructor(e,t,i){super(cd.SKIP_SETUP),this.spellcheck_=!0,this.htmlInput_=null,this.isTextValid_=this.isBeingEdited_=!1,this.onInputWrapper=this.onKeyDownWrapper=this.valueWhenEditorWasOpened_=null,this.fullBlockClickTarget_=!1,this.workspace_=null,this.SERIALIZABLE=!0,e!==cd.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),void 0!==e.spellcheck&&(this.spellcheck_=e.spellcheck)}initView(){if(!this.getSourceBlock())throw new cp;super.initView(),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot()),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyInputField")}isFullBlockField(){let e,t=this.getSourceBlock();if(!t)throw new cp;return this.fullBlockClickTarget_=!(null==(e=this.getConstants())||!e.FULL_BLOCK_FIELDS)&&t.isSimpleReporter()}doValueInvalid_(e,t=!0){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,e=this.value_,this.value_=this.valueWhenEditorWasOpened_,this.sourceBlock_&&eX()&&this.value_!==e&&t&&eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,e,this.value_)))}doValueUpdate_(e){this.isTextValid_=this.isDirty_=!0,this.value_=e}applyColour(){let e=this.getSourceBlock();if(!e)throw new cp;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(null==(e=this.getConstants())?0: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_?(e0(e,"blocklyInvalidInput"),t2(e,aD.INVALID,!1)):(eq(e,"blocklyInvalidInput"),t2(e,aD.INVALID,!0))}if(!(e=this.getSourceBlock()))throw new cp;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,i=!0){this.workspace_=this.sourceBlock_.workspace,!t&&this.workspace_.options.modalInputs&&(rN||rC||rO)?this.showPromptEditor():this.showInlineEditor(t,i)}showPromptEditor(){ir($.Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),e=>{null!==e&&this.setValue(this.getValueFromEditorText_(e)),this.onFinishEditing_(this.value_)})}showInlineEditor(e,t){let i=this.getSourceBlock();if(!i)throw new cp;oZ(this,i.RTL,this.widgetDispose_.bind(this),this.workspace_,t),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 cp;$.setGroup$$module$build$src$core$events$utils(!0);let t=oj();var i=this.getClickTarget_();if(!i)throw Error("A click target has not been set.");eq(i,"blocklyEditing"),(i=document.createElement("input")).className="blocklyHtmlInput",i.setAttribute("spellcheck",this.spellcheck_);let o=this.workspace_.getAbsoluteScale();var s=this.getConstants().FIELD_TEXT_FONTSIZE*o+"pt";return t.style.fontSize=s,i.style.fontSize=s,s=dm.BORDERRADIUS*o+"px",this.isFullBlockField()&&(s=((s=this.getScaledBBox()).bottom-s.top)/2+"px",e=e.getParent()?e.getParent().getColourTertiary():this.sourceBlock_.getColourTertiary(),i.style.border=+o+"px solid "+e,t.style.borderRadius=s,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*o+"px")),i.style.borderRadius=s,t.appendChild(i),i.value=i.defaultValue=this.getEditorText_(this.value_),i.setAttribute("data-untyped-default-value",String(this.value_)),this.resizeEditor_(),this.bindInputEvents_(i),i}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&eX()&&null!==this.valueWhenEditorWasOpened_&&this.valueWhenEditorWasOpened_!==this.value_&&(eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),$.setGroup$$module$build$src$core$events$utils(!1),this.unbindInputEvents_();var e=oj().style;if(e.width="auto",e.height="auto",e.fontSize="",e.transition="",e.boxShadow="",this.htmlInput_=null,!(e=this.getClickTarget_()))throw Error("A click target has not been set.");e0(e,"blocklyEditing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper=eb(e,"keydown",this,this.onHtmlInputKeyDown_),this.onInputWrapper=eb(e,"input",this,this.onHtmlInputChange)}unbindInputEvents_(){this.onKeyDownWrapper&&(eO(this.onKeyDownWrapper),this.onKeyDownWrapper=null),this.onInputWrapper&&(eO(this.onInputWrapper),this.onInputWrapper=null)}onHtmlInputKeyDown_(e){if("Enter"===e.key)o0(this),ou();else if("Escape"===e.key)this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),o0(this),ou();else if("Tab"===e.key){e.preventDefault();var t,i=null==(t=this.workspace_)?void 0:t.getCursor();t=e=>(e instanceof dm||e instanceof hD&&e.isSimpleReporter())&&e!==this.getSourceBlock(),(e=(e=e.shiftKey?null==i?void 0:i.getPreviousNode(this,t,!1):null==i?void 0:i.getNextNode(this,t,!1))instanceof hD&&e.isSimpleReporter()?e.getFields().next().value:e)instanceof dm&&(o0(this),ou(),i=e.getSourceBlock(),e.isFullBlockField()&&i&&i instanceof hD?$.getFocusManager$$module$build$src$core$focus_manager().focusNode(i):$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e),e.showEditor())}}onHtmlInputChange(e){e=this.value_,this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&eX()&&this.value_!==e&&eH(new(ej(rL.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_(){t6().then(()=>{let e=this.getSourceBlock();if(!e)throw new cp;let t=oj(),i=this.getScaledBBox();t.style.width=i.right-i.left+"px",t.style.height=i.bottom-i.top+"px";let o=i.top;t.style.left=`${e.RTL?i.right-t.offsetWidth:i.left}px`,t.style.top=`${o}px`})}repositionForWindowResize(){let e,t=null==(e=this.getSourceBlock())?void 0:e.getRootBlock();return t instanceof hD&&(s9(this.workspace_,this.workspace_.getMetricsManager().getViewMetrics(!0),t)||this.resizeEditor_(),!0)}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(e){return`${e}`}getValueFromEditorText_(e){return e}};dm.BORDERRADIUS=4,$.FieldTextInput$$module$build$src$core$field_textinput=class extends dm{constructor(e,t,i){super(e,t,i)}initView(){super.initView(),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyTextInputField")}doClassValidation_(e){return void 0===e?null:`${e}`}static fromJson(e){return new this(oY(e.text),void 0,e)}},sy("field_input",$.FieldTextInput$$module$build$src$core$field_textinput),$.FieldTextInput$$module$build$src$core$field_textinput.prototype.DEFAULT_VALUE="",$.FieldTextInput$$module$build$src$core$field_textinput;var df=class extends uc{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){return!!e.outputConnection}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},dI=class extends uA{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)}}},dS=class extends ul{constructor(e){super(e),this.width=this.height=0,this.type|=ur.getType("RIGHT_CONNECTION")}},dR=class extends u${constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){let t=(e.hat?"cap"===e.hat:this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection;return!!e.outputConnection||t}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},db=class extends uD{constructor(e,t){super(e,t),this.isInline=!0,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.topRow=new dR(this.constants_),this.bottomRow=new df(this.constants_),this.isMultiRow=!t.getInputsInline()||t.isCollapsed(),this.hasStatementInput=t.statementInputCount>0,this.rightSide=this.outputConnection?new dS(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 hf||e instanceof hI||t instanceof hI||(e instanceof $.ValueInput$$module$build$src$core$inputs$value_input||e instanceof hm||e instanceof hf)&&(!this.isInline||this.isMultiRow))}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&&ur.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:e&&ur.isLeftRoundedCorner(e)&&t&&(ur.isPreviousConnection(t)||ur.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&ur.isLeftSquareCorner(e)&&t&&ur.isHat(t)||e&&ur.isField(e)&&0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING}getSpacerRowHeight_(e,t){if(ur.isTopRow(e)&&ur.isBottomRow(t))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;let i=ur.isInputRow(e)&&e.hasStatement,o=ur.isInputRow(t)&&t.hasStatement;return o||i?(e=Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.INSIDE_CORNERS.rightHeight||0),o&&i?Math.max(e,this.constants_.DUMMY_INPUT_MIN_HEIGHT):e):ur.isTopRow(e)?e.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):ur.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){let i=this.width-this.startX;return ur.isInputRow(e)&&e.hasStatement||ur.isInputRow(t)&&t.hasStatement?Math.max(i,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):i}getElemCenterline_(e,t){if(e.hasStatement&&!ur.isSpacer(t)&&!ur.isStatementInput(t))return e.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(ur.isInlineInput(t)){let i=t.connectedBlock;if(i&&i.outputConnection&&i.nextConnection)return e.yPos+i.height/2}return super.getElemCenterline_(e,t)}addInput_(e,t){if((e instanceof hm||e instanceof hf)&&t.hasDummyInput&&t.align===$.Align$$module$build$src$core$inputs$align.LEFT&&e.align===$.Align$$module$build$src$core$inputs$align.RIGHT)this.rightAlignedDummyInputs.set(t,e);else if(e instanceof hI){t.elements.push(new dI(this.constants_,e)),t.hasStatement=!0,null===t.align&&(t.align=e.align);return}super.addInput_(e,t)}addAlignmentPadding_(e,t){if(this.rightAlignedDummyInputs.get(e)){let i;for(let t=0;t<e.elements.length;t++){let o=e.elements[t];if(ur.isSpacer(o)&&(i=o),ur.isField(o)&&o.parentInput===this.rightAlignedDummyInputs.get(e))break}if(i){i.width+=t,e.width+=t;return}}super.addAlignmentPadding_(e,t)}adjustXPosition_(){let e=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH,t=e;for(let s=2;s<this.rows.length-1;s+=2){var i=this.rows[s-1];let n=this.rows[s];var o=this.rows[s+1];if(i=2===s?!!this.topRow.hasPreviousConnection:!!i.followsStatement,o=s+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!o.precedesStatement,ur.isInputRow(n)&&n.hasStatement){let i,o;n.measure(),t=n.width-(null!=(o=null==(i=n.getLastInput())?void 0:i.width)?o:0)+e}else if(i&&(2===s||o)&&ur.isInputRow(n)&&!n.hasStatement){o=n.xPos,i=null;for(let e=0;e<n.elements.length;e++){let s=n.elements[e];ur.isSpacer(s)&&(i=s),!(i&&(ur.isField(s)||ur.isInput(s))&&o<t)||ur.isField(s)&&(s.field instanceof hh||s.field instanceof dT)||(i.width+=t-o),o+=s.width}}}}finalizeOutputConnection_(){if(this.outputConnection&&this.outputConnection.isDynamicShape){var e=this.outputConnection.shape;if("isDynamic"in e&&e.isDynamic){for(var t=0,i=0;i<this.rows.length;i++){let e=this.rows[i];e.yPos=t,t+=e.height}this.height=t,i=this.bottomRow.hasNextConnection?this.height-this.bottomRow.descenderHeight:this.height,t=e.height(i),i=e.width(i),this.outputConnection.height=t,this.outputConnection.width=i,this.outputConnection.startX=i,this.outputConnection.connectionOffsetY=e.connectionOffsetY(t),this.outputConnection.connectionOffsetX=e.connectionOffsetX(i),e=0,this.hasStatementInput||this.bottomRow.hasNextConnection||(e=i,this.rightSide.height=t,this.rightSide.width=e,this.rightSide.centerline=t/2,this.rightSide.xPos=this.width+e),this.startX=i,this.width+=i+e,this.widthWithChildren+=i+e}}}finalizeHorizontalAlignment_(){if(this.outputConnection&&!this.hasStatementInput&&!this.bottomRow.hasNextConnection){for(var e=0,t=0;t<this.rows.length;t++){var i=this.rows[t];if(!ur.isInputRow(i))continue;e=i.elements[i.elements.length-2];let o=this.getNegativeSpacing_(i.elements[1]),s=this.getNegativeSpacing_(e);e=o+s;let n=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-e<n&&(o=(e=this.width-n)/2,s=e/2),i.elements.unshift(new uE(this.constants_,-o)),i.elements.push(new uE(this.constants_,-s))}if(e)for(this.width-=e,this.widthWithChildren-=e,this.rightSide.xPos-=e,t=0;t<this.rows.length;t++)i=this.rows[t],ur.isTopOrBottomRow(i)&&(i.elements[1].width-=e),i.width-=e,i.widthWithConnectedBlocks-=e}}getNegativeSpacing_(e){if(!e||!this.outputConnection)return 0;let t=this.outputConnection.width;var i=this.outputConnection.shape.type;let o=this.constants_;if(this.inputRows.length>1)if(i===o.SHAPES.ROUND)return i=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,t-(i=this.height/2>i?i:this.height/2)*(1-Math.sin(Math.acos((i-this.constants_.SMALL_PADDING)/i)));else return 0;if(ur.isInlineInput(e)){let s=e.connectedBlock;return null==(e=s?s.pathObject.outputShapeType:e.shape.type)||s&&s.outputConnection&&(s.statementInputCount||s.nextConnection)||i===o.SHAPES.HEXAGONAL&&i!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[i][e]}return ur.isField(e)?i===o.SHAPES.ROUND&&e.field instanceof $.FieldTextInput$$module$build$src$core$field_textinput?t-2.75*o.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[i][0]:ur.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let o=2;o<this.rows.length-1;o+=2){let s=this.rows[o-1],n=this.rows[o],r=this.rows[o+1];var e=2===o,t=o+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!r.precedesStatement;if(e?this.topRow.hasPreviousConnection:s.followsStatement){var i=n.elements[1];if(i=3===n.elements.length&&i instanceof up&&(i.field instanceof hh||i.field instanceof dT),!e&&i)s.height-=this.constants_.SMALL_PADDING,r.height-=this.constants_.SMALL_PADDING,n.height-=this.constants_.MEDIUM_PADDING;else if(e||t){if(t){for(t=0,e=!1;t<n.elements.length;t++)if(i=n.elements[t],ur.isInlineInput(i)&&i.connectedBlock&&!i.connectedBlock.isShadow()&&i.connectedBlock.getHeightWidth().height>=40){e=!0;break}e&&(s.height-=this.constants_.SMALL_PADDING,r.height-=this.constants_.SMALL_PADDING)}}else s.height+=this.constants_.SMALL_PADDING}}}finalize_(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),super.finalize_(),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},dC=class extends uk{constructor(e,t,i){super(e,t,i),this.svgPathSelected=null,this.outlines=new Map,this.remainingOutlines=new Set,this.outputShapeType=null,this.constants=i}setPath(e){super.setPath(e),this.svgPathSelected&&this.svgPathSelected.setAttribute("d",e)}applyColour(e){super.applyColour(e);let t=e.getParent();for(let i of(e.isShadow()&&t&&this.svgPath.setAttribute("stroke",t.getColourTertiary()),this.outlines.values()))i.setAttribute("fill",this.style.colourTertiary)}flipRTL(){for(let e of(super.flipRTL(),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.classList.add("blocklyPathSelected"),e0(this.svgPathSelected,rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),e0(this.svgPathSelected,rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME),this.svgPathSelected.removeAttribute("tabindex"),this.svgPathSelected.removeAttribute("id"),this.svgRoot.appendChild(this.svgPathSelected)):this.svgPathSelected&&(this.svgRoot.removeChild(this.svgPathSelected),this.svgPathSelected=null)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e)}updateShapeForInputHighlight(e,t){e=e.getParentInput().name,(e=this.getOutlinePath(e))&&(t?e.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):e.removeAttribute("filter"))}beginDrawing(){for(let e of(this.remainingOutlines.clear(),this.outlines.keys()))this.remainingOutlines.add(e)}endDrawing(){if(this.remainingOutlines.size)for(let e of this.remainingOutlines)this.removeOutlinePath(e);this.remainingOutlines.clear()}setOutlinePath(e,t){(e=this.getOutlinePath(e)).setAttribute("d",t),e.setAttribute("fill",this.style.colourTertiary)}getOutlinePath(e){return this.outlines.has(e)||this.outlines.set(e,eZ(li.PATH,{class:"blocklyOutlinePath",d:""},this.svgRoot)),this.remainingOutlines.delete(e),this.outlines.get(e)}removeOutlinePath(e){let t,i;null==(t=this.outlines.get(e))||null==(i=t.parentNode)||i.removeChild(this.outlines.get(e)),this.outlines.delete(e)}},dO=class extends uw{constructor(e){super(e)}makeConstants_(){return new dg}makeRenderInfo_(e){return new db(this,e)}makeDrawer_(e,t){return new dE(e,t)}makePathObject(e,t){return new dC(e,t,this.getConstants())}getConstants(){return this.constants_}};nA("zelos",dO);var dA=class{constructor(e){this.staticConn=this.draggedConn=this.markerConn=this.fadedBlock=null,this.workspace=e.workspace}previewReplacement(e,t,i){$.disable$$module$build$src$core$events$utils();try{this.hidePreview(),this.fadedBlock=i,i.fadeForReplacement(!0),this.workspace.getRenderer().shouldHighlightConnection(t)&&(t.highlight(),this.staticConn=t)}finally{$.enable$$module$build$src$core$events$utils()}}previewConnection(e,t){if(e!==this.draggedConn||t!==this.staticConn){$.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{$.enable$$module$build$src$core$events$utils()}}}shouldUseMarkerPreview(e,t){return t.type===c5.PREVIOUS_STATEMENT||t.type===c5.NEXT_STATEMENT||!(this.workspace.getRenderer()instanceof dO)}previewMarker(e,t){let i=e.getSourceBlock(),o=this.createInsertionMarker(i),s=this.getMatchingConnection(i,o,e);if(!s)return null;o.queueRender(),t4(),s.connect(t);let n={x:t.x-s.x,y:t.y-s.y},r=s.getOffsetInBlock().clone();return t6().then(()=>{if(!o.isDeadOrDying()){$.disable$$module$build$src$core$events$utils();try{null==o||o.positionNearConnection(s,n,r),null==o||o.getSvgRoot().setAttribute("visibility","visible")}finally{$.enable$$module$build$src$core$events$utils()}}}),s}createInsertionMarker(e){let t=ik(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!t)throw Error(`Failed to serialize source block. ${e.toDevString()}`);for(let i of(e=iH(t,this.workspace)).getDescendants(!1))i.setInsertionMarker(!0);return e.initSvg(),e.getSvgRoot().setAttribute("visibility","hidden"),e}getMatchingConnection(e,t,i){if(e=e.getConnections_(!0),t=t.getConnections_(!0),e.length!==t.length)return null;for(let o=0;o<e.length;o++)if(e[o]===i)return t[o];return null}hidePreview(){$.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{$.enable$$module$build$src$core$events$utils()}}hideInsertionMarker(e){let t,i=e.getSourceBlock(),o=i.outputConnection;if((null==(t=i.previousConnection)?0:t.targetConnection)||(null==o?0:o.targetConnection))i.unplug(!0);else{let t;null==(t=e.targetBlock())||t.unplug(!1)}i.dispose()}dispose(){this.hidePreview()}};ea(D.CONNECTION_PREVIEWER,y,dA);var d$={};d$.Align=$.Align$$module$build$src$core$inputs$align,d$.DummyInput=hm,d$.EndRowInput=hf,d$.Input=hT,d$.StatementInput=hI,d$.ValueInput=$.ValueInput$$module$build$src$core$inputs$value_input,d$.inputTypes=$.inputTypes$$module$build$src$core$inputs$input_types;var dN=!1;$.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_=RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=tl());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let i=0,o;o=e[i];i++){let e=this.blockToCode(o);Array.isArray(e)&&(e=e[0]),e&&(o.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!o.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,o)+e),this.STATEMENT_SUFFIX&&!o.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,o))),t.push(e))}return t=t.join("\n"),(t=(t=(t=this.finish(t)).replace(/^\s+\n/,"")).replace(/\n\s+$/,"\n")).replace(/[ \t]+\n/g,"\n")}prefixLines(e,t){return t+e.replace(/(?!\n$)\n/g,"\n"+t)}allNestedComments(e){let t=[];e=e.getDescendants(!0);for(let i=0;i<e.length;i++){let o=e[i].getCommentText();o&&t.push(o)}return t.length&&t.push(""),t.join("\n")}blockToCode(e,t){if(!1===this.isInitialized&&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 i=this.forBlock[e.type];if("function"!=typeof i)throw Error(`${this.name_} generator does not know how to generate code for block type "${e.type}".`);if(Array.isArray(i=i.call(e,e,this))){if(!e.outputConnection)throw TypeError("Expecting string from statement block: "+e.type);return[this.scrub_(e,i[0],t),i[1]]}if("string"==typeof i)return this.STATEMENT_PREFIX&&!e.suppressPrefixSuffix&&(i=this.injectId(this.STATEMENT_PREFIX,e)+i),this.STATEMENT_SUFFIX&&!e.suppressPrefixSuffix&&(i+=this.injectId(this.STATEMENT_SUFFIX,e)),this.scrub_(e,i,t);if(null===i)return"";throw SyntaxError("Invalid code generated: "+i)}valueToCode(e,t,i){if(isNaN(i))throw TypeError("Expecting valid order from block: "+e.type);var o=e.getInputTargetBlock(t);if(!o&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if(!o||""===(t=this.blockToCode(o)))return"";if(!Array.isArray(t))throw TypeError(`Expecting tuple from value block: ${o.type} See developers.google.com/blockly/guides/create-custom-blocks/generating-code for more information`);if(e=t[0],isNaN(t=t[1]))throw TypeError("Expecting valid order from value block: "+o.type);if(!e)return"";o=!1;var s=Math.floor(i);let n=Math.floor(t);if(s<=n&&(s!==n||0!==s&&99!==s)){for(o=!0,s=0;s<this.ORDER_OVERRIDES.length;s++)if(this.ORDER_OVERRIDES[s][0]===i&&this.ORDER_OVERRIDES[s][1]===t){o=!1;break}}return o&&(e="("+e+")"),e}statementToCode(e,t){let i=e.getInputTargetBlock(t);if(!i&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if("string"!=typeof(e=this.blockToCode(i)))throw TypeError("Expecting code from statement block: "+(i&&i.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]){let i,o=this.nameDB_.getDistinctName(e,$.NameType$$module$build$src$core$names.PROCEDURE);for(this.functionNames_[e]=o,Array.isArray(t)&&(t=t.join("\n")),t=t.trim().replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,o);i!==t;)i=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,$.NameType$$module$build$src$core$names.VARIABLE)}getProcedureName(e){return this.getName(e,$.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,i){return t}finish(e){return this.definitions_=Object.create(null),this.functionNames_=Object.create(null),e}scrubNakedValue(e){return e}},$.CodeGenerator$$module$build$src$core$generator;var dL=class extends h0{constructor(e){super(e)}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),i=t.getScrollMetrics(),o=t.getViewMetrics();t=t.getAbsoluteMetrics(),"number"==typeof e.y&&(this.workspace_.scrollY=-(i.top+(i.height-o.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();let t=e.getAbsoluteMetrics(),i=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===lS.LEFT?e.width:i.width-this.getWidth():this.toolboxPosition_===lS.LEFT?0:i.width:this.toolboxPosition_===lS.LEFT?0:i.width+t.left-this.getWidth()}getY(){return 0}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=e.height;var t=this.getWidth()-this.CORNER_RADIUS;this.setBackgroundPath(t,e.height-2*this.CORNER_RADIUS),e=this.getX(),t=this.getY(),this.positionAt_(this.getWidth(),this.getHeight(),e,t)}}setBackgroundPath(e,t){let i=this.toolboxPosition_===lS.RIGHT;var o=e+this.CORNER_RADIUS;(o=["M "+(i?o:0)+",0"]).push("h",i?-e:e),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,+!i,i?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("v",Math.max(0,t)),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,+!i,i?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("h",i?e:-e),o.push("z"),this.svgBackground_.setAttribute("d",o.join(" "))}scrollToStart(){let e;null==(e=this.workspace_.scrollbar)||e.setY(0)}wheel_(e){var t=eL(e);if(t.y){let e,i=this.workspace_.getMetricsManager(),o=i.getScrollMetrics();t=i.getViewMetrics().top-o.top+t.y,null==(e=this.workspace_.scrollbar)||e.setY(t),o1(this.workspace_),ou()}e.preventDefault(),e.stopPropagation()}layout_(e){this.workspace_.scale=this.targetWorkspace.scale;var t=this.MARGIN;let i=this.RTL?t:t+this.tabWidth_;for(let o of e)o.getElement().moveBy(i,t),t+=o.getElement().getBoundingRectangle().getHeight()}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;let t=this.dragAngleRange_;return e<t&&e>-t||e<-180+t||e>180-t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;let e=this.svgGroup_.getBoundingClientRect(),t=e.left;return this.toolboxPosition_===lS.LEFT?new lo(-1e9,1e9,-1e9,t+e.width):new lo(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=this.getContents().reduce((e,t)=>Math.max(e,t.getElement().getBoundingRectangle().getWidth()),0);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=lh.scrollbarThickness,this.getWidth()!==e){if(this.RTL)for(let t of this.getContents()){let i=t.getElement().getBoundingRectangle().left,o=e/this.workspace_.scale-t.getElement().getBoundingRectangle().getWidth()-this.MARGIN-this.tabWidth_;t.getElement().moveBy(o-i,0)}this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==lS.LEFT||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};dL.registryName="verticalFlyout",ea(D.FLYOUTS_VERTICAL_TOOLBOX,y,dL);var dy=class extends h0{constructor(e){super(e),this.horizontalLayout=!0}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),i=t.getScrollMetrics(),o=t.getViewMetrics();t=t.getAbsoluteMetrics(),"number"==typeof e.x&&(this.workspace_.scrollX=-(i.left+(i.width-o.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();let t=e.getAbsoluteMetrics(),i=e.getViewMetrics();e=e.getToolboxMetrics();let o=this.toolboxPosition_===lS.TOP;return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?o?e.height:i.height-this.getHeight():o?0:i.height:o?0:i.height+t.top-this.getHeight()}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.width_=e.width,e=e.width-2*this.CORNER_RADIUS;var t=this.getHeight()-this.CORNER_RADIUS;this.setBackgroundPath(e,t),e=this.getX(),t=this.getY(),this.positionAt_(this.getWidth(),this.getHeight(),e,t)}}setBackgroundPath(e,t){let i=this.toolboxPosition_===lS.TOP,o=["M 0,"+(i?0:this.CORNER_RADIUS)];i?(o.push("h",e+2*this.CORNER_RADIUS),o.push("v",t),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("h",-e),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),o.push("h",e),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("v",t),o.push("h",-e-2*this.CORNER_RADIUS)),o.push("z"),this.svgBackground_.setAttribute("d",o.join(" "))}scrollToStart(){let e;null==(e=this.workspace_.scrollbar)||e.setX(this.RTL?1/0:0)}wheel_(e){var t=eL(e);if(t=t.x||t.y){let e,i=this.workspace_.getMetricsManager(),o=i.getScrollMetrics();t=i.getViewMetrics().left-o.left+t,null==(e=this.workspace_.scrollbar)||e.setX(t),o1(this.workspace_),ou()}e.preventDefault(),e.stopPropagation()}layout_(e){this.workspace_.scale=this.targetWorkspace.scale;let t=this.MARGIN,i=t+this.tabWidth_;for(let o of(this.RTL&&(e=e.reverse()),e))e=o.getElement().getBoundingRectangle(),e=this.RTL?i+e.getWidth():i,o.getElement().moveBy(e,t),i+=o.getElement().getBoundingRectangle().getWidth()}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;let 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;let e=this.svgGroup_.getBoundingClientRect(),t=e.top;return this.toolboxPosition_===lS.TOP?new lo(-1e9,t+e.height,-1e9,1e9):new lo(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=this.getContents().reduce((e,t)=>Math.max(e,t.getElement().getBoundingRectangle().getHeight()),0);e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=lh.scrollbarThickness,this.getHeight()!==e&&(this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==lS.TOP||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets())}};ea(D.FLYOUTS_HORIZONTAL_TOOLBOX,y,dy);var dD=class extends c0{constructor(e,t,i,o,s){super(cd.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=dD.dropdownCreate,this.defaultVariableName="string"==typeof e?e:"",this.size_=new ls(0,0),e!==cd.SKIP_SETUP&&(s?this.configure_(s):this.setTypes(i,o),t&&this.setValidator(t))}configure_(e){super.configure_(e),this.setTypes(e.variableTypes,e.defaultType)}initModel(){var e=this.getSourceBlock();if(!e)throw new cp;this.variable||(e=$.getOrCreateVariablePackage$$module$build$src$core$variables(e.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(e.getId()))}initView(){super.initView(),eq(this.fieldGroup_,"blocklyVariableField")}shouldAddBorderRect_(){let e=this.getSourceBlock();if(!e)throw new cp;return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!==e.type)}fromXml(e){var t=this.getSourceBlock();if(!t)throw new cp;let i=e.getAttribute("id"),o=e.textContent,s=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=$.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,i,o,s),null!==s&&s!==t.getType())throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.getType()+", and does not match variable field that references it: "+sg(e)+".");this.setValue(t.getId())}toXml(e){return this.initModel(),e.id=this.variable.getId(),e.textContent=this.variable.getName(),this.variable.getType()&&e.setAttribute("variabletype",this.variable.getType()),e}saveState(e){var t=this.saveLegacyState(dD);return null!==t||(this.initModel(),t={id:this.variable.getId()},e&&(t.name=this.variable.getName(),t.type=this.variable.getType())),t}loadState(e){let t=this.getSourceBlock();if(!t)throw new cp;this.loadLegacyState(dD,e)||(e=$.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.getName():""}getVariable(){return this.variable}getDefaultType(){return this.defaultType}getValidator(){return this.variable?this.validator_:null}doClassValidation_(e){if(null===e)return null;var t=this.getSourceBlock();if(!t)throw new cp;return(t=$.getVariable$$module$build$src$core$variables(t.workspace,e))?(t=t.getType(),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){let t=this.getSourceBlock();if(!t)throw new cp;this.variable=$.getVariable$$module$build$src$core$variables(t.workspace,e),super.doValueUpdate_(e)}typeIsAllowed(e){let t=this.getVariableTypes();if(!t)return!0;for(let i=0;i<t.length;i++)if(e===t[i])return!0;return!1}getVariableTypes(){if(this.variableTypes)return this.variableTypes;if(!this.sourceBlock_||this.sourceBlock_.isDeadOrDying())return[""];let e=this.sourceBlock_.workspace.getVariableMap().getTypes();if(this.sourceBlock_.isInFlyout){let t=this.sourceBlock_.workspace.getPotentialVariableMap();if(!t)return e;e=Array.from(new Set([...e,...t.getTypes()]))}return e}setTypes(e=null,t=""){var i=this.getText();if(Array.isArray(e)){if(0===e.length)throw Error(`'variableTypes' of field variable ${i} was an empty list. If you want to include all variable types, pass 'null' instead.`);i=!1;for(let o=0;o<e.length;o++)e[o]===t&&(i=!0);if(!i)throw Error("Invalid default type '"+t+"' in the definition of a FieldVariable")}else if(null!==e)throw Error(`'variableTypes' was not an array or null in the definition of FieldVariable ${i}`);this.defaultType=t,this.variableTypes=e}refreshVariableName(){this.forceRerender()}onItemSelected_(e,t){if(e=t.getValue(),this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){if(e===hd&&this.variable)return void $.renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable);if(e===hp&&this.variable){e=this.variable.getWorkspace(),$.deleteVariable$$module$build$src$core$variables(e,this.variable,this.sourceBlock_);return}}this.setValue(e)}referencesVariables(){return!0}static fromJson(e){return new this(oY(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.");let e=this.getText(),t=[];var i=this.getSourceBlock();if(i&&!i.isDeadOrDying()){i=i.workspace;let e=this.getVariableTypes();for(let n=0;n<e.length;n++){let r=e[n],l=i.getVariableMap().getVariablesOfType(r);if(t=t.concat(l),i.isFlyout){var o=void 0,s=void 0;t=t.concat(null!=(s=null==(o=i.getPotentialVariableMap())?void 0:o.getVariablesOfType(r))?s:[])}}}for(t.sort(iy),o=[],s=0;s<t.length;s++)o[s]=[t[s].getName(),t[s].getId()];return o.push([$.Msg$$module$build$src$core$msg.RENAME_VARIABLE,hd]),$.Msg$$module$build$src$core$msg.DELETE_VARIABLE&&o.push([$.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",e),hp]),o}};sy("field_variable",dD);var dk=class extends dm{constructor(e,t,i,o,s,n){super(cd.SKIP_SETUP),this.min_=-1/0,this.max_=1/0,this.precision_=0,this.decimalPlaces=null,this.spellcheck_=!1,e!==cd.SKIP_SETUP&&(n?this.configure_(n):this.setConstraints(t,i,o),this.setValue(e),s&&this.setValidator(s))}configure_(e){super.configure_(e),this.setMinInternal(e.min),this.setMaxInternal(e.max),this.setPrecisionInternal(e.precision)}setConstraints(e,t,i){this.setMinInternal(e),this.setMaxInternal(t),this.setPrecisionInternal(i),this.setValue(this.getValue())}setMin(e){this.setMinInternal(e),this.setValue(this.getValue())}setMinInternal(e){null==e?this.min_=-1/0:isNaN(e=Number(e))||(this.min_=e)}getMin(){return this.min_}setMax(e){this.setMaxInternal(e),this.setValue(this.getValue())}setMaxInternal(e){null==e?this.max_=1/0:isNaN(e=Number(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}));let i=t.indexOf(".");this.decimalPlaces=-1===i?e?0:null:t.length-i-1}getPrecision(){return this.precision_}doClassValidation_(e){return null===e||isNaN(e=Number((e=(e=(e=`${e}`.replace(/O/gi,"0")).replace(/,/g,"")).replace(/infinity/i,"Infinity"))||0))?null:(e=Math.min(Math.max(e,this.min_),this.max_),this.precision_&&isFinite(e)&&(e=Math.round(e/this.precision_)*this.precision_),null!==this.decimalPlaces&&(e=Number(e.toFixed(this.decimalPlaces))),e)}widgetCreate_(){let e=super.widgetCreate_();return this.min_>-1/0&&(e.min=`${this.min_}`,t2(e,aD.VALUEMIN,this.min_)),this.max_<1/0&&(e.max=`${this.max_}`,t2(e,aD.VALUEMAX,this.max_)),e}initView(){super.initView(),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyNumberField")}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};sy("field_number",dk),dk.prototype.DEFAULT_VALUE=0;var dw=class extends hh{constructor(e,t,i){super(String(null!=e?e:""),t,i),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(oY(e.text),void 0,e)}};sy("field_label_serializable",dw);var dv=class extends cd{constructor(e,t,i){super(cd.SKIP_SETUP),this.SERIALIZABLE=!0,this.value_=this.value_,this.checkChar=dv.CHECK_CHAR,e!==cd.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.checkCharacter&&(this.checkChar=e.checkCharacter)}saveState(){let e=this.saveLegacyState(dv);return null!==e?e:this.getValueBoolean()}initView(){super.initView();let e=this.getTextElement();eq(this.fieldGroup_,"blocklyCheckboxField"),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||dv.CHECK_CHAR,this.forceRerender()}showEditor_(){this.setValue(!this.value_)}doClassValidation_(e){return!0===e||"TRUE"===e?"TRUE":!1===e||"FALSE"===e?"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"string"==typeof e?"TRUE"===e:!!e}static fromJson(e){return new this(e.checked,void 0,e)}};dv.CHECK_CHAR="✓",sy("field_checkbox",dv),dv.prototype.DEFAULT_VALUE=!1;var dM=class{constructor(e,t){this.draggable=e,this.workspace=t,this.dragTarget=null,this.startLoc=e.getRelativeToSurfaceXY()}onDragStart(e){$.getGroup$$module$build$src$core$events$utils()||$.setGroup$$module$build$src$core$events$utils(!0),this.draggable.startDrag(e)}onDrag(e,t){this.moveDraggable(e,t),ni(t=this.getRoot(this.draggable))&&t.setDeleteStyle(this.wouldDeleteDraggable(e,t)),this.updateDragTarget(e)}updateDragTarget(e){e=this.workspace.getDragTarget(e);let t=this.getRoot(this.draggable);if(this.dragTarget!==e){let i;null==(i=this.dragTarget)||i.onDragExit(t),null==e||e.onDragEnter(t)}null==e||e.onDragOver(t),this.dragTarget=e}moveDraggable(e,t){t=this.pixelsToWorkspaceUnits(t),t=lt.sum(this.startLoc,t),this.draggable.drag(t,e)}wouldDeleteDraggable(e,t){return!!((e=this.workspace.getDragTarget(e))&&this.workspace.getComponentManager().hasCapability(e.id,r6.Capability.DELETE_AREA))&&e.wouldDelete(t)}onDragEnd(e){let t=$.getGroup$$module$build$src$core$events$utils();var i=this.workspace.getDragTarget(e);let o=this.getRoot(this.draggable);if(i){let e;null==(e=this.dragTarget)||e.onDrop(o)}this.shouldReturnToStart(e,o)&&this.draggable.revertDrag(),(i=ni(o)&&this.wouldDeleteDraggable(e,o))&&this.draggable instanceof hD&&sQ(this.draggable.getRootBlock()),this.draggable.endDrag(e),i&&ni(o)&&($.setGroup$$module$build$src$core$events$utils(t),o.dispose()),$.setGroup$$module$build$src$core$events$utils(!1),!i&&te(this.draggable)&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.draggable)}getRoot(e){return e instanceof hD?e.getRootBlock():e}shouldReturnToStart(e,t){return!!(e=this.workspace.getDragTarget(e))&&e.shouldPreventMove(t)}pixelsToWorkspaceUnits(e){return e=new lt(e.x/this.workspace.scale,e.y/this.workspace.scale),this.workspace.isMutator&&e.scale(1/this.workspace.options.parentWorkspace.scale),e}};ea(D.BLOCK_DRAGGER,y,dM);var dP={};dP.BlockDragStrategy=hN,dP.BubbleDragStrategy=c7,dP.CommentDragStrategy=cD,dP.Dragger=dM;var dB=class extends r0{constructor(e,t,i){super(e?e.workspace.id:void 0),this.type=rL.BLOCK_DRAG,e&&(this.blockId=e.id,this.isStart=t,this.blocks=i)}toJson(){let e=super.toJson();if(void 0===this.isStart)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(void 0===this.blockId)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,i){return(t=super.fromJson(e,t,null!=i?i:new dB)).isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};ea(D.EVENT,rL.BLOCK_DRAG,dB);var dx=class extends aC{constructor(e,t,i,o){super(e),this.type=rL.BLOCK_FIELD_INTERMEDIATE_CHANGE,this.recordUndo=!1,e&&(this.name=t,this.oldValue=i,this.newValue=o)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new dx)).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)))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)}};ea(D.EVENT,rL.BLOCK_FIELD_INTERMEDIATE_CHANGE,dx);var dF=class extends aC{constructor(e){super(e),this.type=rL.BLOCK_MOVE,e&&(e.isShadow()&&(this.recordUndo=!1),e=this.currentLocation(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new dF)).oldParentId=e.oldParentId,t.oldInputName=e.oldInputName,e.oldCoordinate&&(i=e.oldCoordinate.split(","),t.oldCoordinate=new lt(Number(i[0]),Number(i[1]))),t.newParentId=e.newParentId,t.newInputName=e.newInputName,e.newCoordinate&&(i=e.newCoordinate.split(","),t.newCoordinate=new lt(Number(i[0]),Number(i[1]))),void 0!==e.reason&&(t.reason=e.reason),void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}recordNew(){let 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={};let i=t.getParent();return i?(e.parentId=i.id,(t=i.getInputWithBlock(t))&&(e.inputName=t.name)):e.coordinate=t.getRelativeToSurfaceXY(),e}isNull(){return this.oldParentId===this.newParentId&&this.oldInputName===this.newInputName&<.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 i=t.getBlockById(this.blockId);if(i){var o=e?this.newParentId:this.oldParentId,s=e?this.newInputName:this.oldInputName;if(e=e?this.newCoordinate:this.oldCoordinate,o){var n=t.getBlockById(o);if(!n)return void console.warn("Can't connect to non-existent block: "+o)}if(i.getParent()&&i.unplug(),e)s=i.getRelativeToSurfaceXY(),i.moveBy(e.x-s.x,e.y-s.y,this.reason);else{let e,o;(!(t=i.outputConnection)||i.previousConnection&&i.previousConnection.isConnected())&&(t=i.previousConnection),i=null==(o=t)?void 0:o.type,s?(i=n.getInput(s))&&(e=i.connection):i===c5.PREVIOUS_STATEMENT&&(e=n.nextConnection),e&&t?t.connect(e):console.warn("Can't connect to non-existent input: "+s)}}else console.warn("Can't move non-existent block: "+this.blockId)}};ea(D.EVENT,rL.BLOCK_MOVE,dF);var dG,dH,dU,dW,dV,dK,dX,dY,dz,dj,dJ=class extends r0{constructor(e,t,i){super(e?e.workspace.id:void 0),this.type=rL.BUBBLE_OPEN,e&&(this.blockId=e.id,this.isOpen=t,this.bubbleType=i)}toJson(){let e=super.toJson();if(void 0===this.isOpen)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,i){return(t=super.fromJson(e,t,null!=i?i:new dJ)).isOpen=e.isOpen,t.bubbleType=e.bubbleType,t.blockId=e.blockId,t}};(e=dj||(dj={})).MUTATOR="mutator",e.COMMENT="comment",e.WARNING="warning",ea(D.EVENT,rL.BUBBLE_OPEN,dJ);var dZ={};dZ.BubbleOpen=dJ,dZ.BubbleType=dj;var dq=class extends rQ{constructor(e){super(),this.isBlank=!e,e&&(this.commentId=e.id,this.workspaceId=e.workspace.id,this.group=$.getGroup$$module$build$src$core$events$utils(),this.recordUndo=eG())}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new dq)).commentId=e.commentId,t}static CommentCreateDeleteHelper(e,t){let i=e.getEventWorkspace_();if(t){if(!e.json)throw Error("Encountered a comment event without proper json");tZ(e.json,i)}else{if(!e.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(t=i.getCommentById(e.commentId))?t.dispose():console.warn("Can't delete non-existent comment: "+e.commentId)}}},dQ=class extends dq{constructor(e,t,i){super(e),this.type=rL.COMMENT_CHANGE,e&&(this.oldContents_=void 0===t?"":t,this.newContents_=void 0===i?"":i)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new dQ)).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 i=e?this.newContents_:this.oldContents_;if(void 0===i){if(e)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson")}t.setText(i)}else console.warn("Can't change non-existent comment: "+this.commentId)}};ea(D.EVENT,rL.COMMENT_CHANGE,dQ);var d0=class extends dq{constructor(e,t){super(e),this.newCollapsed=t,this.type=rL.COMMENT_COLLAPSE}toJson(){let e=super.toJson();if(void 0===this.newCollapsed)throw Error("The new collapse value undefined. Either call recordNew, or call fromJson");return e.newCollapsed=this.newCollapsed,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d0)).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)}};ea(D.EVENT,rL.COMMENT_COLLAPSE,d0);var d1=class extends dq{constructor(e){super(e),this.type=rL.COMMENT_CREATE,e&&(this.xml=sa(e),this.json=tJ(e,{addCoordinates:!0}))}toJson(){let 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=sg(this.xml),e.json=this.json,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d1)).xml=$.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}run(e){dq.CommentCreateDeleteHelper(this,e)}};ea(D.EVENT,rL.COMMENT_CREATE,d1);var d2=class extends dq{constructor(e){super(e),this.type=rL.COMMENT_DELETE,e&&(this.xml=sa(e),this.json=tJ(e,{addCoordinates:!0}))}run(e){dq.CommentCreateDeleteHelper(this,!e)}toJson(){let 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=sg(this.xml),e.json=this.json,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d2)).xml=$.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}};ea(D.EVENT,rL.COMMENT_DELETE,d2);var d3=class extends r0{constructor(e,t){super(e?e.workspace.id:void 0),this.type=rL.COMMENT_DRAG,e&&(this.commentId=e.id,this.isStart=t)}toJson(){let e=super.toJson();if(void 0===this.isStart)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(void 0===this.commentId)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,i){return(t=super.fromJson(e,t,null!=i?i:new d3)).isStart=e.isStart,t.commentId=e.commentId,t}};ea(D.EVENT,rL.COMMENT_DRAG,d3);var d5=class extends dq{constructor(e){super(e),this.type=rL.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(){let 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,i){return t=super.fromJson(e,t,null!=i?i:new d5),i=e.oldCoordinate.split(","),t.oldCoordinate_=new lt(Number(i[0]),Number(i[1])),i=e.newCoordinate.split(","),t.newCoordinate_=new lt(Number(i[0]),Number(i[1])),t}isNull(){return lt.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_))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)}};ea(D.EVENT,rL.COMMENT_MOVE,d5);var d6=class extends dq{constructor(e){super(e),this.type=rL.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)))throw Error("The comment associated with the comment resize event could not be found");this.newSize=e.getSize()}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new d6)).oldSize=new ls(e.oldWidth,e.oldHeight),t.newSize=new ls(e.newWidth,e.newHeight),t}isNull(){return ls.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))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)}};ea(D.EVENT,rL.COMMENT_RESIZE,d6);var d4=class extends r0{constructor(e,t,i){super(i),this.type=rL.TOOLBOX_ITEM_SELECT,this.oldItem=null!=e?e:void 0,this.newItem=null!=t?t:void 0}toJson(){let e=super.toJson();return e.oldItem=this.oldItem,e.newItem=this.newItem,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d4)).oldItem=e.oldItem,t.newItem=e.newItem,t}};ea(D.EVENT,rL.TOOLBOX_ITEM_SELECT,d4);var d8=class extends uW{constructor(e,t,i){super(e),this.oldType=t,this.newType=i,this.type=rL.VAR_TYPE_CHANGE}toJson(){let e=super.toJson();if(!this.oldType||!this.newType)throw Error("The variable's types are undefined. Either pass them to the constructor, or call fromJson");return e.oldType=this.oldType,e.newType=this.newType,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d8)).oldType=e.oldType,t.newType=e.newType,t}run(e){let 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.oldType||!this.newType)throw Error("The variable's types are undefined. Either pass them to the constructor, or call fromJson");let i=t.getVariableMap().getVariableById(this.varId);i&&(e?t.getVariableMap().changeVariableType(i,this.newType):t.getVariableMap().changeVariableType(i,this.oldType))}};ea(D.EVENT,rL.VAR_TYPE_CHANGE,d8);var d9=class extends rQ{constructor(e){super(),this.isBlank=!0,this.recordUndo=!1,this.type=rL.FINISHED_LOADING,this.isBlank=!!e,e&&(this.workspaceId=e.id)}};ea(D.EVENT,rL.FINISHED_LOADING,d9),$.BLOCK_CHANGE$$module$build$src$core$events$events=rL.BLOCK_CHANGE,$.BLOCK_CREATE$$module$build$src$core$events$events=rL.BLOCK_CREATE,$.BLOCK_DELETE$$module$build$src$core$events$events=rL.BLOCK_DELETE,t=rL.BLOCK_DRAG,$.BLOCK_MOVE$$module$build$src$core$events$events=rL.BLOCK_MOVE,i=rL.BLOCK_FIELD_INTERMEDIATE_CHANGE,o=rL.BUBBLE_OPEN,s=rL.BLOCK_CHANGE,n=rL.CLICK,l=rL.COMMENT_CHANGE,a=rL.COMMENT_CREATE,c=rL.COMMENT_DELETE,h=rL.COMMENT_MOVE,u=rL.COMMENT_RESIZE,d=rL.COMMENT_DRAG,p=rL.BLOCK_CREATE,_=rL.BLOCK_DELETE,g=rL.FINISHED_LOADING,E=rL.BLOCK_MOVE,T=rL.SELECTED,m=rL.THEME_CHANGE,f=rL.TOOLBOX_ITEM_SELECT,I=rL.TRASHCAN_OPEN,S=rL.UI,R=rL.VAR_CREATE,b=rL.VAR_DELETE,C=rL.VAR_RENAME,O=rL.VIEWPORT_CHANGE,(A={}).Abstract=rQ,A.BLOCK_CHANGE=$.BLOCK_CHANGE$$module$build$src$core$events$events,A.BLOCK_CREATE=$.BLOCK_CREATE$$module$build$src$core$events$events,A.BLOCK_DELETE=$.BLOCK_DELETE$$module$build$src$core$events$events,A.BLOCK_DRAG=t,A.BLOCK_FIELD_INTERMEDIATE_CHANGE=i,A.BLOCK_MOVE=$.BLOCK_MOVE$$module$build$src$core$events$events,A.BUBBLE_OPEN=o,A.BUMP_EVENTS=z,A.BlockBase=aC,A.BlockChange=aO,A.BlockCreate=cK,A.BlockDelete=cZ,A.BlockDrag=dB,A.BlockFieldIntermediateChange=dx,A.BlockMove=dF,A.BubbleOpen=dJ,A.BubbleType=dj,A.CHANGE=s,A.CLICK=n,A.COMMENT_CHANGE=l,A.COMMENT_CREATE=a,A.COMMENT_DELETE=c,A.COMMENT_DRAG=d,A.COMMENT_MOVE=h,A.COMMENT_RESIZE=u,A.CREATE=p,A.Click=r1,A.ClickTarget=rq,A.CommentBase=dq,A.CommentChange=dQ,A.CommentCollapse=d0,A.CommentCreate=d1,A.CommentDelete=d2,A.CommentDrag=d3,A.CommentMove=d5,A.CommentResize=d6,A.DELETE=_,A.FINISHED_LOADING=g,A.FinishedLoading=d9,A.MOVE=E,A.SELECTED=T,A.Selected=cJ,A.THEME_CHANGE=m,A.TOOLBOX_ITEM_SELECT=f,A.TRASHCAN_OPEN=I,A.ThemeChange=cY,A.ToolboxItemSelect=d4,A.TrashcanOpen=uj,A.UI=S,A.UiBase=r0,A.VAR_CREATE=R,A.VAR_DELETE=b,A.VAR_RENAME=C,A.VIEWPORT_CHANGE=O,A.VarBase=uW,A.VarCreate=uV,A.VarDelete=uX,A.VarRename=uY,A.VarTypeChange=d8,A.ViewportChange=cz,A.clearPendingUndo=eK,A.disable=$.disable$$module$build$src$core$events$utils,A.disableOrphans=eJ,A.enable=$.enable$$module$build$src$core$events$utils,A.filter=eV,A.fire=eH,A.fromJson=ez,A.get=ej,A.getDescendantIds=eY,A.getGroup=$.getGroup$$module$build$src$core$events$utils,A.getRecordUndo=eG,A.isEnabled=eX,A.setGroup=$.setGroup$$module$build$src$core$events$utils,A.setRecordUndo=$.setRecordUndo$$module$build$src$core$events$utils;var d7={};d7.BottomRow=df,d7.ConstantProvider=dg,d7.Drawer=dE,d7.PathObject=dC,d7.RenderInfo=db,d7.Renderer=dO,d7.RightConnectionShape=dS,d7.StatementInput=dI,d7.TopRow=dR,rm();var pe={};pe.registerCleanup=n8,pe.registerCollapse=n7,pe.registerCollapseExpandBlock=rc,pe.registerComment=rl,pe.registerCommentCreate=rg,pe.registerCommentDelete=rp,pe.registerCommentDuplicate=r_,pe.registerCommentOptions=function(){r_(),rp(),rg()},pe.registerDefaultOptions=rm,pe.registerDelete=ru,pe.registerDeleteAll=rs,pe.registerDisable=rh,pe.registerDuplicate=rr,pe.registerExpand=re,pe.registerHelp=rd,pe.registerInline=ra,pe.registerRedo=n4,pe.registerUndo=n6;var pt="button",pi=class{load(e,t){return(e=new hB(t.getWorkspace(),t.targetWorkspace,e,!1)).show(),new hv(e,pt)}gapForItem(e,t){return t}disposeItem(e){(e=e.getElement())instanceof hB&&e.dispose()}getType(){return pt}};ea(D.FLYOUT_INFLATER,pt,pi);var po={};po.Bubble=he,po.MiniWorkspaceBubble=ht,po.TextBubble=hL,po.TextInputBubble=ut;var ps="block",pn=class{constructor(){this.permanentlyDisabledBlocks=new Set,this.listeners=new Map,this.capacityWrapper=this.filterFlyoutBasedOnCapacity.bind(this)}load(e,t){return this.setFlyout(t),(e=this.createBlock(e,t.getWorkspace())).isEnabled()?this.updateStateBasedOnCapacity(e):this.permanentlyDisabledBlocks.add(e),e.getDescendants(!1).forEach(e=>e.isInFlyout=!0),this.addBlockListeners(e),new hv(e,ps)}createBlock(e,t){return e.blockxml?(e="string"==typeof e.blockxml?$.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,t=sT(e,t)):(void 0===e.enabled&&(e.enabled="true"!==e.disabled&&!0!==e.disabled),void 0===e.disabledReasons&&!1===e.enabled&&(e.disabledReasons=[lJ]),"x"in e&&delete e.x,"y"in e&&delete e.y,t=iU(e,t)),t}gapForItem(e,t){let i;return e.gap?i=parseInt(String(e.gap)):e.blockxml&&(i=parseInt((e="string"==typeof e.blockxml?$.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml).getAttribute("gap"))),!i||isNaN(i)?t:i}disposeItem(e){(e=e.getElement())instanceof hD&&(this.removeListeners(e.id),e.dispose(!1,!1))}removeListeners(e){let t;(null!=(t=this.listeners.get(e))?t:[]).forEach(e=>eO(e)),this.listeners.delete(e)}setFlyout(e){if(this.flyout!==e){var t;if(this.flyout){let e;null==(e=this.flyout.targetWorkspace)||e.removeChangeListener(this.capacityWrapper)}this.flyout=e,null==(t=this.flyout.targetWorkspace)||t.addChangeListener(this.capacityWrapper)}}updateStateBasedOnCapacity(e){let t,i,o=null==(t=this.flyout)||null==(i=t.targetWorkspace)?void 0:i.isCapacityAvailable(t_(e));for(;e;)e.setDisabledReason(!o,"WORKSPACE_AT_BLOCK_CAPACITY"),e=e.getNextBlock()}addBlockListeners(e){let t=[];t.push(eb(e.getSvgRoot(),"pointerdown",e,t=>{let i,o,s=null==(i=this.flyout)||null==(o=i.targetWorkspace)?void 0:o.getGesture(t);s&&this.flyout&&(s.setStartBlock(e),s.handleFlyoutStart(t,this.flyout))})),t.push(eC(e.getSvgRoot(),"pointermove",null,()=>{let t,i;(null==(t=this.flyout)||null==(i=t.targetWorkspace)?0:i.isDragging())||e.addSelect()})),t.push(eC(e.getSvgRoot(),"pointerleave",null,()=>{let t,i;(null==(t=this.flyout)||null==(i=t.targetWorkspace)?0:i.isDragging())||e.removeSelect()})),this.listeners.set(e.id,t)}filterFlyoutBasedOnCapacity(e){!this.flyout||e&&e.type!==rL.BLOCK_CREATE&&e.type!==rL.BLOCK_DELETE||this.flyout.getWorkspace().getTopBlocks(!1).forEach(e=>{this.permanentlyDisabledBlocks.has(e)||this.updateStateBasedOnCapacity(e)})}getType(){return ps}};ea(D.FLYOUT_INFLATER,ps,pn);var pr=class extends uN{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;","}"])}},pl=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_+"\n"+this.inlineSteps_}drawTopCorner(e){this.steps_+=sV(e.xPos,this.info_.startY);for(let t=0,i;i=e.elements[t];t++)ur.isLeftSquareCorner(i)?this.steps_+=this.highlightConstants_.START_POINT:ur.isLeftRoundedCorner(i)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):ur.isPreviousConnection(i)?this.steps_+=this.notchPaths_.pathLeft:ur.isHat(i)?this.steps_+=this.startPaths_.path(this.RTL_):ur.isSpacer(i)&&0!==i.width&&(this.steps_+=sY("H",i.xPos+i.width-this.highlightOffset));this.steps_+=sY("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+sY("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(e){let t=e.getLastInput();if(this.RTL_){let i=e.height-t.connectionHeight;this.steps_+=sW(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+sY("v",i)}else this.steps_+=sW(t.xPos+t.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(e){let t=e.getLastInput();if(t)if(this.RTL_){let i=e.height-2*this.insideCornerPaths_.height;this.steps_+=sW(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+sY("v",i)+this.insideCornerPaths_.pathBottom(this.RTL_)+sK(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=sW(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+sK(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){let t=e.xPos+e.width-this.highlightOffset;e instanceof uC&&e.followsStatement&&(this.steps_+=sY("H",t)),this.RTL_&&(this.steps_+=sY("H",t),e.height>this.highlightOffset&&(this.steps_+=sY("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=sY("V",e.baseline-this.highlightOffset);else{let t=this.info_.bottomRow.elements[0];ur.isLeftSquareCorner(t)?this.steps_+=sW(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):ur.isLeftRoundedCorner(t)&&(this.steps_+=sW(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_+=sW(this.info_.startX,e):(this.steps_+=sW(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=sY("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,ur.isLeftRoundedCorner(e.elements[0])?this.steps_+=sY("V",this.outsideCornerPaths_.height):this.steps_+=sY("V",e.capline+this.highlightOffset))}drawInlineInput(e){let t=this.highlightOffset,i=e.xPos+e.connectionWidth;var o=e.centerline-e.height/2;let s=e.width-e.connectionWidth,n=o+t;this.RTL_?(o=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=sW(i-t,n)+sY("v",o)+this.puzzleTabPaths_.pathDown(this.RTL_)+sY("v",e)+sY("h",s)):this.inlineSteps_+=sW(e.xPos+e.width+t,n)+sY("v",e.height)+sY("h",-s)+sW(i,o+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},pa=class extends uy{constructor(e,t){super(e,t),this.highlighter_=new pl(t)}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights();let e=this.block_.pathObject;e.setPath(this.outlinePath_+"\n"+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_+=sY("H",e.xPos+e.width)+sY("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){let t=e.centerline-e.height/2;if(e.connectionModel){let i=e.xPos+e.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(i*=-1),e.connectionModel.setOffsetInBlock(i,t+e.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(e){let t=e.getLastInput();if(null==t?0:t.connectionModel){let i=e.xPos+e.statementEdge+t.notchOffset;i=this.info_.RTL?-1*i:i+this.constants_.DARK_PATH_OFFSET,t.connectionModel.setOffsetInBlock(i,e.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(e){let t=e.getLastInput();if(t&&t.connectionModel){let i=e.xPos+e.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionNextConnection_(){let e=this.info_.bottomRow;if(e.connection){let t=e.connection,i=t.xPos;t.connectionModel.setOffsetInBlock((this.info_.RTL?-i:i)+this.constants_.DARK_PATH_OFFSET/2,e.baseline+this.constants_.DARK_PATH_OFFSET)}}},pc=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=sV(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(){let e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,i=(1-Math.SQRT1_2)*(e+t)-t,o=sV(i,i)+sz("a","0 0,0",e,sH(-i-t,e-i)),s=sz("a","0 0,0",e+t,sH(e+t,e+t)),n=sV(i,-i)+sz("a","0 0,0",e+t,sH(e-i,i+t));return{width:e+t,height:e,pathTop:e=>e?o:"",pathBottom:e=>e?s:n}}makeOutsideCorner(){let e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,i=(1-Math.SQRT1_2)*(e-t)+t,o=sV(i,i)+sz("a","0 0,1",e-t,sH(e-i,-i+t)),s=sV(t,e)+sz("a","0 0,1",e-t,sH(e,-e+t)),n=-i,r=sV(i,n)+sz("a","0 0,1",e-t,sH(-i+t,-n-e));return{height:e,topLeft:e=>e?o:s,bottomLeft:()=>r}}makePuzzleTab(){let e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,i=sV(-2,-t+2.5+.9)+sK(-.45*e,-2.1),o=sY("v",2.5)+sV(-(.97*e),2.5)+sU("q",[sH(-(.05*e),10),sH(.3*e,9.5)])+sV(.67*e,-1.9)+sY("v",2.5),s=sY("v",-1.5)+sV(-.92*e,-.5)+sU("q",[sH(-.19*e,-5.5),sH(0,-11)])+sV(.92*e,1),n=sV(-5,t-.7)+sK(.46*e,-2.1);return{width:e,height:t,pathUp:e=>e?i:s,pathDown:e=>e?o:n}}makeNotch(){return{pathLeft:sY("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:sK(5.1,2.6)+sV(-10.2,6.8)+sK(5.1,2.6),height:12,width:10.2}}makeStartHat(){let e=this.constantProvider.START_HAT.height,t=sV(25,-8.7)+sU("c",[sH(29.7,-6.2),sH(57.2,-.5),sH(75,8.7)]),i=sU("c",[sH(17.8,-9.2),sH(45.3,-14.9),sH(75,-8.7)])+sW(100.5,e+.5);return{path:e=>e?t:i}}},ph=class extends uT{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)}},pu=class extends uA{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},pd=class extends uD{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 hI||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}addInput_(e,t){this.isInline&&e instanceof $.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new ph(this.constants_,e)),t.hasInlineInput=!0):e instanceof hI?(t.elements.push(new pu(this.constants_,e)),t.hasStatement=!0):e instanceof $.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new ud(this.constants_,e)),t.hasExternalInput=!0):(e instanceof hm||e instanceof hf)&&(t.minHeight=Math.max(t.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),this.isInline||null!==t.align||(t.align=e.align)}addElemSpacing_(){let e=!1;for(let t=0,i;i=this.rows[t];t++)i.hasExternalInput&&(e=!0);for(let i=0,o;o=this.rows[i];i++){var t=o.elements;if(o.elements=[],o.startsWithElemSpacer()&&o.elements.push(new uE(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let e=0;e<t.length-1;e++){o.elements.push(t[e]);let i=this.getInRowSpacing_(t[e],t[e+1]);o.elements.push(new uE(this.constants_,i))}o.elements.push(t[t.length-1]),o.endsWithElemSpacer()&&(t=this.getInRowSpacing_(t[t.length-1],null),e&&o.hasDummyInput&&(t+=this.constants_.TAB_WIDTH),o.elements.push(new uE(this.constants_,t)))}}}getInRowSpacing_(e,t){if(!e)return t&&ur.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&ur.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&ur.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!ur.isInput(e)&&(!t||ur.isStatementInput(t)))return ur.isField(e)&&e.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:ur.isIcon(e)?2*this.constants_.LARGE_PADDING+1:ur.isHat(e)?this.constants_.NO_PADDING:ur.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:ur.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:ur.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(ur.isInput(e)&&!t){if(ur.isExternalInput(e))return this.constants_.NO_PADDING;if(ur.isInlineInput(e))return this.constants_.LARGE_PADDING;if(ur.isStatementInput(e))return this.constants_.NO_PADDING}if(!ur.isInput(e)&&t&&ur.isInput(t)){if(ur.isField(e)&&e.isEditable){if(ur.isInlineInput(t)||ur.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(ur.isInlineInput(t)||ur.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(ur.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(ur.isIcon(e)&&t&&!ur.isInput(t))return this.constants_.LARGE_PADDING;if(ur.isInlineInput(e)&&t&&ur.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(ur.isLeftSquareCorner(e)&&t){if(ur.isHat(t))return this.constants_.NO_PADDING;if(ur.isPreviousConnection(t))return t.notchOffset;if(ur.isNextConnection(t))return t.notchOffset+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}if(ur.isLeftRoundedCorner(e)&&t){if(ur.isPreviousConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS;if(ur.isNextConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}return ur.isField(e)&&t&&ur.isField(t)&&e.isEditable===t.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING:t&&ur.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return ur.isTopRow(e)&&ur.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:ur.isTopRow(e)||ur.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(ur.isSpacer(t))return e.yPos+t.height/2;if(ur.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,ur.isNextConnection(t)?e+t.height/2:e-t.height/2;if(ur.isTopRow(e))return ur.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let i=e.yPos;return ur.isField(t)||ur.isIcon(t)?(i+=t.height/2,(e.hasInlineInput||e.hasStatement)&&t.height+this.constants_.TALL_INPUT_FIELD_OFFSET_Y<=e.height&&(i+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y)):i=ur.isInlineInput(t)?i+t.height/2:i+e.height/2,i}alignRowElements_(){if(this.isInline){var e=0,t=new WeakMap,i=null;for(let o=this.rows.length-1,s;s=this.rows[o];o--)t.set(s,e),ur.isInputRow(s)&&(s.hasStatement&&this.alignStatementRow_(s),i&&i.hasStatement&&s.width<i.width?t.set(s,i.width):e=s.hasStatement?s.width:Math.max(e,s.width),i=s);e=0;for(let o=0,s;s=this.rows[o];o++)s.hasStatement?e=this.getDesiredRowWidth_(s):ur.isSpacer(s)?s.width=Math.max(e,t.get(s)):(i=s.width,(e=Math.max(e,t.get(s))-i)>0&&this.addAlignmentPadding_(s,e),e=s.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 o=0,s;s=this.rows[o];o++){s.yPos=t,s.xPos=this.startX,t+=s.height,e=Math.max(e,s.widthWithConnectedBlocks);var i=t-this.topRow.ascenderHeight;s===this.bottomRow&&i<this.constants_.MIN_BLOCK_HEIGHT&&(i=this.constants_.MIN_BLOCK_HEIGHT-i,this.bottomRow.height+=i,t+=i),this.recordElemPositions_(s)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(i=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,i.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}},pp=class extends uk{constructor(e,t,i){super(e,t,i),this.constants=i,this.colourDark="#000000",this.svgPathDark=eZ(li.PATH,{class:"blocklyPathDark",transform:"translate(1,1)"}),this.svgRoot.insertBefore(this.svgPathDark,this.svgPath),this.svgPathLight=eZ(li.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=oW("#000",this.style.colourPrimary,.2)||this.colourDark}updateHighlighted(e){super.updateHighlighted(e),this.svgPathLight.style.display=e?"none":"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")}},p_=class extends uw{constructor(e){super(e),this.highlightConstants=null}init(e,t){super.init(e,t),this.highlightConstants=this.makeHighlightConstants_(),this.highlightConstants.init()}refreshDom(e,t,i){super.refreshDom(e,t,i),this.getHighlightConstants().init()}makeConstants_(){return new pr}makeRenderInfo_(e){return new pd(this,e)}makeDrawer_(e,t){return new pa(e,t)}makePathObject(e,t){return new pp(e,t,this.getConstants())}makeHighlightConstants_(){return new pc(this.getConstants())}getHighlightConstants(){if(!this.highlightConstants)throw Error("Cannot access the highlight constants because init has not been called");return this.highlightConstants}};nA("geras",p_);var pg={};pg.ConstantProvider=pr,pg.Drawer=pa,pg.HighlightConstantProvider=pc,pg.Highlighter=pl,pg.InlineInput=ph,pg.PathObject=pp,pg.RenderInfo=pd,pg.Renderer=p_,pg.StatementInput=pu;var pE=class extends uD{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++){let o=this.rows[t];var i=o.elements;if(o.elements=[],o.startsWithElemSpacer()&&o.elements.push(new uE(this.constants_,this.getInRowSpacing_(null,i[0]))),i.length){for(let e=0;e<i.length-1;e++){o.elements.push(i[e]);let t=this.getInRowSpacing_(i[e],i[e+1]);o.elements.push(new uE(this.constants_,t))}o.elements.push(i[i.length-1]),o.endsWithElemSpacer()&&(i=this.getInRowSpacing_(i[i.length-1],null),e&&o.hasDummyInput&&(i+=this.constants_.TAB_WIDTH),o.elements.push(new uE(this.constants_,i)))}}}getInRowSpacing_(e,t){if(!e)return t&&ur.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&ur.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&ur.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!ur.isInput(e)&&!t)return ur.isField(e)&&e.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:ur.isIcon(e)?2*this.constants_.LARGE_PADDING+1:ur.isHat(e)?this.constants_.NO_PADDING:ur.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:ur.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:ur.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(ur.isInput(e)&&!t){if(ur.isExternalInput(e))return this.constants_.NO_PADDING;if(ur.isInlineInput(e))return this.constants_.LARGE_PADDING;if(ur.isStatementInput(e))return this.constants_.NO_PADDING}if(!ur.isInput(e)&&t&&ur.isInput(t)){if(ur.isField(e)&&e.isEditable){if(ur.isInlineInput(t)||ur.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(ur.isInlineInput(t)||ur.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(ur.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(ur.isIcon(e)&&t&&!ur.isInput(t))return this.constants_.LARGE_PADDING;if(ur.isInlineInput(e)&&t&&ur.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(ur.isLeftSquareCorner(e)&&t){if(ur.isHat(t))return this.constants_.NO_PADDING;if(ur.isPreviousConnection(t)||ur.isNextConnection(t))return t.notchOffset}return ur.isLeftRoundedCorner(e)&&t?t.notchOffset-this.constants_.CORNER_RADIUS:ur.isField(e)&&t&&ur.isField(t)&&e.isEditable===t.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING:t&&ur.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return ur.isTopRow(e)&&ur.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:ur.isTopRow(e)||ur.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(ur.isSpacer(t))return e.yPos+t.height/2;if(ur.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,ur.isNextConnection(t)?e+t.height/2:e-t.height/2;if(ur.isTopRow(e))return ur.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let i=e.yPos;return ur.isField(t)&&e.hasStatement?i+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+t.height/2):i+e.height/2}finalize_(){let e=0,t=0;for(var i=0;i<this.rows.length;i++){let s=this.rows[i];s.yPos=t,s.xPos=this.startX,t+=s.height,e=Math.max(e,s.widthWithConnectedBlocks);var o=t-this.topRow.ascenderHeight;s===this.bottomRow&&o<this.constants_.MIN_BLOCK_HEIGHT&&(o=this.constants_.MIN_BLOCK_HEIGHT-o,this.bottomRow.height+=o,t+=o),this.recordElemPositions_(s)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(i=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,i.getHeightWidth().width)),this.bottomRow.baseline=t-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX,this.height=t,this.startY=this.topRow.capline}},pT=class extends uw{constructor(e){super(e)}makeRenderInfo_(e){return new pE(this,e)}};nA("thrasos",pT);var pm={};pm.RenderInfo=pE,pm.Renderer=pT;var pf=new c4("zelos",{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"}},{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"}}),pI=class{constructor(e,t,i){this.id_=e.toolboxitemid||ey(),this.level_=(this.parent_=i||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){}getFocusableElement(){let e=this.getDiv();if(!e)throw Error("Trying to access toolbox item before DOM is initialized.");if(!(e instanceof HTMLElement))throw Error("Toolbox item div is unexpectedly not an HTML element.");return e}getFocusableTree(){return this.parentToolbox_}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}},pS=class extends pI{constructor(e,t,i){super(e,t,i),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_(),"true"===this.toolboxItemDef_.hidden&&this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategoryContainer",row:"blocklyToolboxCategory",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyToolboxCategoryIcon",label:"blocklyToolboxCategoryLabel",contents:"blocklyToolboxCategoryGroup",selected:"blocklyToolboxSelected",openicon:"blocklyToolboxCategoryIconOpen",closedicon:"blocklyToolboxCategoryIconClosed"}}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else if(e=e.contents)for(let t=0;t<e.length;t++){let i=e[t];Array.isArray(this.flyoutItems_)&&this.flyoutItems_.push(i)}}parseCategoryDef_(e){this.name_="name"in e?oY(e.name):"",this.colour_=this.getColour_(e),Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}createDom_(){this.htmlDiv_=this.createContainer_(),t1(this.htmlDiv_,lH.TREEITEM),t2(this.htmlDiv_,aD.SELECTED,!1),t2(this.htmlDiv_,aD.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_(),t1(this.iconDom_,lH.PRESENTATION),this.rowContents_.appendChild(this.iconDom_),this.labelDom_=this.createLabelDom_(this.name_),this.rowContents_.appendChild(this.labelDom_);let e=this.labelDom_.getAttribute("id");return e&&t2(this.htmlDiv_,aD.LABELLEDBY,e),this.addColourBorder_(this.colour_),this.htmlDiv_}createContainer_(){let e=document.createElement("div");e.tabIndex=-1,e.id=this.getId();let t=this.cssConfig_.container;return t&&eq(e,t),e}createRowContainer_(){let e=document.createElement("div");var t=this.cssConfig_.row;return t&&eq(e,t),t=`${pS.nestedPadding*this.getLevel()}px`,this.workspace_.RTL?e.style.paddingRight=t:e.style.paddingLeft=t,e}createRowContentsContainer_(){let e=document.createElement("div"),t=this.cssConfig_.rowcontentcontainer;return t&&eq(e,t),e}createIconDom_(){let e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){let t=this.cssConfig_.icon;t&&eq(e,t)}return e.style.display="inline-block",e}createLabelDom_(e){let t=document.createElement("span");return t.setAttribute("id",this.getId()+".label"),t.textContent=e,(e=this.cssConfig_.label)&&eq(t,e),t}refreshTheme(){this.colour_=this.getColour_(this.toolboxItemDef_),this.addColourBorder_(this.colour_)}addColourBorder_(e){e&&(e=pS.borderWidth+"px solid "+(e||"#ddd"),this.workspace_.RTL?this.rowDiv_.style.borderRight=e:this.rowDiv_.style.borderLeft=e)}getColour_(e){let 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(null==(e=oY(e))||""===e)return"";var t=Number(e);return isNaN(t)?(t=oF(e))?t:(console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+e),""):oV(t)}openIcon_(e){if(e){var t=this.cssConfig_.closedicon;t&&eQ(e,t),(t=this.cssConfig_.openicon)&&eq(e,t)}}closeIcon_(e){if(e){var t=this.cssConfig_.openicon;t&&eQ(e,t),(t=this.cssConfig_.closedicon)&&eq(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()).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){let e=this.parseColour(pS.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||e,t&&eq(this.rowDiv_,t)}else this.rowDiv_.style.backgroundColor="",t&&e0(this.rowDiv_,t);t2(this.htmlDiv_,aD.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_="string"==typeof e?{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:tF(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(){e2(this.htmlDiv_)}};pS.registrationName="category",pS.nestedPadding=19,pS.borderWidth=8,pS.defaultBackgroundColour="#57e",tf('\n.blocklyToolboxCategory:not(.blocklyToolboxSelected):hover {\n background-color: rgba(255, 255, 255, .2);\n}\n\n.blocklyToolbox[layout="h"] .blocklyToolboxCategoryContainer {\n margin: 1px 5px 1px 0;\n}\n\n.blocklyToolbox[dir="RTL"][layout="h"] .blocklyToolboxCategoryContainer {\n margin: 1px 0 1px 5px;\n}\n\n.blocklyToolboxCategory {\n height: 22px;\n line-height: 22px;\n margin-bottom: 3px;\n padding-right: 8px;\n white-space: nowrap;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxCategory {\n margin-left: 8px;\n padding-right: 0;\n}\n\n.blocklyToolboxCategoryIcon {\n background-image: url(<<<PATH>>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyToolboxCategoryIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxCategoryIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyToolboxCategoryIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyToolboxCategoryLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyToolboxCategoryLabel {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxSelected .blocklyToolboxCategoryLabel {\n color: #fff;\n}\n'),ea(D.TOOLBOX_ITEM,pS.registrationName,pS);var pR=class extends pI{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_(){let e=document.createElement("div");e.tabIndex=-1,e.id=this.getId();let t=this.cssConfig_.container;return t&&eq(e,t),this.htmlDiv=e}getDiv(){return this.htmlDiv}dispose(){e2(this.htmlDiv)}};pR.registrationName="sep",tf('\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolbox[layout="h"] .blocklyTreeSeparator {\n border-right: solid #e5e5e5 1px;\n border-bottom: none;\n height: auto;\n margin: 0 5px 0 5px;\n padding: 5px 0;\n width: 0;\n}\n'),ea(D.TOOLBOX_ITEM,pR.registrationName,pR);var pb=class extends pS{constructor(e,t,i){super(e,t,i),this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[]}makeDefaultCssConfig_(){let e=super.makeDefaultCssConfig_();return e.contents="blocklyToolboxCategoryGroup",e}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else{let t=e.contents;if(t){this.flyoutItems_=[],e=!0;for(let i=0;i<t.length;i++){let o=t[i];!ed(D.TOOLBOX_ITEM,o.kind)||o.kind.toLowerCase()===pR.registrationName&&e?(this.flyoutItems_.push(o),e=!0):(this.createToolboxItem(o),e=!1)}}}}createToolboxItem(e){let t=e.kind;"CATEGORY"===t.toUpperCase()&&tH(e)&&(t=pb.registrationName),e=new(ep(D.TOOLBOX_ITEM,t))(e,this.parentToolbox_,this),this.toolboxItems_.push(e)}init(){super.init(),this.setExpanded("true"===this.toolboxItemDef_.expanded||!0===this.toolboxItemDef_.expanded)}createDom_(){super.createDom_();let e=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(e),t1(this.subcategoriesDiv_,lH.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.closeIcon_(this.iconDom_),t2(this.htmlDiv_,aD.EXPANDED,!1),this.htmlDiv_}createIconDom_(){let e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){let t=this.cssConfig_.icon;t&&eq(e,t),e.style.visibility="visible"}return e.style.display="inline-block",e}createSubCategoriesDom_(e){let t=document.createElement("div");t.style.display="none";var i=this.cssConfig_.contents;for(i&&eq(t,i),i=0;i<e.length;i++){let o=e[i];o.init();let s=o.getDiv();if(t.appendChild(s),o.getClickTarget){let e;null==(e=o.getClickTarget())||e.setAttribute("id",o.getId())}}return t}setExpanded(e){if(this.expanded_!==e){if(this.expanded_=e)this.subcategoriesDiv_.style.display="block",this.openIcon_(this.iconDom_);else{let e;null==(e=this.parentToolbox_.getFlyout())||e.setVisible(!1),this.subcategoriesDiv_.style.display="none",this.closeIcon_(this.iconDom_)}t2(this.htmlDiv_,aD.EXPANDED,e),this.parentToolbox_.handleToolboxItemResize()}}setVisible_(e){this.htmlDiv_.style.display=e?"block":"none";let t=this.getChildToolboxItems();for(let i=0;i<t.length;i++)t[i].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_}};pb.registrationName="collapsibleCategory",ea(D.TOOLBOX_ITEM,pb.registrationName,pb);var pC=class extends hw{constructor(e){super(),this.id="toolbox",this.contentsDiv_=this.HtmlDiv=null,this.isVisible_=!1,this.height_=this.width_=0,this.flyout=null,this.contents=new Map,this.previouslySelectedItem_=this.selectedItem_=null,this.boundEvents_=[],this.workspace_=e,this.toolboxDef_=e.options.languageTree||{contents:[]},this.horizontalLayout=e.options.horizontalLayout,this.RTL=e.options.RTL,this.toolboxPosition=e.options.toolboxPosition}onShortcut(e){return!1}init(){var e=this.workspace_;let t=e.getParentSvg();this.flyout=this.createFlyout_(),this.HtmlDiv=this.createDom_(this.workspace_);let i=this.flyout.createDom("svg");eq(i,"blocklyToolboxFlyout"),e3(i,t),this.setVisible(!0),this.flyout.init(e),this.render(this.toolboxDef_),(e=e.getThemeManager()).subscribe(this.HtmlDiv,"toolboxBackgroundColour","background-color"),e.subscribe(this.HtmlDiv,"toolboxForegroundColour","color"),this.workspace_.getComponentManager().addComponent({component:this,weight:r6.ComponentWeight.TOOLBOX_WEIGHT,capabilities:[r6.Capability.AUTOHIDEABLE,r6.Capability.DELETE_AREA,r6.Capability.DRAG_TARGET]}),$.getFocusManager$$module$build$src$core$focus_manager().registerTree(this,!0)}createDom_(e){e=e.getParentSvg();let t=this.createContainer_();return t.id=ey(),this.contentsDiv_=this.createContentsContainer_(),t1(this.contentsDiv_,lH.TREE),t.appendChild(this.contentsDiv_),e.parentNode.insertBefore(t,e),this.attachEvents_(t,this.contentsDiv_),t}createContainer_(){let e=document.createElement("div");return e.setAttribute("layout",this.isHorizontal()?"h":"v"),eq(e,"blocklyToolbox"),e.setAttribute("dir",this.RTL?"RTL":"LTR"),e}createContentsContainer_(){let e=document.createElement("div");return eq(e,"blocklyToolboxCategoryGroup"),this.isHorizontal()&&(e.style.flexDirection="row"),e}attachEvents_(e,t){e=eb(e,"pointerdown",this,this.onClick_,!1),this.boundEvents_.push(e),t=eb(t,"keydown",this,this.onKeyDown_,!1),this.boundEvents_.push(t)}onClick_(e){if(e$(e)||e.target===this.HtmlDiv)tl().hideChaff(!1);else{var t=e.target.getAttribute("id");t&&(t=this.getToolboxItemById(t)).isSelectable()&&(this.setSelectedItem(t),t.onClick(e)),tl().hideChaff(!0)}ef()}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_(){let e=this.workspace_,t=e.copyOptionsForFlyout();return t.toolboxPosition=e.options.toolboxPosition,new(e.horizontalLayout?eE(D.FLYOUTS_HORIZONTAL_TOOLBOX,e.options,!0):eE(D.FLYOUTS_VERTICAL_TOOLBOX,e.options,!0))(t)}render(e){this.toolboxDef_=e,this.contents.forEach(e=>e.dispose()),this.contents.clear(),this.renderContents_(e.contents),this.position(),this.handleToolboxItemResize()}renderContents_(e){let t=document.createDocumentFragment();for(let i=0;i<e.length;i++)this.createToolboxItem(e[i],t);this.contentsDiv_.appendChild(t)}createToolboxItem(e,t){var i=e.kind;"CATEGORY"===i.toUpperCase()&&tH(e)&&(i=pb.registrationName),(i=ep(D.TOOLBOX_ITEM,i.toLowerCase()))&&((e=new i(e,this)).init(),this.addToolboxItem_(e),(i=e.getDiv())&&t.appendChild(i),e.getClickTarget()&&e.getClickTarget().setAttribute("id",e.getId()))}addToolboxItem_(e){if(this.contents.set(e.getId(),e),e.isCollapsible()){e=e.getChildToolboxItems();for(let t=0;t<e.length;t++)this.addToolboxItem_(e[t])}}getToolboxItems(){return[...this.contents.values()]}addStyle(e){e&&this.HtmlDiv&&eq(this.HtmlDiv,e)}removeStyle(e){e&&this.HtmlDiv&&e0(this.HtmlDiv,e)}getClientRect(){if(!this.HtmlDiv||!this.isVisible_)return null;var e=this.HtmlDiv.getBoundingClientRect();let t=e.top,i=t+e.height,o=e.left;return e=o+e.width,this.toolboxPosition===lS.TOP?new lo(-1e7,i,-1e7,1e7):this.toolboxPosition===lS.BOTTOM?new lo(t,1e7,-1e7,1e7):this.toolboxPosition===lS.LEFT?new lo(-1e7,1e7,-1e7,e):new lo(-1e7,1e7,o,1e7)}wouldDelete(e){return e instanceof hD?this.updateWouldDelete_(!e.getParent()&&e.isDeletable()):this.updateWouldDelete_(ni(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){let t=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";e?this.addStyle(t):this.removeStyle(t)}getToolboxItemById(e){return this.contents.get(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(){let 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===lS.TOP?t.style.top="0":t.style.bottom="0"):(this.toolboxPosition===lS.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(){let e=this.workspace_;var t=this.HtmlDiv.getBoundingClientRect();let i=this.getFlyout(),o=this.toolboxPosition===lS.LEFT?e.scrollX+t.width+((null==i?0:i.isVisible())?i.getWidth():0):e.scrollX;t=this.toolboxPosition===lS.TOP?e.scrollY+t.height+((null==i?0:i.isVisible())?i.getHeight():0):e.scrollY,e.translate(o,t),tp(e)}clearSelection(){this.setSelectedItem(null)}refreshTheme(){this.contents.forEach(e=>{e.refreshTheme&&e.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){let t=this.selectedItem_;(e||t)&&(!e||e.isSelectable())&&(this.shouldDeselectItem_(t,e)&&null!==t&&this.deselectItem_(t),this.shouldSelectItem_(t,e)&&null!==e&&this.selectItem_(t,e),this.updateFlyout_(t,e),this.fireSelectEvent(t,e))}shouldDeselectItem_(e,t){return null!==e&&(!e.isCollapsible()||e!==t)}shouldSelectItem_(e,t){return null!==t&&t!==e}deselectItem_(e){this.selectedItem_=null,this.previouslySelectedItem_=e,e.setSelected(!1),t2(this.contentsDiv_,aD.ACTIVEDESCENDANT,"")}selectItem_(e,t){this.selectedItem_=t,this.previouslySelectedItem_=e,t.setSelected(!0),t2(this.contentsDiv_,aD.ACTIVEDESCENDANT,t.getId())}selectItemByPosition(e){(e=this.getToolboxItems()[e])&&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){let i=e&&e.getName(),o=t&&t.getName();e===t&&(o=null),eH(e=new(ej(rL.TOOLBOX_ITEM_SELECT))(i,o,this.workspace_.id))}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))}selectChild(){if(!this.selectedItem_||!this.selectedItem_.isCollapsible())return!1;let e=this.selectedItem_;return e.isExpanded()?this.selectNext():e.toggleExpanded(),!0}selectNext(){if(!this.selectedItem_)return!1;let e=[...this.contents.values()],t=e.indexOf(this.selectedItem_)+1;if(t>-1&&t<e.length){let i=e[t];for(;i&&!i.isSelectable();)i=e[++t];if(i&&i.isSelectable())return this.setSelectedItem(i),!0}return!1}selectPrevious(){if(!this.selectedItem_)return!1;let e=[...this.contents.values()],t=e.indexOf(this.selectedItem_)-1;if(t>-1&&t<e.length){let i=e[t];for(;i&&!i.isSelectable();)i=e[--t];if(i&&i.isSelectable())return this.setSelectedItem(i),!0}return!1}dispose(){this.workspace_.getComponentManager().removeComponent("toolbox"),this.flyout.dispose(),this.contents.forEach(e=>e.dispose());for(let e=0;e<this.boundEvents_.length;e++)eO(this.boundEvents_[e]);this.boundEvents_=[],this.contents.clear(),this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),e2(this.HtmlDiv)),$.getFocusManager$$module$build$src$core$focus_manager().unregisterTree(this)}getFocusableElement(){if(!this.HtmlDiv)throw Error("Toolbox DOM has not yet been created.");return this.HtmlDiv}getFocusableTree(){return this}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getRootFocusableNode(){return this}getRestoredFocusableNode(e){if(!e||e===this){let e;return null!=(e=this.getToolboxItems().find(e=>e.isSelectable()))?e:null}return null}getNestedTrees(){return[]}lookUpFocusableNode(e){return this.getToolboxItemById(e)}onTreeFocus(e,t){e!==this?this.getSelectedItem()!==e&&this.setSelectedItem(e):this.clearSelection()}onTreeBlur(e){let t;e&&e===(null==(t=this.flyout)?void 0:t.getWorkspace())||(this.clearSelection(),this.flyout&&nl(this.flyout)&&this.flyout.autoHide(!1))}};tf('\n.blocklyToolboxDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolbox {\n box-sizing: border-box;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxCategoryGroup {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxCategoryGroup:focus {\n outline: none;\n}\n'),ea(D.TOOLBOX,y,pC);var pO=c5.INPUT_VALUE,pA=c5.OUTPUT_VALUE,p$=c5.NEXT_STATEMENT,pN=c5.PREVIOUS_STATEMENT,pL=lS.TOP,py=lS.BOTTOM,pD=lS.LEFT,pk=lS.RIGHT;uF.prototype.newBlock=function(e,t){return new hS(this,e,t)},uH.prototype.newBlock=function(e,t){return new hD(this,e,t)},uF.prototype.newComment=function(e){return new cU(this,e)},uH.prototype.newComment=function(e){return new cW(this,e)},uH.newTrashcan=function(e){return new uJ(e)},ht.prototype.newWorkspaceSvg=function(e){return new uH(e)},$.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=(e=nu(e))[0].concat(e[1]);for(let t=0;t<e.length;t++)this.getName(e[t][0],$.Names$$module$build$src$core$names.NameType.PROCEDURE)};var pw={};return pw.Block=hS,pw.BlockFlyoutInflater=pn,pw.BlockNavigationPolicy=hU,pw.BlockSvg=hD,pw.Blocks=w,pw.ButtonFlyoutInflater=pi,pw.COLLAPSED_FIELD_NAME=lj,pw.COLLAPSED_INPUT_NAME=lz,pw.COLLAPSE_CHARS=30,pw.CodeGenerator=$.CodeGenerator$$module$build$src$core$generator,pw.CollapsibleToolboxCategory=pb,pw.ComponentManager=r6,pw.Connection=hl,pw.ConnectionChecker=ux,pw.ConnectionDB=cj,pw.ConnectionNavigationPolicy=hK,pw.ConnectionType=c5,pw.ContextMenu=c$,pw.ContextMenuItems=pe,pw.ContextMenuRegistry=cN,pw.Css=le,pw.DELETE_VARIABLE_ID=hp,pw.DeleteArea=hw,pw.DragTarget=hk,pw.DropDownDiv=aq,pw.Events=A,pw.Extensions=hs,pw.Field=cd,pw.FieldCheckbox=dv,pw.FieldDropdown=c0,pw.FieldImage=dT,pw.FieldLabel=hh,pw.FieldLabelSerializable=dw,pw.FieldNavigationPolicy=hX,pw.FieldNumber=dk,pw.FieldTextInput=$.FieldTextInput$$module$build$src$core$field_textinput,pw.FieldVariable=dD,pw.Flyout=h0,pw.FlyoutButton=hB,pw.FlyoutButtonNavigationPolicy=hx,pw.FlyoutItem=hv,pw.FlyoutMetricsManager=hP,pw.FlyoutNavigationPolicy=hF,pw.FlyoutNavigator=hZ,pw.FlyoutSeparator=hG,pw.FlyoutSeparatorNavigationPolicy=hH,pw.FocusManager=rG,pw.FocusableTreeTraverser=rx,pw.Generator=$.CodeGenerator$$module$build$src$core$generator,pw.Gesture=h6,pw.Grid=h4,pw.HorizontalFlyout=dy,pw.INPUT_VALUE=pO,pw.Input=hT,pw.InsertionMarkerPreviewer=dA,pw.KeyboardNavigationController=h1,pw.LabelFlyoutInflater=d_,pw.LineCursor=h7,pw.Marker=h9,pw.MarkerManager=ue,pw.Menu=lX,pw.MenuItem=lK,pw.MetricsManager=hM,pw.Msg=$.Msg$$module$build$src$core$msg,pw.NEXT_STATEMENT=p$,pw.Names=$.Names$$module$build$src$core$names,pw.Navigator=hJ,pw.OPPOSITE_TYPE=hu,pw.OUTPUT_VALUE=pA,pw.Options=c9,pw.PREVIOUS_STATEMENT=pN,pw.PROCEDURE_CATEGORY_NAME=dX,pw.Procedures=dY,pw.RENAME_VARIABLE_ID=hd,pw.RenderedConnection=h_,pw.Scrollbar=lh,pw.ScrollbarPair=hq,pw.SeparatorFlyoutInflater=hQ,pw.ShortcutItems=dl,pw.ShortcutRegistry=rW,pw.TOOLBOX_AT_BOTTOM=py,pw.TOOLBOX_AT_LEFT=pD,pw.TOOLBOX_AT_RIGHT=pk,pw.TOOLBOX_AT_TOP=pL,pw.Theme=c4,pw.ThemeManager=uM,pw.Themes={Classic:c8,Zelos:pf},pw.Toast=l8,pw.Toolbox=pC,pw.ToolboxCategory=pS,pw.ToolboxItem=pI,pw.ToolboxSeparator=pR,pw.Tooltip=cr,pw.Touch=F,pw.Trashcan=uJ,pw.UnattachedFieldError=cp,pw.VARIABLE_CATEGORY_NAME=ah,pw.VARIABLE_DYNAMIC_CATEGORY_NAME=uP,pw.VERSION="12.2.0",pw.VariableMap=uz,pw.VariableModel=uK,pw.Variables=ap,pw.VariablesDynamic=uB,pw.VerticalFlyout=dL,pw.WidgetDiv=cb,pw.Workspace=uF,pw.WorkspaceAudio=uG,pw.WorkspaceDragger=h5,pw.WorkspaceNavigationPolicy=hj,pw.WorkspaceSvg=uH,pw.Xml=cV,pw.ZoomControls=lN,pw.blockAnimations=hC,pw.blockRendering=uv,pw.browserEvents=Y,pw.bubbles=po,pw.bumpObjects=h$,pw.clipboard=dn,pw.comments=dr,pw.common=rZ,pw.config=$.config$$module$build$src$core$config,pw.constants={COLLAPSED_FIELD_NAME:lj,COLLAPSED_INPUT_NAME:lz,MANUALLY_DISABLED:lJ},pw.defineBlocksWithJsonArray=tE,pw.dialog=ar,pw.dragging=dP,pw.fieldRegistry=cQ,pw.geras=pg,pw.getFocusManager=$.getFocusManager$$module$build$src$core$focus_manager,pw.getMainWorkspace=tl,pw.getSelected=tc,pw.hasBubble=i1,pw.hideChaff=function(e){tl().hideChaff(e)},pw.icons=us,pw.inject=function(e,t){var i;let o=null;if(o="string"==typeof e?document.getElementById(e)||document.querySelector(e):e,!document.contains(o)&&document!==(null==(i=o)?void 0:i.ownerDocument))throw Error("Error: container is not in current document");e=new c9(t||{}),eq(i=document.createElement("div"),"injectionDiv"),(null==t?0:t.rtl)&&eq(i,"blocklyRTL"),o.appendChild(i),t=n0(i,e);let s=n1(i,t,e);return n2(s),ta(s),tp(s),i.addEventListener("focusin",function(){ta(s)}),eb(i,"keydown",null,tT),s},pw.inputs=d$,pw.isCopyable=nH,pw.isDeletable=ni,pw.isDraggable=nr,pw.isIcon=sq,pw.isObservable=nh,pw.isPaster=function(e){return e&&"function"==typeof e.paste},pw.isRenderedElement=function(e){return e&&"function"==typeof e.getSvgRoot},pw.isSelectable=tt,pw.isSerializable=t3,pw.isVariableBackedParameterModel=ic,pw.keyboardNavigationController=h2,pw.layers={BLOCK:50,BUBBLE:100},pw.navigateBlock=nn,pw.navigateStacks=ns,pw.procedures=dY,pw.registry=k,pw.renderManagement=l3,pw.serialization={blocks:aR,exceptions:aI,priorities:{BLOCKS:50,PROCEDURES:75,VARIABLES:100,WORKSPACE_COMMENTS:25},procedures:dc,registry:lL,variables:du,workspaceComments:lD,workspaces:dd},pw.setLocale=ak,pw.setParentContainer=td,pw.svgResize=tp,pw.thrasos=pm,pw.uiPosition=lA,pw.utils=hr,pw.zelos=d7,pw.__namespace__=$,pw},"function"==typeof define&&define.amd?define([],i):e.exports=i()}),u("cWmWX",function(e,t){var i;e.exports,i=function(){var e=e||{Msg:Object.create(null)};return e.Msg.ADD_COMMENT="Add Comment",e.Msg.ALT_KEY="Alt",e.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE="Can't delete the variable '%1' because it's part of the definition of the function '%2'",e.Msg.CHANGE_VALUE_TITLE="Change value:",e.Msg.CHROME_OS="ChromeOS",e.Msg.CLEAN_UP="Clean up Blocks",e.Msg.CLOSE="Close",e.Msg.COLLAPSED_WARNINGS_WARNING="Collapsed blocks contain warnings.",e.Msg.COLLAPSE_ALL="Collapse Blocks",e.Msg.COLLAPSE_BLOCK="Collapse Block",e.Msg.COLOUR_BLEND_COLOUR1="colour 1",e.Msg.COLOUR_BLEND_COLOUR2="colour 2",e.Msg.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp",e.Msg.COLOUR_BLEND_RATIO="ratio",e.Msg.COLOUR_BLEND_TITLE="blend",e.Msg.COLOUR_BLEND_TOOLTIP="Blends two colours together with a given ratio (0.0 - 1.0).",e.Msg.COLOUR_PICKER_HELPURL="https://en.wikipedia.org/wiki/Color",e.Msg.COLOUR_PICKER_TOOLTIP="Choose a colour from the palette.",e.Msg.COLOUR_RANDOM_HELPURL="http://randomcolour.com",e.Msg.COLOUR_RANDOM_TITLE="random colour",e.Msg.COLOUR_RANDOM_TOOLTIP="Choose a colour at random.",e.Msg.COLOUR_RGB_BLUE="blue",e.Msg.COLOUR_RGB_GREEN="green",e.Msg.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html",e.Msg.COLOUR_RGB_RED="red",e.Msg.COLOUR_RGB_TITLE="colour with",e.Msg.COLOUR_RGB_TOOLTIP="Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 100.",e.Msg.COMMAND_KEY="⌘ Command",e.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/google/blockly/wiki/Loops#loop-termination-blocks",e.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="break out of loop",e.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continue with next iteration of loop",e.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="Break out of the containing loop.",e.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="Skip the rest of this loop, and continue with the next iteration.",e.Msg.CONTROLS_FLOW_STATEMENTS_WARNING="Warning: This block may only be used within a loop.",e.Msg.CONTROLS_FOREACH_HELPURL="https://github.com/google/blockly/wiki/Loops#for-each",e.Msg.CONTROLS_FOREACH_TITLE="for each item %1 in list %2",e.Msg.CONTROLS_FOREACH_TOOLTIP="For each item in a list, set the variable '%1' to the item, and then do some statements.",e.Msg.CONTROLS_FOR_HELPURL="https://github.com/google/blockly/wiki/Loops#count-with",e.Msg.CONTROLS_FOR_TITLE="count with %1 from %2 to %3 by %4",e.Msg.CONTROLS_FOR_TOOLTIP="Have the variable '%1' take on the values from the start number to the end number, counting by the specified interval, and do the specified blocks.",e.Msg.CONTROLS_IF_ELSEIF_TOOLTIP="Add a condition to the if block.",e.Msg.CONTROLS_IF_ELSE_TOOLTIP="Add a final, catch-all condition to the if block.",e.Msg.CONTROLS_IF_HELPURL="https://github.com/google/blockly/wiki/IfElse",e.Msg.CONTROLS_IF_IF_TOOLTIP="Add, remove, or reorder sections to reconfigure this if block.",e.Msg.CONTROLS_IF_MSG_ELSE="else",e.Msg.CONTROLS_IF_MSG_ELSEIF="else if",e.Msg.CONTROLS_IF_MSG_IF="if",e.Msg.CONTROLS_IF_TOOLTIP_1="If a value is true, then do some statements.",e.Msg.CONTROLS_IF_TOOLTIP_2="If a value is true, then do the first block of statements. Otherwise, do the second block of statements.",e.Msg.CONTROLS_IF_TOOLTIP_3="If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements.",e.Msg.CONTROLS_IF_TOOLTIP_4="If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements. If none of the values are true, do the last block of statements.",e.Msg.CONTROLS_REPEAT_HELPURL="https://en.wikipedia.org/wiki/For_loop",e.Msg.CONTROLS_REPEAT_INPUT_DO="do",e.Msg.CONTROLS_REPEAT_TITLE="repeat %1 times",e.Msg.CONTROLS_REPEAT_TOOLTIP="Do some statements several times.",e.Msg.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat",e.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="repeat until",e.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="repeat while",e.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="While a value is false, then do some statements.",e.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="While a value is true, then do some statements.",e.Msg.CONTROL_KEY="Ctrl",e.Msg.COPY_SHORTCUT="Copy",e.Msg.CUT_SHORTCUT="Cut",e.Msg.DELETE_ALL_BLOCKS="Delete all %1 blocks?",e.Msg.DELETE_BLOCK="Delete Block",e.Msg.DELETE_VARIABLE="Delete the '%1' variable",e.Msg.DELETE_VARIABLE_CONFIRMATION="Delete %1 uses of the '%2' variable?",e.Msg.DELETE_X_BLOCKS="Delete %1 Blocks",e.Msg.DIALOG_CANCEL="Cancel",e.Msg.DIALOG_OK="OK",e.Msg.DISABLE_BLOCK="Disable Block",e.Msg.DUPLICATE_BLOCK="Duplicate",e.Msg.DUPLICATE_COMMENT="Duplicate Comment",e.Msg.EDIT_BLOCK_CONTENTS="Edit Block contents",e.Msg.ENABLE_BLOCK="Enable Block",e.Msg.EXPAND_ALL="Expand Blocks",e.Msg.EXPAND_BLOCK="Expand Block",e.Msg.EXTERNAL_INPUTS="External Inputs",e.Msg.HELP="Help",e.Msg.HELP_PROMPT="Press %1 for help on keyboard controls",e.Msg.INLINE_INPUTS="Inline Inputs",e.Msg.KEYBOARD_NAV_CONSTRAINED_MOVE_HINT="Use the arrow keys to move, then %1 to accept the position",e.Msg.KEYBOARD_NAV_COPIED_HINT="Copied. Press %1 to paste.",e.Msg.KEYBOARD_NAV_CUT_HINT="Cut. Press %1 to paste.",e.Msg.KEYBOARD_NAV_UNCONSTRAINED_MOVE_HINT="Hold %1 and use arrow keys to move freely, then %2 to accept the position",e.Msg.LINUX="Linux",e.Msg.LISTS_CREATE_EMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#create-empty-list",e.Msg.LISTS_CREATE_EMPTY_TITLE="create empty list",e.Msg.LISTS_CREATE_EMPTY_TOOLTIP="Returns a list, of length 0, containing no data records",e.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="list",e.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="Add, remove, or reorder sections to reconfigure this list block.",e.Msg.LISTS_CREATE_WITH_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",e.Msg.LISTS_CREATE_WITH_INPUT_WITH="create list with",e.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP="Add an item to the list.",e.Msg.LISTS_CREATE_WITH_TOOLTIP="Create a list with any number of items.",e.Msg.LISTS_GET_INDEX_FIRST="first",e.Msg.LISTS_GET_INDEX_FROM_END="# from end",e.Msg.LISTS_GET_INDEX_FROM_START="#",e.Msg.LISTS_GET_INDEX_GET="get",e.Msg.LISTS_GET_INDEX_GET_REMOVE="get and remove",e.Msg.LISTS_GET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",e.Msg.LISTS_GET_INDEX_LAST="last",e.Msg.LISTS_GET_INDEX_RANDOM="random",e.Msg.LISTS_GET_INDEX_REMOVE="remove",e.Msg.LISTS_GET_INDEX_TAIL="",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="Returns the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM="Returns the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST="Returns the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="Returns a random item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="Removes and returns the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="Removes and returns the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="Removes and returns the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="Removes and returns a random item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="Removes the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="Removes the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="Removes the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="Removes a random item in a list.",e.Msg.LISTS_GET_SUBLIST_END_FROM_END="to # from end",e.Msg.LISTS_GET_SUBLIST_END_FROM_START="to #",e.Msg.LISTS_GET_SUBLIST_END_LAST="to last",e.Msg.LISTS_GET_SUBLIST_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-a-sublist",e.Msg.LISTS_GET_SUBLIST_START_FIRST="get sub-list from first",e.Msg.LISTS_GET_SUBLIST_START_FROM_END="get sub-list from # from end",e.Msg.LISTS_GET_SUBLIST_START_FROM_START="get sub-list from #",e.Msg.LISTS_GET_SUBLIST_TAIL="",e.Msg.LISTS_GET_SUBLIST_TOOLTIP="Creates a copy of the specified portion of a list.",e.Msg.LISTS_INDEX_FROM_END_TOOLTIP="%1 is the last item.",e.Msg.LISTS_INDEX_FROM_START_TOOLTIP="%1 is the first item.",e.Msg.LISTS_INDEX_OF_FIRST="find first occurrence of item",e.Msg.LISTS_INDEX_OF_HELPURL="https://github.com/google/blockly/wiki/Lists#finding-items-in-a-list",e.Msg.LISTS_INDEX_OF_LAST="find last occurrence of item",e.Msg.LISTS_INDEX_OF_TOOLTIP="Returns the index of the first/last occurrence of the item in the list. Returns %1 if item is not found.",e.Msg.LISTS_INLIST="in list",e.Msg.LISTS_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#is-empty",e.Msg.LISTS_ISEMPTY_TITLE="%1 is empty",e.Msg.LISTS_ISEMPTY_TOOLTIP="Returns true if the list is empty.",e.Msg.LISTS_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Lists#length-of",e.Msg.LISTS_LENGTH_TITLE="length of %1",e.Msg.LISTS_LENGTH_TOOLTIP="Returns the length of a list.",e.Msg.LISTS_REPEAT_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",e.Msg.LISTS_REPEAT_TITLE="create list with item %1 repeated %2 times",e.Msg.LISTS_REPEAT_TOOLTIP="Creates a list consisting of the given value repeated the specified number of times.",e.Msg.LISTS_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Lists#reversing-a-list",e.Msg.LISTS_REVERSE_MESSAGE0="reverse %1",e.Msg.LISTS_REVERSE_TOOLTIP="Reverse a copy of a list.",e.Msg.LISTS_SET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#in-list--set",e.Msg.LISTS_SET_INDEX_INPUT_TO="as",e.Msg.LISTS_SET_INDEX_INSERT="insert at",e.Msg.LISTS_SET_INDEX_SET="set",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="Inserts the item at the start of a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="Inserts the item at the specified position in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="Append the item to the end of a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="Inserts the item randomly in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="Sets the first item in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM="Sets the item at the specified position in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST="Sets the last item in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="Sets a random item in a list.",e.Msg.LISTS_SORT_HELPURL="https://github.com/google/blockly/wiki/Lists#sorting-a-list",e.Msg.LISTS_SORT_ORDER_ASCENDING="ascending",e.Msg.LISTS_SORT_ORDER_DESCENDING="descending",e.Msg.LISTS_SORT_TITLE="sort %1 %2 %3",e.Msg.LISTS_SORT_TOOLTIP="Sort a copy of a list.",e.Msg.LISTS_SORT_TYPE_IGNORECASE="alphabetic, ignore case",e.Msg.LISTS_SORT_TYPE_NUMERIC="numeric",e.Msg.LISTS_SORT_TYPE_TEXT="alphabetic",e.Msg.LISTS_SPLIT_HELPURL="https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists",e.Msg.LISTS_SPLIT_LIST_FROM_TEXT="make list from text",e.Msg.LISTS_SPLIT_TEXT_FROM_LIST="make text from list",e.Msg.LISTS_SPLIT_TOOLTIP_JOIN="Join a list of texts into one text, separated by a delimiter.",e.Msg.LISTS_SPLIT_TOOLTIP_SPLIT="Split text into a list of texts, breaking at each delimiter.",e.Msg.LISTS_SPLIT_WITH_DELIMITER="with delimiter",e.Msg.LOGIC_BOOLEAN_FALSE="false",e.Msg.LOGIC_BOOLEAN_HELPURL="https://github.com/google/blockly/wiki/Logic#values",e.Msg.LOGIC_BOOLEAN_TOOLTIP="Returns either true or false.",e.Msg.LOGIC_BOOLEAN_TRUE="true",e.Msg.LOGIC_COMPARE_HELPURL="https://en.wikipedia.org/wiki/Inequality_(mathematics)",e.Msg.LOGIC_COMPARE_TOOLTIP_EQ="Return true if both inputs equal each other.",e.Msg.LOGIC_COMPARE_TOOLTIP_GT="Return true if the first input is greater than the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_GTE="Return true if the first input is greater than or equal to the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_LT="Return true if the first input is smaller than the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_LTE="Return true if the first input is smaller than or equal to the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_NEQ="Return true if both inputs are not equal to each other.",e.Msg.LOGIC_NEGATE_HELPURL="https://github.com/google/blockly/wiki/Logic#not",e.Msg.LOGIC_NEGATE_TITLE="not %1",e.Msg.LOGIC_NEGATE_TOOLTIP="Returns true if the input is false. Returns false if the input is true.",e.Msg.LOGIC_NULL="null",e.Msg.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type",e.Msg.LOGIC_NULL_TOOLTIP="Returns null.",e.Msg.LOGIC_OPERATION_AND="and",e.Msg.LOGIC_OPERATION_HELPURL="https://github.com/google/blockly/wiki/Logic#logical-operations",e.Msg.LOGIC_OPERATION_OR="or",e.Msg.LOGIC_OPERATION_TOOLTIP_AND="Return true if both inputs are true.",e.Msg.LOGIC_OPERATION_TOOLTIP_OR="Return true if at least one of the inputs is true.",e.Msg.LOGIC_TERNARY_CONDITION="test",e.Msg.LOGIC_TERNARY_HELPURL="https://en.wikipedia.org/wiki/%3F:",e.Msg.LOGIC_TERNARY_IF_FALSE="if false",e.Msg.LOGIC_TERNARY_IF_TRUE="if true",e.Msg.LOGIC_TERNARY_TOOLTIP="Check the condition in 'test'. If the condition is true, returns the 'if true' value; otherwise returns the 'if false' value.",e.Msg.MAC_OS="macOS",e.Msg.MATH_ADDITION_SYMBOL="+",e.Msg.MATH_ARITHMETIC_HELPURL="https://en.wikipedia.org/wiki/Arithmetic",e.Msg.MATH_ARITHMETIC_TOOLTIP_ADD="Return the sum of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE="Return the quotient of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS="Return the difference of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="Return the product of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_POWER="Return the first number raised to the power of the second number.",e.Msg.MATH_ATAN2_HELPURL="https://en.wikipedia.org/wiki/Atan2",e.Msg.MATH_ATAN2_TITLE="atan2 of X:%1 Y:%2",e.Msg.MATH_ATAN2_TOOLTIP="Return the arctangent of point (X, Y) in degrees from -180 to 180.",e.Msg.MATH_CHANGE_HELPURL="https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter",e.Msg.MATH_CHANGE_TITLE="change %1 by %2",e.Msg.MATH_CHANGE_TOOLTIP="Add a number to variable '%1'.",e.Msg.MATH_CONSTANT_HELPURL="https://en.wikipedia.org/wiki/Mathematical_constant",e.Msg.MATH_CONSTANT_TOOLTIP="Return one of the common constants: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), or ∞ (infinity).",e.Msg.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)",e.Msg.MATH_CONSTRAIN_TITLE="constrain %1 low %2 high %3",e.Msg.MATH_CONSTRAIN_TOOLTIP="Constrain a number to be between the specified limits (inclusive).",e.Msg.MATH_DIVISION_SYMBOL="÷",e.Msg.MATH_IS_DIVISIBLE_BY="is divisible by",e.Msg.MATH_IS_EVEN="is even",e.Msg.MATH_IS_NEGATIVE="is negative",e.Msg.MATH_IS_ODD="is odd",e.Msg.MATH_IS_POSITIVE="is positive",e.Msg.MATH_IS_PRIME="is prime",e.Msg.MATH_IS_TOOLTIP="Check if a number is an even, odd, prime, whole, positive, negative, or if it is divisible by certain number. Returns true or false.",e.Msg.MATH_IS_WHOLE="is whole",e.Msg.MATH_MODULO_HELPURL="https://en.wikipedia.org/wiki/Modulo_operation",e.Msg.MATH_MODULO_TITLE="remainder of %1 ÷ %2",e.Msg.MATH_MODULO_TOOLTIP="Return the remainder from dividing the two numbers.",e.Msg.MATH_MULTIPLICATION_SYMBOL="×",e.Msg.MATH_NUMBER_HELPURL="https://en.wikipedia.org/wiki/Number",e.Msg.MATH_NUMBER_TOOLTIP="A number.",e.Msg.MATH_ONLIST_HELPURL="",e.Msg.MATH_ONLIST_OPERATOR_AVERAGE="average of list",e.Msg.MATH_ONLIST_OPERATOR_MAX="max of list",e.Msg.MATH_ONLIST_OPERATOR_MEDIAN="median of list",e.Msg.MATH_ONLIST_OPERATOR_MIN="min of list",e.Msg.MATH_ONLIST_OPERATOR_MODE="modes of list",e.Msg.MATH_ONLIST_OPERATOR_RANDOM="random item of list",e.Msg.MATH_ONLIST_OPERATOR_STD_DEV="standard deviation of list",e.Msg.MATH_ONLIST_OPERATOR_SUM="sum of list",e.Msg.MATH_ONLIST_TOOLTIP_AVERAGE="Return the average (arithmetic mean) of the numeric values in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MAX="Return the largest number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MEDIAN="Return the median number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MIN="Return the smallest number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MODE="Return a list of the most common item(s) in the list.",e.Msg.MATH_ONLIST_TOOLTIP_RANDOM="Return a random element from the list.",e.Msg.MATH_ONLIST_TOOLTIP_STD_DEV="Return the standard deviation of the list.",e.Msg.MATH_ONLIST_TOOLTIP_SUM="Return the sum of all the numbers in the list.",e.Msg.MATH_POWER_SYMBOL="^",e.Msg.MATH_RANDOM_FLOAT_HELPURL="https://en.wikipedia.org/wiki/Random_number_generation",e.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM="random fraction",e.Msg.MATH_RANDOM_FLOAT_TOOLTIP="Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive).",e.Msg.MATH_RANDOM_INT_HELPURL="https://en.wikipedia.org/wiki/Random_number_generation",e.Msg.MATH_RANDOM_INT_TITLE="random integer from %1 to %2",e.Msg.MATH_RANDOM_INT_TOOLTIP="Return a random integer between the two specified limits, inclusive.",e.Msg.MATH_ROUND_HELPURL="https://en.wikipedia.org/wiki/Rounding",e.Msg.MATH_ROUND_OPERATOR_ROUND="round",e.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN="round down",e.Msg.MATH_ROUND_OPERATOR_ROUNDUP="round up",e.Msg.MATH_ROUND_TOOLTIP="Round a number up or down.",e.Msg.MATH_SINGLE_HELPURL="https://en.wikipedia.org/wiki/Square_root",e.Msg.MATH_SINGLE_OP_ABSOLUTE="absolute",e.Msg.MATH_SINGLE_OP_ROOT="square root",e.Msg.MATH_SINGLE_TOOLTIP_ABS="Return the absolute value of a number.",e.Msg.MATH_SINGLE_TOOLTIP_EXP="Return e to the power of a number.",e.Msg.MATH_SINGLE_TOOLTIP_LN="Return the natural logarithm of a number.",e.Msg.MATH_SINGLE_TOOLTIP_LOG10="Return the base 10 logarithm of a number.",e.Msg.MATH_SINGLE_TOOLTIP_NEG="Return the negation of a number.",e.Msg.MATH_SINGLE_TOOLTIP_POW10="Return 10 to the power of a number.",e.Msg.MATH_SINGLE_TOOLTIP_ROOT="Return the square root of a number.",e.Msg.MATH_SUBTRACTION_SYMBOL="-",e.Msg.MATH_TRIG_ACOS="acos",e.Msg.MATH_TRIG_ASIN="asin",e.Msg.MATH_TRIG_ATAN="atan",e.Msg.MATH_TRIG_COS="cos",e.Msg.MATH_TRIG_HELPURL="https://en.wikipedia.org/wiki/Trigonometric_functions",e.Msg.MATH_TRIG_SIN="sin",e.Msg.MATH_TRIG_TAN="tan",e.Msg.MATH_TRIG_TOOLTIP_ACOS="Return the arccosine of a number.",e.Msg.MATH_TRIG_TOOLTIP_ASIN="Return the arcsine of a number.",e.Msg.MATH_TRIG_TOOLTIP_ATAN="Return the arctangent of a number.",e.Msg.MATH_TRIG_TOOLTIP_COS="Return the cosine of a degree (not radian).",e.Msg.MATH_TRIG_TOOLTIP_SIN="Return the sine of a degree (not radian).",e.Msg.MATH_TRIG_TOOLTIP_TAN="Return the tangent of a degree (not radian).",e.Msg.MOVE_BLOCK="Move Block",e.Msg.NEW_COLOUR_VARIABLE="Create colour variable...",e.Msg.NEW_NUMBER_VARIABLE="Create number variable...",e.Msg.NEW_STRING_VARIABLE="Create string variable...",e.Msg.NEW_VARIABLE="Create variable...",e.Msg.NEW_VARIABLE_TITLE="New variable name:",e.Msg.NEW_VARIABLE_TYPE_TITLE="New variable type:",e.Msg.OPTION_KEY="⌥ Option",e.Msg.ORDINAL_NUMBER_SUFFIX="",e.Msg.PASTE_SHORTCUT="Paste",e.Msg.PROCEDURES_ALLOW_STATEMENTS="allow statements",e.Msg.PROCEDURES_BEFORE_PARAMS="with:",e.Msg.PROCEDURES_CALLNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_CALLNORETURN_TOOLTIP="Run the user-defined function '%1'.",e.Msg.PROCEDURES_CALLRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_CALLRETURN_TOOLTIP="Run the user-defined function '%1' and use its output.",e.Msg.PROCEDURES_CALL_BEFORE_PARAMS="with:",e.Msg.PROCEDURES_CALL_DISABLED_DEF_WARNING="Can't run the user-defined function '%1' because the definition block is disabled.",e.Msg.PROCEDURES_CREATE_DO="Create '%1'",e.Msg.PROCEDURES_DEFNORETURN_COMMENT="Describe this function...",e.Msg.PROCEDURES_DEFNORETURN_DO="",e.Msg.PROCEDURES_DEFNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_DEFNORETURN_PROCEDURE="do something",e.Msg.PROCEDURES_DEFNORETURN_TITLE="to",e.Msg.PROCEDURES_DEFNORETURN_TOOLTIP="Creates a function with no output.",e.Msg.PROCEDURES_DEFRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_DEFRETURN_RETURN="return",e.Msg.PROCEDURES_DEFRETURN_TOOLTIP="Creates a function with an output.",e.Msg.PROCEDURES_DEF_DUPLICATE_WARNING="Warning: This function has duplicate parameters.",e.Msg.PROCEDURES_HIGHLIGHT_DEF="Highlight function definition",e.Msg.PROCEDURES_IFRETURN_HELPURL="https://c2.com/cgi/wiki?GuardClause",e.Msg.PROCEDURES_IFRETURN_TOOLTIP="If a value is true, then return a second value.",e.Msg.PROCEDURES_IFRETURN_WARNING="Warning: This block may be used only within a function definition.",e.Msg.PROCEDURES_MUTATORARG_TITLE="input name:",e.Msg.PROCEDURES_MUTATORARG_TOOLTIP="Add an input to the function.",e.Msg.PROCEDURES_MUTATORCONTAINER_TITLE="inputs",e.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP="Add, remove, or reorder inputs to this function.",e.Msg.REDO="Redo",e.Msg.REMOVE_COMMENT="Remove Comment",e.Msg.RENAME_VARIABLE="Rename variable...",e.Msg.RENAME_VARIABLE_TITLE="Rename all '%1' variables to:",e.Msg.SHORTCUTS_CODE_NAVIGATION="Code navigation",e.Msg.SHORTCUTS_EDITING="Editing",e.Msg.SHORTCUTS_GENERAL="General",e.Msg.TEXT_APPEND_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",e.Msg.TEXT_APPEND_TITLE="to %1 append text %2",e.Msg.TEXT_APPEND_TOOLTIP="Append some text to variable '%1'.",e.Msg.TEXT_CHANGECASE_HELPURL="https://github.com/google/blockly/wiki/Text#adjusting-text-case",e.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE="to lower case",e.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE="to Title Case",e.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE="to UPPER CASE",e.Msg.TEXT_CHANGECASE_TOOLTIP="Return a copy of the text in a different case.",e.Msg.TEXT_CHARAT_FIRST="get first letter",e.Msg.TEXT_CHARAT_FROM_END="get letter # from end",e.Msg.TEXT_CHARAT_FROM_START="get letter #",e.Msg.TEXT_CHARAT_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-text",e.Msg.TEXT_CHARAT_LAST="get last letter",e.Msg.TEXT_CHARAT_RANDOM="get random letter",e.Msg.TEXT_CHARAT_TAIL="",e.Msg.TEXT_CHARAT_TITLE="in text %1 %2",e.Msg.TEXT_CHARAT_TOOLTIP="Returns the letter at the specified position.",e.Msg.TEXT_COUNT_HELPURL="https://github.com/google/blockly/wiki/Text#counting-substrings",e.Msg.TEXT_COUNT_MESSAGE0="count %1 in %2",e.Msg.TEXT_COUNT_TOOLTIP="Count how many times some text occurs within some other text.",e.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP="Add an item to the text.",e.Msg.TEXT_CREATE_JOIN_TITLE_JOIN="join",e.Msg.TEXT_CREATE_JOIN_TOOLTIP="Add, remove, or reorder sections to reconfigure this text block.",e.Msg.TEXT_GET_SUBSTRING_END_FROM_END="to letter # from end",e.Msg.TEXT_GET_SUBSTRING_END_FROM_START="to letter #",e.Msg.TEXT_GET_SUBSTRING_END_LAST="to last letter",e.Msg.TEXT_GET_SUBSTRING_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text",e.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="in text",e.Msg.TEXT_GET_SUBSTRING_START_FIRST="get substring from first letter",e.Msg.TEXT_GET_SUBSTRING_START_FROM_END="get substring from letter # from end",e.Msg.TEXT_GET_SUBSTRING_START_FROM_START="get substring from letter #",e.Msg.TEXT_GET_SUBSTRING_TAIL="",e.Msg.TEXT_GET_SUBSTRING_TOOLTIP="Returns a specified portion of the text.",e.Msg.TEXT_INDEXOF_HELPURL="https://github.com/google/blockly/wiki/Text#finding-text",e.Msg.TEXT_INDEXOF_OPERATOR_FIRST="find first occurrence of text",e.Msg.TEXT_INDEXOF_OPERATOR_LAST="find last occurrence of text",e.Msg.TEXT_INDEXOF_TITLE="in text %1 %2 %3",e.Msg.TEXT_INDEXOF_TOOLTIP="Returns the index of the first/last occurrence of the first text in the second text. Returns %1 if text is not found.",e.Msg.TEXT_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Text#checking-for-empty-text",e.Msg.TEXT_ISEMPTY_TITLE="%1 is empty",e.Msg.TEXT_ISEMPTY_TOOLTIP="Returns true if the provided text is empty.",e.Msg.TEXT_JOIN_HELPURL="https://github.com/google/blockly/wiki/Text#text-creation",e.Msg.TEXT_JOIN_TITLE_CREATEWITH="create text with",e.Msg.TEXT_JOIN_TOOLTIP="Create a piece of text by joining together any number of items.",e.Msg.TEXT_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",e.Msg.TEXT_LENGTH_TITLE="length of %1",e.Msg.TEXT_LENGTH_TOOLTIP="Returns the number of letters (including spaces) in the provided text.",e.Msg.TEXT_PRINT_HELPURL="https://github.com/google/blockly/wiki/Text#printing-text",e.Msg.TEXT_PRINT_TITLE="print %1",e.Msg.TEXT_PRINT_TOOLTIP="Print the specified text, number or other value.",e.Msg.TEXT_PROMPT_HELPURL="https://github.com/google/blockly/wiki/Text#getting-input-from-the-user",e.Msg.TEXT_PROMPT_TOOLTIP_NUMBER="Prompt for user for a number.",e.Msg.TEXT_PROMPT_TOOLTIP_TEXT="Prompt for user for some text.",e.Msg.TEXT_PROMPT_TYPE_NUMBER="prompt for number with message",e.Msg.TEXT_PROMPT_TYPE_TEXT="prompt for text with message",e.Msg.TEXT_REPLACE_HELPURL="https://github.com/google/blockly/wiki/Text#replacing-substrings",e.Msg.TEXT_REPLACE_MESSAGE0="replace %1 with %2 in %3",e.Msg.TEXT_REPLACE_TOOLTIP="Replace all occurances of some text within some other text.",e.Msg.TEXT_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Text#reversing-text",e.Msg.TEXT_REVERSE_MESSAGE0="reverse %1",e.Msg.TEXT_REVERSE_TOOLTIP="Reverses the order of the characters in the text.",e.Msg.TEXT_TEXT_HELPURL="https://en.wikipedia.org/wiki/String_(computer_science)",e.Msg.TEXT_TEXT_TOOLTIP="A letter, word, or line of text.",e.Msg.TEXT_TRIM_HELPURL="https://github.com/google/blockly/wiki/Text#trimming-removing-spaces",e.Msg.TEXT_TRIM_OPERATOR_BOTH="trim spaces from both sides of",e.Msg.TEXT_TRIM_OPERATOR_LEFT="trim spaces from left side of",e.Msg.TEXT_TRIM_OPERATOR_RIGHT="trim spaces from right side of",e.Msg.TEXT_TRIM_TOOLTIP="Return a copy of the text with spaces removed from one or both ends.",e.Msg.TODAY="Today",e.Msg.UNDO="Undo",e.Msg.UNKNOWN="Unknown",e.Msg.UNNAMED_KEY="unnamed",e.Msg.VARIABLES_DEFAULT_NAME="item",e.Msg.VARIABLES_GET_CREATE_SET="Create 'set %1'",e.Msg.VARIABLES_GET_HELPURL="https://github.com/google/blockly/wiki/Variables#get",e.Msg.VARIABLES_GET_TOOLTIP="Returns the value of this variable.",e.Msg.VARIABLES_SET="set %1 to %2",e.Msg.VARIABLES_SET_CREATE_GET="Create 'get %1'",e.Msg.VARIABLES_SET_HELPURL="https://github.com/google/blockly/wiki/Variables#set",e.Msg.VARIABLES_SET_TOOLTIP="Sets this variable to be equal to the input.",e.Msg.VARIABLE_ALREADY_EXISTS="A variable named '%1' already exists.",e.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="A variable named '%1' already exists for another type: '%2'.",e.Msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER="A variable named '%1' already exists as a parameter in the procedure '%2'.",e.Msg.WINDOWS="Windows",e.Msg.WORKSPACE_ARIA_LABEL="Blockly Workspace",e.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT="Say something...",e.Msg.CONTROLS_FOREACH_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_FOR_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=e.Msg.CONTROLS_IF_MSG_ELSEIF,e.Msg.CONTROLS_IF_ELSE_TITLE_ELSE=e.Msg.CONTROLS_IF_MSG_ELSE,e.Msg.CONTROLS_IF_IF_TITLE_IF=e.Msg.CONTROLS_IF_MSG_IF,e.Msg.CONTROLS_IF_MSG_THEN=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_WHILEUNTIL_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.LISTS_CREATE_WITH_ITEM_TITLE=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.LISTS_GET_INDEX_HELPURL=e.Msg.LISTS_INDEX_OF_HELPURL,e.Msg.LISTS_GET_INDEX_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_INDEX_OF_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_SET_INDEX_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.MATH_CHANGE_TITLE_ITEM=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.PROCEDURES_DEFRETURN_COMMENT=e.Msg.PROCEDURES_DEFNORETURN_COMMENT,e.Msg.PROCEDURES_DEFRETURN_DO=e.Msg.PROCEDURES_DEFNORETURN_DO,e.Msg.PROCEDURES_DEFRETURN_PROCEDURE=e.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,e.Msg.PROCEDURES_DEFRETURN_TITLE=e.Msg.PROCEDURES_DEFNORETURN_TITLE,e.Msg.TEXT_APPEND_VARIABLE=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.MATH_HUE="230",e.Msg.LOOPS_HUE="120",e.Msg.LISTS_HUE="260",e.Msg.LOGIC_HUE="210",e.Msg.VARIABLES_HUE="330",e.Msg.TEXTS_HUE="160",e.Msg.PROCEDURES_HUE="290",e.Msg.COLOUR_HUE="20",e.Msg.VARIABLES_DYNAMIC_HUE="310",e.Msg},"function"==typeof define&&define.amd?define([],i):e.exports=i()}),u("94GXq",function(e,t){e.exports=h("34v67")}),u("34v67",function(e,t){var i;e.exports,i=function(e){var t=e.__namespace__,i=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_dynamic_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableDynamicSetterGetter"]},{type:"variables_set_dynamic",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_dynamic_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableDynamicSetterGetter"]}]);t.registerMixin$$module$build$src$core$extensions("contextMenu_variableDynamicSetterGetter",{customContextMenu:function(e){if(this.isInFlyout){var i,o;("variables_get_dynamic"===this.type||"variables_get_reporter_dynamic"===this.type)&&(n={text:t.Msg$$module$build$src$core$msg.RENAME_VARIABLE,enabled:!0,callback:(i=this,function(){let e=i.workspace,o=i.getField("VAR").getVariable();t.renameVariable$$module$build$src$core$variables(e,o)})},r=this.getField("VAR").getText(),r={text:t.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",r),enabled:!0,callback:(o=this,function(){let e=o.getField("VAR").getVariable();e&&t.deleteVariable$$module$build$src$core$variables(e.getWorkspace(),e,o)})},e.unshift(n),e.unshift(r))}else{if("variables_get_dynamic"===this.type)var s="variables_set_dynamic",n=t.Msg$$module$build$src$core$msg.VARIABLES_GET_CREATE_SET;else s="variables_get_dynamic",n=t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET;var r=this.getField("VAR");s={type:s,fields:{VAR:r.saveState(!0)}},e.push({enabled:this.workspace.remainingCapacity()>0,text:n.replace("%1",r.getText()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,s)})}},onchange:function(e){e=this.getFieldValue("VAR"),e=t.getVariable$$module$build$src$core$variables(this.workspace,e),"variables_get_dynamic"===this.type?this.outputConnection.setCheck(e.getType()):this.getInput("VALUE").connection.setCheck(e.getType())}}),t.defineBlocks$$module$build$src$core$common(i);var o=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);t.registerMixin$$module$build$src$core$extensions("contextMenu_variableSetterGetter",{customContextMenu:function(e){if(this.isInFlyout){var i,o;("variables_get"===this.type||"variables_get_reporter"===this.type)&&(n={text:t.Msg$$module$build$src$core$msg.RENAME_VARIABLE,enabled:!0,callback:(i=this,function(){let e=i.workspace,o=i.getField("VAR").getVariable();t.renameVariable$$module$build$src$core$variables(e,o)})},r=this.getField("VAR").getText(),r={text:t.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",r),enabled:!0,callback:(o=this,function(){let e=o.getField("VAR").getVariable();e&&t.deleteVariable$$module$build$src$core$variables(e.getWorkspace(),e,o)})},e.unshift(n),e.unshift(r))}else{if("variables_get"===this.type)var s="variables_set",n=t.Msg$$module$build$src$core$msg.VARIABLES_GET_CREATE_SET;else s="variables_get",n=t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET;var r=this.getField("VAR");s={type:s,fields:{VAR:r.saveState(!0)}},e.push({enabled:this.workspace.remainingCapacity()>0,text:n.replace("%1",r.getText()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,s)})}}}),t.defineBlocks$$module$build$src$core$common(o);var s=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",args0:[{type:"input_dummy"},{type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);s.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("STRING").setCheck("String").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);let e=e=>{let i=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+e]});return i.setValidator(function(t){let i=this.getValue();(t="FROM_START"===t||"FROM_END"===t)!=("FROM_START"===i||"FROM_END"===i)&&this.getSourceBlock().updateAt_(e,t)}),i};this.appendDummyInput("WHERE1_INPUT").appendField(e(1),"WHERE1"),this.appendDummyInput("AT1"),this.appendDummyInput("WHERE2_INPUT").appendField(e(2),"WHERE2"),this.appendDummyInput("AT2"),t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL),this.setInputsInline(!0),this.setOutput(!0,"String"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");var i=this.getInput("AT1")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at1",`${i}`),i=this.getInput("AT2")instanceof t.ValueInput$$module$build$src$core$inputs$value_input,e.setAttribute("at2",`${i}`),e},domToMutation:function(e){let t="true"===e.getAttribute("at1");e="true"===e.getAttribute("at2"),this.updateAt_(1,t),this.updateAt_(2,e)},updateAt_:function(e,i){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),i?(this.appendValueInput("AT"+e).setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e),2===e&&t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL)),1===e&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT"))}},s.text_changeCase={init:function(){let e=[[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("TEXT").setCheck("String").appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),"CASE"),this.setOutput(!0,"String"),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_TOOLTIP)}},s.text_trim={init:function(){let e=[[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_TRIM_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("TEXT").setCheck("String").appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),"MODE"),this.setOutput(!0,"String"),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_TRIM_TOOLTIP)}},s.text_print={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_PRINT_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_PRINT_HELPURL})}};var n={updateType_:function(e){this.outputConnection.setCheck("NUMBER"===e?"Number":"String")},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("type",this.getFieldValue("TYPE")),e},domToMutation:function(e){this.updateType_(e.getAttribute("type"))}};s.text_prompt_ext=Object.assign({},n,{init:function(){var e=[[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(e=>{this.updateType_(e)}),this.appendValueInput("TEXT").appendField(e,"TYPE"),this.setOutput(!0,"String"),this.setTooltip(()=>"TEXT"===this.getFieldValue("TYPE")?t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_TEXT:t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_NUMBER)}}),s.text_prompt=Object.assign({},n,{init:function(){this.mixin(r);var e=[[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(e=>{this.updateType_(e)}),this.appendDummyInput().appendField(e,"TYPE").appendField(this.newQuote_(!0)).appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:""}),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,"String"),this.setTooltip(()=>"TEXT"===this.getFieldValue("TYPE")?t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_TEXT:t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_NUMBER)}}),s.text_count={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_COUNT_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_COUNT_HELPURL})}},s.text_replace={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_REPLACE_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_REPLACE_HELPURL})}},s.text_reverse={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_HELPURL})}};var r={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(e){for(let t=0,i;i=this.inputList[t];t++)for(let t=0,o;o=i.fieldRow[t];t++)if(e===o.name){i.insertFieldAt(t,this.newQuote_(!0)),i.insertFieldAt(t+2,this.newQuote_(!1));return}console.warn('field named "'+e+'" not found in '+this.toDevString())},newQuote_:function(e){return e=this.RTL?!e:e,t.fromJson$$module$build$src$core$field_registry({type:"field_image",src:e?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,width:this.QUOTE_IMAGE_WIDTH,height:this.QUOTE_IMAGE_HEIGHT,alt:e?"“":"”"})}};t.register$$module$build$src$core$extensions("text_append_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_TEXT_APPEND_TOOLTIP}","VAR")),t.register$$module$build$src$core$extensions("text_indexOf_tooltip",function(){this.setTooltip(()=>t.Msg$$module$build$src$core$msg.TEXT_INDEXOF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}),t.register$$module$build$src$core$extensions("text_quotes",function(){this.mixin(r),this.quoteField_("TEXT")}),t.registerMixin$$module$build$src$core$extensions("quote_image_mixin",r),t.registerMutator$$module$build$src$core$extensions("text_join_mutator",{itemCount_:0,mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("items",`${this.itemCount_}`),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(e){this.itemCount_=e.itemCount,this.updateShape_()},decompose:function(e){let t=e.newBlock("text_create_join_container");t.initSvg();let i=t.getInput("STACK").connection;for(let t=0;t<this.itemCount_;t++){let t=e.newBlock("text_create_join_item");t.initSvg(),i.connect(t.previousConnection),i=t.nextConnection}return t},compose:function(e){var t=e.getInputTargetBlock("STACK");for(e=[];t;)t.isInsertionMarker()||e.push(t.valueConnection_),t=t.getNextBlock();for(t=0;t<this.itemCount_;t++){let i=this.getInput("ADD"+t).connection.targetConnection;i&&!e.includes(i)&&i.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),t=0;t<this.itemCount_;t++){let i;null==(i=e[t])||i.reconnect(this,"ADD"+t)}},saveConnections:function(e){e=e.getInputTargetBlock("STACK");let t=0;for(;e;){if(e.isInsertionMarker()){e=e.getNextBlock();continue}let i=this.getInput("ADD"+t);e.valueConnection_=i&&i.connection.targetConnection,e=e.getNextBlock(),t++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));for(var e=0;e<this.itemCount_;e++)if(!this.getInput("ADD"+e)){let i=this.appendValueInput("ADD"+e).setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT);0===e&&i.appendField(t.Msg$$module$build$src$core$msg.TEXT_JOIN_TITLE_CREATEWITH)}for(e=this.itemCount_;this.getInput("ADD"+e);e++)this.removeInput("ADD"+e)}},function(){this.mixin(r),this.itemCount_=2,this.updateShape_(),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["text_create_join_item"],this))}),t.registerMutator$$module$build$src$core$extensions("text_charAt_mutator",{isAt_:!1,mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("at",`${this.isAt_}`),e},domToMutation:function(e){e="false"!==e.getAttribute("at"),this.updateAt_(e)},updateAt_:function(e){this.removeInput("AT",!0),this.removeInput("ORDINAL",!0),e&&(this.appendValueInput("AT").setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)),t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TAIL)),this.isAt_=e}},function(){this.getField("WHERE").setValidator(function(e){e="FROM_START"===e||"FROM_END"===e;let t=this.getSourceBlock();e!==t.isAt_&&t.updateAt_(e)}),this.updateAt_(!0),this.setTooltip(()=>{var e=this.getFieldValue("WHERE");let i=t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TOOLTIP;return("FROM_START"===e||"FROM_END"===e)&&(e="FROM_START"===e?t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP)&&(i+=" "+e.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),i})}),t.defineBlocks$$module$build$src$core$common(s);var l={},a={setStatements_:function(e){this.hasStatements_!==e&&(e?(this.appendStatementInput("STACK").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=e)},updateParams_:function(){let e="";this.arguments_.length&&(e=t.Msg$$module$build$src$core$msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),t.disable$$module$build$src$core$events$utils();try{this.setFieldValue(e,"PARAMS")}finally{t.enable$$module$build$src$core$events$utils()}},mutationToDom:function(e){let i=t.createElement$$module$build$src$core$utils$xml("mutation");e&&i.setAttribute("name",this.getFieldValue("NAME"));for(let o=0;o<this.argumentVarModels_.length;o++){let s=t.createElement$$module$build$src$core$utils$xml("arg"),n=this.argumentVarModels_[o];s.setAttribute("name",n.getName()),s.setAttribute("varid",n.getId()),e&&this.paramIds_&&s.setAttribute("paramId",this.paramIds_[o]),i.appendChild(s)}return this.hasStatements_||i.setAttribute("statements","false"),i},domToMutation:function(e){this.arguments_=[],this.argumentVarModels_=[];for(let o=0,s;s=e.childNodes[o];o++)if("arg"===s.nodeName.toLowerCase()){var i=s;let e=i.getAttribute("name");i=i.getAttribute("varid")||i.getAttribute("varId"),this.arguments_.push(e),null!==(i=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,i,e,""))?this.argumentVarModels_.push(i):console.log(`Failed to create a variable named "${e}", ignoring.`)}this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),this.setStatements_("false"!==e.getAttribute("statements"))},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;let e=Object.create(null);if(this.argumentVarModels_.length){e.params=[];for(let t=0;t<this.argumentVarModels_.length;t++)e.params.push({name:this.argumentVarModels_[t].getName(),id:this.argumentVarModels_[t].getId()})}return this.hasStatements_||(e.hasStatements=!1),e},loadExtraState:function(e){if(this.arguments_=[],this.argumentVarModels_=[],e.params)for(let o=0;o<e.params.length;o++){var i=e.params[o];i=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,i.id,i.name,""),this.arguments_.push(i.getName()),this.argumentVarModels_.push(i)}this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),this.setStatements_(!1!==e.hasStatements)},decompose:function(e){let i=t.createElement$$module$build$src$core$utils$xml("block");i.setAttribute("type","procedures_mutatorcontainer");var o=t.createElement$$module$build$src$core$utils$xml("statement");o.setAttribute("name","STACK"),i.appendChild(o);for(let e=0;e<this.arguments_.length;e++){let i=t.createElement$$module$build$src$core$utils$xml("block");i.setAttribute("type","procedures_mutatorarg");var s=t.createElement$$module$build$src$core$utils$xml("field");s.setAttribute("name","NAME");let n=t.createTextNode$$module$build$src$core$utils$xml(this.arguments_[e]);s.appendChild(n),i.appendChild(s),s=t.createElement$$module$build$src$core$utils$xml("next"),i.appendChild(s),o.appendChild(i),o=s}return e=t.domToBlock$$module$build$src$core$xml(i,e),"procedures_defreturn"===this.type?e.setFieldValue(this.hasStatements_,"STATEMENTS"):e.removeInput("STATEMENT_INPUT"),t.mutateCallers$$module$build$src$core$procedures(this),e},compose:function(e){this.arguments_=[],this.paramIds_=[],this.argumentVarModels_=[];let i=e.getInputTargetBlock("STACK");for(;i&&!i.isInsertionMarker();){var o,s=i.getFieldValue("NAME");this.arguments_.push(s),s=this.workspace.getVariable(s,""),this.argumentVarModels_.push(s),this.paramIds_.push(i.id),i=i.nextConnection&&i.nextConnection.targetBlock()}this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),null!==(e=e.getFieldValue("STATEMENTS"))&&(e="TRUE"===e,this.hasStatements_!==e)&&(e?(this.setStatements_(!0),null==(o=this.statementConnection_)||o.reconnect(this,"STACK"),this.statementConnection_=null):(o=this.getInput("STACK").connection,(this.statementConnection_=o.targetConnection)&&((o=o.targetBlock()).unplug(),o.bumpNeighbours()),this.setStatements_(!1)))},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(e,i){var o=this.workspace.getVariableById(e);if(""===o.getType()){o=o.getName(),i=this.workspace.getVariableById(i);var s=!1;for(let t=0;t<this.argumentVarModels_.length;t++)this.argumentVarModels_[t].getId()===e&&(this.arguments_[t]=i.getName(),this.argumentVarModels_[t]=i,s=!0);s&&(this.displayRenamedVar_(o,i.getName()),t.mutateCallers$$module$build$src$core$procedures(this))}},updateVarName:function(e){let i=e.getName(),o=!1,s;for(let t=0;t<this.argumentVarModels_.length;t++)this.argumentVarModels_[t].getId()===e.getId()&&(s=this.arguments_[t],this.arguments_[t]=i,o=!0);o&&(this.displayRenamedVar_(s,i),t.mutateCallers$$module$build$src$core$procedures(this))},displayRenamedVar_:function(e,i){this.updateParams_();var o=this.getIcon(t.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE);if(o&&o.bubbleIsVisible()){o=o.getWorkspace().getAllBlocks(!1);for(let s=0,n;n=o[s];s++)"procedures_mutatorarg"===n.type&&t.Names$$module$build$src$core$names.equals(e,n.getFieldValue("NAME"))&&n.setFieldValue(i,"NAME")}},customContextMenu:function(e){if(!this.isInFlyout){var i=this.getFieldValue("NAME"),o={type:this.callType_,extraState:{name:i,params:this.arguments_}};if(e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.PROCEDURES_CREATE_DO.replace("%1",i),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,o)}),!this.isCollapsed())for(i=0;i<this.argumentVarModels_.length;i++){let s={type:"variables_get",fields:{VAR:{name:(o=this.argumentVarModels_[i]).getName(),id:o.getId(),type:o.getType()}}};e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",o.getName()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,s)})}}}};l.procedures_defnoreturn=Object.assign({},a,{init:function(){var e=t.findLegalName$$module$build$src$core$procedures("",this);(e=t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:e})).setValidator(t.rename$$module$build$src$core$procedures),e.setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},callType_:"procedures_callnoreturn"}),l.procedures_defreturn=Object.assign({},a,{init:function(){var e=t.findLegalName$$module$build$src$core$procedures("",this);(e=t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:e})).setValidator(t.rename$$module$build$src$core$procedures),e.setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.appendValueInput("RETURN").setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT).appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},callType_:"procedures_callreturn"}),l.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.appendDummyInput("STATEMENT_INPUT").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_ALLOW_STATEMENTS).appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_checkbox",checked:!0}),"STATEMENTS"),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP),this.contextMenu=!1}};var c=class extends t.FieldTextInput$$module$build$src$core$field_textinput{constructor(){super(...arguments),this.editingInteractively=!1}showEditor_(e){super.showEditor_(e),this.editingInteractively=!0,this.editingVariable=void 0}onFinishEditing_(e){super.onFinishEditing_(e),this.editingInteractively=!1}};l.procedures_mutatorarg={init:function(){let e=new c(t.DEFAULT_ARG$$module$build$src$core$procedures,this.validator_);this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORARG_TITLE).appendField(e,"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORARG_TOOLTIP),this.contextMenu=!1},validator_:function(e){var t=this.getSourceBlock();let i=t.workspace.getRootWorkspace();if(!(e=e.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"")))return null;let o=(t.workspace.targetWorkspace||t.workspace).getAllBlocks(!1),s=e.toLowerCase();for(let e=0;e<o.length;e++){if(o[e].id===this.getSourceBlock().id)continue;let t=o[e].getFieldValue("NAME");if(t&&t.toLowerCase()===s)return null}return t.isInFlyout||((t=i.getVariable(e,""))&&t.getName()!==e&&i.renameVariableById(t.getId(),e),t||(this.editingInteractively?this.editingVariable?i.renameVariableById(this.editingVariable.getId(),e):this.editingVariable=i.createVariable(e,""):i.createVariable(e,""))),e}};var h="DISABLED_PROCEDURE_DEFINITION",u={getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(e,i){t.Names$$module$build$src$core$names.equals(e,this.getProcedureCall())&&(this.setFieldValue(i,"NAME"),this.setTooltip((this.outputConnection?t.Msg$$module$build$src$core$msg.PROCEDURES_CALLRETURN_TOOLTIP:t.Msg$$module$build$src$core$msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",i)))},setProcedureParameters_:function(e,i){var o=t.getDefinition$$module$build$src$core$procedures(this.getProcedureCall(),this.workspace);if((o=(o=o&&o.getIcon(t.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE))&&o.bubbleIsVisible())?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=null),e.join("\n")===this.arguments_.join("\n"))this.quarkIds_=i;else{if(i.length!==e.length)throw RangeError("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);for(let e=0;e<this.arguments_.length;e++){var s=this.getInput("ARG"+e);s&&(s=s.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=s,o&&s&&!i.includes(this.quarkIds_[e])&&(s.disconnect(),s.getSourceBlock().bumpNeighbours()))}for(this.arguments_=[].concat(e),this.argumentVarModels_=[],e=0;e<this.arguments_.length;e++)o=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,null,this.arguments_[e],""),this.argumentVarModels_.push(o);if(this.updateShape_(),this.quarkIds_=i){for(i=0;i<this.arguments_.length;i++)if((e=this.quarkIds_[i])in this.quarkConnections_){let t;(null==(t=this.quarkConnections_[e])?0:t.reconnect(this,"ARG"+i))||delete this.quarkConnections_[e]}}}},updateShape_:function(){for(var e=0;e<this.arguments_.length;e++){var i=this.getField("ARGNAME"+e);if(i){t.disable$$module$build$src$core$events$utils();try{i.setValue(this.arguments_[e])}finally{t.enable$$module$build$src$core$events$utils()}}else i=t.fromJson$$module$build$src$core$field_registry({type:"field_label",text:this.arguments_[e]}),this.appendValueInput("ARG"+e).setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT).appendField(i,"ARGNAME"+e)}for(e=this.arguments_.length;this.getInput("ARG"+e);e++)this.removeInput("ARG"+e);(e=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||e.appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&e.removeField("WITH"))},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");e.setAttribute("name",this.getProcedureCall());for(let i=0;i<this.arguments_.length;i++){let o=t.createElement$$module$build$src$core$utils$xml("arg");o.setAttribute("name",this.arguments_[i]),e.appendChild(o)}return e},domToMutation:function(e){var t=e.getAttribute("name");this.renameProcedure(this.getProcedureCall(),t),t=[];let i=[];for(let o=0,s;s=e.childNodes[o];o++)"arg"===s.nodeName.toLowerCase()&&(t.push(s.getAttribute("name")),i.push(s.getAttribute("paramId")));this.setProcedureParameters_(t,i)},saveExtraState:function(){let e=Object.create(null);return e.name=this.getProcedureCall(),this.arguments_.length&&(e.params=this.arguments_),e},loadExtraState:function(e){if(this.renameProcedure(this.getProcedureCall(),e.name),e=e.params){let t=[];t.length=e.length,t.fill(null),this.setProcedureParameters_(e,t)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(e){if(this.workspace&&!this.workspace.isFlyout&&e.recordUndo)if(e.type===t.BLOCK_CREATE$$module$build$src$core$events$events&&e.ids.includes(this.id)){var i=this.getProcedureCall(),o=t.getDefinition$$module$build$src$core$procedures(i,this.workspace);if(o&&(o.type!==this.defType_||JSON.stringify(o.getVars())!==JSON.stringify(this.arguments_))&&(o=null),o)o.isEnabled()||(this.setDisabledReason(!0,h),this.setWarningText(t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",i)));else{t.setGroup$$module$build$src$core$events$utils(e.group),e=t.createElement$$module$build$src$core$utils$xml("xml"),(i=t.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type",this.defType_);var s=(o=this.getRelativeToSurfaceXY()).y+2*t.config$$module$build$src$core$config.snapRadius;i.setAttribute("x",`${o.x+t.config$$module$build$src$core$config.snapRadius*(this.RTL?-1:1)}`),i.setAttribute("y",`${s}`),o=this.mutationToDom(),i.appendChild(o),(o=t.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name","NAME"),s=this.getProcedureCall();let n=t.findLegalName$$module$build$src$core$procedures(s,this);s!==n&&this.renameProcedure(s,n),o.appendChild(t.createTextNode$$module$build$src$core$utils$xml(s)),i.appendChild(o),e.appendChild(i),t.domToWorkspace$$module$build$src$core$xml(e,this.workspace),t.setGroup$$module$build$src$core$events$utils(!1)}}else e.type===t.BLOCK_DELETE$$module$build$src$core$events$events?(i=this.getProcedureCall(),t.getDefinition$$module$build$src$core$procedures(i,this.workspace)||(t.setGroup$$module$build$src$core$events$utils(e.group),this.dispose(!0),t.setGroup$$module$build$src$core$events$utils(!1))):e.type===t.BLOCK_CHANGE$$module$build$src$core$events$events&&"disabled"===e.element&&(i=this.getProcedureCall(),(s=t.getDefinition$$module$build$src$core$procedures(i,this.workspace))&&s.id===e.blockId&&((o=t.getGroup$$module$build$src$core$events$utils())&&console.log("Saw an existing group while responding to a definition change"),t.setGroup$$module$build$src$core$events$utils(e.group),e=s.isEnabled(),this.setDisabledReason(!e,h),this.setWarningText(e?null:t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",i)),t.setGroup$$module$build$src$core$events$utils(o)))},customContextMenu:function(e){if(this.workspace.isMovable()){var i=this.getProcedureCall(),o=this.workspace;e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.PROCEDURES_HIGHLIGHT_DEF,callback:function(){let e=t.getDefinition$$module$build$src$core$procedures(i,o);e&&(o.centerOnBlock(e.id),t.getFocusManager$$module$build$src$core$focus_manager().focusNode(e))}})}}};l.procedures_callnoreturn=Object.assign({},u,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defnoreturn"}),l.procedures_callreturn=Object.assign({},u,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defreturn"}),l.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("value",String(Number(this.hasReturnValue_))),e},domToMutation:function(e){this.hasReturnValue_="1"===e.getAttribute("value"),this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(e){if(!(this.workspace.isDragging&&this.workspace.isDragging()||e.type!==t.BLOCK_MOVE$$module$build$src$core$events$events&&e.type!==t.BLOCK_CREATE$$module$build$src$core$events$events)){e=!1;var i=this;do{if(this.FUNCTION_TYPES.includes(i.type)){e=!0;break}i=i.getSurroundParent()}while(i)if(e?("procedures_defnoreturn"===i.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!==i.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_WARNING),!this.isInFlyout)try{t.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!e,"UNPARENTED_IFRETURN")}finally{t.setRecordUndo$$module$build$src$core$events$utils(!0)}}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]},t.defineBlocks$$module$build$src$core$common(l);var d=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);t.register$$module$build$src$core$extensions("math_op_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("OP",{ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"})),t.registerMutator$$module$build$src$core$extensions("math_is_divisibleby_mutator",{mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation"),i="DIVISIBLE_BY"===this.getFieldValue("PROPERTY");return e.setAttribute("divisor_input",String(i)),e},domToMutation:function(e){e="true"===e.getAttribute("divisor_input"),this.updateShape_(e)},updateShape_:function(e){let t=this.getInput("DIVISOR");e?t||this.appendValueInput("DIVISOR").setCheck("Number"):t&&this.removeInput("DIVISOR")}},function(){this.getField("PROPERTY").setValidator(function(e){e="DIVISIBLE_BY"===e,this.getSourceBlock().updateShape_(e)})}),t.register$$module$build$src$core$extensions("math_change_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_MATH_CHANGE_TOOLTIP}","VAR")),t.registerMutator$$module$build$src$core$extensions("math_modes_of_list_mutator",{updateType_:function(e){"MODE"===e?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("op",this.getFieldValue("OP")),e},domToMutation:function(e){if(null===(e=e.getAttribute("op")))throw TypeError("xmlElement had no op attribute");this.updateType_(e)}},function(){this.getField("OP").setValidator((function(e){this.updateType_(e)}).bind(this))}),t.defineBlocks$$module$build$src$core$common(d);var p=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]);t.register$$module$build$src$core$extensions("controls_whileUntil_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("MODE",{WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"})),t.register$$module$build$src$core$extensions("controls_flow_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("FLOW",{BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"})),t.registerMixin$$module$build$src$core$extensions("contextMenu_newGetVariableBlock",{customContextMenu:function(e){if(!this.isInFlyout){var i=this.getField("VAR"),o=i.getVariable().getName();this.isCollapsed()||null===o||(i={type:"variables_get",fields:{VAR:i.saveState(!0)}},e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",o),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,i)}))}}}),t.register$$module$build$src$core$extensions("controls_for_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),t.register$$module$build$src$core$extensions("controls_forEach_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));var _=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]);t.registerMixin$$module$build$src$core$extensions("controls_flow_in_loop_check",{getSurroundLoop:function(){let e=this;do{if(_.has(e.type))return e;e=e.getSurroundParent()}while(e)return null},onchange:function(e){let i=this.workspace;if(i.isDragging&&!i.isDragging()&&(e.type===t.BLOCK_MOVE$$module$build$src$core$events$events||e.type===t.BLOCK_CREATE$$module$build$src$core$events$events)&&(e=!!this.getSurroundLoop(),this.setWarningText(e?null:t.Msg$$module$build$src$core$msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout))try{t.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!e,"CONTROL_FLOW_NOT_IN_LOOP")}finally{t.setRecordUndo$$module$build$src$core$events$utils(!0)}}}),t.defineBlocks$$module$build$src$core$common(p);var g=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["≠","NEQ"],["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]},{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);t.register$$module$build$src$core$extensions("logic_op_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("OP",{EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"})),t.registerMutator$$module$build$src$core$extensions("controls_if_mutator",{elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;let e=t.createElement$$module$build$src$core$utils$xml("mutation");return this.elseifCount_&&e.setAttribute("elseif",String(this.elseifCount_)),this.elseCount_&&e.setAttribute("else","1"),e},domToMutation:function(e){this.elseifCount_=parseInt(e.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(e.getAttribute("else"),10)||0,this.rebuildShape_()},saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;let e=Object.create(null);return this.elseifCount_&&(e.elseIfCount=this.elseifCount_),this.elseCount_&&(e.hasElse=!0),e},loadExtraState:function(e){this.elseifCount_=e.elseIfCount||0,this.elseCount_=+!!e.hasElse,this.updateShape_()},decompose:function(e){let t=e.newBlock("controls_if_if");t.initSvg();let i=t.nextConnection;for(let t=1;t<=this.elseifCount_;t++){let t=e.newBlock("controls_if_elseif");t.initSvg(),i.connect(t.previousConnection),i=t.nextConnection}return this.elseCount_&&((e=e.newBlock("controls_if_else")).initSvg(),i.connect(e.previousConnection)),t},compose:function(e){e=e.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;let t=[null],i=[null],o=null;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":this.elseifCount_++,t.push(e.valueConnection_),i.push(e.statementConnection_);break;case"controls_if_else":this.elseCount_++,o=e.statementConnection_;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.getNextBlock()}this.updateShape_(),this.reconnectChildBlocks_(t,i,o)},saveConnections:function(e){e=e.nextConnection.targetBlock();let t=1;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":var i=this.getInput("IF"+t);let o=this.getInput("DO"+t);e.valueConnection_=i&&i.connection.targetConnection,e.statementConnection_=o&&o.connection.targetConnection,t++;break;case"controls_if_else":i=this.getInput("ELSE"),e.statementConnection_=i&&i.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.getNextBlock()}},rebuildShape_:function(){let e=[null],t=[null],i=null;this.getInput("ELSE")&&(i=this.getInput("ELSE").connection.targetConnection);for(let i=1;this.getInput("IF"+i);i++){let o=this.getInput("IF"+i),s=this.getInput("DO"+i);e.push(o.connection.targetConnection),t.push(s.connection.targetConnection)}this.updateShape_(),this.reconnectChildBlocks_(e,t,i)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);e++)this.removeInput("IF"+e),this.removeInput("DO"+e);for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck("Boolean").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(e,t,i){for(let i=1;i<=this.elseifCount_;i++){let o,s;null==(o=e[i])||o.reconnect(this,"IF"+i),null==(s=t[i])||s.reconnect(this,"DO"+i)}null==i||i.reconnect(this,"ELSE")}},null,["controls_if_elseif","controls_if_else"]),t.register$$module$build$src$core$extensions("controls_if_tooltip",function(){this.setTooltip((function(){return this.elseifCount_||this.elseCount_?!this.elseifCount_&&this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_2:this.elseifCount_&&!this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_3:this.elseifCount_&&this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_4:"":t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_1}).bind(this))});var E={onchange:function(e){this.prevBlocks_||(this.prevBlocks_=[null,null]);var i=this.getInputTargetBlock("A");let o=this.getInputTargetBlock("B");i&&o&&!this.workspace.connectionChecker.doTypeChecks(i.outputConnection,o.outputConnection)&&(t.setGroup$$module$build$src$core$events$utils(e.group),(e=this.prevBlocks_[0])!==i&&(i.unplug(),!e||e.isDisposed()||e.isShadow()||this.getInput("A").connection.connect(e.outputConnection)),(i=this.prevBlocks_[1])!==o&&(o.unplug(),!i||i.isDisposed()||i.isShadow()||this.getInput("B").connection.connect(i.outputConnection)),this.bumpNeighbours(),t.setGroup$$module$build$src$core$events$utils(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}};t.register$$module$build$src$core$extensions("logic_compare",function(){this.mixin(E)}),t.registerMixin$$module$build$src$core$extensions("logic_ternary",{prevParentConnection_:null,onchange:function(e){let i=this.getInputTargetBlock("THEN"),o=this.getInputTargetBlock("ELSE"),s=this.outputConnection.targetConnection;if((i||o)&&s)for(let n=0;n<2;n++){let r=1===n?i:o;r&&!r.workspace.connectionChecker.doTypeChecks(r.outputConnection,s)&&(t.setGroup$$module$build$src$core$events$utils(e.group),s===this.prevParentConnection_?(this.unplug(),s.getSourceBlock().bumpNeighbours()):(r.unplug(),r.bumpNeighbours()),t.setGroup$$module$build$src$core$events$utils(!1))}this.prevParentConnection_=s}}),t.defineBlocks$$module$build$src$core$common(g);var T=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);T.lists_create_with={init:function(){this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_HELPURL),this.setStyle("list_blocks"),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["lists_create_with_item"],this)),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("items",String(this.itemCount_)),e},domToMutation:function(e){if(!(e=e.getAttribute("items")))throw TypeError("element did not have items");this.itemCount_=parseInt(e,10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(e){this.itemCount_=e.itemCount,this.updateShape_()},decompose:function(e){let t=e.newBlock("lists_create_with_container");t.initSvg();let i=t.getInput("STACK").connection;for(let t=0;t<this.itemCount_;t++){let t=e.newBlock("lists_create_with_item");if(t.initSvg(),!t.previousConnection)throw Error("itemBlock has no previousConnection");i.connect(t.previousConnection),i=t.nextConnection}return t},compose:function(e){var t=e.getInputTargetBlock("STACK");for(e=[];t;)t.isInsertionMarker()||e.push(t.valueConnection_),t=t.getNextBlock();for(t=0;t<this.itemCount_;t++){let i=this.getInput("ADD"+t).connection.targetConnection;i&&!e.includes(i)&&i.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),t=0;t<this.itemCount_;t++){let i;null==(i=e[t])||i.reconnect(this,"ADD"+t)}},saveConnections:function(e){e=e.getInputTargetBlock("STACK");let t=0;for(;e;){if(e.isInsertionMarker()){e=e.getNextBlock();continue}let i=this.getInput("ADD"+t);e.valueConnection_=null==i?void 0:i.connection.targetConnection,e=e.getNextBlock(),t++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_EMPTY_TITLE);for(var e=0;e<this.itemCount_;e++)if(!this.getInput("ADD"+e)){let i=this.appendValueInput("ADD"+e).setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT);0===e&&i.appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_INPUT_WITH)}for(e=this.itemCount_;this.getInput("ADD"+e);e++)this.removeInput("ADD"+e)}},T.lists_create_with_container={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},T.lists_create_with_item={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},T.lists_indexOf={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_LAST,"LAST"]];if(this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_HELPURL),this.setStyle("list_blocks"),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_INPUT_IN_LIST),!(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})))throw Error("field_dropdown not found");this.appendValueInput("FIND").appendField(e,"END"),this.setInputsInline(!0),this.setTooltip(()=>t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}},T.lists_getIndex={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET,"GET"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_HELPURL),this.setStyle("list_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(function(e){e="REMOVE"===e,this.getSourceBlock().updateStatement_(e)}),this.appendValueInput("VALUE").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS})).setValidator(function(e){let t=this.getValue();(e="FROM_START"===e||"FROM_END"===e)!=("FROM_START"===t||"FROM_END"===t)&&this.getSourceBlock().updateAt_(e)}),this.appendDummyInput().appendField(e,"WHERE"),this.appendDummyInput("AT"),t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0),this.setTooltip(()=>{let e=this.getFieldValue("MODE"),i=this.getFieldValue("WHERE"),o="";switch(e+" "+i){case"GET FROM_START":case"GET FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case"GET LAST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case"GET RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case"GET_REMOVE LAST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case"GET_REMOVE RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case"REMOVE FROM_START":case"REMOVE FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case"REMOVE FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case"REMOVE LAST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case"REMOVE RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}return("FROM_START"===i||"FROM_END"===i)&&(o+=" "+("FROM_START"===i?t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),o})},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");e.setAttribute("statement",String(!this.outputConnection));let i=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(i)),e},domToMutation:function(e){let t="true"===e.getAttribute("statement");this.updateStatement_(t),e="false"!==e.getAttribute("at"),this.updateAt_(e)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(e){e.isStatement?this.updateStatement_(!0):"string"==typeof e&&this.domToMutation(t.textToDom$$module$build$src$core$utils$xml(e))},updateStatement_:function(e){!this.outputConnection!==e&&(this.unplug(!0,!0),e?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},T.lists_setIndex={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_SET,"SET"],[t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_IN_LIST),e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS})).setValidator(function(e){let t=this.getValue();(e="FROM_START"===e||"FROM_END"===e)!=("FROM_START"===t||"FROM_END"===t)&&this.getSourceBlock().updateAt_(e)}),this.appendDummyInput().appendField(e,"WHERE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt_(!0),this.setTooltip(()=>{let e=this.getFieldValue("MODE"),i=this.getFieldValue("WHERE"),o="";switch(e+" "+i){case"SET FROM_START":case"SET FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case"SET FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case"SET LAST":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case"SET RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case"INSERT FROM_START":case"INSERT FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case"INSERT FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case"INSERT LAST":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case"INSERT RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}return("FROM_START"===i||"FROM_END"===i)&&(o+=" "+t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),o})},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation"),i=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(i)),e},domToMutation:function(e){e="false"!==e.getAttribute("at"),this.updateAt_(e)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO")}},T.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);let e=e=>{let i=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+e]});return i.setValidator(function(t){let i=this.getValue();(t="FROM_START"===t||"FROM_END"===t)!=("FROM_START"===i||"FROM_END"===i)&&this.getSourceBlock().updateAt_(e,t)}),i};this.appendDummyInput("WHERE1_INPUT").appendField(e(1),"WHERE1"),this.appendDummyInput("AT1"),this.appendDummyInput("WHERE2_INPUT").appendField(e(2),"WHERE2"),this.appendDummyInput("AT2"),t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");var i=this.getInput("AT1")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at1",String(i)),i=this.getInput("AT2")instanceof t.ValueInput$$module$build$src$core$inputs$value_input,e.setAttribute("at2",String(i)),e},domToMutation:function(e){let t="true"===e.getAttribute("at1");e="true"===e.getAttribute("at2"),this.updateAt_(1,t),this.updateAt_(2,e)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(e,i){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),i?(this.appendValueInput("AT"+e).setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e),1===e&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT")),t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}},T.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}},T.lists_split={init:function(){let e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:[[t.Msg$$module$build$src$core$msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!e)throw Error("field_dropdown not found");e.setValidator(e=>{this.updateType_(e)}),this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_SPLIT_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("INPUT").setCheck("String").appendField(e,"MODE"),this.appendValueInput("DELIM").setCheck("String").appendField(t.Msg$$module$build$src$core$msg.LISTS_SPLIT_WITH_DELIMITER),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.setTooltip(()=>{let e=this.getFieldValue("MODE");if("SPLIT"===e)return t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"===e)return t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+e)})},updateType_:function(e){if(this.getFieldValue("MODE")!==e){let e=this.getInput("INPUT").connection;e.setShadowDom(null);let t=e.targetBlock();t&&(e.disconnect(),t.isShadow()?t.dispose(!1):this.bumpNeighbours())}"SPLIT"===e?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("mode",this.getFieldValue("MODE")),e},domToMutation:function(e){this.updateType_(e.getAttribute("mode"))},saveExtraState:function(){return{mode:this.getFieldValue("MODE")}},loadExtraState:function(e){this.updateType_(e.mode)}},t.defineBlocks$$module$build$src$core$common(T);var m={blocks:Object.assign({},T,g,p,d,l,s,o,i),lists:{blocks:T},logic:{blocks:g},loops:{blocks:p,loopTypes:_},math:{blocks:d},procedures:{blocks:l},texts:{blocks:s},variables:{blocks:o},variablesDynamic:{blocks:i}};return m.__namespace__=t,m},"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],i):e.exports=i(h("97Mr6"))}),u("eqdor",function(e,t){var i;e.exports,i=function(e){var t,i,o=e.__namespace__,s=function(e,t){let o=0,s="",n,r;t.STATEMENT_PREFIX&&(s+=t.injectId(t.STATEMENT_PREFIX,e));do r=t.valueToCode(e,"IF"+o,i.NONE)||"False",n=t.statementToCode(e,"DO"+o)||t.PASS,t.STATEMENT_SUFFIX&&(n=t.prefixLines(t.injectId(t.STATEMENT_SUFFIX,e),t.INDENT)+n),s+=(0===o?"if ":"elif ")+r+":\n"+n,o++;while(e.getInput("IF"+o))return(e.getInput("ELSE")||t.STATEMENT_SUFFIX)&&(n=e.getInput("ELSE")&&t.statementToCode(e,"ELSE")||t.PASS,t.STATEMENT_SUFFIX&&(n=t.prefixLines(t.injectId(t.STATEMENT_SUFFIX,e),t.INDENT)+n),s+="else:\n"+n),s},n=function(e,t){let s;s=e.getField("TIMES")?String(parseInt(e.getFieldValue("TIMES"),10)):t.valueToCode(e,"TIMES",i.NONE)||"0",s=o.isNumber$$module$build$src$core$utils$string(s)?parseInt(s,10):"int("+s+")";let n=t.statementToCode(e,"DO");return n=t.addLoopTrap(n,e)||t.PASS,"for "+t.nameDB_.getDistinctName("count",o.NameType$$module$build$src$core$names.VARIABLE)+" in range("+s+"):\n"+n},r=function(e,t){let o,s=e.getFieldValue("OP");if("NEG"===s)return["-"+(o=t.valueToCode(e,"NUM",i.UNARY_SIGN)||"0"),i.UNARY_SIGN];switch(t.definitions_.import_math="import math",e="SIN"===s||"COS"===s||"TAN"===s?t.valueToCode(e,"NUM",i.MULTIPLICATIVE)||"0":t.valueToCode(e,"NUM",i.NONE)||"0",s){case"ABS":o="math.fabs("+e+")";break;case"ROOT":o="math.sqrt("+e+")";break;case"LN":o="math.log("+e+")";break;case"LOG10":o="math.log10("+e+")";break;case"EXP":o="math.exp("+e+")";break;case"POW10":o="math.pow(10,"+e+")";break;case"ROUND":o="round("+e+")";break;case"ROUNDUP":o="math.ceil("+e+")";break;case"ROUNDDOWN":o="math.floor("+e+")";break;case"SIN":o="math.sin("+e+" / 180.0 * math.pi)";break;case"COS":o="math.cos("+e+" / 180.0 * math.pi)";break;case"TAN":o="math.tan("+e+" / 180.0 * math.pi)"}if(o)return[o,i.FUNCTION_CALL];switch(s){case"ASIN":o="math.asin("+e+") / math.pi * 180";break;case"ACOS":o="math.acos("+e+") / math.pi * 180";break;case"ATAN":o="math.atan("+e+") / math.pi * 180";break;default:throw Error("Unknown math operator: "+s)}return[o,i.MULTIPLICATIVE]},l=function(e,t){var s=[],n=e.workspace,r=o.allUsedVarModels$$module$build$src$core$variables(n)||[];for(var l of r)r=l.getName(),e.getVars().includes(r)||s.push(t.getVariableName(r));for(l=0,n=o.allDeveloperVariables$$module$build$src$core$variables(n);l<n.length;l++)s.push(t.nameDB_.getName(n[l],o.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));n=s.length?t.INDENT+"global "+s.join(", ")+"\n":"",s=t.getProcedureName(e.getFieldValue("NAME")),l="",t.STATEMENT_PREFIX&&(l+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(l+=t.injectId(t.STATEMENT_SUFFIX,e)),l&&(l=t.prefixLines(l,t.INDENT)),r="",t.INFINITE_LOOP_TRAP&&(r=t.prefixLines(t.injectId(t.INFINITE_LOOP_TRAP,e),t.INDENT));let a="";e.getInput("STACK")&&(a=t.statementToCode(e,"STACK"));let c="";e.getInput("RETURN")&&(c=t.valueToCode(e,"RETURN",i.NONE)||"");let h="";a&&c&&(h=l),c?c=t.INDENT+"return "+c+"\n":a||(a=t.PASS);let u=[],d=e.getVars();for(let e=0;e<d.length;e++)u[e]=t.getVariableName(d[e]);return n="def "+s+"("+u.join(", ")+"):\n"+n+l+r+a+h+c,n=t.scrub_(e,n),t.definitions_["%"+s]=n,null},a=function(e,t){var o=t.provideFunction_("text_prompt",`
|
|
37
|
+
the string literal 'separator'. Found: ${o}`))}if(t)throw TypeError("Found invalid FieldDropdown options.")}};c0.SEPARATOR="separator",c0.ARROW_CHAR="▾",c0.IMAGE_Y_OFFSET=5,c0.IMAGE_Y_PADDING=2*c0.IMAGE_Y_OFFSET,sy("field_dropdown",c0);var c1,c2,c3,c5,c6,c4=class{constructor(e,t,i,o){this.name=e,this.startHats=!1,this.blockStyles=t||Object.create(null),this.categoryStyles=i||Object.create(null),this.componentStyles=o||Object.create(null),this.fontStyle=Object.create(null),ea(D.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]))return null;if("string"==typeof e){let 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){let i=new c4(e=e.toLowerCase()),o=t.base;if(o){if("string"==typeof o){let e;o=null!=(e=e_(D.THEME,o))?e:void 0}o instanceof c4&&(ti(i,o),i.name=e)}return ti(i.blockStyles,t.blockStyles),ti(i.categoryStyles,t.categoryStyles),ti(i.componentStyles,t.componentStyles),ti(i.fontStyle,t.fontStyle),null!==t.startHats&&(i.startHats=t.startHats),i}},c8=new c4("classic",{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"}},{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"}}),c9=class{constructor(e){let t,i,o;this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let s=null,n=!1;var r,l=!1,a=!1,c=!1,h=!1,u=!1;let d=!!e.readOnly;d||(n=tG(s=tB(null!=(r=e.toolbox)?r:null)),l=void 0===(l=e.trashcan)?n:l,a=void 0===(a=e.collapse)?n:a,c=void 0===(c=e.comments)?n:c,h=void 0===(h=e.disable)?n:h,u=void 0===(u=e.sounds)||u),r=e.maxTrashcanContents,l?void 0===r&&(r=32):r=0;let p=!!e.rtl,_=e.horizontalLayout;void 0===_&&(_=!1);var g="end"!==e.toolboxPosition;g=_?g?lS.TOP:lS.BOTTOM:g===p?lS.RIGHT:lS.LEFT;let E=e.css;void 0===E&&(E=!0);let T="https://blockly-demo.appspot.com/static/media/";e.media&&(T=e.media.endsWith("/")?e.media:e.media+"/");let m=e.oneBasedIndex,f=e.renderer||"geras",I=e.plugins||{},S=e.modalInputs;void 0===S&&(S=!0),this.RTL=p,this.oneBasedIndex=void 0===m||m,this.collapse=a,this.comments=c,this.disable=h,this.readOnly=d,this.maxBlocks=e.maxBlocks||1/0,this.maxInstances=null!=(t=e.maxInstances)?t:null,this.modalInputs=S,this.pathToMedia=T,this.hasCategories=n,this.moveOptions=c9.parseMoveOptions(e,n),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=l,this.maxTrashcanContents=r,this.hasSounds=u,this.hasCss=E,this.horizontalLayout=_,this.languageTree=s,this.gridOptions=c9.parseGridOptions(e),this.zoomOptions=c9.parseZoomOptions(e),this.toolboxPosition=g,this.theme=c9.parseThemeOptions(e),this.renderer=f,this.rendererOverrides=null!=(i=e.rendererOverrides)?i:null,this.parentWorkspace=null!=(o=e.parentWorkspace)?o:null,this.plugins=I}static parseMoveOptions(e,t){let i=e.move||{},o={};return void 0===i.scrollbars&&void 0===e.scrollbars?o.scrollbars=t:"object"==typeof i.scrollbars?(o.scrollbars={horizontal:!!i.scrollbars.horizontal,vertical:!!i.scrollbars.vertical},o.scrollbars.horizontal&&o.scrollbars.vertical?o.scrollbars=!0:o.scrollbars.horizontal||o.scrollbars.vertical||(o.scrollbars=!1)):o.scrollbars=!!i.scrollbars||!!e.scrollbars,o.wheel=o.scrollbars&&void 0!==i.wheel?!!i.wheel:"object"==typeof o.scrollbars,o.drag=!!o.scrollbars&&(void 0===i.drag||!!i.drag),o}static parseZoomOptions(e){e=e.zoom||{};let t={};return t.controls=void 0!==e.controls&&!!e.controls,t.wheel=void 0!==e.wheel&&!!e.wheel,t.startScale=void 0===e.startScale?1:Number(e.startScale),t.maxScale=void 0===e.maxScale?3:Number(e.maxScale),t.minScale=void 0===e.minScale?.3:Number(e.minScale),t.scaleSpeed=void 0===e.scaleSpeed?1.2:Number(e.scaleSpeed),t.pinch=void 0===e.pinch?t.wheel||t.controls:!!e.pinch,t}static parseGridOptions(e){e=e.grid||{};let t={};return t.spacing=Number(e.spacing)||0,t.colour=e.colour||"#888",t.length=void 0===e.length?1:Number(e.length),t.snap=t.spacing>0&&!!e.snap,t}static parseThemeOptions(e){return"string"==typeof(e=e.theme||c8)?e_(D.THEME,e):e instanceof c4?e:c4.defineTheme(e.name||"builtin"+ey(),e)}},c7=class{constructor(e,t){this.bubble=e,this.workspace=t,this.startLoc=null}isMovable(){return!0}startDrag(){let e;this.startLoc=this.bubble.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1),null==(e=this.workspace.getLayerManager())||e.moveToDragLayer(this.bubble),this.bubble.setDragging&&this.bubble.setDragging(!0)}drag(e){this.bubble.moveDuringDrag(e)}endDrag(){let e;this.workspace.setResizesEnabled(!0),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.bubble,100),this.bubble.setDragging(!1)}revertDrag(){this.startLoc&&this.bubble.moveDuringDrag(this.startLoc)}},he=class{constructor(e,t,i,o){this.workspace=e,this.anchor=t,this.ownerRect=i,this.size=new ls(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.dragStrategy=new c7(this,this.workspace),this.id=ey(),this.svgRoot=eZ(li.G,{class:"blocklyBubble"},e.getBubbleCanvas()),e=eZ(li.G,{class:"blocklyEmboss"},this.svgRoot),this.tail=eZ(li.PATH,{class:"blocklyBubbleTail"},e),this.background=eZ(li.RECT,{class:"blocklyDraggable",x:0,y:0,rx:c6.BORDER_WIDTH,ry:c6.BORDER_WIDTH},e),this.contentContainer=eZ(li.G,{},this.svgRoot),this.focusableElement=null!=o?o:this.svgRoot,this.focusableElement.setAttribute("id",this.id),eb(this.background,"pointerdown",this,this.onMouseDown)}dispose(){e2(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,c6.MIN_SIZE),e.height=Math.max(e.height,c6.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;null==(t=this.workspace.getGesture(e))||t.handleBubbleStart(e,this),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(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 lo(0,0,0,0)){var t=this.workspace.getMetricsManager().getViewMetrics(!0),i=this.getOptimalRelativeLeft(t),o=this.getOptimalRelativeTop(t);let s={x:i,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},n={x:-this.size.width-30,y:o};o={x:e.getWidth(),y:o};var r={x:i,y:e.getHeight()};i=e.getWidth()<e.getHeight()?o:r,e=e.getWidth()<e.getHeight()?r:o,o=this.getOverlap(s,t),r=this.getOverlap(n,t);let l=this.getOverlap(i,t);t=Math.max(o,r,l,t=this.getOverlap(e,t)),o===t?(this.relativeLeft=s.x,this.relativeTop=s.y):r===t?(this.relativeLeft=n.x,this.relativeTop=n.y):l===t?(this.relativeLeft=i.x,this.relativeTop=i.y):(this.relativeLeft=e.x,this.relativeTop=e.y),this.positionRelativeToAnchor()}getOverlap(e,t){var i=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(i+this.size.width,t.left+t.width)-Math.max(i,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 i=this.anchor.x-t;i-this.size.width<e.left?t=-(e.left-this.anchor.x+this.size.width):i>e.right&&(t=-(e.right-this.anchor.x))}else{let o=(i=t+this.anchor.x)+this.size.width;i<e.left?t=e.left-this.anchor.x:o>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;let i=this.anchor.y+t,o=i+this.size.height;return i<(e=this.getWorkspaceViewRect(e)).top?t=e.top-this.anchor.y:o>e.bottom&&(t=e.bottom-this.anchor.y-this.size.height),t}getWorkspaceViewRect(e){let t=e.top,i=e.top+e.height,o=e.left;return e=e.left+e.width,i-=this.getScrollbarThickness(),this.workspace.RTL?o-=this.getScrollbarThickness():e-=this.getScrollbarThickness(),new lo(t,i,o,e)}getScrollbarThickness(){return lh.scrollbarThickness/this.workspace.scale}renderTail(){let e,t=[];var i=this.size.width/2,o=this.size.height/2,s=-this.relativeLeft,n=-this.relativeTop;if(i===s&&o===n)t.push("M "+i+","+o);else{n-=o,s-=i,this.workspace.RTL&&(s*=-1);var r=Math.sqrt(n*n+s*s),l=Math.acos(s/r);n<0&&(l=2*Math.PI-l);var a=l+Math.PI/2;a>2*Math.PI&&(a-=2*Math.PI);var c=Math.sin(a);let e=Math.cos(a),h=(this.size.width+this.size.height)/c6.TAIL_THICKNESS;h=Math.min(h,this.size.width,this.size.height)/4,s=i+(a=1-c6.ANCHOR_RADIUS/r)*s,n=o+a*n,a=i+h*e;let u=o+h*c;i-=h*e,o-=h*c,(c=l+(c=i2(this.workspace.RTL?-c6.TAIL_ANGLE:c6.TAIL_ANGLE)))>2*Math.PI&&(c-=2*Math.PI),l=Math.sin(c)*r/c6.TAIL_BEND,r=Math.cos(c)*r/c6.TAIL_BEND,t.push("M"+a+","+u),t.push("C"+(a+r)+","+(u+l)+" "+s+","+n+" "+s+","+n),t.push("C"+s+","+n+" "+(i+r)+","+(o+l)+" "+i+","+o)}t.push("z"),null==(e=this.tail)||e.setAttribute("d",t.join(" "))}bringToFront(){let e,t=null==(e=this.svgRoot)?void 0:e.parentNode;return!!this.svgRoot&&(null==t?void 0:t.lastChild)!==this.svgRoot&&(null==t||t.appendChild(this.svgRoot),!0)}getRelativeToSurfaceXY(){return new lt(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(){th(this)}unselect(){th(null)}getFocusableElement(){return this.focusableElement}getFocusableTree(){return this.workspace}onNodeFocus(){this.select(),this.bringToFront()}onNodeBlur(){this.unselect()}canBeFocused(){return!0}};c6=he,he.BORDER_WIDTH=6,he.DOUBLE_BORDER=2*c6.BORDER_WIDTH,he.MIN_SIZE=c6.DOUBLE_BORDER,he.TAIL_THICKNESS=1,he.TAIL_ANGLE=20,he.TAIL_BEND=4,he.ANCHOR_RADIUS=8;var ht=class extends he{constructor(e,t,i,o){let s,n;super(t,i,o),this.workspace=t,this.anchor=i,this.ownerRect=o,this.autoLayout=!0,t=new c9(e),this.validateWorkspaceOptions(t),this.svgDialog=eZ(li.SVG,{x:he.BORDER_WIDTH,y:he.BORDER_WIDTH},this.contentContainer),e.parentWorkspace=this.workspace,this.miniWorkspace=this.newWorkspaceSvg(new c9(e)),this.miniWorkspace.internalIsMutator=!0,e=this.miniWorkspace.createDom("blocklyMutatorBackground"),this.svgDialog.appendChild(e),t.languageTree&&(e.insertBefore(this.miniWorkspace.addFlyout(li.G),this.miniWorkspace.getCanvas()),null==(e=this.miniWorkspace.getFlyout())||e.init(this.miniWorkspace),null==e||e.show(t.languageTree)),eq(this.svgRoot,"blocklyMiniWorkspaceBubble"),this.miniWorkspace.addChangeListener(this.onWorkspaceChange.bind(this)),null==(s=this.miniWorkspace.getFlyout())||null==(n=s.getWorkspace())||n.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()||this.miniWorkspace.keyboardMoveInProgress)for(let e of this.miniWorkspace.getTopBlocks(!1)){let t=e.getRelativeToSurfaceXY();if(t.y<20&&e.moveBy(0,20-t.y),e.RTL){let i=-20,o=this.miniWorkspace.getFlyout();o&&(i-=o.getWidth()),t.x>i&&e.moveBy(i-t.x,0)}else t.x<20&&e.moveBy(20-t.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()||this.miniWorkspace.keyboardMoveInProgress){this.autoLayout&&(this.autoLayout=!this.miniWorkspace.keyboardMoveInProgress);var e=this.getSize(),t=this.calculateWorkspaceSize();Math.abs(e.width-t.width)<ht.MINIMUM_VIEW_CHANGE&&Math.abs(e.height-t.height)<ht.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 ls(t.width+he.DOUBLE_BORDER,t.height+he.DOUBLE_BORDER),this.autoLayout),this.miniWorkspace.resize(),this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var e=this.miniWorkspace.getCanvas().getBBox();let t=e.width+ht.MARGIN;e=e.height+ht.MARGIN;let i=this.miniWorkspace.getFlyout();return i&&(e=Math.max(e,i.getWorkspace().getMetricsManager().getScrollMetrics().height+20),t+=i.getWidth()),new ls(t,e)}updateBlockStyles(){let e;for(var t of this.miniWorkspace.getAllBlocks(!1))t.setStyle(t.getStyleName());if(t=null==(e=this.miniWorkspace.getFlyout())?void 0:e.getWorkspace())for(let e of t.getAllBlocks(!1))e.setStyle(e.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")}};ht.MINIMUM_VIEW_CHANGE=10,ht.MARGIN=3*he.DOUBLE_BORDER;var hi=class{constructor(e){this.sourceBlock=e,this.offsetInBlock=new lt(0,0),this.workspaceLocation=new lt(0,0),this.svgRoot=null,this.tooltip=e,this.id=ey()}getType(){throw Error("Icons must implement getType")}initView(e){if(!this.svgRoot){var t=this.sourceBlock;this.svgRoot=eZ(li.G,{class:"blocklyIconGroup",id:this.id}),t.getSvgRoot().appendChild(this.svgRoot),this.updateSvgRootOffset(),eb(this.svgRoot,"pointerdown",this,e),this.svgRoot.tooltip=this,oC(this.svgRoot)}}dispose(){oO(this.svgRoot),e2(this.svgRoot)}getWeight(){return -1}getSize(){return new ls(0,0)}setTooltip(e){this.tooltip=null!=e?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",i1(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;null==(e=this.svgRoot)||e.setAttribute("transform",`translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`)}onLocationChange(e){this.workspaceLocation=lt.sum(e,this.offsetInBlock)}onClick(){}isClickableInFlyout(e){return!0}getFocusableElement(){let e=this.svgRoot;if(!e)throw Error("Attempting to focus uninitialized icon.");return e}getFocusableTree(){return this.sourceBlock.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getSourceBlock(){return this.sourceBlock}};$.MutatorIcon$$module$build$src$core$icons$mutator_icon=class extends hi{constructor(e,t){super(t),this.flyoutBlockTypes=e,this.sourceBlock=t,this.saveConnectionsListener=this.updateWorkspacePid=this.rootBlock=this.miniWorkspaceBubble=null}getType(){return $.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE}initView(e){this.svgRoot||(super.initView(e),eZ(li.RECT,{class:"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},this.svgRoot),eZ(li.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),eZ(li.CIRCLE,{class:"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},this.svgRoot),eq(this.svgRoot,"blocklyMutatorIcon"))}dispose(){let e;super.dispose(),null==(e=this.miniWorkspaceBubble)||e.dispose()}getWeight(){return $.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT}getSize(){return new ls(17,17)}applyColour(){let e,t;super.applyColour(),null==(e=this.miniWorkspaceBubble)||e.setColour(this.sourceBlock.getColour()),null==(t=this.miniWorkspaceBubble)||t.updateBlockStyles()}updateCollapsed(){super.updateCollapsed(),this.sourceBlock.isCollapsed()&&this.setBubbleVisible(!1)}onLocationChange(e){let t;super.onLocationChange(e),null==(t=this.miniWorkspaceBubble)||t.setAnchorLocation(this.getAnchorLocation())}onClick(){super.onClick(),this.sourceBlock.isEditable()&&this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.miniWorkspaceBubble}setBubbleVisible(e){let t=this;return(0,rf.asyncExecutePromiseGeneratorFunction)(function*(){if(t.bubbleIsVisible()!==e){if(yield t6(),e){let e;t.miniWorkspaceBubble=new ht(t.getMiniWorkspaceConfig(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour(),t.createRootBlock(),t.addSaveConnectionsListener(),null==(e=t.miniWorkspaceBubble)||e.addWorkspaceChangeListener(t.createMiniWorkspaceChangeListener())}else{let e;null==(e=t.miniWorkspaceBubble)||e.dispose(),t.miniWorkspaceBubble=null,t.saveConnectionsListener&&t.sourceBlock.workspace.removeChangeListener(t.saveConnectionsListener),t.saveConnectionsListener=null}eH(new(ej(rL.BUBBLE_OPEN))(t.sourceBlock,e,"mutator"))}})}getBubble(){return this.miniWorkspaceBubble}getMiniWorkspaceConfig(){let e,t={disable:!1,media:this.sourceBlock.workspace.options.pathToMedia,rtl:this.sourceBlock.RTL,renderer:this.sourceBlock.workspace.options.renderer,rendererOverrides:null!=(e=this.sourceBlock.workspace.options.rendererOverrides)?e:void 0};return this.flyoutBlockTypes.length&&(t.toolbox={kind:"flyoutToolbox",contents:this.flyoutBlockTypes.map(e=>({kind:"block",type:e}))}),t}getAnchorLocation(){return lt.sum(this.workspaceLocation,new lt(8.5,8.5))}getBubbleOwnerRect(){let e=this.sourceBlock.getSvgRoot().getBBox();return new lo(e.y,e.y+e.height,e.x,e.x+e.width)}createRootBlock(){let e,t,i,o;if(!this.sourceBlock.decompose)throw Error("Blocks with mutator icons must include a decompose method");for(var s of(this.rootBlock=this.sourceBlock.decompose(this.miniWorkspaceBubble.getWorkspace()),this.rootBlock.getDescendants(!1)))s.queueRender();this.rootBlock.setMovable(!1),this.rootBlock.setDeletable(!1),s=null!=(o=null==(e=this.miniWorkspaceBubble)||null==(t=e.getWorkspace())||null==(i=t.getFlyout())?void 0:i.getWidth())?o:0,this.rootBlock.moveBy(this.rootBlock.RTL?-(s+16):16,16)}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=>{$.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||ek(e)||eM(e)&&"disabled"===e.element}recomposeSourceBlock(){if(this.rootBlock){if(!this.sourceBlock.compose)throw Error("Blocks with mutator icons must include a compose method");var e=$.getGroup$$module$build$src$core$events$utils();e||$.setGroup$$module$build$src$core$events$utils(!0);var t=aO.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var i=aO.getExtraBlockState_(this.sourceBlock);t!==i&&eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock,"mutation",null,t,i)),$.setGroup$$module$build$src$core$events$utils(e)}}getWorkspace(){let e;return null==(e=this.miniWorkspaceBubble)?void 0:e.getWorkspace()}},$.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE=ab.MUTATOR,$.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1,$.MutatorIcon$$module$build$src$core$icons$mutator_icon;var ho=Object.create(null);$.register$$module$build$src$core$extensions("parent_tooltip_when_inline",function(){let e=this.tooltip;this.setTooltip((function(){let t=this.getParent();return t&&t.getInputsInline()&&t.tooltip||e}).bind(this))});var hs={TEST_ONLY:{allExtensions:ho}};hs.apply=sw,hs.buildTooltipForDropdown=$.buildTooltipForDropdown$$module$build$src$core$extensions,hs.buildTooltipWithFieldText=$.buildTooltipWithFieldText$$module$build$src$core$extensions,hs.isRegistered=sk,hs.register=$.register$$module$build$src$core$extensions,hs.registerMixin=$.registerMixin$$module$build$src$core$extensions,hs.registerMutator=$.registerMutator$$module$build$src$core$extensions,hs.runAfterPageLoad=function(e){if("object"!=typeof document)throw Error("runAfterPageLoad() requires browser document.");if("complete"===document.readyState)e();else{let t=setInterval(function(){"complete"===document.readyState&&(clearInterval(t),e())},10)}},hs.unregister=function(e){sk(e)?delete ho[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},(dG=dK||(dK={}))[dG.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX",dG[dG.MAC_ENTER=3]="MAC_ENTER",dG[dG.BACKSPACE=8]="BACKSPACE",dG[dG.TAB=9]="TAB",dG[dG.NUM_CENTER=12]="NUM_CENTER",dG[dG.ENTER=13]="ENTER",dG[dG.SHIFT=16]="SHIFT",dG[dG.CTRL=17]="CTRL",dG[dG.ALT=18]="ALT",dG[dG.PAUSE=19]="PAUSE",dG[dG.CAPS_LOCK=20]="CAPS_LOCK",dG[dG.ESC=27]="ESC",dG[dG.SPACE=32]="SPACE",dG[dG.PAGE_UP=33]="PAGE_UP",dG[dG.PAGE_DOWN=34]="PAGE_DOWN",dG[dG.END=35]="END",dG[dG.HOME=36]="HOME",dG[dG.LEFT=37]="LEFT",dG[dG.UP=38]="UP",dG[dG.RIGHT=39]="RIGHT",dG[dG.DOWN=40]="DOWN",dG[dG.PLUS_SIGN=43]="PLUS_SIGN",dG[dG.PRINT_SCREEN=44]="PRINT_SCREEN",dG[dG.INSERT=45]="INSERT",dG[dG.DELETE=46]="DELETE",dG[dG.ZERO=48]="ZERO",dG[dG.ONE=49]="ONE",dG[dG.TWO=50]="TWO",dG[dG.THREE=51]="THREE",dG[dG.FOUR=52]="FOUR",dG[dG.FIVE=53]="FIVE",dG[dG.SIX=54]="SIX",dG[dG.SEVEN=55]="SEVEN",dG[dG.EIGHT=56]="EIGHT",dG[dG.NINE=57]="NINE",dG[dG.FF_SEMICOLON=59]="FF_SEMICOLON",dG[dG.FF_EQUALS=61]="FF_EQUALS",dG[dG.FF_DASH=173]="FF_DASH",dG[dG.FF_HASH=163]="FF_HASH",dG[dG.QUESTION_MARK=63]="QUESTION_MARK",dG[dG.AT_SIGN=64]="AT_SIGN",dG[dG.A=65]="A",dG[dG.B=66]="B",dG[dG.C=67]="C",dG[dG.D=68]="D",dG[dG.E=69]="E",dG[dG.F=70]="F",dG[dG.G=71]="G",dG[dG.H=72]="H",dG[dG.I=73]="I",dG[dG.J=74]="J",dG[dG.K=75]="K",dG[dG.L=76]="L",dG[dG.M=77]="M",dG[dG.N=78]="N",dG[dG.O=79]="O",dG[dG.P=80]="P",dG[dG.Q=81]="Q",dG[dG.R=82]="R",dG[dG.S=83]="S",dG[dG.T=84]="T",dG[dG.U=85]="U",dG[dG.V=86]="V",dG[dG.W=87]="W",dG[dG.X=88]="X",dG[dG.Y=89]="Y",dG[dG.Z=90]="Z",dG[dG.META=91]="META",dG[dG.WIN_KEY_RIGHT=92]="WIN_KEY_RIGHT",dG[dG.CONTEXT_MENU=93]="CONTEXT_MENU",dG[dG.NUM_ZERO=96]="NUM_ZERO",dG[dG.NUM_ONE=97]="NUM_ONE",dG[dG.NUM_TWO=98]="NUM_TWO",dG[dG.NUM_THREE=99]="NUM_THREE",dG[dG.NUM_FOUR=100]="NUM_FOUR",dG[dG.NUM_FIVE=101]="NUM_FIVE",dG[dG.NUM_SIX=102]="NUM_SIX",dG[dG.NUM_SEVEN=103]="NUM_SEVEN",dG[dG.NUM_EIGHT=104]="NUM_EIGHT",dG[dG.NUM_NINE=105]="NUM_NINE",dG[dG.NUM_MULTIPLY=106]="NUM_MULTIPLY",dG[dG.NUM_PLUS=107]="NUM_PLUS",dG[dG.NUM_MINUS=109]="NUM_MINUS",dG[dG.NUM_PERIOD=110]="NUM_PERIOD",dG[dG.NUM_DIVISION=111]="NUM_DIVISION",dG[dG.F1=112]="F1",dG[dG.F2=113]="F2",dG[dG.F3=114]="F3",dG[dG.F4=115]="F4",dG[dG.F5=116]="F5",dG[dG.F6=117]="F6",dG[dG.F7=118]="F7",dG[dG.F8=119]="F8",dG[dG.F9=120]="F9",dG[dG.F10=121]="F10",dG[dG.F11=122]="F11",dG[dG.F12=123]="F12",dG[dG.NUMLOCK=144]="NUMLOCK",dG[dG.SCROLL_LOCK=145]="SCROLL_LOCK",dG[dG.FIRST_MEDIA_KEY=166]="FIRST_MEDIA_KEY",dG[dG.LAST_MEDIA_KEY=183]="LAST_MEDIA_KEY",dG[dG.SEMICOLON=186]="SEMICOLON",dG[dG.DASH=189]="DASH",dG[dG.EQUALS=187]="EQUALS",dG[dG.COMMA=188]="COMMA",dG[dG.PERIOD=190]="PERIOD",dG[dG.SLASH=191]="SLASH",dG[dG.APOSTROPHE=192]="APOSTROPHE",dG[dG.TILDE=192]="TILDE",dG[dG.SINGLE_QUOTE=222]="SINGLE_QUOTE",dG[dG.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET",dG[dG.BACKSLASH=220]="BACKSLASH",dG[dG.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET",dG[dG.WIN_KEY=224]="WIN_KEY",dG[dG.MAC_FF_META=224]="MAC_FF_META",dG[dG.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT",dG[dG.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT",dG[dG.WIN_IME=229]="WIN_IME",dG[dG.VK_NONAME=252]="VK_NONAME",dG[dG.PHANTOM=255]="PHANTOM";var hn={};hn.arc=sz,hn.curve=sU,hn.line=sY,hn.lineOnAxis=sX,hn.lineTo=sK,hn.moveBy=sV,hn.moveTo=sW,hn.point=sH;var hr={};hr.Coordinate=lt,hr.KeyCodes=dK,hr.Rect=lo,hr.Size=ls,hr.Svg=li,hr.aria=lV,hr.array=r3,hr.browserEvents=X,hr.colour=ch,hr.deprecation=ac,hr.dom=rB,hr.extensions=hs,hr.idGenerator=q,hr.math=aA,hr.object=rU,hr.parsing=cu,hr.string=aQ,hr.style=lr,hr.svgMath=lc,hr.svgPaths=hn,hr.toolbox=lO,hr.userAgent={ANDROID:rC,GECKO:rb,IPAD:rO,IPHONE:rA,JavaFx:W,MAC:V,MOBILE:rN,raw:rI},hr.xml=lm;var hl=class{constructor(e,t){if(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,e.id.includes("_connection"))throw Error(`Connection ID indicator is contained in block ID. This will cause problems with focus: ${e.id}.`);this.id=`${e.id}_connection_${ey()}`}connect_(e){let t,i,o=c5.INPUT_VALUE,s=this.getSourceBlock();var n=e.getSourceBlock();if(e.isConnected()&&e.disconnectInternal(!1),this.isConnected()){let e=this.stashShadowState(),i=this.targetBlock();i.isShadow()?i.dispose(!1):(this.disconnectInternal(),t=i),this.applyShadowState(e)}eY()&&(i=new(ej(rL.BLOCK_MOVE))(n)).setReason(["connect"]),sj(this,e),n.setParent(s),i&&(i.recordNew(),eH(i)),t&&(e=this.type===o?t.outputConnection:t.previousConnection)&&((n=hl.getConnectionForOrphanedConnection(n,e))?e.connect(n):e.onFailedConnect(this))}dispose(){if(this.isConnected()){this.isSuperior()&&this.setShadowStateInternal();let e=this.targetBlock();e&&!e.isDeadOrDying()&&e.unplug()}this.disposed=!0}getSourceBlock(){return this.sourceBlock_}isSuperior(){return this.type===c5.INPUT_VALUE||this.type===c5.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)){let t=$.getGroup$$module$build$src$core$events$utils();t||$.setGroup$$module$build$src$core$events$utils(!0),this.isSuperior()?this.connect_(e):e.connect_(this),$.setGroup$$module$build$src$core$events$utils(t)}return this.isConnected()}disconnect(){this.disconnectInternal()}disconnectInternal(e=!0){let t,{parentConnection:i,childConnection:o}=this.getParentAndChildConnections();if(!i||!o)throw Error("Source connection not connected.");let s=$.getGroup$$module$build$src$core$events$utils();s||$.setGroup$$module$build$src$core$events$utils(!0),eY()&&(t=new(ej(rL.BLOCK_MOVE))(o.getSourceBlock())).setReason(["disconnect"]);let n=this.targetConnection;n&&(n.targetConnection=null),this.targetConnection=null,e&&o.getSourceBlock().setParent(null),t&&(t.recordNew(),eH(t)),o.getSourceBlock().isShadow()||i.respawnShadow_(),$.setGroup$$module$build$src$core$events$utils(s)}getParentAndChildConnections(){return this.targetConnection?this.isSuperior()?{parentConnection:this,childConnection:this.targetConnection}:{parentConnection:this.targetConnection,childConnection:this}:{}}respawnShadow_(){this.createShadowBlock(!0)}reconnect(e,t){var i;return!this.getSourceBlock().isDeadOrDying()&&(t=null==(i=e.getInput(t))?void 0:i.connection,(!(i=this.targetBlock())||i===e)&&!!t&&t.targetConnection!==this&&(t.isConnected()&&t.disconnect(),t.connect(this),!0))}targetBlock(){if(this.isConnected()){let e,t;return null!=(t=null==(e=this.targetConnection)?void 0:e.getSourceBlock())?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()?sp(this.targetBlock()):this.shadowDom}setShadowState(e){this.setShadowStateInternal({shadowState:e})}getShadowState(e){return e&&this.targetBlock()&&this.targetBlock().isShadow()?ik(this.targetBlock()):this.shadowState}neighbours(e){return[]}getParentInput(){let e=null,t=this.sourceBlock_.inputList;for(let i=0;i<t.length;i++)if(t[i].connection===this){e=t[i];break}return e}toString(){let 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 i=0,o;o=e.inputList[i];i++)if(o.connection===this){t=o;break}if(!t)return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection";t='Input "'+t.name+'" connection on '}return t+e.toDevString()}stashShadowState(){let 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();let i=this.getShadowState(),o=this.getShadowDom();if(t.isDeadOrDying()||!i&&!o)return null;if(i)return iU(i,t.workspace,{parentConnection:e?this:void 0,isShadow:!0,recordUndo:!1});if(o){if(t=sT(o,t.workspace),e)if(this.type===c5.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===c5.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=sp(e),this.shadowState=ik(e))}static getConnectionForOrphanedConnection(e,t){if(t.type===c5.OUTPUT_VALUE)return sZ(e,t.getSourceBlock());e=e.lastConnectionInStack(!0);let i=t.getConnectionChecker();return e&&i.canConnect(t,e,!1)?e:null}};hl.CAN_CONNECT=0,hl.REASON_SELF_CONNECTION=1,hl.REASON_WRONG_TYPE=2,hl.REASON_TARGET_NULL=3,hl.REASON_CHECKS_FAILED=4,hl.REASON_DIFFERENT_WORKSPACES=5,hl.REASON_SHADOW_PARENT=6,hl.REASON_DRAG_CHECKS_FAILED=7,hl.REASON_PREVIOUS_AND_OUTPUT=8;var ha=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}},hc={};hc.DuplicateIconType=ha,(dH=$.Align$$module$build$src$core$inputs$align||($.Align$$module$build$src$core$inputs$align={}))[dH.LEFT=-1]="LEFT",dH[dH.CENTRE=0]="CENTRE",dH[dH.RIGHT=1]="RIGHT",$.Align$$module$build$src$core$inputs$align;var hh=class extends cd{constructor(e,t,i){super(cd.SKIP_SETUP),this.class=null,this.EDITABLE=!1,this.maxDisplayLength=1/0,e!==cd.SKIP_SETUP&&(i?this.configure_(i):this.class=t||null,this.setValue(e))}configure_(e){super.configure_(e),e.class&&(this.class=e.class)}initView(){this.createTextElement_(),this.class&&eq(this.getTextElement(),this.class),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyLabelField")}doClassValidation_(e){return null==e?null:`${e}`}setClass(e){this.textElement_&&(this.class&&e0(this.textElement_,this.class),e&&eq(this.textElement_,e)),this.class=e}static fromJson(e){return new this(oX(e.text),void 0,e)}};sy("field_label",hh),hh.prototype.DEFAULT_VALUE="";var hu=[];hu[c5.INPUT_VALUE]=c5.OUTPUT_VALUE,hu[c5.OUTPUT_VALUE]=c5.INPUT_VALUE,hu[c5.NEXT_STATEMENT]=c5.PREVIOUS_STATEMENT,hu[c5.PREVIOUS_STATEMENT]=c5.NEXT_STATEMENT;var hd="RENAME_VARIABLE_ID",hp="DELETE_VARIABLE_ID",h_=class extends hl{constructor(e,t){super(e,t),this.highlighted=!1,this.targetConnection=null,this.db=e.workspace.connectionDBList[t],this.dbOpposite=e.workspace.connectionDBList[hu[t]],this.offsetInBlock=new lt(0,0),this.trackedState=h_.TrackedState.WILL_TRACK}dispose(){let e,t;super.dispose(),this.trackedState===h_.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),null==(t=(e=this.sourceBlock_.pathObject).removeConnectionHighlight)||t.call(e,this)}getSourceBlock(){return super.getSourceBlock()}targetBlock(){return super.targetBlock()}distanceFrom(e){let t=this.x-e.x;return Math.sqrt(t*t+(e=this.y-e.y)*e)}bumpAwayFrom(e,t=!1){if(!this.sourceBlock_.workspace.isDragging()){var i=$.config$$module$build$src$core$config.snapRadius+Math.floor(10*Math.random()),o=$.config$$module$build$src$core$config.snapRadius+Math.floor(10*Math.random()),s=e.sourceBlock_.getRootBlock(),n=this.sourceBlock_.getRootBlock();if(!s.isInFlyout&&!n.isInFlyout){var r=!0;if(n.isMovable())s.isMovable()&&t&&(o=-o);else{if(!s.isMovable())return;r=!1,i=-i,o=-o}t=r?e:this,e=r?this:e,(s=r?n:s).RTL&&(i=-i),s.moveBy(t.x+i-e.x,t.y+o-e.y,["bump"])}}}moveTo(e,t){let i=!1;return this.trackedState===h_.TrackedState.WILL_TRACK?(this.db.addConnection(this,t),this.trackedState=h_.TrackedState.TRACKED,i=!0):this.trackedState===h_.TrackedState.TRACKED&&(this.db.removeConnection(this,this.y),this.db.addConnection(this,t),i=!0),this.x=e,this.y=t,i}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;let t=this.targetBlock();e&&t&&(e=lt.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;let e=this.findHighlightSvg();e&&(e.style.display="")}unhighlight(){this.highlighted=!1;let e=this.findHighlightSvg();e&&(e.style.display="none")}isHighlighted(){return this.highlighted}setTracking(e){e&&this.trackedState===h_.TrackedState.TRACKED||!e&&this.trackedState===h_.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db.addConnection(this,this.y),this.trackedState=h_.TrackedState.TRACKED):(this.trackedState===h_.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),this.trackedState=h_.TrackedState.UNTRACKED))}stopTrackingAll(){if(this.setTracking(!1),this.targetConnection){let e=this.targetBlock().getDescendants(!1);for(let t=0;t<e.length;t++){let i=e[t],o=i.getConnections_(!0);for(let e=0;e<o.length;e++)o[e].setTracking(!1);for(let e of i.getIcons())i1(e)&&e.setBubbleVisible(!1)}}}startTrackingAll(){this.setTracking(!0);let e=[];if(this.type!==c5.INPUT_VALUE&&this.type!==c5.NEXT_STATEMENT)return e;let t=this.targetBlock();if(t){let i;t.isCollapsed()?(i=[],t.outputConnection&&i.push(t.outputConnection),t.nextConnection&&i.push(t.nextConnection),t.previousConnection&&i.push(t.previousConnection)):i=t.getConnections_(!0);for(let t=0;t<i.length;t++)e.push(...i[t].startTrackingAll());e.length||(e=[t])}return e}onFailedConnect(e){let t=this.getSourceBlock();if(eG()){let i=$.getGroup$$module$build$src$core$events$utils();setTimeout((function(){t.isDisposed()||t.getParent()||($.setGroup$$module$build$src$core$events$utils(i),this.bumpAwayFrom(e),$.setGroup$$module$build$src$core$events$utils(!1))}).bind(this),$.config$$module$build$src$core$config.bumpDelay)}}disconnectInternal(e=!0){let{parentConnection:t,childConnection:i}=this.getParentAndChildConnections();if(t&&i){var o=$.getGroup$$module$build$src$core$events$utils();o||$.setGroup$$module$build$src$core$events$utils(!0);var s=t.getSourceBlock(),n=i.getSourceBlock();super.disconnectInternal(e),s.queueRender(),n.updateDisabled(),n.queueRender(),n.getSvgRoot().style.display="block",$.setGroup$$module$build$src$core$events$utils(o)}}respawnShadow_(){super.respawnShadow_();let 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(),(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}showContextMenu(e){let t=cN.registry.getContextMenuOptions({focusedNode:this},e);if(t.length){var i=this.getSourceBlock(),o=i.workspace;if(e instanceof PointerEvent)var s=new lt(e.clientX,e.clientY);else s=tM(o,s=new lt(this.x,this.y)).translate(i.RTL?-5:5,5);o9(e,t,i.RTL,o,s)}}getFocusableElement(){let e=this.findHighlightSvg();if(e)return e;throw Error("No highlight SVG found corresponding to this connection.")}getFocusableTree(){return this.getSourceBlock().workspace}onNodeFocus(){this.highlight()}onNodeBlur(){this.unhighlight()}canBeFocused(){return!0}findHighlightSvg(){return document.getElementById(this.id)}};(dU=(dU=h_||(h_={})).TrackedState||(dU.TrackedState={}))[dU.WILL_TRACK=-1]="WILL_TRACK",dU[dU.UNTRACKED=0]="UNTRACKED",dU[dU.TRACKED=1]="TRACKED";var hg=h_.TrackedState,hE={};hE.RenderedConnection=h_,hE.TrackedState=hg;var hT=class{constructor(e,t){this.name=e,this.sourceBlock=t,this.fieldRow=[],this.align=$.Align$$module$build$src$core$inputs$align.LEFT,this.visible=!0,this.type=$.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,i){if(e<0||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return(t||""===t&&i)&&("string"==typeof t&&(t=$.fromJson$$module$build$src$core$field_registry({type:"field_label",text:t})),t.setSourceBlock(this.sourceBlock),this.sourceBlock.initialized&&this.initField(t),t.name=i,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 t=0,i;i=this.fieldRow[t];t++)if(i.name===e)return i.dispose(),this.fieldRow.splice(t,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 t=0,i;i=this.fieldRow[t];t++)i.setVisible(e);if(this.connection&&this.connection instanceof h_){e?t=this.connection.startTrackingAll():this.connection.stopTrackingAll();let i=this.connection.targetBlock();i&&(i.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(let e of this.fieldRow)e.init()}initModel(){for(let 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)}},hm=class extends hT{constructor(e,t){super(e,t),this.name=e,this.type=$.inputTypes$$module$build$src$core$inputs$input_types.DUMMY}},hf=class extends hT{constructor(e,t){super(e,t),this.name=e,this.type=$.inputTypes$$module$build$src$core$inputs$input_types.END_ROW}},hI=class extends hT{constructor(e,t){if(!e)throw Error("Statement inputs must have a non-empty name");super(e,t),this.name=e,this.type=$.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT,this.connection=this.makeConnection(c5.NEXT_STATEMENT)}};$.ValueInput$$module$build$src$core$inputs$value_input=class extends hT{constructor(e,t){if(!e)throw Error("Value inputs must have a non-empty name");super(e,t),this.name=e,this.type=$.inputTypes$$module$build$src$core$inputs$input_types.VALUE,this.connection=this.makeConnection(c5.INPUT_VALUE)}},$.ValueInput$$module$build$src$core$inputs$value_input;var hS=class{constructor(e,t,i){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=i&&!e.getBlockById(i)?i:eD(),e.setBlockById(this.id,this),this.xy=new lt(0,0),this.isInFlyout=e.isFlyout,this.isInMutator=e.isMutator,this.RTL=e.RTL,t){if(this.type=t,!(i=w[t])||"object"!=typeof i)throw TypeError("Invalid block definition for type: "+t);Object.assign(this,i)}e.addTopBlock(this),e.addTypedBlock(this),new.target===hS&&this.doInit_()}doInit_(){let e=$.getGroup$$module$build$src$core$events$utils();e||$.setGroup$$module$build$src$core$events$utils(!0);let t=eG();try{"function"==typeof this.init&&($.setRecordUndo$$module$build$src$core$events$utils(!1),this.init(),$.setRecordUndo$$module$build$src$core$events$utils(t)),eY()&&eH(new(ej(rL.BLOCK_CREATE))(this))}finally{$.setGroup$$module$build$src$core$events$utils(e),$.setRecordUndo$$module$build$src$core$events$utils(t)}this.inputsInlineDefault=this.inputsInline,"function"==typeof this.onchange&&this.setOnChange(this.onchange)}dispose(e=!1){this.disposing=!0,this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.unplug(e),eY()&&eH(new(ej(rL.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),"function"==typeof this.destroy&&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(let 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,i;(null==(i=this.outputConnection)?0:i.isConnected())&&(t=this.outputConnection.targetConnection,this.outputConnection.disconnect()),t&&e&&(e=this.getOnlyValueConnection())&&e.isConnected()&&!e.targetBlock().isShadow()&&(null==(e=e.targetConnection)||e.disconnect(),this.workspace.connectionChecker.canConnect(e,t,!1)?t.connect(e):null==e||e.onFailedConnect(t))}getOnlyValueConnection(){let e=null;for(let t=0;t<this.inputList.length;t++){let i=this.inputList[t].connection;if(i&&i.type===c5.INPUT_VALUE&&i.targetConnection){if(e)return null;e=i}}return e}unplugFromStack(e){var t;let i=null;if((null==(t=this.previousConnection)?0:t.isConnected())&&(i=this.previousConnection.targetConnection,this.previousConnection.disconnect()),t=this.getNextBlock(),e&&t&&!t.isShadow()){let t,o;null==(e=null!=(o=null==(t=this.nextConnection)?void 0:t.targetConnection)?o:null)||e.disconnect(),i&&this.workspace.connectionChecker.canConnect(i,e,!1)&&i.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,i;i=this.inputList[t];t++)i.connection&&e.push(i.connection);return e}lastConnectionInStack(e){let t=this.nextConnection;for(;t;){let i=t.targetBlock();if(!i||e&&i.isShadow())return t;t=i.nextConnection}return null}bumpNeighbours(){}getParent(){return this.parentBlock_}getInputWithBlock(e){for(let t=0,i;i=this.inputList[t];t++)if(i.connection&&i.connection.targetBlock()===e)return i;return null}getSurroundParent(){let e=this,t;do if(t=e,!(e=e.getParent()))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 t=(e=t).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 i=0,o;o=this.inputList[i];i++)if(o.connection){var t=o.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(),i=!!t;if(i&&e&&t!==e)throw Error("Block connected to superior one that is not new parent.");if(!i&&e)throw Error("Block not connected to new parent.");if(i&&!e)throw Error("Cannot set parent to null while block is still connected to superior block.");this.parentBlock_?tm(this.parentBlock_.childBlocks_,this):this.workspace.removeTopBlock(this),(this.parentBlock_=e)?e.childBlocks_.push(this):this.workspace.addTopBlock(this)}}getDescendants(e){let t=[this],i=this.getChildren(e);for(let o,s=0;o=i[s];s++)t.push(...o.getDescendants(e));return t}isDeletable(){return this.deletable&&!this.isInFlyout&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()}isOwnDeletable(){return this.deletable}setDeletable(e){this.deletable=e}isMovable(){return this.movable&&!this.isInFlyout&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()}isOwnMovable(){return this.movable}setMovable(e){this.movable=e}isDuplicatable(){return!this.workspace.hasBlockLimits()||this.workspace.isCapacityAvailable(t_(this,!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.isReadOnly()}isOwnEditable(){return this.editable}setEditable(e){for(let t of(this.editable=e,this.getFields()))t.updateEditable()}isDisposed(){return this.disposed}isSimpleReporter(){if(!this.outputConnection)return!1;for(let e of this.inputList)if(e.connection||e.fieldRow.length>1)return!1;return!0}getMatchingConnection(e,t){let i=this.getConnections_(!0);if(e=e.getConnections_(!0),i.length!==e.length)throw Error("Connection lists did not match in length.");for(let o=0;o<e.length;o++)if(e[o]===t)return i[o];return null}setHelpUrl(e){this.helpUrl=e}setTooltip(e){this.tooltip=e}getTooltip(){return oS(this)}getColour(){return this.colour_}getStyleName(){return this.styleName_}getHue(){return this.hue}setColour(e){e=oz(e),this.hue=e.hue,this.colour_=e.hex}setStyle(e){this.styleName_=e}setOnChange(e){if(e&&"function"!=typeof e)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("string"!=typeof e)throw TypeError("Block.prototype.getField expects a string with the field name but received "+(void 0===e?"nothing":e+" of type "+typeof e)+" instead");for(let t of this.getFields())if(t.name===e)return t;return null}*getFields(){for(let e of this.inputList)for(let t of e.fieldRow)yield t}getVars(){let e=[];for(let t of this.getFields())t.referencesVariables()&&e.push(t.getValue());return e}getVarModels(){let e=[];for(let t of this.getFields())if(t.referencesVariables()){let i=this.workspace.getVariableById(t.getValue());i&&e.push(i)}return e}updateVarName(e){for(let t of this.getFields())t.referencesVariables()&&e.getId()===t.getValue()&&t.refreshVariableName()}renameVarById(e,t){for(let i of this.getFields())i.referencesVariables()&&e===i.getValue()&&i.setValue(t)}getFieldValue(e){return(e=this.getField(e))?e.getValue():null}setFieldValue(e,t){let i=this.getField(t);if(!i)throw Error('Field "'+t+'" not found.');i.setValue(e)}setPreviousStatement(e,t){if(e)void 0===t&&(t=null),this.previousConnection||(this.previousConnection=this.makeConnection_(c5.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)void 0===t&&(t=null),this.nextConnection||(this.nextConnection=this.makeConnection_(c5.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)void 0===t&&(t=null),this.outputConnection||(this.outputConnection=this.makeConnection_(c5.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&&(eH(new(ej(rL.BLOCK_CHANGE))(this,"inline",null,this.inputsInline,e)),this.inputsInline=e)}getInputsInline(){if(void 0!==this.inputsInline)return this.inputsInline;for(var e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof hm&&this.inputList[e]instanceof hm)return!1;for(e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof $.ValueInput$$module$build$src$core$inputs$value_input&&this.inputList[e]instanceof hm)return!0;for(e=0;e<this.inputList.length;e++)if(this.inputList[e]instanceof hf)return!0;return!1}setOutputShape(e){this.outputShape_=e}getOutputShape(){return this.outputShape_}isEnabled(){return 0===this.disabledReasons.size}setDisabledReason(e,t){e||this.workspace.options.disable||!this.hasDisabledReason(lJ)||t==lJ||this.setDisabledReason(!1,lJ),this.disabledReasons.has(t)!==e&&(e?this.disabledReasons.add(t):this.disabledReasons.delete(t),(e=new(ej(rL.BLOCK_CHANGE))(this,"disabled",null,!e,e)).setDisabledReason(t),eH(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&&(eH(new(ej(rL.BLOCK_CHANGE))(this,"collapsed",null,this.collapsed_,e)),this.collapsed_=e)}toString(e,t){t=this.toTokens(t);for(let e=2;e<t.length;e++)"("===t[e-2]&&")"===t[e]&&(t[e-2]=t[e-1],t.splice(e-1,2));let i="";return t=(t=t.reduce((e,t)=>(e=e+("("===i||")"===t?"":" ")+t,i=t[t.length-1],e),"")).trim()||"???",e&&t.length>e&&(t=t.substring(0,e-3)+"..."),t}toTokens(e="?"){let t=[];for(let o of this.inputList)if(o.name!=lz){for(let e of o.fieldRow)t.push(e.getText());if(o.connection){let s=o.connection.targetBlock();if(s){var i=o.connection;let n=i.getCheck();!n&&i.targetConnection&&(n=i.targetConnection.getCheck()),(i=!!n&&(n.includes("Boolean")||n.includes("Number")))&&t.push("("),t.push(...s.toTokens(e)),i&&t.push(")")}else t.push(e)}}return t}appendValueInput(e){return this.appendInput(new $.ValueInput$$module$build$src$core$inputs$value_input(e,this))}appendStatementInput(e){return this.statementInputCount++,this.appendInput(new hI(e,this))}appendDummyInput(e=""){return this.appendInput(new hm(e,this))}appendEndRowInput(e=""){return this.appendInput(new hf(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=ep(D.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 i=0;e["args"+i];){if(void 0===e["message"+i])throw Error(t+`args${i} must have a corresponding message (message${i}).`);i++}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),i=0;void 0!==e["message"+i];)this.interpolate(e["message"+i],e["args"+i]||[],e["implicitAlign"+i]||e["lastDummyAlign"+i],t),i++;if(void 0!==e.inputsInline&&($.disable$$module$build$src$core$events$utils(),this.setInputsInline(e.inputsInline),$.enable$$module$build$src$core$events$utils()),void 0!==e.output&&this.setOutput(!0,e.output),void 0!==e.outputShape&&this.setOutputShape(e.outputShape),void 0!==e.previousStatement&&this.setPreviousStatement(!0,e.previousStatement),void 0!==e.nextStatement&&this.setNextStatement(!0,e.nextStatement),void 0!==e.tooltip&&(i=oX(e.tooltip),this.setTooltip(i)),void 0!==e.enableContextMenu&&(this.contextMenu=!!e.enableContextMenu),void 0!==e.suppressPrefixSuffix&&(this.suppressPrefixSuffix=!!e.suppressPrefixSuffix),void 0!==e.helpUrl&&(i=oX(e.helpUrl),this.setHelpUrl(i)),"string"==typeof e.extensions&&(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]),void 0!==e.mutator&&sw(e.mutator,this,!0),Array.isArray(e=e.extensions))for(t=0;t<e.length;t++)sw(e[t],this,!1)}jsonInitColour(e,t){if("colour"in e)if(void 0===e.colour)console.warn(t+"Undefined colour value.");else{e=e.colour;try{this.setColour(e)}catch(i){console.warn(t+"Illegal colour value: ",e)}}}jsonInitStyle(e,t){e=e.style;try{this.setStyle(e)}catch(i){console.warn(t+"Style does not exist: ",e)}}mixin(e,t){if(void 0!==t&&"boolean"!=typeof t)throw Error("opt_disableCheck must be a boolean if provided");if(!t){for(let i in t=[],e)void 0!==this[i]&&t.push(i);if(t.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(t))}Object.assign(this,e)}interpolate(e,t,i,o){e=oY(e),this.validateTokens(e,t.length),t=this.interpolateArguments(e,t,i),i=[];for(let s=0,n;n=t[s];s++)if(this.isInputKeyword(n.type)){if(e=this.inputFromJson(n,o)){for(let t=0,o;o=i[t];t++)e.appendField(o[0],o[1]);i.length=0}}else(e=this.fieldFromJson(n))&&i.push([e,n.name])}validateTokens(e,t){let i=[],o=0;for(let s=0;s<e.length;s++){let n=e[s];if("number"==typeof n){if(n<1||n>t)throw Error('Block "'+this.type+'": Message index %'+n+" out of range.");if(i[n])throw Error('Block "'+this.type+'": Message index %'+n+" duplicated.");i[n]=!0,o++}}if(o!==t)throw Error('Block "'+this.type+'": Message does not reference all '+t+" arg(s).")}interpolateArguments(e,t,i){let o=[];for(let n=0;n<e.length;n++){var s=e[n];if("number"==typeof s&&(s=t[s-1]),"string"==typeof s){if("\n"===s)s={type:"input_end_row"},i&&(s.align=i);else if(!(s=this.stringToFieldJson(s)))continue}o.push(s)}return(e=o.length)&&!this.isInputKeyword(o[e-1].type)&&(e={type:"input_dummy"},i&&(e.align=i),o.push(e)),o}fieldFromJson(e){let t=$.fromJson$$module$build$src$core$field_registry(e);return!t&&e.alt?"string"==typeof e.alt?(e=this.stringToFieldJson(e.alt))?this.fieldFromJson(e):null:this.fieldFromJson(e.alt):t}inputFromJson(e,t){let i;var o={LEFT:$.Align$$module$build$src$core$inputs$align.LEFT,RIGHT:$.Align$$module$build$src$core$inputs$align.RIGHT,CENTRE:$.Align$$module$build$src$core$inputs$align.CENTRE,CENTER:$.Align$$module$build$src$core$inputs$align.CENTRE};switch(e.type){case"input_value":i=this.appendValueInput(e.name);break;case"input_statement":i=this.appendStatementInput(e.name);break;case"input_dummy":i=this.appendDummyInput(e.name);break;case"input_end_row":i=this.appendEndRowInput(e.name);break;default:i=this.appendInputFromRegistry(e.type,e.name)}return i?(e.check&&i.setCheck(e.check),e.align&&(void 0===(o=o[e.align.toUpperCase()])?console.warn(t+"Illegal align value: ",e.align):i.setAlign(o)),i):null}isInputKeyword(e){return"input_value"===e||"input_statement"===e||"input_dummy"===e||"input_end_row"===e||ed(D.INPUT,e)}stringToFieldJson(e){return(e=e.trim())?{type:"field_label",text:e}:null}moveInputBefore(e,t){if(e!==t){var i=-1,o=t?-1:this.inputList.length;for(let s=0,n;n=this.inputList[s];s++)if(n.name===e){if(i=s,-1!==o)break}else if(t&&n.name===t&&(o=s,-1!==i))break;if(-1===i)throw Error('Named input "'+e+'" not found.');if(-1===o)throw Error('Reference input "'+t+'" not found.');this.moveNumberedInputBefore(i,o)}}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.");let i=this.inputList[e];this.inputList.splice(e,1),e<t&&t--,this.inputList.splice(t,0,i)}removeInput(e,t){for(let t=0,i;i=this.inputList[t];t++)if(i.name===e)return i instanceof hI&&this.statementInputCount--,i.dispose(),this.inputList.splice(t,1),!0;if(t)return!1;throw Error("Input not found: "+e)}getInput(e){for(let t=0,i;i=this.inputList[t];t++)if(i.name===e)return i;return null}getInputTargetBlock(e){return(e=this.getInput(e))&&e.connection&&e.connection.targetBlock()}getCommentText(){let e,t;return null!=(t=null==(e=this.getIcon(ab.COMMENT))?void 0:e.getText())?t:null}setCommentText(e){var t,i;let o,s=null!=(o=null==(t=this.getIcon(ab.COMMENT))?void 0:t.getText())?o:null;if(s!==e){if(null!==e){if(!(t=this.getIcon(ab.COMMENT))){if(!(t=ep(D.ICON,ab.COMMENT.toString(),!1)))throw Error("No comment icon class is registered, so a comment cannot be set");if(!(sq(i=t=new t(this))&&i1(i)&&t3(i)&&"function"==typeof i.setText&&"function"==typeof i.getText&&"function"==typeof i.setBubbleSize&&"function"==typeof i.getBubbleSize&&"function"==typeof i.setBubbleLocation&&"function"==typeof i.getBubbleLocation&&i.getType()===ab.COMMENT))throw Error("The class registered as a comment icon does not conform to the ICommentIcon interface");t=this.addIcon(t)}$.disable$$module$build$src$core$events$utils(),t.setText(e),$.enable$$module$build$src$core$events$utils()}else this.removeIcon(ab.COMMENT);eH(new(ej(rL.BLOCK_CHANGE))(this,"comment",null,s,e))}}setWarningText(e,t){}setMutator(e){}addIcon(e){if(this.hasIcon(e.getType()))throw new ha(e);return this.icons.push(e),this.icons.sort((e,t)=>e.getWeight()-t.getWeight()),e}removeIcon(e){let t;return!!this.hasIcon(e)&&(null==(t=this.getIcon(e))||t.dispose(),this.icons=this.icons.filter(t=>!t.getType().equals(e)),!0)}hasIcon(e){return this.icons.some(t=>t.getType().equals(e))}getIcon(e){return e instanceof ab?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,i){if(this.parentBlock_)throw Error("Block has parent");let o=new(ej(rL.BLOCK_MOVE))(this);i&&o.setReason(i),this.xy.translate(e,t),o.recordNew(),eH(o)}makeConnection_(e){return new hl(this,e)}allInputsFilled(e){if(void 0===e&&(e=!0),!e&&this.isShadow())return!1;for(let i=0,o;o=this.inputList[i];i++)if(o.connection){var t=o.connection.targetBlock();if(!t||!t.allInputsFilled(e))return!1}return!(t=this.getNextBlock())||t.allInputsFilled(e)}toDevString(){let e=this.type?'"'+this.type+'" block':"Block";return this.id&&(e+=' (id="'+this.id+'")'),e}};hS.COLLAPSED_INPUT_NAME=lz,hS.COLLAPSED_FIELD_NAME=lj;var hR=null,hb=null,hC={};hC.connectionUiEffect=s1,hC.disconnectUiEffect=s2,hC.disconnectUiStop=s5,hC.disposeUiEffect=sQ;var hO=class{paste(e,t,i){let o;if(!t.isCapacityAvailable(e.typeCounts))return null;i&&(e.blockState.x=i.x,e.blockState.y=i.y),i=i||new lt(e.blockState.x||0,e.blockState.y||0),$.disable$$module$build$src$core$events$utils();try{o=iH(e.blockState,t),s6(o,i)}finally{$.enable$$module$build$src$core$events$utils()}if(!o)return o;eY()&&!o.isShadow()&&eH(new(ej(rL.BLOCK_CREATE))(o));let s=o;return t6().then(()=>$.getFocusManager$$module$build$src$core$focus_manager().focusNode(s)),o}};hO.TYPE="block",tq(hO.TYPE,new hO);var hA={};hA.BlockPaster=hO,hA.moveBlockToNotConflict=s6;var h$={};h$.bumpIntoBounds=s9,h$.bumpIntoBoundsHandler=s7,h$.bumpTopObjectsIntoBounds=nt;var hN=class{constructor(e){this.block=e,this.connectionPreviewer=this.connectionCandidate=this.startLoc=this.startChildConn=this.startParentConn=null,this.dragging=!1,this.dragOffset=new lt(0,0),this.originalEventGroup="",this.workspace=e.workspace}isMovable(){if(this.block.isShadow()){let e,t;return null!=(t=null==(e=this.block.getParent())?void 0:e.isMovable())&&t}return this.block.isOwnMovable()&&!this.block.isDeadOrDying()&&!this.workspace.isReadOnly()&&!this.block.isInFlyout}startDrag(e){if(this.block.isShadow())this.startDraggingShadow(e);else{var t;this.dragging=!0,this.fireDragStartEvent(),this.startLoc=this.block.getRelativeToSurfaceXY(),this.connectionCandidate=null,this.connectionPreviewer=new(eE(D.CONNECTION_PREVIEWER,this.workspace.options))(this.block),e6(),this.workspace.setResizesEnabled(!1),s5(),e=this.shouldHealStack(e),this.shouldDisconnect(e)&&this.disconnectBlock(e),this.block.setDragging(!0),null==(t=this.workspace.getLayerManager())||t.moveToDragLayer(this.block)}}shouldHealStack(e){return!!e&&(e.altKey||e.ctrlKey||e.metaKey)}startDraggingShadow(e){let 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=lt.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,i,o;if(this.startParentConn=null!=(o=null==(t=this.block.outputConnection)?void 0:t.targetConnection)?o:null==(i=this.block.previousConnection)?void 0:i.targetConnection,e){let e;this.startChildConn=null==(e=this.block.nextConnection)?void 0:e.targetConnection}this.block.unplug(e),s2(this.block)}fireDragStartEvent(){eH(new(ej(rL.BLOCK_DRAG))(this.block,!0,this.block.getDescendants(!1)))}fireDragEndEvent(){eH(new(ej(rL.BLOCK_DRAG))(this.block,!1,this.block.getDescendants(!1)))}fireMoveEvent(){if(!this.block.isDeadOrDying()){var e=new(ej(rL.BLOCK_MOVE))(this.block);e.setReason(["drag"]),e.oldCoordinate=this.startLoc,e.recordNew(),eH(e)}}drag(e){if(this.block.isShadow()){let t;null==(t=this.block.getParent())||t.drag(lt.sum(e,this.dragOffset))}else this.block.moveDuringDrag(e),this.updateConnectionPreview(this.block,lt.difference(e,this.startLoc))}updateConnectionPreview(e,t){var i=this.connectionCandidate;let o=this.getConnectionCandidate(e,t);if(o){this.connectionCandidate=t=i&&this.currCandidateIsBetter(i,t,o)?i:o;var s,n,{local:r,neighbour:l}=t;if(t=r.type===c5.OUTPUT_VALUE||r.type===c5.PREVIOUS_STATEMENT,i=l.isConnected()&&!(null==(s=l.targetBlock())?0:s.isInsertionMarker()),t&&i&&!this.orphanCanConnectAtEnd(e,l.targetBlock(),r.type)){let e;null==(e=this.connectionPreviewer)||e.previewReplacement(r,l,l.targetBlock())}else null==(n=this.connectionPreviewer)||n.previewConnection(r,l)}else{let e;null==(e=this.connectionPreviewer)||e.hidePreview(),this.connectionCandidate=null}}orphanCanConnectAtEnd(e,t,i){return!!hl.getConnectionForOrphanedConnection(e,i===c5.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}currCandidateIsBetter(e,t,i){let{local:o,neighbour:s}=e;e=new lt(o.x,o.y);let n=new lt(s.x,s.y);return t=lt.distance(lt.sum(e,t),n),i.distance>t-$.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(e,t){e=this.getLocalConnections(e);let i=this.getSearchRadius(),o=null;for(let s of e){let{connection:e,radius:n}=s.closest(i,t);e&&(o={local:s,neighbour:e,distance:n},i=n)}return o}getSearchRadius(){return this.connectionCandidate?$.config$$module$build$src$core$config.connectingSnapRadius:$.config$$module$build$src$core$config.snapRadius}getLocalConnections(e){let t=e.getConnections_(!1),i=e.lastConnectionInStack(!0);return i&&i!==e.nextConnection&&t.push(i),t}endDrag(e){if(this.block.isShadow()){let t;null==(t=this.block.getParent())||t.endDrag(e)}else{var t;if(this.originalEventGroup=$.getGroup$$module$build$src$core$events$utils(),this.fireDragEndEvent(),this.fireMoveEvent(),e4(),s5(),null==(t=this.connectionPreviewer)||t.hidePreview(),!this.block.isDeadOrDying()&&this.dragging){let e;null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.block,50),this.block.setDragging(!1)}this.connectionCandidate?(this.applyConnections(this.connectionCandidate),this.disposeStep()):this.block.queueRender().then(()=>this.disposeStep())}}disposeStep(){let e,t=$.getGroup$$module$build$src$core$events$utils();$.setGroup$$module$build$src$core$events$utils(this.originalEventGroup),this.block.snapToGrid(),null==(e=this.connectionPreviewer)||e.dispose(),this.workspace.setResizesEnabled(!0),$.setGroup$$module$build$src$core$events$utils(t)}applyConnections(e){let{local:t,neighbour:i}=e;t.connect(i);let o=t.isSuperior()?i:t,s=this.block.getRootBlock();t6().then(()=>{s1(o.getSourceBlock()),setTimeout(()=>{s.bringToFront()},0)})}revertDrag(){if(this.block.isShadow()){let e;null==(e=this.block.getParent())||e.revertDrag()}else{var e,t;if(null==(e=this.connectionPreviewer)||e.hidePreview(),this.connectionCandidate=null,null==(t=this.startChildConn)||t.connect(this.block.nextConnection),this.startParentConn)switch(this.startParentConn.type){case c5.INPUT_VALUE:this.startParentConn.connect(this.block.outputConnection);break;case c5.NEXT_STATEMENT:this.startParentConn.connect(this.block.previousConnection)}else{let e;this.block.moveTo(this.startLoc,["drag"]),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.block,50),s9(this.workspace,this.workspace.getMetricsManager().getScrollMetrics(!0),this.block)}this.startParentConn=this.startChildConn=null,this.block.setDragging(!1),this.dragging=!1}}},hL=class extends he{constructor(e,t,i,o){super(t,i,o),this.text=e,this.workspace=t,this.anchor=i,this.ownerRect=o,this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize(),eq(this.svgRoot,"blocklyTextBubble")}getText(){return this.text}setText(e){this.text=e,e2(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 eZ(li.G,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",transform:`translate(0,${he.BORDER_WIDTH})`,style:`direction: ${this.workspace.RTL?"rtl":"ltr"}`},e)}createTextFragments(e,t){let i=1;return t.split("\n").map(t=>{let o=eZ(li.TEXT,{y:`${i}em`,x:he.BORDER_WIDTH},e);return t=document.createTextNode(t),o.appendChild(t),i+=1,o})}rightAlignTextFragments(e,t){for(let i of t)i.setAttribute("text-anchor","start"),i.setAttribute("x",`${e+he.BORDER_WIDTH}`)}updateBubbleSize(){let e=this.paragraph.getBBox();this.setSize(new ls(e.width+2*he.BORDER_WIDTH,e.height+2*he.BORDER_WIDTH),!0)}},hy=class extends hi{constructor(e){super(e),this.sourceBlock=e,this.textMap=new Map,this.textBubble=null}getType(){return hy.TYPE}initView(e){this.svgRoot||(super.initView(e),eZ(li.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),eZ(li.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),eZ(li.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot),eq(this.svgRoot,"blocklyWarningIcon"))}dispose(){let e;super.dispose(),null==(e=this.textBubble)||e.dispose()}getWeight(){return hy.WEIGHT}getSize(){return new ls(17,17)}applyColour(){let e;super.applyColour(),null==(e=this.textBubble)||e.setColour(this.sourceBlock.getColour())}updateCollapsed(){}isShownWhenCollapsed(){return!0}onLocationChange(e){let t;super.onLocationChange(e),null==(t=this.textBubble)||t.setAnchorLocation(this.getAnchorLocation())}addMessage(e,t){let i;return this.textMap.get(t)===e||(e?this.textMap.set(t,e):this.textMap.delete(t),null==(i=this.textBubble)||i.setText(this.getText())),this}getText(){return[...this.textMap.values()].join("\n")}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.textBubble}setBubbleVisible(e){let t=this;return(0,rf.asyncExecutePromiseGeneratorFunction)(function*(){if(t.bubbleIsVisible()!==e){if(yield t6(),e)t.textBubble=new hL(t.getText(),t.sourceBlock.workspace,t.getAnchorLocation(),t.getBubbleOwnerRect()),t.applyColour();else{let e;null==(e=t.textBubble)||e.dispose(),t.textBubble=null}eH(new(ej(rL.BUBBLE_OPEN))(t.sourceBlock,e,"warning"))}})}getBubble(){return this.textBubble}getAnchorLocation(){return lt.sum(this.workspaceLocation,new lt(8.5,8.5))}getBubbleOwnerRect(){let e=this.sourceBlock.getSvgRoot().getBBox();return new lo(e.y,e.y+e.height,e.x,e.x+e.width)}};hy.TYPE=ab.WARNING,hy.WEIGHT=2;var hD=class extends hS{constructor(e,t,i){if(super(e,t,i),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 lt(0,0),this.dragStrategy=new hN(this),!e.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=e,this.svgGroup=eZ(li.G,{}),t&&eq(this.svgGroup,t),this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup,this.style),(e=this.pathObject.svgPath).tooltip=this,oC(e),this.svgGroup.setAttribute("data-id",this.id),e.id=ey(),this.doInit_()}initSvg(){if(!this.initialized){for(var e of this.inputList)e.init();for(let e of this.getIcons())e.initView(this.createIconPointerDownListener(e)),e.updateEditable();this.applyColour(),this.pathObject.updateMovable(this.isMovable()||this.isInFlyout),(e=this.getSvgRoot())&&eb(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(){this.addSelect(),th(this)}unselect(){this.removeSelect(),th(null)}setParent(e){var t=this.parentBlock_;if(e!==t){e6(),super.setParent(e),e4();var i=this.getSvgRoot();if(!this.workspace.isClearing&&i){var o,s=this.getRelativeToSurfaceXY(),n=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode(),r=this.getSvgRoot().contains(null!=(o=null==n?void 0:n.getFocusableElement())?o:null);e?(e.getSvgRoot().appendChild(i),r&&n&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(n)):t&&((t=null==(e=this.workspace.getCanvas().querySelector(".blocklyDragging"))?void 0:e.parentElement)===(o=this.workspace.getCanvas())?o.insertBefore(i,e):(o.appendChild(i),r&&n&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(n)),this.translate(s.x,s.y)),this.applyColour()}}}getRelativeToSurfaceXY(){let e=this.workspace.getLayerManager();if(!e)throw Error("Cannot calculate position because the workspace has not been appended");let t=0,i=0,o=this.getSvgRoot();if(o)do{let e=tL(o);t+=e.x,i+=e.y,o=o.parentNode}while(o&&!e.hasLayer(o))return new lt(t,i)}moveBy(e,t,i){if(this.parentBlock_)throw Error("Block has parent");let o=eY(),s=null;o&&(s=new(ej(rL.BLOCK_MOVE))(this),i&&s.setReason(i)),e=new lt(e,t),t=this.getRelativeToSurfaceXY(),e=lt.sum(t,e),this.translate(e.x,e.y),this.updateComponentLocations(e),o&&s&&(s.recordNew(),eH(s)),this.workspace.resizeContents()}translate(e,t){this.translation=`translate(${e}, ${t})`,this.relativeCoords=new lt(e,t),this.getSvgRoot().setAttribute("transform",this.getTranslation())}getTranslation(){return this.translation}moveTo(e,t){let i=this.getRelativeToSurfaceXY();this.moveBy(e.x-i.x,e.y-i.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(null!=e&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();(e=e.alignXY(t))!==t&&this.moveTo(e,["snap"])}}}getBoundingRectangle(){return this.getBoundingRectangleWithDimensions(this.getHeightWidth())}getBoundingRectangleWithoutChildren(){return this.getBoundingRectangleWithDimensions({height:this.height,width:this.childlessWidth})}getBoundingRectangleWithDimensions(e){let t,i,o=this.getRelativeToSurfaceXY();return this.RTL?(t=o.x-e.width,i=o.x):(t=o.x,i=o.x+e.width),new lo(o.y,o.y+e.height,t,i)}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())}childHasWarning(){for(let e of this.getChildren(!1))if(e.getIcon(hy.TYPE)||e.childHasWarning())return!0;return!1}updateCollapsed(){var e=this.isCollapsed();for(let t=0,i;i=this.inputList[t];t++)i.name!==lz&&i.setVisible(!e);for(var t of this.getIcons())t.updateCollapsed();e?(eq(this.svgGroup,"blocklyCollapsed"),this.childHasWarning()&&this.setWarningText($.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,hD.COLLAPSED_WARNING_ID),e=this.toString(30),(t=this.getField(lj))?t.setValue(e):(this.getInput(lz)||this.appendDummyInput(lz)).appendField(new hh(e),lj)):(this.updateDisabled(),this.removeInput(lz),e0(this.svgGroup,"blocklyCollapsed"),this.setWarningText(null,hD.COLLAPSED_WARNING_ID))}onMouseDown(e){if(!this.workspace.isReadOnly()){var t=this.workspace.getGesture(e);t&&t.handleBlockStart(e,this)}}showHelp(){let e="function"==typeof this.helpUrl?this.helpUrl():this.helpUrl;e&&window.open(e)}generateContextMenu(e){return this.workspace.isReadOnly()||!this.contextMenu?null:(e=cN.registry.getContextMenuOptions({block:this,focusedNode:this},e),this.customContextMenu&&this.customContextMenu(e),e)}calculateContextMenuLocation(e){let t,i;if(e instanceof PointerEvent)return new lt(e.clientX,e.clientY);e=tM(this.workspace,this.getRelativeToSurfaceXY());let o=null==(t=this.inputList.filter(e=>e.isVisible()).flatMap(e=>e.fieldRow).find(e=>e.isVisible()))||null==(i=t.getSvgRoot())?void 0:i.getBoundingClientRect();return new lt(this.RTL?e.x-5:e.x+5,(o&&o.height?o.y+o.height:e.y+this.height)+5)}showContextMenu(e){let t=this.generateContextMenu(e),i=this.calculateContextMenuLocation(e);t&&t.length&&(o9(e,t,this.RTL,this.workspace,i),o8(this))}updateComponentLocations(e){for(let t of(this.dragging||this.updateConnectionLocations(e),this.updateIconLocations(e),this.updateFieldLocations(e),this.getChildren(!1)))t.updateComponentLocations(lt.sum(e,t.relativeCoords))}updateConnectionLocations(e){for(let t of this.getConnections_(!1))t.moveToOffset(e)}updateIconLocations(e){for(let t of this.getIcons())t.onLocationChange(e)}updateFieldLocations(e){for(let t of this.inputList)for(let i of t.fieldRow)i.onLocationChange(e)}addClass(e){eq(this.svgGroup,e)}removeClass(e){e0(this.svgGroup,e)}setDragging(e){(this.dragging=e)?(this.translation="",rj.push(...this.getConnections_(!0)),this.addClass("blocklyDragging")):(rj.length=0,this.removeClass("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?e0(this.svgGroup,"blocklyNotEditable"):eq(this.svgGroup,"blocklyNotEditable"),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){var i,o;this.disposing=!0,oL(),so();let s=$.getFocusManager$$module$build$src$core$focus_manager();if(this.getSvgRoot().contains(null!=(o=null==(i=s.getFocusedNode())?void 0:i.getFocusableElement())?o:null)){if(!(i=this.getParent())){let e;if(o=null!=(e=this.outputConnection)?e:this.previousConnection){let e;i=null==(e=o.closest(0,new lt(0,0)).connection)?void 0:e.getSourceBlock()}}i?s.focusNode(i):setTimeout(()=>s.focusTree(this.workspace),0)}t&&(this.unplug(e),sQ(this)),super.dispose(!!e),e2(this.svgGroup)}disposeInternal(){this.disposing=!0,super.disposeInternal(),$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()===this&&this.workspace.cancelCurrentGesture(),[...this.warningTextDb.values()].forEach(e=>clearTimeout(e)),this.warningTextDb.clear(),this.getIcons().forEach(e=>e.dispose())}checkAndDelete(){this.workspace.isFlyout||($.setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),$.setGroup$$module$build$src$core$events$utils(!1))}toCopyData(){return this.isInsertionMarker_?null:{paster:hO.TYPE,blockState:ik(this,{addCoordinates:!0,addNextBlocks:!1}),typeCounts:t_(this,!0)}}applyColour(){var e,t;for(null==(t=(e=this.pathObject).applyColour)||t.call(e,this),e=this.getIcons(),t=0;t<e.length;t++)e[t].applyColour();for(let e of this.getFields())e.applyColour()}updateDisabled(){let e=!this.isEnabled()||this.getInheritedDisabled();if(this.visuallyDisabled===e){let e;null==(e=this.getNextBlock())||e.updateDisabled()}else for(let t of(this.applyColour(),this.visuallyDisabled=e,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 i of this.warningTextDb.values())clearTimeout(i);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),i=this.getIcon(hy.TYPE),e){let o=this.getSurroundParent(),s=null;for(;o;)o.isCollapsed()&&(s=o),o=o.getSurroundParent();s&&s.setWarningText($.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,hD.COLLAPSED_WARNING_ID),i?i.addMessage(e,t):this.addIcon(new hy(this).addMessage(e,t))}else i&&(t?(i.addMessage("",t),i.getText()||this.removeIcon(hy.TYPE)):this.removeIcon(hy.TYPE))}setMutator(e){this.removeIcon($.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE),e&&this.addIcon(e)}addIcon(e){return super.addIcon(e),e instanceof $.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){let t=super.removeIcon(e);return e.equals($.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE)&&(this.mutator=null),this.queueRender(),t}setDisabledReason(e,t){let i=this.isEnabled();super.setDisabledReason(e,t),this.isEnabled()===i||this.getInheritedDisabled()||this.updateDisabled()}setDeletable(e){super.setDeletable(e),e?e0(this.svgGroup,"blocklyNotDeletable"):eq(this.svgGroup,"blocklyNotDeletable")}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){let t,i;super.setColour(e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),null==(i=(t=this.pathObject).setStyle)||i.call(t,e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()}setStyle(e){let t=this.workspace.getRenderer().getConstants().getBlockStyle(e);if(this.styleName_&&e0(this.svgGroup,this.styleName_),t){let i,o;this.hat=t.hat,null==(o=(i=this.pathObject).setStyle)||o.call(i,t),this.colour_=t.colourPrimary,this.style=t,this.applyColour(),eq(this.svgGroup,e),this.styleName_=e}else throw Error("Invalid style name: "+e)}getStyle(){return this.style}bringToFront(e=!1){let t=$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode(),i=this;if(!i.isDeadOrDying()){do{let t=i.getSvgRoot(),o=t.parentNode,s=o.childNodes;if(s[s.length-1]!==t&&o.appendChild(t),e)break;i=i.getParent()}while(i)t&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(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 i=this.inputList[t].connection;i&&(i.setTracking(e),(i=i.targetBlock())&&i.setConnectionTracking(e))}}getConnections_(e){let 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 e=0,i;i=this.inputList[e];e++)i.connection&&t.push(i.connection);return t}lastConnectionInStack(e){return super.lastConnectionInStack(e)}getMatchingConnection(e,t){return super.getMatchingConnection(e,t)}makeConnection_(e){return new h_(this,e)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){let e=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||e.isInFlyout))for(let t of this.getConnections_(!1)){if(t.isSuperior()){let e;null==(e=t.targetBlock())||e.bumpNeighbours()}for(let i of t.neighbours($.config$$module$build$src$core$config.snapRadius))i.getSourceBlock().getRootBlock()!==e&&(t.isConnected()&&i.isConnected()||(t.isSuperior()?i.bumpAwayFrom(t,!1):t.bumpAwayFrom(i,!0)))}}scheduleSnapAndBump(){this.snapToGrid(),this.bumpNeighbours()}positionNearConnection(e,t,i){if(e.type===c5.NEXT_STATEMENT||e.type===c5.INPUT_VALUE){let o=t.x;t=t.y,o+=i.x-e.getOffsetInBlock().x,t+=i.y-e.getOffsetInBlock().y,this.moveBy(o,t)}}getChildren(e){return super.getChildren(e)}queueRender(){return t5(this)}render(){this.queueRender(),t4()}renderEfficiently(){e6(),this.isCollapsed()&&this.updateCollapsed(),this.isEnabled()||this.updateDisabled(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),e4()}tightenChildrenEfficiently(){for(let e of this.inputList){let t=e.connection;t&&t.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}getHeightWidth(){let e=this.height,t=this.width;var i=this.getNextBlock();if(i){i=i.getHeightWidth();let o=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;e+=i.height-o,t=Math.max(t,i.width)}return{height:e,width:t}}fadeForReplacement(e){this.pathObject.updateReplacementFade(e)}highlightShapeForInput(e,t){this.pathObject.updateShapeForInputHighlight(e,t)}getDragStrategy(){return this.dragStrategy}setDragStrategy(e){this.dragStrategy=e}isCopyable(){return this.isOwnDeletable()&&this.isOwnMovable()}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(){let e=Object.assign({},{kind:"BLOCK"},ik(this)),t=new Set(["id","height","width","pinned","enabled"]),i=function(e){for(let o in e)t.has(o)?delete e[o]:"object"==typeof e[o]&&i(e[o])};return i(e),[e]}jsonInit(e){super.jsonInit(e),e.classes&&this.addClass(Array.isArray(e.classes)?e.classes.join(" "):e.classes)}getFocusableElement(){return this.pathObject.svgPath}getFocusableTree(){return this.workspace}onNodeFocus(){this.select()}onNodeBlur(){this.unselect()}canBeFocused(){return!0}};hD.INLINE=-1,hD.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var hk=class{onDragEnter(e){}onDragOver(e){}onDragExit(e){}onDrop(e){}getClientRect(){return null}shouldPreventMove(e){return!1}},hw=class extends hk{constructor(){super(),this.wouldDelete_=!1}wouldDelete(e){return e instanceof hD?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e)):this.updateWouldDelete_(ni(e)&&e.isDeletable()),this.wouldDelete_}updateWouldDelete_(e){this.wouldDelete_=e}},hM=class{constructor(e,t){this.element=e,this.type=t}getElement(){return this.element}getType(){return this.type}},hv=class{constructor(e){this.workspace_=e}getDimensionsPx_(e){let t=0,i=0;return e&&(t=e.getWidth(),i=e.getHeight()),new ls(t,i)}getFlyoutMetrics(e){return{width:(e=this.getDimensionsPx_(this.workspace_.getFlyout(e))).width,height:e.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){let e=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:e.width,height:e.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){var e;let t=0,i=0,o=this.getToolboxMetrics(),s=this.getFlyoutMetrics(),n=!!this.workspace_.getToolbox(),r=!(null==(e=this.workspace_.getFlyout())?0:e.autoClose),l=(e=n?o.position:s.position)===lS.TOP;return e===lS.LEFT&&(n&&(t+=o.width),r&&(t+=s.width)),l&&(n&&(i+=o.height),r&&(i+=s.height)),{top:i,left:t}}getViewMetrics(e){var t;e=e?this.workspace_.scale:1;let i=this.getSvgMetrics(),o=this.getToolboxMetrics(),s=this.getFlyoutMetrics(),n=!!this.workspace_.getToolbox(),r=!(null==(t=this.workspace_.getFlyout())?0:t.autoClose),l=(t=n?o.position:s.position)===lS.LEFT||t===lS.RIGHT;return(t===lS.TOP||t===lS.BOTTOM)&&(n&&(i.height-=o.height),r&&(i.height-=s.height)),l&&(n&&(i.width-=o.width),r&&(i.width-=s.width)),{height:i.height/e,width:i.width/e,top:-this.workspace_.scrollY/e,left:-this.workspace_.scrollX/e}}getContentMetrics(e){e=e?1:this.workspace_.scale;let 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{};let t=this.workspace_.isMovableHorizontally(),i=this.workspace_.isMovableVertically();e=e||this.getViewMetrics(!1);let o={};return i||(o.top=e.top,o.bottom=e.top+e.height),t||(o.left=e.left,o.right=e.left+e.width),o}getPaddedContent_(e,t){let i=t.top+t.height,o=t.left+t.width,s=e.width;e=e.height;let n=s/2,r=e/2;return{top:Math.min(t.top-r,i-e),bottom:Math.max(i+r,t.top+e),left:Math.min(t.left-n,o-s),right:Math.max(o+n,t.left+s)}}getScrollMetrics(e,t,i){e=e?this.workspace_.scale:1,t=t||this.getViewMetrics(!1);var o=i||this.getContentMetrics();i=this.getComputedFixedEdges_(t),t=this.getPaddedContent_(t,o),o=void 0!==i.top?i.top:t.top;let s=void 0!==i.left?i.left:t.left;return{top:o/e,left:s/e,width:((void 0!==i.right?i.right:t.right)-s)/e,height:((void 0!==i.bottom?i.bottom:t.bottom)-o)/e}}getUiMetrics(){return{viewMetrics:this.getViewMetrics(),absoluteMetrics:this.getAbsoluteMetrics(),toolboxMetrics:this.getToolboxMetrics()}}getMetrics(){let e=this.getToolboxMetrics(),t=this.getFlyoutMetrics(!0),i=this.getSvgMetrics(),o=this.getAbsoluteMetrics(),s=this.getViewMetrics(),n=this.getContentMetrics(),r=this.getScrollMetrics(!1,s,n);return{contentHeight:n.height,contentWidth:n.width,contentTop:n.top,contentLeft:n.left,scrollHeight:r.height,scrollWidth:r.width,scrollTop:r.top,scrollLeft:r.left,viewHeight:s.height,viewWidth:s.width,viewTop:s.top,viewLeft:s.left,absoluteTop:o.top,absoluteLeft:o.left,svgHeight:i.height,svgWidth:i.width,toolboxWidth:e.width,toolboxHeight:e.height,toolboxPosition:e.position,flyoutWidth:t.width,flyoutHeight:t.height}}};ea(D.METRICS_MANAGER,y,hv);var hP=class extends hv{constructor(e,t){super(e),this.flyout_=t}getBoundingBox(){let e;try{e=this.workspace_.getCanvas().getBBox()}catch(t){e={height:0,y:0,width:0,x:0}}return e}getContentMetrics(e){let 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,i){return t=i||this.getContentMetrics(),i=this.flyout_.MARGIN*this.workspace_.scale,e=e?this.workspace_.scale:1,{height:(t.height+2*i)/e,width:(t.width+t.left+i)/e,top:0,left:0}}},hB=class{constructor(e,t,i,o){let s;this.workspace=e,this.targetWorkspace=t,this.isFlyoutLabel=o,this.height=this.width=0,this.cursorSvg=this.svgText=null,this.text=i.text,this.position=new lt(0,0),this.callbackKey=i.callbackKey||i.callbackkey,this.cssClass=i["web-class"]||null,this.info=i,e=this.isFlyoutLabel?"blocklyFlyoutLabel":"blocklyFlyoutButton",this.cssClass&&(e+=" "+this.cssClass),this.id=ey(),this.svgGroup=eZ(li.G,{id:this.id,class:e},this.workspace.getCanvas()),this.isFlyoutLabel||(s=eZ(li.RECT,{class:"blocklyFlyoutButtonShadow",rx:hB.BORDER_RADIUS,ry:hB.BORDER_RADIUS,x:1,y:1},this.svgGroup)),e=eZ(li.RECT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:hB.BORDER_RADIUS,ry:hB.BORDER_RADIUS},this.svgGroup),t=eZ(li.TEXT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup),i=oX(this.text),this.workspace.RTL&&(i+=""),t.textContent=i,this.isFlyoutLabel&&(this.svgText=t,this.workspace.getThemeManager().subscribe(this.svgText,"flyoutForegroundColour","fill")),o=tb(t,"fontSize");let n=tb(t,"fontWeight"),r=tb(t,"fontFamily");if(this.width=e9(t,o,n,r),i=e7(i,o,n,r),this.height=this.height||i.height,!this.isFlyoutLabel){let e,t;this.width+=2*hB.TEXT_MARGIN_X,this.height+=2*hB.TEXT_MARGIN_Y,null==(e=s)||e.setAttribute("width",String(this.width)),null==(t=s)||t.setAttribute("height",String(this.height))}e.setAttribute("width",String(this.width)),e.setAttribute("height",String(this.height)),t.setAttribute("x",String(this.width/2)),t.setAttribute("y",String(this.height/2-i.height/2+i.baseline)),this.updateTransform(),this.onMouseDownWrapper=eb(this.svgGroup,"pointerdown",this,this.onMouseDown),this.onMouseUpWrapper=eb(this.svgGroup,"pointerup",this,this.onMouseUp)}createDom(){return 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()}moveBy(e,t,i){this.moveTo(this.position.x+e,this.position.y+t)}isLabel(){return this.isFlyoutLabel}getPosition(){return this.position}getBoundingRectangle(){return new lo(this.position.y,this.position.y+this.height,this.position.x,this.position.x+this.width)}getButtonText(){return this.text}getTargetWorkspace(){return this.targetWorkspace}getWorkspace(){return this.workspace}dispose(){eO(this.onMouseDownWrapper),eO(this.onMouseUpWrapper),this.svgGroup&&e2(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}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)}onMouseDown(e){let t=this.targetWorkspace.getGesture(e),i=this.targetWorkspace.getFlyout();t&&i&&t.handleFlyoutStart(e,i)}getSvgRoot(){return this.svgGroup}getFocusableElement(){return this.svgGroup}getFocusableTree(){return this.workspace}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}};hB.TEXT_MARGIN_X=5,hB.TEXT_MARGIN_Y=2,hB.BORDER_RADIUS=4,tf("\n.blocklyFlyoutButton {\n fill: #888;\n cursor: default;\n}\n\n.blocklyFlyoutButtonShadow {\n fill: #666;\n}\n\n.blocklyFlyoutButton:hover {\n fill: #aaa;\n}\n\n.blocklyFlyoutLabel {\n cursor: default;\n}\n\n.blocklyFlyoutLabelBackground {\n opacity: 0;\n}\n");var hx=class{getFirstChild(e){return null}getParent(e){return e.getWorkspace()}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof hB}},hF=class{constructor(e,t){this.policy=e,this.flyout=t}getFirstChild(e){return null}getParent(e){return this.policy.getParent(e)}getNextSibling(e){let t=this.flyout.getContents();if(!t)return null;let i=t.findIndex(t=>t.getElement()===e);return -1===i?null:(++i>=t.length&&(i=0),t[i].getElement())}getPreviousSibling(e){let t=this.flyout.getContents();if(!t)return null;let i=t.findIndex(t=>t.getElement()===e);return -1===i?null:(--i<0&&(i=t.length-1),t[i].getElement())}isNavigable(e){return this.policy.isNavigable(e)}isApplicable(e){return this.policy.isApplicable(e)}},hG=class{constructor(e,t){this.gap=e,this.axis=t,this.y=this.x=0}getBoundingRectangle(){switch(this.axis){case"x":return new lo(this.y,this.y,this.x,this.x+this.gap);case"y":return new lo(this.y,this.y+this.gap,this.x,this.x)}}moveBy(e,t,i){this.x+=e,this.y+=t}isNavigable(){return!1}getFocusableElement(){throw Error("Cannot be focused")}getFocusableTree(){throw Error("Cannot be focused")}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!1}},hH=class{getFirstChild(e){return null}getParent(e){return null}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return!1}isApplicable(e){return e instanceof hG}},hU=class{getFirstChild(e){return no(e,!0)[0]}getParent(e){var t;if(null==(t=e.previousConnection)?0:t.targetBlock()){if(t=e.getSurroundParent())return t}else{let t;if(null==(t=e.outputConnection)?0:t.targetBlock())return e.outputConnection.targetBlock()}return e.workspace}getNextSibling(e){let t,i;if(null==(t=e.nextConnection)?0:t.targetBlock()){let t;return null==(t=e.nextConnection)?void 0:t.targetBlock()}return(null==(i=e.outputConnection)?0:i.targetBlock())?nn(e,1):e.getSurroundParent()?nn(e.getTopStackBlock(),1):this.getParent(e)instanceof uH?ns(e,1):null}getPreviousSibling(e){let t,i;if(null==(t=e.previousConnection)?0:t.targetBlock()){let t;return null==(t=e.previousConnection)?void 0:t.targetBlock()}return(null==(i=e.outputConnection)?0:i.targetBlock())?nn(e,-1):this.getParent(e)instanceof uH?ns(e,-1):null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof hD}},hW={};hW.BlockNavigationPolicy=hU,hW.navigateBlock=nn,hW.navigateStacks=ns;var hV=class{getFirstChild(e){return null}getParent(e){return e.getParentComment()}getNextSibling(e){let t=e.getParentComment().view.getCommentBarButtons();return(e=t.indexOf(e))>=0&&e+1<t.length?t[e+1]:null}getPreviousSibling(e){let t=e.getParentComment().view.getCommentBarButtons();return(e=t.indexOf(e))>0?t[e-1]:null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof cM}},hK=class{getFirstChild(e){return e.getParentInput()?e.targetConnection:null}getParent(e){return e.getSourceBlock()}getNextSibling(e){if(e.getParentInput())return nn(e,1);if(e.type===c5.NEXT_STATEMENT){let i=e.targetConnection;var t=e.getSourceBlock();if(!i&&t.getRootBlock().lastConnectionInStack(!1)===e){let i;return(t=(e=t.workspace.getTopBlocks(!0)).indexOf(t.getRootBlock())+1)>=e.length&&(t=0),t=e[t],null!=(i=this.getParentConnection(t))?i:t}return i}return e.getSourceBlock()}getPreviousSibling(e){if(e.getParentInput())return nn(e,-1);if(e.type===c5.PREVIOUS_STATEMENT||e.type===c5.OUTPUT_VALUE){let i=e.targetConnection&&!e.targetConnection.getParentInput()?e.targetConnection:null;var t=e.getSourceBlock();if(!i&&this.getParentConnection(t.getRootBlock())===e){let i;return(t=(e=t.workspace.getTopBlocks(!0)).indexOf(t.getRootBlock())-1)<0&&(t=e.length-1),null!=(i=(t=e[t]).lastConnectionInStack(!1))?i:t}return i}return e.type===c5.NEXT_STATEMENT?e.getSourceBlock():null}getParentConnection(e){let t;return!e.outputConnection||(null==(t=e.previousConnection)?0:t.isConnected())?e.previousConnection:e.outputConnection}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof h_}},hY=class{getFirstChild(e){return null}getParent(e){return e.getSourceBlock()}getNextSibling(e){return nn(e,1)}getPreviousSibling(e){return nn(e,-1)}isNavigable(e){let t;return e.canBeFocused()&&e.isVisible()&&(e.isClickable()||e.isCurrentlyEditable())&&!((null==(t=e.getSourceBlock())?0:t.isSimpleReporter())&&e.isFullBlockField())&&e.getParentInput().isVisible()}isApplicable(e){return e instanceof cd}},hX=class{getFirstChild(e){if(e instanceof $.MutatorIcon$$module$build$src$core$icons$mutator_icon&&e.bubbleIsVisible()&&$.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()===e){let t,i;return null!=(i=null==(t=e.getBubble())?void 0:t.getWorkspace())?i:null}return null}getParent(e){return e.getSourceBlock()}getNextSibling(e){return nn(e,1)}getPreviousSibling(e){return nn(e,-1)}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof hi}},hz=class{getFirstChild(e){return e.view.getCommentBarButtons()[0]}getParent(e){return e.workspace}getNextSibling(e){return ns(e,1)}getPreviousSibling(e){return ns(e,-1)}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof cW}},hj=class{getFirstChild(e){return(e=e.getTopBlocks(!0)).length?e[0]:null}getParent(e){return null}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return e.canBeFocused()&&!e.isMutator}isApplicable(e){return e instanceof uH}},hJ=class{constructor(){this.rules=[new hU,new hY,new hK,new hj,new hX,new hz,new hV]}addNavigationPolicy(e){this.rules.push(e)}get(e){return this.rules.find(t=>t.isApplicable(e))}getFirstChild(e){let t,i,o=null==(t=this.get(e))?void 0:t.getFirstChild(e);return o?null!=(i=this.get(o))&&i.isNavigable(o)?o:this.getFirstChild(o)||this.getNextSibling(o):null}getParent(e){let t,i,o=null==(t=this.get(e))?void 0:t.getParent(e);return o?null!=(i=this.get(o))&&i.isNavigable(o)?o:this.getParent(o):null}getNextSibling(e){let t,i,o=null==(t=this.get(e))?void 0:t.getNextSibling(e);return o?null!=(i=this.get(o))&&i.isNavigable(o)?o:this.getNextSibling(o):null}getPreviousSibling(e){let t,i,o=null==(t=this.get(e))?void 0:t.getPreviousSibling(e);return o?null!=(i=this.get(o))&&i.isNavigable(o)?o:this.getPreviousSibling(o):null}},hZ=class extends hJ{constructor(e){super(),this.rules.push(new hx,new hH),this.rules=this.rules.map(t=>new hF(t,e))}},hq=class{constructor(e,t,i,o,s){this.workspace=e,this.oldHostMetrics=this.corner_=this.vScroll=this.hScroll=null,i=void 0===i||i;let n=(t=void 0===t||t)&&i;t&&(this.hScroll=new lh(e,!0,n,o,s)),i&&(this.vScroll=new lh(e,!1,n,o,s)),n&&(this.corner_=eZ(li.RECT,{height:lh.scrollbarThickness,width:lh.scrollbarThickness,class:"blocklyScrollbarBackground"}),e3(this.corner_,e.getBubbleCanvas()))}dispose(){e2(this.corner_),this.oldHostMetrics=this.corner_=null,this.hScroll&&(this.hScroll.dispose(),this.hScroll=null),this.vScroll&&(this.vScroll.dispose(),this.vScroll=null)}resize(){let e=this.workspace.getMetrics();if(e){var t=!1,i=!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||(i=!0)):i=t=!0,t||i){try{$.disable$$module$build$src$core$events$utils(),this.hScroll&&t&&this.hScroll.resize(e),this.vScroll&&i&&this.vScroll.resize(e)}finally{$.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 e;null==(e=this.corner_)||e.setAttribute("x",String(this.vScroll.position.x))}if(!this.oldHostMetrics||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteTop!==e.absoluteTop){let e;null==(e=this.corner_)||e.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,i){this.hScroll&&this.hScroll.set(e,!1),this.vScroll&&this.vScroll.set(t,!1),(i||void 0===i)&&(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)}},hQ=class{load(e,t){return new hM(new hG(0,t.horizontalLayout?"x":"y"),"sep")}gapForItem(e,t){let i;return null!=(i=parseInt(String(e.gap)))?i:t}disposeItem(e){}getType(){return"sep"}};ea(D.FLYOUT_INFLATER,"sep",hQ);var h0=class extends hw{constructor(e){super(),this.horizontalLayout=!1,this.boundEvents=[],this.reflowWrapper=null,this.contents=[],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,this.inflaters=new Map,e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new uH(e),this.workspace_.setMetricsManager(new hP(this.workspace_,this)),this.workspace_.internalIsFlyout=!0,this.workspace_.setVisible(this.visible),this.workspace_.setNavigator(new hZ(this)),this.id=eD(),this.RTL=!!e.RTL,this.toolboxPosition_=e.toolboxPosition,this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH,this.MARGIN=this.CORNER_RADIUS,this.GAP_X=3*this.MARGIN,this.GAP_Y=3*this.MARGIN}createDom(e){return this.svgGroup_=eZ(e,{class:"blocklyFlyout"}),this.svgGroup_.style.display="none",this.svgBackground_=eZ(li.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 hq(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),this.boundEvents.push(eb(this.svgGroup_,"wheel",this,this.wheel_)),this.boundEvents.push(eb(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:r6.ComponentWeight.FLYOUT_WEIGHT,capabilities:[r6.Capability.AUTOHIDEABLE,r6.Capability.DELETE_AREA,r6.Capability.DRAG_TARGET]})}dispose(){for(let e of(this.hide(),this.targetWorkspace.getComponentManager().removeComponent(this.id),this.boundEvents))eO(e);this.boundEvents.length=0,this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.dispose()),this.svgGroup_&&e2(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){let t=e!==this.isVisible();this.visible=e,t&&(this.autoClose||this.targetWorkspace.recordDragTargets(),this.updateDisplay())}setContainerVisible(e){let t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay()}getContents(){return this.contents}setContents(e){this.contents=e}updateDisplay(){let e,t;e=!!this.containerVisible&&this.isVisible(),this.svgGroup_&&(this.svgGroup_.style.display=e?"block":"none"),null==(t=this.workspace_.scrollbar)||t.setContainerVisible(e)}positionAt_(e,t,i,o){let s,n;null==(s=this.svgGroup_)||s.setAttribute("width",`${e}`),null==(n=this.svgGroup_)||n.setAttribute("height",`${t}`),this.workspace_.setCachedParentSvgSize(e,t),this.svgGroup_&&e5(this.svgGroup_,"translate("+i+"px,"+o+"px)"),(e=this.workspace_.scrollbar)&&(e.setOrigin(i,o),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(){this.isVisible()&&(this.setVisible(!1),this.reflowWrapper&&(this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowWrapper=null))}show(e){this.workspace_.setResizesEnabled(!1),this.hide(),this.clearOldBlocks(),"string"==typeof e&&(e=this.getDynamicCategoryContents(e)),this.setVisible(!0),e=tF(e),e=this.createFlyoutInfo(e),t4(this.workspace_),this.setContents(e),this.layout_(e),this.horizontalLayout?this.height_=0:this.width_=0,this.reflow(),this.workspace_.setResizesEnabled(!0),this.reflowWrapper=e=>{e.type!==rL.BLOCK_CHANGE&&e.type!==rL.BLOCK_FIELD_INTERMEDIATE_CHANGE||this.reflow()},this.workspace_.addChangeListener(this.reflowWrapper)}createFlyoutInfo(e){let t=[],i=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(let o of e)"custom"in o&&(e=tF(e=this.getDynamicCategoryContents(o.custom)),t.push(...this.createFlyoutInfo(e))),e=o.kind.toLowerCase(),(e=this.getInflaterForType(e))&&(t.push(e.load(o,this)),(e=e.gapForItem(o,i))&&t.push(new hM(new hG(e,this.horizontalLayout?"x":"y"),"sep")));return this.normalizeSeparators(t)}normalizeSeparators(e){for(let t=e.length-1;t>0;t--){let i=e[t].getType().toLowerCase(),o=e[t-1].getType().toLowerCase();"sep"===i&&"sep"===o&&e.splice(t-1,1)}return e}getDynamicCategoryContents(e){if("function"!=typeof(e=this.workspace_.targetWorkspace.getToolboxCategoryCallback(e)))throw TypeError("Couldn't find a callback function when opening a toolbox category.");return e(this.workspace_.targetWorkspace)}clearOldBlocks(){let e;this.getContents().forEach(e=>{let t;null==(t=this.getInflaterForType(e.getType()))||t.disposeItem(e)}),null==(e=this.workspace_.getPotentialVariableMap())||e.clear()}onMouseDown(e){let t=this.targetWorkspace.getGesture(e);t&&t.handleFlyoutStart(e,this)}isBlockCreatable(e){return e.isEnabled()&&!this.getTargetWorkspace().isReadOnly()}createBlock(e){let t=null;$.disable$$module$build$src$core$events$utils();var i=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{t=this.placeNewBlock(e)}finally{$.enable$$module$build$src$core$events$utils()}if(this.targetWorkspace.hideChaff(),e=iL(this.targetWorkspace,i),eY()){for($.setGroup$$module$build$src$core$events$utils(!0),i=0;i<e.length;i++){let t=e[i];eH(new(ej(rL.VAR_CREATE))(t))}eH(new(ej(rL.BLOCK_CREATE))(t))}return this.autoClose&&this.hide(),t}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()}placeNewBlock(e){var t=this.targetWorkspace;if(!e.getSvgRoot())throw Error("oldBlock is not rendered");let i=this.serializeBlock(e);return t.setResizesEnabled(!1),t=iH(i,t),this.positionNewBlock(e,t),t}serializeBlock(e){return ik(e)}positionNewBlock(e,t){let i=this.targetWorkspace;var o=i.getOriginOffsetInPixels(),s=this.workspace_.getOriginOffsetInPixels();(e=e.getRelativeToSurfaceXY()).scale(this.workspace_.scale),s=lt.sum(s,e),(o=lt.difference(s,o)).scale(1/i.scale),t.moveTo(new lt(o.x,o.y))}getInflaterForType(e){if(this.inflaters.has(e)){var t;return null!=(t=this.inflaters.get(e))?t:null}return(t=ep(D.FLYOUT_INFLATER,e))?(t=new t,this.inflaters.set(e,t),t):null}getFocusableElement(){throw Error("Flyouts are not directly focusable.")}getFocusableTree(){throw Error("Flyouts are not directly focusable.")}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!1}getRootFocusableNode(){throw Error("Flyouts are not directly focusable.")}getRestoredFocusableNode(e){throw Error("Flyouts are not directly focusable.")}getNestedTrees(){throw Error("Flyouts are not directly focusable.")}lookUpFocusableNode(e){throw Error("Flyouts are not directly focusable.")}onTreeFocus(e,t){}onTreeBlur(e){throw Error("Flyouts are not directly focusable.")}},h1=class{constructor(){this.isActive=!1,this.activeClassName="blocklyKeyboardNavigation"}setIsActive(e=!0){this.isActive=e,this.updateActiveVisualization()}getIsActive(){return this.isActive}updateActiveVisualization(){this.isActive?document.body.classList.add(this.activeClassName):document.body.classList.remove(this.activeClassName)}},h2=new h1,h3={};h3.KeyboardNavigationController=h1,h3.keyboardNavigationController=h2;var h5=class{constructor(e){this.workspace=e,this.horizontalScrollEnabled=this.workspace.isMovableHorizontally(),this.verticalScrollEnabled=this.workspace.isMovableVertically(),this.startScrollXY_=new lt(e.scrollX,e.scrollY)}dispose(){this.workspace=null}startDrag(){}endDrag(e){this.drag(e)}drag(e){if(e=lt.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 TypeError("Invalid state.")}},h6=class{constructor(e,t){this.creatorWorkspace=t,this.mouseDownXY=new lt(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 lt(0,0)}dispose(){for(let e of(ef(),ok(),this.creatorWorkspace.clearGesture(),this.boundEvents))eO(e);this.boundEvents.length=0,this.workspaceDragger&&this.workspaceDragger.dispose()}updateFromEvent(e){let t=new lt(e.clientX,e.clientY);this.updateDragDelta(t)&&(this.updateIsDragging(e),em()),this.mostRecentEvent=e}updateDragDelta(e){return this.currentDragDeltaXY=lt.difference(e,this.mouseDownXY),!this.hasExceededDragRadius&&(this.hasExceededDragRadius=lt.magnitude(this.currentDragDeltaXY)>(this.flyout?$.config$$module$build$src$core$config.flyoutDragRadius:$.config$$module$build$src$core$config.dragRadius))}updateIsDraggingFromFlyout(){let e;if(!this.targetBlock||null==(e=this.flyout)||!e.isBlockCreatable(this.targetBlock))return!1;if(!this.flyout.targetWorkspace)throw Error("Cannot update dragging from the flyout because the ' +\n 'flyout's target workspace is undefined");return!!(!this.flyout.isScrollable()||this.flyout.isDragTowardWorkspace(this.currentDragDeltaXY))&&(this.startWorkspace_=this.flyout.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),$.getGroup$$module$build$src$core$events$utils()||$.setGroup$$module$build$src$core$events$utils(!0),this.startBlock=null,this.targetBlock=this.flyout.createBlock(this.targetBlock),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.targetBlock),!0)}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 h5(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();let t=tc();t&&nr(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(eE(D.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,eA(e)?this.cancel():(this.gestureHasStarted=!0,s5(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=i4(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,oD(),e$(e)?this.handleRightClick(e):("pointerdown"===e.type.toLowerCase()&&"mouse"!==e.pointerType&&eT(e,this),this.mouseDownXY=new lt(e.clientX,e.clientY),this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(eb(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(eb(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(eb(document,"pointerup",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&em())}handleMove(e){this.isDragging()&&eI(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),em())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!eI(e))return;if(this.updateFromEvent(e),em(),this.isEnding_)return void console.log("Trying to end a gesture recursively.");this.isEnding_=!0,this.dragger?(h2.setIsActive(!1),this.dragger.onDragEnd(e,this.currentDragDeltaXY)):this.workspaceDragger?(h2.setIsActive(!1),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=eS(e);this.cachedPoints.set(t,this.getTouchPoint(e));var i=Array.from(this.cachedPoints.keys());2===i.length&&(t=this.cachedPoints.get(i[0]),i=this.cachedPoints.get(i[1]),this.startDistance=lt.distance(t,i),this.multiTouch=!0,e.preventDefault())}handleTouchMove(e){let t=eS(e);this.cachedPoints.set(t,this.getTouchPoint(e)),this.isPinchZoomEnabled&&2===this.cachedPoints.size?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()),i=this.cachedPoints.get(t[0]);if(t=this.cachedPoints.get(t[1]),i=lt.distance(i,t)/this.startDistance,this.previousScale>0&&this.previousScale<1/0){if(t=(t=i-this.previousScale)>0?5*t:6*t,!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");let o=this.startWorkspace_,s=eN(e,o.getParentSvg(),o.getInverseScreenCTM());o.zoom(s.x,s.y,t)}this.previousScale=i,e.preventDefault()}handleTouchEnd(e){e=eS(e),this.cachedPoints.has(e)&&this.cachedPoints.delete(e),this.cachedPoints.size<2&&(this.cachedPoints.clear(),this.previousScale=0)}getTouchPoint(e){return this.startWorkspace_?new lt(e.pageX,e.pageY):null}isMultiTouch(){return this.multiTouch}cancel(){this.isEnding_||(em(),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(),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.startWorkspace_),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),h2.setIsActive(!1),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?this.startBlock&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.startBlock):$.getFocusManager$$module$build$src$core$focus_manager().focusNode(t),this.doStart(e)}fireWorkspaceClick(e){eH(new(ej(rL.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.bringBlockToFront(),this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent)}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.flyout.isBlockCreatable(this.targetBlock)){$.getGroup$$module$build$src$core$events$utils()||$.setGroup$$module$build$src$core$events$utils(!0);var e=this.flyout.createBlock(this.targetBlock);e.snapToGrid(),e.bumpNeighbours(),$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");eH(e=new(ej(rL.CLICK))(this.startBlock,this.startWorkspace_.id,"block"))}this.bringBlockToFront(),$.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){this.fireWorkspaceClick(this.startWorkspace_||this.creatorWorkspace)}bringBlockToFront(){this.targetBlock&&!this.flyout&&($.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.targetBlock),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,e.isInFlyout&&e!==e.getRootBlock()?this.setTargetBlock(e.getRootBlock()):this.setTargetBlock(e))}setTargetBlock(e){e.isShadow()?this.setTargetBlock(e.getParent()):(this.targetBlock=e,$.getFocusManager$$module$build$src$core$focus_manager().focusNode(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))}isIconClick(){if(!this.startIcon)return!1;let 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 null!=(t=null!=(e=this.workspaceDragger)?e:this.dragger)?t:null}isDragging(){return this.dragging}hasStarted(){return this.gestureHasStarted}static inProgress(){let e=ts();for(let t=0,i;i=e[t];t++)if(i.currentGesture_)return!0;return!1}},h4=class{constructor(e,t){let i,o,s;this.pattern=e,this.scale=1,this.spacing=null!=(i=t.spacing)?i:0,this.length=null!=(o=t.length)?o:1,this.line2=(this.line1=e.firstChild)&&this.line1.nextSibling,this.snapToGrid=null!=(s=t.snap)&&s}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}`);let i=(t=Math.floor(this.spacing/2)+.5)-this.length/2,o=t+this.length/2;t*=e,i*=e,o*=e,this.setLineAttributes(this.line1,e,i,o,t,t),this.setLineAttributes(this.line2,e,t,t,i,o)}setLineAttributes(e,t,i,o,s,n){e&&(e.setAttribute("stroke-width",`${t}`),e.setAttribute("x1",`${i}`),e.setAttribute("y1",`${s}`),e.setAttribute("x2",`${o}`),e.setAttribute("y2",`${n}`))}moveTo(e,t){this.pattern.setAttribute("x",`${e}`),this.pattern.setAttribute("y",`${t}`)}alignXY(e){var t=this.getSpacing();let i=t/2,o=Math.round(Math.round((e.x-i)/t)*t+i);return t=Math.round(Math.round((e.y-i)/t)*t+i),o===e.x&&t===e.y?e:new lt(o,t)}static createDom(e,t,i,o){let s,n;if(e=eZ(li.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},i),(null!=(s=t.length)?s:1)>0&&(null!=(n=t.spacing)?n:0)>0){let i;eZ(li.LINE,{stroke:t.colour},e),null!=(i=t.length)&&i&&eZ(li.LINE,{stroke:t.colour},e)}else eZ(li.LINE,{},e);return o&&o.style.setProperty("--blocklyGridPattern",`url(#${e.id})`),e}},h8=class{constructor(e){this.workspace=e,this.layers=new Map,(e=e.getInjectionDiv())&&(this.dragLayer=this.createDragLayer(e),this.animationLayer=this.createAnimationLayer(e)),eq(e=this.createLayer(50),"blocklyBlockCanvas"),eq(e=this.createLayer(100),"blocklyBubbleCanvas")}createDragLayer(e){let t=eZ(li.SVG,{class:"blocklyBlockDragSurface",xmlns:rD,"xmlns:html":rk,"xmlns:xlink":rw,version:"1.1"});return e.append(t),eZ(li.G,{},t)}createAnimationLayer(e){let t=eZ(li.SVG,{class:"blocklyAnimationLayer",xmlns:rD,"xmlns:html":rk,"xmlns:xlink":rw,version:"1.1"});return e.append(t),eZ(li.G,{},t)}appendToAnimationLayer(e){let t,i,o=null==(t=this.dragLayer)?void 0:t.getAttribute("transform");if(o){let e;null==(e=this.animationLayer)||e.setAttribute("transform",o)}null==(i=this.animationLayer)||i.appendChild(e.getSvgRoot())}translateLayers(e,t){let i;for(let[,o]of(e=`translate(${e.x}, ${e.y}) scale(${t})`,null==(i=this.dragLayer)||i.setAttribute("transform",e),this.layers))o.setAttribute("transform",e)}moveToDragLayer(e){let t;null==(t=this.dragLayer)||t.appendChild(e.getSvgRoot()),e.canBeFocused()&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}moveOffDragLayer(e,t){this.append(e,t),e.canBeFocused()&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}append(e,t){let i;if(this.layers.has(t)||this.createLayer(t),e=e.getSvgRoot(),(null==(i=this.layers.get(t))?void 0:i.lastChild)!==e){let i;null==(i=this.layers.get(t))||i.appendChild(e)}}createLayer(e){let t=this.workspace.getSvgGroup(),i=eZ(li.G,{}),o=!1;for(let[s,n]of[...this.layers].sort((e,t)=>e[0]-t[0]))if(e<s){t.insertBefore(i,n),o=!0;break}return o||t.appendChild(i),this.layers.set(e,i),i}hasLayer(e){return e===this.dragLayer||new Set(this.layers.values()).has(e)}getBlockLayer(){return this.layers.get(50)}getBubbleLayer(){return this.layers.get(100)}},h9=class{constructor(){this.curNode=this.colour=null,this.type="marker"}getCurNode(){return this.curNode}setCurNode(e){this.curNode=e}dispose(){this.curNode=null}getSourceBlockFromNode(e){return e instanceof hD?e:e instanceof cd||e instanceof h_?e.getSourceBlock():null}getSourceBlock(){return this.getSourceBlockFromNode(this.getCurNode())}},h7=class extends h9{constructor(e){super(),this.workspace=e,this.type="cursor",this.potentialNodes=null}next(){var e=this.getCurNode();return e?((e=this.getNextNode(e,e=>{let t;return e instanceof hD&&!(null==(t=e.outputConnection)?0:t.targetBlock())||e instanceof cW},!0))&&this.setCurNode(e),e):null}in(){var e=this.getCurNode();return e?((e=this.getNextNode(e,()=>!0,!0))&&this.setCurNode(e),e):null}prev(){var e=this.getCurNode();return e?((e=this.getPreviousNode(e,e=>{let t;return e instanceof hD&&!(null==(t=e.outputConnection)?0:t.targetBlock())||e instanceof cW},!0))&&this.setCurNode(e),e):null}out(){var e=this.getCurNode();return e?((e=this.getPreviousNode(e,()=>!0,!0))&&this.setCurNode(e),e):null}atEndOfLine(){var e=this.getCurNode();return!!e&&this.getNextNode(e,()=>!0,!0)===(e=this.getNextNode(e,e=>{let t;return e instanceof hD&&!(null==(t=e.outputConnection)?0:t.targetBlock())},!0))}getNextNodeImpl(e,t,i=new Set){if(!e||i.has(e))return null;let o=this.workspace.getNavigator().getFirstChild(e)||this.workspace.getNavigator().getNextSibling(e);for(var s=e;s&&!o&&(s=this.workspace.getNavigator().getParent(s));)o=this.workspace.getNavigator().getNextSibling(s);return t(o)?o:o?(i.add(e),this.getNextNodeImpl(o,t,i)):null}getNextNode(e,t,i){return e&&(i||this.getLastNode()!==e)?this.getNextNodeImpl(e,t):null}getPreviousNodeImpl(e,t,i=new Set){if(!e||i.has(e))return null;let o=this.getRightMostChild(this.workspace.getNavigator().getPreviousSibling(e),e)||this.workspace.getNavigator().getParent(e);return t(o)?o:o?(i.add(e),this.getPreviousNodeImpl(o,t,i)):null}getPreviousNode(e,t,i){return e&&(i||this.getFirstNode()!==e)?this.getPreviousNodeImpl(e,t):null}getRightMostChild(e,t){if(!e)return e;let i=this.workspace.getNavigator().getFirstChild(e);if(!i||i===t)return e;for(e=i;e&&e!==t;e=this.workspace.getNavigator().getNextSibling(i))i=e;return this.getRightMostChild(i,t)}preDelete(e){let t,i;var o,s=this.getCurNode();s=s?[s]:[];let n=null!=(i=null==(o=e.previousConnection)?void 0:o.targetConnection)?i:null==(t=e.outputConnection)?void 0:t.targetConnection;n&&s.push(n),(o=e.getNextBlock())&&s.push(o),(e=e.getParent())&&s.push(e),s.push(this.workspace),this.potentialNodes=s}postDelete(){let e=this.potentialNodes;if(this.potentialNodes=null,!e)throw Error("must call preDelete first");for(let t of e){let e;if(null==(e=this.getSourceBlockFromNode(t))||!e.disposed)return void this.setCurNode(t)}throw Error("no valid nodes in this.potentialNodes")}getCurNode(){return $.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()}setCurNode(e){$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e),e instanceof hD?e.workspace.scrollBoundsIntoView(e.getBoundingRectangleWithoutChildren()):e instanceof cd?(e=e.getSourceBlock()).workspace.scrollBoundsIntoView(e.getBoundingRectangleWithoutChildren()):e instanceof cW&&e.workspace.scrollBoundsIntoView(e.getBoundingRectangle())}getFirstNode(){return this.workspace.getNavigator().getFirstChild(this.workspace)}getLastNode(){let e=this.getFirstNode();return this.getPreviousNode(e,()=>!0,!0)}};ea(D.CURSOR,y,h7);var ue=class{constructor(e){this.workspace=e,this.markers=new Map,this.cursor=new h7(this.workspace)}registerMarker(e,t){this.markers.has(e)&&this.unregisterMarker(e),this.markers.set(e,t)}unregisterMarker(e){let 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=e}dispose(){let e=Object.keys(this.markers);for(let t=0,i;i=e[t];t++)this.unregisterMarker(i);this.markers.clear(),this.cursor.dispose()}};ue.LOCAL_MARKER="local_marker_1";var ut=class extends he{constructor(e,t,i){super(e,t,i,ut.createTextArea()),this.workspace=e,this.anchor=t,this.ownerRect=i,this.resizePointerMoveListener=this.resizePointerUpListener=null,this.textChangeListeners=[],this.sizeChangeListeners=[],this.locationChangeListeners=[],this.text="",this.DEFAULT_SIZE=new ls(160+he.DOUBLE_BORDER,80+he.DOUBLE_BORDER),this.MIN_SIZE=new ls(45+he.DOUBLE_BORDER,20+he.DOUBLE_BORDER),this.editable=!0,eq(this.svgRoot,"blocklyTextInputBubble"),this.textArea=this.getFocusableElement(),this.inputRoot=this.createEditor(this.contentContainer,this.textArea),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)}addLocationChangeListener(e){this.locationChangeListeners.push(e)}static createTextArea(){let e=document.createElementNS(rk,"textarea");return e.className="blocklyTextarea blocklyText",e}createEditor(e,t){e=eZ(li.FOREIGNOBJECT,{x:he.BORDER_WIDTH,y:he.BORDER_WIDTH},e);let i=document.createElementNS(rk,"body");return i.setAttribute("xmlns",rk),i.className="blocklyMinimalBody",t.setAttribute("dir",this.workspace.RTL?"RTL":"LTR"),i.appendChild(t),e.appendChild(i),this.bindTextAreaEvents(t),e}bindTextAreaEvents(e){eb(e,"wheel",this,e=>{e.stopPropagation()}),eb(e,"pointerdown",this,e=>{e.stopPropagation(),ef()}),eb(e,"change",this,this.onTextChange)}createResizeHandle(e,t){return eb(e=eZ(li.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},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);let i=e.width-he.DOUBLE_BORDER,o=e.height-he.DOUBLE_BORDER;this.inputRoot.setAttribute("width",`${i}`),this.inputRoot.setAttribute("height",`${o}`),this.resizeGroup.setAttribute("y",`${o}`),this.workspace.RTL?this.resizeGroup.setAttribute("x",`${-he.DOUBLE_BORDER}`):this.resizeGroup.setAttribute("x",`${i}`),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}moveDuringDrag(e){super.moveDuringDrag(e),this.onLocationChange()}setPositionRelativeToAnchor(e,t){super.setPositionRelativeToAnchor(e,t),this.onLocationChange()}positionByRect(e=new lo(0,0,0,0)){super.positionByRect(e),this.onLocationChange()}onResizePointerDown(e){this.bringToFront(),e$(e)||(sr(this.workspace,e,new lt(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=eb(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=eb(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){ef(),this.resizePointerUpListener&&(eO(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(eO(this.resizePointerMoveListener),this.resizePointerMoveListener=null)}onResizePointerMove(e){e=sl(this.workspace,e),this.setSize(new ls(this.workspace.RTL?-e.x:e.x,e.y),!1),this.onSizeChange()}onTextChange(){for(let e of(this.text=this.textArea.value,this.textChangeListeners))e()}onSizeChange(){for(let e of this.sizeChangeListeners)e()}onLocationChange(){for(let e of this.locationChangeListeners)e()}};tf("\n.blocklyTextInputBubble .blocklyTextarea {\n background-color: var(--commentFillColour);\n border: 0;\n box-sizing: border-box;\n display: block;\n outline: 0;\n padding: 5px;\n resize: none;\n width: 100%;\n height: 100%;\n}\n");var ui={};ui.register=na,ui.unregister=function(e){eh(D.ICON,e)};var uo=class extends hi{constructor(e){super(e),this.sourceBlock=e,this.textInputBubble=null,this.text="",this.bubbleSize=new ls(160,80),this.bubbleVisiblity=!1}getType(){return uo.TYPE}initView(e){this.svgRoot||(super.initView(e),eZ(li.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),eZ(li.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),eZ(li.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),eq(this.svgRoot,"blocklyCommentIcon"))}dispose(){let e;super.dispose(),null==(e=this.textInputBubble)||e.dispose()}getWeight(){return uo.WEIGHT}getSize(){return new ls(17,17)}applyColour(){let e;super.applyColour();let t=this.sourceBlock.getColour();null==(e=this.textInputBubble)||e.setColour(t)}updateEditable(){let e=this,t=()=>super.updateEditable;return(0,rf.asyncExecutePromiseGeneratorFunction)(function*(){t().call(e),e.bubbleIsVisible()&&(yield e.setBubbleVisible(!1),yield e.setBubbleVisible(!0))})}onLocationChange(e){let t,i=this.workspaceLocation;super.onLocationChange(e),this.bubbleLocation&&(e=lt.difference(this.workspaceLocation,i),this.bubbleLocation=lt.sum(this.bubbleLocation,e)),e=this.getAnchorLocation(),null==(t=this.textInputBubble)||t.setAnchorLocation(e)}setText(e){let t,i=this.text;eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock,"comment",null,i,e)),this.text=e,null==(t=this.textInputBubble)||t.setText(this.text)}getText(){return this.text}setBubbleSize(e){let t;this.bubbleSize=e,null==(t=this.textInputBubble)||t.setSize(this.bubbleSize,!0)}getBubbleSize(){return this.bubbleSize}setBubbleLocation(e){let t;this.bubbleLocation=e,null==(t=this.textInputBubble)||t.moveDuringDrag(e)}getBubbleLocation(){return this.bubbleLocation}saveState(){if(this.text){let e={text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width},t=this.getBubbleLocation();return t&&(e.x=this.sourceBlock.workspace.RTL?this.sourceBlock.workspace.getWidth()-(t.x+this.bubbleSize.width):t.x,e.y=t.y),e}return null}loadState(e){let t,i,o,s;this.text=null!=(t=e.text)?t:"",this.bubbleSize=new ls(null!=(i=e.width)?i:160,null!=(o=e.height)?o:80),this.bubbleVisiblity=null!=(s=e.pinned)&&s,this.setBubbleVisible(this.bubbleVisiblity);let n=e.x,r=e.y;t6().then(()=>{n&&r&&(n=this.sourceBlock.workspace.RTL?this.sourceBlock.workspace.getWidth()-(n+this.bubbleSize.width):n,this.setBubbleLocation(new lt(n,r)))})}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}onTextChange(){if(this.textInputBubble){var e=this.textInputBubble.getText();this.text!==e&&(eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock,"comment",null,this.text,e)),this.text=e)}}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}onBubbleLocationChange(){this.textInputBubble&&(this.bubbleLocation=this.textInputBubble.getRelativeToSurfaceXY())}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(e){let t=this;return(0,rf.asyncExecutePromiseGeneratorFunction)(function*(){t.bubbleVisiblity!==e&&(t.bubbleVisiblity=e,yield t6(),!t.sourceBlock.rendered||t.sourceBlock.isInFlyout||t.sourceBlock.isInsertionMarker()||(e?(t.sourceBlock.isEditable()?t.showEditableBubble():t.showNonEditableBubble(),t.applyColour()):t.hideBubble(),eH(new(ej(rL.BUBBLE_OPEN))(t.sourceBlock,e,"comment"))))})}getBubble(){return this.textInputBubble}showEditableBubble(){let e,t;this.createBubble(),null==(e=this.textInputBubble)||e.addTextChangeListener(()=>this.onTextChange()),null==(t=this.textInputBubble)||t.addSizeChangeListener(()=>this.onSizeChange())}showNonEditableBubble(){let e;this.createBubble(),null==(e=this.textInputBubble)||e.setEditable(!1)}createBubble(){this.textInputBubble=new ut(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.textInputBubble.setText(this.getText()),this.textInputBubble.setSize(this.bubbleSize,!0),this.bubbleLocation&&this.textInputBubble.moveDuringDrag(this.bubbleLocation),this.textInputBubble.addTextChangeListener(()=>this.onTextChange()),this.textInputBubble.addSizeChangeListener(()=>this.onSizeChange()),this.textInputBubble.addLocationChangeListener(()=>this.onBubbleLocationChange())}hideBubble(){let e;null==(e=this.textInputBubble)||e.dispose(),this.textInputBubble=null}getAnchorLocation(){return lt.sum(this.workspaceLocation,new lt(8.5,8.5))}getBubbleOwnerRect(){return this.sourceBlock.getBoundingRectangleWithoutChildren()}};uo.TYPE=ab.COMMENT,uo.WEIGHT=3,na(uo.TYPE,uo);var us={};us.CommentIcon=uo,us.Icon=hi,us.IconType=ab,us.MutatorIcon=$.MutatorIcon$$module$build$src$core$icons$mutator_icon,us.WarningIcon=hy,us.exceptions=hc,us.registry=ui,$.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.getName():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:\nBlockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());"),null)}populateVariables(e){e=$.allUsedVarModels$$module$build$src$core$variables(e);for(let t=0;t<e.length;t++)this.getName(e[t].getId(),$.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 i=e;t===$.NameType$$module$build$src$core$names.VARIABLE&&(e=this.getNameForUserVariable(e))&&(i=e),e=i.toLowerCase();let o=t===$.NameType$$module$build$src$core$names.VARIABLE||t===$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix:"";this.db.has(t)||this.db.set(t,new Map);let s=this.db.get(t);return s.has(e)?o+s.get(e):(t=this.getDistinctName(i,t),s.set(e,t.substr(o.length)),t)}getUserNames(e){let t;return(e=null==(t=this.db.get(e))?void 0:t.keys())?Array.from(e):[]}getDistinctName(e,t){let i;e=this.safeName(e);let o=null,s,n;for(;this.dbReverse.has(e+(null!=(s=o)?s:""))||this.reservedWords.has(e+(null!=(n=o)?n:""));)o=o?o+1:2;return e+=null!=(i=o)?i:"",this.dbReverse.add(e),(t===$.NameType$$module$build$src$core$names.VARIABLE||t===$.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=$.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed",e}static equals(e,t){return e.toLowerCase()===t.toLowerCase()}},(dW=(dW=$.Names$$module$build$src$core$names||($.Names$$module$build$src$core$names={})).NameType||(dW.NameType={})).DEVELOPER_VARIABLE="DEVELOPER_VARIABLE",dW.VARIABLE="VARIABLE",dW.PROCEDURE="PROCEDURE",$.NameType$$module$build$src$core$names=$.Names$$module$build$src$core$names.NameType,$.Names$$module$build$src$core$names.DEVELOPER_VARIABLE_TYPE=$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE,({NameType:$.NameType$$module$build$src$core$names}).Names=$.Names$$module$build$src$core$names;var un=class extends Map{constructor(){super()}set(e,t){return this.get(e)===t||(super.set(e,t),nh(t)&&t.startPublishing()),this}delete(e){let t=this.get(e);return(e=super.delete(e))&&nh(t)&&t.stopPublishing(),e}clear(){if(this.size)for(let e of this.keys())this.delete(e)}add(e){return this.set(e.getId(),e)}getProcedures(){return[...this.values()]}};dY="PROCEDURE",$.DEFAULT_ARG$$module$build$src$core$procedures="x",(dX={CATEGORY_NAME:dY,DEFAULT_ARG:$.DEFAULT_ARG$$module$build$src$core$procedures}).ObservableProcedureMap=un,dX.allProcedures=nu,dX.findLegalName=$.findLegalName$$module$build$src$core$procedures,dX.flyoutCategory=nT,dX.getCallers=nS,dX.getDefinition=$.getDefinition$$module$build$src$core$procedures,dX.internalFlyoutCategory=nE,dX.isNameUsed=n_,dX.isProcedureBlock=nc,dX.mutateCallers=$.mutateCallers$$module$build$src$core$procedures,dX.mutatorOpenListener=nf,dX.rename=$.rename$$module$build$src$core$procedures;var ur=new 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_=0x1000000}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)>=1}isHat(e){return(e.type&this.HAT)>=1}isIcon(e){return(e.type&this.ICON)>=1}isSpacer(e){return(e.type&this.SPACER)>=1}isInRowSpacer(e){return(e.type&this.IN_ROW_SPACER)>=1}isSpacerRow(e){return(e.type&this.BETWEEN_ROW_SPACER)>=1}isInput(e){return(e.type&this.INPUT)>=1}isExternalInput(e){return(e.type&this.EXTERNAL_VALUE_INPUT)>=1}isInlineInput(e){return(e.type&this.INLINE_INPUT)>=1}isStatementInput(e){return(e.type&this.STATEMENT_INPUT)>=1}isPreviousConnection(e){return(e.type&this.PREVIOUS_CONNECTION)>=1}isNextConnection(e){return(e.type&this.NEXT_CONNECTION)>=1}isPreviousOrNextConnection(e){return this.isPreviousConnection(e)||this.isNextConnection(e)}isRoundCorner(e){return(e.type&this.LEFT_ROUND_CORNER)>=1||(e.type&this.RIGHT_ROUND_CORNER)>=1}isLeftRoundedCorner(e){return this.isRoundCorner(e)&&(e.type&this.LEFT_ROUND_CORNER)>=1}isRightRoundedCorner(e){return this.isRoundCorner(e)&&(e.type&this.RIGHT_ROUND_CORNER)>=1}isLeftSquareCorner(e){return(e.type&this.LEFT_SQUARE_CORNER)>=1}isRightSquareCorner(e){return(e.type&this.RIGHT_SQUARE_CORNER)>=1}isCorner(e){return(e.type&this.CORNER)>=1}isJaggedEdge(e){return(e.type&this.JAGGED_EDGE)>=1}isRow(e){return(e.type&this.ROW)>=1}isBetweenRowSpacer(e){return(e.type&this.BETWEEN_ROW_SPACER)>=1}isTopRow(e){return(e.type&this.TOP_ROW)>=1}isBottomRow(e){return(e.type&this.BOTTOM_ROW)>=1}isTopOrBottomRow(e){return this.isTopRow(e)||this.isBottomRow(e)}isInputRow(e){return(e.type&this.INPUT_ROW)>=1}},ul=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=ur.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},ua=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=ur.ROW,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}getLastInput(){for(let e=this.elements.length-1;e>=0;e--){let t=this.elements[e];if(ur.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++){let t=this.elements[e];if(ur.isInRowSpacer(t))return t}return null}getLastSpacer(){for(let e=this.elements.length-1;e>=0;e--){let t=this.elements[e];if(ur.isInRowSpacer(t))return t}return null}},uc=class extends ua{constructor(e){super(e),this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0,this.type|=ur.BOTTOM_ROW}hasLeftSquareCorner(e){return!!e.outputConnection||!!e.getNextBlock()}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,i=0;for(let o=0;o<this.elements.length;o++){let s=this.elements[o];t+=s.width,ur.isSpacer(s)||(ur.isNextConnection(s)?i=Math.max(i,s.height):e=Math.max(e,s.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+i,this.descenderHeight=i,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},uh=class extends ul{constructor(e,t){super(e),this.connectionModel=t,this.type|=ur.CONNECTION,this.shape=this.constants_.shapeFor(t),this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic,this.highlighted=t.isHighlighted()}},uu=class extends uh{constructor(e,t){super(e,t.connection),this.input=t,this.connectionOffsetY=this.connectionOffsetX=0,this.type|=ur.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}},ud=class extends uu{constructor(e,t){super(e,t),this.height=0,this.type|=ur.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}},up=class extends ul{constructor(e,t,i){super(e),this.field=t,this.parentInput=i,this.isEditable=t.EDITABLE,this.flipRtl=t.getFlipRtl(),this.type|=ur.FIELD,e=this.field.getSize(),this.height=e.height,this.width=e.width}},u_=class extends ul{constructor(e){super(e),this.type|=ur.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height}},ug=class extends ul{constructor(e,t){super(e),this.icon=t,this.flipRtl=!1,this.type|=ur.ICON,e=t.getSize(),this.height=e.height,this.width=e.width}},uE=class extends ul{constructor(e,t){super(e),this.type|=ur.SPACER|ur.IN_ROW_SPACER,this.width=t,this.height=this.constants_.SPACER_DEFAULT_HEIGHT}},uT=class extends uu{constructor(e,t){super(e,t),this.type|=ur.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}},um=class extends ua{constructor(e){super(e),this.connectedBlockWidths=0,this.type|=ur.INPUT_ROW}measure(){this.width=this.minWidth,this.height=this.minHeight;let e=0;for(let t=0;t<this.elements.length;t++){let i=this.elements[t];this.width+=i.width,ur.isInput(i)&&(ur.isStatementInput(i)?e+=i.connectedBlockWidth:ur.isExternalInput(i)&&0!==i.connectedBlockWidth&&(e+=i.connectedBlockWidth-i.connectionWidth)),ur.isSpacer(i)||(this.height=Math.max(this.height,i.height))}this.connectedBlockWidths=e,this.widthWithConnectedBlocks=this.width+e}endsWithElemSpacer(){return!this.hasExternalInput&&!this.hasStatement}},uf=class extends ul{constructor(e){super(e),this.type|=ur.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width}},uI=class extends uh{constructor(e,t){super(e,t),this.type|=ur.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},uS=class extends uh{constructor(e,t){super(e,t),this.connectionOffsetX=0,this.type|=ur.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}},uR=class extends uh{constructor(e,t){super(e,t),this.type|=ur.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},ub=class extends ul{constructor(e,t){super(e),this.type=(t&&"left"!==t?ur.RIGHT_ROUND_CORNER:ur.LEFT_ROUND_CORNER)|ur.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2}},uC=class extends ua{constructor(e,t,i){super(e),this.height=t,this.width=i,this.precedesStatement=this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.type|=ur.SPACER|ur.BETWEEN_ROW_SPACER,this.elements=[new uE(this.constants_,i)]}measure(){}},uO=class extends ul{constructor(e,t){super(e),this.type=(t&&"left"!==t?ur.RIGHT_SQUARE_CORNER:ur.LEFT_SQUARE_CORNER)|ur.CORNER,this.width=this.height=this.constants_.NO_PADDING}},uA=class extends uu{constructor(e,t){super(e,t),this.type|=ur.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}},u$=class extends ua{constructor(e){super(e),this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null,this.type|=ur.TOP_ROW}hasLeftSquareCorner(e){let t=(e.hat?"cap"===e.hat:this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection,i=e.getPreviousBlock();return!!e.outputConnection||t||!!i&&i.getNextBlock()===e}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,i=0;for(let o=0;o<this.elements.length;o++){let s=this.elements[o];t+=s.width,ur.isSpacer(s)||(ur.isHat(s)?i=Math.max(i,s.ascenderHeight):e=Math.max(e,s.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+i,this.capline=this.ascenderHeight=i,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},uN=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=sV(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);let t=e.blockStyles;for(let e in t)this.blockStyles[e]=this.validatedBlockStyle_(t[e]);this.setDynamicProperties_(e)}setDynamicProperties_(e){this.setFontConstants_(e),this.setComponentConstants_(e),this.ADD_START_HATS=void 0!==e.startHats?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=e7("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){let 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){let t={};return e&&Object.assign(t,e),e=oz(t.colourPrimary||"#000"),t.colourPrimary=e.hex,t.colourSecondary=t.colourSecondary?oz(t.colourSecondary).hex:this.generateSecondaryColour_(t.colourPrimary),t.colourTertiary=t.colourTertiary?oz(t.colourTertiary).hex:this.generateTertiaryColour_(t.colourPrimary),t.hat=t.hat||"",t}generateSecondaryColour_(e){return oW("#fff",e,.6)||e}generateTertiaryColour_(e){return oW("#fff",e,.3)||e}dispose(){this.embossFilter&&e2(this.embossFilter),this.disabledPattern&&e2(this.disabledPattern),this.debugFilter&&e2(this.debugFilter),this.cssNode=null}makeJaggedTeeth(){let e=this.JAGGED_TEETH_HEIGHT,t=this.JAGGED_TEETH_WIDTH,i=sY([sH(t,e/4),sH(-(2*t),e/2),sH(t,e/4)]);return{height:e,width:t,path:i}}makeStartHat(){let e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,i=sU("c",[sH(30,-e),sH(70,-e),sH(t,0)]);return{height:.75*e,width:t,path:i}}makePuzzleTab(){function e(e){let o=-(e=e?-1:1);var s=i/2;let n=s+2.5,r=s+.5,l=sH(-t,e*s);return s=sH(t,e*s),sU("c",[sH(0,e*n),sH(-t,o*r),l])+sU("s",[sH(t,2.5*o),s])}let t=this.TAB_WIDTH,i=this.TAB_HEIGHT,o=e(!0),s=e(!1);return{type:this.SHAPES.PUZZLE,width:t,height:i,pathDown:s,pathUp:o}}makeNotch(){function e(e){return sY([sH(e*o,i),sH(3*e,0),sH(e*o,-i)])}let t=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,o=(t-3)/2,s=e(1),n=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:i,pathLeft:s,pathRight:n}}makeInsideCorners(){let e=this.CORNER_RADIUS,t=sz("a","0 0,0",e,sH(-e,e)),i=sz("a","0 0,0",e,sH(e,e));return{width:e,height:e,pathTop:t,pathBottom:i}}makeOutsideCorners(){let e=this.CORNER_RADIUS,t=sV(0,e)+sz("a","0 0,1",e,sH(e,-e)),i=sz("a","0 0,1",e,sH(e,e)),o=sz("a","0 0,1",e,sH(-e,-e));return{topLeft:t,topRight:i,bottomRight:sz("a","0 0,1",e,sH(-e,e)),bottomLeft:o,rightHeight:e}}shapeFor(e){switch(e.type){case c5.INPUT_VALUE:case c5.OUTPUT_VALUE:return this.PUZZLE_TAB;case c5.PREVIOUS_STATEMENT:case c5.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type")}}createDom(e,t,i,o){this.injectCSS_(t,i),this.defs=eZ(li.DEFS,{},e),e=eZ(li.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},this.defs),eZ(li.FEGAUSSIANBLUR,{in:"SourceAlpha",stdDeviation:1,result:"blur"},e),t=eZ(li.FESPECULARLIGHTING,{in:"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},e),eZ(li.FEPOINTLIGHT,{x:-5e3,y:-1e4,z:2e4},t),eZ(li.FECOMPOSITE,{in:"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},e),eZ(li.FECOMPOSITE,{in:"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},e),this.embossFilterId=e.id,this.embossFilter=e,e=eZ(li.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs),eZ(li.RECT,{width:10,height:10,fill:"#aaa"},e),eZ(li.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(),o&&(o.style.setProperty("--blocklyEmbossFilter",`url(#${this.embossFilterId})`),o.style.setProperty("--blocklyDisabledPattern",`url(#${this.disabledPatternId})`),o.style.setProperty("--blocklyDebugFilter",`url(#${this.debugFilterId})`))}createDebugFilter(){if(!this.debugFilter){let e=eZ(li.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs),t=eZ(li.FECOMPONENTTRANSFER,{result:"outBlur"},e);eZ(li.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),eZ(li.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},e),eZ(li.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);let i=t.join("\n");this.cssNode?this.cssNode.firstChild.textContent=i:((t=document.createElement("style")).id=e,e=document.createTextNode(i),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} .blocklyNonEditableField>rect,`,`${e} .blocklyEditableField>rect {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"fill-opacity: .6;","stroke: none;","}",`${e} .blocklyNonEditableField>text,`,`${e} .blocklyEditableField>text {`,"fill: #000;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #000;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #000;","}",`${e} .blocklyEditableField:not(.blocklyEditing):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;","}"]}},uL={};uL.ConstantProvider=uN,uL.isDynamicShape=nb,uL.isNotch=nO,uL.isPuzzleTab=nC;var uy=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_+"\n"+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++){let 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_(){let e=this.info_.topRow,t=e.elements;this.positionPreviousConnection_(),this.outlinePath_+=sV(e.xPos,this.info_.startY);for(let e=0,i;i=t[e];e++)ur.isLeftRoundedCorner(i)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:ur.isRightRoundedCorner(i)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:ur.isPreviousConnection(i)?this.outlinePath_+=i.shape.pathLeft:ur.isHat(i)?this.outlinePath_+=this.constants_.START_HAT.path:ur.isSpacer(i)&&(this.outlinePath_+=sX("h",i.width));this.outlinePath_+=sX("v",e.height)}drawJaggedEdge_(e){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+sX("v",e.height-this.constants_.JAGGED_TEETH.height)}drawValueInput_(e){let t=e.getLastInput();this.positionExternalValueConnection_(e);let i=nb(t.shape)?t.shape.pathDown(t.height):t.shape.pathDown;this.outlinePath_+=sX("H",t.xPos+t.width)+i+sX("v",e.height-t.connectionHeight)}drawStatementInput_(e){var t=e.getLastInput();if(t){var i=t.xPos+t.notchOffset+t.shape.width;t=t.shape.pathRight+sX("h",-(t.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var o=e.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=sX("H",i)+t+sX("v",o)+this.constants_.INSIDE_CORNERS.pathBottom+sX("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}}drawRightSideRow_(e){this.outlinePath_+=sX("V",e.yPos+e.height)}drawBottom_(){let e=this.info_.bottomRow,t=e.elements;this.positionNextConnection_();let i=0,o="";for(let s=t.length-1,n;n=t[s];s--)ur.isNextConnection(n)?o+=n.shape.pathRight:ur.isLeftSquareCorner(n)?o+=sX("H",e.xPos):ur.isLeftRoundedCorner(n)?o+=this.constants_.OUTSIDE_CORNERS.bottomLeft:ur.isRightRoundedCorner(n)?(o+=this.constants_.OUTSIDE_CORNERS.bottomRight,i=this.constants_.OUTSIDE_CORNERS.rightHeight):ur.isSpacer(n)&&(o+=sX("h",-1*n.width));this.outlinePath_+=sX("V",e.baseline-i),this.outlinePath_+=o}drawLeft_(){var e=this.info_.outputConnection;if(this.positionOutputConnection_(),e){let t=e.connectionOffsetY+e.height;e=nb(e.shape)?e.shape.pathUp(e.height):e.shape.pathUp,this.outlinePath_+=sX("V",t)+e}this.outlinePath_+="z"}drawInternals_(){for(let e=0,t;t=this.info_.rows[e];e++)for(let e=0,i;i=t.elements[e];e++)ur.isInlineInput(i)?this.drawInlineInput_(i):(ur.isIcon(i)||ur.isField(i))&&this.layoutField_(i)}layoutField_(e){let t=e.centerline-e.height/2,i=e.xPos;var o="";this.info_.RTL&&(i=-(i+e.width),e.flipRtl&&(i+=e.width,o="scale(-1 1)")),ur.isIcon(e)?((o=e.icon).setOffsetInBlock(new lt(i,t)),this.info_.isInsertionMarker&&o.hideForInsertionMarker()):((e=e.field.getSvgRoot()).setAttribute("transform","translate("+i+","+t+")"+o),this.info_.isInsertionMarker&&e.setAttribute("display","none"))}drawInlineInput_(e){let t=e.width,i=e.height,o=e.connectionOffsetY,s=e.connectionHeight+o;this.inlinePath_+=sW(e.xPos+e.connectionWidth,e.centerline-i/2)+sX("v",o)+e.shape.pathDown+sX("v",i-s)+sX("h",t-e.connectionWidth)+sX("v",-i)+"z",this.positionInlineInputConnection_(e)}positionInlineInputConnection_(e){let t=e.centerline-e.height/2;if(e.connectionModel){let i=e.xPos+e.connectionWidth+e.connectionOffsetX;this.info_.RTL&&(i*=-1),e.connectionModel.setOffsetInBlock(i,t+e.connectionOffsetY)}}positionStatementInputConnection_(e){let t=e.getLastInput();if(null==t?0:t.connectionModel){let i=e.xPos+e.statementEdge+t.notchOffset;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionExternalValueConnection_(e){let t=e.getLastInput();if(t&&t.connectionModel){let i=e.xPos+e.width;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionPreviousConnection_(){let e=this.info_.topRow;if(e.connection){let t=e.xPos+e.notchOffset;e.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-t:t,0)}}positionNextConnection_(){let e=this.info_.bottomRow;if(e.connection){let t=e.connection,i=t.xPos;t.connectionModel.setOffsetInBlock(this.info_.RTL?-i:i,e.baseline)}}positionOutputConnection_(){if(this.info_.outputConnection){let e=this.info_.startX+this.info_.outputConnection.connectionOffsetX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-e:e,this.info_.outputConnection.connectionOffsetY)}}updateConnectionHighlights(){for(let e of this.info_.rows)for(let t of e.elements){if(!(t instanceof uh))continue;let e=this.drawConnectionHighlightPath(t);e&&(e.style.display=t.highlighted?"":"none")}}drawConnectionHighlightPath(e){let t,i,o=e.connectionModel;e=o.type===c5.INPUT_VALUE||o.type===c5.OUTPUT_VALUE?this.getExpressionConnectionHighlightPath(e):this.getStatementConnectionHighlightPath(e);let s=o.getSourceBlock();return null==(i=(t=s.pathObject).addConnectionHighlight)?void 0:i.call(t,o,e,o.getOffsetInBlock(),s.RTL)}getExpressionConnectionHighlightPath(e){let t="";return nb(e.shape)?t=e.shape.pathDown(e.height):nC(e.shape)&&(t=e.shape.pathDown),sV(0,-(e=this.constants_.TAB_OFFSET_FROM_TOP))+sX("v",e)+t+sX("v",e)}getStatementConnectionHighlightPath(e){if(!nO(e.shape))throw Error("Statement connections should have notch shapes");let t=this.constants_.NOTCH_OFFSET_LEFT-this.constants_.CORNER_RADIUS;return sV(-t,0)+sX("h",t)+e.shape.pathLeft+sX("h",t)}},uD=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 uS(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 u$(this.constants_),this.bottomRow=new uc(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 um(this.constants_);this.inputRows.push(e);var t=this.block_.getIcons();for(let i=0,o;o=t[i];i++){let t=new ug(this.constants_,o);this.isCollapsed&&!o.isShownWhenCollapsed()||e.elements.push(t)}t=void 0;for(let i=0,o;o=this.block_.inputList[i];i++)if(o.isVisible()){this.shouldStartNewRow_(o,t)&&(this.rows.push(e),e=new um(this.constants_),this.inputRows.push(e));for(let t=0,i;i=o.fieldRow[t];t++)e.elements.push(new up(this.constants_,i,o));this.addInput_(o,e),t=o}this.isCollapsed&&(e.hasJaggedEdge=!0,e.elements.push(new uf(this.constants_))),(e.elements.length||e.hasDummyInput)&&this.rows.push(e),this.populateBottomRow_(),this.rows.push(this.bottomRow)}populateTopRow_(){var e=!!this.block_.previousConnection;let t=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!e,i=this.topRow.hasLeftSquareCorner(this.block_)?uO:ub;this.topRow.elements.push(new i(this.constants_)),t?(e=new u_(this.constants_),this.topRow.elements.push(e)):e&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new uR(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0]instanceof hI&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT,i=this.topRow.hasRightSquareCorner(this.block_)?uO:ub,this.topRow.elements.push(new i(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 hI?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new uO(this.constants_)):this.bottomRow.elements.push(new ub(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new uI(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new uO(this.constants_,"right")):this.bottomRow.elements.push(new ub(this.constants_,"right"))}addInput_(e,t){this.isInline&&e instanceof $.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new uT(this.constants_,e)),t.hasInlineInput=!0):e instanceof hI?(t.elements.push(new uA(this.constants_,e)),t.hasStatement=!0):e instanceof $.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new ud(this.constants_,e)),t.hasExternalInput=!0):(e instanceof hm||e instanceof hf)&&(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),null===t.align&&(t.align=e.align)}shouldStartNewRow_(e,t){return!!t&&(t instanceof hf||e instanceof hI||t instanceof hI||(e instanceof $.ValueInput$$module$build$src$core$inputs$value_input||e instanceof hm||t instanceof $.ValueInput$$module$build$src$core$inputs$value_input)&&!this.isInline)}addElemSpacing_(){for(let e=0,t;t=this.rows[e];e++){let e=t.elements;if(t.elements=[],t.startsWithElemSpacer()&&t.elements.push(new uE(this.constants_,this.getInRowSpacing_(null,e[0]))),e.length){for(let i=0;i<e.length-1;i++){t.elements.push(e[i]);let o=this.getInRowSpacing_(e[i],e[i+1]);t.elements.push(new uE(this.constants_,o))}t.elements.push(e[e.length-1]),t.endsWithElemSpacer()&&t.elements.push(new uE(this.constants_,this.getInRowSpacing_(e[e.length-1],null)))}}}getInRowSpacing_(e,t){if(!e&&t&&ur.isStatementInput(t))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(e&&ur.isInput(e)&&!t){if(ur.isExternalInput(e))return this.constants_.NO_PADDING;if(ur.isInlineInput(e))return this.constants_.LARGE_PADDING;if(ur.isStatementInput(e))return this.constants_.NO_PADDING}return e&&ur.isLeftSquareCorner(e)&&t&&(ur.isPreviousConnection(t)||ur.isNextConnection(t))?t.notchOffset:e&&ur.isLeftRoundedCorner(e)&&t&&(ur.isPreviousConnection(t)||ur.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&ur.isField(e)&&0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING}computeBounds_(){let e=0,t=0,i=0;for(let s=0,n;n=this.rows[s];s++){if(n.measure(),t=Math.max(t,n.width),n.hasStatement){let t,i;var o=n.getLastInput();e=Math.max(e,o=n.width-(null!=(i=null==(t=o)?void 0:t.width)?i:0))}i=Math.max(i,n.widthWithConnectedBlocks)}this.statementEdge=e,this.width=t;for(let e=0,t;t=this.rows[e];e++)t.hasStatement&&(t.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(t,i),this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)}alignRowElements_(){for(let t=0,i;i=this.rows[t];t++)if(i.hasStatement)this.alignStatementRow_(i);else{var e=i.width;(e=this.getDesiredRowWidth_(i)-e)>0&&this.addAlignmentPadding_(i,e),ur.isTopOrBottomRow(i)&&(i.widthWithConnectedBlocks=i.width)}}getDesiredRowWidth_(e){return this.width-this.startX}addAlignmentPadding_(e,t){let i=e.getFirstSpacer(),o=e.getLastSpacer();if((e.hasExternalInput||e.hasStatement)&&(e.widthWithConnectedBlocks+=t),e.align===$.Align$$module$build$src$core$inputs$align.LEFT&&o)o.width+=t;else if(e.align===$.Align$$module$build$src$core$inputs$align.CENTRE&&i&&o)i.width+=t/2,o.width+=t/2;else if(e.align===$.Align$$module$build$src$core$inputs$align.RIGHT&&i)i.width+=t;else{if(!o)return;o.width+=t}e.width+=t}alignStatementRow_(e){let t=e.getLastInput();if(t){var i=e.width-t.width,o=this.statementEdge;(i=o-i)>0&&this.addAlignmentPadding_(e,i),i=e.width,o=this.getDesiredRowWidth_(e),t.width+=o-i,t.height=Math.max(t.height,e.height),e.width+=o-i,e.widthWithConnectedBlocks=Math.max(e.width,this.statementEdge+e.connectedBlockWidths)}}addRowSpacing_(){let 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 i=this.getSpacerRowHeight_(e,t);let o=this.getSpacerRowWidth_(e,t);return i=new uC(this.constants_,i,o),e.hasStatement&&(i.followsStatement=!0),t.hasStatement&&(i.precedesStatement=!0),i}getSpacerRowWidth_(e,t){return this.width-this.startX}getSpacerRowHeight_(e,t){return this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){return ur.isSpacer(t)?e.yPos+t.height/2:ur.isBottomRow(e)?(e=e.yPos+e.height-e.descenderHeight,ur.isNextConnection(t)?e+t.height/2:e-t.height/2):ur.isTopRow(e)?ur.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 i=0,o;o=e.elements[i];i++)ur.isSpacer(o)&&(o.height=e.height),o.xPos=t,o.centerline=this.getElemCenterline_(e,o),t+=o.width}finalize_(){let e=0,t=0;for(let i=0,o;o=this.rows[i];i++)o.yPos=t,o.xPos=this.startX,t+=o.height,e=Math.max(e,o.widthWithConnectedBlocks),this.recordElemPositions_(o);if(this.outputConnection&&this.block_.nextConnection){let t=this.block_.nextConnection.targetBlock();t&&(e=Math.max(e,t.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((null==(t=this.outputConnection)?void 0:t.connectionModel)===e)return this.outputConnection;for(let t of this.rows)for(let i of t.elements)if(i instanceof uh&&i.connectionModel===e)return i;return null}},uk=class{constructor(e,t,i){this.connectionHighlights=new WeakMap,this.highlightOffsets=new WeakMap,this.constants=i,this.style=t,this.svgRoot=e,this.svgPath=eZ(li.PATH,{class:"blocklyPath"},this.svgRoot),this.setClass_("blocklyBlock",!0)}setPath(e){this.svgPath.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)")}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?eq(this.svgRoot,e):e0(this.svgRoot,e))}updateHighlighted(e){e?this.setClass_("blocklyHighlighted",!0):this.setClass_("blocklyHighlighted",!1)}updateShadow_(e){e?(this.setClass_("blocklyShadow",!0),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary)):this.setClass_("blocklyShadow",!1)}updateDisabled_(e){this.setClass_("blocklyDisabled",e),this.setClass_("blocklyDisabledPattern",e)}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,i,o){return(i=`translate(${i.x}, ${i.y})`+(o?" scale(-1 1)":""),o=this.connectionHighlights.get(e))?(o.setAttribute("d",t),o.setAttribute("transform",i),o):(t=eZ(li.PATH,{id:e.id,class:"blocklyHighlightedConnectionPath",style:"display: none;",d:t,transform:i},this.svgRoot),this.connectionHighlights.set(e,t),t)}removeConnectionHighlight(e){let t=this.connectionHighlights.get(e);t&&(e2(t),this.connectionHighlights.delete(e))}},uw=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,i){this.constants_.createDom(e,this.name+"-"+t.name,"."+this.getClassName()+"."+t.getClassName(),i)}refreshDom(e,t,i){let 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,i)}dispose(){this.constants_&&this.constants_.dispose()}makeConstants_(){return new uN}makeRenderInfo_(e){return new uD(this,e)}makeDrawer_(e,t){return new uy(e,t)}makePathObject(e,t){return new uk(e,t,this.constants_)}getConstants(){return this.constants_}shouldHighlightConnection(e){return!0}orphanCanConnectAtEnd(e,t,i){return!!hl.getConnectionForOrphanedConnection(e,i===c5.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}render(e){let t=this.makeRenderInfo_(e);t.measure(),this.makeDrawer_(e,t).draw()}},uM={};uM.BottomRow=uc,uM.Connection=uh,uM.ConstantProvider=uN,uM.Drawer=uy,uM.ExternalValueInput=ud,uM.Field=up,uM.Hat=u_,uM.Icon=ug,uM.InRowSpacer=uE,uM.InlineInput=uT,uM.InputConnection=uu,uM.InputRow=um,uM.JaggedEdge=uf,uM.Measurable=ul,uM.NextConnection=uI,uM.OutputConnection=uS,uM.PathObject=uk,uM.PreviousConnection=uR,uM.RenderInfo=uD,uM.Renderer=uw,uM.RoundCorner=ub,uM.Row=ua,uM.SpacerRow=uC,uM.SquareCorner=uO,uM.StatementInput=uA,uM.TopRow=u$,uM.Types=ur,uM.init=n$,uM.register=nA,uM.unregister=function(e){eh(D.RENDERER,e)};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())&&e0(e,t),(t=this.theme.getClassName())&&eq(e,t));for(let e=0,t;t=this.subscribedWorkspaces[e];e++)t.refreshTheme();for(let[i,o]of this.componentDB)for(let s of o){e=s.element,t=s.propertyName;let o=this.theme&&this.theme.getComponentStyle(i);e.style.setProperty(t,o||"")}for(let e of this.subscribedWorkspaces)e.hideChaff()}subscribeWorkspace(e){this.subscribedWorkspaces.push(e)}unsubscribeWorkspace(e){if(!tm(this.subscribedWorkspaces,e))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.")}subscribe(e,t,i){this.componentDB.has(t)||this.componentDB.set(t,[]),this.componentDB.get(t).push({element:e,propertyName:i}),t=this.theme&&this.theme.getComponentStyle(t),e.style.setProperty(i,t||"")}unsubscribe(e){if(e)for(let[t,i]of this.componentDB){for(let t=i.length-1;t>=0;t--)i[t].element===e&&i.splice(t,1);i.length||this.componentDB.delete(t)}}dispose(){this.subscribedWorkspaces.length=0,this.componentDB.clear()}},uP="VARIABLE_DYNAMIC",uB={CATEGORY_NAME:uP};uB.flyoutCategory=nk,uB.flyoutCategoryBlocks=nM,uB.internalFlyoutCategory=nD,uB.onCreateVariableButtonClick_Colour=ny,uB.onCreateVariableButtonClick_Number=nL,uB.onCreateVariableButtonClick_String=nN;var ux=class{canConnect(e,t,i,o){return this.canConnectWithReason(e,t,i,o)===hl.CAN_CONNECT}canConnectWithReason(e,t,i,o){let s=this.doSafetyChecks(e,t);return s!==hl.CAN_CONNECT?s:this.doTypeChecks(e,t)?i&&!this.doDragChecks(e,t,o||0)?hl.REASON_DRAG_CHECKS_FAILED:hl.CAN_CONNECT:hl.REASON_CHECKS_FAILED}getErrorMessage(e,t,i){switch(e){case hl.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case hl.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case hl.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case hl.REASON_TARGET_NULL:return"Target connection is null.";case hl.REASON_CHECKS_FAILED:return"Connection checks failed. "+(t+" expected "+t.getCheck())+", found "+i.getCheck();case hl.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case hl.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case hl.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){let i,o,s;return e&&t?(e.isSuperior()?(i=e.getSourceBlock(),o=t.getSourceBlock(),s=t):(o=e.getSourceBlock(),i=t.getSourceBlock(),s=e,e=t),i===o?hl.REASON_SELF_CONNECTION:s.type!==hu[e.type]?hl.REASON_WRONG_TYPE:i.workspace!==o.workspace?hl.REASON_DIFFERENT_WORKSPACES:i.isShadow()&&!o.isShadow()?hl.REASON_SHADOW_PARENT:s.type===c5.OUTPUT_VALUE&&o.previousConnection&&o.previousConnection.isConnected()||s.type===c5.PREVIOUS_STATEMENT&&o.outputConnection&&o.outputConnection.isConnected()?hl.REASON_PREVIOUS_AND_OUTPUT:hl.CAN_CONNECT):hl.REASON_TARGET_NULL}doTypeChecks(e,t){if(e=e.getCheck(),t=t.getCheck(),!e||!t)return!0;for(let i=0;i<e.length;i++)if(t.includes(e[i]))return!0;return!1}doDragChecks(e,t,i){if(e.distanceFrom(t)>i||t.getSourceBlock().isInsertionMarker())return!1;switch(t.type){case c5.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case c5.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case c5.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case c5.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!rj.includes(t)}canConnectToPrevious_(e,t){return!(e.targetConnection||rj.includes(t))&&(!t.targetConnection||!!(e=t.targetBlock()).isInsertionMarker()&&!e.getPreviousBlock())}};ea(D.CONNECTION_CHECKER,y,ux);var uF=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 un,this.readOnly=!1,this.potentialVariableMap=null,this.id=eD(),tn(this),this.options=e||new c9({}),this.RTL=!!this.options.RTL,this.horizontalLayout=!!this.options.horizontalLayout,this.toolboxPosition=this.options.toolboxPosition,this.connectionChecker=new(eE(D.CONNECTION_CHECKER,this.options,!0))(this),this.variableMap=new(this.getVariableMapClass())(this),this.setIsReadOnly(this.options.readOnly)}dispose(){this.listeners.length=0,this.clear(),tr(this)}sortObjects(e,t){let i=e=>({getBoundingRectangle:()=>{let t=e.getRelativeToSurfaceXY();return new lo(t.y,t.y,t.x,t.x)},moveBy:()=>{}});return this.sortByOrigin(i(e),i(t))}sortByOrigin(e,t){let i=Math.sin(i2(uF.SCAN_ANGLE))*(this.RTL?-1:1);return e=e.getBoundingRectangle().getOrigin(),t=t.getBoundingRectangle().getOrigin(),e.y+i*e.x-(t.y+i*t.x)}addTopBlock(e){this.topBlocks.push(e)}removeTopBlock(e){if(!tm(this.topBlocks,e))throw Error("Block not present in workspace's list of top-most blocks.")}getTopBlocks(e=!1){let t=[].concat(this.topBlocks);return e&&t.length>1&&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){tm(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&&e.length>1&&e.sort(this.sortObjects.bind(this)),e.filter(e=>!e.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(!tm(this.topComments,e))throw Error("Comment not present in workspace's list of top-most comments.");this.commentDB.delete(e.id)}getTopComments(e=!1){let t=[].concat(this.topComments);return e&&t.length>1&&t.sort(this.sortObjects.bind(this)),t}getAllBlocks(e=!1){if(e){var t=this.getTopBlocks(!0);e=[];for(let i=0;i<t.length;i++)e.push(...t[i].getDescendants(!0))}else for(e=this.getTopBlocks(!1),t=0;t<e.length;t++)e.push(...e[t].getChildren(!1));return e.filter(e=>!e.isInsertionMarker())}clear(){this.isClearing=!0;try{let e=$.getGroup$$module$build$src$core$events$utils();for(e||$.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();$.setGroup$$module$build$src$core$events$utils(e),this.isFlyout||this.variableMap.clear(),this.potentialVariableMap&&this.potentialVariableMap.clear()}finally{this.isClearing=!1}}renameVariableById(e,t){ih("Blockly.Workspace.renameVariableById","v12","v13","Blockly.Workspace.getVariableMap().renameVariable"),(e=this.variableMap.getVariableById(e))&&this.variableMap.renameVariable(e,t)}createVariable(e,t,i){return ih("Blockly.Workspace.createVariable","v12","v13","Blockly.Workspace.getVariableMap().createVariable"),this.variableMap.createVariable(e,null!=t?t:void 0,null!=i?i:void 0)}getVariableUsesById(e){return ih("Blockly.Workspace.getVariableUsesById","v12","v13","Blockly.Workspace.getVariableMap().getVariableUsesById"),iD(this,e)}deleteVariableById(e){ih("Blockly.Workspace.deleteVariableById","v12","v13","Blockly.Workspace.getVariableMap().deleteVariable");let t=this.variableMap.getVariableById(e);t?$.deleteVariable$$module$build$src$core$variables(this,t):console.warn(`Can't delete non-existent variable: ${e}`)}getVariable(e,t){return ih("Blockly.Workspace.getVariable","v12","v13","Blockly.Workspace.getVariableMap().getVariable"),this.variableMap.getVariable(e,t)}getVariableById(e){return ih("Blockly.Workspace.getVariableById","v12","v13","Blockly.Workspace.getVariableMap().getVariableById"),this.variableMap.getVariableById(e)}getVariablesOfType(e){return ih("Blockly.Workspace.getVariablesOfType","v12","v13","Blockly.Workspace.getVariableMap().getVariablesOfType"),this.variableMap.getVariablesOfType(null!=e?e:"")}getAllVariables(){return ih("Blockly.Workspace.getAllVariables","v12","v13","Blockly.Workspace.getVariableMap().getAllVariables"),this.variableMap.getAllVariables()}getAllVariableNames(){return ih("Blockly.Workspace.getAllVariableNames","v12","v13","Blockly.Workspace.getVariableMap().getAllVariables"),this.variableMap.getAllVariables().map(e=>e.getName())}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?(void 0!==this.options.maxInstances[e]?this.options.maxInstances[e]:1/0)-this.getBlocksByType(e,!1).length:1/0}isCapacityAvailable(e){if(!this.hasBlockLimits())return!0;let t=0;for(let i in e){if(e[i]>this.remainingCapacityOfType(i))return!1;t+=e[i]}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_,i=e?this.undoStack_:this.redoStack_;let o=t.pop();if(o){for(var s=[o];t.length&&o.group&&o.group===t[t.length-1].group;){let e=t.pop();e&&s.push(e)}for(t=0;t<s.length;t++)i.push(s[t]);$.setRecordUndo$$module$build$src$core$events$utils(!1);try{for(i=0;i<s.length;i++)s[i].run(e)}finally{$.setRecordUndo$$module$build$src$core$events$utils(!0)}}}clearUndo(){this.undoStack_.length=0,this.redoStack_.length=0,eK()}addChangeListener(e){return this.listeners.push(e),e}removeChangeListener(e){tm(this.listeners,e)}fireChangeListener(e){if(e.recordUndo)for(this.undoStack_.push(e),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&this.MAX_UNDO>=0;)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 null!=(t=this.commentDB.get(e))?t:null}allInputsFilled(e){let t=this.getTopBlocks(!1);for(let i=0;i<t.length;i++)if(!t[i].allInputsFilled(e))return!1;return!0}getPotentialVariableMap(){return this.potentialVariableMap}createPotentialVariableMap(){this.potentialVariableMap=new(this.getVariableMapClass())(this,!0)}getVariableMap(){return this.variableMap}setVariableMap(e){this.variableMap=e}getProcedureMap(){return this.procedureMap}getRootWorkspace(){let e=null,t=this.options.parentWorkspace;return this.isFlyout?t&&t.options&&(e=t.options.parentWorkspace):t&&(e=t),e}static getById(e){return to(e)}static getAll(){return ts()}getVariableMapClass(){let e=eE(D.VARIABLE_MAP,this.options,!0);if(!e)throw Error("No variable map is registered.");return e}isReadOnly(){return this.readOnly}setIsReadOnly(e){this.readOnly=e,this.options.readOnly=e}};uF.SCAN_ANGLE=3;var uG=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 i=new globalThis.Audio}catch(e){return}for(let t=0;t<e.length;t++){let s=e[t],n=s.match(/\.(\w+)$/);if(n&&i.canPlayType("audio/"+n[1])){var o=new globalThis.Audio(s);break}}o&&this.sounds.set(t,o)}}preload(){for(let e of this.sounds.values()){e.volume=.01;let t=e.play();if(void 0!==t?t.then(e.pause).catch(function(){}):e.pause(),rO||rA)break}}play(e,t){if(!this.muted){var i=this.sounds.get(e);i?(e=new Date,null!==this.lastSound&&e.getTime()-this.lastSound.getTime()<100||(this.lastSound=e,(i=rO||rC?i:i.cloneNode()).volume=void 0===t?1:t,i.play())):this.parentWorkspace&&this.parentWorkspace.getAudioManager().play(e,t)}}setMuted(e){this.muted=e}getMuted(){return this.muted}},uH=class extends uF{constructor(e){let t;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.keyboardMoveInProgress=this.keyboardAccessibilityMode=!1,this.topBoundedElements=[],this.dragTargetAreas=[],this.zoomControls_=this.layerManager=null,this.navigator=new hJ,this.metricsManager=new(eE(D.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager),this.setMetrics=e.setMetrics||uH.setTopLevelWorkspaceMetrics,this.componentManager=new r6,this.connectionDBList=cj.init(this.connectionChecker),this.audioManager=new uG(e.parentWorkspace),this.grid=this.options.gridPattern?new h4(this.options.gridPattern,e.gridOptions):null,this.markerManager=new ue(this),ap&&iu&&this.registerToolboxCategoryCallback(ah,iu),uB&&nD&&this.registerToolboxCategoryCallback(uP,nD),dX&&nE&&(this.registerToolboxCategoryCallback(dY,nE),this.addChangeListener(nf)),this.addChangeListener(this.variableChangeCallback.bind(this)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new uv(this,this.options.theme||c8),this.themeManager_.subscribeWorkspace(this),this.renderer=n$(this.options.renderer||"geras",this.getTheme(),null!=(t=this.options.rendererOverrides)?t:void 0),this.cachedParentSvgSize=new ls(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}getMarker(e){return this.markerManager.getMarker(e)}getCursor(){return this.markerManager.getCursor()}getRenderer(){return this.renderer}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(e){e||(e=c8),this.themeManager_.setTheme(e)}refreshTheme(){if(this.svgGroup_){var e=null===this.options.parentWorkspace;this.renderer.refreshDom(this.svgGroup_,this.getTheme(),e?this.getInjectionDiv():void 0)}this.updateBlockStyles(this.getAllBlocks(!1).filter(e=>!!e.getStyleName())),this.refreshToolboxSelection(),this.toolbox&&this.toolbox.refreshTheme(),this.isVisible()&&this.setVisible(!0),eH(e=new(ej(rL.THEME_CHANGE))(this.getTheme().name,this.id))}updateBlockStyles(e){for(let t=0,i;i=e[t];t++){let e=i.getStyleName();e&&i.setStyle(e)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){let 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,i=0,o=1;(this.getCanvas().contains(e)||this.getBubbleCanvas().contains(e))&&(o=this.scale);do{let s=tL(e);(e===this.getCanvas()||e===this.getBubbleCanvas())&&(o=1),t+=s.x*o,i+=s.y*o,e=e.parentNode}while(e&&e!==this.getParentSvg()&&e!==this.getInjectionDiv())return new lt(t,i)}getCachedParentSvgSize(){let e=this.cachedParentSvgSize;return new ls(e.width,e.height)}getOriginOffsetInPixels(){return ty(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=null!=t?t:null),this.svgGroup_=eZ(li.G,{class:"blocklyWorkspace",id:this.id}),t&&t2(this.svgGroup_,aD.LABEL,$.Msg$$module$build$src$core$msg.WORKSPACE_ARIA_LABEL),e&&(this.svgBackground_=eZ(li.RECT,{height:"100%",width:"100%",class:e},this.svgGroup_),"blocklyMainBackground"===e&&this.grid?this.svgBackground_.style.fill="var(--blocklyGridPattern)":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill")),this.layerManager=new h8(this),this.svgBlockCanvas_=this.layerManager.getBlockLayer(),this.svgBubbleCanvas_=this.layerManager.getBubbleLayer(),this.isFlyout||(eb(this.svgGroup_,"pointerdown",this,this.onMouseDown,!1),this.dummyWheelListener=()=>{},document.body.addEventListener("wheel",this.dummyWheelListener),eb(this.svgGroup_,"wheel",this,this.onMouseWheel)),this.options.hasCategories&&(this.toolbox=new(eE(D.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=eE(D.CURSOR,this.options))&&this.markerManager.setCursor(new e(this)),e=null===this.options.parentWorkspace,this.renderer.createDom(this.svgGroup_,this.getTheme(),e?this.getInjectionDiv():void 0),$.getFocusManager$$module$build$src$core$focus_manager().registerTree(this,!!this.injectionDiv||this.isFlyout),this.svgGroup_}dispose(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&e2(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.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){let e=this.getParentSvg();e&&e.parentNode&&e2(e.parentNode)}this.resizeHandlerWrapper&&(eO(this.resizeHandlerWrapper),this.resizeHandlerWrapper=null),this.dummyWheelListener&&(document.body.removeEventListener("wheel",this.dummyWheelListener),this.dummyWheelListener=null),$.getFocusManager$$module$build$src$core$focus_manager().isRegistered(this)&&$.getFocusManager$$module$build$src$core$focus_manager().unregisterTree(this)}addTrashcan(){this.trashcan=uH.newTrashcan(this);let 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 lN(this);let e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}copyOptionsForFlyout(){return new c9({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,plugins:this.options.plugins,modalInputs:this.options.modalInputs,move:{scrollbars:!0}})}addFlyout(e){let t=this.copyOptionsForFlyout();return t.toolboxPosition=this.options.toolboxPosition,this.flyout=this.horizontalLayout?new(eE(D.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(eE(D.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();let e=this.componentManager.getComponents(r6.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),i=[];for(let o=0,s;s=e[o];o++){s.position(t,i);let e=s.getBoundingRectangle();e&&i.push(e)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations()}updateScreenCalculationsIfScrolled(){let e=tk();lt.equals(this.lastRecordedPageScroll,e)||(this.lastRecordedPageScroll=e,this.updateScreenCalculations())}getLayerManager(){return this.layerManager}getCanvas(){return this.layerManager.getBlockLayer()}setCachedParentSvgSize(e,t){let i=this.getParentSvg();null!=e&&(this.cachedParentSvgSize.width=e,i.setAttribute("data-cached-width",`${e}`)),null!=t&&(this.cachedParentSvgSize.height=t,i.setAttribute("data-cached-height",`${t}`))}getBubbleCanvas(){return this.layerManager.getBubbleLayer()}getParentSvg(){if(!this.cachedParentSvg){let e=this.svgGroup_;for(;e;){if("svg"===e.tagName){this.cachedParentSvg=e;break}e=e.parentNode}}return this.cachedParentSvg}maybeFireViewportChangeEvent(){if(eY()){var e=this.scale,t=-this.scrollY,i=-this.scrollX;if(!(e===this.oldScale&&1>Math.abs(t-this.oldTop)&&1>Math.abs(i-this.oldLeft))){var o=new(ej(rL.VIEWPORT_CHANGE))(t,i,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=t,this.oldLeft=i,eH(o)}}}translate(e,t){let i,o;null==(i=this.layerManager)||i.translateLayers(new lt(e,t),this.scale),null==(o=this.grid)||o.moveTo(e,t),this.maybeFireViewportChangeEvent()}getWidth(){let 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(){let e=this.getAllBlocks(!1);for(let t=e.length-1;t>=0;t--)e[t].queueRender();this.getTopBlocks().flatMap(e=>e.getDescendants(!1)).filter(e=>e.isInsertionMarker()).forEach(e=>e.queueRender())}highlightBlock(e,t){if(void 0===t){for(let e=0,t;t=this.highlightedBlocks[e];e++)t.setHighlighted(!1);this.highlightedBlocks.length=0}(e=e?this.getBlockById(e):null)&&((t=void 0===t||t)?this.highlightedBlocks.includes(e)||this.highlightedBlocks.push(e):tm(this.highlightedBlocks,e),e.setHighlighted(t))}variableChangeCallback(e){switch(e.type){case rL.VAR_CREATE:case rL.VAR_DELETE:case rL.VAR_RENAME:case rL.VAR_TYPE_CHANGE:this.refreshToolboxSelection()}}refreshToolboxSelection(){let e=this.isFlyout?this.targetWorkspace:this;e&&!e.currentGesture_&&e.toolbox&&e.toolbox.getFlyout()&&e.toolbox.refreshSelection()}recordDragTargets(){let e=this.componentManager.getComponents(r6.Capability.DRAG_TARGET,!0);this.dragTargetAreas=[];for(let t=0,i;i=e[t];t++){let e=i.getClientRect();e&&this.dragTargetAreas.push({component:i,clientRect:e})}}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,i;i=this.dragTargetAreas[t];t++)if(i.clientRect.contains(e.clientX,e.clientY))return i.component;return null}onMouseDown(e){let t=this.getGesture(e);t&&t.handleWsStart(e,this)}startDrag(e,t){sr(this,e,t)}moveDrag(e){return sl(this,e)}setKeyboardMoveInProgress(e){this.keyboardMoveInProgress=e}isDragging(){return this.keyboardMoveInProgress||null!==this.currentGesture_&&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(){let e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){let e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollVertically())}onMouseWheel(e){if(h6.inProgress())e.preventDefault(),e.stopPropagation();else{var t=this.options.zoomOptions&&this.options.zoomOptions.wheel,i=this.options.moveOptions&&this.options.moveOptions.wheel;if(t||i){var o=eL(e);if(V)var s=e.metaKey;t&&(e.ctrlKey||s||!i)?(o=-o.y/50,t=eN(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(t.x,t.y,o)):(t=this.scrollX-o.x,i=this.scrollY-o.y,e.shiftKey&&!o.x&&(t=this.scrollX-o.y,i=this.scrollY),this.scroll(t,i)),e.preventDefault()}}}getBlocksBoundingBox(){let e=this.getTopBoundedElements();if(!e.length)return new lo(0,0,0,0);let t=e[0].getBoundingRectangle();for(let o=1;o<e.length;o++){var i=e[o];i.isInsertionMarker&&i.isInsertionMarker()||((i=i.getBoundingRectangle()).top<t.top&&(t.top=i.top),i.bottom>t.bottom&&(t.bottom=i.bottom),i.left<t.left&&(t.left=i.left),i.right>t.right&&(t.right=i.right))}return t}cleanUp(){this.setResizesEnabled(!1),$.setGroup$$module$build$src$core$events$utils(!0);var e=this.getTopBlocks(!0),t=e.filter(e=>e.isMovable());let i=e.filter(e=>!e.isMovable()).map(e=>e.getBoundingRectangle());e=function(e){for(let t of i)if(e.intersects(t))return t;return null};var o=0;let s=this.renderer.getConstants().MIN_BLOCK_HEIGHT;for(let i of t){for(t=i.getBoundingRectangle(),i.moveBy(-t.left,o-t.top,["cleanup"]),i.snapToGrid(),o=e(t=i.getBoundingRectangle());null!=o;)o=o.top+o.getHeight()+s,i.moveBy(0,o-t.top,["cleanup"]),i.snapToGrid(),o=e(t=i.getBoundingRectangle());o=i.getRelativeToSurfaceXY().y+i.getHeightWidth().height+s}$.setGroup$$module$build$src$core$events$utils(!1),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.isReadOnly()&&!this.isFlyout){var t=cN.registry.getContextMenuOptions({workspace:this,focusedNode:this},e);this.configureContextMenu&&this.configureContextMenu(t,e);var i=e instanceof PointerEvent?new lt(e.clientX,e.clientY):tM(this,new lt(5,5));o9(e,t,this.RTL,this,i)}}updateToolbox(e){if(e=tB(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(tG(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():(ta(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(e,t,i){i=Math.pow(this.options.zoomOptions.scaleSpeed,i);let o=this.scale*i;if(this.scale!==o){o>this.options.zoomOptions.maxScale?i=this.options.zoomOptions.maxScale/this.scale:o<this.options.zoomOptions.minScale&&(i=this.options.zoomOptions.minScale/this.scale);var s=this.getCanvas().getCTM(),n=this.getParentSvg().createSVGPoint();n.x=e,n.y=t,e=(n=n.matrixTransform(s.inverse())).x,t=n.y,s=s.translate(e*(1-i),t*(1-i)).scale(i),this.scrollX=s.e,this.scrollY=s.f,this.setScale(o)}}zoomCenter(e){let t;var i=this.getMetrics();this.flyout?(t=i.svgWidth?i.svgWidth/2:0,i=i.svgHeight?i.svgHeight/2:0):(t=i.viewWidth/2+i.absoluteLeft,i=i.viewHeight/2+i.absoluteTop),this.zoom(t,i,e)}zoomToFit(){if(this.isMovable()){var e=this.getMetrics(),t=e.viewWidth;e=e.viewHeight;var i=this.getBlocksBoundingBox(),o=i.right-i.left+40;if(i=i.bottom-i.top+40,o){this.flyout&&(this.horizontalLayout?(e+=this.flyout.getHeight(),i+=this.flyout.getHeight()/this.scale):(t+=this.flyout.getWidth(),o+=this.flyout.getWidth()/this.scale)),t/=o,e/=i,$.disable$$module$build$src$core$events$utils();try{this.setScale(Math.min(t,e)),this.scrollCenter()}finally{$.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(){eq(this.getCanvas(),"blocklyCanvasTransitioning"),eq(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}endCanvasTransition(){e0(this.getCanvas(),"blocklyCanvasTransitioning"),e0(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}scrollCenter(){if(this.isMovable()){var e=this.getMetrics(),t=(e.scrollWidth-e.viewWidth)/2,i=(e.scrollHeight-e.viewHeight)/2;t=-t-e.scrollLeft,i=-i-e.scrollTop,this.scroll(t,i)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}centerOnBlock(e,t){if(this.isMovable()){var i=e?this.getBlockById(e):null;if(i){e=i.getRelativeToSurfaceXY(),i=t?{height:i.height,width:i.width}:i.getHeightWidth();var o=this.scale;t=(e.x+(this.RTL?-1:1)*i.width/2)*o,e=(e.y+i.height/2)*o,i=this.getMetrics(),this.scroll(-(t-i.viewWidth/2),-(e-i.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.scale}getAbsoluteScale(){let e=e=>{if(e.isFlyout){let t,i=null==(t=e.targetWorkspace)?void 0:t.getFlyout();if(i instanceof h0)return i.getFlyoutScale()}return e.getScale()},t=(i,o)=>i.options.parentWorkspace&&i.options.parentWorkspace.getSvgGroup().contains(i.getSvgGroup())?t(i.options.parentWorkspace,o*e(i)):o*e(i);return t(this,1)}scroll(e,t){this.hideChaff(!0);let i=this.getMetrics();e=Math.min(e,-i.scrollLeft),t=Math.min(t,-i.scrollTop);let o=i.scrollTop+Math.max(0,i.scrollHeight-i.viewHeight);e=Math.max(e,-(i.scrollLeft+Math.max(0,i.scrollWidth-i.viewWidth))),t=Math.max(t,-o),this.scrollX=e,this.scrollY=t,this.scrollbar&&this.scrollbar.set(-(e+i.scrollLeft),-(t+i.scrollTop),!1),e+=i.absoluteLeft,t+=i.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)}getTopComments(e=!1){return super.getTopComments(e)}getCommentById(e){return super.getCommentById(e)}getRootWorkspace(){return super.getRootWorkspace()}addTopBoundedElement(e){this.topBoundedElements.push(e)}removeTopBoundedElement(e){tm(this.topBoundedElements,e)}getTopBoundedElements(e=!1){let t=[].concat(this.topBoundedElements);return e&&t.sort(this.sortByOrigin.bind(this)),t}setResizesEnabled(e){let 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("function"!=typeof t)throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks.set(e,t)}getButtonCallback(e){let t;return null!=(t=this.flyoutButtonCallbacks.get(e))?t:null}removeButtonCallback(e){this.flyoutButtonCallbacks.delete(e)}registerToolboxCategoryCallback(e,t){if("function"!=typeof t)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){let t;if(this.keyboardMoveInProgress)return e.preventDefault(),e.stopPropagation(),null;let i="pointerdown"===e.type;return i&&(null==(t=this.currentGesture_)?0:t.hasStarted())&&(console.warn("Tried to start the same gesture twice."),this.currentGesture_.cancel()),!this.currentGesture_&&i&&(this.currentGesture_=new h6(e,this)),this.currentGesture_}clearGesture(){this.currentGesture_=null}cancelCurrentGesture(){this.currentGesture_&&this.currentGesture_.cancel()}getAudioManager(){return this.audioManager}getGrid(){return this.grid}hideChaff(e=!1){oy(),o1(this),ou(),this.hideComponents(e)}hideComponents(e=!1){this.getComponentManager().getComponents(r6.Capability.AUTOHIDEABLE,!0).forEach(t=>t.autoHide(e))}static setTopLevelWorkspaceMetrics(e){let t=this.getMetrics();"number"==typeof e.x&&(this.scrollX=-(t.scrollLeft+(t.scrollWidth-t.viewWidth)*e.x)),"number"==typeof e.y&&(this.scrollY=-(t.scrollTop+(t.scrollHeight-t.viewHeight)*e.y)),this.translate(this.scrollX+t.absoluteLeft,this.scrollY+t.absoluteTop)}addClass(e){this.injectionDiv&&eq(this.injectionDiv,e)}removeClass(e){this.injectionDiv&&e0(this.injectionDiv,e)}setIsReadOnly(e){super.setIsReadOnly(e),e?this.addClass("blocklyReadOnly"):this.removeClass("blocklyReadOnly")}scrollBoundsIntoView(e,t=10){if(!h6.inProgress()){var i=this.getScale(),o=this.getMetricsManager().getViewMetrics(!0);if(o=new lo(o.top,o.top+o.height,o.left,o.left+o.width),!(e.left>=o.left&&e.top>=o.top&&e.right<=o.right&&e.bottom<=o.bottom)){e=e.clone(),e.top-=t,e.bottom+=t,e.left-=t,e.right+=t;var s=t=0;e.left<o.left?t=this.RTL?Math.min(o.left-e.left,o.right-e.right):o.left-e.left:e.right>o.right&&(t=this.RTL?o.right-e.right:Math.max(o.right-e.right,o.left-e.left)),e.top<o.top?s=o.top-e.top:e.bottom>o.bottom&&(s=Math.max(o.bottom-e.bottom,o.top-e.top)),this.scroll(this.scrollX+t*i,this.scrollY+s*i)}}}getFocusableElement(){return this.svgGroup_}getFocusableTree(){return this.isMutator&&this.options.parentWorkspace||this}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getRootFocusableNode(){return this}getRestoredFocusableNode(e){let t;return e?null:null!=(t=this.getTopBlocks(!0)[0])?t:null}getNestedTrees(){let e=this.getAllBlocks().map(e=>e.getIcons()).flat().filter(e=>e instanceof $.MutatorIcon$$module$build$src$core$icons$mutator_icon&&e.bubbleIsVisible()).map(e=>{let t;return null==(t=e.getBubble())?void 0:t.getWorkspace()}).filter(e=>!!e),t=this.getFlyout(!0);return t&&e.push(t.getWorkspace()),e}searchForWorkspaceComment(e){for(let t of this.getTopComments())if(t instanceof cW&&t.canBeFocused()&&t.getFocusableElement().id===e)return t}lookUpFocusableNode(e){let t=null==(o=this.targetWorkspace)?void 0:o.getFlyout();if(this.isFlyout&&t){for(var i of t.getContents())if(te(o=i.getElement())&&o.canBeFocused()&&o.getFocusableElement().id===e)return o}if(i=e.indexOf("_field_"),o=e.indexOf("_connection_"),-1!==i){var o,s,n=e.substring(0,i);if(n=this.getBlockById(n)){for(var r of n.getFields())if(r.canBeFocused()&&r.getFocusableElement().id===e)return r}return null}if(-1!==o){if(n=e.substring(0,o),n=this.getBlockById(n)){for(let t of n.getConnections_(!0))if(t.id===e)return t}return null}if(-1!==(r=Math.max(e.indexOf(cB),e.indexOf(cv),e.indexOf(cF)))&&(r=e.substring(0,r),r=this.searchForWorkspaceComment(r)))return e.indexOf(cB)>-1?r.getEditorFocusableNode():null!=(s=r.view.getCommentBarButtons().find(t=>t.getFocusableElement().id.includes(e)))?s:null;if((s=this.getAllBlocks(!1).find(t=>t.getFocusableElement().id===e))||(s=this.searchForWorkspaceComment(e)))return s;for(n of s=this.getAllBlocks().map(e=>e.getIcons()).flat()){if(n.canBeFocused()&&n.getFocusableElement().id===e)return n;if(i1(n)&&(s=n.getBubble())&&s.canBeFocused()&&s.getFocusableElement().id===e)return s}return null}onTreeFocus(e,t){}onTreeBlur(e){if(this.isFlyout&&this.targetWorkspace&&!$.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()){var t=this.targetWorkspace.getFlyout(),i=this.targetWorkspace.getToolbox();i&&e===i||(i&&i.clearSelection(),t&&nl(t)&&t.autoHide(!1))}}getNavigator(){return this.navigator}setNavigator(e){this.navigator=e}},uU={};uU.WorkspaceSvg=uH,uU.resizeSvgContents=function(e){e.resizeContents()};var uW=class extends rQ{constructor(e){super(),this.isBlank=void 0===e,e&&(this.varId=e.getId(),this.workspaceId=e.getWorkspace().id)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new uW)).varId=e.varId,t}},uV=class extends uW{constructor(e){super(e),this.type=rL.VAR_CREATE,e&&(this.varType=e.getType(),this.varName=e.getName())}toJson(){let e=super.toJson();if(void 0===this.varType)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,i){return(t=super.fromJson(e,t,null!=i?i:new uV)).varType=e.varType,t.varName=e.varName,t}run(e){var 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");t=t.getVariableMap(),e?t.createVariable(this.varName,this.varType,this.varId):(e=t.getVariableById(this.varId))&&t.deleteVariable(e)}};ea(D.EVENT,rL.VAR_CREATE,uV);var uK=class{constructor(e,t,i,o){this.workspace=e,this.name=t,this.type=i||"",this.id=o||eD()}getId(){return this.id}getName(){return this.name}setName(e){return this.name=e,this}getType(){return this.type}setType(e){return this.type=e,this}getWorkspace(){return this.workspace}save(){let e={name:this.getName(),id:this.getId()},t=this.getType();return t&&(e.type=t),e}static load(e,t){e=new this(t,e.name,e.type,e.id),t.getVariableMap().addVariable(e),eH(new(ej(rL.VAR_CREATE))(e))}};ea(D.VARIABLE_MODEL,y,uK);var uY=class extends uW{constructor(e){super(e),this.type=rL.VAR_DELETE,e&&(this.varType=e.getType(),this.varName=e.getName())}toJson(){let e=super.toJson();if(void 0===this.varType)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,i){return(t=super.fromJson(e,t,null!=i?i:new uY)).varType=e.varType,t.varName=e.varName,t}run(e){var 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");t=t.getVariableMap(),e?(e=t.getVariableById(this.varId))&&t.deleteVariable(e):t.createVariable(this.varName,this.varType,this.varId)}};ea(D.EVENT,rL.VAR_DELETE,uY);var uX=class extends uW{constructor(e,t){super(e),this.type=rL.VAR_RENAME,e&&(this.oldName=e.getName(),this.newName=void 0===t?"":t)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new uX)).oldName=e.oldName,t.newName=e.newName,t}run(e){var 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");let i=(t=t.getVariableMap()).getVariableById(this.varId);e?i&&t.renameVariable(i,this.newName):i&&t.renameVariable(i,this.oldName)}};ea(D.EVENT,rL.VAR_RENAME,uX);var uz=class{constructor(e,t=!1){this.workspace=e,this.potentialMap=t,this.variableMap=new Map}clear(){for(let e of this.variableMap.values())for(let t of e.values())this.deleteVariable(t);if(0!==this.variableMap.size)throw Error("Non-empty variable map")}renameVariable(e,t){if(e.getName()===t)return e;var i=e.getType();i=this.getVariable(t,i);let o=this.workspace.getAllBlocks(!1),s="";this.potentialMap||(s=$.getGroup$$module$build$src$core$events$utils())||$.setGroup$$module$build$src$core$events$utils(!0);try{i&&i.getId()!==e.getId()?this.renameVariableWithConflict(e,t,i,o):this.renameVariableAndUses(e,t,o)}finally{this.potentialMap||$.setGroup$$module$build$src$core$events$utils(s)}return e}changeVariableType(e,t){var i;let o;return null==(i=this.variableMap.get(e.getType()))||i.delete(e.getId()),e.setType(t),(i=null!=(o=this.variableMap.get(t))?o:new Map).set(e.getId(),e),this.variableMap.has(t)||this.variableMap.set(t,i),e}renameVariableById(e,t){ih("VariableMap.renameVariableById","v12","v13","VariableMap.renameVariable");let i=this.getVariableById(e);if(!i)throw Error("Tried to rename a variable that didn't exist. ID: "+e);this.renameVariable(i,t)}renameVariableAndUses(e,t,i){for(this.potentialMap||eH(new(ej(rL.VAR_RENAME))(e,t)),e.setName(t),t=0;t<i.length;t++)i[t].updateVarName(e)}renameVariableWithConflict(e,t,i,o){let s,n=e.getType(),r=i.getName();for(t!==r&&this.renameVariableAndUses(i,t,o),t=0;t<o.length;t++)o[t].renameVarById(e.getId(),i.getId());this.potentialMap||eH(new(ej(rL.VAR_DELETE))(e)),null==(s=this.variableMap.get(n))||s.delete(e.getId())}createVariable(e,t,i){let o;var s=this.getVariable(e,t);if(s){if(i&&s.getId()!==i)throw Error('Variable "'+e+'" is already in use and its id is "'+s.getId()+'" which conflicts with the passed in id, "'+i+'".');return s}if(i&&this.getVariableById(i))throw Error('Variable id, "'+i+'", is already in use.');if(s=i||eD(),t=t||"",!(i=e_(D.VARIABLE_MODEL,y,!0)))throw Error("No variable model is registered.");return s=new i(this.workspace,e,t,s),(e=null!=(o=this.variableMap.get(t))?o:new Map).set(s.getId(),s),this.variableMap.has(t)||this.variableMap.set(t,e),this.potentialMap||eH(new(ej(rL.VAR_CREATE))(s)),s}addVariable(e){let t,i=e.getType();this.variableMap.has(i)||this.variableMap.set(i,new Map),null==(t=this.variableMap.get(i))||t.set(e.getId(),e)}deleteVariable(e){let t=iD(this.workspace,e.getId()),i="";this.potentialMap||(i=$.getGroup$$module$build$src$core$events$utils())||$.setGroup$$module$build$src$core$events$utils(!0);try{for(let e=0;e<t.length;e++)t[e].dispose(!0);let i=this.variableMap.get(e.getType());i&&i.has(e.getId())&&(i.delete(e.getId()),this.potentialMap||eH(new(ej(rL.VAR_DELETE))(e)),0===i.size&&this.variableMap.delete(e.getType()))}finally{this.potentialMap||$.setGroup$$module$build$src$core$events$utils(i)}}deleteVariableById(e){ih("VariableMap.deleteVariableById","v12","v13","Blockly.Variables.deleteVariable"),(e=this.getVariableById(e))&&$.deleteVariable$$module$build$src$core$variables(this.workspace,e)}getVariable(e,t){let i;return(t=this.variableMap.get(t||""))&&null!=(i=[...t.values()].find(t=>$.Names$$module$build$src$core$names.equals(t.getName(),e)))?i:null}getVariableById(e){for(let t of this.variableMap.values())if(t.has(e)){let i;return null!=(i=t.get(e))?i:null}return null}getVariablesOfType(e){return(e=this.variableMap.get(e||""))?[...e.values()]:[]}getTypes(){return[...this.variableMap.keys()]}getAllVariables(){let e=[];for(let t of this.variableMap.values())e=e.concat(...t.values());return e}getAllVariableNames(){ih("VariableMap.getAllVariableNames","v12","v13","Blockly.Variables.getAllVariables");let e=[];for(let t of this.variableMap.values())for(let i of t.values())e.push(i.getName());return e}getVariableUsesById(e){return ih("VariableMap.getVariableUsesById","v12","v13","Blockly.Variables.getVariableUsesById"),iD(this.workspace,e)}};ea(D.VARIABLE_MAP,y,uz);var uj=class extends r0{constructor(e,t){super(t),this.type=rL.TRASHCAN_OPEN,this.isOpen=e}toJson(){let e=super.toJson();if(void 0===this.isOpen)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,i){return(t=super.fromJson(e,t,null!=i?i:new uj)).isOpen=e.isOpen,t}};ea(D.EVENT,rL.TRASHCAN_OPEN,uj);var uJ=class extends hw{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,this.workspace.options.maxTrashcanContents<=0||(e=this.workspace.copyOptionsForFlyout(),this.workspace.horizontalLayout?(e.toolboxPosition=this.workspace.toolboxPosition===lS.TOP?lS.BOTTOM:lS.TOP,this.flyout=new(eE(D.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===lS.RIGHT?lS.LEFT:lS.RIGHT,this.flyout=new(eE(D.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){let e;this.svgGroup=eZ(li.G,{class:"blocklyTrash"});let t=String(Math.random()).substring(2);e=eZ(li.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),eZ(li.RECT,{width:uZ,height:uq,y:uQ},e);let i=eZ(li.IMAGE,{width:96,x:-u3,height:124,y:-u5,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return i.setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),e=eZ(li.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),eZ(li.RECT,{width:uZ,height:uQ},e),this.svgLid=eZ(li.IMAGE,{width:96,x:-u3,height:124,y:-u5,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(rw,"xlink:href",this.workspace.options.pathToMedia+l$),eC(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),eC(this.svgGroup,"pointerup",this,this.click),eC(i,"pointerover",this,this.mouseOver),eC(i,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){if(this.workspace.options.maxTrashcanContents>0){let e=this.flyout.createDom(li.SVG);eq(e,"blocklyTrashcanFlyout"),e3(e,this.workspace.getParentSvg()),this.flyout.init(this.workspace)}this.workspace.getComponentManager().addComponent({component:this,weight:r6.ComponentWeight.TRASHCAN_WEIGHT,capabilities:[r6.Capability.AUTOHIDEABLE,r6.Capability.DELETE_AREA,r6.Capability.DRAG_TARGET,r6.Capability.POSITIONABLE]}),this.initialized=!0,this.setLidOpen(!1)}dispose(){this.workspace.getComponentManager().removeComponent("trashcan"),this.svgGroup&&e2(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(e){return JSON.parse(e)}),t=this.workspace.getParentSvg().style;t.cursor="wait",setTimeout(()=>{let i,o;null==(i=this.flyout)||i.show(e),t.cursor="",null==(o=this.workspace.scrollbar)||o.setVisible(!1)},10),this.fireUiEvent(!0)}}closeFlyout(){if(this.contentsIsOpen()){var e,t;null==(e=this.flyout)||e.hide(),null==(t=this.workspace.scrollbar)||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 i,o,s=tX(this.workspace,e);t=tz(e=tY(s,new ls(uZ,uq+uQ),u1,u0,e,this.workspace),u0,s.vertical===lx.TOP?lG.DOWN:lG.UP,t),this.top=t.top,this.left=t.left,null==(i=this.svgGroup)||i.setAttribute("transform","translate("+this.left+","+this.top+")"),null==(o=this.flyout)||o.position()}}getBoundingRectangle(){return new lo(this.top,this.top+uq+uQ,this.left,this.left+uZ)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();let t=e.top+u5-u2;return e=e.left+u3-u2,new lo(t,t+uQ+uq+2*u2,e,e+uZ+2*u2)}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(){var e=1/(u8+1);this.lidOpen+=this.isLidOpen?e:-e,this.lidOpen=Math.min(Math.max(this.lidOpen,this.minOpenness),1),this.setLidAngle(this.lidOpen*de),e=u9+this.lidOpen*(u7-u9),this.svgGroup&&(this.svgGroup.style.opacity=`${e}`),this.lidOpen>this.minOpenness&&this.lidOpen<1&&(this.lidTask=setTimeout(this.animateLid.bind(this),u4/u8))}setLidAngle(e){let t,i=this.workspace.toolboxPosition===lS.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;null==(t=this.svgLid)||t.setAttribute("transform","rotate("+(i?-e:e)+","+(i?4:uZ-4)+","+(uQ-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*de)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&!this.workspace.isDragging()&&this.openFlyout()}fireUiEvent(e){eH(e=new(ej(rL.TRASHCAN_OPEN))(e,this.workspace.id))}blockMouseDownWhenOpenable(e){!this.contentsIsOpen()&&this.hasContents()&&e.stopPropagation()}mouseOver(){this.hasContents()&&this.setLidOpen(!0)}mouseOut(){this.setLidOpen(!1)}onDelete(e){if(!(this.workspace.options.maxTrashcanContents<=0||!ew(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(u6)}}}cleanBlockJson(e){return!function e(t){if(t){if(delete t.id,delete t.x,delete t.y,delete t.enabled,delete t.disabledReasons,t.icons&&t.icons.comment){var i=t.icons.comment;delete i.height,delete i.width,delete i.pinned}for(var o in i=t.inputs){var s=i[o];let t=s.block;s=s.shadow,t&&e(t),s&&e(s)}t.next&&(t=(o=t.next).block,o=o.shadow,t&&e(t),o&&e(o))}}(e=JSON.parse(JSON.stringify(e))),Object.assign({},{kind:"BLOCK"},e)}},uZ=47,uq=44,uQ=16,u0=20,u1=20,u2=10,u3=0,u5=32,u6=.1,u4=80,u8=4,u9=.4,u7=.8,de=45,dt=null,di=null,ds=void 0,dn={};dn.BlockPaster=hO,dn.copy=nv,dn.getLastCopiedData=nP,dn.getLastCopiedLocation=nx,dn.getLastCopiedWorkspace=nB,dn.paste=nF,dn.registry=lk,dn.setLastCopiedData=function(e){dt=e},dn.setLastCopiedLocation=function(e){ds=e},dn.setLastCopiedWorkspace=function(e){di=e};var dr={};dr.CollapseCommentBarButton=cP,dr.CommentBarButton=cM,dr.CommentEditor=cx,dr.CommentView=cH,dr.DeleteCommentBarButton=cG,dr.RenderedWorkspaceComment=cW,dr.WorkspaceComment=cU,(dV=dz||(dz={})).ESCAPE="escape",dV.DELETE="delete",dV.COPY="copy",dV.CUT="cut",dV.PASTE="paste",dV.UNDO="undo",dV.REDO="redo",nZ();var dl={};dl.names=dz,dl.registerCopy=nY,dl.registerCut=nX,dl.registerDefaultShortcuts=nZ,dl.registerDelete=nW,dl.registerEscape=nU,dl.registerPaste=nz,dl.registerRedo=nJ,dl.registerUndo=nj;var da=class{constructor(e,t){this.procedureModelClass=e,this.parameterModelClass=t,this.priority=75}save(e){return(e=e.getProcedureMap().getProcedures().map(e=>nq(e))).length?e:null}load(e,t){let i=t.getProcedureMap();for(let o of e)i.add(nQ(this.procedureModelClass,this.parameterModelClass,o,t))}clear(e){e.getProcedureMap().clear()}},dc={};dc.ProcedureSerializer=da,dc.loadProcedure=nQ,dc.saveProcedure=nq;var dh=class{constructor(){this.priority=100}save(e){return(e=e.getAllVariables().map(e=>e.save())).length?e:null}load(e,t){let i=e_(D.VARIABLE_MODEL,y);e.forEach(e=>{null==i||i.load(e,t)})}clear(e){e.getVariableMap().clear()}};tj("variables",new dh);var du={};du.VariableSerializer=dh;var dd={};dd.load=function(e,t,{recordUndo:i=!1}={}){var o=eg(D.SERIALIZER,!0);if(o){o=Object.entries(o).sort((e,t)=>t[1].priority-e[1].priority);var s=eG();for(let[,e]of($.setRecordUndo$$module$build$src$core$events$utils(i),(i=$.getGroup$$module$build$src$core$events$utils())||$.setGroup$$module$build$src$core$events$utils(!0),e6(),t instanceof uH&&t.setResizesEnabled(!1),o.reverse()))null==e||e.clear(t);for(let[i,s]of o.reverse())e[i]&&(null==s||s.load(e[i],t));t instanceof uH&&t.setResizesEnabled(!0),e4(),eH(new(ej(rL.FINISHED_LOADING))(t)),$.setGroup$$module$build$src$core$events$utils(i),$.setRecordUndo$$module$build$src$core$events$utils(s)}},dd.save=function(e){let t=Object.create(null),i=eg(D.SERIALIZER,!0);for(let o in i){let s,n=null==(s=i[o])?void 0:s.save(e);n&&(t[o]=n)}return t},"Blockly"in globalThis||(globalThis.Blockly={Msg:aw});var dp="label",d_=class{load(e,t){return(e=new hB(t.getWorkspace(),t.targetWorkspace,e,!0)).show(),new hM(e,dp)}gapForItem(e,t){return t}disposeItem(e){(e=e.getElement())instanceof hB&&e.dispose()}getType(){return dp}};ea(D.FLYOUT_INFLATER,dp,d_);var dg=class extends uN{constructor(e){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:+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,e&&(this.GRID_UNIT=e),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=+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=+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;let 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&&e2(this.selectedGlowFilter),this.replacementGlowFilter&&e2(this.replacementGlowFilter)}makeStartHat(){let e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,i=sU("c",[sH(25,-e),sH(71,-e),sH(t,0)]);return{height:.75*e,width:t,path:i}}makeHexagonal(){function e(e,i,o){var s=e/2;return sK(-(o=o?-1:1)*(s=s>t?t:s),e=(i?-1:1)*e/2)+sK(o*s,e)}let t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width:e=>(e/=2)>t?t:e,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}makeRounded(){function e(e,t,o){let s=e>i?e-i:0,n=o===t?"0":"1";return sz("a","0 0,"+n,e=(e>i?i:e)/2,sH((o?1:-1)*e,(t?-1:1)*e))+sX("v",(t?-1:1)*s)+sz("a","0 0,"+n,e,sH((o?-1:1)*e,(t?-1:1)*e))}let t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,i=2*t;return{type:this.SHAPES.ROUND,isDynamic:!0,width:e=>(e/=2)>t?t:e,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}makeSquared(){function e(e,i,o){e-=2*t;let s=o===i?"0":"1";return sz("a","0 0,"+s,t,sH((o?1:-1)*t,(i?-1:1)*t))+sX("v",(i?-1:1)*e)+sz("a","0 0,"+s,t,sH((o?-1:1)*t,(i?-1:1)*t))}let t=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width:e=>t,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}shapeFor(e){let t=e.getCheck();switch(!t&&e.targetConnection&&(t=e.targetConnection.getCheck()),e.type){case c5.INPUT_VALUE:case c5.OUTPUT_VALUE:if(null!==(e=e.getSourceBlock().getOutputShape()))switch(e){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}if(t&&t.includes("Boolean"))return this.HEXAGONAL;if(t&&t.includes("Number"))return this.ROUNDED;return t&&t.includes("String"),this.ROUNDED;case c5.PREVIOUS_STATEMENT:case c5.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(e){return sU("c",[sH(e*s/2,0),sH(e*s*3/4,r/2),sH(e*s,r)])+sY([sH(e*s,n)])+sU("c",[sH(e*s/4,r/2),sH(e*s/2,r),sH(e*s,r)])+sX("h",e*o)+sU("c",[sH(e*s/2,0),sH(e*s*3/4,-(r/2)),sH(e*s,-r)])+sY([sH(e*s,-n)])+sU("c",[sH(e*s/4,-(r/2)),sH(e*s/2,-r),sH(e*s,-r)])}let t=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,o=t/3,s=o/3,n=i/2,r=n/2,l=e(1),a=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:i,pathLeft:l,pathRight:a}}makeInsideCorners(){let e=this.CORNER_RADIUS,t=sz("a","0 0,0",e,sH(-e,e)),i=sz("a","0 0,1",e,sH(-e,e)),o=sz("a","0 0,0",e,sH(e,e)),s=sz("a","0 0,1",e,sH(e,e));return{width:e,height:e,pathTop:t,pathBottom:o,rightWidth:e,rightHeight:e,pathTopRight:i,pathBottomRight:s}}generateSecondaryColour_(e){return oW("#000",e,.15)||e}generateTertiaryColour_(e){return oW("#000",e,.25)||e}createDom(e,t,i,o){super.createDom(e,t,i,o),e=eZ(li.DEFS,{},e),t=eZ(li.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),eZ(li.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),i=eZ(li.FECOMPONENTTRANSFER,{result:"outBlur"},t),eZ(li.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},i),eZ(li.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),eZ(li.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=eZ(li.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),eZ(li.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=eZ(li.FECOMPONENTTRANSFER,{result:"outBlur"},e),eZ(li.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),eZ(li.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),eZ(li.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),eZ(li.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter=e,o&&(o.style.setProperty("--blocklySelectedGlowFilter",`url(#${this.selectedGlowFilterId})`),o.style.setProperty("--blocklyReplacementGlowFilter",`url(#${this.replacementGlowFilterId})`))}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} .blocklyNonEditableField>rect:not(.blocklyDropdownRect),`,`${e} .blocklyEditableField>rect:not(.blocklyDropdownRect) {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"}",`${e} .blocklyNonEditableField>text,`,`${e} .blocklyEditableField>text,`,`${e} .blocklyNonEditableField>g>text,`,`${e} .blocklyEditableField>g>text {`,"fill: #575E75;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #575E75;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #575E75;","}",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableField:not(.blocklyEditing):hover>rect,",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableField:not(.blocklyEditing):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} .blocklyDisabledPattern > .blocklyOutlinePath {`,"fill: var(--blocklyDisabledPattern)","}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}",`${e} .blocklySelected>.blocklyPath.blocklyPathSelected {`,"fill: none;","filter: var(--blocklySelectedGlowFilter);","}",`${e} .blocklyReplaceable>.blocklyPath {`,"filter: var(--blocklyReplacementGlowFilter);","}"]}},dE=class extends uy{constructor(e,t){super(e,t)}draw(){let e=this.block_.pathObject;e.beginDrawing(),this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),e.setPath(this.outlinePath_+"\n"+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(!(e.height<=0)){if(ur.isSpacer(e)){let o=e.precedesStatement;var t=e.followsStatement;if(o||t){let s=this.constants_.INSIDE_CORNERS;var i=s.rightHeight;i=e.height-(o?i:0),t=t?s.pathBottomRight:"",e=i>0?sX("V",e.yPos+i):"",this.outlinePath_+=t+e+(o?s.pathTopRight:"");return}}this.outlinePath_+=sX("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_(){let e=this.info_.topRow;this.positionPreviousConnection_(),this.outlinePath_+=sV(e.xPos,this.info_.startY),this.outlinePath_+=sX("h",e.width)}drawFlatBottom_(){let e=this.info_.bottomRow;this.positionNextConnection_(),this.outlinePath_+=sX("V",e.baseline),this.outlinePath_+=sX("h",-e.width)}drawInlineInput_(e){this.positionInlineInputConnection_(e);let t=e.input.name;e.connectedBlock||this.info_.isInsertionMarker||(e=sW(e.xPos+e.connectionWidth,e.centerline-e.height/2)+this.getInlineInputPath(e),this.block_.pathObject.setOutlinePath(t,e))}getInlineInputPath(e){let t=e.width-2*e.connectionWidth,i=e.height;return sX("h",t)+e.shape.pathRightDown(i)+sX("h",-t)+e.shape.pathUp(i)+"z"}drawStatementInput_(e){var t=e.getLastInput();let i=t.xPos+t.notchOffset+t.shape.width,o=this.constants_.INSIDE_CORNERS,s=t.shape.pathRight+sX("h",-(t.notchOffset-o.width))+o.pathTop,n=e.height-2*o.height;t=o.pathBottom+sX("h",t.notchOffset-o.width)+(t.connectedBottomNextConnection?"":t.shape.pathLeft),this.outlinePath_+=sX("H",i)+s+sX("v",n)+t+sX("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}drawConnectionHighlightPath(e){let t,i,o=e.connectionModel;if(o.type===c5.NEXT_STATEMENT||o.type===c5.PREVIOUS_STATEMENT||o.type===c5.OUTPUT_VALUE&&!e.isDynamicShape)return super.drawConnectionHighlightPath(e);e=o.type===c5.INPUT_VALUE?sW(e.connectionWidth,-e.height/2)+this.getInlineInputPath(e):sW(e.width,-e.height/2)+e.shape.pathDown(e.height);let s=o.getSourceBlock();return null==(i=(t=s.pathObject).addConnectionHighlight)?void 0:i.call(t,o,e,o.getOffsetInBlock(),s.RTL)}},dT=class extends cd{constructor(e,t,i,o,s,n,r){if(super(cd.SKIP_SETUP),this.imageElement=this.clickHandler=null,this.flipRtl=this.isDirty_=this.EDITABLE=!1,this.altText="",i=Number(oX(i)),t=Number(oX(t)),isNaN(i)||isNaN(t))throw Error("Height and width values of an image field must cast to numbers.");if(i<=0||t<=0)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new ls(t,i+dT.Y_PADDING),this.imageHeight=i,"function"==typeof s&&(this.clickHandler=s),e!==cd.SKIP_SETUP&&(r?this.configure_(r):(this.flipRtl=!!n,this.altText=oX(o)||""),this.setValue(oX(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=oX(e.alt))}initView(){this.imageElement=eZ(li.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(rw,"xlink:href",this.value_),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyImageField"),this.clickHandler&&(this.imageElement.style.cursor="pointer")}updateSize_(){}doClassValidation_(e){return"string"!=typeof e?null:e}doValueUpdate_(e){this.value_=e,this.imageElement&&this.imageElement.setAttributeNS(rw,"xlink:href",this.value_)}getFlipRtl(){return this.flipRtl}setAlt(e){e!==this.altText&&(this.altText=e||"",this.imageElement&&this.imageElement.setAttribute("alt",this.altText))}isClickable(){return super.isClickable()&&!!this.clickHandler}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)}};dT.Y_PADDING=1,sy("field_image",dT),dT.prototype.DEFAULT_VALUE="";var dm=class extends cd{set size_(e){super.size_=e}get size_(){let e=super.size_;return e.width<14&&(e.width=14),e}constructor(e,t,i){super(cd.SKIP_SETUP),this.spellcheck_=!0,this.htmlInput_=null,this.isTextValid_=this.isBeingEdited_=!1,this.onInputWrapper=this.onKeyDownWrapper=this.valueWhenEditorWasOpened_=null,this.fullBlockClickTarget_=!1,this.workspace_=null,this.SERIALIZABLE=!0,e!==cd.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),void 0!==e.spellcheck&&(this.spellcheck_=e.spellcheck)}initView(){if(!this.getSourceBlock())throw new cp;super.initView(),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot()),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyInputField")}isFullBlockField(){let e,t=this.getSourceBlock();if(!t)throw new cp;return this.fullBlockClickTarget_=!(null==(e=this.getConstants())||!e.FULL_BLOCK_FIELDS)&&t.isSimpleReporter()}doValueInvalid_(e,t=!0){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,e=this.value_,this.value_=this.valueWhenEditorWasOpened_,this.sourceBlock_&&eY()&&this.value_!==e&&t&&eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,e,this.value_)))}doValueUpdate_(e){this.isTextValid_=this.isDirty_=!0,this.value_=e}applyColour(){let e=this.getSourceBlock();if(!e)throw new cp;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(null==(e=this.getConstants())?0: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_?(e0(e,"blocklyInvalidInput"),t2(e,aD.INVALID,!1)):(eq(e,"blocklyInvalidInput"),t2(e,aD.INVALID,!0))}if(!(e=this.getSourceBlock()))throw new cp;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,i=!0){this.workspace_=this.sourceBlock_.workspace,!t&&this.workspace_.options.modalInputs&&(rN||rC||rO)?this.showPromptEditor():this.showInlineEditor(t,i)}showPromptEditor(){ir($.Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),e=>{null!==e&&this.setValue(this.getValueFromEditorText_(e)),this.onFinishEditing_(this.value_)})}showInlineEditor(e,t){let i=this.getSourceBlock();if(!i)throw new cp;oZ(this,i.RTL,this.widgetDispose_.bind(this),this.workspace_,t),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 cp;$.setGroup$$module$build$src$core$events$utils(!0);let t=oj();var i=this.getClickTarget_();if(!i)throw Error("A click target has not been set.");eq(i,"blocklyEditing"),(i=document.createElement("input")).className="blocklyHtmlInput",i.setAttribute("spellcheck",this.spellcheck_);let o=this.workspace_.getAbsoluteScale();var s=this.getConstants().FIELD_TEXT_FONTSIZE*o+"pt";return t.style.fontSize=s,i.style.fontSize=s,s=dm.BORDERRADIUS*o+"px",this.isFullBlockField()&&(s=((s=this.getScaledBBox()).bottom-s.top)/2+"px",e=e.getParent()?e.getParent().getColourTertiary():this.sourceBlock_.getColourTertiary(),i.style.border=+o+"px solid "+e,t.style.borderRadius=s,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*o+"px")),i.style.borderRadius=s,t.appendChild(i),i.value=i.defaultValue=this.getEditorText_(this.value_),i.setAttribute("data-untyped-default-value",String(this.value_)),this.resizeEditor_(),this.bindInputEvents_(i),i}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&eY()&&null!==this.valueWhenEditorWasOpened_&&this.valueWhenEditorWasOpened_!==this.value_&&(eH(new(ej(rL.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),$.setGroup$$module$build$src$core$events$utils(!1),this.unbindInputEvents_();var e=oj().style;if(e.width="auto",e.height="auto",e.fontSize="",e.transition="",e.boxShadow="",this.htmlInput_=null,!(e=this.getClickTarget_()))throw Error("A click target has not been set.");e0(e,"blocklyEditing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper=eb(e,"keydown",this,this.onHtmlInputKeyDown_),this.onInputWrapper=eb(e,"input",this,this.onHtmlInputChange)}unbindInputEvents_(){this.onKeyDownWrapper&&(eO(this.onKeyDownWrapper),this.onKeyDownWrapper=null),this.onInputWrapper&&(eO(this.onInputWrapper),this.onInputWrapper=null)}onHtmlInputKeyDown_(e){if("Enter"===e.key)o0(this),ou();else if("Escape"===e.key)this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),o0(this),ou();else if("Tab"===e.key){e.preventDefault();var t,i=null==(t=this.workspace_)?void 0:t.getCursor();t=e=>(e instanceof dm||e instanceof hD&&e.isSimpleReporter())&&e!==this.getSourceBlock(),(e=(e=e.shiftKey?null==i?void 0:i.getPreviousNode(this,t,!1):null==i?void 0:i.getNextNode(this,t,!1))instanceof hD&&e.isSimpleReporter()?e.getFields().next().value:e)instanceof dm&&(o0(this),ou(),i=e.getSourceBlock(),e.isFullBlockField()&&i&&i instanceof hD?$.getFocusManager$$module$build$src$core$focus_manager().focusNode(i):$.getFocusManager$$module$build$src$core$focus_manager().focusNode(e),e.showEditor())}}onHtmlInputChange(e){e=this.value_,this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&eY()&&this.value_!==e&&eH(new(ej(rL.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_(){t6().then(()=>{let e=this.getSourceBlock();if(!e)throw new cp;let t=oj(),i=this.getScaledBBox();t.style.width=i.right-i.left+"px",t.style.height=i.bottom-i.top+"px";let o=i.top;t.style.left=`${e.RTL?i.right-t.offsetWidth:i.left}px`,t.style.top=`${o}px`})}repositionForWindowResize(){let e,t=null==(e=this.getSourceBlock())?void 0:e.getRootBlock();return t instanceof hD&&(s9(this.workspace_,this.workspace_.getMetricsManager().getViewMetrics(!0),t)||this.resizeEditor_(),!0)}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(e){return`${e}`}getValueFromEditorText_(e){return e}};dm.BORDERRADIUS=4,$.FieldTextInput$$module$build$src$core$field_textinput=class extends dm{constructor(e,t,i){super(e,t,i)}initView(){super.initView(),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyTextInputField")}doClassValidation_(e){return void 0===e?null:`${e}`}static fromJson(e){return new this(oX(e.text),void 0,e)}},sy("field_input",$.FieldTextInput$$module$build$src$core$field_textinput),$.FieldTextInput$$module$build$src$core$field_textinput.prototype.DEFAULT_VALUE="",$.FieldTextInput$$module$build$src$core$field_textinput;var df=class extends uc{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){return!!e.outputConnection}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},dI=class extends uA{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)}}},dS=class extends ul{constructor(e){super(e),this.width=this.height=0,this.type|=ur.getType("RIGHT_CONNECTION")}},dR=class extends u${constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){let t=(e.hat?"cap"===e.hat:this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection;return!!e.outputConnection||t}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},db=class extends uD{constructor(e,t){super(e,t),this.isInline=!0,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.topRow=new dR(this.constants_),this.bottomRow=new df(this.constants_),this.isMultiRow=!t.getInputsInline()||t.isCollapsed(),this.hasStatementInput=t.statementInputCount>0,this.rightSide=this.outputConnection?new dS(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 hf||e instanceof hI||t instanceof hI||(e instanceof $.ValueInput$$module$build$src$core$inputs$value_input||e instanceof hm||e instanceof hf)&&(!this.isInline||this.isMultiRow))}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&&ur.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:e&&ur.isLeftRoundedCorner(e)&&t&&(ur.isPreviousConnection(t)||ur.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&ur.isLeftSquareCorner(e)&&t&&ur.isHat(t)||e&&ur.isField(e)&&0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING}getSpacerRowHeight_(e,t){if(ur.isTopRow(e)&&ur.isBottomRow(t))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;let i=ur.isInputRow(e)&&e.hasStatement,o=ur.isInputRow(t)&&t.hasStatement;return o||i?(e=Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.INSIDE_CORNERS.rightHeight||0),o&&i?Math.max(e,this.constants_.DUMMY_INPUT_MIN_HEIGHT):e):ur.isTopRow(e)?e.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):ur.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){let i=this.width-this.startX;return ur.isInputRow(e)&&e.hasStatement||ur.isInputRow(t)&&t.hasStatement?Math.max(i,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):i}getElemCenterline_(e,t){if(e.hasStatement&&!ur.isSpacer(t)&&!ur.isStatementInput(t))return e.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(ur.isInlineInput(t)){let i=t.connectedBlock;if(i&&i.outputConnection&&i.nextConnection)return e.yPos+i.height/2}return super.getElemCenterline_(e,t)}addInput_(e,t){if((e instanceof hm||e instanceof hf)&&t.hasDummyInput&&t.align===$.Align$$module$build$src$core$inputs$align.LEFT&&e.align===$.Align$$module$build$src$core$inputs$align.RIGHT)this.rightAlignedDummyInputs.set(t,e);else if(e instanceof hI){t.elements.push(new dI(this.constants_,e)),t.hasStatement=!0,null===t.align&&(t.align=e.align);return}super.addInput_(e,t)}addAlignmentPadding_(e,t){if(this.rightAlignedDummyInputs.get(e)){let i;for(let t=0;t<e.elements.length;t++){let o=e.elements[t];if(ur.isSpacer(o)&&(i=o),ur.isField(o)&&o.parentInput===this.rightAlignedDummyInputs.get(e))break}if(i){i.width+=t,e.width+=t;return}}super.addAlignmentPadding_(e,t)}adjustXPosition_(){let e=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH,t=e;for(let s=2;s<this.rows.length-1;s+=2){var i=this.rows[s-1];let n=this.rows[s];var o=this.rows[s+1];if(i=2===s?!!this.topRow.hasPreviousConnection:!!i.followsStatement,o=s+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!o.precedesStatement,ur.isInputRow(n)&&n.hasStatement){let i,o;n.measure(),t=n.width-(null!=(o=null==(i=n.getLastInput())?void 0:i.width)?o:0)+e}else if(i&&(2===s||o)&&ur.isInputRow(n)&&!n.hasStatement){o=n.xPos,i=null;for(let e=0;e<n.elements.length;e++){let s=n.elements[e];ur.isSpacer(s)&&(i=s),!(i&&(ur.isField(s)||ur.isInput(s))&&o<t)||ur.isField(s)&&(s.field instanceof hh||s.field instanceof dT)||(i.width+=t-o),o+=s.width}}}}finalizeOutputConnection_(){if(this.outputConnection&&this.outputConnection.isDynamicShape){var e=this.outputConnection.shape;if("isDynamic"in e&&e.isDynamic){for(var t=0,i=0;i<this.rows.length;i++){let e=this.rows[i];e.yPos=t,t+=e.height}this.height=t,i=this.bottomRow.hasNextConnection?this.height-this.bottomRow.descenderHeight:this.height,t=e.height(i),i=e.width(i),this.outputConnection.height=t,this.outputConnection.width=i,this.outputConnection.startX=i,this.outputConnection.connectionOffsetY=e.connectionOffsetY(t),this.outputConnection.connectionOffsetX=e.connectionOffsetX(i),e=0,this.hasStatementInput||this.bottomRow.hasNextConnection||(e=i,this.rightSide.height=t,this.rightSide.width=e,this.rightSide.centerline=t/2,this.rightSide.xPos=this.width+e),this.startX=i,this.width+=i+e,this.widthWithChildren+=i+e}}}finalizeHorizontalAlignment_(){if(this.outputConnection&&!this.hasStatementInput&&!this.bottomRow.hasNextConnection){for(var e=0,t=0;t<this.rows.length;t++){var i=this.rows[t];if(!ur.isInputRow(i))continue;e=i.elements[i.elements.length-2];let o=this.getNegativeSpacing_(i.elements[1]),s=this.getNegativeSpacing_(e);e=o+s;let n=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-e<n&&(o=(e=this.width-n)/2,s=e/2),i.elements.unshift(new uE(this.constants_,-o)),i.elements.push(new uE(this.constants_,-s))}if(e)for(this.width-=e,this.widthWithChildren-=e,this.rightSide.xPos-=e,t=0;t<this.rows.length;t++)i=this.rows[t],ur.isTopOrBottomRow(i)&&(i.elements[1].width-=e),i.width-=e,i.widthWithConnectedBlocks-=e}}getNegativeSpacing_(e){if(!e||!this.outputConnection)return 0;let t=this.outputConnection.width;var i=this.outputConnection.shape.type;let o=this.constants_;if(this.inputRows.length>1)if(i===o.SHAPES.ROUND)return i=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,t-(i=this.height/2>i?i:this.height/2)*(1-Math.sin(Math.acos((i-this.constants_.SMALL_PADDING)/i)));else return 0;if(ur.isInlineInput(e)){let s=e.connectedBlock;return null==(e=s?s.pathObject.outputShapeType:e.shape.type)||s&&s.outputConnection&&(s.statementInputCount||s.nextConnection)||i===o.SHAPES.HEXAGONAL&&i!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[i][e]}return ur.isField(e)?i===o.SHAPES.ROUND&&e.field instanceof $.FieldTextInput$$module$build$src$core$field_textinput?t-2.75*o.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[i][0]:ur.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let o=2;o<this.rows.length-1;o+=2){let s=this.rows[o-1],n=this.rows[o],r=this.rows[o+1];var e=2===o,t=o+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!r.precedesStatement;if(e?this.topRow.hasPreviousConnection:s.followsStatement){var i=n.elements[1];if(i=3===n.elements.length&&i instanceof up&&(i.field instanceof hh||i.field instanceof dT),!e&&i)s.height-=this.constants_.SMALL_PADDING,r.height-=this.constants_.SMALL_PADDING,n.height-=this.constants_.MEDIUM_PADDING;else if(e||t){if(t){for(t=0,e=!1;t<n.elements.length;t++)if(i=n.elements[t],ur.isInlineInput(i)&&i.connectedBlock&&!i.connectedBlock.isShadow()&&i.connectedBlock.getHeightWidth().height>=40){e=!0;break}e&&(s.height-=this.constants_.SMALL_PADDING,r.height-=this.constants_.SMALL_PADDING)}}else s.height+=this.constants_.SMALL_PADDING}}}finalize_(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),super.finalize_(),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},dC=class extends uk{constructor(e,t,i){super(e,t,i),this.svgPathSelected=null,this.outlines=new Map,this.remainingOutlines=new Set,this.outputShapeType=null,this.constants=i}setPath(e){super.setPath(e),this.svgPathSelected&&this.svgPathSelected.setAttribute("d",e)}applyColour(e){super.applyColour(e);let t=e.getParent();for(let i of(e.isShadow()&&t&&this.svgPath.setAttribute("stroke",t.getColourTertiary()),this.outlines.values()))i.setAttribute("fill",this.style.colourTertiary)}flipRTL(){for(let e of(super.flipRTL(),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.classList.add("blocklyPathSelected"),e0(this.svgPathSelected,rG.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),e0(this.svgPathSelected,rG.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME),this.svgPathSelected.removeAttribute("tabindex"),this.svgPathSelected.removeAttribute("id"),this.svgRoot.appendChild(this.svgPathSelected)):this.svgPathSelected&&(this.svgRoot.removeChild(this.svgPathSelected),this.svgPathSelected=null)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e)}updateShapeForInputHighlight(e,t){e=e.getParentInput().name,(e=this.getOutlinePath(e))&&(t?e.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):e.removeAttribute("filter"))}beginDrawing(){for(let e of(this.remainingOutlines.clear(),this.outlines.keys()))this.remainingOutlines.add(e)}endDrawing(){if(this.remainingOutlines.size)for(let e of this.remainingOutlines)this.removeOutlinePath(e);this.remainingOutlines.clear()}setOutlinePath(e,t){(e=this.getOutlinePath(e)).setAttribute("d",t),e.setAttribute("fill",this.style.colourTertiary)}getOutlinePath(e){return this.outlines.has(e)||this.outlines.set(e,eZ(li.PATH,{class:"blocklyOutlinePath",d:""},this.svgRoot)),this.remainingOutlines.delete(e),this.outlines.get(e)}removeOutlinePath(e){let t,i;null==(t=this.outlines.get(e))||null==(i=t.parentNode)||i.removeChild(this.outlines.get(e)),this.outlines.delete(e)}},dO=class extends uw{constructor(e){super(e)}makeConstants_(){return new dg}makeRenderInfo_(e){return new db(this,e)}makeDrawer_(e,t){return new dE(e,t)}makePathObject(e,t){return new dC(e,t,this.getConstants())}getConstants(){return this.constants_}};nA("zelos",dO);var dA=class{constructor(e){this.staticConn=this.draggedConn=this.markerConn=this.fadedBlock=null,this.workspace=e.workspace}previewReplacement(e,t,i){$.disable$$module$build$src$core$events$utils();try{this.hidePreview(),this.fadedBlock=i,i.fadeForReplacement(!0),this.workspace.getRenderer().shouldHighlightConnection(t)&&(t.highlight(),this.staticConn=t)}finally{$.enable$$module$build$src$core$events$utils()}}previewConnection(e,t){if(e!==this.draggedConn||t!==this.staticConn){$.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{$.enable$$module$build$src$core$events$utils()}}}shouldUseMarkerPreview(e,t){return t.type===c5.PREVIOUS_STATEMENT||t.type===c5.NEXT_STATEMENT||!(this.workspace.getRenderer()instanceof dO)}previewMarker(e,t){let i=e.getSourceBlock(),o=this.createInsertionMarker(i),s=this.getMatchingConnection(i,o,e);if(!s)return null;o.queueRender(),t4(),s.connect(t);let n={x:t.x-s.x,y:t.y-s.y},r=s.getOffsetInBlock().clone();return t6().then(()=>{if(!o.isDeadOrDying()){$.disable$$module$build$src$core$events$utils();try{null==o||o.positionNearConnection(s,n,r),null==o||o.getSvgRoot().setAttribute("visibility","visible")}finally{$.enable$$module$build$src$core$events$utils()}}}),s}createInsertionMarker(e){let t=ik(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!t)throw Error(`Failed to serialize source block. ${e.toDevString()}`);for(let i of(e=iH(t,this.workspace)).getDescendants(!1))i.setInsertionMarker(!0);return e.initSvg(),e.getSvgRoot().setAttribute("visibility","hidden"),e}getMatchingConnection(e,t,i){if(e=e.getConnections_(!0),t=t.getConnections_(!0),e.length!==t.length)return null;for(let o=0;o<e.length;o++)if(e[o]===i)return t[o];return null}hidePreview(){$.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{$.enable$$module$build$src$core$events$utils()}}hideInsertionMarker(e){let t,i=e.getSourceBlock(),o=i.outputConnection;if((null==(t=i.previousConnection)?0:t.targetConnection)||(null==o?0:o.targetConnection))i.unplug(!0);else{let t;null==(t=e.targetBlock())||t.unplug(!1)}i.dispose()}dispose(){this.hidePreview()}};ea(D.CONNECTION_PREVIEWER,y,dA);var d$={};d$.Align=$.Align$$module$build$src$core$inputs$align,d$.DummyInput=hm,d$.EndRowInput=hf,d$.Input=hT,d$.StatementInput=hI,d$.ValueInput=$.ValueInput$$module$build$src$core$inputs$value_input,d$.inputTypes=$.inputTypes$$module$build$src$core$inputs$input_types;var dN=!1;$.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_=RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=tl());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let i=0,o;o=e[i];i++){let e=this.blockToCode(o);Array.isArray(e)&&(e=e[0]),e&&(o.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!o.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,o)+e),this.STATEMENT_SUFFIX&&!o.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,o))),t.push(e))}return t=t.join("\n"),(t=(t=(t=this.finish(t)).replace(/^\s+\n/,"")).replace(/\n\s+$/,"\n")).replace(/[ \t]+\n/g,"\n")}prefixLines(e,t){return t+e.replace(/(?!\n$)\n/g,"\n"+t)}allNestedComments(e){let t=[];e=e.getDescendants(!0);for(let i=0;i<e.length;i++){let o=e[i].getCommentText();o&&t.push(o)}return t.length&&t.push(""),t.join("\n")}blockToCode(e,t){if(!1===this.isInitialized&&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 i=this.forBlock[e.type];if("function"!=typeof i)throw Error(`${this.name_} generator does not know how to generate code for block type "${e.type}".`);if(Array.isArray(i=i.call(e,e,this))){if(!e.outputConnection)throw TypeError("Expecting string from statement block: "+e.type);return[this.scrub_(e,i[0],t),i[1]]}if("string"==typeof i)return this.STATEMENT_PREFIX&&!e.suppressPrefixSuffix&&(i=this.injectId(this.STATEMENT_PREFIX,e)+i),this.STATEMENT_SUFFIX&&!e.suppressPrefixSuffix&&(i+=this.injectId(this.STATEMENT_SUFFIX,e)),this.scrub_(e,i,t);if(null===i)return"";throw SyntaxError("Invalid code generated: "+i)}valueToCode(e,t,i){if(isNaN(i))throw TypeError("Expecting valid order from block: "+e.type);var o=e.getInputTargetBlock(t);if(!o&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if(!o||""===(t=this.blockToCode(o)))return"";if(!Array.isArray(t))throw TypeError(`Expecting tuple from value block: ${o.type} See developers.google.com/blockly/guides/create-custom-blocks/generating-code for more information`);if(e=t[0],isNaN(t=t[1]))throw TypeError("Expecting valid order from value block: "+o.type);if(!e)return"";o=!1;var s=Math.floor(i);let n=Math.floor(t);if(s<=n&&(s!==n||0!==s&&99!==s)){for(o=!0,s=0;s<this.ORDER_OVERRIDES.length;s++)if(this.ORDER_OVERRIDES[s][0]===i&&this.ORDER_OVERRIDES[s][1]===t){o=!1;break}}return o&&(e="("+e+")"),e}statementToCode(e,t){let i=e.getInputTargetBlock(t);if(!i&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if("string"!=typeof(e=this.blockToCode(i)))throw TypeError("Expecting code from statement block: "+(i&&i.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]){let i,o=this.nameDB_.getDistinctName(e,$.NameType$$module$build$src$core$names.PROCEDURE);for(this.functionNames_[e]=o,Array.isArray(t)&&(t=t.join("\n")),t=t.trim().replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,o);i!==t;)i=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,$.NameType$$module$build$src$core$names.VARIABLE)}getProcedureName(e){return this.getName(e,$.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,i){return t}finish(e){return this.definitions_=Object.create(null),this.functionNames_=Object.create(null),e}scrubNakedValue(e){return e}},$.CodeGenerator$$module$build$src$core$generator;var dL=class extends h0{constructor(e){super(e)}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),i=t.getScrollMetrics(),o=t.getViewMetrics();t=t.getAbsoluteMetrics(),"number"==typeof e.y&&(this.workspace_.scrollY=-(i.top+(i.height-o.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();let t=e.getAbsoluteMetrics(),i=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===lS.LEFT?e.width:i.width-this.getWidth():this.toolboxPosition_===lS.LEFT?0:i.width:this.toolboxPosition_===lS.LEFT?0:i.width+t.left-this.getWidth()}getY(){return 0}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=e.height;var t=this.getWidth()-this.CORNER_RADIUS;this.setBackgroundPath(t,e.height-2*this.CORNER_RADIUS),e=this.getX(),t=this.getY(),this.positionAt_(this.getWidth(),this.getHeight(),e,t)}}setBackgroundPath(e,t){let i=this.toolboxPosition_===lS.RIGHT;var o=e+this.CORNER_RADIUS;(o=["M "+(i?o:0)+",0"]).push("h",i?-e:e),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,+!i,i?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("v",Math.max(0,t)),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,+!i,i?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("h",i?e:-e),o.push("z"),this.svgBackground_.setAttribute("d",o.join(" "))}scrollToStart(){let e;null==(e=this.workspace_.scrollbar)||e.setY(0)}wheel_(e){var t=eL(e);if(t.y){let e,i=this.workspace_.getMetricsManager(),o=i.getScrollMetrics();t=i.getViewMetrics().top-o.top+t.y,null==(e=this.workspace_.scrollbar)||e.setY(t),o1(this.workspace_),ou()}e.preventDefault(),e.stopPropagation()}layout_(e){this.workspace_.scale=this.targetWorkspace.scale;var t=this.MARGIN;let i=this.RTL?t:t+this.tabWidth_;for(let o of e)o.getElement().moveBy(i,t),t+=o.getElement().getBoundingRectangle().getHeight()}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;let t=this.dragAngleRange_;return e<t&&e>-t||e<-180+t||e>180-t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;let e=this.svgGroup_.getBoundingClientRect(),t=e.left;return this.toolboxPosition_===lS.LEFT?new lo(-1e9,1e9,-1e9,t+e.width):new lo(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=this.getContents().reduce((e,t)=>Math.max(e,t.getElement().getBoundingRectangle().getWidth()),0);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=lh.scrollbarThickness,this.getWidth()!==e){if(this.RTL)for(let t of this.getContents()){let i=t.getElement().getBoundingRectangle().left,o=e/this.workspace_.scale-t.getElement().getBoundingRectangle().getWidth()-this.MARGIN-this.tabWidth_;t.getElement().moveBy(o-i,0)}this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==lS.LEFT||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};dL.registryName="verticalFlyout",ea(D.FLYOUTS_VERTICAL_TOOLBOX,y,dL);var dy=class extends h0{constructor(e){super(e),this.horizontalLayout=!0}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),i=t.getScrollMetrics(),o=t.getViewMetrics();t=t.getAbsoluteMetrics(),"number"==typeof e.x&&(this.workspace_.scrollX=-(i.left+(i.width-o.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();let t=e.getAbsoluteMetrics(),i=e.getViewMetrics();e=e.getToolboxMetrics();let o=this.toolboxPosition_===lS.TOP;return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?o?e.height:i.height-this.getHeight():o?0:i.height:o?0:i.height+t.top-this.getHeight()}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.width_=e.width,e=e.width-2*this.CORNER_RADIUS;var t=this.getHeight()-this.CORNER_RADIUS;this.setBackgroundPath(e,t),e=this.getX(),t=this.getY(),this.positionAt_(this.getWidth(),this.getHeight(),e,t)}}setBackgroundPath(e,t){let i=this.toolboxPosition_===lS.TOP,o=["M 0,"+(i?0:this.CORNER_RADIUS)];i?(o.push("h",e+2*this.CORNER_RADIUS),o.push("v",t),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("h",-e),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),o.push("h",e),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("v",t),o.push("h",-e-2*this.CORNER_RADIUS)),o.push("z"),this.svgBackground_.setAttribute("d",o.join(" "))}scrollToStart(){let e;null==(e=this.workspace_.scrollbar)||e.setX(this.RTL?1/0:0)}wheel_(e){var t=eL(e);if(t=t.x||t.y){let e,i=this.workspace_.getMetricsManager(),o=i.getScrollMetrics();t=i.getViewMetrics().left-o.left+t,null==(e=this.workspace_.scrollbar)||e.setX(t),o1(this.workspace_),ou()}e.preventDefault(),e.stopPropagation()}layout_(e){this.workspace_.scale=this.targetWorkspace.scale;let t=this.MARGIN,i=t+this.tabWidth_;for(let o of(this.RTL&&(e=e.reverse()),e))e=o.getElement().getBoundingRectangle(),e=this.RTL?i+e.getWidth():i,o.getElement().moveBy(e,t),i+=o.getElement().getBoundingRectangle().getWidth()}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;let 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;let e=this.svgGroup_.getBoundingClientRect(),t=e.top;return this.toolboxPosition_===lS.TOP?new lo(-1e9,t+e.height,-1e9,1e9):new lo(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=this.getContents().reduce((e,t)=>Math.max(e,t.getElement().getBoundingRectangle().getHeight()),0);e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=lh.scrollbarThickness,this.getHeight()!==e&&(this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==lS.TOP||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets())}};ea(D.FLYOUTS_HORIZONTAL_TOOLBOX,y,dy);var dD=class extends c0{constructor(e,t,i,o,s){super(cd.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=dD.dropdownCreate,this.defaultVariableName="string"==typeof e?e:"",this.size_=new ls(0,0),e!==cd.SKIP_SETUP&&(s?this.configure_(s):this.setTypes(i,o),t&&this.setValidator(t))}configure_(e){super.configure_(e),this.setTypes(e.variableTypes,e.defaultType)}initModel(){var e=this.getSourceBlock();if(!e)throw new cp;this.variable||(e=$.getOrCreateVariablePackage$$module$build$src$core$variables(e.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(e.getId()))}initView(){super.initView(),eq(this.fieldGroup_,"blocklyVariableField")}shouldAddBorderRect_(){let e=this.getSourceBlock();if(!e)throw new cp;return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!==e.type)}fromXml(e){var t=this.getSourceBlock();if(!t)throw new cp;let i=e.getAttribute("id"),o=e.textContent,s=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=$.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,i,o,s),null!==s&&s!==t.getType())throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.getType()+", and does not match variable field that references it: "+sg(e)+".");this.setValue(t.getId())}toXml(e){return this.initModel(),e.id=this.variable.getId(),e.textContent=this.variable.getName(),this.variable.getType()&&e.setAttribute("variabletype",this.variable.getType()),e}saveState(e){var t=this.saveLegacyState(dD);return null!==t||(this.initModel(),t={id:this.variable.getId()},e&&(t.name=this.variable.getName(),t.type=this.variable.getType())),t}loadState(e){let t=this.getSourceBlock();if(!t)throw new cp;this.loadLegacyState(dD,e)||(e=$.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.getName():""}getVariable(){return this.variable}getDefaultType(){return this.defaultType}getValidator(){return this.variable?this.validator_:null}doClassValidation_(e){if(null===e)return null;var t=this.getSourceBlock();if(!t)throw new cp;return(t=$.getVariable$$module$build$src$core$variables(t.workspace,e))?(t=t.getType(),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){let t=this.getSourceBlock();if(!t)throw new cp;this.variable=$.getVariable$$module$build$src$core$variables(t.workspace,e),super.doValueUpdate_(e)}typeIsAllowed(e){let t=this.getVariableTypes();if(!t)return!0;for(let i=0;i<t.length;i++)if(e===t[i])return!0;return!1}getVariableTypes(){if(this.variableTypes)return this.variableTypes;if(!this.sourceBlock_||this.sourceBlock_.isDeadOrDying())return[""];let e=this.sourceBlock_.workspace.getVariableMap().getTypes();if(this.sourceBlock_.isInFlyout){let t=this.sourceBlock_.workspace.getPotentialVariableMap();if(!t)return e;e=Array.from(new Set([...e,...t.getTypes()]))}return e}setTypes(e=null,t=""){var i=this.getText();if(Array.isArray(e)){if(0===e.length)throw Error(`'variableTypes' of field variable ${i} was an empty list. If you want to include all variable types, pass 'null' instead.`);i=!1;for(let o=0;o<e.length;o++)e[o]===t&&(i=!0);if(!i)throw Error("Invalid default type '"+t+"' in the definition of a FieldVariable")}else if(null!==e)throw Error(`'variableTypes' was not an array or null in the definition of FieldVariable ${i}`);this.defaultType=t,this.variableTypes=e}refreshVariableName(){this.forceRerender()}onItemSelected_(e,t){if(e=t.getValue(),this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){if(e===hd&&this.variable)return void $.renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable);if(e===hp&&this.variable){e=this.variable.getWorkspace(),$.deleteVariable$$module$build$src$core$variables(e,this.variable,this.sourceBlock_);return}}this.setValue(e)}referencesVariables(){return!0}static fromJson(e){return new this(oX(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.");let e=this.getText(),t=[];var i=this.getSourceBlock();if(i&&!i.isDeadOrDying()){i=i.workspace;let e=this.getVariableTypes();for(let n=0;n<e.length;n++){let r=e[n],l=i.getVariableMap().getVariablesOfType(r);if(t=t.concat(l),i.isFlyout){var o=void 0,s=void 0;t=t.concat(null!=(s=null==(o=i.getPotentialVariableMap())?void 0:o.getVariablesOfType(r))?s:[])}}}for(t.sort(iy),o=[],s=0;s<t.length;s++)o[s]=[t[s].getName(),t[s].getId()];return o.push([$.Msg$$module$build$src$core$msg.RENAME_VARIABLE,hd]),$.Msg$$module$build$src$core$msg.DELETE_VARIABLE&&o.push([$.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",e),hp]),o}};sy("field_variable",dD);var dk=class extends dm{constructor(e,t,i,o,s,n){super(cd.SKIP_SETUP),this.min_=-1/0,this.max_=1/0,this.precision_=0,this.decimalPlaces=null,this.spellcheck_=!1,e!==cd.SKIP_SETUP&&(n?this.configure_(n):this.setConstraints(t,i,o),this.setValue(e),s&&this.setValidator(s))}configure_(e){super.configure_(e),this.setMinInternal(e.min),this.setMaxInternal(e.max),this.setPrecisionInternal(e.precision)}setConstraints(e,t,i){this.setMinInternal(e),this.setMaxInternal(t),this.setPrecisionInternal(i),this.setValue(this.getValue())}setMin(e){this.setMinInternal(e),this.setValue(this.getValue())}setMinInternal(e){null==e?this.min_=-1/0:isNaN(e=Number(e))||(this.min_=e)}getMin(){return this.min_}setMax(e){this.setMaxInternal(e),this.setValue(this.getValue())}setMaxInternal(e){null==e?this.max_=1/0:isNaN(e=Number(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}));let i=t.indexOf(".");this.decimalPlaces=-1===i?e?0:null:t.length-i-1}getPrecision(){return this.precision_}doClassValidation_(e){return null===e||isNaN(e=Number((e=(e=(e=`${e}`.replace(/O/gi,"0")).replace(/,/g,"")).replace(/infinity/i,"Infinity"))||0))?null:(e=Math.min(Math.max(e,this.min_),this.max_),this.precision_&&isFinite(e)&&(e=Math.round(e/this.precision_)*this.precision_),null!==this.decimalPlaces&&(e=Number(e.toFixed(this.decimalPlaces))),e)}widgetCreate_(){let e=super.widgetCreate_();return this.min_>-1/0&&(e.min=`${this.min_}`,t2(e,aD.VALUEMIN,this.min_)),this.max_<1/0&&(e.max=`${this.max_}`,t2(e,aD.VALUEMAX,this.max_)),e}initView(){super.initView(),this.fieldGroup_&&eq(this.fieldGroup_,"blocklyNumberField")}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};sy("field_number",dk),dk.prototype.DEFAULT_VALUE=0;var dw=class extends hh{constructor(e,t,i){super(String(null!=e?e:""),t,i),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(oX(e.text),void 0,e)}};sy("field_label_serializable",dw);var dM=class extends cd{constructor(e,t,i){super(cd.SKIP_SETUP),this.SERIALIZABLE=!0,this.value_=this.value_,this.checkChar=dM.CHECK_CHAR,e!==cd.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.checkCharacter&&(this.checkChar=e.checkCharacter)}saveState(){let e=this.saveLegacyState(dM);return null!==e?e:this.getValueBoolean()}initView(){super.initView();let e=this.getTextElement();eq(this.fieldGroup_,"blocklyCheckboxField"),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||dM.CHECK_CHAR,this.forceRerender()}showEditor_(){this.setValue(!this.value_)}doClassValidation_(e){return!0===e||"TRUE"===e?"TRUE":!1===e||"FALSE"===e?"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"string"==typeof e?"TRUE"===e:!!e}static fromJson(e){return new this(e.checked,void 0,e)}};dM.CHECK_CHAR="✓",sy("field_checkbox",dM),dM.prototype.DEFAULT_VALUE=!1;var dv=class{constructor(e,t){this.draggable=e,this.workspace=t,this.dragTarget=null,this.startLoc=e.getRelativeToSurfaceXY()}onDragStart(e){$.getGroup$$module$build$src$core$events$utils()||$.setGroup$$module$build$src$core$events$utils(!0),this.draggable.startDrag(e)}onDrag(e,t){this.moveDraggable(e,t),ni(t=this.getRoot(this.draggable))&&t.setDeleteStyle(this.wouldDeleteDraggable(e,t)),this.updateDragTarget(e)}updateDragTarget(e){e=this.workspace.getDragTarget(e);let t=this.getRoot(this.draggable);if(this.dragTarget!==e){let i;null==(i=this.dragTarget)||i.onDragExit(t),null==e||e.onDragEnter(t)}null==e||e.onDragOver(t),this.dragTarget=e}moveDraggable(e,t){t=this.pixelsToWorkspaceUnits(t),t=lt.sum(this.startLoc,t),this.draggable.drag(t,e)}wouldDeleteDraggable(e,t){return!!((e=this.workspace.getDragTarget(e))&&this.workspace.getComponentManager().hasCapability(e.id,r6.Capability.DELETE_AREA))&&e.wouldDelete(t)}onDragEnd(e){let t=$.getGroup$$module$build$src$core$events$utils();var i=this.workspace.getDragTarget(e);let o=this.getRoot(this.draggable);if(i){let e;null==(e=this.dragTarget)||e.onDrop(o)}this.shouldReturnToStart(e,o)&&this.draggable.revertDrag(),(i=ni(o)&&this.wouldDeleteDraggable(e,o))&&this.draggable instanceof hD&&sQ(this.draggable.getRootBlock()),this.draggable.endDrag(e),i&&ni(o)&&($.setGroup$$module$build$src$core$events$utils(t),o.dispose()),$.setGroup$$module$build$src$core$events$utils(!1),!i&&te(this.draggable)&&$.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.draggable)}getRoot(e){return e instanceof hD?e.getRootBlock():e}shouldReturnToStart(e,t){return!!(e=this.workspace.getDragTarget(e))&&e.shouldPreventMove(t)}pixelsToWorkspaceUnits(e){return e=new lt(e.x/this.workspace.scale,e.y/this.workspace.scale),this.workspace.isMutator&&e.scale(1/this.workspace.options.parentWorkspace.scale),e}};ea(D.BLOCK_DRAGGER,y,dv);var dP={};dP.BlockDragStrategy=hN,dP.BubbleDragStrategy=c7,dP.CommentDragStrategy=cD,dP.Dragger=dv;var dB=class extends r0{constructor(e,t,i){super(e?e.workspace.id:void 0),this.type=rL.BLOCK_DRAG,e&&(this.blockId=e.id,this.isStart=t,this.blocks=i)}toJson(){let e=super.toJson();if(void 0===this.isStart)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(void 0===this.blockId)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,i){return(t=super.fromJson(e,t,null!=i?i:new dB)).isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};ea(D.EVENT,rL.BLOCK_DRAG,dB);var dx=class extends aC{constructor(e,t,i,o){super(e),this.type=rL.BLOCK_FIELD_INTERMEDIATE_CHANGE,this.recordUndo=!1,e&&(this.name=t,this.oldValue=i,this.newValue=o)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new dx)).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)))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)}};ea(D.EVENT,rL.BLOCK_FIELD_INTERMEDIATE_CHANGE,dx);var dF=class extends aC{constructor(e){super(e),this.type=rL.BLOCK_MOVE,e&&(e.isShadow()&&(this.recordUndo=!1),e=this.currentLocation(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new dF)).oldParentId=e.oldParentId,t.oldInputName=e.oldInputName,e.oldCoordinate&&(i=e.oldCoordinate.split(","),t.oldCoordinate=new lt(Number(i[0]),Number(i[1]))),t.newParentId=e.newParentId,t.newInputName=e.newInputName,e.newCoordinate&&(i=e.newCoordinate.split(","),t.newCoordinate=new lt(Number(i[0]),Number(i[1]))),void 0!==e.reason&&(t.reason=e.reason),void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}recordNew(){let 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={};let i=t.getParent();return i?(e.parentId=i.id,(t=i.getInputWithBlock(t))&&(e.inputName=t.name)):e.coordinate=t.getRelativeToSurfaceXY(),e}isNull(){return this.oldParentId===this.newParentId&&this.oldInputName===this.newInputName&<.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 i=t.getBlockById(this.blockId);if(i){var o=e?this.newParentId:this.oldParentId,s=e?this.newInputName:this.oldInputName;if(e=e?this.newCoordinate:this.oldCoordinate,o){var n=t.getBlockById(o);if(!n)return void console.warn("Can't connect to non-existent block: "+o)}if(i.getParent()&&i.unplug(),e)s=i.getRelativeToSurfaceXY(),i.moveBy(e.x-s.x,e.y-s.y,this.reason);else{let e,o;(!(t=i.outputConnection)||i.previousConnection&&i.previousConnection.isConnected())&&(t=i.previousConnection),i=null==(o=t)?void 0:o.type,s?(i=n.getInput(s))&&(e=i.connection):i===c5.PREVIOUS_STATEMENT&&(e=n.nextConnection),e&&t?t.connect(e):console.warn("Can't connect to non-existent input: "+s)}}else console.warn("Can't move non-existent block: "+this.blockId)}};ea(D.EVENT,rL.BLOCK_MOVE,dF);var dG,dH,dU,dW,dV,dK,dY,dX,dz,dj,dJ=class extends r0{constructor(e,t,i){super(e?e.workspace.id:void 0),this.type=rL.BUBBLE_OPEN,e&&(this.blockId=e.id,this.isOpen=t,this.bubbleType=i)}toJson(){let e=super.toJson();if(void 0===this.isOpen)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,i){return(t=super.fromJson(e,t,null!=i?i:new dJ)).isOpen=e.isOpen,t.bubbleType=e.bubbleType,t.blockId=e.blockId,t}};(e=dj||(dj={})).MUTATOR="mutator",e.COMMENT="comment",e.WARNING="warning",ea(D.EVENT,rL.BUBBLE_OPEN,dJ);var dZ={};dZ.BubbleOpen=dJ,dZ.BubbleType=dj;var dq=class extends rQ{constructor(e){super(),this.isBlank=!e,e&&(this.commentId=e.id,this.workspaceId=e.workspace.id,this.group=$.getGroup$$module$build$src$core$events$utils(),this.recordUndo=eG())}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new dq)).commentId=e.commentId,t}static CommentCreateDeleteHelper(e,t){let i=e.getEventWorkspace_();if(t){if(!e.json)throw Error("Encountered a comment event without proper json");tZ(e.json,i)}else{if(!e.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(t=i.getCommentById(e.commentId))?t.dispose():console.warn("Can't delete non-existent comment: "+e.commentId)}}},dQ=class extends dq{constructor(e,t,i){super(e),this.type=rL.COMMENT_CHANGE,e&&(this.oldContents_=void 0===t?"":t,this.newContents_=void 0===i?"":i)}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new dQ)).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 i=e?this.newContents_:this.oldContents_;if(void 0===i){if(e)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson")}t.setText(i)}else console.warn("Can't change non-existent comment: "+this.commentId)}};ea(D.EVENT,rL.COMMENT_CHANGE,dQ);var d0=class extends dq{constructor(e,t){super(e),this.newCollapsed=t,this.type=rL.COMMENT_COLLAPSE}toJson(){let e=super.toJson();if(void 0===this.newCollapsed)throw Error("The new collapse value undefined. Either call recordNew, or call fromJson");return e.newCollapsed=this.newCollapsed,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d0)).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)}};ea(D.EVENT,rL.COMMENT_COLLAPSE,d0);var d1=class extends dq{constructor(e){super(e),this.type=rL.COMMENT_CREATE,e&&(this.xml=sa(e),this.json=tJ(e,{addCoordinates:!0}))}toJson(){let 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=sg(this.xml),e.json=this.json,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d1)).xml=$.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}run(e){dq.CommentCreateDeleteHelper(this,e)}};ea(D.EVENT,rL.COMMENT_CREATE,d1);var d2=class extends dq{constructor(e){super(e),this.type=rL.COMMENT_DELETE,e&&(this.xml=sa(e),this.json=tJ(e,{addCoordinates:!0}))}run(e){dq.CommentCreateDeleteHelper(this,!e)}toJson(){let 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=sg(this.xml),e.json=this.json,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d2)).xml=$.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}};ea(D.EVENT,rL.COMMENT_DELETE,d2);var d3=class extends r0{constructor(e,t){super(e?e.workspace.id:void 0),this.type=rL.COMMENT_DRAG,e&&(this.commentId=e.id,this.isStart=t)}toJson(){let e=super.toJson();if(void 0===this.isStart)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(void 0===this.commentId)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,i){return(t=super.fromJson(e,t,null!=i?i:new d3)).isStart=e.isStart,t.commentId=e.commentId,t}};ea(D.EVENT,rL.COMMENT_DRAG,d3);var d5=class extends dq{constructor(e){super(e),this.type=rL.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(){let 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,i){return t=super.fromJson(e,t,null!=i?i:new d5),i=e.oldCoordinate.split(","),t.oldCoordinate_=new lt(Number(i[0]),Number(i[1])),i=e.newCoordinate.split(","),t.newCoordinate_=new lt(Number(i[0]),Number(i[1])),t}isNull(){return lt.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_))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)}};ea(D.EVENT,rL.COMMENT_MOVE,d5);var d6=class extends dq{constructor(e){super(e),this.type=rL.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)))throw Error("The comment associated with the comment resize event could not be found");this.newSize=e.getSize()}toJson(){let 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,i){return(t=super.fromJson(e,t,null!=i?i:new d6)).oldSize=new ls(e.oldWidth,e.oldHeight),t.newSize=new ls(e.newWidth,e.newHeight),t}isNull(){return ls.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))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)}};ea(D.EVENT,rL.COMMENT_RESIZE,d6);var d4=class extends r0{constructor(e,t,i){super(i),this.type=rL.TOOLBOX_ITEM_SELECT,this.oldItem=null!=e?e:void 0,this.newItem=null!=t?t:void 0}toJson(){let e=super.toJson();return e.oldItem=this.oldItem,e.newItem=this.newItem,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d4)).oldItem=e.oldItem,t.newItem=e.newItem,t}};ea(D.EVENT,rL.TOOLBOX_ITEM_SELECT,d4);var d8=class extends uW{constructor(e,t,i){super(e),this.oldType=t,this.newType=i,this.type=rL.VAR_TYPE_CHANGE}toJson(){let e=super.toJson();if(!this.oldType||!this.newType)throw Error("The variable's types are undefined. Either pass them to the constructor, or call fromJson");return e.oldType=this.oldType,e.newType=this.newType,e}static fromJson(e,t,i){return(t=super.fromJson(e,t,null!=i?i:new d8)).oldType=e.oldType,t.newType=e.newType,t}run(e){let 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.oldType||!this.newType)throw Error("The variable's types are undefined. Either pass them to the constructor, or call fromJson");let i=t.getVariableMap().getVariableById(this.varId);i&&(e?t.getVariableMap().changeVariableType(i,this.newType):t.getVariableMap().changeVariableType(i,this.oldType))}};ea(D.EVENT,rL.VAR_TYPE_CHANGE,d8);var d9=class extends rQ{constructor(e){super(),this.isBlank=!0,this.recordUndo=!1,this.type=rL.FINISHED_LOADING,this.isBlank=!!e,e&&(this.workspaceId=e.id)}};ea(D.EVENT,rL.FINISHED_LOADING,d9),$.BLOCK_CHANGE$$module$build$src$core$events$events=rL.BLOCK_CHANGE,$.BLOCK_CREATE$$module$build$src$core$events$events=rL.BLOCK_CREATE,$.BLOCK_DELETE$$module$build$src$core$events$events=rL.BLOCK_DELETE,t=rL.BLOCK_DRAG,$.BLOCK_MOVE$$module$build$src$core$events$events=rL.BLOCK_MOVE,i=rL.BLOCK_FIELD_INTERMEDIATE_CHANGE,o=rL.BUBBLE_OPEN,s=rL.BLOCK_CHANGE,n=rL.CLICK,l=rL.COMMENT_CHANGE,a=rL.COMMENT_CREATE,c=rL.COMMENT_DELETE,h=rL.COMMENT_MOVE,u=rL.COMMENT_RESIZE,d=rL.COMMENT_DRAG,p=rL.BLOCK_CREATE,_=rL.BLOCK_DELETE,g=rL.FINISHED_LOADING,E=rL.BLOCK_MOVE,T=rL.SELECTED,m=rL.THEME_CHANGE,f=rL.TOOLBOX_ITEM_SELECT,I=rL.TRASHCAN_OPEN,S=rL.UI,R=rL.VAR_CREATE,b=rL.VAR_DELETE,C=rL.VAR_RENAME,O=rL.VIEWPORT_CHANGE,(A={}).Abstract=rQ,A.BLOCK_CHANGE=$.BLOCK_CHANGE$$module$build$src$core$events$events,A.BLOCK_CREATE=$.BLOCK_CREATE$$module$build$src$core$events$events,A.BLOCK_DELETE=$.BLOCK_DELETE$$module$build$src$core$events$events,A.BLOCK_DRAG=t,A.BLOCK_FIELD_INTERMEDIATE_CHANGE=i,A.BLOCK_MOVE=$.BLOCK_MOVE$$module$build$src$core$events$events,A.BUBBLE_OPEN=o,A.BUMP_EVENTS=z,A.BlockBase=aC,A.BlockChange=aO,A.BlockCreate=cK,A.BlockDelete=cZ,A.BlockDrag=dB,A.BlockFieldIntermediateChange=dx,A.BlockMove=dF,A.BubbleOpen=dJ,A.BubbleType=dj,A.CHANGE=s,A.CLICK=n,A.COMMENT_CHANGE=l,A.COMMENT_CREATE=a,A.COMMENT_DELETE=c,A.COMMENT_DRAG=d,A.COMMENT_MOVE=h,A.COMMENT_RESIZE=u,A.CREATE=p,A.Click=r1,A.ClickTarget=rq,A.CommentBase=dq,A.CommentChange=dQ,A.CommentCollapse=d0,A.CommentCreate=d1,A.CommentDelete=d2,A.CommentDrag=d3,A.CommentMove=d5,A.CommentResize=d6,A.DELETE=_,A.FINISHED_LOADING=g,A.FinishedLoading=d9,A.MOVE=E,A.SELECTED=T,A.Selected=cJ,A.THEME_CHANGE=m,A.TOOLBOX_ITEM_SELECT=f,A.TRASHCAN_OPEN=I,A.ThemeChange=cX,A.ToolboxItemSelect=d4,A.TrashcanOpen=uj,A.UI=S,A.UiBase=r0,A.VAR_CREATE=R,A.VAR_DELETE=b,A.VAR_RENAME=C,A.VIEWPORT_CHANGE=O,A.VarBase=uW,A.VarCreate=uV,A.VarDelete=uY,A.VarRename=uX,A.VarTypeChange=d8,A.ViewportChange=cz,A.clearPendingUndo=eK,A.disable=$.disable$$module$build$src$core$events$utils,A.disableOrphans=eJ,A.enable=$.enable$$module$build$src$core$events$utils,A.filter=eV,A.fire=eH,A.fromJson=ez,A.get=ej,A.getDescendantIds=eX,A.getGroup=$.getGroup$$module$build$src$core$events$utils,A.getRecordUndo=eG,A.isEnabled=eY,A.setGroup=$.setGroup$$module$build$src$core$events$utils,A.setRecordUndo=$.setRecordUndo$$module$build$src$core$events$utils;var d7={};d7.BottomRow=df,d7.ConstantProvider=dg,d7.Drawer=dE,d7.PathObject=dC,d7.RenderInfo=db,d7.Renderer=dO,d7.RightConnectionShape=dS,d7.StatementInput=dI,d7.TopRow=dR,rm();var pe={};pe.registerCleanup=n8,pe.registerCollapse=n7,pe.registerCollapseExpandBlock=rc,pe.registerComment=rl,pe.registerCommentCreate=rg,pe.registerCommentDelete=rp,pe.registerCommentDuplicate=r_,pe.registerCommentOptions=function(){r_(),rp(),rg()},pe.registerDefaultOptions=rm,pe.registerDelete=ru,pe.registerDeleteAll=rs,pe.registerDisable=rh,pe.registerDuplicate=rr,pe.registerExpand=re,pe.registerHelp=rd,pe.registerInline=ra,pe.registerRedo=n4,pe.registerUndo=n6;var pt="button",pi=class{load(e,t){return(e=new hB(t.getWorkspace(),t.targetWorkspace,e,!1)).show(),new hM(e,pt)}gapForItem(e,t){return t}disposeItem(e){(e=e.getElement())instanceof hB&&e.dispose()}getType(){return pt}};ea(D.FLYOUT_INFLATER,pt,pi);var po={};po.Bubble=he,po.MiniWorkspaceBubble=ht,po.TextBubble=hL,po.TextInputBubble=ut;var ps="block",pn=class{constructor(){this.permanentlyDisabledBlocks=new Set,this.listeners=new Map,this.capacityWrapper=this.filterFlyoutBasedOnCapacity.bind(this)}load(e,t){return this.setFlyout(t),(e=this.createBlock(e,t.getWorkspace())).isEnabled()?this.updateStateBasedOnCapacity(e):this.permanentlyDisabledBlocks.add(e),e.getDescendants(!1).forEach(e=>e.isInFlyout=!0),this.addBlockListeners(e),new hM(e,ps)}createBlock(e,t){return e.blockxml?(e="string"==typeof e.blockxml?$.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,t=sT(e,t)):(void 0===e.enabled&&(e.enabled="true"!==e.disabled&&!0!==e.disabled),void 0===e.disabledReasons&&!1===e.enabled&&(e.disabledReasons=[lJ]),"x"in e&&delete e.x,"y"in e&&delete e.y,t=iU(e,t)),t}gapForItem(e,t){let i;return e.gap?i=parseInt(String(e.gap)):e.blockxml&&(i=parseInt((e="string"==typeof e.blockxml?$.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml).getAttribute("gap"))),!i||isNaN(i)?t:i}disposeItem(e){(e=e.getElement())instanceof hD&&(this.removeListeners(e.id),e.dispose(!1,!1))}removeListeners(e){let t;(null!=(t=this.listeners.get(e))?t:[]).forEach(e=>eO(e)),this.listeners.delete(e)}setFlyout(e){if(this.flyout!==e){var t;if(this.flyout){let e;null==(e=this.flyout.targetWorkspace)||e.removeChangeListener(this.capacityWrapper)}this.flyout=e,null==(t=this.flyout.targetWorkspace)||t.addChangeListener(this.capacityWrapper)}}updateStateBasedOnCapacity(e){let t,i,o=null==(t=this.flyout)||null==(i=t.targetWorkspace)?void 0:i.isCapacityAvailable(t_(e));for(;e;)e.setDisabledReason(!o,"WORKSPACE_AT_BLOCK_CAPACITY"),e=e.getNextBlock()}addBlockListeners(e){let t=[];t.push(eb(e.getSvgRoot(),"pointerdown",e,t=>{let i,o,s=null==(i=this.flyout)||null==(o=i.targetWorkspace)?void 0:o.getGesture(t);s&&this.flyout&&(s.setStartBlock(e),s.handleFlyoutStart(t,this.flyout))})),t.push(eC(e.getSvgRoot(),"pointermove",null,()=>{let t,i;(null==(t=this.flyout)||null==(i=t.targetWorkspace)?0:i.isDragging())||e.addSelect()})),t.push(eC(e.getSvgRoot(),"pointerleave",null,()=>{let t,i;(null==(t=this.flyout)||null==(i=t.targetWorkspace)?0:i.isDragging())||e.removeSelect()})),this.listeners.set(e.id,t)}filterFlyoutBasedOnCapacity(e){!this.flyout||e&&e.type!==rL.BLOCK_CREATE&&e.type!==rL.BLOCK_DELETE||this.flyout.getWorkspace().getTopBlocks(!1).forEach(e=>{this.permanentlyDisabledBlocks.has(e)||this.updateStateBasedOnCapacity(e)})}getType(){return ps}};ea(D.FLYOUT_INFLATER,ps,pn);var pr=class extends uN{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;","}"])}},pl=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_+"\n"+this.inlineSteps_}drawTopCorner(e){this.steps_+=sV(e.xPos,this.info_.startY);for(let t=0,i;i=e.elements[t];t++)ur.isLeftSquareCorner(i)?this.steps_+=this.highlightConstants_.START_POINT:ur.isLeftRoundedCorner(i)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):ur.isPreviousConnection(i)?this.steps_+=this.notchPaths_.pathLeft:ur.isHat(i)?this.steps_+=this.startPaths_.path(this.RTL_):ur.isSpacer(i)&&0!==i.width&&(this.steps_+=sX("H",i.xPos+i.width-this.highlightOffset));this.steps_+=sX("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+sX("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(e){let t=e.getLastInput();if(this.RTL_){let i=e.height-t.connectionHeight;this.steps_+=sW(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+sX("v",i)}else this.steps_+=sW(t.xPos+t.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(e){let t=e.getLastInput();if(t)if(this.RTL_){let i=e.height-2*this.insideCornerPaths_.height;this.steps_+=sW(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+sX("v",i)+this.insideCornerPaths_.pathBottom(this.RTL_)+sK(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=sW(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+sK(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){let t=e.xPos+e.width-this.highlightOffset;e instanceof uC&&e.followsStatement&&(this.steps_+=sX("H",t)),this.RTL_&&(this.steps_+=sX("H",t),e.height>this.highlightOffset&&(this.steps_+=sX("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=sX("V",e.baseline-this.highlightOffset);else{let t=this.info_.bottomRow.elements[0];ur.isLeftSquareCorner(t)?this.steps_+=sW(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):ur.isLeftRoundedCorner(t)&&(this.steps_+=sW(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_+=sW(this.info_.startX,e):(this.steps_+=sW(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=sX("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,ur.isLeftRoundedCorner(e.elements[0])?this.steps_+=sX("V",this.outsideCornerPaths_.height):this.steps_+=sX("V",e.capline+this.highlightOffset))}drawInlineInput(e){let t=this.highlightOffset,i=e.xPos+e.connectionWidth;var o=e.centerline-e.height/2;let s=e.width-e.connectionWidth,n=o+t;this.RTL_?(o=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=sW(i-t,n)+sX("v",o)+this.puzzleTabPaths_.pathDown(this.RTL_)+sX("v",e)+sX("h",s)):this.inlineSteps_+=sW(e.xPos+e.width+t,n)+sX("v",e.height)+sX("h",-s)+sW(i,o+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},pa=class extends uy{constructor(e,t){super(e,t),this.highlighter_=new pl(t)}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights();let e=this.block_.pathObject;e.setPath(this.outlinePath_+"\n"+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_+=sX("H",e.xPos+e.width)+sX("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){let t=e.centerline-e.height/2;if(e.connectionModel){let i=e.xPos+e.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(i*=-1),e.connectionModel.setOffsetInBlock(i,t+e.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(e){let t=e.getLastInput();if(null==t?0:t.connectionModel){let i=e.xPos+e.statementEdge+t.notchOffset;i=this.info_.RTL?-1*i:i+this.constants_.DARK_PATH_OFFSET,t.connectionModel.setOffsetInBlock(i,e.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(e){let t=e.getLastInput();if(t&&t.connectionModel){let i=e.xPos+e.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionNextConnection_(){let e=this.info_.bottomRow;if(e.connection){let t=e.connection,i=t.xPos;t.connectionModel.setOffsetInBlock((this.info_.RTL?-i:i)+this.constants_.DARK_PATH_OFFSET/2,e.baseline+this.constants_.DARK_PATH_OFFSET)}}},pc=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=sV(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(){let e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,i=(1-Math.SQRT1_2)*(e+t)-t,o=sV(i,i)+sz("a","0 0,0",e,sH(-i-t,e-i)),s=sz("a","0 0,0",e+t,sH(e+t,e+t)),n=sV(i,-i)+sz("a","0 0,0",e+t,sH(e-i,i+t));return{width:e+t,height:e,pathTop:e=>e?o:"",pathBottom:e=>e?s:n}}makeOutsideCorner(){let e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,i=(1-Math.SQRT1_2)*(e-t)+t,o=sV(i,i)+sz("a","0 0,1",e-t,sH(e-i,-i+t)),s=sV(t,e)+sz("a","0 0,1",e-t,sH(e,-e+t)),n=-i,r=sV(i,n)+sz("a","0 0,1",e-t,sH(-i+t,-n-e));return{height:e,topLeft:e=>e?o:s,bottomLeft:()=>r}}makePuzzleTab(){let e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,i=sV(-2,-t+2.5+.9)+sK(-.45*e,-2.1),o=sX("v",2.5)+sV(-(.97*e),2.5)+sU("q",[sH(-(.05*e),10),sH(.3*e,9.5)])+sV(.67*e,-1.9)+sX("v",2.5),s=sX("v",-1.5)+sV(-.92*e,-.5)+sU("q",[sH(-.19*e,-5.5),sH(0,-11)])+sV(.92*e,1),n=sV(-5,t-.7)+sK(.46*e,-2.1);return{width:e,height:t,pathUp:e=>e?i:s,pathDown:e=>e?o:n}}makeNotch(){return{pathLeft:sX("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:sK(5.1,2.6)+sV(-10.2,6.8)+sK(5.1,2.6),height:12,width:10.2}}makeStartHat(){let e=this.constantProvider.START_HAT.height,t=sV(25,-8.7)+sU("c",[sH(29.7,-6.2),sH(57.2,-.5),sH(75,8.7)]),i=sU("c",[sH(17.8,-9.2),sH(45.3,-14.9),sH(75,-8.7)])+sW(100.5,e+.5);return{path:e=>e?t:i}}},ph=class extends uT{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)}},pu=class extends uA{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},pd=class extends uD{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 hI||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}addInput_(e,t){this.isInline&&e instanceof $.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new ph(this.constants_,e)),t.hasInlineInput=!0):e instanceof hI?(t.elements.push(new pu(this.constants_,e)),t.hasStatement=!0):e instanceof $.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new ud(this.constants_,e)),t.hasExternalInput=!0):(e instanceof hm||e instanceof hf)&&(t.minHeight=Math.max(t.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),this.isInline||null!==t.align||(t.align=e.align)}addElemSpacing_(){let e=!1;for(let t=0,i;i=this.rows[t];t++)i.hasExternalInput&&(e=!0);for(let i=0,o;o=this.rows[i];i++){var t=o.elements;if(o.elements=[],o.startsWithElemSpacer()&&o.elements.push(new uE(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let e=0;e<t.length-1;e++){o.elements.push(t[e]);let i=this.getInRowSpacing_(t[e],t[e+1]);o.elements.push(new uE(this.constants_,i))}o.elements.push(t[t.length-1]),o.endsWithElemSpacer()&&(t=this.getInRowSpacing_(t[t.length-1],null),e&&o.hasDummyInput&&(t+=this.constants_.TAB_WIDTH),o.elements.push(new uE(this.constants_,t)))}}}getInRowSpacing_(e,t){if(!e)return t&&ur.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&ur.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&ur.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!ur.isInput(e)&&(!t||ur.isStatementInput(t)))return ur.isField(e)&&e.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:ur.isIcon(e)?2*this.constants_.LARGE_PADDING+1:ur.isHat(e)?this.constants_.NO_PADDING:ur.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:ur.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:ur.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(ur.isInput(e)&&!t){if(ur.isExternalInput(e))return this.constants_.NO_PADDING;if(ur.isInlineInput(e))return this.constants_.LARGE_PADDING;if(ur.isStatementInput(e))return this.constants_.NO_PADDING}if(!ur.isInput(e)&&t&&ur.isInput(t)){if(ur.isField(e)&&e.isEditable){if(ur.isInlineInput(t)||ur.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(ur.isInlineInput(t)||ur.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(ur.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(ur.isIcon(e)&&t&&!ur.isInput(t))return this.constants_.LARGE_PADDING;if(ur.isInlineInput(e)&&t&&ur.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(ur.isLeftSquareCorner(e)&&t){if(ur.isHat(t))return this.constants_.NO_PADDING;if(ur.isPreviousConnection(t))return t.notchOffset;if(ur.isNextConnection(t))return t.notchOffset+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}if(ur.isLeftRoundedCorner(e)&&t){if(ur.isPreviousConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS;if(ur.isNextConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}return ur.isField(e)&&t&&ur.isField(t)&&e.isEditable===t.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING:t&&ur.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return ur.isTopRow(e)&&ur.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:ur.isTopRow(e)||ur.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(ur.isSpacer(t))return e.yPos+t.height/2;if(ur.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,ur.isNextConnection(t)?e+t.height/2:e-t.height/2;if(ur.isTopRow(e))return ur.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let i=e.yPos;return ur.isField(t)||ur.isIcon(t)?(i+=t.height/2,(e.hasInlineInput||e.hasStatement)&&t.height+this.constants_.TALL_INPUT_FIELD_OFFSET_Y<=e.height&&(i+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y)):i=ur.isInlineInput(t)?i+t.height/2:i+e.height/2,i}alignRowElements_(){if(this.isInline){var e=0,t=new WeakMap,i=null;for(let o=this.rows.length-1,s;s=this.rows[o];o--)t.set(s,e),ur.isInputRow(s)&&(s.hasStatement&&this.alignStatementRow_(s),i&&i.hasStatement&&s.width<i.width?t.set(s,i.width):e=s.hasStatement?s.width:Math.max(e,s.width),i=s);e=0;for(let o=0,s;s=this.rows[o];o++)s.hasStatement?e=this.getDesiredRowWidth_(s):ur.isSpacer(s)?s.width=Math.max(e,t.get(s)):(i=s.width,(e=Math.max(e,t.get(s))-i)>0&&this.addAlignmentPadding_(s,e),e=s.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 o=0,s;s=this.rows[o];o++){s.yPos=t,s.xPos=this.startX,t+=s.height,e=Math.max(e,s.widthWithConnectedBlocks);var i=t-this.topRow.ascenderHeight;s===this.bottomRow&&i<this.constants_.MIN_BLOCK_HEIGHT&&(i=this.constants_.MIN_BLOCK_HEIGHT-i,this.bottomRow.height+=i,t+=i),this.recordElemPositions_(s)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(i=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,i.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}},pp=class extends uk{constructor(e,t,i){super(e,t,i),this.constants=i,this.colourDark="#000000",this.svgPathDark=eZ(li.PATH,{class:"blocklyPathDark",transform:"translate(1,1)"}),this.svgRoot.insertBefore(this.svgPathDark,this.svgPath),this.svgPathLight=eZ(li.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=oW("#000",this.style.colourPrimary,.2)||this.colourDark}updateHighlighted(e){super.updateHighlighted(e),this.svgPathLight.style.display=e?"none":"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")}},p_=class extends uw{constructor(e){super(e),this.highlightConstants=null}init(e,t){super.init(e,t),this.highlightConstants=this.makeHighlightConstants_(),this.highlightConstants.init()}refreshDom(e,t,i){super.refreshDom(e,t,i),this.getHighlightConstants().init()}makeConstants_(){return new pr}makeRenderInfo_(e){return new pd(this,e)}makeDrawer_(e,t){return new pa(e,t)}makePathObject(e,t){return new pp(e,t,this.getConstants())}makeHighlightConstants_(){return new pc(this.getConstants())}getHighlightConstants(){if(!this.highlightConstants)throw Error("Cannot access the highlight constants because init has not been called");return this.highlightConstants}};nA("geras",p_);var pg={};pg.ConstantProvider=pr,pg.Drawer=pa,pg.HighlightConstantProvider=pc,pg.Highlighter=pl,pg.InlineInput=ph,pg.PathObject=pp,pg.RenderInfo=pd,pg.Renderer=p_,pg.StatementInput=pu;var pE=class extends uD{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++){let o=this.rows[t];var i=o.elements;if(o.elements=[],o.startsWithElemSpacer()&&o.elements.push(new uE(this.constants_,this.getInRowSpacing_(null,i[0]))),i.length){for(let e=0;e<i.length-1;e++){o.elements.push(i[e]);let t=this.getInRowSpacing_(i[e],i[e+1]);o.elements.push(new uE(this.constants_,t))}o.elements.push(i[i.length-1]),o.endsWithElemSpacer()&&(i=this.getInRowSpacing_(i[i.length-1],null),e&&o.hasDummyInput&&(i+=this.constants_.TAB_WIDTH),o.elements.push(new uE(this.constants_,i)))}}}getInRowSpacing_(e,t){if(!e)return t&&ur.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&ur.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&ur.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!ur.isInput(e)&&!t)return ur.isField(e)&&e.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:ur.isIcon(e)?2*this.constants_.LARGE_PADDING+1:ur.isHat(e)?this.constants_.NO_PADDING:ur.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:ur.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:ur.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(ur.isInput(e)&&!t){if(ur.isExternalInput(e))return this.constants_.NO_PADDING;if(ur.isInlineInput(e))return this.constants_.LARGE_PADDING;if(ur.isStatementInput(e))return this.constants_.NO_PADDING}if(!ur.isInput(e)&&t&&ur.isInput(t)){if(ur.isField(e)&&e.isEditable){if(ur.isInlineInput(t)||ur.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(ur.isInlineInput(t)||ur.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(ur.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(ur.isIcon(e)&&t&&!ur.isInput(t))return this.constants_.LARGE_PADDING;if(ur.isInlineInput(e)&&t&&ur.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(ur.isLeftSquareCorner(e)&&t){if(ur.isHat(t))return this.constants_.NO_PADDING;if(ur.isPreviousConnection(t)||ur.isNextConnection(t))return t.notchOffset}return ur.isLeftRoundedCorner(e)&&t?t.notchOffset-this.constants_.CORNER_RADIUS:ur.isField(e)&&t&&ur.isField(t)&&e.isEditable===t.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING:t&&ur.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return ur.isTopRow(e)&&ur.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:ur.isTopRow(e)||ur.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(ur.isSpacer(t))return e.yPos+t.height/2;if(ur.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,ur.isNextConnection(t)?e+t.height/2:e-t.height/2;if(ur.isTopRow(e))return ur.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let i=e.yPos;return ur.isField(t)&&e.hasStatement?i+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+t.height/2):i+e.height/2}finalize_(){let e=0,t=0;for(var i=0;i<this.rows.length;i++){let s=this.rows[i];s.yPos=t,s.xPos=this.startX,t+=s.height,e=Math.max(e,s.widthWithConnectedBlocks);var o=t-this.topRow.ascenderHeight;s===this.bottomRow&&o<this.constants_.MIN_BLOCK_HEIGHT&&(o=this.constants_.MIN_BLOCK_HEIGHT-o,this.bottomRow.height+=o,t+=o),this.recordElemPositions_(s)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(i=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,i.getHeightWidth().width)),this.bottomRow.baseline=t-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX,this.height=t,this.startY=this.topRow.capline}},pT=class extends uw{constructor(e){super(e)}makeRenderInfo_(e){return new pE(this,e)}};nA("thrasos",pT);var pm={};pm.RenderInfo=pE,pm.Renderer=pT;var pf=new c4("zelos",{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"}},{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"}}),pI=class{constructor(e,t,i){this.id_=e.toolboxitemid||ey(),this.level_=(this.parent_=i||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){}getFocusableElement(){let e=this.getDiv();if(!e)throw Error("Trying to access toolbox item before DOM is initialized.");if(!(e instanceof HTMLElement))throw Error("Toolbox item div is unexpectedly not an HTML element.");return e}getFocusableTree(){return this.parentToolbox_}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}},pS=class extends pI{constructor(e,t,i){super(e,t,i),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_(),"true"===this.toolboxItemDef_.hidden&&this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategoryContainer",row:"blocklyToolboxCategory",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyToolboxCategoryIcon",label:"blocklyToolboxCategoryLabel",contents:"blocklyToolboxCategoryGroup",selected:"blocklyToolboxSelected",openicon:"blocklyToolboxCategoryIconOpen",closedicon:"blocklyToolboxCategoryIconClosed"}}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else if(e=e.contents)for(let t=0;t<e.length;t++){let i=e[t];Array.isArray(this.flyoutItems_)&&this.flyoutItems_.push(i)}}parseCategoryDef_(e){this.name_="name"in e?oX(e.name):"",this.colour_=this.getColour_(e),Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}createDom_(){this.htmlDiv_=this.createContainer_(),t1(this.htmlDiv_,lH.TREEITEM),t2(this.htmlDiv_,aD.SELECTED,!1),t2(this.htmlDiv_,aD.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_(),t1(this.iconDom_,lH.PRESENTATION),this.rowContents_.appendChild(this.iconDom_),this.labelDom_=this.createLabelDom_(this.name_),this.rowContents_.appendChild(this.labelDom_);let e=this.labelDom_.getAttribute("id");return e&&t2(this.htmlDiv_,aD.LABELLEDBY,e),this.addColourBorder_(this.colour_),this.htmlDiv_}createContainer_(){let e=document.createElement("div");e.tabIndex=-1,e.id=this.getId();let t=this.cssConfig_.container;return t&&eq(e,t),e}createRowContainer_(){let e=document.createElement("div");var t=this.cssConfig_.row;return t&&eq(e,t),t=`${pS.nestedPadding*this.getLevel()}px`,this.workspace_.RTL?e.style.paddingRight=t:e.style.paddingLeft=t,e}createRowContentsContainer_(){let e=document.createElement("div"),t=this.cssConfig_.rowcontentcontainer;return t&&eq(e,t),e}createIconDom_(){let e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){let t=this.cssConfig_.icon;t&&eq(e,t)}return e.style.display="inline-block",e}createLabelDom_(e){let t=document.createElement("span");return t.setAttribute("id",this.getId()+".label"),t.textContent=e,(e=this.cssConfig_.label)&&eq(t,e),t}refreshTheme(){this.colour_=this.getColour_(this.toolboxItemDef_),this.addColourBorder_(this.colour_)}addColourBorder_(e){e&&(e=pS.borderWidth+"px solid "+(e||"#ddd"),this.workspace_.RTL?this.rowDiv_.style.borderRight=e:this.rowDiv_.style.borderLeft=e)}getColour_(e){let 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(null==(e=oX(e))||""===e)return"";var t=Number(e);return isNaN(t)?(t=oF(e))?t:(console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+e),""):oV(t)}openIcon_(e){if(e){var t=this.cssConfig_.closedicon;t&&eQ(e,t),(t=this.cssConfig_.openicon)&&eq(e,t)}}closeIcon_(e){if(e){var t=this.cssConfig_.openicon;t&&eQ(e,t),(t=this.cssConfig_.closedicon)&&eq(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()).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){let e=this.parseColour(pS.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||e,t&&eq(this.rowDiv_,t)}else this.rowDiv_.style.backgroundColor="",t&&e0(this.rowDiv_,t);t2(this.htmlDiv_,aD.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_="string"==typeof e?{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:tF(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(){e2(this.htmlDiv_)}};pS.registrationName="category",pS.nestedPadding=19,pS.borderWidth=8,pS.defaultBackgroundColour="#57e",tf('\n.blocklyToolboxCategory:not(.blocklyToolboxSelected):hover {\n background-color: rgba(255, 255, 255, .2);\n}\n\n.blocklyToolbox[layout="h"] .blocklyToolboxCategoryContainer {\n margin: 1px 5px 1px 0;\n}\n\n.blocklyToolbox[dir="RTL"][layout="h"] .blocklyToolboxCategoryContainer {\n margin: 1px 0 1px 5px;\n}\n\n.blocklyToolboxCategory {\n height: 22px;\n line-height: 22px;\n margin-bottom: 3px;\n padding-right: 8px;\n white-space: nowrap;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxCategory {\n margin-left: 8px;\n padding-right: 0;\n}\n\n.blocklyToolboxCategoryIcon {\n background-image: url(<<<PATH>>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyToolboxCategoryIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxCategoryIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyToolboxCategoryIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyToolboxCategoryLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyToolboxCategoryLabel {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxSelected .blocklyToolboxCategoryLabel {\n color: #fff;\n}\n'),ea(D.TOOLBOX_ITEM,pS.registrationName,pS);var pR=class extends pI{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_(){let e=document.createElement("div");e.tabIndex=-1,e.id=this.getId();let t=this.cssConfig_.container;return t&&eq(e,t),this.htmlDiv=e}getDiv(){return this.htmlDiv}dispose(){e2(this.htmlDiv)}};pR.registrationName="sep",tf('\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolbox[layout="h"] .blocklyTreeSeparator {\n border-right: solid #e5e5e5 1px;\n border-bottom: none;\n height: auto;\n margin: 0 5px 0 5px;\n padding: 5px 0;\n width: 0;\n}\n'),ea(D.TOOLBOX_ITEM,pR.registrationName,pR);var pb=class extends pS{constructor(e,t,i){super(e,t,i),this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[]}makeDefaultCssConfig_(){let e=super.makeDefaultCssConfig_();return e.contents="blocklyToolboxCategoryGroup",e}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else{let t=e.contents;if(t){this.flyoutItems_=[],e=!0;for(let i=0;i<t.length;i++){let o=t[i];!ed(D.TOOLBOX_ITEM,o.kind)||o.kind.toLowerCase()===pR.registrationName&&e?(this.flyoutItems_.push(o),e=!0):(this.createToolboxItem(o),e=!1)}}}}createToolboxItem(e){let t=e.kind;"CATEGORY"===t.toUpperCase()&&tH(e)&&(t=pb.registrationName),e=new(ep(D.TOOLBOX_ITEM,t))(e,this.parentToolbox_,this),this.toolboxItems_.push(e)}init(){super.init(),this.setExpanded("true"===this.toolboxItemDef_.expanded||!0===this.toolboxItemDef_.expanded)}createDom_(){super.createDom_();let e=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(e),t1(this.subcategoriesDiv_,lH.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.closeIcon_(this.iconDom_),t2(this.htmlDiv_,aD.EXPANDED,!1),this.htmlDiv_}createIconDom_(){let e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){let t=this.cssConfig_.icon;t&&eq(e,t),e.style.visibility="visible"}return e.style.display="inline-block",e}createSubCategoriesDom_(e){let t=document.createElement("div");t.style.display="none";var i=this.cssConfig_.contents;for(i&&eq(t,i),i=0;i<e.length;i++){let o=e[i];o.init();let s=o.getDiv();if(t.appendChild(s),o.getClickTarget){let e;null==(e=o.getClickTarget())||e.setAttribute("id",o.getId())}}return t}setExpanded(e){if(this.expanded_!==e){if(this.expanded_=e)this.subcategoriesDiv_.style.display="block",this.openIcon_(this.iconDom_);else{let e;null==(e=this.parentToolbox_.getFlyout())||e.setVisible(!1),this.subcategoriesDiv_.style.display="none",this.closeIcon_(this.iconDom_)}t2(this.htmlDiv_,aD.EXPANDED,e),this.parentToolbox_.handleToolboxItemResize()}}setVisible_(e){this.htmlDiv_.style.display=e?"block":"none";let t=this.getChildToolboxItems();for(let i=0;i<t.length;i++)t[i].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_}};pb.registrationName="collapsibleCategory",ea(D.TOOLBOX_ITEM,pb.registrationName,pb);var pC=class extends hw{constructor(e){super(),this.id="toolbox",this.contentsDiv_=this.HtmlDiv=null,this.isVisible_=!1,this.height_=this.width_=0,this.flyout=null,this.contents=new Map,this.previouslySelectedItem_=this.selectedItem_=null,this.boundEvents_=[],this.workspace_=e,this.toolboxDef_=e.options.languageTree||{contents:[]},this.horizontalLayout=e.options.horizontalLayout,this.RTL=e.options.RTL,this.toolboxPosition=e.options.toolboxPosition}onShortcut(e){return!1}init(){var e=this.workspace_;let t=e.getParentSvg();this.flyout=this.createFlyout_(),this.HtmlDiv=this.createDom_(this.workspace_);let i=this.flyout.createDom("svg");eq(i,"blocklyToolboxFlyout"),e3(i,t),this.setVisible(!0),this.flyout.init(e),this.render(this.toolboxDef_),(e=e.getThemeManager()).subscribe(this.HtmlDiv,"toolboxBackgroundColour","background-color"),e.subscribe(this.HtmlDiv,"toolboxForegroundColour","color"),this.workspace_.getComponentManager().addComponent({component:this,weight:r6.ComponentWeight.TOOLBOX_WEIGHT,capabilities:[r6.Capability.AUTOHIDEABLE,r6.Capability.DELETE_AREA,r6.Capability.DRAG_TARGET]}),$.getFocusManager$$module$build$src$core$focus_manager().registerTree(this,!0)}createDom_(e){e=e.getParentSvg();let t=this.createContainer_();return t.id=ey(),this.contentsDiv_=this.createContentsContainer_(),t1(this.contentsDiv_,lH.TREE),t.appendChild(this.contentsDiv_),e.parentNode.insertBefore(t,e),this.attachEvents_(t,this.contentsDiv_),t}createContainer_(){let e=document.createElement("div");return e.setAttribute("layout",this.isHorizontal()?"h":"v"),eq(e,"blocklyToolbox"),e.setAttribute("dir",this.RTL?"RTL":"LTR"),e}createContentsContainer_(){let e=document.createElement("div");return eq(e,"blocklyToolboxCategoryGroup"),this.isHorizontal()&&(e.style.flexDirection="row"),e}attachEvents_(e,t){e=eb(e,"pointerdown",this,this.onClick_,!1),this.boundEvents_.push(e),t=eb(t,"keydown",this,this.onKeyDown_,!1),this.boundEvents_.push(t)}onClick_(e){if(e$(e)||e.target===this.HtmlDiv)tl().hideChaff(!1);else{var t=e.target.getAttribute("id");t&&(t=this.getToolboxItemById(t)).isSelectable()&&(this.setSelectedItem(t),t.onClick(e)),tl().hideChaff(!0)}ef()}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_(){let e=this.workspace_,t=e.copyOptionsForFlyout();return t.toolboxPosition=e.options.toolboxPosition,new(e.horizontalLayout?eE(D.FLYOUTS_HORIZONTAL_TOOLBOX,e.options,!0):eE(D.FLYOUTS_VERTICAL_TOOLBOX,e.options,!0))(t)}render(e){this.toolboxDef_=e,this.contents.forEach(e=>e.dispose()),this.contents.clear(),this.renderContents_(e.contents),this.position(),this.handleToolboxItemResize()}renderContents_(e){let t=document.createDocumentFragment();for(let i=0;i<e.length;i++)this.createToolboxItem(e[i],t);this.contentsDiv_.appendChild(t)}createToolboxItem(e,t){var i=e.kind;"CATEGORY"===i.toUpperCase()&&tH(e)&&(i=pb.registrationName),(i=ep(D.TOOLBOX_ITEM,i.toLowerCase()))&&((e=new i(e,this)).init(),this.addToolboxItem_(e),(i=e.getDiv())&&t.appendChild(i),e.getClickTarget()&&e.getClickTarget().setAttribute("id",e.getId()))}addToolboxItem_(e){if(this.contents.set(e.getId(),e),e.isCollapsible()){e=e.getChildToolboxItems();for(let t=0;t<e.length;t++)this.addToolboxItem_(e[t])}}getToolboxItems(){return[...this.contents.values()]}addStyle(e){e&&this.HtmlDiv&&eq(this.HtmlDiv,e)}removeStyle(e){e&&this.HtmlDiv&&e0(this.HtmlDiv,e)}getClientRect(){if(!this.HtmlDiv||!this.isVisible_)return null;var e=this.HtmlDiv.getBoundingClientRect();let t=e.top,i=t+e.height,o=e.left;return e=o+e.width,this.toolboxPosition===lS.TOP?new lo(-1e7,i,-1e7,1e7):this.toolboxPosition===lS.BOTTOM?new lo(t,1e7,-1e7,1e7):this.toolboxPosition===lS.LEFT?new lo(-1e7,1e7,-1e7,e):new lo(-1e7,1e7,o,1e7)}wouldDelete(e){return e instanceof hD?this.updateWouldDelete_(!e.getParent()&&e.isDeletable()):this.updateWouldDelete_(ni(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){let t=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";e?this.addStyle(t):this.removeStyle(t)}getToolboxItemById(e){return this.contents.get(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(){let 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===lS.TOP?t.style.top="0":t.style.bottom="0"):(this.toolboxPosition===lS.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(){let e=this.workspace_;var t=this.HtmlDiv.getBoundingClientRect();let i=this.getFlyout(),o=this.toolboxPosition===lS.LEFT?e.scrollX+t.width+((null==i?0:i.isVisible())?i.getWidth():0):e.scrollX;t=this.toolboxPosition===lS.TOP?e.scrollY+t.height+((null==i?0:i.isVisible())?i.getHeight():0):e.scrollY,e.translate(o,t),tp(e)}clearSelection(){this.setSelectedItem(null)}refreshTheme(){this.contents.forEach(e=>{e.refreshTheme&&e.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){let t=this.selectedItem_;(e||t)&&(!e||e.isSelectable())&&(this.shouldDeselectItem_(t,e)&&null!==t&&this.deselectItem_(t),this.shouldSelectItem_(t,e)&&null!==e&&this.selectItem_(t,e),this.updateFlyout_(t,e),this.fireSelectEvent(t,e))}shouldDeselectItem_(e,t){return null!==e&&(!e.isCollapsible()||e!==t)}shouldSelectItem_(e,t){return null!==t&&t!==e}deselectItem_(e){this.selectedItem_=null,this.previouslySelectedItem_=e,e.setSelected(!1),t2(this.contentsDiv_,aD.ACTIVEDESCENDANT,"")}selectItem_(e,t){this.selectedItem_=t,this.previouslySelectedItem_=e,t.setSelected(!0),t2(this.contentsDiv_,aD.ACTIVEDESCENDANT,t.getId())}selectItemByPosition(e){(e=this.getToolboxItems()[e])&&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){let i=e&&e.getName(),o=t&&t.getName();e===t&&(o=null),eH(e=new(ej(rL.TOOLBOX_ITEM_SELECT))(i,o,this.workspace_.id))}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))}selectChild(){if(!this.selectedItem_||!this.selectedItem_.isCollapsible())return!1;let e=this.selectedItem_;return e.isExpanded()?this.selectNext():e.toggleExpanded(),!0}selectNext(){if(!this.selectedItem_)return!1;let e=[...this.contents.values()],t=e.indexOf(this.selectedItem_)+1;if(t>-1&&t<e.length){let i=e[t];for(;i&&!i.isSelectable();)i=e[++t];if(i&&i.isSelectable())return this.setSelectedItem(i),!0}return!1}selectPrevious(){if(!this.selectedItem_)return!1;let e=[...this.contents.values()],t=e.indexOf(this.selectedItem_)-1;if(t>-1&&t<e.length){let i=e[t];for(;i&&!i.isSelectable();)i=e[--t];if(i&&i.isSelectable())return this.setSelectedItem(i),!0}return!1}dispose(){this.workspace_.getComponentManager().removeComponent("toolbox"),this.flyout.dispose(),this.contents.forEach(e=>e.dispose());for(let e=0;e<this.boundEvents_.length;e++)eO(this.boundEvents_[e]);this.boundEvents_=[],this.contents.clear(),this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),e2(this.HtmlDiv)),$.getFocusManager$$module$build$src$core$focus_manager().unregisterTree(this)}getFocusableElement(){if(!this.HtmlDiv)throw Error("Toolbox DOM has not yet been created.");return this.HtmlDiv}getFocusableTree(){return this}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getRootFocusableNode(){return this}getRestoredFocusableNode(e){if(!e||e===this){let e;return null!=(e=this.getToolboxItems().find(e=>e.isSelectable()))?e:null}return null}getNestedTrees(){return[]}lookUpFocusableNode(e){return this.getToolboxItemById(e)}onTreeFocus(e,t){e!==this?this.getSelectedItem()!==e&&this.setSelectedItem(e):this.clearSelection()}onTreeBlur(e){let t;e&&e===(null==(t=this.flyout)?void 0:t.getWorkspace())||(this.clearSelection(),this.flyout&&nl(this.flyout)&&this.flyout.autoHide(!1))}};tf('\n.blocklyToolboxDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolbox {\n box-sizing: border-box;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxCategoryGroup {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxCategoryGroup:focus {\n outline: none;\n}\n'),ea(D.TOOLBOX,y,pC);var pO=c5.INPUT_VALUE,pA=c5.OUTPUT_VALUE,p$=c5.NEXT_STATEMENT,pN=c5.PREVIOUS_STATEMENT,pL=lS.TOP,py=lS.BOTTOM,pD=lS.LEFT,pk=lS.RIGHT;uF.prototype.newBlock=function(e,t){return new hS(this,e,t)},uH.prototype.newBlock=function(e,t){return new hD(this,e,t)},uF.prototype.newComment=function(e){return new cU(this,e)},uH.prototype.newComment=function(e){return new cW(this,e)},uH.newTrashcan=function(e){return new uJ(e)},ht.prototype.newWorkspaceSvg=function(e){return new uH(e)},$.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=(e=nu(e))[0].concat(e[1]);for(let t=0;t<e.length;t++)this.getName(e[t][0],$.Names$$module$build$src$core$names.NameType.PROCEDURE)};var pw={};return pw.Block=hS,pw.BlockFlyoutInflater=pn,pw.BlockNavigationPolicy=hU,pw.BlockSvg=hD,pw.Blocks=w,pw.ButtonFlyoutInflater=pi,pw.COLLAPSED_FIELD_NAME=lj,pw.COLLAPSED_INPUT_NAME=lz,pw.COLLAPSE_CHARS=30,pw.CodeGenerator=$.CodeGenerator$$module$build$src$core$generator,pw.CollapsibleToolboxCategory=pb,pw.ComponentManager=r6,pw.Connection=hl,pw.ConnectionChecker=ux,pw.ConnectionDB=cj,pw.ConnectionNavigationPolicy=hK,pw.ConnectionType=c5,pw.ContextMenu=c$,pw.ContextMenuItems=pe,pw.ContextMenuRegistry=cN,pw.Css=le,pw.DELETE_VARIABLE_ID=hp,pw.DeleteArea=hw,pw.DragTarget=hk,pw.DropDownDiv=aq,pw.Events=A,pw.Extensions=hs,pw.Field=cd,pw.FieldCheckbox=dM,pw.FieldDropdown=c0,pw.FieldImage=dT,pw.FieldLabel=hh,pw.FieldLabelSerializable=dw,pw.FieldNavigationPolicy=hY,pw.FieldNumber=dk,pw.FieldTextInput=$.FieldTextInput$$module$build$src$core$field_textinput,pw.FieldVariable=dD,pw.Flyout=h0,pw.FlyoutButton=hB,pw.FlyoutButtonNavigationPolicy=hx,pw.FlyoutItem=hM,pw.FlyoutMetricsManager=hP,pw.FlyoutNavigationPolicy=hF,pw.FlyoutNavigator=hZ,pw.FlyoutSeparator=hG,pw.FlyoutSeparatorNavigationPolicy=hH,pw.FocusManager=rG,pw.FocusableTreeTraverser=rx,pw.Generator=$.CodeGenerator$$module$build$src$core$generator,pw.Gesture=h6,pw.Grid=h4,pw.HorizontalFlyout=dy,pw.INPUT_VALUE=pO,pw.Input=hT,pw.InsertionMarkerPreviewer=dA,pw.KeyboardNavigationController=h1,pw.LabelFlyoutInflater=d_,pw.LineCursor=h7,pw.Marker=h9,pw.MarkerManager=ue,pw.Menu=lY,pw.MenuItem=lK,pw.MetricsManager=hv,pw.Msg=$.Msg$$module$build$src$core$msg,pw.NEXT_STATEMENT=p$,pw.Names=$.Names$$module$build$src$core$names,pw.Navigator=hJ,pw.OPPOSITE_TYPE=hu,pw.OUTPUT_VALUE=pA,pw.Options=c9,pw.PREVIOUS_STATEMENT=pN,pw.PROCEDURE_CATEGORY_NAME=dY,pw.Procedures=dX,pw.RENAME_VARIABLE_ID=hd,pw.RenderedConnection=h_,pw.Scrollbar=lh,pw.ScrollbarPair=hq,pw.SeparatorFlyoutInflater=hQ,pw.ShortcutItems=dl,pw.ShortcutRegistry=rW,pw.TOOLBOX_AT_BOTTOM=py,pw.TOOLBOX_AT_LEFT=pD,pw.TOOLBOX_AT_RIGHT=pk,pw.TOOLBOX_AT_TOP=pL,pw.Theme=c4,pw.ThemeManager=uv,pw.Themes={Classic:c8,Zelos:pf},pw.Toast=l8,pw.Toolbox=pC,pw.ToolboxCategory=pS,pw.ToolboxItem=pI,pw.ToolboxSeparator=pR,pw.Tooltip=cr,pw.Touch=F,pw.Trashcan=uJ,pw.UnattachedFieldError=cp,pw.VARIABLE_CATEGORY_NAME=ah,pw.VARIABLE_DYNAMIC_CATEGORY_NAME=uP,pw.VERSION="12.2.0",pw.VariableMap=uz,pw.VariableModel=uK,pw.Variables=ap,pw.VariablesDynamic=uB,pw.VerticalFlyout=dL,pw.WidgetDiv=cb,pw.Workspace=uF,pw.WorkspaceAudio=uG,pw.WorkspaceDragger=h5,pw.WorkspaceNavigationPolicy=hj,pw.WorkspaceSvg=uH,pw.Xml=cV,pw.ZoomControls=lN,pw.blockAnimations=hC,pw.blockRendering=uM,pw.browserEvents=X,pw.bubbles=po,pw.bumpObjects=h$,pw.clipboard=dn,pw.comments=dr,pw.common=rZ,pw.config=$.config$$module$build$src$core$config,pw.constants={COLLAPSED_FIELD_NAME:lj,COLLAPSED_INPUT_NAME:lz,MANUALLY_DISABLED:lJ},pw.defineBlocksWithJsonArray=tE,pw.dialog=ar,pw.dragging=dP,pw.fieldRegistry=cQ,pw.geras=pg,pw.getFocusManager=$.getFocusManager$$module$build$src$core$focus_manager,pw.getMainWorkspace=tl,pw.getSelected=tc,pw.hasBubble=i1,pw.hideChaff=function(e){tl().hideChaff(e)},pw.icons=us,pw.inject=function(e,t){var i;let o=null;if(o="string"==typeof e?document.getElementById(e)||document.querySelector(e):e,!document.contains(o)&&document!==(null==(i=o)?void 0:i.ownerDocument))throw Error("Error: container is not in current document");e=new c9(t||{}),eq(i=document.createElement("div"),"injectionDiv"),(null==t?0:t.rtl)&&eq(i,"blocklyRTL"),o.appendChild(i),t=n0(i,e);let s=n1(i,t,e);return n2(s),ta(s),tp(s),i.addEventListener("focusin",function(){ta(s)}),eb(i,"keydown",null,tT),s},pw.inputs=d$,pw.isCopyable=nH,pw.isDeletable=ni,pw.isDraggable=nr,pw.isIcon=sq,pw.isObservable=nh,pw.isPaster=function(e){return e&&"function"==typeof e.paste},pw.isRenderedElement=function(e){return e&&"function"==typeof e.getSvgRoot},pw.isSelectable=tt,pw.isSerializable=t3,pw.isVariableBackedParameterModel=ic,pw.keyboardNavigationController=h2,pw.layers={BLOCK:50,BUBBLE:100},pw.navigateBlock=nn,pw.navigateStacks=ns,pw.procedures=dX,pw.registry=k,pw.renderManagement=l3,pw.serialization={blocks:aR,exceptions:aI,priorities:{BLOCKS:50,PROCEDURES:75,VARIABLES:100,WORKSPACE_COMMENTS:25},procedures:dc,registry:lL,variables:du,workspaceComments:lD,workspaces:dd},pw.setLocale=ak,pw.setParentContainer=td,pw.svgResize=tp,pw.thrasos=pm,pw.uiPosition=lA,pw.utils=hr,pw.zelos=d7,pw.__namespace__=$,pw},"function"==typeof define&&define.amd?define([],i):e.exports=i()}),u("cWmWX",function(e,t){var i;e.exports,i=function(){var e=e||{Msg:Object.create(null)};return e.Msg.ADD_COMMENT="Add Comment",e.Msg.ALT_KEY="Alt",e.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE="Can't delete the variable '%1' because it's part of the definition of the function '%2'",e.Msg.CHANGE_VALUE_TITLE="Change value:",e.Msg.CHROME_OS="ChromeOS",e.Msg.CLEAN_UP="Clean up Blocks",e.Msg.CLOSE="Close",e.Msg.COLLAPSED_WARNINGS_WARNING="Collapsed blocks contain warnings.",e.Msg.COLLAPSE_ALL="Collapse Blocks",e.Msg.COLLAPSE_BLOCK="Collapse Block",e.Msg.COLOUR_BLEND_COLOUR1="colour 1",e.Msg.COLOUR_BLEND_COLOUR2="colour 2",e.Msg.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp",e.Msg.COLOUR_BLEND_RATIO="ratio",e.Msg.COLOUR_BLEND_TITLE="blend",e.Msg.COLOUR_BLEND_TOOLTIP="Blends two colours together with a given ratio (0.0 - 1.0).",e.Msg.COLOUR_PICKER_HELPURL="https://en.wikipedia.org/wiki/Color",e.Msg.COLOUR_PICKER_TOOLTIP="Choose a colour from the palette.",e.Msg.COLOUR_RANDOM_HELPURL="http://randomcolour.com",e.Msg.COLOUR_RANDOM_TITLE="random colour",e.Msg.COLOUR_RANDOM_TOOLTIP="Choose a colour at random.",e.Msg.COLOUR_RGB_BLUE="blue",e.Msg.COLOUR_RGB_GREEN="green",e.Msg.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html",e.Msg.COLOUR_RGB_RED="red",e.Msg.COLOUR_RGB_TITLE="colour with",e.Msg.COLOUR_RGB_TOOLTIP="Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 100.",e.Msg.COMMAND_KEY="⌘ Command",e.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/google/blockly/wiki/Loops#loop-termination-blocks",e.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="break out of loop",e.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continue with next iteration of loop",e.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="Break out of the containing loop.",e.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="Skip the rest of this loop, and continue with the next iteration.",e.Msg.CONTROLS_FLOW_STATEMENTS_WARNING="Warning: This block may only be used within a loop.",e.Msg.CONTROLS_FOREACH_HELPURL="https://github.com/google/blockly/wiki/Loops#for-each",e.Msg.CONTROLS_FOREACH_TITLE="for each item %1 in list %2",e.Msg.CONTROLS_FOREACH_TOOLTIP="For each item in a list, set the variable '%1' to the item, and then do some statements.",e.Msg.CONTROLS_FOR_HELPURL="https://github.com/google/blockly/wiki/Loops#count-with",e.Msg.CONTROLS_FOR_TITLE="count with %1 from %2 to %3 by %4",e.Msg.CONTROLS_FOR_TOOLTIP="Have the variable '%1' take on the values from the start number to the end number, counting by the specified interval, and do the specified blocks.",e.Msg.CONTROLS_IF_ELSEIF_TOOLTIP="Add a condition to the if block.",e.Msg.CONTROLS_IF_ELSE_TOOLTIP="Add a final, catch-all condition to the if block.",e.Msg.CONTROLS_IF_HELPURL="https://github.com/google/blockly/wiki/IfElse",e.Msg.CONTROLS_IF_IF_TOOLTIP="Add, remove, or reorder sections to reconfigure this if block.",e.Msg.CONTROLS_IF_MSG_ELSE="else",e.Msg.CONTROLS_IF_MSG_ELSEIF="else if",e.Msg.CONTROLS_IF_MSG_IF="if",e.Msg.CONTROLS_IF_TOOLTIP_1="If a value is true, then do some statements.",e.Msg.CONTROLS_IF_TOOLTIP_2="If a value is true, then do the first block of statements. Otherwise, do the second block of statements.",e.Msg.CONTROLS_IF_TOOLTIP_3="If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements.",e.Msg.CONTROLS_IF_TOOLTIP_4="If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements. If none of the values are true, do the last block of statements.",e.Msg.CONTROLS_REPEAT_HELPURL="https://en.wikipedia.org/wiki/For_loop",e.Msg.CONTROLS_REPEAT_INPUT_DO="do",e.Msg.CONTROLS_REPEAT_TITLE="repeat %1 times",e.Msg.CONTROLS_REPEAT_TOOLTIP="Do some statements several times.",e.Msg.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat",e.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="repeat until",e.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="repeat while",e.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="While a value is false, then do some statements.",e.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="While a value is true, then do some statements.",e.Msg.CONTROL_KEY="Ctrl",e.Msg.COPY_SHORTCUT="Copy",e.Msg.CUT_SHORTCUT="Cut",e.Msg.DELETE_ALL_BLOCKS="Delete all %1 blocks?",e.Msg.DELETE_BLOCK="Delete Block",e.Msg.DELETE_VARIABLE="Delete the '%1' variable",e.Msg.DELETE_VARIABLE_CONFIRMATION="Delete %1 uses of the '%2' variable?",e.Msg.DELETE_X_BLOCKS="Delete %1 Blocks",e.Msg.DIALOG_CANCEL="Cancel",e.Msg.DIALOG_OK="OK",e.Msg.DISABLE_BLOCK="Disable Block",e.Msg.DUPLICATE_BLOCK="Duplicate",e.Msg.DUPLICATE_COMMENT="Duplicate Comment",e.Msg.EDIT_BLOCK_CONTENTS="Edit Block contents",e.Msg.ENABLE_BLOCK="Enable Block",e.Msg.EXPAND_ALL="Expand Blocks",e.Msg.EXPAND_BLOCK="Expand Block",e.Msg.EXTERNAL_INPUTS="External Inputs",e.Msg.HELP="Help",e.Msg.HELP_PROMPT="Press %1 for help on keyboard controls",e.Msg.INLINE_INPUTS="Inline Inputs",e.Msg.KEYBOARD_NAV_CONSTRAINED_MOVE_HINT="Use the arrow keys to move, then %1 to accept the position",e.Msg.KEYBOARD_NAV_COPIED_HINT="Copied. Press %1 to paste.",e.Msg.KEYBOARD_NAV_CUT_HINT="Cut. Press %1 to paste.",e.Msg.KEYBOARD_NAV_UNCONSTRAINED_MOVE_HINT="Hold %1 and use arrow keys to move freely, then %2 to accept the position",e.Msg.LINUX="Linux",e.Msg.LISTS_CREATE_EMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#create-empty-list",e.Msg.LISTS_CREATE_EMPTY_TITLE="create empty list",e.Msg.LISTS_CREATE_EMPTY_TOOLTIP="Returns a list, of length 0, containing no data records",e.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="list",e.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="Add, remove, or reorder sections to reconfigure this list block.",e.Msg.LISTS_CREATE_WITH_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",e.Msg.LISTS_CREATE_WITH_INPUT_WITH="create list with",e.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP="Add an item to the list.",e.Msg.LISTS_CREATE_WITH_TOOLTIP="Create a list with any number of items.",e.Msg.LISTS_GET_INDEX_FIRST="first",e.Msg.LISTS_GET_INDEX_FROM_END="# from end",e.Msg.LISTS_GET_INDEX_FROM_START="#",e.Msg.LISTS_GET_INDEX_GET="get",e.Msg.LISTS_GET_INDEX_GET_REMOVE="get and remove",e.Msg.LISTS_GET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",e.Msg.LISTS_GET_INDEX_LAST="last",e.Msg.LISTS_GET_INDEX_RANDOM="random",e.Msg.LISTS_GET_INDEX_REMOVE="remove",e.Msg.LISTS_GET_INDEX_TAIL="",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="Returns the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM="Returns the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST="Returns the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="Returns a random item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="Removes and returns the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="Removes and returns the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="Removes and returns the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="Removes and returns a random item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="Removes the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="Removes the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="Removes the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="Removes a random item in a list.",e.Msg.LISTS_GET_SUBLIST_END_FROM_END="to # from end",e.Msg.LISTS_GET_SUBLIST_END_FROM_START="to #",e.Msg.LISTS_GET_SUBLIST_END_LAST="to last",e.Msg.LISTS_GET_SUBLIST_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-a-sublist",e.Msg.LISTS_GET_SUBLIST_START_FIRST="get sub-list from first",e.Msg.LISTS_GET_SUBLIST_START_FROM_END="get sub-list from # from end",e.Msg.LISTS_GET_SUBLIST_START_FROM_START="get sub-list from #",e.Msg.LISTS_GET_SUBLIST_TAIL="",e.Msg.LISTS_GET_SUBLIST_TOOLTIP="Creates a copy of the specified portion of a list.",e.Msg.LISTS_INDEX_FROM_END_TOOLTIP="%1 is the last item.",e.Msg.LISTS_INDEX_FROM_START_TOOLTIP="%1 is the first item.",e.Msg.LISTS_INDEX_OF_FIRST="find first occurrence of item",e.Msg.LISTS_INDEX_OF_HELPURL="https://github.com/google/blockly/wiki/Lists#finding-items-in-a-list",e.Msg.LISTS_INDEX_OF_LAST="find last occurrence of item",e.Msg.LISTS_INDEX_OF_TOOLTIP="Returns the index of the first/last occurrence of the item in the list. Returns %1 if item is not found.",e.Msg.LISTS_INLIST="in list",e.Msg.LISTS_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#is-empty",e.Msg.LISTS_ISEMPTY_TITLE="%1 is empty",e.Msg.LISTS_ISEMPTY_TOOLTIP="Returns true if the list is empty.",e.Msg.LISTS_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Lists#length-of",e.Msg.LISTS_LENGTH_TITLE="length of %1",e.Msg.LISTS_LENGTH_TOOLTIP="Returns the length of a list.",e.Msg.LISTS_REPEAT_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",e.Msg.LISTS_REPEAT_TITLE="create list with item %1 repeated %2 times",e.Msg.LISTS_REPEAT_TOOLTIP="Creates a list consisting of the given value repeated the specified number of times.",e.Msg.LISTS_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Lists#reversing-a-list",e.Msg.LISTS_REVERSE_MESSAGE0="reverse %1",e.Msg.LISTS_REVERSE_TOOLTIP="Reverse a copy of a list.",e.Msg.LISTS_SET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#in-list--set",e.Msg.LISTS_SET_INDEX_INPUT_TO="as",e.Msg.LISTS_SET_INDEX_INSERT="insert at",e.Msg.LISTS_SET_INDEX_SET="set",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="Inserts the item at the start of a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="Inserts the item at the specified position in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="Append the item to the end of a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="Inserts the item randomly in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="Sets the first item in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM="Sets the item at the specified position in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST="Sets the last item in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="Sets a random item in a list.",e.Msg.LISTS_SORT_HELPURL="https://github.com/google/blockly/wiki/Lists#sorting-a-list",e.Msg.LISTS_SORT_ORDER_ASCENDING="ascending",e.Msg.LISTS_SORT_ORDER_DESCENDING="descending",e.Msg.LISTS_SORT_TITLE="sort %1 %2 %3",e.Msg.LISTS_SORT_TOOLTIP="Sort a copy of a list.",e.Msg.LISTS_SORT_TYPE_IGNORECASE="alphabetic, ignore case",e.Msg.LISTS_SORT_TYPE_NUMERIC="numeric",e.Msg.LISTS_SORT_TYPE_TEXT="alphabetic",e.Msg.LISTS_SPLIT_HELPURL="https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists",e.Msg.LISTS_SPLIT_LIST_FROM_TEXT="make list from text",e.Msg.LISTS_SPLIT_TEXT_FROM_LIST="make text from list",e.Msg.LISTS_SPLIT_TOOLTIP_JOIN="Join a list of texts into one text, separated by a delimiter.",e.Msg.LISTS_SPLIT_TOOLTIP_SPLIT="Split text into a list of texts, breaking at each delimiter.",e.Msg.LISTS_SPLIT_WITH_DELIMITER="with delimiter",e.Msg.LOGIC_BOOLEAN_FALSE="false",e.Msg.LOGIC_BOOLEAN_HELPURL="https://github.com/google/blockly/wiki/Logic#values",e.Msg.LOGIC_BOOLEAN_TOOLTIP="Returns either true or false.",e.Msg.LOGIC_BOOLEAN_TRUE="true",e.Msg.LOGIC_COMPARE_HELPURL="https://en.wikipedia.org/wiki/Inequality_(mathematics)",e.Msg.LOGIC_COMPARE_TOOLTIP_EQ="Return true if both inputs equal each other.",e.Msg.LOGIC_COMPARE_TOOLTIP_GT="Return true if the first input is greater than the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_GTE="Return true if the first input is greater than or equal to the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_LT="Return true if the first input is smaller than the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_LTE="Return true if the first input is smaller than or equal to the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_NEQ="Return true if both inputs are not equal to each other.",e.Msg.LOGIC_NEGATE_HELPURL="https://github.com/google/blockly/wiki/Logic#not",e.Msg.LOGIC_NEGATE_TITLE="not %1",e.Msg.LOGIC_NEGATE_TOOLTIP="Returns true if the input is false. Returns false if the input is true.",e.Msg.LOGIC_NULL="null",e.Msg.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type",e.Msg.LOGIC_NULL_TOOLTIP="Returns null.",e.Msg.LOGIC_OPERATION_AND="and",e.Msg.LOGIC_OPERATION_HELPURL="https://github.com/google/blockly/wiki/Logic#logical-operations",e.Msg.LOGIC_OPERATION_OR="or",e.Msg.LOGIC_OPERATION_TOOLTIP_AND="Return true if both inputs are true.",e.Msg.LOGIC_OPERATION_TOOLTIP_OR="Return true if at least one of the inputs is true.",e.Msg.LOGIC_TERNARY_CONDITION="test",e.Msg.LOGIC_TERNARY_HELPURL="https://en.wikipedia.org/wiki/%3F:",e.Msg.LOGIC_TERNARY_IF_FALSE="if false",e.Msg.LOGIC_TERNARY_IF_TRUE="if true",e.Msg.LOGIC_TERNARY_TOOLTIP="Check the condition in 'test'. If the condition is true, returns the 'if true' value; otherwise returns the 'if false' value.",e.Msg.MAC_OS="macOS",e.Msg.MATH_ADDITION_SYMBOL="+",e.Msg.MATH_ARITHMETIC_HELPURL="https://en.wikipedia.org/wiki/Arithmetic",e.Msg.MATH_ARITHMETIC_TOOLTIP_ADD="Return the sum of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE="Return the quotient of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS="Return the difference of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="Return the product of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_POWER="Return the first number raised to the power of the second number.",e.Msg.MATH_ATAN2_HELPURL="https://en.wikipedia.org/wiki/Atan2",e.Msg.MATH_ATAN2_TITLE="atan2 of X:%1 Y:%2",e.Msg.MATH_ATAN2_TOOLTIP="Return the arctangent of point (X, Y) in degrees from -180 to 180.",e.Msg.MATH_CHANGE_HELPURL="https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter",e.Msg.MATH_CHANGE_TITLE="change %1 by %2",e.Msg.MATH_CHANGE_TOOLTIP="Add a number to variable '%1'.",e.Msg.MATH_CONSTANT_HELPURL="https://en.wikipedia.org/wiki/Mathematical_constant",e.Msg.MATH_CONSTANT_TOOLTIP="Return one of the common constants: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), or ∞ (infinity).",e.Msg.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)",e.Msg.MATH_CONSTRAIN_TITLE="constrain %1 low %2 high %3",e.Msg.MATH_CONSTRAIN_TOOLTIP="Constrain a number to be between the specified limits (inclusive).",e.Msg.MATH_DIVISION_SYMBOL="÷",e.Msg.MATH_IS_DIVISIBLE_BY="is divisible by",e.Msg.MATH_IS_EVEN="is even",e.Msg.MATH_IS_NEGATIVE="is negative",e.Msg.MATH_IS_ODD="is odd",e.Msg.MATH_IS_POSITIVE="is positive",e.Msg.MATH_IS_PRIME="is prime",e.Msg.MATH_IS_TOOLTIP="Check if a number is an even, odd, prime, whole, positive, negative, or if it is divisible by certain number. Returns true or false.",e.Msg.MATH_IS_WHOLE="is whole",e.Msg.MATH_MODULO_HELPURL="https://en.wikipedia.org/wiki/Modulo_operation",e.Msg.MATH_MODULO_TITLE="remainder of %1 ÷ %2",e.Msg.MATH_MODULO_TOOLTIP="Return the remainder from dividing the two numbers.",e.Msg.MATH_MULTIPLICATION_SYMBOL="×",e.Msg.MATH_NUMBER_HELPURL="https://en.wikipedia.org/wiki/Number",e.Msg.MATH_NUMBER_TOOLTIP="A number.",e.Msg.MATH_ONLIST_HELPURL="",e.Msg.MATH_ONLIST_OPERATOR_AVERAGE="average of list",e.Msg.MATH_ONLIST_OPERATOR_MAX="max of list",e.Msg.MATH_ONLIST_OPERATOR_MEDIAN="median of list",e.Msg.MATH_ONLIST_OPERATOR_MIN="min of list",e.Msg.MATH_ONLIST_OPERATOR_MODE="modes of list",e.Msg.MATH_ONLIST_OPERATOR_RANDOM="random item of list",e.Msg.MATH_ONLIST_OPERATOR_STD_DEV="standard deviation of list",e.Msg.MATH_ONLIST_OPERATOR_SUM="sum of list",e.Msg.MATH_ONLIST_TOOLTIP_AVERAGE="Return the average (arithmetic mean) of the numeric values in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MAX="Return the largest number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MEDIAN="Return the median number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MIN="Return the smallest number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MODE="Return a list of the most common item(s) in the list.",e.Msg.MATH_ONLIST_TOOLTIP_RANDOM="Return a random element from the list.",e.Msg.MATH_ONLIST_TOOLTIP_STD_DEV="Return the standard deviation of the list.",e.Msg.MATH_ONLIST_TOOLTIP_SUM="Return the sum of all the numbers in the list.",e.Msg.MATH_POWER_SYMBOL="^",e.Msg.MATH_RANDOM_FLOAT_HELPURL="https://en.wikipedia.org/wiki/Random_number_generation",e.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM="random fraction",e.Msg.MATH_RANDOM_FLOAT_TOOLTIP="Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive).",e.Msg.MATH_RANDOM_INT_HELPURL="https://en.wikipedia.org/wiki/Random_number_generation",e.Msg.MATH_RANDOM_INT_TITLE="random integer from %1 to %2",e.Msg.MATH_RANDOM_INT_TOOLTIP="Return a random integer between the two specified limits, inclusive.",e.Msg.MATH_ROUND_HELPURL="https://en.wikipedia.org/wiki/Rounding",e.Msg.MATH_ROUND_OPERATOR_ROUND="round",e.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN="round down",e.Msg.MATH_ROUND_OPERATOR_ROUNDUP="round up",e.Msg.MATH_ROUND_TOOLTIP="Round a number up or down.",e.Msg.MATH_SINGLE_HELPURL="https://en.wikipedia.org/wiki/Square_root",e.Msg.MATH_SINGLE_OP_ABSOLUTE="absolute",e.Msg.MATH_SINGLE_OP_ROOT="square root",e.Msg.MATH_SINGLE_TOOLTIP_ABS="Return the absolute value of a number.",e.Msg.MATH_SINGLE_TOOLTIP_EXP="Return e to the power of a number.",e.Msg.MATH_SINGLE_TOOLTIP_LN="Return the natural logarithm of a number.",e.Msg.MATH_SINGLE_TOOLTIP_LOG10="Return the base 10 logarithm of a number.",e.Msg.MATH_SINGLE_TOOLTIP_NEG="Return the negation of a number.",e.Msg.MATH_SINGLE_TOOLTIP_POW10="Return 10 to the power of a number.",e.Msg.MATH_SINGLE_TOOLTIP_ROOT="Return the square root of a number.",e.Msg.MATH_SUBTRACTION_SYMBOL="-",e.Msg.MATH_TRIG_ACOS="acos",e.Msg.MATH_TRIG_ASIN="asin",e.Msg.MATH_TRIG_ATAN="atan",e.Msg.MATH_TRIG_COS="cos",e.Msg.MATH_TRIG_HELPURL="https://en.wikipedia.org/wiki/Trigonometric_functions",e.Msg.MATH_TRIG_SIN="sin",e.Msg.MATH_TRIG_TAN="tan",e.Msg.MATH_TRIG_TOOLTIP_ACOS="Return the arccosine of a number.",e.Msg.MATH_TRIG_TOOLTIP_ASIN="Return the arcsine of a number.",e.Msg.MATH_TRIG_TOOLTIP_ATAN="Return the arctangent of a number.",e.Msg.MATH_TRIG_TOOLTIP_COS="Return the cosine of a degree (not radian).",e.Msg.MATH_TRIG_TOOLTIP_SIN="Return the sine of a degree (not radian).",e.Msg.MATH_TRIG_TOOLTIP_TAN="Return the tangent of a degree (not radian).",e.Msg.MOVE_BLOCK="Move Block",e.Msg.NEW_COLOUR_VARIABLE="Create colour variable...",e.Msg.NEW_NUMBER_VARIABLE="Create number variable...",e.Msg.NEW_STRING_VARIABLE="Create string variable...",e.Msg.NEW_VARIABLE="Create variable...",e.Msg.NEW_VARIABLE_TITLE="New variable name:",e.Msg.NEW_VARIABLE_TYPE_TITLE="New variable type:",e.Msg.OPTION_KEY="⌥ Option",e.Msg.ORDINAL_NUMBER_SUFFIX="",e.Msg.PASTE_SHORTCUT="Paste",e.Msg.PROCEDURES_ALLOW_STATEMENTS="allow statements",e.Msg.PROCEDURES_BEFORE_PARAMS="with:",e.Msg.PROCEDURES_CALLNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_CALLNORETURN_TOOLTIP="Run the user-defined function '%1'.",e.Msg.PROCEDURES_CALLRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_CALLRETURN_TOOLTIP="Run the user-defined function '%1' and use its output.",e.Msg.PROCEDURES_CALL_BEFORE_PARAMS="with:",e.Msg.PROCEDURES_CALL_DISABLED_DEF_WARNING="Can't run the user-defined function '%1' because the definition block is disabled.",e.Msg.PROCEDURES_CREATE_DO="Create '%1'",e.Msg.PROCEDURES_DEFNORETURN_COMMENT="Describe this function...",e.Msg.PROCEDURES_DEFNORETURN_DO="",e.Msg.PROCEDURES_DEFNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_DEFNORETURN_PROCEDURE="do something",e.Msg.PROCEDURES_DEFNORETURN_TITLE="to",e.Msg.PROCEDURES_DEFNORETURN_TOOLTIP="Creates a function with no output.",e.Msg.PROCEDURES_DEFRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_DEFRETURN_RETURN="return",e.Msg.PROCEDURES_DEFRETURN_TOOLTIP="Creates a function with an output.",e.Msg.PROCEDURES_DEF_DUPLICATE_WARNING="Warning: This function has duplicate parameters.",e.Msg.PROCEDURES_HIGHLIGHT_DEF="Highlight function definition",e.Msg.PROCEDURES_IFRETURN_HELPURL="https://c2.com/cgi/wiki?GuardClause",e.Msg.PROCEDURES_IFRETURN_TOOLTIP="If a value is true, then return a second value.",e.Msg.PROCEDURES_IFRETURN_WARNING="Warning: This block may be used only within a function definition.",e.Msg.PROCEDURES_MUTATORARG_TITLE="input name:",e.Msg.PROCEDURES_MUTATORARG_TOOLTIP="Add an input to the function.",e.Msg.PROCEDURES_MUTATORCONTAINER_TITLE="inputs",e.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP="Add, remove, or reorder inputs to this function.",e.Msg.REDO="Redo",e.Msg.REMOVE_COMMENT="Remove Comment",e.Msg.RENAME_VARIABLE="Rename variable...",e.Msg.RENAME_VARIABLE_TITLE="Rename all '%1' variables to:",e.Msg.SHORTCUTS_CODE_NAVIGATION="Code navigation",e.Msg.SHORTCUTS_EDITING="Editing",e.Msg.SHORTCUTS_GENERAL="General",e.Msg.TEXT_APPEND_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",e.Msg.TEXT_APPEND_TITLE="to %1 append text %2",e.Msg.TEXT_APPEND_TOOLTIP="Append some text to variable '%1'.",e.Msg.TEXT_CHANGECASE_HELPURL="https://github.com/google/blockly/wiki/Text#adjusting-text-case",e.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE="to lower case",e.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE="to Title Case",e.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE="to UPPER CASE",e.Msg.TEXT_CHANGECASE_TOOLTIP="Return a copy of the text in a different case.",e.Msg.TEXT_CHARAT_FIRST="get first letter",e.Msg.TEXT_CHARAT_FROM_END="get letter # from end",e.Msg.TEXT_CHARAT_FROM_START="get letter #",e.Msg.TEXT_CHARAT_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-text",e.Msg.TEXT_CHARAT_LAST="get last letter",e.Msg.TEXT_CHARAT_RANDOM="get random letter",e.Msg.TEXT_CHARAT_TAIL="",e.Msg.TEXT_CHARAT_TITLE="in text %1 %2",e.Msg.TEXT_CHARAT_TOOLTIP="Returns the letter at the specified position.",e.Msg.TEXT_COUNT_HELPURL="https://github.com/google/blockly/wiki/Text#counting-substrings",e.Msg.TEXT_COUNT_MESSAGE0="count %1 in %2",e.Msg.TEXT_COUNT_TOOLTIP="Count how many times some text occurs within some other text.",e.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP="Add an item to the text.",e.Msg.TEXT_CREATE_JOIN_TITLE_JOIN="join",e.Msg.TEXT_CREATE_JOIN_TOOLTIP="Add, remove, or reorder sections to reconfigure this text block.",e.Msg.TEXT_GET_SUBSTRING_END_FROM_END="to letter # from end",e.Msg.TEXT_GET_SUBSTRING_END_FROM_START="to letter #",e.Msg.TEXT_GET_SUBSTRING_END_LAST="to last letter",e.Msg.TEXT_GET_SUBSTRING_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text",e.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="in text",e.Msg.TEXT_GET_SUBSTRING_START_FIRST="get substring from first letter",e.Msg.TEXT_GET_SUBSTRING_START_FROM_END="get substring from letter # from end",e.Msg.TEXT_GET_SUBSTRING_START_FROM_START="get substring from letter #",e.Msg.TEXT_GET_SUBSTRING_TAIL="",e.Msg.TEXT_GET_SUBSTRING_TOOLTIP="Returns a specified portion of the text.",e.Msg.TEXT_INDEXOF_HELPURL="https://github.com/google/blockly/wiki/Text#finding-text",e.Msg.TEXT_INDEXOF_OPERATOR_FIRST="find first occurrence of text",e.Msg.TEXT_INDEXOF_OPERATOR_LAST="find last occurrence of text",e.Msg.TEXT_INDEXOF_TITLE="in text %1 %2 %3",e.Msg.TEXT_INDEXOF_TOOLTIP="Returns the index of the first/last occurrence of the first text in the second text. Returns %1 if text is not found.",e.Msg.TEXT_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Text#checking-for-empty-text",e.Msg.TEXT_ISEMPTY_TITLE="%1 is empty",e.Msg.TEXT_ISEMPTY_TOOLTIP="Returns true if the provided text is empty.",e.Msg.TEXT_JOIN_HELPURL="https://github.com/google/blockly/wiki/Text#text-creation",e.Msg.TEXT_JOIN_TITLE_CREATEWITH="create text with",e.Msg.TEXT_JOIN_TOOLTIP="Create a piece of text by joining together any number of items.",e.Msg.TEXT_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",e.Msg.TEXT_LENGTH_TITLE="length of %1",e.Msg.TEXT_LENGTH_TOOLTIP="Returns the number of letters (including spaces) in the provided text.",e.Msg.TEXT_PRINT_HELPURL="https://github.com/google/blockly/wiki/Text#printing-text",e.Msg.TEXT_PRINT_TITLE="print %1",e.Msg.TEXT_PRINT_TOOLTIP="Print the specified text, number or other value.",e.Msg.TEXT_PROMPT_HELPURL="https://github.com/google/blockly/wiki/Text#getting-input-from-the-user",e.Msg.TEXT_PROMPT_TOOLTIP_NUMBER="Prompt for user for a number.",e.Msg.TEXT_PROMPT_TOOLTIP_TEXT="Prompt for user for some text.",e.Msg.TEXT_PROMPT_TYPE_NUMBER="prompt for number with message",e.Msg.TEXT_PROMPT_TYPE_TEXT="prompt for text with message",e.Msg.TEXT_REPLACE_HELPURL="https://github.com/google/blockly/wiki/Text#replacing-substrings",e.Msg.TEXT_REPLACE_MESSAGE0="replace %1 with %2 in %3",e.Msg.TEXT_REPLACE_TOOLTIP="Replace all occurances of some text within some other text.",e.Msg.TEXT_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Text#reversing-text",e.Msg.TEXT_REVERSE_MESSAGE0="reverse %1",e.Msg.TEXT_REVERSE_TOOLTIP="Reverses the order of the characters in the text.",e.Msg.TEXT_TEXT_HELPURL="https://en.wikipedia.org/wiki/String_(computer_science)",e.Msg.TEXT_TEXT_TOOLTIP="A letter, word, or line of text.",e.Msg.TEXT_TRIM_HELPURL="https://github.com/google/blockly/wiki/Text#trimming-removing-spaces",e.Msg.TEXT_TRIM_OPERATOR_BOTH="trim spaces from both sides of",e.Msg.TEXT_TRIM_OPERATOR_LEFT="trim spaces from left side of",e.Msg.TEXT_TRIM_OPERATOR_RIGHT="trim spaces from right side of",e.Msg.TEXT_TRIM_TOOLTIP="Return a copy of the text with spaces removed from one or both ends.",e.Msg.TODAY="Today",e.Msg.UNDO="Undo",e.Msg.UNKNOWN="Unknown",e.Msg.UNNAMED_KEY="unnamed",e.Msg.VARIABLES_DEFAULT_NAME="item",e.Msg.VARIABLES_GET_CREATE_SET="Create 'set %1'",e.Msg.VARIABLES_GET_HELPURL="https://github.com/google/blockly/wiki/Variables#get",e.Msg.VARIABLES_GET_TOOLTIP="Returns the value of this variable.",e.Msg.VARIABLES_SET="set %1 to %2",e.Msg.VARIABLES_SET_CREATE_GET="Create 'get %1'",e.Msg.VARIABLES_SET_HELPURL="https://github.com/google/blockly/wiki/Variables#set",e.Msg.VARIABLES_SET_TOOLTIP="Sets this variable to be equal to the input.",e.Msg.VARIABLE_ALREADY_EXISTS="A variable named '%1' already exists.",e.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="A variable named '%1' already exists for another type: '%2'.",e.Msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER="A variable named '%1' already exists as a parameter in the procedure '%2'.",e.Msg.WINDOWS="Windows",e.Msg.WORKSPACE_ARIA_LABEL="Blockly Workspace",e.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT="Say something...",e.Msg.CONTROLS_FOREACH_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_FOR_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=e.Msg.CONTROLS_IF_MSG_ELSEIF,e.Msg.CONTROLS_IF_ELSE_TITLE_ELSE=e.Msg.CONTROLS_IF_MSG_ELSE,e.Msg.CONTROLS_IF_IF_TITLE_IF=e.Msg.CONTROLS_IF_MSG_IF,e.Msg.CONTROLS_IF_MSG_THEN=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_WHILEUNTIL_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.LISTS_CREATE_WITH_ITEM_TITLE=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.LISTS_GET_INDEX_HELPURL=e.Msg.LISTS_INDEX_OF_HELPURL,e.Msg.LISTS_GET_INDEX_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_INDEX_OF_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_SET_INDEX_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.MATH_CHANGE_TITLE_ITEM=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.PROCEDURES_DEFRETURN_COMMENT=e.Msg.PROCEDURES_DEFNORETURN_COMMENT,e.Msg.PROCEDURES_DEFRETURN_DO=e.Msg.PROCEDURES_DEFNORETURN_DO,e.Msg.PROCEDURES_DEFRETURN_PROCEDURE=e.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,e.Msg.PROCEDURES_DEFRETURN_TITLE=e.Msg.PROCEDURES_DEFNORETURN_TITLE,e.Msg.TEXT_APPEND_VARIABLE=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.MATH_HUE="230",e.Msg.LOOPS_HUE="120",e.Msg.LISTS_HUE="260",e.Msg.LOGIC_HUE="210",e.Msg.VARIABLES_HUE="330",e.Msg.TEXTS_HUE="160",e.Msg.PROCEDURES_HUE="290",e.Msg.COLOUR_HUE="20",e.Msg.VARIABLES_DYNAMIC_HUE="310",e.Msg},"function"==typeof define&&define.amd?define([],i):e.exports=i()}),u("94GXq",function(e,t){e.exports=h("34v67")}),u("34v67",function(e,t){var i;e.exports,i=function(e){var t=e.__namespace__,i=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_dynamic_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableDynamicSetterGetter"]},{type:"variables_set_dynamic",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_dynamic_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableDynamicSetterGetter"]}]);t.registerMixin$$module$build$src$core$extensions("contextMenu_variableDynamicSetterGetter",{customContextMenu:function(e){if(this.isInFlyout){var i,o;("variables_get_dynamic"===this.type||"variables_get_reporter_dynamic"===this.type)&&(n={text:t.Msg$$module$build$src$core$msg.RENAME_VARIABLE,enabled:!0,callback:(i=this,function(){let e=i.workspace,o=i.getField("VAR").getVariable();t.renameVariable$$module$build$src$core$variables(e,o)})},r=this.getField("VAR").getText(),r={text:t.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",r),enabled:!0,callback:(o=this,function(){let e=o.getField("VAR").getVariable();e&&t.deleteVariable$$module$build$src$core$variables(e.getWorkspace(),e,o)})},e.unshift(n),e.unshift(r))}else{if("variables_get_dynamic"===this.type)var s="variables_set_dynamic",n=t.Msg$$module$build$src$core$msg.VARIABLES_GET_CREATE_SET;else s="variables_get_dynamic",n=t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET;var r=this.getField("VAR");s={type:s,fields:{VAR:r.saveState(!0)}},e.push({enabled:this.workspace.remainingCapacity()>0,text:n.replace("%1",r.getText()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,s)})}},onchange:function(e){e=this.getFieldValue("VAR"),e=t.getVariable$$module$build$src$core$variables(this.workspace,e),"variables_get_dynamic"===this.type?this.outputConnection.setCheck(e.getType()):this.getInput("VALUE").connection.setCheck(e.getType())}}),t.defineBlocks$$module$build$src$core$common(i);var o=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);t.registerMixin$$module$build$src$core$extensions("contextMenu_variableSetterGetter",{customContextMenu:function(e){if(this.isInFlyout){var i,o;("variables_get"===this.type||"variables_get_reporter"===this.type)&&(n={text:t.Msg$$module$build$src$core$msg.RENAME_VARIABLE,enabled:!0,callback:(i=this,function(){let e=i.workspace,o=i.getField("VAR").getVariable();t.renameVariable$$module$build$src$core$variables(e,o)})},r=this.getField("VAR").getText(),r={text:t.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",r),enabled:!0,callback:(o=this,function(){let e=o.getField("VAR").getVariable();e&&t.deleteVariable$$module$build$src$core$variables(e.getWorkspace(),e,o)})},e.unshift(n),e.unshift(r))}else{if("variables_get"===this.type)var s="variables_set",n=t.Msg$$module$build$src$core$msg.VARIABLES_GET_CREATE_SET;else s="variables_get",n=t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET;var r=this.getField("VAR");s={type:s,fields:{VAR:r.saveState(!0)}},e.push({enabled:this.workspace.remainingCapacity()>0,text:n.replace("%1",r.getText()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,s)})}}}),t.defineBlocks$$module$build$src$core$common(o);var s=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",args0:[{type:"input_dummy"},{type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);s.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("STRING").setCheck("String").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);let e=e=>{let i=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+e]});return i.setValidator(function(t){let i=this.getValue();(t="FROM_START"===t||"FROM_END"===t)!=("FROM_START"===i||"FROM_END"===i)&&this.getSourceBlock().updateAt_(e,t)}),i};this.appendDummyInput("WHERE1_INPUT").appendField(e(1),"WHERE1"),this.appendDummyInput("AT1"),this.appendDummyInput("WHERE2_INPUT").appendField(e(2),"WHERE2"),this.appendDummyInput("AT2"),t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL),this.setInputsInline(!0),this.setOutput(!0,"String"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");var i=this.getInput("AT1")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at1",`${i}`),i=this.getInput("AT2")instanceof t.ValueInput$$module$build$src$core$inputs$value_input,e.setAttribute("at2",`${i}`),e},domToMutation:function(e){let t="true"===e.getAttribute("at1");e="true"===e.getAttribute("at2"),this.updateAt_(1,t),this.updateAt_(2,e)},updateAt_:function(e,i){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),i?(this.appendValueInput("AT"+e).setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e),2===e&&t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL)),1===e&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT"))}},s.text_changeCase={init:function(){let e=[[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("TEXT").setCheck("String").appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),"CASE"),this.setOutput(!0,"String"),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_TOOLTIP)}},s.text_trim={init:function(){let e=[[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_TRIM_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("TEXT").setCheck("String").appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),"MODE"),this.setOutput(!0,"String"),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_TRIM_TOOLTIP)}},s.text_print={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_PRINT_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_PRINT_HELPURL})}};var n={updateType_:function(e){this.outputConnection.setCheck("NUMBER"===e?"Number":"String")},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("type",this.getFieldValue("TYPE")),e},domToMutation:function(e){this.updateType_(e.getAttribute("type"))}};s.text_prompt_ext=Object.assign({},n,{init:function(){var e=[[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(e=>{this.updateType_(e)}),this.appendValueInput("TEXT").appendField(e,"TYPE"),this.setOutput(!0,"String"),this.setTooltip(()=>"TEXT"===this.getFieldValue("TYPE")?t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_TEXT:t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_NUMBER)}}),s.text_prompt=Object.assign({},n,{init:function(){this.mixin(r);var e=[[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(e=>{this.updateType_(e)}),this.appendDummyInput().appendField(e,"TYPE").appendField(this.newQuote_(!0)).appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:""}),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,"String"),this.setTooltip(()=>"TEXT"===this.getFieldValue("TYPE")?t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_TEXT:t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_NUMBER)}}),s.text_count={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_COUNT_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_COUNT_HELPURL})}},s.text_replace={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_REPLACE_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_REPLACE_HELPURL})}},s.text_reverse={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_HELPURL})}};var r={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(e){for(let t=0,i;i=this.inputList[t];t++)for(let t=0,o;o=i.fieldRow[t];t++)if(e===o.name){i.insertFieldAt(t,this.newQuote_(!0)),i.insertFieldAt(t+2,this.newQuote_(!1));return}console.warn('field named "'+e+'" not found in '+this.toDevString())},newQuote_:function(e){return e=this.RTL?!e:e,t.fromJson$$module$build$src$core$field_registry({type:"field_image",src:e?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,width:this.QUOTE_IMAGE_WIDTH,height:this.QUOTE_IMAGE_HEIGHT,alt:e?"“":"”"})}};t.register$$module$build$src$core$extensions("text_append_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_TEXT_APPEND_TOOLTIP}","VAR")),t.register$$module$build$src$core$extensions("text_indexOf_tooltip",function(){this.setTooltip(()=>t.Msg$$module$build$src$core$msg.TEXT_INDEXOF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}),t.register$$module$build$src$core$extensions("text_quotes",function(){this.mixin(r),this.quoteField_("TEXT")}),t.registerMixin$$module$build$src$core$extensions("quote_image_mixin",r),t.registerMutator$$module$build$src$core$extensions("text_join_mutator",{itemCount_:0,mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("items",`${this.itemCount_}`),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(e){this.itemCount_=e.itemCount,this.updateShape_()},decompose:function(e){let t=e.newBlock("text_create_join_container");t.initSvg();let i=t.getInput("STACK").connection;for(let t=0;t<this.itemCount_;t++){let t=e.newBlock("text_create_join_item");t.initSvg(),i.connect(t.previousConnection),i=t.nextConnection}return t},compose:function(e){var t=e.getInputTargetBlock("STACK");for(e=[];t;)t.isInsertionMarker()||e.push(t.valueConnection_),t=t.getNextBlock();for(t=0;t<this.itemCount_;t++){let i=this.getInput("ADD"+t).connection.targetConnection;i&&!e.includes(i)&&i.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),t=0;t<this.itemCount_;t++){let i;null==(i=e[t])||i.reconnect(this,"ADD"+t)}},saveConnections:function(e){e=e.getInputTargetBlock("STACK");let t=0;for(;e;){if(e.isInsertionMarker()){e=e.getNextBlock();continue}let i=this.getInput("ADD"+t);e.valueConnection_=i&&i.connection.targetConnection,e=e.getNextBlock(),t++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));for(var e=0;e<this.itemCount_;e++)if(!this.getInput("ADD"+e)){let i=this.appendValueInput("ADD"+e).setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT);0===e&&i.appendField(t.Msg$$module$build$src$core$msg.TEXT_JOIN_TITLE_CREATEWITH)}for(e=this.itemCount_;this.getInput("ADD"+e);e++)this.removeInput("ADD"+e)}},function(){this.mixin(r),this.itemCount_=2,this.updateShape_(),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["text_create_join_item"],this))}),t.registerMutator$$module$build$src$core$extensions("text_charAt_mutator",{isAt_:!1,mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("at",`${this.isAt_}`),e},domToMutation:function(e){e="false"!==e.getAttribute("at"),this.updateAt_(e)},updateAt_:function(e){this.removeInput("AT",!0),this.removeInput("ORDINAL",!0),e&&(this.appendValueInput("AT").setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)),t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TAIL)),this.isAt_=e}},function(){this.getField("WHERE").setValidator(function(e){e="FROM_START"===e||"FROM_END"===e;let t=this.getSourceBlock();e!==t.isAt_&&t.updateAt_(e)}),this.updateAt_(!0),this.setTooltip(()=>{var e=this.getFieldValue("WHERE");let i=t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TOOLTIP;return("FROM_START"===e||"FROM_END"===e)&&(e="FROM_START"===e?t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP)&&(i+=" "+e.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),i})}),t.defineBlocks$$module$build$src$core$common(s);var l={},a={setStatements_:function(e){this.hasStatements_!==e&&(e?(this.appendStatementInput("STACK").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=e)},updateParams_:function(){let e="";this.arguments_.length&&(e=t.Msg$$module$build$src$core$msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),t.disable$$module$build$src$core$events$utils();try{this.setFieldValue(e,"PARAMS")}finally{t.enable$$module$build$src$core$events$utils()}},mutationToDom:function(e){let i=t.createElement$$module$build$src$core$utils$xml("mutation");e&&i.setAttribute("name",this.getFieldValue("NAME"));for(let o=0;o<this.argumentVarModels_.length;o++){let s=t.createElement$$module$build$src$core$utils$xml("arg"),n=this.argumentVarModels_[o];s.setAttribute("name",n.getName()),s.setAttribute("varid",n.getId()),e&&this.paramIds_&&s.setAttribute("paramId",this.paramIds_[o]),i.appendChild(s)}return this.hasStatements_||i.setAttribute("statements","false"),i},domToMutation:function(e){this.arguments_=[],this.argumentVarModels_=[];for(let o=0,s;s=e.childNodes[o];o++)if("arg"===s.nodeName.toLowerCase()){var i=s;let e=i.getAttribute("name");i=i.getAttribute("varid")||i.getAttribute("varId"),this.arguments_.push(e),null!==(i=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,i,e,""))?this.argumentVarModels_.push(i):console.log(`Failed to create a variable named "${e}", ignoring.`)}this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),this.setStatements_("false"!==e.getAttribute("statements"))},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;let e=Object.create(null);if(this.argumentVarModels_.length){e.params=[];for(let t=0;t<this.argumentVarModels_.length;t++)e.params.push({name:this.argumentVarModels_[t].getName(),id:this.argumentVarModels_[t].getId()})}return this.hasStatements_||(e.hasStatements=!1),e},loadExtraState:function(e){if(this.arguments_=[],this.argumentVarModels_=[],e.params)for(let o=0;o<e.params.length;o++){var i=e.params[o];i=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,i.id,i.name,""),this.arguments_.push(i.getName()),this.argumentVarModels_.push(i)}this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),this.setStatements_(!1!==e.hasStatements)},decompose:function(e){let i=t.createElement$$module$build$src$core$utils$xml("block");i.setAttribute("type","procedures_mutatorcontainer");var o=t.createElement$$module$build$src$core$utils$xml("statement");o.setAttribute("name","STACK"),i.appendChild(o);for(let e=0;e<this.arguments_.length;e++){let i=t.createElement$$module$build$src$core$utils$xml("block");i.setAttribute("type","procedures_mutatorarg");var s=t.createElement$$module$build$src$core$utils$xml("field");s.setAttribute("name","NAME");let n=t.createTextNode$$module$build$src$core$utils$xml(this.arguments_[e]);s.appendChild(n),i.appendChild(s),s=t.createElement$$module$build$src$core$utils$xml("next"),i.appendChild(s),o.appendChild(i),o=s}return e=t.domToBlock$$module$build$src$core$xml(i,e),"procedures_defreturn"===this.type?e.setFieldValue(this.hasStatements_,"STATEMENTS"):e.removeInput("STATEMENT_INPUT"),t.mutateCallers$$module$build$src$core$procedures(this),e},compose:function(e){this.arguments_=[],this.paramIds_=[],this.argumentVarModels_=[];let i=e.getInputTargetBlock("STACK");for(;i&&!i.isInsertionMarker();){var o,s=i.getFieldValue("NAME");this.arguments_.push(s),s=this.workspace.getVariable(s,""),this.argumentVarModels_.push(s),this.paramIds_.push(i.id),i=i.nextConnection&&i.nextConnection.targetBlock()}this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),null!==(e=e.getFieldValue("STATEMENTS"))&&(e="TRUE"===e,this.hasStatements_!==e)&&(e?(this.setStatements_(!0),null==(o=this.statementConnection_)||o.reconnect(this,"STACK"),this.statementConnection_=null):(o=this.getInput("STACK").connection,(this.statementConnection_=o.targetConnection)&&((o=o.targetBlock()).unplug(),o.bumpNeighbours()),this.setStatements_(!1)))},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(e,i){var o=this.workspace.getVariableById(e);if(""===o.getType()){o=o.getName(),i=this.workspace.getVariableById(i);var s=!1;for(let t=0;t<this.argumentVarModels_.length;t++)this.argumentVarModels_[t].getId()===e&&(this.arguments_[t]=i.getName(),this.argumentVarModels_[t]=i,s=!0);s&&(this.displayRenamedVar_(o,i.getName()),t.mutateCallers$$module$build$src$core$procedures(this))}},updateVarName:function(e){let i=e.getName(),o=!1,s;for(let t=0;t<this.argumentVarModels_.length;t++)this.argumentVarModels_[t].getId()===e.getId()&&(s=this.arguments_[t],this.arguments_[t]=i,o=!0);o&&(this.displayRenamedVar_(s,i),t.mutateCallers$$module$build$src$core$procedures(this))},displayRenamedVar_:function(e,i){this.updateParams_();var o=this.getIcon(t.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE);if(o&&o.bubbleIsVisible()){o=o.getWorkspace().getAllBlocks(!1);for(let s=0,n;n=o[s];s++)"procedures_mutatorarg"===n.type&&t.Names$$module$build$src$core$names.equals(e,n.getFieldValue("NAME"))&&n.setFieldValue(i,"NAME")}},customContextMenu:function(e){if(!this.isInFlyout){var i=this.getFieldValue("NAME"),o={type:this.callType_,extraState:{name:i,params:this.arguments_}};if(e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.PROCEDURES_CREATE_DO.replace("%1",i),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,o)}),!this.isCollapsed())for(i=0;i<this.argumentVarModels_.length;i++){let s={type:"variables_get",fields:{VAR:{name:(o=this.argumentVarModels_[i]).getName(),id:o.getId(),type:o.getType()}}};e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",o.getName()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,s)})}}}};l.procedures_defnoreturn=Object.assign({},a,{init:function(){var e=t.findLegalName$$module$build$src$core$procedures("",this);(e=t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:e})).setValidator(t.rename$$module$build$src$core$procedures),e.setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},callType_:"procedures_callnoreturn"}),l.procedures_defreturn=Object.assign({},a,{init:function(){var e=t.findLegalName$$module$build$src$core$procedures("",this);(e=t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:e})).setValidator(t.rename$$module$build$src$core$procedures),e.setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.appendValueInput("RETURN").setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT).appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},callType_:"procedures_callreturn"}),l.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.appendDummyInput("STATEMENT_INPUT").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_ALLOW_STATEMENTS).appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_checkbox",checked:!0}),"STATEMENTS"),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP),this.contextMenu=!1}};var c=class extends t.FieldTextInput$$module$build$src$core$field_textinput{constructor(){super(...arguments),this.editingInteractively=!1}showEditor_(e){super.showEditor_(e),this.editingInteractively=!0,this.editingVariable=void 0}onFinishEditing_(e){super.onFinishEditing_(e),this.editingInteractively=!1}};l.procedures_mutatorarg={init:function(){let e=new c(t.DEFAULT_ARG$$module$build$src$core$procedures,this.validator_);this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORARG_TITLE).appendField(e,"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORARG_TOOLTIP),this.contextMenu=!1},validator_:function(e){var t=this.getSourceBlock();let i=t.workspace.getRootWorkspace();if(!(e=e.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"")))return null;let o=(t.workspace.targetWorkspace||t.workspace).getAllBlocks(!1),s=e.toLowerCase();for(let e=0;e<o.length;e++){if(o[e].id===this.getSourceBlock().id)continue;let t=o[e].getFieldValue("NAME");if(t&&t.toLowerCase()===s)return null}return t.isInFlyout||((t=i.getVariable(e,""))&&t.getName()!==e&&i.renameVariableById(t.getId(),e),t||(this.editingInteractively?this.editingVariable?i.renameVariableById(this.editingVariable.getId(),e):this.editingVariable=i.createVariable(e,""):i.createVariable(e,""))),e}};var h="DISABLED_PROCEDURE_DEFINITION",u={getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(e,i){t.Names$$module$build$src$core$names.equals(e,this.getProcedureCall())&&(this.setFieldValue(i,"NAME"),this.setTooltip((this.outputConnection?t.Msg$$module$build$src$core$msg.PROCEDURES_CALLRETURN_TOOLTIP:t.Msg$$module$build$src$core$msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",i)))},setProcedureParameters_:function(e,i){var o=t.getDefinition$$module$build$src$core$procedures(this.getProcedureCall(),this.workspace);if((o=(o=o&&o.getIcon(t.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE))&&o.bubbleIsVisible())?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=null),e.join("\n")===this.arguments_.join("\n"))this.quarkIds_=i;else{if(i.length!==e.length)throw RangeError("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);for(let e=0;e<this.arguments_.length;e++){var s=this.getInput("ARG"+e);s&&(s=s.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=s,o&&s&&!i.includes(this.quarkIds_[e])&&(s.disconnect(),s.getSourceBlock().bumpNeighbours()))}for(this.arguments_=[].concat(e),this.argumentVarModels_=[],e=0;e<this.arguments_.length;e++)o=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,null,this.arguments_[e],""),this.argumentVarModels_.push(o);if(this.updateShape_(),this.quarkIds_=i){for(i=0;i<this.arguments_.length;i++)if((e=this.quarkIds_[i])in this.quarkConnections_){let t;(null==(t=this.quarkConnections_[e])?0:t.reconnect(this,"ARG"+i))||delete this.quarkConnections_[e]}}}},updateShape_:function(){for(var e=0;e<this.arguments_.length;e++){var i=this.getField("ARGNAME"+e);if(i){t.disable$$module$build$src$core$events$utils();try{i.setValue(this.arguments_[e])}finally{t.enable$$module$build$src$core$events$utils()}}else i=t.fromJson$$module$build$src$core$field_registry({type:"field_label",text:this.arguments_[e]}),this.appendValueInput("ARG"+e).setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT).appendField(i,"ARGNAME"+e)}for(e=this.arguments_.length;this.getInput("ARG"+e);e++)this.removeInput("ARG"+e);(e=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||e.appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&e.removeField("WITH"))},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");e.setAttribute("name",this.getProcedureCall());for(let i=0;i<this.arguments_.length;i++){let o=t.createElement$$module$build$src$core$utils$xml("arg");o.setAttribute("name",this.arguments_[i]),e.appendChild(o)}return e},domToMutation:function(e){var t=e.getAttribute("name");this.renameProcedure(this.getProcedureCall(),t),t=[];let i=[];for(let o=0,s;s=e.childNodes[o];o++)"arg"===s.nodeName.toLowerCase()&&(t.push(s.getAttribute("name")),i.push(s.getAttribute("paramId")));this.setProcedureParameters_(t,i)},saveExtraState:function(){let e=Object.create(null);return e.name=this.getProcedureCall(),this.arguments_.length&&(e.params=this.arguments_),e},loadExtraState:function(e){if(this.renameProcedure(this.getProcedureCall(),e.name),e=e.params){let t=[];t.length=e.length,t.fill(null),this.setProcedureParameters_(e,t)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(e){if(this.workspace&&!this.workspace.isFlyout&&e.recordUndo)if(e.type===t.BLOCK_CREATE$$module$build$src$core$events$events&&e.ids.includes(this.id)){var i=this.getProcedureCall(),o=t.getDefinition$$module$build$src$core$procedures(i,this.workspace);if(o&&(o.type!==this.defType_||JSON.stringify(o.getVars())!==JSON.stringify(this.arguments_))&&(o=null),o)o.isEnabled()||(this.setDisabledReason(!0,h),this.setWarningText(t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",i)));else{t.setGroup$$module$build$src$core$events$utils(e.group),e=t.createElement$$module$build$src$core$utils$xml("xml"),(i=t.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type",this.defType_);var s=(o=this.getRelativeToSurfaceXY()).y+2*t.config$$module$build$src$core$config.snapRadius;i.setAttribute("x",`${o.x+t.config$$module$build$src$core$config.snapRadius*(this.RTL?-1:1)}`),i.setAttribute("y",`${s}`),o=this.mutationToDom(),i.appendChild(o),(o=t.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name","NAME"),s=this.getProcedureCall();let n=t.findLegalName$$module$build$src$core$procedures(s,this);s!==n&&this.renameProcedure(s,n),o.appendChild(t.createTextNode$$module$build$src$core$utils$xml(s)),i.appendChild(o),e.appendChild(i),t.domToWorkspace$$module$build$src$core$xml(e,this.workspace),t.setGroup$$module$build$src$core$events$utils(!1)}}else e.type===t.BLOCK_DELETE$$module$build$src$core$events$events?(i=this.getProcedureCall(),t.getDefinition$$module$build$src$core$procedures(i,this.workspace)||(t.setGroup$$module$build$src$core$events$utils(e.group),this.dispose(!0),t.setGroup$$module$build$src$core$events$utils(!1))):e.type===t.BLOCK_CHANGE$$module$build$src$core$events$events&&"disabled"===e.element&&(i=this.getProcedureCall(),(s=t.getDefinition$$module$build$src$core$procedures(i,this.workspace))&&s.id===e.blockId&&((o=t.getGroup$$module$build$src$core$events$utils())&&console.log("Saw an existing group while responding to a definition change"),t.setGroup$$module$build$src$core$events$utils(e.group),e=s.isEnabled(),this.setDisabledReason(!e,h),this.setWarningText(e?null:t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",i)),t.setGroup$$module$build$src$core$events$utils(o)))},customContextMenu:function(e){if(this.workspace.isMovable()){var i=this.getProcedureCall(),o=this.workspace;e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.PROCEDURES_HIGHLIGHT_DEF,callback:function(){let e=t.getDefinition$$module$build$src$core$procedures(i,o);e&&(o.centerOnBlock(e.id),t.getFocusManager$$module$build$src$core$focus_manager().focusNode(e))}})}}};l.procedures_callnoreturn=Object.assign({},u,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defnoreturn"}),l.procedures_callreturn=Object.assign({},u,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defreturn"}),l.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("value",String(Number(this.hasReturnValue_))),e},domToMutation:function(e){this.hasReturnValue_="1"===e.getAttribute("value"),this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(e){if(!(this.workspace.isDragging&&this.workspace.isDragging()||e.type!==t.BLOCK_MOVE$$module$build$src$core$events$events&&e.type!==t.BLOCK_CREATE$$module$build$src$core$events$events)){e=!1;var i=this;do{if(this.FUNCTION_TYPES.includes(i.type)){e=!0;break}i=i.getSurroundParent()}while(i)if(e?("procedures_defnoreturn"===i.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!==i.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_WARNING),!this.isInFlyout)try{t.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!e,"UNPARENTED_IFRETURN")}finally{t.setRecordUndo$$module$build$src$core$events$utils(!0)}}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]},t.defineBlocks$$module$build$src$core$common(l);var d=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);t.register$$module$build$src$core$extensions("math_op_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("OP",{ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"})),t.registerMutator$$module$build$src$core$extensions("math_is_divisibleby_mutator",{mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation"),i="DIVISIBLE_BY"===this.getFieldValue("PROPERTY");return e.setAttribute("divisor_input",String(i)),e},domToMutation:function(e){e="true"===e.getAttribute("divisor_input"),this.updateShape_(e)},updateShape_:function(e){let t=this.getInput("DIVISOR");e?t||this.appendValueInput("DIVISOR").setCheck("Number"):t&&this.removeInput("DIVISOR")}},function(){this.getField("PROPERTY").setValidator(function(e){e="DIVISIBLE_BY"===e,this.getSourceBlock().updateShape_(e)})}),t.register$$module$build$src$core$extensions("math_change_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_MATH_CHANGE_TOOLTIP}","VAR")),t.registerMutator$$module$build$src$core$extensions("math_modes_of_list_mutator",{updateType_:function(e){"MODE"===e?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("op",this.getFieldValue("OP")),e},domToMutation:function(e){if(null===(e=e.getAttribute("op")))throw TypeError("xmlElement had no op attribute");this.updateType_(e)}},function(){this.getField("OP").setValidator((function(e){this.updateType_(e)}).bind(this))}),t.defineBlocks$$module$build$src$core$common(d);var p=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]);t.register$$module$build$src$core$extensions("controls_whileUntil_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("MODE",{WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"})),t.register$$module$build$src$core$extensions("controls_flow_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("FLOW",{BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"})),t.registerMixin$$module$build$src$core$extensions("contextMenu_newGetVariableBlock",{customContextMenu:function(e){if(!this.isInFlyout){var i=this.getField("VAR"),o=i.getVariable().getName();this.isCollapsed()||null===o||(i={type:"variables_get",fields:{VAR:i.saveState(!0)}},e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",o),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,i)}))}}}),t.register$$module$build$src$core$extensions("controls_for_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),t.register$$module$build$src$core$extensions("controls_forEach_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));var _=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]);t.registerMixin$$module$build$src$core$extensions("controls_flow_in_loop_check",{getSurroundLoop:function(){let e=this;do{if(_.has(e.type))return e;e=e.getSurroundParent()}while(e)return null},onchange:function(e){let i=this.workspace;if(i.isDragging&&!i.isDragging()&&(e.type===t.BLOCK_MOVE$$module$build$src$core$events$events||e.type===t.BLOCK_CREATE$$module$build$src$core$events$events)&&(e=!!this.getSurroundLoop(),this.setWarningText(e?null:t.Msg$$module$build$src$core$msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout))try{t.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!e,"CONTROL_FLOW_NOT_IN_LOOP")}finally{t.setRecordUndo$$module$build$src$core$events$utils(!0)}}}),t.defineBlocks$$module$build$src$core$common(p);var g=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["≠","NEQ"],["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]},{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);t.register$$module$build$src$core$extensions("logic_op_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("OP",{EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"})),t.registerMutator$$module$build$src$core$extensions("controls_if_mutator",{elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;let e=t.createElement$$module$build$src$core$utils$xml("mutation");return this.elseifCount_&&e.setAttribute("elseif",String(this.elseifCount_)),this.elseCount_&&e.setAttribute("else","1"),e},domToMutation:function(e){this.elseifCount_=parseInt(e.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(e.getAttribute("else"),10)||0,this.rebuildShape_()},saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;let e=Object.create(null);return this.elseifCount_&&(e.elseIfCount=this.elseifCount_),this.elseCount_&&(e.hasElse=!0),e},loadExtraState:function(e){this.elseifCount_=e.elseIfCount||0,this.elseCount_=+!!e.hasElse,this.updateShape_()},decompose:function(e){let t=e.newBlock("controls_if_if");t.initSvg();let i=t.nextConnection;for(let t=1;t<=this.elseifCount_;t++){let t=e.newBlock("controls_if_elseif");t.initSvg(),i.connect(t.previousConnection),i=t.nextConnection}return this.elseCount_&&((e=e.newBlock("controls_if_else")).initSvg(),i.connect(e.previousConnection)),t},compose:function(e){e=e.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;let t=[null],i=[null],o=null;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":this.elseifCount_++,t.push(e.valueConnection_),i.push(e.statementConnection_);break;case"controls_if_else":this.elseCount_++,o=e.statementConnection_;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.getNextBlock()}this.updateShape_(),this.reconnectChildBlocks_(t,i,o)},saveConnections:function(e){e=e.nextConnection.targetBlock();let t=1;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":var i=this.getInput("IF"+t);let o=this.getInput("DO"+t);e.valueConnection_=i&&i.connection.targetConnection,e.statementConnection_=o&&o.connection.targetConnection,t++;break;case"controls_if_else":i=this.getInput("ELSE"),e.statementConnection_=i&&i.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.getNextBlock()}},rebuildShape_:function(){let e=[null],t=[null],i=null;this.getInput("ELSE")&&(i=this.getInput("ELSE").connection.targetConnection);for(let i=1;this.getInput("IF"+i);i++){let o=this.getInput("IF"+i),s=this.getInput("DO"+i);e.push(o.connection.targetConnection),t.push(s.connection.targetConnection)}this.updateShape_(),this.reconnectChildBlocks_(e,t,i)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);e++)this.removeInput("IF"+e),this.removeInput("DO"+e);for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck("Boolean").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(e,t,i){for(let i=1;i<=this.elseifCount_;i++){let o,s;null==(o=e[i])||o.reconnect(this,"IF"+i),null==(s=t[i])||s.reconnect(this,"DO"+i)}null==i||i.reconnect(this,"ELSE")}},null,["controls_if_elseif","controls_if_else"]),t.register$$module$build$src$core$extensions("controls_if_tooltip",function(){this.setTooltip((function(){return this.elseifCount_||this.elseCount_?!this.elseifCount_&&this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_2:this.elseifCount_&&!this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_3:this.elseifCount_&&this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_4:"":t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_1}).bind(this))});var E={onchange:function(e){this.prevBlocks_||(this.prevBlocks_=[null,null]);var i=this.getInputTargetBlock("A");let o=this.getInputTargetBlock("B");i&&o&&!this.workspace.connectionChecker.doTypeChecks(i.outputConnection,o.outputConnection)&&(t.setGroup$$module$build$src$core$events$utils(e.group),(e=this.prevBlocks_[0])!==i&&(i.unplug(),!e||e.isDisposed()||e.isShadow()||this.getInput("A").connection.connect(e.outputConnection)),(i=this.prevBlocks_[1])!==o&&(o.unplug(),!i||i.isDisposed()||i.isShadow()||this.getInput("B").connection.connect(i.outputConnection)),this.bumpNeighbours(),t.setGroup$$module$build$src$core$events$utils(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}};t.register$$module$build$src$core$extensions("logic_compare",function(){this.mixin(E)}),t.registerMixin$$module$build$src$core$extensions("logic_ternary",{prevParentConnection_:null,onchange:function(e){let i=this.getInputTargetBlock("THEN"),o=this.getInputTargetBlock("ELSE"),s=this.outputConnection.targetConnection;if((i||o)&&s)for(let n=0;n<2;n++){let r=1===n?i:o;r&&!r.workspace.connectionChecker.doTypeChecks(r.outputConnection,s)&&(t.setGroup$$module$build$src$core$events$utils(e.group),s===this.prevParentConnection_?(this.unplug(),s.getSourceBlock().bumpNeighbours()):(r.unplug(),r.bumpNeighbours()),t.setGroup$$module$build$src$core$events$utils(!1))}this.prevParentConnection_=s}}),t.defineBlocks$$module$build$src$core$common(g);var T=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);T.lists_create_with={init:function(){this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_HELPURL),this.setStyle("list_blocks"),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["lists_create_with_item"],this)),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("items",String(this.itemCount_)),e},domToMutation:function(e){if(!(e=e.getAttribute("items")))throw TypeError("element did not have items");this.itemCount_=parseInt(e,10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(e){this.itemCount_=e.itemCount,this.updateShape_()},decompose:function(e){let t=e.newBlock("lists_create_with_container");t.initSvg();let i=t.getInput("STACK").connection;for(let t=0;t<this.itemCount_;t++){let t=e.newBlock("lists_create_with_item");if(t.initSvg(),!t.previousConnection)throw Error("itemBlock has no previousConnection");i.connect(t.previousConnection),i=t.nextConnection}return t},compose:function(e){var t=e.getInputTargetBlock("STACK");for(e=[];t;)t.isInsertionMarker()||e.push(t.valueConnection_),t=t.getNextBlock();for(t=0;t<this.itemCount_;t++){let i=this.getInput("ADD"+t).connection.targetConnection;i&&!e.includes(i)&&i.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),t=0;t<this.itemCount_;t++){let i;null==(i=e[t])||i.reconnect(this,"ADD"+t)}},saveConnections:function(e){e=e.getInputTargetBlock("STACK");let t=0;for(;e;){if(e.isInsertionMarker()){e=e.getNextBlock();continue}let i=this.getInput("ADD"+t);e.valueConnection_=null==i?void 0:i.connection.targetConnection,e=e.getNextBlock(),t++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_EMPTY_TITLE);for(var e=0;e<this.itemCount_;e++)if(!this.getInput("ADD"+e)){let i=this.appendValueInput("ADD"+e).setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT);0===e&&i.appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_INPUT_WITH)}for(e=this.itemCount_;this.getInput("ADD"+e);e++)this.removeInput("ADD"+e)}},T.lists_create_with_container={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},T.lists_create_with_item={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},T.lists_indexOf={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_LAST,"LAST"]];if(this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_HELPURL),this.setStyle("list_blocks"),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_INPUT_IN_LIST),!(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})))throw Error("field_dropdown not found");this.appendValueInput("FIND").appendField(e,"END"),this.setInputsInline(!0),this.setTooltip(()=>t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}},T.lists_getIndex={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET,"GET"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_HELPURL),this.setStyle("list_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(function(e){e="REMOVE"===e,this.getSourceBlock().updateStatement_(e)}),this.appendValueInput("VALUE").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS})).setValidator(function(e){let t=this.getValue();(e="FROM_START"===e||"FROM_END"===e)!=("FROM_START"===t||"FROM_END"===t)&&this.getSourceBlock().updateAt_(e)}),this.appendDummyInput().appendField(e,"WHERE"),this.appendDummyInput("AT"),t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0),this.setTooltip(()=>{let e=this.getFieldValue("MODE"),i=this.getFieldValue("WHERE"),o="";switch(e+" "+i){case"GET FROM_START":case"GET FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case"GET LAST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case"GET RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case"GET_REMOVE LAST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case"GET_REMOVE RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case"REMOVE FROM_START":case"REMOVE FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case"REMOVE FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case"REMOVE LAST":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case"REMOVE RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}return("FROM_START"===i||"FROM_END"===i)&&(o+=" "+("FROM_START"===i?t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),o})},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");e.setAttribute("statement",String(!this.outputConnection));let i=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(i)),e},domToMutation:function(e){let t="true"===e.getAttribute("statement");this.updateStatement_(t),e="false"!==e.getAttribute("at"),this.updateAt_(e)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(e){e.isStatement?this.updateStatement_(!0):"string"==typeof e&&this.domToMutation(t.textToDom$$module$build$src$core$utils$xml(e))},updateStatement_:function(e){!this.outputConnection!==e&&(this.unplug(!0,!0),e?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},T.lists_setIndex={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_SET,"SET"],[t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_IN_LIST),e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS})).setValidator(function(e){let t=this.getValue();(e="FROM_START"===e||"FROM_END"===e)!=("FROM_START"===t||"FROM_END"===t)&&this.getSourceBlock().updateAt_(e)}),this.appendDummyInput().appendField(e,"WHERE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt_(!0),this.setTooltip(()=>{let e=this.getFieldValue("MODE"),i=this.getFieldValue("WHERE"),o="";switch(e+" "+i){case"SET FROM_START":case"SET FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case"SET FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case"SET LAST":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case"SET RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case"INSERT FROM_START":case"INSERT FROM_END":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case"INSERT FIRST":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case"INSERT LAST":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case"INSERT RANDOM":o=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}return("FROM_START"===i||"FROM_END"===i)&&(o+=" "+t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),o})},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation"),i=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(i)),e},domToMutation:function(e){e="false"!==e.getAttribute("at"),this.updateAt_(e)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO")}},T.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);let e=e=>{let i=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+e]});return i.setValidator(function(t){let i=this.getValue();(t="FROM_START"===t||"FROM_END"===t)!=("FROM_START"===i||"FROM_END"===i)&&this.getSourceBlock().updateAt_(e,t)}),i};this.appendDummyInput("WHERE1_INPUT").appendField(e(1),"WHERE1"),this.appendDummyInput("AT1"),this.appendDummyInput("WHERE2_INPUT").appendField(e(2),"WHERE2"),this.appendDummyInput("AT2"),t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");var i=this.getInput("AT1")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at1",String(i)),i=this.getInput("AT2")instanceof t.ValueInput$$module$build$src$core$inputs$value_input,e.setAttribute("at2",String(i)),e},domToMutation:function(e){let t="true"===e.getAttribute("at1");e="true"===e.getAttribute("at2"),this.updateAt_(1,t),this.updateAt_(2,e)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(e,i){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),i?(this.appendValueInput("AT"+e).setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e),1===e&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT")),t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}},T.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}},T.lists_split={init:function(){let e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:[[t.Msg$$module$build$src$core$msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!e)throw Error("field_dropdown not found");e.setValidator(e=>{this.updateType_(e)}),this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_SPLIT_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("INPUT").setCheck("String").appendField(e,"MODE"),this.appendValueInput("DELIM").setCheck("String").appendField(t.Msg$$module$build$src$core$msg.LISTS_SPLIT_WITH_DELIMITER),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.setTooltip(()=>{let e=this.getFieldValue("MODE");if("SPLIT"===e)return t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"===e)return t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+e)})},updateType_:function(e){if(this.getFieldValue("MODE")!==e){let e=this.getInput("INPUT").connection;e.setShadowDom(null);let t=e.targetBlock();t&&(e.disconnect(),t.isShadow()?t.dispose(!1):this.bumpNeighbours())}"SPLIT"===e?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("mode",this.getFieldValue("MODE")),e},domToMutation:function(e){this.updateType_(e.getAttribute("mode"))},saveExtraState:function(){return{mode:this.getFieldValue("MODE")}},loadExtraState:function(e){this.updateType_(e.mode)}},t.defineBlocks$$module$build$src$core$common(T);var m={blocks:Object.assign({},T,g,p,d,l,s,o,i),lists:{blocks:T},logic:{blocks:g},loops:{blocks:p,loopTypes:_},math:{blocks:d},procedures:{blocks:l},texts:{blocks:s},variables:{blocks:o},variablesDynamic:{blocks:i}};return m.__namespace__=t,m},"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],i):e.exports=i(h("97Mr6"))}),u("eqdor",function(e,t){var i;e.exports,i=function(e){var t,i,o=e.__namespace__,s=function(e,t){let o=0,s="",n,r;t.STATEMENT_PREFIX&&(s+=t.injectId(t.STATEMENT_PREFIX,e));do r=t.valueToCode(e,"IF"+o,i.NONE)||"False",n=t.statementToCode(e,"DO"+o)||t.PASS,t.STATEMENT_SUFFIX&&(n=t.prefixLines(t.injectId(t.STATEMENT_SUFFIX,e),t.INDENT)+n),s+=(0===o?"if ":"elif ")+r+":\n"+n,o++;while(e.getInput("IF"+o))return(e.getInput("ELSE")||t.STATEMENT_SUFFIX)&&(n=e.getInput("ELSE")&&t.statementToCode(e,"ELSE")||t.PASS,t.STATEMENT_SUFFIX&&(n=t.prefixLines(t.injectId(t.STATEMENT_SUFFIX,e),t.INDENT)+n),s+="else:\n"+n),s},n=function(e,t){let s;s=e.getField("TIMES")?String(parseInt(e.getFieldValue("TIMES"),10)):t.valueToCode(e,"TIMES",i.NONE)||"0",s=o.isNumber$$module$build$src$core$utils$string(s)?parseInt(s,10):"int("+s+")";let n=t.statementToCode(e,"DO");return n=t.addLoopTrap(n,e)||t.PASS,"for "+t.nameDB_.getDistinctName("count",o.NameType$$module$build$src$core$names.VARIABLE)+" in range("+s+"):\n"+n},r=function(e,t){let o,s=e.getFieldValue("OP");if("NEG"===s)return["-"+(o=t.valueToCode(e,"NUM",i.UNARY_SIGN)||"0"),i.UNARY_SIGN];switch(t.definitions_.import_math="import math",e="SIN"===s||"COS"===s||"TAN"===s?t.valueToCode(e,"NUM",i.MULTIPLICATIVE)||"0":t.valueToCode(e,"NUM",i.NONE)||"0",s){case"ABS":o="math.fabs("+e+")";break;case"ROOT":o="math.sqrt("+e+")";break;case"LN":o="math.log("+e+")";break;case"LOG10":o="math.log10("+e+")";break;case"EXP":o="math.exp("+e+")";break;case"POW10":o="math.pow(10,"+e+")";break;case"ROUND":o="round("+e+")";break;case"ROUNDUP":o="math.ceil("+e+")";break;case"ROUNDDOWN":o="math.floor("+e+")";break;case"SIN":o="math.sin("+e+" / 180.0 * math.pi)";break;case"COS":o="math.cos("+e+" / 180.0 * math.pi)";break;case"TAN":o="math.tan("+e+" / 180.0 * math.pi)"}if(o)return[o,i.FUNCTION_CALL];switch(s){case"ASIN":o="math.asin("+e+") / math.pi * 180";break;case"ACOS":o="math.acos("+e+") / math.pi * 180";break;case"ATAN":o="math.atan("+e+") / math.pi * 180";break;default:throw Error("Unknown math operator: "+s)}return[o,i.MULTIPLICATIVE]},l=function(e,t){var s=[],n=e.workspace,r=o.allUsedVarModels$$module$build$src$core$variables(n)||[];for(var l of r)r=l.getName(),e.getVars().includes(r)||s.push(t.getVariableName(r));for(l=0,n=o.allDeveloperVariables$$module$build$src$core$variables(n);l<n.length;l++)s.push(t.nameDB_.getName(n[l],o.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));n=s.length?t.INDENT+"global "+s.join(", ")+"\n":"",s=t.getProcedureName(e.getFieldValue("NAME")),l="",t.STATEMENT_PREFIX&&(l+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(l+=t.injectId(t.STATEMENT_SUFFIX,e)),l&&(l=t.prefixLines(l,t.INDENT)),r="",t.INFINITE_LOOP_TRAP&&(r=t.prefixLines(t.injectId(t.INFINITE_LOOP_TRAP,e),t.INDENT));let a="";e.getInput("STACK")&&(a=t.statementToCode(e,"STACK"));let c="";e.getInput("RETURN")&&(c=t.valueToCode(e,"RETURN",i.NONE)||"");let h="";a&&c&&(h=l),c?c=t.INDENT+"return "+c+"\n":a||(a=t.PASS);let u=[],d=e.getVars();for(let e=0;e<d.length;e++)u[e]=t.getVariableName(d[e]);return n="def "+s+"("+u.join(", ")+"):\n"+n+l+r+a+h+c,n=t.scrub_(e,n),t.definitions_["%"+s]=n,null},a=function(e,t){var o=t.provideFunction_("text_prompt",`
|
|
38
38
|
def ${t.FUNCTION_NAME_PLACEHOLDER_}(msg):
|
|
39
39
|
try:
|
|
40
40
|
return raw_input(msg)
|
|
@@ -142,14 +142,18 @@ def ${t.FUNCTION_NAME_PLACEHOLDER_}(numbers):
|
|
|
142
142
|
def ${t.FUNCTION_NAME_PLACEHOLDER_}(text):
|
|
143
143
|
x = int(random.random() * len(text))
|
|
144
144
|
return text[x]
|
|
145
|
-
`)+"("+s+")",i.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).")},I.text_count=function(e,t){return[(t.valueToCode(e,"TEXT",i.MEMBER)||"''")+".count("+(e=t.valueToCode(e,"SUB",i.NONE)||"''")+")",i.FUNCTION_CALL]},I.text_getSubstring=function(e,t){var s=e.getFieldValue("WHERE1");let n=e.getFieldValue("WHERE2"),r=t.valueToCode(e,"STRING",i.MEMBER)||"''";switch(s){case"FROM_START":0===(s=t.getAdjustedInt(e,"AT1"))&&(s="");break;case"FROM_END":s=t.getAdjustedInt(e,"AT1",1,!0);break;case"FIRST":s="";break;default:throw Error("Unhandled option (text_getSubstring)")}switch(n){case"FROM_START":e=t.getAdjustedInt(e,"AT2",1);break;case"FROM_END":e=t.getAdjustedInt(e,"AT2",0,!0),o.isNumber$$module$build$src$core$utils$string(String(e))?0===e&&(e=""):(t.definitions_.import_sys="import sys",e+=" or sys.maxsize");break;case"LAST":e="";break;default:throw Error("Unhandled option (text_getSubstring)")}return[r+"["+s+" : "+e+"]",i.MEMBER]},I.text_indexOf=function(e,t){let o="FIRST"===e.getFieldValue("END")?"find":"rfind",s=t.valueToCode(e,"FIND",i.NONE)||"''";return t=(t.valueToCode(e,"VALUE",i.MEMBER)||"''")+"."+o+"("+s+")",e.workspace.options.oneBasedIndex?[t+" + 1",i.ADDITIVE]:[t,i.FUNCTION_CALL]},I.text_isEmpty=function(e,t){return["not len("+(t.valueToCode(e,"VALUE",i.NONE)||"''")+")",i.LOGICAL_NOT]},I.text_join=function(e,t){switch(e.itemCount_){case 0:return["''",i.ATOMIC];case 1:return f(e=t.valueToCode(e,"ADD0",i.NONE)||"''");case 2:var s=t.valueToCode(e,"ADD0",i.NONE)||"''";return e=t.valueToCode(e,"ADD1",i.NONE)||"''",[f(s)[0]+" + "+f(e)[0],i.ADDITIVE];default:s=[];for(let o=0;o<e.itemCount_;o++)s[o]=t.valueToCode(e,"ADD"+o,i.NONE)||"''";return["''.join([str("+(e=t.nameDB_.getDistinctName("x",o.NameType$$module$build$src$core$names.VARIABLE))+") for "+e+" in ["+s.join(", ")+"]])",i.FUNCTION_CALL]}},I.text_length=function(e,t){return["len("+(t.valueToCode(e,"VALUE",i.NONE)||"''")+")",i.FUNCTION_CALL]},I.text_print=function(e,t){return"print("+(t.valueToCode(e,"TEXT",i.NONE)||"''")+")\n"},I.text_prompt=a,I.text_prompt_ext=a,I.text_replace=function(e,t){return[(t.valueToCode(e,"TEXT",i.MEMBER)||"''")+".replace("+(t.valueToCode(e,"FROM",i.NONE)||"''")+", "+(e=t.valueToCode(e,"TO",i.NONE)||"''")+")",i.MEMBER]},I.text_reverse=function(e,t){return[(t.valueToCode(e,"TEXT",i.MEMBER)||"''")+"[::-1]",i.MEMBER]},I.text_trim=function(e,t){let o={LEFT:".lstrip()",RIGHT:".rstrip()",BOTH:".strip()"}[e.getFieldValue("MODE")];return[(t.valueToCode(e,"TEXT",i.MEMBER)||"''")+o,i.FUNCTION_CALL]};var S={};S.variables_get=c,S.variables_set=h;var R={};R.variables_get_dynamic=c,R.variables_set_dynamic=h;var b=new u;b.addReservedWords("math,random,Number");var C=Object.assign({},p,_,g,E,T,I,S,R);for(let e in C)b.forBlock[e]=C[e];var O={};return O.Order=i,O.PythonGenerator=u,O.pythonGenerator=b,O.__namespace__=o,O},"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],i):e.exports=i(h("97Mr6"))});var d=h("hKdZU");h("7nxqN"),h("7nxqN").default.defineExtension("json-enc",{init:function(e){i=e},onEvent:function(e,t){"htmx:configRequest"===e&&(t.detail.headers["Content-Type"]="application/json")},encodeParameters:function(e,t,o){e.overrideMimeType("text/json");let s={};t.forEach(function(e,t){Object.hasOwn(s,t)?(Array.isArray(s[t])||(s[t]=[s[t]]),s[t].push(e)):s[t]=e});let n=i.getExpressionVars(o);return Object.keys(s).forEach(function(e){s[e]=Object.hasOwn(n,e)?n[e]:s[e]}),JSON.stringify(s)}});var p={},_=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,o={},s={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof n?new n(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++i}),e.__id},clone:function e(t,i){var o,n;switch(i=i||{},s.util.type(t)){case"Object":if(i[n=s.util.objId(t)])return i[n];for(var r in o={},i[n]=o,t)t.hasOwnProperty(r)&&(o[r]=e(t[r],i));return o;case"Array":if(i[n=s.util.objId(t)])return i[n];return o=[],i[n]=o,t.forEach(function(t,s){o[s]=e(t,i)}),o;default:return t}},getLanguage:function(e){for(;e;){var i=t.exec(e.className);if(i)return i[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,i){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+i)},currentScript:function(){if("u"<typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName&&1)return document.currentScript;try{throw Error()}catch(o){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(o.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var i in t)if(t[i].src==e)return t[i]}return null}},isActive:function(e,t,i){for(var o="no-"+t;e;){var s=e.classList;if(s.contains(t))return!0;if(s.contains(o))return!1;e=e.parentElement}return!!i}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(e,t){var i=s.util.clone(s.languages[e]);for(var o in t)i[o]=t[o];return i},insertBefore:function(e,t,i,o){var n=(o=o||s.languages)[e],r={};for(var l in n)if(n.hasOwnProperty(l)){if(l==t)for(var a in i)i.hasOwnProperty(a)&&(r[a]=i[a]);i.hasOwnProperty(l)||(r[l]=n[l])}var c=o[e];return o[e]=r,s.languages.DFS(s.languages,function(t,i){i===c&&t!=e&&(this[t]=r)}),r},DFS:function e(t,i,o,n){n=n||{};var r=s.util.objId;for(var l in t)if(t.hasOwnProperty(l)){i.call(t,l,t[l],o||l);var a=t[l],c=s.util.type(a);"Object"!==c||n[r(a)]?"Array"!==c||n[r(a)]||(n[r(a)]=!0,e(a,i,l,n)):(n[r(a)]=!0,e(a,i,null,n))}}},plugins:{},highlightAll:function(e,t){s.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,i){var o={callback:i,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};s.hooks.run("before-highlightall",o),o.elements=Array.prototype.slice.apply(o.container.querySelectorAll(o.selector)),s.hooks.run("before-all-elements-highlight",o);for(var n,r=0;n=o.elements[r++];)s.highlightElement(n,!0===t,o.callback)},highlightElement:function(t,i,o){var n=s.util.getLanguage(t),r=s.languages[n];s.util.setLanguage(t,n);var l=t.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&s.util.setLanguage(l,n);var a=t.textContent,c={element:t,language:n,grammar:r,code:a};function h(e){c.highlightedCode=e,s.hooks.run("before-insert",c),c.element.innerHTML=c.highlightedCode,s.hooks.run("after-highlight",c),s.hooks.run("complete",c),o&&o.call(c.element)}if(s.hooks.run("before-sanity-check",c),(l=c.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!c.code){s.hooks.run("complete",c),o&&o.call(c.element);return}if(s.hooks.run("before-highlight",c),!c.grammar)return void h(s.util.encode(c.code));if(i&&e.Worker){var u=new Worker(s.filename);u.onmessage=function(e){h(e.data)},u.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else h(s.highlight(c.code,c.grammar,c.language))},highlight:function(e,t,i){var o={code:e,grammar:t,language:i};if(s.hooks.run("before-tokenize",o),!o.grammar)throw Error('The language "'+o.language+'" has no grammar.');return o.tokens=s.tokenize(o.code,o.grammar),s.hooks.run("after-tokenize",o),n.stringify(s.util.encode(o.tokens),o.language)},tokenize:function(e,t){var i=t.rest;if(i){for(var o in i)t[o]=i[o];delete t.rest}var c=new l;return a(c,c.head,e),function e(t,i,o,l,c,h){for(var u in o)if(o.hasOwnProperty(u)&&o[u]){var d=o[u];d=Array.isArray(d)?d:[d];for(var p=0;p<d.length;++p){if(h&&h.cause==u+","+p)return;var _=d[p],g=_.inside,E=!!_.lookbehind,T=!!_.greedy,m=_.alias;if(T&&!_.pattern.global){var f=_.pattern.toString().match(/[imsuy]*$/)[0];_.pattern=RegExp(_.pattern.source,f+"g")}for(var I=_.pattern||_,S=l.next,R=c;S!==i.tail&&(!h||!(R>=h.reach));R+=S.value.length,S=S.next){var b,C=S.value;if(i.length>t.length)return;if(!(C instanceof n)){var O=1;if(T){if(!(b=r(I,R,t,E))||b.index>=t.length)break;var A=b.index,$=b.index+b[0].length,N=R;for(N+=S.value.length;A>=N;)N+=(S=S.next).value.length;if(N-=S.value.length,R=N,S.value instanceof n)continue;for(var L=S;L!==i.tail&&(N<$||"string"==typeof L.value);L=L.next)O++,N+=L.value.length;O--,C=t.slice(R,N),b.index-=R}else if(!(b=r(I,0,C,E)))continue;var A=b.index,y=b[0],D=C.slice(0,A),k=C.slice(A+y.length),w=R+C.length;h&&w>h.reach&&(h.reach=w);var v=S.prev;if(D&&(v=a(i,v,D),R+=D.length),function(e,t,i){for(var o=t.next,s=0;s<i&&o!==e.tail;s++)o=o.next;t.next=o,o.prev=t,e.length-=s}(i,v,O),S=a(i,v,new n(u,g?s.tokenize(y,g):y,m,y)),k&&a(i,S,k),O>1){var M={cause:u+","+p,reach:w};e(t,i,o,S.prev,R,M),h&&M.reach>h.reach&&(h.reach=M.reach)}}}}}}(e,c,t,c.head,0),function(e){for(var t=[],i=e.head.next;i!==e.tail;)t.push(i.value),i=i.next;return t}(c)},hooks:{all:{},add:function(e,t){var i=s.hooks.all;i[e]=i[e]||[],i[e].push(t)},run:function(e,t){var i=s.hooks.all[e];if(i&&i.length)for(var o,n=0;o=i[n++];)o(t)}},Token:n};function n(e,t,i,o){this.type=e,this.content=t,this.alias=i,this.length=0|(o||"").length}function r(e,t,i,o){e.lastIndex=t;var s=e.exec(i);if(s&&o&&s[1]){var n=s[1].length;s.index+=n,s[0]=s[0].slice(n)}return s}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function a(e,t,i){var o=t.next,s={value:i,prev:t,next:o};return t.next=s,o.prev=s,e.length++,s}if(e.Prism=s,n.stringify=function e(t,i){if("string"==typeof t)return t;if(Array.isArray(t)){var o="";return t.forEach(function(t){o+=e(t,i)}),o}var n={type:t.type,content:e(t.content,i),tag:"span",classes:["token",t.type],attributes:{},language:i},r=t.alias;r&&(Array.isArray(r)?Array.prototype.push.apply(n.classes,r):n.classes.push(r)),s.hooks.run("wrap",n);var l="";for(var a in n.attributes)l+=" "+a+'="'+(n.attributes[a]||"").replace(/"/g,""")+'"';return"<"+n.tag+' class="'+n.classes.join(" ")+'"'+l+">"+n.content+"</"+n.tag+">"},!e.document)return e.addEventListener&&(s.disableWorkerMessageHandler||e.addEventListener("message",function(t){var i=JSON.parse(t.data),o=i.language,n=i.code,r=i.immediateClose;e.postMessage(s.highlight(n,s.languages[o],o)),r&&e.close()},!1)),s;var c=s.util.currentScript();function h(){s.manual||s.highlightAll()}if(c&&(s.filename=c.src,c.hasAttribute("data-manual")&&(s.manual=!0)),!s.manual){var u=document.readyState;"loading"===u||"interactive"===u&&c&&c.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return s}("u">typeof window?window:"u">typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});p&&(p=_),void 0!==r&&(r.Prism=_),_.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},_.languages.markup.tag.inside["attr-value"].inside.entity=_.languages.markup.entity,_.languages.markup.doctype.inside["internal-subset"].inside=_.languages.markup,_.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(_.languages.markup.tag,"addInlined",{value:function(e,t){var i={};i["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:_.languages[t]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var o={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};o["language-"+t]={pattern:/[\s\S]+/,inside:_.languages[t]};var s={};s[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:o},_.languages.insertBefore("markup","cdata",s)}}),Object.defineProperty(_.languages.markup.tag,"addAttribute",{value:function(e,t){_.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:_.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),_.languages.html=_.languages.markup,_.languages.mathml=_.languages.markup,_.languages.svg=_.languages.markup,_.languages.xml=_.languages.extend("markup",{}),_.languages.ssml=_.languages.xml,_.languages.atom=_.languages.xml,_.languages.rss=_.languages.xml,o=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,_.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+o.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+o.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+o.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+o.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:o,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},_.languages.css.atrule.inside.rest=_.languages.css,(s=_.languages.markup)&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css")),_.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},_.languages.javascript=_.languages.extend("clike",{"class-name":[_.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source)+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),_.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,_.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:_.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:_.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:_.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:_.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:_.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),_.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:_.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),_.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),_.languages.markup&&(_.languages.markup.tag.addInlined("script","javascript"),_.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),_.languages.js=_.languages.javascript,function(){if(void 0!==_&&"u">typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",i="loading",o="loaded",s="pre[data-src]:not(["+t+'="'+o+'"]):not(['+t+'="'+i+'"])';_.hooks.add("before-highlightall",function(e){e.selector+=", "+s}),_.hooks.add("before-sanity-check",function(n){var r=n.element;if(r.matches(s)){n.code="",r.setAttribute(t,i);var l,a,c,h,u=r.appendChild(document.createElement("CODE"));u.textContent="Loading…";var d=r.getAttribute("data-src"),p=n.language;if("none"===p){var g=(/\.(\w+)$/.exec(d)||[,"none"])[1];p=e[g]||g}_.util.setLanguage(u,p),_.util.setLanguage(r,p);var E=_.plugins.autoloader;E&&E.loadLanguages(p),l=d,a=function(e){r.setAttribute(t,o);var i=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var i=Number(t[1]),o=t[2],s=t[3];return o?s?[i,Number(s)]:[i,void 0]:[i,i]}}(r.getAttribute("data-range"));if(i){var s=e.split(/\r\n?|\n/g),n=i[0],l=null==i[1]?s.length:i[1];n<0&&(n+=s.length),n=Math.max(0,Math.min(n-1,s.length)),l<0&&(l+=s.length),l=Math.max(0,Math.min(l,s.length)),e=s.slice(n,l).join("\n"),r.hasAttribute("data-start")||r.setAttribute("data-start",String(n+1))}u.textContent=e,_.highlightElement(u)},c=function(e){r.setAttribute(t,"failed"),u.textContent=e},(h=new XMLHttpRequest).open("GET",l,!0),h.onreadystatechange=function(){var e;4==h.readyState&&(h.status<400&&h.responseText?a(h.responseText):h.status>=400?c((e=h.status,"✖ Error "+e+" while fetching file: "+h.statusText)):c("✖ Error: File does not exist or is empty"))},h.send(null)}}),_.plugins.fileHighlight={highlight:function(e){for(var t,i=(e||document).querySelectorAll(s),o=0;t=i[o++];)_.highlightElement(t)}};var n=!1;_.fileHighlight=function(){n||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),n=!0),_.plugins.fileHighlight.highlight.apply(this,arguments)}}}(),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python;var g={};n=function(e,t,i){return e.setLocale(t),e},"function"==typeof define&&define.amd?define(["blockly/core","blockly/msg/en","blockly/blocks"],n):g=n(h("ca2Ll"),h("cWmWX"),h("94GXq"));var E={};function T(e,t){let i=e.replace(/['"]/g,"");return`'${i}_${t}'`}E=h("eqdor"),h("eqdor"),window.Alpine=d.default;let m={blocks:{languageVersion:0,blocks:[]},variables:[]},f="mcEdWorkspaceAutosave";async function I(e){if(e){console.log(`Sending request to delete power: ${e}`);try{let t=await fetch(`/api/power/${e}`,{method:"DELETE"});if(t.ok)console.log("Delete request successful. The server will trigger a library refresh."),window.dispatchEvent(new CustomEvent("library-changed",{bubbles:!0}));else{let e=await t.text();console.error("Error deleting power:",t.status,e),alert(`Failed to delete power: ${e}`)}}catch(e){console.error("Network error while deleting power:",e),alert("Network error. Could not delete power.")}}}window.prepareAndOpenSaveModal=function(){let e="",i="",o="Workspaces",s=t.getTopBlocks(!1).find(e=>"procedures_defnoreturn"===e.type||"procedures_defreturn"===e.type);s&&(e=s.getFieldValue("NAME"),i=s.getCommentText()||"",o="Powers"),window.dispatchEvent(new CustomEvent("open-save-modal",{detail:{name:e,description:i,category:o}}))},window.handleDeletePower=I;var S={};async function R(){var i,o,s,n,r,a;let c,h,u;async function d(e,t){try{let i=await fetch("/api/ipython_magic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e,arguments:t})});if(!i.ok)throw Error(`HTTP error! status: ${i.status}`);let o=await i.json();if(o.error)return console.error("IPython Magic Error:",o.error),alert(`IPython Command Error: ${o.error}`),null;return console.log("IPython Magic Output:",o.output),o.output}catch(e){return console.error("Fetch error calling IPython API:",e),alert("Error communicating with IPython process."),null}}async function _(){if(!t)return void alert("Workspace is not ready yet.");if(window.showOpenFilePicker)try{let[e]=await window.showOpenFilePicker({types:[{description:"Blockly Workspace Files",accept:{"application/json":[".json"]}}],multiple:!1}),i=await e.getFile(),o=await i.text(),s=JSON.parse(o);t.clear(),g.serialization.workspaces.load(s,t),console.log(`Successfully loaded power from: ${i.name}`)}catch(e){"AbortError"===e.name?console.log("User cancelled the file open dialog."):(console.error("Error opening or loading file:",e),alert("An error occurred while trying to load the file."))}else{console.warn("File System Access API not supported. Using legacy file input.");let e=document.createElement("input");e.type="file",e.accept=".json,application/json",e.onchange=async e=>{let i=e.target.files[0];if(i)try{let e=await i.text(),o=JSON.parse(e);t.clear(),g.serialization.workspaces.load(o,t),console.log(`Successfully loaded power from: ${i.name}`)}catch(e){console.error("Error parsing or loading file:",e),alert("Error loading workspace: The selected file is not valid JSON.")}},e.click()}}function I(){if(t)try{let e=g.serialization.workspaces.save(t),i=JSON.stringify(e);localStorage.setItem(f,i),console.log("Workspace autosaved to localStorage.")}catch(e){console.error("Error during autosave:",e)}}function R(e,t=500){let i;return(...o)=>{clearTimeout(i),i=setTimeout(()=>{e.apply(this,o)},t)}}async function b(){console.log("Handling save power...");let i=document.getElementById("savePowerForm");if(!i)return;let o=Object.fromEntries(new FormData(i).entries());if(!o.name)return void alert("Please enter a name for your power.");let s=g.serialization.workspaces.save(t),n=[],r=null,l=null,a=[],c=t.getTopBlocks(!0),h=c.find(e=>"procedures_defnoreturn"===e.type||"procedures_defreturn"===e.type);if(h){r=h.getFieldValue("NAME"),console.log(`Found functional power definition: '${r}'.`);let t=E.pythonGenerator.nameDB_.getName(r,e.BlocklyNameTypes.PROCEDURE),i=h.getVars(),o=i.map(t=>E.pythonGenerator.nameDB_.getName(t,e.BlocklyNameTypes.VARIABLE)),s=E.pythonGenerator.statementToCode(h,"STACK")||E.pythonGenerator.INDENT+"pass\n";if("procedures_defreturn"===h.type){let e=E.pythonGenerator.valueToCode(h,"RETURN",E.pythonGenerator.ORDER_NONE)||"None";s+=E.pythonGenerator.INDENT+"return "+e+"\n"}for(let e of(l=`def ${t}(self, ${o.join(", ")}):
|
|
146
|
-
${s}`,h.getDescendants(!1)))if("procedures_callnoreturn"===e.type||"procedures_callreturn"===e.type){let t=e.getFieldValue("NAME");t&&t!==r&&!a.includes(t)&&a.push(t)}if(i.length>0){let e=c.find(e=>("procedures_callnoreturn"===e.type||"procedures_callreturn"===e.type)&&e.getFieldValue("NAME")===r);if(!e)return void alert(`Save Error: To save the function '${r}' as a reusable Power, you must place a "call ${r}" block on the workspace to define its parameter types.`);for(let t=0;t<i.length;t++){let o=i[t],s=null,l=e.getInput("ARG"+t);if(!l||!l.connection||!l.connection.targetBlock())return void alert(`Save Error for function '${r}': The parameter '${o}' must have a block connected to it to define its type.`);let a=l.connection.targetBlock().outputConnection;if(a&&a.getCheck()){let e=a.getCheck();e&&e.length>0&&(s=e[0])}if(!s)return void alert(`Save Error for function '${r}': Could not determine the type for parameter '${o}'. Please ensure the connected block has an output type.`);n.push({name:o,type:s,default:0})}}}else console.log("No function definition found. Saving as a 'Script Power'."),l=E.pythonGenerator.workspaceToCode(t),r=null,n=[],o.category&&""!==o.category.trim()||(o.category="Workspaces");let u={name:o.name,description:o.description,category:o.category||"Workspaces",power_id:o.power_id||null,function_name:r,parameters:n,blockly_json:s,python_code:l,dependencies:a};console.log("Sending final power data to server:",u);try{let e=await fetch("/api/powers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});e.ok?(alert(`Saved "${o.name}" successfully!`),document.getElementById("savePowerModal"),window.dispatchEvent(new CustomEvent("library-changed"))):alert(`Failed to save: ${await e.text()}`)}catch(e){console.error("Network error while saving:",e),alert("Network error. Could not save.")}}i=g,i.FieldMinecraftColour=class extends i.FieldDropdown{constructor(t,o){super(i.FieldMinecraftColour.menuGenerator,o);let s=t;e.Colours.find(e=>e.id===s)||(s=e.Colours.length>0?e.Colours[0].id:"WHITE"),this.setValue(s)}static menuGenerator(){return e.Colours.map(e=>[{src:"data:image/svg+xml;base64,"+btoa(`<svg xmlns="http://www.w3.org/2000/svg" width="76" height="16"><rect x="0" y="0" width="16" height="16" fill="${e.hex}" stroke="#888" stroke-width="1" rx="2" ry="2"></rect><text x="21" y="12" font-family="sans-serif" font-size="12px" fill="#000000" dominant-baseline="middle">${e.name}</text></svg>`),width:76,height:16,alt:e.name},e.id])}getText_(){let t=e.Colours.find(e=>e.id===this.getValue());return t?t.name:this.getValue()||""}initView(){super.initView()}setValue(e){let t=this.getValue();super.setValue(e),null!==e&&e!==t&&this.sourceBlock_&&this.sourceBlock_.rendered&&this.forceRerender()}static fromJson(t){let o=t.colour_id||(e.Colours.length>0?e.Colours[0].id:"WHITE");return new i.FieldMinecraftColour(o,null)}},i.fieldRegistry.register("field_minecraft_colour",i.FieldMinecraftColour),e={BlocklyUtils:{configureShadow:function(t,i){let s=e.Defaults.values[t.type]?.[i]?.shadow;s&&t.getInput(i).connection.setShadowDom(o.utils.xml.textToDom(s))}},BlocklyNameTypes:{PROCEDURE:(o=g).Names.NameType.PROCEDURE,VARIABLE:o.Names.NameType.VARIABLE},Defaults:{values:{}},Colours:[{name:"White",hex:"#FFFFFF",id:"WHITE"},{name:"Orange",hex:"#D87F33",id:"ORANGE"},{name:"Magenta",hex:"#B24CD8",id:"MAGENTA"},{name:"Light Blue",hex:"#6699D8",id:"LIGHT_BLUE"},{name:"Yellow",hex:"#E5E533",id:"YELLOW"},{name:"Lime",hex:"#7FCC19",id:"LIME"},{name:"Pink",hex:"#F27FA5",id:"PINK"},{name:"Gray",hex:"#4C4C4C",id:"GRAY"},{name:"Light Gray",hex:"#999999",id:"LIGHT_GRAY"},{name:"Cyan",hex:"#4C7F99",id:"CYAN"},{name:"Azure",hex:"#007FFF",id:"AZURE"},{name:"Purple",hex:"#7F3FB2",id:"PURPLE"},{name:"Blue",hex:"#334CB2",id:"BLUE"},{name:"Brown",hex:"#664C33",id:"BROWN"},{name:"Green",hex:"#667F33",id:"GREEN"},{name:"Red",hex:"#993333",id:"RED"},{name:"Black",hex:"#191919",id:"BLACK"},{name:"Tinted",hex:"#2A232B",id:"TINTED_GLASS_BLOCK"}]},(n=s=g).Blocks.dummy_block={init:function(){console.log("mc.mjs: Inside init() function of ...")}},n.Blocks.minecraft_coloured_block_picker={init:function(){this.appendDummyInput().appendField(new n.FieldMinecraftColour(e.Colours[0].id),"MINECRAFT_COLOUR_ID"),this.setOutput(!0,"MinecraftColour"),this.setColour("%{BKY_COLOUR_HUE}"),this.setTooltip("Select a Minecraft block colour.")}},n.Blocks.minecraft_matrix_3d_elements={init:function(){this.appendDummyInput().appendField("Rotation Matrix (Elements)"),this.appendValueInput("R00").setCheck("Number").setAlign("RIGHT").appendField("r00"),this.appendValueInput("R01").setCheck("Number").setAlign("RIGHT").appendField("r01"),this.appendValueInput("R02").setCheck("Number").setAlign("RIGHT").appendField("r02"),this.appendValueInput("R10").setCheck("Number").setAlign("RIGHT").appendField("r10"),this.appendValueInput("R11").setCheck("Number").setAlign("RIGHT").appendField("r11"),this.appendValueInput("R12").setCheck("Number").setAlign("RIGHT").appendField("r12"),this.appendValueInput("R20").setCheck("Number").setAlign("RIGHT").appendField("r20"),this.appendValueInput("R21").setCheck("Number").setAlign("RIGHT").appendField("r21"),this.appendValueInput("R22").setCheck("Number").setAlign("RIGHT").appendField("r22"),this.setOutput(!0,"3DMatrix"),this.setColour(210),this.setTooltip("Define a 3x3 rotation matrix by its elements."),this.setInputsInline(!1),e.Defaults.values.minecraft_matrix_3d_elements={},["R00","R01","R02","R10","R11","R12","R20","R21","R22"].forEach((t,i)=>{e.Defaults.values.minecraft_matrix_3d_elements[t]={shadow:`<shadow type="math_number"><field name="NUM">${+(i%4==0)}</field></shadow>`}}),e.BlocklyUtils.configureShadow(this,"R00"),e.BlocklyUtils.configureShadow(this,"R01"),e.BlocklyUtils.configureShadow(this,"R02"),e.BlocklyUtils.configureShadow(this,"R10"),e.BlocklyUtils.configureShadow(this,"R11"),e.BlocklyUtils.configureShadow(this,"R12"),e.BlocklyUtils.configureShadow(this,"R20"),e.BlocklyUtils.configureShadow(this,"R21"),e.BlocklyUtils.configureShadow(this,"R22")}},n.Blocks.minecraft_matrix_3d_euler={init:function(){this.appendDummyInput().appendField("Rotation Matrix (Euler Angles)"),this.appendValueInput("YAW").setCheck("Number").setAlign("RIGHT").appendField("Yaw (Z, degrees)"),this.appendValueInput("PITCH").setCheck("Number").setAlign("RIGHT").appendField("Pitch (Y, degrees)"),this.appendValueInput("ROLL").setCheck("Number").setAlign("RIGHT").appendField("Roll (X, degrees)"),this.setOutput(!0,"3DMatrix"),this.setColour(210),this.setTooltip("Define a 3x3 rotation matrix from Euler angles (yaw, pitch, roll)."),this.setInputsInline(!1),e.Defaults.values.minecraft_matrix_3d_euler={YAW:{shadow:'<shadow type="math_number"><field name="NUM">0</field></shadow>'},PITCH:{shadow:'<shadow type="math_number"><field name="NUM">0</field></shadow>'},ROLL:{shadow:'<shadow type="math_number"><field name="NUM">0</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"YAW"),e.BlocklyUtils.configureShadow(this,"PITCH"),e.BlocklyUtils.configureShadow(this,"ROLL")}},n.Blocks.minecraft_vector_3d={init:function(){this.appendValueInput("X").setCheck("Number").setAlign("RIGHT").appendField("Vec3 x"),this.appendValueInput("Y").setCheck("Number").setAlign("RIGHT").appendField("y"),this.appendValueInput("Z").setCheck("Number").setAlign("RIGHT").appendField("z"),this.setOutput(!0,"3DVector"),this.setColour(180),this.setTooltip("Creates a 3D vector from x, y, and z components. Accepts numbers or variables."),this.setInputsInline(!0)}},n.Blocks.minecraft_vector_delta={init:function(){this.isInFlyout?this.appendDummyInput().appendField("vector delta"):this.appendDummyInput().appendField("x:").appendField(new n.FieldNumber(1),"X").appendField("y:").appendField(new n.FieldNumber(0),"Y").appendField("z:").appendField(new n.FieldNumber(0),"Z"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_player={init:function(){this.appendDummyInput().appendField("player position"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_player_tile={init:function(){this.appendDummyInput().appendField("player tile position"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_here={init:function(){this.appendDummyInput().appendField("here"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_get_direction={init:function(){this.appendDummyInput().appendField("player direction"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_get_compass_direction={init:function(){this.appendDummyInput().appendField("player compass direction"),this.setOutput(!0,"String"),this.setColour(160),this.setTooltip("Returns the cardinal or intercardinal direction the player is facing (N, NE, E, SE, S, SW, W, NW).")}},n.Blocks.minecraft_vector_get_attribute={init:function(){this.appendDummyInput().appendField("get component").appendField(new n.FieldDropdown([["x","X"],["y","Y"],["z","Z"]]),"COMPONENT").appendField("of"),this.appendValueInput("VECTOR").setCheck("3DVector"),this.setOutput(!0,"Number"),this.setColour(180),this.setTooltip("Gets the x, y, or z component of a vector."),this.setInputsInline(!0)}},n.Blocks.minecraft_vector_binary_op={init:function(){this.appendValueInput("A").setCheck("3DVector"),this.appendDummyInput().appendField(new n.FieldDropdown([["+","ADD"],["-","SUBTRACT"],["× (cross product)","CROSS"]]),"OP"),this.appendValueInput("B").setCheck("3DVector"),this.setInputsInline(!0),this.setOutput(!0,"3DVector"),this.setColour(180),this.setTooltip("Performs vector addition, subtraction, or cross product."),e.Defaults.values.minecraft_vector_binary_op={A:{shadow:e.VECTOR_3D_SHADOW},B:{shadow:e.VECTOR_3D_SHADOW}},e.BlocklyUtils.configureShadow(this,"A"),e.BlocklyUtils.configureShadow(this,"B")}},n.Blocks.minecraft_vector_scalar_multiply={init:function(){this.appendValueInput("A").setCheck("3DVector"),this.appendDummyInput().appendField("×"),this.appendValueInput("B").setCheck("Number"),this.setInputsInline(!0),this.setOutput(!0,"3DVector"),this.setColour(180),this.setTooltip("Multiplies a vector by a scalar number."),e.Defaults.values.minecraft_vector_scalar_multiply={A:{shadow:e.VECTOR_3D_SHADOW},B:{shadow:'<shadow type="math_number"><field name="NUM">1</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"A"),e.BlocklyUtils.configureShadow(this,"B")}},n.Blocks.minecraft_vector_dot_product={init:function(){this.appendValueInput("A").setCheck("3DVector"),this.appendDummyInput().appendField("• (dot product)"),this.appendValueInput("B").setCheck("3DVector"),this.setInputsInline(!0),this.setOutput(!0,"Number"),this.setColour(210),this.setTooltip("Calculates the dot product of two vectors, returning a number."),e.Defaults.values.minecraft_vector_dot_product={A:{shadow:e.VECTOR_3D_SHADOW},B:{shadow:e.VECTOR_3D_SHADOW}},e.BlocklyUtils.configureShadow(this,"A"),e.BlocklyUtils.configureShadow(this,"B")}},n.Blocks.minecraft_matrix_vector_multiply={init:function(){this.appendValueInput("B").setCheck("3DVector").appendField("Rotate vector"),this.appendValueInput("A").setCheck("3DMatrix").appendField("by matrix"),this.setInputsInline(!0),this.setOutput(!0,"3DVector"),this.setColour(180),this.setTooltip("Rotates a vector by a transformation matrix."),e.Defaults.values.minecraft_matrix_vector_multiply={A:{shadow:'<shadow type="minecraft_matrix_3d_euler"></shadow>'},B:{shadow:e.VECTOR_3D_SHADOW}},e.BlocklyUtils.configureShadow(this,"A"),e.BlocklyUtils.configureShadow(this,"B")}},n.Blocks.time_sleep={init:function(){this.appendValueInput("SECONDS").setCheck("Number").appendField("wait for"),this.appendDummyInput().appendField("seconds"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(120),this.setTooltip("Pauses the program for a specified number of seconds."),this.setInputsInline(!0)}},s.Blocks.digital_geometry_create_digital_cube={init:function(){this.appendDummyInput().appendField("Create Digital Cube"),this.appendValueInput("CENTER").setCheck("3DVector").setAlign("RIGHT").appendField("Center"),this.appendValueInput("SIDE_LENGTH").setCheck("Number").setAlign("RIGHT").appendField("Side Length"),this.appendValueInput("BLOCK_TYPE").setCheck("String").setAlign("RIGHT").appendField("Block Type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Create Digital Cube' action."),this.setInputsInline(!1),this.getInput("CENTER").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
145
|
+
`)+"("+s+")",i.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).")},I.text_count=function(e,t){return[(t.valueToCode(e,"TEXT",i.MEMBER)||"''")+".count("+(e=t.valueToCode(e,"SUB",i.NONE)||"''")+")",i.FUNCTION_CALL]},I.text_getSubstring=function(e,t){var s=e.getFieldValue("WHERE1");let n=e.getFieldValue("WHERE2"),r=t.valueToCode(e,"STRING",i.MEMBER)||"''";switch(s){case"FROM_START":0===(s=t.getAdjustedInt(e,"AT1"))&&(s="");break;case"FROM_END":s=t.getAdjustedInt(e,"AT1",1,!0);break;case"FIRST":s="";break;default:throw Error("Unhandled option (text_getSubstring)")}switch(n){case"FROM_START":e=t.getAdjustedInt(e,"AT2",1);break;case"FROM_END":e=t.getAdjustedInt(e,"AT2",0,!0),o.isNumber$$module$build$src$core$utils$string(String(e))?0===e&&(e=""):(t.definitions_.import_sys="import sys",e+=" or sys.maxsize");break;case"LAST":e="";break;default:throw Error("Unhandled option (text_getSubstring)")}return[r+"["+s+" : "+e+"]",i.MEMBER]},I.text_indexOf=function(e,t){let o="FIRST"===e.getFieldValue("END")?"find":"rfind",s=t.valueToCode(e,"FIND",i.NONE)||"''";return t=(t.valueToCode(e,"VALUE",i.MEMBER)||"''")+"."+o+"("+s+")",e.workspace.options.oneBasedIndex?[t+" + 1",i.ADDITIVE]:[t,i.FUNCTION_CALL]},I.text_isEmpty=function(e,t){return["not len("+(t.valueToCode(e,"VALUE",i.NONE)||"''")+")",i.LOGICAL_NOT]},I.text_join=function(e,t){switch(e.itemCount_){case 0:return["''",i.ATOMIC];case 1:return f(e=t.valueToCode(e,"ADD0",i.NONE)||"''");case 2:var s=t.valueToCode(e,"ADD0",i.NONE)||"''";return e=t.valueToCode(e,"ADD1",i.NONE)||"''",[f(s)[0]+" + "+f(e)[0],i.ADDITIVE];default:s=[];for(let o=0;o<e.itemCount_;o++)s[o]=t.valueToCode(e,"ADD"+o,i.NONE)||"''";return["''.join([str("+(e=t.nameDB_.getDistinctName("x",o.NameType$$module$build$src$core$names.VARIABLE))+") for "+e+" in ["+s.join(", ")+"]])",i.FUNCTION_CALL]}},I.text_length=function(e,t){return["len("+(t.valueToCode(e,"VALUE",i.NONE)||"''")+")",i.FUNCTION_CALL]},I.text_print=function(e,t){return"print("+(t.valueToCode(e,"TEXT",i.NONE)||"''")+")\n"},I.text_prompt=a,I.text_prompt_ext=a,I.text_replace=function(e,t){return[(t.valueToCode(e,"TEXT",i.MEMBER)||"''")+".replace("+(t.valueToCode(e,"FROM",i.NONE)||"''")+", "+(e=t.valueToCode(e,"TO",i.NONE)||"''")+")",i.MEMBER]},I.text_reverse=function(e,t){return[(t.valueToCode(e,"TEXT",i.MEMBER)||"''")+"[::-1]",i.MEMBER]},I.text_trim=function(e,t){let o={LEFT:".lstrip()",RIGHT:".rstrip()",BOTH:".strip()"}[e.getFieldValue("MODE")];return[(t.valueToCode(e,"TEXT",i.MEMBER)||"''")+o,i.FUNCTION_CALL]};var S={};S.variables_get=c,S.variables_set=h;var R={};R.variables_get_dynamic=c,R.variables_set_dynamic=h;var b=new u;b.addReservedWords("math,random,Number");var C=Object.assign({},p,_,g,E,T,I,S,R);for(let e in C)b.forBlock[e]=C[e];var O={};return O.Order=i,O.PythonGenerator=u,O.pythonGenerator=b,O.__namespace__=o,O},"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],i):e.exports=i(h("97Mr6"))});var d=h("hKdZU");h("7nxqN"),h("7nxqN").default.defineExtension("json-enc",{init:function(e){i=e},onEvent:function(e,t){"htmx:configRequest"===e&&(t.detail.headers["Content-Type"]="application/json")},encodeParameters:function(e,t,o){e.overrideMimeType("text/json");let s={};t.forEach(function(e,t){Object.hasOwn(s,t)?(Array.isArray(s[t])||(s[t]=[s[t]]),s[t].push(e)):s[t]=e});let n=i.getExpressionVars(o);return Object.keys(s).forEach(function(e){s[e]=Object.hasOwn(n,e)?n[e]:s[e]}),JSON.stringify(s)}});var p={},_=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,o={},s={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof n?new n(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++i}),e.__id},clone:function e(t,i){var o,n;switch(i=i||{},s.util.type(t)){case"Object":if(i[n=s.util.objId(t)])return i[n];for(var r in o={},i[n]=o,t)t.hasOwnProperty(r)&&(o[r]=e(t[r],i));return o;case"Array":if(i[n=s.util.objId(t)])return i[n];return o=[],i[n]=o,t.forEach(function(t,s){o[s]=e(t,i)}),o;default:return t}},getLanguage:function(e){for(;e;){var i=t.exec(e.className);if(i)return i[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,i){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+i)},currentScript:function(){if("u"<typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName&&1)return document.currentScript;try{throw Error()}catch(o){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(o.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var i in t)if(t[i].src==e)return t[i]}return null}},isActive:function(e,t,i){for(var o="no-"+t;e;){var s=e.classList;if(s.contains(t))return!0;if(s.contains(o))return!1;e=e.parentElement}return!!i}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(e,t){var i=s.util.clone(s.languages[e]);for(var o in t)i[o]=t[o];return i},insertBefore:function(e,t,i,o){var n=(o=o||s.languages)[e],r={};for(var l in n)if(n.hasOwnProperty(l)){if(l==t)for(var a in i)i.hasOwnProperty(a)&&(r[a]=i[a]);i.hasOwnProperty(l)||(r[l]=n[l])}var c=o[e];return o[e]=r,s.languages.DFS(s.languages,function(t,i){i===c&&t!=e&&(this[t]=r)}),r},DFS:function e(t,i,o,n){n=n||{};var r=s.util.objId;for(var l in t)if(t.hasOwnProperty(l)){i.call(t,l,t[l],o||l);var a=t[l],c=s.util.type(a);"Object"!==c||n[r(a)]?"Array"!==c||n[r(a)]||(n[r(a)]=!0,e(a,i,l,n)):(n[r(a)]=!0,e(a,i,null,n))}}},plugins:{},highlightAll:function(e,t){s.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,i){var o={callback:i,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};s.hooks.run("before-highlightall",o),o.elements=Array.prototype.slice.apply(o.container.querySelectorAll(o.selector)),s.hooks.run("before-all-elements-highlight",o);for(var n,r=0;n=o.elements[r++];)s.highlightElement(n,!0===t,o.callback)},highlightElement:function(t,i,o){var n=s.util.getLanguage(t),r=s.languages[n];s.util.setLanguage(t,n);var l=t.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&s.util.setLanguage(l,n);var a=t.textContent,c={element:t,language:n,grammar:r,code:a};function h(e){c.highlightedCode=e,s.hooks.run("before-insert",c),c.element.innerHTML=c.highlightedCode,s.hooks.run("after-highlight",c),s.hooks.run("complete",c),o&&o.call(c.element)}if(s.hooks.run("before-sanity-check",c),(l=c.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!c.code){s.hooks.run("complete",c),o&&o.call(c.element);return}if(s.hooks.run("before-highlight",c),!c.grammar)return void h(s.util.encode(c.code));if(i&&e.Worker){var u=new Worker(s.filename);u.onmessage=function(e){h(e.data)},u.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else h(s.highlight(c.code,c.grammar,c.language))},highlight:function(e,t,i){var o={code:e,grammar:t,language:i};if(s.hooks.run("before-tokenize",o),!o.grammar)throw Error('The language "'+o.language+'" has no grammar.');return o.tokens=s.tokenize(o.code,o.grammar),s.hooks.run("after-tokenize",o),n.stringify(s.util.encode(o.tokens),o.language)},tokenize:function(e,t){var i=t.rest;if(i){for(var o in i)t[o]=i[o];delete t.rest}var c=new l;return a(c,c.head,e),function e(t,i,o,l,c,h){for(var u in o)if(o.hasOwnProperty(u)&&o[u]){var d=o[u];d=Array.isArray(d)?d:[d];for(var p=0;p<d.length;++p){if(h&&h.cause==u+","+p)return;var _=d[p],g=_.inside,E=!!_.lookbehind,T=!!_.greedy,m=_.alias;if(T&&!_.pattern.global){var f=_.pattern.toString().match(/[imsuy]*$/)[0];_.pattern=RegExp(_.pattern.source,f+"g")}for(var I=_.pattern||_,S=l.next,R=c;S!==i.tail&&(!h||!(R>=h.reach));R+=S.value.length,S=S.next){var b,C=S.value;if(i.length>t.length)return;if(!(C instanceof n)){var O=1;if(T){if(!(b=r(I,R,t,E))||b.index>=t.length)break;var A=b.index,$=b.index+b[0].length,N=R;for(N+=S.value.length;A>=N;)N+=(S=S.next).value.length;if(N-=S.value.length,R=N,S.value instanceof n)continue;for(var L=S;L!==i.tail&&(N<$||"string"==typeof L.value);L=L.next)O++,N+=L.value.length;O--,C=t.slice(R,N),b.index-=R}else if(!(b=r(I,0,C,E)))continue;var A=b.index,y=b[0],D=C.slice(0,A),k=C.slice(A+y.length),w=R+C.length;h&&w>h.reach&&(h.reach=w);var M=S.prev;if(D&&(M=a(i,M,D),R+=D.length),function(e,t,i){for(var o=t.next,s=0;s<i&&o!==e.tail;s++)o=o.next;t.next=o,o.prev=t,e.length-=s}(i,M,O),S=a(i,M,new n(u,g?s.tokenize(y,g):y,m,y)),k&&a(i,S,k),O>1){var v={cause:u+","+p,reach:w};e(t,i,o,S.prev,R,v),h&&v.reach>h.reach&&(h.reach=v.reach)}}}}}}(e,c,t,c.head,0),function(e){for(var t=[],i=e.head.next;i!==e.tail;)t.push(i.value),i=i.next;return t}(c)},hooks:{all:{},add:function(e,t){var i=s.hooks.all;i[e]=i[e]||[],i[e].push(t)},run:function(e,t){var i=s.hooks.all[e];if(i&&i.length)for(var o,n=0;o=i[n++];)o(t)}},Token:n};function n(e,t,i,o){this.type=e,this.content=t,this.alias=i,this.length=0|(o||"").length}function r(e,t,i,o){e.lastIndex=t;var s=e.exec(i);if(s&&o&&s[1]){var n=s[1].length;s.index+=n,s[0]=s[0].slice(n)}return s}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function a(e,t,i){var o=t.next,s={value:i,prev:t,next:o};return t.next=s,o.prev=s,e.length++,s}if(e.Prism=s,n.stringify=function e(t,i){if("string"==typeof t)return t;if(Array.isArray(t)){var o="";return t.forEach(function(t){o+=e(t,i)}),o}var n={type:t.type,content:e(t.content,i),tag:"span",classes:["token",t.type],attributes:{},language:i},r=t.alias;r&&(Array.isArray(r)?Array.prototype.push.apply(n.classes,r):n.classes.push(r)),s.hooks.run("wrap",n);var l="";for(var a in n.attributes)l+=" "+a+'="'+(n.attributes[a]||"").replace(/"/g,""")+'"';return"<"+n.tag+' class="'+n.classes.join(" ")+'"'+l+">"+n.content+"</"+n.tag+">"},!e.document)return e.addEventListener&&(s.disableWorkerMessageHandler||e.addEventListener("message",function(t){var i=JSON.parse(t.data),o=i.language,n=i.code,r=i.immediateClose;e.postMessage(s.highlight(n,s.languages[o],o)),r&&e.close()},!1)),s;var c=s.util.currentScript();function h(){s.manual||s.highlightAll()}if(c&&(s.filename=c.src,c.hasAttribute("data-manual")&&(s.manual=!0)),!s.manual){var u=document.readyState;"loading"===u||"interactive"===u&&c&&c.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return s}("u">typeof window?window:"u">typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});p&&(p=_),void 0!==r&&(r.Prism=_),_.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},_.languages.markup.tag.inside["attr-value"].inside.entity=_.languages.markup.entity,_.languages.markup.doctype.inside["internal-subset"].inside=_.languages.markup,_.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(_.languages.markup.tag,"addInlined",{value:function(e,t){var i={};i["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:_.languages[t]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var o={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};o["language-"+t]={pattern:/[\s\S]+/,inside:_.languages[t]};var s={};s[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:o},_.languages.insertBefore("markup","cdata",s)}}),Object.defineProperty(_.languages.markup.tag,"addAttribute",{value:function(e,t){_.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:_.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),_.languages.html=_.languages.markup,_.languages.mathml=_.languages.markup,_.languages.svg=_.languages.markup,_.languages.xml=_.languages.extend("markup",{}),_.languages.ssml=_.languages.xml,_.languages.atom=_.languages.xml,_.languages.rss=_.languages.xml,o=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,_.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+o.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+o.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+o.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+o.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:o,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},_.languages.css.atrule.inside.rest=_.languages.css,(s=_.languages.markup)&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css")),_.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},_.languages.javascript=_.languages.extend("clike",{"class-name":[_.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source)+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),_.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,_.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:_.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:_.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:_.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:_.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:_.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),_.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:_.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),_.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),_.languages.markup&&(_.languages.markup.tag.addInlined("script","javascript"),_.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),_.languages.js=_.languages.javascript,function(){if(void 0!==_&&"u">typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",i="loading",o="loaded",s="pre[data-src]:not(["+t+'="'+o+'"]):not(['+t+'="'+i+'"])';_.hooks.add("before-highlightall",function(e){e.selector+=", "+s}),_.hooks.add("before-sanity-check",function(n){var r=n.element;if(r.matches(s)){n.code="",r.setAttribute(t,i);var l,a,c,h,u=r.appendChild(document.createElement("CODE"));u.textContent="Loading…";var d=r.getAttribute("data-src"),p=n.language;if("none"===p){var g=(/\.(\w+)$/.exec(d)||[,"none"])[1];p=e[g]||g}_.util.setLanguage(u,p),_.util.setLanguage(r,p);var E=_.plugins.autoloader;E&&E.loadLanguages(p),l=d,a=function(e){r.setAttribute(t,o);var i=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var i=Number(t[1]),o=t[2],s=t[3];return o?s?[i,Number(s)]:[i,void 0]:[i,i]}}(r.getAttribute("data-range"));if(i){var s=e.split(/\r\n?|\n/g),n=i[0],l=null==i[1]?s.length:i[1];n<0&&(n+=s.length),n=Math.max(0,Math.min(n-1,s.length)),l<0&&(l+=s.length),l=Math.max(0,Math.min(l,s.length)),e=s.slice(n,l).join("\n"),r.hasAttribute("data-start")||r.setAttribute("data-start",String(n+1))}u.textContent=e,_.highlightElement(u)},c=function(e){r.setAttribute(t,"failed"),u.textContent=e},(h=new XMLHttpRequest).open("GET",l,!0),h.onreadystatechange=function(){var e;4==h.readyState&&(h.status<400&&h.responseText?a(h.responseText):h.status>=400?c((e=h.status,"✖ Error "+e+" while fetching file: "+h.statusText)):c("✖ Error: File does not exist or is empty"))},h.send(null)}}),_.plugins.fileHighlight={highlight:function(e){for(var t,i=(e||document).querySelectorAll(s),o=0;t=i[o++];)_.highlightElement(t)}};var n=!1;_.fileHighlight=function(){n||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),n=!0),_.plugins.fileHighlight.highlight.apply(this,arguments)}}}(),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python;var g={};n=function(e,t,i){return e.setLocale(t),e},"function"==typeof define&&define.amd?define(["blockly/core","blockly/msg/en","blockly/blocks"],n):g=n(h("ca2Ll"),h("cWmWX"),h("94GXq"));var E={};function T(e,t){let i=e.replace(/['"]/g,"");return`'${i}_${t}'`}E=h("eqdor"),h("eqdor"),window.Alpine=d.default;let m={blocks:{languageVersion:0,blocks:[]},variables:[]},f="mcEdWorkspaceAutosave";async function I(e){if(e){console.log(`Sending request to delete power: ${e}`);try{let t=await fetch(`/api/power/${e}`,{method:"DELETE"});if(t.ok)console.log("Delete request successful. The server will trigger a library refresh."),window.dispatchEvent(new CustomEvent("library-changed",{bubbles:!0}));else{let e=await t.text();console.error("Error deleting power:",t.status,e),alert(`Failed to delete power: ${e}`)}}catch(e){console.error("Network error while deleting power:",e),alert("Network error. Could not delete power.")}}}window.prepareAndOpenSaveModal=function(){let e="",i="",o="Workspaces",s=t.getTopBlocks(!1).find(e=>"procedures_defnoreturn"===e.type||"procedures_defreturn"===e.type);s&&(e=s.getFieldValue("NAME"),i=s.getCommentText()||"",o="Powers"),window.dispatchEvent(new CustomEvent("open-save-modal",{detail:{name:e,description:i,category:o}}))},window.handleDeletePower=I;var S={};async function R(){var i,o,s,n,r,a;let c,h,u;async function d(e,t){try{let i=await fetch("/api/ipython_magic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e,arguments:t})});if(!i.ok)throw Error(`HTTP error! status: ${i.status}`);let o=await i.json();if(o.error)return console.error("IPython Magic Error:",o.error),alert(`IPython Command Error: ${o.error}`),null;return console.log("IPython Magic Output:",o.output),o.output}catch(e){return console.error("Fetch error calling IPython API:",e),alert("Error communicating with IPython process."),null}}async function _(){if(!t)return void alert("Workspace is not ready yet.");if(window.showOpenFilePicker)try{let[e]=await window.showOpenFilePicker({types:[{description:"Blockly Workspace Files",accept:{"application/json":[".json"]}}],multiple:!1}),i=await e.getFile(),o=await i.text(),s=JSON.parse(o);t.clear(),g.serialization.workspaces.load(s,t),console.log(`Successfully loaded power from: ${i.name}`)}catch(e){"AbortError"===e.name?console.log("User cancelled the file open dialog."):(console.error("Error opening or loading file:",e),alert("An error occurred while trying to load the file."))}else{console.warn("File System Access API not supported. Using legacy file input.");let e=document.createElement("input");e.type="file",e.accept=".json,application/json",e.onchange=async e=>{let i=e.target.files[0];if(i)try{let e=await i.text(),o=JSON.parse(e);t.clear(),g.serialization.workspaces.load(o,t),console.log(`Successfully loaded power from: ${i.name}`)}catch(e){console.error("Error parsing or loading file:",e),alert("Error loading workspace: The selected file is not valid JSON.")}},e.click()}}function I(){if(t)try{let e=g.serialization.workspaces.save(t),i=JSON.stringify(e);localStorage.setItem(f,i),console.log("Workspace autosaved to localStorage.")}catch(e){console.error("Error during autosave:",e)}}function R(e,t=500){let i;return(...o)=>{clearTimeout(i),i=setTimeout(()=>{e.apply(this,o)},t)}}async function b(){console.log("Handling save power...");let i=document.getElementById("savePowerForm");if(!i)return;let o=Object.fromEntries(new FormData(i).entries());if(!o.name)return void alert("Please enter a name for your power.");let s=g.serialization.workspaces.save(t),n=[],r=null,l=null,a=[],c=t.getTopBlocks(!0),h=c.find(e=>"procedures_defnoreturn"===e.type||"procedures_defreturn"===e.type);if(h){r=h.getFieldValue("NAME"),console.log(`Found functional power definition: '${r}'.`);let t=E.pythonGenerator.nameDB_.getName(r,e.BlocklyNameTypes.PROCEDURE),i=h.getVars(),o=i.map(t=>E.pythonGenerator.nameDB_.getName(t,e.BlocklyNameTypes.VARIABLE)),s=E.pythonGenerator.statementToCode(h,"STACK")||E.pythonGenerator.INDENT+"pass\n";if("procedures_defreturn"===h.type){let e=E.pythonGenerator.valueToCode(h,"RETURN",E.pythonGenerator.ORDER_NONE)||"None";s+=E.pythonGenerator.INDENT+"return "+e+"\n"}for(let e of(l=`def ${t}(self, ${o.join(", ")}):
|
|
146
|
+
${s}`,h.getDescendants(!1)))if("procedures_callnoreturn"===e.type||"procedures_callreturn"===e.type){let t=e.getFieldValue("NAME");t&&t!==r&&!a.includes(t)&&a.push(t)}if(i.length>0){let e=c.find(e=>("procedures_callnoreturn"===e.type||"procedures_callreturn"===e.type)&&e.getFieldValue("NAME")===r);if(!e)return void alert(`Save Error: To save the function '${r}' as a reusable Power, you must place a "call ${r}" block on the workspace to define its parameter types.`);for(let t=0;t<i.length;t++){let o=i[t],s=null,l=e.getInput("ARG"+t);if(!l||!l.connection||!l.connection.targetBlock())return void alert(`Save Error for function '${r}': The parameter '${o}' must have a block connected to it to define its type.`);let a=l.connection.targetBlock().outputConnection;if(a&&a.getCheck()){let e=a.getCheck();e&&e.length>0&&(s=e[0])}if(!s)return void alert(`Save Error for function '${r}': Could not determine the type for parameter '${o}'. Please ensure the connected block has an output type.`);n.push({name:o,type:s,default:0})}}}else console.log("No function definition found. Saving as a 'Script Power'."),l=E.pythonGenerator.workspaceToCode(t),r=null,n=[],o.category&&""!==o.category.trim()||(o.category="Workspaces");let u={name:o.name,description:o.description,category:o.category||"Workspaces",power_id:o.power_id||null,function_name:r,parameters:n,blockly_json:s,python_code:l,dependencies:a};console.log("Sending final power data to server:",u);try{let e=await fetch("/api/powers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});e.ok?(alert(`Saved "${o.name}" successfully!`),document.getElementById("savePowerModal"),window.dispatchEvent(new CustomEvent("library-changed"))):alert(`Failed to save: ${await e.text()}`)}catch(e){console.error("Network error while saving:",e),alert("Network error. Could not save.")}}i=g,i.FieldMinecraftColour=class extends i.FieldDropdown{constructor(t,o){super(i.FieldMinecraftColour.menuGenerator,o);let s=t;e.Colours.find(e=>e.id===s)||(s=e.Colours.length>0?e.Colours[0].id:"WHITE"),this.setValue(s)}static menuGenerator(){return e.Colours.map(e=>[{src:"data:image/svg+xml;base64,"+btoa(`<svg xmlns="http://www.w3.org/2000/svg" width="76" height="16"><rect x="0" y="0" width="16" height="16" fill="${e.hex}" stroke="#888" stroke-width="1" rx="2" ry="2"></rect><text x="21" y="12" font-family="sans-serif" font-size="12px" fill="#000000" dominant-baseline="middle">${e.name}</text></svg>`),width:76,height:16,alt:e.name},e.id])}getText_(){let t=e.Colours.find(e=>e.id===this.getValue());return t?t.name:this.getValue()||""}initView(){super.initView()}setValue(e){let t=this.getValue();super.setValue(e),null!==e&&e!==t&&this.sourceBlock_&&this.sourceBlock_.rendered&&this.forceRerender()}static fromJson(t){let o=t.colour_id||(e.Colours.length>0?e.Colours[0].id:"WHITE");return new i.FieldMinecraftColour(o,null)}},i.fieldRegistry.register("field_minecraft_colour",i.FieldMinecraftColour),e={BlocklyUtils:{configureShadow:function(t,i){let s=e.Defaults.values[t.type]?.[i]?.shadow;s&&t.getInput(i).connection.setShadowDom(o.utils.xml.textToDom(s))}},BlocklyNameTypes:{PROCEDURE:(o=g).Names.NameType.PROCEDURE,VARIABLE:o.Names.NameType.VARIABLE},Defaults:{values:{}},Colours:[{name:"White",hex:"#FFFFFF",id:"WHITE"},{name:"Orange",hex:"#D87F33",id:"ORANGE"},{name:"Magenta",hex:"#B24CD8",id:"MAGENTA"},{name:"Light Blue",hex:"#6699D8",id:"LIGHT_BLUE"},{name:"Yellow",hex:"#E5E533",id:"YELLOW"},{name:"Lime",hex:"#7FCC19",id:"LIME"},{name:"Pink",hex:"#F27FA5",id:"PINK"},{name:"Gray",hex:"#4C4C4C",id:"GRAY"},{name:"Light Gray",hex:"#999999",id:"LIGHT_GRAY"},{name:"Cyan",hex:"#4C7F99",id:"CYAN"},{name:"Azure",hex:"#007FFF",id:"AZURE"},{name:"Purple",hex:"#7F3FB2",id:"PURPLE"},{name:"Blue",hex:"#334CB2",id:"BLUE"},{name:"Brown",hex:"#664C33",id:"BROWN"},{name:"Green",hex:"#667F33",id:"GREEN"},{name:"Red",hex:"#993333",id:"RED"},{name:"Black",hex:"#191919",id:"BLACK"},{name:"Tinted",hex:"#2A232B",id:"TINTED_GLASS_BLOCK"}]},(n=s=g).Blocks.dummy_block={init:function(){console.log("mc.mjs: Inside init() function of ...")}},n.Blocks.minecraft_coloured_block_picker={init:function(){this.appendDummyInput().appendField(new n.FieldMinecraftColour(e.Colours[0].id),"MINECRAFT_COLOUR_ID"),this.setOutput(!0,"MinecraftColour"),this.setColour("%{BKY_COLOUR_HUE}"),this.setTooltip("Select a Minecraft block colour.")}},n.Blocks.minecraft_matrix_3d_elements={init:function(){this.appendDummyInput().appendField("Rotation Matrix (Elements)"),this.appendValueInput("R00").setCheck("Number").setAlign("RIGHT").appendField("r00"),this.appendValueInput("R01").setCheck("Number").setAlign("RIGHT").appendField("r01"),this.appendValueInput("R02").setCheck("Number").setAlign("RIGHT").appendField("r02"),this.appendValueInput("R10").setCheck("Number").setAlign("RIGHT").appendField("r10"),this.appendValueInput("R11").setCheck("Number").setAlign("RIGHT").appendField("r11"),this.appendValueInput("R12").setCheck("Number").setAlign("RIGHT").appendField("r12"),this.appendValueInput("R20").setCheck("Number").setAlign("RIGHT").appendField("r20"),this.appendValueInput("R21").setCheck("Number").setAlign("RIGHT").appendField("r21"),this.appendValueInput("R22").setCheck("Number").setAlign("RIGHT").appendField("r22"),this.setOutput(!0,"3DMatrix"),this.setColour(210),this.setTooltip("Define a 3x3 rotation matrix by its elements."),this.setInputsInline(!1),e.Defaults.values.minecraft_matrix_3d_elements={},["R00","R01","R02","R10","R11","R12","R20","R21","R22"].forEach((t,i)=>{e.Defaults.values.minecraft_matrix_3d_elements[t]={shadow:`<shadow type="math_number"><field name="NUM">${+(i%4==0)}</field></shadow>`}}),e.BlocklyUtils.configureShadow(this,"R00"),e.BlocklyUtils.configureShadow(this,"R01"),e.BlocklyUtils.configureShadow(this,"R02"),e.BlocklyUtils.configureShadow(this,"R10"),e.BlocklyUtils.configureShadow(this,"R11"),e.BlocklyUtils.configureShadow(this,"R12"),e.BlocklyUtils.configureShadow(this,"R20"),e.BlocklyUtils.configureShadow(this,"R21"),e.BlocklyUtils.configureShadow(this,"R22")}},n.Blocks.minecraft_matrix_3d_euler={init:function(){this.appendDummyInput().appendField("Rotation Matrix (Euler Angles)"),this.appendValueInput("YAW").setCheck("Number").setAlign("RIGHT").appendField("Yaw (Z, degrees)"),this.appendValueInput("PITCH").setCheck("Number").setAlign("RIGHT").appendField("Pitch (Y, degrees)"),this.appendValueInput("ROLL").setCheck("Number").setAlign("RIGHT").appendField("Roll (X, degrees)"),this.setOutput(!0,"3DMatrix"),this.setColour(210),this.setTooltip("Define a 3x3 rotation matrix from Euler angles (yaw, pitch, roll)."),this.setInputsInline(!1),e.Defaults.values.minecraft_matrix_3d_euler={YAW:{shadow:'<shadow type="math_number"><field name="NUM">0</field></shadow>'},PITCH:{shadow:'<shadow type="math_number"><field name="NUM">0</field></shadow>'},ROLL:{shadow:'<shadow type="math_number"><field name="NUM">0</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"YAW"),e.BlocklyUtils.configureShadow(this,"PITCH"),e.BlocklyUtils.configureShadow(this,"ROLL")}},n.Blocks.minecraft_vector_3d={init:function(){this.appendValueInput("X").setCheck("Number").setAlign("RIGHT").appendField("Vec3 x"),this.appendValueInput("Y").setCheck("Number").setAlign("RIGHT").appendField("y"),this.appendValueInput("Z").setCheck("Number").setAlign("RIGHT").appendField("z"),this.setOutput(!0,"3DVector"),this.setColour(180),this.setTooltip("Creates a 3D vector from x, y, and z components. Accepts numbers or variables."),this.setInputsInline(!0)}},n.Blocks.minecraft_vector_delta={init:function(){this.isInFlyout?this.appendDummyInput().appendField("vector delta"):this.appendDummyInput().appendField("x:").appendField(new n.FieldNumber(1),"X").appendField("y:").appendField(new n.FieldNumber(0),"Y").appendField("z:").appendField(new n.FieldNumber(0),"Z"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_player={init:function(){this.appendDummyInput().appendField("player position"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_player_tile={init:function(){this.appendDummyInput().appendField("player tile position"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_here={init:function(){this.appendDummyInput().appendField("here"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_get_direction={init:function(){this.appendDummyInput().appendField("player direction"),this.setOutput(!0,"3DVector"),this.setColour(160)}},n.Blocks.minecraft_position_get_compass_direction={init:function(){this.appendDummyInput().appendField("player compass direction"),this.setOutput(!0,"String"),this.setColour(160),this.setTooltip("Returns the cardinal or intercardinal direction the player is facing (N, NE, E, SE, S, SW, W, NW).")}},n.Blocks.minecraft_vector_get_attribute={init:function(){this.appendDummyInput().appendField("get component").appendField(new n.FieldDropdown([["x","X"],["y","Y"],["z","Z"]]),"COMPONENT").appendField("of"),this.appendValueInput("VECTOR").setCheck("3DVector"),this.setOutput(!0,"Number"),this.setColour(180),this.setTooltip("Gets the x, y, or z component of a vector."),this.setInputsInline(!0)}},n.Blocks.minecraft_vector_binary_op={init:function(){this.appendValueInput("A").setCheck("3DVector"),this.appendDummyInput().appendField(new n.FieldDropdown([["+","ADD"],["-","SUBTRACT"],["× (cross product)","CROSS"]]),"OP"),this.appendValueInput("B").setCheck("3DVector"),this.setInputsInline(!0),this.setOutput(!0,"3DVector"),this.setColour(180),this.setTooltip("Performs vector addition, subtraction, or cross product."),e.Defaults.values.minecraft_vector_binary_op={A:{shadow:e.VECTOR_3D_SHADOW},B:{shadow:e.VECTOR_3D_SHADOW}},e.BlocklyUtils.configureShadow(this,"A"),e.BlocklyUtils.configureShadow(this,"B")}},n.Blocks.minecraft_vector_scalar_multiply={init:function(){this.appendValueInput("A").setCheck("3DVector"),this.appendDummyInput().appendField("×"),this.appendValueInput("B").setCheck("Number"),this.setInputsInline(!0),this.setOutput(!0,"3DVector"),this.setColour(180),this.setTooltip("Multiplies a vector by a scalar number."),e.Defaults.values.minecraft_vector_scalar_multiply={A:{shadow:e.VECTOR_3D_SHADOW},B:{shadow:'<shadow type="math_number"><field name="NUM">1</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"A"),e.BlocklyUtils.configureShadow(this,"B")}},n.Blocks.minecraft_vector_dot_product={init:function(){this.appendValueInput("A").setCheck("3DVector"),this.appendDummyInput().appendField("• (dot product)"),this.appendValueInput("B").setCheck("3DVector"),this.setInputsInline(!0),this.setOutput(!0,"Number"),this.setColour(210),this.setTooltip("Calculates the dot product of two vectors, returning a number."),e.Defaults.values.minecraft_vector_dot_product={A:{shadow:e.VECTOR_3D_SHADOW},B:{shadow:e.VECTOR_3D_SHADOW}},e.BlocklyUtils.configureShadow(this,"A"),e.BlocklyUtils.configureShadow(this,"B")}},n.Blocks.minecraft_matrix_vector_multiply={init:function(){this.appendValueInput("B").setCheck("3DVector").appendField("Rotate vector"),this.appendValueInput("A").setCheck("3DMatrix").appendField("by matrix"),this.setInputsInline(!0),this.setOutput(!0,"3DVector"),this.setColour(180),this.setTooltip("Rotates a vector by a transformation matrix."),e.Defaults.values.minecraft_matrix_vector_multiply={A:{shadow:'<shadow type="minecraft_matrix_3d_euler"></shadow>'},B:{shadow:e.VECTOR_3D_SHADOW}},e.BlocklyUtils.configureShadow(this,"A"),e.BlocklyUtils.configureShadow(this,"B")}},n.Blocks.time_sleep={init:function(){this.appendValueInput("SECONDS").setCheck("Number").appendField("wait for"),this.appendDummyInput().appendField("seconds"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(120),this.setTooltip("Pauses the program for a specified number of seconds."),this.setInputsInline(!0)}},s.Blocks.digital_geometry_create_digital_cube={init:function(){this.appendDummyInput().appendField("Create Digital Cube"),this.appendValueInput("CENTER").setCheck("3DVector").setAlign("RIGHT").appendField("Center"),this.appendValueInput("SIDE_LENGTH").setCheck("Number").setAlign("RIGHT").appendField("Side Length"),this.appendValueInput("BLOCK_TYPE").setCheck("Block").setAlign("RIGHT").appendField("Block Type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Create Digital Cube' action."),this.setInputsInline(!1),this.getInput("CENTER").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
147
147
|
<shadow type="minecraft_vector_3d">
|
|
148
148
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
149
149
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
150
150
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
151
151
|
</shadow>
|
|
152
|
-
`)),this.getInput("SIDE_LENGTH").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>')),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(
|
|
152
|
+
`)),this.getInput("SIDE_LENGTH").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>')),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
153
|
+
<shadow type="minecraft_picker_world">
|
|
154
|
+
<field name="MATERIAL_ID">STONE</field>
|
|
155
|
+
</shadow>
|
|
156
|
+
`))}},s.Blocks.digital_geometry_create_digital_disc={init:function(){this.appendDummyInput().appendField("Create Digital Disc"),this.appendValueInput("CENTER").setCheck("3DVector").setAlign("RIGHT").appendField("Center"),this.appendValueInput("RADIUS").setCheck("Number").setAlign("RIGHT").appendField("Radius"),this.appendValueInput("NORMAL").setCheck("3DVector").setAlign("RIGHT").appendField("Normal"),this.appendValueInput("BLOCK_TYPE").setCheck("Block").setAlign("RIGHT").appendField("Block Type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Create Digital Disc' action."),this.setInputsInline(!1),this.getInput("CENTER").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
153
157
|
<shadow type="minecraft_vector_3d">
|
|
154
158
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
155
159
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
@@ -161,7 +165,11 @@ ${s}`,h.getDescendants(!1)))if("procedures_callnoreturn"===e.type||"procedures_c
|
|
|
161
165
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
162
166
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
163
167
|
</shadow>
|
|
164
|
-
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(
|
|
168
|
+
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
169
|
+
<shadow type="minecraft_picker_world">
|
|
170
|
+
<field name="MATERIAL_ID">STONE</field>
|
|
171
|
+
</shadow>
|
|
172
|
+
`))}},s.Blocks.digital_geometry_create_digital_line={init:function(){this.appendDummyInput().appendField("Create Digital Line"),this.appendValueInput("POINT1").setCheck("3DVector").setAlign("RIGHT").appendField("Start Point"),this.appendValueInput("POINT2").setCheck("3DVector").setAlign("RIGHT").appendField("End Point"),this.appendValueInput("BLOCK_TYPE").setCheck("Block").setAlign("RIGHT").appendField("Block Type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Create Digital Line' action."),this.setInputsInline(!1),this.getInput("POINT1").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
165
173
|
<shadow type="minecraft_vector_3d">
|
|
166
174
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
167
175
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
@@ -173,13 +181,21 @@ ${s}`,h.getDescendants(!1)))if("procedures_callnoreturn"===e.type||"procedures_c
|
|
|
173
181
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
174
182
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
175
183
|
</shadow>
|
|
176
|
-
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(
|
|
184
|
+
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
185
|
+
<shadow type="minecraft_picker_world">
|
|
186
|
+
<field name="MATERIAL_ID">STONE</field>
|
|
187
|
+
</shadow>
|
|
188
|
+
`))}},s.Blocks.digital_geometry_create_digital_sphere={init:function(){this.appendDummyInput().appendField("Create Digital Sphere"),this.appendValueInput("CENTER").setCheck("3DVector").setAlign("RIGHT").appendField("Center"),this.appendValueInput("RADIUS").setCheck("Number").setAlign("RIGHT").appendField("Radius"),this.appendValueInput("BLOCK_TYPE").setCheck("Block").setAlign("RIGHT").appendField("Block Type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Create Digital Sphere' action."),this.setInputsInline(!1),this.getInput("CENTER").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
177
189
|
<shadow type="minecraft_vector_3d">
|
|
178
190
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
179
191
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
180
192
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
181
193
|
</shadow>
|
|
182
|
-
`)),this.getInput("RADIUS").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>')),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(
|
|
194
|
+
`)),this.getInput("RADIUS").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>')),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
195
|
+
<shadow type="minecraft_picker_world">
|
|
196
|
+
<field name="MATERIAL_ID">STONE</field>
|
|
197
|
+
</shadow>
|
|
198
|
+
`))}},s.Blocks.event_actions_clear_events={init:function(){this.appendDummyInput().appendField("Clear All Events"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Clear All Events' action."),this.setInputsInline(!1)}},s.Blocks.event_actions_wait_for_chat_by_name={init:function(){this.appendDummyInput().appendField("Wait for Chat from [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"String"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Wait for Chat from [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.event_actions_wait_for_projectile_by_name={init:function(){this.appendDummyInput().appendField("Wait for Arrow Hit from [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Wait for Arrow Hit from [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.event_actions_wait_for_sword_strike_by_name={init:function(){this.appendDummyInput().appendField("Wait for Sword Strike from [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Wait for Sword Strike from [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.l_system_shapes_define_rule={init:function(){this.appendDummyInput().appendField("L-System: Define Rule"),this.appendValueInput("PREDECESSOR").setCheck("String").setAlign("RIGHT").appendField("Symbol (char)"),this.appendValueInput("SUCCESSOR").setCheck("String").setAlign("RIGHT").appendField("Replacement"),this.setOutput(!0,"LSYSTEM_RULE"),this.setColour(65),this.setTooltip("An auto-generated block for the 'L-System: Define Rule' action."),this.setInputsInline(!1),this.getInput("PREDECESSOR").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>')),this.getInput("SUCCESSOR").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>'))}},s.Blocks.l_system_shapes_get_lsystem_shape={init:function(){this.appendDummyInput().appendField("L-System: Generate Shape"),this.appendValueInput("AXIOM").setCheck("String").setAlign("RIGHT").appendField("Axiom"),this.appendValueInput("ITERATIONS").setCheck("Number").setAlign("RIGHT").appendField("Iterations"),this.appendValueInput("STEP_LENGTH").setCheck("Number").setAlign("RIGHT").appendField("Step Length"),this.appendValueInput("RULES").setCheck(null).setAlign("RIGHT").appendField("Rules (List)"),this.setOutput(!0,"Digital_Set"),this.setColour(65),this.setTooltip("An auto-generated block for the 'L-System: Generate Shape' action."),this.setInputsInline(!1),this.getInput("AXIOM").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>')),this.getInput("ITERATIONS").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>')),this.getInput("STEP_LENGTH").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>'))}},s.Blocks.player_actions_get_compass_direction={init:function(){this.appendDummyInput().appendField("Get Player Compass Direction"),this.setOutput(!0,"Compass"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Player Compass Direction' action."),this.setInputsInline(!1)}},s.Blocks.player_actions_get_compass_direction_by_name={init:function(){this.appendDummyInput().appendField("Get Compass Direction for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Compass"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Compass Direction for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.player_actions_get_direction={init:function(){this.appendDummyInput().appendField("Get Direction"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Direction' action."),this.setInputsInline(!1)}},s.Blocks.player_actions_get_position={init:function(){this.appendDummyInput().appendField("Get Player Position"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Player Position' action."),this.setInputsInline(!1)}},s.Blocks.player_actions_get_tile_position={init:function(){this.appendDummyInput().appendField("Get Tile Position"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Tile Position' action."),this.setInputsInline(!1)}},s.Blocks.player_actions_get_tile_position_by_name={init:function(){this.appendDummyInput().appendField("Get Tile Position by Name"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player Name"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Tile Position by Name' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>'))}},s.Blocks.player_actions_send_title={init:function(){this.appendDummyInput().appendField("Send Title"),this.appendValueInput("TITLE").setCheck("String").setAlign("RIGHT").appendField("Title Text"),this.appendValueInput("SUBTITLE").setCheck("String").setAlign("RIGHT").appendField("Subtitle Text"),this.appendValueInput("STAY").setCheck("Number").setAlign("RIGHT").appendField("Time Onscreen"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Send Title' action."),this.setInputsInline(!1),this.getInput("TITLE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>')),this.getInput("SUBTITLE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>')),this.getInput("STAY").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">70</field></shadow>')),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.player_actions_set_compass_direction={init:function(){this.appendDummyInput().appendField("Set Player Compass Direction"),this.appendValueInput("DIR").setCheck("Compass").setAlign("RIGHT").appendField("Direction"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Set Player Compass Direction' action."),this.setInputsInline(!1),this.getInput("DIR").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="picker_compass"><field name="VALUE">N</field></shadow>'))}},s.Blocks.player_actions_set_direction={init:function(){this.appendDummyInput().appendField("Set Direction"),this.appendValueInput("DIRECTION").setCheck("3DVector").setAlign("RIGHT").appendField("Direction Vector"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Set Direction' action."),this.setInputsInline(!1),this.getInput("DIRECTION").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
183
199
|
<shadow type="minecraft_vector_3d">
|
|
184
200
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
185
201
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
@@ -209,13 +225,17 @@ ${s}`,h.getDescendants(!1)))if("procedures_callnoreturn"===e.type||"procedures_c
|
|
|
209
225
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
210
226
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
211
227
|
</shadow>
|
|
212
|
-
`))}},s.Blocks.pyncraft_actions_get_direction_by_name={init:function(){this.appendDummyInput().appendField("Get Direction for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Direction for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_food_level_by_name={init:function(){this.appendDummyInput().appendField("Get Food Level for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Food Level for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_health_by_name={init:function(){this.appendDummyInput().appendField("Get Health for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Health for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_height={init:function(){this.appendDummyInput().appendField("Get Height"),this.appendValueInput("X").setCheck("Number").setAlign("RIGHT").appendField("X"),this.appendValueInput("Z").setCheck("Number").setAlign("RIGHT").appendField("Z"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Height' action."),this.setInputsInline(!1),this.getInput("X").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>')),this.getInput("Z").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>'))}},s.Blocks.pyncraft_actions_get_pitch_by_name={init:function(){this.appendDummyInput().appendField("Get Pitch for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Pitch for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_player_entity_id={init:function(){this.appendDummyInput().appendField("Get Player Entity ID"),this.appendValueInput("NAME").setCheck("String").setAlign("RIGHT").appendField("Player Name"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Player Entity ID' action."),this.setInputsInline(!1),this.getInput("NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>'))}},s.Blocks.pyncraft_actions_get_player_entity_ids={init:function(){this.appendDummyInput().appendField("Get Player Entity IDs"),this.setOutput(!0,"Array"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Player Entity IDs' action."),this.setInputsInline(!1)}},s.Blocks.pyncraft_actions_get_position_by_name={init:function(){this.appendDummyInput().appendField("Get Position for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Position for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_rotation_by_name={init:function(){this.appendDummyInput().appendField("Get Rotation for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Rotation for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_tile_position_by_name={init:function(){this.appendDummyInput().appendField("Get Tile Position for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Tile Position for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_yaw_by_name={init:function(){this.appendDummyInput().appendField("Get Yaw for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Yaw for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_send_title_by_name={init:function(){this.appendDummyInput().appendField("Send Title to [player]"),this.appendValueInput("TITLE").setCheck("String").setAlign("RIGHT").appendField("Title"),this.appendValueInput("SUBTITLE").setCheck("String").setAlign("RIGHT").appendField("Subtitle"),this.appendValueInput("STAY").setCheck("Number").setAlign("RIGHT").appendField("Stay (Ticks)"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Send Title to [player]' action."),this.setInputsInline(!1),this.getInput("TITLE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>')),this.getInput("SUBTITLE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>')),this.getInput("STAY").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">70</field></shadow>')),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_set_block={init:function(){this.appendDummyInput().appendField("Set Block"),this.appendValueInput("POSITION").setCheck("3DVector").setAlign("RIGHT").appendField("At Position"),this.appendValueInput("BLOCK_TYPE").setCheck("
|
|
228
|
+
`))}},s.Blocks.pyncraft_actions_get_direction_by_name={init:function(){this.appendDummyInput().appendField("Get Direction for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Direction for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_food_level_by_name={init:function(){this.appendDummyInput().appendField("Get Food Level for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Food Level for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_health_by_name={init:function(){this.appendDummyInput().appendField("Get Health for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Health for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_height={init:function(){this.appendDummyInput().appendField("Get Height"),this.appendValueInput("X").setCheck("Number").setAlign("RIGHT").appendField("X"),this.appendValueInput("Z").setCheck("Number").setAlign("RIGHT").appendField("Z"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Height' action."),this.setInputsInline(!1),this.getInput("X").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>')),this.getInput("Z").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">0</field></shadow>'))}},s.Blocks.pyncraft_actions_get_pitch_by_name={init:function(){this.appendDummyInput().appendField("Get Pitch for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Pitch for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_player_entity_id={init:function(){this.appendDummyInput().appendField("Get Player Entity ID"),this.appendValueInput("NAME").setCheck("String").setAlign("RIGHT").appendField("Player Name"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Player Entity ID' action."),this.setInputsInline(!1),this.getInput("NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>'))}},s.Blocks.pyncraft_actions_get_player_entity_ids={init:function(){this.appendDummyInput().appendField("Get Player Entity IDs"),this.setOutput(!0,"Array"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Player Entity IDs' action."),this.setInputsInline(!1)}},s.Blocks.pyncraft_actions_get_position_by_name={init:function(){this.appendDummyInput().appendField("Get Position for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Position for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_rotation_by_name={init:function(){this.appendDummyInput().appendField("Get Rotation for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Rotation for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_tile_position_by_name={init:function(){this.appendDummyInput().appendField("Get Tile Position for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"3DVector"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Tile Position for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_get_yaw_by_name={init:function(){this.appendDummyInput().appendField("Get Yaw for [player]"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setOutput(!0,"Number"),this.setColour(65),this.setTooltip("An auto-generated block for the 'Get Yaw for [player]' action."),this.setInputsInline(!1),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_send_title_by_name={init:function(){this.appendDummyInput().appendField("Send Title to [player]"),this.appendValueInput("TITLE").setCheck("String").setAlign("RIGHT").appendField("Title"),this.appendValueInput("SUBTITLE").setCheck("String").setAlign("RIGHT").appendField("Subtitle"),this.appendValueInput("STAY").setCheck("Number").setAlign("RIGHT").appendField("Stay (Ticks)"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Send Title to [player]' action."),this.setInputsInline(!1),this.getInput("TITLE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>')),this.getInput("SUBTITLE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>')),this.getInput("STAY").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="math_number"><field name="NUM">70</field></shadow>')),this.getInput("PLAYER_NAME").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT">SELF</field></shadow>'))}},s.Blocks.pyncraft_actions_set_block={init:function(){this.appendDummyInput().appendField("Set Block"),this.appendValueInput("POSITION").setCheck("3DVector").setAlign("RIGHT").appendField("At Position"),this.appendValueInput("BLOCK_TYPE").setCheck("Block").setAlign("RIGHT").appendField("Block Type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Set Block' action."),this.setInputsInline(!1),this.getInput("POSITION").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
213
229
|
<shadow type="minecraft_vector_3d">
|
|
214
230
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
215
231
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
216
232
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
217
233
|
</shadow>
|
|
218
|
-
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(
|
|
234
|
+
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
235
|
+
<shadow type="minecraft_picker_world">
|
|
236
|
+
<field name="MATERIAL_ID">STONE</field>
|
|
237
|
+
</shadow>
|
|
238
|
+
`))}},s.Blocks.pyncraft_actions_set_blocks={init:function(){this.appendDummyInput().appendField("Set Blocks"),this.appendValueInput("P1").setCheck("3DVector").setAlign("RIGHT").appendField("Position 1"),this.appendValueInput("P2").setCheck("3DVector").setAlign("RIGHT").appendField("Position 2"),this.appendValueInput("BLOCK_TYPE").setCheck("Block").setAlign("RIGHT").appendField("Block Type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Set Blocks' action."),this.setInputsInline(!1),this.getInput("P1").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
219
239
|
<shadow type="minecraft_vector_3d">
|
|
220
240
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
221
241
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
@@ -227,7 +247,11 @@ ${s}`,h.getDescendants(!1)))if("procedures_callnoreturn"===e.type||"procedures_c
|
|
|
227
247
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
228
248
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
229
249
|
</shadow>
|
|
230
|
-
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(
|
|
250
|
+
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
251
|
+
<shadow type="minecraft_picker_world">
|
|
252
|
+
<field name="MATERIAL_ID">STONE</field>
|
|
253
|
+
</shadow>
|
|
254
|
+
`))}},s.Blocks.pyncraft_actions_set_direction_by_name={init:function(){this.appendDummyInput().appendField("Set Direction for [player]"),this.appendValueInput("DIRECTION").setCheck("3DVector").setAlign("RIGHT").appendField("Direction Vector"),this.appendValueInput("PLAYER_NAME").setCheck("String").setAlign("RIGHT").appendField("Player"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Set Direction for [player]' action."),this.setInputsInline(!1),this.getInput("DIRECTION").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
231
255
|
<shadow type="minecraft_vector_3d">
|
|
232
256
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
233
257
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
@@ -299,13 +323,17 @@ ${s}`,h.getDescendants(!1)))if("procedures_callnoreturn"===e.type||"procedures_c
|
|
|
299
323
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
300
324
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
301
325
|
</shadow>
|
|
302
|
-
`))}},s.Blocks.world_actions_post_to_chat={init:function(){this.appendDummyInput().appendField("Post to Chat"),this.appendValueInput("MESSAGE").setCheck("String").setAlign("RIGHT").appendField("Message"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Post to Chat' action."),this.setInputsInline(!1),this.getInput("MESSAGE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>'))}},s.Blocks.world_actions_set_block={init:function(){this.appendDummyInput().appendField("Set Block"),this.appendValueInput("POSITION").setCheck("3DVector").setAlign("RIGHT").appendField("At Position"),this.appendValueInput("BLOCK_TYPE").setCheck("
|
|
326
|
+
`))}},s.Blocks.world_actions_post_to_chat={init:function(){this.appendDummyInput().appendField("Post to Chat"),this.appendValueInput("MESSAGE").setCheck("String").setAlign("RIGHT").appendField("Message"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Post to Chat' action."),this.setInputsInline(!1),this.getInput("MESSAGE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>'))}},s.Blocks.world_actions_set_block={init:function(){this.appendDummyInput().appendField("Set Block"),this.appendValueInput("POSITION").setCheck("3DVector").setAlign("RIGHT").appendField("At Position"),this.appendValueInput("BLOCK_TYPE").setCheck("Block").setAlign("RIGHT").appendField("Block Type"),this.setPreviousStatement(!0,null),this.setNextStatement(!0,null),this.setColour(65),this.setTooltip("An auto-generated block for the 'Set Block' action."),this.setInputsInline(!1),this.getInput("POSITION").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
303
327
|
<shadow type="minecraft_vector_3d">
|
|
304
328
|
<value name="X"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
305
329
|
<value name="Y"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
306
330
|
<value name="Z"><shadow type="math_number"><field name="NUM">0</field></shadow></value>
|
|
307
331
|
</shadow>
|
|
308
|
-
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom('<shadow type="text"><field name="TEXT"></field></shadow>'))}},s.Blocks.minecraft_entity_picker_hostile_mobs={init:function(){this.appendDummyInput().appendField("Hostile Mobs").appendField(new s.FieldDropdown([["Blaze","BLAZE"],["Cave Spider","CAVE_SPIDER"],["Creeper","CREEPER"],["Elder Guardian","ELDER_GUARDIAN"],["Enderman","ENDERMAN"],["Endermite","ENDERMITE"],["Evoker","EVOKER"],["Ghast","GHAST"],["Guardian","GUARDIAN"],["Husk","HUSK"],["Illusioner","ILLUSIONER"],["Magma Cube","MAGMA_CUBE"],["Shulker","SHULKER"],["Silverfish","SILVERFISH"],["Skeleton","SKELETON"],["Slime","SLIME"],["Spider","SPIDER"],["Stray","STRAY"],["Vex","VEX"],["Vindicator","VINDICATOR"],["Witch","WITCH"],["Wither","WITHER"],["Wither Skeleton","WITHER_SKELETON"],["Zombie","ZOMBIE"],["Zombie Villager","ZOMBIE_VILLAGER"],["Zombified Piglin","ZOMBIFIED_PIGLIN"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a hostile mobs entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_minecarts={init:function(){this.appendDummyInput().appendField("Minecarts").appendField(new s.FieldDropdown([["Minecart","MINECART"],["Chest Minecart","CHEST_MINECART"],["Command Block Minecart","COMMAND_BLOCK_MINECART"],["Furnace Minecart","FURNACE_MINECART"],["Hopper Minecart","HOPPER_MINECART"],["Spawner Minecart","SPAWNER_MINECART"],["Tnt Minecart","TNT_MINECART"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a minecarts entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_miscellaneous_entities={init:function(){this.appendDummyInput().appendField("Miscellaneous Entities").appendField(new s.FieldDropdown([["Ender Dragon","ENDER_DRAGON"],["Evoker Fangs","EVOKER_FANGS"],["Giant","GIANT"],["Iron Golem","IRON_GOLEM"],["Llama","LLAMA"],["Skeleton Horse","SKELETON_HORSE"],["Snow Golem","SNOW_GOLEM"],["Tnt","TNT"],["Zombie Horse","ZOMBIE_HORSE"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a miscellaneous entities entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_passive_mobs={init:function(){this.appendDummyInput().appendField("Passive Mobs").appendField(new s.FieldDropdown([["Bat","BAT"],["Chicken","CHICKEN"],["Cow","COW"],["Donkey","DONKEY"],["Horse","HORSE"],["Mooshroom","MOOSHROOM"],["Mule","MULE"],["Ocelot","OCELOT"],["Parrot","PARROT"],["Pig","PIG"],["Polar Bear","POLAR_BEAR"],["Rabbit","RABBIT"],["Sheep","SHEEP"],["Squid","SQUID"],["Villager","VILLAGER"],["Wolf","WOLF"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a passive mobs entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_projectiles={init:function(){this.appendDummyInput().appendField("Projectiles").appendField(new s.FieldDropdown([["Arrow","ARROW"],["Dragon Fireball","DRAGON_FIREBALL"],["Egg","EGG"],["Ender Pearl","ENDER_PEARL"],["Experience Bottle","EXPERIENCE_BOTTLE"],["Fireball","FIREBALL"],["Firework Rocket","FIREWORK_ROCKET"],["Llama Spit","LLAMA_SPIT"],["Shulker Bullet","SHULKER_BULLET"],["Small Fireball","SMALL_FIREBALL"],["Snowball","SNOWBALL"],["Spectral Arrow","SPECTRAL_ARROW"],["Splash Potion","SPLASH_POTION"],["Wither Skull","WITHER_SKULL"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a projectiles entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_utility_and_special={init:function(){this.appendDummyInput().appendField("Utility And Special").appendField(new s.FieldDropdown([["Area Effect Cloud","AREA_EFFECT_CLOUD"],["Armor Stand","ARMOR_STAND"],["End Crystal","END_CRYSTAL"],["Experience Orb","EXPERIENCE_ORB"],["Eye Of Ender","EYE_OF_ENDER"],["Falling Block","FALLING_BLOCK"],["Item","ITEM"],["Item Frame","ITEM_FRAME"],["Leash Knot","LEASH_KNOT"],["Painting","PAINTING"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a utility and special entity."),this.setHelpUrl("")}},s.Blocks.minecraft_material_banner={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("BANNER with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Banner block that can be colored."),e.Defaults.values.minecraft_material_banner={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_bed={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("BED with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Bed block that can be colored."),e.Defaults.values.minecraft_material_bed={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_candle={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("CANDLE with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Candle block that can be colored."),e.Defaults.values.minecraft_material_candle={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_carpet={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("CARPET with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Carpet block that can be colored."),e.Defaults.values.minecraft_material_carpet={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_concrete={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("CONCRETE with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Concrete block that can be colored."),e.Defaults.values.minecraft_material_concrete={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_concrete_powder={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("CONCRETE_POWDER with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Concrete Powder block that can be colored."),e.Defaults.values.minecraft_material_concrete_powder={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_glazed_terracotta={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("GLAZED_TERRACOTTA with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Glazed Terracotta block that can be colored."),e.Defaults.values.minecraft_material_glazed_terracotta={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_shulker_box={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("SHULKER_BOX with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Shulker Box block that can be colored."),e.Defaults.values.minecraft_material_shulker_box={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_stained_glass={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("STAINED_GLASS with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Stained Glass block that can be colored."),e.Defaults.values.minecraft_material_stained_glass={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_stained_glass_pane={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("STAINED_GLASS_PANE with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Stained Glass Pane block that can be colored."),e.Defaults.values.minecraft_material_stained_glass_pane={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_terracotta={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("TERRACOTTA with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Terracotta block that can be colored."),e.Defaults.values.minecraft_material_terracotta={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_wool={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("WOOL with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Wool block that can be colored."),e.Defaults.values.minecraft_material_wool={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_picker_doors={init:function(){this.appendDummyInput().appendField("Doors").appendField(new s.FieldDropdown([["Acacia Door","ACACIA_DOOR"],["Weathered Copper Door","WEATHERED_COPPER_DOOR"],["Waxed Copper Door","WAXED_COPPER_DOOR"],["Cherry Door","CHERRY_DOOR"],["Waxed Weathered Copper Door","WAXED_WEATHERED_COPPER_DOOR"],["Oxidized Copper Door","OXIDIZED_COPPER_DOOR"],["Iron Door","IRON_DOOR"],["Spruce Door","SPRUCE_DOOR"],["Jungle Door","JUNGLE_DOOR"],["Exposed Copper Door","EXPOSED_COPPER_DOOR"],["Warped Door","WARPED_DOOR"],["Oak Door","OAK_DOOR"],["Bamboo Door","BAMBOO_DOOR"],["Copper Door","COPPER_DOOR"],["Pale Oak Door","PALE_OAK_DOOR"],["Mangrove Door","MANGROVE_DOOR"],["Crimson Door","CRIMSON_DOOR"],["Dark Oak Door","DARK_OAK_DOOR"],["Birch Door","BIRCH_DOOR"],["Waxed Exposed Copper Door","WAXED_EXPOSED_COPPER_DOOR"],["Waxed Oxidized Copper Door","WAXED_OXIDIZED_COPPER_DOOR"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Doors material.")}},s.Blocks.minecraft_picker_fences={init:function(){this.appendDummyInput().appendField("Fences").appendField(new s.FieldDropdown([["Jungle Fence","JUNGLE_FENCE"],["Acacia Fence","ACACIA_FENCE"],["Cherry Fence","CHERRY_FENCE"],["Pale Oak Fence","PALE_OAK_FENCE"],["Oak Fence","OAK_FENCE"],["Nether Brick Fence","NETHER_BRICK_FENCE"],["Dark Oak Fence","DARK_OAK_FENCE"],["Warped Fence","WARPED_FENCE"],["Bamboo Fence","BAMBOO_FENCE"],["Birch Fence","BIRCH_FENCE"],["Mangrove Fence","MANGROVE_FENCE"],["Spruce Fence","SPRUCE_FENCE"],["Crimson Fence","CRIMSON_FENCE"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Fences material.")}},s.Blocks.minecraft_picker_gates={init:function(){this.appendDummyInput().appendField("Gates").appendField(new s.FieldDropdown([["Dark Oak Fence Gate","DARK_OAK_FENCE_GATE"],["Acacia Fence Gate","ACACIA_FENCE_GATE"],["Spruce Fence Gate","SPRUCE_FENCE_GATE"],["Cherry Fence Gate","CHERRY_FENCE_GATE"],["Warped Fence Gate","WARPED_FENCE_GATE"],["Birch Fence Gate","BIRCH_FENCE_GATE"],["Oak Fence Gate","OAK_FENCE_GATE"],["Bamboo Fence Gate","BAMBOO_FENCE_GATE"],["Mangrove Fence Gate","MANGROVE_FENCE_GATE"],["Jungle Fence Gate","JUNGLE_FENCE_GATE"],["Crimson Fence Gate","CRIMSON_FENCE_GATE"],["Pale Oak Fence Gate","PALE_OAK_FENCE_GATE"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Gates material.")}},s.Blocks.minecraft_picker_glass={init:function(){this.appendDummyInput().appendField("Glass").appendField(new s.FieldDropdown([["Glass","GLASS"],["Glass Pane","GLASS_PANE"],["Tinted Glass","TINTED_GLASS"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Glass material.")}},s.Blocks.minecraft_picker_ores={init:function(){this.appendDummyInput().appendField("Ores").appendField(new s.FieldDropdown([["Coal Ore","COAL_ORE"],["Deepslate Coal Ore","DEEPSLATE_COAL_ORE"],["Iron Ore","IRON_ORE"],["Deepslate Iron Ore","DEEPSLATE_IRON_ORE"],["Copper Ore","COPPER_ORE"],["Deepslate Copper Ore","DEEPSLATE_COPPER_ORE"],["Gold Ore","GOLD_ORE"],["Deepslate Gold Ore","DEEPSLATE_GOLD_ORE"],["Redstone Ore","REDSTONE_ORE"],["Deepslate Redstone Ore","DEEPSLATE_REDSTONE_ORE"],["Emerald Ore","EMERALD_ORE"],["Deepslate Emerald Ore","DEEPSLATE_EMERALD_ORE"],["Lapis Ore","LAPIS_ORE"],["Deepslate Lapis Ore","DEEPSLATE_LAPIS_ORE"],["Diamond Ore","DIAMOND_ORE"],["Deepslate Diamond Ore","DEEPSLATE_DIAMOND_ORE"],["Nether Gold Ore","NETHER_GOLD_ORE"],["Nether Quartz Ore","NETHER_QUARTZ_ORE"],["Ancient Debris","ANCIENT_DEBRIS"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Ores material.")}},s.Blocks.minecraft_picker_redstone_components={init:function(){this.appendDummyInput().appendField("Redstone Components").appendField(new s.FieldDropdown([["Redstone Wire","REDSTONE_WIRE"],["Redstone Block","REDSTONE_BLOCK"],["Redstone Torch","REDSTONE_TORCH"],["Repeater","REPEATER"],["Comparator","COMPARATOR"],["Piston","PISTON"],["Sticky Piston","STICKY_PISTON"],["Slime Block","SLIME_BLOCK"],["Honey Block","HONEY_BLOCK"],["Observer","OBSERVER"],["Dropper","DROPPER"],["Dispenser","DISPENSER"],["Hopper","HOPPER"],["Lectern","LECTERN"],["Lever","LEVER"],["Daylight Detector","DAYLIGHT_DETECTOR"],["Tripwire Hook","TRIPWIRE_HOOK"],["Target","TARGET"],["Note Block","NOTE_BLOCK"],["Rail","RAIL"],["Powered Rail","POWERED_RAIL"],["Detector Rail","DETECTOR_RAIL"],["Activator Rail","ACTIVATOR_RAIL"],["Redstone Lamp","REDSTONE_LAMP"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Redstone Components material.")}},s.Blocks.minecraft_picker_slabs={init:function(){this.appendDummyInput().appendField("Slabs").appendField(new s.FieldDropdown([["Mossy Cobblestone Slab","MOSSY_COBBLESTONE_SLAB"],["Cherry Slab","CHERRY_SLAB"],["Deepslate Brick Slab","DEEPSLATE_BRICK_SLAB"],["Stone Brick Slab","STONE_BRICK_SLAB"],["Mangrove Slab","MANGROVE_SLAB"],["Acacia Slab","ACACIA_SLAB"],["End Stone Brick Slab","END_STONE_BRICK_SLAB"],["Granite Slab","GRANITE_SLAB"],["Smooth Sandstone Slab","SMOOTH_SANDSTONE_SLAB"],["Jungle Slab","JUNGLE_SLAB"],["Prismarine Brick Slab","PRISMARINE_BRICK_SLAB"],["Waxed Oxidized Cut Copper Slab","WAXED_OXIDIZED_CUT_COPPER_SLAB"],["Waxed Cut Copper Slab","WAXED_CUT_COPPER_SLAB"],["Exposed Cut Copper Slab","EXPOSED_CUT_COPPER_SLAB"],["Warped Slab","WARPED_SLAB"],["Cut Copper Slab","CUT_COPPER_SLAB"],["Nether Brick Slab","NETHER_BRICK_SLAB"],["Mossy Stone Brick Slab","MOSSY_STONE_BRICK_SLAB"],["Polished Blackstone Slab","POLISHED_BLACKSTONE_SLAB"],["Waxed Exposed Cut Copper Slab","WAXED_EXPOSED_CUT_COPPER_SLAB"],["Polished Deepslate Slab","POLISHED_DEEPSLATE_SLAB"],["Cut Red Sandstone Slab","CUT_RED_SANDSTONE_SLAB"],["Tuff Slab","TUFF_SLAB"],["Cobbled Deepslate Slab","COBBLED_DEEPSLATE_SLAB"],["Crimson Slab","CRIMSON_SLAB"],["Dark Prismarine Slab","DARK_PRISMARINE_SLAB"],["Dark Oak Slab","DARK_OAK_SLAB"],["Smooth Quartz Slab","SMOOTH_QUARTZ_SLAB"],["Deepslate Tile Slab","DEEPSLATE_TILE_SLAB"],["Brick Slab","BRICK_SLAB"],["Smooth Red Sandstone Slab","SMOOTH_RED_SANDSTONE_SLAB"],["Andesite Slab","ANDESITE_SLAB"],["Resin Brick Slab","RESIN_BRICK_SLAB"],["Polished Diorite Slab","POLISHED_DIORITE_SLAB"],["Mud Brick Slab","MUD_BRICK_SLAB"],["Red Sandstone Slab","RED_SANDSTONE_SLAB"],["Polished Tuff Slab","POLISHED_TUFF_SLAB"],["Weathered Cut Copper Slab","WEATHERED_CUT_COPPER_SLAB"],["Red Nether Brick Slab","RED_NETHER_BRICK_SLAB"],["Bamboo Slab","BAMBOO_SLAB"],["Pale Oak Slab","PALE_OAK_SLAB"],["Diorite Slab","DIORITE_SLAB"],["Bamboo Mosaic Slab","BAMBOO_MOSAIC_SLAB"],["Waxed Weathered Cut Copper Slab","WAXED_WEATHERED_CUT_COPPER_SLAB"],["Polished Granite Slab","POLISHED_GRANITE_SLAB"],["Birch Slab","BIRCH_SLAB"],["Polished Blackstone Brick Slab","POLISHED_BLACKSTONE_BRICK_SLAB"],["Purpur Slab","PURPUR_SLAB"],["Petrified Oak Slab","PETRIFIED_OAK_SLAB"],["Cobblestone Slab","COBBLESTONE_SLAB"],["Tuff Brick Slab","TUFF_BRICK_SLAB"],["Blackstone Slab","BLACKSTONE_SLAB"],["Oak Slab","OAK_SLAB"],["Quartz Slab","QUARTZ_SLAB"],["Prismarine Slab","PRISMARINE_SLAB"],["Smooth Stone Slab","SMOOTH_STONE_SLAB"],["Stone Slab","STONE_SLAB"],["Cut Sandstone Slab","CUT_SANDSTONE_SLAB"],["Oxidized Cut Copper Slab","OXIDIZED_CUT_COPPER_SLAB"],["Polished Andesite Slab","POLISHED_ANDESITE_SLAB"],["Sandstone Slab","SANDSTONE_SLAB"],["Spruce Slab","SPRUCE_SLAB"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Slabs material.")}},s.Blocks.minecraft_picker_stairs={init:function(){this.appendDummyInput().appendField("Stairs").appendField(new s.FieldDropdown([["Cut Copper Stairs","CUT_COPPER_STAIRS"],["Cherry Stairs","CHERRY_STAIRS"],["Brick Stairs","BRICK_STAIRS"],["Sandstone Stairs","SANDSTONE_STAIRS"],["Andesite Stairs","ANDESITE_STAIRS"],["Tuff Brick Stairs","TUFF_BRICK_STAIRS"],["Dark Oak Stairs","DARK_OAK_STAIRS"],["Mud Brick Stairs","MUD_BRICK_STAIRS"],["Purpur Stairs","PURPUR_STAIRS"],["Quartz Stairs","QUARTZ_STAIRS"],["Waxed Oxidized Cut Copper Stairs","WAXED_OXIDIZED_CUT_COPPER_STAIRS"],["Pale Oak Stairs","PALE_OAK_STAIRS"],["Jungle Stairs","JUNGLE_STAIRS"],["Waxed Cut Copper Stairs","WAXED_CUT_COPPER_STAIRS"],["Bamboo Mosaic Stairs","BAMBOO_MOSAIC_STAIRS"],["Bamboo Stairs","BAMBOO_STAIRS"],["Polished Blackstone Brick Stairs","POLISHED_BLACKSTONE_BRICK_STAIRS"],["Deepslate Brick Stairs","DEEPSLATE_BRICK_STAIRS"],["Mangrove Stairs","MANGROVE_STAIRS"],["Red Sandstone Stairs","RED_SANDSTONE_STAIRS"],["Stone Brick Stairs","STONE_BRICK_STAIRS"],["Polished Blackstone Stairs","POLISHED_BLACKSTONE_STAIRS"],["Prismarine Brick Stairs","PRISMARINE_BRICK_STAIRS"],["Spruce Stairs","SPRUCE_STAIRS"],["Polished Deepslate Stairs","POLISHED_DEEPSLATE_STAIRS"],["Granite Stairs","GRANITE_STAIRS"],["Smooth Red Sandstone Stairs","SMOOTH_RED_SANDSTONE_STAIRS"],["Polished Diorite Stairs","POLISHED_DIORITE_STAIRS"],["Tuff Stairs","TUFF_STAIRS"],["End Stone Brick Stairs","END_STONE_BRICK_STAIRS"],["Resin Brick Stairs","RESIN_BRICK_STAIRS"],["Birch Stairs","BIRCH_STAIRS"],["Oak Stairs","OAK_STAIRS"],["Warped Stairs","WARPED_STAIRS"],["Polished Tuff Stairs","POLISHED_TUFF_STAIRS"],["Acacia Stairs","ACACIA_STAIRS"],["Crimson Stairs","CRIMSON_STAIRS"],["Prismarine Stairs","PRISMARINE_STAIRS"],["Smooth Sandstone Stairs","SMOOTH_SANDSTONE_STAIRS"],["Polished Granite Stairs","POLISHED_GRANITE_STAIRS"],["Cobbled Deepslate Stairs","COBBLED_DEEPSLATE_STAIRS"],["Blackstone Stairs","BLACKSTONE_STAIRS"],["Nether Brick Stairs","NETHER_BRICK_STAIRS"],["Waxed Exposed Cut Copper Stairs","WAXED_EXPOSED_CUT_COPPER_STAIRS"],["Cobblestone Stairs","COBBLESTONE_STAIRS"],["Smooth Quartz Stairs","SMOOTH_QUARTZ_STAIRS"],["Mossy Cobblestone Stairs","MOSSY_COBBLESTONE_STAIRS"],["Oxidized Cut Copper Stairs","OXIDIZED_CUT_COPPER_STAIRS"],["Red Nether Brick Stairs","RED_NETHER_BRICK_STAIRS"],["Stone Stairs","STONE_STAIRS"],["Mossy Stone Brick Stairs","MOSSY_STONE_BRICK_STAIRS"],["Weathered Cut Copper Stairs","WEATHERED_CUT_COPPER_STAIRS"],["Polished Andesite Stairs","POLISHED_ANDESITE_STAIRS"],["Diorite Stairs","DIORITE_STAIRS"],["Deepslate Tile Stairs","DEEPSLATE_TILE_STAIRS"],["Exposed Cut Copper Stairs","EXPOSED_CUT_COPPER_STAIRS"],["Dark Prismarine Stairs","DARK_PRISMARINE_STAIRS"],["Waxed Weathered Cut Copper Stairs","WAXED_WEATHERED_CUT_COPPER_STAIRS"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Stairs material.")}},s.Blocks.minecraft_picker_stone_bricks={init:function(){this.appendDummyInput().appendField("Stone Bricks").appendField(new s.FieldDropdown([["Bricks","BRICKS"],["Stone Bricks","STONE_BRICKS"],["Mud Bricks","MUD_BRICKS"],["Deepslate Bricks","DEEPSLATE_BRICKS"],["Deepslate Tiles","DEEPSLATE_TILES"],["Nether Bricks","NETHER_BRICKS"],["Red Nether Bricks","RED_NETHER_BRICKS"],["Polished Blackstone Bricks","POLISHED_BLACKSTONE_BRICKS"],["End Stone Bricks","END_STONE_BRICKS"],["Quartz Bricks","QUARTZ_BRICKS"],["Chiseled Stone Bricks","CHISELED_STONE_BRICKS"],["Cracked Stone Bricks","CRACKED_STONE_BRICKS"],["Mossy Stone Bricks","MOSSY_STONE_BRICKS"],["Chiseled Nether Bricks","CHISELED_NETHER_BRICKS"],["Cracked Nether Bricks","CRACKED_NETHER_BRICKS"],["Chiseled Polished Blackstone","CHISELED_POLISHED_BLACKSTONE"],["Cracked Polished Blackstone Bricks","CRACKED_POLISHED_BLACKSTONE_BRICKS"],["Chiseled Deepslate","CHISELED_DEEPSLATE"],["Cracked Deepslate Bricks","CRACKED_DEEPSLATE_BRICKS"],["Cracked Deepslate Tiles","CRACKED_DEEPSLATE_TILES"],["Chiseled Tuff Bricks","CHISELED_TUFF_BRICKS"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Stone Bricks material.")}},s.Blocks.minecraft_picker_trapdoors={init:function(){this.appendDummyInput().appendField("Trapdoors").appendField(new s.FieldDropdown([["Waxed Copper Trapdoor","WAXED_COPPER_TRAPDOOR"],["Dark Oak Trapdoor","DARK_OAK_TRAPDOOR"],["Mangrove Trapdoor","MANGROVE_TRAPDOOR"],["Iron Trapdoor","IRON_TRAPDOOR"],["Waxed Exposed Copper Trapdoor","WAXED_EXPOSED_COPPER_TRAPDOOR"],["Waxed Oxidized Copper Trapdoor","WAXED_OXIDIZED_COPPER_TRAPDOOR"],["Exposed Copper Trapdoor","EXPOSED_COPPER_TRAPDOOR"],["Jungle Trapdoor","JUNGLE_TRAPDOOR"],["Pale Oak Trapdoor","PALE_OAK_TRAPDOOR"],["Acacia Trapdoor","ACACIA_TRAPDOOR"],["Weathered Copper Trapdoor","WEATHERED_COPPER_TRAPDOOR"],["Warped Trapdoor","WARPED_TRAPDOOR"],["Waxed Weathered Copper Trapdoor","WAXED_WEATHERED_COPPER_TRAPDOOR"],["Copper Trapdoor","COPPER_TRAPDOOR"],["Oxidized Copper Trapdoor","OXIDIZED_COPPER_TRAPDOOR"],["Cherry Trapdoor","CHERRY_TRAPDOOR"],["Spruce Trapdoor","SPRUCE_TRAPDOOR"],["Birch Trapdoor","BIRCH_TRAPDOOR"],["Bamboo Trapdoor","BAMBOO_TRAPDOOR"],["Oak Trapdoor","OAK_TRAPDOOR"],["Crimson Trapdoor","CRIMSON_TRAPDOOR"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Trapdoors material.")}},s.Blocks.minecraft_picker_walls={init:function(){this.appendDummyInput().appendField("Walls").appendField(new s.FieldDropdown([["Cobbled Deepslate Wall","COBBLED_DEEPSLATE_WALL"],["Resin Brick Wall","RESIN_BRICK_WALL"],["Tuff Wall","TUFF_WALL"],["Cobblestone Wall","COBBLESTONE_WALL"],["Polished Tuff Wall","POLISHED_TUFF_WALL"],["Deepslate Tile Wall","DEEPSLATE_TILE_WALL"],["Polished Blackstone Wall","POLISHED_BLACKSTONE_WALL"],["Mossy Cobblestone Wall","MOSSY_COBBLESTONE_WALL"],["Nether Brick Wall","NETHER_BRICK_WALL"],["Sandstone Wall","SANDSTONE_WALL"],["Mossy Stone Brick Wall","MOSSY_STONE_BRICK_WALL"],["Polished Blackstone Brick Wall","POLISHED_BLACKSTONE_BRICK_WALL"],["Blackstone Wall","BLACKSTONE_WALL"],["Brick Wall","BRICK_WALL"],["End Stone Brick Wall","END_STONE_BRICK_WALL"],["Granite Wall","GRANITE_WALL"],["Stone Brick Wall","STONE_BRICK_WALL"],["Polished Deepslate Wall","POLISHED_DEEPSLATE_WALL"],["Diorite Wall","DIORITE_WALL"],["Andesite Wall","ANDESITE_WALL"],["Prismarine Wall","PRISMARINE_WALL"],["Red Sandstone Wall","RED_SANDSTONE_WALL"],["Deepslate Brick Wall","DEEPSLATE_BRICK_WALL"],["Red Nether Brick Wall","RED_NETHER_BRICK_WALL"],["Tuff Brick Wall","TUFF_BRICK_WALL"],["Mud Brick Wall","MUD_BRICK_WALL"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Walls material.")}},s.Blocks.minecraft_picker_wood_full={init:function(){this.appendDummyInput().appendField("Wood Full").appendField(new s.FieldDropdown([["Oak Wood","OAK_WOOD"],["Spruce Wood","SPRUCE_WOOD"],["Birch Wood","BIRCH_WOOD"],["Jungle Wood","JUNGLE_WOOD"],["Acacia Wood","ACACIA_WOOD"],["Dark Oak Wood","DARK_OAK_WOOD"],["Mangrove Wood","MANGROVE_WOOD"],["Cherry Wood","CHERRY_WOOD"],["Crimson Hyphae","CRIMSON_HYPHAE"],["Warped Hyphae","WARPED_HYPHAE"],["Stripped Oak Wood","STRIPPED_OAK_WOOD"],["Stripped Spruce Wood","STRIPPED_SPRUCE_WOOD"],["Stripped Birch Wood","STRIPPED_BIRCH_WOOD"],["Stripped Jungle Wood","STRIPPED_JUNGLE_WOOD"],["Stripped Acacia Wood","STRIPPED_ACACIA_WOOD"],["Stripped Dark Oak Wood","STRIPPED_DARK_OAK_WOOD"],["Stripped Mangrove Wood","STRIPPED_MANGROVE_WOOD"],["Stripped Cherry Wood","STRIPPED_CHERRY_WOOD"],["Stripped Crimson Hyphae","STRIPPED_CRIMSON_HYPHAE"],["Stripped Warped Hyphae","STRIPPED_WARPED_HYPHAE"],["Bamboo Block","BAMBOO_BLOCK"],["Stripped Bamboo Block","STRIPPED_BAMBOO_BLOCK"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Wood Full material.")}},s.Blocks.minecraft_picker_wood_logs={init:function(){this.appendDummyInput().appendField("Wood Logs").appendField(new s.FieldDropdown([["Oak Log","OAK_LOG"],["Spruce Log","SPRUCE_LOG"],["Birch Log","BIRCH_LOG"],["Jungle Log","JUNGLE_LOG"],["Acacia Log","ACACIA_LOG"],["Dark Oak Log","DARK_OAK_LOG"],["Mangrove Log","MANGROVE_LOG"],["Cherry Log","CHERRY_LOG"],["Crimson Stem","CRIMSON_STEM"],["Warped Stem","WARPED_STEM"],["Stripped Oak Log","STRIPPED_OAK_LOG"],["Stripped Spruce Log","STRIPPED_SPRUCE_LOG"],["Stripped Birch Log","STRIPPED_BIRCH_LOG"],["Stripped Jungle Log","STRIPPED_JUNGLE_LOG"],["Stripped Acacia Log","STRIPPED_ACACIA_LOG"],["Stripped Dark Oak Log","STRIPPED_DARK_OAK_LOG"],["Stripped Mangrove Log","STRIPPED_MANGROVE_LOG"],["Stripped Cherry Log","STRIPPED_CHERRY_LOG"],["Stripped Crimson Stem","STRIPPED_CRIMSON_STEM"],["Stripped Warped Stem","STRIPPED_WARPED_STEM"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Wood Logs material.")}},s.Blocks.minecraft_picker_wood_planks={init:function(){this.appendDummyInput().appendField("Wood Planks").appendField(new s.FieldDropdown([["Oak Planks","OAK_PLANKS"],["Spruce Planks","SPRUCE_PLANKS"],["Birch Planks","BIRCH_PLANKS"],["Jungle Planks","JUNGLE_PLANKS"],["Acacia Planks","ACACIA_PLANKS"],["Dark Oak Planks","DARK_OAK_PLANKS"],["Mangrove Planks","MANGROVE_PLANKS"],["Cherry Planks","CHERRY_PLANKS"],["Bamboo Planks","BAMBOO_PLANKS"],["Crimson Planks","CRIMSON_PLANKS"],["Warped Planks","WARPED_PLANKS"],["Bamboo Mosaic","BAMBOO_MOSAIC"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Wood Planks material.")}},s.Blocks.minecraft_picker_world={init:function(){this.appendDummyInput().appendField("World").appendField(new s.FieldDropdown([["Air","AIR"],["Stone","STONE"],["Granite","GRANITE"],["Diorite","DIORITE"],["Andesite","ANDESITE"],["Deepslate","DEEPSLATE"],["Calcite","CALCITE"],["Tuff","TUFF"],["Dirt","DIRT"],["Coarse Dirt","COARSE_DIRT"],["Rooted Dirt","ROOTED_DIRT"],["Grass Block","GRASS_BLOCK"],["Podzol","PODZOL"],["Mycelium","MYCELIUM"],["Dirt Path","DIRT_PATH"],["Sand","SAND"],["Red Sand","RED_SAND"],["Gravel","GRAVEL"],["Clay","CLAY"],["Ice","ICE"],["Packed Ice","PACKED_ICE"],["Blue Ice","BLUE_ICE"],["Snow","SNOW"],["Snow Block","SNOW_BLOCK"],["Water","WATER"],["Lava","LAVA"],["Bedrock","BEDROCK"],["Obsidian","OBSIDIAN"],["Crying Obsidian","CRYING_OBSIDIAN"],["Magma Block","MAGMA_BLOCK"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a World material.")}},s.Blocks.minecraft_picker_miscellaneous={init:function(){this.appendDummyInput().appendField("Misc. Block/Item").appendField(new s.FieldDropdown([["Acacia Boat","ACACIA_BOAT"],["Acacia Button","ACACIA_BUTTON"],["Acacia Chest Boat","ACACIA_CHEST_BOAT"],["Acacia Hanging Sign","ACACIA_HANGING_SIGN"],["Acacia Leaves","ACACIA_LEAVES"],["Acacia Pressure Plate","ACACIA_PRESSURE_PLATE"],["Acacia Sapling","ACACIA_SAPLING"],["Acacia Shelf","ACACIA_SHELF"],["Acacia Sign","ACACIA_SIGN"],["Acacia Wall Hanging Sign","ACACIA_WALL_HANGING_SIGN"],["Acacia Wall Sign","ACACIA_WALL_SIGN"],["Allay Spawn Egg","ALLAY_SPAWN_EGG"],["Allium","ALLIUM"],["Amethyst Block","AMETHYST_BLOCK"],["Amethyst Cluster","AMETHYST_CLUSTER"],["Amethyst Shard","AMETHYST_SHARD"],["Angler Pottery Sherd","ANGLER_POTTERY_SHERD"],["Anvil","ANVIL"],["Apple","APPLE"],["Archer Pottery Sherd","ARCHER_POTTERY_SHERD"],["Armadillo Scute","ARMADILLO_SCUTE"],["Armadillo Spawn Egg","ARMADILLO_SPAWN_EGG"],["Armor Stand","ARMOR_STAND"],["Arms Up Pottery Sherd","ARMS_UP_POTTERY_SHERD"],["Arrow","ARROW"],["Attached Melon Stem","ATTACHED_MELON_STEM"],["Attached Pumpkin Stem","ATTACHED_PUMPKIN_STEM"],["Axolotl Bucket","AXOLOTL_BUCKET"],["Axolotl Spawn Egg","AXOLOTL_SPAWN_EGG"],["Azalea","AZALEA"],["Azalea Leaves","AZALEA_LEAVES"],["Azure Bluet","AZURE_BLUET"],["Baked Potato","BAKED_POTATO"],["Bamboo","BAMBOO"],["Bamboo Button","BAMBOO_BUTTON"],["Bamboo Chest Raft","BAMBOO_CHEST_RAFT"],["Bamboo Hanging Sign","BAMBOO_HANGING_SIGN"],["Bamboo Pressure Plate","BAMBOO_PRESSURE_PLATE"],["Bamboo Raft","BAMBOO_RAFT"],["Bamboo Sapling","BAMBOO_SAPLING"],["Bamboo Shelf","BAMBOO_SHELF"],["Bamboo Sign","BAMBOO_SIGN"],["Bamboo Wall Hanging Sign","BAMBOO_WALL_HANGING_SIGN"],["Bamboo Wall Sign","BAMBOO_WALL_SIGN"],["Barrel","BARREL"],["Barrier","BARRIER"],["Basalt","BASALT"],["Bat Spawn Egg","BAT_SPAWN_EGG"],["Beacon","BEACON"],["Beef","BEEF"],["Beehive","BEEHIVE"],["Beetroot","BEETROOT"],["Beetroots","BEETROOTS"],["Beetroot Seeds","BEETROOT_SEEDS"],["Beetroot Soup","BEETROOT_SOUP"],["Bee Nest","BEE_NEST"],["Bee Spawn Egg","BEE_SPAWN_EGG"],["Bell","BELL"],["Big Dripleaf","BIG_DRIPLEAF"],["Big Dripleaf Stem","BIG_DRIPLEAF_STEM"],["Birch Boat","BIRCH_BOAT"],["Birch Button","BIRCH_BUTTON"],["Birch Chest Boat","BIRCH_CHEST_BOAT"],["Birch Hanging Sign","BIRCH_HANGING_SIGN"],["Birch Leaves","BIRCH_LEAVES"],["Birch Pressure Plate","BIRCH_PRESSURE_PLATE"],["Birch Sapling","BIRCH_SAPLING"],["Birch Shelf","BIRCH_SHELF"],["Birch Sign","BIRCH_SIGN"],["Birch Wall Hanging Sign","BIRCH_WALL_HANGING_SIGN"],["Birch Wall Sign","BIRCH_WALL_SIGN"],["Blackstone","BLACKSTONE"],["Black Bundle","BLACK_BUNDLE"],["Black Candle Cake","BLACK_CANDLE_CAKE"],["Black Dye","BLACK_DYE"],["Black Harness","BLACK_HARNESS"],["Blade Pottery Sherd","BLADE_POTTERY_SHERD"],["Blast Furnace","BLAST_FURNACE"],["Blaze Powder","BLAZE_POWDER"],["Blaze Rod","BLAZE_ROD"],["Blaze Spawn Egg","BLAZE_SPAWN_EGG"],["Blue Bundle","BLUE_BUNDLE"],["Blue Candle Cake","BLUE_CANDLE_CAKE"],["Blue Dye","BLUE_DYE"],["Blue Egg","BLUE_EGG"],["Blue Harness","BLUE_HARNESS"],["Blue Orchid","BLUE_ORCHID"],["Bogged Spawn Egg","BOGGED_SPAWN_EGG"],["Bolt Armor Trim Smithing Template","BOLT_ARMOR_TRIM_SMITHING_TEMPLATE"],["Bone","BONE"],["Bone Block","BONE_BLOCK"],["Bone Meal","BONE_MEAL"],["Book","BOOK"],["Bookshelf","BOOKSHELF"],["Bordure Indented Banner Pattern","BORDURE_INDENTED_BANNER_PATTERN"],["Bow","BOW"],["Bowl","BOWL"],["Brain Coral","BRAIN_CORAL"],["Brain Coral Block","BRAIN_CORAL_BLOCK"],["Brain Coral Fan","BRAIN_CORAL_FAN"],["Brain Coral Wall Fan","BRAIN_CORAL_WALL_FAN"],["Bread","BREAD"],["Breeze Rod","BREEZE_ROD"],["Breeze Spawn Egg","BREEZE_SPAWN_EGG"],["Brewer Pottery Sherd","BREWER_POTTERY_SHERD"],["Brewing Stand","BREWING_STAND"],["Brick","BRICK"],["Brown Bundle","BROWN_BUNDLE"],["Brown Candle Cake","BROWN_CANDLE_CAKE"],["Brown Dye","BROWN_DYE"],["Brown Egg","BROWN_EGG"],["Brown Harness","BROWN_HARNESS"],["Brown Mushroom","BROWN_MUSHROOM"],["Brown Mushroom Block","BROWN_MUSHROOM_BLOCK"],["Brush","BRUSH"],["Bubble Column","BUBBLE_COLUMN"],["Bubble Coral","BUBBLE_CORAL"],["Bubble Coral Block","BUBBLE_CORAL_BLOCK"],["Bubble Coral Fan","BUBBLE_CORAL_FAN"],["Bubble Coral Wall Fan","BUBBLE_CORAL_WALL_FAN"],["Bucket","BUCKET"],["Budding Amethyst","BUDDING_AMETHYST"],["Bundle","BUNDLE"],["Burn Pottery Sherd","BURN_POTTERY_SHERD"],["Bush","BUSH"],["Cactus","CACTUS"],["Cactus Flower","CACTUS_FLOWER"],["Cake","CAKE"],["Calibrated Sculk Sensor","CALIBRATED_SCULK_SENSOR"],["Camel Husk Spawn Egg","CAMEL_HUSK_SPAWN_EGG"],["Camel Spawn Egg","CAMEL_SPAWN_EGG"],["Campfire","CAMPFIRE"],["Candle","CANDLE"],["Candle Cake","CANDLE_CAKE"],["Carrot","CARROT"],["Carrots","CARROTS"],["Carrot On A Stick","CARROT_ON_A_STICK"],["Cartography Table","CARTOGRAPHY_TABLE"],["Carved Pumpkin","CARVED_PUMPKIN"],["Cat Spawn Egg","CAT_SPAWN_EGG"],["Cauldron","CAULDRON"],["Cave Air","CAVE_AIR"],["Cave Spider Spawn Egg","CAVE_SPIDER_SPAWN_EGG"],["Cave Vines","CAVE_VINES"],["Cave Vines Plant","CAVE_VINES_PLANT"],["Chainmail Boots","CHAINMAIL_BOOTS"],["Chainmail Chestplate","CHAINMAIL_CHESTPLATE"],["Chainmail Helmet","CHAINMAIL_HELMET"],["Chainmail Leggings","CHAINMAIL_LEGGINGS"],["Chain Command Block","CHAIN_COMMAND_BLOCK"],["Charcoal","CHARCOAL"],["Cherry Boat","CHERRY_BOAT"],["Cherry Button","CHERRY_BUTTON"],["Cherry Chest Boat","CHERRY_CHEST_BOAT"],["Cherry Hanging Sign","CHERRY_HANGING_SIGN"],["Cherry Leaves","CHERRY_LEAVES"],["Cherry Pressure Plate","CHERRY_PRESSURE_PLATE"],["Cherry Sapling","CHERRY_SAPLING"],["Cherry Shelf","CHERRY_SHELF"],["Cherry Sign","CHERRY_SIGN"],["Cherry Wall Hanging Sign","CHERRY_WALL_HANGING_SIGN"],["Cherry Wall Sign","CHERRY_WALL_SIGN"],["Chest","CHEST"],["Chest Minecart","CHEST_MINECART"],["Chicken","CHICKEN"],["Chicken Spawn Egg","CHICKEN_SPAWN_EGG"],["Chipped Anvil","CHIPPED_ANVIL"],["Chiseled Bookshelf","CHISELED_BOOKSHELF"],["Chiseled Copper","CHISELED_COPPER"],["Chiseled Quartz Block","CHISELED_QUARTZ_BLOCK"],["Chiseled Red Sandstone","CHISELED_RED_SANDSTONE"],["Chiseled Resin Bricks","CHISELED_RESIN_BRICKS"],["Chiseled Sandstone","CHISELED_SANDSTONE"],["Chiseled Tuff","CHISELED_TUFF"],["Chorus Flower","CHORUS_FLOWER"],["Chorus Fruit","CHORUS_FRUIT"],["Chorus Plant","CHORUS_PLANT"],["Clay Ball","CLAY_BALL"],["Clock","CLOCK"],["Closed Eyeblossom","CLOSED_EYEBLOSSOM"],["Coal","COAL"],["Coal Block","COAL_BLOCK"],["Coast Armor Trim Smithing Template","COAST_ARMOR_TRIM_SMITHING_TEMPLATE"],["Cobbled Deepslate","COBBLED_DEEPSLATE"],["Cobblestone","COBBLESTONE"],["Cobweb","COBWEB"],["Cocoa","COCOA"],["Cocoa Beans","COCOA_BEANS"],["Cod","COD"],["Cod Bucket","COD_BUCKET"],["Cod Spawn Egg","COD_SPAWN_EGG"],["Command Block","COMMAND_BLOCK"],["Command Block Minecart","COMMAND_BLOCK_MINECART"],["Compass","COMPASS"],["Composter","COMPOSTER"],["Conduit","CONDUIT"],["Cooked Beef","COOKED_BEEF"],["Cooked Chicken","COOKED_CHICKEN"],["Cooked Cod","COOKED_COD"],["Cooked Mutton","COOKED_MUTTON"],["Cooked Porkchop","COOKED_PORKCHOP"],["Cooked Rabbit","COOKED_RABBIT"],["Cooked Salmon","COOKED_SALMON"],["Cookie","COOKIE"],["Copper Axe","COPPER_AXE"],["Copper Bars","COPPER_BARS"],["Copper Block","COPPER_BLOCK"],["Copper Boots","COPPER_BOOTS"],["Copper Bulb","COPPER_BULB"],["Copper Chain","COPPER_CHAIN"],["Copper Chest","COPPER_CHEST"],["Copper Chestplate","COPPER_CHESTPLATE"],["Copper Golem Spawn Egg","COPPER_GOLEM_SPAWN_EGG"],["Copper Golem Statue","COPPER_GOLEM_STATUE"],["Copper Grate","COPPER_GRATE"],["Copper Helmet","COPPER_HELMET"],["Copper Hoe","COPPER_HOE"],["Copper Horse Armor","COPPER_HORSE_ARMOR"],["Copper Ingot","COPPER_INGOT"],["Copper Lantern","COPPER_LANTERN"],["Copper Leggings","COPPER_LEGGINGS"],["Copper Nautilus Armor","COPPER_NAUTILUS_ARMOR"],["Copper Nugget","COPPER_NUGGET"],["Copper Pickaxe","COPPER_PICKAXE"],["Copper Shovel","COPPER_SHOVEL"],["Copper Spear","COPPER_SPEAR"],["Copper Sword","COPPER_SWORD"],["Copper Torch","COPPER_TORCH"],["Copper Wall Torch","COPPER_WALL_TORCH"],["Cornflower","CORNFLOWER"],["Cow Spawn Egg","COW_SPAWN_EGG"],["Crafter","CRAFTER"],["Crafting Table","CRAFTING_TABLE"],["Creaking Heart","CREAKING_HEART"],["Creaking Spawn Egg","CREAKING_SPAWN_EGG"],["Creeper Banner Pattern","CREEPER_BANNER_PATTERN"],["Creeper Head","CREEPER_HEAD"],["Creeper Spawn Egg","CREEPER_SPAWN_EGG"],["Creeper Wall Head","CREEPER_WALL_HEAD"],["Crimson Button","CRIMSON_BUTTON"],["Crimson Fungus","CRIMSON_FUNGUS"],["Crimson Hanging Sign","CRIMSON_HANGING_SIGN"],["Crimson Nylium","CRIMSON_NYLIUM"],["Crimson Pressure Plate","CRIMSON_PRESSURE_PLATE"],["Crimson Roots","CRIMSON_ROOTS"],["Crimson Shelf","CRIMSON_SHELF"],["Crimson Sign","CRIMSON_SIGN"],["Crimson Wall Hanging Sign","CRIMSON_WALL_HANGING_SIGN"],["Crimson Wall Sign","CRIMSON_WALL_SIGN"],["Crossbow","CROSSBOW"],["Cut Copper","CUT_COPPER"],["Cut Red Sandstone","CUT_RED_SANDSTONE"],["Cut Sandstone","CUT_SANDSTONE"],["Cyan Bundle","CYAN_BUNDLE"],["Cyan Candle Cake","CYAN_CANDLE_CAKE"],["Cyan Dye","CYAN_DYE"],["Cyan Harness","CYAN_HARNESS"],["Damaged Anvil","DAMAGED_ANVIL"],["Dandelion","DANDELION"],["Danger Pottery Sherd","DANGER_POTTERY_SHERD"],["Dark Oak Boat","DARK_OAK_BOAT"],["Dark Oak Button","DARK_OAK_BUTTON"],["Dark Oak Chest Boat","DARK_OAK_CHEST_BOAT"],["Dark Oak Hanging Sign","DARK_OAK_HANGING_SIGN"],["Dark Oak Leaves","DARK_OAK_LEAVES"],["Dark Oak Pressure Plate","DARK_OAK_PRESSURE_PLATE"],["Dark Oak Sapling","DARK_OAK_SAPLING"],["Dark Oak Shelf","DARK_OAK_SHELF"],["Dark Oak Sign","DARK_OAK_SIGN"],["Dark Oak Wall Hanging Sign","DARK_OAK_WALL_HANGING_SIGN"],["Dark Oak Wall Sign","DARK_OAK_WALL_SIGN"],["Dark Prismarine","DARK_PRISMARINE"],["Dead Brain Coral","DEAD_BRAIN_CORAL"],["Dead Brain Coral Block","DEAD_BRAIN_CORAL_BLOCK"],["Dead Brain Coral Fan","DEAD_BRAIN_CORAL_FAN"],["Dead Brain Coral Wall Fan","DEAD_BRAIN_CORAL_WALL_FAN"],["Dead Bubble Coral","DEAD_BUBBLE_CORAL"],["Dead Bubble Coral Block","DEAD_BUBBLE_CORAL_BLOCK"],["Dead Bubble Coral Fan","DEAD_BUBBLE_CORAL_FAN"],["Dead Bubble Coral Wall Fan","DEAD_BUBBLE_CORAL_WALL_FAN"],["Dead Bush","DEAD_BUSH"],["Dead Fire Coral","DEAD_FIRE_CORAL"],["Dead Fire Coral Block","DEAD_FIRE_CORAL_BLOCK"],["Dead Fire Coral Fan","DEAD_FIRE_CORAL_FAN"],["Dead Fire Coral Wall Fan","DEAD_FIRE_CORAL_WALL_FAN"],["Dead Horn Coral","DEAD_HORN_CORAL"],["Dead Horn Coral Block","DEAD_HORN_CORAL_BLOCK"],["Dead Horn Coral Fan","DEAD_HORN_CORAL_FAN"],["Dead Horn Coral Wall Fan","DEAD_HORN_CORAL_WALL_FAN"],["Dead Tube Coral","DEAD_TUBE_CORAL"],["Dead Tube Coral Block","DEAD_TUBE_CORAL_BLOCK"],["Dead Tube Coral Fan","DEAD_TUBE_CORAL_FAN"],["Dead Tube Coral Wall Fan","DEAD_TUBE_CORAL_WALL_FAN"],["Debug Stick","DEBUG_STICK"],["Decorated Pot","DECORATED_POT"],["Diamond","DIAMOND"],["Diamond Axe","DIAMOND_AXE"],["Diamond Block","DIAMOND_BLOCK"],["Diamond Boots","DIAMOND_BOOTS"],["Diamond Chestplate","DIAMOND_CHESTPLATE"],["Diamond Helmet","DIAMOND_HELMET"],["Diamond Hoe","DIAMOND_HOE"],["Diamond Horse Armor","DIAMOND_HORSE_ARMOR"],["Diamond Leggings","DIAMOND_LEGGINGS"],["Diamond Nautilus Armor","DIAMOND_NAUTILUS_ARMOR"],["Diamond Pickaxe","DIAMOND_PICKAXE"],["Diamond Shovel","DIAMOND_SHOVEL"],["Diamond Spear","DIAMOND_SPEAR"],["Diamond Sword","DIAMOND_SWORD"],["Disc Fragment 5","DISC_FRAGMENT_5"],["Dolphin Spawn Egg","DOLPHIN_SPAWN_EGG"],["Donkey Spawn Egg","DONKEY_SPAWN_EGG"],["Dragon Breath","DRAGON_BREATH"],["Dragon Egg","DRAGON_EGG"],["Dragon Head","DRAGON_HEAD"],["Dragon Wall Head","DRAGON_WALL_HEAD"],["Dried Ghast","DRIED_GHAST"],["Dried Kelp","DRIED_KELP"],["Dried Kelp Block","DRIED_KELP_BLOCK"],["Dripstone Block","DRIPSTONE_BLOCK"],["Drowned Spawn Egg","DROWNED_SPAWN_EGG"],["Dune Armor Trim Smithing Template","DUNE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Echo Shard","ECHO_SHARD"],["Egg","EGG"],["Elder Guardian Spawn Egg","ELDER_GUARDIAN_SPAWN_EGG"],["Elytra","ELYTRA"],["Emerald","EMERALD"],["Emerald Block","EMERALD_BLOCK"],["Enchanted Book","ENCHANTED_BOOK"],["Enchanted Golden Apple","ENCHANTED_GOLDEN_APPLE"],["Enchanting Table","ENCHANTING_TABLE"],["Enderman Spawn Egg","ENDERMAN_SPAWN_EGG"],["Endermite Spawn Egg","ENDERMITE_SPAWN_EGG"],["Ender Chest","ENDER_CHEST"],["Ender Dragon Spawn Egg","ENDER_DRAGON_SPAWN_EGG"],["Ender Eye","ENDER_EYE"],["Ender Pearl","ENDER_PEARL"],["End Crystal","END_CRYSTAL"],["End Gateway","END_GATEWAY"],["End Portal","END_PORTAL"],["End Portal Frame","END_PORTAL_FRAME"],["End Rod","END_ROD"],["End Stone","END_STONE"],["Evoker Spawn Egg","EVOKER_SPAWN_EGG"],["Experience Bottle","EXPERIENCE_BOTTLE"],["Explorer Pottery Sherd","EXPLORER_POTTERY_SHERD"],["Exposed Chiseled Copper","EXPOSED_CHISELED_COPPER"],["Exposed Copper","EXPOSED_COPPER"],["Exposed Copper Bars","EXPOSED_COPPER_BARS"],["Exposed Copper Bulb","EXPOSED_COPPER_BULB"],["Exposed Copper Chain","EXPOSED_COPPER_CHAIN"],["Exposed Copper Chest","EXPOSED_COPPER_CHEST"],["Exposed Copper Golem Statue","EXPOSED_COPPER_GOLEM_STATUE"],["Exposed Copper Grate","EXPOSED_COPPER_GRATE"],["Exposed Copper Lantern","EXPOSED_COPPER_LANTERN"],["Exposed Cut Copper","EXPOSED_CUT_COPPER"],["Exposed Lightning Rod","EXPOSED_LIGHTNING_ROD"],["Eye Armor Trim Smithing Template","EYE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Farmland","FARMLAND"],["Feather","FEATHER"],["Fermented Spider Eye","FERMENTED_SPIDER_EYE"],["Fern","FERN"],["Field Masoned Banner Pattern","FIELD_MASONED_BANNER_PATTERN"],["Filled Map","FILLED_MAP"],["Fire","FIRE"],["Firefly Bush","FIREFLY_BUSH"],["Firework Rocket","FIREWORK_ROCKET"],["Firework Star","FIREWORK_STAR"],["Fire Charge","FIRE_CHARGE"],["Fire Coral","FIRE_CORAL"],["Fire Coral Block","FIRE_CORAL_BLOCK"],["Fire Coral Fan","FIRE_CORAL_FAN"],["Fire Coral Wall Fan","FIRE_CORAL_WALL_FAN"],["Fishing Rod","FISHING_ROD"],["Fletching Table","FLETCHING_TABLE"],["Flint","FLINT"],["Flint And Steel","FLINT_AND_STEEL"],["Flowering Azalea","FLOWERING_AZALEA"],["Flowering Azalea Leaves","FLOWERING_AZALEA_LEAVES"],["Flower Banner Pattern","FLOWER_BANNER_PATTERN"],["Flower Pot","FLOWER_POT"],["Flow Armor Trim Smithing Template","FLOW_ARMOR_TRIM_SMITHING_TEMPLATE"],["Flow Banner Pattern","FLOW_BANNER_PATTERN"],["Flow Pottery Sherd","FLOW_POTTERY_SHERD"],["Fox Spawn Egg","FOX_SPAWN_EGG"],["Friend Pottery Sherd","FRIEND_POTTERY_SHERD"],["Frogspawn","FROGSPAWN"],["Frog Spawn Egg","FROG_SPAWN_EGG"],["Frosted Ice","FROSTED_ICE"],["Furnace","FURNACE"],["Furnace Minecart","FURNACE_MINECART"],["Ghast Spawn Egg","GHAST_SPAWN_EGG"],["Ghast Tear","GHAST_TEAR"],["Gilded Blackstone","GILDED_BLACKSTONE"],["Glass Bottle","GLASS_BOTTLE"],["Glistering Melon Slice","GLISTERING_MELON_SLICE"],["Globe Banner Pattern","GLOBE_BANNER_PATTERN"],["Glowstone","GLOWSTONE"],["Glowstone Dust","GLOWSTONE_DUST"],["Glow Berries","GLOW_BERRIES"],["Glow Ink Sac","GLOW_INK_SAC"],["Glow Item Frame","GLOW_ITEM_FRAME"],["Glow Lichen","GLOW_LICHEN"],["Glow Squid Spawn Egg","GLOW_SQUID_SPAWN_EGG"],["Goat Horn","GOAT_HORN"],["Goat Spawn Egg","GOAT_SPAWN_EGG"],["Golden Apple","GOLDEN_APPLE"],["Golden Axe","GOLDEN_AXE"],["Golden Boots","GOLDEN_BOOTS"],["Golden Carrot","GOLDEN_CARROT"],["Golden Chestplate","GOLDEN_CHESTPLATE"],["Golden Helmet","GOLDEN_HELMET"],["Golden Hoe","GOLDEN_HOE"],["Golden Horse Armor","GOLDEN_HORSE_ARMOR"],["Golden Leggings","GOLDEN_LEGGINGS"],["Golden Nautilus Armor","GOLDEN_NAUTILUS_ARMOR"],["Golden Pickaxe","GOLDEN_PICKAXE"],["Golden Shovel","GOLDEN_SHOVEL"],["Golden Spear","GOLDEN_SPEAR"],["Golden Sword","GOLDEN_SWORD"],["Gold Block","GOLD_BLOCK"],["Gold Ingot","GOLD_INGOT"],["Gold Nugget","GOLD_NUGGET"],["Gray Bundle","GRAY_BUNDLE"],["Gray Candle Cake","GRAY_CANDLE_CAKE"],["Gray Dye","GRAY_DYE"],["Gray Harness","GRAY_HARNESS"],["Green Bundle","GREEN_BUNDLE"],["Green Candle Cake","GREEN_CANDLE_CAKE"],["Green Dye","GREEN_DYE"],["Green Harness","GREEN_HARNESS"],["Grindstone","GRINDSTONE"],["Guardian Spawn Egg","GUARDIAN_SPAWN_EGG"],["Gunpowder","GUNPOWDER"],["Guster Banner Pattern","GUSTER_BANNER_PATTERN"],["Guster Pottery Sherd","GUSTER_POTTERY_SHERD"],["Hanging Roots","HANGING_ROOTS"],["Happy Ghast Spawn Egg","HAPPY_GHAST_SPAWN_EGG"],["Hay Block","HAY_BLOCK"],["Heartbreak Pottery Sherd","HEARTBREAK_POTTERY_SHERD"],["Heart Of The Sea","HEART_OF_THE_SEA"],["Heart Pottery Sherd","HEART_POTTERY_SHERD"],["Heavy Core","HEAVY_CORE"],["Heavy Weighted Pressure Plate","HEAVY_WEIGHTED_PRESSURE_PLATE"],["Hoglin Spawn Egg","HOGLIN_SPAWN_EGG"],["Honeycomb","HONEYCOMB"],["Honeycomb Block","HONEYCOMB_BLOCK"],["Honey Bottle","HONEY_BOTTLE"],["Hopper Minecart","HOPPER_MINECART"],["Horn Coral","HORN_CORAL"],["Horn Coral Block","HORN_CORAL_BLOCK"],["Horn Coral Fan","HORN_CORAL_FAN"],["Horn Coral Wall Fan","HORN_CORAL_WALL_FAN"],["Horse Spawn Egg","HORSE_SPAWN_EGG"],["Host Armor Trim Smithing Template","HOST_ARMOR_TRIM_SMITHING_TEMPLATE"],["Howl Pottery Sherd","HOWL_POTTERY_SHERD"],["Husk Spawn Egg","HUSK_SPAWN_EGG"],["Infested Chiseled Stone Bricks","INFESTED_CHISELED_STONE_BRICKS"],["Infested Cobblestone","INFESTED_COBBLESTONE"],["Infested Cracked Stone Bricks","INFESTED_CRACKED_STONE_BRICKS"],["Infested Deepslate","INFESTED_DEEPSLATE"],["Infested Mossy Stone Bricks","INFESTED_MOSSY_STONE_BRICKS"],["Infested Stone","INFESTED_STONE"],["Infested Stone Bricks","INFESTED_STONE_BRICKS"],["Ink Sac","INK_SAC"],["Iron Axe","IRON_AXE"],["Iron Bars","IRON_BARS"],["Iron Block","IRON_BLOCK"],["Iron Boots","IRON_BOOTS"],["Iron Chain","IRON_CHAIN"],["Iron Chestplate","IRON_CHESTPLATE"],["Iron Golem Spawn Egg","IRON_GOLEM_SPAWN_EGG"],["Iron Helmet","IRON_HELMET"],["Iron Hoe","IRON_HOE"],["Iron Horse Armor","IRON_HORSE_ARMOR"],["Iron Ingot","IRON_INGOT"],["Iron Leggings","IRON_LEGGINGS"],["Iron Nautilus Armor","IRON_NAUTILUS_ARMOR"],["Iron Nugget","IRON_NUGGET"],["Iron Pickaxe","IRON_PICKAXE"],["Iron Shovel","IRON_SHOVEL"],["Iron Spear","IRON_SPEAR"],["Iron Sword","IRON_SWORD"],["Item Frame","ITEM_FRAME"],["Jack O Lantern","JACK_O_LANTERN"],["Jigsaw","JIGSAW"],["Jukebox","JUKEBOX"],["Jungle Boat","JUNGLE_BOAT"],["Jungle Button","JUNGLE_BUTTON"],["Jungle Chest Boat","JUNGLE_CHEST_BOAT"],["Jungle Hanging Sign","JUNGLE_HANGING_SIGN"],["Jungle Leaves","JUNGLE_LEAVES"],["Jungle Pressure Plate","JUNGLE_PRESSURE_PLATE"],["Jungle Sapling","JUNGLE_SAPLING"],["Jungle Shelf","JUNGLE_SHELF"],["Jungle Sign","JUNGLE_SIGN"],["Jungle Wall Hanging Sign","JUNGLE_WALL_HANGING_SIGN"],["Jungle Wall Sign","JUNGLE_WALL_SIGN"],["Kelp","KELP"],["Kelp Plant","KELP_PLANT"],["Knowledge Book","KNOWLEDGE_BOOK"],["Ladder","LADDER"],["Lantern","LANTERN"],["Lapis Block","LAPIS_BLOCK"],["Lapis Lazuli","LAPIS_LAZULI"],["Large Amethyst Bud","LARGE_AMETHYST_BUD"],["Large Fern","LARGE_FERN"],["Lava Bucket","LAVA_BUCKET"],["Lava Cauldron","LAVA_CAULDRON"],["Lead","LEAD"],["Leaf Litter","LEAF_LITTER"],["Leather","LEATHER"],["Leather Boots","LEATHER_BOOTS"],["Leather Chestplate","LEATHER_CHESTPLATE"],["Leather Helmet","LEATHER_HELMET"],["Leather Horse Armor","LEATHER_HORSE_ARMOR"],["Leather Leggings","LEATHER_LEGGINGS"],["Light","LIGHT"],["Lightning Rod","LIGHTNING_ROD"],["Light Blue Bundle","LIGHT_BLUE_BUNDLE"],["Light Blue Candle Cake","LIGHT_BLUE_CANDLE_CAKE"],["Light Blue Dye","LIGHT_BLUE_DYE"],["Light Blue Harness","LIGHT_BLUE_HARNESS"],["Light Gray Bundle","LIGHT_GRAY_BUNDLE"],["Light Gray Candle Cake","LIGHT_GRAY_CANDLE_CAKE"],["Light Gray Dye","LIGHT_GRAY_DYE"],["Light Gray Harness","LIGHT_GRAY_HARNESS"],["Light Weighted Pressure Plate","LIGHT_WEIGHTED_PRESSURE_PLATE"],["Lilac","LILAC"],["Lily Of The Valley","LILY_OF_THE_VALLEY"],["Lily Pad","LILY_PAD"],["Lime Bundle","LIME_BUNDLE"],["Lime Candle Cake","LIME_CANDLE_CAKE"],["Lime Dye","LIME_DYE"],["Lime Harness","LIME_HARNESS"],["Lingering Potion","LINGERING_POTION"],["Llama Spawn Egg","LLAMA_SPAWN_EGG"],["Lodestone","LODESTONE"],["Loom","LOOM"],["Mace","MACE"],["Magenta Bundle","MAGENTA_BUNDLE"],["Magenta Candle Cake","MAGENTA_CANDLE_CAKE"],["Magenta Dye","MAGENTA_DYE"],["Magenta Harness","MAGENTA_HARNESS"],["Magma Cream","MAGMA_CREAM"],["Magma Cube Spawn Egg","MAGMA_CUBE_SPAWN_EGG"],["Mangrove Boat","MANGROVE_BOAT"],["Mangrove Button","MANGROVE_BUTTON"],["Mangrove Chest Boat","MANGROVE_CHEST_BOAT"],["Mangrove Hanging Sign","MANGROVE_HANGING_SIGN"],["Mangrove Leaves","MANGROVE_LEAVES"],["Mangrove Pressure Plate","MANGROVE_PRESSURE_PLATE"],["Mangrove Propagule","MANGROVE_PROPAGULE"],["Mangrove Roots","MANGROVE_ROOTS"],["Mangrove Shelf","MANGROVE_SHELF"],["Mangrove Sign","MANGROVE_SIGN"],["Mangrove Wall Hanging Sign","MANGROVE_WALL_HANGING_SIGN"],["Mangrove Wall Sign","MANGROVE_WALL_SIGN"],["Map","MAP"],["Medium Amethyst Bud","MEDIUM_AMETHYST_BUD"],["Melon","MELON"],["Melon Seeds","MELON_SEEDS"],["Melon Slice","MELON_SLICE"],["Melon Stem","MELON_STEM"],["Milk Bucket","MILK_BUCKET"],["Minecart","MINECART"],["Miner Pottery Sherd","MINER_POTTERY_SHERD"],["Mojang Banner Pattern","MOJANG_BANNER_PATTERN"],["Mooshroom Spawn Egg","MOOSHROOM_SPAWN_EGG"],["Mossy Cobblestone","MOSSY_COBBLESTONE"],["Moss Block","MOSS_BLOCK"],["Moss Carpet","MOSS_CARPET"],["Mourner Pottery Sherd","MOURNER_POTTERY_SHERD"],["Moving Piston","MOVING_PISTON"],["Mud","MUD"],["Muddy Mangrove Roots","MUDDY_MANGROVE_ROOTS"],["Mule Spawn Egg","MULE_SPAWN_EGG"],["Mushroom Stem","MUSHROOM_STEM"],["Mushroom Stew","MUSHROOM_STEW"],["Music Disc 11","MUSIC_DISC_11"],["Music Disc 13","MUSIC_DISC_13"],["Music Disc 5","MUSIC_DISC_5"],["Music Disc Blocks","MUSIC_DISC_BLOCKS"],["Music Disc Cat","MUSIC_DISC_CAT"],["Music Disc Chirp","MUSIC_DISC_CHIRP"],["Music Disc Creator","MUSIC_DISC_CREATOR"],["Music Disc Creator Music Box","MUSIC_DISC_CREATOR_MUSIC_BOX"],["Music Disc Far","MUSIC_DISC_FAR"],["Music Disc Lava Chicken","MUSIC_DISC_LAVA_CHICKEN"],["Music Disc Mall","MUSIC_DISC_MALL"],["Music Disc Mellohi","MUSIC_DISC_MELLOHI"],["Music Disc Otherside","MUSIC_DISC_OTHERSIDE"],["Music Disc Pigstep","MUSIC_DISC_PIGSTEP"],["Music Disc Precipice","MUSIC_DISC_PRECIPICE"],["Music Disc Relic","MUSIC_DISC_RELIC"],["Music Disc Stal","MUSIC_DISC_STAL"],["Music Disc Strad","MUSIC_DISC_STRAD"],["Music Disc Tears","MUSIC_DISC_TEARS"],["Music Disc Wait","MUSIC_DISC_WAIT"],["Music Disc Ward","MUSIC_DISC_WARD"],["Mutton","MUTTON"],["Name Tag","NAME_TAG"],["Nautilus Shell","NAUTILUS_SHELL"],["Nautilus Spawn Egg","NAUTILUS_SPAWN_EGG"],["Netherite Axe","NETHERITE_AXE"],["Netherite Block","NETHERITE_BLOCK"],["Netherite Boots","NETHERITE_BOOTS"],["Netherite Chestplate","NETHERITE_CHESTPLATE"],["Netherite Helmet","NETHERITE_HELMET"],["Netherite Hoe","NETHERITE_HOE"],["Netherite Horse Armor","NETHERITE_HORSE_ARMOR"],["Netherite Ingot","NETHERITE_INGOT"],["Netherite Leggings","NETHERITE_LEGGINGS"],["Netherite Nautilus Armor","NETHERITE_NAUTILUS_ARMOR"],["Netherite Pickaxe","NETHERITE_PICKAXE"],["Netherite Scrap","NETHERITE_SCRAP"],["Netherite Shovel","NETHERITE_SHOVEL"],["Netherite Spear","NETHERITE_SPEAR"],["Netherite Sword","NETHERITE_SWORD"],["Netherite Upgrade Smithing Template","NETHERITE_UPGRADE_SMITHING_TEMPLATE"],["Netherrack","NETHERRACK"],["Nether Brick","NETHER_BRICK"],["Nether Portal","NETHER_PORTAL"],["Nether Sprouts","NETHER_SPROUTS"],["Nether Star","NETHER_STAR"],["Nether Wart","NETHER_WART"],["Nether Wart Block","NETHER_WART_BLOCK"],["Oak Boat","OAK_BOAT"],["Oak Button","OAK_BUTTON"],["Oak Chest Boat","OAK_CHEST_BOAT"],["Oak Hanging Sign","OAK_HANGING_SIGN"],["Oak Leaves","OAK_LEAVES"],["Oak Pressure Plate","OAK_PRESSURE_PLATE"],["Oak Sapling","OAK_SAPLING"],["Oak Shelf","OAK_SHELF"],["Oak Sign","OAK_SIGN"],["Oak Wall Hanging Sign","OAK_WALL_HANGING_SIGN"],["Oak Wall Sign","OAK_WALL_SIGN"],["Ocelot Spawn Egg","OCELOT_SPAWN_EGG"],["Ochre Froglight","OCHRE_FROGLIGHT"],["Ominous Bottle","OMINOUS_BOTTLE"],["Ominous Trial Key","OMINOUS_TRIAL_KEY"],["Open Eyeblossom","OPEN_EYEBLOSSOM"],["Orange Bundle","ORANGE_BUNDLE"],["Orange Candle Cake","ORANGE_CANDLE_CAKE"],["Orange Dye","ORANGE_DYE"],["Orange Harness","ORANGE_HARNESS"],["Orange Tulip","ORANGE_TULIP"],["Oxeye Daisy","OXEYE_DAISY"],["Oxidized Chiseled Copper","OXIDIZED_CHISELED_COPPER"],["Oxidized Copper","OXIDIZED_COPPER"],["Oxidized Copper Bars","OXIDIZED_COPPER_BARS"],["Oxidized Copper Bulb","OXIDIZED_COPPER_BULB"],["Oxidized Copper Chain","OXIDIZED_COPPER_CHAIN"],["Oxidized Copper Chest","OXIDIZED_COPPER_CHEST"],["Oxidized Copper Golem Statue","OXIDIZED_COPPER_GOLEM_STATUE"],["Oxidized Copper Grate","OXIDIZED_COPPER_GRATE"],["Oxidized Copper Lantern","OXIDIZED_COPPER_LANTERN"],["Oxidized Cut Copper","OXIDIZED_CUT_COPPER"],["Oxidized Lightning Rod","OXIDIZED_LIGHTNING_ROD"],["Packed Mud","PACKED_MUD"],["Painting","PAINTING"],["Pale Hanging Moss","PALE_HANGING_MOSS"],["Pale Moss Block","PALE_MOSS_BLOCK"],["Pale Moss Carpet","PALE_MOSS_CARPET"],["Pale Oak Boat","PALE_OAK_BOAT"],["Pale Oak Button","PALE_OAK_BUTTON"],["Pale Oak Chest Boat","PALE_OAK_CHEST_BOAT"],["Pale Oak Hanging Sign","PALE_OAK_HANGING_SIGN"],["Pale Oak Leaves","PALE_OAK_LEAVES"],["Pale Oak Log","PALE_OAK_LOG"],["Pale Oak Planks","PALE_OAK_PLANKS"],["Pale Oak Pressure Plate","PALE_OAK_PRESSURE_PLATE"],["Pale Oak Sapling","PALE_OAK_SAPLING"],["Pale Oak Shelf","PALE_OAK_SHELF"],["Pale Oak Sign","PALE_OAK_SIGN"],["Pale Oak Wall Hanging Sign","PALE_OAK_WALL_HANGING_SIGN"],["Pale Oak Wall Sign","PALE_OAK_WALL_SIGN"],["Pale Oak Wood","PALE_OAK_WOOD"],["Panda Spawn Egg","PANDA_SPAWN_EGG"],["Paper","PAPER"],["Parched Spawn Egg","PARCHED_SPAWN_EGG"],["Parrot Spawn Egg","PARROT_SPAWN_EGG"],["Pearlescent Froglight","PEARLESCENT_FROGLIGHT"],["Peony","PEONY"],["Phantom Membrane","PHANTOM_MEMBRANE"],["Phantom Spawn Egg","PHANTOM_SPAWN_EGG"],["Piglin Banner Pattern","PIGLIN_BANNER_PATTERN"],["Piglin Brute Spawn Egg","PIGLIN_BRUTE_SPAWN_EGG"],["Piglin Head","PIGLIN_HEAD"],["Piglin Spawn Egg","PIGLIN_SPAWN_EGG"],["Piglin Wall Head","PIGLIN_WALL_HEAD"],["Pig Spawn Egg","PIG_SPAWN_EGG"],["Pillager Spawn Egg","PILLAGER_SPAWN_EGG"],["Pink Bundle","PINK_BUNDLE"],["Pink Candle Cake","PINK_CANDLE_CAKE"],["Pink Dye","PINK_DYE"],["Pink Harness","PINK_HARNESS"],["Pink Petals","PINK_PETALS"],["Pink Tulip","PINK_TULIP"],["Piston Head","PISTON_HEAD"],["Pitcher Crop","PITCHER_CROP"],["Pitcher Plant","PITCHER_PLANT"],["Pitcher Pod","PITCHER_POD"],["Player Head","PLAYER_HEAD"],["Player Wall Head","PLAYER_WALL_HEAD"],["Plenty Pottery Sherd","PLENTY_POTTERY_SHERD"],["Pointed Dripstone","POINTED_DRIPSTONE"],["Poisonous Potato","POISONOUS_POTATO"],["Polar Bear Spawn Egg","POLAR_BEAR_SPAWN_EGG"],["Polished Andesite","POLISHED_ANDESITE"],["Polished Basalt","POLISHED_BASALT"],["Polished Blackstone","POLISHED_BLACKSTONE"],["Polished Blackstone Button","POLISHED_BLACKSTONE_BUTTON"],["Polished Blackstone Pressure Plate","POLISHED_BLACKSTONE_PRESSURE_PLATE"],["Polished Deepslate","POLISHED_DEEPSLATE"],["Polished Diorite","POLISHED_DIORITE"],["Polished Granite","POLISHED_GRANITE"],["Polished Tuff","POLISHED_TUFF"],["Popped Chorus Fruit","POPPED_CHORUS_FRUIT"],["Poppy","POPPY"],["Porkchop","PORKCHOP"],["Potato","POTATO"],["Potatoes","POTATOES"],["Potion","POTION"],["Potted Acacia Sapling","POTTED_ACACIA_SAPLING"],["Potted Allium","POTTED_ALLIUM"],["Potted Azalea Bush","POTTED_AZALEA_BUSH"],["Potted Azure Bluet","POTTED_AZURE_BLUET"],["Potted Bamboo","POTTED_BAMBOO"],["Potted Birch Sapling","POTTED_BIRCH_SAPLING"],["Potted Blue Orchid","POTTED_BLUE_ORCHID"],["Potted Brown Mushroom","POTTED_BROWN_MUSHROOM"],["Potted Cactus","POTTED_CACTUS"],["Potted Cherry Sapling","POTTED_CHERRY_SAPLING"],["Potted Closed Eyeblossom","POTTED_CLOSED_EYEBLOSSOM"],["Potted Cornflower","POTTED_CORNFLOWER"],["Potted Crimson Fungus","POTTED_CRIMSON_FUNGUS"],["Potted Crimson Roots","POTTED_CRIMSON_ROOTS"],["Potted Dandelion","POTTED_DANDELION"],["Potted Dark Oak Sapling","POTTED_DARK_OAK_SAPLING"],["Potted Dead Bush","POTTED_DEAD_BUSH"],["Potted Fern","POTTED_FERN"],["Potted Flowering Azalea Bush","POTTED_FLOWERING_AZALEA_BUSH"],["Potted Jungle Sapling","POTTED_JUNGLE_SAPLING"],["Potted Lily Of The Valley","POTTED_LILY_OF_THE_VALLEY"],["Potted Mangrove Propagule","POTTED_MANGROVE_PROPAGULE"],["Potted Oak Sapling","POTTED_OAK_SAPLING"],["Potted Open Eyeblossom","POTTED_OPEN_EYEBLOSSOM"],["Potted Orange Tulip","POTTED_ORANGE_TULIP"],["Potted Oxeye Daisy","POTTED_OXEYE_DAISY"],["Potted Pale Oak Sapling","POTTED_PALE_OAK_SAPLING"],["Potted Pink Tulip","POTTED_PINK_TULIP"],["Potted Poppy","POTTED_POPPY"],["Potted Red Mushroom","POTTED_RED_MUSHROOM"],["Potted Red Tulip","POTTED_RED_TULIP"],["Potted Spruce Sapling","POTTED_SPRUCE_SAPLING"],["Potted Torchflower","POTTED_TORCHFLOWER"],["Potted Warped Fungus","POTTED_WARPED_FUNGUS"],["Potted Warped Roots","POTTED_WARPED_ROOTS"],["Potted White Tulip","POTTED_WHITE_TULIP"],["Potted Wither Rose","POTTED_WITHER_ROSE"],["Powder Snow","POWDER_SNOW"],["Powder Snow Bucket","POWDER_SNOW_BUCKET"],["Powder Snow Cauldron","POWDER_SNOW_CAULDRON"],["Prismarine","PRISMARINE"],["Prismarine Bricks","PRISMARINE_BRICKS"],["Prismarine Crystals","PRISMARINE_CRYSTALS"],["Prismarine Shard","PRISMARINE_SHARD"],["Prize Pottery Sherd","PRIZE_POTTERY_SHERD"],["Pufferfish","PUFFERFISH"],["Pufferfish Bucket","PUFFERFISH_BUCKET"],["Pufferfish Spawn Egg","PUFFERFISH_SPAWN_EGG"],["Pumpkin","PUMPKIN"],["Pumpkin Pie","PUMPKIN_PIE"],["Pumpkin Seeds","PUMPKIN_SEEDS"],["Pumpkin Stem","PUMPKIN_STEM"],["Purple Bundle","PURPLE_BUNDLE"],["Purple Candle Cake","PURPLE_CANDLE_CAKE"],["Purple Dye","PURPLE_DYE"],["Purple Harness","PURPLE_HARNESS"],["Purpur Block","PURPUR_BLOCK"],["Purpur Pillar","PURPUR_PILLAR"],["Quartz","QUARTZ"],["Quartz Block","QUARTZ_BLOCK"],["Quartz Pillar","QUARTZ_PILLAR"],["Rabbit","RABBIT"],["Rabbit Foot","RABBIT_FOOT"],["Rabbit Hide","RABBIT_HIDE"],["Rabbit Spawn Egg","RABBIT_SPAWN_EGG"],["Rabbit Stew","RABBIT_STEW"],["Raiser Armor Trim Smithing Template","RAISER_ARMOR_TRIM_SMITHING_TEMPLATE"],["Ravager Spawn Egg","RAVAGER_SPAWN_EGG"],["Raw Copper","RAW_COPPER"],["Raw Copper Block","RAW_COPPER_BLOCK"],["Raw Gold","RAW_GOLD"],["Raw Gold Block","RAW_GOLD_BLOCK"],["Raw Iron","RAW_IRON"],["Raw Iron Block","RAW_IRON_BLOCK"],["Recovery Compass","RECOVERY_COMPASS"],["Redstone","REDSTONE"],["Redstone Wall Torch","REDSTONE_WALL_TORCH"],["Red Bundle","RED_BUNDLE"],["Red Candle Cake","RED_CANDLE_CAKE"],["Red Dye","RED_DYE"],["Red Harness","RED_HARNESS"],["Red Mushroom","RED_MUSHROOM"],["Red Mushroom Block","RED_MUSHROOM_BLOCK"],["Red Sandstone","RED_SANDSTONE"],["Red Tulip","RED_TULIP"],["Reinforced Deepslate","REINFORCED_DEEPSLATE"],["Repeating Command Block","REPEATING_COMMAND_BLOCK"],["Resin Block","RESIN_BLOCK"],["Resin Brick","RESIN_BRICK"],["Resin Bricks","RESIN_BRICKS"],["Resin Clump","RESIN_CLUMP"],["Respawn Anchor","RESPAWN_ANCHOR"],["Rib Armor Trim Smithing Template","RIB_ARMOR_TRIM_SMITHING_TEMPLATE"],["Rose Bush","ROSE_BUSH"],["Rotten Flesh","ROTTEN_FLESH"],["Saddle","SADDLE"],["Salmon","SALMON"],["Salmon Bucket","SALMON_BUCKET"],["Salmon Spawn Egg","SALMON_SPAWN_EGG"],["Sandstone","SANDSTONE"],["Scaffolding","SCAFFOLDING"],["Scrape Pottery Sherd","SCRAPE_POTTERY_SHERD"],["Sculk","SCULK"],["Sculk Catalyst","SCULK_CATALYST"],["Sculk Sensor","SCULK_SENSOR"],["Sculk Shrieker","SCULK_SHRIEKER"],["Sculk Vein","SCULK_VEIN"],["Seagrass","SEAGRASS"],["Sea Lantern","SEA_LANTERN"],["Sea Pickle","SEA_PICKLE"],["Sentry Armor Trim Smithing Template","SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE"],["Shaper Armor Trim Smithing Template","SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE"],["Sheaf Pottery Sherd","SHEAF_POTTERY_SHERD"],["Shears","SHEARS"],["Sheep Spawn Egg","SHEEP_SPAWN_EGG"],["Shelter Pottery Sherd","SHELTER_POTTERY_SHERD"],["Shield","SHIELD"],["Short Dry Grass","SHORT_DRY_GRASS"],["Short Grass","SHORT_GRASS"],["Shroomlight","SHROOMLIGHT"],["Shulker Box","SHULKER_BOX"],["Shulker Shell","SHULKER_SHELL"],["Shulker Spawn Egg","SHULKER_SPAWN_EGG"],["Silence Armor Trim Smithing Template","SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Silverfish Spawn Egg","SILVERFISH_SPAWN_EGG"],["Skeleton Horse Spawn Egg","SKELETON_HORSE_SPAWN_EGG"],["Skeleton Skull","SKELETON_SKULL"],["Skeleton Spawn Egg","SKELETON_SPAWN_EGG"],["Skeleton Wall Skull","SKELETON_WALL_SKULL"],["Skull Banner Pattern","SKULL_BANNER_PATTERN"],["Skull Pottery Sherd","SKULL_POTTERY_SHERD"],["Slime Ball","SLIME_BALL"],["Slime Spawn Egg","SLIME_SPAWN_EGG"],["Small Amethyst Bud","SMALL_AMETHYST_BUD"],["Small Dripleaf","SMALL_DRIPLEAF"],["Smithing Table","SMITHING_TABLE"],["Smoker","SMOKER"],["Smooth Basalt","SMOOTH_BASALT"],["Smooth Quartz","SMOOTH_QUARTZ"],["Smooth Red Sandstone","SMOOTH_RED_SANDSTONE"],["Smooth Sandstone","SMOOTH_SANDSTONE"],["Smooth Stone","SMOOTH_STONE"],["Sniffer Egg","SNIFFER_EGG"],["Sniffer Spawn Egg","SNIFFER_SPAWN_EGG"],["Snort Pottery Sherd","SNORT_POTTERY_SHERD"],["Snout Armor Trim Smithing Template","SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE"],["Snowball","SNOWBALL"],["Snow Golem Spawn Egg","SNOW_GOLEM_SPAWN_EGG"],["Soul Campfire","SOUL_CAMPFIRE"],["Soul Fire","SOUL_FIRE"],["Soul Lantern","SOUL_LANTERN"],["Soul Sand","SOUL_SAND"],["Soul Soil","SOUL_SOIL"],["Soul Torch","SOUL_TORCH"],["Soul Wall Torch","SOUL_WALL_TORCH"],["Spawner","SPAWNER"],["Spectral Arrow","SPECTRAL_ARROW"],["Spider Eye","SPIDER_EYE"],["Spider Spawn Egg","SPIDER_SPAWN_EGG"],["Spire Armor Trim Smithing Template","SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Splash Potion","SPLASH_POTION"],["Sponge","SPONGE"],["Spore Blossom","SPORE_BLOSSOM"],["Spruce Boat","SPRUCE_BOAT"],["Spruce Button","SPRUCE_BUTTON"],["Spruce Chest Boat","SPRUCE_CHEST_BOAT"],["Spruce Hanging Sign","SPRUCE_HANGING_SIGN"],["Spruce Leaves","SPRUCE_LEAVES"],["Spruce Pressure Plate","SPRUCE_PRESSURE_PLATE"],["Spruce Sapling","SPRUCE_SAPLING"],["Spruce Shelf","SPRUCE_SHELF"],["Spruce Sign","SPRUCE_SIGN"],["Spruce Wall Hanging Sign","SPRUCE_WALL_HANGING_SIGN"],["Spruce Wall Sign","SPRUCE_WALL_SIGN"],["Spyglass","SPYGLASS"],["Squid Spawn Egg","SQUID_SPAWN_EGG"],["Stick","STICK"],["Stonecutter","STONECUTTER"],["Stone Axe","STONE_AXE"],["Stone Button","STONE_BUTTON"],["Stone Hoe","STONE_HOE"],["Stone Pickaxe","STONE_PICKAXE"],["Stone Pressure Plate","STONE_PRESSURE_PLATE"],["Stone Shovel","STONE_SHOVEL"],["Stone Spear","STONE_SPEAR"],["Stone Sword","STONE_SWORD"],["Stray Spawn Egg","STRAY_SPAWN_EGG"],["Strider Spawn Egg","STRIDER_SPAWN_EGG"],["String","STRING"],["Stripped Pale Oak Log","STRIPPED_PALE_OAK_LOG"],["Stripped Pale Oak Wood","STRIPPED_PALE_OAK_WOOD"],["Structure Block","STRUCTURE_BLOCK"],["Structure Void","STRUCTURE_VOID"],["Sugar","SUGAR"],["Sugar Cane","SUGAR_CANE"],["Sunflower","SUNFLOWER"],["Suspicious Gravel","SUSPICIOUS_GRAVEL"],["Suspicious Sand","SUSPICIOUS_SAND"],["Suspicious Stew","SUSPICIOUS_STEW"],["Sweet Berries","SWEET_BERRIES"],["Sweet Berry Bush","SWEET_BERRY_BUSH"],["Tadpole Bucket","TADPOLE_BUCKET"],["Tadpole Spawn Egg","TADPOLE_SPAWN_EGG"],["Tall Dry Grass","TALL_DRY_GRASS"],["Tall Grass","TALL_GRASS"],["Tall Seagrass","TALL_SEAGRASS"],["Terracotta","TERRACOTTA"],["Test Block","TEST_BLOCK"],["Test Instance Block","TEST_INSTANCE_BLOCK"],["Tide Armor Trim Smithing Template","TIDE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Tipped Arrow","TIPPED_ARROW"],["Tnt","TNT"],["Tnt Minecart","TNT_MINECART"],["Torch","TORCH"],["Torchflower","TORCHFLOWER"],["Torchflower Crop","TORCHFLOWER_CROP"],["Torchflower Seeds","TORCHFLOWER_SEEDS"],["Totem Of Undying","TOTEM_OF_UNDYING"],["Trader Llama Spawn Egg","TRADER_LLAMA_SPAWN_EGG"],["Trapped Chest","TRAPPED_CHEST"],["Trial Key","TRIAL_KEY"],["Trial Spawner","TRIAL_SPAWNER"],["Trident","TRIDENT"],["Tripwire","TRIPWIRE"],["Tropical Fish","TROPICAL_FISH"],["Tropical Fish Bucket","TROPICAL_FISH_BUCKET"],["Tropical Fish Spawn Egg","TROPICAL_FISH_SPAWN_EGG"],["Tube Coral","TUBE_CORAL"],["Tube Coral Block","TUBE_CORAL_BLOCK"],["Tube Coral Fan","TUBE_CORAL_FAN"],["Tube Coral Wall Fan","TUBE_CORAL_WALL_FAN"],["Tuff Bricks","TUFF_BRICKS"],["Turtle Egg","TURTLE_EGG"],["Turtle Helmet","TURTLE_HELMET"],["Turtle Scute","TURTLE_SCUTE"],["Turtle Spawn Egg","TURTLE_SPAWN_EGG"],["Twisting Vines","TWISTING_VINES"],["Twisting Vines Plant","TWISTING_VINES_PLANT"],["Vault","VAULT"],["Verdant Froglight","VERDANT_FROGLIGHT"],["Vex Armor Trim Smithing Template","VEX_ARMOR_TRIM_SMITHING_TEMPLATE"],["Vex Spawn Egg","VEX_SPAWN_EGG"],["Villager Spawn Egg","VILLAGER_SPAWN_EGG"],["Vindicator Spawn Egg","VINDICATOR_SPAWN_EGG"],["Vine","VINE"],["Void Air","VOID_AIR"],["Wall Torch","WALL_TORCH"],["Wandering Trader Spawn Egg","WANDERING_TRADER_SPAWN_EGG"],["Warden Spawn Egg","WARDEN_SPAWN_EGG"],["Ward Armor Trim Smithing Template","WARD_ARMOR_TRIM_SMITHING_TEMPLATE"],["Warped Button","WARPED_BUTTON"],["Warped Fungus","WARPED_FUNGUS"],["Warped Fungus On A Stick","WARPED_FUNGUS_ON_A_STICK"],["Warped Hanging Sign","WARPED_HANGING_SIGN"],["Warped Nylium","WARPED_NYLIUM"],["Warped Pressure Plate","WARPED_PRESSURE_PLATE"],["Warped Roots","WARPED_ROOTS"],["Warped Shelf","WARPED_SHELF"],["Warped Sign","WARPED_SIGN"],["Warped Wall Hanging Sign","WARPED_WALL_HANGING_SIGN"],["Warped Wall Sign","WARPED_WALL_SIGN"],["Warped Wart Block","WARPED_WART_BLOCK"],["Water Bucket","WATER_BUCKET"],["Water Cauldron","WATER_CAULDRON"],["Waxed Chiseled Copper","WAXED_CHISELED_COPPER"],["Waxed Copper Bars","WAXED_COPPER_BARS"],["Waxed Copper Block","WAXED_COPPER_BLOCK"],["Waxed Copper Bulb","WAXED_COPPER_BULB"],["Waxed Copper Chain","WAXED_COPPER_CHAIN"],["Waxed Copper Chest","WAXED_COPPER_CHEST"],["Waxed Copper Golem Statue","WAXED_COPPER_GOLEM_STATUE"],["Waxed Copper Grate","WAXED_COPPER_GRATE"],["Waxed Copper Lantern","WAXED_COPPER_LANTERN"],["Waxed Cut Copper","WAXED_CUT_COPPER"],["Waxed Exposed Chiseled Copper","WAXED_EXPOSED_CHISELED_COPPER"],["Waxed Exposed Copper","WAXED_EXPOSED_COPPER"],["Waxed Exposed Copper Bars","WAXED_EXPOSED_COPPER_BARS"],["Waxed Exposed Copper Bulb","WAXED_EXPOSED_COPPER_BULB"],["Waxed Exposed Copper Chain","WAXED_EXPOSED_COPPER_CHAIN"],["Waxed Exposed Copper Chest","WAXED_EXPOSED_COPPER_CHEST"],["Waxed Exposed Copper Golem Statue","WAXED_EXPOSED_COPPER_GOLEM_STATUE"],["Waxed Exposed Copper Grate","WAXED_EXPOSED_COPPER_GRATE"],["Waxed Exposed Copper Lantern","WAXED_EXPOSED_COPPER_LANTERN"],["Waxed Exposed Cut Copper","WAXED_EXPOSED_CUT_COPPER"],["Waxed Exposed Lightning Rod","WAXED_EXPOSED_LIGHTNING_ROD"],["Waxed Lightning Rod","WAXED_LIGHTNING_ROD"],["Waxed Oxidized Chiseled Copper","WAXED_OXIDIZED_CHISELED_COPPER"],["Waxed Oxidized Copper","WAXED_OXIDIZED_COPPER"],["Waxed Oxidized Copper Bars","WAXED_OXIDIZED_COPPER_BARS"],["Waxed Oxidized Copper Bulb","WAXED_OXIDIZED_COPPER_BULB"],["Waxed Oxidized Copper Chain","WAXED_OXIDIZED_COPPER_CHAIN"],["Waxed Oxidized Copper Chest","WAXED_OXIDIZED_COPPER_CHEST"],["Waxed Oxidized Copper Golem Statue","WAXED_OXIDIZED_COPPER_GOLEM_STATUE"],["Waxed Oxidized Copper Grate","WAXED_OXIDIZED_COPPER_GRATE"],["Waxed Oxidized Copper Lantern","WAXED_OXIDIZED_COPPER_LANTERN"],["Waxed Oxidized Cut Copper","WAXED_OXIDIZED_CUT_COPPER"],["Waxed Oxidized Lightning Rod","WAXED_OXIDIZED_LIGHTNING_ROD"],["Waxed Weathered Chiseled Copper","WAXED_WEATHERED_CHISELED_COPPER"],["Waxed Weathered Copper","WAXED_WEATHERED_COPPER"],["Waxed Weathered Copper Bars","WAXED_WEATHERED_COPPER_BARS"],["Waxed Weathered Copper Bulb","WAXED_WEATHERED_COPPER_BULB"],["Waxed Weathered Copper Chain","WAXED_WEATHERED_COPPER_CHAIN"],["Waxed Weathered Copper Chest","WAXED_WEATHERED_COPPER_CHEST"],["Waxed Weathered Copper Golem Statue","WAXED_WEATHERED_COPPER_GOLEM_STATUE"],["Waxed Weathered Copper Grate","WAXED_WEATHERED_COPPER_GRATE"],["Waxed Weathered Copper Lantern","WAXED_WEATHERED_COPPER_LANTERN"],["Waxed Weathered Cut Copper","WAXED_WEATHERED_CUT_COPPER"],["Waxed Weathered Lightning Rod","WAXED_WEATHERED_LIGHTNING_ROD"],["Wayfinder Armor Trim Smithing Template","WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE"],["Weathered Chiseled Copper","WEATHERED_CHISELED_COPPER"],["Weathered Copper","WEATHERED_COPPER"],["Weathered Copper Bars","WEATHERED_COPPER_BARS"],["Weathered Copper Bulb","WEATHERED_COPPER_BULB"],["Weathered Copper Chain","WEATHERED_COPPER_CHAIN"],["Weathered Copper Chest","WEATHERED_COPPER_CHEST"],["Weathered Copper Golem Statue","WEATHERED_COPPER_GOLEM_STATUE"],["Weathered Copper Grate","WEATHERED_COPPER_GRATE"],["Weathered Copper Lantern","WEATHERED_COPPER_LANTERN"],["Weathered Cut Copper","WEATHERED_CUT_COPPER"],["Weathered Lightning Rod","WEATHERED_LIGHTNING_ROD"],["Weeping Vines","WEEPING_VINES"],["Weeping Vines Plant","WEEPING_VINES_PLANT"],["Wet Sponge","WET_SPONGE"],["Wheat","WHEAT"],["Wheat Seeds","WHEAT_SEEDS"],["White Bundle","WHITE_BUNDLE"],["White Candle Cake","WHITE_CANDLE_CAKE"],["White Dye","WHITE_DYE"],["White Harness","WHITE_HARNESS"],["White Tulip","WHITE_TULIP"],["Wildflowers","WILDFLOWERS"],["Wild Armor Trim Smithing Template","WILD_ARMOR_TRIM_SMITHING_TEMPLATE"],["Wind Charge","WIND_CHARGE"],["Witch Spawn Egg","WITCH_SPAWN_EGG"],["Wither Rose","WITHER_ROSE"],["Wither Skeleton Skull","WITHER_SKELETON_SKULL"],["Wither Skeleton Spawn Egg","WITHER_SKELETON_SPAWN_EGG"],["Wither Skeleton Wall Skull","WITHER_SKELETON_WALL_SKULL"],["Wither Spawn Egg","WITHER_SPAWN_EGG"],["Wolf Armor","WOLF_ARMOR"],["Wolf Spawn Egg","WOLF_SPAWN_EGG"],["Wooden Axe","WOODEN_AXE"],["Wooden Hoe","WOODEN_HOE"],["Wooden Pickaxe","WOODEN_PICKAXE"],["Wooden Shovel","WOODEN_SHOVEL"],["Wooden Spear","WOODEN_SPEAR"],["Wooden Sword","WOODEN_SWORD"],["Writable Book","WRITABLE_BOOK"],["Written Book","WRITTEN_BOOK"],["Yellow Bundle","YELLOW_BUNDLE"],["Yellow Candle Cake","YELLOW_CANDLE_CAKE"],["Yellow Dye","YELLOW_DYE"],["Yellow Harness","YELLOW_HARNESS"],["Zoglin Spawn Egg","ZOGLIN_SPAWN_EGG"],["Zombie Head","ZOMBIE_HEAD"],["Zombie Horse Spawn Egg","ZOMBIE_HORSE_SPAWN_EGG"],["Zombie Nautilus Spawn Egg","ZOMBIE_NAUTILUS_SPAWN_EGG"],["Zombie Spawn Egg","ZOMBIE_SPAWN_EGG"],["Zombie Villager Spawn Egg","ZOMBIE_VILLAGER_SPAWN_EGG"],["Zombie Wall Head","ZOMBIE_WALL_HEAD"],["Zombified Piglin Spawn Egg","ZOMBIFIED_PIGLIN_SPAWN_EGG"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(200),this.setTooltip("Select a miscellaneous Minecraft block or item.")}},(a=r=E.pythonGenerator).INDENT=" ",h=a.init,a.init=function(e){h.call(this,e),this.methods_=Object.create(null)},a.finish=function(e){let t=Object.values(a.methods_||{}),i=a.INDENT,o=t.length>0?"\n"+t.map(e=>a.prefixLines(e,i)).join("\n\n"):"",s=i+i,n=a.prefixLines(e,s)||s+"pass",r=new Date().toISOString();return`
|
|
332
|
+
`)),this.getInput("BLOCK_TYPE").connection.setShadowDom(s.utils.xml.textToDom(`
|
|
333
|
+
<shadow type="minecraft_picker_world">
|
|
334
|
+
<field name="MATERIAL_ID">STONE</field>
|
|
335
|
+
</shadow>
|
|
336
|
+
`))}},s.Blocks.minecraft_entity_picker_hostile_mobs={init:function(){this.appendDummyInput().appendField("Hostile Mobs").appendField(new s.FieldDropdown([["Blaze","BLAZE"],["Cave Spider","CAVE_SPIDER"],["Creeper","CREEPER"],["Elder Guardian","ELDER_GUARDIAN"],["Enderman","ENDERMAN"],["Endermite","ENDERMITE"],["Evoker","EVOKER"],["Ghast","GHAST"],["Guardian","GUARDIAN"],["Husk","HUSK"],["Illusioner","ILLUSIONER"],["Magma Cube","MAGMA_CUBE"],["Shulker","SHULKER"],["Silverfish","SILVERFISH"],["Skeleton","SKELETON"],["Slime","SLIME"],["Spider","SPIDER"],["Stray","STRAY"],["Vex","VEX"],["Vindicator","VINDICATOR"],["Witch","WITCH"],["Wither","WITHER"],["Wither Skeleton","WITHER_SKELETON"],["Zombie","ZOMBIE"],["Zombie Villager","ZOMBIE_VILLAGER"],["Zombified Piglin","ZOMBIFIED_PIGLIN"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a hostile mobs entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_minecarts={init:function(){this.appendDummyInput().appendField("Minecarts").appendField(new s.FieldDropdown([["Minecart","MINECART"],["Chest Minecart","CHEST_MINECART"],["Command Block Minecart","COMMAND_BLOCK_MINECART"],["Furnace Minecart","FURNACE_MINECART"],["Hopper Minecart","HOPPER_MINECART"],["Spawner Minecart","SPAWNER_MINECART"],["Tnt Minecart","TNT_MINECART"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a minecarts entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_miscellaneous_entities={init:function(){this.appendDummyInput().appendField("Miscellaneous Entities").appendField(new s.FieldDropdown([["Ender Dragon","ENDER_DRAGON"],["Evoker Fangs","EVOKER_FANGS"],["Giant","GIANT"],["Iron Golem","IRON_GOLEM"],["Llama","LLAMA"],["Skeleton Horse","SKELETON_HORSE"],["Snow Golem","SNOW_GOLEM"],["Tnt","TNT"],["Zombie Horse","ZOMBIE_HORSE"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a miscellaneous entities entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_passive_mobs={init:function(){this.appendDummyInput().appendField("Passive Mobs").appendField(new s.FieldDropdown([["Bat","BAT"],["Chicken","CHICKEN"],["Cow","COW"],["Donkey","DONKEY"],["Horse","HORSE"],["Mooshroom","MOOSHROOM"],["Mule","MULE"],["Ocelot","OCELOT"],["Parrot","PARROT"],["Pig","PIG"],["Polar Bear","POLAR_BEAR"],["Rabbit","RABBIT"],["Sheep","SHEEP"],["Squid","SQUID"],["Villager","VILLAGER"],["Wolf","WOLF"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a passive mobs entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_projectiles={init:function(){this.appendDummyInput().appendField("Projectiles").appendField(new s.FieldDropdown([["Arrow","ARROW"],["Dragon Fireball","DRAGON_FIREBALL"],["Egg","EGG"],["Ender Pearl","ENDER_PEARL"],["Experience Bottle","EXPERIENCE_BOTTLE"],["Fireball","FIREBALL"],["Firework Rocket","FIREWORK_ROCKET"],["Llama Spit","LLAMA_SPIT"],["Shulker Bullet","SHULKER_BULLET"],["Small Fireball","SMALL_FIREBALL"],["Snowball","SNOWBALL"],["Spectral Arrow","SPECTRAL_ARROW"],["Splash Potion","SPLASH_POTION"],["Wither Skull","WITHER_SKULL"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a projectiles entity."),this.setHelpUrl("")}},s.Blocks.minecraft_entity_picker_utility_and_special={init:function(){this.appendDummyInput().appendField("Utility And Special").appendField(new s.FieldDropdown([["Area Effect Cloud","AREA_EFFECT_CLOUD"],["Armor Stand","ARMOR_STAND"],["End Crystal","END_CRYSTAL"],["Experience Orb","EXPERIENCE_ORB"],["Eye Of Ender","EYE_OF_ENDER"],["Falling Block","FALLING_BLOCK"],["Item","ITEM"],["Item Frame","ITEM_FRAME"],["Leash Knot","LEASH_KNOT"],["Painting","PAINTING"]]),"ENTITY_ID"),this.setOutput(!0,"Entity"),this.setColour("#5b5ba5"),this.setTooltip("Select a utility and special entity."),this.setHelpUrl("")}},s.Blocks.minecraft_material_banner={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("BANNER with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Banner block that can be colored."),e.Defaults.values.minecraft_material_banner={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_bed={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("BED with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Bed block that can be colored."),e.Defaults.values.minecraft_material_bed={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_candle={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("CANDLE with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Candle block that can be colored."),e.Defaults.values.minecraft_material_candle={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_carpet={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("CARPET with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Carpet block that can be colored."),e.Defaults.values.minecraft_material_carpet={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_concrete={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("CONCRETE with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Concrete block that can be colored."),e.Defaults.values.minecraft_material_concrete={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_concrete_powder={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("CONCRETE_POWDER with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Concrete Powder block that can be colored."),e.Defaults.values.minecraft_material_concrete_powder={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_glazed_terracotta={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("GLAZED_TERRACOTTA with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Glazed Terracotta block that can be colored."),e.Defaults.values.minecraft_material_glazed_terracotta={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_shulker_box={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("SHULKER_BOX with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Shulker Box block that can be colored."),e.Defaults.values.minecraft_material_shulker_box={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_stained_glass={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("STAINED_GLASS with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Stained Glass block that can be colored."),e.Defaults.values.minecraft_material_stained_glass={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_stained_glass_pane={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("STAINED_GLASS_PANE with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Stained Glass Pane block that can be colored."),e.Defaults.values.minecraft_material_stained_glass_pane={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_terracotta={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("TERRACOTTA with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Terracotta block that can be colored."),e.Defaults.values.minecraft_material_terracotta={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_material_wool={init:function(){this.appendValueInput("COLOUR").setCheck("MinecraftColour").setAlign(s.ALIGN_RIGHT).appendField("WOOL with color"),this.setOutput(!0,"Block"),this.setColour(160),this.setTooltip("A Wool block that can be colored."),e.Defaults.values.minecraft_material_wool={COLOUR:{shadow:'<shadow type="minecraft_coloured_block_picker"><field name="MINECRAFT_COLOUR_ID">WHITE</field></shadow>'}},e.BlocklyUtils.configureShadow(this,"COLOUR")}},s.Blocks.minecraft_picker_doors={init:function(){this.appendDummyInput().appendField("Doors").appendField(new s.FieldDropdown([["Waxed Weathered Copper Door","WAXED_WEATHERED_COPPER_DOOR"],["Crimson Door","CRIMSON_DOOR"],["Cherry Door","CHERRY_DOOR"],["Pale Oak Door","PALE_OAK_DOOR"],["Dark Oak Door","DARK_OAK_DOOR"],["Exposed Copper Door","EXPOSED_COPPER_DOOR"],["Waxed Oxidized Copper Door","WAXED_OXIDIZED_COPPER_DOOR"],["Spruce Door","SPRUCE_DOOR"],["Iron Door","IRON_DOOR"],["Mangrove Door","MANGROVE_DOOR"],["Oxidized Copper Door","OXIDIZED_COPPER_DOOR"],["Weathered Copper Door","WEATHERED_COPPER_DOOR"],["Copper Door","COPPER_DOOR"],["Bamboo Door","BAMBOO_DOOR"],["Jungle Door","JUNGLE_DOOR"],["Birch Door","BIRCH_DOOR"],["Waxed Copper Door","WAXED_COPPER_DOOR"],["Waxed Exposed Copper Door","WAXED_EXPOSED_COPPER_DOOR"],["Oak Door","OAK_DOOR"],["Acacia Door","ACACIA_DOOR"],["Warped Door","WARPED_DOOR"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Doors material.")}},s.Blocks.minecraft_picker_fences={init:function(){this.appendDummyInput().appendField("Fences").appendField(new s.FieldDropdown([["Birch Fence","BIRCH_FENCE"],["Crimson Fence","CRIMSON_FENCE"],["Bamboo Fence","BAMBOO_FENCE"],["Warped Fence","WARPED_FENCE"],["Mangrove Fence","MANGROVE_FENCE"],["Acacia Fence","ACACIA_FENCE"],["Pale Oak Fence","PALE_OAK_FENCE"],["Oak Fence","OAK_FENCE"],["Spruce Fence","SPRUCE_FENCE"],["Dark Oak Fence","DARK_OAK_FENCE"],["Jungle Fence","JUNGLE_FENCE"],["Cherry Fence","CHERRY_FENCE"],["Nether Brick Fence","NETHER_BRICK_FENCE"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Fences material.")}},s.Blocks.minecraft_picker_gates={init:function(){this.appendDummyInput().appendField("Gates").appendField(new s.FieldDropdown([["Cherry Fence Gate","CHERRY_FENCE_GATE"],["Pale Oak Fence Gate","PALE_OAK_FENCE_GATE"],["Birch Fence Gate","BIRCH_FENCE_GATE"],["Oak Fence Gate","OAK_FENCE_GATE"],["Dark Oak Fence Gate","DARK_OAK_FENCE_GATE"],["Bamboo Fence Gate","BAMBOO_FENCE_GATE"],["Acacia Fence Gate","ACACIA_FENCE_GATE"],["Crimson Fence Gate","CRIMSON_FENCE_GATE"],["Warped Fence Gate","WARPED_FENCE_GATE"],["Jungle Fence Gate","JUNGLE_FENCE_GATE"],["Mangrove Fence Gate","MANGROVE_FENCE_GATE"],["Spruce Fence Gate","SPRUCE_FENCE_GATE"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Gates material.")}},s.Blocks.minecraft_picker_glass={init:function(){this.appendDummyInput().appendField("Glass").appendField(new s.FieldDropdown([["Glass","GLASS"],["Glass Pane","GLASS_PANE"],["Tinted Glass","TINTED_GLASS"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Glass material.")}},s.Blocks.minecraft_picker_ores={init:function(){this.appendDummyInput().appendField("Ores").appendField(new s.FieldDropdown([["Coal Ore","COAL_ORE"],["Deepslate Coal Ore","DEEPSLATE_COAL_ORE"],["Iron Ore","IRON_ORE"],["Deepslate Iron Ore","DEEPSLATE_IRON_ORE"],["Copper Ore","COPPER_ORE"],["Deepslate Copper Ore","DEEPSLATE_COPPER_ORE"],["Gold Ore","GOLD_ORE"],["Deepslate Gold Ore","DEEPSLATE_GOLD_ORE"],["Redstone Ore","REDSTONE_ORE"],["Deepslate Redstone Ore","DEEPSLATE_REDSTONE_ORE"],["Emerald Ore","EMERALD_ORE"],["Deepslate Emerald Ore","DEEPSLATE_EMERALD_ORE"],["Lapis Ore","LAPIS_ORE"],["Deepslate Lapis Ore","DEEPSLATE_LAPIS_ORE"],["Diamond Ore","DIAMOND_ORE"],["Deepslate Diamond Ore","DEEPSLATE_DIAMOND_ORE"],["Nether Gold Ore","NETHER_GOLD_ORE"],["Nether Quartz Ore","NETHER_QUARTZ_ORE"],["Ancient Debris","ANCIENT_DEBRIS"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Ores material.")}},s.Blocks.minecraft_picker_redstone_components={init:function(){this.appendDummyInput().appendField("Redstone Components").appendField(new s.FieldDropdown([["Redstone Wire","REDSTONE_WIRE"],["Redstone Block","REDSTONE_BLOCK"],["Redstone Torch","REDSTONE_TORCH"],["Repeater","REPEATER"],["Comparator","COMPARATOR"],["Piston","PISTON"],["Sticky Piston","STICKY_PISTON"],["Slime Block","SLIME_BLOCK"],["Honey Block","HONEY_BLOCK"],["Observer","OBSERVER"],["Dropper","DROPPER"],["Dispenser","DISPENSER"],["Hopper","HOPPER"],["Lectern","LECTERN"],["Lever","LEVER"],["Daylight Detector","DAYLIGHT_DETECTOR"],["Tripwire Hook","TRIPWIRE_HOOK"],["Target","TARGET"],["Note Block","NOTE_BLOCK"],["Rail","RAIL"],["Powered Rail","POWERED_RAIL"],["Detector Rail","DETECTOR_RAIL"],["Activator Rail","ACTIVATOR_RAIL"],["Redstone Lamp","REDSTONE_LAMP"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Redstone Components material.")}},s.Blocks.minecraft_picker_slabs={init:function(){this.appendDummyInput().appendField("Slabs").appendField(new s.FieldDropdown([["Bamboo Mosaic Slab","BAMBOO_MOSAIC_SLAB"],["Deepslate Tile Slab","DEEPSLATE_TILE_SLAB"],["Exposed Cut Copper Slab","EXPOSED_CUT_COPPER_SLAB"],["Cherry Slab","CHERRY_SLAB"],["Polished Deepslate Slab","POLISHED_DEEPSLATE_SLAB"],["Sandstone Slab","SANDSTONE_SLAB"],["Acacia Slab","ACACIA_SLAB"],["Bamboo Slab","BAMBOO_SLAB"],["Polished Blackstone Slab","POLISHED_BLACKSTONE_SLAB"],["Smooth Sandstone Slab","SMOOTH_SANDSTONE_SLAB"],["Petrified Oak Slab","PETRIFIED_OAK_SLAB"],["Andesite Slab","ANDESITE_SLAB"],["Blackstone Slab","BLACKSTONE_SLAB"],["Smooth Stone Slab","SMOOTH_STONE_SLAB"],["Oxidized Cut Copper Slab","OXIDIZED_CUT_COPPER_SLAB"],["End Stone Brick Slab","END_STONE_BRICK_SLAB"],["Smooth Quartz Slab","SMOOTH_QUARTZ_SLAB"],["Oak Slab","OAK_SLAB"],["Waxed Cut Copper Slab","WAXED_CUT_COPPER_SLAB"],["Purpur Slab","PURPUR_SLAB"],["Cobbled Deepslate Slab","COBBLED_DEEPSLATE_SLAB"],["Dark Prismarine Slab","DARK_PRISMARINE_SLAB"],["Dark Oak Slab","DARK_OAK_SLAB"],["Birch Slab","BIRCH_SLAB"],["Cut Copper Slab","CUT_COPPER_SLAB"],["Brick Slab","BRICK_SLAB"],["Polished Andesite Slab","POLISHED_ANDESITE_SLAB"],["Pale Oak Slab","PALE_OAK_SLAB"],["Polished Granite Slab","POLISHED_GRANITE_SLAB"],["Mud Brick Slab","MUD_BRICK_SLAB"],["Quartz Slab","QUARTZ_SLAB"],["Waxed Exposed Cut Copper Slab","WAXED_EXPOSED_CUT_COPPER_SLAB"],["Jungle Slab","JUNGLE_SLAB"],["Smooth Red Sandstone Slab","SMOOTH_RED_SANDSTONE_SLAB"],["Deepslate Brick Slab","DEEPSLATE_BRICK_SLAB"],["Mangrove Slab","MANGROVE_SLAB"],["Tuff Brick Slab","TUFF_BRICK_SLAB"],["Warped Slab","WARPED_SLAB"],["Polished Diorite Slab","POLISHED_DIORITE_SLAB"],["Polished Blackstone Brick Slab","POLISHED_BLACKSTONE_BRICK_SLAB"],["Polished Tuff Slab","POLISHED_TUFF_SLAB"],["Red Nether Brick Slab","RED_NETHER_BRICK_SLAB"],["Nether Brick Slab","NETHER_BRICK_SLAB"],["Weathered Cut Copper Slab","WEATHERED_CUT_COPPER_SLAB"],["Resin Brick Slab","RESIN_BRICK_SLAB"],["Prismarine Brick Slab","PRISMARINE_BRICK_SLAB"],["Spruce Slab","SPRUCE_SLAB"],["Stone Slab","STONE_SLAB"],["Granite Slab","GRANITE_SLAB"],["Tuff Slab","TUFF_SLAB"],["Mossy Stone Brick Slab","MOSSY_STONE_BRICK_SLAB"],["Stone Brick Slab","STONE_BRICK_SLAB"],["Mossy Cobblestone Slab","MOSSY_COBBLESTONE_SLAB"],["Cobblestone Slab","COBBLESTONE_SLAB"],["Red Sandstone Slab","RED_SANDSTONE_SLAB"],["Prismarine Slab","PRISMARINE_SLAB"],["Waxed Weathered Cut Copper Slab","WAXED_WEATHERED_CUT_COPPER_SLAB"],["Waxed Oxidized Cut Copper Slab","WAXED_OXIDIZED_CUT_COPPER_SLAB"],["Crimson Slab","CRIMSON_SLAB"],["Diorite Slab","DIORITE_SLAB"],["Cut Red Sandstone Slab","CUT_RED_SANDSTONE_SLAB"],["Cut Sandstone Slab","CUT_SANDSTONE_SLAB"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Slabs material.")}},s.Blocks.minecraft_picker_stairs={init:function(){this.appendDummyInput().appendField("Stairs").appendField(new s.FieldDropdown([["Polished Granite Stairs","POLISHED_GRANITE_STAIRS"],["Polished Tuff Stairs","POLISHED_TUFF_STAIRS"],["Waxed Exposed Cut Copper Stairs","WAXED_EXPOSED_CUT_COPPER_STAIRS"],["Waxed Cut Copper Stairs","WAXED_CUT_COPPER_STAIRS"],["Stone Stairs","STONE_STAIRS"],["Tuff Stairs","TUFF_STAIRS"],["Polished Blackstone Brick Stairs","POLISHED_BLACKSTONE_BRICK_STAIRS"],["Bamboo Stairs","BAMBOO_STAIRS"],["Mangrove Stairs","MANGROVE_STAIRS"],["Brick Stairs","BRICK_STAIRS"],["Oak Stairs","OAK_STAIRS"],["Tuff Brick Stairs","TUFF_BRICK_STAIRS"],["Mossy Cobblestone Stairs","MOSSY_COBBLESTONE_STAIRS"],["Jungle Stairs","JUNGLE_STAIRS"],["Purpur Stairs","PURPUR_STAIRS"],["Prismarine Stairs","PRISMARINE_STAIRS"],["Cherry Stairs","CHERRY_STAIRS"],["Waxed Oxidized Cut Copper Stairs","WAXED_OXIDIZED_CUT_COPPER_STAIRS"],["Polished Diorite Stairs","POLISHED_DIORITE_STAIRS"],["Stone Brick Stairs","STONE_BRICK_STAIRS"],["Crimson Stairs","CRIMSON_STAIRS"],["Red Nether Brick Stairs","RED_NETHER_BRICK_STAIRS"],["Cobblestone Stairs","COBBLESTONE_STAIRS"],["Polished Andesite Stairs","POLISHED_ANDESITE_STAIRS"],["Oxidized Cut Copper Stairs","OXIDIZED_CUT_COPPER_STAIRS"],["Sandstone Stairs","SANDSTONE_STAIRS"],["Mud Brick Stairs","MUD_BRICK_STAIRS"],["Deepslate Tile Stairs","DEEPSLATE_TILE_STAIRS"],["Spruce Stairs","SPRUCE_STAIRS"],["Smooth Quartz Stairs","SMOOTH_QUARTZ_STAIRS"],["Waxed Weathered Cut Copper Stairs","WAXED_WEATHERED_CUT_COPPER_STAIRS"],["Acacia Stairs","ACACIA_STAIRS"],["Diorite Stairs","DIORITE_STAIRS"],["Quartz Stairs","QUARTZ_STAIRS"],["Pale Oak Stairs","PALE_OAK_STAIRS"],["Dark Prismarine Stairs","DARK_PRISMARINE_STAIRS"],["Cut Copper Stairs","CUT_COPPER_STAIRS"],["Smooth Red Sandstone Stairs","SMOOTH_RED_SANDSTONE_STAIRS"],["Mossy Stone Brick Stairs","MOSSY_STONE_BRICK_STAIRS"],["Exposed Cut Copper Stairs","EXPOSED_CUT_COPPER_STAIRS"],["Birch Stairs","BIRCH_STAIRS"],["Prismarine Brick Stairs","PRISMARINE_BRICK_STAIRS"],["Weathered Cut Copper Stairs","WEATHERED_CUT_COPPER_STAIRS"],["End Stone Brick Stairs","END_STONE_BRICK_STAIRS"],["Warped Stairs","WARPED_STAIRS"],["Smooth Sandstone Stairs","SMOOTH_SANDSTONE_STAIRS"],["Andesite Stairs","ANDESITE_STAIRS"],["Resin Brick Stairs","RESIN_BRICK_STAIRS"],["Polished Blackstone Stairs","POLISHED_BLACKSTONE_STAIRS"],["Polished Deepslate Stairs","POLISHED_DEEPSLATE_STAIRS"],["Cobbled Deepslate Stairs","COBBLED_DEEPSLATE_STAIRS"],["Deepslate Brick Stairs","DEEPSLATE_BRICK_STAIRS"],["Granite Stairs","GRANITE_STAIRS"],["Red Sandstone Stairs","RED_SANDSTONE_STAIRS"],["Blackstone Stairs","BLACKSTONE_STAIRS"],["Dark Oak Stairs","DARK_OAK_STAIRS"],["Nether Brick Stairs","NETHER_BRICK_STAIRS"],["Bamboo Mosaic Stairs","BAMBOO_MOSAIC_STAIRS"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Stairs material.")}},s.Blocks.minecraft_picker_stone_bricks={init:function(){this.appendDummyInput().appendField("Stone Bricks").appendField(new s.FieldDropdown([["Bricks","BRICKS"],["Stone Bricks","STONE_BRICKS"],["Mud Bricks","MUD_BRICKS"],["Deepslate Bricks","DEEPSLATE_BRICKS"],["Deepslate Tiles","DEEPSLATE_TILES"],["Nether Bricks","NETHER_BRICKS"],["Red Nether Bricks","RED_NETHER_BRICKS"],["Polished Blackstone Bricks","POLISHED_BLACKSTONE_BRICKS"],["End Stone Bricks","END_STONE_BRICKS"],["Quartz Bricks","QUARTZ_BRICKS"],["Chiseled Stone Bricks","CHISELED_STONE_BRICKS"],["Cracked Stone Bricks","CRACKED_STONE_BRICKS"],["Mossy Stone Bricks","MOSSY_STONE_BRICKS"],["Chiseled Nether Bricks","CHISELED_NETHER_BRICKS"],["Cracked Nether Bricks","CRACKED_NETHER_BRICKS"],["Chiseled Polished Blackstone","CHISELED_POLISHED_BLACKSTONE"],["Cracked Polished Blackstone Bricks","CRACKED_POLISHED_BLACKSTONE_BRICKS"],["Chiseled Deepslate","CHISELED_DEEPSLATE"],["Cracked Deepslate Bricks","CRACKED_DEEPSLATE_BRICKS"],["Cracked Deepslate Tiles","CRACKED_DEEPSLATE_TILES"],["Chiseled Tuff Bricks","CHISELED_TUFF_BRICKS"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Stone Bricks material.")}},s.Blocks.minecraft_picker_trapdoors={init:function(){this.appendDummyInput().appendField("Trapdoors").appendField(new s.FieldDropdown([["Oak Trapdoor","OAK_TRAPDOOR"],["Iron Trapdoor","IRON_TRAPDOOR"],["Bamboo Trapdoor","BAMBOO_TRAPDOOR"],["Warped Trapdoor","WARPED_TRAPDOOR"],["Copper Trapdoor","COPPER_TRAPDOOR"],["Spruce Trapdoor","SPRUCE_TRAPDOOR"],["Crimson Trapdoor","CRIMSON_TRAPDOOR"],["Weathered Copper Trapdoor","WEATHERED_COPPER_TRAPDOOR"],["Cherry Trapdoor","CHERRY_TRAPDOOR"],["Birch Trapdoor","BIRCH_TRAPDOOR"],["Waxed Oxidized Copper Trapdoor","WAXED_OXIDIZED_COPPER_TRAPDOOR"],["Waxed Copper Trapdoor","WAXED_COPPER_TRAPDOOR"],["Jungle Trapdoor","JUNGLE_TRAPDOOR"],["Dark Oak Trapdoor","DARK_OAK_TRAPDOOR"],["Acacia Trapdoor","ACACIA_TRAPDOOR"],["Pale Oak Trapdoor","PALE_OAK_TRAPDOOR"],["Oxidized Copper Trapdoor","OXIDIZED_COPPER_TRAPDOOR"],["Waxed Weathered Copper Trapdoor","WAXED_WEATHERED_COPPER_TRAPDOOR"],["Mangrove Trapdoor","MANGROVE_TRAPDOOR"],["Exposed Copper Trapdoor","EXPOSED_COPPER_TRAPDOOR"],["Waxed Exposed Copper Trapdoor","WAXED_EXPOSED_COPPER_TRAPDOOR"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Trapdoors material.")}},s.Blocks.minecraft_picker_walls={init:function(){this.appendDummyInput().appendField("Walls").appendField(new s.FieldDropdown([["Polished Blackstone Brick Wall","POLISHED_BLACKSTONE_BRICK_WALL"],["Blackstone Wall","BLACKSTONE_WALL"],["Resin Brick Wall","RESIN_BRICK_WALL"],["Cobblestone Wall","COBBLESTONE_WALL"],["Cobbled Deepslate Wall","COBBLED_DEEPSLATE_WALL"],["Deepslate Brick Wall","DEEPSLATE_BRICK_WALL"],["End Stone Brick Wall","END_STONE_BRICK_WALL"],["Mud Brick Wall","MUD_BRICK_WALL"],["Deepslate Tile Wall","DEEPSLATE_TILE_WALL"],["Polished Deepslate Wall","POLISHED_DEEPSLATE_WALL"],["Red Sandstone Wall","RED_SANDSTONE_WALL"],["Nether Brick Wall","NETHER_BRICK_WALL"],["Polished Blackstone Wall","POLISHED_BLACKSTONE_WALL"],["Polished Tuff Wall","POLISHED_TUFF_WALL"],["Tuff Brick Wall","TUFF_BRICK_WALL"],["Tuff Wall","TUFF_WALL"],["Red Nether Brick Wall","RED_NETHER_BRICK_WALL"],["Andesite Wall","ANDESITE_WALL"],["Prismarine Wall","PRISMARINE_WALL"],["Sandstone Wall","SANDSTONE_WALL"],["Diorite Wall","DIORITE_WALL"],["Stone Brick Wall","STONE_BRICK_WALL"],["Brick Wall","BRICK_WALL"],["Mossy Cobblestone Wall","MOSSY_COBBLESTONE_WALL"],["Mossy Stone Brick Wall","MOSSY_STONE_BRICK_WALL"],["Granite Wall","GRANITE_WALL"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Walls material.")}},s.Blocks.minecraft_picker_wood_full={init:function(){this.appendDummyInput().appendField("Wood Full").appendField(new s.FieldDropdown([["Oak Wood","OAK_WOOD"],["Spruce Wood","SPRUCE_WOOD"],["Birch Wood","BIRCH_WOOD"],["Jungle Wood","JUNGLE_WOOD"],["Acacia Wood","ACACIA_WOOD"],["Dark Oak Wood","DARK_OAK_WOOD"],["Mangrove Wood","MANGROVE_WOOD"],["Cherry Wood","CHERRY_WOOD"],["Crimson Hyphae","CRIMSON_HYPHAE"],["Warped Hyphae","WARPED_HYPHAE"],["Stripped Oak Wood","STRIPPED_OAK_WOOD"],["Stripped Spruce Wood","STRIPPED_SPRUCE_WOOD"],["Stripped Birch Wood","STRIPPED_BIRCH_WOOD"],["Stripped Jungle Wood","STRIPPED_JUNGLE_WOOD"],["Stripped Acacia Wood","STRIPPED_ACACIA_WOOD"],["Stripped Dark Oak Wood","STRIPPED_DARK_OAK_WOOD"],["Stripped Mangrove Wood","STRIPPED_MANGROVE_WOOD"],["Stripped Cherry Wood","STRIPPED_CHERRY_WOOD"],["Stripped Crimson Hyphae","STRIPPED_CRIMSON_HYPHAE"],["Stripped Warped Hyphae","STRIPPED_WARPED_HYPHAE"],["Bamboo Block","BAMBOO_BLOCK"],["Stripped Bamboo Block","STRIPPED_BAMBOO_BLOCK"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Wood Full material.")}},s.Blocks.minecraft_picker_wood_logs={init:function(){this.appendDummyInput().appendField("Wood Logs").appendField(new s.FieldDropdown([["Oak Log","OAK_LOG"],["Spruce Log","SPRUCE_LOG"],["Birch Log","BIRCH_LOG"],["Jungle Log","JUNGLE_LOG"],["Acacia Log","ACACIA_LOG"],["Dark Oak Log","DARK_OAK_LOG"],["Mangrove Log","MANGROVE_LOG"],["Cherry Log","CHERRY_LOG"],["Crimson Stem","CRIMSON_STEM"],["Warped Stem","WARPED_STEM"],["Stripped Oak Log","STRIPPED_OAK_LOG"],["Stripped Spruce Log","STRIPPED_SPRUCE_LOG"],["Stripped Birch Log","STRIPPED_BIRCH_LOG"],["Stripped Jungle Log","STRIPPED_JUNGLE_LOG"],["Stripped Acacia Log","STRIPPED_ACACIA_LOG"],["Stripped Dark Oak Log","STRIPPED_DARK_OAK_LOG"],["Stripped Mangrove Log","STRIPPED_MANGROVE_LOG"],["Stripped Cherry Log","STRIPPED_CHERRY_LOG"],["Stripped Crimson Stem","STRIPPED_CRIMSON_STEM"],["Stripped Warped Stem","STRIPPED_WARPED_STEM"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Wood Logs material.")}},s.Blocks.minecraft_picker_wood_planks={init:function(){this.appendDummyInput().appendField("Wood Planks").appendField(new s.FieldDropdown([["Oak Planks","OAK_PLANKS"],["Spruce Planks","SPRUCE_PLANKS"],["Birch Planks","BIRCH_PLANKS"],["Jungle Planks","JUNGLE_PLANKS"],["Acacia Planks","ACACIA_PLANKS"],["Dark Oak Planks","DARK_OAK_PLANKS"],["Mangrove Planks","MANGROVE_PLANKS"],["Cherry Planks","CHERRY_PLANKS"],["Bamboo Planks","BAMBOO_PLANKS"],["Crimson Planks","CRIMSON_PLANKS"],["Warped Planks","WARPED_PLANKS"],["Bamboo Mosaic","BAMBOO_MOSAIC"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a Wood Planks material.")}},s.Blocks.minecraft_picker_world={init:function(){this.appendDummyInput().appendField("World").appendField(new s.FieldDropdown([["Air","AIR"],["Stone","STONE"],["Granite","GRANITE"],["Diorite","DIORITE"],["Andesite","ANDESITE"],["Deepslate","DEEPSLATE"],["Calcite","CALCITE"],["Tuff","TUFF"],["Dirt","DIRT"],["Coarse Dirt","COARSE_DIRT"],["Rooted Dirt","ROOTED_DIRT"],["Grass Block","GRASS_BLOCK"],["Podzol","PODZOL"],["Mycelium","MYCELIUM"],["Dirt Path","DIRT_PATH"],["Sand","SAND"],["Red Sand","RED_SAND"],["Gravel","GRAVEL"],["Clay","CLAY"],["Ice","ICE"],["Packed Ice","PACKED_ICE"],["Blue Ice","BLUE_ICE"],["Snow","SNOW"],["Snow Block","SNOW_BLOCK"],["Water","WATER"],["Lava","LAVA"],["Bedrock","BEDROCK"],["Obsidian","OBSIDIAN"],["Crying Obsidian","CRYING_OBSIDIAN"],["Magma Block","MAGMA_BLOCK"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(180),this.setTooltip("Select a World material.")}},s.Blocks.minecraft_picker_miscellaneous={init:function(){this.appendDummyInput().appendField("Misc. Block/Item").appendField(new s.FieldDropdown([["Acacia Boat","ACACIA_BOAT"],["Acacia Button","ACACIA_BUTTON"],["Acacia Chest Boat","ACACIA_CHEST_BOAT"],["Acacia Hanging Sign","ACACIA_HANGING_SIGN"],["Acacia Leaves","ACACIA_LEAVES"],["Acacia Pressure Plate","ACACIA_PRESSURE_PLATE"],["Acacia Sapling","ACACIA_SAPLING"],["Acacia Shelf","ACACIA_SHELF"],["Acacia Sign","ACACIA_SIGN"],["Acacia Wall Hanging Sign","ACACIA_WALL_HANGING_SIGN"],["Acacia Wall Sign","ACACIA_WALL_SIGN"],["Allay Spawn Egg","ALLAY_SPAWN_EGG"],["Allium","ALLIUM"],["Amethyst Block","AMETHYST_BLOCK"],["Amethyst Cluster","AMETHYST_CLUSTER"],["Amethyst Shard","AMETHYST_SHARD"],["Angler Pottery Sherd","ANGLER_POTTERY_SHERD"],["Anvil","ANVIL"],["Apple","APPLE"],["Archer Pottery Sherd","ARCHER_POTTERY_SHERD"],["Armadillo Scute","ARMADILLO_SCUTE"],["Armadillo Spawn Egg","ARMADILLO_SPAWN_EGG"],["Armor Stand","ARMOR_STAND"],["Arms Up Pottery Sherd","ARMS_UP_POTTERY_SHERD"],["Arrow","ARROW"],["Attached Melon Stem","ATTACHED_MELON_STEM"],["Attached Pumpkin Stem","ATTACHED_PUMPKIN_STEM"],["Axolotl Bucket","AXOLOTL_BUCKET"],["Axolotl Spawn Egg","AXOLOTL_SPAWN_EGG"],["Azalea","AZALEA"],["Azalea Leaves","AZALEA_LEAVES"],["Azure Bluet","AZURE_BLUET"],["Baked Potato","BAKED_POTATO"],["Bamboo","BAMBOO"],["Bamboo Button","BAMBOO_BUTTON"],["Bamboo Chest Raft","BAMBOO_CHEST_RAFT"],["Bamboo Hanging Sign","BAMBOO_HANGING_SIGN"],["Bamboo Pressure Plate","BAMBOO_PRESSURE_PLATE"],["Bamboo Raft","BAMBOO_RAFT"],["Bamboo Sapling","BAMBOO_SAPLING"],["Bamboo Shelf","BAMBOO_SHELF"],["Bamboo Sign","BAMBOO_SIGN"],["Bamboo Wall Hanging Sign","BAMBOO_WALL_HANGING_SIGN"],["Bamboo Wall Sign","BAMBOO_WALL_SIGN"],["Barrel","BARREL"],["Barrier","BARRIER"],["Basalt","BASALT"],["Bat Spawn Egg","BAT_SPAWN_EGG"],["Beacon","BEACON"],["Beef","BEEF"],["Beehive","BEEHIVE"],["Beetroot","BEETROOT"],["Beetroots","BEETROOTS"],["Beetroot Seeds","BEETROOT_SEEDS"],["Beetroot Soup","BEETROOT_SOUP"],["Bee Nest","BEE_NEST"],["Bee Spawn Egg","BEE_SPAWN_EGG"],["Bell","BELL"],["Big Dripleaf","BIG_DRIPLEAF"],["Big Dripleaf Stem","BIG_DRIPLEAF_STEM"],["Birch Boat","BIRCH_BOAT"],["Birch Button","BIRCH_BUTTON"],["Birch Chest Boat","BIRCH_CHEST_BOAT"],["Birch Hanging Sign","BIRCH_HANGING_SIGN"],["Birch Leaves","BIRCH_LEAVES"],["Birch Pressure Plate","BIRCH_PRESSURE_PLATE"],["Birch Sapling","BIRCH_SAPLING"],["Birch Shelf","BIRCH_SHELF"],["Birch Sign","BIRCH_SIGN"],["Birch Wall Hanging Sign","BIRCH_WALL_HANGING_SIGN"],["Birch Wall Sign","BIRCH_WALL_SIGN"],["Blackstone","BLACKSTONE"],["Black Bundle","BLACK_BUNDLE"],["Black Candle Cake","BLACK_CANDLE_CAKE"],["Black Dye","BLACK_DYE"],["Black Harness","BLACK_HARNESS"],["Blade Pottery Sherd","BLADE_POTTERY_SHERD"],["Blast Furnace","BLAST_FURNACE"],["Blaze Powder","BLAZE_POWDER"],["Blaze Rod","BLAZE_ROD"],["Blaze Spawn Egg","BLAZE_SPAWN_EGG"],["Blue Bundle","BLUE_BUNDLE"],["Blue Candle Cake","BLUE_CANDLE_CAKE"],["Blue Dye","BLUE_DYE"],["Blue Egg","BLUE_EGG"],["Blue Harness","BLUE_HARNESS"],["Blue Orchid","BLUE_ORCHID"],["Bogged Spawn Egg","BOGGED_SPAWN_EGG"],["Bolt Armor Trim Smithing Template","BOLT_ARMOR_TRIM_SMITHING_TEMPLATE"],["Bone","BONE"],["Bone Block","BONE_BLOCK"],["Bone Meal","BONE_MEAL"],["Book","BOOK"],["Bookshelf","BOOKSHELF"],["Bordure Indented Banner Pattern","BORDURE_INDENTED_BANNER_PATTERN"],["Bow","BOW"],["Bowl","BOWL"],["Brain Coral","BRAIN_CORAL"],["Brain Coral Block","BRAIN_CORAL_BLOCK"],["Brain Coral Fan","BRAIN_CORAL_FAN"],["Brain Coral Wall Fan","BRAIN_CORAL_WALL_FAN"],["Bread","BREAD"],["Breeze Rod","BREEZE_ROD"],["Breeze Spawn Egg","BREEZE_SPAWN_EGG"],["Brewer Pottery Sherd","BREWER_POTTERY_SHERD"],["Brewing Stand","BREWING_STAND"],["Brick","BRICK"],["Brown Bundle","BROWN_BUNDLE"],["Brown Candle Cake","BROWN_CANDLE_CAKE"],["Brown Dye","BROWN_DYE"],["Brown Egg","BROWN_EGG"],["Brown Harness","BROWN_HARNESS"],["Brown Mushroom","BROWN_MUSHROOM"],["Brown Mushroom Block","BROWN_MUSHROOM_BLOCK"],["Brush","BRUSH"],["Bubble Column","BUBBLE_COLUMN"],["Bubble Coral","BUBBLE_CORAL"],["Bubble Coral Block","BUBBLE_CORAL_BLOCK"],["Bubble Coral Fan","BUBBLE_CORAL_FAN"],["Bubble Coral Wall Fan","BUBBLE_CORAL_WALL_FAN"],["Bucket","BUCKET"],["Budding Amethyst","BUDDING_AMETHYST"],["Bundle","BUNDLE"],["Burn Pottery Sherd","BURN_POTTERY_SHERD"],["Bush","BUSH"],["Cactus","CACTUS"],["Cactus Flower","CACTUS_FLOWER"],["Cake","CAKE"],["Calibrated Sculk Sensor","CALIBRATED_SCULK_SENSOR"],["Camel Husk Spawn Egg","CAMEL_HUSK_SPAWN_EGG"],["Camel Spawn Egg","CAMEL_SPAWN_EGG"],["Campfire","CAMPFIRE"],["Candle","CANDLE"],["Candle Cake","CANDLE_CAKE"],["Carrot","CARROT"],["Carrots","CARROTS"],["Carrot On A Stick","CARROT_ON_A_STICK"],["Cartography Table","CARTOGRAPHY_TABLE"],["Carved Pumpkin","CARVED_PUMPKIN"],["Cat Spawn Egg","CAT_SPAWN_EGG"],["Cauldron","CAULDRON"],["Cave Air","CAVE_AIR"],["Cave Spider Spawn Egg","CAVE_SPIDER_SPAWN_EGG"],["Cave Vines","CAVE_VINES"],["Cave Vines Plant","CAVE_VINES_PLANT"],["Chainmail Boots","CHAINMAIL_BOOTS"],["Chainmail Chestplate","CHAINMAIL_CHESTPLATE"],["Chainmail Helmet","CHAINMAIL_HELMET"],["Chainmail Leggings","CHAINMAIL_LEGGINGS"],["Chain Command Block","CHAIN_COMMAND_BLOCK"],["Charcoal","CHARCOAL"],["Cherry Boat","CHERRY_BOAT"],["Cherry Button","CHERRY_BUTTON"],["Cherry Chest Boat","CHERRY_CHEST_BOAT"],["Cherry Hanging Sign","CHERRY_HANGING_SIGN"],["Cherry Leaves","CHERRY_LEAVES"],["Cherry Pressure Plate","CHERRY_PRESSURE_PLATE"],["Cherry Sapling","CHERRY_SAPLING"],["Cherry Shelf","CHERRY_SHELF"],["Cherry Sign","CHERRY_SIGN"],["Cherry Wall Hanging Sign","CHERRY_WALL_HANGING_SIGN"],["Cherry Wall Sign","CHERRY_WALL_SIGN"],["Chest","CHEST"],["Chest Minecart","CHEST_MINECART"],["Chicken","CHICKEN"],["Chicken Spawn Egg","CHICKEN_SPAWN_EGG"],["Chipped Anvil","CHIPPED_ANVIL"],["Chiseled Bookshelf","CHISELED_BOOKSHELF"],["Chiseled Copper","CHISELED_COPPER"],["Chiseled Quartz Block","CHISELED_QUARTZ_BLOCK"],["Chiseled Red Sandstone","CHISELED_RED_SANDSTONE"],["Chiseled Resin Bricks","CHISELED_RESIN_BRICKS"],["Chiseled Sandstone","CHISELED_SANDSTONE"],["Chiseled Tuff","CHISELED_TUFF"],["Chorus Flower","CHORUS_FLOWER"],["Chorus Fruit","CHORUS_FRUIT"],["Chorus Plant","CHORUS_PLANT"],["Clay Ball","CLAY_BALL"],["Clock","CLOCK"],["Closed Eyeblossom","CLOSED_EYEBLOSSOM"],["Coal","COAL"],["Coal Block","COAL_BLOCK"],["Coast Armor Trim Smithing Template","COAST_ARMOR_TRIM_SMITHING_TEMPLATE"],["Cobbled Deepslate","COBBLED_DEEPSLATE"],["Cobblestone","COBBLESTONE"],["Cobweb","COBWEB"],["Cocoa","COCOA"],["Cocoa Beans","COCOA_BEANS"],["Cod","COD"],["Cod Bucket","COD_BUCKET"],["Cod Spawn Egg","COD_SPAWN_EGG"],["Command Block","COMMAND_BLOCK"],["Command Block Minecart","COMMAND_BLOCK_MINECART"],["Compass","COMPASS"],["Composter","COMPOSTER"],["Conduit","CONDUIT"],["Cooked Beef","COOKED_BEEF"],["Cooked Chicken","COOKED_CHICKEN"],["Cooked Cod","COOKED_COD"],["Cooked Mutton","COOKED_MUTTON"],["Cooked Porkchop","COOKED_PORKCHOP"],["Cooked Rabbit","COOKED_RABBIT"],["Cooked Salmon","COOKED_SALMON"],["Cookie","COOKIE"],["Copper Axe","COPPER_AXE"],["Copper Bars","COPPER_BARS"],["Copper Block","COPPER_BLOCK"],["Copper Boots","COPPER_BOOTS"],["Copper Bulb","COPPER_BULB"],["Copper Chain","COPPER_CHAIN"],["Copper Chest","COPPER_CHEST"],["Copper Chestplate","COPPER_CHESTPLATE"],["Copper Golem Spawn Egg","COPPER_GOLEM_SPAWN_EGG"],["Copper Golem Statue","COPPER_GOLEM_STATUE"],["Copper Grate","COPPER_GRATE"],["Copper Helmet","COPPER_HELMET"],["Copper Hoe","COPPER_HOE"],["Copper Horse Armor","COPPER_HORSE_ARMOR"],["Copper Ingot","COPPER_INGOT"],["Copper Lantern","COPPER_LANTERN"],["Copper Leggings","COPPER_LEGGINGS"],["Copper Nautilus Armor","COPPER_NAUTILUS_ARMOR"],["Copper Nugget","COPPER_NUGGET"],["Copper Pickaxe","COPPER_PICKAXE"],["Copper Shovel","COPPER_SHOVEL"],["Copper Spear","COPPER_SPEAR"],["Copper Sword","COPPER_SWORD"],["Copper Torch","COPPER_TORCH"],["Copper Wall Torch","COPPER_WALL_TORCH"],["Cornflower","CORNFLOWER"],["Cow Spawn Egg","COW_SPAWN_EGG"],["Crafter","CRAFTER"],["Crafting Table","CRAFTING_TABLE"],["Creaking Heart","CREAKING_HEART"],["Creaking Spawn Egg","CREAKING_SPAWN_EGG"],["Creeper Banner Pattern","CREEPER_BANNER_PATTERN"],["Creeper Head","CREEPER_HEAD"],["Creeper Spawn Egg","CREEPER_SPAWN_EGG"],["Creeper Wall Head","CREEPER_WALL_HEAD"],["Crimson Button","CRIMSON_BUTTON"],["Crimson Fungus","CRIMSON_FUNGUS"],["Crimson Hanging Sign","CRIMSON_HANGING_SIGN"],["Crimson Nylium","CRIMSON_NYLIUM"],["Crimson Pressure Plate","CRIMSON_PRESSURE_PLATE"],["Crimson Roots","CRIMSON_ROOTS"],["Crimson Shelf","CRIMSON_SHELF"],["Crimson Sign","CRIMSON_SIGN"],["Crimson Wall Hanging Sign","CRIMSON_WALL_HANGING_SIGN"],["Crimson Wall Sign","CRIMSON_WALL_SIGN"],["Crossbow","CROSSBOW"],["Cut Copper","CUT_COPPER"],["Cut Red Sandstone","CUT_RED_SANDSTONE"],["Cut Sandstone","CUT_SANDSTONE"],["Cyan Bundle","CYAN_BUNDLE"],["Cyan Candle Cake","CYAN_CANDLE_CAKE"],["Cyan Dye","CYAN_DYE"],["Cyan Harness","CYAN_HARNESS"],["Damaged Anvil","DAMAGED_ANVIL"],["Dandelion","DANDELION"],["Danger Pottery Sherd","DANGER_POTTERY_SHERD"],["Dark Oak Boat","DARK_OAK_BOAT"],["Dark Oak Button","DARK_OAK_BUTTON"],["Dark Oak Chest Boat","DARK_OAK_CHEST_BOAT"],["Dark Oak Hanging Sign","DARK_OAK_HANGING_SIGN"],["Dark Oak Leaves","DARK_OAK_LEAVES"],["Dark Oak Pressure Plate","DARK_OAK_PRESSURE_PLATE"],["Dark Oak Sapling","DARK_OAK_SAPLING"],["Dark Oak Shelf","DARK_OAK_SHELF"],["Dark Oak Sign","DARK_OAK_SIGN"],["Dark Oak Wall Hanging Sign","DARK_OAK_WALL_HANGING_SIGN"],["Dark Oak Wall Sign","DARK_OAK_WALL_SIGN"],["Dark Prismarine","DARK_PRISMARINE"],["Dead Brain Coral","DEAD_BRAIN_CORAL"],["Dead Brain Coral Block","DEAD_BRAIN_CORAL_BLOCK"],["Dead Brain Coral Fan","DEAD_BRAIN_CORAL_FAN"],["Dead Brain Coral Wall Fan","DEAD_BRAIN_CORAL_WALL_FAN"],["Dead Bubble Coral","DEAD_BUBBLE_CORAL"],["Dead Bubble Coral Block","DEAD_BUBBLE_CORAL_BLOCK"],["Dead Bubble Coral Fan","DEAD_BUBBLE_CORAL_FAN"],["Dead Bubble Coral Wall Fan","DEAD_BUBBLE_CORAL_WALL_FAN"],["Dead Bush","DEAD_BUSH"],["Dead Fire Coral","DEAD_FIRE_CORAL"],["Dead Fire Coral Block","DEAD_FIRE_CORAL_BLOCK"],["Dead Fire Coral Fan","DEAD_FIRE_CORAL_FAN"],["Dead Fire Coral Wall Fan","DEAD_FIRE_CORAL_WALL_FAN"],["Dead Horn Coral","DEAD_HORN_CORAL"],["Dead Horn Coral Block","DEAD_HORN_CORAL_BLOCK"],["Dead Horn Coral Fan","DEAD_HORN_CORAL_FAN"],["Dead Horn Coral Wall Fan","DEAD_HORN_CORAL_WALL_FAN"],["Dead Tube Coral","DEAD_TUBE_CORAL"],["Dead Tube Coral Block","DEAD_TUBE_CORAL_BLOCK"],["Dead Tube Coral Fan","DEAD_TUBE_CORAL_FAN"],["Dead Tube Coral Wall Fan","DEAD_TUBE_CORAL_WALL_FAN"],["Debug Stick","DEBUG_STICK"],["Decorated Pot","DECORATED_POT"],["Diamond","DIAMOND"],["Diamond Axe","DIAMOND_AXE"],["Diamond Block","DIAMOND_BLOCK"],["Diamond Boots","DIAMOND_BOOTS"],["Diamond Chestplate","DIAMOND_CHESTPLATE"],["Diamond Helmet","DIAMOND_HELMET"],["Diamond Hoe","DIAMOND_HOE"],["Diamond Horse Armor","DIAMOND_HORSE_ARMOR"],["Diamond Leggings","DIAMOND_LEGGINGS"],["Diamond Nautilus Armor","DIAMOND_NAUTILUS_ARMOR"],["Diamond Pickaxe","DIAMOND_PICKAXE"],["Diamond Shovel","DIAMOND_SHOVEL"],["Diamond Spear","DIAMOND_SPEAR"],["Diamond Sword","DIAMOND_SWORD"],["Disc Fragment 5","DISC_FRAGMENT_5"],["Dolphin Spawn Egg","DOLPHIN_SPAWN_EGG"],["Donkey Spawn Egg","DONKEY_SPAWN_EGG"],["Dragon Breath","DRAGON_BREATH"],["Dragon Egg","DRAGON_EGG"],["Dragon Head","DRAGON_HEAD"],["Dragon Wall Head","DRAGON_WALL_HEAD"],["Dried Ghast","DRIED_GHAST"],["Dried Kelp","DRIED_KELP"],["Dried Kelp Block","DRIED_KELP_BLOCK"],["Dripstone Block","DRIPSTONE_BLOCK"],["Drowned Spawn Egg","DROWNED_SPAWN_EGG"],["Dune Armor Trim Smithing Template","DUNE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Echo Shard","ECHO_SHARD"],["Egg","EGG"],["Elder Guardian Spawn Egg","ELDER_GUARDIAN_SPAWN_EGG"],["Elytra","ELYTRA"],["Emerald","EMERALD"],["Emerald Block","EMERALD_BLOCK"],["Enchanted Book","ENCHANTED_BOOK"],["Enchanted Golden Apple","ENCHANTED_GOLDEN_APPLE"],["Enchanting Table","ENCHANTING_TABLE"],["Enderman Spawn Egg","ENDERMAN_SPAWN_EGG"],["Endermite Spawn Egg","ENDERMITE_SPAWN_EGG"],["Ender Chest","ENDER_CHEST"],["Ender Dragon Spawn Egg","ENDER_DRAGON_SPAWN_EGG"],["Ender Eye","ENDER_EYE"],["Ender Pearl","ENDER_PEARL"],["End Crystal","END_CRYSTAL"],["End Gateway","END_GATEWAY"],["End Portal","END_PORTAL"],["End Portal Frame","END_PORTAL_FRAME"],["End Rod","END_ROD"],["End Stone","END_STONE"],["Evoker Spawn Egg","EVOKER_SPAWN_EGG"],["Experience Bottle","EXPERIENCE_BOTTLE"],["Explorer Pottery Sherd","EXPLORER_POTTERY_SHERD"],["Exposed Chiseled Copper","EXPOSED_CHISELED_COPPER"],["Exposed Copper","EXPOSED_COPPER"],["Exposed Copper Bars","EXPOSED_COPPER_BARS"],["Exposed Copper Bulb","EXPOSED_COPPER_BULB"],["Exposed Copper Chain","EXPOSED_COPPER_CHAIN"],["Exposed Copper Chest","EXPOSED_COPPER_CHEST"],["Exposed Copper Golem Statue","EXPOSED_COPPER_GOLEM_STATUE"],["Exposed Copper Grate","EXPOSED_COPPER_GRATE"],["Exposed Copper Lantern","EXPOSED_COPPER_LANTERN"],["Exposed Cut Copper","EXPOSED_CUT_COPPER"],["Exposed Lightning Rod","EXPOSED_LIGHTNING_ROD"],["Eye Armor Trim Smithing Template","EYE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Farmland","FARMLAND"],["Feather","FEATHER"],["Fermented Spider Eye","FERMENTED_SPIDER_EYE"],["Fern","FERN"],["Field Masoned Banner Pattern","FIELD_MASONED_BANNER_PATTERN"],["Filled Map","FILLED_MAP"],["Fire","FIRE"],["Firefly Bush","FIREFLY_BUSH"],["Firework Rocket","FIREWORK_ROCKET"],["Firework Star","FIREWORK_STAR"],["Fire Charge","FIRE_CHARGE"],["Fire Coral","FIRE_CORAL"],["Fire Coral Block","FIRE_CORAL_BLOCK"],["Fire Coral Fan","FIRE_CORAL_FAN"],["Fire Coral Wall Fan","FIRE_CORAL_WALL_FAN"],["Fishing Rod","FISHING_ROD"],["Fletching Table","FLETCHING_TABLE"],["Flint","FLINT"],["Flint And Steel","FLINT_AND_STEEL"],["Flowering Azalea","FLOWERING_AZALEA"],["Flowering Azalea Leaves","FLOWERING_AZALEA_LEAVES"],["Flower Banner Pattern","FLOWER_BANNER_PATTERN"],["Flower Pot","FLOWER_POT"],["Flow Armor Trim Smithing Template","FLOW_ARMOR_TRIM_SMITHING_TEMPLATE"],["Flow Banner Pattern","FLOW_BANNER_PATTERN"],["Flow Pottery Sherd","FLOW_POTTERY_SHERD"],["Fox Spawn Egg","FOX_SPAWN_EGG"],["Friend Pottery Sherd","FRIEND_POTTERY_SHERD"],["Frogspawn","FROGSPAWN"],["Frog Spawn Egg","FROG_SPAWN_EGG"],["Frosted Ice","FROSTED_ICE"],["Furnace","FURNACE"],["Furnace Minecart","FURNACE_MINECART"],["Ghast Spawn Egg","GHAST_SPAWN_EGG"],["Ghast Tear","GHAST_TEAR"],["Gilded Blackstone","GILDED_BLACKSTONE"],["Glass Bottle","GLASS_BOTTLE"],["Glistering Melon Slice","GLISTERING_MELON_SLICE"],["Globe Banner Pattern","GLOBE_BANNER_PATTERN"],["Glowstone","GLOWSTONE"],["Glowstone Dust","GLOWSTONE_DUST"],["Glow Berries","GLOW_BERRIES"],["Glow Ink Sac","GLOW_INK_SAC"],["Glow Item Frame","GLOW_ITEM_FRAME"],["Glow Lichen","GLOW_LICHEN"],["Glow Squid Spawn Egg","GLOW_SQUID_SPAWN_EGG"],["Goat Horn","GOAT_HORN"],["Goat Spawn Egg","GOAT_SPAWN_EGG"],["Golden Apple","GOLDEN_APPLE"],["Golden Axe","GOLDEN_AXE"],["Golden Boots","GOLDEN_BOOTS"],["Golden Carrot","GOLDEN_CARROT"],["Golden Chestplate","GOLDEN_CHESTPLATE"],["Golden Helmet","GOLDEN_HELMET"],["Golden Hoe","GOLDEN_HOE"],["Golden Horse Armor","GOLDEN_HORSE_ARMOR"],["Golden Leggings","GOLDEN_LEGGINGS"],["Golden Nautilus Armor","GOLDEN_NAUTILUS_ARMOR"],["Golden Pickaxe","GOLDEN_PICKAXE"],["Golden Shovel","GOLDEN_SHOVEL"],["Golden Spear","GOLDEN_SPEAR"],["Golden Sword","GOLDEN_SWORD"],["Gold Block","GOLD_BLOCK"],["Gold Ingot","GOLD_INGOT"],["Gold Nugget","GOLD_NUGGET"],["Gray Bundle","GRAY_BUNDLE"],["Gray Candle Cake","GRAY_CANDLE_CAKE"],["Gray Dye","GRAY_DYE"],["Gray Harness","GRAY_HARNESS"],["Green Bundle","GREEN_BUNDLE"],["Green Candle Cake","GREEN_CANDLE_CAKE"],["Green Dye","GREEN_DYE"],["Green Harness","GREEN_HARNESS"],["Grindstone","GRINDSTONE"],["Guardian Spawn Egg","GUARDIAN_SPAWN_EGG"],["Gunpowder","GUNPOWDER"],["Guster Banner Pattern","GUSTER_BANNER_PATTERN"],["Guster Pottery Sherd","GUSTER_POTTERY_SHERD"],["Hanging Roots","HANGING_ROOTS"],["Happy Ghast Spawn Egg","HAPPY_GHAST_SPAWN_EGG"],["Hay Block","HAY_BLOCK"],["Heartbreak Pottery Sherd","HEARTBREAK_POTTERY_SHERD"],["Heart Of The Sea","HEART_OF_THE_SEA"],["Heart Pottery Sherd","HEART_POTTERY_SHERD"],["Heavy Core","HEAVY_CORE"],["Heavy Weighted Pressure Plate","HEAVY_WEIGHTED_PRESSURE_PLATE"],["Hoglin Spawn Egg","HOGLIN_SPAWN_EGG"],["Honeycomb","HONEYCOMB"],["Honeycomb Block","HONEYCOMB_BLOCK"],["Honey Bottle","HONEY_BOTTLE"],["Hopper Minecart","HOPPER_MINECART"],["Horn Coral","HORN_CORAL"],["Horn Coral Block","HORN_CORAL_BLOCK"],["Horn Coral Fan","HORN_CORAL_FAN"],["Horn Coral Wall Fan","HORN_CORAL_WALL_FAN"],["Horse Spawn Egg","HORSE_SPAWN_EGG"],["Host Armor Trim Smithing Template","HOST_ARMOR_TRIM_SMITHING_TEMPLATE"],["Howl Pottery Sherd","HOWL_POTTERY_SHERD"],["Husk Spawn Egg","HUSK_SPAWN_EGG"],["Infested Chiseled Stone Bricks","INFESTED_CHISELED_STONE_BRICKS"],["Infested Cobblestone","INFESTED_COBBLESTONE"],["Infested Cracked Stone Bricks","INFESTED_CRACKED_STONE_BRICKS"],["Infested Deepslate","INFESTED_DEEPSLATE"],["Infested Mossy Stone Bricks","INFESTED_MOSSY_STONE_BRICKS"],["Infested Stone","INFESTED_STONE"],["Infested Stone Bricks","INFESTED_STONE_BRICKS"],["Ink Sac","INK_SAC"],["Iron Axe","IRON_AXE"],["Iron Bars","IRON_BARS"],["Iron Block","IRON_BLOCK"],["Iron Boots","IRON_BOOTS"],["Iron Chain","IRON_CHAIN"],["Iron Chestplate","IRON_CHESTPLATE"],["Iron Golem Spawn Egg","IRON_GOLEM_SPAWN_EGG"],["Iron Helmet","IRON_HELMET"],["Iron Hoe","IRON_HOE"],["Iron Horse Armor","IRON_HORSE_ARMOR"],["Iron Ingot","IRON_INGOT"],["Iron Leggings","IRON_LEGGINGS"],["Iron Nautilus Armor","IRON_NAUTILUS_ARMOR"],["Iron Nugget","IRON_NUGGET"],["Iron Pickaxe","IRON_PICKAXE"],["Iron Shovel","IRON_SHOVEL"],["Iron Spear","IRON_SPEAR"],["Iron Sword","IRON_SWORD"],["Item Frame","ITEM_FRAME"],["Jack O Lantern","JACK_O_LANTERN"],["Jigsaw","JIGSAW"],["Jukebox","JUKEBOX"],["Jungle Boat","JUNGLE_BOAT"],["Jungle Button","JUNGLE_BUTTON"],["Jungle Chest Boat","JUNGLE_CHEST_BOAT"],["Jungle Hanging Sign","JUNGLE_HANGING_SIGN"],["Jungle Leaves","JUNGLE_LEAVES"],["Jungle Pressure Plate","JUNGLE_PRESSURE_PLATE"],["Jungle Sapling","JUNGLE_SAPLING"],["Jungle Shelf","JUNGLE_SHELF"],["Jungle Sign","JUNGLE_SIGN"],["Jungle Wall Hanging Sign","JUNGLE_WALL_HANGING_SIGN"],["Jungle Wall Sign","JUNGLE_WALL_SIGN"],["Kelp","KELP"],["Kelp Plant","KELP_PLANT"],["Knowledge Book","KNOWLEDGE_BOOK"],["Ladder","LADDER"],["Lantern","LANTERN"],["Lapis Block","LAPIS_BLOCK"],["Lapis Lazuli","LAPIS_LAZULI"],["Large Amethyst Bud","LARGE_AMETHYST_BUD"],["Large Fern","LARGE_FERN"],["Lava Bucket","LAVA_BUCKET"],["Lava Cauldron","LAVA_CAULDRON"],["Lead","LEAD"],["Leaf Litter","LEAF_LITTER"],["Leather","LEATHER"],["Leather Boots","LEATHER_BOOTS"],["Leather Chestplate","LEATHER_CHESTPLATE"],["Leather Helmet","LEATHER_HELMET"],["Leather Horse Armor","LEATHER_HORSE_ARMOR"],["Leather Leggings","LEATHER_LEGGINGS"],["Light","LIGHT"],["Lightning Rod","LIGHTNING_ROD"],["Light Blue Bundle","LIGHT_BLUE_BUNDLE"],["Light Blue Candle Cake","LIGHT_BLUE_CANDLE_CAKE"],["Light Blue Dye","LIGHT_BLUE_DYE"],["Light Blue Harness","LIGHT_BLUE_HARNESS"],["Light Gray Bundle","LIGHT_GRAY_BUNDLE"],["Light Gray Candle Cake","LIGHT_GRAY_CANDLE_CAKE"],["Light Gray Dye","LIGHT_GRAY_DYE"],["Light Gray Harness","LIGHT_GRAY_HARNESS"],["Light Weighted Pressure Plate","LIGHT_WEIGHTED_PRESSURE_PLATE"],["Lilac","LILAC"],["Lily Of The Valley","LILY_OF_THE_VALLEY"],["Lily Pad","LILY_PAD"],["Lime Bundle","LIME_BUNDLE"],["Lime Candle Cake","LIME_CANDLE_CAKE"],["Lime Dye","LIME_DYE"],["Lime Harness","LIME_HARNESS"],["Lingering Potion","LINGERING_POTION"],["Llama Spawn Egg","LLAMA_SPAWN_EGG"],["Lodestone","LODESTONE"],["Loom","LOOM"],["Mace","MACE"],["Magenta Bundle","MAGENTA_BUNDLE"],["Magenta Candle Cake","MAGENTA_CANDLE_CAKE"],["Magenta Dye","MAGENTA_DYE"],["Magenta Harness","MAGENTA_HARNESS"],["Magma Cream","MAGMA_CREAM"],["Magma Cube Spawn Egg","MAGMA_CUBE_SPAWN_EGG"],["Mangrove Boat","MANGROVE_BOAT"],["Mangrove Button","MANGROVE_BUTTON"],["Mangrove Chest Boat","MANGROVE_CHEST_BOAT"],["Mangrove Hanging Sign","MANGROVE_HANGING_SIGN"],["Mangrove Leaves","MANGROVE_LEAVES"],["Mangrove Pressure Plate","MANGROVE_PRESSURE_PLATE"],["Mangrove Propagule","MANGROVE_PROPAGULE"],["Mangrove Roots","MANGROVE_ROOTS"],["Mangrove Shelf","MANGROVE_SHELF"],["Mangrove Sign","MANGROVE_SIGN"],["Mangrove Wall Hanging Sign","MANGROVE_WALL_HANGING_SIGN"],["Mangrove Wall Sign","MANGROVE_WALL_SIGN"],["Map","MAP"],["Medium Amethyst Bud","MEDIUM_AMETHYST_BUD"],["Melon","MELON"],["Melon Seeds","MELON_SEEDS"],["Melon Slice","MELON_SLICE"],["Melon Stem","MELON_STEM"],["Milk Bucket","MILK_BUCKET"],["Minecart","MINECART"],["Miner Pottery Sherd","MINER_POTTERY_SHERD"],["Mojang Banner Pattern","MOJANG_BANNER_PATTERN"],["Mooshroom Spawn Egg","MOOSHROOM_SPAWN_EGG"],["Mossy Cobblestone","MOSSY_COBBLESTONE"],["Moss Block","MOSS_BLOCK"],["Moss Carpet","MOSS_CARPET"],["Mourner Pottery Sherd","MOURNER_POTTERY_SHERD"],["Moving Piston","MOVING_PISTON"],["Mud","MUD"],["Muddy Mangrove Roots","MUDDY_MANGROVE_ROOTS"],["Mule Spawn Egg","MULE_SPAWN_EGG"],["Mushroom Stem","MUSHROOM_STEM"],["Mushroom Stew","MUSHROOM_STEW"],["Music Disc 11","MUSIC_DISC_11"],["Music Disc 13","MUSIC_DISC_13"],["Music Disc 5","MUSIC_DISC_5"],["Music Disc Blocks","MUSIC_DISC_BLOCKS"],["Music Disc Cat","MUSIC_DISC_CAT"],["Music Disc Chirp","MUSIC_DISC_CHIRP"],["Music Disc Creator","MUSIC_DISC_CREATOR"],["Music Disc Creator Music Box","MUSIC_DISC_CREATOR_MUSIC_BOX"],["Music Disc Far","MUSIC_DISC_FAR"],["Music Disc Lava Chicken","MUSIC_DISC_LAVA_CHICKEN"],["Music Disc Mall","MUSIC_DISC_MALL"],["Music Disc Mellohi","MUSIC_DISC_MELLOHI"],["Music Disc Otherside","MUSIC_DISC_OTHERSIDE"],["Music Disc Pigstep","MUSIC_DISC_PIGSTEP"],["Music Disc Precipice","MUSIC_DISC_PRECIPICE"],["Music Disc Relic","MUSIC_DISC_RELIC"],["Music Disc Stal","MUSIC_DISC_STAL"],["Music Disc Strad","MUSIC_DISC_STRAD"],["Music Disc Tears","MUSIC_DISC_TEARS"],["Music Disc Wait","MUSIC_DISC_WAIT"],["Music Disc Ward","MUSIC_DISC_WARD"],["Mutton","MUTTON"],["Name Tag","NAME_TAG"],["Nautilus Shell","NAUTILUS_SHELL"],["Nautilus Spawn Egg","NAUTILUS_SPAWN_EGG"],["Netherite Axe","NETHERITE_AXE"],["Netherite Block","NETHERITE_BLOCK"],["Netherite Boots","NETHERITE_BOOTS"],["Netherite Chestplate","NETHERITE_CHESTPLATE"],["Netherite Helmet","NETHERITE_HELMET"],["Netherite Hoe","NETHERITE_HOE"],["Netherite Horse Armor","NETHERITE_HORSE_ARMOR"],["Netherite Ingot","NETHERITE_INGOT"],["Netherite Leggings","NETHERITE_LEGGINGS"],["Netherite Nautilus Armor","NETHERITE_NAUTILUS_ARMOR"],["Netherite Pickaxe","NETHERITE_PICKAXE"],["Netherite Scrap","NETHERITE_SCRAP"],["Netherite Shovel","NETHERITE_SHOVEL"],["Netherite Spear","NETHERITE_SPEAR"],["Netherite Sword","NETHERITE_SWORD"],["Netherite Upgrade Smithing Template","NETHERITE_UPGRADE_SMITHING_TEMPLATE"],["Netherrack","NETHERRACK"],["Nether Brick","NETHER_BRICK"],["Nether Portal","NETHER_PORTAL"],["Nether Sprouts","NETHER_SPROUTS"],["Nether Star","NETHER_STAR"],["Nether Wart","NETHER_WART"],["Nether Wart Block","NETHER_WART_BLOCK"],["Oak Boat","OAK_BOAT"],["Oak Button","OAK_BUTTON"],["Oak Chest Boat","OAK_CHEST_BOAT"],["Oak Hanging Sign","OAK_HANGING_SIGN"],["Oak Leaves","OAK_LEAVES"],["Oak Pressure Plate","OAK_PRESSURE_PLATE"],["Oak Sapling","OAK_SAPLING"],["Oak Shelf","OAK_SHELF"],["Oak Sign","OAK_SIGN"],["Oak Wall Hanging Sign","OAK_WALL_HANGING_SIGN"],["Oak Wall Sign","OAK_WALL_SIGN"],["Ocelot Spawn Egg","OCELOT_SPAWN_EGG"],["Ochre Froglight","OCHRE_FROGLIGHT"],["Ominous Bottle","OMINOUS_BOTTLE"],["Ominous Trial Key","OMINOUS_TRIAL_KEY"],["Open Eyeblossom","OPEN_EYEBLOSSOM"],["Orange Bundle","ORANGE_BUNDLE"],["Orange Candle Cake","ORANGE_CANDLE_CAKE"],["Orange Dye","ORANGE_DYE"],["Orange Harness","ORANGE_HARNESS"],["Orange Tulip","ORANGE_TULIP"],["Oxeye Daisy","OXEYE_DAISY"],["Oxidized Chiseled Copper","OXIDIZED_CHISELED_COPPER"],["Oxidized Copper","OXIDIZED_COPPER"],["Oxidized Copper Bars","OXIDIZED_COPPER_BARS"],["Oxidized Copper Bulb","OXIDIZED_COPPER_BULB"],["Oxidized Copper Chain","OXIDIZED_COPPER_CHAIN"],["Oxidized Copper Chest","OXIDIZED_COPPER_CHEST"],["Oxidized Copper Golem Statue","OXIDIZED_COPPER_GOLEM_STATUE"],["Oxidized Copper Grate","OXIDIZED_COPPER_GRATE"],["Oxidized Copper Lantern","OXIDIZED_COPPER_LANTERN"],["Oxidized Cut Copper","OXIDIZED_CUT_COPPER"],["Oxidized Lightning Rod","OXIDIZED_LIGHTNING_ROD"],["Packed Mud","PACKED_MUD"],["Painting","PAINTING"],["Pale Hanging Moss","PALE_HANGING_MOSS"],["Pale Moss Block","PALE_MOSS_BLOCK"],["Pale Moss Carpet","PALE_MOSS_CARPET"],["Pale Oak Boat","PALE_OAK_BOAT"],["Pale Oak Button","PALE_OAK_BUTTON"],["Pale Oak Chest Boat","PALE_OAK_CHEST_BOAT"],["Pale Oak Hanging Sign","PALE_OAK_HANGING_SIGN"],["Pale Oak Leaves","PALE_OAK_LEAVES"],["Pale Oak Log","PALE_OAK_LOG"],["Pale Oak Planks","PALE_OAK_PLANKS"],["Pale Oak Pressure Plate","PALE_OAK_PRESSURE_PLATE"],["Pale Oak Sapling","PALE_OAK_SAPLING"],["Pale Oak Shelf","PALE_OAK_SHELF"],["Pale Oak Sign","PALE_OAK_SIGN"],["Pale Oak Wall Hanging Sign","PALE_OAK_WALL_HANGING_SIGN"],["Pale Oak Wall Sign","PALE_OAK_WALL_SIGN"],["Pale Oak Wood","PALE_OAK_WOOD"],["Panda Spawn Egg","PANDA_SPAWN_EGG"],["Paper","PAPER"],["Parched Spawn Egg","PARCHED_SPAWN_EGG"],["Parrot Spawn Egg","PARROT_SPAWN_EGG"],["Pearlescent Froglight","PEARLESCENT_FROGLIGHT"],["Peony","PEONY"],["Phantom Membrane","PHANTOM_MEMBRANE"],["Phantom Spawn Egg","PHANTOM_SPAWN_EGG"],["Piglin Banner Pattern","PIGLIN_BANNER_PATTERN"],["Piglin Brute Spawn Egg","PIGLIN_BRUTE_SPAWN_EGG"],["Piglin Head","PIGLIN_HEAD"],["Piglin Spawn Egg","PIGLIN_SPAWN_EGG"],["Piglin Wall Head","PIGLIN_WALL_HEAD"],["Pig Spawn Egg","PIG_SPAWN_EGG"],["Pillager Spawn Egg","PILLAGER_SPAWN_EGG"],["Pink Bundle","PINK_BUNDLE"],["Pink Candle Cake","PINK_CANDLE_CAKE"],["Pink Dye","PINK_DYE"],["Pink Harness","PINK_HARNESS"],["Pink Petals","PINK_PETALS"],["Pink Tulip","PINK_TULIP"],["Piston Head","PISTON_HEAD"],["Pitcher Crop","PITCHER_CROP"],["Pitcher Plant","PITCHER_PLANT"],["Pitcher Pod","PITCHER_POD"],["Player Head","PLAYER_HEAD"],["Player Wall Head","PLAYER_WALL_HEAD"],["Plenty Pottery Sherd","PLENTY_POTTERY_SHERD"],["Pointed Dripstone","POINTED_DRIPSTONE"],["Poisonous Potato","POISONOUS_POTATO"],["Polar Bear Spawn Egg","POLAR_BEAR_SPAWN_EGG"],["Polished Andesite","POLISHED_ANDESITE"],["Polished Basalt","POLISHED_BASALT"],["Polished Blackstone","POLISHED_BLACKSTONE"],["Polished Blackstone Button","POLISHED_BLACKSTONE_BUTTON"],["Polished Blackstone Pressure Plate","POLISHED_BLACKSTONE_PRESSURE_PLATE"],["Polished Deepslate","POLISHED_DEEPSLATE"],["Polished Diorite","POLISHED_DIORITE"],["Polished Granite","POLISHED_GRANITE"],["Polished Tuff","POLISHED_TUFF"],["Popped Chorus Fruit","POPPED_CHORUS_FRUIT"],["Poppy","POPPY"],["Porkchop","PORKCHOP"],["Potato","POTATO"],["Potatoes","POTATOES"],["Potion","POTION"],["Potted Acacia Sapling","POTTED_ACACIA_SAPLING"],["Potted Allium","POTTED_ALLIUM"],["Potted Azalea Bush","POTTED_AZALEA_BUSH"],["Potted Azure Bluet","POTTED_AZURE_BLUET"],["Potted Bamboo","POTTED_BAMBOO"],["Potted Birch Sapling","POTTED_BIRCH_SAPLING"],["Potted Blue Orchid","POTTED_BLUE_ORCHID"],["Potted Brown Mushroom","POTTED_BROWN_MUSHROOM"],["Potted Cactus","POTTED_CACTUS"],["Potted Cherry Sapling","POTTED_CHERRY_SAPLING"],["Potted Closed Eyeblossom","POTTED_CLOSED_EYEBLOSSOM"],["Potted Cornflower","POTTED_CORNFLOWER"],["Potted Crimson Fungus","POTTED_CRIMSON_FUNGUS"],["Potted Crimson Roots","POTTED_CRIMSON_ROOTS"],["Potted Dandelion","POTTED_DANDELION"],["Potted Dark Oak Sapling","POTTED_DARK_OAK_SAPLING"],["Potted Dead Bush","POTTED_DEAD_BUSH"],["Potted Fern","POTTED_FERN"],["Potted Flowering Azalea Bush","POTTED_FLOWERING_AZALEA_BUSH"],["Potted Jungle Sapling","POTTED_JUNGLE_SAPLING"],["Potted Lily Of The Valley","POTTED_LILY_OF_THE_VALLEY"],["Potted Mangrove Propagule","POTTED_MANGROVE_PROPAGULE"],["Potted Oak Sapling","POTTED_OAK_SAPLING"],["Potted Open Eyeblossom","POTTED_OPEN_EYEBLOSSOM"],["Potted Orange Tulip","POTTED_ORANGE_TULIP"],["Potted Oxeye Daisy","POTTED_OXEYE_DAISY"],["Potted Pale Oak Sapling","POTTED_PALE_OAK_SAPLING"],["Potted Pink Tulip","POTTED_PINK_TULIP"],["Potted Poppy","POTTED_POPPY"],["Potted Red Mushroom","POTTED_RED_MUSHROOM"],["Potted Red Tulip","POTTED_RED_TULIP"],["Potted Spruce Sapling","POTTED_SPRUCE_SAPLING"],["Potted Torchflower","POTTED_TORCHFLOWER"],["Potted Warped Fungus","POTTED_WARPED_FUNGUS"],["Potted Warped Roots","POTTED_WARPED_ROOTS"],["Potted White Tulip","POTTED_WHITE_TULIP"],["Potted Wither Rose","POTTED_WITHER_ROSE"],["Powder Snow","POWDER_SNOW"],["Powder Snow Bucket","POWDER_SNOW_BUCKET"],["Powder Snow Cauldron","POWDER_SNOW_CAULDRON"],["Prismarine","PRISMARINE"],["Prismarine Bricks","PRISMARINE_BRICKS"],["Prismarine Crystals","PRISMARINE_CRYSTALS"],["Prismarine Shard","PRISMARINE_SHARD"],["Prize Pottery Sherd","PRIZE_POTTERY_SHERD"],["Pufferfish","PUFFERFISH"],["Pufferfish Bucket","PUFFERFISH_BUCKET"],["Pufferfish Spawn Egg","PUFFERFISH_SPAWN_EGG"],["Pumpkin","PUMPKIN"],["Pumpkin Pie","PUMPKIN_PIE"],["Pumpkin Seeds","PUMPKIN_SEEDS"],["Pumpkin Stem","PUMPKIN_STEM"],["Purple Bundle","PURPLE_BUNDLE"],["Purple Candle Cake","PURPLE_CANDLE_CAKE"],["Purple Dye","PURPLE_DYE"],["Purple Harness","PURPLE_HARNESS"],["Purpur Block","PURPUR_BLOCK"],["Purpur Pillar","PURPUR_PILLAR"],["Quartz","QUARTZ"],["Quartz Block","QUARTZ_BLOCK"],["Quartz Pillar","QUARTZ_PILLAR"],["Rabbit","RABBIT"],["Rabbit Foot","RABBIT_FOOT"],["Rabbit Hide","RABBIT_HIDE"],["Rabbit Spawn Egg","RABBIT_SPAWN_EGG"],["Rabbit Stew","RABBIT_STEW"],["Raiser Armor Trim Smithing Template","RAISER_ARMOR_TRIM_SMITHING_TEMPLATE"],["Ravager Spawn Egg","RAVAGER_SPAWN_EGG"],["Raw Copper","RAW_COPPER"],["Raw Copper Block","RAW_COPPER_BLOCK"],["Raw Gold","RAW_GOLD"],["Raw Gold Block","RAW_GOLD_BLOCK"],["Raw Iron","RAW_IRON"],["Raw Iron Block","RAW_IRON_BLOCK"],["Recovery Compass","RECOVERY_COMPASS"],["Redstone","REDSTONE"],["Redstone Wall Torch","REDSTONE_WALL_TORCH"],["Red Bundle","RED_BUNDLE"],["Red Candle Cake","RED_CANDLE_CAKE"],["Red Dye","RED_DYE"],["Red Harness","RED_HARNESS"],["Red Mushroom","RED_MUSHROOM"],["Red Mushroom Block","RED_MUSHROOM_BLOCK"],["Red Sandstone","RED_SANDSTONE"],["Red Tulip","RED_TULIP"],["Reinforced Deepslate","REINFORCED_DEEPSLATE"],["Repeating Command Block","REPEATING_COMMAND_BLOCK"],["Resin Block","RESIN_BLOCK"],["Resin Brick","RESIN_BRICK"],["Resin Bricks","RESIN_BRICKS"],["Resin Clump","RESIN_CLUMP"],["Respawn Anchor","RESPAWN_ANCHOR"],["Rib Armor Trim Smithing Template","RIB_ARMOR_TRIM_SMITHING_TEMPLATE"],["Rose Bush","ROSE_BUSH"],["Rotten Flesh","ROTTEN_FLESH"],["Saddle","SADDLE"],["Salmon","SALMON"],["Salmon Bucket","SALMON_BUCKET"],["Salmon Spawn Egg","SALMON_SPAWN_EGG"],["Sandstone","SANDSTONE"],["Scaffolding","SCAFFOLDING"],["Scrape Pottery Sherd","SCRAPE_POTTERY_SHERD"],["Sculk","SCULK"],["Sculk Catalyst","SCULK_CATALYST"],["Sculk Sensor","SCULK_SENSOR"],["Sculk Shrieker","SCULK_SHRIEKER"],["Sculk Vein","SCULK_VEIN"],["Seagrass","SEAGRASS"],["Sea Lantern","SEA_LANTERN"],["Sea Pickle","SEA_PICKLE"],["Sentry Armor Trim Smithing Template","SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE"],["Shaper Armor Trim Smithing Template","SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE"],["Sheaf Pottery Sherd","SHEAF_POTTERY_SHERD"],["Shears","SHEARS"],["Sheep Spawn Egg","SHEEP_SPAWN_EGG"],["Shelter Pottery Sherd","SHELTER_POTTERY_SHERD"],["Shield","SHIELD"],["Short Dry Grass","SHORT_DRY_GRASS"],["Short Grass","SHORT_GRASS"],["Shroomlight","SHROOMLIGHT"],["Shulker Box","SHULKER_BOX"],["Shulker Shell","SHULKER_SHELL"],["Shulker Spawn Egg","SHULKER_SPAWN_EGG"],["Silence Armor Trim Smithing Template","SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Silverfish Spawn Egg","SILVERFISH_SPAWN_EGG"],["Skeleton Horse Spawn Egg","SKELETON_HORSE_SPAWN_EGG"],["Skeleton Skull","SKELETON_SKULL"],["Skeleton Spawn Egg","SKELETON_SPAWN_EGG"],["Skeleton Wall Skull","SKELETON_WALL_SKULL"],["Skull Banner Pattern","SKULL_BANNER_PATTERN"],["Skull Pottery Sherd","SKULL_POTTERY_SHERD"],["Slime Ball","SLIME_BALL"],["Slime Spawn Egg","SLIME_SPAWN_EGG"],["Small Amethyst Bud","SMALL_AMETHYST_BUD"],["Small Dripleaf","SMALL_DRIPLEAF"],["Smithing Table","SMITHING_TABLE"],["Smoker","SMOKER"],["Smooth Basalt","SMOOTH_BASALT"],["Smooth Quartz","SMOOTH_QUARTZ"],["Smooth Red Sandstone","SMOOTH_RED_SANDSTONE"],["Smooth Sandstone","SMOOTH_SANDSTONE"],["Smooth Stone","SMOOTH_STONE"],["Sniffer Egg","SNIFFER_EGG"],["Sniffer Spawn Egg","SNIFFER_SPAWN_EGG"],["Snort Pottery Sherd","SNORT_POTTERY_SHERD"],["Snout Armor Trim Smithing Template","SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE"],["Snowball","SNOWBALL"],["Snow Golem Spawn Egg","SNOW_GOLEM_SPAWN_EGG"],["Soul Campfire","SOUL_CAMPFIRE"],["Soul Fire","SOUL_FIRE"],["Soul Lantern","SOUL_LANTERN"],["Soul Sand","SOUL_SAND"],["Soul Soil","SOUL_SOIL"],["Soul Torch","SOUL_TORCH"],["Soul Wall Torch","SOUL_WALL_TORCH"],["Spawner","SPAWNER"],["Spectral Arrow","SPECTRAL_ARROW"],["Spider Eye","SPIDER_EYE"],["Spider Spawn Egg","SPIDER_SPAWN_EGG"],["Spire Armor Trim Smithing Template","SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Splash Potion","SPLASH_POTION"],["Sponge","SPONGE"],["Spore Blossom","SPORE_BLOSSOM"],["Spruce Boat","SPRUCE_BOAT"],["Spruce Button","SPRUCE_BUTTON"],["Spruce Chest Boat","SPRUCE_CHEST_BOAT"],["Spruce Hanging Sign","SPRUCE_HANGING_SIGN"],["Spruce Leaves","SPRUCE_LEAVES"],["Spruce Pressure Plate","SPRUCE_PRESSURE_PLATE"],["Spruce Sapling","SPRUCE_SAPLING"],["Spruce Shelf","SPRUCE_SHELF"],["Spruce Sign","SPRUCE_SIGN"],["Spruce Wall Hanging Sign","SPRUCE_WALL_HANGING_SIGN"],["Spruce Wall Sign","SPRUCE_WALL_SIGN"],["Spyglass","SPYGLASS"],["Squid Spawn Egg","SQUID_SPAWN_EGG"],["Stick","STICK"],["Stonecutter","STONECUTTER"],["Stone Axe","STONE_AXE"],["Stone Button","STONE_BUTTON"],["Stone Hoe","STONE_HOE"],["Stone Pickaxe","STONE_PICKAXE"],["Stone Pressure Plate","STONE_PRESSURE_PLATE"],["Stone Shovel","STONE_SHOVEL"],["Stone Spear","STONE_SPEAR"],["Stone Sword","STONE_SWORD"],["Stray Spawn Egg","STRAY_SPAWN_EGG"],["Strider Spawn Egg","STRIDER_SPAWN_EGG"],["String","STRING"],["Stripped Pale Oak Log","STRIPPED_PALE_OAK_LOG"],["Stripped Pale Oak Wood","STRIPPED_PALE_OAK_WOOD"],["Structure Block","STRUCTURE_BLOCK"],["Structure Void","STRUCTURE_VOID"],["Sugar","SUGAR"],["Sugar Cane","SUGAR_CANE"],["Sunflower","SUNFLOWER"],["Suspicious Gravel","SUSPICIOUS_GRAVEL"],["Suspicious Sand","SUSPICIOUS_SAND"],["Suspicious Stew","SUSPICIOUS_STEW"],["Sweet Berries","SWEET_BERRIES"],["Sweet Berry Bush","SWEET_BERRY_BUSH"],["Tadpole Bucket","TADPOLE_BUCKET"],["Tadpole Spawn Egg","TADPOLE_SPAWN_EGG"],["Tall Dry Grass","TALL_DRY_GRASS"],["Tall Grass","TALL_GRASS"],["Tall Seagrass","TALL_SEAGRASS"],["Terracotta","TERRACOTTA"],["Test Block","TEST_BLOCK"],["Test Instance Block","TEST_INSTANCE_BLOCK"],["Tide Armor Trim Smithing Template","TIDE_ARMOR_TRIM_SMITHING_TEMPLATE"],["Tipped Arrow","TIPPED_ARROW"],["Tnt","TNT"],["Tnt Minecart","TNT_MINECART"],["Torch","TORCH"],["Torchflower","TORCHFLOWER"],["Torchflower Crop","TORCHFLOWER_CROP"],["Torchflower Seeds","TORCHFLOWER_SEEDS"],["Totem Of Undying","TOTEM_OF_UNDYING"],["Trader Llama Spawn Egg","TRADER_LLAMA_SPAWN_EGG"],["Trapped Chest","TRAPPED_CHEST"],["Trial Key","TRIAL_KEY"],["Trial Spawner","TRIAL_SPAWNER"],["Trident","TRIDENT"],["Tripwire","TRIPWIRE"],["Tropical Fish","TROPICAL_FISH"],["Tropical Fish Bucket","TROPICAL_FISH_BUCKET"],["Tropical Fish Spawn Egg","TROPICAL_FISH_SPAWN_EGG"],["Tube Coral","TUBE_CORAL"],["Tube Coral Block","TUBE_CORAL_BLOCK"],["Tube Coral Fan","TUBE_CORAL_FAN"],["Tube Coral Wall Fan","TUBE_CORAL_WALL_FAN"],["Tuff Bricks","TUFF_BRICKS"],["Turtle Egg","TURTLE_EGG"],["Turtle Helmet","TURTLE_HELMET"],["Turtle Scute","TURTLE_SCUTE"],["Turtle Spawn Egg","TURTLE_SPAWN_EGG"],["Twisting Vines","TWISTING_VINES"],["Twisting Vines Plant","TWISTING_VINES_PLANT"],["Vault","VAULT"],["Verdant Froglight","VERDANT_FROGLIGHT"],["Vex Armor Trim Smithing Template","VEX_ARMOR_TRIM_SMITHING_TEMPLATE"],["Vex Spawn Egg","VEX_SPAWN_EGG"],["Villager Spawn Egg","VILLAGER_SPAWN_EGG"],["Vindicator Spawn Egg","VINDICATOR_SPAWN_EGG"],["Vine","VINE"],["Void Air","VOID_AIR"],["Wall Torch","WALL_TORCH"],["Wandering Trader Spawn Egg","WANDERING_TRADER_SPAWN_EGG"],["Warden Spawn Egg","WARDEN_SPAWN_EGG"],["Ward Armor Trim Smithing Template","WARD_ARMOR_TRIM_SMITHING_TEMPLATE"],["Warped Button","WARPED_BUTTON"],["Warped Fungus","WARPED_FUNGUS"],["Warped Fungus On A Stick","WARPED_FUNGUS_ON_A_STICK"],["Warped Hanging Sign","WARPED_HANGING_SIGN"],["Warped Nylium","WARPED_NYLIUM"],["Warped Pressure Plate","WARPED_PRESSURE_PLATE"],["Warped Roots","WARPED_ROOTS"],["Warped Shelf","WARPED_SHELF"],["Warped Sign","WARPED_SIGN"],["Warped Wall Hanging Sign","WARPED_WALL_HANGING_SIGN"],["Warped Wall Sign","WARPED_WALL_SIGN"],["Warped Wart Block","WARPED_WART_BLOCK"],["Water Bucket","WATER_BUCKET"],["Water Cauldron","WATER_CAULDRON"],["Waxed Chiseled Copper","WAXED_CHISELED_COPPER"],["Waxed Copper Bars","WAXED_COPPER_BARS"],["Waxed Copper Block","WAXED_COPPER_BLOCK"],["Waxed Copper Bulb","WAXED_COPPER_BULB"],["Waxed Copper Chain","WAXED_COPPER_CHAIN"],["Waxed Copper Chest","WAXED_COPPER_CHEST"],["Waxed Copper Golem Statue","WAXED_COPPER_GOLEM_STATUE"],["Waxed Copper Grate","WAXED_COPPER_GRATE"],["Waxed Copper Lantern","WAXED_COPPER_LANTERN"],["Waxed Cut Copper","WAXED_CUT_COPPER"],["Waxed Exposed Chiseled Copper","WAXED_EXPOSED_CHISELED_COPPER"],["Waxed Exposed Copper","WAXED_EXPOSED_COPPER"],["Waxed Exposed Copper Bars","WAXED_EXPOSED_COPPER_BARS"],["Waxed Exposed Copper Bulb","WAXED_EXPOSED_COPPER_BULB"],["Waxed Exposed Copper Chain","WAXED_EXPOSED_COPPER_CHAIN"],["Waxed Exposed Copper Chest","WAXED_EXPOSED_COPPER_CHEST"],["Waxed Exposed Copper Golem Statue","WAXED_EXPOSED_COPPER_GOLEM_STATUE"],["Waxed Exposed Copper Grate","WAXED_EXPOSED_COPPER_GRATE"],["Waxed Exposed Copper Lantern","WAXED_EXPOSED_COPPER_LANTERN"],["Waxed Exposed Cut Copper","WAXED_EXPOSED_CUT_COPPER"],["Waxed Exposed Lightning Rod","WAXED_EXPOSED_LIGHTNING_ROD"],["Waxed Lightning Rod","WAXED_LIGHTNING_ROD"],["Waxed Oxidized Chiseled Copper","WAXED_OXIDIZED_CHISELED_COPPER"],["Waxed Oxidized Copper","WAXED_OXIDIZED_COPPER"],["Waxed Oxidized Copper Bars","WAXED_OXIDIZED_COPPER_BARS"],["Waxed Oxidized Copper Bulb","WAXED_OXIDIZED_COPPER_BULB"],["Waxed Oxidized Copper Chain","WAXED_OXIDIZED_COPPER_CHAIN"],["Waxed Oxidized Copper Chest","WAXED_OXIDIZED_COPPER_CHEST"],["Waxed Oxidized Copper Golem Statue","WAXED_OXIDIZED_COPPER_GOLEM_STATUE"],["Waxed Oxidized Copper Grate","WAXED_OXIDIZED_COPPER_GRATE"],["Waxed Oxidized Copper Lantern","WAXED_OXIDIZED_COPPER_LANTERN"],["Waxed Oxidized Cut Copper","WAXED_OXIDIZED_CUT_COPPER"],["Waxed Oxidized Lightning Rod","WAXED_OXIDIZED_LIGHTNING_ROD"],["Waxed Weathered Chiseled Copper","WAXED_WEATHERED_CHISELED_COPPER"],["Waxed Weathered Copper","WAXED_WEATHERED_COPPER"],["Waxed Weathered Copper Bars","WAXED_WEATHERED_COPPER_BARS"],["Waxed Weathered Copper Bulb","WAXED_WEATHERED_COPPER_BULB"],["Waxed Weathered Copper Chain","WAXED_WEATHERED_COPPER_CHAIN"],["Waxed Weathered Copper Chest","WAXED_WEATHERED_COPPER_CHEST"],["Waxed Weathered Copper Golem Statue","WAXED_WEATHERED_COPPER_GOLEM_STATUE"],["Waxed Weathered Copper Grate","WAXED_WEATHERED_COPPER_GRATE"],["Waxed Weathered Copper Lantern","WAXED_WEATHERED_COPPER_LANTERN"],["Waxed Weathered Cut Copper","WAXED_WEATHERED_CUT_COPPER"],["Waxed Weathered Lightning Rod","WAXED_WEATHERED_LIGHTNING_ROD"],["Wayfinder Armor Trim Smithing Template","WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE"],["Weathered Chiseled Copper","WEATHERED_CHISELED_COPPER"],["Weathered Copper","WEATHERED_COPPER"],["Weathered Copper Bars","WEATHERED_COPPER_BARS"],["Weathered Copper Bulb","WEATHERED_COPPER_BULB"],["Weathered Copper Chain","WEATHERED_COPPER_CHAIN"],["Weathered Copper Chest","WEATHERED_COPPER_CHEST"],["Weathered Copper Golem Statue","WEATHERED_COPPER_GOLEM_STATUE"],["Weathered Copper Grate","WEATHERED_COPPER_GRATE"],["Weathered Copper Lantern","WEATHERED_COPPER_LANTERN"],["Weathered Cut Copper","WEATHERED_CUT_COPPER"],["Weathered Lightning Rod","WEATHERED_LIGHTNING_ROD"],["Weeping Vines","WEEPING_VINES"],["Weeping Vines Plant","WEEPING_VINES_PLANT"],["Wet Sponge","WET_SPONGE"],["Wheat","WHEAT"],["Wheat Seeds","WHEAT_SEEDS"],["White Bundle","WHITE_BUNDLE"],["White Candle Cake","WHITE_CANDLE_CAKE"],["White Dye","WHITE_DYE"],["White Harness","WHITE_HARNESS"],["White Tulip","WHITE_TULIP"],["Wildflowers","WILDFLOWERS"],["Wild Armor Trim Smithing Template","WILD_ARMOR_TRIM_SMITHING_TEMPLATE"],["Wind Charge","WIND_CHARGE"],["Witch Spawn Egg","WITCH_SPAWN_EGG"],["Wither Rose","WITHER_ROSE"],["Wither Skeleton Skull","WITHER_SKELETON_SKULL"],["Wither Skeleton Spawn Egg","WITHER_SKELETON_SPAWN_EGG"],["Wither Skeleton Wall Skull","WITHER_SKELETON_WALL_SKULL"],["Wither Spawn Egg","WITHER_SPAWN_EGG"],["Wolf Armor","WOLF_ARMOR"],["Wolf Spawn Egg","WOLF_SPAWN_EGG"],["Wooden Axe","WOODEN_AXE"],["Wooden Hoe","WOODEN_HOE"],["Wooden Pickaxe","WOODEN_PICKAXE"],["Wooden Shovel","WOODEN_SHOVEL"],["Wooden Spear","WOODEN_SPEAR"],["Wooden Sword","WOODEN_SWORD"],["Writable Book","WRITABLE_BOOK"],["Written Book","WRITTEN_BOOK"],["Yellow Bundle","YELLOW_BUNDLE"],["Yellow Candle Cake","YELLOW_CANDLE_CAKE"],["Yellow Dye","YELLOW_DYE"],["Yellow Harness","YELLOW_HARNESS"],["Zoglin Spawn Egg","ZOGLIN_SPAWN_EGG"],["Zombie Head","ZOMBIE_HEAD"],["Zombie Horse Spawn Egg","ZOMBIE_HORSE_SPAWN_EGG"],["Zombie Nautilus Spawn Egg","ZOMBIE_NAUTILUS_SPAWN_EGG"],["Zombie Spawn Egg","ZOMBIE_SPAWN_EGG"],["Zombie Villager Spawn Egg","ZOMBIE_VILLAGER_SPAWN_EGG"],["Zombie Wall Head","ZOMBIE_WALL_HEAD"],["Zombified Piglin Spawn Egg","ZOMBIFIED_PIGLIN_SPAWN_EGG"]]),"MATERIAL_ID"),this.setOutput(!0,"Block"),this.setColour(200),this.setTooltip("Select a miscellaneous Minecraft block or item.")}},(a=r=E.pythonGenerator).INDENT=" ",h=a.init,a.init=function(e){h.call(this,e),this.methods_=Object.create(null)},a.finish=function(e){let t=Object.values(a.methods_||{}),i=a.INDENT,o=t.length>0?"\n"+t.map(e=>a.prefixLines(e,i)).join("\n\n"):"",s=i+i,n=a.prefixLines(e,s)||s+"pass",r=new Date().toISOString();return`
|
|
309
337
|
from mcshell.constants import *
|
|
310
338
|
|
|
311
339
|
# Generated by Blockly MC-ED on ${r}
|
|
@@ -326,10 +354,10 @@ ${l}`},a.forBlock.controls_forEach=function(t,i){let o=i.nameDB_.getName(t.getFi
|
|
|
326
354
|
${n}`},a.forBlock.procedures_defnoreturn=function(t,i){let o=i.nameDB_.getName(t.getFieldValue("NAME"),e.BlocklyNameTypes.PROCEDURE),s=i.statementToCode(t,"STACK")||i.INDENT+"pass\n";s=`${i.prefixLines("if self.cancel_event and self.cancel_event.is_set(): return\n",i.INDENT)}${s}`;let n=t.getVars().map(t=>i.nameDB_.getName(t,e.BlocklyNameTypes.VARIABLE)),r=`def ${o}(self, ${n.join(", ")}):
|
|
327
355
|
${s}`;return i.methods_||(i.methods_={}),i.methods_["%"+o]=r,null},a.forBlock.procedures_defreturn=function(t,i){let o=i.nameDB_.getName(t.getFieldValue("NAME"),e.BlocklyNameTypes.PROCEDURE),s=i.statementToCode(t,"STACK"),n=i.valueToCode(t,"RETURN",i.ORDER_NONE)||"None";s=(s||"")+(i.INDENT+"return "+n)+"\n",s=`${i.prefixLines("if self.cancel_event and self.cancel_event.is_set(): return\n",i.INDENT)}${s}`;let r=t.getVars().map(t=>i.nameDB_.getName(t,e.BlocklyNameTypes.VARIABLE)),l=`def ${o}(self, ${r.join(", ")}):
|
|
328
356
|
${s}`;return i.methods_||(i.methods_={}),i.methods_["%"+o]=l,null},a.forBlock.procedures_callnoreturn=function(t,i){let o=i.nameDB_.getName(t.getFieldValue("NAME"),e.BlocklyNameTypes.PROCEDURE),s=t.getVars(),n=[];for(let o=0;o<s.length;o++){let r,l=i.nameDB_.getName(s[o],e.BlocklyNameTypes.VARIABLE);r=t.getInputTargetBlock("ARG"+o)?i.valueToCode(t,"ARG"+o,i.ORDER_NONE)||"None":`self.runtime_params.get('${l}', None)`,n.push(`${l}=${r}`)}return"self."+o+"("+n.join(", ")+")\n"},a.forBlock.procedures_callreturn=function(t,i){let o=i.nameDB_.getName(t.getFieldValue("NAME"),e.BlocklyNameTypes.PROCEDURE),s=t.getVars(),n=[];for(let o=0;o<s.length;o++){let r=i.nameDB_.getName(s[o],e.BlocklyNameTypes.VARIABLE),l=t.getInputTargetBlock("ARG"+o)?i.valueToCode(t,"ARG"+o,i.ORDER_NONE)||"None":`self.runtime_params.get('${r}', None)`;n.push(`${r}=${l}`)}return["self."+o+"("+n.join(", ")+")",i.ORDER_FUNCTION_CALL]},a.forBlock.procedures_ifreturn=function(e,t){let i="if "+(t.valueToCode(e,"CONDITION",t.ORDER_NONE)||"False")+":\n";if(e.hasReturnValue_){let o=t.valueToCode(e,"VALUE",t.ORDER_NONE)||"None";i+=t.INDENT+"return "+o+"\n"}else i+=t.INDENT+"return\n";return i},a.forBlock.minecraft_matrix_3d_elements=function(e,t){let i=t.valueToCode(e,"R00",t.ORDER_ATOMIC)||"1.0",o=t.valueToCode(e,"R01",t.ORDER_ATOMIC)||"0.0",s=t.valueToCode(e,"R02",t.ORDER_ATOMIC)||"0.0",n=t.valueToCode(e,"R10",t.ORDER_ATOMIC)||"0.0",r=t.valueToCode(e,"R11",t.ORDER_ATOMIC)||"1.0",l=t.valueToCode(e,"R12",t.ORDER_ATOMIC)||"0.0",a=t.valueToCode(e,"R20",t.ORDER_ATOMIC)||"0.0",c=t.valueToCode(e,"R21",t.ORDER_ATOMIC)||"0.0",h=t.valueToCode(e,"R22",t.ORDER_ATOMIC)||"1.0";return[`Matrix3([[${i}, ${o}, ${s}], [${n}, ${r}, ${l}], [${a}, ${c}, ${h}]])`,t.ORDER_FUNCTION_CALL]},a.forBlock.minecraft_matrix_3d_euler=function(e,t){let i=t.valueToCode(e,"YAW",t.ORDER_ATOMIC)||"0.0",o=t.valueToCode(e,"PITCH",t.ORDER_ATOMIC)||"0.0",s=t.valueToCode(e,"ROLL",t.ORDER_ATOMIC)||"0.0";return[`Matrix3.from_euler_angles(yaw_degrees=${i}, pitch_degrees=${o}, roll_degrees=${s})`,t.ORDER_FUNCTION_CALL]},a.forBlock.minecraft_vector_3d=function(e,t){let i=t.valueToCode(e,"X",t.ORDER_ATOMIC)||"0",o=t.valueToCode(e,"Y",t.ORDER_ATOMIC)||"0",s=t.valueToCode(e,"Z",t.ORDER_ATOMIC)||"0";return[`Vec3(${i}, ${o}, ${s})`,t.ORDER_FUNCTION_CALL]},a.forBlock.minecraft_vector_get_attribute=function(e,t){let i=t.valueToCode(e,"VECTOR",t.ORDER_ATOMIC)||"Vec3(0, 0, 0)",o=e.getFieldValue("COMPONENT").toLowerCase();return[`${i}.${o}`,t.ORDER_MEMBER]},a.forBlock.minecraft_vector_delta=function(e,t){let i=e.getFieldValue("X"),o=e.getFieldValue("Y"),s=e.getFieldValue("Z");return[`Vec3(${i},${o},${s})`,t.ORDER_ATOMIC]},a.forBlock.minecraft_position_get_direction=function(e,t){return["self.action_implementer.mcplayer.direction",t.ORDER_ATOMIC]},a.forBlock.minecraft_position_player=function(e,t){return["self.action_implementer.mcplayer.position",t.ORDER_ATOMIC]},a.forBlock.minecraft_position_player_tile=function(e,t){return["self.action_implementer.mcplayer.tile_position",t.ORDER_ATOMIC]},a.forBlock.minecraft_position_here=function(e,t){return["self.action_implementer.mcplayer.here",t.ORDER_ATOMIC]},a.forBlock.minecraft_position_get_compass_direction=function(e,t){return["self.action_implementer.mcplayer.compass_direction",t.ORDER_FUNCTION_CALL]},a.forBlock.minecraft_vector_binary_op=function(e,t){let i={ADD:[" + ",t.ORDER_ADDITIVE],SUBTRACT:[" - ",t.ORDER_ADDITIVE],CROSS:[".cross(",t.ORDER_FUNCTION_CALL]},o=e.getFieldValue("OP"),s=i[o],n=s[0],r=s[1],l=t.valueToCode(e,"A",r)||"Vec3()",a=t.valueToCode(e,"B",r)||"Vec3()";return["CROSS"===o?`${l}${n}${a})`:`${l}${n}${a}`,r]},a.forBlock.minecraft_vector_scalar_multiply=function(e,t){let i=t.valueToCode(e,"A",t.ORDER_MULTIPLICATIVE)||"Vec3()",o=t.valueToCode(e,"B",t.ORDER_MULTIPLICATIVE)||"1";return[`${i} * ${o}`,t.ORDER_MULTIPLICATIVE]},a.forBlock.minecraft_vector_dot_product=function(e,t){let i=t.valueToCode(e,"A",t.ORDER_ATOMIC)||"Vec3()",o=t.valueToCode(e,"B",t.ORDER_ATOMIC)||"Vec3()";return[`${i}.dot(${o})`,t.ORDER_FUNCTION_CALL]},a.forBlock.minecraft_matrix_vector_multiply=function(e,t){let i=t.valueToCode(e,"A",t.ORDER_MULTIPLICATIVE)||"Matrix3.identity()",o=t.valueToCode(e,"B",t.ORDER_MULTIPLICATIVE)||"Vec3()";return[`${i} @ ${o}`,t.ORDER_MULTIPLICATIVE]},a.forBlock.minecraft_coloured_block_picker=function(e,t){let i=e.getFieldValue("MINECRAFT_COLOUR_ID");return[`'${i}'`,t.ORDER_ATOMIC]},a.forBlock.time_sleep=function(e,t){let i=t.valueToCode(e,"SECONDS",t.ORDER_ATOMIC)||"1";return`time.sleep(${i})
|
|
329
|
-
`},r.forBlock.digital_geometry_create_digital_cube=function(e,t){let i=t.valueToCode(e,"CENTER",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"SIDE_LENGTH",t.ORDER_ATOMIC)||0,s=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"";return`self.action_implementer.create_digital_cube(center=${i}, side_length=${o}, block_type=${s})
|
|
330
|
-
`},r.forBlock.digital_geometry_create_digital_disc=function(e,t){let i=t.valueToCode(e,"CENTER",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"RADIUS",t.ORDER_ATOMIC)||0,s=t.valueToCode(e,"NORMAL",t.ORDER_ATOMIC)||"None",n=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"";return`self.action_implementer.create_digital_disc(center=${i}, radius=${o}, normal=${s}, block_type=${n})
|
|
331
|
-
`},r.forBlock.digital_geometry_create_digital_line=function(e,t){let i=t.valueToCode(e,"POINT1",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"POINT2",t.ORDER_ATOMIC)||"None",s=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"";return`self.action_implementer.create_digital_line(point1=${i}, point2=${o}, block_type=${s})
|
|
332
|
-
`},r.forBlock.digital_geometry_create_digital_sphere=function(e,t){let i=t.valueToCode(e,"CENTER",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"RADIUS",t.ORDER_ATOMIC)||0,s=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"";return`self.action_implementer.create_digital_sphere(center=${i}, radius=${o}, block_type=${s})
|
|
357
|
+
`},r.forBlock.digital_geometry_create_digital_cube=function(e,t){let i=t.valueToCode(e,"CENTER",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"SIDE_LENGTH",t.ORDER_ATOMIC)||0,s=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.create_digital_cube(center=${i}, side_length=${o}, block_type=${s})
|
|
358
|
+
`},r.forBlock.digital_geometry_create_digital_disc=function(e,t){let i=t.valueToCode(e,"CENTER",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"RADIUS",t.ORDER_ATOMIC)||0,s=t.valueToCode(e,"NORMAL",t.ORDER_ATOMIC)||"None",n=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.create_digital_disc(center=${i}, radius=${o}, normal=${s}, block_type=${n})
|
|
359
|
+
`},r.forBlock.digital_geometry_create_digital_line=function(e,t){let i=t.valueToCode(e,"POINT1",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"POINT2",t.ORDER_ATOMIC)||"None",s=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.create_digital_line(point1=${i}, point2=${o}, block_type=${s})
|
|
360
|
+
`},r.forBlock.digital_geometry_create_digital_sphere=function(e,t){let i=t.valueToCode(e,"CENTER",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"RADIUS",t.ORDER_ATOMIC)||0,s=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.create_digital_sphere(center=${i}, radius=${o}, block_type=${s})
|
|
333
361
|
`},r.forBlock.event_actions_clear_events=function(e,t){return`self.action_implementer.clear_events()
|
|
334
362
|
`},r.forBlock.event_actions_wait_for_chat_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.wait_for_chat_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.event_actions_wait_for_projectile_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.wait_for_projectile_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.event_actions_wait_for_sword_strike_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.wait_for_sword_strike_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.l_system_shapes_define_rule=function(e,t){let i=t.valueToCode(e,"PREDECESSOR",t.ORDER_ATOMIC)||"",o=t.valueToCode(e,"SUCCESSOR",t.ORDER_ATOMIC)||"";return[`self.action_implementer.define_rule(predecessor=${i}, successor=${o})`,t.ORDER_FUNCTION_CALL]},r.forBlock.l_system_shapes_get_lsystem_shape=function(e,t){let i=t.valueToCode(e,"AXIOM",t.ORDER_ATOMIC)||"",o=t.valueToCode(e,"ITERATIONS",t.ORDER_ATOMIC)||0,s=t.valueToCode(e,"STEP_LENGTH",t.ORDER_ATOMIC)||0,n=t.valueToCode(e,"RULES",t.ORDER_ATOMIC)||"None";return[`self.action_implementer.get_lsystem_shape(axiom=${i}, iterations=${o}, step_length=${s}, rules=${n})`,t.ORDER_FUNCTION_CALL]},r.forBlock.player_actions_get_compass_direction=function(e,t){return["self.action_implementer.get_compass_direction()",t.ORDER_FUNCTION_CALL]},r.forBlock.player_actions_get_compass_direction_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_compass_direction_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.player_actions_get_direction=function(e,t){return["self.action_implementer.get_direction()",t.ORDER_FUNCTION_CALL]},r.forBlock.player_actions_get_position=function(e,t){return["self.action_implementer.get_position()",t.ORDER_FUNCTION_CALL]},r.forBlock.player_actions_get_tile_position=function(e,t){return["self.action_implementer.get_tile_position()",t.ORDER_FUNCTION_CALL]},r.forBlock.player_actions_get_tile_position_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"";return[`self.action_implementer.get_tile_position_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.player_actions_send_title=function(e,t){let i=t.valueToCode(e,"TITLE",t.ORDER_ATOMIC)||"",o=t.valueToCode(e,"SUBTITLE",t.ORDER_ATOMIC)||"",s=t.valueToCode(e,"STAY",t.ORDER_ATOMIC)||70,n=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return`self.action_implementer.send_title(title=${i}, subtitle=${o}, stay=${s}, player_name=${n})
|
|
335
363
|
`},r.forBlock.player_actions_set_compass_direction=function(e,t){let i=t.valueToCode(e,"DIR",t.ORDER_ATOMIC)||"None";return`self.action_implementer.set_compass_direction(dir=${i})
|
|
@@ -337,8 +365,8 @@ ${s}`;return i.methods_||(i.methods_={}),i.methods_["%"+o]=l,null},a.forBlock.pr
|
|
|
337
365
|
`},r.forBlock.player_actions_set_position=function(e,t){let i=t.valueToCode(e,"POS",t.ORDER_ATOMIC)||"None";return`self.action_implementer.set_position(pos=${i})
|
|
338
366
|
`},r.forBlock.player_actions_wait_for_sword_strike=function(e,t){return["self.action_implementer.wait_for_sword_strike()",t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_create_explosion=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"POWER",t.ORDER_ATOMIC)||4;return`self.action_implementer.create_explosion(position=${i}, power=${o})
|
|
339
367
|
`},r.forBlock.pyncraft_actions_get_block=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None";return[`self.action_implementer.get_block(position=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_block_with_data=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None";return[`self.action_implementer.get_block_with_data(position=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_direction_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_direction_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_food_level_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_food_level_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_health_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_health_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_height=function(e,t){let i=t.valueToCode(e,"X",t.ORDER_ATOMIC)||0,o=t.valueToCode(e,"Z",t.ORDER_ATOMIC)||0;return[`self.action_implementer.get_height(x=${i}, z=${o})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_pitch_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_pitch_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_player_entity_id=function(e,t){let i=t.valueToCode(e,"NAME",t.ORDER_ATOMIC)||"";return[`self.action_implementer.get_player_entity_id(name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_player_entity_ids=function(e,t){return["self.action_implementer.get_player_entity_ids()",t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_position_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_position_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_rotation_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_rotation_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_tile_position_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_tile_position_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_get_yaw_by_name=function(e,t){let i=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return[`self.action_implementer.get_yaw_by_name(player_name=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.pyncraft_actions_send_title_by_name=function(e,t){let i=t.valueToCode(e,"TITLE",t.ORDER_ATOMIC)||"",o=t.valueToCode(e,"SUBTITLE",t.ORDER_ATOMIC)||"",s=t.valueToCode(e,"STAY",t.ORDER_ATOMIC)||70,n=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return`self.action_implementer.send_title_by_name(title=${i}, subtitle=${o}, stay=${s}, player_name=${n})
|
|
340
|
-
`},r.forBlock.pyncraft_actions_set_block=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"";return`self.action_implementer.set_block(position=${i}, block_type=${o})
|
|
341
|
-
`},r.forBlock.pyncraft_actions_set_blocks=function(e,t){let i=t.valueToCode(e,"P1",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"P2",t.ORDER_ATOMIC)||"None",s=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"";return`self.action_implementer.set_blocks(p1=${i}, p2=${o}, block_type=${s})
|
|
368
|
+
`},r.forBlock.pyncraft_actions_set_block=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.set_block(position=${i}, block_type=${o})
|
|
369
|
+
`},r.forBlock.pyncraft_actions_set_blocks=function(e,t){let i=t.valueToCode(e,"P1",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"P2",t.ORDER_ATOMIC)||"None",s=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.set_blocks(p1=${i}, p2=${o}, block_type=${s})
|
|
342
370
|
`},r.forBlock.pyncraft_actions_set_direction_by_name=function(e,t){let i=t.valueToCode(e,"DIRECTION",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return`self.action_implementer.set_direction_by_name(direction=${i}, player_name=${o})
|
|
343
371
|
`},r.forBlock.pyncraft_actions_set_position_by_name=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return`self.action_implementer.set_position_by_name(position=${i}, player_name=${o})
|
|
344
372
|
`},r.forBlock.pyncraft_actions_set_rotation_by_name=function(e,t){let i=t.valueToCode(e,"YAW",t.ORDER_ATOMIC)||0,o=t.valueToCode(e,"PITCH",t.ORDER_ATOMIC)||0,s=t.valueToCode(e,"PLAYER_NAME",t.ORDER_ATOMIC)||"SELF";return`self.action_implementer.set_rotation_by_name(yaw=${i}, pitch=${o}, player_name=${s})
|
|
@@ -361,8 +389,8 @@ ${s}`;return i.methods_||(i.methods_={}),i.methods_["%"+o]=l,null},a.forBlock.pr
|
|
|
361
389
|
`},r.forBlock.turtle_actions_turtle_set_brush=function(e,t){let i=t.valueToCode(e,"SHAPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.turtle_set_brush(shape=${i})
|
|
362
390
|
`},r.forBlock.turtle_actions_turtle_stamp=function(e,t){let i=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.turtle_stamp(block_type=${i})
|
|
363
391
|
`},r.forBlock.picker_metric=function(e,t){let i=e.getFieldValue("VALUE");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.turtle_shapes_get_arithmetic_plane=function(e,t){let i=t.valueToCode(e,"NORMAL",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"SIDE_LENGTH",t.ORDER_ATOMIC)||0;return[`self.action_implementer.get_arithmetic_plane(normal=${i}, side_length=${o})`,t.ORDER_FUNCTION_CALL]},r.forBlock.turtle_shapes_get_line=function(e,t){let i=t.valueToCode(e,"P1",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"P2",t.ORDER_ATOMIC)||"None";return[`self.action_implementer.get_line(p1=${i}, p2=${o})`,t.ORDER_FUNCTION_CALL]},r.forBlock.turtle_shapes_get_metric_ball=function(e,t){let i=t.valueToCode(e,"RADIUS",t.ORDER_ATOMIC)||0,o=t.valueToCode(e,"METRIC",t.ORDER_ATOMIC)||"None";return[`self.action_implementer.get_metric_ball(radius=${i}, metric=${o})`,t.ORDER_FUNCTION_CALL]},r.forBlock.world_actions_get_height=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None";return[`self.action_implementer.get_height(position=${i})`,t.ORDER_FUNCTION_CALL]},r.forBlock.world_actions_post_to_chat=function(e,t){let i=t.valueToCode(e,"MESSAGE",t.ORDER_ATOMIC)||"";return`self.action_implementer.post_to_chat(message=${i})
|
|
364
|
-
`},r.forBlock.world_actions_set_block=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"";return`self.action_implementer.set_block(position=${i}, block_type=${o})
|
|
392
|
+
`},r.forBlock.world_actions_set_block=function(e,t){let i=t.valueToCode(e,"POSITION",t.ORDER_ATOMIC)||"None",o=t.valueToCode(e,"BLOCK_TYPE",t.ORDER_ATOMIC)||"None";return`self.action_implementer.set_block(position=${i}, block_type=${o})
|
|
365
393
|
`},r.forBlock.minecraft_entity_picker_hostile_mobs=function(e,t){let i=e.getFieldValue("ENTITY_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_entity_picker_minecarts=function(e,t){let i=e.getFieldValue("ENTITY_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_entity_picker_miscellaneous_entities=function(e,t){let i=e.getFieldValue("ENTITY_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_entity_picker_passive_mobs=function(e,t){let i=e.getFieldValue("ENTITY_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_entity_picker_projectiles=function(e,t){let i=e.getFieldValue("ENTITY_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_entity_picker_utility_and_special=function(e,t){let i=e.getFieldValue("ENTITY_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_material_banner=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"BANNER"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_bed=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"BED"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_candle=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"CANDLE"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_carpet=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"CARPET"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_concrete=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"CONCRETE"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_concrete_powder=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"CONCRETE_POWDER"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_glazed_terracotta=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"GLAZED_TERRACOTTA"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_shulker_box=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"SHULKER_BOX"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_stained_glass=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"STAINED_GLASS"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_stained_glass_pane=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"STAINED_GLASS_PANE"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_terracotta=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"TERRACOTTA"),t.ORDER_ATOMIC]},r.forBlock.minecraft_material_wool=function(e,t){let i=t.valueToCode(e,"COLOUR",t.ORDER_ATOMIC)||"'WHITE'";return[T(`'${i}'`,"WOOL"),t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_doors=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_fences=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_gates=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_glass=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_ores=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_redstone_components=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_slabs=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_stairs=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_stone_bricks=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_trapdoors=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_walls=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_wood_full=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_wood_logs=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_wood_planks=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_world=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]},r.forBlock.minecraft_picker_miscellaneous=function(e,t){let i=e.getFieldValue("MATERIAL_ID");return[`'${i}'`,t.ORDER_ATOMIC]};let C=function(){try{let e=localStorage.getItem(f);if(e){let t=JSON.parse(e);if(t&&t.blocks)return console.log("Found and loaded workspace from localStorage."),t}}catch(e){console.error("Error loading autosaved workspace:",e)}return console.log("No valid autosave found, loading default workspace."),null}();if(!C)try{let e=await fetch("./workspace.json");C=e.ok?await e.json():m}catch(e){C=m}console.log("Workspace will be initialized with this JSON:",C);let O=new URL(S);try{let e=await fetch(O);if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);c=await e.text()}catch(e){console.error("Could not load toolbox.xml. Using empty toolbox.",e),c="<xml></xml>"}if(t=g.inject("blocklyDiv",{toolbox:c,grid:{spacing:20,length:3,colour:"#ccc",snap:!0},zoom:{controls:!0,wheel:!0,startScale:1,maxScale:3,minScale:.3,scaleSpeed:1.2},move:{scrollbars:!0,drag:!0,wheel:!1}}),console.log("Initializing global htmx event listeners..."),document.body.addEventListener("showError",function(e){console.error("Custom server error event received:",e.detail);let t=e.detail.errorMessage||"An unknown server error occurred.";alert(`Application Error: ${t}`)}),document.body.addEventListener("htmx:responseError",function(e){console.error("HTMX Response Error:",e.detail);let t=e.detail.xhr,i=`A server communication error occurred.
|
|
366
394
|
|
|
367
|
-
Status: ${t.status} - ${t.statusText}`;0===t.status&&(i="Network Error: Could not connect to the server. Is it running?"),alert(i)}),C&&C.blocks)try{g.serialization.workspaces.load(C,t),console.log("Successfully loaded initial workspace from JSON data.")}catch(e){console.error("Error loading workspace JSON data:",e)}console.log("Setting up autosave listeners."),window.addEventListener("beforeunload",I);let A=R(I,1e3);t.addChangeListener(e=>{e.isUiEvent||A()});let $=document.getElementById("clearWorkspaceButton");$&&$.addEventListener("click",()=>{confirm("Are you sure you want to clear the workspace? This cannot be undone.")&&(t.clear(),localStorage.removeItem(f),console.log("Workspace and autosave data cleared."))});let N=document.getElementById("pythonCodeDisplay"),L=R(()=>{if(!t||!E.pythonGenerator)return;let e=E.pythonGenerator.workspaceToCode(t);N&&(N.textContent=e,window.Prism&&l(p).highlightElement(N))});t.addChangeListener(e=>{e.isUiEvent||L()}),L();let y=document.getElementById("confirmSaveButton");y&&y.addEventListener("click",b);let D=document.getElementById("loadPowerFromFileButton");D&&D.addEventListener("click",_);let k=document.getElementById("executePowerButton");k&&k.addEventListener("click",async()=>{console.log("Execute (Debug) button clicked.");let e=function(e){let t=e.getTopBlocks(!1);if(0===t.length)return null;let i=["procedures_defnoreturn","procedures_defreturn"],o=t.filter(e=>!i.includes(e.type)&&e.isEnabled()),s=t.filter(e=>i.includes(e.type)&&e.isEnabled());if(o.length>0)return{type:"script",code:E.pythonGenerator.workspaceToCode(e)};if(s.length>0){let t=s[0].getFieldValue("NAME");return{type:"functional",code:E.pythonGenerator.workspaceToCode(e),function_name:t}}return null}(t);if(!e)return;let i=document.getElementById("pythonCodeDisplay");i&&(i.textContent=e.code,window.Prism&&l(p).highlightElement(i));let o=await d("%mc_debug_and_define",JSON.stringify(e));o&&alert("Debug Output:\n\n"+o)}),document.body.addEventListener("loadPower",function(e){if(!e.detail||!e.detail.powerData||!e.detail.powerData.blockly_json)return void alert("Error: Could not load power. Data is missing.");let i=e.detail.powerData,o=e.detail.mode;console.log(`Received power to load: '${i.name}' in '${o}' mode.`);try{if("replace"===o){if(t.getAllBlocks(!1).length>0&&!confirm(`This will replace your current workspace with the power '${i.name}'. Are you sure?`))return;g.serialization.workspaces.load(i.blockly_json,t),console.log("Workspace replaced successfully.")}else{console.log("Appending power to workspace...");let e=i.blockly_json,o=t.getVariableMap(),s={};if(e.variables)for(let i of e.variables){let e=o.getVariable(i.name);e&&e.getId()!==i.id?s[i.id]=e.getId():e||t.createVariable(i.name,i.type,i.id)}let n=e.blocks;if(Object.keys(s).length>0&&n){let e=JSON.stringify(n);for(let t in s){let i=s[t],o=RegExp(`"${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"`,"g");e=e.replace(o,`"${i}"`)}n=JSON.parse(e)}if(n&&Array.isArray(n.blocks)){g.Events.disable();try{let e=n.blocks;for(let i of e)("procedures_defnoreturn"===i.type||"procedures_defreturn"===i.type)&&(i.collapsed=!0),g.serialization.blocks.append(i,t);console.log(`Appended ${e.length} new block stack(s).`)}finally{g.Events.enable()}t.getTopBlocks(!1).length>0&&(t.render(),t.cleanUp())}}I()}catch(e){console.error("Error deserializing or loading workspace:",e),alert("Could not load the power. The file may be corrupted.")}});let w=R(()=>{console.log("Resizing Blockly canvas..."),window.dispatchEvent(new Event("resize"))},100),
|
|
368
|
-
//# sourceMappingURL=mced.
|
|
395
|
+
Status: ${t.status} - ${t.statusText}`;0===t.status&&(i="Network Error: Could not connect to the server. Is it running?"),alert(i)}),C&&C.blocks)try{g.serialization.workspaces.load(C,t),console.log("Successfully loaded initial workspace from JSON data.")}catch(e){console.error("Error loading workspace JSON data:",e)}console.log("Setting up autosave listeners."),window.addEventListener("beforeunload",I);let A=R(I,1e3);t.addChangeListener(e=>{e.isUiEvent||A()});let $=document.getElementById("clearWorkspaceButton");$&&$.addEventListener("click",()=>{confirm("Are you sure you want to clear the workspace? This cannot be undone.")&&(t.clear(),localStorage.removeItem(f),console.log("Workspace and autosave data cleared."))});let N=document.getElementById("pythonCodeDisplay"),L=R(()=>{if(!t||!E.pythonGenerator)return;let e=E.pythonGenerator.workspaceToCode(t);N&&(N.textContent=e,window.Prism&&l(p).highlightElement(N))});t.addChangeListener(e=>{e.isUiEvent||L()}),L();let y=document.getElementById("confirmSaveButton");y&&y.addEventListener("click",b);let D=document.getElementById("loadPowerFromFileButton");D&&D.addEventListener("click",_);let k=document.getElementById("executePowerButton");k&&k.addEventListener("click",async()=>{console.log("Execute (Debug) button clicked.");let e=function(e){let t=e.getTopBlocks(!1);if(0===t.length)return null;let i=["procedures_defnoreturn","procedures_defreturn"],o=t.filter(e=>!i.includes(e.type)&&e.isEnabled()),s=t.filter(e=>i.includes(e.type)&&e.isEnabled());if(o.length>0)return{type:"script",code:E.pythonGenerator.workspaceToCode(e)};if(s.length>0){let t=s[0].getFieldValue("NAME");return{type:"functional",code:E.pythonGenerator.workspaceToCode(e),function_name:t}}return null}(t);if(!e)return;let i=document.getElementById("pythonCodeDisplay");i&&(i.textContent=e.code,window.Prism&&l(p).highlightElement(i));let o=await d("%mc_debug_and_define",JSON.stringify(e));o&&alert("Debug Output:\n\n"+o)}),document.body.addEventListener("loadPower",function(e){if(!e.detail||!e.detail.powerData||!e.detail.powerData.blockly_json)return void alert("Error: Could not load power. Data is missing.");let i=e.detail.powerData,o=e.detail.mode;console.log(`Received power to load: '${i.name}' in '${o}' mode.`);try{if("replace"===o){if(t.getAllBlocks(!1).length>0&&!confirm(`This will replace your current workspace with the power '${i.name}'. Are you sure?`))return;g.serialization.workspaces.load(i.blockly_json,t),console.log("Workspace replaced successfully.")}else{console.log("Appending power to workspace...");let e=i.blockly_json,o=t.getVariableMap(),s={};if(e.variables)for(let i of e.variables){let e=o.getVariable(i.name);e&&e.getId()!==i.id?s[i.id]=e.getId():e||t.createVariable(i.name,i.type,i.id)}let n=e.blocks;if(Object.keys(s).length>0&&n){let e=JSON.stringify(n);for(let t in s){let i=s[t],o=RegExp(`"${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}"`,"g");e=e.replace(o,`"${i}"`)}n=JSON.parse(e)}if(n&&Array.isArray(n.blocks)){g.Events.disable();try{let e=n.blocks;for(let i of e)("procedures_defnoreturn"===i.type||"procedures_defreturn"===i.type)&&(i.collapsed=!0),g.serialization.blocks.append(i,t);console.log(`Appended ${e.length} new block stack(s).`)}finally{g.Events.enable()}t.getTopBlocks(!1).length>0&&(t.render(),t.cleanUp())}}I()}catch(e){console.error("Error deserializing or loading workspace:",e),alert("Could not load the power. The file may be corrupted.")}});let w=R(()=>{console.log("Resizing Blockly canvas..."),window.dispatchEvent(new Event("resize"))},100),M=document.querySelector("#power-library-panel .toggle-btn"),v=document.querySelector("#code-preview-panel .toggle-btn");M&&M.addEventListener("click",w),v&&v.addEventListener("click",w);let P=R(()=>{t&&(console.log("Triggering Blockly resize..."),g.svgResize(t))},100);window.addEventListener("resize",P),window.triggerBlocklyResize=P,document.body.addEventListener("library-changed",e=>{console.log("Event 'library-changed' was successfully dispatched!"),console.log("Event Detail (data passed with dispatch):",e.detail)})}S=import.meta.resolve("2N3MJ"),document.addEventListener("DOMContentLoaded",()=>{console.log("DOM fully loaded and parsed."),d.default.start(),console.log("Alpine.js started."),R()});
|
|
396
|
+
//# sourceMappingURL=mced.0c019c78.js.map
|