From 96f3aad0d9ecfa6b73de45175fa487e4dcf4d2fc Mon Sep 17 00:00:00 2001 From: Andrei Ignat Date: Fri, 3 May 2024 07:51:14 +0300 Subject: [PATCH] new version --- .../BlocklyAutomation/asset-manifest.json | 6 +- .../wwwroot/BlocklyAutomation/assets/.gitkeep | 0 .../showUsage/demoBlocks/FridayLinks.txt | 16 +- .../showUsage/demoBlocks/MyPCExtensions.txt | 22 ++- .../showUsage/demoBlocks/arrayExample.txt | 8 +- .../showUsage/demoBlocks/chromeBookmarks.txt | 16 +- .../showUsage/demoBlocks/dockerImagesList.txt | 8 +- .../demoBlocks/githubRepoForUser.txt | 14 +- .../assets/showUsage/demoBlocks/reduce.txt | 8 +- .../showUsage/demoBlocks/weatherChart.txt | 8 +- .../wwwroot/BlocklyAutomation/index.html | 2 +- .../static/js/main.f1c40dfb.js | 3 + .../static/js/main.f1c40dfb.js.LICENSE.txt | 158 ++++++++++++++++++ .../static/js/main.f1c40dfb.js.map | 1 + .../wwwroot/BlocklyAutomation/version.txt | 2 +- 15 files changed, 256 insertions(+), 16 deletions(-) create mode 100644 src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/.gitkeep create mode 100644 src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/static/js/main.f1c40dfb.js create mode 100644 src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/static/js/main.f1c40dfb.js.LICENSE.txt create mode 100644 src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/static/js/main.f1c40dfb.js.map diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/asset-manifest.json b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/asset-manifest.json index 1f05532..def48b6 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/asset-manifest.json +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/asset-manifest.json @@ -1,15 +1,15 @@ { "files": { "main.css": "/BlocklyAutomation/static/css/main.1636a4ef.css", - "main.js": "/BlocklyAutomation/static/js/main.2d9b1936.js", + "main.js": "/BlocklyAutomation/static/js/main.f1c40dfb.js", "static/js/511.878759ab.chunk.js": "/BlocklyAutomation/static/js/511.878759ab.chunk.js", "index.html": "/BlocklyAutomation/index.html", "main.1636a4ef.css.map": "/BlocklyAutomation/static/css/main.1636a4ef.css.map", - "main.2d9b1936.js.map": "/BlocklyAutomation/static/js/main.2d9b1936.js.map", + "main.f1c40dfb.js.map": "/BlocklyAutomation/static/js/main.f1c40dfb.js.map", "511.878759ab.chunk.js.map": "/BlocklyAutomation/static/js/511.878759ab.chunk.js.map" }, "entrypoints": [ "static/css/main.1636a4ef.css", - "static/js/main.2d9b1936.js" + "static/js/main.f1c40dfb.js" ] } \ No newline at end of file diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/.gitkeep b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/FridayLinks.txt b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/FridayLinks.txt index c4e35a9..38f69fd 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/FridayLinks.txt +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/FridayLinks.txt @@ -16,7 +16,13 @@ 2021 - + + + 1.0 + + + + localhost @@ -353,7 +359,13 @@ - + + + 1.0 + + + + localhost diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/MyPCExtensions.txt b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/MyPCExtensions.txt index 6fa4c92..7d8ad9b 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/MyPCExtensions.txt +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/MyPCExtensions.txt @@ -19,7 +19,13 @@ - + + + 1.0 + + + + localhost @@ -55,7 +61,13 @@ + + + 1.0 + + + localhost @@ -91,7 +103,13 @@ - + + + 1.0 + + + + localhost diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/arrayExample.txt b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/arrayExample.txt index 5a59773..d2b530b 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/arrayExample.txt +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/arrayExample.txt @@ -6,7 +6,13 @@ list - + + + 1.0 + + + + visualapi.azurewebsites.net diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/chromeBookmarks.txt b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/chromeBookmarks.txt index 848ca9d..e7ce022 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/chromeBookmarks.txt +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/chromeBookmarks.txt @@ -16,7 +16,13 @@ 2021 - + + + 1.0 + + + + localhost @@ -225,7 +231,13 @@ - + + + 1.0 + + + + localhost diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/dockerImagesList.txt b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/dockerImagesList.txt index 7019b80..6fcd68b 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/dockerImagesList.txt +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/dockerImagesList.txt @@ -24,7 +24,13 @@ TRUE - + + + 1.0 + + + + http://localhost diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/githubRepoForUser.txt b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/githubRepoForUser.txt index d262e72..1ad9879 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/githubRepoForUser.txt +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/githubRepoForUser.txt @@ -72,7 +72,13 @@ 1 + + + 1.0 + + + @@ -99,7 +105,13 @@ res - + + + 1.0 + + + + diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/reduce.txt b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/reduce.txt index cafe3ab..e69b474 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/reduce.txt +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/reduce.txt @@ -6,7 +6,13 @@ weather - + + + 1.0 + + + + visualapi.azurewebsites.net diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/weatherChart.txt b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/weatherChart.txt index e90209e..477fc23 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/weatherChart.txt +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/assets/showUsage/demoBlocks/weatherChart.txt @@ -9,7 +9,13 @@ - + + + 1.0 + + + + visualapi.azurewebsites.net diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/index.html b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/index.html index bf2691b..a227fe9 100644 --- a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/index.html +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/index.html @@ -1 +1 @@ -Blockly Automation
\ No newline at end of file +Blockly Automation
\ No newline at end of file diff --git a/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/static/js/main.f1c40dfb.js b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/static/js/main.f1c40dfb.js new file mode 100644 index 0000000..a08af1c --- /dev/null +++ b/src/NetCore2Blockly/TestBlocklyHtml/wwwroot/BlocklyAutomation/static/js/main.f1c40dfb.js @@ -0,0 +1,3 @@ +/*! For license information please see main.f1c40dfb.js.LICENSE.txt */ +(()=>{var e={97485:(e,t,n)=>{"use strict";var o,r,i;n.r(t),n.d(t,{Synth:()=>o}),function(){var e=window.URL||window.webkitURL,t=window.Blob;if(!e||!t)throw new Error("This browser does not support AudioSynth");var n=!1,s=null,a=function(e,t){return[new Uint8Array([t,t>>8]),new Uint8Array([t,t>>8,t>>16,t>>24])][e]},l=function(e,t,n,o){Object.defineProperty(this,e,{value:t,writable:!!n,enumerable:!!o})},c=function(e,t,n){l.call(this,e,t,n,!0)};i=function(){this.__init__.apply(this,arguments)};var u=l.bind(i.prototype),h=c.bind(i.prototype);u("__init__",(function(e,t,o){if(!n)throw new Error("AudioSynthInstrument can only be instantiated from the createInstrument method of the AudioSynth object.");l.call(this,"_parent",e),c.call(this,"name",t),l.call(this,"_soundID",o)})),h("play",(function(e,t,n){return this._parent.play(this._soundID,e,t,n)})),h("generate",(function(e,t,n){return this._parent.generate(this._soundID,e,t,n)})),u=l.bind((r=function e(){return s instanceof e?s:(this.__init__(),this)}).prototype),h=c.bind(r.prototype),u("_debug",!1,!0),u("_bitsPerSample",16),u("_channels",1),u("_sampleRate",44100,!0),h("setSampleRate",(function(e){return this._sampleRate=Math.max(Math.min(0|e,44100),4e3),this._clearCache(),this._sampleRate})),h("getSampleRate",(function(){return this._sampleRate})),u("_volume",32768,!0),h("setVolume",(function(e){return e=parseFloat(e),isNaN(e)&&(e=0),e=Math.round(32768*e),this._volume=Math.max(Math.min(0|e,32768),0),this._clearCache(),this._volume})),h("getVolume",(function(){return Math.round(this._volume/32768*1e4)/1e4})),u("_notes",{C:261.63,"C#":277.18,D:293.66,"D#":311.13,E:329.63,F:349.23,"F#":369.99,G:392,"G#":415.3,A:440,"A#":466.16,B:493.88}),u("_fileCache",[],!0),u("_temp",{},!0),u("_sounds",[],!0),u("_mod",[function(e,t,n,o){return Math.sin(2*Math.PI*(e/t)*n+o)}]),u("_resizeCache",(function(){for(var e=this._fileCache,t=this._sounds.length;e.length>8;for(;l!==I;l++)v=p*Math.pow(1-(l-d*m)/(d*(u-m)),b)*_.call(T,l,d,h,p),y[l<<1]=v,y[1+(l<<1)]=v>>8;var w=["RIFF",a(1,52),"WAVE","fmt ",a(1,16),a(0,1),a(0,f),a(1,d),a(1,d*f*g/8),a(0,f*g/8),a(0,g),"data",a(1,y.length*f*g/8),y],C=new t(w,{type:"audio/wav"}),k=e.createObjectURL(C);return this._fileCache[n][r-1][o][u]=k,this._debug&&console.log((new Date).valueOf()-c,"ms to generate"),k})),h("play",(function(e,t,n,o){var r=this.generate(e,t,n,o);return new Audio(r).play(),!0})),h("debug",(function(){this._debug=!0})),h("createInstrument",(function(e){var t=0,o=!1;if("string"==typeof e){for(var r=0;r=r.length-1?0:i+1]+r[i]),i>=Math.floor(a)&&(i=l&&(c=!0,r[i+1]=.5*(r[0]+r[i+1]),o.periodCount++):c=!0);var u=r[i];return c?o.playVal=0:o.playVal++,u}},{name:"edm",attack:function(){return.002},dampen:function(){return 1},wave:function(e,t,n){var o=this.modulate[0],r=this.modulate.slice(1);return r[0](e,t,n,r[9](e,t,n,r[2](e,t,n,Math.pow(o(e,t,n,0),3)+Math.pow(o(e,t,n,.5),5)+Math.pow(o(e,t,n,1),7)))+r[8](e,t,n,o(e,t,n,1.75)))}})},61697:function(e,t,n){var o;o=e=>(()=>{"use strict";var t={573:t=>{t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{BlockShadowStateChange:()=>t,shadowBlockConversionChangeListener:()=>i});var e=o(573);class t extends e.Events.BlockBase{constructor(e,n,o){super(e),this.type=t.EVENT_TYPE,this.inputIndexInParent=n,this.shadowState=o}toJson(){const e=super.toJson();return e.inputIndexInParent=this.inputIndexInParent,e.shadowState=this.shadowState,e}static fromJson(e,t,n){const o=super.fromJson(e,t,n);return o.inputIndexInParent=e.inputIndexInParent,o.shadowState=e.shadowState,n}isNull(){return!1}run(e){const t=this.getEventWorkspace_();if(!this.blockId)throw new Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");const n=t.getBlockById(this.blockId);if(!n)throw new Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");const o=n.getConnections_(!0);let r;if(null===this.inputIndexInParent)r=n.nextConnection;else{if("number"!=typeof this.inputIndexInParent||this.inputIndexInParent<0||this.inputIndexInParent>=o.length)throw new Error("inputIndexInParent was invalid.");r=n.inputList[this.inputIndexInParent].connection}if(null===r)throw new Error("No matching connection was found.");e&&r.setShadowState(this.shadowState||null)}}function n(o){var r,i;let s=null,a=!1;if((null===(r=o.previousConnection)||void 0===r?void 0:r.isConnected())?s=o.previousConnection.targetConnection:(null===(i=o.outputConnection)||void 0===i?void 0:i.isConnected())&&(s=o.outputConnection.targetConnection,a=!0),null===s)return o;let l=s.getSourceBlock();const c=s.getParentInput(),u=c?l.inputList.indexOf(c):null,h=s.getShadowState(!1),d=e.serialization.blocks.save(o,{addCoordinates:!1,addInputBlocks:!0,addNextBlocks:!0,doFullSerialization:!1});if(null===h||null===d)return o;if(l.isShadow()){const e=n(l);if(null===e)throw new Error("No parent block was created, so we can't recreate the current block either.");if(l=e,null===u)s=l.nextConnection;else{if(u<0||u>=l.inputList.length)throw new Error("inputIndexInParent is invalid.");s=l.inputList[u].connection}if(null===s)throw new Error("Couldn't find the corresponding connection on the new version of the parent block.")}d.id=void 0;const p=e.serialization.blocks.append(d,l.workspace,{recordUndo:!0}),f=a?p.outputConnection:p.previousConnection;return f&&s.connect(f),s.setShadowState(h),e.Events.fire(new t(l,u,h)),p}function i(t){if(!t.recordUndo)return;if(t.type!=e.Events.BLOCK_CHANGE)return;const o=t;if(!o.workspaceId||!o.blockId)return;const r=e.Workspace.getById(o.workspaceId);if(!r)return;const i=r.getBlockById(o.blockId);if(!i)return;if(!i.isShadow())return;const s=e.Events.getGroup();o.group?e.Events.setGroup(o.group):e.Events.setGroup(!0),n(i),e.Events.setGroup(s)}t.EVENT_TYPE="block_shadow_state_change",e.registry.register(e.registry.Type.EVENT,t.EVENT_TYPE,t)})(),r})(),e.exports=o(n(72560))},99212:function(e,t,n){var o;o=e=>(()=>{"use strict";var t={573:t=>{t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{Backpack:()=>a,BackpackChange:()=>s,BackpackOpen:()=>n,backpackChange:()=>i,backpackOpen:()=>t});var e=o(573);e.Msg.COPY_ALL_TO_BACKPACK="Copy All Blocks to Backpack",e.Msg.COPY_TO_BACKPACK="Copy to Backpack",e.Msg.EMPTY_BACKPACK="Empty",e.Msg.PASTE_ALL_FROM_BACKPACK="Paste All Blocks from Backpack",e.Msg.REMOVE_FROM_BACKPACK="Remove from Backpack";const t="backpack_open";class n extends e.Events.UiBase{constructor(e,n){super(n),this.isOpen=e,this.type=t}toJson(){const e=super.toJson();return e.isOpen=this.isOpen,e}static fromJson(e,t,n){const o=super.fromJson(e,t,n);return o.isOpen=e.isOpen,o}}e.registry.register(e.registry.Type.EVENT,t,n);const i="backpack_change";class s extends e.Events.UiBase{constructor(){super(...arguments),this.type=i}}e.registry.register(e.registry.Type.EVENT,i,s);class a extends e.DragTarget{constructor(e,t){super(),this.workspace_=e,this.id="backpack",this.flyout_=null,this.contents_=[],this.boundEvents=[],this.left_=0,this.top_=0,this.WIDTH_=40,this.HEIGHT_=60,this.MARGIN_VERTICAL_=20,this.MARGIN_HORIZONTAL_=20,this.HOTSPOT_MARGIN_=10,this.svgGroup_=null,this.svgImg_=null,this.spriteTop=10,this.spriteLeft=20,this.spriteSize=80,this.initialized_=!1,this.options=function(e){var t,n,o;const r={allowEmptyBackpackOpen:!0,useFilledBackpackImage:!1,skipSerializerRegistration:!1,contextMenu:{emptyBackpack:!0,removeFromBackpack:!0,copyToBackpack:!0,copyAllToBackpack:!1,pasteAllToBackpack:!1,disablePreconditionChecks:!1}};return e?{allowEmptyBackpackOpen:null!==(t=e.allowEmptyBackpackOpen)&&void 0!==t?t:r.allowEmptyBackpackOpen,useFilledBackpackImage:null!==(n=e.useFilledBackpackImage)&&void 0!==n?n:r.useFilledBackpackImage,skipSerializerRegistration:null!==(o=e.skipSerializerRegistration)&&void 0!==o?o:r.skipSerializerRegistration,contextMenu:Object.assign(Object.assign({},r.contextMenu),e.contextMenu)}:r}(t),this.registerSerializer()}registerSerializer(){this.options.skipSerializerRegistration||e.registry.hasItem(e.registry.Type.SERIALIZER,"backpack")||e.serialization.registry.register("backpack",new u)}init(){var t,n,o;this.workspace_.getComponentManager().addComponent({component:this,weight:2,capabilities:[e.ComponentManager.Capability.AUTOHIDEABLE,e.ComponentManager.Capability.DRAG_TARGET,e.ComponentManager.Capability.POSITIONABLE]}),this.initFlyout(),this.createDom(),this.attachListeners(),this.options.contextMenu&&(t=this.options.contextMenu,n=this.workspace_,t.emptyBackpack&&function(t){const n=t.configureContextMenu;t.configureContextMenu=(o,r)=>{const i=t.getComponentManager().getComponent("backpack"),s=i&&i.getClientRect();if(r instanceof PointerEvent&&s&&(!i||!s.contains(r.clientX,r.clientY)))return void(n&&n.call(null,o,r));o.length=0;const a={text:e.Msg.EMPTY_BACKPACK,enabled:!!i.getCount(),callback:function(){i.empty()},scope:{workspace:t},weight:0};o.push(a)}}(n),t.removeFromBackpack&&function(){if(e.ContextMenuRegistry.registry.getItem("remove_from_backpack"))return;const t={displayText:e.Msg.REMOVE_FROM_BACKPACK,preconditionFn:function(e){if(!e.block)return"hidden";const t=e.block.workspace;if(t.isFlyout&&t.targetWorkspace){const e=t.targetWorkspace.getComponentManager().getComponent("backpack"),n=e&&e.getFlyout();if(e&&n&&n.getWorkspace().id===t.id)return"enabled"}return"hidden"},callback:function(e){e.block&&e.block.workspace.targetWorkspace&&e.block.workspace.targetWorkspace.getComponentManager().getComponent("backpack").removeBlock(e.block)},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:"remove_from_backpack",weight:200};e.ContextMenuRegistry.registry.register(t)}(),t.copyToBackpack&&function(t){if(e.ContextMenuRegistry.registry.getItem("copy_to_backpack"))return;const n={displayText:function(t){if(!t.block)return"";const n=t.block.workspace.getComponentManager().getComponent("backpack").getCount();return"".concat(e.Msg.COPY_TO_BACKPACK," (").concat(n,")")},preconditionFn:function(e){if(!e.block)return"hidden";const n=e.block.workspace;if(!n.isFlyout){const o=n.getComponentManager().getComponent("backpack");if(o)return t?"enabled":o.containsBlock(e.block)?"disabled":"enabled"}return"hidden"},callback:function(e){e.block&&e.block.workspace.getComponentManager().getComponent("backpack").addBlock(e.block)},scopeType:e.ContextMenuRegistry.ScopeType.BLOCK,id:"copy_to_backpack",weight:200};e.ContextMenuRegistry.registry.register(n)}(null!==(o=t.disablePreconditionChecks)&&void 0!==o&&o),t.copyAllToBackpack&&function(){if(e.ContextMenuRegistry.registry.getItem("copy_all_to_backpack"))return;const t={displayText:e.Msg.COPY_ALL_TO_BACKPACK,preconditionFn:function(e){const t=e.workspace;return t&&!t.isFlyout&&t.getComponentManager().getComponent("backpack")?"enabled":"hidden"},callback:function(e){const t=e.workspace;t&&t.getComponentManager().getComponent("backpack").addBlocks(t.getTopBlocks(!0))},scopeType:e.ContextMenuRegistry.ScopeType.WORKSPACE,id:"copy_all_to_backpack",weight:200};e.ContextMenuRegistry.registry.register(t)}(),t.pasteAllToBackpack&&function(){if(e.ContextMenuRegistry.registry.getItem("paste_all_from_backpack"))return;const t={displayText:function(t){if(!t.workspace)return"";const n=t.workspace.getComponentManager().getComponent("backpack").getCount();return"".concat(e.Msg.PASTE_ALL_FROM_BACKPACK," (").concat(n,")")},preconditionFn:function(e){const t=e.workspace;return t&&!t.isFlyout&&t.getComponentManager().getComponent("backpack")?"enabled":"hidden"},callback:function(t){const n=t.workspace;n&&n.getComponentManager().getComponent("backpack").getContents().forEach((t=>{e.serialization.blocks.append(JSON.parse(t),n).scheduleSnapAndBump()}))},scopeType:e.ContextMenuRegistry.ScopeType.WORKSPACE,id:"paste_all_from_backpack",weight:200};e.ContextMenuRegistry.registry.register(t)}()),this.initialized_=!0,this.workspace_.resize()}dispose(){this.svgGroup_&&e.utils.dom.removeNode(this.svgGroup_);for(const t of this.boundEvents)e.browserEvents.unbind(t);this.boundEvents.length=0}initFlyout(){var t;const n=new e.Options({scrollbars:!0,parentWorkspace:this.workspace_,rtl:this.workspace_.RTL,oneBasedIndex:this.workspace_.options.oneBasedIndex,renderer:this.workspace_.options.renderer,rendererOverrides:this.workspace_.options.rendererOverrides||void 0,move:{scrollbars:!0}});if(this.workspace_.horizontalLayout){n.toolboxPosition=this.workspace_.toolboxPosition===e.utils.toolbox.Position.TOP?e.utils.toolbox.Position.BOTTOM:e.utils.toolbox.Position.TOP;const t=e.registry.getClassFromOptions(e.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace_.options,!0);if(!t)throw new Error("HorizontalFlyout does not exist");this.flyout_=new t(n)}else{n.toolboxPosition=this.workspace_.toolboxPosition===e.utils.toolbox.Position.RIGHT?e.utils.toolbox.Position.LEFT:e.utils.toolbox.Position.RIGHT;const t=e.registry.getClassFromOptions(e.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,this.workspace_.options,!0);if(!t)throw new Error("VerticalFlyout does not exist");this.flyout_=new t(n)}const o=this.workspace_.getParentSvg().parentNode;null==o||o.appendChild(null===(t=this.flyout_)||void 0===t?void 0:t.createDom(e.utils.Svg.SVG)),this.flyout_.init(this.workspace_)}createDom(){this.svgGroup_=e.utils.dom.createSvgElement(e.utils.Svg.G,{},null);const t=e.utils.idGenerator.genUid(),n=e.utils.dom.createSvgElement(e.utils.Svg.CLIPPATH,{id:"blocklyBackpackClipPath"+t},this.svgGroup_);e.utils.dom.createSvgElement(e.utils.Svg.RECT,{width:this.WIDTH_,height:this.HEIGHT_},n),this.svgImg_=e.utils.dom.createSvgElement(e.utils.Svg.IMAGE,{class:"blocklyBackpack","clip-path":"url(#blocklyBackpackClipPath"+t+")",width:this.spriteSize+"px",x:-this.spriteLeft,height:this.spriteSize+"px",y:-this.spriteTop},this.svgGroup_),this.svgImg_.setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",l),e.utils.dom.insertAfter(this.svgGroup_,this.workspace_.getBubbleCanvas())}attachListeners(){this.svgGroup_&&(this.addEvent(this.svgGroup_,"mousedown",this,this.blockMouseDownWhenOpenable),this.addEvent(this.svgGroup_,"mouseup",this,this.onClick),this.addEvent(this.svgGroup_,"mouseover",this,this.onMouseOver),this.addEvent(this.svgGroup_,"mouseout",this,this.onMouseOut))}addEvent(t,n,o,r){const i=e.browserEvents.bind(t,n,o,r);this.boundEvents.push(i)}getFlyout(){return this.flyout_}getClientRect(){if(!this.svgGroup_)return null;const t=this.svgGroup_.getBoundingClientRect(),n=t.top+this.spriteTop-this.HOTSPOT_MARGIN_,o=n+this.HEIGHT_+2*this.HOTSPOT_MARGIN_,r=t.left+this.spriteLeft-this.HOTSPOT_MARGIN_,i=r+this.WIDTH_+2*this.HOTSPOT_MARGIN_;return new e.utils.Rect(n,o,r,i)}getBoundingRectangle(){return new e.utils.Rect(this.top_,this.top_+this.HEIGHT_,this.left_,this.left_+this.WIDTH_)}position(t,n){if(!this.initialized_)return;const o=this.workspace_.scrollbar,r=o&&o.isVisible()&&o.canScrollVertically(),i=o&&o.isVisible()&&o.canScrollHorizontally();t.toolboxMetrics.position===e.TOOLBOX_AT_LEFT||this.workspace_.horizontalLayout&&!this.workspace_.RTL?(this.left_=t.absoluteMetrics.left+t.viewMetrics.width-this.WIDTH_-this.MARGIN_HORIZONTAL_,r&&!this.workspace_.RTL&&(this.left_-=e.Scrollbar.scrollbarThickness)):(this.left_=this.MARGIN_HORIZONTAL_,r&&this.workspace_.RTL&&(this.left_+=e.Scrollbar.scrollbarThickness));const s=t.toolboxMetrics.position===e.TOOLBOX_AT_BOTTOM;s?(this.top_=t.absoluteMetrics.top+t.viewMetrics.height-this.HEIGHT_-this.MARGIN_VERTICAL_,i&&(this.top_-=e.Scrollbar.scrollbarThickness)):this.top_=t.absoluteMetrics.top+this.MARGIN_VERTICAL_;let a=this.getBoundingRectangle();for(let e,l=0;e=n[l];l++)a.intersects(e)&&(this.top_=s?e.top-this.HEIGHT_-this.MARGIN_VERTICAL_:e.bottom+this.MARGIN_VERTICAL_,a=this.getBoundingRectangle(),l=-1);this.svgGroup_&&this.svgGroup_.setAttribute("transform","translate(".concat(this.left_,",").concat(this.top_,")"))}getCount(){return this.contents_.length}getContents(){return[...this.contents_]}onDrop(t){t instanceof e.BlockSvg&&this.addBlock(t)}blockToJsonString(t){const n=e.serialization.blocks.save(t);n.kind="BLOCK";const o=function(e,t){for(const n in e)n&&(-1!==t.indexOf(n)&&delete e[n],e[n]&&"object"==typeof e[n]&&o(e[n],t))};return n&&o(n,["id","height","width","pinned","enabled"]),JSON.stringify(n)}blockXmlToJsonString(t){if(!t.startsWith("e.startsWith("0?this.svgImg_.setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",c):this.svgImg_.setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",l))}filterDuplicates(e){return e.filter(((t,n)=>e.indexOf(t)===n&&-1===this.contents_.indexOf(t)))}isOpenable(){return!(this.isOpen()||!this.options.allowEmptyBackpackOpen)||this.getCount()>0}isOpen(){return!!this.flyout_&&this.flyout_.isVisible()}open(){var t;if(!this.isOpenable())return;const o=this.contents_.map((e=>JSON.parse(e)));null===(t=this.flyout_)||void 0===t||t.show(o),this.workspace_.scrollbar&&this.workspace_.scrollbar.setVisible&&this.workspace_.scrollbar.setVisible(!1),e.Events.fire(new n(!0,this.workspace_.id))}maybeRefreshFlyoutContents(){var e;if(!this.isOpen())return;const t=this.contents_.map((e=>JSON.parse(e)));null===(e=this.flyout_)||void 0===e||e.show(t)}close(){var t;this.isOpen()&&(null===(t=this.flyout_)||void 0===t||t.hide(),this.workspace_.scrollbar&&this.workspace_.scrollbar.setVisible&&this.workspace_.scrollbar.setVisible(!0),e.Events.fire(new n(!1,this.workspace_.id)))}autoHide(e){e||this.close()}onClick(t){if(t instanceof MouseEvent&&e.browserEvents.isRightButton(t))return;this.open();const n=new(e.Events.get(e.Events.CLICK))(null,this.workspace_.id,"backpack");e.Events.fire(n)}onDragEnter(t){t instanceof e.BlockSvg&&this.updateHoverStying(!0)}onDragExit(e){this.updateHoverStying(!1)}onMouseOver(){this.isOpenable()&&this.updateHoverStying(!0)}onMouseOut(){this.updateHoverStying(!1)}updateHoverStying(t){const n="blocklyBackpackDarken";this.svgImg_&&(t?e.utils.dom.addClass(this.svgImg_,n):e.utils.dom.removeClass(this.svgImg_,n))}shouldPreventMove(t){return t instanceof e.BlockSvg}blockMouseDownWhenOpenable(t){t instanceof MouseEvent&&!e.browserEvents.isRightButton(t)&&this.isOpenable()&&t.stopPropagation()}}const l="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0IDI0IiBoZWlnaHQ9IjI0cHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0cHgiIGZpbGw9IiM0NTVBNjQiPjxnPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iMjQiIHdpZHRoPSIyNCIvPjwvZz48Zz48Zy8+PGc+PHBhdGggZD0iTTEzLjk3LDUuMzRDMTMuOTgsNS4yMywxNCw1LjEyLDE0LDVjMC0xLjEtMC45LTItMi0ycy0yLDAuOS0yLDJjMCwwLjEyLDAuMDIsMC4yMywwLjAzLDAuMzRDNy42OSw2LjE1LDYsOC4zOCw2LDExdjggYzAsMS4xLDAuOSwyLDIsMmg4YzEuMSwwLDItMC45LDItMnYtOEMxOCw4LjM4LDE2LjMxLDYuMTUsMTMuOTcsNS4zNHogTTExLDVjMC0wLjU1LDAuNDUtMSwxLTFzMSwwLjQ1LDEsMSBjMCwwLjAzLTAuMDEsMC4wNi0wLjAyLDAuMDlDMTIuNjYsNS4wMywxMi4zNCw1LDEyLDVzLTAuNjYsMC4wMy0wLjk4LDAuMDlDMTEuMDEsNS4wNiwxMSw1LjAzLDExLDV6IE0xNiwxM3YxdjAuNSBjMCwwLjI4LTAuMjIsMC41LTAuNSwwLjVTMTUsMTQuNzgsMTUsMTQuNVYxNHYtMUg4di0xaDdoMVYxM3oiLz48L2c+PC9nPjwvc3ZnPg==",c="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB3aWR0aD0iMjQiCiAgIGhlaWdodD0iMjQiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgdmVyc2lvbj0iMS4xIgogICBpZD0ic3ZnNSIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzMiIgLz4KICA8ZwogICAgIGlkPSJsYXllcjEiPgogICAgPGcKICAgICAgIHN0eWxlPSJmaWxsOiM0NTVhNjQiCiAgICAgICBpZD0iZzg0OCIKICAgICAgIHRyYW5zZm9ybT0ibWF0cml4KDAuMjY0NTgzMzMsMCwwLDAuMjY0NTgzMzMsOC44MjQ5OTk3LDguODI0OTk5NykiPgogICAgICA8ZwogICAgICAgICBpZD0iZzgyNiI+CiAgICAgICAgPHJlY3QKICAgICAgICAgICBmaWxsPSJub25lIgogICAgICAgICAgIGhlaWdodD0iMjQiCiAgICAgICAgICAgd2lkdGg9IjI0IgogICAgICAgICAgIGlkPSJyZWN0ODI0IgogICAgICAgICAgIHg9IjAiCiAgICAgICAgICAgeT0iMCIgLz4KICAgICAgPC9nPgogICAgICA8ZwogICAgICAgICBpZD0iZzgzNCI+CiAgICAgICAgPGcKICAgICAgICAgICBpZD0iZzgyOCIgLz4KICAgICAgICA8ZwogICAgICAgICAgIGlkPSJnMjIyMyI+CiAgICAgICAgICA8ZwogICAgICAgICAgICAgaWQ9ImcyMTAxNiI+CiAgICAgICAgICAgIDxnCiAgICAgICAgICAgICAgIHN0eWxlPSJmaWxsOiM0NTVhNjQiCiAgICAgICAgICAgICAgIGlkPSJnMTQ5MyIKICAgICAgICAgICAgICAgdHJhbnNmb3JtPSJtYXRyaXgoMy43Nzk1Mjc2LDAsMCwzLjc3OTUyNzYsLTMzLjM1NDMzLC0zMy4zNTQzMykiPgogICAgICAgICAgICAgIDxnCiAgICAgICAgICAgICAgICAgaWQ9ImcxNDcxIj4KICAgICAgICAgICAgICAgIDxwYXRoCiAgICAgICAgICAgICAgICAgICBpZD0icmVjdDE0NjkiCiAgICAgICAgICAgICAgICAgICBzdHlsZT0iZmlsbDpub25lIgogICAgICAgICAgICAgICAgICAgZD0iTSAwLDAgSCAyNCBWIDI0IEggMCBaIiAvPgogICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICA8ZwogICAgICAgICAgICAgICAgIGlkPSJnMTQ3OSI+CiAgICAgICAgICAgICAgICA8ZwogICAgICAgICAgICAgICAgICAgaWQ9ImcxNDczIiAvPgogICAgICAgICAgICAgICAgPGcKICAgICAgICAgICAgICAgICAgIGlkPSJnMTQ3NyI+CiAgICAgICAgICAgICAgICAgIDxwYXRoCiAgICAgICAgICAgICAgICAgICAgIGlkPSJwYXRoMTQ3NSIKICAgICAgICAgICAgICAgICAgICAgZD0ibSAxMiwzIGMgLTEuMSwwIC0yLDAuOSAtMiwyIDAsMC4xMiAwLjAxOTMsMC4yMjk4NDM4IDAuMDI5MywwLjMzOTg0MzggQyA3LjY4OTI5NjUsNi4xNDk4NDMzIDYsOC4zOCA2LDExIHYgOCBjIDAsMS4xIDAuOSwyIDIsMiBoIDggYyAxLjEsMCAyLC0wLjkgMiwtMiBWIDExIEMgMTgsOC4zOCAxNi4zMTA3MDMsNi4xNDk4NDMzIDEzLjk3MDcwMyw1LjMzOTg0MzggMTMuOTgwNzAzLDUuMjI5ODQzOCAxNCw1LjEyIDE0LDUgMTQsMy45IDEzLjEsMyAxMiwzIFogbSAwLDEgYyAwLjU1LDAgMSwwLjQ1IDEsMSAwLDAuMDMgLTAuMDA5NSwwLjA1OTg0NCAtMC4wMTk1MywwLjA4OTg0NCBDIDEyLjY2MDQ2OSw1LjAyOTg0MzggMTIuMzQsNSAxMiw1IDExLjY2LDUgMTEuMzM5NTMxLDUuMDI5ODQzOCAxMS4wMTk1MzEsNS4wODk4NDM4IDExLjAwOTUzMSw1LjA1OTg0MzggMTEsNS4wMyAxMSw1IDExLDQuNDUgMTEuNDUsNCAxMiw0IFogbSAtMy40NzI2NTYyLDYuMzk4NDM4IGggMS4xNTYyNSB2IDIuNjQwNjI0IGggMC4zMDkzMzU0IGwgLTIuMzdlLTUsLTEuMTcxMTQ2IDEuMDgyNzEwNSwtMTBlLTcgMC4wMTEsMS4xNzExNDYgaCAwLjMzMzMwNCBsIC0wLjAzNTA0LC0yLjU4NzMxNSBoIDAuNTc4MTI1IDAuNTc4MTI1IGwgMC4wMTEwNSwyLjU4NzMxNSBoIDAuMzU2MDI0IFYgMTIuMDYwNTQ3IEggMTQuMDYyNSB2IDAuOTc4NTE1IGggMC4zMzAwNzggdiAtMi41NTI3MzQgaCAxLjE1NjI1IHYgMi41NTI3MzQgaCAwLjk2Njc5NyB2IDAuMzU3NDIyIEggOS42ODM1OTM4IDguNTI3MzQzOCA3LjYwMzUxNTYgdiAtMC4zNTc0MjIgaCAwLjkyMzgyODIgeiIKICAgICAgICAgICAgICAgICAgICAgLz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgIDwvZz4KICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICAgIDwvZz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=";e.Css.register("\n.blocklyBackpack {\n opacity: 0.4;\n}\n.blocklyBackpackDarken {\n opacity: 0.6;\n}\n.blocklyBackpack:active {\n opacity: 0.8;\n}\n");class u{constructor(){this.priority=e.serialization.priorities.BLOCKS-10}save(e){const t=e.getComponentManager().getComponent("backpack");return null==t?void 0:t.getContents().map((e=>JSON.parse(e)))}load(e,t){const n=e.map((e=>JSON.stringify(e))),o=t.getComponentManager().getComponent("backpack");null==o||o.setContents(n)}clear(e){const t=e.getComponentManager().getComponent("backpack");null==t||t.empty()}}})(),r})(),e.exports=o(n(72560))},74024:function(e){var t;t=()=>(()=>{var e={943:function(e,t,n){var o,r,i;r=[n(12)],void 0===(i="function"==typeof(o=function(e){return e})?o.apply(t,r):o)||(e.exports=i)},12:function(e,t,n){var o,r;void 0===(r="function"==typeof(o=function(){var e,t,o,r,i,s,a,l,c,u,h,d,p,f,g,m,b,_,T,v,y,E,I,S,w,C,k,$,A,O,R,x,L,N,M,D,P,B,F,U,H,G,V,W,j,z,X,Y,K,J,q,Z,Q,ee,te,ne,oe,re,ie,se,ae,le,ce,ue,he,de,pe,fe,ge,me,be,_e,Te,ve,ye,Ee,Ie,Se,we,Ce,ke,$e,Ae,Oe,Re,xe,Le,Ne,Me,De,Pe,Be,Fe,Ue,He,Ge,Ve,We,je,ze,Xe,Ye,Ke,Je,qe,Ze,Qe,et,tt,nt,ot,rt,it,st,at,lt,ct,ut,ht,dt,pt,ft,gt,mt,bt,_t,Tt,vt,yt,Et,It,St,wt,Ct,kt,$t,At,Ot,Rt,xt,Lt,Nt,Mt,Dt,Pt,Bt,Ft,Ut,Ht,Gt,Vt,Wt,jt,zt,Xt,Yt,Kt,Jt,qt,Zt,Qt,en,tn,nn,on,rn,sn,an,ln,cn,un,hn,dn,pn,fn,gn,mn,bn,_n,Tn,vn,yn,En,In,Sn,wn,Cn,kn,$n,An,On,Rn,xn,Ln,Nn,Mn,Dn,Pn,Bn,Fn,Un,Hn,Gn,Vn,Wn,jn,zn,Xn,Yn,Kn,Jn,qn,Zn,Qn,eo,to,no,oo,ro,io,so,ao,lo,co,uo,ho,po,fo,go,mo,bo,_o,To,vo,yo,Eo,Io,So,wo,Co,ko,$o,Ao,Oo,Ro,xo,Lo,No,Mo,Do,Po,Bo,Fo,Uo,Ho,Go,Vo,Wo,jo,zo,Xo,Yo,Ko,Jo,qo,Zo,Qo,er,tr,nr,or,rr,ir,sr,ar,lr,cr,ur,hr,dr,pr,fr,gr,mr,br,_r,Tr,vr,yr,Er,Ir,Sr,wr,Cr,kr,$r,Ar,Or,Rr,xr,Lr,Nr,Mr,Dr,Pr,Br,Fr,Ur,Hr,Gr,Vr,Wr,jr,zr,Xr,Yr,Kr,Jr,qr,Zr,Qr,ei,ti,ni,oi,ri,ii,si,ai,li,ci,ui,hi,di,pi,fi,gi,mi,bi,_i,Ti,vi,yi,Ei,Ii,Si,wi,Ci,ki,$i,Ai,Oi,Ri,xi,Li,Ni,Mi,Di,Pi,Bi,Fi,Ui,Hi,Gi,Vi,Wi,ji,zi,Xi,Yi,Ki,Ji,qi,Zi,Qi,es,ts,ns,os,rs,is,ss,as,ls,cs,us,hs,ds,ps,fs,gs,ms,bs,_s,Ts,vs,ys={};e=function(e,n,o,r){if(!(e instanceof As)&&"string"!=typeof e||""==="".concat(e).trim())throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e="".concat(e).toLowerCase(),"string"!=typeof n||""===n.trim())throw Error('Invalid name "'+n+'". The name must be a non-empty string.');const i=n.toLowerCase();if(!o)throw Error("Can not register a null value");let s=ws[e],a=ks[e];if(s||(s=ws[e]=Object.create(null),a=ks[e]=Object.create(null)),t(e,o),!r&&s[i])throw Error('Name "'+i+'" with type "'+e+'" already registered.');s[i]=o,a[i]=n},t=function(e,t){if(e===String(As.FIELD)&&"function"!=typeof t.fromJson)throw Error('Type "'+e+'" must have a fromJson function')},o=function(e,t){e="".concat(e).toLowerCase(),t=t.toLowerCase();const n=ws[e];n&&n[t]?(delete ws[e][t],delete ks[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},r=function(e,t,n){e="".concat(e).toLowerCase(),t=t.toLowerCase();const o=ws[e];if(!o||!o[t]){if(t="Unable to find ["+t+"]["+e+"] in the registry.",n)throw Error(t+" You must require or register a "+e+" plugin.");return console.warn(t),null}return o[t]},i=function(e,t){return e="".concat(e).toLowerCase(),t=t.toLowerCase(),!!(e=ws[e])&&!!e[t]},s=function(e,t,n){return r(e,t,n)},a=function(e,t,n){return r(e,t,n)},l=function(e,t,n){e="".concat(e).toLowerCase();var o=ws[e];if(!o){if(o="Unable to find [".concat(e,"] in the registry."),n)throw Error("".concat(o," You must require or register a ").concat(e," plugin."));return console.warn(o),null}if(!t)return o;e=ks[e],n=Object.create(null);for(const r of Object.keys(o))n[e[r]]=o[r];return n},c=function(e,t,n){return"function"==typeof(t=t.plugins[String(e)]||$s)?t:s(e,t,n)},u=function(e){return Ns[e]||null},h=function(){const e=[];for(const t in Ns)e.push(Ns[t]);return e},d=function(e){Ns[e.id]=e},p=function(e){delete Ns[e.id]},f=function(){return Rs},g=function(e){Rs=e},m=function(){return Ms},b=function(e){Ms=e},_=function(){return xs},T=function(e){xs=e},v=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;const t=e.getParentSvg(),n=e.getCachedParentSvgSize();var o=t.parentElement;if(o instanceof HTMLElement){var r=o.offsetWidth;o=o.offsetHeight,n.width!==r&&(t.setAttribute("width",r+"px"),e.setCachedParentSvgSize(r,null)),n.height!==o&&(t.setAttribute("height",o+"px"),e.setCachedParentSvgSize(null,o)),e.resize()}},y=function(e,t){const n=Object.create(null),o=e.getDescendants(!0);t&&(e=e.getNextBlock())&&(e=o.indexOf(e),o.splice(e,o.length-e));for(let r,i=0;r=o[i];i++)n[r.type]?n[r.type]++:n[r.type]=1;return n},E=function(e){return function(){this.jsonInit(e)}},I=function(e){Ps.defineBlocksWithJsonArrayInternal(e)},S=function(e){ys.defineBlocks$$module$build$src$core$common(ys.createBlockDefinitionsFromJsonArray$$module$build$src$core$common(e))},ys.createBlockDefinitionsFromJsonArray$$module$build$src$core$common=function(e){const t={};for(let n=0;n{setTimeout(R,0)}))}catch(e){setTimeout(R,0)}la.push(e)}},R=function(){var e=x(la,!0);la.length=0;for(let n,o=0;n=e[o];o++)if(n.workspaceId){var t=u(n.workspaceId);t&&t.fireChangeListener(n)}e=new Set(e.map((e=>e.workspaceId)));for(const n of e){if(!n)continue;if(!(e=u(n)))continue;let o;for(t=(e=e.getUndoStack()).length;0"&#".concat(e.charCodeAt(0),";")))},W=function(e,t,n,o){e=e+" was deprecated in "+t+" and will be deleted in "+n+".",o&&(e+="\nUse "+o+" instead."),console.warn(e)},j=function(e,t,n){e=document.createElementNS(ka,"".concat(e));for(const o in t)e.setAttribute(o,"".concat(t[o]));return n&&n.appendChild(e),e},z=function(e,t){return!(t=t.split(" ")).every((t=>e.classList.contains(t)))&&(e.classList.add(...t),!0)},X=function(e,t){e.classList.remove(...t.split(" "))},Y=function(e,t){return!(t=t.split(" ")).every((t=>!e.classList.contains(t)))&&(e.classList.remove(...t),!0)},K=function(e,t){return e.classList.contains(t)},J=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},q=function(e,t){const n=t.nextSibling;if(!(t=t.parentNode))throw Error("Reference node has no parent.");n?t.insertBefore(e,n):t.appendChild(e)},Z=function(e,t){return W("Blockly.utils.dom.containsNode","version 10","version 11",'Use native "contains" DOM method'),e.contains(t)},Q=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},ee=function(){Ra++,Oa||(Oa=Object.create(null))},te=function(){--Ra||(Oa=null)},ne=function(e){const t=e.textContent+"\n"+e.className.baseVal;let n;if(Oa&&(n=Oa[t]))return n;try{n=e.getComputedTextLength()}catch(t){return 8*e.textContent.length}return Oa&&(Oa[t]=n),n},oe=function(e,t,n,o){return re(e,t+"pt",n,o)},re=function(e,t,n,o){const r=e.textContent;var i;return e=r+"\n"+e.className.baseVal,Oa&&(i=Oa[e])||(xa||((i=document.createElement("canvas")).className="blocklyComputeCanvas",document.body.appendChild(i),xa=i.getContext("2d")),xa.font=n+" "+t+" "+o,i=r?xa.measureText(r).width:0,Oa&&(Oa[e]=i)),i},ie=function(e,t,n,o){const r=document.createElement("span");r.style.font=n+" "+t+" "+o,r.textContent=e,(e=document.createElement("div")).style.width="1px",e.style.height="0",(t=document.createElement("div")).setAttribute("style","position: fixed; top: 0; left: 0; display: flex;"),t.appendChild(r),t.appendChild(e),document.body.appendChild(t),n={height:0,baseline:0};try{t.style.alignItems="baseline",n.baseline=e.offsetTop-r.offsetTop,t.style.alignItems="flex-end",n.height=e.offsetTop-r.offsetTop}finally{document.body.removeChild(t)}return n},se=function(e,t){Pa(e,t)},ae=function(e){Pa=e},le=function(e,t){Ua.confirmInternal(e,t)},ce=function(e,t){Ba(e,t)},ue=function(e){Ba=e},he=function(e,t,n){Fa(e,t,n)},de=function(e){Fa=e},pe=function(e){return void 0!==e.getVariableModel},fe=function(e){return void 0!==e.getProcedureDef},ge=function(e){return void 0!==e.getProcedureCall&&void 0!==e.renameProcedure},ys.allUsedVarModels$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);const t=new Set;for(let n=0;n1
'),o.appendChild(n),t.push(o)),Ls.variables_get){e.sort(za.compareByName);for(let o,r=0;o=e[r];r++)(n=ys.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get"),n.setAttribute("gap","8"),n.appendChild(ys.generateVariableFieldDom$$module$build$src$core$variables(o)),t.push(n)}}return t},_e=function(e){return Ka.generateUniqueNameInternal(e)},Te=function(e){return ve(Ya.charAt(0),e.getAllVariableNames())},ve=function(e,t){if(!t.length)return e;const n=Ya;let o="",r=n.indexOf(e);for(;;){let i=!1;for(let n=0;ne.getVariableModel().name));if(o&&(n=o.some((t=>t.toLowerCase()===e)),o=o.some((e=>e.toLowerCase()===t)),n&&o))return r.getName()}return null},ke=function(e,t,n){e=e.toLowerCase(),t=t.toLowerCase(),n=n.getAllBlocks(!1);for(const r of n){if(!fe(r))continue;var o=(n=r.getProcedureDef())[1];const i=o.some((t=>t.toLowerCase()===e));if(o=o.some((e=>e.toLowerCase()===t)),i&&o)return n[0]}return null},ys.generateVariableFieldDom$$module$build$src$core$variables=function(e){const t=ys.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name","VAR"),t.setAttribute("id",e.getId()),t.setAttribute("variabletype",e.type),e=ys.createTextNode$$module$build$src$core$utils$xml(e.name),t.appendChild(e),t},ys.getOrCreateVariablePackage$$module$build$src$core$variables=function(e,t,n,o){let r=ys.getVariable$$module$build$src$core$variables(e,t,n,o);return r||(r=$e(e,t,n,o)),r},ys.getVariable$$module$build$src$core$variables=function(e,t,n,o){const r=e.getPotentialVariableMap();let i=null;if(t&&(i=e.getVariableById(t),!i&&r&&(i=r.getVariableById(t)),i))return i;if(n){if(void 0===o)throw Error("Tried to look up a variable by name without a type");i=e.getVariable(n,o),!i&&r&&(i=r.getVariable(n,o))}return i},$e=function(e,t,n,o){const r=e.getPotentialVariableMap();return n||(n=_e(e.isFlyout?e.targetWorkspace:e)),r?r.createVariable(n,o,t):e.createVariable(n,o,t)},Ae=function(e,t){e=e.getAllVariables();const n=[];if(t.length!==e.length)for(let o=0;o>>/g,e),Ol="",(e=document.createElement("style")).id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},je=function(e){return Nl.getSizeInternal(e)},ze=function(e){if("none"!==Ye(e,"display"))return Xe(e);const t=e.style,n=t.display,o=t.visibility,r=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";const i=e.offsetWidth;return e=e.offsetHeight,t.display=n,t.position=r,t.visibility=o,new Da(i,e)},Xe=function(e){return new Da(e.offsetWidth,e.offsetHeight)},Ye=function(e,t){return(e=window.getComputedStyle(e))[t]||e.getPropertyValue(t)},Ke=function(e){const t=new qa(0,0);e=e.getBoundingClientRect();var n=document.documentElement;return n=new qa(window.pageXOffset||n.scrollLeft,window.pageYOffset||n.scrollTop),t.x=e.left+n.x,t.y=e.top+n.y,t},Je=function(){const e=document.body,t=document.documentElement;return new qa(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},qe=function(e){const t=parseFloat(Ye(e,"borderLeftWidth")),n=parseFloat(Ye(e,"borderRightWidth")),o=parseFloat(Ye(e,"borderTopWidth"));return e=parseFloat(Ye(e,"borderBottomWidth")),new xl(o,e,t,n)},Ze=function(e,t,n){e=Qe(e,t,n),t.scrollLeft=e.x,t.scrollTop=e.y},Qe=function(e,t,n){var o=Ke(e),r=Ke(t),i=qe(t);const s=o.x-r.x-i.left;return o=o.y-r.y-i.top,r=Xe(e),e=t.clientWidth-r.width,r=t.clientHeight-r.height,i=t.scrollLeft,t=t.scrollTop,n?(i+=s-e/2,t+=o-r/2):(i+=Math.min(s,Math.max(s-e,0)),t+=Math.min(o,Math.max(o-r,0))),new qa(i,t)},et=function(e){const t=new qa(0,0);var n=e.x&&e.getAttribute("x");const o=e.y&&e.getAttribute("y");return n&&(t.x=parseInt(n)),o&&(t.y=parseInt(o)),(n=(n=e.getAttribute("transform"))&&n.match(Dl))&&(t.x+=Number(n[1]),n[3]&&(t.y+=Number(n[3]))),(e=e.getAttribute("style"))&&-1/g,"<$1$2>")},pt=function(e){e=dt(e).split("<");let t="";for(let n=1;n"!==o.slice(-2)&&(t+=" ")}return(e=(e=e.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1")).replace(/^\n/,"")},ft=function(e,t){return t.setResizesEnabled(!1),t.clear(),e=ys.domToWorkspace$$module$build$src$core$xml(e,t),t.setResizesEnabled(!0),e},ys.domToWorkspace$$module$build$src$core$xml=function(e,t){let n=0;t.RTL&&(n=t.getWidth());const o=[];ee();const r=ys.getGroup$$module$build$src$core$events$utils();r||ys.setGroup$$module$build$src$core$events$utils(!0),t.setResizesEnabled&&t.setResizesEnabled(!1);let i=!0;try{for(let r,s=0;r=e.childNodes[s];s++){const e=r.nodeName.toLowerCase(),s=r;if("block"===e||"shadow"===e&&!$()){const e=ys.domToBlock$$module$build$src$core$xml(s,t);let r;o.push(e.id);const a=parseInt(null!=(r=s.getAttribute("x"))?r:"10",10);let l;const c=parseInt(null!=(l=s.getAttribute("y"))?l:"10",10);isNaN(a)||isNaN(c)||e.moveBy(t.RTL?n-a:a,c,["create"]),i=!1}else{if("shadow"===e)throw TypeError("Shadow block cannot be a top-level block.");if("comment"===e)t.rendered?Ul.fromXmlRendered(s,t,n):Za.fromXml(s,t);else if("variables"===e){if(!i)throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");mt(s,t),i=!1}}}}finally{ys.setGroup$$module$build$src$core$events$utils(r),te()}return t.setResizesEnabled&&t.setResizesEnabled(!0),A(new(B(sa))(t)),o},gt=function(e,t){if(!t.getBlocksBoundingBox)return ys.domToWorkspace$$module$build$src$core$xml(e,t);var n=t.getBlocksBoundingBox();if(e=ys.domToWorkspace$$module$build$src$core$xml(e,t),n&&n.top!==n.bottom){var o=n.bottom;n=t.RTL?n.right:n.left;var r=1/0;let i=-1/0,s=1/0;for(let n=0;ni&&(i=o.x)}for(o=o-s+10,n=t.RTL?n-i:n-r,r=0;rc.setBubbleVisible(i)),1)}},vt=function(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(e.isInsertionMarker())return null;const i={type:e.type,id:e.id};return t&&Lt(e,i),xt(e,i),Nt(e,i),Mt(e,i,r),Dt(e,i,r),n&&Pt(e,i,r),o&&Bt(e,i,r),i},xt=function(e,t){e.isCollapsed()&&(t.collapsed=!0),e.isEnabled()||(t.enabled=!1),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)},Lt=function(e,t){const n=e.workspace;e=e.getRelativeToSurfaceXY(),t.x=Math.round(n.RTL?n.getWidth()-e.x:e.x),t.y=Math.round(e.y)},Nt=function(e,t){e.saveExtraState?null!==(e=e.saveExtraState())&&(t.extraState=e):e.mutationToDom&&null!==(e=e.mutationToDom())&&(t.extraState=dt(e).replace(' xmlns="https://developers.google.com/blockly/xml"',""))},Mt=function(e,t,n){const o=Object.create(null);for(const r of e.getIcons())U(r)&&(e=r.saveState(n))&&(o[r.getType().toString()]=e);Object.keys(o).length&&(t.icons=o)},Dt=function(e,t,n){const o=Object.create(null);for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};return Ht(e,t,{recordUndo:n})},Ht=function(e,t){let{parentConnection:n,isShadow:o=!1,recordUndo:r=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=$();k(r),(r=ys.getGroup$$module$build$src$core$events$utils())||ys.setGroup$$module$build$src$core$events$utils(!0),ys.disable$$module$build$src$core$events$utils();const s=Gt(e,t,{parentConnection:n,isShadow:o});return ys.enable$$module$build$src$core$events$utils(),A(new(B(ys.CREATE$$module$build$src$core$events$utils))(s)),ys.setGroup$$module$build$src$core$events$utils(r),k(i),t.rendered&&setTimeout((()=>{s.disposed||s.setConnectionTracking(!0)}),1),s},Gt=function(e,t){let{parentConnection:n,isShadow:o=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e.type)throw new Vl(e);const r=t.newBlock(e.type,e.id);return r.setShadow(o),Vt(r,e),Wt(r,e),jt(r,e),zt(n,r,e),Xt(r,e),Yt(r,e),Kt(r,e),Jt(r,e),Zt(r,t.rendered),r},Vt=function(e,t){let n=void 0===t.x?0:t.x;t=void 0===t.y?0:t.y;const o=e.workspace;n=o.RTL?o.getWidth()-n:n,e.moveBy(n,t)},Wt=function(e,t){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.setEnabled(!1),void 0!==t.inline&&e.setInputsInline(t.inline),void 0!==t.data&&(e.data=t.data)},jt=function(e,t){t.extraState&&(e.loadExtraState?e.loadExtraState(t.extraState):e.domToMutation&&e.domToMutation(ys.textToDom$$module$build$src$core$utils$xml(t.extraState)))},zt=function(e,t,n){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new zl(n);if(e.type===ys.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var o=t.outputConnection;if(!o)throw new Wl("output",t,n)}else if(!(o=t.previousConnection))throw new Wl("previous",t,n);if(!e.connect(o)){const r=t.workspace.connectionChecker;throw new jl(r.getErrorMessage(r.canConnectWithReason(o,e,!1),o,e),e.type===ys.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,n)}}},Xt=function(e,t){if(t.icons){var n=Object.keys(t.icons);for(const r of n){n=t.icons[r];var o=e.getIcon(r);if(!o){if(!(o=s(As.ICON,r,!1)))throw new Xl(r,e,t);o=new o(e),e.addIcon(o)}U(o)&&o.loadState(n)}}},Yt=function(e,t){if(t.fields){var n=Object.keys(t.fields);for(let o=0;ot&&(t=n[o].length);var r=-1/0;let i,s=1;do{o=r,i=e,e=[],r=n.length/s;let a=1;for(let t=0;to);return i},Nn=function(e,t,n){const o=[0],r=[];for(var i=0;ir&&(r=a,o=s)}return o?Mn(e,o,n):t},Dn=function(e,t){const n=[];for(let o=0;oGc&&Jn()}else Fc!==Bc&&(clearTimeout(Mc),Dc=e.pageX,Pc=e.pageY,Mc=setTimeout(no,Vc))},Kn=function(){Fc=Bc=null,Jn()},Jn=function(){Rc&&(Rc=!1,jc&&(jc.style.display="none")),Mc&&(clearTimeout(Mc),Mc=0)},qn=function(){Jn(),xc=!0},Zn=function(){xc=!1},Qn=function(){jc&&Bc&&("function"==typeof Oc?Oc(jc,Bc):eo())},eo=function(){var e=Hn(Bc);e=(e=ys.wrap$$module$build$src$core$utils$string(e,Lc)).split("\n");for(let t=0;tn+window.scrollY&&(r-=jc.offsetHeight+2*Hc),e?o=Math.max(Wc-window.scrollX,o):o+jc.offsetWidth>t+window.scrollX-2*Wc&&(o=t-jc.offsetWidth-2*Wc),{x:o,y:r}},no=function(){if(!xc&&(Fc=Bc,jc)){jc.textContent="",Qn();var e=Bc.RTL;jc.style.direction=e?"rtl":"ltr",jc.style.display="block",Rc=!0;var{x:t,y:n}=to(e);jc.style.left=t+"px",jc.style.top=n+"px"}},oo=function(){return Xc},ro=function(e){Xc=e},io=function(){return Yc},so=function(e){Yc=e},ao=function(e){e="".concat(e).toLowerCase().trim();var t=Kc[e];if(t)return t;if(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]].join("");var n=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return n&&(e=Number(n[1]),t=Number(n[2]),n=Number(n[3]),0<=e&&256>e&&0<=t&&256>t&&0<=n&&256>n)?lo(e,t,n):null},lo=function(e,t,n){return t=e<<16|t<<8|n,16>e?"#"+(16777216|t).toString(16).substr(1):"#"+t.toString(16)},co=function(e){return(e=ao(e))?[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]:[0,0,0]},uo=function(e,t,n){let o=0,r=0,i=0;if(0===t)i=r=o=n;else{const s=Math.floor(e/60),a=e/60-s;e=n*(1-t);const l=n*(1-t*a);switch(t=n*(1-t*(1-a)),s){case 1:o=l,r=n,i=e;break;case 2:o=e,r=n,i=t;break;case 3:o=e,r=l,i=n;break;case 4:o=t,r=e,i=n;break;case 5:o=n,r=e,i=l;break;case 6:case 0:o=n,r=t,i=e}}return lo(Math.floor(o),Math.floor(r),Math.floor(i))},ho=function(e,t,n){return(e=ao(e))&&(t=ao(t))?(e=co(e),t=co(t),lo(Math.round(t[0]+n*(e[0]-t[0])),Math.round(t[1]+n*(e[1]-t[1])),Math.round(t[2]+n*(e[2]-t[2])))):null},po=function(e){return uo(e,Xc,255*Yc)},fo=function(e,t){const n=[];var o=e.split("");o.push("");var r=0;e=[];let i=null;for(let l=0;l=s?(r=2,i=s,(s=e.join(""))&&n.push(s),e.length=0):"{"===s?r=3:(e.push("%",s),r=0);else if(2===r)if("0"<=s&&"9">=s)i+=s;else{var a=void 0;n.push(parseInt(null!=(a=i)?a:"",10)),l--,r=0}else 3===r&&(""===s?(e.splice(0,0,"%{"),l--,r=0):"}"!==s?e.push(s):(r=e.join(""),/[A-Z]\w*/i.test(r)&&(s=(s=r.toUpperCase()).startsWith("BKY_")?s.substring(4):null)&&s in ys.Msg$$module$build$src$core$msg?"string"==typeof(r=ys.Msg$$module$build$src$core$msg[s])?Array.prototype.push.apply(n,fo(r,t)):t?n.push("".concat(r)):n.push(r):n.push("%{"+r+"}"),r=e.length=0))}for((t=e.join(""))&&n.push(t),a=[],e.length=0,o=0;o=n)return{hue:n,hex:uo(n,oo(),255*io())};if(n=ao(t))return{hue:null,hex:n};throw n='Invalid colour: "'+t+'"',e!==t&&(n+=' (from "'+e+'")'),Error(n)},To=function(){return Zc},vo=function(e){Zc=e},yo=function(){Zc||((Zc=document.createElement("div")).className="blocklyWidgetDiv",(_()||document.body).appendChild(Zc))},Eo=function(e,t,n){Io(),Qc=e,eu=n,(e=Zc)&&(e.style.direction=t?"rtl":"ltr",e.style.display="block",t=f(),tu=t.getRenderer().getClassName(),nu=t.getTheme().getClassName(),tu&&z(e,tu),nu&&z(e,nu))},Io=function(){if(So()){Qc=null;var e=Zc;e&&(e.style.display="none",e.style.left="",e.style.top="",eu&&eu(),eu=null,e.textContent="",tu&&(Y(e,tu),tu=""),nu&&(Y(e,nu),nu=""),f().markFocused())}},So=function(){return!!Qc},wo=function(e){Qc===e&&Io()},Co=function(e,t,n){Zc.style.left=e+"px",Zc.style.top=t+"px",Zc.style.height=n+"px"},ko=function(e,t,n,o){const r=Ao(e,t,n);e=$o(e,t,n,o),0>r?Co(e,0,n.height+r):Co(e,r,n.height)},$o=function(e,t,n,o){return o?Math.min(Math.max(t.right-n.width,e.left),e.right-n.width):Math.max(Math.min(t.left,e.right-n.width),e.left)},Ao=function(e,t,n){return t.bottom+n.height>=e.bottom?t.top-n.height:t.bottom},Oo=function(e){return!(null==e||!e.repositionForWindowResize)},Ro=function(){Oo(Qc)&&Qc.repositionForWindowResize()||Io()},xo=function(t,n){e(As.FIELD,t,n)},Lo=function(e){o(As.FIELD,e)},ys.fromJson$$module$build$src$core$field_registry=function(e){return au.fromJsonInternal(e)},No=function(e){const t=a(As.FIELD,e.type);if(t){if("function"!=typeof t.fromJson)throw new TypeError("returned Field was not a IRegistrableField");return t.fromJson(e)}return 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},Mo=function(e,t){e.setAttribute(du,t)},Do=function(e,t,n){Array.isArray(n)&&(n=n.join(" ")),e.setAttribute(hu+t,"".concat(n))},Po=function(e){let t=!1;const n=e.map((e=>{let[n,o]=e;return"string"==typeof n?[mo(n),o]:(t=!0,[null!==n.alt?Object.assign({},n,{alt:mo(n.alt)}):Object.assign({},n),o])}));if(t||2>e.length)return{options:n};var o=n.map((e=>{let[t]=e;return t})),r=On(o);e=Rn(o,r);const i=xn(o,r);return!e&&!i||r<=e+i?{options:n}:(r=e?o[0].substring(0,e-1):void 0,o=i?o[0].substr(1-i):void 0,{options:Bo(n,e,i),prefix:r,suffix:o})},Bo=function(e,t,n){return e.map((e=>{let[o,r]=e;return[o.substring(t,o.length-n),r]}))},Fo=function(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 n=0;n document.")}else e instanceof Element&&(t=e);return t},ys.register$$module$build$src$core$extensions=function(e,t){if("string"!=typeof e||""===e.trim())throw Error('Error: Invalid extension name "'+e+'"');if(xu[e])throw Error('Error: Extension "'+e+'" is already registered.');if("function"!=typeof t)throw Error('Error: Extension "'+e+'" must be a function');xu[e]=t},ys.registerMixin$$module$build$src$core$extensions=function(e,t){if(!t||"object"!=typeof t)throw Error('Error: Mixin "'+e+'" must be a object');ys.register$$module$build$src$core$extensions(e,(function(){this.mixin(t)}))},ys.registerMutator$$module$build$src$core$extensions=function(e,t,n,o){const r='Error when registering mutator "'+e+'": ';ir(r,t);const i=or(t,r);if(n&&"function"!=typeof n)throw Error(r+'Extension "'+e+'" is not a function');ys.register$$module$build$src$core$extensions(e,(function(){i&&this.setMutator(new ys.MutatorIcon$$module$build$src$core$icons$mutator_icon(o||[],this)),this.mixin(t),n&&n.apply(this)}))},qo=function(e){Zo(e)?delete xu[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},Zo=function(e){return!!xu[e]},Qo=function(e,t,n){const o=xu[e];if("function"!=typeof o)throw Error('Error: Extension "'+e+'" not found.');let r;if(n?er(e,t):r=sr(t),o.apply(t),n)ir('Error after applying mutator "'+e+'": ',t);else if(!ar(r,t))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},er=function(e,t){if(sr(t).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+t.id)},tr=function(e,t){return rr(e.mutationToDom,e.domToMutation,t+" mutationToDom/domToMutation")},nr=function(e,t){return rr(e.saveExtraState,e.loadExtraState,t+" saveExtraState/loadExtraState")},or=function(e,t){return rr(e.compose,e.decompose,t+" compose/decompose")},rr=function(e,t,n){if(e&&t){if("function"!=typeof e||"function"!=typeof t)throw Error(n+" must be a function");return!0}if(!e&&!t)return!1;throw Error(n+"Must have both or neither functions")},ir=function(e,t){const n=tr(t,e),o=nr(t,e);if(!n&&!o)throw Error(e+"Mutations must contain either XML hooks, or JSON hooks, or both");or(t,e)},sr=function(e){const 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},ar=function(e,t){if((t=sr(t)).length!==e.length)return!1;for(let n=0;nn)){var o=t.getSvgXY(e.getSvgRoot());e.outputConnection?(o.x+=(e.RTL?3:-3)*n,o.y+=13*n):e.previousConnection&&(o.x+=(e.RTL?-23:23)*n,o.y+=3*n),e=j(Ll.CIRCLE,{cx:o.x,cy:o.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg()),wr(e,new Date,n)}},wr=function(e,t,n){const o=((new Date).getTime()-t.getTime())/150;1e.workspace.scale)){var t=e.getHeightWidth().height;t=Math.atan(10/t)/Math.PI*180,e.RTL||(t*=-1),Ju=e,kr(e,t,new Date)}},kr=function(e,t,n){const o=((new Date).getTime()-n.getTime())/200;let r="";1>=o&&(r="skewX(".concat(Math.round(Math.sin(o*Math.PI*3)*(1-o)*t),")"),Ku=setTimeout(kr,10,e,t,n)),e.getSvgRoot().setAttribute("transform","".concat(e.getTranslation()," ").concat(r))},$r=function(){Ju&&(Ku&&(clearTimeout(Ku),Ku=null),Ju.getSvgRoot().setAttribute("transform",Ju.getTranslation()),Ju=null)},Ar=function(e,t,n){const o=n.getBoundingRectangle(),r=o.right-o.left,i=sn(t.top,o.top,t.top+t.height-(o.bottom-o.top))-o.top;let s=t.left;return t=t.left+t.width-r,e.RTL?s=Math.min(t,s):t=Math.max(s,t),!(!(e=sn(s,o.left,t)-o.left)&&!i||(n.moveBy(e,i,["inbounds"]),0))},Or=function(e){return t=>{var n,o=e.getMetricsManager();if(o.hasFixedEdges()&&!e.isDragging())if(-1!==aa.indexOf(null!=(n=t.type)?n:"")){n=o.getScrollMetrics(!0);const r=Rr(e,t);r&&(o=ys.getGroup$$module$build$src$core$events$utils()||!1,ys.setGroup$$module$build$src$core$events$utils(t.group),Ar(e,n,r)&&!t.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),ys.setGroup$$module$build$src$core$events$utils(o))}else t.type===ta&&t.scale&&t.oldScale&&t.scale>t.oldScale&&xr(e)}},Rr=function(e,t){let n=null;switch(t.type){case ys.CREATE$$module$build$src$core$events$utils:case ys.MOVE$$module$build$src$core$events$utils:(n=e.getBlockById(t.blockId))&&(n=n.getRootBlock());break;case na:case ia:n=e.getCommentById(t.commentId)}return n},xr=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var n=e.getTopBoundedElements();for(let o,r=0;o=n[r];r++)Ar(e,t,o)}},Lr=function(e){return Mr(e),nh||(nh=new Promise((e=>{window.requestAnimationFrame((()=>{Dr(),e()}))}))),nh},Nr=function(){return nh||Promise.resolve()},Mr=function(e){th.add(e);const t=e.getParent();t?Mr(t):eh.add(e)},Dr=function(){const e=new Set([...eh].map((e=>e.workspace)));for(const t of eh){if(t.isDisposed())continue;if(t.getParent())continue;Pr(t);const e=t.getRelativeToSurfaceXY();Br(t,e),Fr(t,e)}for(const t of e)t.resizeContents();eh.clear(),th=new Set,nh=null},Pr=function(e){if(th.has(e)){for(const t of e.getChildren(!1))Pr(t);e.renderEfficiently()}},Br=function(e,t){for(const n of e.getConnections_(!1)){e=n.moveToOffset(t);const o=n.targetBlock();n.isSuperior()&&o&&(e||th.has(o))&&Br(o,qa.sum(t,o.relativeCoords))}},Fr=function(e,t){if(e.getIcons){for(const n of e.getIcons())n.onLocationChange(t);for(const n of e.getChildren(!1))Fr(n,qa.sum(t,n.relativeCoords))}},Ur=function(e,t){const n=[];for(const o of e.getIcons())Qt(o)&&!o.bubbleIsVisible()||(n.push({location:t,icon:o}),o.onLocationChange(t));for(const o of e.getChildren(!1))n.push(...Ur(o,qa.sum(t,o.relativeCoords)));return n},Hr=function(e){dh.copyInternal(e)},Gr=function(e){hh=e.toCopyData()},Vr=function(){if(!hh)return null;let e=hh.source;return e.isFlyout&&(e=e.targetWorkspace),hh.typeCounts&&e.isCapacityAvailable(hh.typeCounts)?e.paste(hh.saveInfo):null},Wr=function(e){return dh.duplicateInternal(e)},jr=function(e){const t=hh;let n,o,r;return Hr(e),e=null!=(r=null==(n=e.toCopyData())||null==(o=n.source)?void 0:o.paste(hh.saveInfo))?r:null,hh=t,e},zr=function(){return fh},Xr=function(e){fh=e},Yr=function(e,t,n){if(Eo(gh,n,ei),t.length){var o=Kr(t,n);mh=o,Jr(o,e,n),setTimeout((function(){o.focus()}),1),fh=null}else Qr()},Kr=function(e,t){const n=new fu;n.setRole(cu.MENU);for(let o=0;o{setTimeout((()=>{r.callback(r.scope)}),0)}))}),{})}return n},Jr=function(e,t,n){const o=nt();t=new xl(t.clientY+o.top,t.clientY+o.top,t.clientX+o.left,t.clientX+o.left),qr(e);const r=e.getSize();n&&(t.left+=r.width,t.right+=r.width,o.left+=r.width,o.right+=r.width),ko(o,t,r,n),e.focus()},qr=function(e){var t=To();if(!t)throw Error("Attempting to create a context menu when widget div is null");t=e.render(t),z(t,"blocklyContextMenu"),De(t,"contextmenu",null,Zr),e.focus()},Zr=function(e){e.preventDefault(),e.stopPropagation()},Qr=function(){wo(gh),fh=null},ei=function(){mh&&(mh.dispose(),mh=null)},ys.callbackFactory$$module$build$src$core$contextmenu=function(e,t){return()=>{let n;ys.disable$$module$build$src$core$events$utils();try{n=ys.domToBlock$$module$build$src$core$xml(t,e.workspace);const o=e.getRelativeToSurfaceXY();o.x=e.RTL?o.x-ys.config$$module$build$src$core$config.snapRadius:o.x+ys.config$$module$build$src$core$config.snapRadius,o.y+=2*ys.config$$module$build$src$core$config.snapRadius,n.moveBy(o.x,o.y)}finally{ys.enable$$module$build$src$core$events$utils()}N()&&!n.isShadow()&&A(new(B(ys.CREATE$$module$build$src$core$events$utils))(n)),n.select()}},ti=function(e){return{text:ys.Msg$$module$build$src$core$msg.REMOVE_COMMENT,enabled:!0,callback:function(){ys.setGroup$$module$build$src$core$events$utils(!0),e.dispose(),ys.setGroup$$module$build$src$core$events$utils(!1)}}},ni=function(e){return{text:ys.Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){Wr(e)}}},oi=function(e,t){const n={enabled:!0};return n.text=ys.Msg$$module$build$src$core$msg.ADD_COMMENT,n.callback=function(){const n=new Ul(e,ys.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT,Ul.DEFAULT_SIZE,Ul.DEFAULT_SIZE);var o=e.getInjectionDiv().getBoundingClientRect();o=new qa(t.clientX-o.left,t.clientY-o.top);const r=e.getOriginOffsetInPixels();(o=qa.difference(o,r)).scale(1/e.scale),n.moveBy(o.x,o.y),e.rendered&&(n.initSvg(),n.render(),n.select())},n},ri=function(e){let t=e.outputConnection;return(!t||e.previousConnection&&e.previousConnection.isConnected())&&(t=e.previousConnection),t},ii=function(e){return e.isDynamic},si=function(t,n){e(As.RENDERER,t,n)},ai=function(e){o(As.RENDERER,e)},li=function(e,t,n){return(e=new(s(As.RENDERER,e))(e)).init(t,n),e},ci=function(){_h.registry.register({displayText:()=>ys.Msg$$module$build$src$core$msg.UNDO,preconditionFn:e=>0ys.Msg$$module$build$src$core$msg.REDO,preconditionFn:e=>0ys.Msg$$module$build$src$core$msg.CLEAN_UP,preconditionFn:e=>e.workspace.isMovable()?1ys.Msg$$module$build$src$core$msg.COLLAPSE_ALL,preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;tys.Msg$$module$build$src$core$msg.EXPAND_ALL,preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;te.workspace?1===(e=mi(e.workspace).length)?ys.Msg$$module$build$src$core$msg.DELETE_BLOCK:ys.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1","".concat(e)):"",preconditionFn:e=>e.workspace&&0t.length?bi(t):le(ys.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),(function(e){e&&bi(t)}))}},scopeType:_h.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},Ti=function(){ci(),ui(),hi(),pi(),fi(),_i()},vi=function(){_h.registry.register({displayText:()=>ys.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){e.block&&Wr(e.block)},scopeType:_h.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},yi=function(){_h.registry.register({displayText:e=>e.block.hasIcon(Gu.TYPE)?ys.Msg$$module$build$src$core$msg.REMOVE_COMMENT:ys.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(Gu.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:_h.ScopeType.BLOCK,id:"blockComment",weight:2})},Ei=function(){_h.registry.register({displayText:e=>e.block.getInputsInline()?ys.Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:ys.Msg$$module$build$src$core$msg.INLINE_INPUTS,preconditionFn(e){if(!(e=e.block).isInFlyout&&e.isMovable()&&!e.isCollapsed())for(let t=1;te.block.isCollapsed()?ys.Msg$$module$build$src$core$msg.EXPAND_BLOCK:ys.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:_h.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},Si=function(){_h.registry.register({displayText:e=>e.block.isEnabled()?ys.Msg$$module$build$src$core$msg.DISABLE_BLOCK:ys.Msg$$module$build$src$core$msg.ENABLE_BLOCK,preconditionFn:e=>!(e=e.block).isInFlyout&&e.workspace.options.disable&&e.isEditable()?e.getInheritedDisabled()?"disabled":"enabled":"hidden",callback(e){e=e.block;const t=ys.getGroup$$module$build$src$core$events$utils();t||ys.setGroup$$module$build$src$core$events$utils(!0),e.setEnabled(!e.isEnabled()),ys.setGroup$$module$build$src$core$events$utils(t)},scopeType:_h.ScopeType.BLOCK,id:"blockDisable",weight:5})},wi=function(){_h.registry.register({displayText(e){var t=e.block;return e=t.getDescendants(!1).length,(t=t.getNextBlock())&&(e-=t.getDescendants(!1).length),1===e?ys.Msg$$module$build$src$core$msg.DELETE_BLOCK:ys.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1","".concat(e))},preconditionFn:e=>!e.block.isInFlyout&&e.block.isDeletable()?"enabled":"hidden",callback(e){e.block&&e.block.checkAndDelete()},scopeType:_h.ScopeType.BLOCK,id:"blockDelete",weight:6})},Ci=function(){_h.registry.register({displayText:()=>ys.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:_h.ScopeType.BLOCK,id:"blockHelp",weight:7})},ki=function(){vi(),yi(),Ei(),Ii(),Si(),wi(),Ci()},$i=function(){Ti(),ki()},Ai=function(e){return void 0!==e.getProcedureModel&&void 0!==e.doProcedureUpdate&&void 0!==e.isProcedureDef},Oi=function(e){return void 0!==e.startPublishing&&void 0!==e.stopPublishing},Ri=function(e){const 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=>{!Ai(e)&&fe(e)&&t.push(e.getProcedureDef())}));const n=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=>{!Ai(e)&&fe(e)&&n.push(e.getProcedureDef())})),t.sort(xi),n.sort(xi),[t,n]},xi=function(e,t){return e[0].localeCompare(t[0],void 0,{sensitivity:"base"})},ys.findLegalName$$module$build$src$core$procedures=function(e,t){if(t.isInFlyout)return e;for(e=e||ys.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!Li(e,t.workspace,t);){const t=e.match(/^(.*?)(\d+)$/);e=t?t[1]+(parseInt(t[2])+1):e+"2"}return e},Li=function(e,t,n){return!Ni(e,t,n)},Ni=function(e,t,n){for(const o of t.getAllBlocks(!1))if(o!==n&&fe(o)&&ys.Names$$module$build$src$core$names.equals(o.getProcedureDef()[0],e))return!0;n=n&&Ai(n)?null==n?void 0:n.getProcedureModel():void 0;for(const o of t.getProcedureMap().getProcedures())if(o!==n&&ys.Names$$module$build$src$core$names.equals(o.getName(),e))return!0;return!1},ys.rename$$module$build$src$core$procedures=function(e){var t=this.getSourceBlock();if(!t)throw new iu;e=e.trim();const n=ys.findLegalName$$module$build$src$core$procedures(e,t);Ai(t)&&!t.isInsertionMarker()&&t.getProcedureModel().setName(n);const o=this.getValue();if(o!==e&&o!==n)for(e=t.workspace.getAllBlocks(!1),t=0;tUi(t,e)||ge(t)&&ys.Names$$module$build$src$core$names.equals(t.getProcedureCall(),e)))},Ui=function(e,t){return Ai(e)&&!e.isProcedureDef()&&e.getProcedureModel()&&ys.Names$$module$build$src$core$names.equals(e.getProcedureModel().getName(),t)},ys.mutateCallers$$module$build$src$core$procedures=function(e){const t=$();var n=e.getProcedureDef()[0];const o=e.mutationToDom(!0);e=Fi(n,e.workspace);for(let i,s=0;i=e[s];s++){n=(n=i.mutationToDom())&&G(n),i.domToMutation&&i.domToMutation(o);var r=i.mutationToDom();n!==(r=r&&G(r))&&(k(!1),A(new(B(ys.CHANGE$$module$build$src$core$events$utils))(i,"mutation",null,n,r)),k(t))}},ys.getDefinition$$module$build$src$core$procedures=function(e,t){for(const n of t.getAllBlocks(!1))if(Ai(n)&&n.isProcedureDef()&&ys.Names$$module$build$src$core$names.equals(n.getProcedureModel().getName(),e)||fe(n)&&ys.Names$$module$build$src$core$names.equals(n.getProcedureDef()[0],e))return n;return null},Hi=function(e){ye(e.getTargetWorkspace(),void 0,"String")},Gi=function(e){ye(e.getTargetWorkspace(),void 0,"Number")},Vi=function(e){ye(e.getTargetWorkspace(),void 0,"Colour")},Wi=function(e){let t=[],n=document.createElement("button");return n.setAttribute("text",ys.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE),n.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),t.push(n),n=document.createElement("button"),n.setAttribute("text",ys.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE),n.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),t.push(n),n=document.createElement("button"),n.setAttribute("text",ys.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE),n.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),t.push(n),e.registerButtonCallback("CREATE_VARIABLE_STRING",Hi),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",Gi),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",Vi),e=ji(e),t.concat(e)},ji=function(e){const t=[];if(0<(e=e.getAllVariables()).length){if(Ls.variables_set_dynamic){var n=e[e.length-1];const o=ys.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","variables_set_dynamic"),o.setAttribute("gap","24"),o.appendChild(ys.generateVariableFieldDom$$module$build$src$core$variables(n)),t.push(o)}if(Ls.variables_get_dynamic){e.sort(za.compareByName);for(let o,r=0;o=e[r];r++)(n=ys.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get_dynamic"),n.setAttribute("gap","8"),n.appendChild(ys.generateVariableFieldDom$$module$build$src$core$variables(o)),t.push(n)}}return t},zi=function(e,t,n,o,r,i){const s=i.scrollbar&&i.scrollbar.canScrollVertically();return e.horizontal===Cp.LEFT?(n=r.absoluteMetrics.left+n,s&&i.RTL&&(n+=Tu.scrollbarThickness)):(n=r.absoluteMetrics.left+r.viewMetrics.width-t.width-n,s&&!i.RTL&&(n-=Tu.scrollbarThickness)),e.vertical===wp.TOP?e=r.absoluteMetrics.top+o:(e=r.absoluteMetrics.top+r.viewMetrics.height-t.height-o,i.scrollbar&&i.scrollbar.canScrollHorizontally()&&(e-=Tu.scrollbarThickness)),new xl(e,e+t.height,n,n+t.width)},Xi=function(e,t){return{horizontal:t.toolboxMetrics.position===Iu.LEFT||e.horizontalLayout&&!e.RTL?Cp.RIGHT:Cp.LEFT,vertical:t.toolboxMetrics.position===Iu.BOTTOM?wp.TOP:wp.BOTTOM}},Yi=function(e,t,n,o){const r=e.left,i=e.right-e.left,s=e.bottom-e.top;for(let a=0;ais(e))),t):t},is=function(e){const t={id:e.getId(),name:e.getName()};return e.getTypes().length?(t.types=e.getTypes(),t):t},ss=function(e,t,n,o){if(e=new e(o,n.name,n.id).setReturnTypes(n.returnTypes),!n.parameters)return e;for(const[r,i]of n.parameters.entries())e.insertParameter(as(t,i,o),r);return e},as=function(e,t,n){return e=new e(n,t.name,t.id),t.types&&e.setTypes(t.types),e},ls=function(e){const t=Object.create(null),n=l(As.SERIALIZER,!0);for(const o in n){let r;const i=null==(r=n[o])?void 0:r.save(e);i&&(t[o]=i)}return t},cs=function(e,t){let{recordUndo:n=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var o=l(As.SERIALIZER,!0);if(o){o=Object.entries(o).sort(((e,t)=>t[1].priority-e[1].priority));var r=$();k(n),(n=ys.getGroup$$module$build$src$core$events$utils())||ys.setGroup$$module$build$src$core$events$utils(!0),ee(),t instanceof Np&&t.setResizesEnabled(!1);for(const[,e]of o.reverse()){let n;null==(n=e)||n.clear(t)}for(let[n,r]of o.reverse())if(e[n]){let o;null==(o=r)||o.load(e[n],t)}t instanceof Np&&t.setResizesEnabled(!0),te(),A(new(B(sa))(t)),ys.setGroup$$module$build$src$core$events$utils(n),k(r)}},us=function(){Fp.registry.register({name:hf.ESCAPE,preconditionFn:e=>!e.options.readOnly,callback:e=>(e.hideChaff(),!0),keyCodes:[Mu.ESC]})},hs=function(){Fp.registry.register({name:hf.DELETE,preconditionFn(e){const t=m();return!e.options.readOnly&&null!=t&&t.isDeletable()},callback:(e,t)=>(t.preventDefault(),!pp.inProgress()&&(m().checkAndDelete(),!0)),keyCodes:[Mu.DELETE,Mu.BACKSPACE]})},ds=function(){const e=Fp.registry.createSerializedKey(Mu.C,[Mu.CTRL]),t=Fp.registry.createSerializedKey(Mu.C,[Mu.ALT]),n=Fp.registry.createSerializedKey(Mu.C,[Mu.META]);Fp.registry.register({name:hf.COPY,preconditionFn(e){const t=m();return!e.options.readOnly&&!pp.inProgress()&&null!=t&&t.isDeletable()&&t.isMovable()},callback:(e,t)=>(t.preventDefault(),e.hideChaff(),Hr(m()),!0),keyCodes:[e,t,n]})},ps=function(){const e=Fp.registry.createSerializedKey(Mu.X,[Mu.CTRL]),t=Fp.registry.createSerializedKey(Mu.X,[Mu.ALT]),n=Fp.registry.createSerializedKey(Mu.X,[Mu.META]);Fp.registry.register({name:hf.CUT,preconditionFn(e){const t=m();return!e.options.readOnly&&!pp.inProgress()&&null!=t&&t instanceof Nh&&t.isDeletable()&&t.isMovable()&&!t.workspace.isFlyout},callback(){const e=m();return!!e&&(Hr(e),e.checkAndDelete(),!0)},keyCodes:[e,t,n]})},fs=function(){const e=Fp.registry.createSerializedKey(Mu.V,[Mu.CTRL]),t=Fp.registry.createSerializedKey(Mu.V,[Mu.ALT]),n=Fp.registry.createSerializedKey(Mu.V,[Mu.META]);Fp.registry.register({name:hf.PASTE,preconditionFn:e=>!e.options.readOnly&&!pp.inProgress(),callback:()=>!!Vr(),keyCodes:[e,t,n]})},gs=function(){const e=Fp.registry.createSerializedKey(Mu.Z,[Mu.CTRL]),t=Fp.registry.createSerializedKey(Mu.Z,[Mu.ALT]),n=Fp.registry.createSerializedKey(Mu.Z,[Mu.META]);Fp.registry.register({name:hf.UNDO,preconditionFn:e=>!e.options.readOnly&&!pp.inProgress(),callback:e=>(e.hideChaff(),e.undo(!1),!0),keyCodes:[e,t,n]})},ms=function(){const e=Fp.registry.createSerializedKey(Mu.Z,[Mu.SHIFT,Mu.CTRL]),t=Fp.registry.createSerializedKey(Mu.Z,[Mu.SHIFT,Mu.ALT]),n=Fp.registry.createSerializedKey(Mu.Z,[Mu.SHIFT,Mu.META]),o=Fp.registry.createSerializedKey(Mu.Y,[Mu.CTRL]);Fp.registry.register({name:hf.REDO,preconditionFn:e=>!pp.inProgress()&&!e.options.readOnly,callback:e=>(e.hideChaff(),e.undo(!0),!0),keyCodes:[e,t,n,o]})},bs=function(){us(),hs(),ds(),ps(),fs(),gs(),ms()},_s=function(e){return e.isSelectable()},Ts=function(e){f().hideChaff(e)},(vs=vs||{}).scope={},vs.ASSUME_ES5=!1,vs.ASSUME_NO_NATIVE_MAP=!1,vs.ASSUME_NO_NATIVE_SET=!1,vs.SIMPLE_FROUND_POLYFILL=!1,vs.ISOLATE_POLYFILLS=!1,vs.FORCE_POLYFILL_PROMISE=!1,vs.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,vs.defineProperty=vs.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e},vs.getGlobal=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof n.g&&n.g];for(var t=0;t>>0,vs.propertyToPolyfillSymbol[r]=vs.IS_SYMBOL_NATIVE?vs.global.Symbol(r):vs.POLYFILL_PREFIX+n+"$"+r),vs.defineProperty(o,vs.propertyToPolyfillSymbol[r],{configurable:!0,writable:!0,value:t})))},vs.polyfill("globalThis",(function(e){return e||vs.global}),"es_2020","es3"),vs.arrayIteratorImpl=function(e){var t=0;return function(){return t{const e=[];for(let t=0;20>t;t++)e[t]=da.charAt(88*Math.random());return e.join("")}},fa=0,ga={};ga.TEST_ONLY=pa,ga.genUid=C,ga.getNextUniqueId=w,Fs="",Us=!0,Hs=0,ys.CREATE$$module$build$src$core$events$utils="create",ys.CREATE$$module$build$src$core$events$utils,ys.DELETE$$module$build$src$core$events$utils="delete",ys.DELETE$$module$build$src$core$events$utils,ys.CHANGE$$module$build$src$core$events$utils="change",ys.CHANGE$$module$build$src$core$events$utils,Gs="block_field_intermediate_change",ys.MOVE$$module$build$src$core$events$utils="move",ys.MOVE$$module$build$src$core$events$utils,Vs="var_create",Ws="var_delete",js="var_rename",zs="ui",Xs="drag",Ys="selected",Ks="click",Js="marker_move",qs="bubble_open",Zs="trashcan_open",Qs="toolbox_item_select",ea="theme_change",ta="viewport_change",na="comment_create",oa="comment_delete",ra="comment_change",ia="comment_move",sa="finished_loading",aa=[ys.CREATE$$module$build$src$core$events$utils,ys.MOVE$$module$build$src$core$events$utils,na,ia],ca={FIRE_QUEUE:la=[],fireNow:R,fireInternal:O,setGroupInternal:M},(ua={}).BLOCK_CHANGE=ys.CHANGE$$module$build$src$core$events$utils,ua.BLOCK_CREATE=ys.CREATE$$module$build$src$core$events$utils,ua.BLOCK_DELETE=ys.DELETE$$module$build$src$core$events$utils,ua.BLOCK_DRAG=Xs,ua.BLOCK_FIELD_INTERMEDIATE_CHANGE=Gs,ua.BLOCK_MOVE=ys.MOVE$$module$build$src$core$events$utils,ua.BUBBLE_OPEN=qs,ua.BUMP_EVENTS=aa,ua.CHANGE=ys.CHANGE$$module$build$src$core$events$utils,ua.CLICK=Ks,ua.COMMENT_CHANGE=ra,ua.COMMENT_CREATE=na,ua.COMMENT_DELETE=oa,ua.COMMENT_MOVE=ia,ua.CREATE=ys.CREATE$$module$build$src$core$events$utils,ua.DELETE=ys.DELETE$$module$build$src$core$events$utils,ua.FINISHED_LOADING=sa,ua.MARKER_MOVE=Js,ua.MOVE=ys.MOVE$$module$build$src$core$events$utils,ua.SELECTED=Ys,ua.TEST_ONLY=ca,ua.THEME_CHANGE=ea,ua.TOOLBOX_ITEM_SELECT=Qs,ua.TRASHCAN_OPEN=Zs,ua.UI=zs,ua.VAR_CREATE=Vs,ua.VAR_DELETE=Ws,ua.VAR_RENAME=js,ua.VIEWPORT_CHANGE=ta,ua.clearPendingUndo=L,ua.disable=ys.disable$$module$build$src$core$events$utils,ua.disableOrphans=F,ua.enable=ys.enable$$module$build$src$core$events$utils,ua.filter=x,ua.fire=A,ua.fromJson=P,ua.get=B,ua.getDescendantIds=D,ua.getGroup=ys.getGroup$$module$build$src$core$events$utils,ua.getRecordUndo=$,ua.isEnabled=N,ua.setGroup=ys.setGroup$$module$build$src$core$events$utils,ua.setRecordUndo=k,(ha=ys.inputTypes$$module$build$src$core$inputs$input_types||(ys.inputTypes$$module$build$src$core$inputs$input_types={}))[ha.VALUE=1]="VALUE",ha[ha.STATEMENT=3]="STATEMENT",ha[ha.DUMMY=5]="DUMMY",ha[ha.CUSTOM=6]="CUSTOM",ys.inputTypes$$module$build$src$core$inputs$input_types;var ma={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},ba={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:_a,DOMParser:Ta,XMLSerializer:va}=globalThis;Ta&&(ma=new Ta),va&&(ba=new va);var ya="https://developers.google.com/blockly/xml",Ea=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,Ia={};Ia.NAME_SPACE=ya,Ia.createElement=ys.createElement$$module$build$src$core$utils$xml,Ia.createTextNode=ys.createTextNode$$module$build$src$core$utils$xml,Ia.domToText=G,Ia.injectDependencies=H,Ia.textToDom=ys.textToDom$$module$build$src$core$utils$xml;var Sa=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};Sa.MUTATOR=new Sa("mutator"),Sa.WARNING=new Sa("warning"),Sa.COMMENT=new Sa("comment");var wa={};wa.warn=W;var Ca,ka="http://www.w3.org/2000/svg",$a="http://www.w3.org/1999/xhtml",Aa="http://www.w3.org/1999/xlink";!function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE"}(Ca||(Ca={}));var Oa=null,Ra=0,xa=null,La={};La.HTML_NS=$a,La.NodeType=Ca,La.SVG_NS=ka,La.XLINK_NS=Aa,La.addClass=z,La.containsNode=Z,La.createSvgElement=j,La.getFastTextWidth=oe,La.getFastTextWidthWithSizeString=re,La.getTextWidth=ne,La.hasClass=K,La.insertAfter=q,La.measureFontMetrics=ie,La.removeClass=Y,La.removeClasses=X,La.removeNode=J,La.setCssTransform=Q,La.startTextWidthCache=ee,La.stopTextWidthCache=te;var Na,Ma,Da=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}},Pa=function(e,t){window.alert(e),t&&t()},Ba=function(e,t){t(window.confirm(e))},Fa=function(e,t,n){n(window.prompt(e,t))},Ua={confirmInternal:ce},Ha={};Ha.TEST_ONLY=Ua,Ha.alert=se,Ha.confirm=le,Ha.prompt=he,Ha.setAlert=ae,Ha.setConfirm=ue,Ha.setPrompt=de,ys.Msg$$module$build$src$core$msg=Object.create(null),Na=function(e){Object.keys(e).forEach((function(t){ys.Msg$$module$build$src$core$msg[t]=e[t]}))},(Ma={}).Msg=ys.Msg$$module$build$src$core$msg,Ma.setLocale=Na;var Ga={};Ga.isLegacyProcedureCallBlock=ge,Ga.isLegacyProcedureDefBlock=fe;var Va=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=ys.getGroup$$module$build$src$core$events$utils(),this.recordUndo=$()}toJson(){return{type:this.type,group:this.group}}static fromJson(e,t,n){return n.isBlank=!1,n.group=e.group||"",n.workspaceId=t.id,n}isNull(){return!1}run(e){}getEventWorkspace_(){let e;if(this.workspaceId&&(e=u(this.workspaceId)),!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e}},Wa=class extends Va{constructor(e){super(),this.isBlank=void 0===e,e&&(this.varId=e.getId(),this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");return e.varId=this.varId,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new Wa)).varId=e.varId,t}},ja=class extends Wa{constructor(e){super(e),this.type=Vs,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const 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,n){return(t=super.fromJson(e,t,null!=n?n:new ja)).varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.createVariable(this.varName,this.varType,this.varId):t.deleteVariableById(this.varId)}};e(As.EVENT,Vs,ja);var za=class{constructor(e,t,n,o){this.workspace=e,this.name=t,this.type=n||"",this.id_=o||C()}getId(){return this.id_}static compareByName(e,t){return e.name.localeCompare(t.name,void 0,{sensitivity:"base"})}},Xa="VARIABLE",Ya="ijkmnopqrstuvwxyzabcdefgh",Ka={generateUniqueNameInternal:Te},Ja={};Ja.CATEGORY_NAME=Xa,Ja.TEST_ONLY=Ka,Ja.VAR_LETTER_OPTIONS=Ya,Ja.allDeveloperVariables=ys.allDeveloperVariables$$module$build$src$core$variables,Ja.allUsedVarModels=ys.allUsedVarModels$$module$build$src$core$variables,Ja.createVariableButtonHandler=ye,Ja.flyoutCategory=me,Ja.flyoutCategoryBlocks=be,Ja.generateUniqueName=_e,Ja.generateUniqueNameFromOptions=ve,Ja.generateVariableFieldDom=ys.generateVariableFieldDom$$module$build$src$core$variables,Ja.getAddedVariables=Ae,Ja.getOrCreateVariablePackage=ys.getOrCreateVariablePackage$$module$build$src$core$variables,Ja.getVariable=ys.getVariable$$module$build$src$core$variables,Ja.nameUsedWithAnyType=Se,Ja.nameUsedWithConflictingParam=we,Ja.promptName=Ee,Ja.renameVariable=ys.renameVariable$$module$build$src$core$variables;var qa=class{constructor(e,t){this.x=e,this.y=t}clone(){return new qa(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){const n=e.x-t.x;return e=e.y-t.y,Math.sqrt(n*n+e*e)}static magnitude(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static difference(e,t){return new qa(e.x-t.x,e.y-t.y)}static sum(e,t){return new qa(e.x+t.x,e.y+t.y)}},Za=class{constructor(e,t,n,o,r){this.workspace=e,this.editable=this.movable=this.deletable=!0,this.disposed_=!1,this.isComment=!0,this.id=r&&!e.getCommentById(r)?r:C(),e.addTopComment(this),this.xy_=new qa(0,0),this.height_=n,this.width_=o,this.RTL=e.RTL,this.content_=t,Za.fireCreateEvent(this)}dispose(){this.disposed_||(N()&&A(new(B(oa))(this)),this.workspace.removeTopComment(this),this.disposed_=!0)}getHeight(){return this.height_}setHeight(e){this.height_=e}getWidth(){return this.width_}setWidth(e){this.width_=e}getRelativeToSurfaceXY(){return new qa(this.xy_.x,this.xy_.y)}moveBy(e,t){const n=new(B(ia))(this);this.xy_.translate(e,t),n.recordNew(),A(n)}isDeletable(){return this.deletable&&!(this.workspace&&this.workspace.options.readOnly)}setDeletable(e){this.deletable=e}isMovable(){return this.movable&&!(this.workspace&&this.workspace.options.readOnly)}setMovable(e){this.movable=e}isEditable(){return this.editable&&!(this.workspace&&this.workspace.options.readOnly)}setEditable(e){this.editable=e}getContent(){return this.content_}setContent(e){this.content_!==e&&(A(new(B(ra))(this,this.content_,e)),this.content_=e)}toXmlWithXY(e){return(e=this.toXml(e)).setAttribute("x",String(Math.round(this.xy_.x))),e.setAttribute("y",String(Math.round(this.xy_.y))),e.setAttribute("h",String(this.height_)),e.setAttribute("w",String(this.width_)),e}toXml(e){const t=ys.createElement$$module$build$src$core$utils$xml("comment");return e||(t.id=this.id),t.textContent=this.getContent(),t}static fireCreateEvent(e){if(N()){const t=ys.getGroup$$module$build$src$core$events$utils();t||ys.setGroup$$module$build$src$core$events$utils(!0);try{A(new(B(na))(e))}finally{ys.setGroup$$module$build$src$core$events$utils(t)}}}static fromXml(e,t){var n=Za.parseAttributes(e);return t=new Za(t,n.content,n.h,n.w,n.id),n=e.getAttribute("x"),e=e.getAttribute("y"),n=n?parseInt(n,10):NaN,e=e?parseInt(e,10):NaN,isNaN(n)||isNaN(e)||t.moveBy(n,e),Za.fireCreateEvent(t),t}static parseAttributes(e){const t=e.getAttribute("h"),n=e.getAttribute("w"),o=e.getAttribute("x"),r=e.getAttribute("y"),i=e.getAttribute("id");if(!i)throw Error("No ID present in XML comment definition.");let s;return{id:i,h:t?parseInt(t):100,w:n?parseInt(n):100,x:o?parseInt(o):NaN,y:r?parseInt(r):NaN,content:null!=(s=e.textContent)?s:""}}},Qa=class extends Va{constructor(e){super(),this.recordUndo=!1,this.isUiEvent=!0,this.isBlank=void 0===e,this.workspaceId=e||""}},el=class extends Qa{constructor(e,t,n){super(n),this.type=Ys,this.oldElementId=null!=e?e:void 0,this.newElementId=null!=t?t:void 0}toJson(){const e=super.toJson();return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new el)).oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};e(As.EVENT,Ys,el);var tl,nl,ol,rl,il,sl,al,ll,cl,ul,hl=750,dl="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),pl=null,fl={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},gl=0,ml={};ml.TOUCH_ENABLED=dl,ml.TOUCH_MAP=fl,ml.checkTouchIdentifier=Me,ml.clearTouchIdentifier=xe,ml.getTouchIdentifierFromEvent=Ne,ml.longStart=Oe,ml.longStop=Re,ml.shouldHandleEvent=Le,function(e){function t(e){return-1!==n.indexOf(e.toUpperCase())}const n=(tl=e).toUpperCase();nl=t("JavaFX"),ol=t("WebKit"),rl=t("Gecko")&&!ol,il=t("Android"),e=globalThis.navigator&&globalThis.navigator.maxTouchPoints,sl=t("iPad")||t("Macintosh")&&0.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}\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("<<>>/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.blocklyDisabled>.blocklyPath {\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.blocklyMultilineText {\n font-family: monospace;\n}\n\n.blocklyNonEditableText>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.blocklyHidden {\n display: none;\n}\n\n.blocklyFieldDropdown:not(.blocklyHidden) {\n display: block;\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}\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}\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 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.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\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 position: relative; /* Compatibility with gapi, reset from goog-menu */\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(<<>>/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',Rl={};Rl.inject=We,Rl.register=Ve;var xl=class{constructor(e,t,n,o){this.top=e,this.bottom=t,this.left=n,this.right=o}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}contains(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}intersects(e){return!(this.left>e.right||this.righte.bottom||this.bottom{this.disposed_||(this.textarea.focus(),this.addFocus(),this.svgRectTarget&&z(this.svgRectTarget,"blocklyCommentTargetFocused"),this.svgHandleTarget&&z(this.svgHandleTarget,"blocklyCommentHandleTargetFocused"))}),0)}blurFocus(){this.focused=!1,setTimeout((()=>{this.disposed_||(this.textarea.blur(),this.removeFocus(),this.svgRectTarget&&Y(this.svgRectTarget,"blocklyCommentTargetFocused"),this.svgHandleTarget&&Y(this.svgHandleTarget,"blocklyCommentHandleTargetFocused"))}),0)}static fromXmlRendered(e,t,n){let o;ys.disable$$module$build$src$core$events$utils();try{const r=Za.parseAttributes(e);if(o=new Ul(t,r.content,r.h,r.w,r.id),t.rendered&&(o.initSvg(!0),o.render()),!isNaN(r.x)&&!isNaN(r.y))if(t.RTL){const e=n||t.getWidth();o.moveBy(e-r.x,r.y)}else o.moveBy(r.x,r.y)}finally{ys.enable$$module$build$src$core$events$utils()}return Za.fireCreateEvent(o),o}};Ul.DEFAULT_SIZE=100,Ul.TOP_OFFSET=10,Ve("\n.blocklyCommentForeignObject {\n position: relative;\n z-index: 0;\n}\n\n.blocklyCommentRect {\n fill: #E7DE8E;\n stroke: #bcA903;\n stroke-width: 1px;\n}\n\n.blocklyCommentTarget {\n fill: transparent;\n stroke: #bcA903;\n}\n\n.blocklyCommentTargetFocused {\n fill: none;\n}\n\n.blocklyCommentHandleTarget {\n fill: none;\n}\n\n.blocklyCommentHandleTargetFocused {\n fill: transparent;\n}\n\n.blocklyFocused>.blocklyCommentRect {\n fill: #B9B272;\n stroke: #B9B272;\n}\n\n.blocklySelected>.blocklyCommentTarget {\n stroke: #fc3;\n stroke-width: 3px;\n}\n\n.blocklyCommentDeleteIcon {\n cursor: pointer;\n fill: #000;\n display: none;\n}\n\n.blocklySelected > .blocklyCommentDeleteIcon {\n display: block;\n}\n\n.blocklyDeleteIconShape {\n fill: #000;\n stroke: #000;\n stroke-width: 1px;\n}\n\n.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {\n stroke: #fc3;\n}\n");var Hl={};Hl.appendDomToWorkspace=gt,Hl.blockToDom=ut,Hl.blockToDomWithXY=at,Hl.clearWorkspaceAndLoadFromXml=ft,Hl.deleteNext=kt,Hl.domToBlock=ys.domToBlock$$module$build$src$core$xml,Hl.domToPrettyText=pt,Hl.domToText=dt,Hl.domToVariables=mt,Hl.domToWorkspace=ys.domToWorkspace$$module$build$src$core$xml,Hl.variablesToDom=st,Hl.workspaceToDom=it;var Gl=class extends Error{},Vl=class extends Gl{constructor(e){super("Expected to find a 'type' property, defining the block type"),this.state=e}},Wl=class extends Gl{constructor(e,t,n){super("The block ".concat(t.toDevString()," is missing a(n) ").concat(e,"\nconnection")),this.block=t,this.state=n}},jl=class extends Gl{constructor(e,t,n,o){super("The block ".concat(n.toDevString()," could not connect its\n").concat(t," to its parent, because: ").concat(e)),this.childBlock=n,this.childState=o}},zl=class extends Gl{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}},Xl=class extends Gl{constructor(e,t,n){super("Cannot add an icon of type '".concat(e,"' to the block ").concat(t.toDevString(),", because there is no icon registered with type '").concat(e,"'. Make sure that all of your icons have been registered.")),this.block=t,this.state=n}},Yl={};Yl.BadConnectionCheck=jl,Yl.DeserializationError=Gl,Yl.MissingBlockType=Vl,Yl.MissingConnection=Wl,Yl.RealChildOfShadow=zl,Yl.UnregisteredIcon=Xl;var Kl={};Kl.register=At,Kl.unregister=Ot;var Jl=class{constructor(){this.priority=50}save(e){const t=[];for(const n of e.getTopBlocks(!1))(e=Rt(n,{addCoordinates:!0,doFullSerialization:!1}))&&t.push(e);return t.length?{languageVersion:0,blocks:t}:null}load(e,t){e=e.blocks;for(const n of e)Ut(n,t,{recordUndo:$()})}clear(e){for(const t of e.getTopBlocks(!1))t.dispose(!1)}};At("blocks",new Jl);var ql={};ql.BlockSerializer=Jl,ql.append=Ut,ql.appendInternal=Ht,ql.save=Rt;var Zl=class extends Va{constructor(e){super(),this.isBlank=!e,e&&(this.blockId=e.id,this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.blockId=this.blockId,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new Zl)).blockId=e.blockId,t}},Ql=class extends Zl{constructor(e){super(e),this.type=ys.CREATE$$module$build$src$core$events$utils,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=at(e),this.ids=D(e),this.json=Rt(e,{addCoordinates:!0}))}toJson(){const e=super.toJson();if(!this.xml)throw Error("The block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=dt(this.xml),e.ids=this.ids,e.json=this.json,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new Ql)).xml=ys.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){const t=this.getEventWorkspace_();if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(e)Ut(this.json,t);else for(e=0;e")),A(new tc(t,"mutation",null,n,e));break;default:console.warn("Unknown change type: "+this.element)}}static getExtraBlockState_(e){return e.saveExtraState?(e=e.saveExtraState())?JSON.stringify(e):"":e.mutationToDom&&(e=e.mutationToDom())?dt(e):""}};e(As.EVENT,ys.CHANGE$$module$build$src$core$events$utils,tc);var nc,oc=class extends Zl{constructor(e){if(super(e),this.type=ys.DELETE$$module$build$src$core$events$utils,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=at(e),this.ids=D(e),this.wasShadow=e.isShadow(),this.oldJson=Rt(e,{addCoordinates:!0})}}toJson(){const e=super.toJson();if(!this.oldXml)throw Error("The old block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(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=dt(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,n){return(t=super.fromJson(e,t,null!=n?n:new oc)).oldXml=ys.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){const t=this.getEventWorkspace_();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(e)for(e=0;e0&&void 0!==arguments[0])||arguments[0];const{parentConnection:t,childConnection:n}=this.getParentAndChildConnections();if(!t||!n)throw Error("Source connection not connected.");const o=ys.getGroup$$module$build$src$core$events$utils();let r;o||ys.setGroup$$module$build$src$core$events$utils(!0),N()&&(r=new(B(ys.MOVE$$module$build$src$core$events$utils))(n.getSourceBlock()),r.setReason(["disconnect"]));const i=this.targetConnection;i&&(i.targetConnection=null),this.targetConnection=null,e&&n.getSourceBlock().setParent(null),r&&(r.recordNew(),A(r)),n.getSourceBlock().isShadow()||t.respawnShadow_(),ys.setGroup$$module$build$src$core$events$utils(o)}getParentAndChildConnections(){return this.targetConnection?this.isSuperior()?{parentConnection:this,childConnection:this.targetConnection}:{parentConnection:this.targetConnection,childConnection:this}:{}}respawnShadow_(){this.createShadowBlock(!0)}reconnect(e,t){return!(this.getSourceBlock().isDeadOrDying()||(t=null==(n=e.getInput(t))?void 0:n.connection,(n=this.targetBlock())&&n!==e||!t||t.targetConnection===this||(t.isConnected()&&t.disconnect(),t.connect(this),0)));var n}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()?ut(this.targetBlock()):this.shadowDom}setShadowState(e){this.setShadowStateInternal({shadowState:e})}getShadowState(e){return e&&this.targetBlock()&&this.targetBlock().isShadow()?Rt(this.targetBlock()):this.shadowState}neighbours(e){return[]}getParentInput(){let e=null;const t=this.sourceBlock_.inputList;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.shadowDom=e,this.shadowState=t,(e=this.targetBlock())?e.isShadow()?(e.dispose(!1),this.getSourceBlock().isDeadOrDying()||(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock()))):(e=this.createShadowBlock(!1),this.serializeShadow(e),e&&e.dispose(!1)):(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock()))}createShadowBlock(e){var t=this.getSourceBlock();const n=this.getShadowState(),o=this.getShadowDom();if(t.isDeadOrDying()||!n&&!o)return null;if(n)return Ht(n,t.workspace,{parentConnection:e?this:void 0,isShadow:!0,recordUndo:!1});if(o){if(t=ys.domToBlock$$module$build$src$core$xml(o,t.workspace),e)if(this.type===nc.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!==nc.NEXT_STATEMENT)throw Error("Cannot connect a shadow block to a previous/output connection");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")}return t}return null}serializeShadow(e){e&&(this.shadowDom=ut(e),this.shadowState=Rt(e))}static getConnectionForOrphanedConnection(e,t){if(t.type===nc.OUTPUT_VALUE)return nn(e,t.getSourceBlock());e=e.lastConnectionInStack(!0);const n=t.getConnectionChecker();return e&&n.canConnect(t,e,!1)?e:null}};rc.CAN_CONNECT=0,rc.REASON_SELF_CONNECTION=1,rc.REASON_WRONG_TYPE=2,rc.REASON_TARGET_NULL=3,rc.REASON_CHECKS_FAILED=4,rc.REASON_DIFFERENT_WORKSPACES=5,rc.REASON_SHADOW_PARENT=6,rc.REASON_DRAG_CHECKS_FAILED=7,rc.REASON_PREVIOUS_AND_OUTPUT=8;var ic="_TEMP_COLLAPSED_INPUT",sc="_TEMP_COLLAPSED_FIELD",ac={};ac.COLLAPSED_FIELD_NAME=sc,ac.COLLAPSED_INPUT_NAME=ic;var lc=class extends Error{constructor(e){super("Tried to append an icon of type ".concat(e.getType()," when an icon of that type already exists on the block. Use getIcon to access the existing icon.")),this.icon=e}},cc={};cc.DuplicateIconType=lc;var uc={};uc.clamp=sn,uc.toDegrees=rn,uc.toRadians=on;var hc,dc,pc,fc=16,gc=1,mc=12,bc=16,_c=.25,Tc=null,vc=null,yc="",Ec="",Ic=null,Sc=null,wc=null,Cc={getBoundsInfo:function(){const e=Ke(Ic),t=je(Ic);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,n,o){const r=Cc.getBoundsInfo(),i=je(hc);return t+i.heightr.top?vn(n,o,r,i):t+i.heightdocument.documentElement.clientTop?vn(n,o,r,i):yn(e,r,i)}},kc={};kc.ANIMATION_TIME=_c,kc.ARROW_HORIZONTAL_PADDING=mc,kc.ARROW_SIZE=fc,kc.BORDER_SIZE=gc,kc.PADDING_Y=bc,kc.TEST_ONLY=Cc,kc.clearContent=hn,kc.createDom=an,kc.getContentDiv=un,kc.getOwner=cn,kc.getPositionX=En,kc.hide=wn,kc.hideIfOwner=Sn,kc.hideWithoutAnimation=Cn,kc.isVisible=In,kc.repositionForWindowResize=$n,kc.setBoundsElement=ln,kc.setColour=dn,kc.show=_n,kc.showPositionedByBlock=pn,kc.showPositionedByField=fn;var $c=class{constructor(e){this.workspace=e,this.cursorSvg_=this.cursor_=null,this.markers=new Map,this.markerSvg_=null}registerMarker(e,t){this.markers.has(e)&&this.unregisterMarker(e),t.setDrawer(this.workspace.getRenderer().makeMarkerDrawer(this.workspace,t)),this.setMarkerSvg(t.getDrawer().createDom()),this.markers.set(e,t)}unregisterMarker(e){const t=this.markers.get(e);if(!t)throw Error("Marker with ID "+e+" does not exist. Can only unregister markers that exist.");t.dispose(),this.markers.delete(e)}getCursor(){return this.cursor_}getMarker(e){return this.markers.get(e)||null}setCursor(e){this.cursor_&&this.cursor_.getDrawer()&&this.cursor_.getDrawer().dispose(),(this.cursor_=e)&&(e=this.workspace.getRenderer().makeMarkerDrawer(this.workspace,this.cursor_),this.cursor_.setDrawer(e),this.setCursorSvg(this.cursor_.getDrawer().createDom()))}setCursorSvg(e){e?(this.workspace.getBlockCanvas().appendChild(e),this.cursorSvg_=e):this.cursorSvg_=null}setMarkerSvg(e){e?this.workspace.getBlockCanvas()&&(this.cursorSvg_?this.workspace.getBlockCanvas().insertBefore(e,this.cursorSvg_):this.workspace.getBlockCanvas().appendChild(e)):this.markerSvg_=null}updateMarkers(){this.workspace.keyboardAccessibilityMode&&this.cursorSvg_&&this.workspace.getCursor().draw()}dispose(){const e=Object.keys(this.markers);for(let t,n=0;t=e[n];n++)this.unregisterMarker(t);this.markers.clear(),this.cursor_&&(this.cursor_.dispose(),this.cursor_=null)}};$c.LOCAL_MARKER="local_marker_1";var Ac={};Ac.commonWordPrefix=Rn,Ac.commonWordSuffix=xn,Ac.isNumber=ys.isNumber$$module$build$src$core$utils$string,Ac.shortestStringLength=On,Ac.startsWith=An,Ac.wrap=ys.wrap$$module$build$src$core$utils$string;var Oc=void 0,Rc=!1,xc=!1,Lc=50,Nc=0,Mc=0,Dc=0,Pc=0,Bc=null,Fc=null,Uc=0,Hc=10,Gc=10,Vc=750,Wc=5,jc=null,zc={};zc.HOVER_MS=Vc,zc.LIMIT=Lc,zc.MARGINS=Wc,zc.OFFSET_X=Uc,zc.OFFSET_Y=Hc,zc.RADIUS_OK=Gc,zc.bindMouseEvents=Wn,zc.block=qn,zc.createDom=Vn,zc.dispose=Kn,zc.getCustomTooltip=Bn,zc.getDiv=Un,zc.getTooltipOfObject=Hn,zc.hide=Jn,zc.isVisible=Fn,zc.setCustomTooltip=Pn,zc.unbindMouseEvents=jn,zc.unblock=Zn;var Xc=.45,Yc=.65,Kc={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"},Jc={};Jc.blend=ho,Jc.getHsvSaturation=oo,Jc.getHsvValue=io,Jc.hexToRgb=co,Jc.hsvToHex=uo,Jc.hueToHex=po,Jc.names=Kc,Jc.parse=ao,Jc.rgbToHex=lo,Jc.setHsvSaturation=ro,Jc.setHsvValue=so;var qc={};qc.checkMessageReferences=bo,qc.parseBlockColour=_o,qc.replaceMessageReferences=mo,qc.tokenizeInterpolation=go;var Zc,Qc=null,eu=null,tu="",nu="",ou={};ou.createDom=yo,ou.getDiv=To,ou.hide=Io,ou.hideIfOwner=wo,ou.isVisible=So,ou.positionWithAnchor=ko,ou.repositionForWindowResize=Ro,ou.show=Eo,ou.testOnly_setDiv=vo;var ru=class{constructor(e,t,n){this.DEFAULT_VALUE=null,this.name=void 0,this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=this.tooltip_=this.validator_=null,this.disposed=!1,this.maxDisplayLength=50,this.sourceBlock_=null,this.enabled_=this.visible_=this.isDirty_=!0,this.suffixField=this.prefixField=this.clickTarget_=null,this.EDITABLE=!0,this.SERIALIZABLE=!1,this.CURSOR="",this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE,this.size_=new Da(0,0),e!==ru.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(mo(e.tooltip))}setSourceBlock(e){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=e}getConstants(){return!this.constants_&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_}getSourceBlock(){return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=j(Ll.G,{}),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())}initView(){this.createBorderRect_(),this.createTextElement_()}initModel(){}createBorderRect_(){this.borderRect_=j(Ll.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_=j(Ll.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)}bindEvents_(){const e=this.getClickTarget_();if(!e)throw Error("A click target has not been set.");Wn(e),this.mouseDownWrapper_=De(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(ru))?e:this.getValue()}loadState(e){this.loadLegacyState(ru,e)||this.setValue(e)}saveLegacyState(e){return e.prototype.saveState===this.saveState&&e.prototype.toXml!==this.toXml?((e=ys.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name",this.name||""),G(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(ys.textToDom$$module$build$src$core$utils$xml(t)),!0)}dispose(){let e;Sn(this),wo(this),null!=(e=this.getSourceBlock())&&e.isDeadOrDying()||J(this.fieldGroup_),this.disposed=!0}updateEditable(){const e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(z(e,"blocklyEditableText"),Y(e,"blocklyNonEditableText"),e.style.cursor=this.CURSOR):(z(e,"blocklyNonEditableText"),Y(e,"blocklyEditableText"),e.style.cursor=""))}setEnabled(e){this.enabled_=e,this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==ru.prototype.showEditor_}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 ".concat(this.borderRect_,"."));return this.borderRect_}getTextElement(){if(!this.textElement_)throw Error("The text element is ".concat(this.textElement_,"."));return this.textElement_}getTextContent(){if(!this.textContent_)throw Error("The text content is ".concat(this.textContent_,"."));return this.textContent_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()}showEditor(e){this.isClickable()&&this.showEditor_(e)}showEditor_(e){}repositionForWindowResize(){return!1}updateSize_(e){const t=this.getConstants();let n=2*(e=void 0!==e?e:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0),o=t.FIELD_TEXT_HEIGHT,r=0;this.textElement_&&(r=oe(this.textElement_,t.FIELD_TEXT_FONTSIZE,t.FIELD_TEXT_FONTWEIGHT,t.FIELD_TEXT_FONTFAMILY),n+=r),this.borderRect_&&(o=Math.max(o,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=o,this.size_.width=n,this.positionTextElement_(e,r),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var n,o=this.getConstants(),r=this.size_.height/2;this.textElement_.setAttribute("x",String(null!=(n=this.getSourceBlock())&&n.RTL?this.size_.width-t-e:e)),this.textElement_.setAttribute("y",String(o.FIELD_TEXT_BASELINE_CENTER?r:r-o.FIELD_TEXT_HEIGHT/2+o.FIELD_TEXT_BASELINE))}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",String(this.size_.width)),this.borderRect_.setAttribute("height",String(this.size_.height)),this.borderRect_.setAttribute("rx",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)),this.borderRect_.setAttribute("ry",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)))}getSize(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0===this.size_.width&&(this.render_(),0!==this.size_.width&&console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead.")),this.size_):new Da(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new iu;if(this.borderRect_){var n=this.borderRect_.getBoundingClientRect();e=Ke(this.borderRect_),t=n.width,n=n.height}else{n=this.sourceBlock_.getHeightWidth();const o=t.workspace.scale;e=this.getAbsoluteXY_(),t=(n.width+1)*o,n=(n.height+1)*o,Tl?(e.x+=1.5*o,e.y+=1.5*o):(e.x-=.5*o,e.y-=.5*o)}return new xl(e.y,e.y+n,e.x,e.x+t)}getDisplayText_(){let e=this.getText();return e?(e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"\u2026"),e=e.replace(/\s/g,ru.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+="\u200f"),e):ru.NBSP}getText(){const e=this.getText_();return String(null!==e?e:this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0,this.constants_=null}forceRerender(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.queueRender(),this.sourceBlock_.bumpNeighbours())}setValue(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(null!==e){var n,o=this.doClassValidation_(e);(e=this.processValidation_(e,o))instanceof Error||(o=null==(n=this.getValidator())?void 0:n.call(this,e),(n=this.processValidation_(e,o))instanceof Error||(e=this.sourceBlock_)&&e.disposed||((o=this.getValue())===n?this.doValueUpdate_(n):(this.doValueUpdate_(n),t&&e&&N()&&A(new(B(ys.CHANGE$$module$build$src$core$events$utils))(e,"field",this.name||null,o,n)),this.isDirty_&&this.forceRerender())))}}processValidation_(e,t){return null===t?(this.doValueInvalid_(e),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){}onMouseDown_(e){this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&(e=this.sourceBlock_.workspace.getGesture(e))&&e.setStartField(this)}setTooltip(e){e||""===e||(e=this.sourceBlock_);const t=this.getClickTarget_();t?t.tooltip=e:this.tooltip_=e}getTooltip(){const e=this.getClickTarget_();return Hn(e||{tooltip:this.tooltip_})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return Ke(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null;const t=this.getSourceBlock();if(!t)throw new iu;const n=t.inputList;for(let o=0;oe?this.menuItems.length:e,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(e,t){let n;for(e+=t;n=this.menuItems[e];){if(n.isEnabled()){this.setHighlighted(n);break}e+=t}}handleMouseOver(e){(e=this.getMenuItem(e.target))&&(e.isEnabled()?this.highlightedItem!==e&&this.setHighlighted(e):this.setHighlighted(null))}handleClick(e){const t=this.openingCoords;if(this.openingCoords=null,t&&"number"==typeof e.clientX){const n=new qa(e.clientX,e.clientY);if(1>qa.distance(t,n))return}(e=this.getMenuItem(e.target))&&e.performAction()}handleMouseEnter(e){this.focus()}handleMouseLeave(e){this.getElement()&&(this.blur(),this.setHighlighted(null))}handleKeyEvent(e){if(this.menuItems.length&&!(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){var t=this.highlightedItem;switch(e.key){case"Enter":case" ":t&&t.performAction();break;case"ArrowUp":this.highlightPrevious();break;case"ArrowDown":this.highlightNext();break;case"PageUp":case"Home":this.highlightFirst();break;case"PageDown":case"End":this.highlightLast();break;default:return}e.preventDefault(),e.stopPropagation()}}getSize(){const e=this.getElement(),t=je(e);return t.height=e.scrollHeight,t}},gu=class{constructor(e,t){this.content=e,this.opt_value=t,this.enabled=!0,this.element=null,this.rightToLeft=!1,this.roleName=null,this.highlight=this.checked=this.checkable=!1,this.actionHandler=null}createDom(){const e=document.createElement("div");e.id=w(),this.element=e,e.className="blocklyMenuItem goog-menuitem "+(this.enabled?"":"blocklyMenuItemDisabled goog-menuitem-disabled ")+(this.checked?"blocklyMenuItemSelected goog-option-selected ":"")+(this.highlight?"blocklyMenuItemHighlight goog-menuitem-highlight ":"")+(this.rightToLeft?"blocklyMenuItemRtl goog-menuitem-rtl ":"");const t=document.createElement("div");if(t.className="blocklyMenuItemContent goog-menuitem-content",this.checkable){var n=document.createElement("div");n.className="blocklyMenuItemCheckbox goog-menuitem-checkbox",t.appendChild(n)}return n=this.content,"string"==typeof this.content&&(n=document.createTextNode(this.content)),t.appendChild(n),e.appendChild(t),this.roleName&&Mo(e,this.roleName),Do(e,uu.SELECTED,this.checkable&&this.checked||!1),Do(e,uu.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;const t=this.getElement();t&&this.isEnabled()&&(e?(z(t,"blocklyMenuItemHighlight"),z(t,"goog-menuitem-highlight")):(Y(t,"blocklyMenuItemHighlight"),Y(t,"goog-menuitem-highlight")))}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}performAction(){this.isEnabled()&&this.actionHandler&&this.actionHandler(this)}onAction(e,t){this.actionHandler=e.bind(t)}},mu=class extends ru{constructor(e,t,n){super(ru.SKIP_SETUP),this.svgArrow=this.arrow=this.imageElement=this.menu_=this.selectedMenuItem=null,this.SERIALIZABLE=!0,this.CURSOR="default",this.clickTarget_=this.suffixField=this.prefixField=this.generatedOptions=null,e!==ru.SKIP_SETUP&&(Array.isArray(e)?(Fo(e),e=Po(e),this.menuGenerator_=e.options,this.prefixField=e.prefix||null,this.suffixField=e.suffix||null):this.menuGenerator_=e,this.selectedOption=this.getOptions(!1)[0],n&&this.configure_(n),this.setValue(this.selectedOption[1]),t&&this.setValidator(t))}fromXml(e){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e.textContent)}loadState(e){this.loadLegacyState(mu,e)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement=j(Ll.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&z(this.borderRect_,"blocklyDropdownRect")}shouldAddBorderRect_(){let e;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!(null!=(e=this.getSourceBlock())&&e.isShadow())}createTextArrow_(){let e,t;this.arrow=j(Ll.TSPAN,{},this.textElement_),this.arrow.appendChild(document.createTextNode(null!=(e=this.getSourceBlock())&&e.RTL?mu.ARROW_CHAR+" ":" "+mu.ARROW_CHAR)),null!=(t=this.getSourceBlock())&&t.RTL?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=j(Ll.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow.setAttributeNS(Aa,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(e){var t=this.getSourceBlock();if(!t)throw new iu;this.dropdownCreate(),this.menu_.openingCoords=e&&"number"==typeof e.clientX?new qa(e.clientX,e.clientY):null,hn(),e=this.menu_.render(un()),z(e,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(e=t.isShadow()?t.getParent().getColour():t.getColour(),t=t.isShadow()?t.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary,dn(e,t)),fn(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem&&(this.menu_.setHighlighted(this.selectedMenuItem),Ze(this.selectedMenuItem.getElement(),un(),!0)),this.applyColour()}dropdownCreate(){const e=this.getSourceBlock();if(!e)throw new iu;const t=new fu;t.setRole(cu.LISTBOX),this.menu_=t;const n=this.getOptions(!1);this.selectedMenuItem=null;for(let r=0;rt[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,n=0;t=e[n];n++)t[1]===this.value_&&(this.selectedOption=t)}applyColour(){const e=this.sourceBlock_.style;this.borderRect_&&(this.borderRect_.setAttribute("stroke",e.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",e.colourTertiary):this.borderRect_.setAttribute("fill","transparent")),this.sourceBlock_&&this.arrow&&(this.sourceBlock_.isShadow()?this.arrow.style.fill=e.colourSecondary:this.arrow.style.fill=e.colourPrimary)}render_(){this.getTextContent().nodeValue="",this.imageElement.style.display="none";const e=this.selectedOption&&this.selectedOption[0];e&&"object"==typeof e?this.renderSelectedImage(e):this.renderSelectedText(),this.positionBorderRect_()}renderSelectedImage(e){const t=this.getSourceBlock();if(!t)throw new iu;this.imageElement.style.display="",this.imageElement.setAttributeNS(Aa,"xlink:href",e.src),this.imageElement.setAttribute("height",String(e.height)),this.imageElement.setAttribute("width",String(e.width));const n=Number(e.height);e=Number(e.width);var o=!!this.borderRect_;const r=Math.max(o?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,n+bu);let i;o=o?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,i=this.svgArrow?this.positionSVGArrow(e+o,r/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):oe(this.arrow,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY),this.size_.width=e+i+2*o,this.size_.height=r;let s=0;t.RTL?this.imageElement.setAttribute("x","".concat(o+i)):(s=e+i,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x","".concat(o))),this.imageElement.setAttribute("y",String(r/2-n/2)),this.positionTextElement_(s+o,e+i)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();z(e,"blocklyDropdownText"),e.setAttribute("text-anchor","start");var t=!!this.borderRect_;e=Math.max(t?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);const n=oe(this.getTextElement(),this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);t=t?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let o=0;this.svgArrow&&(o=this.positionSVGArrow(n+t,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_.width=n+o+2*t,this.size_.height=e,this.positionTextElement_(t,n)}positionSVGArrow(e,t){if(!this.svgArrow)return 0;const n=this.getSourceBlock();if(!n)throw new iu;const o=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,r=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,i=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(n.RTL?o:e+r)+","+t+")"),i+r}getText_(){if(!this.selectedOption)return null;const e=this.selectedOption[0];return"object"==typeof e?e.alt:e}static fromJson(e){if(!e.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");return new this(e.options,void 0,e)}};mu.CHECKMARK_OVERHANG=25,mu.MAX_MENU_HEIGHT_VH=.45,mu.ARROW_CHAR="\u25be";var bu=10;xo("field_dropdown",mu);var _u=class{constructor(e){this.sourceBlock=e,this.offsetInBlock=new qa(0,0),this.workspaceLocation=new qa(0,0),this.svgRoot=null}getType(){throw Error("Icons must implement getType")}initView(e){if(!this.svgRoot){var t=this.sourceBlock;this.svgRoot=j(Ll.G,{class:"blocklyIconGroup"}),t.getSvgRoot().appendChild(this.svgRoot),this.updateSvgRootOffset(),De(this.svgRoot,"pointerdown",this,e)}}dispose(){J(this.svgRoot)}getWeight(){return-1}getSize(){return new Da(0,0)}applyColour(){}updateEditable(){}updateCollapsed(){this.svgRoot&&(this.sourceBlock.isCollapsed()?this.svgRoot.style.display="none":this.svgRoot.style.display="block",Qt(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(".concat(this.offsetInBlock.x,", ").concat(this.offsetInBlock.y,")"))}onLocationChange(e){this.workspaceLocation=qa.sum(e,this.offsetInBlock)}onClick(){}setVisible(e){W("setVisible","v10","v11","setBubbleVisible"),Qt(this)&&this.setBubbleVisible(e)}},Tu=class{constructor(e,t,n,o,r){this.workspace=e,this.horizontal=t,this.oldHostMetrics=null,this.ratio=1,this.origin=new qa(0,0),this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0,this.containerVisible=this.isHandleVisible=!0,this.position=new qa(0,0),this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null,this.pair=n||!1,this.margin=void 0!==r?r:Tu.DEFAULT_SCROLLBAR_MARGIN,e="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical"),o&&(e+=" "+o),this.outerSvg=j(Ll.SVG,{class:e}),o=j(Ll.G,{},this.outerSvg),this.svgBackground=j(Ll.RECT,{class:"blocklyScrollbarBackground"},o),e=Math.floor((Tu.scrollbarThickness-5)/2),this.svgHandle=j(Ll.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"),q(this.outerSvg,this.workspace.getParentSvg()),this.setInitialThickness(),t?(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=De(this.svgBackground,"pointerdown",this,this.onMouseDownBar),this.onMouseDownHandleWrapper_=De(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){const e=Tu.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(),Be(this.onMouseDownBarWrapper_),Be(this.onMouseDownHandleWrapper_),J(this.outerSvg),this.workspace.getThemeManager().unsubscribe(this.svgHandle)}constrainHandleLength(e){return 0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength)}setHandleLength(e){this.handleLength=e,this.svgHandle.setAttribute(this.lengthAttribute_,String(this.handleLength))}constrainHandlePosition(e){return 0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength-this.handleLength)}setHandlePosition(e){this.handlePosition=e,this.svgHandle.setAttribute(this.positionAttribute_,String(this.handlePosition))}setScrollbarLength(e){this.scrollbarLength=e,this.outerSvg.setAttribute(this.lengthAttribute_,String(this.scrollbarLength)),this.svgBackground.setAttribute(this.lengthAttribute_,String(this.scrollbarLength))}setPosition(e,t){this.position.x=e,this.position.y=t,Q(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&&Tu.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-=Tu.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&(t+=Tu.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-Tu.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 n=this.scrollbarLength-this.handleLength;e=(e.viewLeft-e.scrollLeft)/t*n,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=n/t}}resizeVertical(e){this.requiresViewResize(e)?this.resizeViewVertical(e):this.resizeContentVertical(e)}resizeViewVertical(e){let t=e.viewHeight-2*this.margin;this.pair&&(t-=Tu.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-Tu.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 n=this.scrollbarLength-this.handleLength;e=(e.viewTop-e.scrollTop)/t*n,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=n/t}}isVisible(){return this.isHandleVisible}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay_()}setVisible(e){const t=e!==this.isVisible();if(this.pair)throw Error("Unable to toggle visibility of paired scrollbars.");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(),xe(),this.cleanUp(),Ue(e))e.stopPropagation();else{var t=He(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var n=tt(this.svgHandle);n=this.horizontal?n.x:n.y;var o=this.handlePosition,r=.95*this.handleLength;t<=n?o-=r:t>=n+this.handleLength&&(o+=r),this.setHandlePosition(this.constrainHandlePosition(o)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),Ue(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=De(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=De(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(){xe(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&(Be(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onMouseMoveWrapper_&&(Be(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){let e=this.handlePosition/(this.scrollbarLength-this.handleLength);return isNaN(e)&&(e=0),e}updateMetrics(){const e=this.getRatio_();this.horizontal?this.workspace.setMetrics({x:e}):this.workspace.setMetrics({y:e})}set(e,t){this.setHandlePosition(this.constrainHandlePosition(e*this.ratio)),(t||void 0===t)&&this.updateMetrics()}setOrigin(e,t){this.origin=new qa(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}};Tu.scrollbarThickness=dl?25:15,Tu.DEFAULT_SCROLLBAR_MARGIN=.5;var vu,yu=class{constructor(e,t,n){this.workspace=e,this.anchor=t,this.ownerRect=n,this.size=new Da(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.svgRoot=j(Ll.G,{},e.getBubbleCanvas()),e=j(Ll.G,{filter:"url(#".concat(this.workspace.getRenderer().getConstants().embossFilterId,")")},this.svgRoot),this.tail=j(Ll.PATH,{},e),this.background=j(Ll.RECT,{class:"blocklyDraggable",x:0,y:0,rx:yu.BORDER_WIDTH,ry:yu.BORDER_WIDTH},e),this.contentContainer=j(Ll.G,{},this.svgRoot),De(this.background,"pointerdown",this,this.onMouseDown)}dispose(){J(this.svgRoot),this.disposed=!0}setAnchorLocation(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.width=Math.max(e.width,yu.MIN_SIZE),e.height=Math.max(e.height,yu.MIN_SIZE),this.size=e,this.background.setAttribute("width","".concat(e.width)),this.background.setAttribute("height","".concat(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)}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(".concat(e,", ").concat(t,")"))}positionByRect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new xl(0,0,0,0);var t=this.workspace.getMetricsManager().getViewMetrics(!0),n=this.getOptimalRelativeLeft(t),o=this.getOptimalRelativeTop(t);const r={x:n,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},i={x:-this.size.width-30,y:o};o={x:e.getWidth(),y:o};var s={x:n,y:e.getHeight()};n=e.getWidth()e.width)return t;if(e=this.getWorkspaceViewRect(e),this.workspace.RTL){var n=this.anchor.x-t;n-this.size.widthe.right&&(t=-(e.right-this.anchor.x))}else{const o=(n=t+this.anchor.x)+this.size.width;ne.right&&(t=e.right-this.anchor.x-this.size.width)}return t}getOptimalRelativeTop(e){let t=-this.size.height/4;if(this.size.height>e.height)return t;const n=this.anchor.y+t,o=n+this.size.height;return n<(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){const t=e.top;let n=e.top+e.height,o=e.left;return e=e.left+e.width,n-=this.getScrollbarThickness(),this.workspace.RTL?o-=this.getScrollbarThickness():e-=this.getScrollbarThickness(),new xl(t,n,o,e)}getScrollbarThickness(){return Tu.scrollbarThickness/this.workspace.scale}renderTail(){const e=[];var t=this.size.width/2,n=this.size.height/2,o=-this.relativeLeft,r=-this.relativeTop;if(t===o&&n===r)e.push("M "+t+","+n);else{r-=n,o-=t,this.workspace.RTL&&(o*=-1);var i=Math.sqrt(r*r+o*o),s=Math.acos(o/i);0>r&&(s=2*Math.PI-s);var a=s+Math.PI/2;a>2*Math.PI&&(a-=2*Math.PI);var l=Math.sin(a);const c=Math.cos(a);let u=(this.size.width+this.size.height)/yu.TAIL_THICKNESS;u=Math.min(u,this.size.width,this.size.height)/4,o=t+(a=1-yu.ANCHOR_RADIUS/i)*o,r=n+a*r,a=t+u*c;const h=n+u*l;t-=u*c,n-=u*l,(l=s+(l=on(this.workspace.RTL?-yu.TAIL_ANGLE:yu.TAIL_ANGLE)))>2*Math.PI&&(l-=2*Math.PI),s=Math.sin(l)*i/yu.TAIL_BEND,i=Math.cos(l)*i/yu.TAIL_BEND,e.push("M"+a+","+h),e.push("C"+(a+i)+","+(h+s)+" "+o+","+r+" "+o+","+r),e.push("C"+o+","+r+" "+(t+i)+","+(n+s)+" "+t+","+n)}let c;e.push("z"),null==(c=this.tail)||c.setAttribute("d",e.join(" "))}bringToFront(){let e;const 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 qa(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){}};vu=yu,yu.BORDER_WIDTH=6,yu.DOUBLE_BORDER=2*vu.BORDER_WIDTH,yu.MIN_SIZE=vu.DOUBLE_BORDER,yu.TAIL_THICKNESS=1,yu.TAIL_ANGLE=20,yu.TAIL_BEND=4,yu.ANCHOR_RADIUS=8;var Eu={};Eu.deepMerge=Uo;var Iu,Su=class{constructor(t,n,o,r){this.name=t,this.startHats=!1,this.blockStyles=n||Object.create(null),this.categoryStyles=o||Object.create(null),this.componentStyles=r||Object.create(null),this.fontStyle=Object.create(null),e(As.THEME,t,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){const t=this.getComponentStyle(e);if(t)return t}return"".concat(e)}setComponentStyle(e,t){this.componentStyles[e]=t}setFontStyle(e){this.fontStyle=e}setStartHats(e){this.startHats=e}static defineTheme(e,t){e=e.toLowerCase();const n=new Su(e);let o=t.base;if(o){if("string"==typeof o){let e;o=null!=(e=a(As.THEME,o))?e:void 0}o instanceof Su&&(Uo(n,o),n.name=e)}return Uo(n.blockStyles,t.blockStyles),Uo(n.categoryStyles,t.categoryStyles),Uo(n.componentStyles,t.componentStyles),Uo(n.fontStyle,t.fontStyle),null!==t.startHats&&(n.startHats=t.startHats),n}},wu=new Su("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"}}),Cu="categoryToolbox",ku="flyoutToolbox";!function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"}(Iu||(Iu={}));var $u={hasCategoriesInternal:jo},Au={};Au.Position=Iu,Au.TEST_ONLY=$u,Au.convertFlyoutDefToJsonArray=Vo,Au.convertToolboxDefToJson=Ho,Au.hasCategories=Wo,Au.isCategoryCollapsible=zo,Au.parseToolboxTree=Jo;var Ou=class{constructor(e){this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let t=null,n=!1;var o=!1,r=!1,i=!1,s=!1,a=!1;const l=!!e.readOnly;var c;l||(t=Ho(null!=(c=e.toolbox)?c:null),n=Wo(t),o=void 0===(o=e.trashcan)?n:o,r=void 0===(r=e.collapse)?n:r,i=void 0===(i=e.comments)?n:i,s=void 0===(s=e.disable)?n:s,a=void 0===(a=e.sounds)||a),c=e.maxTrashcanContents,o?void 0===c&&(c=32):c=0;const u=!!e.rtl;let h=e.horizontalLayout;void 0===h&&(h=!1);var d="end"!==e.toolboxPosition;d=h?d?Iu.TOP:Iu.BOTTOM:d===u?Iu.RIGHT:Iu.LEFT;let p=e.css;void 0===p&&(p=!0);let f="https://blockly-demo.appspot.com/static/media/";e.media?f=e.media.endsWith("/")?e.media:e.media+"/":"path"in e&&(W("path","Nov 2014","Jul 2023","media"),f=e.path+"media/");const g=e.oneBasedIndex,m=e.renderer||"geras",b=e.plugins||{};let _,T,v,y=e.modalInputs;void 0===y&&(y=!0),this.RTL=u,this.oneBasedIndex=void 0===g||g,this.collapse=r,this.comments=i,this.disable=s,this.readOnly=l,this.maxBlocks=e.maxBlocks||1/0,this.maxInstances=null!=(_=e.maxInstances)?_:null,this.modalInputs=y,this.pathToMedia=f,this.hasCategories=n,this.moveOptions=Ou.parseMoveOptions_(e,n),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=o,this.maxTrashcanContents=c,this.hasSounds=a,this.hasCss=p,this.horizontalLayout=h,this.languageTree=t,this.gridOptions=Ou.parseGridOptions_(e),this.zoomOptions=Ou.parseZoomOptions_(e),this.toolboxPosition=d,this.theme=Ou.parseThemeOptions_(e),this.renderer=m,this.rendererOverrides=null!=(T=e.rendererOverrides)?T:null,this.parentWorkspace=null!=(v=e.parentWorkspace)?v:null,this.plugins=b}static parseMoveOptions_(e,t){const n=e.move||{},o={};return void 0===n.scrollbars&&void 0===e.scrollbars?o.scrollbars=t:"object"==typeof n.scrollbars?(o.scrollbars={horizontal:!!n.scrollbars.horizontal,vertical:!!n.scrollbars.vertical},o.scrollbars.horizontal&&o.scrollbars.vertical?o.scrollbars=!0:o.scrollbars.horizontal||o.scrollbars.vertical||(o.scrollbars=!1)):o.scrollbars=!!n.scrollbars||!!e.scrollbars,o.wheel=o.scrollbars&&void 0!==n.wheel?!!n.wheel:"object"==typeof o.scrollbars,o.drag=!(!o.scrollbars||void 0!==n.drag&&!n.drag),o}static parseZoomOptions_(e){e=e.zoom||{};const 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||{};const 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=0t.y&&e.moveBy(0,20-t.y),e.RTL){let n=-20;const o=this.miniWorkspace.getFlyout();o&&(n-=o.getWidth()),t.x>n&&e.moveBy(n-t.x,0)}else 20>t.x&&e.moveBy(20-t.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()){var e=this.getSize(),t=this.calculateWorkspaceSize();Math.abs(e.width-t.width)({kind:"block",type:e})))}),t}getAnchorLocation(){return qa.sum(this.workspaceLocation,new qa(8.5,8.5))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new xl(e.y,e.y+e.height,e.x,e.x+e.width)}createRootBlock(){for(var e of(this.rootBlock=this.sourceBlock.decompose(this.miniWorkspaceBubble.getWorkspace()),this.rootBlock.getDescendants(!1)))e.queueRender();let t,n,o,r;this.rootBlock.setMovable(!1),this.rootBlock.setDeletable(!1),e=null!=(r=null==(t=this.miniWorkspaceBubble)||null==(n=t.getWorkspace())||null==(o=n.getFlyout())?void 0:o.getWidth())?r:0,this.rootBlock.moveBy(this.rootBlock.RTL?-(e+16):16,16)}addSaveConnectionsListener(){if(this.sourceBlock.saveConnections&&this.rootBlock){var e=()=>{this.sourceBlock.saveConnections&&this.rootBlock&&this.sourceBlock.saveConnections(this.rootBlock)};e(),this.sourceBlock.workspace.addChangeListener(e)}}createMiniWorkspaceChangeListener(){return e=>{ys.MutatorIcon$$module$build$src$core$icons$mutator_icon.isIgnorableMutatorEvent(e)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout((()=>{this.updateWorkspacePid=null,this.recomposeSourceBlock()}),0))}}static isIgnorableMutatorEvent(e){return e.isUiEvent||e.type===ys.CREATE$$module$build$src$core$events$utils||e.type===ys.CHANGE$$module$build$src$core$events$utils&&"disabled"===e.element}recomposeSourceBlock(){if(this.rootBlock){var e=ys.getGroup$$module$build$src$core$events$utils();e||ys.setGroup$$module$build$src$core$events$utils(!0);var t=tc.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var n=tc.getExtraBlockState_(this.sourceBlock);t!==n&&A(new(B(ys.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock,"mutation",null,t,n)),ys.setGroup$$module$build$src$core$events$utils(e)}}getWorkspace(){let e;return null==(e=this.miniWorkspaceBubble)?void 0:e.getWorkspace()}static reconnect(e,t,n){return W("MutatorIcon.reconnect","v10","v11","connection.reconnect"),!!e&&e.reconnect(t,n)}static findParentWs(e){return W("MutatorIcon.findParentWs","v10","v11","workspace.getRootWorkspace"),e.getRootWorkspace()}},ys.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE=Sa.MUTATOR,ys.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1,ys.MutatorIcon$$module$build$src$core$icons$mutator_icon;var xu=Object.create(null),Lu={allExtensions:xu};ys.register$$module$build$src$core$extensions("parent_tooltip_when_inline",ur);var Nu={};Nu.TEST_ONLY=Lu,Nu.apply=Qo,Nu.buildTooltipForDropdown=ys.buildTooltipForDropdown$$module$build$src$core$extensions,Nu.buildTooltipWithFieldText=ys.buildTooltipWithFieldText$$module$build$src$core$extensions,Nu.isRegistered=Zo,Nu.register=ys.register$$module$build$src$core$extensions,Nu.registerMixin=ys.registerMixin$$module$build$src$core$extensions,Nu.registerMutator=ys.registerMutator$$module$build$src$core$extensions,Nu.runAfterPageLoad=lr,Nu.unregister=qo,function(e){e[e.LEFT=-1]="LEFT",e[e.CENTRE=0]="CENTRE",e[e.RIGHT=1]="RIGHT"}(ys.Align$$module$build$src$core$inputs$align||(ys.Align$$module$build$src$core$inputs$align={})),ys.Align$$module$build$src$core$inputs$align;var Mu,Du={};Du.removeElem=hr,function(e){e[e.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX",e[e.MAC_ENTER=3]="MAC_ENTER",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.NUM_CENTER=12]="NUM_CENTER",e[e.ENTER=13]="ENTER",e[e.SHIFT=16]="SHIFT",e[e.CTRL=17]="CTRL",e[e.ALT=18]="ALT",e[e.PAUSE=19]="PAUSE",e[e.CAPS_LOCK=20]="CAPS_LOCK",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.PAGE_UP=33]="PAGE_UP",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.END=35]="END",e[e.HOME=36]="HOME",e[e.LEFT=37]="LEFT",e[e.UP=38]="UP",e[e.RIGHT=39]="RIGHT",e[e.DOWN=40]="DOWN",e[e.PLUS_SIGN=43]="PLUS_SIGN",e[e.PRINT_SCREEN=44]="PRINT_SCREEN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.ZERO=48]="ZERO",e[e.ONE=49]="ONE",e[e.TWO=50]="TWO",e[e.THREE=51]="THREE",e[e.FOUR=52]="FOUR",e[e.FIVE=53]="FIVE",e[e.SIX=54]="SIX",e[e.SEVEN=55]="SEVEN",e[e.EIGHT=56]="EIGHT",e[e.NINE=57]="NINE",e[e.FF_SEMICOLON=59]="FF_SEMICOLON",e[e.FF_EQUALS=61]="FF_EQUALS",e[e.FF_DASH=173]="FF_DASH",e[e.FF_HASH=163]="FF_HASH",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.AT_SIGN=64]="AT_SIGN",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.META=91]="META",e[e.WIN_KEY_RIGHT=92]="WIN_KEY_RIGHT",e[e.CONTEXT_MENU=93]="CONTEXT_MENU",e[e.NUM_ZERO=96]="NUM_ZERO",e[e.NUM_ONE=97]="NUM_ONE",e[e.NUM_TWO=98]="NUM_TWO",e[e.NUM_THREE=99]="NUM_THREE",e[e.NUM_FOUR=100]="NUM_FOUR",e[e.NUM_FIVE=101]="NUM_FIVE",e[e.NUM_SIX=102]="NUM_SIX",e[e.NUM_SEVEN=103]="NUM_SEVEN",e[e.NUM_EIGHT=104]="NUM_EIGHT",e[e.NUM_NINE=105]="NUM_NINE",e[e.NUM_MULTIPLY=106]="NUM_MULTIPLY",e[e.NUM_PLUS=107]="NUM_PLUS",e[e.NUM_MINUS=109]="NUM_MINUS",e[e.NUM_PERIOD=110]="NUM_PERIOD",e[e.NUM_DIVISION=111]="NUM_DIVISION",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUMLOCK=144]="NUMLOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.FIRST_MEDIA_KEY=166]="FIRST_MEDIA_KEY",e[e.LAST_MEDIA_KEY=183]="LAST_MEDIA_KEY",e[e.SEMICOLON=186]="SEMICOLON",e[e.DASH=189]="DASH",e[e.EQUALS=187]="EQUALS",e[e.COMMA=188]="COMMA",e[e.PERIOD=190]="PERIOD",e[e.SLASH=191]="SLASH",e[e.APOSTROPHE=192]="APOSTROPHE",e[e.TILDE=192]="TILDE",e[e.SINGLE_QUOTE=222]="SINGLE_QUOTE",e[e.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET",e[e.BACKSLASH=220]="BACKSLASH",e[e.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET",e[e.WIN_KEY=224]="WIN_KEY",e[e.MAC_FF_META=224]="MAC_FF_META",e[e.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT",e[e.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT",e[e.WIN_IME=229]="WIN_IME",e[e.VK_NONAME=252]="VK_NONAME",e[e.PHANTOM=255]="PHANTOM"}(Mu||(Mu={}));var Pu={};Pu.arc=Tr,Pu.curve=pr,Pu.line=br,Pu.lineOnAxis=_r,Pu.lineTo=mr,Pu.moveBy=gr,Pu.moveTo=fr,Pu.point=dr;var Bu={};Bu.Coordinate=qa,Bu.KeyCodes=Mu,Bu.Rect=xl,Bu.Size=Da,Bu.Svg=Ll,Bu.aria=pu,Bu.array=Du,Bu.browserEvents=$l,Bu.colour=Jc,Bu.deprecation=wa,Bu.dom=La,Bu.extensions=Nu,Bu.idGenerator=ga,Bu.math=uc,Bu.object=Eu,Bu.parsing=qc,Bu.string=Ac,Bu.style=Ml,Bu.svgMath=Fl,Bu.svgPaths=Pu,Bu.toolbox=Au,Bu.userAgent=wl,Bu.xml=Ia;var Fu={};Fu.register=vr,Fu.unregister=yr;var Uu=class extends yu{constructor(e,t,n,o){super(t,n,o),this.text=e,this.workspace=t,this.anchor=n,this.ownerRect=o,this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}getText(){return this.text}setText(e){this.text=e,J(this.paragraph),this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}stringToSvg(e,t){return t=this.createParagraph(t),e=this.createSpans(t,e),this.workspace.RTL&&this.rightAlignSpans(t.getBBox().width,e),t}createParagraph(e){return j(Ll.TEXT,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:yu.BORDER_WIDTH},e)}createSpans(e,t){return t.split("\n").map((t=>{const n=j(Ll.TSPAN,{dy:"1em",x:yu.BORDER_WIDTH},e);return t=document.createTextNode(t),n.appendChild(t),n}))}rightAlignSpans(e,t){for(const n of t)n.setAttribute("text-anchor","end"),n.setAttribute("x","".concat(e+yu.BORDER_WIDTH))}updateBubbleSize(){const e=this.paragraph.getBBox();this.setSize(new Da(e.width+2*yu.BORDER_WIDTH,e.height+2*yu.BORDER_WIDTH),!0)}},Hu=class extends yu{constructor(e,t,n){super(e,t,n),this.workspace=e,this.anchor=t,this.ownerRect=n,this.resizePointerMoveListener=this.resizePointerUpListener=null,this.textChangeListeners=[],this.sizeChangeListeners=[],this.text="",this.DEFAULT_SIZE=new Da(160+yu.DOUBLE_BORDER,80+yu.DOUBLE_BORDER),this.MIN_SIZE=new Da(45+yu.DOUBLE_BORDER,20+yu.DOUBLE_BORDER),({inputRoot:this.inputRoot,textArea:this.textArea}=this.createEditor(this.contentContainer)),this.resizeGroup=this.createResizeHandle(this.svgRoot),this.setSize(this.DEFAULT_SIZE,!0)}getText(){return this.text}setText(e){this.text=e,this.textArea.value=e,this.onTextChange()}addTextChangeListener(e){this.textChangeListeners.push(e)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}createEditor(e){e=j(Ll.FOREIGNOBJECT,{x:yu.BORDER_WIDTH,y:yu.BORDER_WIDTH},e);const t=document.createElementNS($a,"body");t.setAttribute("xmlns",$a),t.className="blocklyMinimalBody";const n=document.createElementNS($a,"textarea");return n.className="blocklyCommentTextarea",n.setAttribute("dir",this.workspace.RTL?"RTL":"LTR"),t.appendChild(n),e.appendChild(t),this.bindTextAreaEvents(n),setTimeout((()=>{n.focus()}),0),{inputRoot:e,textArea:n}}bindTextAreaEvents(e){De(e,"wheel",this,(e=>{e.stopPropagation()})),De(e,"focus",this,this.onStartEdit,!0),De(e,"change",this,this.onTextChange)}createResizeHandle(e){e=j(Ll.G,{class:this.workspace.RTL?"blocklyResizeSW":"blocklyResizeSE"},e);const t=2*yu.BORDER_WIDTH;return j(Ll.POLYGON,{points:"0,".concat(t," ").concat(t,",").concat(t," ").concat(t,",0")},e),j(Ll.LINE,{class:"blocklyResizeLine",x1:t/3,y1:t-1,x2:t-1,y2:t/3},e),j(Ll.LINE,{class:"blocklyResizeLine",x1:2*t/3,y1:t-1,x2:t-1,y2:2*t/3},e),De(e,"pointerdown",this,this.onResizePointerDown),e}setSize(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.width=Math.max(e.width,this.MIN_SIZE.width),e.height=Math.max(e.height,this.MIN_SIZE.height);const n=e.width-yu.DOUBLE_BORDER,o=e.height-yu.DOUBLE_BORDER;this.inputRoot.setAttribute("width","".concat(n)),this.inputRoot.setAttribute("height","".concat(o)),this.textArea.style.width=n-4+"px",this.textArea.style.height=o-4+"px",this.workspace.RTL?this.resizeGroup.setAttribute("transform","translate(".concat(yu.DOUBLE_BORDER,", ").concat(o,") scale(-1 1)")):this.resizeGroup.setAttribute("transform","translate(".concat(n,", ").concat(o,")")),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}onResizePointerDown(e){this.bringToFront(),Ue(e)||(this.workspace.startDrag(e,new qa(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=De(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=De(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){xe(),this.resizePointerUpListener&&(Be(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(Be(this.resizePointerMoveListener),this.resizePointerMoveListener=null)}onResizePointerMove(e){e=this.workspace.moveDrag(e),this.setSize(new Da(this.workspace.RTL?-e.x:e.x,e.y),!1),this.onSizeChange()}onStartEdit(){this.bringToFront()&&this.textArea.focus()}onTextChange(){this.text=this.textArea.value;for(const e of this.textChangeListeners)e()}onSizeChange(){for(const e of this.sizeChangeListeners)e()}};Ve("\n.blocklyCommentTextarea {\n background-color: #fef49c;\n border: 0;\n display: block;\n margin: 0;\n outline: 0;\n padding: 3px;\n resize: none;\n text-overflow: hidden;\n}\n");var Gu=class extends _u{constructor(e){super(e),this.sourceBlock=e,this.textBubble=this.textInputBubble=null,this.text="",this.bubbleSize=new Da(160,80),this.bubbleVisiblity=!1}getType(){return Gu.TYPE}initView(e){this.svgRoot||(super.initView(e),j(Ll.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),j(Ll.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),j(Ll.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot))}dispose(){let e,t;super.dispose(),null==(e=this.textInputBubble)||e.dispose(),null==(t=this.textBubble)||t.dispose()}getWeight(){return Gu.WEIGHT}getSize(){return new Da(17,17)}applyColour(){super.applyColour();const e=this.sourceBlock.style.colourPrimary;let t,n;null==(t=this.textInputBubble)||t.setColour(e),null==(n=this.textBubble)||n.setColour(e)}updateEditable(){super.updateEditable(),this.bubbleIsVisible()&&(this.setBubbleVisible(!1),this.setBubbleVisible(!0))}onLocationChange(e){let t,n;super.onLocationChange(e),e=this.getAnchorLocation(),null==(t=this.textInputBubble)||t.setAnchorLocation(e),null==(n=this.textBubble)||n.setAnchorLocation(e)}setText(e){let t,n;this.text=e,null==(t=this.textInputBubble)||t.setText(this.text),null==(n=this.textBubble)||n.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}saveState(){return this.text?{text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width}:null}loadState(e){let t,n,o,r;this.text=null!=(t=e.text)?t:"",this.bubbleSize=new Da(null!=(n=e.width)?n:160,null!=(o=e.height)?o:80),this.bubbleVisiblity=null!=(r=e.pinned)&&r,setTimeout((()=>this.setBubbleVisible(this.bubbleVisiblity)),1)}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}onTextChange(){this.textInputBubble&&(this.text=this.textInputBubble.getText())}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(e){e&&(this.textBubble||this.textInputBubble)||(e||this.textBubble||this.textInputBubble)&&(this.bubbleVisiblity=e,this.sourceBlock.rendered&&!this.sourceBlock.isInFlyout&&(e?(this.sourceBlock.isEditable()?this.showEditableBubble():this.showNonEditableBubble(),this.applyColour()):this.hideBubble(),A(new(B(qs))(this.sourceBlock,e,"comment"))))}showEditableBubble(){this.textInputBubble=new Hu(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.textInputBubble.setText(this.getText()),this.textInputBubble.setSize(this.bubbleSize,!0),this.textInputBubble.addTextChangeListener((()=>this.onTextChange())),this.textInputBubble.addSizeChangeListener((()=>this.onSizeChange()))}showNonEditableBubble(){this.textBubble=new Uu(this.getText(),this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect())}hideBubble(){let e,t;null==(e=this.textInputBubble)||e.dispose(),this.textInputBubble=null,null==(t=this.textBubble)||t.dispose(),this.textBubble=null}getAnchorLocation(){return qa.sum(this.workspaceLocation,new qa(8.5,8.5))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new xl(e.y,e.y+e.height,e.x,e.x+e.width)}};Gu.TYPE=Sa.COMMENT,Gu.WEIGHT=3,vr(Gu.TYPE,Gu);var Vu=class extends ru{constructor(e,t,n){super(ru.SKIP_SETUP),this.class=null,this.EDITABLE=!1,this.maxDisplayLength=1/0,e!==ru.SKIP_SETUP&&(n?this.configure_(n):this.class=t||null,this.setValue(e))}configure_(e){super.configure_(e),e.class&&(this.class=e.class)}initView(){this.createTextElement_(),this.class&&z(this.getTextElement(),this.class)}doClassValidation_(e){return null==e?null:"".concat(e)}setClass(e){this.textElement_&&(this.class&&Y(this.textElement_,this.class),e&&z(this.textElement_,e)),this.class=e}static fromJson(e){return new this(mo(e.text),void 0,e)}};xo("field_label",Vu),Vu.prototype.DEFAULT_VALUE="";var Wu,ju=class{constructor(e,t){this.name=e,this.sourceBlock=t,this.fieldRow=[],this.align=ys.Align$$module$build$src$core$inputs$input.LEFT,this.visible=!0,this.type=ys.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,n){if(0>e||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return t||""===t&&n?("string"==typeof t&&(t=ys.fromJson$$module$build$src$core$field_registry({type:"field_label",text:t})),t.setSourceBlock(this.sourceBlock),this.sourceBlock.rendered&&(t.init(),t.applyColour()),t.name=n,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(),this.sourceBlock.bumpNeighbours()),e):e}removeField(e,t){for(let n,o=0;n=this.fieldRow[o];o++)if(n.name===e)return n.dispose(),this.fieldRow.splice(o,1),this.sourceBlock.rendered&&(this.sourceBlock.queueRender(),this.sourceBlock.bumpNeighbours()),!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 o,r=0;o=this.fieldRow[r];r++)o.setVisible(e);if(this.connection){var n=this.connection;e?t=n.startTrackingAll():n.stopTrackingAll(),(n=n.targetBlock())&&(n.getSvgRoot().style.display=e?"block":"none")}return t}markDirty(){for(let e,t=0;e=this.fieldRow[t];t++)e.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(){if(this.sourceBlock.workspace.rendered)for(let e=0;ee.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(){for(let e,t=0;e=this.inputList[t];t++)for(let n,o=0;n=e.fieldRow[o];o++)n.initModel&&n.initModel()}unplug(e){this.outputConnection&&this.unplugFromRow_(e),this.previousConnection&&this.unplugFromStack_(e)}unplugFromRow_(e){let t,n=null;null!=(t=this.outputConnection)&&t.isConnected()&&(n=this.outputConnection.targetConnection,this.outputConnection.disconnect()),n&&e&&(e=this.getOnlyValueConnection_())&&e.isConnected()&&!e.targetBlock().isShadow()&&(null==(e=e.targetConnection)||e.disconnect(),this.workspace.connectionChecker.canConnect(e,n,!1)?n.connect(e):null==e||e.onFailedConnect(n))}getOnlyValueConnection_(){let e=null;for(let t=0;t(e=e+("("===n||")"===t?"":" ")+t,n=t[t.length-1],e)),"")).trim()||"???",e&&t.length>e&&(t=t.substring(0,e-3)+"..."),t}toTokens(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"?";const t=[];for(const o of this.inputList)if(o.name!=ic){for(const e of o.fieldRow)t.push(e.getText());if(o.connection){const r=o.connection.targetBlock();if(r){var n=o.connection;let i=n.getCheck();!i&&n.targetConnection&&(i=n.targetConnection.getCheck()),(n=!!i&&(-1!==i.indexOf("Boolean")||-1!==i.indexOf("Number")))&&t.push("("),t.push(...r.toTokens(e)),n&&t.push(")")}else t.push(e)}}return t}appendValueInput(e){return this.appendInput(new ys.ValueInput$$module$build$src$core$inputs$value_input(e,this))}appendStatementInput(e){return this.statementInputCount++,this.appendInput(new Xu(e,this))}appendDummyInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.appendInput(new zu(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=s(As.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.");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.");e.style?this.jsonInitStyle_(e,t):this.jsonInitColour_(e,t);for(var n=0;void 0!==e["message"+n];)this.interpolate_(e["message"+n],e["args"+n]||[],e["lastDummyAlign"+n],t),n++;if(void 0!==e.inputsInline&&this.setInputsInline(e.inputsInline),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&&(n=mo(e.tooltip),this.setTooltip(n)),void 0!==e.enableContextMenu&&(this.contextMenu=!!e.enableContextMenu),void 0!==e.suppressPrefixSuffix&&(this.suppressPrefixSuffix=!!e.suppressPrefixSuffix),void 0!==e.helpUrl&&(n=mo(e.helpUrl),this.setHelpUrl(n)),"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&&Qo(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(t=0;ti||i>t)throw Error('Block "'+this.type+'": Message index %'+i+" out of range.");if(n[i])throw Error('Block "'+this.type+'": Message index %'+i+" duplicated.");n[i]=!0,o++}}if(o!==t)throw Error('Block "'+this.type+'": Message does not reference all '+t+" arg(s).")}interpolateArguments_(e,t,n){const o=[];for(let r=0;r=this.inputList.length)throw RangeError("Input index "+e+" out of bounds.");if(t>this.inputList.length)throw RangeError("Reference input "+t+" out of bounds.");const n=this.inputList[e];this.inputList.splice(e,1),ee.getWeight()-t.getWeight())),e}removeIcon(e){if(!this.hasIcon(e))return!1;let t;return 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 Sa?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,n){if(this.parentBlock_)throw Error("Block has parent");const o=new(B(ys.MOVE$$module$build$src$core$events$utils))(this);n&&o.setReason(n),this.xy_.translate(e,t),o.recordNew(),A(o)}makeConnection_(e){return new rc(this,e)}allInputsFilled(e){if(void 0===e&&(e=!0),!e&&this.isShadow())return!1;for(let n,o=0;n=this.inputList[o];o++)if(n.connection){var t=n.connection.targetBlock();if(!t||!t.allInputsFilled(e))return!1}return!(t=this.getNextBlock())||t.allInputsFilled(e)}toDevString(){let e=this.type?'"'+this.type+'" block':"Block";return this.id&&(e+=' (id="'+this.id+'")'),e}};Yu.COLLAPSED_INPUT_NAME=ic,Yu.COLLAPSED_FIELD_NAME=sc;var Ku=null,Ju=null,qu={};qu.connectionUiEffect=Sr,qu.disconnectUiEffect=Cr,qu.disconnectUiStop=$r,qu.disposeUiEffect=Er;var Zu=class extends Qa{constructor(e,t,n){super(e?e.workspace.id:void 0),this.type=Xs,e&&(this.blockId=e.id,this.isStart=t,this.blocks=n)}toJson(){const 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,n){return(t=super.fromJson(e,t,null!=n?n:new Zu)).isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};e(As.EVENT,Xs,Zu);var Qu={};Qu.bumpIntoBounds=Ar,Qu.bumpIntoBoundsHandler=Or,Qu.bumpTopObjectsIntoBounds=xr;var eh=new Set,th=new WeakSet,nh=null,oh={};oh.finishQueuedRenders=Nr,oh.queueRender=Lr;var rh=class{constructor(e){this.name_=e}toString(){return this.name_}};rh.POSITIONABLE=new rh("positionable"),rh.DRAG_TARGET=new rh("drag_target"),rh.DELETE_AREA=new rh("delete_area"),rh.AUTOHIDEABLE=new rh("autohideable");var ih=class{constructor(){this.componentData=new Map,this.capabilityToComponentIds=new Map}addComponent(e,t){const n=e.component.id;var o;if(!t&&this.componentData.has(n))throw Error('Plugin "'+n+'" with capabilities "'+(null==(o=this.componentData.get(n))?void 0:o.capabilities)+'" already added.');for(this.componentData.set(n,e),t=[],o=0;o{t.push(this.componentData.get(e))})),t.sort((function(e,t){return e.weight-t.weight})),t.forEach((function(e){n.push(e.component)}))}else e.forEach((e=>{n.push(this.componentData.get(e).component)}));return n}};ih.Capability=rh,ys.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:28,connectingSnapRadius:28,currentConnectionPreference:8,bumpDelay:250},ys.config$$module$build$src$core$config;var sh="The insertion marker manager tried to create a marker but the result is missing %1. If you are using a mutator, make sure your domToMutation method is properly defined.",ah=class{constructor(e){this.activeCandidate=this.lastMarker=this.lastOnStack=null,this.wouldDeleteBlock=!1,this.fadedBlock=this.highlightedBlock=this.markerConnection=null,b(e),this.topBlock=e,this.workspace=e.workspace,this.firstMarker=this.createMarkerBlock(this.topBlock),this.availableConnections=this.initAvailableConnections(),this.lastOnStack&&(this.lastMarker=this.createMarkerBlock(this.lastOnStack.getSourceBlock()))}dispose(){this.availableConnections.length=0,this.disposeInsertionMarker(this.firstMarker),this.disposeInsertionMarker(this.lastMarker)}updateAvailableConnections(){this.availableConnections=this.initAvailableConnections()}wouldConnectBlock(){return!!this.activeCandidate}applyConnections(){if(this.activeCandidate){ys.disable$$module$build$src$core$events$utils(),this.hidePreview(),ys.enable$$module$build$src$core$events$utils();var{local:e,closest:t}=this.activeCandidate;if(e.connect(t),this.topBlock.rendered){const n=e.isSuperior()?t:e,o=this.topBlock.getRootBlock();Nr().then((()=>{Sr(n.getSourceBlock()),setTimeout((()=>{o.bringToFront()}),0)}))}}}update(e,t){const n=this.getCandidate(e);((this.wouldDeleteBlock=this.shouldDelete(!!n,t))||this.shouldUpdatePreviews(n,e))&&(ys.disable$$module$build$src$core$events$utils(),this.maybeHidePreview(n),this.maybeShowPreview(n),ys.enable$$module$build$src$core$events$utils())}createMarkerBlock(e){var t=e.type;let n;ys.disable$$module$build$src$core$events$utils();try{if(n=this.workspace.newBlock(t),n.setInsertionMarker(!0),e.saveExtraState){var o=e.saveExtraState();o&&n.loadExtraState&&n.loadExtraState(o)}else if(e.mutationToDom){const t=e.mutationToDom();t&&n.domToMutation&&n.domToMutation(t)}for(t=0;t0&&void 0!==arguments[0])||arguments[0];const{parentConnection:t,childConnection:n}=this.getParentAndChildConnections();if(t&&n){var o=t.getSourceBlock(),r=n.getSourceBlock();super.disconnectInternal(e),o.rendered&&o.queueRender(),r.rendered&&(r.updateDisabled(),r.queueRender(),r.getSvgRoot().style.display="block")}}respawnShadow_(){super.respawnShadow_();const e=this.targetBlock();e&&(e.initSvg(),e.queueRender())}neighbours(e){return this.dbOpposite.getNeighbours(this,e)}connect_(e){super.connect_(e);var t=this.getSourceBlock();e=e.getSourceBlock();const n=t.rendered,o=e.rendered;n&&t.updateDisabled(),o&&e.updateDisabled(),n&&o&&(this.type===nc.NEXT_STATEMENT||this.type===nc.PREVIOUS_STATEMENT?e.queueRender():t.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(),this.sourceBlock_.bumpNeighbours())}};!function(e){(e=e.TrackedState||(e.TrackedState={}))[e.WILL_TRACK=-1]="WILL_TRACK",e[e.UNTRACKED=0]="UNTRACKED",e[e.TRACKED=1]="TRACKED"}(Oh||(Oh={}));var Rh=Oh.TrackedState,xh={};xh.RenderedConnection=Oh,xh.TrackedState=Rh;var Lh=class extends _u{constructor(e){super(e),this.sourceBlock=e,this.textMap=new Map,this.textBubble=null}getType(){return Lh.TYPE}initView(e){this.svgRoot||(super.initView(e),j(Ll.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),j(Ll.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),j(Ll.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot))}dispose(){let e;super.dispose(),null==(e=this.textBubble)||e.dispose()}getWeight(){return Lh.WEIGHT}getSize(){return new Da(17,17)}applyColour(){let e;super.applyColour(),null==(e=this.textBubble)||e.setColour(this.sourceBlock.style.colourPrimary)}updateCollapsed(){}isShownWhenCollapsed(){return!0}onLocationChange(e){let t;super.onLocationChange(e),null==(t=this.textBubble)||t.setAnchorLocation(this.getAnchorLocation())}addMessage(e,t){if(this.textMap.get(t)===e)return this;let n;return e?this.textMap.set(t,e):this.textMap.delete(t),null==(n=this.textBubble)||n.setText(this.getText()),this}getText(){return[...this.textMap.values()].join("\n")}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}bubbleIsVisible(){return!!this.textBubble}setBubbleVisible(e){if(this.bubbleIsVisible()!==e){if(e)this.textBubble=new Uu(this.getText(),this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.applyColour();else{let e;null==(e=this.textBubble)||e.dispose(),this.textBubble=null}A(new(B(qs))(this.sourceBlock,e,"warning"))}}getAnchorLocation(){return qa.sum(this.workspaceLocation,new qa(8.5,8.5))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new xl(e.y,e.y+e.height,e.x,e.x+e.width)}};Lh.TYPE=Sa.WARNING,Lh.WEIGHT=2;var Nh=class extends Yu{constructor(e,t,n){super(e,t,n),this.width=this.height=0,this.warningTextDb=new Map,this.warning=this.mutator=null,this.eventsInit_=this.renderIsInProgress_=this.visuallyDisabled=this.rendered=!1,this.translation="",this.bumpNeighboursPid=0,this.relativeCoords=new qa(0,0),this.workspace=e,this.svgGroup_=j(Ll.G,{}),this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup_,this.style),(e=this.pathObject.svgPath).tooltip=this,Wn(e),this.svgGroup_.setAttribute("data-id",this.id),this.doInit_()}initSvg(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(let t,n=0;t=this.inputList[n];n++)t.init();for(var e of this.getIcons())e.initView(this.createIconPointerDownListener(e)),e.updateEditable();this.applyColour(),this.pathObject.updateMovable(this.isMovable()),e=this.getSvgRoot(),this.workspace.options.readOnly||this.eventsInit_||!e||De(e,"pointerdown",this,this.onMouseDown_),this.eventsInit_=!0,e.parentNode||this.workspace.getCanvas().appendChild(e)}getColourSecondary(){return this.style.colourSecondary}getColourTertiary(){return this.style.colourTertiary}select(){if(this.isShadow()&&this.getParent())this.getParent().select();else if(m()!==this){var e=null;if(m()){e=m().id,ys.disable$$module$build$src$core$events$utils();try{m().unselect()}finally{ys.enable$$module$build$src$core$events$utils()}}e=new(B(Ys))(e,this.id,this.workspace.id),A(e),b(this),this.addSelect()}}unselect(){if(m()===this){var e=new(B(Ys))(this.id,null,this.workspace.id);e.workspaceId=this.workspace.id,A(e),b(null),this.removeSelect()}}setParent(e){const t=this.parentBlock_;if(e!==t){ee(),super.setParent(e),te();var n=this.getSvgRoot();if(!this.workspace.isClearing&&n){var o=this.getRelativeToSurfaceXY();e?e.getSvgRoot().appendChild(n):t&&(this.workspace.getCanvas().appendChild(n),this.translate(o.x,o.y)),this.applyColour()}}}getRelativeToSurfaceXY(){let e=0,t=0,n=this.getSvgRoot();if(n)do{const o=et(n);e+=o.x,t+=o.y,n=n.parentNode}while(n&&n!==this.workspace.getCanvas());return new qa(e,t)}moveBy(e,t,n){if(this.parentBlock_)throw Error("Block has parent");const o=N();let r=null;o&&(r=new(B(ys.MOVE$$module$build$src$core$events$utils))(this),n&&r.setReason(n)),n=this.getRelativeToSurfaceXY(),this.translate(n.x+e,n.y+t),this.moveConnections(e,t),o&&r&&(r.recordNew(),A(r)),this.workspace.resizeContents()}translate(e,t){this.translation="translate(".concat(e,", ").concat(t,")"),this.relativeCoords=new qa(e,t),this.getSvgRoot().setAttribute("transform",this.getTranslation())}getTranslation(){return this.translation}moveTo(e,t){const n=this.getRelativeToSurfaceXY();this.moveBy(e.x-n.x,e.y-n.y,t)}moveDuringDrag(e){this.translate(e.x,e.y),this.getSvgRoot().setAttribute("transform",this.getTranslation())}clearTransformAttributes_(){this.getSvgRoot().removeAttribute("transform")}snapToGrid(){if(!(this.isDeadOrDying()||this.workspace.isDragging()||this.getParent()||this.isInFlyout)){var e=this.workspace.getGrid();if(e&&e.shouldSnap()){var t=e.getSpacing(),n=t/2,o=this.getRelativeToSurfaceXY();e=Math.round(Math.round((o.x-n)/t)*t+n-o.x),t=Math.round(Math.round((o.y-n)/t)*t+n-o.y),(e||t)&&this.moveBy(e,t,["snap"])}}}getBoundingRectangle(){const e=this.getRelativeToSurfaceXY(),t=this.getHeightWidth();let n,o;return this.RTL?(n=e.x-t.width,o=e.x):(n=e.x,o=e.x+t.width),new xl(e.y,e.y+t.height,n,o)}markDirty(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(let e,t=0;e=this.inputList[t];t++)e.markDirty()}setCollapsed(e){this.collapsed_!==e&&(super.setCollapsed(e),this.updateCollapsed_())}updateCollapsed_(){var e=this.isCollapsed();const t=ic,n=sc;for(let r,i=0;r=this.inputList[i];i++)r.name!==t&&r.setVisible(!e);for(var o of this.getIcons())o.updateCollapsed();e?(e=this.toString(30),(o=this.getField(n))?o.setValue(e):(this.getInput(t)||this.appendDummyInput(t)).appendField(new Vu(e),n)):(this.updateDisabled(),this.removeInput(t))}tab(e,t){const n=new Ah;n.setCurNode(wh.createFieldNode(e)),e=n.getCurNode(),t?n.next():n.prev(),(t=n.getCurNode())&&t!==e&&(t.getLocation().showEditor(),this.workspace.keyboardAccessibilityMode&&this.workspace.getCursor().setCurNode(t))}onMouseDown_(e){const t=this.workspace.getGesture(e);t&&t.handleBlockStart(e,this)}showHelp(){const e="function"==typeof this.helpUrl?this.helpUrl():this.helpUrl;e&&window.open(e)}generateContextMenu(){if(this.workspace.options.readOnly||!this.contextMenu)return null;const e=_h.registry.getContextMenuOptions(_h.ScopeType.BLOCK,{block:this});return this.customContextMenu&&this.customContextMenu(e),e}showContextMenu(e){const t=this.generateContextMenu();t&&t.length&&(Yr(e,t,this.RTL),Xr(this))}moveConnections(e,t){if(this.rendered){for(var n=this.getConnections_(!1),o=0;oclearTimeout(e))),this.warningTextDb.clear(),this.getIcons().forEach((e=>e.dispose())))}checkAndDelete(){this.workspace.isFlyout||(ys.setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),ys.setGroup$$module$build$src$core$events$utils(!1))}toCopyData(){return this.isInsertionMarker_?null:{saveInfo:Rt(this,{addCoordinates:!0,addNextBlocks:!1}),source:this.workspace,typeCounts:y(this,!0)}}applyColour(){this.pathObject.applyColour(this);const e=this.getIcons();for(let t=0;t{this.isDeadOrDying()||(this.warningTextDb.delete(n),this.setWarningText(e,n))}),100));else if(this.isInFlyout&&(e=null),t=this.getIcon(Lh.TYPE),"string"==typeof e){o=this.getSurroundParent();let r=null;for(;o;)o.isCollapsed()&&(r=o),o=o.getSurroundParent();r&&r.setWarningText(ys.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,Nh.COLLAPSED_WARNING_ID),t?t.addMessage(e,n):this.addIcon(new Lh(this).addMessage(e,n))}else t&&(n&&t.getText()||this.removeIcon(Lh.TYPE))}setMutator(e){this.removeIcon(ys.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE),e&&this.addIcon(e)}addIcon(e){return super.addIcon(e),e instanceof Lh&&(this.warning=e),e instanceof ys.MutatorIcon$$module$build$src$core$icons$mutator_icon&&(this.mutator=e),this.rendered&&(e.initView(this.createIconPointerDownListener(e)),e.applyColour(),e.updateEditable(),this.render(),this.bumpNeighbours()),e}createIconPointerDownListener(e){return t=>{this.isDeadOrDying()||(t=this.workspace.getGesture(t))&&t.setStartIcon(e)}}removeIcon(e){const t=super.removeIcon(e);return e.equals(Lh.TYPE)&&(this.warning=null),e.equals(ys.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE)&&(this.mutator=null),this.rendered&&(this.render(),this.bumpNeighbours()),t}setEnabled(e){this.isEnabled()!==e&&(super.setEnabled(e),this.rendered&&!this.getInheritedDisabled()&&this.updateDisabled())}setHighlighted(e){this.rendered&&this.pathObject.updateHighlighted(e)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(e){this.pathObject.updateDraggingDelete(e)}getColour(){return this.style.colourPrimary}setColour(e){super.setColour(e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),this.pathObject.setStyle(e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()}setStyle(e){const t=this.workspace.getRenderer().getConstants().getBlockStyle(e);if(this.styleName_=e,!t)throw Error("Invalid style name: "+e);this.hat=t.hat,this.pathObject.setStyle(t),this.colour_=t.colourPrimary,this.style=t,this.applyColour()}bringToFront(){let e=this;do{const t=e.getSvgRoot(),n=t.parentNode,o=n.childNodes;o[o.length-1]!==t&&n.appendChild(t),e=e.getParent()}while(e)}setPreviousStatement(e,t){super.setPreviousStatement(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setNextStatement(e,t){super.setNextStatement(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setOutput(e,t){super.setOutput(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setInputsInline(e){super.setInputsInline(e),this.rendered&&(this.queueRender(),this.bumpNeighbours())}removeInput(e,t){return e=super.removeInput(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours()),e}moveNumberedInputBefore(e,t){super.moveNumberedInputBefore(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}appendInput(e){return super.appendInput(e),this.rendered&&(this.queueRender(),this.bumpNeighbours()),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{const t=ys.getGroup$$module$build$src$core$events$utils();ys.setGroup$$module$build$src$core$events$utils(e),this.getRootBlock().bumpNeighboursInternal(),ys.setGroup$$module$build$src$core$events$utils(t),this.bumpNeighboursPid=0}),ys.config$$module$build$src$core$config.bumpDelay)}}bumpNeighboursInternal(){const e=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||e.isInFlyout))for(const t of this.getConnections_(!1)){if(t.isSuperior()){let e;null==(e=t.targetBlock())||e.bumpNeighboursInternal()}for(const n of t.neighbours(ys.config$$module$build$src$core$config.snapRadius))n.getSourceBlock().getRootBlock()!==e&&(t.isConnected()&&n.isConnected()||(t.isSuperior()?n.bumpAwayFrom(t):t.bumpAwayFrom(n)))}}scheduleSnapAndBump(){const e=ys.getGroup$$module$build$src$core$events$utils();setTimeout((()=>{ys.setGroup$$module$build$src$core$events$utils(e),this.snapToGrid(),ys.setGroup$$module$build$src$core$events$utils(!1)}),ys.config$$module$build$src$core$config.bumpDelay/2),this.bumpNeighbours()}positionNearConnection(e,t){e.type!==nc.NEXT_STATEMENT&&e.type!==nc.INPUT_VALUE||this.moveBy(t.x-e.x,t.y-e.y)}getFirstStatementConnection(){return super.getFirstStatementConnection()}getChildren(e){return super.getChildren(e)}queueRender(){return Lr(this)}render(e){if(!this.renderIsInProgress_){this.renderIsInProgress_=!0;try{if(this.rendered=!0,ee(),this.isEnabled()||this.updateDisabled(),this.isCollapsed()&&this.updateCollapsed_(),this.workspace.getRenderer().render(this),this.updateConnectionAndIconLocations(),!1!==e){const e=this.getParent();e?e.render(!0):this.workspace.resizeContents()}te(),this.updateMarkers_()}finally{this.renderIsInProgress_=!1}}}renderEfficiently(){this.rendered=!0,ee(),this.isCollapsed()&&this.updateCollapsed_(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),te(),this.updateMarkers_()}tightenChildrenEfficiently(){for(const e of this.inputList){const t=e.connection;t&&t.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}updateMarkers_(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw(),this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker($c.LOCAL_MARKER).draw();for(const e of this.inputList)for(const t of e.fieldRow)t.updateMarkers_()}updateConnectionAndIconLocations(){const e=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(e),this.outputConnection&&this.outputConnection.moveToOffset(e);for(let t=0;tn||t.getSourceBlock().isInsertionMarker())return!1;switch(t.type){case nc.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case nc.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case nc.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case nc.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-1===Ds.indexOf(t)}canConnectToPrevious_(e,t){return!(e.targetConnection||-1!==Ds.indexOf(t)||t.targetConnection&&(!(e=t.targetBlock()).isInsertionMarker()||e.getPreviousBlock()))}};e(As.CONNECTION_CHECKER,$s,Ph);var Bh=class{constructor(e){this.connectionChecker=e,this.connections=[]}addConnection(e,t){t=this.calculateIndexForYPos(t),this.connections.splice(t,0,e)}findIndexOfConnection(e,t){if(!this.connections.length)return-1;const n=this.calculateIndexForYPos(t);if(n>=this.connections.length)return-1;t=e.y;let o=n;for(;0<=o&&this.connections[o].y===t;){if(this.connections[o]===e)return o;o--}for(o=n;oe)){t=o;break}n=o}}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 n(e){const n=r-o[e].x,s=i-o[e].y;return Math.sqrt(n*n+s*s)<=t&&l.push(o[e]),srect,"),"".concat(e," .blocklyEditableText>rect {"),"fill: ".concat(this.FIELD_BORDER_RECT_COLOUR,";"),"fill-opacity: .6;","stroke: none;","}","".concat(e," .blocklyNonEditableText>text,"),"".concat(e," .blocklyEditableText>text {"),"fill: #000;","}","".concat(e," .blocklyFlyoutLabelText {"),"fill: #000;","}","".concat(e," .blocklyText.blocklyBubbleText {"),"fill: #000;","}","".concat(e," .blocklyEditableText:not(.editing):hover>rect {"),"stroke: #fff;","stroke-width: 2;","}","".concat(e," .blocklyHtmlInput {"),"font-family: ".concat(this.FIELD_TEXT_FONTFAMILY,";"),"font-weight: ".concat(this.FIELD_TEXT_FONTWEIGHT,";"),"}","".concat(e," .blocklySelected>.blocklyPath {"),"stroke: #fc3;","stroke-width: 3px;","}","".concat(e," .blocklyHighlightedConnectionPath {"),"stroke: #fc3;","}","".concat(e," .blocklyReplaceable .blocklyPath {"),"fill-opacity: .5;","}","".concat(e," .blocklyReplaceable .blocklyPathLight,"),"".concat(e," .blocklyReplaceable .blocklyPathDark {"),"display: none;","}","".concat(e," .blocklyInsertionMarker>.blocklyPath {"),"fill-opacity: ".concat(this.INSERTION_MARKER_OPACITY,";"),"stroke: none;","}"]}},ad={};ad.ConstantProvider=sd,ad.isDynamicShape=ii;var ld=class extends sd{constructor(){super(),this.GRID_UNIT=4,this.CURSOR_COLOUR="#ffa200",this.CURSOR_RADIUS=5,this.JAGGED_TEETH_WIDTH=this.JAGGED_TEETH_HEIGHT=0,this.START_HAT_HEIGHT=22,this.START_HAT_WIDTH=96,this.SHAPES={HEXAGONAL:1,ROUND:2,SQUARE:3,PUZZLE:4,NOTCH:5},this.SHAPE_IN_SHAPE_PADDING={1:{0:5*this.GRID_UNIT,1:2*this.GRID_UNIT,2:5*this.GRID_UNIT,3:5*this.GRID_UNIT},2:{0:3*this.GRID_UNIT,1:3*this.GRID_UNIT,2:1*this.GRID_UNIT,3:2*this.GRID_UNIT},3:{0:2*this.GRID_UNIT,1:2*this.GRID_UNIT,2:2*this.GRID_UNIT,3:2*this.GRID_UNIT}},this.FULL_BLOCK_FIELDS=!0,this.FIELD_TEXT_FONTWEIGHT="bold",this.FIELD_TEXT_FONTFAMILY='"Helvetica Neue", "Segoe UI", Helvetica, sans-serif',this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0,this.SELECTED_GLOW_COLOUR="#fff200",this.SELECTED_GLOW_SIZE=.5,this.REPLACEMENT_GLOW_COLOUR="#fff200",this.REPLACEMENT_GLOW_SIZE=2,this.selectedGlowFilterId="",this.selectedGlowFilter=null,this.replacementGlowFilterId="",this.SQUARED=this.ROUNDED=this.HEXAGONAL=this.replacementGlowFilter=null,this.SMALL_PADDING=this.GRID_UNIT,this.MEDIUM_PADDING=2*this.GRID_UNIT,this.MEDIUM_LARGE_PADDING=3*this.GRID_UNIT,this.LARGE_PADDING=4*this.GRID_UNIT,this.CORNER_RADIUS=1*this.GRID_UNIT,this.NOTCH_WIDTH=9*this.GRID_UNIT,this.NOTCH_HEIGHT=2*this.GRID_UNIT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=3*this.GRID_UNIT,this.MIN_BLOCK_WIDTH=2*this.GRID_UNIT,this.MIN_BLOCK_HEIGHT=12*this.GRID_UNIT,this.EMPTY_STATEMENT_INPUT_HEIGHT=6*this.GRID_UNIT,this.TOP_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=6*this.GRID_UNIT,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT,this.STATEMENT_INPUT_SPACER_MIN_WIDTH=40*this.GRID_UNIT,this.STATEMENT_INPUT_PADDING_LEFT=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_PADDING=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_MIN_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=6*this.GRID_UNIT,this.CURSOR_WS_WIDTH=20*this.GRID_UNIT,this.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT,this.FIELD_BORDER_RECT_RADIUS=this.CORNER_RADIUS,this.FIELD_BORDER_RECT_X_PADDING=2*this.GRID_UNIT,this.FIELD_BORDER_RECT_Y_PADDING=1.625*this.GRID_UNIT,this.FIELD_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_COLOUR_DEFAULT_WIDTH=2*this.GRID_UNIT,this.FIELD_COLOUR_DEFAULT_HEIGHT=4*this.GRID_UNIT,this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT,this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT}setFontConstants_(e){super.setFontConstants_(e),this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING}init(){super.init(),this.HEXAGONAL=this.makeHexagonal(),this.ROUNDED=this.makeRounded(),this.SQUARED=this.makeSquared(),this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT+this.INSIDE_CORNERS.rightWidth}setDynamicProperties_(e){super.setDynamicProperties_(e),this.SELECTED_GLOW_COLOUR=e.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;const t=Number(e.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=t&&!isNaN(t)?t:this.SELECTED_GLOW_SIZE,this.REPLACEMENT_GLOW_COLOUR=e.getComponentStyle("replacementGlowColour")||this.REPLACEMENT_GLOW_COLOUR,this.REPLACEMENT_GLOW_SIZE=(e=Number(e.getComponentStyle("replacementGlowSize")))&&!isNaN(e)?e:this.REPLACEMENT_GLOW_SIZE}dispose(){super.dispose(),this.selectedGlowFilter&&J(this.selectedGlowFilter),this.replacementGlowFilter&&J(this.replacementGlowFilter)}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH;return{height:e,width:t,path:pr("c",[dr(25,-e),dr(71,-e),dr(t,0)])}}makeHexagonal(){function e(e,n,o){var r=e/2;return mr(-(o=o?-1:1)*(r=r>t?t:r),e=(n?-1:1)*e/2)+mr(o*r,e)}const 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){const r=e>n?e-n:0;return Tr("a","0 0,1",e=(e>n?n:e)/2,dr((t?-1:1)*e,(t?-1:1)*e))+_r("v",(o?1:-1)*r)+Tr("a","0 0,1",e,dr((t?1:-1)*e,(t?-1:1)*e))}const t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,n=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,n,o){return e-=2*t,Tr("a","0 0,1",t,dr((n?-1:1)*t,(n?-1:1)*t))+_r("v",(o?1:-1)*e)+Tr("a","0 0,1",t,dr((n?1:-1)*t,(n?-1:1)*t))}const 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 nc.INPUT_VALUE:case nc.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}return t&&-1!==t.indexOf("Boolean")?this.HEXAGONAL:(t&&-1!==t.indexOf("Number")||t&&t.indexOf("String"),this.ROUNDED);case nc.PREVIOUS_STATEMENT:case nc.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(e){return pr("c",[dr(e*r/2,0),dr(e*r*3/4,s/2),dr(e*r,s)])+br([dr(e*r,i)])+pr("c",[dr(e*r/4,s/2),dr(e*r/2,s),dr(e*r,s)])+_r("h",e*o)+pr("c",[dr(e*r/2,0),dr(e*r*3/4,-s/2),dr(e*r,-s)])+br([dr(e*r,-i)])+pr("c",[dr(e*r/4,-s/2),dr(e*r/2,-s),dr(e*r,-s)])}const t=this.NOTCH_WIDTH,n=this.NOTCH_HEIGHT,o=t/3,r=o/3,i=n/2,s=i/2,a=e(1),l=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:n,pathLeft:a,pathRight:l}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=Tr("a","0 0,0",e,dr(-e,e)),n=Tr("a","0 0,1",e,dr(-e,e));return{width:e,height:e,pathTop:t,pathBottom:Tr("a","0 0,0",e,dr(e,e)),rightWidth:e,rightHeight:e,pathTopRight:n,pathBottomRight:Tr("a","0 0,1",e,dr(e,e))}}generateSecondaryColour_(e){return ho("#000",e,.15)||e}generateTertiaryColour_(e){return ho("#000",e,.25)||e}createDom(e,t,n){super.createDom(e,t,n),e=j(Ll.DEFS,{},e),t=j(Ll.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),j(Ll.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),n=j(Ll.FECOMPONENTTRANSFER,{result:"outBlur"},t),j(Ll.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},n),j(Ll.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),j(Ll.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=j(Ll.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),j(Ll.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=j(Ll.FECOMPONENTTRANSFER,{result:"outBlur"},e),j(Ll.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),j(Ll.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),j(Ll.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),j(Ll.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter=e}getCSS_(e){return["".concat(e," .blocklyText,"),"".concat(e," .blocklyFlyoutLabelText {"),"font: ".concat(this.FIELD_TEXT_FONTWEIGHT," ").concat(this.FIELD_TEXT_FONTSIZE,"pt ").concat(this.FIELD_TEXT_FONTFAMILY,";"),"}","".concat(e," .blocklyText {"),"fill: #fff;","}","".concat(e," .blocklyNonEditableText>rect:not(.blocklyDropdownRect),"),"".concat(e," .blocklyEditableText>rect:not(.blocklyDropdownRect) {"),"fill: ".concat(this.FIELD_BORDER_RECT_COLOUR,";"),"}","".concat(e," .blocklyNonEditableText>text,"),"".concat(e," .blocklyEditableText>text,"),"".concat(e," .blocklyNonEditableText>g>text,"),"".concat(e," .blocklyEditableText>g>text {"),"fill: #575E75;","}","".concat(e," .blocklyFlyoutLabelText {"),"fill: #575E75;","}","".concat(e," .blocklyText.blocklyBubbleText {"),"fill: #575E75;","}","".concat(e," .blocklyDraggable:not(.blocklyDisabled)")," .blocklyEditableText:not(.editing):hover>rect,","".concat(e," .blocklyDraggable:not(.blocklyDisabled)")," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}","".concat(e," .blocklyHtmlInput {"),"font-family: ".concat(this.FIELD_TEXT_FONTFAMILY,";"),"font-weight: ".concat(this.FIELD_TEXT_FONTWEIGHT,";"),"color: #575E75;","}","".concat(e," .blocklyDropdownText {"),"fill: #fff !important;","}","".concat(e,".blocklyWidgetDiv .goog-menuitem,"),"".concat(e,".blocklyDropDownDiv .goog-menuitem {"),"font-family: ".concat(this.FIELD_TEXT_FONTFAMILY,";"),"}","".concat(e,".blocklyDropDownDiv .goog-menuitem-content {"),"color: #fff;","}","".concat(e," .blocklyHighlightedConnectionPath {"),"stroke: ".concat(this.SELECTED_GLOW_COLOUR,";"),"}","".concat(e," .blocklyDisabled > .blocklyOutlinePath {"),"fill: url(#blocklyDisabledPattern".concat(this.randomIdentifier,")"),"}","".concat(e," .blocklyInsertionMarker>.blocklyPath {"),"fill-opacity: ".concat(this.INSERTION_MARKER_OPACITY,";"),"stroke: none;","}"]}},cd=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_=16777216}getType(e){return Object.prototype.hasOwnProperty.call(this,e)||(this[e]=this.nextTypeValue_,this.nextTypeValue_<<=1),this[e]}isField(e){return e.type&this.FIELD}isHat(e){return e.type&this.HAT}isIcon(e){return e.type&this.ICON}isSpacer(e){return e.type&this.SPACER}isInRowSpacer(e){return e.type&this.IN_ROW_SPACER}isInput(e){return e.type&this.INPUT}isExternalInput(e){return e.type&this.EXTERNAL_VALUE_INPUT}isInlineInput(e){return e.type&this.INLINE_INPUT}isStatementInput(e){return e.type&this.STATEMENT_INPUT}isPreviousConnection(e){return e.type&this.PREVIOUS_CONNECTION}isNextConnection(e){return e.type&this.NEXT_CONNECTION}isPreviousOrNextConnection(e){return e.type&(this.PREVIOUS_CONNECTION|this.NEXT_CONNECTION)}isLeftRoundedCorner(e){return e.type&this.LEFT_ROUND_CORNER}isRightRoundedCorner(e){return e.type&this.RIGHT_ROUND_CORNER}isLeftSquareCorner(e){return e.type&this.LEFT_SQUARE_CORNER}isRightSquareCorner(e){return e.type&this.RIGHT_SQUARE_CORNER}isCorner(e){return e.type&this.CORNER}isJaggedEdge(e){return e.type&this.JAGGED_EDGE}isRow(e){return e.type&this.ROW}isBetweenRowSpacer(e){return e.type&this.BETWEEN_ROW_SPACER}isTopRow(e){return e.type&this.TOP_ROW}isBottomRow(e){return e.type&this.BOTTOM_ROW}isTopOrBottomRow(e){return e.type&(this.TOP_ROW|this.BOTTOM_ROW)}isInputRow(e){return e.type&this.INPUT_ROW}},ud=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=cd.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},hd=class extends ud{constructor(e,t){super(e),this.connectionModel=t,this.shape=this.constants_.shapeFor(t),this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic,this.type|=cd.CONNECTION}},dd=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.block_.pathObject.setPath(this.outlinePath_+"\n"+this.inlinePath_),this.info_.RTL&&this.block_.pathObject.flipRTL(),this.recordSizeOnBlock_()}hideHiddenIcons_(){W("hideHiddenIcons_","v10","v11")}recordSizeOnBlock_(){this.block_.height=this.info_.height,this.block_.width=this.info_.widthWithChildren}drawOutline_(){this.drawTop_();for(let e=1;e=e.height)){if(cd.isSpacer(e)){const o=e.precedesStatement;var t=e.followsStatement;if(o||t){const r=this.constants_.INSIDE_CORNERS;var n=r.rightHeight;return n=e.height-(o?n:0),t=t?r.pathBottomRight:"",e=0=n||0>=t)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new Da(t,n+fd.Y_PADDING),this.imageHeight=n,"function"==typeof r&&(this.clickHandler=r),e!==ru.SKIP_SETUP&&(s?this.configure_(s):(this.flipRtl=!!i,this.altText=mo(o)||""),this.setValue(mo(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=mo(e.alt))}initView(){this.imageElement=j(Ll.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(Aa,"xlink:href",this.value_),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(Aa,"xlink:href",this.value_)}getFlipRtl(){return this.flipRtl}setAlt(e){e!==this.altText&&(this.altText=e||"",this.imageElement&&this.imageElement.setAttribute("alt",this.altText))}showEditor_(){this.clickHandler&&this.clickHandler(this)}setOnClickHandler(e){this.clickHandler=e}getText_(){return this.altText}static fromJson(e){if(!e.src||!e.width||!e.height)throw Error("src, width, and height values for an image field arerequired. The width and height must be non-zero.");return new this(e.src,e.width,e.height,void 0,void 0,void 0,e)}};fd.Y_PADDING=1,xo("field_image",fd),fd.prototype.DEFAULT_VALUE="";var gd=class extends ru{constructor(e,t,n){super(ru.SKIP_SETUP),this.spellcheck_=!0,this.htmlInput_=null,this.isTextValid_=this.isBeingEdited_=!1,this.onKeyInputWrapper_=this.onKeyDownWrapper_=this.valueWhenEditorWasOpened_=null,this.fullBlockClickTarget_=!1,this.workspace_=null,this.SERIALIZABLE=!0,this.CURSOR="text",e!==ru.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),void 0!==e.spellcheck&&(this.spellcheck_=e.spellcheck)}initView(){const e=this.getSourceBlock();if(!e)throw new iu;if(this.getConstants().FULL_BLOCK_FIELDS){let t=0,n=0;for(let o,r=0;o=e.inputList[r];r++){for(let e=0;o.fieldRow[e];e++)t++;o.connection&&n++}this.fullBlockClickTarget_=1>=t&&e.outputConnection&&!n}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_(),this.createTextElement_()}doValueInvalid_(e){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,e=this.value_,this.value_=this.htmlInput_.getAttribute("data-untyped-default-value"),this.sourceBlock_&&N()&&A(new(B(ys.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock_,"field",this.name||null,e,this.value_)))}doValueUpdate_(e){this.isTextValid_=this.isDirty_=!0,this.value_=e}applyColour(){if(this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS){var e=this.sourceBlock_;this.borderRect_?this.borderRect_.setAttribute("stroke",e.style.colourTertiary):e.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR)}}render_(){if(super.render_(),this.isBeingEdited_){this.resizeEditor_();const e=this.htmlInput_;this.isTextValid_?(Y(e,"blocklyInvalidInput"),Do(e,uu.INVALID,!1)):(z(e,"blocklyInvalidInput"),Do(e,uu.INVALID,!0))}}setSpellcheck(e){e!==this.spellcheck_&&(this.spellcheck_=e,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}showEditor_(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.workspace_=this.sourceBlock_.workspace,!t&&this.workspace_.options.modalInputs&&(Sl||vl||yl)?this.showPromptEditor_():this.showInlineEditor_(t)}showPromptEditor_(){he(ys.Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),(e=>{null!==e&&this.setValue(this.getValueFromEditorText_(e))}))}showInlineEditor_(e){const t=this.getSourceBlock();if(!t)throw new iu;Eo(this,t.RTL,this.widgetDispose_.bind(this)),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 iu;ys.setGroup$$module$build$src$core$events$utils(!0);const t=To();var n=this.getClickTarget_();if(!n)throw Error("A click target has not been set.");z(n,"editing"),(n=document.createElement("input")).className="blocklyHtmlInput",n.setAttribute("spellcheck",this.spellcheck_);const o=this.workspace_.getScale();var r=this.getConstants().FIELD_TEXT_FONTSIZE*o+"pt";return t.style.fontSize=r,n.style.fontSize=r,r=gd.BORDERRADIUS*o+"px",this.fullBlockClickTarget_&&(r=((r=this.getScaledBBox()).bottom-r.top)/2+"px",e=e.getParent()?e.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary,n.style.border=1*o+"px solid "+e,t.style.borderRadius=r,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")),n.style.borderRadius=r,t.appendChild(n),n.value=n.defaultValue=this.getEditorText_(this.value_),n.setAttribute("data-untyped-default-value",String(this.value_)),this.resizeEditor_(),this.bindInputEvents_(n),n}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&N()&&null!==this.valueWhenEditorWasOpened_&&this.valueWhenEditorWasOpened_!==this.value_&&(A(new(B(ys.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),ys.setGroup$$module$build$src$core$events$utils(!1),this.unbindInputEvents_();var e=To().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.");Y(e,"editing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper_=De(e,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper_=De(e,"input",this,this.onHtmlInputChange_)}unbindInputEvents_(){this.onKeyDownWrapper_&&(Be(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyInputWrapper_&&(Be(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}onHtmlInputKeyDown_(e){"Enter"===e.key?(Io(),Cn()):"Escape"===e.key?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value")),Io(),Cn()):"Tab"===e.key&&(Io(),Cn(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())}onHtmlInputChange_(e){e=this.value_,this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&N()&&this.value_!==e&&A(new(B(Gs))(this.sourceBlock_,this.name||null,e,this.value_)),Nr().then((()=>{this.resizeEditor_()}))}setEditorValue_(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.isDirty_=!0,this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(e)),this.setValue(e,t)}resizeEditor_(){var e=this.getSourceBlock();if(!e)throw new iu;const t=To(),n=this.getScaledBBox();t.style.width=n.right-n.left+"px",t.style.height=n.bottom-n.top+"px",e=new qa(e.RTL?n.right-t.offsetWidth:n.left,n.top),t.style.left=e.x+"px",t.style.top=e.y+"px"}repositionForWindowResize(){const e=this.getSourceBlock();return e instanceof Nh&&(Ar(this.workspace_,this.workspace_.getMetricsManager().getViewMetrics(!0),e),this.resizeEditor_(),!0)}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(e){return"".concat(e)}getValueFromEditorText_(e){return e}};gd.BORDERRADIUS=4;var md=class extends gd{constructor(e,t,n){super(e,t,n)}doClassValidation_(e){return void 0===e?null:"".concat(e)}static fromJson(e){return new this(mo(e.text),void 0,e)}};xo("field_input",md),md.prototype.DEFAULT_VALUE="";var bd=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=cd.ROW,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}getLastInput(){for(let e=this.elements.length-1;0<=e;e--){const t=this.elements[e];if(cd.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.rows.length-1?!!this.bottomRow.hasNextConnection:!!o.precedesStatement,cd.isInputRow(i)&&i.hasStatement){let n,o;i.measure(),t=i.width-(null!=(o=null==(n=i.getLastInput())?void 0:n.width)?o:0)+e}else if(n&&(2===r||o)&&cd.isInputRow(i)&&!i.hasStatement){o=i.xPos,n=null;for(let e=0;en?n:this.height/2)*(1-Math.sin(Math.acos((n-this.constants_.SMALL_PADDING)/n)))):0;if(cd.isInlineInput(e)&&e instanceof Td){const r=e.connectedBlock;return null==(e=r?r.pathObject.outputShapeType:e.shape.type)||r&&r.outputConnection&&(r.statementInputCount||r.nextConnection)||n===o.SHAPES.HEXAGONAL&&n!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[n][e]}return cd.isField(e)&&e instanceof yd?n===o.SHAPES.ROUND&&e.field instanceof md?t-2.75*o.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[n][0]:cd.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let o=2;o=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!s.precedesStatement;if(e?this.topRow.hasPreviousConnection:r.followsStatement){var n=i.elements[1];if(n=3===i.elements.length&&n instanceof yd&&(n.field instanceof Vu||n.field instanceof fd),!e&&n)r.height-=this.constants_.SMALL_PADDING,s.height-=this.constants_.SMALL_PADDING,i.height-=this.constants_.MEDIUM_PADDING;else if(e||t){if(t){for(e=!1,t=0;tn;n+=15)j(Ll.LINE,{x1:ep.HALF+ep.RADIUS,y1:ep.HALF,x2:ep.HALF+ep.RADIUS-(0==n%45?10:5),y2:ep.HALF,class:"blocklyAngleMarks",transform:"rotate("+n+","+ep.HALF+","+ep.HALF+")"},e);return this.boundEvents.push(De(e,"click",this,this.hide)),this.boundEvents.push(De(t,"pointerdown",this,this.onMouseMove_,!0)),this.boundEvents.push(De(t,"pointermove",this,this.onMouseMove_,!0)),e}dropdownDispose(){for(const e of this.boundEvents)Be(e);this.boundEvents.length=0,this.line=this.gauge=null}hide(){Sn(this),Io()}onMouseMove_(e){var t=this.gauge.ownerSVGElement.getBoundingClientRect();const n=e.clientX-t.left-ep.HALF;e=e.clientY-t.top-ep.HALF,t=Math.atan(-e/n),isNaN(t)||(t=rn(t),0>n?t+=180:0(e%=360)&&(e+=360),e>this.wrap&&(e-=360),e}static fromJson(e){return new this(e.angle,void 0,e)}};ep.HALF=50,ep.RADIUS=ep.HALF-1,ep.CLOCKWISE=!1,ep.OFFSET=0,ep.WRAP=360,ep.ROUND=15,xo("field_angle",ep),ep.prototype.DEFAULT_VALUE=0,Ve("\n.blocklyAngleCircle {\n stroke: #444;\n stroke-width: 1;\n fill: #ddd;\n fill-opacity: 0.8;\n}\n\n.blocklyAngleMarks {\n stroke: #444;\n stroke-width: 1;\n}\n\n.blocklyAngleGauge {\n fill: #f88;\n fill-opacity: 0.8;\n pointer-events: none;\n}\n\n.blocklyAngleLine {\n stroke: #f00;\n stroke-width: 2;\n stroke-linecap: round;\n pointer-events: none;\n}\n"),function(e){e.COMPASS="compass",e.PROTRACTOR="protractor"}(qd||(qd={}));var tp={};tp.FieldAngle=ep,tp.Mode=qd;var np=class extends ru{constructor(e,t,n){super(ru.SKIP_SETUP),this.SERIALIZABLE=!0,this.CURSOR="default",this.value_=this.value_,this.checkChar=np.CHECK_CHAR,e!==ru.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.checkCharacter&&(this.checkChar=e.checkCharacter)}saveState(){const e=this.saveLegacyState(np);return null!==e?e:this.getValueBoolean()}initView(){super.initView();const e=this.getTextElement();z(e,"blocklyCheckbox"),e.style.display=this.value_?"block":"none"}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)}getDisplayText_(){return this.checkChar}setCheckCharacter(e){this.checkChar=e||np.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)}};np.CHECK_CHAR="\u2713",xo("field_checkbox",np),np.prototype.DEFAULT_VALUE=!1;var op=class extends ru{constructor(e,t,n){super(ru.SKIP_SETUP),this.highlightedIndex=this.picker=null,this.boundEvents=[],this.SERIALIZABLE=!0,this.CURSOR="default",this.isDirty_=!1,this.titles=this.colours=null,this.columns=0,e!==ru.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.colourOptions&&(this.colours=e.colourOptions),e.colourTitles&&(this.titles=e.colourTitles),e.columns&&(this.columns=e.columns)}initView(){this.size_=new Da(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT),this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.sourceBlock_ instanceof Nh&&(this.clickTarget_=this.sourceBlock_.getSvgRoot()):(this.createBorderRect_(),this.getBorderRect().style.fillOpacity="1")}applyColour(){this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.sourceBlock_ instanceof Nh&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())}doClassValidation_(e){return"string"!=typeof e?null:ao(e)}doValueUpdate_(e){this.value_=e,this.borderRect_?this.borderRect_.style.fill=e:this.sourceBlock_&&this.sourceBlock_.rendered&&this.sourceBlock_ instanceof Nh&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",e),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff"))}getText(){let e=this.value_;return/^#(.)\1(.)\2(.)\3$/.test(e)&&(e="#"+e[1]+e[3]+e[5]),e}setColours(e,t){return this.colours=e,t&&(this.titles=t),this}setColumns(e){return this.columns=e,this}showEditor_(){this.dropdownCreate(),un().appendChild(this.picker),fn(this,this.dropdownDispose.bind(this)),this.picker.focus({preventScroll:!0})}onClick(e){null!==(e=(e=e.target)&&e.getAttribute("data-colour"))&&(this.setValue(e),Sn(this))}onKeyDown(e){let t=!0;var n;switch(e.key){case"ArrowUp":this.moveHighlightBy(0,-1);break;case"ArrowDown":this.moveHighlightBy(0,1);break;case"ArrowLeft":this.moveHighlightBy(-1,0);break;case"ArrowRight":this.moveHighlightBy(1,0);break;case"Enter":(n=this.getHighlighted())&&null!==(n=n.getAttribute("data-colour"))&&this.setValue(n),Cn();break;default:t=!1}t&&e.stopPropagation()}moveHighlightBy(e,t){if(this.highlightedIndex){var n=this.colours||op.COLOURS,o=this.columns||op.COLUMNS,r=this.highlightedIndex%o,i=Math.floor(this.highlightedIndex/o);r+=e,i+=t,0>e?0>r&&0r&&(r=0):0o-1&&io-1&&r--:0>t?0>i&&(i=0):0Math.floor(n.length/o)-1&&(i=Math.floor(n.length/o)-1),this.setHighlightedCell(this.picker.childNodes[i].childNodes[r],i*o+r)}}onMouseMove(e){const t=(e=e.target)&&Number(e.getAttribute("data-index"));null!==t&&t!==this.highlightedIndex&&this.setHighlightedCell(e,t)}onMouseEnter(){let e;null==(e=this.picker)||e.focus({preventScroll:!0})}onMouseLeave(){var e;null==(e=this.picker)||e.blur(),(e=this.getHighlighted())&&Y(e,"blocklyColourHighlighted")}getHighlighted(){if(!this.highlightedIndex)return null;const e=this.columns||op.COLUMNS,t=this.picker.childNodes[Math.floor(this.highlightedIndex/e)];return t?t.childNodes[this.highlightedIndex%e]:null}setHighlightedCell(e,t){const n=this.getHighlighted();n&&Y(n,"blocklyColourHighlighted"),z(e,"blocklyColourHighlighted"),this.highlightedIndex=t,(e=e.getAttribute("id"))&&this.picker&&Do(this.picker,uu.ACTIVEDESCENDANT,e)}dropdownCreate(){const e=this.columns||op.COLUMNS,t=this.colours||op.COLOURS,n=this.titles||op.TITLES,o=this.getValue(),r=document.createElement("table");let i;r.className="blocklyColourTable",r.tabIndex=0,r.dir="ltr",Mo(r,cu.GRID),Do(r,uu.EXPANDED,!0),Do(r,uu.ROWCOUNT,Math.floor(t.length/e)),Do(r,uu.COLCOUNT,e);for(let s=0;str>td {\n border: 0.5px solid #888;\n box-sizing: border-box;\n cursor: pointer;\n display: inline-block;\n height: 20px;\n padding: 0;\n width: 20px;\n}\n\n.blocklyColourTable>tr>td.blocklyColourHighlighted {\n border-color: #eee;\n box-shadow: 2px 2px 7px 2px rgba(0, 0, 0, 0.3);\n position: relative;\n}\n\n.blocklyColourSelected, .blocklyColourSelected:hover {\n border-color: #eee !important;\n outline: 1px solid #333;\n position: relative;\n}\n");var rp=class extends Vu{constructor(e,t,n){super(String(null!=e?e:""),t,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(mo(e.text),void 0,e)}};xo("field_label_serializable",rp);var ip=class extends md{constructor(e,t,n){super(ru.SKIP_SETUP),this.textGroup=null,this.maxLines_=1/0,this.isOverflowedY_=!1,e!==ru.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.maxLines&&this.setMaxLines(e.maxLines)}toXml(e){return e.textContent=this.getValue().replace(/\n/g," "),e}fromXml(e){this.setValue(e.textContent.replace(/ /g,"\n"))}saveState(){const e=this.saveLegacyState(ip);return null!==e?e:this.getValue()}loadState(e){this.loadLegacyState(ru,e)||this.setValue(e)}initView(){this.createBorderRect_(),this.textGroup=j(Ll.G,{class:"blocklyEditableText"},this.fieldGroup_)}getDisplayText_(){const e=this.getSourceBlock();if(!e)throw new iu;let t=this.getText();if(!t)return ru.NBSP;const n=t.split("\n");t="";const o=this.isOverflowedY_?this.maxLines_:n.length;for(let r=0;rthis.maxDisplayLength?e=e.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&r===o-1&&(e=e.substring(0,e.length-3)+"..."),e=e.replace(/\s/g,ru.NBSP),t+=e,r!==o-1&&(t+="\n")}return e.RTL&&(t+="\u200f"),t}doValueUpdate_(e){super.doValueUpdate_(e),null!==this.value_&&(this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_)}render_(){var e=this.getSourceBlock();if(!e)throw new iu;for(var t,n=this.textGroup;t=n.firstChild;)n.removeChild(t);t=this.getDisplayText_().split("\n");let o=0;for(let r=0;rr&&(r=a),i+=this.getConstants().FIELD_TEXT_HEIGHT+(0this.maxDisplayLength&&(e[a]=e[a].substring(0,this.maxDisplayLength)),s.textContent=e[a];const i=oe(s,t,n,o);i>r&&(r=i)}r+=this.htmlInput_.offsetWidth-this.htmlInput_.clientWidth}this.borderRect_&&(i+=2*this.getConstants().FIELD_BORDER_RECT_Y_PADDING,r+=2*this.getConstants().FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width","".concat(r)),this.borderRect_.setAttribute("height","".concat(i))),this.size_.width=r,this.size_.height=i,this.positionBorderRect_()}showEditor_(e,t){super.showEditor_(e,t),this.forceRerender()}widgetCreate_(){const e=To(),t=this.workspace_.getScale(),n=document.createElement("textarea");n.className="blocklyHtmlInput blocklyHtmlTextAreaInput",n.setAttribute("spellcheck",String(this.spellcheck_));var o=this.getConstants().FIELD_TEXT_FONTSIZE*t+"pt";e.style.fontSize=o,n.style.fontSize=o,n.style.borderRadius=md.BORDERRADIUS*t+"px",o=this.getConstants().FIELD_BORDER_RECT_X_PADDING*t;const r=this.getConstants().FIELD_BORDER_RECT_Y_PADDING*t/2;return n.style.padding=r+"px "+o+"px "+r+"px "+o+"px",o=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,n.style.lineHeight=o*t+"px",e.appendChild(n),n.value=n.defaultValue=this.getEditorText_(this.value_),n.setAttribute("data-untyped-default-value",String(this.value_)),n.setAttribute("data-old-value",""),Tl?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(n),n}setMaxLines(e){"number"==typeof e&&0this.max_&&(e.max="".concat(this.max_),Do(e,uu.VALUEMAX,this.max_)),e}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};xo("field_number",sp),sp.prototype.DEFAULT_VALUE=0;var ap=class extends mu{constructor(e,t,n,o,r){super(ru.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=ap.dropdownCreate,this.defaultVariableName="string"==typeof e?e:"",this.size_=new Da(0,0),e!==ru.SKIP_SETUP&&(r?this.configure_(r):this.setTypes(n,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 iu;this.variable||(e=ys.getOrCreateVariablePackage$$module$build$src$core$variables(e.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(e.getId()))}shouldAddBorderRect_(){const e=this.getSourceBlock();if(!e)throw new iu;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 iu;const n=e.getAttribute("id"),o=e.textContent,r=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=ys.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,n,o,r),null!==r&&r!==t.type)throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.type+", and does not match variable field that references it: "+dt(e)+".");this.setValue(t.getId())}toXml(e){return this.initModel(),e.id=this.variable.getId(),e.textContent=this.variable.name,this.variable.type&&e.setAttribute("variabletype",this.variable.type),e}saveState(e){var t=this.saveLegacyState(ap);return null!==t||(this.initModel(),t={id:this.variable.getId()},e&&(t.name=this.variable.name,t.type=this.variable.type)),t}loadState(e){const t=this.getSourceBlock();if(!t)throw new iu;this.loadLegacyState(ap,e)||(e=ys.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,e.id||null,e.name,e.type||""),this.setValue(e.getId()))}setSourceBlock(e){if(e.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(e)}getValue(){return this.variable?this.variable.getId():null}getText(){return this.variable?this.variable.name:""}getVariable(){return this.variable}getValidator(){return this.variable?this.validator_:null}doClassValidation_(e){if(null===e)return null;var t=this.getSourceBlock();if(!t)throw new iu;return(t=ys.getVariable$$module$build$src$core$variables(t.workspace,e))?(t=t.type,this.typeIsAllowed(t)?e:(console.warn("Variable type doesn't match this field! Type was "+t),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+e),null)}doValueUpdate_(e){const t=this.getSourceBlock();if(!t)throw new iu;this.variable=ys.getVariable$$module$build$src$core$variables(t.workspace,e),super.doValueUpdate_(e)}typeIsAllowed(e){const t=this.getVariableTypes();if(!t)return!0;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(Array.isArray(e)){let n=!1;for(let o=0;o(this.flyout?ys.config$$module$build$src$core$config.flyoutDragRadius:ys.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(),ys.getGroup$$module$build$src$core$events$utils()||ys.setGroup$$module$build$src$core$events$utils(!0),this.startBlock=null,this.targetBlock=this.flyout.createBlock(this.targetBlock),this.targetBlock.select(),0))}updateIsDraggingBubble(){return!!this.startBubble&&(this.startDraggingBubble(),!0)}updateIsDraggingBlock(){if(!this.targetBlock)return!1;if(this.flyout){if(this.updateIsDraggingFromFlyout())return this.startDraggingBlock(),!0}else if(this.targetBlock.isMovable())return this.startDraggingBlock(),!0;return!1}updateIsDraggingWorkspace(){if(!this.startWorkspace_)throw Error("Cannot update dragging the workspace because the start workspace is undefined");(this.flyout?this.flyout.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.workspaceDragger=new dp(this.startWorkspace_),this.workspaceDragger.startDrag())}updateIsDragging(){if(this.calledUpdateIsDragging)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging=!0,this.updateIsDraggingBubble()||this.updateIsDraggingBlock()||this.updateIsDraggingWorkspace()}startDraggingBlock(){this.blockDragger=new(c(As.BLOCK_DRAGGER,this.creatorWorkspace.options,!0))(this.targetBlock,this.startWorkspace_),this.blockDragger.startDrag(this.currentDragDeltaXY,this.healStack),this.blockDragger.drag(this.mostRecentEvent,this.currentDragDeltaXY)}startDraggingBubble(){if(!this.startBubble)throw Error("Cannot update dragging the bubble because the start bubble is undefined");if(!this.startWorkspace_)throw Error("Cannot update dragging the bubble because the start workspace is undefined");this.bubbleDragger=new Dh(this.startBubble,this.startWorkspace_),this.bubbleDragger.startBubbleDrag(),this.bubbleDragger.dragBubble(this.mostRecentEvent,this.currentDragDeltaXY)}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,Fe(e)?this.cancel():(this.gestureHasStarted=!0,$r(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=cn(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,qn(),this.targetBlock&&this.targetBlock.select(),Ue(e)?this.handleRightClick(e):("pointerdown"===e.type.toLowerCase()&&"mouse"!==e.pointerType&&Oe(e,this),this.mouseDownXY=new qa(e.clientX,e.clientY),this.healStack=e.altKey||e.ctrlKey||e.metaKey,this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(De(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(De(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(De(document,"pointerup",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&Re())}handleMove(e){this.isDragging()&&Le(e)||!this.isMultiTouch()?(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.blockDragger?this.blockDragger.drag(this.mostRecentEvent,this.currentDragDeltaXY):this.bubbleDragger&&this.bubbleDragger.dragBubble(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation()):this.isMultiTouch()&&(this.handleTouchMove(e),Re())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!Le(e))return;if(this.updateFromEvent(e),Re(),this.isEnding_)return void console.log("Trying to end a gesture recursively.");this.isEnding_=!0,this.bubbleDragger?this.bubbleDragger.endBubbleDrag(e,this.currentDragDeltaXY):this.blockDragger?this.blockDragger.endDrag(e,this.currentDragDeltaXY):this.workspaceDragger?this.workspaceDragger.endDrag(this.currentDragDeltaXY):this.isBubbleClick()?this.doBubbleClick():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=Ne(e);this.cachedPoints.set(t,this.getTouchPoint(e));var n=Array.from(this.cachedPoints.keys());2===n.length&&(t=this.cachedPoints.get(n[0]),n=this.cachedPoints.get(n[1]),this.startDistance=qa.distance(t,n),this.isMultiTouch_=!0,e.preventDefault())}handleTouchMove(e){const t=Ne(e);this.cachedPoints.set(t,this.getTouchPoint(e)),this.isPinchZoomEnabled&&2===this.cachedPoints.size?this.handlePinch(e):this.handleMove(e)}handlePinch(e){var t=Array.from(this.cachedPoints.keys()),n=this.cachedPoints.get(t[0]);if(t=this.cachedPoints.get(t[1]),n=qa.distance(n,t)/this.startDistance,0this.previousScale){if(t=0<(t=n-this.previousScale)?5*t:6*t,!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");const o=this.startWorkspace_,r=He(e,o.getParentSvg(),o.getInverseScreenCTM());o.zoom(r.x,r.y,t)}this.previousScale=n,e.preventDefault()}handleTouchEnd(e){e=Ne(e),this.cachedPoints.has(e)&&this.cachedPoints.delete(e),2>this.cachedPoints.size&&(this.cachedPoints.clear(),this.previousScale=0)}getTouchPoint(e){return this.startWorkspace_?new qa(e.pageX,e.pageY):null}isMultiTouch(){return this.isMultiTouch_}cancel(){this.isEnding_||(Re(),this.bubbleDragger?this.bubbleDragger.endBubbleDrag(this.mostRecentEvent,this.currentDragDeltaXY):this.blockDragger?this.blockDragger.endDrag(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.startWorkspace_&&!this.flyout&&(this.startWorkspace_.hideChaff(),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),this.dispose()}handleWsStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace(t),this.mostRecentEvent=e,this.doStart(e)}fireWorkspaceClick(e){A(new(B(Ks))(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}doBubbleClick(){this.startBubble instanceof Ul&&(this.startBubble.setFocus(),this.startBubble.select())}doFieldClick(){if(!this.startField)throw Error("Cannot do a field click because the start field is undefined");this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent),this.bringBlockToFront()}doIconClick(){if(!this.startIcon)throw Error("Cannot do an icon click because the start icon is undefined");this.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");this.targetBlock.isEnabled()&&(ys.getGroup$$module$build$src$core$events$utils()||ys.setGroup$$module$build$src$core$events$utils(!0),this.flyout.createBlock(this.targetBlock).scheduleSnapAndBump())}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");const e=new(B(Ks))(this.startBlock,this.startWorkspace_.id,"block");A(e)}this.bringBlockToFront(),ys.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){e=this.creatorWorkspace,m()&&m().unselect(),this.fireWorkspaceClick(this.startWorkspace_||e)}bringBlockToFront(){this.targetBlock&&!this.flyout&&this.targetBlock.bringToFront()}setStartField(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField||(this.startField=e)}setStartIcon(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartIcon, but the gesture had already been started.");this.startIcon||(this.startIcon=e)}setStartBubble(e){this.startBubble||(this.startBubble=e)}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}setStartWorkspace(e){this.startWorkspace_||(this.startWorkspace_=e)}setStartFlyout(e){this.flyout||(this.flyout=e)}isBubbleClick(){return!!this.startBubble&&!this.hasExceededDragRadius}isBlockClick(){return!(!this.startBlock||this.hasExceededDragRadius||this.isFieldClick()||this.isIconClick())}isFieldClick(){return!!this.startField&&this.startField.isClickable()&&!this.hasExceededDragRadius&&(!this.flyout||!this.flyout.autoClose)}isIconClick(){return!!this.startIcon&&!this.hasExceededDragRadius}isWorkspaceClick(){return!(this.startBlock||this.startBubble||this.startField||this.hasExceededDragRadius)}isDragging(){return!!this.workspaceDragger||!!this.blockDragger||!!this.bubbleDragger}hasStarted(){return this.gestureHasStarted}getInsertionMarkers(){return this.blockDragger?this.blockDragger.getInsertionMarkers():[]}getCurrentDragger(){let e,t;return null!=(t=null!=(e=this.blockDragger)?e:this.workspaceDragger)?t:this.bubbleDragger}static inProgress(){const e=h();for(let t,n=0;t=e[n];n++)if(t.currentGesture_)return!0;return!1}},fp=class{constructor(e,t){let n,o,r;this.pattern=e,this.spacing=null!=(n=t.spacing)?n:0,this.length=null!=(o=t.length)?o:1,this.line2=(this.line1=e.firstChild)&&this.line1.nextSibling,this.snapToGrid=null!=(r=t.snap)&&r}shouldSnap(){return this.snapToGrid}getSpacing(){return this.spacing}getPatternId(){return this.pattern.id}update(e){var t=this.spacing*e;this.pattern.setAttribute("width","".concat(t)),this.pattern.setAttribute("height","".concat(t));let n=(t=Math.floor(this.spacing/2)+.5)-this.length/2,o=t+this.length/2;t*=e,n*=e,o*=e,this.setLineAttributes(this.line1,e,n,o,t,t),this.setLineAttributes(this.line2,e,t,t,n,o)}setLineAttributes(e,t,n,o,r,i){e&&(e.setAttribute("stroke-width","".concat(t)),e.setAttribute("x1","".concat(n)),e.setAttribute("y1","".concat(r)),e.setAttribute("x2","".concat(o)),e.setAttribute("y2","".concat(i)))}moveTo(e,t){this.pattern.setAttribute("x","".concat(e)),this.pattern.setAttribute("y","".concat(t))}static createDom(e,t,n){let o,r;if(e=j(Ll.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},n),0<(null!=(o=t.length)?o:1)&&0<(null!=(r=t.spacing)?r:0)){let n;j(Ll.LINE,{stroke:t.colour},e),null!=(n=t.length)&&n&&j(Ll.LINE,{stroke:t.colour},e)}else j(Ll.LINE,{},e);return e}};ys.Names$$module$build$src$core$names=class{constructor(e,t){this.db=new Map,this.dbReverse=new Set,this.variableMap=null,this.variablePrefix=t||"",this.reservedWords=new Set(e?e.split(","):[])}reset(){this.db.clear(),this.dbReverse.clear(),this.variableMap=null}setVariableMap(e){this.variableMap=e}getNameForUserVariable(e){return this.variableMap?(e=this.variableMap.getVariableById(e))?e.name:null:(console.warn("Deprecated call to Names.prototype.getName without defining a variable map. To fix, add the following code in your generator's init() function:\nBlockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());"),null)}populateVariables(e){e=ys.allUsedVarModels$$module$build$src$core$variables(e);for(let t=0;t{e&&t&&this.deleteVariableInternal(t,o)}))):this.deleteVariableInternal(t,o)}else console.warn("Can't delete non-existent variable: "+e)}deleteVariableInternal(e,t){const n=ys.getGroup$$module$build$src$core$events$utils();n||ys.setGroup$$module$build$src$core$events$utils(!0);try{for(let e=0;ee.name))}getVariableUsesById(e){const t=[],n=this.workspace.getAllBlocks(!1);for(let o=0;othis.remainingCapacityOfType(n))return!1;t+=e[n]}return!(t>this.remainingCapacity())}hasBlockLimits(){return 1/0!==this.options.maxBlocks||!!this.options.maxInstances}getUndoStack(){return this.undoStack_}getRedoStack(){return this.redoStack_}undo(e){var t=e?this.redoStack_:this.undoStack_,n=e?this.undoStack_:this.redoStack_;const o=t.pop();if(o){for(var r=[o];t.length&&o.group&&o.group===t[t.length-1].group;){const e=t.pop();e&&r.push(e)}for(t=0;tthis.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(let t=0;timage, .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 Lp,Np=class extends Sp{constructor(e){let t;super(e),this.resizeHandlerWrapper=null,this.resizesEnabled=this.isVisible_=this.rendered=!0,this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0,this.dragDeltaXY=null,this.oldScale=this.scale=1,this.oldLeft=this.oldTop=0,this.inverseScreenCTM=this.targetWorkspace=this.configureContextMenu=this.lastRecordedPageScroll=this.injectionDiv=this.currentGesture_=this.toolbox_=this.flyout=this.scrollbar=this.trashcan=null,this.inverseScreenCTMDirty=!0,this.highlightedBlocks=[],this.toolboxCategoryCallbacks=new Map,this.flyoutButtonCallbacks=new Map,this.cachedParentSvg=null,this.keyboardAccessibilityMode=!1,this.topBoundedElements=[],this.dragTargetAreas=[],this.zoomControls_=null,this.metricsManager=new(c(As.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager),this.setMetrics=e.setMetrics||Np.setTopLevelWorkspaceMetrics_,this.componentManager=new ih,this.connectionDBList=Bh.init(this.connectionChecker),this.audioManager=new $p(e.parentWorkspace),this.grid=this.options.gridPattern?new fp(this.options.gridPattern,e.gridOptions):null,this.markerManager=new $c(this),Ja&&me&&this.registerToolboxCategoryCallback(Xa,me),Ep&&Wi&&this.registerToolboxCategoryCallback(yp,Wi),bp&&Mi&&(this.registerToolboxCategoryCallback(mp,Mi),this.addChangeListener(Pi)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new vp(this,this.options.theme||wu),this.themeManager_.subscribeWorkspace(this),this.renderer=li(this.options.renderer||"geras",this.getTheme(),null!=(t=this.options.rendererOverrides)?t:void 0),this.cachedParentSvgSize=new Da(0,0)}getMarkerManager(){return this.markerManager}getMetricsManager(){return this.metricsManager}setMetricsManager(e){this.metricsManager=e,this.getMetrics=this.metricsManager.getMetrics.bind(this.metricsManager)}getComponentManager(){return this.componentManager}setCursorSvg(e){this.markerManager.setCursorSvg(e)}setMarkerSvg(e){this.markerManager.setMarkerSvg(e)}getMarker(e){return this.markerManager?this.markerManager.getMarker(e):null}getCursor(){return this.markerManager?this.markerManager.getCursor():null}getRenderer(){return this.renderer}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(e){e||(e=wu),this.themeManager_.setTheme(e)}refreshTheme(){this.svgGroup_&&this.renderer.refreshDom(this.svgGroup_,this.getTheme()),this.updateBlockStyles_(this.getAllBlocks(!1).filter((function(e){return!!e.getStyleName()}))),this.refreshToolboxSelection(),this.toolbox_&&this.toolbox_.refreshTheme(),this.isVisible()&&this.setVisible(!0);const e=new(B(ea))(this.getTheme().name,this.id);A(e)}updateBlockStyles_(e){for(let t,n=0;t=e[n];n++){const e=t.getStyleName();e&&t.setStyle(e)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){const e=this.getParentSvg().getScreenCTM();e&&(this.inverseScreenCTM=e.inverse(),this.inverseScreenCTMDirty=!1)}return this.inverseScreenCTM}updateInverseScreenCTM(){this.inverseScreenCTMDirty=!0}isVisible(){return this.isVisible_}getSvgXY(e){let t=0,n=0,o=1;(this.getCanvas().contains(e)||this.getBubbleCanvas().contains(e))&&(o=this.scale);do{const r=et(e);e!==this.getCanvas()&&e!==this.getBubbleCanvas()||(o=1),t+=r.x*o,n+=r.y*o,e=e.parentNode}while(e&&e!==this.getParentSvg());return new qa(t,n)}getCachedParentSvgSize(){const e=this.cachedParentSvgSize;return new Da(e.width,e.height)}getOriginOffsetInPixels(){return tt(this.getCanvas())}getInjectionDiv(){if(!this.injectionDiv){let e=this.svgGroup_;for(;e;){if(-1!==(" "+(e.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){this.injectionDiv=e;break}e=e.parentNode}}return this.injectionDiv}getBlockCanvas(){return this.svgBlockCanvas_}setResizeHandlerWrapper(e){this.resizeHandlerWrapper=e}createDom(e){return this.svgGroup_=j(Ll.G,{class:"blocklyWorkspace"}),e&&(this.svgBackground_=j(Ll.RECT,{height:"100%",width:"100%",class:e},this.svgGroup_),"blocklyMainBackground"===e&&this.grid?this.svgBackground_.style.fill="url(#"+this.grid.getPatternId()+")":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill")),this.svgBlockCanvas_=j(Ll.G,{class:"blocklyBlockCanvas"},this.svgGroup_),this.svgBubbleCanvas_=j(Ll.G,{class:"blocklyBubbleCanvas"},this.svgGroup_),this.isFlyout||(De(this.svgGroup_,"pointerdown",this,this.onMouseDown_,!1),document.body.addEventListener("wheel",(function(){})),De(this.svgGroup_,"wheel",this,this.onMouseWheel_)),this.options.hasCategories&&(this.toolbox_=new(c(As.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=c(As.CURSOR,this.options))&&this.markerManager.setCursor(new e),this.renderer.createDom(this.svgGroup_,this.getTheme()),this.svgGroup_}dispose(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&J(this.svgGroup_),this.toolbox_&&(this.toolbox_.dispose(),this.toolbox_=null),this.flyout&&(this.flyout.dispose(),this.flyout=null),this.trashcan&&(this.trashcan.dispose(),this.trashcan=null),this.scrollbar&&(this.scrollbar.dispose(),this.scrollbar=null),this.zoomControls_&&this.zoomControls_.dispose(),this.audioManager&&this.audioManager.dispose(),this.grid&&(this.grid=null),this.renderer.dispose(),this.markerManager&&this.markerManager.dispose(),super.dispose(),this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),this.options.parentWorkspace||this.themeManager_.dispose()),this.connectionDBList.length=0,this.toolboxCategoryCallbacks.clear(),this.flyoutButtonCallbacks.clear(),!this.options.parentWorkspace){const e=this.getParentSvg();e&&e.parentNode&&J(e.parentNode)}this.resizeHandlerWrapper&&(Be(this.resizeHandlerWrapper),this.resizeHandlerWrapper=null)}addTrashcan(){this.trashcan=Np.newTrashcan(this);const e=this.trashcan.createDom();this.svgGroup_.insertBefore(e,this.svgBlockCanvas_)}static newTrashcan(e){throw Error("The implementation of newTrashcan should be monkey-patched in by blockly.ts")}addZoomControls(){this.zoomControls_=new xp(this);const e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}addFlyout(e){const t=new Ou({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,move:{scrollbars:!0}});return t.toolboxPosition=this.options.toolboxPosition,this.flyout=this.horizontalLayout?new(c(As.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(c(As.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(t),this.flyout.autoClose=!1,this.flyout.getWorkspace().setVisible(!0),this.flyout.createDom(e)}getFlyout(e){return this.flyout||e?this.flyout:this.toolbox_?this.toolbox_.getFlyout():null}getToolbox(){return this.toolbox_}updateScreenCalculations_(){this.updateInverseScreenCTM(),this.recordDragTargets()}resizeContents(){this.resizesEnabled&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())}resize(){this.toolbox_&&this.toolbox_.position(),this.flyout&&this.flyout.position();const e=this.componentManager.getComponents(ih.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),n=[];for(let o,r=0;o=e[r];r++){o.position(t,n);const e=o.getBoundingRectangle();e&&n.push(e)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations_()}updateScreenCalculationsIfScrolled(){const e=ot();qa.equals(this.lastRecordedPageScroll,e)||(this.lastRecordedPageScroll=e,this.updateScreenCalculations_())}getCanvas(){return this.svgBlockCanvas_}setCachedParentSvgSize(e,t){const n=this.getParentSvg();null!=e&&(this.cachedParentSvgSize.width=e,n.setAttribute("data-cached-width","".concat(e))),null!=t&&(this.cachedParentSvgSize.height=t,n.setAttribute("data-cached-height","".concat(t)))}getBubbleCanvas(){return this.svgBubbleCanvas_}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(N()){var e=this.scale,t=-this.scrollY,n=-this.scrollX;if(!(e===this.oldScale&&1>Math.abs(t-this.oldTop)&&1>Math.abs(n-this.oldLeft))){var o=new(B(ta))(t,n,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=t,this.oldLeft=n,A(o)}}}translate(e,t){const n="translate("+e+","+t+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",n),this.svgBubbleCanvas_.setAttribute("transform",n),this.grid&&this.grid.moveTo(e,t),this.maybeFireViewportChangeEvent()}getWidth(){const e=this.getMetrics();return e?e.viewWidth/this.scale:0}setVisible(e){if(this.isVisible_=e,this.svgGroup_)if(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){for(let t=(e=this.getAllBlocks(!1)).length-1;0<=t;t--)e[t].markDirty();this.render(),this.toolbox_&&this.toolbox_.position()}else this.hideChaff(!0)}render(){for(var e=this.getAllBlocks(!1),t=e.length-1;0<=t;t--)e[t].queueRender();if(this.currentGesture_)for(e=this.currentGesture_.getInsertionMarkers(),t=0;t=Math.abs(o-t.x)&&1>=Math.abs(r-t.y)){e=!0;break}}if(!e){const t=n.getConnections_(!1);for(let n,i=0;n=t[i];i++)if(n.closest(ys.config$$module$build$src$core$config.snapRadius,new qa(o,r)).connection){e=!0;break}}e&&(o=this.RTL?o-ys.config$$module$build$src$core$config.snapRadius:o+ys.config$$module$build$src$core$config.snapRadius,r+=2*ys.config$$module$build$src$core$config.snapRadius)}while(e);n.moveTo(new qa(o,r))}}finally{ys.enable$$module$build$src$core$events$utils()}return N()&&!n.isShadow()&&A(new(B(ys.CREATE$$module$build$src$core$events$utils))(n)),n.select(),n}pasteWorkspaceComment_(e){let t;ys.disable$$module$build$src$core$events$utils();try{t=Ul.fromXmlRendered(e,this);let n,o,r=parseInt(null!=(n=e.getAttribute("x"))?n:"0"),i=parseInt(null!=(o=e.getAttribute("y"))?o:"0");isNaN(r)||isNaN(i)||(this.RTL&&(r=-r),t.moveBy(r+50,i+50))}finally{ys.enable$$module$build$src$core$events$utils()}return N()&&Za.fireCreateEvent(t),t.select(),t}refreshToolboxSelection(){const e=this.isFlyout?this.targetWorkspace:this;e&&!e.currentGesture_&&e.toolbox_&&e.toolbox_.getFlyout()&&e.toolbox_.refreshSelection()}renameVariableById(e,t){super.renameVariableById(e,t),this.refreshToolboxSelection()}deleteVariableById(e){super.deleteVariableById(e),this.refreshToolboxSelection()}createVariable(e,t,n){return e=super.createVariable(e,t,n),this.refreshToolboxSelection(),e}recordDragTargets(){const e=this.componentManager.getComponents(ih.Capability.DRAG_TARGET,!0);this.dragTargetAreas=[];for(let t,n=0;t=e[n];n++){const e=t.getClientRect();e&&this.dragTargetAreas.push({component:t,clientRect:e})}}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}getDragTarget(e){for(let t,n=0;t=this.dragTargetAreas[n];n++)if(t.clientRect.contains(e.clientX,e.clientY))return t.component;return null}onMouseDown_(e){const t=this.getGesture(e);t&&t.handleWsStart(e,this)}startDrag(e,t){(e=He(e,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,e.y/=this.scale,this.dragDeltaXY=qa.difference(t,e)}moveDrag(e){return(e=He(e,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,e.y/=this.scale,qa.sum(this.dragDeltaXY,e)}isDragging(){return 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(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollVertically())}onMouseWheel_(e){if(pp.inProgress())e.preventDefault(),e.stopPropagation();else{var t=this.options.zoomOptions&&this.options.zoomOptions.wheel,n=this.options.moveOptions&&this.options.moveOptions.wheel;if(t||n){var o=Ge(e);if(Il)var r=e.metaKey;t&&(e.ctrlKey||r||!n)?(o=-o.y/50,t=He(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(t.x,t.y,o)):(t=this.scrollX-o.x,n=this.scrollY-o.y,e.shiftKey&&!o.x&&(t=this.scrollX-o.y,n=this.scrollY),this.scroll(t,n)),e.preventDefault()}}}getBlocksBoundingBox(){const e=this.getTopBoundedElements();if(!e.length)return new xl(0,0,0,0);const t=e[0].getBoundingRectangle();for(let o=1;ot.bottom&&(t.bottom=n.bottom),n.leftt.right&&(t.right=n.right))}return t}cleanUp(){this.setResizesEnabled(!1),ys.setGroup$$module$build$src$core$events$utils(!0);const e=this.getTopBlocks(!0);let t=0;for(let n,o=0;n=e[o];o++){if(!n.isMovable())continue;const e=n.getRelativeToSurfaceXY();n.moveBy(-e.x,t-e.y,["cleanup"]),n.snapToGrid(),t=n.getRelativeToSurfaceXY().y+n.getHeightWidth().height+this.renderer.getConstants().MIN_BLOCK_HEIGHT}ys.setGroup$$module$build$src$core$events$utils(!1),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.options.readOnly&&!this.isFlyout){var t=_h.registry.getContextMenuOptions(_h.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(t,e),Yr(e,t,this.RTL)}}updateToolbox(e){if(e=Ho(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(Wo(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():(g(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(e,t,n){n=Math.pow(this.options.zoomOptions.scaleSpeed,n);const o=this.scale*n;if(this.scale!==o){o>this.options.zoomOptions.maxScale?n=this.options.zoomOptions.maxScale/this.scale:othis.options.zoomOptions.maxScale?e=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&e0&&void 0!==arguments[0]&&arguments[0];Jn(),Io(),Cn(),this.hideComponents(e)}hideComponents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.getComponentManager().getComponents(ih.Capability.AUTOHIDEABLE,!0).forEach((t=>t.autoHide(e)))}static setTopLevelWorkspaceMetrics_(e){const 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)}},Mp={};Mp.WorkspaceSvg=Np,Mp.resizeSvgContents=Ki,function(e){e.BLOCK="block",e.BUTTON="button"}(Lp||(Lp={}));var Dp=class extends Qd{constructor(e){super(),this.horizontalLayout=!1,this.boundEvents=[],this.filterWrapper=this.reflowWrapper=null,this.mats=[],this.buttons_=[],this.listeners=[],this.permanentlyDisabled=[],this.recycledBlocks=[],this.autoClose=!0,this.isVisible_=!1,this.containerVisible=!0,this.CORNER_RADIUS=8,this.SCROLLBAR_MARGIN=2.5,this.height_=this.width_=0,this.dragAngleRange_=70,this.svgGroup_=this.svgBackground_=null,e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new Np(e),this.workspace_.setMetricsManager(new up(this.workspace_,this)),this.workspace_.internalIsFlyout=!0,this.workspace_.setVisible(this.isVisible_),this.id=C(),this.RTL=!!e.RTL,this.toolboxPosition_=e.toolboxPosition,this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH,this.rectMap_=new WeakMap,this.MARGIN=this.CORNER_RADIUS,this.GAP_X=3*this.MARGIN,this.GAP_Y=3*this.MARGIN}createDom(e){return this.svgGroup_=j(e,{class:"blocklyFlyout",style:"display: none"}),this.svgBackground_=j(Ll.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 hp(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),this.boundEvents.push(De(this.svgGroup_,"wheel",this,this.wheel_)),this.autoClose||(this.filterWrapper=this.filterForCapacity.bind(this),this.targetWorkspace.addChangeListener(this.filterWrapper)),this.boundEvents.push(De(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:1,capabilities:[ih.Capability.DELETE_AREA,ih.Capability.DRAG_TARGET]})}dispose(){this.hide(),this.workspace_.getComponentManager().removeComponent(this.id);for(const e of this.boundEvents)Be(e);this.boundEvents.length=0,this.filterWrapper&&this.targetWorkspace.removeChangeListener(this.filterWrapper),this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.dispose()),this.svgGroup_&&J(this.svgGroup_)}getWidth(){return this.width_}getHeight(){return this.height_}getFlyoutScale(){return this.targetWorkspace.scale}getWorkspace(){return this.workspace_}isVisible(){return this.isVisible_}setVisible(e){const t=e!==this.isVisible();this.isVisible_=e,t&&(this.autoClose||this.workspace_.recordDragTargets(),this.updateDisplay())}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay()}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,n,o){let r,i;null==(r=this.svgGroup_)||r.setAttribute("width","".concat(e)),null==(i=this.svgGroup_)||i.setAttribute("height","".concat(t)),this.workspace_.setCachedParentSvgSize(e,t),this.svgGroup_&&Q(this.svgGroup_,"translate("+n+"px,"+o+"px)"),(e=this.workspace_.scrollbar)&&(e.setOrigin(n,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(){if(this.isVisible()){this.setVisible(!1);for(const e of this.listeners)Be(e);this.listeners.length=0,this.reflowWrapper&&(this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowWrapper=null)}}show(e){this.workspace_.setResizesEnabled(!1),this.hide(),this.clearOldBlocks(),"string"==typeof e&&(e=this.getDynamicCategoryContents(e)),this.setVisible(!0),e=Vo(e),e=this.createFlyoutInfo(e),this.layout_(e.contents,e.gaps),this.horizontalLayout?this.height_=0:this.width_=0,this.workspace_.setResizesEnabled(!0),this.reflow(),this.filterForCapacity(),this.position(),this.reflowWrapper=this.reflow.bind(this),this.workspace_.addChangeListener(this.reflowWrapper),this.emptyRecycledBlocks()}createFlyoutInfo(e){const t=[],n=[];this.permanentlyDisabled.length=0;const o=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(const r of e){if("custom"in r){e=this.getDynamicCategoryContents(r.custom),e=Vo(e);const{contents:o,gaps:i}=this.createFlyoutInfo(e);t.push(...o),n.push(...i)}switch(r.kind.toUpperCase()){case"BLOCK":e=r;const i=this.createFlyoutBlock(e);t.push({type:Lp.BLOCK,block:i}),this.addBlockGap(e,n,o);break;case"SEP":this.addSeparatorGap(r,n,o);break;case"LABEL":e=this.createButton(r,!0),t.push({type:Lp.BUTTON,button:e}),n.push(o);break;case"BUTTON":e=this.createButton(r,!1),t.push({type:Lp.BUTTON,button:e}),n.push(o)}}return{contents:t,gaps:n}}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)}createButton(e,t){return new lp(this.workspace_,this.targetWorkspace,e,t)}createFlyoutBlock(e){let t;return e.blockxml?(e="string"==typeof e.blockxml?ys.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,(t=this.getRecycledBlock(e.getAttribute("type")))||(t=ys.domToBlock$$module$build$src$core$xml(e,this.workspace_))):(t=this.getRecycledBlock(e.type),t||(void 0===e.enabled&&(e.enabled="true"!==e.disabled&&!0!==e.disabled),t=Ut(e,this.workspace_))),t.isEnabled()||this.permanentlyDisabled.push(t),t}getRecycledBlock(e){let t=-1;for(let n=0;n{const n=this.targetWorkspace.getGesture(t);n&&(n.setStartBlock(e),n.handleFlyoutStart(t,this))}}onMouseDown(e){const t=this.targetWorkspace.getGesture(e);t&&t.handleFlyoutStart(e,this)}isBlockCreatable(e){return e.isEnabled()}createBlock(e){let t=null;ys.disable$$module$build$src$core$events$utils();var n=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{t=this.placeNewBlock(e)}finally{ys.enable$$module$build$src$core$events$utils()}if(this.targetWorkspace.hideChaff(),e=Ae(this.targetWorkspace,n),N()){for(ys.setGroup$$module$build$src$core$events$utils(!0),n=0;n90-t||e>-90-t&&e<-90+t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.top;return this.toolboxPosition_===Iu.TOP?new xl(-1e9,t+e.height,-1e9,1e9):new xl(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;const t=this.workspace_.getTopBlocks(!1);for(let o,r=0;o=t[r];r++)e=Math.max(e,o.getHeightWidth().height);const n=this.buttons_;for(let o,r=0;o=n[r];r++)e=Math.max(e,o.height);if(e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=Tu.scrollbarThickness,this.height_!==e){for(let e,n=0;e=t[n];n++)this.rectMap_.has(e)&&this.moveRectToBlock_(this.rectMap_.get(e),e);this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==Iu.TOP||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.recordDragTargets()}}};e(As.FLYOUTS_HORIZONTAL_TOOLBOX,$s,Pp);var Bp=class extends Dp{constructor(e){super(e)}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),n=t.getScrollMetrics(),o=t.getViewMetrics();t=t.getAbsoluteMetrics(),"number"==typeof e.y&&(this.workspace_.scrollY=-(n.top+(n.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();const t=e.getAbsoluteMetrics(),n=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===Iu.LEFT?e.width:n.width-this.width_:this.toolboxPosition_===Iu.LEFT?0:n.width:this.toolboxPosition_===Iu.LEFT?0:n.width+t.left-this.width_}getY(){return 0}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=e.height,this.setBackgroundPath(this.width_-this.CORNER_RADIUS,e.height-2*this.CORNER_RADIUS),e=this.getX();var t=this.getY();this.positionAt_(this.width_,this.height_,e,t)}}setBackgroundPath(e,t){const n=this.toolboxPosition_===Iu.RIGHT;var o=e+this.CORNER_RADIUS;(o=["M "+(n?o:0)+",0"]).push("h",n?-e:e),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,n?0:1,n?-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,n?0:1,n?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("h",n?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=Ge(e);if(t.y){const e=this.workspace_.getMetricsManager(),n=e.getScrollMetrics();let o;t=e.getViewMetrics().top-n.top+t.y,null==(o=this.workspace_.scrollbar)||o.setY(t),Io(),Cn()}e.preventDefault(),e.stopPropagation()}layout_(e,t){this.workspace_.scale=this.targetWorkspace.scale;var n=this.MARGIN;const o=this.RTL?n:n+this.tabWidth_;for(let a,l=0;a=e[l];l++)if("block"===a.type){var r=a.block,i=r.getDescendants(!1);for(let t,n=0;t=i[n];n++)t.isInFlyout=!0;i=r.getSvgRoot();const e=r.getHeightWidth();var s=r.outputConnection?o-this.tabWidth_:o;r.moveBy(s,n),s=this.createRect_(r,this.RTL?s-e.width:s,n,e,l),this.addBlockListeners_(i,r,s),n+=e.height+t[l]}else"button"===a.type&&(r=a.button,this.initFlyoutButton_(r,o,n),n+=r.height+t[l])}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;const t=this.dragAngleRange_;return e-t||e<-180+t||e>180-t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.left;return this.toolboxPosition_===Iu.LEFT?new xl(-1e9,1e9,-1e9,t+e.width):new xl(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;var t=this.workspace_.getTopBlocks(!1);for(let o,r=0;o=t[r];r++){var n=o.getHeightWidth().width;o.outputConnection&&(n-=this.tabWidth_),e=Math.max(e,n)}for(let o,r=0;o=this.buttons_[r];r++)e=Math.max(e,o.width);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=Tu.scrollbarThickness,this.width_!==e){for(let o,r=0;o=t[r];r++){if(this.RTL){n=o.getRelativeToSurfaceXY().x;let t=e/this.workspace_.scale-this.MARGIN;o.outputConnection||(t-=this.tabWidth_),o.moveBy(t-n,0)}this.rectMap_.has(o)&&this.moveRectToBlock_(this.rectMap_.get(o),o)}if(this.RTL)for(let n,o=0;n=this.buttons_[o];o++)t=n.getPosition().y,n.moveTo(e/this.workspace_.scale-n.width-this.MARGIN-this.tabWidth_,t);this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==Iu.LEFT||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.recordDragTargets()}}};Bp.registryName="verticalFlyout",e(As.FLYOUTS_VERTICAL_TOOLBOX,$s,Bp),ys.CodeGenerator$$module$build$src$core$generator=class{constructor(e){this.forBlock=Object.create(null),this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}",this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null,this.INDENT=" ",this.COMMENT_WRAP=60,this.ORDER_OVERRIDES=[],this.isInitialized=null,this.RESERVED_WORDS_="",this.definitions_=Object.create(null),this.functionNames_=Object.create(null),this.nameDB_=void 0,this.name_=e,this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=f());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let n,o=0;n=e[o];o++){let e=this.blockToCode(n);Array.isArray(e)&&(e=e[0]),e&&(n.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!n.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,n)+e),this.STATEMENT_SUFFIX&&!n.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,n))),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){const t=[];e=e.getDescendants(!0);for(let n=0;n.blocklyPathLight,"),"".concat(e," .blocklyInsertionMarker>.blocklyPathDark {"),"fill-opacity: ".concat(this.INSERTION_MARKER_OPACITY,";"),"stroke: none;","}"])}},Vp=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_+=gr(e.xPos,this.info_.startY);for(let t,n=0;t=e.elements[n];n++)cd.isLeftSquareCorner(t)?this.steps_+=this.highlightConstants_.START_POINT:cd.isLeftRoundedCorner(t)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):cd.isPreviousConnection(t)?this.steps_+=this.notchPaths_.pathLeft:cd.isHat(t)?this.steps_+=this.startPaths_.path(this.RTL_):cd.isSpacer(t)&&0!==t.width&&(this.steps_+=_r("H",t.xPos+t.width-this.highlightOffset));this.steps_+=_r("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+_r("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(e){const t=e.getLastInput();if(this.RTL_){const n=e.height-t.connectionHeight;this.steps_+=fr(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+_r("v",n)}else this.steps_+=fr(t.xPos+t.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(e){const t=e.getLastInput();if(t)if(this.RTL_){const n=e.height-2*this.insideCornerPaths_.height;this.steps_+=fr(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+_r("v",n)+this.insideCornerPaths_.pathBottom(this.RTL_)+mr(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=fr(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+mr(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){const t=e.xPos+e.width-this.highlightOffset;e instanceof Ld&&e.followsStatement&&(this.steps_+=_r("H",t)),this.RTL_&&(this.steps_+=_r("H",t),e.height>this.highlightOffset&&(this.steps_+=_r("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=_r("V",e.baseline-this.highlightOffset);else{const t=this.info_.bottomRow.elements[0];cd.isLeftSquareCorner(t)?this.steps_+=fr(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):cd.isLeftRoundedCorner(t)&&(this.steps_+=fr(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_+=fr(this.info_.startX,e):(this.steps_+=fr(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=_r("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,cd.isLeftRoundedCorner(e.elements[0])?this.steps_+=_r("V",this.outsideCornerPaths_.height):this.steps_+=_r("V",e.capline+this.highlightOffset))}drawInlineInput(e){const t=this.highlightOffset,n=e.xPos+e.connectionWidth;var o=e.centerline-e.height/2;const r=e.width-e.connectionWidth,i=o+t;this.RTL_?(o=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=fr(n-t,i)+_r("v",o)+this.puzzleTabPaths_.pathDown(this.RTL_)+_r("v",e)+_r("h",r)):this.inlineSteps_+=fr(e.xPos+e.width+t,i)+_r("v",e.height)+_r("h",-r)+fr(n,o+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},Wp=class extends dd{constructor(e,t){super(e,t),this.highlighter_=new Vp(t)}draw(){this.drawOutline_(),this.drawInternals_();const 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_+=_r("H",e.xPos+e.width)+_r("V",e.yPos+e.height)}drawBottom_(){this.highlighter_.drawBottomRow(this.info_.bottomRow),super.drawBottom_()}drawLeft_(){this.highlighter_.drawLeft(),super.drawLeft_()}drawInlineInput_(e){this.highlighter_.drawInlineInput(e),super.drawInlineInput_(e)}positionInlineInputConnection_(e){const t=e.centerline-e.height/2;if(e.connectionModel){let n=e.xPos+e.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(n*=-1),e.connectionModel.setOffsetInBlock(n,t+e.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(e){const t=e.getLastInput();if(null!=t&&t.connectionModel){let n=e.xPos+e.statementEdge+t.notchOffset;n=this.info_.RTL?-1*n:n+this.constants_.DARK_PATH_OFFSET,t.connectionModel.setOffsetInBlock(n,e.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(e){const t=e.getLastInput();if(t&&t.connectionModel){let n=e.xPos+e.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(n*=-1),t.connectionModel.setOffsetInBlock(n,e.yPos)}}positionNextConnection_(){const e=this.info_.bottomRow;if(e.connection){const t=e.connection,n=t.xPos;t.connectionModel.setOffsetInBlock((this.info_.RTL?-n:n)+this.constants_.DARK_PATH_OFFSET/2,e.baseline+this.constants_.DARK_PATH_OFFSET)}}},jp=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=gr(this.OFFSET,this.OFFSET)}init(){this.INSIDE_CORNER=this.makeInsideCorner(),this.OUTSIDE_CORNER=this.makeOutsideCorner(),this.PUZZLE_TAB=this.makePuzzleTab(),this.NOTCH=this.makeNotch(),this.JAGGED_TEETH=this.makeJaggedTeeth(),this.START_HAT=this.makeStartHat()}makeInsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,n=(1-Math.SQRT1_2)*(e+t)-t,o=gr(n,n)+Tr("a","0 0,0",e,dr(-n-t,e-n)),r=Tr("a","0 0,0",e+t,dr(e+t,e+t)),i=gr(n,-n)+Tr("a","0 0,0",e+t,dr(e-n,n+t));return{width:e+t,height:e,pathTop:e=>e?o:"",pathBottom:e=>e?r:i}}makeOutsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,n=(1-Math.SQRT1_2)*(e-t)+t,o=gr(n,n)+Tr("a","0 0,1",e-t,dr(e-n,-n+t)),r=gr(t,e)+Tr("a","0 0,1",e-t,dr(e,-e+t)),i=-n,s=gr(n,i)+Tr("a","0 0,1",e-t,dr(-n+t,-i-e));return{height:e,topLeft:e=>e?o:r,bottomLeft:()=>s}}makePuzzleTab(){const e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,n=gr(-2,3.4-t)+mr(-.45*e,-2.1),o=_r("v",2.5)+gr(.97*-e,2.5)+pr("q",[dr(.05*-e,10),dr(.3*e,9.5)])+gr(.67*e,-1.9)+_r("v",2.5),r=_r("v",-1.5)+gr(-.92*e,-.5)+pr("q",[dr(-.19*e,-5.5),dr(0,-11)])+gr(.92*e,1),i=gr(-5,t-.7)+mr(.46*e,-2.1);return{width:e,height:t,pathUp:e=>e?n:r,pathDown:e=>e?o:i}}makeNotch(){return{pathLeft:_r("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:mr(5.1,2.6)+gr(-10.2,6.8)+mr(5.1,2.6),height:12,width:10.2}}makeStartHat(){const e=this.constantProvider.START_HAT.height,t=gr(25,-8.7)+pr("c",[dr(29.7,-6.2),dr(57.2,-.5),dr(75,8.7)]),n=pr("c",[dr(17.8,-9.2),dr(45.3,-14.9),dr(75,-8.7)])+fr(100.5,e+.5);return{path:e=>e?t:n}}},zp=class extends wd{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)}},Xp=class extends Cd{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},Yp=class extends Dd{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 Xu||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}addInput_(e,t){this.isInline&&e instanceof ys.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new zp(this.constants_,e)),t.hasInlineInput=!0):e instanceof Xu?(t.elements.push(new Xp(this.constants_,e)),t.hasStatement=!0):e instanceof ys.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new vd(this.constants_,e)),t.hasExternalInput=!0):e instanceof zu&&(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 n,o=0;n=this.rows[o];o++)n.hasExternalInput&&(e=!0);for(let n,o=0;n=this.rows[o];o++){var t=n.elements;if(n.elements=[],n.startsWithElemSpacer()&&n.elements.push(new Sd(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let e=0;ers(e)))).length?e:null}load(e,t){const n=t.getProcedureMap();for(const o of e)n.add(ss(this.procedureModelClass,this.parameterModelClass,o,t))}clear(e){e.getProcedureMap().clear()}}};af.loadParameter=as,af.loadProcedure=ss,af.saveParameter=is,af.saveProcedure=rs;var lf=class{constructor(){this.priority=100}save(e){const t=[];for(const n of e.getAllVariables())e={name:n.name,id:n.getId()},n.type&&(e.type=n.type),t.push(e);return t.length?t:null}load(e,t){for(const n of e)t.createVariable(n.name,n.type,n.id)}clear(e){e.getVariableMap().clear()}};At("variables",new lf);var cf={};cf.VariableSerializer=lf;var uf={};uf.load=cs,uf.save=ls;var hf,df={blocks:ql,exceptions:Yl,priorities:{BLOCKS:50,PROCEDURES:75,VARIABLES:100},procedures:af,registry:Kl,variables:cf,workspaces:uf};!function(e){e.ESCAPE="escape",e.DELETE="delete",e.COPY="copy",e.CUT="cut",e.PASTE="paste",e.UNDO="undo",e.REDO="redo"}(hf||(hf={})),bs();var pf={};pf.names=hf,pf.registerCopy=ds,pf.registerCut=ps,pf.registerDefaultShortcuts=bs,pf.registerDelete=hs,pf.registerEscape=us,pf.registerPaste=fs,pf.registerRedo=ms,pf.registerUndo=gs;var ff=new Su("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"}}),gf={};gf.Classic=wu,gf.Zelos=ff;var mf=class{constructor(e,t,n){this.id_=e.toolboxitemid||w(),this.level_=(this.parent_=n||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){}},bf=class extends mf{constructor(e,t,n){super(e,t,n),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:"blocklyToolboxCategory",row:"blocklyTreeRow",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyTreeIcon",label:"blocklyTreeLabel",contents:"blocklyToolboxContents",selected:"blocklyTreeSelected",openicon:"blocklyTreeIconOpen",closedicon:"blocklyTreeIconClosed"}}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else if(e=e.contents)for(let t=0;t>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyTreeIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyTreeIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyTreeLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyTreeLabel {\n cursor: url("<<>>/handdelete.cur"), auto;\n}\n\n.blocklyTreeSelected .blocklyTreeLabel {\n color: #fff;\n}\n'),e(As.TOOLBOX_ITEM,bf.registrationName,bf);var _f=class extends mf{constructor(e,t){super(e,t),this.cssConfig_={container:"blocklyTreeSeparator"},this.htmlDiv_=null,Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}init(){this.createDom_()}createDom_(){const e=document.createElement("div"),t=this.cssConfig_.container;return t&&z(e,t),this.htmlDiv_=e}getDiv(){return this.htmlDiv_}dispose(){J(this.htmlDiv_)}};_f.registrationName="sep",Ve('\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolboxDiv[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'),e(As.TOOLBOX_ITEM,_f.registrationName,_f);var Tf=class extends bf{constructor(e,t,n){super(e,t,n),this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[]}makeDefaultCssConfig_(){const e=super.makeDefaultCssConfig_();return e.contents="blocklyToolboxContents",e}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else{const t=e.contents;if(t){this.flyoutItems_=[],e=!0;for(let n=0;n>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolboxDiv {\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.blocklyToolboxContents {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxContents:focus {\n outline: none;\n}\n'),e(As.TOOLBOX,$s,vf);var yf=class extends Qd{constructor(e){super(),this.workspace=e,this.id="trashcan",this.contents=[],this.flyout=null,this.isLidOpen=!1,this.minOpenness=0,this.lidTask=this.svgLid=this.svgGroup=null,this.top=this.left=this.lidOpen=0,this.initialized=!1,0>=this.workspace.options.maxTrashcanContents||(e=new Ou({scrollbars:!0,parentWorkspace:this.workspace,rtl:this.workspace.RTL,oneBasedIndex:this.workspace.options.oneBasedIndex,renderer:this.workspace.options.renderer,rendererOverrides:this.workspace.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace.horizontalLayout?(e.toolboxPosition=this.workspace.toolboxPosition===Iu.TOP?Iu.BOTTOM:Iu.TOP,this.flyout=new(c(As.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===Iu.RIGHT?Iu.LEFT:Iu.RIGHT,this.flyout=new(c(As.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){let e;this.svgGroup=j(Ll.G,{class:"blocklyTrash"});const t=String(Math.random()).substring(2);e=j(Ll.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),j(Ll.RECT,{width:Ef,height:If,y:Sf},e);const n=j(Ll.IMAGE,{width:96,x:-$f,height:Op,y:-Af,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return n.setAttributeNS(Aa,"xlink:href",this.workspace.options.pathToMedia+Rp),e=j(Ll.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),j(Ll.RECT,{width:Ef,height:Sf},e),this.svgLid=j(Ll.IMAGE,{width:96,x:-$f,height:Op,y:-Af,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(Aa,"xlink:href",this.workspace.options.pathToMedia+Rp),Pe(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),Pe(this.svgGroup,"pointerup",this,this.click),Pe(n,"pointerover",this,this.mouseOver),Pe(n,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){0{let n;null==(n=this.flyout)||n.show(e),t.cursor=""}),10),this.fireUiEvent(!0)}}closeFlyout(){var e;this.contentsIsOpen()&&(null==(e=this.flyout)||e.hide(),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 n,o=Xi(this.workspace,e);e=zi(o,new Da(Ef,If+Sf),Cf,wf,e,this.workspace),t=Yi(e,wf,o.vertical===wp.TOP?kp.DOWN:kp.UP,t),this.top=t.top,this.left=t.left,null==(n=this.svgGroup)||n.setAttribute("transform","translate("+this.left+","+this.top+")")}}getBoundingRectangle(){return new xl(this.top,this.top+If+Sf,this.left,this.left+Ef)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();const t=e.top+Af-kf;return e=e.left+$f-kf,new xl(t,t+Sf+If+2*kf,e,e+Ef+2*kf)}onDragOver(e){this.setLidOpen(this.wouldDelete_)}onDragExit(e){this.setLidOpen(!1)}onDrop(e){setTimeout(this.setLidOpen.bind(this,!1),100)}setLidOpen(e){this.isLidOpen!==e&&(this.lidTask&&clearTimeout(this.lidTask),this.isLidOpen=e,this.animateLid())}animateLid(){const e=xf;var t=1/(e+1);this.lidOpen+=this.isLidOpen?t:-t,this.lidOpen=Math.min(Math.max(this.lidOpen,this.minOpenness),1),this.setLidAngle(this.lidOpen*Mf),t=Lf+this.lidOpen*(Nf-Lf),this.svgGroup&&(this.svgGroup.style.opacity="".concat(t)),this.lidOpen>this.minOpenness&&1>this.lidOpen&&(this.lidTask=setTimeout(this.animateLid.bind(this),Rf/e))}setLidAngle(e){const t=this.workspace.toolboxPosition===Iu.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;let n;null==(n=this.svgLid)||n.setAttribute("transform","rotate("+(t?-e:e)+","+(t?4:Ef-4)+","+(Sf-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*Mf)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&this.openFlyout()}fireUiEvent(e){e=new(B(Zs))(e,this.workspace.id),A(e)}blockMouseDownWhenOpenable(e){!this.contentsIsOpen()&&this.hasContents()&&e.stopPropagation()}mouseOver(){this.hasContents()&&this.setLidOpen(!0)}mouseOut(){this.setLidOpen(!1)}onDelete(e){if(!(0>=this.workspace.options.maxTrashcanContents||e.type!==ys.DELETE$$module$build$src$core$events$utils||e.type!==ys.DELETE$$module$build$src$core$events$utils||e.wasShadow)){if(!e.oldJson)throw Error("Encountered a delete event without proper oldJson");if(e=JSON.stringify(this.cleanBlockJson(e.oldJson)),-1===this.contents.indexOf(e)){for(this.contents.unshift(e);this.contents.length>this.workspace.options.maxTrashcanContents;)this.contents.pop();this.setMinOpenness(Of)}}}cleanBlockJson(e){return function e(t){if(t){if(delete t.id,delete t.x,delete t.y,delete t.enabled,t.icons&&t.icons.comment){var n=t.icons.comment;delete n.height,delete n.width,delete n.pinned}for(var o in n=t.inputs){var r=n[o];const t=r.block;r=r.shadow,t&&e(t),r&&e(r)}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)}},Ef=47,If=44,Sf=16,wf=20,Cf=20,kf=10,$f=0,Af=32,Of=.1,Rf=80,xf=4,Lf=.4,Nf=.8,Mf=45,Df=ys.Align$$module$build$src$core$inputs$align.LEFT,Pf=ys.Align$$module$build$src$core$inputs$align.CENTRE,Bf=ys.Align$$module$build$src$core$inputs$align.RIGHT,Ff=nc.INPUT_VALUE,Uf=nc.OUTPUT_VALUE,Hf=nc.NEXT_STATEMENT,Gf=nc.PREVIOUS_STATEMENT,Vf=ys.inputTypes$$module$build$src$core$inputs$input_types.DUMMY,Wf=Iu.TOP,jf=Iu.BOTTOM,zf=Iu.LEFT,Xf=Iu.RIGHT;Sp.prototype.newBlock=function(e,t){return new Yu(this,e,t)},Np.prototype.newBlock=function(e,t){return new Nh(this,e,t)},Np.newTrashcan=function(e){return new yf(e)},Ul.prototype.showContextMenu=function(e){if(!this.workspace.options.readOnly){var t=[];this.isDeletable()&&this.isMovable()&&(t.push(ni(this)),t.push(ti(this))),Yr(e,t,this.RTL)}},Ru.prototype.newWorkspaceSvg=function(e){return new Np(e)},ys.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=(e=Ri(e))[0].concat(e[1]);for(let t=0;tt.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1")))}};r.lists_indexOf=l;var c={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"),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((()=>{const e=this.getFieldValue("MODE"),n=this.getFieldValue("WHERE");let o="";switch(e+" "+n){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"!==n&&"FROM_END"!==n||(o+=" "+("FROM_START"===n?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(){const e=t.createElement$$module$build$src$core$utils$xml("mutation");e.setAttribute("statement",String(!this.outputConnection));const n=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(n)),e},domToMutation:function(e){const 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){e!==!this.outputConnection&&(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");const n=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS});n.setValidator((function(t){const n="FROM_START"===t||"FROM_END"===t;if(n!==e){const e=this.getSourceBlock();return e.updateAt_(n),e.setFieldValue(t,"WHERE"),null}})),this.getInput("AT").appendField(n,"WHERE"),t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};r.lists_getIndex=c;var u={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"),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((()=>{const e=this.getFieldValue("MODE"),n=this.getFieldValue("WHERE");let o="";switch(e+" "+n){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"!==n&&"FROM_END"!==n||(o+=" "+t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),o}))},mutationToDom:function(){const e=t.createElement$$module$build$src$core$utils$xml("mutation"),n=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(n)),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");const n=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS});n.setValidator((function(t){const n="FROM_START"===t||"FROM_END"===t;if(n!==e){const e=this.getSourceBlock();return e.updateAt_(n),e.setFieldValue(t,"WHERE"),null}})),this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO"),this.getInput("AT").appendField(n,"WHERE")}};r.lists_setIndex=u;var h={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),this.appendDummyInput("AT1"),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(){const e=t.createElement$$module$build$src$core$utils$xml("mutation");var n=this.getInput("AT1")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at1",String(n)),n=this.getInput("AT2")instanceof t.ValueInput$$module$build$src$core$inputs$value_input,e.setAttribute("at2",String(n)),e},domToMutation:function(e){const 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,n){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),n?(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);const o=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+e]});o.setValidator((function(t){const o="FROM_START"===t||"FROM_END"===t;if(o!==n){const n=this.getSourceBlock();return n.updateAt_(e,o),n.setFieldValue(t,"WHERE"+e),null}})),this.getInput("AT"+e).appendField(o,"WHERE"+e),1===e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2")),t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};r.lists_getSublist=h,r.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}"})}},r.lists_split={init:function(){const 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((()=>{const 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){const e=this.getInput("INPUT").connection;e.setShadowDom(null);const 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(){const 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 null},loadExtraState:function(){}},t.defineBlocks$$module$build$src$core$common(r);var d={};d.blocks=r;var p=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"],["\u2260","NEQ"],["\u200f<","LT"],["\u200f\u2264","LTE"],["\u200f>","GT"],["\u200f\u2265","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}"}));var f={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;const 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;const 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?1:0,this.updateShape_()},decompose:function(e){const t=e.newBlock("controls_if_if");t.initSvg();let n=t.nextConnection;for(let o=1;o<=this.elseifCount_;o++){const t=e.newBlock("controls_if_elseif");t.initSvg(),n.connect(t.previousConnection),n=t.nextConnection}return this.elseCount_&&((e=e.newBlock("controls_if_else")).initSvg(),n.connect(e.previousConnection)),t},compose:function(e){e=e.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;const t=[null],n=[null];let o=null;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":this.elseifCount_++,t.push(e.valueConnection_),n.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,n,o)},saveConnections:function(e){e=e.nextConnection.targetBlock();let t=1;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":var n=this.getInput("IF"+t);const o=this.getInput("DO"+t);e.valueConnection_=n&&n.connection.targetConnection,e.statementConnection_=o&&o.connection.targetConnection,t++;break;case"controls_if_else":n=this.getInput("ELSE"),e.statementConnection_=n&&n.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.getNextBlock()}},rebuildShape_:function(){const e=[null],t=[null];let n=null;this.getInput("ELSE")&&(n=this.getInput("ELSE").connection.targetConnection);for(let o=1;this.getInput("IF"+o);o++){const n=this.getInput("IF"+o),r=this.getInput("DO"+o);e.push(n.connection.targetConnection),t.push(r.connection.targetConnection)}this.updateShape_(),this.reconnectChildBlocks_(e,t,n)},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,n){for(let o=1;o<=this.elseifCount_;o++){let n,r;null==(n=e[o])||n.reconnect(this,"IF"+o),null==(r=t[o])||r.reconnect(this,"DO"+o)}null==n||n.reconnect(this,"ELSE")}};t.registerMutator$$module$build$src$core$extensions("controls_if_mutator",f,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 g={onchange:function(e){this.prevBlocks_||(this.prevBlocks_=[null,null]);var n=this.getInputTargetBlock("A");const o=this.getInputTargetBlock("B");n&&o&&!this.workspace.connectionChecker.doTypeChecks(n.outputConnection,o.outputConnection)&&(t.setGroup$$module$build$src$core$events$utils(e.group),(e=this.prevBlocks_[0])!==n&&(n.unplug(),!e||e.isDisposed()||e.isShadow()||this.getInput("A").connection.connect(e.outputConnection)),(n=this.prevBlocks_[1])!==o&&(o.unplug(),!n||n.isDisposed()||n.isShadow()||this.getInput("B").connection.connect(n.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(g)}));var m={prevParentConnection_:null,onchange:function(e){const n=this.getInputTargetBlock("THEN"),o=this.getInputTargetBlock("ELSE"),r=this.outputConnection.targetConnection;if((n||o)&&r)for(let i=0;2>i;i++){const s=1===i?n:o;s&&!s.workspace.connectionChecker.doTypeChecks(s.outputConnection,r)&&(t.setGroup$$module$build$src$core$events$utils(e.group),r===this.prevParentConnection_?(this.unplug(),r.getSourceBlock().bumpNeighbours()):(s.unplug(),s.bumpNeighbours()),t.setGroup$$module$build$src$core$events$utils(!1))}this.prevParentConnection_=r}};t.registerMixin$$module$build$src$core$extensions("logic_ternary",m),t.defineBlocks$$module$build$src$core$common(p);var b=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}"}));var _={customContextMenu:function(e){if(!this.isInFlyout){var n=this.getField("VAR").getVariable(),o=n.name;if(!this.isCollapsed()&&null!==o){n=t.generateVariableFieldDom$$module$build$src$core$variables(n);const r=t.createElement$$module$build$src$core$utils$xml("block");r.setAttribute("type","variables_get"),r.appendChild(n),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,r)})}}}};t.registerMixin$$module$build$src$core$extensions("contextMenu_newGetVariableBlock",_),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 T=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]),v={getSurroundLoop:function(){let e=this;do{if(T.has(e.type))return e;e=e.getSurroundParent()}while(e);return null},onchange:function(e){var n=this.workspace;if(n.isDragging&&!n.isDragging()&&e.type===t.MOVE$$module$build$src$core$events$utils&&(n=!!this.getSurroundLoop(),this.setWarningText(n?null:t.Msg$$module$build$src$core$msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout)){const o=t.getGroup$$module$build$src$core$events$utils();t.setGroup$$module$build$src$core$events$utils(e.group),this.setEnabled(n),t.setGroup$$module$build$src$core$events$utils(o)}}};t.registerMixin$$module$build$src$core$extensions("controls_flow_in_loop_check",v),t.defineBlocks$$module$build$src$core$common(b);var y={};y.blocks=b,y.loopTypes=T;var E=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:[["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\xbd)","SQRT1_2"],["\u221e","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}"}));var I={mutationToDom:function(){const e=t.createElement$$module$build$src$core$utils$xml("mutation"),n="DIVISIBLE_BY"===this.getFieldValue("PROPERTY");return e.setAttribute("divisor_input",String(n)),e},domToMutation:function(e){e="true"===e.getAttribute("divisor_input"),this.updateShape_(e)},updateShape_:function(e){const t=this.getInput("DIVISOR");e?t||this.appendValueInput("DIVISOR").setCheck("Number"):t&&this.removeInput("DIVISOR")}};t.registerMutator$$module$build$src$core$extensions("math_is_divisibleby_mutator",I,(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"));var S={updateType_:function(e){"MODE"===e?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){const 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 new TypeError("xmlElement had no op attribute");this.updateType_(e)}};t.registerMutator$$module$build$src$core$extensions("math_modes_of_list_mutator",S,(function(){this.getField("OP").setValidator(function(e){this.updateType_(e)}.bind(this))})),t.defineBlocks$$module$build$src$core$common(E);var w={};w.blocks=E;var C={},k={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){const n=t.createElement$$module$build$src$core$utils$xml("mutation");e&&n.setAttribute("name",this.getFieldValue("NAME"));for(let o=0;o{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))}});var D=Object.assign({},M,{init:function(){this.mixin(P);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))}});L.text_prompt=D,L.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})}},L.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})}},L.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 P={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,n=0;t=this.inputList[n];n++)for(let o,r=0;o=t.fieldRow[r];r++)if(e===o.name)return t.insertFieldAt(r,this.newQuote_(!0)),void t.insertFieldAt(r+2,this.newQuote_(!1));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?"\u201c":"\u201d"})}},B={itemCount_:0,mutationToDom:function(){const e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("items","".concat(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){const t=e.newBlock("text_create_join_container");t.initSvg();let n=t.getInput("STACK").connection;for(let o=0;ot.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(P),this.quoteField_("TEXT")})),t.registerMutator$$module$build$src$core$extensions("text_join_mutator",B,(function(){this.mixin(P),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",F,(function(){this.getField("WHERE").setValidator((function(e){e="FROM_START"===e||"FROM_END"===e;const t=this.getSourceBlock();e!==t.isAt_&&t.updateAt_(e)})),this.updateAt_(!0),this.setTooltip((()=>{var e=this.getFieldValue("WHERE");let n=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)&&(n+=" "+e.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),n}))})),t.defineBlocks$$module$build$src$core$common(L);var U={};U.blocks=L;var H=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"]}]),G={customContextMenu:function(e){if(this.isInFlyout)"variables_get"!==this.type&&"variables_get_reporter"!==this.type||(n={text:t.Msg$$module$build$src$core$msg.RENAME_VARIABLE,enabled:!0,callback:V(this)},o=this.getField("VAR").getText(),o={text:t.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",o),enabled:!0,callback:W(this)},e.unshift(n),e.unshift(o));else{if("variables_get"===this.type)var n="variables_set",o=t.Msg$$module$build$src$core$msg.VARIABLES_GET_CREATE_SET;else n="variables_get",o=t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET;const r=this.getField("VAR").getText(),i=t.createElement$$module$build$src$core$utils$xml("field");i.setAttribute("name","VAR"),i.appendChild(t.createTextNode$$module$build$src$core$utils$xml(r));const s=t.createElement$$module$build$src$core$utils$xml("block");s.setAttribute("type",n),s.appendChild(i),e.push({enabled:0o?a=l=this.ORDER_SUBTRACTION:r&&(a=l=this.ORDER_UNARY_NEGATION),e=this.valueToCode(e,n,l)||s,t.isNumber$$module$build$src$core$utils$string(e)?(e=Number(e)+o,r&&(e=-e)):(0o&&(e=e+" - "+-o),r&&(e=o?"-("+e+")":"-"+e),a=Math.floor(a),i=Math.floor(i),a&&i>=a&&(e="("+e+")")),e}},h={};h.JavascriptGenerator=u,h.Order=c;var d={colour_blend:function(e,t){const n=t.valueToCode(e,"COLOUR1",c.NONE)||"'#000000'",o=t.valueToCode(e,"COLOUR2",c.NONE)||"'#000000'";return e=t.valueToCode(e,"RATIO",c.NONE)||.5,[t.provideFunction_("colourBlend","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(c1, c2, ratio) {\n ratio = Math.max(Math.min(Number(ratio), 1), 0);\n var r1 = parseInt(c1.substring(1, 3), 16);\n var g1 = parseInt(c1.substring(3, 5), 16);\n var b1 = parseInt(c1.substring(5, 7), 16);\n var r2 = parseInt(c2.substring(1, 3), 16);\n var g2 = parseInt(c2.substring(3, 5), 16);\n var b2 = parseInt(c2.substring(5, 7), 16);\n var r = Math.round(r1 * (1 - ratio) + r2 * ratio);\n var g = Math.round(g1 * (1 - ratio) + g2 * ratio);\n var b = Math.round(b1 * (1 - ratio) + b2 * ratio);\n r = ('0' + (r || 0).toString(16)).slice(-2);\n g = ('0' + (g || 0).toString(16)).slice(-2);\n b = ('0' + (b || 0).toString(16)).slice(-2);\n return '#' + r + g + b;\n}\n"))+"("+n+", "+o+", "+e+")",c.FUNCTION_CALL]},colour_picker:function(e,t){return[t.quote_(e.getFieldValue("COLOUR")),c.ATOMIC]},colour_random:function(e,t){return[t.provideFunction_("colourRandom","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"() {\n var num = Math.floor(Math.random() * Math.pow(2, 24));\n return '#' + ('00000' + num.toString(16)).substr(-6);\n}\n"))+"()",c.FUNCTION_CALL]},colour_rgb:function(e,t){const n=t.valueToCode(e,"RED",c.NONE)||0,o=t.valueToCode(e,"GREEN",c.NONE)||0;return e=t.valueToCode(e,"BLUE",c.NONE)||0,[t.provideFunction_("colourRgb","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(r, g, b) {\n r = Math.max(Math.min(Number(r), 100), 0) * 2.55;\n g = Math.max(Math.min(Number(g), 100), 0) * 2.55;\n b = Math.max(Math.min(Number(b), 100), 0) * 2.55;\n r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);\n g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);\n b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);\n return '#' + r + g + b;\n}\n"))+"("+n+", "+o+", "+e+")",c.FUNCTION_CALL]}},p=function(e,t,n){return"FIRST"===t?"0":"FROM_END"===t?e+".length - 1 - "+n:"LAST"===t?e+".length - 1":n},f={lists_create_empty:function(e,t){return["[]",c.ATOMIC]},lists_create_with:function(e,t){const n=Array(e.itemCount_);for(let o=0;o String(b) ? 1 : -1; },\n 'IGNORE_CASE': function(a, b) {\n return String(a).toLowerCase() > String(b).toLowerCase() ? 1 : -1; },\n };\n var compare = compareFuncs[type];\n return function(a, b) { return compare(a, b) * direction; };\n}\n ")))+'("'+e+'", '+o+"))",c.FUNCTION_CALL]},lists_split:function(e,t){let n=t.valueToCode(e,"INPUT",c.MEMBER);if(t=t.valueToCode(e,"DELIM",c.NONE)||"''","SPLIT"===(e=e.getFieldValue("MODE")))n||(n="''"),e="split";else{if("JOIN"!==e)throw Error("Unknown mode: "+e);n||(n="[]"),e="join"}return[n+"."+e+"("+t+")",c.FUNCTION_CALL]}},g={};g.controls_if=n,g.controls_ifelse=n,g.logic_boolean=function(e,t){return["TRUE"===e.getFieldValue("BOOL")?"true":"false",c.ATOMIC]},g.logic_compare=function(e,t){const n={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[e.getFieldValue("OP")],o="=="===n||"!="===n?c.EQUALITY:c.RELATIONAL;return[(t.valueToCode(e,"A",o)||"0")+" "+n+" "+(e=t.valueToCode(e,"B",o)||"0"),o]},g.logic_negate=function(e,t){const n=c.LOGICAL_NOT;return["!"+(t.valueToCode(e,"BOOL",n)||"true"),n]},g.logic_null=function(e,t){return["null",c.ATOMIC]},g.logic_operation=function(e,t){const n="AND"===e.getFieldValue("OP")?"&&":"||",o="&&"===n?c.LOGICAL_AND:c.LOGICAL_OR;let r=t.valueToCode(e,"A",o);return e=t.valueToCode(e,"B",o),r||e?(t="&&"===n?"true":"false",r||(r=t),e||(e=t)):e=r="false",[r+" "+n+" "+e,o]},g.logic_ternary=function(e,t){return[(t.valueToCode(e,"IF",c.CONDITIONAL)||"false")+" ? "+(t.valueToCode(e,"THEN",c.CONDITIONAL)||"null")+" : "+(e=t.valueToCode(e,"ELSE",c.CONDITIONAL)||"null"),c.CONDITIONAL]};var m={controls_flow_statements:function(e,t){let n="";if(t.STATEMENT_PREFIX&&(n+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(n+=t.injectId(t.STATEMENT_SUFFIX,e)),t.STATEMENT_PREFIX){const o=e.getSurroundLoop();o&&!o.suppressPrefixSuffix&&(n+=t.injectId(t.STATEMENT_PREFIX,o))}switch(e.getFieldValue("FLOW")){case"BREAK":return n+"break;\n";case"CONTINUE":return n+"continue;\n"}throw Error("Unknown flow statement.")},controls_for:function(e,n){var o=n.nameDB_.getName(e.getFieldValue("VAR"),t.NameType$$module$build$src$core$names.VARIABLE),r=n.valueToCode(e,"FROM",c.ASSIGNMENT)||"0",i=n.valueToCode(e,"TO",c.ASSIGNMENT)||"0";const s=n.valueToCode(e,"BY",c.ASSIGNMENT)||"1";let a=n.statementToCode(e,"DO");if(a=n.addLoopTrap(a,e),t.isNumber$$module$build$src$core$utils$string(r)&&t.isNumber$$module$build$src$core$utils$string(i)&&t.isNumber$$module$build$src$core$utils$string(s))e="for ("+o+" = "+r+"; "+o+((n=Number(r)<=Number(i))?" <= ":" >= ")+i+"; "+o,e=1===(o=Math.abs(Number(s)))?e+(n?"++":"--"):e+(n?" += ":" -= ")+o,e+=") {\n"+a+"}\n";else{e="";let l=r;r.match(/^\w+$/)||t.isNumber$$module$build$src$core$utils$string(r)||(l=n.nameDB_.getDistinctName(o+"_start",t.NameType$$module$build$src$core$names.VARIABLE),e+="var "+l+" = "+r+";\n"),r=i,i.match(/^\w+$/)||t.isNumber$$module$build$src$core$utils$string(i)||(e+="var "+(r=n.nameDB_.getDistinctName(o+"_end",t.NameType$$module$build$src$core$names.VARIABLE))+" = "+i+";\n"),e+="var "+(i=n.nameDB_.getDistinctName(o+"_inc",t.NameType$$module$build$src$core$names.VARIABLE))+" = ",e=t.isNumber$$module$build$src$core$utils$string(s)?e+(Math.abs(s)+";\n"):e+"Math.abs("+s+");\n",e+="if ("+l+" > "+r+") {\n",e=(e+=n.INDENT+i+" = -"+i+";\n")+"}\nfor ("+o+" = "+l+"; "+i+" >= 0 ? "+o+" <= "+r+" : "+o+" >= "+r+"; "+o+" += "+i+") {\n"+a+"}\n"}return e},controls_forEach:function(e,n){const o=n.nameDB_.getName(e.getFieldValue("VAR"),t.NameType$$module$build$src$core$names.VARIABLE);var r=n.valueToCode(e,"LIST",c.ASSIGNMENT)||"[]";let i=n.statementToCode(e,"DO");i=n.addLoopTrap(i,e),e="";let s=r;return r.match(/^\w+$/)||(s=n.nameDB_.getDistinctName(o+"_list",t.NameType$$module$build$src$core$names.VARIABLE),e+="var "+s+" = "+r+";\n"),r=n.nameDB_.getDistinctName(o+"_index",t.NameType$$module$build$src$core$names.VARIABLE),i=n.INDENT+o+" = "+s+"["+r+"];\n"+i,e+"for (var "+r+" in "+s+") {\n"+i+"}\n"}};m.controls_repeat=o,m.controls_repeat_ext=o,m.controls_whileUntil=function(e,t){const n="UNTIL"===e.getFieldValue("MODE");let o=t.valueToCode(e,"BOOL",n?c.LOGICAL_NOT:c.NONE)||"false",r=t.statementToCode(e,"DO");return r=t.addLoopTrap(r,e),n&&(o="!"+o),"while ("+o+") {\n"+r+"}\n"};var b={math_arithmetic:function(e,t){var n={ADD:[" + ",c.ADDITION],MINUS:[" - ",c.SUBTRACTION],MULTIPLY:[" * ",c.MULTIPLICATION],DIVIDE:[" / ",c.DIVISION],POWER:[null,c.NONE]}[e.getFieldValue("OP")];const o=n[0];n=n[1];const r=t.valueToCode(e,"A",n)||"0";return e=t.valueToCode(e,"B",n)||"0",o?[r+o+e,n]:["Math.pow("+r+", "+e+")",c.FUNCTION_CALL]},math_atan2:function(e,t){const n=t.valueToCode(e,"X",c.NONE)||"0";return["Math.atan2("+(t.valueToCode(e,"Y",c.NONE)||"0")+", "+n+") / Math.PI * 180",c.DIVISION]},math_change:function(e,n){const o=n.valueToCode(e,"DELTA",c.ADDITION)||"0";return(e=n.nameDB_.getName(e.getFieldValue("VAR"),t.NameType$$module$build$src$core$names.VARIABLE))+" = (typeof "+e+" === 'number' ? "+e+" : 0) + "+o+";\n"},math_constant:function(e,t){return{PI:["Math.PI",c.MEMBER],E:["Math.E",c.MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",c.DIVISION],SQRT2:["Math.SQRT2",c.MEMBER],SQRT1_2:["Math.SQRT1_2",c.MEMBER],INFINITY:["Infinity",c.ATOMIC]}[e.getFieldValue("CONSTANT")]},math_constrain:function(e,t){return["Math.min(Math.max("+(t.valueToCode(e,"VALUE",c.NONE)||"0")+", "+(t.valueToCode(e,"LOW",c.NONE)||"0")+"), "+(e=t.valueToCode(e,"HIGH",c.NONE)||"Infinity")+")",c.FUNCTION_CALL]},math_modulo:function(e,t){return[(t.valueToCode(e,"DIVIDEND",c.MODULUS)||"0")+" % "+(e=t.valueToCode(e,"DIVISOR",c.MODULUS)||"0"),c.MODULUS]},math_number:function(e,t){return[e=Number(e.getFieldValue("NUM")),0<=e?c.ATOMIC:c.UNARY_NEGATION]},math_number_property:function(e,t){var n={EVEN:[" % 2 === 0",c.MODULUS,c.EQUALITY],ODD:[" % 2 === 1",c.MODULUS,c.EQUALITY],WHOLE:[" % 1 === 0",c.MODULUS,c.EQUALITY],POSITIVE:[" > 0",c.RELATIONAL,c.RELATIONAL],NEGATIVE:[" < 0",c.RELATIONAL,c.RELATIONAL],DIVISIBLE_BY:[null,c.MODULUS,c.EQUALITY],PRIME:[null,c.NONE,c.FUNCTION_CALL]};const o=e.getFieldValue("PROPERTY"),[r,i,s]=n[o];return n=t.valueToCode(e,"NUMBER_TO_CHECK",i)||"0",[e="PRIME"===o?t.provideFunction_("mathIsPrime","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(n) {\n // https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n if (n == 2 || n == 3) {\n return true;\n }\n // False if n is NaN, negative, is 1, or not whole.\n // And false if n is divisible by 2 or 3.\n if (isNaN(n) || n <= 1 || n % 1 !== 0 || n % 2 === 0 || n % 3 === 0) {\n return false;\n }\n // Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {\n if (n % (x - 1) === 0 || n % (x + 1) === 0) {\n return false;\n }\n }\n return true;\n}\n"))+"("+n+")":"DIVISIBLE_BY"===o?n+" % "+(e=t.valueToCode(e,"DIVISOR",c.MODULUS)||"0")+" === 0":n+r,s]},math_on_list:function(e,t){var n=e.getFieldValue("OP");switch(n){case"SUM":e=t.valueToCode(e,"LIST",c.MEMBER)||"[]",e+=".reduce(function(x, y) {return x + y;}, 0)";break;case"MIN":e="Math.min.apply(null, "+(e=t.valueToCode(e,"LIST",c.NONE)||"[]")+")";break;case"MAX":e="Math.max.apply(null, "+(e=t.valueToCode(e,"LIST",c.NONE)||"[]")+")";break;case"AVERAGE":e=(n=t.provideFunction_("mathMean","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(myList) {\n return myList.reduce(function(x, y) {return x + y;}, 0) / myList.length;\n}\n")))+"("+(e=t.valueToCode(e,"LIST",c.NONE)||"[]")+")";break;case"MEDIAN":e=(n=t.provideFunction_("mathMedian","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(myList) {\n var localList = myList.filter(function (x) {return typeof x === 'number';});\n if (!localList.length) return null;\n localList.sort(function(a, b) {return b - a;});\n if (localList.length % 2 === 0) {\n return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;\n } else {\n return localList[(localList.length - 1) / 2];\n }\n}\n")))+"("+(e=t.valueToCode(e,"LIST",c.NONE)||"[]")+")";break;case"MODE":e=(n=t.provideFunction_("mathModes","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(values) {\n var modes = [];\n var counts = [];\n var maxCount = 0;\n for (var i = 0; i < values.length; i++) {\n var value = values[i];\n var found = false;\n var thisCount;\n for (var j = 0; j < counts.length; j++) {\n if (counts[j][0] === value) {\n thisCount = ++counts[j][1];\n found = true;\n break;\n }\n }\n if (!found) {\n counts.push([value, 1]);\n thisCount = 1;\n }\n maxCount = Math.max(thisCount, maxCount);\n }\n for (var j = 0; j < counts.length; j++) {\n if (counts[j][1] === maxCount) {\n modes.push(counts[j][0]);\n }\n }\n return modes;\n}\n")))+"("+(e=t.valueToCode(e,"LIST",c.NONE)||"[]")+")";break;case"STD_DEV":e=(n=t.provideFunction_("mathStandardDeviation","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(numbers) {\n var n = numbers.length;\n if (!n) return null;\n var mean = numbers.reduce(function(x, y) {return x + y;}) / n;\n var variance = 0;\n for (var j = 0; j < n; j++) {\n variance += Math.pow(numbers[j] - mean, 2);\n }\n variance = variance / n;\n return Math.sqrt(variance);\n}\n")))+"("+(e=t.valueToCode(e,"LIST",c.NONE)||"[]")+")";break;case"RANDOM":e=(n=t.provideFunction_("mathRandomList","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(list) {\n var x = Math.floor(Math.random() * list.length);\n return list[x];\n}\n")))+"("+(e=t.valueToCode(e,"LIST",c.NONE)||"[]")+")";break;default:throw Error("Unknown operator: "+n)}return[e,c.FUNCTION_CALL]},math_random_float:function(e,t){return["Math.random()",c.FUNCTION_CALL]},math_random_int:function(e,t){const n=t.valueToCode(e,"FROM",c.NONE)||"0";return e=t.valueToCode(e,"TO",c.NONE)||"0",[t.provideFunction_("mathRandomInt","\nfunction ".concat(t.FUNCTION_NAME_PLACEHOLDER_,"(a, b) {\n if (a > b) {\n // Swap a and b to ensure a is smaller.\n var c = a;\n a = b;\n b = c;\n }\n return Math.floor(Math.random() * (b - a + 1) + a);\n}\n"))+"("+n+", "+e+")",c.FUNCTION_CALL]}};b.math_round=r,b.math_single=r,b.math_trig=r;var _={procedures_callnoreturn:function(e,t){return t.forBlock.procedures_callreturn(e,t)[0]+";\n"},procedures_callreturn:function(e,n){const o=n.nameDB_.getName(e.getFieldValue("NAME"),t.NameType$$module$build$src$core$names.PROCEDURE),r=[],i=e.getVars();for(let t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";n.r(o),n.d(o,{ContentHighlight:()=>r});var e=n(746);const t=[e.Events.VIEWPORT_CHANGE,e.Events.BLOCK_MOVE,e.Events.BLOCK_DELETE];class r{constructor(e){this.workspace=e,this.width=0,this.height=0,this.top=0,this.left=0,this.lastScale=1,this.padding=10}init(t){this.padding=t||10,this.svgGroup=e.utils.dom.createSvgElement(e.utils.Svg.G,{class:"contentAreaHighlight"},null);const n=String(Math.random()).substring(2),o=e.utils.dom.createSvgElement(new e.utils.Svg("mask"),{id:"contentAreaHighlightMask"+n},this.svgGroup);e.utils.dom.createSvgElement(e.utils.Svg.RECT,{x:0,y:0,width:"100%",height:"100%",fill:"white"},o),this.rect=e.utils.dom.createSvgElement(e.utils.Svg.RECT,{x:0,y:0,rx:e.Bubble.BORDER_WIDTH,ry:e.Bubble.BORDER_WIDTH,fill:"black"},o),this.background=e.utils.dom.createSvgElement(e.utils.Svg.RECT,{x:0,y:0,width:"100%",height:"100%",mask:"url(#contentAreaHighlightMask".concat(n,")")},this.svgGroup),this.applyColor();const r=this.workspace.getMetricsManager();this.cachedContentMetrics=r.getContentMetrics(!0),this.resize(this.cachedContentMetrics);const i=r.getAbsoluteMetrics();this.position(this.cachedContentMetrics,i),this.svgGroup.style.transition="opacity 0.25s";const s=this.workspace.getParentSvg();s.firstChild?s.insertBefore(this.svgGroup,s.firstChild):s.appendChild(this.svgGroup),this.onChangeWrapper=this.onChange.bind(this),this.workspace.addChangeListener(this.onChangeWrapper)}dispose(){this.svgGroup&&e.utils.dom.removeNode(this.svgGroup),this.onChangeWrapper&&this.workspace.removeChangeListener(this.onChangeWrapper)}onChange(n){if(n.type===e.Events.THEME_CHANGE)this.applyColor();else if(-1!==t.indexOf(n.type)){const t=this.workspace.getMetricsManager();n.type!==e.Events.VIEWPORT_CHANGE&&(this.cachedContentMetrics=t.getContentMetrics(!0),this.resize(this.cachedContentMetrics));const o=t.getAbsoluteMetrics();this.cachedContentMetrics&&this.position(this.cachedContentMetrics,o)}else if(n.type===e.Events.BLOCK_DRAG)this.handleBlockDrag(n);else if(n.type===e.Events.BLOCK_CHANGE){const e=this.workspace.getMetricsManager();this.cachedContentMetrics=e.getContentMetrics(!0),this.resize(this.cachedContentMetrics)}}handleBlockDrag(e){var t;const n=e.isStart?"0":"1";null===(t=this.svgGroup)||void 0===t||t.setAttribute("opacity",n)}applyColor(){var t;const n=this.workspace.getTheme().getComponentStyle("workspaceBackgroundColour")||"#ffffff",o=e.utils.colour.blend("#000",n,.1),r=e.utils.colour.blend("#fff",n,.1),i="#ffffff"===n||"#fff"===n?o:r;i&&(null===(t=this.background)||void 0===t||t.setAttribute("fill",i))}resize(e){var t,n;const o=e.width?e.width+2*this.padding:0,r=e.height?e.height+2*this.padding:0;o!==this.width&&(this.width=o,null===(t=this.rect)||void 0===t||t.setAttribute("width","".concat(o))),r!==this.height&&(this.height=r,null===(n=this.rect)||void 0===n||n.setAttribute("height","".concat(r)))}position(e,t){var n;const o=-this.workspace.scrollY,r=-this.workspace.scrollX,i=this.workspace.scale,s=t.top+e.top*i-o-this.padding*i,a=t.left+e.left*i-r-this.padding*i;s===this.top&&a===this.left&&this.lastScale===i||(this.top=s,this.left=a,this.lastScale=i,null===(n=this.rect)||void 0===n||n.setAttribute("transform","translate(".concat(a,", ").concat(s,") scale(").concat(i,")")))}}})(),o})(),e.exports=t()},42215:function(e,t,n){var o;o=e=>(()=>{"use strict";var t={573:t=>{t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{ZoomToFitControl:()=>t});var e=o(573);class t{constructor(e){this.workspace=e,this.id="zoomToFit",this.svgGroup=null,this.left=0,this.top=0,this.width=32,this.height=32,this.marginVertical=20,this.marginHorizontal=20,this.initialized=!1,this.onZoomToFitWrapper=null}init(){this.workspace.getComponentManager().addComponent({component:this,weight:2,capabilities:[e.ComponentManager.Capability.POSITIONABLE]}),this.createDom(),this.initialized=!0,this.workspace.resize()}dispose(){this.svgGroup&&e.utils.dom.removeNode(this.svgGroup),this.onZoomToFitWrapper&&(e.browserEvents.unbind(this.onZoomToFitWrapper),this.onZoomToFitWrapper=null)}createDom(){this.svgGroup=e.utils.dom.createSvgElement(e.utils.Svg.IMAGE,{height:"".concat(this.height,"px"),width:"".concat(this.width,"px"),class:"zoomToFit"}),this.svgGroup.setAttributeNS(e.utils.dom.XLINK_NS,"xlink:href",n),e.utils.dom.insertAfter(this.svgGroup,this.workspace.getBubbleCanvas()),this.onZoomToFitWrapper=e.browserEvents.conditionalBind(this.svgGroup,"pointerdown",null,this.onClick.bind(this))}onClick(t){this.workspace.zoomToFit();const n=new(e.Events.get(e.Events.CLICK))(null,this.workspace.id,"zoom_reset_control");e.Events.fire(n),t.stopPropagation(),t.preventDefault()}getBoundingRectangle(){return new e.utils.Rect(this.top,this.top+this.height,this.left,this.left+this.width)}position(t,n){var o;if(!this.initialized)return;const r=this.workspace.scrollbar&&this.workspace.scrollbar.canScrollHorizontally(),i=this.workspace.scrollbar&&this.workspace.scrollbar.canScrollVertically();t.toolboxMetrics.position===e.TOOLBOX_AT_LEFT||this.workspace.horizontalLayout&&!this.workspace.RTL?(this.left=t.absoluteMetrics.left+t.viewMetrics.width-this.width-this.marginHorizontal,r&&!this.workspace.RTL&&(this.left-=e.Scrollbar.scrollbarThickness)):(this.left=this.marginHorizontal,r&&this.workspace.RTL&&(this.left+=e.Scrollbar.scrollbarThickness));const s=t.toolboxMetrics.position!==e.TOOLBOX_AT_BOTTOM;s?(this.top=t.absoluteMetrics.top+t.viewMetrics.height-this.height-this.marginVertical,i&&(this.top-=e.Scrollbar.scrollbarThickness)):this.top=t.absoluteMetrics.top+this.marginVertical;let a=this.getBoundingRectangle();for(let e,l=0;e=n[l];l++)a.intersects(e)&&(this.top=s?e.top-this.height-this.marginVertical:e.bottom+this.marginVertical,a=this.getBoundingRectangle(),l=-1);null===(o=this.svgGroup)||void 0===o||o.setAttribute("transform","translate(".concat(this.left,", ").concat(this.top,")"))}}const n="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjRweCIgZmlsbD0iIzU0NkU3QSI+PHBhdGggZD0iTTAgMGgyNHYyNEgwVjB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTUgNi40Mkw4LjA5IDkuNSA5LjUgOC4wOSA2LjQxIDVIOVYzSDN2Nmgyem0xMC0zLjQxdjJoMi41N0wxNC41IDguMDlsMS40MSAxLjQxTDE5IDYuNDFWOWgyVjMuMDF6bTQgMTQuNTdsLTMuMDktMy4wOC0xLjQxIDEuNDFMMTcuNTkgMTlIMTV2Mmg2di02aC0yek04LjA5IDE0LjVMNSAxNy41OVYxNUgzdjZoNnYtMkg2LjQybDMuMDgtMy4wOXoiLz48L3N2Zz4=";e.Css.register("\n.zoomToFit {\n opacity: 0.4;\n}\n.zoomToFit:hover {\n opacity: 0.6;\n}\n.zoomToFit:active {\n opacity: 0.8;\n}\n")})(),r})(),e.exports=o(n(72560))},25243:(e,t,n)=>{"use strict";n.d(t,{A:()=>re});var o=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t0?u(v,--_):0,m--,10===T&&(m=1,g--),T}function S(){return T=_2||$(T)>3?"":" "}function L(e,t){for(;--t&&S()&&!(T<48||T>102||T>57&&T<65||T>70&&T<97););return k(e,C()+(t<6&&32==w()&&32==S()))}function N(e){for(;S();)switch(T){case e:return _;case 34:case 39:34!==e&&39!==e&&N(T);break;case 40:41===e&&N(e);break;case 92:S()}return _}function M(e,t){for(;S()&&e+T!==57&&(e+T!==84||47!==w()););return"/*"+k(t,_-1)+"*"+i(47===e?e:S())}function D(e){for(;!$(w());)S();return k(e,_)}var P="-ms-",B="-moz-",F="-webkit-",U="comm",H="rule",G="decl",V="@keyframes";function W(e,t){for(var n="",o=p(e),r=0;r0&&d(B)-b&&f(T>32?J(B+";",o,n,b-1):J(l(B," ","")+";",o,n,b-2),p);break;case 59:B+=";";default:if(f(P=Y(B,t,n,g,m,r,h,A,O=[],N=[],b),s),123===$)if(0===m)X(B,t,P,P,O,s,b,h,N);else switch(99===_&&110===u(B,3)?100:_){case 100:case 108:case 109:case 115:X(e,P,P,o&&f(Y(e,P,P,0,0,r,h,A,r,O=[],b),N),r,N,b,h,o?O:N);break;default:X(B,P,P,P,[""],N,0,h,N)}}g=m=T=0,y=k=1,A=B="",b=a;break;case 58:b=1+d(B),T=v;default:if(y<1)if(123==$)--y;else if(125==$&&0==y++&&125==I())continue;switch(B+=i($),$*y){case 38:k=m>0?1:(B+="\f",-1);break;case 44:h[g++]=(d(B)-1)*k,k=1;break;case 64:45===w()&&(B+=R(S())),_=w(),m=b=d(A=B+=D(C())),$++;break;case 45:45===v&&2==d(B)&&(y=0)}}return s}function Y(e,t,n,o,i,s,c,u,d,f,g){for(var m=i-1,b=0===i?s:[""],_=p(b),T=0,v=0,E=0;T0?b[I]+" "+S:l(S,/&\f/g,b[I])))&&(d[E++]=w);return y(e,t,n,0===i?H:u,d,f,g)}function K(e,t,n){return y(e,t,n,U,i(T),h(e,2,-2),0)}function J(e,t,n,o){return y(e,t,n,G,h(e,0,o),h(e,o+1,-1),o)}var q=function(e,t,n){for(var o=0,r=0;o=r,r=w(),38===o&&12===r&&(t[n]=1),!$(r);)S();return k(e,_)},Z=function(e,t){return O(function(e,t){var n=-1,o=44;do{switch($(o)){case 0:38===o&&12===w()&&(t[n]=1),e[n]+=q(_-1,t,n);break;case 2:e[n]+=R(o);break;case 4:if(44===o){e[++n]=58===w()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=i(o)}}while(o=S());return e}(A(e),t))},Q=new WeakMap,ee=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,o=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Q.get(n))&&!o){Q.set(e,!0);for(var r=[],i=Z(t,r),s=n.props,a=0,l=0;a6)switch(u(e,t+1)){case 109:if(45!==u(e,t+4))break;case 102:return l(e,/(.+:)(.+)-([^]+)/,"$1"+F+"$2-$3$1"+B+(108==u(e,t+3)?"$3":"$2-$3"))+e;case 115:return~c(e,"stretch")?ne(l(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==u(e,t+1))break;case 6444:switch(u(e,d(e)-3-(~c(e,"!important")&&10))){case 107:return l(e,":",":"+F)+e;case 101:return l(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+F+(45===u(e,14)?"inline-":"")+"box$3$1"+F+"$2$3$1"+P+"$2box$3")+e}break;case 5936:switch(u(e,t+11)){case 114:return F+e+P+l(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return F+e+P+l(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return F+e+P+l(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return F+e+P+e+e}return e}var oe=[function(e,t,n,o){if(e.length>-1&&!e.return)switch(e.type){case G:e.return=ne(e.value,e.length);break;case V:return W([E(e,{value:l(e.value,"@","@"+F)})],o);case H:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=t.exec(e))?e[0]:e}(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return W([E(e,{props:[l(t,/:(read-\w+)/,":-moz-$1")]})],o);case"::placeholder":return W([E(e,{props:[l(t,/:(plac\w+)/,":"+F+"input-$1")]}),E(e,{props:[l(t,/:(plac\w+)/,":-moz-$1")]}),E(e,{props:[l(t,/:(plac\w+)/,P+"input-$1")]})],o)}return""}))}}],re=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r=e.stylisPlugins||oe;var i,s,a={},l=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n{"use strict";function o(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}n.d(t,{A:()=>o})},3934:(e,t,n)=>{"use strict";n.d(t,{T:()=>a,w:()=>s});var o=n(27565),r=n(25243),i=(n(74013),n(96714),(0,o.createContext)("undefined"!==typeof HTMLElement?(0,r.A)({key:"css"}):null));i.Provider;var s=function(e){return(0,o.forwardRef)((function(t,n){var r=(0,o.useContext)(i);return e(t,r,n)}))},a=(0,o.createContext)({})},74013:(e,t,n)=>{"use strict";n.d(t,{J:()=>f});var o={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},r=n(35208),i=/[A-Z]|^ms/g,s=/_EMO_([^_]+?)_([^]*?)_EMO_/g,a=function(e){return 45===e.charCodeAt(1)},l=function(e){return null!=e&&"boolean"!==typeof e},c=(0,r.A)((function(e){return a(e)?e:e.replace(i,"-$&").toLowerCase()})),u=function(e,t){switch(e){case"animation":case"animationName":if("string"===typeof t)return t.replace(s,(function(e,t,n){return d={name:t,styles:n,next:d},t}))}return 1===o[e]||a(e)||"number"!==typeof t||0===t?t:t+"px"};function h(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return d={name:n.name,styles:n.styles,next:d},n.name;if(void 0!==n.styles){var o=n.next;if(void 0!==o)for(;void 0!==o;)d={name:o.name,styles:o.styles,next:d},o=o.next;return n.styles+";"}return function(e,t,n){var o="";if(Array.isArray(n))for(var r=0;r=4;++o,r-=4)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(r)+l;return{name:c,styles:r,next:d}}},96714:(e,t,n)=>{"use strict";var o;n.d(t,{i:()=>a,s:()=>s});var r=n(27565),i=!!(o||(o=n.t(r,2))).useInsertionEffect&&(o||(o=n.t(r,2))).useInsertionEffect,s=i||function(e){return e()},a=i||r.useLayoutEffect},58592:(e,t,n)=>{"use strict";n.d(t,{Rk:()=>o,SF:()=>r,sk:()=>i});function o(e,t,n){var o="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):o+=n+" "})),o}var r=function(e,t,n){var o=e.key+"-"+t.name;!1===n&&void 0===e.registered[o]&&(e.registered[o]=t.styles)},i=function(e,t,n){r(e,t,n);var o=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var i=t;do{e.insert(t===i?"."+o:"",i,e.sheet,!0),i=i.next}while(void 0!==i)}}},25104:(e,t,n)=>{"use strict";var o=n(24994);t.A=void 0;var r=o(n(20549)),i=n(27929),s=(0,r.default)((0,i.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");t.A=s},67001:(e,t,n)=>{"use strict";var o=n(24994);t.A=void 0;var r=o(n(20549)),i=n(27929),s=(0,r.default)((0,i.jsx)("path",{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"}),"Menu");t.A=s},24616:(e,t,n)=>{"use strict";var o=n(24994);t.A=void 0;var r=o(n(20549)),i=n(27929),s=(0,r.default)((0,i.jsx)("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send");t.A=s},20549:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o.createSvgIcon}});var o=n(60811)},80402:(e,t,n)=>{"use strict";n.d(t,{A:()=>P});var o=n(58168),r=n(98587),i=n(49838),s=n(5382),a=n(43647);var l=n(63937);const c={black:"#000",white:"#fff"},u={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},h={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},d={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},p={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},f={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},g={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},m={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},b=["mode","contrastThreshold","tonalOffset"],_={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:c.white,default:c.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},T={text:{primary:c.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:c.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function v(e,t,n,o){const r=o.light||o,i=o.dark||1.5*o;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:"light"===t?e.light=(0,l.a)(e.main,r):"dark"===t&&(e.dark=(0,l.e$)(e.main,i)))}function y(e){const{mode:t="light",contrastThreshold:n=3,tonalOffset:a=.2}=e,y=(0,r.A)(e,b),E=e.primary||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:f[200],light:f[50],dark:f[400]}:{main:f[700],light:f[400],dark:f[800]}}(t),I=e.secondary||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:h[200],light:h[50],dark:h[400]}:{main:h[500],light:h[300],dark:h[700]}}(t),S=e.error||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:d[500],light:d[300],dark:d[700]}:{main:d[700],light:d[400],dark:d[800]}}(t),w=e.info||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:g[400],light:g[300],dark:g[700]}:{main:g[700],light:g[500],dark:g[900]}}(t),C=e.success||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:m[400],light:m[300],dark:m[700]}:{main:m[800],light:m[500],dark:m[900]}}(t),k=e.warning||function(){return"dark"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light")?{main:p[400],light:p[300],dark:p[700]}:{main:"#ed6c02",light:p[500],dark:p[900]}}(t);function $(e){return(0,l.eM)(e,T.text.primary)>=n?T.text.primary:_.text.primary}const A=e=>{let{color:t,name:n,mainShade:r=500,lightShade:s=300,darkShade:l=700}=e;if(t=(0,o.A)({},t),!t.main&&t[r]&&(t.main=t[r]),!t.hasOwnProperty("main"))throw new Error((0,i.A)(11,n?" (".concat(n,")"):"",r));if("string"!==typeof t.main)throw new Error((0,i.A)(12,n?" (".concat(n,")"):"",JSON.stringify(t.main)));return v(t,"light",s,a),v(t,"dark",l,a),t.contrastText||(t.contrastText=$(t.main)),t},O={dark:T,light:_};return(0,s.A)((0,o.A)({common:(0,o.A)({},c),mode:t,primary:A({color:E,name:"primary"}),secondary:A({color:I,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:A({color:S,name:"error"}),warning:A({color:k,name:"warning"}),info:A({color:w,name:"info"}),success:A({color:C,name:"success"}),grey:u,contrastThreshold:n,getContrastText:$,augmentColor:A,tonalOffset:a},O[t]),y)}const E=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];const I={textTransform:"uppercase"},S='"Roboto", "Helvetica", "Arial", sans-serif';function w(e,t){const n="function"===typeof t?t(e):t,{fontFamily:i=S,fontSize:a=14,fontWeightLight:l=300,fontWeightRegular:c=400,fontWeightMedium:u=500,fontWeightBold:h=700,htmlFontSize:d=16,allVariants:p,pxToRem:f}=n,g=(0,r.A)(n,E);const m=a/14,b=f||(e=>"".concat(e/d*m,"rem")),_=(e,t,n,r,s)=>{return(0,o.A)({fontFamily:i,fontWeight:e,fontSize:b(t),lineHeight:n},i===S?{letterSpacing:"".concat((a=r/t,Math.round(1e5*a)/1e5),"em")}:{},s,p);var a},T={h1:_(l,96,1.167,-1.5),h2:_(l,60,1.2,-.5),h3:_(c,48,1.167,0),h4:_(c,34,1.235,.25),h5:_(c,24,1.334,0),h6:_(u,20,1.6,.15),subtitle1:_(c,16,1.75,.15),subtitle2:_(u,14,1.57,.1),body1:_(c,16,1.5,.15),body2:_(c,14,1.43,.15),button:_(u,14,1.75,.4,I),caption:_(c,12,1.66,.4),overline:_(c,12,2.66,1,I)};return(0,s.A)((0,o.A)({htmlFontSize:d,pxToRem:b,fontFamily:i,fontSize:a,fontWeightLight:l,fontWeightRegular:c,fontWeightMedium:u,fontWeightBold:h},T),g,{clone:!1})}function C(){return["".concat(arguments.length<=0?void 0:arguments[0],"px ").concat(arguments.length<=1?void 0:arguments[1],"px ").concat(arguments.length<=2?void 0:arguments[2],"px ").concat(arguments.length<=3?void 0:arguments[3],"px rgba(0,0,0,").concat(.2,")"),"".concat(arguments.length<=4?void 0:arguments[4],"px ").concat(arguments.length<=5?void 0:arguments[5],"px ").concat(arguments.length<=6?void 0:arguments[6],"px ").concat(arguments.length<=7?void 0:arguments[7],"px rgba(0,0,0,").concat(.14,")"),"".concat(arguments.length<=8?void 0:arguments[8],"px ").concat(arguments.length<=9?void 0:arguments[9],"px ").concat(arguments.length<=10?void 0:arguments[10],"px ").concat(arguments.length<=11?void 0:arguments[11],"px rgba(0,0,0,").concat(.12,")")].join(",")}const k=["none",C(0,2,1,-1,0,1,1,0,0,1,3,0),C(0,3,1,-2,0,2,2,0,0,1,5,0),C(0,3,3,-2,0,3,4,0,0,1,8,0),C(0,2,4,-1,0,4,5,0,0,1,10,0),C(0,3,5,-1,0,5,8,0,0,1,14,0),C(0,3,5,-1,0,6,10,0,0,1,18,0),C(0,4,5,-2,0,7,10,1,0,2,16,1),C(0,5,5,-3,0,8,10,1,0,3,14,2),C(0,5,6,-3,0,9,12,1,0,3,16,2),C(0,6,6,-3,0,10,14,1,0,4,18,3),C(0,6,7,-4,0,11,15,1,0,4,20,3),C(0,7,8,-4,0,12,17,2,0,5,22,4),C(0,7,8,-4,0,13,19,2,0,5,24,4),C(0,7,9,-4,0,14,21,2,0,5,26,4),C(0,8,9,-5,0,15,22,2,0,6,28,5),C(0,8,10,-5,0,16,24,2,0,6,30,5),C(0,8,11,-5,0,17,26,2,0,6,32,5),C(0,9,11,-5,0,18,28,2,0,7,34,6),C(0,9,12,-6,0,19,29,2,0,7,36,6),C(0,10,13,-6,0,20,31,3,0,8,38,7),C(0,10,13,-6,0,21,33,3,0,8,40,7),C(0,10,14,-6,0,22,35,3,0,8,42,7),C(0,11,14,-7,0,23,36,3,0,9,44,8),C(0,11,15,-7,0,24,38,3,0,9,46,8)],$=["duration","easing","delay"],A={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},O={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function R(e){return"".concat(Math.round(e),"ms")}function x(e){if(!e)return 0;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}function L(e){const t=(0,o.A)({},A,e.easing),n=(0,o.A)({},O,e.duration);return(0,o.A)({getAutoHeightDuration:x,create:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["all"],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{duration:i=n.standard,easing:s=t.easeInOut,delay:a=0}=o;(0,r.A)(o,$);return(Array.isArray(e)?e:[e]).map((e=>"".concat(e," ").concat("string"===typeof i?i:R(i)," ").concat(s," ").concat("string"===typeof a?a:R(a)))).join(",")}},e,{easing:t,duration:n})}const N={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},M=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function D(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{mixins:t={},palette:n={},transitions:l={},typography:c={}}=e,u=(0,r.A)(e,M);if(e.vars)throw new Error((0,i.A)(18));const h=y(n),d=(0,a.A)(e);let p=(0,s.A)(d,{mixins:(f=d.breakpoints,g=t,(0,o.A)({toolbar:{minHeight:56,[f.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[f.up("sm")]:{minHeight:64}}},g)),palette:h,shadows:k.slice(),typography:w(h,c),transitions:L(l),zIndex:(0,o.A)({},N)});var f,g;p=(0,s.A)(p,u);for(var m=arguments.length,b=new Array(m>1?m-1:0),_=1;_(0,s.A)(e,t)),p),p}const P=D},27996:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=(0,n(80402).A)()},30359:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>E,ep:()=>T,_n:()=>v});var o=n(58168),r=n(98587),i=n(74843),s=n(5382),a=n(43647),l=n(15514);const c=["ownerState"],u=["variants"],h=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function d(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const p=(0,a.A)(),f=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function g(e){let{defaultTheme:t,theme:n,themeId:o}=e;return r=n,0===Object.keys(r).length?t:n[o]||n;var r}function m(e){return e?(t,n)=>n[e]:null}function b(e,t){let{ownerState:n}=t,i=(0,r.A)(t,c);const s="function"===typeof e?e((0,o.A)({ownerState:n},i)):e;if(Array.isArray(s))return s.flatMap((e=>b(e,(0,o.A)({ownerState:n},i))));if(s&&"object"===typeof s&&Array.isArray(s.variants)){const{variants:e=[]}=s;let t=(0,r.A)(s,u);return e.forEach((e=>{let r=!0;"function"===typeof e.props?r=e.props((0,o.A)({ownerState:n},i,n)):Object.keys(e.props).forEach((t=>{(null==n?void 0:n[t])!==e.props[t]&&i[t]!==e.props[t]&&(r=!1)})),r&&(Array.isArray(t)||(t=[t]),t.push("function"===typeof e.style?e.style((0,o.A)({ownerState:n},i,n)):e.style))})),t}return s}var _=n(27996);const T=e=>d(e)&&"classes"!==e,v=d,y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{themeId:t,defaultTheme:n=p,rootShouldForwardProp:a=d,slotShouldForwardProp:c=d}=e,u=e=>(0,l.A)((0,o.A)({},e,{theme:g((0,o.A)({},e,{defaultTheme:n,themeId:t}))}));return u.__mui_systemSx=!0,function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,i.q_)(e,(e=>e.filter((e=>!(null!=e&&e.__mui_systemSx)))));const{name:p,slot:_,skipVariantsResolver:T,skipSx:v,overridesResolver:y=m(f(_))}=l,E=(0,r.A)(l,h),I=void 0!==T?T:_&&"Root"!==_&&"root"!==_||!1,S=v||!1;let w=d;"Root"===_||"root"===_?w=a:_?w=c:function(e){return"string"===typeof e&&e.charCodeAt(0)>96}(e)&&(w=void 0);const C=(0,i.Ay)(e,(0,o.A)({shouldForwardProp:w,label:undefined},E)),k=e=>"function"===typeof e&&e.__emotion_real!==e||(0,s.Q)(e)?r=>b(e,(0,o.A)({},r,{theme:g({theme:r.theme,defaultTheme:n,themeId:t})})):e,$=function(r){let i=k(r);for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l{const r=g((0,o.A)({},e,{defaultTheme:n,themeId:t}));if(!r.components||!r.components[p]||!r.components[p].styleOverrides)return null;const i=r.components[p].styleOverrides,s={};return Object.entries(i).forEach((t=>{let[n,i]=t;s[n]=b(i,(0,o.A)({},e,{theme:r}))})),y(e,s)})),p&&!I&&c.push((e=>{var r;const i=g((0,o.A)({},e,{defaultTheme:n,themeId:t}));return b({variants:null==i||null==(r=i.components)||null==(r=r[p])?void 0:r.variants},(0,o.A)({},e,{theme:i}))})),S||c.push(u);const h=c.length-a.length;if(Array.isArray(r)&&h>0){const e=new Array(h).fill("");i=[...r,...e],i.raw=[...r.raw,...e]}const d=C(i,...c);return e.muiName&&(d.muiName=e.muiName),d};return C.withConfig&&($.withConfig=C.withConfig),$}}({defaultTheme:_.A,rootShouldForwardProp:T}),E=y},28167:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var o=n(30965),r=n(75841);var i=n(27996);function s(e){let{props:t,name:n}=e;return function(e){let{props:t,name:n,defaultTheme:i,themeId:s}=e,a=(0,r.A)(i);return s&&(a=a[s]||a),(0,o.A)({theme:a,name:n,props:t})}({props:t,name:n,defaultTheme:i.A})}},63777:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(11728).A},48063:(e,t,n)=>{"use strict";n.d(t,{A:()=>T});var o=n(58168),r=n(27565),i=n(98587),s=n(58854),a=n(68788),l=n(63777),c=n(28167),u=n(30359),h=n(31406),d=n(92230);function p(e){return(0,d.Ay)("MuiSvgIcon",e)}(0,h.A)("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);var f=n(27929);const g=["children","className","color","component","fontSize","htmlColor","inheritViewBox","titleAccess","viewBox"],m=(0,u.Ay)("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,"inherit"!==n.color&&t["color".concat((0,l.A)(n.color))],t["fontSize".concat((0,l.A)(n.fontSize))]]}})((e=>{let{theme:t,ownerState:n}=e;var o,r,i,s,a,l,c,u,h,d,p,f,g,m,b,_,T;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0,transition:null==(o=t.transitions)||null==(r=o.create)?void 0:r.call(o,"fill",{duration:null==(i=t.transitions)||null==(s=i.duration)?void 0:s.shorter}),fontSize:{inherit:"inherit",small:(null==(a=t.typography)||null==(l=a.pxToRem)?void 0:l.call(a,20))||"1.25rem",medium:(null==(c=t.typography)||null==(u=c.pxToRem)?void 0:u.call(c,24))||"1.5rem",large:(null==(h=t.typography)||null==(d=h.pxToRem)?void 0:d.call(h,35))||"2.1875rem"}[n.fontSize],color:null!=(p=null==(f=(t.vars||t).palette)||null==(g=f[n.color])?void 0:g.main)?p:{action:null==(m=(t.vars||t).palette)||null==(b=m.action)?void 0:b.active,disabled:null==(_=(t.vars||t).palette)||null==(T=_.action)?void 0:T.disabled,inherit:void 0}[n.color]}})),b=r.forwardRef((function(e,t){const n=(0,c.A)({props:e,name:"MuiSvgIcon"}),{children:r,className:u,color:h="inherit",component:d="svg",fontSize:b="medium",htmlColor:_,inheritViewBox:T=!1,titleAccess:v,viewBox:y="0 0 24 24"}=n,E=(0,i.A)(n,g),I=(0,o.A)({},n,{color:h,component:d,fontSize:b,instanceFontSize:e.fontSize,inheritViewBox:T,viewBox:y}),S={};T||(S.viewBox=y);const w=(e=>{const{color:t,fontSize:n,classes:o}=e,r={root:["root","inherit"!==t&&"color".concat((0,l.A)(t)),"fontSize".concat((0,l.A)(n))]};return(0,a.A)(r,p,o)})(I);return(0,f.jsxs)(m,(0,o.A)({as:d,className:(0,s.A)(w.root,u),focusable:"false",color:_,"aria-hidden":!v||void 0,role:v?"img":void 0,ref:t},S,E,{ownerState:I,children:[r,v?(0,f.jsx)("title",{children:v}):null]}))}));b.muiName="SvgIcon";const _=b;function T(e,t){function n(n,r){return(0,f.jsx)(_,(0,o.A)({"data-testid":"".concat(t,"Icon"),ref:r},n,{children:e}))}return n.muiName=_.muiName,r.memo(r.forwardRef(n))}},65524:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(43182).A},60811:(e,t,n)=>{"use strict";n.r(t),n.d(t,{capitalize:()=>r.A,createChainedFunction:()=>i,createSvgIcon:()=>s.A,debounce:()=>a.A,deprecatedPropType:()=>l,isMuiElement:()=>c.A,ownerDocument:()=>u.A,ownerWindow:()=>h.A,requirePropFactory:()=>d,setRef:()=>p,unstable_ClassNameGenerator:()=>y,unstable_useEnhancedEffect:()=>f.A,unstable_useId:()=>g,unsupportedProp:()=>m,useControlled:()=>b.A,useEventCallback:()=>_.A,useForkRef:()=>T.A,useIsFocusVisible:()=>v.A});var o=n(50852),r=n(63777);const i=n(50714).A;var s=n(48063),a=n(65524);const l=function(e,t){return()=>null};var c=n(41501),u=n(36497),h=n(31264);n(58168);const d=function(e,t){return()=>null};const p=n(91334).A;var f=n(95267);const g=n(74654).A;const m=function(e,t,n,o,r){return null};var b=n(97022),_=n(24737),T=n(45523),v=n(12085);const y={configure:e=>{console.warn(["MUI: `ClassNameGenerator` import from `@mui/material/utils` is outdated and might cause unexpected issues.","","You should use `import { unstable_ClassNameGenerator } from '@mui/material/className'` instead","","The detail of the issue: https://github.com/mui/material-ui/issues/30011#issuecomment-1024993401","","The updated documentation: https://mui.com/guides/classname-generator/"].join("\n")),o.A.configure(e)}}},41501:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(27565);const r=function(e,t){var n,r;return o.isValidElement(e)&&-1!==t.indexOf(null!=(n=e.type.muiName)?n:null==(r=e.type)||null==(r=r._payload)||null==(r=r.value)?void 0:r.muiName)}},36497:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(25062).A},31264:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(46814).A},97022:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(93614).A},95267:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(45874).A},24737:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(33624).A},45523:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});const o=n(92328).A},12085:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var o=n(27565);class r{constructor(){this.currentId=null,this.clear=()=>{null!==this.currentId&&(clearTimeout(this.currentId),this.currentId=null)},this.disposeEffect=()=>this.clear}static create(){return new r}start(e,t){this.clear(),this.currentId=setTimeout((()=>{this.currentId=null,t()}),e)}}let i=!0,s=!1;const a=new r,l={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function c(e){e.metaKey||e.altKey||e.ctrlKey||(i=!0)}function u(){i=!1}function h(){"hidden"===this.visibilityState&&s&&(i=!0)}function d(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch(n){}return i||function(e){const{type:t,tagName:n}=e;return!("INPUT"!==n||!l[t]||e.readOnly)||"TEXTAREA"===n&&!e.readOnly||!!e.isContentEditable}(t)}const p=function(){const e=o.useCallback((e=>{var t;null!=e&&((t=e.ownerDocument).addEventListener("keydown",c,!0),t.addEventListener("mousedown",u,!0),t.addEventListener("pointerdown",u,!0),t.addEventListener("touchstart",u,!0),t.addEventListener("visibilitychange",h,!0))}),[]),t=o.useRef(!1);return{isFocusVisibleRef:t,onFocus:function(e){return!!d(e)&&(t.current=!0,!0)},onBlur:function(){return!!t.current&&(s=!0,a.start(100,(()=>{s=!1})),t.current=!1,!0)},ref:e}}},74843:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>v,q_:()=>y});var o=n(27565),r=n(58168),i=n(35208),s=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,a=(0,i.A)((function(e){return s.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91})),l=n(3934),c=n(58592),u=n(74013),h=n(96714),d=a,p=function(e){return"theme"!==e},f=function(e){return"string"===typeof e&&e.charCodeAt(0)>96?d:p},g=function(e,t,n){var o;if(t){var r=t.shouldForwardProp;o=e.__emotion_forwardProp&&r?function(t){return e.__emotion_forwardProp(t)&&r(t)}:r}return"function"!==typeof o&&n&&(o=e.__emotion_forwardProp),o},m=function(e){var t=e.cache,n=e.serialized,o=e.isStringTag;(0,c.SF)(t,n,o);(0,h.s)((function(){return(0,c.sk)(t,n,o)}));return null};const b=function e(t,n){var i,s,a=t.__emotion_real===t,h=a&&t.__emotion_base||t;void 0!==n&&(i=n.label,s=n.target);var d=g(t,n,a),p=d||f(h),b=!p("as");return function(){var _=arguments,T=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==i&&T.push("label:"+i+";"),null==_[0]||void 0===_[0].raw)T.push.apply(T,_);else{0,T.push(_[0][0]);for(var v=_.length,y=1;y{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}},60129:(e,t,n)=>{"use strict";n.d(t,{EU:()=>s,NI:()=>i,vf:()=>a,zu:()=>o});const o={xs:0,sm:600,md:900,lg:1200,xl:1536},r={keys:["xs","sm","md","lg","xl"],up:e=>"@media (min-width:".concat(o[e],"px)")};function i(e,t,n){const i=e.theme||{};if(Array.isArray(t)){const e=i.breakpoints||r;return t.reduce(((o,r,i)=>(o[e.up(e.keys[i])]=n(t[i]),o)),{})}if("object"===typeof t){const e=i.breakpoints||r;return Object.keys(t).reduce(((r,i)=>{if(-1!==Object.keys(e.values||o).indexOf(i)){r[e.up(i)]=n(t[i],i)}else{const e=i;r[e]=t[e]}return r}),{})}return n(t)}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;return(null==(t=e.keys)?void 0:t.reduce(((t,n)=>(t[e.up(n)]={},t)),{}))||{}}function a(e,t){return e.reduce(((e,t)=>{const n=e[t];return(!n||0===Object.keys(n).length)&&delete e[t],e}),t)}},63937:(e,t,n)=>{"use strict";n.d(t,{X4:()=>u,e$:()=>h,tL:()=>p,eM:()=>c,a:()=>d});var o=n(49838);const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MIN_SAFE_INTEGER,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.MAX_SAFE_INTEGER;return Math.max(t,Math.min(e,n))};function i(e){return r(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)}function s(e){if(e.type)return e;if("#"===e.charAt(0))return s(function(e){e=e.slice(1);const t=new RegExp(".{1,".concat(e.length>=6?2:1,"}"),"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?"rgb".concat(4===n.length?"a":"","(").concat(n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", "),")"):""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error((0,o.A)(9,e));let r,i=e.substring(t+1,e.length-1);if("color"===n){if(i=i.split(" "),r=i.shift(),4===i.length&&"/"===i[3].charAt(0)&&(i[3]=i[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(r))throw new Error((0,o.A)(10,r))}else i=i.split(",");return i=i.map((e=>parseFloat(e))),{type:n,values:i,colorSpace:r}}function a(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]="".concat(o[1],"%"),o[2]="".concat(o[2],"%")),o=-1!==t.indexOf("color")?"".concat(n," ").concat(o.join(" ")):"".concat(o.join(", ")),"".concat(t,"(").concat(o,")")}function l(e){let t="hsl"===(e=s(e)).type||"hsla"===e.type?s(function(e){e=s(e);const{values:t}=e,n=t[0],o=t[1]/100,r=t[2]/100,i=o*Math.min(r,1-r),l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(e+n/30)%12;return r-i*Math.max(Math.min(t-3,9-t,1),-1)};let c="rgb";const u=[Math.round(255*l(0)),Math.round(255*l(8)),Math.round(255*l(4))];return"hsla"===e.type&&(c+="a",u.push(t[3])),a({type:c,values:u})}(e)).values:e.values;return t=t.map((t=>("color"!==e.type&&(t/=255),t<=.03928?t/12.92:((t+.055)/1.055)**2.4))),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function c(e,t){const n=l(e),o=l(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function u(e,t){return e=s(e),t=i(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]="/".concat(t):e.values[3]=t,a(e)}function h(e,t){if(e=s(e),t=i(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return a(e)}function d(e,t){if(e=s(e),t=i(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return a(e)}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.15;return l(e)>.5?h(e,t):d(e,t)}},43647:(e,t,n)=>{"use strict";n.d(t,{A:()=>f});var o=n(58168),r=n(98587),i=n(5382);const s=["values","unit","step"],a=e=>{const t=Object.keys(e).map((t=>({key:t,val:e[t]})))||[];return t.sort(((e,t)=>e.val-t.val)),t.reduce(((e,t)=>(0,o.A)({},e,{[t.key]:t.val})),{})};const l={borderRadius:4};var c=n(3742);var u=n(15514),h=n(92346);function d(e,t){const n=this;if(n.vars&&"function"===typeof n.getColorSchemeSelector){const o=n.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)");return{[o]:t}}return n.palette.mode===e?t:{}}const p=["breakpoints","palette","spacing","shape"];const f=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{breakpoints:t={},palette:n={},spacing:f,shape:g={}}=e,m=(0,r.A)(e,p),b=function(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:i=5}=e,l=(0,r.A)(e,s),c=a(t),u=Object.keys(c);function h(e){const o="number"===typeof t[e]?t[e]:e;return"@media (min-width:".concat(o).concat(n,")")}function d(e){const o="number"===typeof t[e]?t[e]:e;return"@media (max-width:".concat(o-i/100).concat(n,")")}function p(e,o){const r=u.indexOf(o);return"@media (min-width:".concat("number"===typeof t[e]?t[e]:e).concat(n,") and ")+"(max-width:".concat((-1!==r&&"number"===typeof t[u[r]]?t[u[r]]:o)-i/100).concat(n,")")}return(0,o.A)({keys:u,values:c,up:h,down:d,between:p,only:function(e){return u.indexOf(e)+10&&void 0!==arguments[0]?arguments[0]:8;if(e.mui)return e;const t=(0,c.LX)({spacing:e}),n=function(){for(var e=arguments.length,n=new Array(e),o=0;o{const n=t(e);return"number"===typeof n?"".concat(n,"px"):n})).join(" ")};return n.mui=!0,n}(f);let T=(0,i.A)({breakpoints:b,direction:"ltr",components:{},palette:(0,o.A)({mode:"light"},n),spacing:_,shape:(0,o.A)({},l,g)},m);T.applyStyles=d;for(var v=arguments.length,y=new Array(v>1?v-1:0),E=1;E(0,i.A)(e,t)),T),T.unstable_sxConfig=(0,o.A)({},h.A,null==m?void 0:m.unstable_sxConfig),T.unstable_sx=function(e){return(0,u.A)({sx:e,theme:this})},T}},14953:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(5382);const r=function(e,t){return t?(0,o.A)(e,t,{clone:!1}):e}},3742:(e,t,n)=>{"use strict";n.d(t,{LX:()=>f,MA:()=>p,_W:()=>g,Lc:()=>_,Ms:()=>T});var o=n(60129),r=n(32256),i=n(14953);const s={m:"margin",p:"padding"},a={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},l={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},c=function(e){const t={};return n=>(void 0===t[n]&&(t[n]=e(n)),t[n])}((e=>{if(e.length>2){if(!l[e])return[e];e=l[e]}const[t,n]=e.split(""),o=s[t],r=a[n]||"";return Array.isArray(r)?r.map((e=>o+e)):[o+r]})),u=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],h=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],d=[...u,...h];function p(e,t,n,o){var i;const s=null!=(i=(0,r.Yn)(e,t,!1))?i:n;return"number"===typeof s?e=>"string"===typeof e?e:s*e:Array.isArray(s)?e=>"string"===typeof e?e:s[e]:"function"===typeof s?s:()=>{}}function f(e){return p(e,"spacing",8)}function g(e,t){if("string"===typeof t||null==t)return t;const n=e(Math.abs(t));return t>=0?n:"number"===typeof n?-n:"-".concat(n)}function m(e,t,n,r){if(-1===t.indexOf(n))return null;const i=function(e,t){return n=>e.reduce(((e,o)=>(e[o]=g(t,n),e)),{})}(c(n),r),s=e[n];return(0,o.NI)(e,s,i)}function b(e,t){const n=f(e.theme);return Object.keys(e).map((o=>m(e,t,o,n))).reduce(i.A,{})}function _(e){return b(e,u)}function T(e){return b(e,h)}function v(e){return b(e,d)}_.propTypes={},_.filterProps=u,T.propTypes={},T.filterProps=h,v.propTypes={},v.filterProps=d},32256:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>a,BO:()=>s,Yn:()=>i});var o=n(11728),r=n(60129);function i(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t||"string"!==typeof t)return null;if(e&&e.vars&&n){const n="vars.".concat(t).split(".").reduce(((e,t)=>e&&e[t]?e[t]:null),e);if(null!=n)return n}return t.split(".").reduce(((e,t)=>e&&null!=e[t]?e[t]:null),e)}function s(e,t,n){let o,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;return o="function"===typeof e?e(n):Array.isArray(e)?e[n]||r:i(e,n)||r,t&&(o=t(o,r,e)),o}const a=function(e){const{prop:t,cssProperty:n=e.prop,themeKey:a,transform:l}=e,c=e=>{if(null==e[t])return null;const c=e[t],u=i(e.theme,a)||{};return(0,r.NI)(e,c,(e=>{let r=s(u,l,e);return e===r&&"string"===typeof e&&(r=s(u,l,"".concat(t).concat("default"===e?"":(0,o.A)(e)),e)),!1===n?r:{[n]:r}}))};return c.propTypes={},c.filterProps=[t],c}},92346:(e,t,n)=>{"use strict";n.d(t,{A:()=>N});var o=n(3742),r=n(32256),i=n(14953);const s=function(){for(var e=arguments.length,t=new Array(e),n=0;n(t.filterProps.forEach((n=>{e[n]=t})),e)),{}),r=e=>Object.keys(e).reduce(((t,n)=>o[n]?(0,i.A)(t,o[n](e)):t),{});return r.propTypes={},r.filterProps=t.reduce(((e,t)=>e.concat(t.filterProps)),[]),r};var a=n(60129);function l(e){return"number"!==typeof e?e:"".concat(e,"px solid")}function c(e,t){return(0,r.Ay)({prop:e,themeKey:"borders",transform:t})}const u=c("border",l),h=c("borderTop",l),d=c("borderRight",l),p=c("borderBottom",l),f=c("borderLeft",l),g=c("borderColor"),m=c("borderTopColor"),b=c("borderRightColor"),_=c("borderBottomColor"),T=c("borderLeftColor"),v=c("outline",l),y=c("outlineColor"),E=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const t=(0,o.MA)(e.theme,"shape.borderRadius",4,"borderRadius"),n=e=>({borderRadius:(0,o._W)(t,e)});return(0,a.NI)(e,e.borderRadius,n)}return null};E.propTypes={},E.filterProps=["borderRadius"];s(u,h,d,p,f,g,m,b,_,T,E,v,y);const I=e=>{if(void 0!==e.gap&&null!==e.gap){const t=(0,o.MA)(e.theme,"spacing",8,"gap"),n=e=>({gap:(0,o._W)(t,e)});return(0,a.NI)(e,e.gap,n)}return null};I.propTypes={},I.filterProps=["gap"];const S=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const t=(0,o.MA)(e.theme,"spacing",8,"columnGap"),n=e=>({columnGap:(0,o._W)(t,e)});return(0,a.NI)(e,e.columnGap,n)}return null};S.propTypes={},S.filterProps=["columnGap"];const w=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const t=(0,o.MA)(e.theme,"spacing",8,"rowGap"),n=e=>({rowGap:(0,o._W)(t,e)});return(0,a.NI)(e,e.rowGap,n)}return null};w.propTypes={},w.filterProps=["rowGap"];s(I,S,w,(0,r.Ay)({prop:"gridColumn"}),(0,r.Ay)({prop:"gridRow"}),(0,r.Ay)({prop:"gridAutoFlow"}),(0,r.Ay)({prop:"gridAutoColumns"}),(0,r.Ay)({prop:"gridAutoRows"}),(0,r.Ay)({prop:"gridTemplateColumns"}),(0,r.Ay)({prop:"gridTemplateRows"}),(0,r.Ay)({prop:"gridTemplateAreas"}),(0,r.Ay)({prop:"gridArea"}));function C(e,t){return"grey"===t?t:e}s((0,r.Ay)({prop:"color",themeKey:"palette",transform:C}),(0,r.Ay)({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:C}),(0,r.Ay)({prop:"backgroundColor",themeKey:"palette",transform:C}));function k(e){return e<=1&&0!==e?"".concat(100*e,"%"):e}const $=(0,r.Ay)({prop:"width",transform:k}),A=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const t=t=>{var n,o;const r=(null==(n=e.theme)||null==(n=n.breakpoints)||null==(n=n.values)?void 0:n[t])||a.zu[t];return r?"px"!==(null==(o=e.theme)||null==(o=o.breakpoints)?void 0:o.unit)?{maxWidth:"".concat(r).concat(e.theme.breakpoints.unit)}:{maxWidth:r}:{maxWidth:k(t)}};return(0,a.NI)(e,e.maxWidth,t)}return null};A.filterProps=["maxWidth"];const O=(0,r.Ay)({prop:"minWidth",transform:k}),R=(0,r.Ay)({prop:"height",transform:k}),x=(0,r.Ay)({prop:"maxHeight",transform:k}),L=(0,r.Ay)({prop:"minHeight",transform:k}),N=((0,r.Ay)({prop:"size",cssProperty:"width",transform:k}),(0,r.Ay)({prop:"size",cssProperty:"height",transform:k}),s($,A,O,R,x,L,(0,r.Ay)({prop:"boxSizing"})),{border:{themeKey:"borders",transform:l},borderTop:{themeKey:"borders",transform:l},borderRight:{themeKey:"borders",transform:l},borderBottom:{themeKey:"borders",transform:l},borderLeft:{themeKey:"borders",transform:l},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:l},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:E},color:{themeKey:"palette",transform:C},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:C},backgroundColor:{themeKey:"palette",transform:C},p:{style:o.Ms},pt:{style:o.Ms},pr:{style:o.Ms},pb:{style:o.Ms},pl:{style:o.Ms},px:{style:o.Ms},py:{style:o.Ms},padding:{style:o.Ms},paddingTop:{style:o.Ms},paddingRight:{style:o.Ms},paddingBottom:{style:o.Ms},paddingLeft:{style:o.Ms},paddingX:{style:o.Ms},paddingY:{style:o.Ms},paddingInline:{style:o.Ms},paddingInlineStart:{style:o.Ms},paddingInlineEnd:{style:o.Ms},paddingBlock:{style:o.Ms},paddingBlockStart:{style:o.Ms},paddingBlockEnd:{style:o.Ms},m:{style:o.Lc},mt:{style:o.Lc},mr:{style:o.Lc},mb:{style:o.Lc},ml:{style:o.Lc},mx:{style:o.Lc},my:{style:o.Lc},margin:{style:o.Lc},marginTop:{style:o.Lc},marginRight:{style:o.Lc},marginBottom:{style:o.Lc},marginLeft:{style:o.Lc},marginX:{style:o.Lc},marginY:{style:o.Lc},marginInline:{style:o.Lc},marginInlineStart:{style:o.Lc},marginInlineEnd:{style:o.Lc},marginBlock:{style:o.Lc},marginBlockStart:{style:o.Lc},marginBlockEnd:{style:o.Lc},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:I},rowGap:{style:w},columnGap:{style:S},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:k},maxWidth:{style:A},minWidth:{transform:k},height:{transform:k},maxHeight:{transform:k},minHeight:{transform:k},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}})},15514:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var o=n(11728),r=n(14953),i=n(32256),s=n(60129),a=n(92346);const l=function(){function e(e,t,n,r){const a={[e]:t,theme:n},l=r[e];if(!l)return{[e]:t};const{cssProperty:c=e,themeKey:u,transform:h,style:d}=l;if(null==t)return null;if("typography"===u&&"inherit"===t)return{[e]:t};const p=(0,i.Yn)(n,u)||{};if(d)return d(a);return(0,s.NI)(a,t,(t=>{let n=(0,i.BO)(p,h,t);return t===n&&"string"===typeof t&&(n=(0,i.BO)(p,h,"".concat(e).concat("default"===t?"":(0,o.A)(t)),t)),!1===c?n:{[c]:n}}))}return function t(n){var o;const{sx:i,theme:l={}}=n||{};if(!i)return null;const c=null!=(o=l.unstable_sxConfig)?o:a.A;function u(n){let o=n;if("function"===typeof n)o=n(l);else if("object"!==typeof n)return n;if(!o)return null;const i=(0,s.EU)(l.breakpoints),a=Object.keys(i);let u=i;return Object.keys(o).forEach((n=>{const i=(a=o[n],h=l,"function"===typeof a?a(h):a);var a,h;if(null!==i&&void 0!==i)if("object"===typeof i)if(c[n])u=(0,r.A)(u,e(n,i,l,c));else{const e=(0,s.NI)({theme:l},i,(e=>({[n]:e})));!function(){for(var e=arguments.length,t=new Array(e),n=0;ne.concat(Object.keys(t))),[]),r=new Set(o);return t.every((e=>r.size===Object.keys(e).length))}(e,i)?u=(0,r.A)(u,e):u[n]=t({sx:i,theme:l})}else u=(0,r.A)(u,e(n,i,l,c))})),(0,s.vf)(a,u)}return Array.isArray(i)?i.map(u):u(i)}}();l.filterProps=["sx"];const c=l},75841:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var o=n(43647),r=n(94648);const i=(0,o.A)();const s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;return(0,r.A)(e)}},30965:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(56328);function r(e){const{theme:t,name:n,props:r}=e;return t&&t.components&&t.components[n]&&t.components[n].defaultProps?(0,o.A)(t.components[n].defaultProps,r):r}},94648:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n(27565),r=n(3934);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const t=o.useContext(r.T);return t&&(n=t,0!==Object.keys(n).length)?t:e;var n}},50852:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const o=e=>e,r=(()=>{let e=o;return{configure(t){e=t},generate:t=>e(t),reset(){e=o}}})()},11728:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(49838);function r(e){if("string"!==typeof e)throw new Error((0,o.A)(7));return e.charAt(0).toUpperCase()+e.slice(1)}},68788:(e,t,n)=>{"use strict";function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const o={};return Object.keys(e).forEach((r=>{o[r]=e[r].reduce(((e,o)=>{if(o){const r=t(o);""!==r&&e.push(r),n&&n[o]&&e.push(n[o])}return e}),[]).join(" ")})),o}n.d(t,{A:()=>o})},50714:(e,t,n)=>{"use strict";function o(){for(var e=arguments.length,t=new Array(e),n=0;nnull==t?e:function(){for(var n=arguments.length,o=new Array(n),r=0;r{}))}n.d(t,{A:()=>o})},43182:(e,t,n)=>{"use strict";function o(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:166;function o(){for(var o=arguments.length,r=new Array(o),i=0;i{e.apply(this,r)}),n)}return o.clear=()=>{clearTimeout(t)},o}n.d(t,{A:()=>o})},5382:(e,t,n)=>{"use strict";n.d(t,{A:()=>s,Q:()=>r});var o=n(58168);function r(e){if("object"!==typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function i(e){if(!r(e))return e;const t={};return Object.keys(e).forEach((n=>{t[n]=i(e[n])})),t}function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{clone:!0};const a=n.clone?(0,o.A)({},e):e;return r(e)&&r(t)&&Object.keys(t).forEach((o=>{"__proto__"!==o&&(r(t[o])&&o in e&&r(e[o])?a[o]=s(e[o],t[o],n):n.clone?a[o]=r(t[o])?i(t[o]):t[o]:a[o]=t[o])})),a}},49838:(e,t,n)=>{"use strict";function o(e){let t="https://mui.com/production-error/?code="+e;for(let n=1;no})},92230:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>i});var o=n(50852);const r={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function i(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Mui";const i=r[t];return i?"".concat(n,"-").concat(i):"".concat(o.A.generate(e),"-").concat(t)}},31406:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(92230);function r(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Mui";const r={};return t.forEach((t=>{r[t]=(0,o.Ay)(e,t,n)})),r}},25062:(e,t,n)=>{"use strict";function o(e){return e&&e.ownerDocument||document}n.d(t,{A:()=>o})},46814:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(25062);function r(e){return(0,o.A)(e).defaultView||window}},56328:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(58168);function r(e,t){const n=(0,o.A)({},t);return Object.keys(e).forEach((i=>{if(i.toString().match(/^(components|slots)$/))n[i]=(0,o.A)({},e[i],n[i]);else if(i.toString().match(/^(componentsProps|slotProps)$/)){const s=e[i]||{},a=t[i];n[i]={},a&&Object.keys(a)?s&&Object.keys(s)?(n[i]=(0,o.A)({},a),Object.keys(s).forEach((e=>{n[i][e]=r(s[e],a[e])}))):n[i]=a:n[i]=s}else void 0===n[i]&&(n[i]=e[i])})),n}},91334:(e,t,n)=>{"use strict";function o(e,t){"function"===typeof e?e(t):e&&(e.current=t)}n.d(t,{A:()=>o})},93614:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(27565);function r(e){let{controlled:t,default:n,name:r,state:i="value"}=e;const{current:s}=o.useRef(void 0!==t),[a,l]=o.useState(n);return[s?t:a,o.useCallback((e=>{s||l(e)}),[])]}},45874:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var o=n(27565);const r="undefined"!==typeof window?o.useLayoutEffect:o.useEffect},33624:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n(27565),r=n(45874);const i=function(e){const t=o.useRef(e);return(0,r.A)((()=>{t.current=e})),o.useRef((function(){return(0,t.current)(...arguments)})).current}},92328:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n(27565),r=n(91334);function i(){for(var e=arguments.length,t=new Array(e),n=0;nt.every((e=>null==e))?null:e=>{t.forEach((t=>{(0,r.A)(t,e)}))}),t)}},74654:(e,t,n)=>{"use strict";var o;n.d(t,{A:()=>a});var r=n(27565);let i=0;const s=(o||(o=n.t(r,2)))["useId".toString()];function a(e){if(void 0!==s){const t=s();return null!=e?e:t}return function(e){const[t,n]=r.useState(e),o=e||t;return r.useEffect((()=>{null==t&&(i+=1,n("mui-".concat(i)))}),[t]),o}(e)}},52960:(e,t,n)=>{"use strict";var o=n(73374)("ArrayBuffer.prototype.byteLength",!0),r=n(12519);e.exports=function(e){return r(e)?o?o(e):e.byteLength:NaN}},47841:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"apathy",author:"jannik siebert (https://github.com/janniks)",base00:"#031A16",base01:"#0B342D",base02:"#184E45",base03:"#2B685E",base04:"#5F9C92",base05:"#81B5AC",base06:"#A7CEC8",base07:"#D2E7E4",base08:"#3E9688",base09:"#3E7996",base0A:"#3E4C96",base0B:"#883E96",base0C:"#963E4C",base0D:"#96883E",base0E:"#4C963E",base0F:"#3E965B"},e.exports=t.default},1436:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"ashes",author:"jannik siebert (https://github.com/janniks)",base00:"#1C2023",base01:"#393F45",base02:"#565E65",base03:"#747C84",base04:"#ADB3BA",base05:"#C7CCD1",base06:"#DFE2E5",base07:"#F3F4F5",base08:"#C7AE95",base09:"#C7C795",base0A:"#AEC795",base0B:"#95C7AE",base0C:"#95AEC7",base0D:"#AE95C7",base0E:"#C795AE",base0F:"#C79595"},e.exports=t.default},19199:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier dune",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)",base00:"#20201d",base01:"#292824",base02:"#6e6b5e",base03:"#7d7a68",base04:"#999580",base05:"#a6a28c",base06:"#e8e4cf",base07:"#fefbec",base08:"#d73737",base09:"#b65611",base0A:"#cfb017",base0B:"#60ac39",base0C:"#1fad83",base0D:"#6684e1",base0E:"#b854d4",base0F:"#d43552"},e.exports=t.default},78332:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier forest",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)",base00:"#1b1918",base01:"#2c2421",base02:"#68615e",base03:"#766e6b",base04:"#9c9491",base05:"#a8a19f",base06:"#e6e2e0",base07:"#f1efee",base08:"#f22c40",base09:"#df5320",base0A:"#d5911a",base0B:"#5ab738",base0C:"#00ad9c",base0D:"#407ee7",base0E:"#6666ea",base0F:"#c33ff3"},e.exports=t.default},15199:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier heath",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)",base00:"#1b181b",base01:"#292329",base02:"#695d69",base03:"#776977",base04:"#9e8f9e",base05:"#ab9bab",base06:"#d8cad8",base07:"#f7f3f7",base08:"#ca402b",base09:"#a65926",base0A:"#bb8a35",base0B:"#379a37",base0C:"#159393",base0D:"#516aec",base0E:"#7b59c0",base0F:"#cc33cc"},e.exports=t.default},43641:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier lakeside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/)",base00:"#161b1d",base01:"#1f292e",base02:"#516d7b",base03:"#5a7b8c",base04:"#7195a8",base05:"#7ea2b4",base06:"#c1e4f6",base07:"#ebf8ff",base08:"#d22d72",base09:"#935c25",base0A:"#8a8a0f",base0B:"#568c3b",base0C:"#2d8f6f",base0D:"#257fad",base0E:"#5d5db1",base0F:"#b72dd2"},e.exports=t.default},48705:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier seaside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/)",base00:"#131513",base01:"#242924",base02:"#5e6e5e",base03:"#687d68",base04:"#809980",base05:"#8ca68c",base06:"#cfe8cf",base07:"#f0fff0",base08:"#e6193c",base09:"#87711d",base0A:"#c3c322",base0B:"#29a329",base0C:"#1999b3",base0D:"#3d62f5",base0E:"#ad2bee",base0F:"#e619c3"},e.exports=t.default},58943:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"bespin",author:"jan t. sott",base00:"#28211c",base01:"#36312e",base02:"#5e5d5c",base03:"#666666",base04:"#797977",base05:"#8a8986",base06:"#9d9b97",base07:"#baae9e",base08:"#cf6a4c",base09:"#cf7d34",base0A:"#f9ee98",base0B:"#54be0d",base0C:"#afc4db",base0D:"#5ea6ea",base0E:"#9b859d",base0F:"#937121"},e.exports=t.default},85457:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"brewer",author:"timoth\xe9e poisot (http://github.com/tpoisot)",base00:"#0c0d0e",base01:"#2e2f30",base02:"#515253",base03:"#737475",base04:"#959697",base05:"#b7b8b9",base06:"#dadbdc",base07:"#fcfdfe",base08:"#e31a1c",base09:"#e6550d",base0A:"#dca060",base0B:"#31a354",base0C:"#80b1d3",base0D:"#3182bd",base0E:"#756bb1",base0F:"#b15928"},e.exports=t.default},20446:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"bright",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#303030",base02:"#505050",base03:"#b0b0b0",base04:"#d0d0d0",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ffffff",base08:"#fb0120",base09:"#fc6d24",base0A:"#fda331",base0B:"#a1c659",base0C:"#76c7b7",base0D:"#6fb3d2",base0E:"#d381c3",base0F:"#be643c"},e.exports=t.default},64367:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"chalk",author:"chris kempson (http://chriskempson.com)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#f5f5f5",base08:"#fb9fb1",base09:"#eda987",base0A:"#ddb26f",base0B:"#acc267",base0C:"#12cfc0",base0D:"#6fc2ef",base0E:"#e1a3ee",base0F:"#deaf8f"},e.exports=t.default},50703:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"codeschool",author:"brettof86",base00:"#232c31",base01:"#1c3657",base02:"#2a343a",base03:"#3f4944",base04:"#84898c",base05:"#9ea7a6",base06:"#a7cfa3",base07:"#b5d8f6",base08:"#2a5491",base09:"#43820d",base0A:"#a03b1e",base0B:"#237986",base0C:"#b02f30",base0D:"#484d79",base0E:"#c59820",base0F:"#c98344"},e.exports=t.default},79050:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"colors",author:"mrmrs (http://clrs.cc)",base00:"#111111",base01:"#333333",base02:"#555555",base03:"#777777",base04:"#999999",base05:"#bbbbbb",base06:"#dddddd",base07:"#ffffff",base08:"#ff4136",base09:"#ff851b",base0A:"#ffdc00",base0B:"#2ecc40",base0C:"#7fdbff",base0D:"#0074d9",base0E:"#b10dc9",base0F:"#85144b"},e.exports=t.default},55801:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"default",author:"chris kempson (http://chriskempson.com)",base00:"#181818",base01:"#282828",base02:"#383838",base03:"#585858",base04:"#b8b8b8",base05:"#d8d8d8",base06:"#e8e8e8",base07:"#f8f8f8",base08:"#ab4642",base09:"#dc9656",base0A:"#f7ca88",base0B:"#a1b56c",base0C:"#86c1b9",base0D:"#7cafc2",base0E:"#ba8baf",base0F:"#a16946"},e.exports=t.default},60776:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"eighties",author:"chris kempson (http://chriskempson.com)",base00:"#2d2d2d",base01:"#393939",base02:"#515151",base03:"#747369",base04:"#a09f93",base05:"#d3d0c8",base06:"#e8e6df",base07:"#f2f0ec",base08:"#f2777a",base09:"#f99157",base0A:"#ffcc66",base0B:"#99cc99",base0C:"#66cccc",base0D:"#6699cc",base0E:"#cc99cc",base0F:"#d27b53"},e.exports=t.default},16598:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"embers",author:"jannik siebert (https://github.com/janniks)",base00:"#16130F",base01:"#2C2620",base02:"#433B32",base03:"#5A5047",base04:"#8A8075",base05:"#A39A90",base06:"#BEB6AE",base07:"#DBD6D1",base08:"#826D57",base09:"#828257",base0A:"#6D8257",base0B:"#57826D",base0C:"#576D82",base0D:"#6D5782",base0E:"#82576D",base0F:"#825757"},e.exports=t.default},59933:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"flat",author:"chris kempson (http://chriskempson.com)",base00:"#2C3E50",base01:"#34495E",base02:"#7F8C8D",base03:"#95A5A6",base04:"#BDC3C7",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ECF0F1",base08:"#E74C3C",base09:"#E67E22",base0A:"#F1C40F",base0B:"#2ECC71",base0C:"#1ABC9C",base0D:"#3498DB",base0E:"#9B59B6",base0F:"#be643c"},e.exports=t.default},99417:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"google",author:"seth wright (http://sethawright.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#CC342B",base09:"#F96A38",base0A:"#FBA922",base0B:"#198844",base0C:"#3971ED",base0D:"#3971ED",base0E:"#A36AC7",base0F:"#3971ED"},e.exports=t.default},5047:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"grayscale",author:"alexandre gavioli (https://github.com/alexx2/)",base00:"#101010",base01:"#252525",base02:"#464646",base03:"#525252",base04:"#ababab",base05:"#b9b9b9",base06:"#e3e3e3",base07:"#f7f7f7",base08:"#7c7c7c",base09:"#999999",base0A:"#a0a0a0",base0B:"#8e8e8e",base0C:"#868686",base0D:"#686868",base0E:"#747474",base0F:"#5e5e5e"},e.exports=t.default},96191:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"green screen",author:"chris kempson (http://chriskempson.com)",base00:"#001100",base01:"#003300",base02:"#005500",base03:"#007700",base04:"#009900",base05:"#00bb00",base06:"#00dd00",base07:"#00ff00",base08:"#007700",base09:"#009900",base0A:"#007700",base0B:"#00bb00",base0C:"#005500",base0D:"#009900",base0E:"#00bb00",base0F:"#005500"},e.exports=t.default},3185:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"harmonic16",author:"jannik siebert (https://github.com/janniks)",base00:"#0b1c2c",base01:"#223b54",base02:"#405c79",base03:"#627e99",base04:"#aabcce",base05:"#cbd6e2",base06:"#e5ebf1",base07:"#f7f9fb",base08:"#bf8b56",base09:"#bfbf56",base0A:"#8bbf56",base0B:"#56bf8b",base0C:"#568bbf",base0D:"#8b56bf",base0E:"#bf568b",base0F:"#bf5656"},e.exports=t.default},35545:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"hopscotch",author:"jan t. sott",base00:"#322931",base01:"#433b42",base02:"#5c545b",base03:"#797379",base04:"#989498",base05:"#b9b5b8",base06:"#d5d3d5",base07:"#ffffff",base08:"#dd464c",base09:"#fd8b19",base0A:"#fdcc59",base0B:"#8fc13e",base0C:"#149b93",base0D:"#1290bf",base0E:"#c85e7c",base0F:"#b33508"},e.exports=t.default},96568:(e,t,n)=>{"use strict";function o(e){return e&&e.__esModule?e.default:e}t.__esModule=!0;var r=n(80650);t.threezerotwofour=o(r);var i=n(47841);t.apathy=o(i);var s=n(1436);t.ashes=o(s);var a=n(19199);t.atelierDune=o(a);var l=n(78332);t.atelierForest=o(l);var c=n(15199);t.atelierHeath=o(c);var u=n(43641);t.atelierLakeside=o(u);var h=n(48705);t.atelierSeaside=o(h);var d=n(58943);t.bespin=o(d);var p=n(85457);t.brewer=o(p);var f=n(20446);t.bright=o(f);var g=n(64367);t.chalk=o(g);var m=n(50703);t.codeschool=o(m);var b=n(79050);t.colors=o(b);var _=n(55801);t.default=o(_);var T=n(60776);t.eighties=o(T);var v=n(16598);t.embers=o(v);var y=n(59933);t.flat=o(y);var E=n(99417);t.google=o(E);var I=n(5047);t.grayscale=o(I);var S=n(96191);t.greenscreen=o(S);var w=n(3185);t.harmonic=o(w);var C=n(35545);t.hopscotch=o(C);var k=n(95867);t.isotope=o(k);var $=n(11550);t.marrakesh=o($);var A=n(36606);t.mocha=o(A);var O=n(18654);t.monokai=o(O);var R=n(7042);t.ocean=o(R);var x=n(11511);t.paraiso=o(x);var L=n(871);t.pop=o(L);var N=n(99130);t.railscasts=o(N);var M=n(84498);t.shapeshifter=o(M);var D=n(15635);t.solarized=o(D);var P=n(24473);t.summerfruit=o(P);var B=n(26281);t.tomorrow=o(B);var F=n(82463);t.tube=o(F);var U=n(30786);t.twilight=o(U)},95867:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"isotope",author:"jan t. sott",base00:"#000000",base01:"#404040",base02:"#606060",base03:"#808080",base04:"#c0c0c0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#ff0000",base09:"#ff9900",base0A:"#ff0099",base0B:"#33ff00",base0C:"#00ffff",base0D:"#0066ff",base0E:"#cc00ff",base0F:"#3300ff"},e.exports=t.default},11550:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"marrakesh",author:"alexandre gavioli (http://github.com/alexx2/)",base00:"#201602",base01:"#302e00",base02:"#5f5b17",base03:"#6c6823",base04:"#86813b",base05:"#948e48",base06:"#ccc37a",base07:"#faf0a5",base08:"#c35359",base09:"#b36144",base0A:"#a88339",base0B:"#18974e",base0C:"#75a738",base0D:"#477ca1",base0E:"#8868b3",base0F:"#b3588e"},e.exports=t.default},36606:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"mocha",author:"chris kempson (http://chriskempson.com)",base00:"#3B3228",base01:"#534636",base02:"#645240",base03:"#7e705a",base04:"#b8afad",base05:"#d0c8c6",base06:"#e9e1dd",base07:"#f5eeeb",base08:"#cb6077",base09:"#d28b71",base0A:"#f4bc87",base0B:"#beb55b",base0C:"#7bbda4",base0D:"#8ab3b5",base0E:"#a89bb9",base0F:"#bb9584"},e.exports=t.default},18654:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"monokai",author:"wimer hazenberg (http://www.monokai.nl)",base00:"#272822",base01:"#383830",base02:"#49483e",base03:"#75715e",base04:"#a59f85",base05:"#f8f8f2",base06:"#f5f4f1",base07:"#f9f8f5",base08:"#f92672",base09:"#fd971f",base0A:"#f4bf75",base0B:"#a6e22e",base0C:"#a1efe4",base0D:"#66d9ef",base0E:"#ae81ff",base0F:"#cc6633"},e.exports=t.default},7042:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"ocean",author:"chris kempson (http://chriskempson.com)",base00:"#2b303b",base01:"#343d46",base02:"#4f5b66",base03:"#65737e",base04:"#a7adba",base05:"#c0c5ce",base06:"#dfe1e8",base07:"#eff1f5",base08:"#bf616a",base09:"#d08770",base0A:"#ebcb8b",base0B:"#a3be8c",base0C:"#96b5b4",base0D:"#8fa1b3",base0E:"#b48ead",base0F:"#ab7967"},e.exports=t.default},11511:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"paraiso",author:"jan t. sott",base00:"#2f1e2e",base01:"#41323f",base02:"#4f424c",base03:"#776e71",base04:"#8d8687",base05:"#a39e9b",base06:"#b9b6b0",base07:"#e7e9db",base08:"#ef6155",base09:"#f99b15",base0A:"#fec418",base0B:"#48b685",base0C:"#5bc4bf",base0D:"#06b6ef",base0E:"#815ba4",base0F:"#e96ba8"},e.exports=t.default},871:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"pop",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#eb008a",base09:"#f29333",base0A:"#f8ca12",base0B:"#37b349",base0C:"#00aabb",base0D:"#0e5a94",base0E:"#b31e8d",base0F:"#7a2d00"},e.exports=t.default},99130:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"railscasts",author:"ryan bates (http://railscasts.com)",base00:"#2b2b2b",base01:"#272935",base02:"#3a4055",base03:"#5a647e",base04:"#d4cfc9",base05:"#e6e1dc",base06:"#f4f1ed",base07:"#f9f7f3",base08:"#da4939",base09:"#cc7833",base0A:"#ffc66d",base0B:"#a5c261",base0C:"#519f50",base0D:"#6d9cbe",base0E:"#b6b3eb",base0F:"#bc9458"},e.exports=t.default},84498:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"shapeshifter",author:"tyler benziger (http://tybenz.com)",base00:"#000000",base01:"#040404",base02:"#102015",base03:"#343434",base04:"#555555",base05:"#ababab",base06:"#e0e0e0",base07:"#f9f9f9",base08:"#e92f2f",base09:"#e09448",base0A:"#dddd13",base0B:"#0ed839",base0C:"#23edda",base0D:"#3b48e3",base0E:"#f996e2",base0F:"#69542d"},e.exports=t.default},15635:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"},e.exports=t.default},24473:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"summerfruit",author:"christopher corley (http://cscorley.github.io/)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#B0B0B0",base05:"#D0D0D0",base06:"#E0E0E0",base07:"#FFFFFF",base08:"#FF0086",base09:"#FD8900",base0A:"#ABA800",base0B:"#00C918",base0C:"#1faaaa",base0D:"#3777E6",base0E:"#AD00A1",base0F:"#cc6633"},e.exports=t.default},80650:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"threezerotwofour",author:"jan t. sott (http://github.com/idleberg)",base00:"#090300",base01:"#3a3432",base02:"#4a4543",base03:"#5c5855",base04:"#807d7c",base05:"#a5a2a2",base06:"#d6d5d4",base07:"#f7f7f7",base08:"#db2d20",base09:"#e8bbd0",base0A:"#fded02",base0B:"#01a252",base0C:"#b5e4f4",base0D:"#01a0e4",base0E:"#a16a94",base0F:"#cdab53"},e.exports=t.default},26281:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"tomorrow",author:"chris kempson (http://chriskempson.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#cc6666",base09:"#de935f",base0A:"#f0c674",base0B:"#b5bd68",base0C:"#8abeb7",base0D:"#81a2be",base0E:"#b294bb",base0F:"#a3685a"},e.exports=t.default},82463:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"london tube",author:"jan t. sott",base00:"#231f20",base01:"#1c3f95",base02:"#5a5758",base03:"#737171",base04:"#959ca1",base05:"#d9d8d8",base06:"#e7e7e8",base07:"#ffffff",base08:"#ee2e24",base09:"#f386a1",base0A:"#ffd204",base0B:"#00853e",base0C:"#85cebc",base0D:"#009ddc",base0E:"#98005d",base0F:"#b06110"},e.exports=t.default},30786:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"twilight",author:"david hart (http://hart-dev.com)",base00:"#1e1e1e",base01:"#323537",base02:"#464b50",base03:"#5f5a60",base04:"#838184",base05:"#a7a7a7",base06:"#c3c3c3",base07:"#ffffff",base08:"#cf6a4c",base09:"#cda869",base0A:"#f9ee98",base0B:"#8f9d6a",base0C:"#afc4db",base0D:"#7587a6",base0E:"#9b859d",base0F:"#9b703f"},e.exports=t.default},83514:function(e,t,n){var o,r,i;r=[n(33096)],void 0===(i="function"===typeof(o=function(e){return e})?o.apply(t,r):o)||(e.exports=i)},33096:function(e,t,n){var o,r,i;r=[],o=function(){var e,t,o,r,i,s,a,l,c,u,h,d,p,f,g,m,b,_,T,v,y,E,I,S,w,C,k,$,A,O,R,x,L,N,M,D,P,B,F,U,H,G,V,W,j,z,X,Y,K,J,q,Z,Q,ee,te,ne,oe,re,ie,se,ae,le,ce,ue,he,de,pe,fe,ge,me,be,_e,Te,ve,ye,Ee,Ie,Se,we,Ce,ke,$e,Ae,Oe,Re,xe,Le,Ne,Me,De,Pe,Be,Fe,Ue,He,Ge,Ve,We,je,ze,Xe,Ye,Ke,Je,qe,Ze,Qe,et,tt,nt,ot,rt,it,st,at,lt,ct,ut,ht,dt,pt,ft,gt,mt,bt,_t,Tt,vt,yt,Et,It,St,wt,Ct,kt,$t,At,Ot,Rt,xt,Lt,Nt,Mt,Dt,Pt,Bt,Ft,Ut,Ht,Gt,Vt,Wt,jt,zt,Xt,Yt,Kt,Jt,qt,Zt,Qt,en,tn,nn,on,rn,sn,an,ln,cn,un,hn,dn,pn,fn,gn,mn,bn,_n,Tn,vn,yn,En,In,Sn,wn,Cn,kn,$n,An,On,Rn,xn,Ln,Nn,Mn,Dn,Pn,Bn,Fn,Un,Hn,Gn,Vn,Wn,jn,zn,Xn,Yn,Kn,Jn,qn,Zn,Qn,eo,to,no,oo,ro,io,so,ao,lo,co,uo,ho,po,fo,go,mo,bo,_o,To,vo,yo,Eo,Io,So,wo,Co,ko,$o,Ao,Oo,Ro,xo,Lo,No,Mo,Do,Po,Bo,Fo,Uo,Ho,Go,Vo,Wo,jo,zo,Xo,Yo,Ko,Jo,qo,Zo,Qo,er,tr,nr,or,rr,ir,sr,ar,lr,cr,ur,hr,dr,pr,fr,gr,mr,br,_r,Tr,vr,yr,Er,Ir,Sr,wr,Cr,kr,$r,Ar,Or,Rr,xr,Lr,Nr,Mr,Dr,Pr,Br,Fr,Ur,Hr,Gr,Vr,Wr,jr,zr,Xr,Yr,Kr,Jr,qr,Zr,Qr,ei,ti,ni,oi,ri,ii,si,ai,li,ci,ui,hi,di,pi,fi,gi,mi,bi,_i,Ti,vi,yi,Ei,Ii,Si,wi,Ci,ki,$i,Ai,Oi,Ri,xi,Li,Ni,Mi,Di,Pi,Bi,Fi,Ui,Hi,Gi,Vi,Wi,ji,zi,Xi,Yi,Ki,Ji,qi,Zi,Qi,es,ts,ns,os,rs,is,ss,as,ls,cs,us,hs,ds,ps,fs,gs,ms,bs,_s,Ts,vs,ys,Es,Is,Ss,ws,Cs,ks,$s,As,Os,Rs,xs,Ls,Ns,Ms={};e=function(e,n,o,r){if(!(e instanceof Us)&&"string"!==typeof e||""==="".concat(e).trim())throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e="".concat(e).toLowerCase(),"string"!==typeof n||""===n.trim())throw Error('Invalid name "'+n+'". The name must be a non-empty string.');const i=n.toLowerCase();if(!o)throw Error("Can not register a null value");let s=Ds[e],a=Bs[e];if(s||(s=Ds[e]=Object.create(null),a=Bs[e]=Object.create(null)),t(e,o),!r&&s[i])throw Error('Name "'+i+'" with type "'+e+'" already registered.');s[i]=o,a[i]=n},t=function(e,t){if(e===String(Us.FIELD)&&"function"!==typeof t.fromJson)throw Error('Type "'+e+'" must have a fromJson function')},o=function(e,t){e="".concat(e).toLowerCase(),t=t.toLowerCase();const n=Ds[e];n&&n[t]?(delete Ds[e][t],delete Bs[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},r=function(e,t,n){e="".concat(e).toLowerCase(),t=t.toLowerCase();const o=Ds[e];if(!o||!o[t]){if(t="Unable to find ["+t+"]["+e+"] in the registry.",n)throw Error(t+" You must require or register a "+e+" plugin.");return console.warn(t),null}return o[t]},i=function(e,t){return e="".concat(e).toLowerCase(),t=t.toLowerCase(),!!(e=Ds[e])&&!!e[t]},s=function(e,t,n){return r(e,t,n)},a=function(e,t,n){return r(e,t,n)},l=function(e,t,n){e="".concat(e).toLowerCase();var o=Ds[e];if(!o){if(o="Unable to find [".concat(e,"] in the registry."),n)throw Error("".concat(o," You must require or register a ").concat(e," plugin."));return console.warn(o),null}if(!t)return o;e=Bs[e],n=Object.create(null);for(const r of Object.keys(o))n[e[r]]=o[r];return n},c=function(e,t,n){return"function"===typeof(t=t.plugins[String(e)]||Fs)?t:s(e,t,n)},u=function(e){return js[e]||null},h=function(){const e=[];for(const t in js)e.push(js[t]);return e},d=function(e){js[e.id]=e},p=function(e){delete js[e.id]},f=function(){return Gs},g=function(e){Gs=e},m=function(){return zs},b=function(e){zs=e},_=function(){return Vs},T=function(e){Vs=e},v=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;const t=e.getParentSvg(),n=e.getCachedParentSvgSize();var o=t.parentElement;if(o instanceof HTMLElement){var r=o.offsetWidth;o=o.offsetHeight,n.width!==r&&(t.setAttribute("width",r+"px"),e.setCachedParentSvgSize(r,null)),n.height!==o&&(t.setAttribute("height",o+"px"),e.setCachedParentSvgSize(null,o)),e.resize()}},y=function(e,t){const n=Object.create(null),o=e.getDescendants(!0);t&&(e=e.getNextBlock())&&(e=o.indexOf(e),o.splice(e,o.length-e));for(let r,i=0;r=o[i];i++)n[r.type]?n[r.type]++:n[r.type]=1;return n},E=function(e){return function(){this.jsonInit(e)}},I=function(e){Ys.defineBlocksWithJsonArrayInternal(e)},S=function(e){Ms.defineBlocks$$module$build$src$core$common(Ms.createBlockDefinitionsFromJsonArray$$module$build$src$core$common(e))},Ms.createBlockDefinitionsFromJsonArray$$module$build$src$core$common=function(e){const t={};for(let n=0;n{setTimeout(R,0)}))}catch(t){setTimeout(R,0)}Ta.push(e)}},R=function(){var e=x(Ta,!0);Ta.length=0;for(let n,o=0;n=e[o];o++)if(n.workspaceId){var t=u(n.workspaceId);t&&t.fireChangeListener(n)}e=new Set(e.map((e=>e.workspaceId)));for(const n of e){if(!n)continue;if(!(e=u(n)))continue;let o;for(t=(e=e.getUndoStack()).length;0>>/g,e),cl="",(e=document.createElement("style")).id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},ne=function(e,t,n,o){e=e+" was deprecated in "+t+" and will be deleted in "+n+".",o&&(e+="\nUse "+o+" instead."),dl.has(e)||(dl.add(e),console.warn(e))},oe=function(e,t,n){e=document.createElementNS(gl,"".concat(e));for(const o in t)e.setAttribute(o,"".concat(t[o]));return n&&n.appendChild(e),e},re=function(e,t){return!(t=t.split(" ")).every((t=>e.classList.contains(t)))&&(e.classList.add(...t),!0)},ie=function(e,t){e.classList.remove(...t.split(" "))},se=function(e,t){return!(t=t.split(" ")).every((t=>!e.classList.contains(t)))&&(e.classList.remove(...t),!0)},ae=function(e,t){return e.classList.contains(t)},le=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},ce=function(e,t){const n=t.nextSibling;if(!(t=t.parentNode))throw Error("Reference node has no parent.");n?t.insertBefore(e,n):t.appendChild(e)},ue=function(e,t){return ne("Blockly.utils.dom.containsNode","version 10","version 11",'Use native "contains" DOM method'),e.contains(t)},he=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},de=function(){Tl++,_l||(_l=Object.create(null))},pe=function(){--Tl||(_l=null)},fe=function(e){const t=e.textContent+"\n"+e.className.baseVal;let n;if(_l&&(n=_l[t]))return n;try{n=e.getComputedTextLength()}catch(o){return 8*e.textContent.length}return _l&&(_l[t]=n),n},ge=function(e,t,n,o){return me(e,t+"pt",n,o)},me=function(e,t,n,o){const r=e.textContent;var i;return e=r+"\n"+e.className.baseVal,_l&&(i=_l[e])||(vl||((i=document.createElement("canvas")).className="blocklyComputeCanvas",document.body.appendChild(i),vl=i.getContext("2d")),vl.font=n+" "+t+" "+o,i=r?vl.measureText(r).width:0,_l&&(_l[e]=i)),i},be=function(e,t,n,o){const r=document.createElement("span");r.style.font=n+" "+t+" "+o,r.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(r),t.appendChild(e),document.body.appendChild(t),n={height:0,baseline:0};try{t.style.alignItems="baseline",n.baseline=e.offsetTop-r.offsetTop,t.style.alignItems="flex-end",n.height=e.offsetTop-r.offsetTop}finally{document.body.removeChild(t)}return n},_e=function(e){return wl.getSizeInternal(e)},Te=function(e){if("none"!==ye(e,"display"))return ve(e);const t=e.style,n=t.display,o=t.visibility,r=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";const i=e.offsetWidth;return e=e.offsetHeight,t.display=n,t.position=r,t.visibility=o,new Sl(i,e)},ve=function(e){return new Sl(e.offsetWidth,e.offsetHeight)},ye=function(e,t){return(e=window.getComputedStyle(e))[t]||e.getPropertyValue(t)},Ee=function(e){const t=new hl(0,0);e=e.getBoundingClientRect();var n=document.documentElement;return n=new hl(window.pageXOffset||n.scrollLeft,window.pageYOffset||n.scrollTop),t.x=e.left+n.x,t.y=e.top+n.y,t},Ie=function(){const e=document.body,t=document.documentElement;return new hl(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},Se=function(e){const t=parseFloat(ye(e,"borderLeftWidth")),n=parseFloat(ye(e,"borderRightWidth")),o=parseFloat(ye(e,"borderTopWidth"));return e=parseFloat(ye(e,"borderBottomWidth")),new Il(o,e,t,n)},we=function(e,t,n){e=Ce(e,t,n),t.scrollLeft=e.x,t.scrollTop=e.y},Ce=function(e,t,n){var o=Ee(e),r=Ee(t),i=Se(t);const s=o.x-r.x-i.left;return o=o.y-r.y-i.top,r=ve(e),e=t.clientWidth-r.width,r=t.clientHeight-r.height,i=t.scrollLeft,t=t.scrollTop,n?(i+=s-e/2,t+=o-r/2):(i+=Math.min(s,Math.max(s-e,0)),t+=Math.min(o,Math.max(o-r,0))),new hl(i,t)},ke=function(e){const t=new hl(0,0);var n=e.x&&e.getAttribute("x");const o=e.y&&e.getAttribute("y");return n&&(t.x=parseInt(n)),o&&(t.y=parseInt(o)),(n=(n=e.getAttribute("transform"))&&n.match(kl))&&(t.x+=Number(n[1]),n[3]&&(t.y+=Number(n[3]))),(e=e.getAttribute("style"))&&-1"&#".concat(e.charCodeAt(0),";")))},De=function(e){return e?((e instanceof Element||"string"===typeof e)&&(e=je(e),e=Ge(e)),Pe(e),e):null},Pe=function(e){const t=e.kind;if(e=e.contents,t&&t!==Hl&&t!==Ul)throw Error("Invalid toolbox kind "+t+". Please supply either "+Hl+" or "+Ul);if(!e)throw Error("Toolbox must have a contents attribute.")},Be=function(e){return e?e.contents?e.contents:Array.isArray(e)&&0 document.")}else e instanceof Element&&(t=e);return t},ze=function(e,t,n,o,r,i){const s=i.scrollbar&&i.scrollbar.canScrollVertically();return e.horizontal===Vl.LEFT?(n=r.absoluteMetrics.left+n,s&&i.RTL&&(n+=Ol.scrollbarThickness)):(n=r.absoluteMetrics.left+r.viewMetrics.width-t.width-n,s&&!i.RTL&&(n-=Ol.scrollbarThickness)),e.vertical===Gl.TOP?e=r.absoluteMetrics.top+o:(e=r.absoluteMetrics.top+r.viewMetrics.height-t.height-o,i.scrollbar&&i.scrollbar.canScrollHorizontally()&&(e-=Ol.scrollbarThickness)),new Il(e,e+t.height,n,n+t.width)},Xe=function(e,t){return{horizontal:t.toolboxMetrics.position===Fl.LEFT||e.horizontalLayout&&!e.RTL?Vl.RIGHT:Vl.LEFT,vertical:t.toolboxMetrics.position===Fl.BOTTOM?Gl.TOP:Gl.BOTTOM}},Ye=function(e,t,n,o){const r=e.left,i=e.right-e.left,s=e.bottom-e.top;for(let a=0;a1
'),o.appendChild(n),t.push(o)),Ws.variables_get){e.sort(ac.compareByName);for(let o,r=0;o=e[r];r++)(n=Ms.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get"),n.setAttribute("gap","8"),n.appendChild(bt(o)),t.push(n)}}return t},at=function(e){return uc.generateUniqueNameInternal(e)},lt=function(e){return ct(cc.charAt(0),e.getAllVariableNames())},ct=function(e,t){if(!t.length)return e;const n=cc;let o="",r=n.indexOf(e);for(;;){let i=!1;for(let n=0;ne.getVariableModel().name));if(o&&(n=o.some((t=>t.toLowerCase()===e)),o=o.some((e=>e.toLowerCase()===t)),n&&o))return r.getName()}return null},mt=function(e,t,n){e=e.toLowerCase(),t=t.toLowerCase(),n=n.getAllBlocks(!1);for(const r of n){if(!ot(r))continue;var o=(n=r.getProcedureDef())[1];const i=o.some((t=>t.toLowerCase()===e));if(o=o.some((e=>e.toLowerCase()===t)),i&&o)return n[0]}return null},bt=function(e){const t=Ms.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name","VAR"),t.setAttribute("id",e.getId()),t.setAttribute("variabletype",e.type),e=Ms.createTextNode$$module$build$src$core$utils$xml(e.name),t.appendChild(e),t},Ms.getOrCreateVariablePackage$$module$build$src$core$variables=function(e,t,n,o){let r=Ms.getVariable$$module$build$src$core$variables(e,t,n,o);return r||(r=_t(e,t,n,o)),r},Ms.getVariable$$module$build$src$core$variables=function(e,t,n,o){const r=e.getPotentialVariableMap();let i=null;if(t&&(i=e.getVariableById(t),!i&&r&&(i=r.getVariableById(t)),i))return i;if(n){if(void 0===o)throw Error("Tried to look up a variable by name without a type");i=e.getVariable(n,o),!i&&r&&(i=r.getVariable(n,o))}return i},_t=function(e,t,n,o){const r=e.getPotentialVariableMap();return n||(n=at(e.isFlyout?e.targetWorkspace:e)),r?r.createVariable(n,o,t):e.createVariable(n,o,t)},Tt=function(e,t){e=e.getAllVariables();const n=[];if(t.length!==e.length)for(let o=0;o{Ic=e,Sc=window.requestAnimationFrame((()=>{kt(),e()}))}))),Ec)},It=function(){return Ec||Promise.resolve()},St=function(e){e||window.cancelAnimationFrame(Sc),kt(e),!e&&Ic&&Ic()},wt=function(){return Ya},Ct=function(e){yc.add(e);const t=e.getParent();t?Ct(t):vc.add(e)},kt=function(e){const t=e?new Set([e]):new Set([...vc].map((e=>e.workspace))),n=[...vc].filter(At).filter((e=>t.has(e.workspace)));for(var o of n)Ot(o);for(const r of t)r.resizeContents();for(const r of n)o=r.getRelativeToSurfaceXY(),r.updateComponentLocations(o);for(const r of n)$t(r);e||(Ec=null)},$t=function(e){vc.delete(e),yc.delete(e);for(const t of e.getChildren(!1))$t(t)},At=function(e){return!e.isDisposed()&&!e.getParent()},Ot=function(e){if(yc.has(e)){for(const t of e.getChildren(!1))Ot(t);e.renderEfficiently()}},Rt=function(e,t){const n=Ms.createElement$$module$build$src$core$utils$xml("xml");var o=xt(Ms.allUsedVarModels$$module$build$src$core$variables(e));o.hasChildNodes()&&n.appendChild(o),o=e.getTopComments(!0);for(let r=0;r/g,"<$1$2>")},Ft=function(e){e=Bt(e).split("<");let t="";for(let n=1;n"!==o.slice(-2)&&(t+=" ")}return(e=(e=e.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1")).replace(/^\n/,"")},Ut=function(e,t){return t.setResizesEnabled(!1),t.clear(),e=Ms.domToWorkspace$$module$build$src$core$xml(e,t),t.setResizesEnabled(!0),e},Ms.domToWorkspace$$module$build$src$core$xml=function(e,t){let n=0;t.RTL&&(n=t.getWidth());const o=[];de();const r=Ms.getGroup$$module$build$src$core$events$utils();r||Ms.setGroup$$module$build$src$core$events$utils(!0),t.setResizesEnabled&&t.setResizesEnabled(!1);let i=!0;try{for(let r,s=0;r=e.childNodes[s];s++){const e=r.nodeName.toLowerCase(),s=r;if("block"===e||"shadow"===e&&!$()){const e=Gt(s,t);let r;o.push(e.id);const a=parseInt(null!=(r=s.getAttribute("x"))?r:"10",10);let l;const c=parseInt(null!=(l=s.getAttribute("y"))?l:"10",10);isNaN(a)||isNaN(c)||e.moveBy(t.RTL?n-a:a,c,["create"]),i=!1}else{if("shadow"===e)throw TypeError("Shadow block cannot be a top-level block.");if("comment"===e)t.rendered?Tc.fromXmlRendered(s,t,n):dc.fromXml(s,t);else if("variables"===e){if(!i)throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");Vt(s,t),i=!1}}}}finally{Ms.setGroup$$module$build$src$core$events$utils(r),t.setResizesEnabled&&t.setResizesEnabled(!0),t.rendered&&St(),pe()}return A(new(B(ba))(t)),o},Ht=function(e,t){if(!t.getBlocksBoundingBox)return Ms.domToWorkspace$$module$build$src$core$xml(e,t);var n=t.getBlocksBoundingBox();if(e=Ms.domToWorkspace$$module$build$src$core$xml(e,t),n&&n.top!==n.bottom){var o=n.bottom;n=t.RTL?n.right:n.left;var r=1/0;let i=-1/0,s=1/0;for(let n=0;ni&&(i=o.x)}for(o=o-s+10,n=t.RTL?n-i:n-r,r=0;rc.setBubbleVisible(i)),1)}},Xt=function(e,t){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(e.isInsertionMarker())return null;const s={type:e.type,id:i?e.id:void 0};return t&&ln(e,s),an(e,s),cn(e,s,r),un(e,s,r),hn(e,s,r),n&&dn(e,s,r,i),o&&pn(e,s,r,i),s},an=function(e,t){e.isCollapsed()&&(t.collapsed=!0),e.isEnabled()||(t.enabled=!1),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)},ln=function(e,t){const n=e.workspace;e=e.getRelativeToSurfaceXY(),t.x=Math.round(n.RTL?n.getWidth()-e.x:e.x),t.y=Math.round(e.y)},cn=function(e,t,n){e.saveExtraState?null!==(e=e.saveExtraState(n))&&(t.extraState=e):e.mutationToDom&&null!==(e=e.mutationToDom())&&(t.extraState=Bt(e).replace(' xmlns="https://developers.google.com/blockly/xml"',""))},un=function(e,t,n){const o=Object.create(null);for(const r of e.getIcons())nn(r)&&(e=r.saveState(n))&&(o[r.getType().toString()]=e);Object.keys(o).length&&(t.icons=o)},hn=function(e,t,n){const o=Object.create(null);for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:{};return e=mn(e,t,{recordUndo:n}),t.rendered&&St(),e},mn=function(e,t){let{parentConnection:n,isShadow:o=!1,recordUndo:r=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=$();let s;k(r),(r=Ms.getGroup$$module$build$src$core$events$utils())||Ms.setGroup$$module$build$src$core$events$utils(!0),Ms.disable$$module$build$src$core$events$utils();try{s=bn(e,t,{parentConnection:n,isShadow:o})}finally{Ms.enable$$module$build$src$core$events$utils()}if(N()&&A(new(B(Ms.CREATE$$module$build$src$core$events$utils))(s)),Ms.setGroup$$module$build$src$core$events$utils(r),k(i),t.rendered){const e=s;setTimeout((()=>{e.disposed||e.setConnectionTracking(!0)}),1)}return s},bn=function(e,t){let{parentConnection:n,isShadow:o=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e.type)throw new $c(e);const r=t.newBlock(e.type,e.id);return r.setShadow(o),_n(r,e),Tn(r,e),vn(r,e),yn(n,r,e),En(r,e),In(r,e),Sn(r,e),wn(r,e),kn(r,t.rendered),r},_n=function(e,t){let n=void 0===t.x?0:t.x;t=void 0===t.y?0:t.y;const o=e.workspace;n=o.RTL?o.getWidth()-n:n,e.moveBy(n,t)},Tn=function(e,t){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.setEnabled(!1),void 0!==t.inline&&e.setInputsInline(t.inline),void 0!==t.data&&(e.data=t.data)},vn=function(e,t){t.extraState&&(e.loadExtraState?e.loadExtraState(t.extraState):e.domToMutation&&e.domToMutation(Ms.textToDom$$module$build$src$core$utils$xml(t.extraState)))},yn=function(e,t,n){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new Rc(n);if(e.type===Ms.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var o=t.outputConnection;if(!o)throw new Ac("output",t,n)}else if(!(o=t.previousConnection))throw new Ac("previous",t,n);if(!e.connect(o)){const r=t.workspace.connectionChecker;throw new Oc(r.getErrorMessage(r.canConnectWithReason(o,e,!1),o,e),e.type===Ms.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,n)}}},En=function(e,t){if(t.icons){var n=Object.keys(t.icons);for(const r of n){n=t.icons[r];var o=e.getIcon(r);if(!o){if(!(o=s(Us.ICON,r,!1)))throw new xc(r,e,t);o=new o(e),e.addIcon(o)}nn(o)&&o.loadState(n)}}},In=function(e,t){if(t.fields){var n=Object.keys(t.fields);for(let o=0;ot.id!=e.id)).map((e=>e.getRelativeToSurfaceXY()));for(;An(hl.sum(o,r),i)||On(e,r,n);)t.RTL?r.translate(-n,2*n):r.translate(n,2*n);e.moveTo(hl.sum(o,r))},An=function(e,t){return t.some((t=>1>=Math.abs(t.x-e.x)&&1>=Math.abs(t.y-e.y)))},On=function(e,t,n){return e.getConnections_(!1).some((e=>!!e.closest(n,t).connection))},Rn=function(e){return ne("Blockly.clipboard.copy","v11","v12","myCopyable.toCopyData()"),Qc.copyInternal(e)},xn=function(e){const t=e.toCopyData();let n;return qc=t,Zc=null!=(n=e.workspace)?n:null,t},Ln=function(e,t,n){return e&&t?Nn(e,t,n):qc&&Zc?Nn(qc,Zc):null},Nn=function(e,t,n){let o,r,i;return t=null!=(o=t.getRootWorkspace())?o:t,null!=(i=null==(r=a(Us.PASTER,e.paster,!1))?void 0:r.paste(e,t,n))?i:null},Mn=function(e){return ne("Blockly.clipboard.duplicate","v11","v12","Blockly.clipboard.paste(myCopyable.toCopyData(), myWorkspace)"),Qc.duplicateInternal(e)},Dn=function(e){const t=e.toCopyData();return t?Ln(t,e.workspace):null},Pn=function(e,t){e.setAttribute(ru,t)},Bn=function(e,t,n){Array.isArray(n)&&(n=n.join(" ")),e.setAttribute(ou+t,"".concat(n))},Fn=function(){return su},Un=function(e){if(su=e,null===e){let e;null==(e=document.querySelector("."+hu))||e.remove()}},Hn=function(){document.querySelector("."+hu)||((su=document.createElement("div")).className=hu,(_()||document.body).appendChild(su))},Gn=function(e,t,n){Vn(),cu=e,uu=n,(e=su)&&(e.style.direction=t?"rtl":"ltr",e.style.display="block",t=f(),du=t.getRenderer().getClassName(),pu=t.getTheme().getClassName(),du&&re(e,du),pu&&re(e,pu))},Vn=function(){if(Wn()){cu=null;var e=su;e&&(e.style.display="none",e.style.left="",e.style.top="",uu&&uu(),uu=null,e.textContent="",du&&(se(e,du),du=""),pu&&(se(e,pu),pu=""),f().markFocused())}},Wn=function(){return!!cu},jn=function(e){cu===e&&Vn()},zn=function(e,t,n){su.style.left=e+"px",su.style.top=t+"px",su.style.height=n+"px"},Xn=function(e,t,n,o){const r=Kn(e,t,n);e=Yn(e,t,n,o),0>r?zn(e,0,n.height+r):zn(e,r,n.height)},Yn=function(e,t,n,o){return o?Math.min(Math.max(t.right-n.width,e.left),e.right-n.width):Math.max(Math.min(t.left,e.right-n.width),e.left)},Kn=function(e,t,n){return t.bottom+n.height>=e.bottom?t.top-n.height:t.bottom},Jn=function(e){return!(null==e||!e.repositionForWindowResize)},qn=function(){Jn(cu)&&cu.repositionForWindowResize()||Vn()},Zn=function(){return gu},Qn=function(e){gu=e},eo=function(e,t,n){if(Gn(mu,n,so),t.length){var o=to(t,n);bu=o,no(o,e,n),setTimeout((function(){o.focus()}),1),gu=null}else io()},to=function(e,t){const n=new au;n.setRole(tu.MENU);for(let o=0;o{setTimeout((()=>{r.callback(r.scope)}),0)}))}),{})}return n},no=function(e,t,n){const o=Ae();t=new Il(t.clientY+o.top,t.clientY+o.top,t.clientX+o.left,t.clientX+o.left),oo(e);const r=e.getSize();n&&(t.left+=r.width,t.right+=r.width,o.left+=r.width,o.right+=r.width),Xn(o,t,r,n),e.focus()},oo=function(e){var t=Fn();if(!t)throw Error("Attempting to create a context menu when widget div is null");t=e.render(t),re(t,"blocklyContextMenu"),z(t,"contextmenu",null,ro),e.focus()},ro=function(e){e.preventDefault(),e.stopPropagation()},io=function(){jn(mu),gu=null},so=function(){bu&&(bu.dispose(),bu=null)},Ms.callbackFactory$$module$build$src$core$contextmenu=function(e,t){return()=>{let n;Ms.disable$$module$build$src$core$events$utils();try{n=t instanceof Element?Gt(t,e.workspace):mn(t,e.workspace);const o=e.getRelativeToSurfaceXY();o.x=e.RTL?o.x-Ms.config$$module$build$src$core$config.snapRadius:o.x+Ms.config$$module$build$src$core$config.snapRadius,o.y+=2*Ms.config$$module$build$src$core$config.snapRadius,n.moveBy(o.x,o.y)}finally{Ms.enable$$module$build$src$core$events$utils()}return N()&&!n.isShadow()&&A(new(B(Ms.CREATE$$module$build$src$core$events$utils))(n)),n.select(),n}},ao=function(e){return{text:Ms.Msg$$module$build$src$core$msg.REMOVE_COMMENT,enabled:!0,callback:function(){Ms.setGroup$$module$build$src$core$events$utils(!0),e.dispose(),Ms.setGroup$$module$build$src$core$events$utils(!1)}}},lo=function(e){return{text:Ms.Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){const t=e.toCopyData();t&&Ln(t,e.workspace)}}},co=function(e,t){const n={enabled:!0};return n.text=Ms.Msg$$module$build$src$core$msg.ADD_COMMENT,n.callback=function(){const n=new Tc(e,Ms.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT,Tc.DEFAULT_SIZE,Tc.DEFAULT_SIZE);var o=e.getInjectionDiv().getBoundingClientRect();o=new hl(t.clientX-o.left,t.clientY-o.top);const r=e.getOriginOffsetInPixels();(o=hl.difference(o,r)).scale(1/e.scale),n.moveBy(o.x,o.y),e.rendered&&(n.initSvg(),n.render(),n.select())},n},uo=function(e){return e*Math.PI/180},ho=function(e){return 180*e/Math.PI},po=function(e,t,n){if(nn)){var o=t.getSvgXY(e.getSvgRoot());e.outputConnection?(o.x+=(e.RTL?3:-3)*n,o.y+=13*n):e.previousConnection&&(o.x+=(e.RTL?-23:23)*n,o.y+=3*n);var r=oe(El.CIRCLE,{cx:o.x,cy:o.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg());e=oe(El.ANIMATE,{id:"animationCircle",begin:"indefinite",attributeName:"r",dur:"150ms",from:0,to:25*n},r),t=oe(El.ANIMATE,{id:"animationOpacity",begin:"indefinite",attributeName:"opacity",dur:"150ms",from:1,to:0},r),e.beginElement(),t.beginElement(),setTimeout((()=>{le(r)}),150)}},Fo=function(e){if(Ho(),e.workspace.getAudioManager().play("disconnect"),!(1>e.workspace.scale)){var t=e.getHeightWidth().height;t=Math.atan(10/t)/Math.PI*180,e.RTL||(t*=-1),Hu=e,Uo(e,t,new Date)}},Uo=function(e,t,n){const o=((new Date).getTime()-n.getTime())/200;let r="";1>=o&&(r="skewX(".concat(Math.round(Math.sin(o*Math.PI*3)*(1-o)*t),")"),Uu=setTimeout(Uo,10,e,t,n)),e.getSvgRoot().setAttribute("transform","".concat(e.getTranslation()," ").concat(r))},Ho=function(){Hu&&(Uu&&(clearTimeout(Uu),Uu=null),Hu.getSvgRoot().setAttribute("transform",Hu.getTranslation()),Hu=null)},Go=function(e,t){return ne("Blockly.utils.string.startsWith()","April 2022","April 2023","Use built-in string.startsWith"),e.startsWith(t)},Vo=function(e){return e.length?e.reduce((function(e,t){return e.lengtht&&(t=n[o].length);var r=-1/0;let i,s=1;do{o=r,i=e,e=[],r=n.length/s;let a=1;for(let t=0;to);return i},Xo=function(e,t,n){const o=[0],r=[];for(var i=0;ir&&(r=a,o=s)}return o?Yo(e,o,n):t},Ko=function(e,t){const n=[];for(let o=0;ouh&&cr()}else ah!==sh&&(clearTimeout(oh),rh=e.pageX,ih=e.pageY,oh=setTimeout(gr,hh))},lr=function(){ah=sh=null,cr()},cr=function(){Qu&&(Qu=!1,ph&&(ph.style.display="none")),oh&&(clearTimeout(oh),oh=0)},ur=function(){cr(),eh=!0},hr=function(){eh=!1},dr=function(){ph&&sh&&("function"===typeof Zu?Zu(ph,sh):pr())},pr=function(){var e=er(sh);e=(e=Ms.wrap$$module$build$src$core$utils$string(e,th)).split("\n");for(let t=0;tn+window.scrollY&&(r-=ph.offsetHeight+2*ch),e?o=Math.max(dh-window.scrollX,o):o+ph.offsetWidth>t+window.scrollX-2*dh&&(o=t-ph.offsetWidth-2*dh),{x:o,y:r}},gr=function(){if(!eh&&(ah=sh,ph)){ph.textContent="",dr();var e=sh.RTL;ph.style.direction=e?"rtl":"ltr",ph.style.display="block",Qu=!0;var{x:t,y:n}=fr(e);ph.style.left=t+"px",ph.style.top=n+"px"}},mr=function(e,t){for(const n in t)e[n]=null!==t[n]&&"object"===typeof t[n]?mr(e[n]||Object.create(null),t[n]):t[n];return e},br=function(e){return void 0!==e.bubbleIsVisible&&void 0!==e.setBubbleVisible},_r=function(){return Ch},Tr=function(e){Ch=e},vr=function(){return kh},yr=function(e){kh=e},Er=function(e){e="".concat(e).toLowerCase().trim();var t=$h[e];if(t)return t;if(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]].join("");var n=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return n&&(e=Number(n[1]),t=Number(n[2]),n=Number(n[3]),0<=e&&256>e&&0<=t&&256>t&&0<=n&&256>n)?Ir(e,t,n):null},Ir=function(e,t,n){return t=e<<16|t<<8|n,16>e?"#"+(16777216|t).toString(16).substr(1):"#"+t.toString(16)},Sr=function(e){return(e=Er(e))?[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]:[0,0,0]},wr=function(e,t,n){let o=0,r=0,i=0;if(0===t)i=r=o=n;else{const s=Math.floor(e/60),a=e/60-s;e=n*(1-t);const l=n*(1-t*a);switch(t=n*(1-t*(1-a)),s){case 1:o=l,r=n,i=e;break;case 2:o=e,r=n,i=t;break;case 3:o=e,r=l,i=n;break;case 4:o=t,r=e,i=n;break;case 5:o=n,r=e,i=l;break;case 6:case 0:o=n,r=t,i=e}}return Ir(Math.floor(o),Math.floor(r),Math.floor(i))},Cr=function(e,t,n){return(e=Er(e))&&(t=Er(t))?(e=Sr(e),t=Sr(t),Ir(Math.round(t[0]+n*(e[0]-t[0])),Math.round(t[1]+n*(e[1]-t[1])),Math.round(t[2]+n*(e[2]-t[2])))):null},kr=function(e){return wr(e,Ch,255*kh)},$r=function(e,t,n){const o=[];var r=e.split("");r.push("");var i=0;e=[];let s=null;for(let c=0;c=a?(i=2,s=a,(a=e.join(""))&&o.push(a),e.length=0):"{"===a?i=3:(e.push("%",a),i=0);else if(2===i)if("0"<=a&&"9">=a)s+=a;else{var l=void 0;o.push(parseInt(null!=(l=s)?l:"",10)),c--,i=0}else 3===i&&(""===a?(e.splice(0,0,"%{"),c--,i=0):"}"!==a?e.push(a):(i=e.join(""),/[A-Z]\w*/i.test(i)&&(a=(a=i.toUpperCase()).startsWith("BKY_")?a.substring(4):null)&&a in Ms.Msg$$module$build$src$core$msg?"string"===typeof(i=Ms.Msg$$module$build$src$core$msg[a])?Array.prototype.push.apply(o,$r(i,t,n)):t?o.push("".concat(i)):o.push(i):o.push("%{"+i+"}"),i=e.length=0))}for((t=e.join(""))&&o.push(t),l=[],e.length=0,r=0;r=n)return{hue:n,hex:wr(n,_r(),255*vr())};if(n=Er(t))return{hue:null,hex:n};throw n='Invalid colour: "'+t+'"',e!==t&&(n+=' (from "'+e+'")'),Error(n)},Lr=function(e){return void 0!==e.getProcedureModel&&void 0!==e.doProcedureUpdate&&void 0!==e.isProcedureDef},Nr=function(e){return void 0!==e.startPublishing&&void 0!==e.stopPublishing},Mr=function(t,n){e(Us.FIELD,t,n)},Dr=function(e){o(Us.FIELD,e)},Ms.fromJson$$module$build$src$core$field_registry=function(e){return Dh.fromJsonInternal(e)},Pr=function(e){const t=a(Us.FIELD,e.type);if(t){if("function"!==typeof t.fromJson)throw new TypeError("returned Field was not a IRegistrableField");return t.fromJson(e)}return 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},Br=function(e){let t=!1;const n=e.map((e=>{let[n,o]=e;return"string"===typeof n?[Or(n),o]:(t=!0,[null!==n.alt?Object.assign({},n,{alt:Or(n.alt)}):Object.assign({},n),o])}));if(t||2>e.length)return{options:n};var o=n.map((e=>{let[t]=e;return t})),r=Vo(o);e=Wo(o,r);const i=jo(o,r);return!e&&!i||r<=e+i?{options:n}:(r=e?o[0].substring(0,e-1):void 0,o=i?o[0].substr(1-i):void 0,{options:Fr(n,e,i),prefix:r,suffix:o})},Fr=function(e,t,n){return e.map((e=>{let[o,r]=e;return[o.substring(t,o.length-n),r]}))},Ur=function(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 n=0;n!e.getReturnTypes())).map((e=>[e.getName(),e.getParameters().map((e=>e.getName())),!1]));e.getBlocksByType("procedures_defnoreturn",!1).forEach((e=>{!Lr(e)&&ot(e)&&t.push(e.getProcedureDef())}));const n=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=>{!Lr(e)&&ot(e)&&n.push(e.getProcedureDef())})),t.sort(di),n.sort(di),[t,n]},di=function(e,t){return e[0].localeCompare(t[0],void 0,{sensitivity:"base"})},Ms.findLegalName$$module$build$src$core$procedures=function(e,t){if(t.isInFlyout)return e;for(e=e||Ms.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!pi(e,t.workspace,t);){const t=e.match(/^(.*?)(\d+)$/);e=t?t[1]+(parseInt(t[2])+1):e+"2"}return e},pi=function(e,t,n){return!fi(e,t,n)},fi=function(e,t,n){for(const o of t.getAllBlocks(!1))if(o!==n&&ot(o)&&Ms.Names$$module$build$src$core$names.equals(o.getProcedureDef()[0],e))return!0;n=n&&Lr(n)?null==n?void 0:n.getProcedureModel():void 0;for(const o of t.getProcedureMap().getProcedures())if(o!==n&&Ms.Names$$module$build$src$core$names.equals(o.getName(),e))return!0;return!1},Ms.rename$$module$build$src$core$procedures=function(e){var t=this.getSourceBlock();if(!t)throw new xh;e=e.trim();const n=Ms.findLegalName$$module$build$src$core$procedures(e,t);Lr(t)&&!t.isInsertionMarker()&&t.getProcedureModel().setName(n);const o=this.getValue();if(o!==e&&o!==n)for(e=t.workspace.getAllBlocks(!1),t=0;tvi(t,e)||rt(t)&&Ms.Names$$module$build$src$core$names.equals(t.getProcedureCall(),e)))},vi=function(e,t){return Lr(e)&&!e.isProcedureDef()&&e.getProcedureModel()&&Ms.Names$$module$build$src$core$names.equals(e.getProcedureModel().getName(),t)},Ms.mutateCallers$$module$build$src$core$procedures=function(e){const t=$();var n=e.getProcedureDef()[0];const o=e.mutationToDom(!0);e=Ti(n,e.workspace);for(let i,s=0;i=e[s];s++){n=(n=i.mutationToDom())&&Ne(n),i.domToMutation&&i.domToMutation(o);var r=i.mutationToDom();n!==(r=r&&Ne(r))&&(k(!1),A(new(B(Ms.CHANGE$$module$build$src$core$events$utils))(i,"mutation",null,n,r)),k(t))}},Ms.getDefinition$$module$build$src$core$procedures=function(e,t){for(const n of t.getAllBlocks(!1))if(Lr(n)&&n.isProcedureDef()&&Ms.Names$$module$build$src$core$names.equals(n.getProcedureModel().getName(),e)||ot(n)&&Ms.Names$$module$build$src$core$names.equals(n.getProcedureDef()[0],e))return n;return null},yi=function(e){return e.isDynamic},Ei=function(e){return void 0!==e.pathDown&&void 0!==e.pathUp},Ii=function(e){return void 0!==e.pathLeft&&void 0!==e.pathRight},Si=function(e){let t=e.outputConnection;return(!t||e.previousConnection&&e.previousConnection.isConnected())&&(t=e.previousConnection),t},wi=function(e,t){if(!e||!t)throw Error("Cannot connect null connections.");e.targetConnection=t,t.targetConnection=e},Ci=function(e,t){let n=null;const o=null==(t=t.outputConnection)?void 0:t.getConnectionChecker();for(let r,i=0;r=e.inputList[i];i++){const e=r.connection;let i;if(e&&null!=(i=o)&&i.canConnect(t,e,!1)){if(n)return null;n=e}}return n},ki=function(e,t){let n;for(;n=Ci(e,t);)if(!(e=n.targetBlock())||e.isShadow())return n;return null},$i=function(t,n){e(Us.RENDERER,t,n)},Ai=function(e){o(Us.RENDERER,e)},Oi=function(e,t,n){return(e=new(s(Us.RENDERER,e))(e)).init(t,n),e},Ri=function(e){ut(e.getTargetWorkspace(),void 0,"String")},xi=function(e){ut(e.getTargetWorkspace(),void 0,"Number")},Li=function(e){ut(e.getTargetWorkspace(),void 0,"Colour")},Ni=function(e){let t=[],n=document.createElement("button");return n.setAttribute("text",Ms.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE),n.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),t.push(n),n=document.createElement("button"),n.setAttribute("text",Ms.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE),n.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),t.push(n),n=document.createElement("button"),n.setAttribute("text",Ms.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE),n.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),t.push(n),e.registerButtonCallback("CREATE_VARIABLE_STRING",Ri),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",xi),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",Li),e=Mi(e),t.concat(e)},Mi=function(e){const t=[];if(0<(e=e.getAllVariables()).length){if(Ws.variables_set_dynamic){var n=e[e.length-1];const o=Ms.createElement$$module$build$src$core$utils$xml("block");o.setAttribute("type","variables_set_dynamic"),o.setAttribute("gap","24"),o.appendChild(bt(n)),t.push(o)}if(Ws.variables_get_dynamic){e.sort(ac.compareByName);for(let o,r=0;o=e[r];r++)(n=Ms.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get_dynamic"),n.setAttribute("gap","8"),n.appendChild(bt(o)),t.push(n)}}return t},Di=function(e){e.resizeContents()},Pi=function(e){return void 0!==e.toCopyData},Bi=function(){Kp.registry.register({name:Rp.ESCAPE,preconditionFn:e=>!e.options.readOnly,callback:e=>(e.hideChaff(),!0),keyCodes:[Xh.ESC]})},Fi=function(){Kp.registry.register({name:Rp.DELETE,preconditionFn(e){const t=m();return!e.options.readOnly&&null!=t&&t.isDeletable()},callback:(e,t)=>(t.preventDefault(),!_h.inProgress()&&(m().checkAndDelete(),!0)),keyCodes:[Xh.DELETE,Xh.BACKSPACE]})},Ui=function(){const e=Kp.registry.createSerializedKey(Xh.C,[Xh.CTRL]),t=Kp.registry.createSerializedKey(Xh.C,[Xh.ALT]),n=Kp.registry.createSerializedKey(Xh.C,[Xh.META]);Kp.registry.register({name:Rp.COPY,preconditionFn(e){const t=m();return!e.options.readOnly&&!_h.inProgress()&&null!=t&&t.isDeletable()&&t.isMovable()&&Pi(t)},callback:(e,t)=>(t.preventDefault(),e.hideChaff(),!(!(t=m())||!Pi(t))&&(Jp=t.toCopyData(),qp=e,!!Jp)),keyCodes:[e,t,n]})},Hi=function(){const e=Kp.registry.createSerializedKey(Xh.X,[Xh.CTRL]),t=Kp.registry.createSerializedKey(Xh.X,[Xh.ALT]),n=Kp.registry.createSerializedKey(Xh.X,[Xh.META]);Kp.registry.register({name:Rp.CUT,preconditionFn(e){const t=m();return!e.options.readOnly&&!_h.inProgress()&&null!=t&&t instanceof Op&&t.isDeletable()&&t.isMovable()&&!t.workspace.isFlyout},callback(e){const t=m();return!(!t||!Pi(t))&&(Jp=t.toCopyData(),qp=e,t.checkAndDelete(),!0)},keyCodes:[e,t,n]})},Gi=function(){const e=Kp.registry.createSerializedKey(Xh.V,[Xh.CTRL]),t=Kp.registry.createSerializedKey(Xh.V,[Xh.ALT]),n=Kp.registry.createSerializedKey(Xh.V,[Xh.META]);Kp.registry.register({name:Rp.PASTE,preconditionFn:e=>!e.options.readOnly&&!_h.inProgress(),callback:()=>!(!Jp||!qp)&&!!Ln(Jp,qp),keyCodes:[e,t,n]})},Vi=function(){const e=Kp.registry.createSerializedKey(Xh.Z,[Xh.CTRL]),t=Kp.registry.createSerializedKey(Xh.Z,[Xh.ALT]),n=Kp.registry.createSerializedKey(Xh.Z,[Xh.META]);Kp.registry.register({name:Rp.UNDO,preconditionFn:e=>!e.options.readOnly&&!_h.inProgress(),callback:e=>(e.hideChaff(),e.undo(!1),!0),keyCodes:[e,t,n]})},Wi=function(){const e=Kp.registry.createSerializedKey(Xh.Z,[Xh.SHIFT,Xh.CTRL]),t=Kp.registry.createSerializedKey(Xh.Z,[Xh.SHIFT,Xh.ALT]),n=Kp.registry.createSerializedKey(Xh.Z,[Xh.SHIFT,Xh.META]),o=Kp.registry.createSerializedKey(Xh.Y,[Xh.CTRL]);Kp.registry.register({name:Rp.REDO,preconditionFn:e=>!_h.inProgress()&&!e.options.readOnly,callback:e=>(e.hideChaff(),e.undo(!0),!0),keyCodes:[e,t,n,o]})},ji=function(){Bi(),Fi(),Ui(),Hi(),Gi(),Vi(),Wi()},zi=function(e){const t={id:e.getId(),name:e.getName(),returnTypes:e.getReturnTypes()};return e.getParameters().length?(t.parameters=e.getParameters().map((e=>Xi(e))),t):t},Xi=function(e){const t={id:e.getId(),name:e.getName()};return e.getTypes().length?(t.types=e.getTypes(),t):t},Yi=function(e,t,n,o){if(e=new e(o,n.name,n.id).setReturnTypes(n.returnTypes),!n.parameters)return e;for(const[r,i]of n.parameters.entries())e.insertParameter(Ki(t,i,o),r);return e},Ki=function(e,t,n){return e=new e(n,t.name,t.id),t.types&&e.setTypes(t.types),e},Ji=function(e){const t=Object.create(null),n=l(Us.SERIALIZER,!0);for(const o in n){let r;const i=null==(r=n[o])?void 0:r.save(e);i&&(t[o]=i)}return t},qi=function(e,t){let{recordUndo:n=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var o=l(Us.SERIALIZER,!0);if(o){o=Object.entries(o).sort(((e,t)=>t[1].priority-e[1].priority));var r=$();k(n),(n=Ms.getGroup$$module$build$src$core$events$utils())||Ms.setGroup$$module$build$src$core$events$utils(!0),de(),t instanceof bp&&t.setResizesEnabled(!1);for(const[,e]of o.reverse()){let n;null==(n=e)||n.clear(t)}for(let[n,r]of o.reverse())if(e[n]){let o;null==(o=r)||o.load(e[n],t)}t instanceof bp&&t.setResizesEnabled(!0),pe(),A(new(B(ba))(t)),Ms.setGroup$$module$build$src$core$events$utils(n),k(r)}},Zi=function(e,t,n){const o=n.getBoundingRectangle(),r=o.right-o.left,i=po(t.top,o.top,t.top+t.height-(o.bottom-o.top))-o.top;let s=t.left;return t=t.left+t.width-r,e.RTL?s=Math.min(t,s):t=Math.max(s,t),!(!(e=po(s,o.left,t)-o.left)&&!i)&&(n.moveBy(e,i,["inbounds"]),!0)},Qi=function(e){return t=>{var n,o=e.getMetricsManager();if(o.hasFixedEdges()&&!e.isDragging())if(-1!==_a.indexOf(null!=(n=t.type)?n:"")){n=o.getScrollMetrics(!0);const r=es(e,t);r&&(o=Ms.getGroup$$module$build$src$core$events$utils()||!1,Ms.setGroup$$module$build$src$core$events$utils(t.group),Zi(e,n,r)&&!t.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),Ms.setGroup$$module$build$src$core$events$utils(o))}else t.type===da&&t.scale&&t.oldScale&&t.scale>t.oldScale&&ts(e)}},es=function(e,t){let n=null;switch(t.type){case Ms.CREATE$$module$build$src$core$events$utils:case Ms.MOVE$$module$build$src$core$events$utils:(n=e.getBlockById(t.blockId))&&(n=n.getRootBlock());break;case pa:case ma:n=e.getCommentById(t.commentId)}return n},ts=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var n=e.getTopBoundedElements();for(let o,r=0;o=n[r];r++)Zi(e,t,o)}},ns=function(e,t){const n=[];for(const o of e.getIcons())br(o)&&!o.bubbleIsVisible()||(n.push({location:t,icon:o}),o.onLocationChange(t));for(const o of e.getChildren(!1))n.push(...ns(o,hl.sum(t,o.relativeCoords)));return n},os=function(){Tu.registry.register({displayText:()=>Ms.Msg$$module$build$src$core$msg.UNDO,preconditionFn:e=>0Ms.Msg$$module$build$src$core$msg.REDO,preconditionFn:e=>0Ms.Msg$$module$build$src$core$msg.CLEAN_UP,preconditionFn:e=>e.workspace.isMovable()?1Ms.Msg$$module$build$src$core$msg.COLLAPSE_ALL,preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;tMs.Msg$$module$build$src$core$msg.EXPAND_ALL,preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;te.workspace?1===(e=us(e.workspace).length)?Ms.Msg$$module$build$src$core$msg.DELETE_BLOCK:Ms.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1","".concat(e)):"",preconditionFn:e=>e.workspace&&0t.length?hs(t):qe(Ms.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),(function(e){e&&hs(t)}))}},scopeType:Tu.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},ps=function(){os(),rs(),is(),as(),ls(),ds()},fs=function(){Tu.registry.register({displayText:()=>Ms.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&&Ln(t,e.block.workspace)}},scopeType:Tu.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},gs=function(){Tu.registry.register({displayText:e=>e.block.hasIcon(od.TYPE)?Ms.Msg$$module$build$src$core$msg.REMOVE_COMMENT:Ms.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(od.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:Tu.ScopeType.BLOCK,id:"blockComment",weight:2})},ms=function(){Tu.registry.register({displayText:e=>e.block.getInputsInline()?Ms.Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:Ms.Msg$$module$build$src$core$msg.INLINE_INPUTS,preconditionFn(e){if(!(e=e.block).isInFlyout&&e.isMovable()&&!e.isCollapsed())for(let t=1;te.block.isCollapsed()?Ms.Msg$$module$build$src$core$msg.EXPAND_BLOCK:Ms.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:Tu.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},_s=function(){Tu.registry.register({displayText:e=>e.block.isEnabled()?Ms.Msg$$module$build$src$core$msg.DISABLE_BLOCK:Ms.Msg$$module$build$src$core$msg.ENABLE_BLOCK,preconditionFn:e=>!(e=e.block).isInFlyout&&e.workspace.options.disable&&e.isEditable()?e.getInheritedDisabled()?"disabled":"enabled":"hidden",callback(e){e=e.block;const t=Ms.getGroup$$module$build$src$core$events$utils();t||Ms.setGroup$$module$build$src$core$events$utils(!0),e.setEnabled(!e.isEnabled()),Ms.setGroup$$module$build$src$core$events$utils(t)},scopeType:Tu.ScopeType.BLOCK,id:"blockDisable",weight:5})},Ts=function(){Tu.registry.register({displayText(e){var t=e.block;return e=t.getDescendants(!1).length,(t=t.getNextBlock())&&(e-=t.getDescendants(!1).length),1===e?Ms.Msg$$module$build$src$core$msg.DELETE_BLOCK:Ms.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1","".concat(e))},preconditionFn:e=>!e.block.isInFlyout&&e.block.isDeletable()?"enabled":"hidden",callback(e){e.block&&e.block.checkAndDelete()},scopeType:Tu.ScopeType.BLOCK,id:"blockDelete",weight:6})},vs=function(){Tu.registry.register({displayText:()=>Ms.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:Tu.ScopeType.BLOCK,id:"blockHelp",weight:7})},ys=function(){fs(),gs(),ms(),bs(),_s(),Ts(),vs()},Es=function(){ps(),ys()},Is=function(e,t){var n=null;let o;if(n="string"===typeof e?document.getElementById(e)||document.querySelector(e):e,!document.contains(n)&&document!==(null==(o=n)?void 0:o.ownerDocument))throw Error("Error: container is not in current document");e=new Sh(t||{}),(t=document.createElement("div")).className="injectionDiv",t.tabIndex=0,Bn(t,nu.LABEL,Ms.Msg$$module$build$src$core$msg.WORKSPACE_ARIA_LABEL),n.appendChild(t),n=Ss(t,e);const r=ws(t,n,e);return Cs(r),g(r),v(r),t.addEventListener("focusin",(function(){g(r)})),r},Ss=function(e,t){e.setAttribute("dir","LTR"),te(t.hasCss,t.pathToMedia),e=oe(El.SVG,{xmlns:gl,"xmlns:html":ml,"xmlns:xlink":bl,version:"1.1",class:"blocklySvg",tabindex:"0"},e);const n=oe(El.DEFS,{},e),o=String(Math.random()).substring(2);return t.gridPattern=Th.createDom(o,t.gridOptions,n),e},ws=function(e,t,n){n.parentWorkspace=null;const o=(n=new bp(n)).options;n.scale=o.zoomOptions.startScale,t.appendChild(n.createDom("blocklyMainBackground",e));var r=n.getRenderer().getClassName();return r&&re(e,r),(r=n.getTheme().getClassName())&&re(e,r),!o.hasCategories&&o.languageTree&&(e=n.addFlyout(El.SVG),ce(e,t)),o.hasTrashcan&&n.addTrashcan(),o.zoomOptions&&o.zoomOptions.controls&&n.addZoomControls(),n.getThemeManager().subscribe(t,"workspaceBackgroundColour","background-color"),n.translate(0,0),n.addChangeListener(Qi(n)),v(n),Hn(),fo(),nr(),n},Cs=function(e){const t=e.options;var n=e.getParentSvg();if(z(n.parentNode,"contextmenu",null,(function(e){K(e)||e.preventDefault()})),n=z(window,"resize",null,(function(){cr(),e.hideComponents(!0),Mo(),qn(),v(e),ts(e)})),e.setResizeHandlerWrapper(n),$s(),t.languageTree){n=e.getToolbox();const o=e.getFlyout(!0);n?n.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 sf(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&&As(t.pathToMedia,e)},ks=function(e){const t=f();t&&!(K(e)||t.rendered&&!t.isVisible())&&Kp.registry.onKeyDown(t,e)},$s=function(){tg||(z(document,"scroll",null,(function(){const e=h();for(let t,n=0;t=e[n];n++)t instanceof bp&&t.updateInverseScreenCTM()})),z(document,"keydown",null,ks),X(document,"touchend",null,H),X(document,"touchcancel",null,H),qa&&z(window,"orientationchange",document,(function(){v(f())}))),tg=!0},As=function(e,t){function n(){for(;r.length;){const e=r.pop();e&&Y(e)}o.preload()}const 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");const r=[];r.push(z(document,"pointermove",null,n,!0)),r.push(z(document,"touchstart",null,n,!0))},Os=function(e){return void 0!==e.getType&&void 0!==e.initView&&void 0!==e.dispose&&void 0!==e.getWeight&&void 0!==e.getSize&&void 0!==e.applyColour&&void 0!==e.hideForInsertionMarker&&void 0!==e.updateEditable&&void 0!==e.updateCollapsed&&void 0!==e.isShownWhenCollapsed&&void 0!==e.setOffsetInBlock&&void 0!==e.onLocationChange&&void 0!==e.onClick},Rs=function(e){return void 0!==e.paste},xs=function(e){return e.isSelectable()},Ls=function(e){f().hideChaff(e)},(Ns=Ns||{}).scope={},Ns.ASSUME_ES5=!1,Ns.ASSUME_NO_NATIVE_MAP=!1,Ns.ASSUME_NO_NATIVE_SET=!1,Ns.SIMPLE_FROUND_POLYFILL=!1,Ns.ISOLATE_POLYFILLS=!1,Ns.FORCE_POLYFILL_PROMISE=!1,Ns.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,Ns.defineProperty=Ns.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e},Ns.getGlobal=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof n.g&&n.g];for(var t=0;t>>0,Ns.propertyToPolyfillSymbol[r]=Ns.IS_SYMBOL_NATIVE?Ns.global.Symbol(r):Ns.POLYFILL_PREFIX+n+"$"+r),Ns.defineProperty(o,Ns.propertyToPolyfillSymbol[r],{configurable:!0,writable:!0,value:t})))},Ns.polyfill("globalThis",(function(e){return e||Ns.global}),"es_2020","es3"),Ns.arrayIteratorImpl=function(e){var t=0;return function(){return t{const e=Ea.length,t=[];for(let n=0;20>n;n++)t[n]=Ea.charAt(Math.random()*e);return t.join("")}},Sa=0,wa={TEST_ONLY:Ia};wa.genUid=C,wa.getNextUniqueId=w,Js="",qs=!0,Zs=0,Ms.CREATE$$module$build$src$core$events$utils="create",Ms.CREATE$$module$build$src$core$events$utils,Ms.DELETE$$module$build$src$core$events$utils="delete",Ms.DELETE$$module$build$src$core$events$utils,Ms.CHANGE$$module$build$src$core$events$utils="change",Ms.CHANGE$$module$build$src$core$events$utils,Qs="block_field_intermediate_change",Ms.MOVE$$module$build$src$core$events$utils="move",Ms.MOVE$$module$build$src$core$events$utils,ea="var_create",ta="var_delete",na="var_rename",oa="ui",ra="drag",ia="selected",sa="click",aa="marker_move",la="bubble_open",ca="trashcan_open",ua="toolbox_item_select",ha="theme_change",da="viewport_change",pa="comment_create",fa="comment_delete",ga="comment_change",ma="comment_move",ba="finished_loading",_a=[Ms.CREATE$$module$build$src$core$events$utils,Ms.MOVE$$module$build$src$core$events$utils,pa,ma],va={FIRE_QUEUE:Ta=[],fireNow:R,fireInternal:O,setGroupInternal:M},(ya={BLOCK_CHANGE:Ms.CHANGE$$module$build$src$core$events$utils,BLOCK_CREATE:Ms.CREATE$$module$build$src$core$events$utils,BLOCK_DELETE:Ms.DELETE$$module$build$src$core$events$utils,BLOCK_DRAG:ra,BLOCK_FIELD_INTERMEDIATE_CHANGE:Qs,BLOCK_MOVE:Ms.MOVE$$module$build$src$core$events$utils,BUBBLE_OPEN:la,BUMP_EVENTS:_a,CHANGE:Ms.CHANGE$$module$build$src$core$events$utils,CLICK:sa,COMMENT_CHANGE:ga,COMMENT_CREATE:pa,COMMENT_DELETE:fa,COMMENT_MOVE:ma,CREATE:Ms.CREATE$$module$build$src$core$events$utils,DELETE:Ms.DELETE$$module$build$src$core$events$utils,FINISHED_LOADING:ba,MARKER_MOVE:aa,MOVE:Ms.MOVE$$module$build$src$core$events$utils,SELECTED:ia,TEST_ONLY:va,THEME_CHANGE:ha,TOOLBOX_ITEM_SELECT:ua,TRASHCAN_OPEN:ca,UI:oa,VAR_CREATE:ea,VAR_DELETE:ta,VAR_RENAME:na,VIEWPORT_CHANGE:da}).clearPendingUndo=L,ya.disable=Ms.disable$$module$build$src$core$events$utils,ya.disableOrphans=F,ya.enable=Ms.enable$$module$build$src$core$events$utils,ya.filter=x,ya.fire=A,ya.fromJson=P,ya.get=B,ya.getDescendantIds=D,ya.getGroup=Ms.getGroup$$module$build$src$core$events$utils,ya.getRecordUndo=$,ya.isEnabled=N,ya.setGroup=Ms.setGroup$$module$build$src$core$events$utils,ya.setRecordUndo=k;var Ca,ka,$a=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=Ms.getGroup$$module$build$src$core$events$utils(),this.recordUndo=$()}toJson(){return{type:this.type,group:this.group}}static fromJson(e,t,n){return n.isBlank=!1,n.group=e.group||"",n.workspaceId=t.id,n}isNull(){return!1}run(e){}getEventWorkspace_(){let e;if(this.workspaceId&&(e=u(this.workspaceId)),!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e}},Aa=class extends $a{constructor(e){super(),this.recordUndo=!1,this.isUiEvent=!0,this.isBlank="undefined"===typeof e,this.workspaceId=e||""}},Oa=class extends Aa{constructor(e,t,n){null===(t=e?e.workspace.id:t)&&(t=void 0),super(t),this.type=sa,this.blockId=e?e.id:void 0,this.targetType=n}toJson(){const e=super.toJson();if(!this.targetType)throw Error("The click target type is undefined. Either pass a block to the constructor, or call fromJson");return e.targetType=this.targetType,e.blockId=this.blockId,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new Oa)).targetType=e.targetType,t.blockId=e.blockId,t}};(ka=Ca||(Ca={})).BLOCK="block",ka.WORKSPACE="workspace",ka.ZOOM_CONTROLS="zoom_controls",e(Us.EVENT,sa,Oa);var Ra={};Ra.Click=Oa,Ra.ClickTarget=Ca;var xa,La,Na,Ma,Da,Pa,Ba,Fa,Ua,Ha,Ga=750,Va="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),Wa=null,ja={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},za=0,Xa={TOUCH_ENABLED:Va,TOUCH_MAP:ja};Xa.checkTouchIdentifier=j,Xa.clearTouchIdentifier=G,Xa.getTouchIdentifierFromEvent=W,Xa.longStart=U,Xa.longStop=H,Xa.shouldHandleEvent=V,function(e){function t(e){return-1!==n.indexOf(e.toUpperCase())}const n=(xa=e).toUpperCase();La=t("JavaFX"),Na=t("WebKit"),Ma=t("Gecko")&&!Na,Da=t("Android"),e=globalThis.navigator&&globalThis.navigator.maxTouchPoints,Pa=t("iPad")||t("Macintosh")&&0{t.push(this.componentData.get(e))})),t.sort((function(e,t){return e.weight-t.weight})),t.forEach((function(e){n.push(e.component)}))}else e.forEach((e=>{n.push(this.componentData.get(e).component)}));return n}};al.Capability=sl;var ll=!1,cl='\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}\n\n.blocklyNonSelectable {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\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.blocklyFocused {\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 overflow: auto;\n overflow-x: hidden;\n position: relative;\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}\n\n.blocklyDropDownButton {\n display: inline-block;\n float: left;\n padding: 0;\n margin: 4px;\n border-radius: 4px;\n outline: none;\n border: 1px solid;\n transition: box-shadow .1s;\n cursor: pointer;\n}\n\n.blocklyArrowTop {\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyArrowBottom {\n border-bottom: 1px solid;\n border-right: 1px solid;\n border-bottom-right-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyResizeSE {\n cursor: se-resize;\n fill: #aaa;\n}\n\n.blocklyResizeSW {\n cursor: sw-resize;\n fill: #aaa;\n}\n\n.blocklyResizeLine {\n stroke: #515A5A;\n stroke-width: 1;\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}\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("<<>>/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.blocklyDisabled>.blocklyPath {\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.blocklyMultilineText {\n font-family: monospace;\n}\n\n.blocklyNonEditableText>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.blocklyHidden {\n display: none;\n}\n\n.blocklyFieldDropdown:not(.blocklyHidden) {\n display: block;\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}\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}\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 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.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\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 position: relative; /* Compatibility with gapi, reset from goog-menu */\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(<<>>/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.blocklyBlockDragSurface {\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',ul={};ul.inject=te,ul.register=ee;var hl=class{constructor(e,t){this.x=e,this.y=t}clone(){return new hl(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){const n=e.x-t.x;return e=e.y-t.y,Math.sqrt(n*n+e*e)}static magnitude(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static difference(e,t){return new hl(e.x-t.x,e.y-t.y)}static sum(e,t){return new hl(e.x+t.x,e.y+t.y)}},dl=new Set,pl={};pl.warn=ne;var fl,gl="http://www.w3.org/2000/svg",ml="http://www.w3.org/1999/xhtml",bl="http://www.w3.org/1999/xlink";!function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE"}(fl||(fl={}));var _l=null,Tl=0,vl=null,yl={HTML_NS:ml};yl.NodeType=fl,yl.SVG_NS=gl,yl.XLINK_NS=bl,yl.addClass=re,yl.containsNode=ue,yl.createSvgElement=oe,yl.getFastTextWidth=ge,yl.getFastTextWidthWithSizeString=me,yl.getTextWidth=fe,yl.hasClass=ae,yl.insertAfter=ce,yl.measureFontMetrics=be,yl.removeClass=se,yl.removeClasses=ie,yl.removeNode=le,yl.setCssTransform=he,yl.startTextWidthCache=de,yl.stopTextWidthCache=pe;var El=class{constructor(e){this.tagName=e}toString(){return this.tagName}};El.ANIMATE=new El("animate"),El.CIRCLE=new El("circle"),El.CLIPPATH=new El("clipPath"),El.DEFS=new El("defs"),El.FECOMPOSITE=new El("feComposite"),El.FECOMPONENTTRANSFER=new El("feComponentTransfer"),El.FEFLOOD=new El("feFlood"),El.FEFUNCA=new El("feFuncA"),El.FEGAUSSIANBLUR=new El("feGaussianBlur"),El.FEPOINTLIGHT=new El("fePointLight"),El.FESPECULARLIGHTING=new El("feSpecularLighting"),El.FILTER=new El("filter"),El.FOREIGNOBJECT=new El("foreignObject"),El.G=new El("g"),El.IMAGE=new El("image"),El.LINE=new El("line"),El.PATH=new El("path"),El.PATTERN=new El("pattern"),El.POLYGON=new El("polygon"),El.RECT=new El("rect"),El.SVG=new El("svg"),El.TEXT=new El("text"),El.TSPAN=new El("tspan");var Il=class{constructor(e,t,n,o){this.top=e,this.bottom=t,this.left=n,this.right=o}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}contains(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}intersects(e){return!(this.left>e.right||this.righte.bottom||this.bottom=e||isNaN(e)?0:Math.min(e,this.scrollbarLength)}setHandleLength(e){this.handleLength=e,this.svgHandle.setAttribute(this.lengthAttribute_,String(this.handleLength))}constrainHandlePosition(e){return 0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength-this.handleLength)}setHandlePosition(e){this.handlePosition=e,this.svgHandle.setAttribute(this.positionAttribute_,String(this.handlePosition))}setScrollbarLength(e){this.scrollbarLength=e,this.outerSvg.setAttribute(this.lengthAttribute_,String(this.scrollbarLength)),this.svgBackground.setAttribute(this.lengthAttribute_,String(this.scrollbarLength))}setPosition(e,t){this.position.x=e,this.position.y=t,he(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&&Ol.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-=Ol.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&(t+=Ol.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-Ol.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 n=this.scrollbarLength-this.handleLength;e=(e.viewLeft-e.scrollLeft)/t*n,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=n/t}}resizeVertical(e){this.requiresViewResize(e)?this.resizeViewVertical(e):this.resizeContentVertical(e)}resizeViewVertical(e){let t=e.viewHeight-2*this.margin;this.pair&&(t-=Ol.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-Ol.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 n=this.scrollbarLength-this.handleLength;e=(e.viewTop-e.scrollTop)/t*n,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=n/t}}isVisible(){return this.isHandleVisible}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay_()}setVisible(e){if(this.pair)throw Error("Unable to toggle visibility of paired scrollbars.");this.setVisibleInternal(e)}setVisibleInternal(e){const t=e!==this.isVisible();this.isHandleVisible=e,t&&this.updateDisplay_()}updateDisplay_(){this.containerVisible&&this.isVisible()?this.outerSvg.setAttribute("display","block"):this.outerSvg.setAttribute("display","none")}onMouseDownBar(e){if(this.workspace.markFocused(),G(),this.cleanUp(),J(e))e.stopPropagation();else{var t=q(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var n=$e(this.svgHandle);n=this.horizontal?n.x:n.y;var o=this.handlePosition,r=.95*this.handleLength;t<=n?o-=r:t>=n+this.handleLength&&(o+=r),this.setHandlePosition(this.constrainHandlePosition(o)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),J(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=z(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=z(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(){G(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&(Y(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onMouseMoveWrapper_&&(Y(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){let e=this.handlePosition/(this.scrollbarLength-this.handleLength);return isNaN(e)&&(e=0),e}updateMetrics(){const e=this.getRatio_();this.horizontal?this.workspace.setMetrics({x:e}):this.workspace.setMetrics({y:e})}set(e,t){this.setHandlePosition(this.constrainHandlePosition(e*this.ratio)),(t||void 0===t)&&this.updateMetrics()}setOrigin(e,t){this.origin=new hl(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}};Ol.scrollbarThickness=Va?25:15,Ol.DEFAULT_SCROLLBAR_MARGIN=.5;var Rl={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},xl={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:Ll,DOMParser:Nl,XMLSerializer:Ml}=globalThis;Nl&&(Rl=new Nl),Ml&&(xl=new Ml);var Dl="https://developers.google.com/blockly/xml",Pl=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,Bl={NAME_SPACE:Dl};Bl.createElement=Ms.createElement$$module$build$src$core$utils$xml,Bl.createTextNode=Ms.createTextNode$$module$build$src$core$utils$xml,Bl.domToText=Ne,Bl.injectDependencies=Le,Bl.textToDom=Ms.textToDom$$module$build$src$core$utils$xml;var Fl,Ul="categoryToolbox",Hl="flyoutToolbox";!function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"}(Fl||(Fl={}));var Gl,Vl,Wl,jl={hasCategoriesInternal:Ue},zl={};zl.Position=Fl,zl.TEST_ONLY=jl,zl.convertFlyoutDefToJsonArray=Be,zl.convertToolboxDefToJson=De,zl.hasCategories=Fe,zl.isCategoryCollapsible=He,zl.parseToolboxTree=je,function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM"}(Gl||(Gl={})),function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT"}(Vl||(Vl={})),function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"}(Wl||(Wl={}));var Xl={};Xl.bumpDirection=Wl,Xl.bumpPositionRect=Ye,Xl.getCornerOppositeToolbox=Xe,Xl.getStartPositionRect=ze,Xl.horizontalPosition=Vl,Xl.verticalPosition=Gl;var Yl={width:96,height:124,url:"sprites.png"},Kl=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=oe(El.G,{});const e=String(Math.random()).substring(2);return this.createZoomOutSvg(e),this.createZoomInSvg(e),this.workspace.isMovable()&&this.createZoomResetSvg(e),this.svgGroup}init(){this.workspace.getComponentManager().addComponent({component:this,weight:2,capabilities:[al.Capability.POSITIONABLE]}),this.initialized=!0}dispose(){this.workspace.getComponentManager().removeComponent("zoomControls"),this.svgGroup&&le(this.svgGroup);for(const e of this.boundEvents)Y(e);this.boundEvents.length=0}getBoundingRectangle(){let e=this.SMALL_SPACING+2*this.HEIGHT;return this.zoomResetGroup&&(e+=this.LARGE_SPACING+this.HEIGHT),new Il(this.top,this.top+e,this.left,this.left+this.WIDTH)}position(e,t){if(this.initialized){var n,o=Xe(this.workspace,e),r=this.SMALL_SPACING+2*this.HEIGHT;if(this.zoomResetGroup&&(r+=this.LARGE_SPACING+this.HEIGHT),e=ze(o,new Sl(this.WIDTH,r),this.MARGIN_HORIZONTAL,this.MARGIN_VERTICAL,e,this.workspace),o=o.vertical,t=Ye(e,this.MARGIN_VERTICAL,o===Gl.TOP?Wl.DOWN:Wl.UP,t),o===Gl.TOP){var i,s=this.SMALL_SPACING+this.HEIGHT;null==(i=this.zoomInGroup)||i.setAttribute("transform","translate(0, "+s+")"),this.zoomResetGroup&&this.zoomResetGroup.setAttribute("transform","translate(0, "+(s+this.LARGE_SPACING+this.HEIGHT)+")")}else{let e;i=this.zoomResetGroup?this.LARGE_SPACING+this.HEIGHT:0,null==(e=this.zoomInGroup)||e.setAttribute("transform","translate(0, "+i+")"),i=i+this.SMALL_SPACING+this.HEIGHT,null==(s=this.zoomOutGroup)||s.setAttribute("transform","translate(0, "+i+")")}this.top=t.top,this.left=t.left,null==(n=this.svgGroup)||n.setAttribute("transform","translate("+this.left+","+this.top+")")}}createZoomOutSvg(e){this.zoomOutGroup=oe(El.G,{class:"blocklyZoom blocklyZoomOut"},this.svgGroup);const t=oe(El.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup);oe(El.RECT,{width:32,height:32},t),oe(El.IMAGE,{width:Yl.width,height:Yl.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup).setAttributeNS(bl,"xlink:href",this.workspace.options.pathToMedia+Yl.url),this.boundEvents.push(z(this.zoomOutGroup,"pointerdown",null,this.zoom.bind(this,-1)))}createZoomInSvg(e){this.zoomInGroup=oe(El.G,{class:"blocklyZoom blocklyZoomIn"},this.svgGroup);const t=oe(El.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup);oe(El.RECT,{width:32,height:32},t),oe(El.IMAGE,{width:Yl.width,height:Yl.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup).setAttributeNS(bl,"xlink:href",this.workspace.options.pathToMedia+Yl.url),this.boundEvents.push(z(this.zoomInGroup,"pointerdown",null,this.zoom.bind(this,1)))}zoom(e,t){this.workspace.markFocused(),this.workspace.zoomCenter(e),this.fireZoomEvent(),G(),t.stopPropagation(),t.preventDefault()}createZoomResetSvg(e){this.zoomResetGroup=oe(El.G,{class:"blocklyZoom blocklyZoomReset"},this.svgGroup);const t=oe(El.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup);oe(El.RECT,{width:32,height:32},t),oe(El.IMAGE,{width:Yl.width,height:Yl.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup).setAttributeNS(bl,"xlink:href",this.workspace.options.pathToMedia+Yl.url),this.boundEvents.push(z(this.zoomResetGroup,"pointerdown",null,this.resetZoom.bind(this)))}resetZoom(e){this.workspace.markFocused();const t=Math.log(this.workspace.options.zoomOptions.startScale/this.workspace.scale)/Math.log(this.workspace.options.zoomOptions.scaleSpeed);this.workspace.beginCanvasTransition(),this.workspace.zoomCenter(t),this.workspace.scrollCenter(),setTimeout(this.workspace.endCanvasTransition.bind(this.workspace),500),this.fireZoomEvent(),G(),e.stopPropagation(),e.preventDefault()}fireZoomEvent(){const e=new(B(sa))(null,this.workspace.id,"zoom_controls");A(e)}};ee("\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 Jl=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};Jl.MUTATOR=new Jl("mutator"),Jl.WARNING=new Jl("warning"),Jl.COMMENT=new Jl("comment"),function(e){e[e.VALUE=1]="VALUE",e[e.STATEMENT=3]="STATEMENT",e[e.DUMMY=5]="DUMMY",e[e.CUSTOM=6]="CUSTOM",e[e.END_ROW=7]="END_ROW"}(Ms.inputTypes$$module$build$src$core$inputs$input_types||(Ms.inputTypes$$module$build$src$core$inputs$input_types={})),Ms.inputTypes$$module$build$src$core$inputs$input_types;var ql,Zl,Ql=function(e,t){window.alert(e),t&&t()},ec=function(e,t){t(window.confirm(e))},tc=function(e,t,n){n(window.prompt(e,t))},nc={confirmInternal:Ze},oc={TEST_ONLY:nc};oc.alert=Ke,oc.confirm=qe,oc.prompt=et,oc.setAlert=Je,oc.setConfirm=Qe,oc.setPrompt=tt,Ms.Msg$$module$build$src$core$msg=Object.create(null),ql=function(e){Object.keys(e).forEach((function(t){Ms.Msg$$module$build$src$core$msg[t]=e[t]}))},Zl={Msg:Ms.Msg$$module$build$src$core$msg,setLocale:ql};var rc={};rc.isLegacyProcedureCallBlock=rt,rc.isLegacyProcedureDefBlock=ot;var ic=class extends $a{constructor(e){super(),this.isBlank="undefined"===typeof e,e&&(this.varId=e.getId(),this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");return e.varId=this.varId,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new ic)).varId=e.varId,t}},sc=class extends ic{constructor(e){super(e),this.type=ea,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const 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,n){return(t=super.fromJson(e,t,null!=n?n:new sc)).varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.createVariable(this.varName,this.varType,this.varId):t.deleteVariableById(this.varId)}};e(Us.EVENT,ea,sc);var ac=class{constructor(e,t,n,o){this.workspace=e,this.name=t,this.type=n||"",this.id_=o||C()}getId(){return this.id_}static compareByName(e,t){return e.name.localeCompare(t.name,void 0,{sensitivity:"base"})}},lc="VARIABLE",cc="ijkmnopqrstuvwxyzabcdefgh",uc={generateUniqueNameInternal:lt},hc={CATEGORY_NAME:lc,TEST_ONLY:uc,VAR_LETTER_OPTIONS:cc};hc.allDeveloperVariables=Ms.allDeveloperVariables$$module$build$src$core$variables,hc.allUsedVarModels=Ms.allUsedVarModels$$module$build$src$core$variables,hc.createVariableButtonHandler=ut,hc.flyoutCategory=it,hc.flyoutCategoryBlocks=st,hc.generateUniqueName=at,hc.generateUniqueNameFromOptions=ct,hc.generateVariableFieldDom=bt,hc.getAddedVariables=Tt,hc.getOrCreateVariablePackage=Ms.getOrCreateVariablePackage$$module$build$src$core$variables,hc.getVariable=Ms.getVariable$$module$build$src$core$variables,hc.nameUsedWithAnyType=pt,hc.nameUsedWithConflictingParam=ft,hc.promptName=ht,hc.renameVariable=Ms.renameVariable$$module$build$src$core$variables;var dc=class{constructor(e,t,n,o,r){this.workspace=e,this.editable=this.movable=this.deletable=!0,this.disposed_=!1,this.isComment=!0,this.id=r&&!e.getCommentById(r)?r:C(),e.addTopComment(this),this.xy_=new hl(0,0),this.height_=n,this.width_=o,this.RTL=e.RTL,this.content_=t,dc.fireCreateEvent(this)}dispose(){this.disposed_||(N()&&A(new(B(fa))(this)),this.workspace.removeTopComment(this),this.disposed_=!0)}getHeight(){return this.height_}setHeight(e){this.height_=e}getWidth(){return this.width_}setWidth(e){this.width_=e}getRelativeToSurfaceXY(){return new hl(this.xy_.x,this.xy_.y)}moveBy(e,t){const n=new(B(ma))(this);this.xy_.translate(e,t),n.recordNew(),A(n)}isDeletable(){return this.deletable&&!(this.workspace&&this.workspace.options.readOnly)}setDeletable(e){this.deletable=e}isMovable(){return this.movable&&!(this.workspace&&this.workspace.options.readOnly)}setMovable(e){this.movable=e}isEditable(){return this.editable&&!(this.workspace&&this.workspace.options.readOnly)}setEditable(e){this.editable=e}getContent(){return this.content_}setContent(e){this.content_!==e&&(A(new(B(ga))(this,this.content_,e)),this.content_=e)}toXmlWithXY(e){return(e=this.toXml(e)).setAttribute("x",String(Math.round(this.xy_.x))),e.setAttribute("y",String(Math.round(this.xy_.y))),e.setAttribute("h",String(this.height_)),e.setAttribute("w",String(this.width_)),e}toXml(e){const t=Ms.createElement$$module$build$src$core$utils$xml("comment");return e||(t.id=this.id),t.textContent=this.getContent(),t}static fireCreateEvent(e){if(N()){const t=Ms.getGroup$$module$build$src$core$events$utils();t||Ms.setGroup$$module$build$src$core$events$utils(!0);try{A(new(B(pa))(e))}finally{Ms.setGroup$$module$build$src$core$events$utils(t)}}}static fromXml(e,t){var n=dc.parseAttributes(e);return t=new dc(t,n.content,n.h,n.w,n.id),n=e.getAttribute("x"),e=e.getAttribute("y"),n=n?parseInt(n,10):NaN,e=e?parseInt(e,10):NaN,isNaN(n)||isNaN(e)||t.moveBy(n,e),dc.fireCreateEvent(t),t}static parseAttributes(e){const t=e.getAttribute("h"),n=e.getAttribute("w"),o=e.getAttribute("x"),r=e.getAttribute("y"),i=e.getAttribute("id");if(!i)throw Error("No ID present in XML comment definition.");let s;return{id:i,h:t?parseInt(t):100,w:n?parseInt(n):100,x:o?parseInt(o):NaN,y:r?parseInt(r):NaN,content:null!=(s=e.textContent)?s:""}}},pc=class extends Aa{constructor(e,t,n){super(n),this.type=ia,this.oldElementId=null!=e?e:void 0,this.newElementId=null!=t?t:void 0}toJson(){const e=super.toJson();return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new pc)).oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};e(Us.EVENT,ia,pc);var fc={};fc.register=vt,fc.unregister=yt;var gc=class{paste(e,t,n){const o=e.commentState;if(n)o.setAttribute("x","".concat(n.x)),o.setAttribute("y","".concat(n.y));else{var r;let e;n=parseInt(null!=(r=o.getAttribute("x"))?r:"0")+50,r=parseInt(null!=(e=o.getAttribute("y"))?e:"0")+50,o.setAttribute("x","".concat(n)),o.setAttribute("y","".concat(r))}return Tc.fromXmlRendered(e.commentState,t)}};gc.TYPE="workspace-comment",vt(gc.TYPE,new gc);var mc=8,bc=3,_c=2,Tc=class extends dc{constructor(e,t,n,o,r){super(e,t,n,o,r),this.onMouseMoveWrapper=this.onMouseUpWrapper=null,this.eventsInit=!1,this.deleteIconBorder=this.deleteGroup=this.resizeGroup=this.foreignObject=this.svgHandleTarget=this.svgRectTarget=this.textarea=null,this.rendered=this.autoLayout=this.focused=!1,this.svgGroup=oe(El.G,{class:"blocklyComment"}),this.workspace=e,this.svgRect_=oe(El.RECT,{class:"blocklyCommentRect",x:0,y:0,rx:bc,ry:bc}),this.svgGroup.appendChild(this.svgRect_),this.render()}dispose(){this.disposed_||(m()===this&&(this.unselect(),this.workspace.cancelCurrentGesture()),N()&&A(new(B(fa))(this)),le(this.svgGroup),Ms.disable$$module$build$src$core$events$utils(),super.dispose(),Ms.enable$$module$build$src$core$events$utils())}initSvg(e){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");this.workspace.options.readOnly||this.eventsInit||(z(this.svgRectTarget,"pointerdown",this,this.pathMouseDown),z(this.svgHandleTarget,"pointerdown",this,this.pathMouseDown)),this.eventsInit=!0,this.updateMovable(),this.getSvgRoot().parentNode||this.workspace.getBubbleCanvas().appendChild(this.getSvgRoot()),!e&&this.textarea&&this.textarea.select()}pathMouseDown(e){const t=this.workspace.getGesture(e);t&&t.handleBubbleStart(e,this)}showContextMenu(e){throw Error("The implementation of showContextMenu should be monkey-patched in by blockly.ts")}select(){if(m()!==this){var e=null;if(m()){e=m().id,Ms.disable$$module$build$src$core$events$utils();try{m().unselect()}finally{Ms.enable$$module$build$src$core$events$utils()}}e=new(B(ia))(e,this.id,this.workspace.id),A(e),b(this),this.addSelect()}}unselect(){if(m()===this){var e=new(B(ia))(this.id,null,this.workspace.id);A(e),b(null),this.removeSelect(),this.blurFocus()}}addSelect(){re(this.svgGroup,"blocklySelected"),this.setFocus()}removeSelect(){re(this.svgGroup,"blocklySelected"),this.blurFocus()}addFocus(){re(this.svgGroup,"blocklyFocused")}removeFocus(){se(this.svgGroup,"blocklyFocused")}getRelativeToSurfaceXY(){const e=this.workspace.getLayerManager();if(!e)throw Error("Cannot calculate position because the workspace has not been appended");let t=0,n=0,o=this.getSvgRoot();if(o)do{const e=ke(o);t+=e.x,n+=e.y,o=o.parentNode}while(o&&!e.hasLayer(o)&&null!==o);return this.xy_=new hl(t,n)}moveBy(e,t){const n=new(B(ma))(this),o=this.getRelativeToSurfaceXY();this.translate(o.x+e,o.y+t),this.xy_=new hl(o.x+e,o.y+t),n.recordNew(),A(n),this.workspace.resizeContents()}translate(e,t){this.xy_=new hl(e,t),this.getSvgRoot().setAttribute("transform","translate("+e+","+t+")")}moveDuringDrag(e){e="translate(".concat(e.x,", ").concat(e.y,")"),this.getSvgRoot().setAttribute("transform",e)}moveTo(e,t){this.translate(e,t)}clearTransformAttributes(){this.getSvgRoot().removeAttribute("transform")}getBoundingRectangle(){var e=this.getRelativeToSurfaceXY();const t=this.getHeightWidth(),n=e.y,o=e.y+t.height;let r;return this.RTL?(r=e.x-t.width,e=e.x):(r=e.x,e=e.x+t.width),new Il(n,o,r,e)}updateMovable(){this.isMovable()?re(this.svgGroup,"blocklyDraggable"):se(this.svgGroup,"blocklyDraggable")}setMovable(e){super.setMovable(e),this.updateMovable()}setEditable(e){super.setEditable(e),this.textarea&&(this.textarea.readOnly=!e)}setDragging(e){e?re(this.getSvgRoot(),"blocklyDragging"):se(this.getSvgRoot(),"blocklyDragging")}getSvgRoot(){return this.svgGroup}getContent(){return this.textarea?this.textarea.value:this.content_}setContent(e){super.setContent(e),this.textarea&&(this.textarea.value=e)}setDeleteStyle(e){e?re(this.svgGroup,"blocklyDraggingDelete"):se(this.svgGroup,"blocklyDraggingDelete")}setAutoLayout(e){}toXmlWithXY(e){let t=0;this.workspace.RTL&&(t=this.workspace.getWidth()),e=this.toXml(e);const n=this.getRelativeToSurfaceXY();return e.setAttribute("x",String(Math.round(this.workspace.RTL?t-n.x:n.x))),e.setAttribute("y",String(Math.round(n.y))),e.setAttribute("h",String(this.getHeight())),e.setAttribute("w",String(this.getWidth())),e}toCopyData(){return{paster:gc.TYPE,commentState:this.toXmlWithXY()}}getHeightWidth(){return{width:this.getWidth(),height:this.getHeight()}}render(){if(!this.rendered){var e=this.getHeightWidth(),t=this.createEditor();this.svgGroup.appendChild(t),this.svgHandleTarget=oe(El.RECT,{class:"blocklyCommentHandleTarget",x:0,y:0}),this.svgGroup.appendChild(this.svgHandleTarget),this.svgRectTarget=oe(El.RECT,{class:"blocklyCommentTarget",x:0,y:0,rx:bc,ry:bc}),this.svgGroup.appendChild(this.svgRectTarget),this.addResizeDom(),this.isDeletable()&&this.addDeleteDom(),this.setSize(e.width,e.height),this.textarea.value=this.content_,this.rendered=!0,this.resizeGroup&&z(this.resizeGroup,"pointerdown",this,this.resizeMouseDown),this.isDeletable()&&(z(this.deleteGroup,"pointerdown",this,this.deleteMouseDown),z(this.deleteGroup,"pointerout",this,this.deleteMouseOut),z(this.deleteGroup,"pointerup",this,this.deleteMouseUp))}}createEditor(){this.foreignObject=oe(El.FOREIGNOBJECT,{x:0,y:Tc.TOP_OFFSET,class:"blocklyCommentForeignObject"});const e=document.createElementNS(ml,"body");e.setAttribute("xmlns",ml),e.className="blocklyMinimalBody";const t=document.createElementNS(ml,"textarea");return t.className="blocklyCommentTextarea",t.setAttribute("dir",this.RTL?"RTL":"LTR"),t.readOnly=!this.isEditable(),e.appendChild(t),this.textarea=t,this.foreignObject.appendChild(e),z(t,"wheel",this,(function(e){e.stopPropagation()})),z(t,"change",this,(function(e){this.setContent(t.value)})),this.foreignObject}addResizeDom(){this.resizeGroup=oe(El.G,{class:this.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.svgGroup),oe(El.POLYGON,{points:"0,".concat(mc," ").concat(mc,",").concat(mc," ").concat(mc,",0")},this.resizeGroup),oe(El.LINE,{class:"blocklyResizeLine",x1:mc/3,y1:mc-1,x2:mc-1,y2:mc/3},this.resizeGroup),oe(El.LINE,{class:"blocklyResizeLine",x1:2*mc/3,y1:mc-1,x2:mc-1,y2:2*mc/3},this.resizeGroup)}addDeleteDom(){this.deleteGroup=oe(El.G,{class:"blocklyCommentDeleteIcon"},this.svgGroup),this.deleteIconBorder=oe(El.CIRCLE,{class:"blocklyDeleteIconShape",r:"7",cx:"7.5",cy:"7.5"},this.deleteGroup),oe(El.LINE,{x1:"5",y1:"10",x2:"10",y2:"5",stroke:"#fff","stroke-width":"2"},this.deleteGroup),oe(El.LINE,{x1:"5",y1:"5",x2:"10",y2:"10",stroke:"#fff","stroke-width":"2"},this.deleteGroup)}resizeMouseDown(e){this.unbindDragEvents(),J(e)||(this.workspace.startDrag(e,new hl(this.workspace.RTL?-this.width_:this.width_,this.height_)),this.onMouseUpWrapper=z(document,"pointerup",this,this.resizeMouseUp),this.onMouseMoveWrapper=z(document,"pointermove",this,this.resizeMouseMove),this.workspace.hideChaff()),e.stopPropagation()}deleteMouseDown(e){this.deleteIconBorder&&re(this.deleteIconBorder,"blocklyDeleteIconHighlighted"),e.stopPropagation()}deleteMouseOut(e){this.deleteIconBorder&&se(this.deleteIconBorder,"blocklyDeleteIconHighlighted")}deleteMouseUp(e){this.dispose(),e.stopPropagation()}unbindDragEvents(){this.onMouseUpWrapper&&(Y(this.onMouseUpWrapper),this.onMouseUpWrapper=null),this.onMouseMoveWrapper&&(Y(this.onMouseMoveWrapper),this.onMouseMoveWrapper=null)}resizeMouseUp(e){G(),this.unbindDragEvents()}resizeMouseMove(e){this.autoLayout=!1,e=this.workspace.moveDrag(e),this.setSize(this.RTL?-e.x:e.x,e.y)}resizeComment(){const e=this.getHeightWidth(),t=Tc.TOP_OFFSET,n=2*_c;let o,r;if(null==(o=this.foreignObject)||o.setAttribute("width",String(e.width)),null==(r=this.foreignObject)||r.setAttribute("height",String(e.height-t)),this.RTL){let t;null==(t=this.foreignObject)||t.setAttribute("x",String(-e.width))}this.textarea&&(this.textarea.style.width=e.width-n+"px",this.textarea.style.height=e.height-n-t+"px")}setSize(e,t){let n,o,r,i;if(e=Math.max(e,45),t=Math.max(t,20+Tc.TOP_OFFSET),this.width_=e,this.height_=t,this.svgRect_.setAttribute("width","".concat(e)),this.svgRect_.setAttribute("height","".concat(t)),null==(n=this.svgRectTarget)||n.setAttribute("width","".concat(e)),null==(o=this.svgRectTarget)||o.setAttribute("height","".concat(t)),null==(r=this.svgHandleTarget)||r.setAttribute("width","".concat(e)),null==(i=this.svgHandleTarget)||i.setAttribute("height",String(Tc.TOP_OFFSET)),this.RTL){let e;this.svgRect_.setAttribute("transform","scale(-1 1)"),null==(e=this.svgRectTarget)||e.setAttribute("transform","scale(-1 1)")}if(this.resizeGroup)if(this.RTL){let n;this.resizeGroup.setAttribute("transform","translate("+(-e+mc)+","+(t-mc)+") scale(-1 1)"),null==(n=this.deleteGroup)||n.setAttribute("transform","translate("+(-e+mc)+","+-mc+") scale(-1 1)")}else{let n;this.resizeGroup.setAttribute("transform","translate("+(e-mc)+","+(t-mc)+")"),null==(n=this.deleteGroup)||n.setAttribute("transform","translate("+(e-mc)+","+-mc+")")}this.resizeComment()}setFocus(){this.focused=!0,setTimeout((()=>{this.disposed_||(this.textarea.focus(),this.addFocus(),this.svgRectTarget&&re(this.svgRectTarget,"blocklyCommentTargetFocused"),this.svgHandleTarget&&re(this.svgHandleTarget,"blocklyCommentHandleTargetFocused"))}),0)}blurFocus(){this.focused=!1,setTimeout((()=>{this.disposed_||(this.textarea.blur(),this.removeFocus(),this.svgRectTarget&&se(this.svgRectTarget,"blocklyCommentTargetFocused"),this.svgHandleTarget&&se(this.svgHandleTarget,"blocklyCommentHandleTargetFocused"))}),0)}static fromXmlRendered(e,t,n){let o;Ms.disable$$module$build$src$core$events$utils();try{const r=dc.parseAttributes(e);if(o=new Tc(t,r.content,r.h,r.w,r.id),t.rendered&&(o.initSvg(!0),o.render()),!isNaN(r.x)&&!isNaN(r.y))if(t.RTL){const e=n||t.getWidth();o.moveBy(e-r.x,r.y)}else o.moveBy(r.x,r.y)}finally{Ms.enable$$module$build$src$core$events$utils()}return dc.fireCreateEvent(o),o}};Tc.DEFAULT_SIZE=100,Tc.TOP_OFFSET=10,ee("\n.blocklyCommentForeignObject {\n position: relative;\n z-index: 0;\n}\n\n.blocklyCommentRect {\n fill: #E7DE8E;\n stroke: #bcA903;\n stroke-width: 1px;\n}\n\n.blocklyCommentTarget {\n fill: transparent;\n stroke: #bcA903;\n}\n\n.blocklyCommentTargetFocused {\n fill: none;\n}\n\n.blocklyCommentHandleTarget {\n fill: none;\n}\n\n.blocklyCommentHandleTargetFocused {\n fill: transparent;\n}\n\n.blocklyFocused>.blocklyCommentRect {\n fill: #B9B272;\n stroke: #B9B272;\n}\n\n.blocklySelected>.blocklyCommentTarget {\n stroke: #fc3;\n stroke-width: 3px;\n}\n\n.blocklyCommentDeleteIcon {\n cursor: pointer;\n fill: #000;\n display: none;\n}\n\n.blocklySelected > .blocklyCommentDeleteIcon {\n display: block;\n}\n\n.blocklyDeleteIconShape {\n fill: #000;\n stroke: #000;\n stroke-width: 1px;\n}\n\n.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {\n stroke: #fc3;\n}\n");var vc=new Set,yc=new WeakSet,Ec=null,Ic=null,Sc=0,wc={};wc.finishQueuedRenders=It,wc.queueRender=Et,wc.triggerQueuedRenders=St;var Cc={};Cc.appendDomToWorkspace=Ht,Cc.blockToDom=Dt,Cc.blockToDomWithXY=Lt,Cc.clearWorkspaceAndLoadFromXml=Ut,Cc.deleteNext=en,Cc.domToBlock=Ms.domToBlock$$module$build$src$core$xml,Cc.domToBlockInternal=Gt,Cc.domToPrettyText=Ft,Cc.domToText=Bt,Cc.domToVariables=Vt,Cc.domToWorkspace=Ms.domToWorkspace$$module$build$src$core$xml,Cc.variablesToDom=xt,Cc.workspaceToDom=Rt;var kc=class extends Error{},$c=class extends kc{constructor(e){super("Expected to find a 'type' property, defining the block type"),this.state=e}},Ac=class extends kc{constructor(e,t,n){super("The block ".concat(t.toDevString()," is missing a(n) ").concat(e,"\nconnection")),this.block=t,this.state=n}},Oc=class extends kc{constructor(e,t,n,o){super("The block ".concat(n.toDevString()," could not connect its\n").concat(t," to its parent, because: ").concat(e)),this.childBlock=n,this.childState=o}},Rc=class extends kc{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}},xc=class extends kc{constructor(e,t,n){super("Cannot add an icon of type '".concat(e,"' to the block ")+"".concat(t.toDevString(),", because there is no icon registered with ")+"type '".concat(e,"'. Make sure that all of your icons have been ")+"registered."),this.block=t,this.state=n}},Lc={};Lc.BadConnectionCheck=Oc,Lc.DeserializationError=kc,Lc.MissingBlockType=$c,Lc.MissingConnection=Ac,Lc.RealChildOfShadow=Rc,Lc.UnregisteredIcon=xc;var Nc=100,Mc=75,Dc=50,Pc={BLOCKS:Dc,PROCEDURES:Mc,VARIABLES:Nc},Bc={};Bc.register=on,Bc.unregister=rn;var Fc=class{constructor(){this.priority=Dc}save(e){const t=[];for(const n of e.getTopBlocks(!1))(e=sn(n,{addCoordinates:!0,doFullSerialization:!1}))&&t.push(e);return t.length?{languageVersion:0,blocks:t}:null}load(e,t){e=e.blocks;for(const n of e)gn(n,t,{recordUndo:$()})}clear(e){for(const t of e.getTopBlocks(!1))t.dispose(!1)}};on("blocks",new Fc);var Uc={};Uc.BlockSerializer=Fc,Uc.append=gn,Uc.appendInternal=mn,Uc.save=sn;var Hc=class extends $a{constructor(e){super(),this.isBlank=!e,e&&(this.blockId=e.id,this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.blockId=this.blockId,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new Hc)).blockId=e.blockId,t}},Gc=class extends Hc{constructor(e){super(e),this.type=Ms.CREATE$$module$build$src$core$events$utils,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=Lt(e),this.ids=D(e),this.json=sn(e,{addCoordinates:!0}))}toJson(){const e=super.toJson();if(!this.xml)throw Error("The block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Bt(this.xml),e.ids=this.ids,e.json=this.json,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new Gc)).xml=Ms.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){const t=this.getEventWorkspace_();if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!Vc(t,this.ids))if(e)gn(this.json,t);else for(e=0;ee.getBlockById(t))).filter((e=>e&&e.isShadow())).length===t.length};e(Us.EVENT,Ms.CREATE$$module$build$src$core$events$utils,Gc);var Wc=class extends Aa{constructor(e,t){super(t),this.type=ha,this.themeName=e}toJson(){const e=super.toJson();if(!this.themeName)throw Error("The theme name is undefined. Either pass a theme name to the constructor, or call fromJson");return e.themeName=this.themeName,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new Wc)).themeName=e.themeName,t}};e(Us.EVENT,ha,Wc);var jc,zc,Xc=class extends Aa{constructor(e,t,n,o,r){super(o),this.type=da,this.viewTop=e,this.viewLeft=t,this.scale=n,this.oldScale=r}toJson(){const 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,n){return(t=super.fromJson(e,t,null!=n?n:new Xc)).viewTop=e.viewTop,t.viewLeft=e.viewLeft,t.scale=e.scale,t.oldScale=e.oldScale,t}};e(Us.EVENT,da,Xc),jc=28,Ms.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:jc,connectingSnapRadius:jc,currentConnectionPreference:8,bumpDelay:250},Ms.config$$module$build$src$core$config,function(e){e[e.INPUT_VALUE=1]="INPUT_VALUE",e[e.OUTPUT_VALUE=2]="OUTPUT_VALUE",e[e.NEXT_STATEMENT=3]="NEXT_STATEMENT",e[e.PREVIOUS_STATEMENT=4]="PREVIOUS_STATEMENT"}(zc||(zc={}));var Yc=class{constructor(e){this.connectionChecker=e,this.connections=[]}addConnection(e,t){t=this.calculateIndexForYPos(t),this.connections.splice(t,0,e)}findIndexOfConnection(e,t){if(!this.connections.length)return-1;const n=this.calculateIndexForYPos(t);if(n>=this.connections.length)return-1;t=e.y;let o=n;for(;0<=o&&this.connections[o].y===t;){if(this.connections[o]===e)return o;o--}for(o=n;oe)){t=o;break}n=o}}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 n(e){const n=r-o[e].x,s=i-o[e].y;return Math.sqrt(n*n+s*s)<=t&&l.push(o[e]),se?this.menuItems.length:e,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(e,t){let n;for(e+=t;n=this.menuItems[e];){if(n.isEnabled()){this.setHighlighted(n);break}e+=t}}handleMouseOver(e){(e=this.getMenuItem(e.target))&&(e.isEnabled()?this.highlightedItem!==e&&this.setHighlighted(e):this.setHighlighted(null))}handleClick(e){const t=this.openingCoords;if(this.openingCoords=null,t&&"number"===typeof e.clientX){const n=new hl(e.clientX,e.clientY);if(1>hl.distance(t,n))return}(e=this.getMenuItem(e.target))&&e.performAction()}handleMouseEnter(e){this.focus()}handleMouseLeave(e){this.getElement()&&(this.blur(),this.setHighlighted(null))}handleKeyEvent(e){if(this.menuItems.length&&!(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){var t=this.highlightedItem;switch(e.key){case"Enter":case" ":t&&t.performAction();break;case"ArrowUp":this.highlightPrevious();break;case"ArrowDown":this.highlightNext();break;case"PageUp":case"Home":this.highlightFirst();break;case"PageDown":case"End":this.highlightLast();break;default:return}e.preventDefault(),e.stopPropagation()}}getSize(){const e=this.getElement(),t=_e(e);return t.height=e.scrollHeight,t}},lu=class{constructor(e,t){this.content=e,this.opt_value=t,this.enabled=!0,this.element=null,this.rightToLeft=!1,this.roleName=null,this.highlight=this.checked=this.checkable=!1,this.actionHandler=null}createDom(){const e=document.createElement("div");e.id=w(),this.element=e,e.className="blocklyMenuItem goog-menuitem "+(this.enabled?"":"blocklyMenuItemDisabled goog-menuitem-disabled ")+(this.checked?"blocklyMenuItemSelected goog-option-selected ":"")+(this.highlight?"blocklyMenuItemHighlight goog-menuitem-highlight ":"")+(this.rightToLeft?"blocklyMenuItemRtl goog-menuitem-rtl ":"");const t=document.createElement("div");if(t.className="blocklyMenuItemContent goog-menuitem-content",this.checkable){var n=document.createElement("div");n.className="blocklyMenuItemCheckbox goog-menuitem-checkbox",t.appendChild(n)}return n=this.content,"string"===typeof this.content&&(n=document.createTextNode(this.content)),t.appendChild(n),e.appendChild(t),this.roleName&&Pn(e,this.roleName),Bn(e,nu.SELECTED,this.checkable&&this.checked||!1),Bn(e,nu.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;const t=this.getElement();t&&this.isEnabled()&&(e?(re(t,"blocklyMenuItemHighlight"),re(t,"goog-menuitem-highlight")):(se(t,"blocklyMenuItemHighlight"),se(t,"goog-menuitem-highlight")))}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}performAction(){this.isEnabled()&&this.actionHandler&&this.actionHandler(this)}onAction(e,t){this.actionHandler=e.bind(t)}},cu=null,uu=null,hu="blocklyWidgetDiv",du="",pu="",fu={};fu.createDom=Hn,fu.getDiv=Fn,fu.hide=Vn,fu.hideIfOwner=jn,fu.isVisible=Wn,fu.positionWithAnchor=Xn,fu.repositionForWindowResize=qn,fu.show=Gn,fu.testOnly_setDiv=Un;var gu=null,mu={},bu=null,_u={};_u.callbackFactory=Ms.callbackFactory$$module$build$src$core$contextmenu,_u.commentDeleteOption=ao,_u.commentDuplicateOption=lo,_u.dispose=so,_u.getCurrentBlock=Zn,_u.hide=io,_u.setCurrentBlock=Qn,_u.show=eo,_u.workspaceCommentOption=co;var Tu=class{constructor(){this.registry_=new Map,this.reset()}reset(){this.registry_.clear()}register(e){if(this.registry_.has(e.id))throw Error('Menu item with ID "'+e.id+'" is already registered.');this.registry_.set(e.id,e)}unregister(e){if(!this.registry_.has(e))throw Error('Menu item with ID "'+e+'" not found.');this.registry_.delete(e)}getItem(e){let t;return null!=(t=this.registry_.get(e))?t:null}getContextMenuOptions(e,t){const n=[];for(const r of this.registry_.values())if(e===r.scopeType){var o=r.preconditionFn(t);"hidden"!==o&&(o={text:"function"===typeof r.displayText?r.displayText(t):r.displayText,enabled:"enabled"===o,callback:r.callback,scope:t,weight:r.weight},n.push(o))}return n.sort((function(e,t){return e.weight-t.weight})),n}};!function(e){var t=e.ScopeType||(e.ScopeType={});t.BLOCK="block",t.WORKSPACE="workspace",e.registry=new e}(Tu||(Tu={}));var vu=Tu.ScopeType,yu={};yu.ContextMenuRegistry=Tu,yu.ScopeType=vu;var Eu={};Eu.clamp=po,Eu.toDegrees=ho,Eu.toRadians=uo;var Iu,Su,wu,Cu=16,ku=1,$u=12,Au=16,Ou=.25,Ru=null,xu=null,Lu="",Nu="",Mu=null,Du=null,Pu=null,Bu={getBoundsInfo:function(){const e=Ee(Mu),t=_e(Mu);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,n,o){const r=Bu.getBoundsInfo(),i=_e(Iu);return t+i.heightr.top?ko(n,o,r,i):t+i.heightdocument.documentElement.clientTop?ko(n,o,r,i):$o(e,r,i)}},Fu={ANIMATION_TIME:Ou,ARROW_HORIZONTAL_PADDING:$u,ARROW_SIZE:Cu,BORDER_SIZE:ku,PADDING_Y:Au,TEST_ONLY:Bu};Fu.clearContent=_o,Fu.createDom=fo,Fu.getContentDiv=bo,Fu.getOwner=mo,Fu.getPositionX=Ao,Fu.hide=xo,Fu.hideIfOwner=Ro,Fu.hideWithoutAnimation=Lo,Fu.isVisible=Oo,Fu.repositionForWindowResize=Mo,Fu.setBoundsElement=go,Fu.setColour=To,Fu.show=wo,Fu.showPositionedByBlock=vo,Fu.showPositionedByField=yo;var Uu=null,Hu=null,Gu={};Gu.connectionUiEffect=Bo,Gu.disconnectUiEffect=Fo,Gu.disconnectUiStop=Ho,Gu.disposeUiEffect=Do;var Vu=50,Wu=100,ju=class{constructor(e,t){this.bubble=e,this.workspace=t,this.dragTarget_=null,this.wouldDeleteBubble_=!1,this.startXY_=this.bubble.getRelativeToSurfaceXY()}startBubbleDrag(){let e;Ms.getGroup$$module$build$src$core$events$utils()||Ms.setGroup$$module$build$src$core$events$utils(!0),this.workspace.setResizesEnabled(!1),this.bubble.setAutoLayout&&this.bubble.setAutoLayout(!1),null==(e=this.workspace.getLayerManager())||e.moveToDragLayer(this.bubble),this.bubble.setDragging&&this.bubble.setDragging(!0)}dragBubble(e,t){t=this.pixelsToWorkspaceUnits_(t),t=hl.sum(this.startXY_,t),this.bubble.moveDuringDrag(t),t=this.dragTarget_,this.dragTarget_=this.workspace.getDragTarget(e),e=this.wouldDeleteBubble_,this.wouldDeleteBubble_=this.shouldDelete_(this.dragTarget_),e!==this.wouldDeleteBubble_&&this.updateCursorDuringBubbleDrag_(),this.dragTarget_!==t&&(t&&t.onDragExit(this.bubble),this.dragTarget_&&this.dragTarget_.onDragEnter(this.bubble)),this.dragTarget_&&this.dragTarget_.onDragOver(this.bubble)}shouldDelete_(e){return!(!e||!this.workspace.getComponentManager().hasCapability(e.id,al.Capability.DELETE_AREA))&&e.wouldDelete(this.bubble,!1)}updateCursorDuringBubbleDrag_(){this.bubble.setDeleteStyle(this.wouldDeleteBubble_)}endBubbleDrag(e,t){if(this.dragBubble(e,t),this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.bubble)?e=this.startXY_:(e=this.pixelsToWorkspaceUnits_(t),e=hl.sum(this.startXY_,e)),this.bubble.moveTo(e.x,e.y),this.dragTarget_&&this.dragTarget_.onDrop(this.bubble),this.wouldDeleteBubble_)this.fireMoveEvent_(),this.bubble.dispose();else{if(this.bubble.setDragging){let e;this.bubble.setDragging(!1),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.bubble,Wu)}this.fireMoveEvent_()}this.workspace.setResizesEnabled(!0),Ms.setGroup$$module$build$src$core$events$utils(!1)}fireMoveEvent_(){if(this.bubble instanceof Tc){const e=new(B(ma))(this.bubble);e.setOldCoordinate(this.startXY_),e.recordNew(),A(e)}}pixelsToWorkspaceUnits_(e){return e=new hl(e.x/this.workspace.scale,e.y/this.workspace.scale),this.workspace.isMutator&&e.scale(1/this.workspace.options.parentWorkspace.scale),e}},zu=30,Xu=!0,Yu=[];Yu[zc.INPUT_VALUE]=zc.OUTPUT_VALUE,Yu[zc.OUTPUT_VALUE]=zc.INPUT_VALUE,Yu[zc.NEXT_STATEMENT]=zc.PREVIOUS_STATEMENT,Yu[zc.PREVIOUS_STATEMENT]=zc.NEXT_STATEMENT;var Ku="RENAME_VARIABLE_ID",Ju="DELETE_VARIABLE_ID",qu={};qu.commonWordPrefix=Wo,qu.commonWordSuffix=jo,qu.isNumber=Ms.isNumber$$module$build$src$core$utils$string,qu.shortestStringLength=Vo,qu.startsWith=Go,qu.wrap=Ms.wrap$$module$build$src$core$utils$string;var Zu=void 0,Qu=!1,eh=!1,th=50,nh=0,oh=0,rh=0,ih=0,sh=null,ah=null,lh=0,ch=10,uh=10,hh=750,dh=5,ph=null,fh={HOVER_MS:hh,LIMIT:th,MARGINS:dh,OFFSET_X:lh,OFFSET_Y:ch,RADIUS_OK:uh};fh.bindMouseEvents=or,fh.block=ur,fh.createDom=nr,fh.dispose=lr,fh.getCustomTooltip=qo,fh.getDiv=Qo,fh.getTooltipOfObject=er,fh.hide=cr,fh.isVisible=Zo,fh.setCustomTooltip=Jo,fh.unbindMouseEvents=rr,fh.unblock=hr;var gh=class{constructor(e){this.workspace=e,this.horizontalScrollEnabled_=this.workspace.isMovableHorizontally(),this.verticalScrollEnabled_=this.workspace.isMovableVertically(),this.startScrollXY_=new hl(e.scrollX,e.scrollY)}dispose(){this.workspace=null}startDrag(){m()&&m().unselect()}endDrag(e){this.drag(e)}drag(e){if(e=hl.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_)throw new TypeError("Invalid state.");this.workspace.scroll(this.workspace.scrollX,e.y)}}},mh=5,bh=6,_h=class{constructor(e,t){this.creatorWorkspace=t,this.mouseDownXY=new hl(0,0),this.startWorkspace_=this.targetBlock=this.startBlock=this.startIcon=this.startField=this.startBubble=null,this.hasExceededDragRadius=!1,this.boundEvents=[],this.flyout=this.workspaceDragger=this.blockDragger=this.bubbleDragger=null,this.isMultiTouch_=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 hl(0,0),this.healStack=!Xu}dispose(){G(),hr(),this.creatorWorkspace.clearGesture();for(const e of this.boundEvents)Y(e);this.boundEvents.length=0,this.blockDragger&&this.blockDragger.dispose(),this.workspaceDragger&&this.workspaceDragger.dispose()}updateFromEvent(e){const t=new hl(e.clientX,e.clientY);this.updateDragDelta(t)&&(this.updateIsDragging(),H()),this.mostRecentEvent=e}updateDragDelta(e){return this.currentDragDeltaXY=hl.difference(e,this.mouseDownXY),!this.hasExceededDragRadius&&(this.hasExceededDragRadius=hl.magnitude(this.currentDragDeltaXY)>(this.flyout?Ms.config$$module$build$src$core$config.flyoutDragRadius:Ms.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(),Ms.getGroup$$module$build$src$core$events$utils()||Ms.setGroup$$module$build$src$core$events$utils(!0),this.startBlock=null,this.targetBlock=this.flyout.createBlock(this.targetBlock),this.targetBlock.select(),!0)}updateIsDraggingBubble(){return!!this.startBubble&&(this.startDraggingBubble(),!0)}updateIsDraggingBlock(){if(!this.targetBlock)return!1;if(this.flyout){if(this.updateIsDraggingFromFlyout())return this.startDraggingBlock(),!0}else if(this.targetBlock.isMovable())return this.startDraggingBlock(),!0;return!1}updateIsDraggingWorkspace(){if(!this.startWorkspace_)throw Error("Cannot update dragging the workspace because the start workspace is undefined");(this.flyout?this.flyout.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.workspaceDragger=new gh(this.startWorkspace_),this.workspaceDragger.startDrag())}updateIsDragging(){if(this.calledUpdateIsDragging)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging=!0,this.updateIsDraggingBubble()||this.updateIsDraggingBlock()||this.updateIsDraggingWorkspace()}startDraggingBlock(){this.blockDragger=new(c(Us.BLOCK_DRAGGER,this.creatorWorkspace.options,!0))(this.targetBlock,this.startWorkspace_),this.blockDragger.startDrag(this.currentDragDeltaXY,this.healStack),this.blockDragger.drag(this.mostRecentEvent,this.currentDragDeltaXY)}startDraggingBubble(){if(!this.startBubble)throw Error("Cannot update dragging the bubble because the start bubble is undefined");if(!this.startWorkspace_)throw Error("Cannot update dragging the bubble because the start workspace is undefined");this.bubbleDragger=new ju(this.startBubble,this.startWorkspace_),this.bubbleDragger.startBubbleDrag(),this.bubbleDragger.dragBubble(this.mostRecentEvent,this.currentDragDeltaXY)}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,K(e)?this.cancel():(this.gestureHasStarted=!0,Ho(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=mo(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,ur(),this.targetBlock&&this.targetBlock.select(),J(e)?this.handleRightClick(e):("pointerdown"===e.type.toLowerCase()&&"mouse"!==e.pointerType&&U(e,this),this.mouseDownXY=new hl(e.clientX,e.clientY),this.healStack=e.altKey||e.ctrlKey||e.metaKey,this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(z(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(z(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(z(document,"pointerup",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&H())}handleMove(e){this.isDragging()&&V(e)||!this.isMultiTouch()?(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.blockDragger?this.blockDragger.drag(this.mostRecentEvent,this.currentDragDeltaXY):this.bubbleDragger&&this.bubbleDragger.dragBubble(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation()):this.isMultiTouch()&&(this.handleTouchMove(e),H())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!V(e))return;if(this.updateFromEvent(e),H(),this.isEnding_)return void console.log("Trying to end a gesture recursively.");this.isEnding_=!0,this.bubbleDragger?this.bubbleDragger.endBubbleDrag(e,this.currentDragDeltaXY):this.blockDragger?this.blockDragger.endDrag(e,this.currentDragDeltaXY):this.workspaceDragger?this.workspaceDragger.endDrag(this.currentDragDeltaXY):this.isBubbleClick()?this.doBubbleClick():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=W(e);this.cachedPoints.set(t,this.getTouchPoint(e));var n=Array.from(this.cachedPoints.keys());2===n.length&&(t=this.cachedPoints.get(n[0]),n=this.cachedPoints.get(n[1]),this.startDistance=hl.distance(t,n),this.isMultiTouch_=!0,e.preventDefault())}handleTouchMove(e){const t=W(e);this.cachedPoints.set(t,this.getTouchPoint(e)),this.isPinchZoomEnabled&&2===this.cachedPoints.size?this.handlePinch(e):this.handleMove(e)}handlePinch(e){var t=Array.from(this.cachedPoints.keys()),n=this.cachedPoints.get(t[0]);if(t=this.cachedPoints.get(t[1]),n=hl.distance(n,t)/this.startDistance,0this.previousScale){if(t=0<(t=n-this.previousScale)?t*mh:t*bh,!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");const o=this.startWorkspace_,r=q(e,o.getParentSvg(),o.getInverseScreenCTM());o.zoom(r.x,r.y,t)}this.previousScale=n,e.preventDefault()}handleTouchEnd(e){e=W(e),this.cachedPoints.has(e)&&this.cachedPoints.delete(e),2>this.cachedPoints.size&&(this.cachedPoints.clear(),this.previousScale=0)}getTouchPoint(e){return this.startWorkspace_?new hl(e.pageX,e.pageY):null}isMultiTouch(){return this.isMultiTouch_}cancel(){this.isEnding_||(H(),this.bubbleDragger?this.bubbleDragger.endBubbleDrag(this.mostRecentEvent,this.currentDragDeltaXY):this.blockDragger?this.blockDragger.endDrag(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.startWorkspace_&&!this.flyout&&(this.startWorkspace_.hideChaff(),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),this.dispose()}handleWsStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace(t),this.mostRecentEvent=e,this.doStart(e)}fireWorkspaceClick(e){A(new(B(sa))(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}doBubbleClick(){this.startBubble instanceof Tc&&(this.startBubble.setFocus(),this.startBubble.select())}doFieldClick(){if(!this.startField)throw Error("Cannot do a field click because the start field is undefined");this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent),this.bringBlockToFront()}doIconClick(){if(!this.startIcon)throw Error("Cannot do an icon click because the start icon is undefined");this.bringBlockToFront(),this.startIcon.onClick()}doBlockClick(){if(this.flyout&&this.flyout.autoClose){if(!this.targetBlock)throw Error("Cannot do a block click because the target block is undefined");this.targetBlock.isEnabled()&&(Ms.getGroup$$module$build$src$core$events$utils()||Ms.setGroup$$module$build$src$core$events$utils(!0),this.flyout.createBlock(this.targetBlock).scheduleSnapAndBump())}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");const e=new(B(sa))(this.startBlock,this.startWorkspace_.id,"block");A(e)}this.bringBlockToFront(),Ms.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){e=this.creatorWorkspace,m()&&m().unselect(),this.fireWorkspaceClick(this.startWorkspace_||e)}bringBlockToFront(){this.targetBlock&&!this.flyout&&this.targetBlock.bringToFront()}setStartField(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField||(this.startField=e)}setStartIcon(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartIcon, but the gesture had already been started.");this.startIcon||(this.startIcon=e)}setStartBubble(e){this.startBubble||(this.startBubble=e)}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}setStartWorkspace(e){this.startWorkspace_||(this.startWorkspace_=e)}setStartFlyout(e){this.flyout||(this.flyout=e)}isBubbleClick(){return!!this.startBubble&&!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;const e=!this.flyout||!this.startIcon.isClickableInFlyout||this.startIcon.isClickableInFlyout(this.flyout.autoClose);return!this.hasExceededDragRadius&&e}isWorkspaceClick(){return!this.startBlock&&!this.startBubble&&!this.startField&&!this.hasExceededDragRadius}isDragging(){return!!this.workspaceDragger||!!this.blockDragger||!!this.bubbleDragger}hasStarted(){return this.gestureHasStarted}getInsertionMarkers(){return this.blockDragger?this.blockDragger.getInsertionMarkers():[]}getCurrentDragger(){let e,t;return null!=(t=null!=(e=this.blockDragger)?e:this.workspaceDragger)?t:this.bubbleDragger}static inProgress(){const e=h();for(let t,n=0;t=e[n];n++)if(t.currentGesture_)return!0;return!1}},Th=class{constructor(e,t){let n,o,r;this.pattern=e,this.scale=1,this.spacing=null!=(n=t.spacing)?n:0,this.length=null!=(o=t.length)?o:1,this.line2=(this.line1=e.firstChild)&&this.line1.nextSibling,this.snapToGrid=null!=(r=t.snap)&&r}setSpacing(e){this.spacing=e,this.update(this.scale)}setLength(e){this.length=e,this.update(this.scale)}setSnapToGrid(e){this.snapToGrid=e}shouldSnap(){return this.snapToGrid}getSpacing(){return this.spacing}getPatternId(){return this.pattern.id}update(e){this.scale=e;var t=this.spacing*e;this.pattern.setAttribute("width","".concat(t)),this.pattern.setAttribute("height","".concat(t));let n=(t=Math.floor(this.spacing/2)+.5)-this.length/2,o=t+this.length/2;t*=e,n*=e,o*=e,this.setLineAttributes(this.line1,e,n,o,t,t),this.setLineAttributes(this.line2,e,t,t,n,o)}setLineAttributes(e,t,n,o,r,i){e&&(e.setAttribute("stroke-width","".concat(t)),e.setAttribute("x1","".concat(n)),e.setAttribute("y1","".concat(r)),e.setAttribute("x2","".concat(o)),e.setAttribute("y2","".concat(i)))}moveTo(e,t){this.pattern.setAttribute("x","".concat(e)),this.pattern.setAttribute("y","".concat(t))}static createDom(e,t,n){let o,r;if(e=oe(El.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},n),0<(null!=(o=t.length)?o:1)&&0<(null!=(r=t.spacing)?r:0)){let n;oe(El.LINE,{stroke:t.colour},e),null!=(n=t.length)&&n&&oe(El.LINE,{stroke:t.colour},e)}else oe(El.LINE,{},e);return e}},vh=class{constructor(e){this.workspace=e,this.cursorSvg_=this.cursor_=null,this.markers=new Map,this.markerSvg_=null}registerMarker(e,t){this.markers.has(e)&&this.unregisterMarker(e),t.setDrawer(this.workspace.getRenderer().makeMarkerDrawer(this.workspace,t)),this.setMarkerSvg(t.getDrawer().createDom()),this.markers.set(e,t)}unregisterMarker(e){const t=this.markers.get(e);if(!t)throw Error("Marker with ID "+e+" does not exist. Can only unregister markers that exist.");t.dispose(),this.markers.delete(e)}getCursor(){return this.cursor_}getMarker(e){return this.markers.get(e)||null}setCursor(e){this.cursor_&&this.cursor_.getDrawer()&&this.cursor_.getDrawer().dispose(),(this.cursor_=e)&&(e=this.workspace.getRenderer().makeMarkerDrawer(this.workspace,this.cursor_),this.cursor_.setDrawer(e),this.setCursorSvg(this.cursor_.getDrawer().createDom()))}setCursorSvg(e){e?(this.workspace.getBlockCanvas().appendChild(e),this.cursorSvg_=e):this.cursorSvg_=null}setMarkerSvg(e){e?this.workspace.getBlockCanvas()&&(this.cursorSvg_?this.workspace.getBlockCanvas().insertBefore(e,this.cursorSvg_):this.workspace.getBlockCanvas().appendChild(e)):this.markerSvg_=null}updateMarkers(){this.workspace.keyboardAccessibilityMode&&this.cursorSvg_&&this.workspace.getCursor().draw()}dispose(){const e=Object.keys(this.markers);for(let t,n=0;t=e[n];n++)this.unregisterMarker(t);this.markers.clear(),this.cursor_&&(this.cursor_.dispose(),this.cursor_=null)}};vh.LOCAL_MARKER="local_marker_1";var yh={};yh.deepMerge=mr;var Eh=class{constructor(t,n,o,r){this.name=t,this.startHats=!1,this.blockStyles=n||Object.create(null),this.categoryStyles=o||Object.create(null),this.componentStyles=r||Object.create(null),this.fontStyle=Object.create(null),e(Us.THEME,t,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){const t=this.getComponentStyle(e);if(t)return t}return"".concat(e)}setComponentStyle(e,t){this.componentStyles[e]=t}setFontStyle(e){this.fontStyle=e}setStartHats(e){this.startHats=e}static defineTheme(e,t){e=e.toLowerCase();const n=new Eh(e);let o=t.base;if(o){if("string"===typeof o){let e;o=null!=(e=a(Us.THEME,o))?e:void 0}o instanceof Eh&&(mr(n,o),n.name=e)}return mr(n.blockStyles,t.blockStyles),mr(n.categoryStyles,t.categoryStyles),mr(n.componentStyles,t.componentStyles),mr(n.fontStyle,t.fontStyle),null!==t.startHats&&(n.startHats=t.startHats),n}},Ih=new Eh("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"}}),Sh=class{constructor(e){this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let t=null,n=!1;var o=!1,r=!1,i=!1,s=!1,a=!1;const l=!!e.readOnly;var c;l||(t=De(null!=(c=e.toolbox)?c:null),n=Fe(t),o=void 0===(o=e.trashcan)?n:o,r=void 0===(r=e.collapse)?n:r,i=void 0===(i=e.comments)?n:i,s=void 0===(s=e.disable)?n:s,a=void 0===(a=e.sounds)||a),c=e.maxTrashcanContents,o?void 0===c&&(c=32):c=0;const u=!!e.rtl;let h=e.horizontalLayout;void 0===h&&(h=!1);var d="end"!==e.toolboxPosition;d=h?d?Fl.TOP:Fl.BOTTOM:d===u?Fl.RIGHT:Fl.LEFT;let p=e.css;void 0===p&&(p=!0);let f="https://blockly-demo.appspot.com/static/media/";e.media?f=e.media.endsWith("/")?e.media:e.media+"/":"path"in e&&(ne("path","Nov 2014","Jul 2023","media"),f=e.path+"media/");const g=e.oneBasedIndex,m=e.renderer||"geras",b=e.plugins||{};let _,T,v,y=e.modalInputs;void 0===y&&(y=!0),this.RTL=u,this.oneBasedIndex=void 0===g||g,this.collapse=r,this.comments=i,this.disable=s,this.readOnly=l,this.maxBlocks=e.maxBlocks||1/0,this.maxInstances=null!=(_=e.maxInstances)?_:null,this.modalInputs=y,this.pathToMedia=f,this.hasCategories=n,this.moveOptions=Sh.parseMoveOptions_(e,n),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=o,this.maxTrashcanContents=c,this.hasSounds=a,this.hasCss=p,this.horizontalLayout=h,this.languageTree=t,this.gridOptions=Sh.parseGridOptions_(e),this.zoomOptions=Sh.parseZoomOptions_(e),this.toolboxPosition=d,this.theme=Sh.parseThemeOptions_(e),this.renderer=m,this.rendererOverrides=null!=(T=e.rendererOverrides)?T:null,this.parentWorkspace=null!=(v=e.parentWorkspace)?v:null,this.plugins=b}static parseMoveOptions_(e,t){const n=e.move||{},o={};return void 0===n.scrollbars&&void 0===e.scrollbars?o.scrollbars=t:"object"===typeof n.scrollbars?(o.scrollbars={horizontal:!!n.scrollbars.horizontal,vertical:!!n.scrollbars.vertical},o.scrollbars.horizontal&&o.scrollbars.vertical?o.scrollbars=!0:o.scrollbars.horizontal||o.scrollbars.vertical||(o.scrollbars=!1)):o.scrollbars=!!n.scrollbars||!!e.scrollbars,o.wheel=o.scrollbars&&void 0!==n.wheel?!!n.wheel:"object"===typeof o.scrollbars,o.drag=!!o.scrollbars&&(void 0===n.drag||!!n.drag),o}static parseZoomOptions_(e){e=e.zoom||{};const 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||{};const 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=0")),A(new wh(t,"mutation",null,n,e));break;default:console.warn("Unknown change type: "+this.element)}}static getExtraBlockState_(e){return e.saveExtraState?(e=e.saveExtraState(!0))?JSON.stringify(e):"":e.mutationToDom&&(e=e.mutationToDom())?Bt(e):""}};e(Us.EVENT,Ms.CHANGE$$module$build$src$core$events$utils,wh);var Ch=.45,kh=.65,$h={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"},Ah={};Ah.blend=Cr,Ah.getHsvSaturation=_r,Ah.getHsvValue=vr,Ah.hexToRgb=Sr,Ah.hsvToHex=wr,Ah.hueToHex=kr,Ah.names=$h,Ah.parse=Er,Ah.rgbToHex=Ir,Ah.setHsvSaturation=Tr,Ah.setHsvValue=yr;var Oh={};Oh.checkMessageReferences=Rr,Oh.parseBlockColour=xr,Oh.replaceMessageReferences=Or,Oh.tokenizeInterpolation=Ar;var Rh=class{constructor(e,t,n){this.DEFAULT_VALUE=null,this.name=void 0,this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=this.tooltip_=this.validator_=null,this.disposed=!1,this.maxDisplayLength=50,this.sourceBlock_=null,this.enabled_=this.visible_=this.isDirty_=!0,this.suffixField=this.prefixField=this.clickTarget_=null,this.EDITABLE=!0,this.SERIALIZABLE=!1,this.CURSOR="",this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE,this.size_=new Sl(0,0),e!==Rh.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(Or(e.tooltip))}setSourceBlock(e){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=e}getConstants(){return!this.constants_&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_}getSourceBlock(){return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=oe(El.G,{}),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())}initView(){this.createBorderRect_(),this.createTextElement_()}initModel(){}isFullBlockField(){return!this.borderRect_}createBorderRect_(){this.borderRect_=oe(El.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_=oe(El.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)}bindEvents_(){const e=this.getClickTarget_();if(!e)throw Error("A click target has not been set.");or(e),this.mouseDownWrapper_=z(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(Rh))?e:this.getValue()}loadState(e){this.loadLegacyState(Rh,e)||this.setValue(e)}saveLegacyState(e){return e.prototype.saveState===this.saveState&&e.prototype.toXml!==this.toXml?((e=Ms.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name",this.name||""),Ne(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(Ms.textToDom$$module$build$src$core$utils$xml(t)),!0)}dispose(){let e;Ro(this),jn(this),null!=(e=this.getSourceBlock())&&e.isDeadOrDying()||le(this.fieldGroup_),this.disposed=!0}updateEditable(){const e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(re(e,"blocklyEditableText"),se(e,"blocklyNonEditableText"),e.style.cursor=this.CURSOR):(re(e,"blocklyNonEditableText"),se(e,"blocklyEditableText"),e.style.cursor=""))}setEnabled(e){this.enabled_=e,this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==Rh.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 ".concat(this.borderRect_,"."));return this.borderRect_}getTextElement(){if(!this.textElement_)throw Error("The text element is ".concat(this.textElement_,"."));return this.textElement_}getTextContent(){if(!this.textContent_)throw Error("The text content is ".concat(this.textContent_,"."));return this.textContent_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()}showEditor(e){this.isClickable()&&this.showEditor_(e)}showEditor_(e){}repositionForWindowResize(){return!1}updateSize_(e){const t=this.getConstants();let n=2*(e=void 0!==e?e:this.isFullBlockField()?0:this.getConstants().FIELD_BORDER_RECT_X_PADDING),o=t.FIELD_TEXT_HEIGHT,r=0;this.textElement_&&(r=ge(this.textElement_,t.FIELD_TEXT_FONTSIZE,t.FIELD_TEXT_FONTWEIGHT,t.FIELD_TEXT_FONTFAMILY),n+=r),this.isFullBlockField()||(o=Math.max(o,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=o,this.size_.width=n,this.positionTextElement_(e,r),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var n,o=this.getConstants(),r=this.size_.height/2;this.textElement_.setAttribute("x",String(null!=(n=this.getSourceBlock())&&n.RTL?this.size_.width-t-e:e)),this.textElement_.setAttribute("y",String(o.FIELD_TEXT_BASELINE_CENTER?r:r-o.FIELD_TEXT_HEIGHT/2+o.FIELD_TEXT_BASELINE))}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",String(this.size_.width)),this.borderRect_.setAttribute("height",String(this.size_.height)),this.borderRect_.setAttribute("rx",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)),this.borderRect_.setAttribute("ry",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)))}getSize(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0===this.size_.width&&(this.render_(),0!==this.size_.width&&console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead.")),this.size_):new Sl(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new xh;if(this.isFullBlockField()){var n=this.sourceBlock_.getHeightWidth();const o=t.workspace.scale;e=this.getAbsoluteXY_(),t=(n.width+1)*o,n=(n.height+1)*o,Ka?(e.x+=1.5*o,e.y+=1.5*o):(e.x-=.5*o,e.y-=.5*o)}else n=this.borderRect_.getBoundingClientRect(),e=Ee(this.borderRect_),t=n.width,n=n.height;return new Il(e.y,e.y+n,e.x,e.x+t)}onLocationChange(e){}getDisplayText_(){let e=this.getText();return e?(e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"\u2026"),e=e.replace(/\s/g,Rh.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+="\u200f"),e):Rh.NBSP}getText(){const e=this.getText_();return String(null!==e?e:this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0,this.constants_=null}forceRerender(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.queueRender(),this.sourceBlock_.bumpNeighbours())}setValue(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(null!==e){var n,o=this.doClassValidation_(e);(e=this.processValidation_(e,o))instanceof Error||(o=null==(n=this.getValidator())?void 0:n.call(this,e),(n=this.processValidation_(e,o))instanceof Error||(e=this.sourceBlock_)&&e.disposed||((o=this.getValue())===n?this.doValueUpdate_(n):(this.doValueUpdate_(n),t&&e&&N()&&A(new(B(Ms.CHANGE$$module$build$src$core$events$utils))(e,"field",this.name||null,o,n)),this.isDirty_&&this.forceRerender())))}}processValidation_(e,t){return null===t?(this.doValueInvalid_(e),this.isDirty_&&this.forceRerender(),Error()):void 0===t?e:t}getValue(){return this.value_}doClassValidation_(e){return null===e||void 0===e?null:e}doValueUpdate_(e){this.value_=e,this.isDirty_=!0}doValueInvalid_(e){}onMouseDown_(e){this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&(e=this.sourceBlock_.workspace.getGesture(e))&&e.setStartField(this)}setTooltip(e){e||""===e||(e=this.sourceBlock_);const t=this.getClickTarget_();t?t.tooltip=e:this.tooltip_=e}getTooltip(){const e=this.getClickTarget_();return er(e||{tooltip:this.tooltip_})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return Ee(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null;const t=this.getSourceBlock();if(!t)throw new xh;const n=t.inputList;for(let o=0;ot[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,n=0;t=e[n];n++)t[1]===this.value_&&(this.selectedOption=t)}applyColour(){const e=this.sourceBlock_.style;this.borderRect_&&(this.borderRect_.setAttribute("stroke",e.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",e.colourTertiary):this.borderRect_.setAttribute("fill","transparent")),this.sourceBlock_&&this.arrow&&(this.sourceBlock_.isShadow()?this.arrow.style.fill=e.colourSecondary:this.arrow.style.fill=e.colourPrimary)}render_(){this.getTextContent().nodeValue="",this.imageElement.style.display="none";const e=this.selectedOption&&this.selectedOption[0];e&&"object"===typeof e?this.renderSelectedImage(e):this.renderSelectedText(),this.positionBorderRect_()}renderSelectedImage(e){const t=this.getSourceBlock();if(!t)throw new xh;this.imageElement.style.display="",this.imageElement.setAttributeNS(bl,"xlink:href",e.src),this.imageElement.setAttribute("height",String(e.height)),this.imageElement.setAttribute("width",String(e.width));const n=Number(e.height);e=Number(e.width);var o=!!this.borderRect_;const r=Math.max(o?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,n+Fh);let i;o=o?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,i=this.svgArrow?this.positionSVGArrow(e+o,r/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):ge(this.arrow,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY),this.size_.width=e+i+2*o,this.size_.height=r;let s=0;t.RTL?this.imageElement.setAttribute("x","".concat(o+i)):(s=e+i,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x","".concat(o))),this.imageElement.setAttribute("y",String(r/2-n/2)),this.positionTextElement_(s+o,e+i)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();re(e,"blocklyDropdownText"),e.setAttribute("text-anchor","start");var t=!!this.borderRect_;e=Math.max(t?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);const n=ge(this.getTextElement(),this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);t=t?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let o=0;this.svgArrow&&(o=this.positionSVGArrow(n+t,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_.width=n+o+2*t,this.size_.height=e,this.positionTextElement_(t,n)}positionSVGArrow(e,t){if(!this.svgArrow)return 0;const n=this.getSourceBlock();if(!n)throw new xh;const o=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,r=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,i=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(n.RTL?o:e+r)+","+t+")"),i+r}getText_(){if(!this.selectedOption)return null;const e=this.selectedOption[0];return"object"===typeof e?e.alt:e}static fromJson(e){if(!e.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");return new this(e.options,void 0,e)}};Bh.CHECKMARK_OVERHANG=25,Bh.MAX_MENU_HEIGHT_VH=.45,Bh.ARROW_CHAR="\u25be";var Fh=10;Mr("field_dropdown",Bh);var Uh,Hh=class{constructor(e,t,n){this.workspace=e,this.anchor=t,this.ownerRect=n,this.size=new Sl(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.svgRoot=oe(El.G,{},e.getBubbleCanvas()),e=oe(El.G,{filter:"url(#".concat(this.workspace.getRenderer().getConstants().embossFilterId,")")},this.svgRoot),this.tail=oe(El.PATH,{},e),this.background=oe(El.RECT,{class:"blocklyDraggable",x:0,y:0,rx:Uh.BORDER_WIDTH,ry:Uh.BORDER_WIDTH},e),this.contentContainer=oe(El.G,{},this.svgRoot),z(this.background,"pointerdown",this,this.onMouseDown)}dispose(){le(this.svgRoot),this.disposed=!0}setAnchorLocation(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.width=Math.max(e.width,Uh.MIN_SIZE),e.height=Math.max(e.height,Uh.MIN_SIZE),this.size=e,this.background.setAttribute("width","".concat(e.width)),this.background.setAttribute("height","".concat(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)}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(".concat(e,", ").concat(t,")"))}positionByRect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Il(0,0,0,0);var t=this.workspace.getMetricsManager().getViewMetrics(!0),n=this.getOptimalRelativeLeft(t),o=this.getOptimalRelativeTop(t);const r={x:n,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},i={x:-this.size.width-30,y:o};o={x:e.getWidth(),y:o};var s={x:n,y:e.getHeight()};n=e.getWidth()e.width)return t;if(e=this.getWorkspaceViewRect(e),this.workspace.RTL){var n=this.anchor.x-t;n-this.size.widthe.right&&(t=-(e.right-this.anchor.x))}else{const o=(n=t+this.anchor.x)+this.size.width;ne.right&&(t=e.right-this.anchor.x-this.size.width)}return t}getOptimalRelativeTop(e){let t=-this.size.height/4;if(this.size.height>e.height)return t;const n=this.anchor.y+t,o=n+this.size.height;return n<(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){const t=e.top;let n=e.top+e.height,o=e.left;return e=e.left+e.width,n-=this.getScrollbarThickness(),this.workspace.RTL?o-=this.getScrollbarThickness():e-=this.getScrollbarThickness(),new Il(t,n,o,e)}getScrollbarThickness(){return Ol.scrollbarThickness/this.workspace.scale}renderTail(){const e=[];var t=this.size.width/2,n=this.size.height/2,o=-this.relativeLeft,r=-this.relativeTop;if(t===o&&n===r)e.push("M "+t+","+n);else{r-=n,o-=t,this.workspace.RTL&&(o*=-1);var i=Math.sqrt(r*r+o*o),s=Math.acos(o/i);0>r&&(s=2*Math.PI-s);var a=s+Math.PI/2;a>2*Math.PI&&(a-=2*Math.PI);var l=Math.sin(a);const c=Math.cos(a);let u=(this.size.width+this.size.height)/Uh.TAIL_THICKNESS;u=Math.min(u,this.size.width,this.size.height)/4,o=t+(a=1-Uh.ANCHOR_RADIUS/i)*o,r=n+a*r,a=t+u*c;const h=n+u*l;t-=u*c,n-=u*l,(l=s+(l=uo(this.workspace.RTL?-Uh.TAIL_ANGLE:Uh.TAIL_ANGLE)))>2*Math.PI&&(l-=2*Math.PI),s=Math.sin(l)*i/Uh.TAIL_BEND,i=Math.cos(l)*i/Uh.TAIL_BEND,e.push("M"+a+","+h),e.push("C"+(a+i)+","+(h+s)+" "+o+","+r+" "+o+","+r),e.push("C"+o+","+r+" "+(t+i)+","+(n+s)+" "+t+","+n)}let c;e.push("z"),null==(c=this.tail)||c.setAttribute("d",e.join(" "))}bringToFront(){let e;const 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 hl(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){}};Uh=Hh,Hh.BORDER_WIDTH=6,Hh.DOUBLE_BORDER=2*Uh.BORDER_WIDTH,Hh.MIN_SIZE=Uh.DOUBLE_BORDER,Hh.TAIL_THICKNESS=1,Hh.TAIL_ANGLE=20,Hh.TAIL_BEND=4,Hh.ANCHOR_RADIUS=8;var Gh,Vh,Wh=class extends Hh{constructor(e,t,n,o){let r,i;super(t,n,o),this.workspace=t,this.anchor=n,this.ownerRect=o,this.autoLayout=!0,t=new Sh(e),this.validateWorkspaceOptions(t),this.svgDialog=oe(El.SVG,{x:Hh.BORDER_WIDTH,y:Hh.BORDER_WIDTH},this.contentContainer),e.parentWorkspace=this.workspace,this.miniWorkspace=this.newWorkspaceSvg(new Sh(e)),this.miniWorkspace.internalIsMutator=!0,e=this.miniWorkspace.createDom("blocklyMutatorBackground"),this.svgDialog.appendChild(e),t.languageTree&&(e.insertBefore(this.miniWorkspace.addFlyout(El.G),this.miniWorkspace.getCanvas()),null==(e=this.miniWorkspace.getFlyout())||e.init(this.miniWorkspace),null==e||e.show(t.languageTree)),this.miniWorkspace.addChangeListener(this.onWorkspaceChange.bind(this)),null==(r=this.miniWorkspace.getFlyout())||null==(i=r.getWorkspace())||i.addChangeListener(this.onWorkspaceChange.bind(this)),this.updateBubbleSize()}dispose(){this.miniWorkspace.dispose(),super.dispose()}getWorkspace(){return this.miniWorkspace}addWorkspaceChangeListener(e){this.miniWorkspace.addChangeListener(e)}validateWorkspaceOptions(e){if(e.hasCategories)throw Error("The miniworkspace bubble does not support toolboxes with categories");if(e.hasTrashcan)throw Error("The miniworkspace bubble does not support trashcans");if(e.zoomOptions.controls||e.zoomOptions.wheel||e.zoomOptions.pinch)throw Error("The miniworkspace bubble does not support zooming");if(e.moveOptions.scrollbars||e.moveOptions.wheel||e.moveOptions.drag)throw Error("The miniworkspace bubble does not scrolling/moving the workspace");if(e.horizontalLayout)throw Error("The miniworkspace bubble does not support horizontal layouts")}onWorkspaceChange(){this.bumpBlocksIntoBounds(),this.updateBubbleSize()}bumpBlocksIntoBounds(){if(!this.miniWorkspace.isDragging())for(const e of this.miniWorkspace.getTopBlocks(!1)){const t=e.getRelativeToSurfaceXY();if(20>t.y&&e.moveBy(0,20-t.y),e.RTL){let n=-20;const o=this.miniWorkspace.getFlyout();o&&(n-=o.getWidth()),t.x>n&&e.moveBy(n-t.x,0)}else 20>t.x&&e.moveBy(20-t.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()){var e=this.getSize(),t=this.calculateWorkspaceSize();Math.abs(e.width-t.width)({kind:"block",type:e})))}),t}getAnchorLocation(){const e=Gh/2;return hl.sum(this.workspaceLocation,new hl(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new Il(e.y,e.y+e.height,e.x,e.x+e.width)}createRootBlock(){if(!this.sourceBlock.decompose)throw Error("Blocks with mutator icons must include a decompose method");for(var e of(this.rootBlock=this.sourceBlock.decompose(this.miniWorkspaceBubble.getWorkspace()),this.rootBlock.getDescendants(!1)))e.queueRender();let t,n,o,r;this.rootBlock.setMovable(!1),this.rootBlock.setDeletable(!1),e=null!=(r=null==(t=this.miniWorkspaceBubble)||null==(n=t.getWorkspace())||null==(o=n.getFlyout())?void 0:o.getWidth())?r:0,this.rootBlock.moveBy(this.rootBlock.RTL?-(e+Vh):Vh,Vh)}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=>{Ms.MutatorIcon$$module$build$src$core$icons$mutator_icon.isIgnorableMutatorEvent(e)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout((()=>{this.updateWorkspacePid=null,this.recomposeSourceBlock()}),0))}}static isIgnorableMutatorEvent(e){return e.isUiEvent||e.type===Ms.CREATE$$module$build$src$core$events$utils||e.type===Ms.CHANGE$$module$build$src$core$events$utils&&"disabled"===e.element}recomposeSourceBlock(){if(this.rootBlock){if(!this.sourceBlock.compose)throw Error("Blocks with mutator icons must include a compose method");var e=Ms.getGroup$$module$build$src$core$events$utils();e||Ms.setGroup$$module$build$src$core$events$utils(!0);var t=wh.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var n=wh.getExtraBlockState_(this.sourceBlock);t!==n&&A(new(B(Ms.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock,"mutation",null,t,n)),Ms.setGroup$$module$build$src$core$events$utils(e)}}getWorkspace(){let e;return null==(e=this.miniWorkspaceBubble)?void 0:e.getWorkspace()}static reconnect(e,t,n){return ne("MutatorIcon.reconnect","v10","v11","connection.reconnect"),!!e&&e.reconnect(t,n)}static findParentWs(e){return ne("MutatorIcon.findParentWs","v10","v11","workspace.getRootWorkspace"),e.getRootWorkspace()}},Ms.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE=Jl.MUTATOR,Ms.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1,Ms.MutatorIcon$$module$build$src$core$icons$mutator_icon;var jh=Object.create(null),zh={allExtensions:jh};Ms.register$$module$build$src$core$extensions("parent_tooltip_when_inline",ei);var Xh,Yh={TEST_ONLY:zh};Yh.apply=Vr,Yh.buildTooltipForDropdown=Ms.buildTooltipForDropdown$$module$build$src$core$extensions,Yh.buildTooltipWithFieldText=Ms.buildTooltipWithFieldText$$module$build$src$core$extensions,Yh.isRegistered=Gr,Yh.register=Ms.register$$module$build$src$core$extensions,Yh.registerMixin=Ms.registerMixin$$module$build$src$core$extensions,Yh.registerMutator=Ms.registerMutator$$module$build$src$core$extensions,Yh.runAfterPageLoad=Zr,Yh.unregister=Hr,function(e){e[e.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX",e[e.MAC_ENTER=3]="MAC_ENTER",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.NUM_CENTER=12]="NUM_CENTER",e[e.ENTER=13]="ENTER",e[e.SHIFT=16]="SHIFT",e[e.CTRL=17]="CTRL",e[e.ALT=18]="ALT",e[e.PAUSE=19]="PAUSE",e[e.CAPS_LOCK=20]="CAPS_LOCK",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.PAGE_UP=33]="PAGE_UP",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.END=35]="END",e[e.HOME=36]="HOME",e[e.LEFT=37]="LEFT",e[e.UP=38]="UP",e[e.RIGHT=39]="RIGHT",e[e.DOWN=40]="DOWN",e[e.PLUS_SIGN=43]="PLUS_SIGN",e[e.PRINT_SCREEN=44]="PRINT_SCREEN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.ZERO=48]="ZERO",e[e.ONE=49]="ONE",e[e.TWO=50]="TWO",e[e.THREE=51]="THREE",e[e.FOUR=52]="FOUR",e[e.FIVE=53]="FIVE",e[e.SIX=54]="SIX",e[e.SEVEN=55]="SEVEN",e[e.EIGHT=56]="EIGHT",e[e.NINE=57]="NINE",e[e.FF_SEMICOLON=59]="FF_SEMICOLON",e[e.FF_EQUALS=61]="FF_EQUALS",e[e.FF_DASH=173]="FF_DASH",e[e.FF_HASH=163]="FF_HASH",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.AT_SIGN=64]="AT_SIGN",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.META=91]="META",e[e.WIN_KEY_RIGHT=92]="WIN_KEY_RIGHT",e[e.CONTEXT_MENU=93]="CONTEXT_MENU",e[e.NUM_ZERO=96]="NUM_ZERO",e[e.NUM_ONE=97]="NUM_ONE",e[e.NUM_TWO=98]="NUM_TWO",e[e.NUM_THREE=99]="NUM_THREE",e[e.NUM_FOUR=100]="NUM_FOUR",e[e.NUM_FIVE=101]="NUM_FIVE",e[e.NUM_SIX=102]="NUM_SIX",e[e.NUM_SEVEN=103]="NUM_SEVEN",e[e.NUM_EIGHT=104]="NUM_EIGHT",e[e.NUM_NINE=105]="NUM_NINE",e[e.NUM_MULTIPLY=106]="NUM_MULTIPLY",e[e.NUM_PLUS=107]="NUM_PLUS",e[e.NUM_MINUS=109]="NUM_MINUS",e[e.NUM_PERIOD=110]="NUM_PERIOD",e[e.NUM_DIVISION=111]="NUM_DIVISION",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUMLOCK=144]="NUMLOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.FIRST_MEDIA_KEY=166]="FIRST_MEDIA_KEY",e[e.LAST_MEDIA_KEY=183]="LAST_MEDIA_KEY",e[e.SEMICOLON=186]="SEMICOLON",e[e.DASH=189]="DASH",e[e.EQUALS=187]="EQUALS",e[e.COMMA=188]="COMMA",e[e.PERIOD=190]="PERIOD",e[e.SLASH=191]="SLASH",e[e.APOSTROPHE=192]="APOSTROPHE",e[e.TILDE=192]="TILDE",e[e.SINGLE_QUOTE=222]="SINGLE_QUOTE",e[e.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET",e[e.BACKSLASH=220]="BACKSLASH",e[e.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET",e[e.WIN_KEY=224]="WIN_KEY",e[e.MAC_FF_META=224]="MAC_FF_META",e[e.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT",e[e.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT",e[e.WIN_IME=229]="WIN_IME",e[e.VK_NONAME=252]="VK_NONAME",e[e.PHANTOM=255]="PHANTOM"}(Xh||(Xh={}));var Kh={};Kh.arc=li,Kh.curve=ni,Kh.line=si,Kh.lineOnAxis=ai,Kh.lineTo=ii,Kh.moveBy=ri,Kh.moveTo=oi,Kh.point=ti;var Jh={};Jh.Coordinate=hl,Jh.KeyCodes=Xh,Jh.Rect=Il,Jh.Size=Sl,Jh.Svg=El,Jh.aria=iu,Jh.array=il,Jh.browserEvents=rl,Jh.colour=Ah,Jh.deprecation=pl,Jh.dom=yl,Jh.extensions=Yh,Jh.idGenerator=wa,Jh.math=Eu,Jh.object=yh,Jh.parsing=Oh,Jh.string=qu,Jh.style=Cl,Jh.svgMath=Al,Jh.svgPaths=Kh,Jh.toolbox=zl,Jh.userAgent=tl,Jh.xml=Bl;var qh={};qh.register=ci,qh.unregister=ui;var Zh=class extends Hh{constructor(e,t,n,o){super(t,n,o),this.text=e,this.workspace=t,this.anchor=n,this.ownerRect=o,this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}getText(){return this.text}setText(e){this.text=e,le(this.paragraph),this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}stringToSvg(e,t){return t=this.createParagraph(t),e=this.createSpans(t,e),this.workspace.RTL&&this.rightAlignSpans(t.getBBox().width,e),t}createParagraph(e){return oe(El.TEXT,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:Hh.BORDER_WIDTH},e)}createSpans(e,t){return t.split("\n").map((t=>{const n=oe(El.TSPAN,{dy:"1em",x:Hh.BORDER_WIDTH},e);return t=document.createTextNode(t),n.appendChild(t),n}))}rightAlignSpans(e,t){for(const n of t)n.setAttribute("text-anchor","end"),n.setAttribute("x","".concat(e+Hh.BORDER_WIDTH))}updateBubbleSize(){const e=this.paragraph.getBBox();this.setSize(new Sl(e.width+2*Hh.BORDER_WIDTH,e.height+2*Hh.BORDER_WIDTH),!0)}},Qh=class extends Hh{constructor(e,t,n){super(e,t,n),this.workspace=e,this.anchor=t,this.ownerRect=n,this.resizePointerMoveListener=this.resizePointerUpListener=null,this.textChangeListeners=[],this.sizeChangeListeners=[],this.text="",this.DEFAULT_SIZE=new Sl(160+Hh.DOUBLE_BORDER,80+Hh.DOUBLE_BORDER),this.MIN_SIZE=new Sl(45+Hh.DOUBLE_BORDER,20+Hh.DOUBLE_BORDER),({inputRoot:this.inputRoot,textArea:this.textArea}=this.createEditor(this.contentContainer)),this.resizeGroup=this.createResizeHandle(this.svgRoot),this.setSize(this.DEFAULT_SIZE,!0)}getText(){return this.text}setText(e){this.text=e,this.textArea.value=e,this.onTextChange()}addTextChangeListener(e){this.textChangeListeners.push(e)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}createEditor(e){e=oe(El.FOREIGNOBJECT,{x:Hh.BORDER_WIDTH,y:Hh.BORDER_WIDTH},e);const t=document.createElementNS(ml,"body");t.setAttribute("xmlns",ml),t.className="blocklyMinimalBody";const n=document.createElementNS(ml,"textarea");return n.className="blocklyCommentTextarea",n.setAttribute("dir",this.workspace.RTL?"RTL":"LTR"),t.appendChild(n),e.appendChild(t),this.bindTextAreaEvents(n),setTimeout((()=>{n.focus()}),0),{inputRoot:e,textArea:n}}bindTextAreaEvents(e){z(e,"wheel",this,(e=>{e.stopPropagation()})),z(e,"focus",this,this.onStartEdit,!0),z(e,"change",this,this.onTextChange)}createResizeHandle(e){e=oe(El.G,{class:this.workspace.RTL?"blocklyResizeSW":"blocklyResizeSE"},e);const t=2*Hh.BORDER_WIDTH;return oe(El.POLYGON,{points:"0,".concat(t," ").concat(t,",").concat(t," ").concat(t,",0")},e),oe(El.LINE,{class:"blocklyResizeLine",x1:t/3,y1:t-1,x2:t-1,y2:t/3},e),oe(El.LINE,{class:"blocklyResizeLine",x1:2*t/3,y1:t-1,x2:t-1,y2:2*t/3},e),z(e,"pointerdown",this,this.onResizePointerDown),e}setSize(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.width=Math.max(e.width,this.MIN_SIZE.width),e.height=Math.max(e.height,this.MIN_SIZE.height);const n=e.width-Hh.DOUBLE_BORDER,o=e.height-Hh.DOUBLE_BORDER;this.inputRoot.setAttribute("width","".concat(n)),this.inputRoot.setAttribute("height","".concat(o)),this.textArea.style.width="".concat(n-4,"px"),this.textArea.style.height="".concat(o-4,"px"),this.workspace.RTL?this.resizeGroup.setAttribute("transform","translate(".concat(Hh.DOUBLE_BORDER,", ").concat(o,") scale(-1 1)")):this.resizeGroup.setAttribute("transform","translate(".concat(n,", ").concat(o,")")),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}onResizePointerDown(e){this.bringToFront(),J(e)||(this.workspace.startDrag(e,new hl(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=z(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=z(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){G(),this.resizePointerUpListener&&(Y(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(Y(this.resizePointerMoveListener),this.resizePointerMoveListener=null)}onResizePointerMove(e){e=this.workspace.moveDrag(e),this.setSize(new Sl(this.workspace.RTL?-e.x:e.x,e.y),!1),this.onSizeChange()}onStartEdit(){this.bringToFront()&&this.textArea.focus()}onTextChange(){this.text=this.textArea.value;for(const e of this.textChangeListeners)e()}onSizeChange(){for(const e of this.sizeChangeListeners)e()}};ee("\n.blocklyCommentTextarea {\n background-color: #fef49c;\n border: 0;\n display: block;\n margin: 0;\n outline: 0;\n padding: 3px;\n resize: none;\n text-overflow: hidden;\n}\n");var ed=17,td=160,nd=80,od=class extends Mh{constructor(e){super(e),this.sourceBlock=e,this.textBubble=this.textInputBubble=null,this.text="",this.bubbleSize=new Sl(td,nd),this.bubbleVisiblity=!1}getType(){return od.TYPE}initView(e){this.svgRoot||(super.initView(e),oe(El.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),oe(El.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),oe(El.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),re(this.svgRoot,"blockly-icon-comment"))}dispose(){let e,t;super.dispose(),null==(e=this.textInputBubble)||e.dispose(),null==(t=this.textBubble)||t.dispose()}getWeight(){return od.WEIGHT}getSize(){return new Sl(ed,ed)}applyColour(){super.applyColour();const e=this.sourceBlock.style.colourPrimary;let t,n;null==(t=this.textInputBubble)||t.setColour(e),null==(n=this.textBubble)||n.setColour(e)}updateEditable(){super.updateEditable(),this.bubbleIsVisible()&&(this.setBubbleVisible(!1),this.setBubbleVisible(!0))}onLocationChange(e){let t,n;super.onLocationChange(e),e=this.getAnchorLocation(),null==(t=this.textInputBubble)||t.setAnchorLocation(e),null==(n=this.textBubble)||n.setAnchorLocation(e)}setText(e){const t=this.text;let n,o;A(new(B(Ms.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock,"comment",null,t,e)),this.text=e,null==(n=this.textInputBubble)||n.setText(this.text),null==(o=this.textBubble)||o.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}saveState(){return this.text?{text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width}:null}loadState(e){let t,n,o,r;this.text=null!=(t=e.text)?t:"",this.bubbleSize=new Sl(null!=(n=e.width)?n:td,null!=(o=e.height)?o:nd),this.bubbleVisiblity=null!=(r=e.pinned)&&r,setTimeout((()=>this.setBubbleVisible(this.bubbleVisiblity)),1)}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}onTextChange(){if(this.textInputBubble){var e=this.textInputBubble.getText();this.text!==e&&(A(new(B(Ms.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock,"comment",null,this.text,e)),this.text=e)}}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(e){e&&(this.textBubble||this.textInputBubble)||(e||this.textBubble||this.textInputBubble)&&(this.bubbleVisiblity=e,this.sourceBlock.rendered&&!this.sourceBlock.isInFlyout&&(e?(this.sourceBlock.isEditable()?this.showEditableBubble():this.showNonEditableBubble(),this.applyColour()):this.hideBubble(),A(new(B(la))(this.sourceBlock,e,"comment"))))}showEditableBubble(){this.textInputBubble=new Qh(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.textInputBubble.setText(this.getText()),this.textInputBubble.setSize(this.bubbleSize,!0),this.textInputBubble.addTextChangeListener((()=>this.onTextChange())),this.textInputBubble.addSizeChangeListener((()=>this.onSizeChange()))}showNonEditableBubble(){this.textBubble=new Zh(this.getText(),this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect())}hideBubble(){let e,t;null==(e=this.textInputBubble)||e.dispose(),this.textInputBubble=null,null==(t=this.textBubble)||t.dispose(),this.textBubble=null}getAnchorLocation(){const e=ed/2;return hl.sum(this.workspaceLocation,new hl(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new Il(e.y,e.y+e.height,e.x,e.x+e.width)}};od.TYPE=Jl.COMMENT,od.WEIGHT=3,ci(od.TYPE,od);var rd=17,id=class extends Mh{constructor(e){super(e),this.sourceBlock=e,this.textMap=new Map,this.textBubble=null}getType(){return id.TYPE}initView(e){this.svgRoot||(super.initView(e),oe(El.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),oe(El.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),oe(El.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot),re(this.svgRoot,"blockly-icon-warning"))}dispose(){let e;super.dispose(),null==(e=this.textBubble)||e.dispose()}getWeight(){return id.WEIGHT}getSize(){return new Sl(rd,rd)}applyColour(){let e;super.applyColour(),null==(e=this.textBubble)||e.setColour(this.sourceBlock.style.colourPrimary)}updateCollapsed(){}isShownWhenCollapsed(){return!0}onLocationChange(e){let t;super.onLocationChange(e),null==(t=this.textBubble)||t.setAnchorLocation(this.getAnchorLocation())}addMessage(e,t){if(this.textMap.get(t)===e)return this;let n;return e?this.textMap.set(t,e):this.textMap.delete(t),null==(n=this.textBubble)||n.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){if(this.bubbleIsVisible()!==e){if(e)this.textBubble=new Zh(this.getText(),this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.applyColour();else{let e;null==(e=this.textBubble)||e.dispose(),this.textBubble=null}A(new(B(la))(this.sourceBlock,e,"warning"))}}getAnchorLocation(){const e=rd/2;return hl.sum(this.workspaceLocation,new hl(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new Il(e.y,e.y+e.height,e.x,e.x+e.width)}};id.TYPE=Jl.WARNING,id.WEIGHT=2;var sd=class extends Error{constructor(e){super("Tried to append an icon of type ".concat(e.getType()," when an icon of ")+"that type already exists on the block. Use getIcon to access the existing icon."),this.icon=e}},ad={};ad.DuplicateIconType=sd;var ld,cd,ud={};ud.CommentIcon=od,ud.Icon=Mh,ud.IconType=Jl,ud.MutatorIcon=Ms.MutatorIcon$$module$build$src$core$icons$mutator_icon,ud.WarningIcon=id,ud.exceptions=ad,ud.registry=qh,ld="PROCEDURE",Ms.DEFAULT_ARG$$module$build$src$core$procedures="x",(cd={CATEGORY_NAME:ld,DEFAULT_ARG:Ms.DEFAULT_ARG$$module$build$src$core$procedures}).ObservableProcedureMap=Nh,cd.allProcedures=hi,cd.findLegalName=Ms.findLegalName$$module$build$src$core$procedures,cd.flyoutCategory=gi,cd.getCallers=Ti,cd.getDefinition=Ms.getDefinition$$module$build$src$core$procedures,cd.isNameUsed=fi,cd.isProcedureBlock=Lr,cd.mutateCallers=Ms.mutateCallers$$module$build$src$core$procedures,cd.mutatorOpenListener=bi,cd.rename=Ms.rename$$module$build$src$core$procedures;var hd=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_=16777216}getType(e){return Object.prototype.hasOwnProperty.call(this,e)||(this[e]=this.nextTypeValue_,this.nextTypeValue_<<=1),this[e]}isField(e){return e.type&this.FIELD}isHat(e){return e.type&this.HAT}isIcon(e){return e.type&this.ICON}isSpacer(e){return e.type&this.SPACER}isInRowSpacer(e){return e.type&this.IN_ROW_SPACER}isInput(e){return e.type&this.INPUT}isExternalInput(e){return e.type&this.EXTERNAL_VALUE_INPUT}isInlineInput(e){return e.type&this.INLINE_INPUT}isStatementInput(e){return e.type&this.STATEMENT_INPUT}isPreviousConnection(e){return e.type&this.PREVIOUS_CONNECTION}isNextConnection(e){return e.type&this.NEXT_CONNECTION}isPreviousOrNextConnection(e){return e.type&(this.PREVIOUS_CONNECTION|this.NEXT_CONNECTION)}isLeftRoundedCorner(e){return e.type&this.LEFT_ROUND_CORNER}isRightRoundedCorner(e){return e.type&this.RIGHT_ROUND_CORNER}isLeftSquareCorner(e){return e.type&this.LEFT_SQUARE_CORNER}isRightSquareCorner(e){return e.type&this.RIGHT_SQUARE_CORNER}isCorner(e){return e.type&this.CORNER}isJaggedEdge(e){return e.type&this.JAGGED_EDGE}isRow(e){return e.type&this.ROW}isBetweenRowSpacer(e){return e.type&this.BETWEEN_ROW_SPACER}isTopRow(e){return e.type&this.TOP_ROW}isBottomRow(e){return e.type&this.BOTTOM_ROW}isTopOrBottomRow(e){return e.type&(this.TOP_ROW|this.BOTTOM_ROW)}isInputRow(e){return e.type&this.INPUT_ROW}},dd=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=hd.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},pd=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=hd.ROW,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}getLastInput(){for(let e=this.elements.length-1;0<=e;e--){const t=this.elements[e];if(hd.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;erect,"),"".concat(e," .blocklyEditableText>rect {"),"fill: ".concat(this.FIELD_BORDER_RECT_COLOUR,";"),"fill-opacity: .6;","stroke: none;","}","".concat(e," .blocklyNonEditableText>text,"),"".concat(e," .blocklyEditableText>text {"),"fill: #000;","}","".concat(e," .blocklyFlyoutLabelText {"),"fill: #000;","}","".concat(e," .blocklyText.blocklyBubbleText {"),"fill: #000;","}","".concat(e," .blocklyEditableText:not(.editing):hover>rect {"),"stroke: #fff;","stroke-width: 2;","}","".concat(e," .blocklyHtmlInput {"),"font-family: ".concat(this.FIELD_TEXT_FONTFAMILY,";"),"font-weight: ".concat(this.FIELD_TEXT_FONTWEIGHT,";"),"}","".concat(e," .blocklySelected>.blocklyPath {"),"stroke: #fc3;","stroke-width: 3px;","}","".concat(e," .blocklyHighlightedConnectionPath {"),"stroke: #fc3;","}","".concat(e," .blocklyReplaceable .blocklyPath {"),"fill-opacity: .5;","}","".concat(e," .blocklyReplaceable .blocklyPathLight,"),"".concat(e," .blocklyReplaceable .blocklyPathDark {"),"display: none;","}","".concat(e," .blocklyInsertionMarker>.blocklyPath {"),"fill-opacity: ".concat(this.INSERTION_MARKER_OPACITY,";"),"stroke: none;","}"]}},Nd={};Nd.ConstantProvider=Ld,Nd.isDynamicShape=yi,Nd.isNotch=Ii,Nd.isPuzzleTab=Ei;var Md=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_()}hideHiddenIcons_(){ne("hideHiddenIcons_","v10","v11")}recordSizeOnBlock_(){this.block_.height=this.info_.height,this.block_.width=this.info_.widthWithChildren}drawOutline_(){this.drawTop_();for(let e=1;ee||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return t||""===t&&n?("string"===typeof t&&(t=Ms.fromJson$$module$build$src$core$field_registry({type:"field_label",text:t})),t.setSourceBlock(this.sourceBlock),this.sourceBlock.rendered&&(t.init(),t.applyColour()),t.name=n,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(),this.sourceBlock.bumpNeighbours()),e):e}removeField(e,t){for(let n,o=0;n=this.fieldRow[o];o++)if(n.name===e)return n.dispose(),this.fieldRow.splice(o,1),this.sourceBlock.rendered&&(this.sourceBlock.queueRender(),this.sourceBlock.bumpNeighbours()),!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 o,r=0;o=this.fieldRow[r];r++)o.setVisible(e);if(this.connection){var n=this.connection;e?t=n.startTrackingAll():n.stopTrackingAll(),(n=n.targetBlock())&&(n.getSvgRoot().style.display=e?"block":"none")}return t}markDirty(){for(let e,t=0;e=this.fieldRow[t];t++)e.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(){if(this.sourceBlock.workspace.rendered)for(let e=0;e0&&void 0!==arguments[0])||arguments[0];const{parentConnection:t,childConnection:n}=this.getParentAndChildConnections();if(!t||!n)throw Error("Source connection not connected.");const o=Ms.getGroup$$module$build$src$core$events$utils();let r;o||Ms.setGroup$$module$build$src$core$events$utils(!0),N()&&(r=new(B(Ms.MOVE$$module$build$src$core$events$utils))(n.getSourceBlock()),r.setReason(["disconnect"]));const i=this.targetConnection;i&&(i.targetConnection=null),this.targetConnection=null,e&&n.getSourceBlock().setParent(null),r&&(r.recordNew(),A(r)),n.getSourceBlock().isShadow()||t.respawnShadow_(),Ms.setGroup$$module$build$src$core$events$utils(o)}getParentAndChildConnections(){return this.targetConnection?this.isSuperior()?{parentConnection:this,childConnection:this.targetConnection}:{parentConnection:this.targetConnection,childConnection:this}:{}}respawnShadow_(){this.createShadowBlock(!0)}reconnect(e,t){return!this.getSourceBlock().isDeadOrDying()&&(t=null==(n=e.getInput(t))?void 0:n.connection,!((n=this.targetBlock())&&n!==e||!t||t.targetConnection===this)&&(t.isConnected()&&t.disconnect(),t.connect(this),!0));var n}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()?Dt(this.targetBlock()):this.shadowDom}setShadowState(e){this.setShadowStateInternal({shadowState:e})}getShadowState(e){return e&&this.targetBlock()&&this.targetBlock().isShadow()?sn(this.targetBlock()):this.shadowState}neighbours(e){return[]}getParentInput(){let e=null;const t=this.sourceBlock_.inputList;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.shadowDom=e,this.shadowState=t,(e=this.targetBlock())?e.isShadow()?(e.dispose(!1),this.getSourceBlock().isDeadOrDying()||(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock()))):(e=this.createShadowBlock(!1),this.serializeShadow(e),e&&e.dispose(!1)):(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock()))}createShadowBlock(e){var t=this.getSourceBlock();const n=this.getShadowState(),o=this.getShadowDom();if(t.isDeadOrDying()||!n&&!o)return null;if(n)return mn(n,t.workspace,{parentConnection:e?this:void 0,isShadow:!0,recordUndo:!1});if(o){if(t=Gt(o,t.workspace),e)if(this.type===zc.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!==zc.NEXT_STATEMENT)throw Error("Cannot connect a shadow block to a previous/output connection");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")}return t}return null}serializeShadow(e){e&&(this.shadowDom=Dt(e),this.shadowState=sn(e))}static getConnectionForOrphanedConnection(e,t){if(t.type===zc.OUTPUT_VALUE)return ki(e,t.getSourceBlock());e=e.lastConnectionInStack(!0);const n=t.getConnectionChecker();return e&&n.canConnect(t,e,!1)?e:null}};Kd.CAN_CONNECT=0,Kd.REASON_SELF_CONNECTION=1,Kd.REASON_WRONG_TYPE=2,Kd.REASON_TARGET_NULL=3,Kd.REASON_CHECKS_FAILED=4,Kd.REASON_DIFFERENT_WORKSPACES=5,Kd.REASON_SHADOW_PARENT=6,Kd.REASON_DRAG_CHECKS_FAILED=7,Kd.REASON_PREVIOUS_AND_OUTPUT=8;var Jd="_TEMP_COLLAPSED_INPUT",qd="_TEMP_COLLAPSED_FIELD",Zd={COLLAPSED_FIELD_NAME:qd,COLLAPSED_INPUT_NAME:Jd},Qd="The insertion marker manager tried to create a marker but the result is missing %1. If you are using a mutator, make sure your domToMutation method is properly defined.",ep=class{constructor(e){this.activeCandidate=this.lastMarker=this.lastOnStack=null,this.wouldDeleteBlock=!1,this.fadedBlock=this.highlightedBlock=this.markerConnection=null,b(e),this.topBlock=e,this.workspace=e.workspace,this.firstMarker=this.createMarkerBlock(this.topBlock),this.availableConnections=this.initAvailableConnections(),this.lastOnStack&&(this.lastMarker=this.createMarkerBlock(this.lastOnStack.getSourceBlock()))}dispose(){this.availableConnections.length=0,this.disposeInsertionMarker(this.firstMarker),this.disposeInsertionMarker(this.lastMarker)}updateAvailableConnections(){this.availableConnections=this.initAvailableConnections()}wouldConnectBlock(){return!!this.activeCandidate}applyConnections(){if(this.activeCandidate){Ms.disable$$module$build$src$core$events$utils(),this.hidePreview(),Ms.enable$$module$build$src$core$events$utils();var{local:e,closest:t}=this.activeCandidate;if(e.connect(t),this.topBlock.rendered){const n=e.isSuperior()?t:e,o=this.topBlock.getRootBlock();It().then((()=>{Bo(n.getSourceBlock()),setTimeout((()=>{o.bringToFront()}),0)}))}}}update(e,t){const n=this.getCandidate(e);((this.wouldDeleteBlock=this.shouldDelete(!!n,t))||this.shouldUpdatePreviews(n,e))&&(Ms.disable$$module$build$src$core$events$utils(),this.maybeHidePreview(n),this.maybeShowPreview(n),Ms.enable$$module$build$src$core$events$utils())}createMarkerBlock(e){var t=e.type;let n;Ms.disable$$module$build$src$core$events$utils();try{if(n=this.workspace.newBlock(t),n.setInsertionMarker(!0),e.saveExtraState){var o=e.saveExtraState(!0);o&&n.loadExtraState&&n.loadExtraState(o)}else if(e.mutationToDom){const t=e.mutationToDom();t&&n.domToMutation&&n.domToMutation(t)}for(t=0;t{let e,t;null==(e=r)||e.positionNearConnection(a,i,s),null==(t=r)||t.getSvgRoot().setAttribute("visibility","visible")})),this.markerConnection=o}hideInsertionMarker(){if(this.markerConnection){var e,t=this.markerConnection,n=t.getSourceBlock(),o=n.outputConnection;if(null!=(e=n.previousConnection)&&e.targetConnection||null!=o&&o.targetConnection)n.unplug(!0);else{let e;null==(e=t.targetBlock())||e.unplug(!1)}if(t.targetConnection)throw Error("markerConnection still connected at the end of disconnectInsertionMarker");this.markerConnection=null,(t=n.getSvgRoot())&&t.setAttribute("visibility","hidden")}}showInsertionInputOutline(e){e=e.closest,this.highlightedBlock=e.getSourceBlock(),this.highlightedBlock.highlightShapeForInput(e,!0)}hideInsertionInputOutline(){if(this.highlightedBlock){if(!this.activeCandidate)throw Error("Cannot hide the insertion marker outline because there is no active candidate");this.highlightedBlock.highlightShapeForInput(this.activeCandidate.closest,!1),this.highlightedBlock=null}}showReplacementFade(e){if(this.fadedBlock=e.closest.targetBlock(),!this.fadedBlock)throw Error("Cannot show the replacement fade because the closest connection does not have a target block");this.fadedBlock.fadeForReplacement(!0)}hideReplacementFade(){this.fadedBlock&&(this.fadedBlock.fadeForReplacement(!1),this.fadedBlock=null)}getInsertionMarkers(){const e=[];return this.firstMarker&&e.push(this.firstMarker),this.lastMarker&&e.push(this.lastMarker),e}disposeInsertionMarker(e){if(e){Ms.disable$$module$build$src$core$events$utils();try{e.dispose()}finally{Ms.enable$$module$build$src$core$events$utils()}}}};!function(e){(e=e.PREVIEW_TYPE||(e.PREVIEW_TYPE={}))[e.INSERTION_MARKER=0]="INSERTION_MARKER",e[e.INPUT_OUTLINE=1]="INPUT_OUTLINE",e[e.REPLACEMENT_FADE=2]="REPLACEMENT_FADE"}(ep||(ep={}));var tp=ep.PREVIEW_TYPE,np={};np.InsertionMarkerManager=ep,np.PreviewType=tp;var op=class{constructor(e){this.overrides=null,this.name=e}getClassName(){return this.name+"-renderer"}init(e,t){this.constants_=this.makeConstants_(),t&&(this.overrides=t,Object.assign(this.constants_,t)),this.constants_.setTheme(e),this.constants_.init()}createDom(e,t){this.constants_.createDom(e,this.name+"-"+t.name,"."+this.getClassName()+"."+t.getClassName())}refreshDom(e,t){const n=this.getConstants();n.dispose(),this.constants_=this.makeConstants_(),this.overrides&&Object.assign(this.constants_,this.overrides),this.constants_.randomIdentifier=n.randomIdentifier,this.constants_.setTheme(t),this.constants_.init(),this.createDom(e,t)}dispose(){this.constants_&&this.constants_.dispose()}makeConstants_(){return new Ld}makeRenderInfo_(e){return new Hd(this,e)}makeDrawer_(e,t){return new Md(e,t)}makeMarkerDrawer(e,t){return new Xd(e,this.getConstants(),t)}makePathObject(e,t){return new Yd(e,t,this.constants_)}getConstants(){return this.constants_}shouldHighlightConnection(e){return!0}orphanCanConnectAtEnd(e,t,n){return!!Kd.getConnectionForOrphanedConnection(e,n===zc.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}getConnectionPreviewMethod(e,t,n){return ne("getConnectionPreviewMethod","v10","v12","an IConnectionPreviewer, if it fulfills your use case."),t.type===zc.OUTPUT_VALUE||t.type===zc.PREVIOUS_STATEMENT?!e.isConnected()||this.orphanCanConnectAtEnd(n,e.targetBlock(),t.type)?ep.PREVIEW_TYPE.INSERTION_MARKER:ep.PREVIEW_TYPE.REPLACEMENT_FADE:ep.PREVIEW_TYPE.INSERTION_MARKER}render(e){const t=this.makeRenderInfo_(e);t.measure(),this.makeDrawer_(e,t).draw()}},rp={};rp.BottomRow=fd,rp.Connection=gd,rp.ConstantProvider=Ld,rp.Drawer=Md,rp.ExternalValueInput=bd,rp.Field=_d,rp.Hat=Td,rp.Icon=vd,rp.InRowSpacer=yd,rp.InlineInput=Ed,rp.InputConnection=md,rp.InputRow=Sd,rp.JaggedEdge=wd,rp.MarkerSvg=Xd,rp.Measurable=dd,rp.NextConnection=Cd,rp.OutputConnection=kd,rp.PathObject=Yd,rp.PreviousConnection=$d,rp.RenderInfo=Hd,rp.Renderer=op,rp.RoundCorner=Ad,rp.Row=pd,rp.SpacerRow=Od,rp.SquareCorner=Rd,rp.StatementInput=Id,rp.TopRow=xd,rp.Types=hd,rp.init=Oi,rp.register=$i,rp.unregister=Ai;var ip=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())&&se(e,t),(t=this.theme.getClassName())&&re(e,t));for(let n,o=0;n=this.subscribedWorkspaces_[o];o++)n.refreshTheme();for(const[n,o]of this.componentDB)for(const r of o){e=r.element,t=r.propertyName;const o=this.theme&&this.theme.getComponentStyle(n);e.style.setProperty(t,o||"")}for(const n of this.subscribedWorkspaces_)n.hideChaff()}subscribeWorkspace(e){this.subscribedWorkspaces_.push(e)}unsubscribeWorkspace(e){if(!Q(this.subscribedWorkspaces_,e))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.")}subscribe(e,t,n){this.componentDB.has(t)||this.componentDB.set(t,[]),this.componentDB.get(t).push({element:e,propertyName:n}),t=this.theme&&this.theme.getComponentStyle(t),e.style.setProperty(n,t||"")}unsubscribe(e){if(e)for(const[t,n]of this.componentDB){for(let t=n.length-1;0<=t;t--)n[t].element===e&&n.splice(t,1);n.length||this.componentDB.delete(t)}}dispose(){this.subscribedWorkspaces_.length=0,this.componentDB.clear()}},sp="VARIABLE_DYNAMIC",ap={CATEGORY_NAME:sp};ap.flyoutCategory=Ni,ap.flyoutCategoryBlocks=Mi,ap.onCreateVariableButtonClick_Colour=Li,ap.onCreateVariableButtonClick_Number=xi,ap.onCreateVariableButtonClick_String=Ri;var lp=class{canConnect(e,t,n,o){return this.canConnectWithReason(e,t,n,o)===Kd.CAN_CONNECT}canConnectWithReason(e,t,n,o){const r=this.doSafetyChecks(e,t);return r!==Kd.CAN_CONNECT?r:this.doTypeChecks(e,t)?n&&!this.doDragChecks(e,t,o||0)?Kd.REASON_DRAG_CHECKS_FAILED:Kd.CAN_CONNECT:Kd.REASON_CHECKS_FAILED}getErrorMessage(e,t,n){switch(e){case Kd.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case Kd.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case Kd.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case Kd.REASON_TARGET_NULL:return"Target connection is null.";case Kd.REASON_CHECKS_FAILED:return"Connection checks failed. "+t+" expected "+t.getCheck()+", found "+n.getCheck();case Kd.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case Kd.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case Kd.REASON_PREVIOUS_AND_OUTPUT:return"Block would have an output and a previous connection.";default:return"Unknown connection failure: this should never happen!"}}doSafetyChecks(e,t){if(!e||!t)return Kd.REASON_TARGET_NULL;let n,o,r;return e.isSuperior()?(n=e.getSourceBlock(),o=t.getSourceBlock(),r=t):(o=e.getSourceBlock(),n=t.getSourceBlock(),r=e,e=t),n===o?Kd.REASON_SELF_CONNECTION:r.type!==Yu[e.type]?Kd.REASON_WRONG_TYPE:n.workspace!==o.workspace?Kd.REASON_DIFFERENT_WORKSPACES:n.isShadow()&&!o.isShadow()?Kd.REASON_SHADOW_PARENT:r.type===zc.OUTPUT_VALUE&&o.previousConnection&&o.previousConnection.isConnected()||r.type===zc.PREVIOUS_STATEMENT&&o.outputConnection&&o.outputConnection.isConnected()?Kd.REASON_PREVIOUS_AND_OUTPUT:Kd.CAN_CONNECT}doTypeChecks(e,t){if(e=e.getCheck(),t=t.getCheck(),!e||!t)return!0;for(let n=0;nn||t.getSourceBlock().isInsertionMarker())return!1;switch(t.type){case zc.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case zc.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case zc.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case zc.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-1===Xs.indexOf(t)}canConnectToPrevious_(e,t){return!e.targetConnection&&-1===Xs.indexOf(t)&&(!t.targetConnection||!!(e=t.targetBlock()).isInsertionMarker()&&!e.getPreviousBlock())}};e(Us.CONNECTION_CHECKER,Fs,lp);var cp=class extends ic{constructor(e){super(e),this.type=ta,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const 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,n){return(t=super.fromJson(e,t,null!=n?n:new cp)).varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.deleteVariableById(this.varId):t.createVariable(this.varName,this.varType,this.varId)}};e(Us.EVENT,ta,cp);var up=class extends ic{constructor(e,t){super(e),this.type=na,e&&(this.oldName=e.name,this.newName="undefined"===typeof t?"":t)}toJson(){const e=super.toJson();if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");return e.oldName=this.oldName,e.newName=this.newName,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new up)).oldName=e.oldName,t.newName=e.newName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");e?t.renameVariableById(this.varId,this.newName):t.renameVariableById(this.varId,this.oldName)}};e(Us.EVENT,na,up);var hp=class{constructor(e){this.workspace=e,this.variableMap=new Map}clear(){for(const e of this.variableMap.values())for(;0{e&&t&&this.deleteVariableInternal(t,o)}))):this.deleteVariableInternal(t,o)}else console.warn("Can't delete non-existent variable: "+e)}deleteVariableInternal(e,t){const n=Ms.getGroup$$module$build$src$core$events$utils();n||Ms.setGroup$$module$build$src$core$events$utils(!0);try{for(let e=0;ee.name))}getVariableUsesById(e){const t=[],n=this.workspace.getAllBlocks(!1);for(let o=0;o0&&void 0!==arguments[0]&&arguments[0];const t=[].concat(this.topBlocks);return e&&11&&void 0!==arguments[1]&&arguments[1];return this.typedBlocksDB.has(e)?(e=this.typedBlocksDB.get(e).slice(0),t&&e&&10&&void 0!==arguments[0]&&arguments[0];const t=[].concat(this.topComments);return e&&10&&void 0!==arguments[0]&&arguments[0];if(e){var t=this.getTopBlocks(!0);e=[];for(let n=0;nthis.remainingCapacityOfType(n))return!1;t+=e[n]}return!(t>this.remainingCapacity())}hasBlockLimits(){return 1/0!==this.options.maxBlocks||!!this.options.maxInstances}getUndoStack(){return this.undoStack_}getRedoStack(){return this.redoStack_}undo(e){var t=e?this.redoStack_:this.undoStack_,n=e?this.undoStack_:this.redoStack_;const o=t.pop();if(o){for(var r=[o];t.length&&o.group&&o.group===t[t.length-1].group;){const e=t.pop();e&&r.push(e)}for(t=0;tthis.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(let t=0;te[0]-t[0]));for(const[i,s]of r)if(e{},document.body.addEventListener("wheel",this.dummyWheelListener),z(this.svgGroup_,"wheel",this,this.onMouseWheel_)),this.options.hasCategories&&(this.toolbox_=new(c(Us.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=c(Us.CURSOR,this.options))&&this.markerManager.setCursor(new e),this.renderer.createDom(this.svgGroup_,this.getTheme()),this.svgGroup_}dispose(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&le(this.svgGroup_),this.toolbox_&&(this.toolbox_.dispose(),this.toolbox_=null),this.flyout&&(this.flyout.dispose(),this.flyout=null),this.trashcan&&(this.trashcan.dispose(),this.trashcan=null),this.scrollbar&&(this.scrollbar.dispose(),this.scrollbar=null),this.zoomControls_&&this.zoomControls_.dispose(),this.audioManager&&this.audioManager.dispose(),this.grid&&(this.grid=null),this.renderer.dispose(),this.markerManager&&this.markerManager.dispose(),super.dispose(),this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),this.options.parentWorkspace||this.themeManager_.dispose()),this.connectionDBList.length=0,this.toolboxCategoryCallbacks.clear(),this.flyoutButtonCallbacks.clear(),!this.options.parentWorkspace){const e=this.getParentSvg();e&&e.parentNode&&le(e.parentNode)}this.resizeHandlerWrapper&&(Y(this.resizeHandlerWrapper),this.resizeHandlerWrapper=null),this.dummyWheelListener&&(document.body.removeEventListener("wheel",this.dummyWheelListener),this.dummyWheelListener=null)}addTrashcan(){this.trashcan=bp.newTrashcan(this);const e=this.trashcan.createDom();this.svgGroup_.insertBefore(e,this.getCanvas())}static newTrashcan(e){throw Error("The implementation of newTrashcan should be monkey-patched in by blockly.ts")}addZoomControls(){this.zoomControls_=new Kl(this);const e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}addFlyout(e){const t=new Sh({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,move:{scrollbars:!0}});return t.toolboxPosition=this.options.toolboxPosition,this.flyout=this.horizontalLayout?new(c(Us.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(c(Us.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(t),this.flyout.autoClose=!1,this.flyout.getWorkspace().setVisible(!0),this.flyout.createDom(e)}getFlyout(e){return this.flyout||e?this.flyout:this.toolbox_?this.toolbox_.getFlyout():null}getToolbox(){return this.toolbox_}updateScreenCalculations_(){this.updateInverseScreenCTM(),this.recordDragTargets()}resizeContents(){this.resizesEnabled&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())}resize(){this.toolbox_&&this.toolbox_.position(),this.flyout&&this.flyout.position();const e=this.componentManager.getComponents(al.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),n=[];for(let o,r=0;o=e[r];r++){o.position(t,n);const e=o.getBoundingRectangle();e&&n.push(e)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations_()}updateScreenCalculationsIfScrolled(){const e=Oe();hl.equals(this.lastRecordedPageScroll,e)||(this.lastRecordedPageScroll=e,this.updateScreenCalculations_())}getLayerManager(){return this.layerManager}getCanvas(){return this.layerManager.getBlockLayer()}setCachedParentSvgSize(e,t){const n=this.getParentSvg();null!=e&&(this.cachedParentSvgSize.width=e,n.setAttribute("data-cached-width","".concat(e))),null!=t&&(this.cachedParentSvgSize.height=t,n.setAttribute("data-cached-height","".concat(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(N()){var e=this.scale,t=-this.scrollY,n=-this.scrollX;if(!(e===this.oldScale&&1>Math.abs(t-this.oldTop)&&1>Math.abs(n-this.oldLeft))){var o=new(B(da))(t,n,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=t,this.oldLeft=n,A(o)}}}translate(e,t){let n,o;null==(n=this.layerManager)||n.translateLayers(new hl(e,t),this.scale),null==(o=this.grid)||o.moveTo(e,t),this.maybeFireViewportChangeEvent()}getWidth(){const e=this.getMetrics();return e?e.viewWidth/this.scale:0}setVisible(e){this.isVisible_=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(){for(var e=this.getAllBlocks(!1),t=e.length-1;0<=t;t--)e[t].queueRender();if(this.currentGesture_)for(e=this.currentGesture_.getInsertionMarkers(),t=0;t{this.markerManager.updateMarkers()}))}highlightBlock(e,t){if(void 0===t){for(let e,t=0;e=this.highlightedBlocks[t];t++)e.setHighlighted(!1);this.highlightedBlocks.length=0}(e=e?this.getBlockById(e):null)&&((t=void 0===t||t)?-1===this.highlightedBlocks.indexOf(e)&&this.highlightedBlocks.push(e):Q(this.highlightedBlocks,e),e.setHighlighted(t))}paste(e){if(ne("Blockly.WorkspaceSvg.prototype.paste","v10","v11","Blockly.clipboard.paste"),!this.rendered||!e.type&&!e.tagName)return null;this.currentGesture_&&this.currentGesture_.cancel();const t=Ms.getGroup$$module$build$src$core$events$utils();let n;t||Ms.setGroup$$module$build$src$core$events$utils(!0);try{n=e.type?this.pasteBlock_(null,e):"comment"===e.tagName.toLowerCase()?this.pasteWorkspaceComment_(e):this.pasteBlock_(e,null)}finally{Ms.setGroup$$module$build$src$core$events$utils(t)}return n}pasteBlock_(e,t){let n;Ms.disable$$module$build$src$core$events$utils();try{let o=0,r=0;if(e){let t,i;n=Gt(e,this),o=parseInt(null!=(t=e.getAttribute("x"))?t:"0"),this.RTL&&(o=-o),r=parseInt(null!=(i=e.getAttribute("y"))?i:"0")}else t&&(n=gn(t,this),o=t.x||10,this.RTL&&(o=this.getWidth()-o),r=t.y||10);if(!isNaN(o)&&!isNaN(r)){let e;do{e=!1;const t=this.getAllBlocks(!1);for(let n,i=0;n=t[i];i++){const t=n.getRelativeToSurfaceXY();if(1>=Math.abs(o-t.x)&&1>=Math.abs(r-t.y)){e=!0;break}}if(!e){const t=n.getConnections_(!1);for(let n,i=0;n=t[i];i++)if(n.closest(Ms.config$$module$build$src$core$config.snapRadius,new hl(o,r)).connection){e=!0;break}}e&&(o=this.RTL?o-Ms.config$$module$build$src$core$config.snapRadius:o+Ms.config$$module$build$src$core$config.snapRadius,r+=2*Ms.config$$module$build$src$core$config.snapRadius)}while(e);n.moveTo(new hl(o,r))}}finally{Ms.enable$$module$build$src$core$events$utils()}return N()&&!n.isShadow()&&A(new(B(Ms.CREATE$$module$build$src$core$events$utils))(n)),n.select(),n}pasteWorkspaceComment_(e){let t;Ms.disable$$module$build$src$core$events$utils();try{t=Tc.fromXmlRendered(e,this);let n,o,r=parseInt(null!=(n=e.getAttribute("x"))?n:"0"),i=parseInt(null!=(o=e.getAttribute("y"))?o:"0");isNaN(r)||isNaN(i)||(this.RTL&&(r=-r),t.moveBy(r+50,i+50))}finally{Ms.enable$$module$build$src$core$events$utils()}return N()&&dc.fireCreateEvent(t),t.select(),t}refreshToolboxSelection(){const e=this.isFlyout?this.targetWorkspace:this;e&&!e.currentGesture_&&e.toolbox_&&e.toolbox_.getFlyout()&&e.toolbox_.refreshSelection()}renameVariableById(e,t){super.renameVariableById(e,t),this.refreshToolboxSelection()}deleteVariableById(e){super.deleteVariableById(e),this.refreshToolboxSelection()}createVariable(e,t,n){return e=super.createVariable(e,t,n),this.refreshToolboxSelection(),e}recordDragTargets(){const e=this.componentManager.getComponents(al.Capability.DRAG_TARGET,!0);this.dragTargetAreas=[];for(let t,n=0;t=e[n];n++){const e=t.getClientRect();e&&this.dragTargetAreas.push({component:t,clientRect:e})}}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}getDragTarget(e){for(let t,n=0;t=this.dragTargetAreas[n];n++)if(t.clientRect.contains(e.clientX,e.clientY))return t.component;return null}onMouseDown_(e){const t=this.getGesture(e);t&&t.handleWsStart(e,this)}startDrag(e,t){(e=q(e,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,e.y/=this.scale,this.dragDeltaXY=hl.difference(t,e)}moveDrag(e){return(e=q(e,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,e.y/=this.scale,hl.sum(this.dragDeltaXY,e)}isDragging(){return 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(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollVertically())}onMouseWheel_(e){if(_h.inProgress())e.preventDefault(),e.stopPropagation();else{var t=this.options.zoomOptions&&this.options.zoomOptions.wheel,n=this.options.moveOptions&&this.options.moveOptions.wheel;if(t||n){var o=Z(e);if(Qa)var r=e.metaKey;t&&(e.ctrlKey||r||!n)?(o=-o.y/50,t=q(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(t.x,t.y,o)):(t=this.scrollX-o.x,n=this.scrollY-o.y,e.shiftKey&&!o.x&&(t=this.scrollX-o.y,n=this.scrollY),this.scroll(t,n)),e.preventDefault()}}}getBlocksBoundingBox(){const e=this.getTopBoundedElements();if(!e.length)return new Il(0,0,0,0);const t=e[0].getBoundingRectangle();for(let o=1;ot.bottom&&(t.bottom=n.bottom),n.leftt.right&&(t.right=n.right))}return t}cleanUp(){this.setResizesEnabled(!1),Ms.setGroup$$module$build$src$core$events$utils(!0);const e=this.getTopBlocks(!0);let t=0;for(let n,o=0;n=e[o];o++){if(!n.isMovable())continue;const e=n.getRelativeToSurfaceXY();n.moveBy(-e.x,t-e.y,["cleanup"]),n.snapToGrid(),t=n.getRelativeToSurfaceXY().y+n.getHeightWidth().height+this.renderer.getConstants().MIN_BLOCK_HEIGHT}Ms.setGroup$$module$build$src$core$events$utils(!1),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.options.readOnly&&!this.isFlyout){var t=Tu.registry.getContextMenuOptions(Tu.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(t,e),eo(e,t,this.RTL)}}updateToolbox(e){if(e=De(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(Fe(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():(g(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(e,t,n){n=Math.pow(this.options.zoomOptions.scaleSpeed,n);const o=this.scale*n;if(this.scale!==o){o>this.options.zoomOptions.maxScale?n=this.options.zoomOptions.maxScale/this.scale:othis.options.zoomOptions.maxScale?e=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&e0&&void 0!==arguments[0]&&arguments[0];return super.getAllBlocks(e)}getTopBlocks(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return super.getTopBlocks(e)}addTopBlock(e){this.addTopBoundedElement(e),super.addTopBlock(e)}removeTopBlock(e){this.removeTopBoundedElement(e),super.removeTopBlock(e)}addTopComment(e){this.addTopBoundedElement(e),super.addTopComment(e)}removeTopComment(e){this.removeTopBoundedElement(e),super.removeTopComment(e)}getRootWorkspace(){return super.getRootWorkspace()}addTopBoundedElement(e){this.topBoundedElements.push(e)}removeTopBoundedElement(e){Q(this.topBoundedElements,e)}getTopBoundedElements(){return[].concat(this.topBoundedElements)}setResizesEnabled(e){const t=!this.resizesEnabled&&e;this.resizesEnabled=e,t&&this.resizeContents()}clear(){this.setResizesEnabled(!1),super.clear(),this.topBoundedElements=[],this.setResizesEnabled(!0)}registerButtonCallback(e,t){if("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){const t="pointerdown"===e.type,n=this.currentGesture_;return n?t&&n.hasStarted()?(console.warn("Tried to start the same gesture twice."),n.cancel(),null):n:t?this.currentGesture_=new _h(e,this):null}clearGesture(){this.currentGesture_=null}cancelCurrentGesture(){this.currentGesture_&&this.currentGesture_.cancel()}getAudioManager(){return this.audioManager}getGrid(){return this.grid}hideChaff(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];cr(),Vn(),Lo(),this.hideComponents(e)}hideComponents(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.getComponentManager().getComponents(al.Capability.AUTOHIDEABLE,!0).forEach((t=>t.autoHide(e)))}static setTopLevelWorkspaceMetrics_(e){const 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)}},_p={};_p.WorkspaceSvg=bp,_p.resizeSvgContents=Di;var Tp=class extends Aa{constructor(e,t){super(t),this.type=ca,this.isOpen=e}toJson(){const 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,n){return(t=super.fromJson(e,t,null!=n?n:new Tp)).isOpen=e.isOpen,t}};e(Us.EVENT,ca,Tp);var vp=class extends Hc{constructor(e){if(super(e),this.type=Ms.DELETE$$module$build$src$core$events$utils,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=Lt(e),this.ids=D(e),this.wasShadow=e.isShadow(),this.oldJson=sn(e,{addCoordinates:!0})}}toJson(){const e=super.toJson();if(!this.oldXml)throw Error("The old block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(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=Bt(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,n){return(t=super.fromJson(e,t,null!=n?n:new vp)).oldXml=Ms.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){const t=this.getEventWorkspace_();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(e)for(e=0;ee.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(){for(const e of this.inputList)for(const t of e.fieldRow)t.initModel&&t.initModel()}unplug(e){this.outputConnection&&this.unplugFromRow_(e),this.previousConnection&&this.unplugFromStack_(e)}unplugFromRow_(e){let t,n=null;null!=(t=this.outputConnection)&&t.isConnected()&&(n=this.outputConnection.targetConnection,this.outputConnection.disconnect()),n&&e&&(e=this.getOnlyValueConnection_())&&e.isConnected()&&!e.targetBlock().isShadow()&&(null==(e=e.targetConnection)||e.disconnect(),this.workspace.connectionChecker.canConnect(e,n,!1)?n.connect(e):null==e||e.onFailedConnect(n))}getOnlyValueConnection_(){let e=null;for(let t=0;t(e=e+("("===n||")"===t?"":" ")+t,n=t[t.length-1],e)),"")).trim()||"???",e&&t.length>e&&(t=t.substring(0,e-3)+"..."),t}toTokens(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"?";const t=[];for(const o of this.inputList)if(o.name!=Jd){for(const e of o.fieldRow)t.push(e.getText());if(o.connection){const r=o.connection.targetBlock();if(r){var n=o.connection;let i=n.getCheck();!i&&n.targetConnection&&(i=n.targetConnection.getCheck()),(n=!!i&&(-1!==i.indexOf("Boolean")||-1!==i.indexOf("Number")))&&t.push("("),t.push(...r.toTokens(e)),n&&t.push(")")}else t.push(e)}}return t}appendValueInput(e){return this.appendInput(new Ms.ValueInput$$module$build$src$core$inputs$value_input(e,this))}appendStatementInput(e){return this.statementInputCount++,this.appendInput(new Ud(e,this))}appendDummyInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.appendInput(new Bd(e,this))}appendEndRowInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.appendInput(new Fd(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=s(Us.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 n=0;e["args"+n];){if(void 0===e["message"+n])throw Error(t+"args".concat(n," must have a corresponding message (message").concat(n,")."));n++}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),n=0;void 0!==e["message"+n];)this.interpolate_(e["message"+n],e["args"+n]||[],e["implicitAlign"+n]||e["lastDummyAlign"+n],t),n++;if(void 0!==e.inputsInline&&(Ms.disable$$module$build$src$core$events$utils(),this.setInputsInline(e.inputsInline),Ms.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&&(n=Or(e.tooltip),this.setTooltip(n)),void 0!==e.enableContextMenu&&(this.contextMenu=!!e.enableContextMenu),void 0!==e.suppressPrefixSuffix&&(this.suppressPrefixSuffix=!!e.suppressPrefixSuffix),void 0!==e.helpUrl&&(n=Or(e.helpUrl),this.setHelpUrl(n)),"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&&Vr(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(t=0;ti||i>t)throw Error('Block "'+this.type+'": Message index %'+i+" out of range.");if(n[i])throw Error('Block "'+this.type+'": Message index %'+i+" duplicated.");n[i]=!0,o++}}if(o!==t)throw Error('Block "'+this.type+'": Message does not reference all '+t+" arg(s).")}interpolateArguments_(e,t,n){const o=[];for(let i=0;i=this.inputList.length)throw RangeError("Input index "+e+" out of bounds.");if(t>this.inputList.length)throw RangeError("Reference input "+t+" out of bounds.");const n=this.inputList[e];this.inputList.splice(e,1),ee.getWeight()-t.getWeight())),e}removeIcon(e){if(!this.hasIcon(e))return!1;let t;return 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 Jl?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,n){if(this.parentBlock_)throw Error("Block has parent");const o=new(B(Ms.MOVE$$module$build$src$core$events$utils))(this);n&&o.setReason(n),this.xy_.translate(e,t),o.recordNew(),A(o)}makeConnection_(e){return new Kd(this,e)}allInputsFilled(e){if(void 0===e&&(e=!0),!e&&this.isShadow())return!1;for(let n,o=0;n=this.inputList[o];o++)if(n.connection){var t=n.connection.targetBlock();if(!t||!t.allInputsFilled(e))return!1}return!(t=this.getNextBlock())||t.allInputsFilled(e)}toDevString(){let e=this.type?'"'+this.type+'" block':"Block";return this.id&&(e+=' (id="'+this.id+'")'),e}};yp.COLLAPSED_INPUT_NAME=Jd,yp.COLLAPSED_FIELD_NAME=qd;var Ep=class{constructor(){this.drawer=this.curNode=this.colour=null,this.type="marker"}setDrawer(e){this.drawer=e}getDrawer(){return this.drawer}getCurNode(){return this.curNode}setCurNode(e){const t=this.curNode;this.curNode=e,this.drawer&&this.drawer.draw(t,this.curNode)}draw(){this.drawer&&this.drawer.draw(this.curNode,this.curNode)}hide(){this.drawer&&this.drawer.hide()}dispose(){this.getDrawer()&&this.getDrawer().dispose()}},Ip=class extends Ep{constructor(){super(),this.type="cursor"}next(){var e=this.getCurNode();if(!e)return null;for(e=e.next();e&&e.next()&&(e.getType()===Gd.types.NEXT||e.getType()===Gd.types.BLOCK);)e=e.next();return e&&this.setCurNode(e),e}in(){var e=this.getCurNode();if(!e)return null;let t,n;return e.getType()!==Gd.types.PREVIOUS&&e.getType()!==Gd.types.OUTPUT||(e=e.next()),(e=null!=(n=null==(t=e)?void 0:t.in())?n:null)&&this.setCurNode(e),e}prev(){var e=this.getCurNode();if(!e)return null;for(e=e.prev();e&&e.prev()&&(e.getType()===Gd.types.NEXT||e.getType()===Gd.types.BLOCK);)e=e.prev();return e&&this.setCurNode(e),e}out(){var e=this.getCurNode();return e?((e=e.out())&&e.getType()===Gd.types.BLOCK&&(e=e.prev()||e),e&&this.setCurNode(e),e):null}};e(Us.CURSOR,Fs,Ip);var Sp=class extends Ip{constructor(){super()}next(){var e=this.getCurNode();return e?((e=this.getNextNode_(e,this.validNode_))&&this.setCurNode(e),e):null}in(){return this.next()}prev(){var e=this.getCurNode();return e?((e=this.getPreviousNode_(e,this.validNode_))&&this.setCurNode(e),e):null}out(){return this.prev()}getNextNode_(e,t){if(!e)return null;const n=e.in()||e.next();return t(n)?n:n?this.getNextNode_(n,t):t(e=this.findSiblingOrParent(e.out()))?e:e?this.getNextNode_(e,t):null}getPreviousNode_(e,t){if(!e)return null;let n=e.prev();return n=n?this.getRightMostChild(n):e.out(),t(n)?n:n?this.getPreviousNode_(n,t):null}validNode_(e){let t=!1;return(e=e&&e.getType())!==Gd.types.OUTPUT&&e!==Gd.types.INPUT&&e!==Gd.types.FIELD&&e!==Gd.types.NEXT&&e!==Gd.types.PREVIOUS&&e!==Gd.types.WORKSPACE||(t=!0),t}findSiblingOrParent(e){if(!e)return null;const t=e.next();return t||this.findSiblingOrParent(e.out())}getRightMostChild(e){if(!e.in())return e;for(e=e.in();e&&e.next();)e=e.next();return this.getRightMostChild(e)}};Sp.registrationName="basicCursor",e(Us.CURSOR,Sp.registrationName,Sp);var wp=class extends Sp{validNode_(e){let t=!1;const n=e&&e.getType();return e&&(e=e.getLocation(),n===Gd.types.FIELD&&e&&e.isTabNavigable()&&e.isClickable()&&(t=!0)),t}},Cp=10,kp=class extends Kd{constructor(e,t){super(e,t),this.highlighted=!1,this.targetConnection=null,this.db=e.workspace.connectionDBList[t],this.dbOpposite=e.workspace.connectionDBList[Yu[t]],this.offsetInBlock=new hl(0,0),this.trackedState=kp.TrackedState.WILL_TRACK}dispose(){let e,t;super.dispose(),this.trackedState===kp.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){const t=this.x-e.x;return e=this.y-e.y,Math.sqrt(t*t+e*e)}bumpAwayFrom(e){if(!this.sourceBlock_.workspace.isDragging()){var t=this.sourceBlock_.getRootBlock();if(!t.isInFlyout){var n=!1;if(!t.isMovable()){if(!(t=e.getSourceBlock().getRootBlock()).isMovable())return;e=this,n=!0}var o=m()==t;o||t.addSelect();var r=e.x+Ms.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*Cp)-this.x,i=e.y+Ms.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*Cp)-this.y;n&&(i=-i),t.RTL&&(r=e.x-Ms.config$$module$build$src$core$config.snapRadius-Math.floor(Math.random()*Cp)-this.x),t.moveBy(r,i,["bump"]),o||t.removeSelect()}}}moveTo(e,t){let n=!1;return this.trackedState===kp.TrackedState.WILL_TRACK?(this.db.addConnection(this,t),this.trackedState=kp.TrackedState.TRACKED,n=!0):this.trackedState===kp.TrackedState.TRACKED&&(this.db.removeConnection(this,this.y),this.db.addConnection(this,t),n=!0),this.x=e,this.y=t,n}moveBy(e,t){return this.moveTo(this.x+e,this.y+t)}moveToOffset(e){return this.moveTo(e.x+this.offsetInBlock.x,e.y+this.offsetInBlock.y)}setOffsetInBlock(e,t){this.offsetInBlock.x=e,this.offsetInBlock.y=t}getOffsetInBlock(){return this.offsetInBlock}tightenEfficiently(){var e=this.targetConnection;const t=this.targetBlock();e&&t&&(e=hl.difference(this.offsetInBlock,e.offsetInBlock),t.translate(e.x,e.y))}closest(e,t){return this.dbOpposite.searchForClosest(this,e,t)}highlight(){this.highlighted=!0,this.getSourceBlock().queueRender()}unhighlight(){this.highlighted=!1,this.getSourceBlock().queueRender()}isHighlighted(){return this.highlighted}setTracking(e){e&&this.trackedState===kp.TrackedState.TRACKED||!e&&this.trackedState===kp.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db.addConnection(this,this.y),this.trackedState=kp.TrackedState.TRACKED):(this.trackedState===kp.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),this.trackedState=kp.TrackedState.UNTRACKED))}stopTrackingAll(){if(this.setTracking(!1),this.targetConnection){const e=this.targetBlock().getDescendants(!1);for(let t=0;t0&&void 0!==arguments[0])||arguments[0];const{parentConnection:t,childConnection:n}=this.getParentAndChildConnections();if(t&&n){var o=t.getSourceBlock(),r=n.getSourceBlock();super.disconnectInternal(e),o.rendered&&o.queueRender(),r.rendered&&(r.updateDisabled(),r.queueRender(),r.getSvgRoot().style.display="block")}}respawnShadow_(){super.respawnShadow_();const e=this.targetBlock();e&&(e.initSvg(),e.queueRender())}neighbours(e){return this.dbOpposite.getNeighbours(this,e)}connect_(e){super.connect_(e);var t=this.getSourceBlock();e=e.getSourceBlock();const n=t.rendered,o=e.rendered;n&&t.updateDisabled(),o&&e.updateDisabled(),n&&o&&(this.type===zc.NEXT_STATEMENT||this.type===zc.PREVIOUS_STATEMENT?e.queueRender():t.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(),this.sourceBlock_.bumpNeighbours())}setCheck(e){return super.setCheck(e),this.sourceBlock_.rendered&&this.sourceBlock_.queueRender(),this}};!function(e){(e=e.TrackedState||(e.TrackedState={}))[e.WILL_TRACK=-1]="WILL_TRACK",e[e.UNTRACKED=0]="UNTRACKED",e[e.TRACKED=1]="TRACKED"}(kp||(kp={}));var $p=kp.TrackedState,Ap={};Ap.RenderedConnection=kp,Ap.TrackedState=$p;var Op=class extends yp{constructor(e,t,n){super(e,t,n),this.width=this.height=0,this.warningTextDb=new Map,this.warning=this.mutator=null,this.eventsInit_=this.renderIsInProgress_=this.visuallyDisabled=this.rendered=!1,this.translation="",this.bumpNeighboursPid=0,this.dragging=!1,this.relativeCoords=new hl(0,0),this.workspace=e,this.svgGroup_=oe(El.G,{}),this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup_,this.style),(e=this.pathObject.svgPath).tooltip=this,or(e),this.svgGroup_.setAttribute("data-id",this.id),this.doInit_()}initSvg(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(let t,n=0;t=this.inputList[n];n++)t.init();for(var e of this.getIcons())e.initView(this.createIconPointerDownListener(e)),e.updateEditable();this.applyColour(),this.pathObject.updateMovable(this.isMovable()),e=this.getSvgRoot(),this.workspace.options.readOnly||this.eventsInit_||!e||z(e,"pointerdown",this,this.onMouseDown_),this.eventsInit_=!0,e.parentNode||this.workspace.getCanvas().appendChild(e)}getColourSecondary(){return this.style.colourSecondary}getColourTertiary(){return this.style.colourTertiary}select(){if(this.isShadow()&&this.getParent())this.getParent().select();else if(m()!==this){var e=null;if(m()){e=m().id,Ms.disable$$module$build$src$core$events$utils();try{m().unselect()}finally{Ms.enable$$module$build$src$core$events$utils()}}e=new(B(ia))(e,this.id,this.workspace.id),A(e),b(this),this.addSelect()}}unselect(){if(m()===this){var e=new(B(ia))(this.id,null,this.workspace.id);e.workspaceId=this.workspace.id,A(e),b(null),this.removeSelect()}}setParent(e){const t=this.parentBlock_;if(e!==t){de(),super.setParent(e),pe();var n=this.getSvgRoot();if(!this.workspace.isClearing&&n){var o=this.getRelativeToSurfaceXY();e?e.getSvgRoot().appendChild(n):t&&((e=this.workspace.getCanvas().querySelector(".blocklyDragging"))?this.workspace.getCanvas().insertBefore(n,e):this.workspace.getCanvas().appendChild(n),this.translate(o.x,o.y)),this.applyColour()}}}getRelativeToSurfaceXY(){const e=this.workspace.getLayerManager();if(!e)throw Error("Cannot calculate position because the workspace has not been appended");let t=0,n=0,o=this.getSvgRoot();if(o)do{const e=ke(o);t+=e.x,n+=e.y,o=o.parentNode}while(o&&!e.hasLayer(o));return new hl(t,n)}moveBy(e,t,n){if(this.parentBlock_)throw Error("Block has parent");const o=N();let r=null;o&&(r=new(B(Ms.MOVE$$module$build$src$core$events$utils))(this),n&&r.setReason(n)),e=new hl(e,t),t=this.getRelativeToSurfaceXY(),e=hl.sum(t,e),this.translate(e.x,e.y),this.updateComponentLocations(e),o&&r&&(r.recordNew(),A(r)),this.workspace.resizeContents()}translate(e,t){this.translation="translate(".concat(e,", ").concat(t,")"),this.relativeCoords=new hl(e,t),this.getSvgRoot().setAttribute("transform",this.getTranslation())}getTranslation(){return this.translation}moveTo(e,t){const n=this.getRelativeToSurfaceXY();this.moveBy(e.x-n.x,e.y-n.y,t)}moveDuringDrag(e){this.translate(e.x,e.y),this.getSvgRoot().setAttribute("transform",this.getTranslation()),this.updateComponentLocations(e)}snapToGrid(){if(!(this.isDeadOrDying()||this.workspace.isDragging()||this.getParent()||this.isInFlyout)){var e=this.workspace.getGrid();if(e&&e.shouldSnap()){var t=e.getSpacing(),n=t/2,o=this.getRelativeToSurfaceXY();e=Math.round(Math.round((o.x-n)/t)*t+n-o.x),t=Math.round(Math.round((o.y-n)/t)*t+n-o.y),(e||t)&&this.moveBy(e,t,["snap"])}}}getBoundingRectangle(){const e=this.getRelativeToSurfaceXY(),t=this.getHeightWidth();let n,o;return this.RTL?(n=e.x-t.width,o=e.x):(n=e.x,o=e.x+t.width),new Il(e.y,e.y+t.height,n,o)}markDirty(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(let e,t=0;e=this.inputList[t];t++)e.markDirty()}setCollapsed(e){this.collapsed_!==e&&(super.setCollapsed(e),this.updateCollapsed_())}updateCollapsed_(){var e=this.isCollapsed();const t=Jd,n=qd;for(let r,i=0;r=this.inputList[i];i++)r.name!==t&&r.setVisible(!e);for(var o of this.getIcons())o.updateCollapsed();e?(e=this.toString(zu),(o=this.getField(n))?o.setValue(e):(this.getInput(t)||this.appendDummyInput(t)).appendField(new Dd(e),n)):(this.updateDisabled(),this.removeInput(t))}tab(e,t){const n=new wp;n.setCurNode(Gd.createFieldNode(e)),e=n.getCurNode(),t?n.next():n.prev(),(t=n.getCurNode())&&t!==e&&(t.getLocation().showEditor(),this.workspace.keyboardAccessibilityMode&&this.workspace.getCursor().setCurNode(t))}onMouseDown_(e){const t=this.workspace.getGesture(e);t&&t.handleBlockStart(e,this)}showHelp(){const e="function"===typeof this.helpUrl?this.helpUrl():this.helpUrl;e&&window.open(e)}generateContextMenu(){if(this.workspace.options.readOnly||!this.contextMenu)return null;const e=Tu.registry.getContextMenuOptions(Tu.ScopeType.BLOCK,{block:this});return this.customContextMenu&&this.customContextMenu(e),e}showContextMenu(e){const t=this.generateContextMenu();t&&t.length&&(eo(e,t,this.RTL),Qn(this))}updateComponentLocations(e){if(this.rendered){this.dragging||this.updateConnectionLocations(e),this.updateIconLocations(e),this.updateFieldLocations(e);for(const t of this.getChildren(!1))t.updateComponentLocations(hl.sum(e,t.relativeCoords))}}updateConnectionLocations(e){for(const t of this.getConnections_(!1))t.moveToOffset(e)}updateIconLocations(e){for(const t of this.getIcons())t.onLocationChange(e)}updateFieldLocations(e){for(const t of this.inputList)for(const n of t.fieldRow)n.onLocationChange(e)}setDragging(e){(this.dragging=e)?(this.translation="",Xs.push(...this.getConnections_(!0)),re(this.svgGroup_,"blocklyDragging")):(Xs.length=0,se(this.svgGroup_,"blocklyDragging"));for(let t=0;tclearTimeout(e))),this.warningTextDb.clear(),this.getIcons().forEach((e=>e.dispose())))}checkAndDelete(){this.workspace.isFlyout||(Ms.setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),Ms.setGroup$$module$build$src$core$events$utils(!1))}toCopyData(){return this.isInsertionMarker_?null:{paster:Kc.TYPE,blockState:sn(this,{addCoordinates:!0,addNextBlocks:!1}),typeCounts:y(this,!0)}}applyColour(){this.pathObject.applyColour(this);const e=this.getIcons();for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:"";if(t)this.warningTextDb.has(t)&&(clearTimeout(this.warningTextDb.get(t)),this.warningTextDb.delete(t));else{for(var n of this.warningTextDb.values())clearTimeout(n);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),n=this.getIcon(id.TYPE),e){let o=this.getSurroundParent(),r=null;for(;o;)o.isCollapsed()&&(r=o),o=o.getSurroundParent();r&&r.setWarningText(Ms.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,Op.COLLAPSED_WARNING_ID),n?n.addMessage(e,t):this.addIcon(new id(this).addMessage(e,t))}else n&&(t?(n.addMessage("",t),n.getText()||this.removeIcon(id.TYPE)):this.removeIcon(id.TYPE))}setMutator(e){this.removeIcon(Ms.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE),e&&this.addIcon(e)}addIcon(e){return super.addIcon(e),e instanceof id&&(this.warning=e),e instanceof Ms.MutatorIcon$$module$build$src$core$icons$mutator_icon&&(this.mutator=e),this.rendered&&(e.initView(this.createIconPointerDownListener(e)),e.applyColour(),e.updateEditable(),this.queueRender(),St(),this.bumpNeighbours()),e}createIconPointerDownListener(e){return t=>{this.isDeadOrDying()||(t=this.workspace.getGesture(t))&&t.setStartIcon(e)}}removeIcon(e){const t=super.removeIcon(e);return e.equals(id.TYPE)&&(this.warning=null),e.equals(Ms.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE)&&(this.mutator=null),this.rendered&&(this.queueRender(),St(),this.bumpNeighbours()),t}setEnabled(e){this.isEnabled()!==e&&(super.setEnabled(e),this.rendered&&!this.getInheritedDisabled()&&this.updateDisabled())}setHighlighted(e){this.rendered&&this.pathObject.updateHighlighted(e)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(e){this.pathObject.updateDraggingDelete(e)}getColour(){return this.style.colourPrimary}setColour(e){super.setColour(e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),this.pathObject.setStyle(e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()}setStyle(e){const t=this.workspace.getRenderer().getConstants().getBlockStyle(e);if(this.styleName_=e,!t)throw Error("Invalid style name: "+e);this.hat=t.hat,this.pathObject.setStyle(t),this.colour_=t.colourPrimary,this.style=t,this.applyColour()}bringToFront(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this;if(!t.isDeadOrDying())do{const n=t.getSvgRoot(),o=n.parentNode,r=o.childNodes;if(r[r.length-1]!==n&&o.appendChild(n),e)break;t=t.getParent()}while(t)}setPreviousStatement(e,t){super.setPreviousStatement(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setNextStatement(e,t){super.setNextStatement(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setOutput(e,t){super.setOutput(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setInputsInline(e){super.setInputsInline(e),this.rendered&&(this.queueRender(),this.bumpNeighbours())}removeInput(e,t){return e=super.removeInput(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours()),e}moveNumberedInputBefore(e,t){super.moveNumberedInputBefore(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}appendInput(e){return super.appendInput(e),this.rendered&&(this.queueRender(),this.bumpNeighbours()),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{const t=Ms.getGroup$$module$build$src$core$events$utils();Ms.setGroup$$module$build$src$core$events$utils(e),this.getRootBlock().bumpNeighboursInternal(),Ms.setGroup$$module$build$src$core$events$utils(t),this.bumpNeighboursPid=0}),Ms.config$$module$build$src$core$config.bumpDelay)}}bumpNeighboursInternal(){const e=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||e.isInFlyout))for(const t of this.getConnections_(!1)){if(t.isSuperior()){let e;null==(e=t.targetBlock())||e.bumpNeighboursInternal()}for(const n of t.neighbours(Ms.config$$module$build$src$core$config.snapRadius))n.getSourceBlock().getRootBlock()!==e&&(t.isConnected()&&n.isConnected()||(t.isSuperior()?n.bumpAwayFrom(t):t.bumpAwayFrom(n)))}}scheduleSnapAndBump(){const e=Ms.getGroup$$module$build$src$core$events$utils();setTimeout((()=>{Ms.setGroup$$module$build$src$core$events$utils(e),this.snapToGrid(),Ms.setGroup$$module$build$src$core$events$utils(!1)}),Ms.config$$module$build$src$core$config.bumpDelay/2),this.bumpNeighbours()}positionNearConnection(e,t,n){if(e.type===zc.NEXT_STATEMENT||e.type===zc.INPUT_VALUE){let o=t.x;t=t.y,o+=n.x-e.getOffsetInBlock().x,t+=n.y-e.getOffsetInBlock().y,this.moveBy(o,t)}}getChildren(e){return super.getChildren(e)}queueRender(){return Et(this)}render(){this.queueRender(),St()}renderEfficiently(){this.rendered=!0,de(),this.isCollapsed()&&this.updateCollapsed_(),this.isEnabled()||this.updateDisabled(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),pe(),this.updateMarkers_()}tightenChildrenEfficiently(){for(const e of this.inputList){const t=e.connection;t&&t.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}updateMarkers_(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw(),this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(vh.LOCAL_MARKER).draw();for(const e of this.inputList)for(const t of e.fieldRow)t.updateMarkers_()}setCursorSvg(e){this.pathObject.setCursorSvg(e)}setMarkerSvg(e){this.pathObject.setMarkerSvg(e)}getHeightWidth(){let e=this.height,t=this.width;var n=this.getNextBlock();if(n){n=n.getHeightWidth();const o=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;e+=n.height-o,t=Math.max(t,n.width)}return{height:e,width:t}}fadeForReplacement(e){this.pathObject.updateReplacementFade(e)}highlightShapeForInput(e,t){this.pathObject.updateShapeForInputHighlight(e,t)}};Op.INLINE=-1,Op.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var Rp,xp=class{constructor(){}onDragEnter(e){}onDragOver(e){}onDragExit(e){}onDrop(e){}getClientRect(){return null}shouldPreventMove(e){return!1}},Lp=class extends xp{constructor(){super(),this.wouldDelete_=!1}wouldDelete(e,t){return e instanceof Op?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e&&!t)):this.updateWouldDelete_(e.isDeletable()),this.wouldDelete_}updateWouldDelete_(e){this.wouldDelete_=e}},Np=class extends Lp{constructor(e){super(),this.workspace=e,this.id="trashcan",this.contents=[],this.flyout=null,this.isLidOpen=!1,this.minOpenness=0,this.lidTask=this.svgLid=this.svgGroup=null,this.top=this.left=this.lidOpen=0,this.initialized=!1,0>=this.workspace.options.maxTrashcanContents||(e=new Sh({scrollbars:!0,parentWorkspace:this.workspace,rtl:this.workspace.RTL,oneBasedIndex:this.workspace.options.oneBasedIndex,renderer:this.workspace.options.renderer,rendererOverrides:this.workspace.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace.horizontalLayout?(e.toolboxPosition=this.workspace.toolboxPosition===Fl.TOP?Fl.BOTTOM:Fl.TOP,this.flyout=new(c(Us.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===Fl.RIGHT?Fl.LEFT:Fl.RIGHT,this.flyout=new(c(Us.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){let e;this.svgGroup=oe(El.G,{class:"blocklyTrash"});const t=String(Math.random()).substring(2);e=oe(El.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),oe(El.RECT,{width:Mp,height:Dp,y:Pp},e);const n=oe(El.IMAGE,{width:Yl.width,x:-Hp,height:Yl.height,y:-Gp,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return n.setAttributeNS(bl,"xlink:href",this.workspace.options.pathToMedia+Yl.url),e=oe(El.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),oe(El.RECT,{width:Mp,height:Pp},e),this.svgLid=oe(El.IMAGE,{width:Yl.width,x:-Hp,height:Yl.height,y:-Gp,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(bl,"xlink:href",this.workspace.options.pathToMedia+Yl.url),X(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),X(this.svgGroup,"pointerup",this,this.click),X(n,"pointerover",this,this.mouseOver),X(n,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){0{let n,o;null==(n=this.flyout)||n.show(e),t.cursor="",null==(o=this.workspace.scrollbar)||o.setVisible(!1)}),10),this.fireUiEvent(!0)}}closeFlyout(){var e,t;this.contentsIsOpen()&&(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 n,o=Xe(this.workspace,e);e=ze(o,new Sl(Mp,Dp+Pp),Fp,Bp,e,this.workspace),t=Ye(e,Bp,o.vertical===Gl.TOP?Wl.DOWN:Wl.UP,t),this.top=t.top,this.left=t.left,null==(n=this.svgGroup)||n.setAttribute("transform","translate("+this.left+","+this.top+")")}}getBoundingRectangle(){return new Il(this.top,this.top+Dp+Pp,this.left,this.left+Mp)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();const t=e.top+Gp-Up;return e=e.left+Hp-Up,new Il(t,t+Pp+Dp+2*Up,e,e+Mp+2*Up)}onDragOver(e){this.setLidOpen(this.wouldDelete_)}onDragExit(e){this.setLidOpen(!1)}onDrop(e){setTimeout(this.setLidOpen.bind(this,!1),100)}setLidOpen(e){this.isLidOpen!==e&&(this.lidTask&&clearTimeout(this.lidTask),this.isLidOpen=e,this.animateLid())}animateLid(){const e=jp;var t=1/(e+1);this.lidOpen+=this.isLidOpen?t:-t,this.lidOpen=Math.min(Math.max(this.lidOpen,this.minOpenness),1),this.setLidAngle(this.lidOpen*Yp),t=zp+this.lidOpen*(Xp-zp),this.svgGroup&&(this.svgGroup.style.opacity="".concat(t)),this.lidOpen>this.minOpenness&&1>this.lidOpen&&(this.lidTask=setTimeout(this.animateLid.bind(this),Wp/e))}setLidAngle(e){const t=this.workspace.toolboxPosition===Fl.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;let n;null==(n=this.svgLid)||n.setAttribute("transform","rotate("+(t?-e:e)+","+(t?4:Mp-4)+","+(Pp-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*Yp)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&!this.workspace.isDragging()&&this.openFlyout()}fireUiEvent(e){e=new(B(ca))(e,this.workspace.id),A(e)}blockMouseDownWhenOpenable(e){!this.contentsIsOpen()&&this.hasContents()&&e.stopPropagation()}mouseOver(){this.hasContents()&&this.setLidOpen(!0)}mouseOut(){this.setLidOpen(!1)}onDelete(e){if(!(0>=this.workspace.options.maxTrashcanContents||e.type!==Ms.DELETE$$module$build$src$core$events$utils||e.type!==Ms.DELETE$$module$build$src$core$events$utils||e.wasShadow)){if(!e.oldJson)throw Error("Encountered a delete event without proper oldJson");if(e=JSON.stringify(this.cleanBlockJson(e.oldJson)),-1===this.contents.indexOf(e)){for(this.contents.unshift(e);this.contents.length>this.workspace.options.maxTrashcanContents;)this.contents.pop();this.setMinOpenness(Vp)}}}cleanBlockJson(e){function t(e){if(e){if(delete e.id,delete e.x,delete e.y,delete e.enabled,e.icons&&e.icons.comment){var n=e.icons.comment;delete n.height,delete n.width,delete n.pinned}for(var o in n=e.inputs){var r=n[o];const e=r.block;r=r.shadow,e&&t(e),r&&t(r)}e.next&&(e=(o=e.next).block,o=o.shadow,e&&t(e),o&&t(o))}}return t(e=JSON.parse(JSON.stringify(e))),Object.assign({},{kind:"BLOCK"},e)}},Mp=47,Dp=44,Pp=16,Bp=20,Fp=20,Up=10,Hp=0,Gp=32,Vp=.1,Wp=80,jp=4,zp=.4,Xp=.8,Yp=45,Kp=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 "'.concat(e.name,'" already exists.'));if(this.shortcuts.set(e.name,e),(t=e.keyCodes)&&0zi(e)))).length?e:null}load(e,t){const n=t.getProcedureMap();for(const o of e)n.add(Yi(this.procedureModelClass,this.parameterModelClass,o,t))}clear(e){e.getProcedureMap().clear()}},ef={};ef.ProcedureSerializer=Qp,ef.loadParameter=Ki,ef.loadProcedure=Yi,ef.saveParameter=Xi,ef.saveProcedure=zi;var tf=class{constructor(){this.priority=Nc}save(e){const t=[];for(const n of e.getAllVariables())e={name:n.name,id:n.getId()},n.type&&(e.type=n.type),t.push(e);return t.length?t:null}load(e,t){for(const n of e)t.createVariable(n.name,n.type,n.id)}clear(e){e.getVariableMap().clear()}};on("variables",new tf);var nf={};nf.VariableSerializer=tf;var of={};of.load=qi,of.save=Ji;var rf={blocks:Uc,exceptions:Lc,priorities:Pc,procedures:ef,registry:Bc,variables:nf,workspaces:of},sf=class{constructor(e,t,n,o,r){this.workspace=e,this.oldHostMetrics_=this.corner_=this.vScroll=this.hScroll=null,n=void 0===n||n;const i=(t=void 0===t||t)&&n;t&&(this.hScroll=new Ol(e,!0,i,o,r)),n&&(this.vScroll=new Ol(e,!1,i,o,r)),i&&(this.corner_=oe(El.RECT,{height:Ol.scrollbarThickness,width:Ol.scrollbarThickness,class:"blocklyScrollbarBackground"}),ce(this.corner_,e.getBubbleCanvas()))}dispose(){le(this.corner_),this.oldHostMetrics_=this.corner_=null,this.hScroll&&(this.hScroll.dispose(),this.hScroll=null),this.vScroll&&(this.vScroll.dispose(),this.vScroll=null)}resize(){const e=this.workspace.getMetrics();if(e){var t=!1,n=!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||(n=!0)):n=t=!0,t||n){try{Ms.disable$$module$build$src$core$events$utils(),this.hScroll&&t&&this.hScroll.resize(e),this.vScroll&&n&&this.vScroll.resize(e)}finally{Ms.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,n){this.hScroll&&this.hScroll.set(e,!1),this.vScroll&&this.vScroll.set(t,!1),(n||void 0===n)&&(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)}},af=class{constructor(e){this.workspace_=e}getDimensionsPx_(e){let t=0,n=0;return e&&(t=e.getWidth(),n=e.getHeight()),new Sl(t,n)}getFlyoutMetrics(e){return{width:(e=this.getDimensionsPx_(this.workspace_.getFlyout(e))).width,height:e.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){const e=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:e.width,height:e.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){let e=0,t=0;const n=this.getToolboxMetrics(),o=this.getFlyoutMetrics(),r=!!this.workspace_.getToolbox();var i;const s=!(null!=(i=this.workspace_.getFlyout())&&i.autoClose),a=(i=r?n.position:o.position)===Fl.TOP;return i===Fl.LEFT&&(r&&(e+=n.width),s&&(e+=o.width)),a&&(r&&(t+=n.height),s&&(t+=o.height)),{top:t,left:e}}getViewMetrics(e){e=e?this.workspace_.scale:1;const t=this.getSvgMetrics(),n=this.getToolboxMetrics(),o=this.getFlyoutMetrics(),r=!!this.workspace_.getToolbox();var i;const s=!(null!=(i=this.workspace_.getFlyout())&&i.autoClose),a=(i=r?n.position:o.position)===Fl.LEFT||i===Fl.RIGHT;return i!==Fl.TOP&&i!==Fl.BOTTOM||(r&&(t.height-=n.height),s&&(t.height-=o.height)),a&&(r&&(t.width-=n.width),s&&(t.width-=o.width)),{height:t.height/e,width:t.width/e,top:-this.workspace_.scrollY/e,left:-this.workspace_.scrollX/e}}getContentMetrics(e){e=e?1:this.workspace_.scale;const t=this.workspace_.getBlocksBoundingBox();return{height:(t.bottom-t.top)*e,width:(t.right-t.left)*e,top:t.top*e,left:t.left*e}}hasFixedEdges(){return!this.workspace_.isMovableHorizontally()||!this.workspace_.isMovableVertically()}getComputedFixedEdges_(e){if(!this.hasFixedEdges())return{};const t=this.workspace_.isMovableHorizontally(),n=this.workspace_.isMovableVertically();e=e||this.getViewMetrics(!1);const o={};return n||(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){const n=t.top+t.height,o=t.left+t.width,r=e.width,i=r/2,s=(e=e.height)/2;return{top:Math.min(t.top-s,n-e),bottom:Math.max(n+s,t.top+e),left:Math.min(t.left-i,o-r),right:Math.max(o+i,t.left+r)}}getScrollMetrics(e,t,n){e=e?this.workspace_.scale:1,t=t||this.getViewMetrics(!1);var o=n||this.getContentMetrics();n=this.getComputedFixedEdges_(t),t=this.getPaddedContent_(t,o),o=void 0!==n.top?n.top:t.top;const r=void 0!==n.left?n.left:t.left;return{top:o/e,left:r/e,width:((void 0!==n.right?n.right:t.right)-r)/e,height:((void 0!==n.bottom?n.bottom:t.bottom)-o)/e}}getUiMetrics(){return{viewMetrics:this.getViewMetrics(),absoluteMetrics:this.getAbsoluteMetrics(),toolboxMetrics:this.getToolboxMetrics()}}getMetrics(){const e=this.getToolboxMetrics(),t=this.getFlyoutMetrics(!0),n=this.getSvgMetrics(),o=this.getAbsoluteMetrics(),r=this.getViewMetrics(),i=this.getContentMetrics(),s=this.getScrollMetrics(!1,r,i);return{contentHeight:i.height,contentWidth:i.width,contentTop:i.top,contentLeft:i.left,scrollHeight:s.height,scrollWidth:s.width,scrollTop:s.top,scrollLeft:s.left,viewHeight:r.height,viewWidth:r.width,viewTop:r.top,viewLeft:r.left,absoluteTop:o.top,absoluteLeft:o.left,svgHeight:n.height,svgWidth:n.width,toolboxWidth:e.width,toolboxHeight:e.height,toolboxPosition:e.position,flyoutWidth:t.width,flyoutHeight:t.height}}};e(Us.METRICS_MANAGER,Fs,af);var lf=class extends $a{constructor(e){super(),this.isBlank=!0,this.recordUndo=!1,this.type=ba,this.isBlank=!!e,e&&(this.workspaceId=e.id)}};e(Us.EVENT,ba,lf);var cf=class extends Aa{constructor(e,t,n){super(e?e.workspace.id:void 0),this.type=ra,e&&(this.blockId=e.id,this.isStart=t,this.blocks=n)}toJson(){const 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,n){return(t=super.fromJson(e,t,null!=n?n:new cf)).isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};e(Us.EVENT,ra,cf);var uf={};uf.bumpIntoBounds=Zi,uf.bumpIntoBoundsHandler=Qi,uf.bumpTopObjectsIntoBounds=ts;var hf=class{constructor(e,t){this.connectionCandidate=this.dragTarget_=null,this.wouldDeleteBlock_=!1,this.dragIconData_=[],this.draggingBlock_=e,this.workspace_=t,this.connectionPreviewer=new(c(Us.CONNECTION_PREVIEWER,this.workspace_.options))(e),this.startXY_=this.draggingBlock_.getRelativeToSurfaceXY(),this.dragIconData_=ns(e,this.startXY_)}dispose(){this.dragIconData_.length=0,this.connectionPreviewer.dispose()}startDrag(e,t){let n;Ms.getGroup$$module$build$src$core$events$utils()||Ms.setGroup$$module$build$src$core$events$utils(!0),this.fireDragStartEvent_(),this.draggingBlock_.bringToFront(!0),de(),this.workspace_.setResizesEnabled(!1),Ho(),this.shouldDisconnect_(t)&&this.disconnectBlock_(t,e),this.draggingBlock_.setDragging(!0),null==(n=this.workspace_.getLayerManager())||n.moveToDragLayer(this.draggingBlock_)}shouldDisconnect_(e){return!!(this.draggingBlock_.getParent()||e&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock())}disconnectBlock_(e,t){this.draggingBlock_.unplug(e),e=this.pixelsToWorkspaceUnits_(t),e=hl.sum(this.startXY_,e),this.draggingBlock_.translate(e.x,e.y),Fo(this.draggingBlock_)}fireDragStartEvent_(){const e=new(B(ra))(this.draggingBlock_,!0,this.draggingBlock_.getDescendants(!1));A(e)}drag(e,t){const n=this.draggingBlock_;this.moveBlock(n,t),this.updateDragTargets(e,n),this.wouldDeleteBlock_=this.wouldDeleteBlock(e,n,t),this.updateCursorDuringBlockDrag_(),this.updateConnectionPreview(n,t)}moveBlock(e,t){t=this.pixelsToWorkspaceUnits_(t),t=hl.sum(this.startXY_,t),e.moveDuringDrag(t)}updateDragTargets(e,t){if(e=this.workspace_.getDragTarget(e),this.dragTarget_!==e){let n;null==(n=this.dragTarget_)||n.onDragExit(t),null==e||e.onDragEnter(t)}null==e||e.onDragOver(t),this.dragTarget_=e}wouldDeleteBlock(e,t,n){return!(!(e=this.workspace_.getDragTarget(e))||!this.workspace_.getComponentManager().hasCapability(e.id,al.Capability.DELETE_AREA))&&e.wouldDelete(t,!!this.getConnectionCandidate(t,n))}updateConnectionPreview(e,t){t=this.pixelsToWorkspaceUnits_(t);const n=this.connectionCandidate,o=this.getConnectionCandidate(e,t);if(o){this.connectionCandidate=t=n&&this.currCandidateIsBetter(n,t,o)?n:o;var{local:r,neighbour:i}=t;r.type!==zc.OUTPUT_VALUE&&r.type!==zc.PREVIOUS_STATEMENT||!i.isConnected()||i.targetBlock().isInsertionMarker()||this.orphanCanConnectAtEnd(e,i.targetBlock(),r.type)?this.connectionPreviewer.previewConnection(r,i):this.connectionPreviewer.previewReplacement(r,i,i.targetBlock())}else this.connectionPreviewer.hidePreview(),this.connectionCandidate=null}orphanCanConnectAtEnd(e,t,n){return!!Kd.getConnectionForOrphanedConnection(e,n===zc.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}currCandidateIsBetter(e,t,n){const{local:o,neighbour:r}=e;e=new hl(o.x,o.y);const i=new hl(r.x,r.y);return t=hl.distance(hl.sum(e,t),i),n.distance>t-Ms.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(e,t){e=this.getLocalConnections(e);let n=this.connectionCandidate?Ms.config$$module$build$src$core$config.connectingSnapRadius:Ms.config$$module$build$src$core$config.snapRadius,o=null;for(const r of e){const{connection:e,radius:i}=r.closest(n,t);e&&(o={local:r,neighbour:e,distance:i},n=i)}return o}getLocalConnections(e){const t=e.getConnections_(!1),n=e.lastConnectionInStack(!0);return n&&n!==e.nextConnection&&t.push(n),t}endDrag(e,t){if(this.drag(e,t),this.fireDragEndEvent_(),pe(),Ho(),this.connectionPreviewer.hidePreview(),e=null,this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBlock_)||(e=this.getNewLocationAfterDrag_(t).delta),this.dragTarget_&&this.dragTarget_.onDrop(this.draggingBlock_),!this.maybeDeleteBlock_()){let t;null==(t=this.workspace_.getLayerManager())||t.moveOffDragLayer(this.draggingBlock_,Vu),this.draggingBlock_.setDragging(!1),e?this.updateBlockAfterMove_():Zi(this.draggingBlock_.workspace,this.workspace_.getMetricsManager().getScrollMetrics(!0),this.draggingBlock_)}this.connectionPreviewer.dispose(),this.workspace_.setResizesEnabled(!0),Ms.setGroup$$module$build$src$core$events$utils(!1)}getNewLocationAfterDrag_(e){return{delta:e=this.pixelsToWorkspaceUnits_(e),newLocation:hl.sum(this.startXY_,e)}}maybeDeleteBlock_(){return!!this.wouldDeleteBlock_&&(this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0),Xs.length=0,!0)}updateBlockAfterMove_(){this.fireMoveEvent_(),this.connectionCandidate?this.applyConnections(this.connectionCandidate):this.draggingBlock_.queueRender(),this.draggingBlock_.scheduleSnapAndBump()}applyConnections(e){const{local:t,neighbour:n}=e;if(t.connect(n),this.draggingBlock_.rendered){const e=t.isSuperior()?n:t,o=this.draggingBlock_.getRootBlock();It().then((()=>{Bo(e.getSourceBlock()),setTimeout((()=>{o.bringToFront()}),0)}))}}fireDragEndEvent_(){const e=new(B(ra))(this.draggingBlock_,!1,this.draggingBlock_.getDescendants(!1));A(e)}updateToolboxStyle_(e){const t=this.workspace_.getToolbox();if(t){const n=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";e&&"function"===typeof t.removeStyle?t.removeStyle(n):e||"function"!==typeof t.addStyle||t.addStyle(n)}}fireMoveEvent_(){if(!this.draggingBlock_.isDeadOrDying()){var e=new(B(Ms.MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);e.setReason(["drag"]),e.oldCoordinate=this.startXY_,e.recordNew(),A(e)}}updateCursorDuringBlockDrag_(){this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_)}pixelsToWorkspaceUnits_(e){return e=new hl(e.x/this.workspace_.scale,e.y/this.workspace_.scale),this.workspace_.isMutator&&e.scale(1/this.workspace_.options.parentWorkspace.scale),e}dragIcons_(){ne("Blockly.BlockDragger.prototype.dragIcons_","v10","v11")}getInsertionMarkers(){return this.workspace_.getAllBlocks().filter((e=>e.isInsertionMarker()))}};e(Us.BLOCK_DRAGGER,Fs,hf);var df={};df.Bubble=Hh,df.MiniWorkspaceBubble=Wh,df.TextBubble=Zh,df.TextInputBubble=Qh;var pf=class extends Hc{constructor(e,t,n,o){super(e),this.type=Qs,this.recordUndo=!1,e&&(this.name=t,this.oldValue=n,this.newValue=o)}toJson(){const e=super.toJson();if(!this.name)throw Error("The changed field name is undefined. Either pass a name to the constructor, or call fromJson.");return e.name=this.name,e.oldValue=this.oldValue,e.newValue=this.newValue,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new pf)).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)}};e(Us.EVENT,Qs,pf);var ff=class extends Hc{constructor(e){super(e),this.type=Ms.MOVE$$module$build$src$core$events$utils,e&&(e.isShadow()&&(this.recordUndo=!1),e=this.currentLocation_(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)}toJson(){const e=super.toJson();return e.oldParentId=this.oldParentId,e.oldInputName=this.oldInputName,this.oldCoordinate&&(e.oldCoordinate="".concat(Math.round(this.oldCoordinate.x),", ")+"".concat(Math.round(this.oldCoordinate.y))),e.newParentId=this.newParentId,e.newInputName=this.newInputName,this.newCoordinate&&(e.newCoordinate="".concat(Math.round(this.newCoordinate.x),", ")+"".concat(Math.round(this.newCoordinate.y))),this.reason&&(e.reason=this.reason),this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new ff)).oldParentId=e.oldParentId,t.oldInputName=e.oldInputName,e.oldCoordinate&&(n=e.oldCoordinate.split(","),t.oldCoordinate=new hl(Number(n[0]),Number(n[1]))),t.newParentId=e.newParentId,t.newInputName=e.newInputName,e.newCoordinate&&(n=e.newCoordinate.split(","),t.newCoordinate=new hl(Number(n[0]),Number(n[1]))),void 0!==e.reason&&(t.reason=e.reason),void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}recordNew(){const e=this.currentLocation_();this.newParentId=e.parentId,this.newInputName=e.inputName,this.newCoordinate=e.coordinate}setReason(e){this.reason=e}currentLocation_(){var e=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var t=e.getBlockById(this.blockId);if(!t)throw Error("The block associated with the block move event could not be found");e={};const n=t.getParent();return n?(e.parentId=n.id,(t=n.getInputWithBlock(t))&&(e.inputName=t.name)):e.coordinate=t.getRelativeToSurfaceXY(),e}isNull(){return this.oldParentId===this.newParentId&&this.oldInputName===this.newInputName&&hl.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 n=t.getBlockById(this.blockId);if(n){var o=e?this.newParentId:this.oldParentId,r=e?this.newInputName:this.oldInputName;if(e=e?this.newCoordinate:this.oldCoordinate,o){var i=t.getBlockById(o);if(!i)return void console.warn("Can't connect to non-existent block: "+o)}if(n.getParent()&&n.unplug(),e)r=n.getRelativeToSurfaceXY(),n.moveBy(e.x-r.x,e.y-r.y,this.reason);else{let e,o;(!(t=n.outputConnection)||n.previousConnection&&n.previousConnection.isConnected())&&(t=n.previousConnection),n=null==(o=t)?void 0:o.type,r?(n=i.getInput(r))&&(e=n.connection):n===zc.PREVIOUS_STATEMENT&&(e=i.nextConnection),e&&t?t.connect(e):console.warn("Can't connect to non-existent input: "+r)}}else console.warn("Can't move non-existent block: "+this.blockId)}};e(Us.EVENT,Ms.MOVE$$module$build$src$core$events$utils,ff);var gf,mf=class extends Aa{constructor(e,t,n){super(e?e.workspace.id:void 0),this.type=la,e&&(this.blockId=e.id,this.isOpen=t,this.bubbleType=n)}toJson(){const 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,n){return(t=super.fromJson(e,t,null!=n?n:new mf)).isOpen=e.isOpen,t.bubbleType=e.bubbleType,t.blockId=e.blockId,t}};(function(e){e.MUTATOR="mutator",e.COMMENT="comment",e.WARNING="warning"})(gf||(gf={})),e(Us.EVENT,la,mf);var bf={};bf.BubbleOpen=mf,bf.BubbleType=gf;var _f=class extends $a{constructor(e){super(),this.isBlank=!e,e&&(this.commentId=e.id,this.workspaceId=e.workspace.id,this.group=Ms.getGroup$$module$build$src$core$events$utils(),this.recordUndo=$())}toJson(){const e=super.toJson();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");return e.commentId=this.commentId,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new _f)).commentId=e.commentId,t}static CommentCreateDeleteHelper(e,t){var n=e.getEventWorkspace_();if(t){if(t=Ms.createElement$$module$build$src$core$utils$xml("xml"),!e.xml)throw Error("Ecountered a comment event without proper xml");t.appendChild(e.xml),Ms.domToWorkspace$$module$build$src$core$xml(t,n)}else{if(!e.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(n=n.getCommentById(e.commentId))?n.dispose():console.warn("Can't uncreate non-existent comment: "+e.commentId)}}},Tf=class extends _f{constructor(e,t,n){super(e),this.type=ga,e&&(this.oldContents_="undefined"===typeof t?"":t,this.newContents_="undefined"===typeof n?"":n)}toJson(){const e=super.toJson();if(!this.oldContents_)throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newContents_)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");return e.oldContents=this.oldContents_,e.newContents=this.newContents_,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new Tf)).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 n=e?this.newContents_:this.oldContents_;if(!n){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.setContent(n)}else console.warn("Can't change non-existent comment: "+this.commentId)}};e(Us.EVENT,ga,Tf);var vf=class extends _f{constructor(e){super(e),this.type=pa,e&&(this.xml=e.toXmlWithXY())}toJson(){const e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");return e.xml=Bt(this.xml),e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new vf)).xml=Ms.textToDom$$module$build$src$core$utils$xml(e.xml),t}run(e){_f.CommentCreateDeleteHelper(this,e)}};e(Us.EVENT,pa,vf);var yf=class extends _f{constructor(e){super(e),this.type=fa,e&&(this.xml=e.toXmlWithXY())}run(e){_f.CommentCreateDeleteHelper(this,!e)}toJson(){const e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");return e.xml=Bt(this.xml),e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new yf)).xml=Ms.textToDom$$module$build$src$core$utils$xml(e.xml),t}};e(Us.EVENT,fa,yf);var Ef=class extends _f{constructor(e){super(e),this.type=ma,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()}setOldCoordinate(e){this.oldCoordinate_=e}toJson(){const e=super.toJson();if(!this.oldCoordinate_)throw Error("The old comment position is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newCoordinate_)throw Error("The new comment position is undefined. Either call recordNew, or call fromJson");return e.oldCoordinate="".concat(Math.round(this.oldCoordinate_.x),", ")+"".concat(Math.round(this.oldCoordinate_.y)),e.newCoordinate=Math.round(this.newCoordinate_.x)+","+Math.round(this.newCoordinate_.y),e}static fromJson(e,t,n){return t=super.fromJson(e,t,null!=n?n:new Ef),n=e.oldCoordinate.split(","),t.oldCoordinate_=new hl(Number(n[0]),Number(n[1])),n=e.newCoordinate.split(","),t.newCoordinate_=new hl(Number(n[0]),Number(n[1])),t}isNull(){return hl.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");var n=t.getRelativeToSurfaceXY();t.moveBy(e.x-n.x,e.y-n.y)}else console.warn("Can't move non-existent comment: "+this.commentId)}};e(Us.EVENT,ma,Ef);var If=class extends Aa{constructor(e,t,n){super(n),this.type=ua,this.oldItem=null!=e?e:void 0,this.newItem=null!=t?t:void 0}toJson(){const e=super.toJson();return e.oldItem=this.oldItem,e.newItem=this.newItem,e}static fromJson(e,t,n){return(t=super.fromJson(e,t,null!=n?n:new If)).oldItem=e.oldItem,t.newItem=e.newItem,t}};e(Us.EVENT,ua,If),Ms.CHANGE$$module$build$src$core$events$utils,Ms.CREATE$$module$build$src$core$events$utils,Ms.DELETE$$module$build$src$core$events$utils,Ms.MOVE$$module$build$src$core$events$utils,Ms.CHANGE$$module$build$src$core$events$utils,Ms.CREATE$$module$build$src$core$events$utils,Ms.DELETE$$module$build$src$core$events$utils,Ms.MOVE$$module$build$src$core$events$utils,Ms.disable$$module$build$src$core$events$utils,Ms.enable$$module$build$src$core$events$utils,Ms.getGroup$$module$build$src$core$events$utils,Ms.setGroup$$module$build$src$core$events$utils;var Sf={};Sf.Abstract=$a,Sf.BLOCK_CHANGE=Ms.CHANGE$$module$build$src$core$events$utils,Sf.BLOCK_CREATE=Ms.CREATE$$module$build$src$core$events$utils,Sf.BLOCK_DELETE=Ms.DELETE$$module$build$src$core$events$utils,Sf.BLOCK_DRAG=ra,Sf.BLOCK_FIELD_INTERMEDIATE_CHANGE=Qs,Sf.BLOCK_MOVE=Ms.MOVE$$module$build$src$core$events$utils,Sf.BUBBLE_OPEN=la,Sf.BUMP_EVENTS=_a,Sf.BlockBase=Hc,Sf.BlockChange=wh,Sf.BlockCreate=Gc,Sf.BlockDelete=vp,Sf.BlockDrag=cf,Sf.BlockFieldIntermediateChange=pf,Sf.BlockMove=ff,Sf.BubbleOpen=mf,Sf.BubbleType=gf,Sf.CHANGE=Ms.CHANGE$$module$build$src$core$events$utils,Sf.CLICK=sa,Sf.COMMENT_CHANGE=ga,Sf.COMMENT_CREATE=pa,Sf.COMMENT_DELETE=fa,Sf.COMMENT_MOVE=ma,Sf.CREATE=Ms.CREATE$$module$build$src$core$events$utils,Sf.Click=Oa,Sf.ClickTarget=Ca,Sf.CommentBase=_f,Sf.CommentChange=Tf,Sf.CommentCreate=vf,Sf.CommentDelete=yf,Sf.CommentMove=Ef,Sf.DELETE=Ms.DELETE$$module$build$src$core$events$utils,Sf.FINISHED_LOADING=ba,Sf.FinishedLoading=lf,Sf.MARKER_MOVE=aa,Sf.MOVE=Ms.MOVE$$module$build$src$core$events$utils,Sf.MarkerMove=Vd,Sf.SELECTED=ia,Sf.Selected=pc,Sf.THEME_CHANGE=ha,Sf.TOOLBOX_ITEM_SELECT=ua,Sf.TRASHCAN_OPEN=ca,Sf.ThemeChange=Wc,Sf.ToolboxItemSelect=If,Sf.TrashcanOpen=Tp,Sf.UI=oa,Sf.UiBase=Aa,Sf.VAR_CREATE=ea,Sf.VAR_DELETE=ta,Sf.VAR_RENAME=na,Sf.VIEWPORT_CHANGE=da,Sf.VarBase=ic,Sf.VarCreate=sc,Sf.VarDelete=cp,Sf.VarRename=up,Sf.ViewportChange=Xc,Sf.clearPendingUndo=L,Sf.disable=Ms.disable$$module$build$src$core$events$utils,Sf.disableOrphans=F,Sf.enable=Ms.enable$$module$build$src$core$events$utils,Sf.filter=x,Sf.fire=A,Sf.fromJson=P,Sf.get=B,Sf.getDescendantIds=D,Sf.getGroup=Ms.getGroup$$module$build$src$core$events$utils,Sf.getRecordUndo=$,Sf.isEnabled=N,Sf.setGroup=Ms.setGroup$$module$build$src$core$events$utils,Sf.setRecordUndo=k;var wf=class extends Ld{constructor(){super(),this.GRID_UNIT=4,this.CURSOR_COLOUR="#ffa200",this.CURSOR_RADIUS=5,this.JAGGED_TEETH_WIDTH=this.JAGGED_TEETH_HEIGHT=0,this.START_HAT_HEIGHT=22,this.START_HAT_WIDTH=96,this.SHAPES={HEXAGONAL:1,ROUND:2,SQUARE:3,PUZZLE:4,NOTCH:5},this.SHAPE_IN_SHAPE_PADDING={1:{0:5*this.GRID_UNIT,1:2*this.GRID_UNIT,2:5*this.GRID_UNIT,3:5*this.GRID_UNIT},2:{0:3*this.GRID_UNIT,1:3*this.GRID_UNIT,2:1*this.GRID_UNIT,3:2*this.GRID_UNIT},3:{0:2*this.GRID_UNIT,1:2*this.GRID_UNIT,2:2*this.GRID_UNIT,3:2*this.GRID_UNIT}},this.FULL_BLOCK_FIELDS=!0,this.FIELD_TEXT_FONTWEIGHT="bold",this.FIELD_TEXT_FONTFAMILY='"Helvetica Neue", "Segoe UI", Helvetica, sans-serif',this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0,this.SELECTED_GLOW_COLOUR="#fff200",this.SELECTED_GLOW_SIZE=.5,this.REPLACEMENT_GLOW_COLOUR="#fff200",this.REPLACEMENT_GLOW_SIZE=2,this.selectedGlowFilterId="",this.selectedGlowFilter=null,this.replacementGlowFilterId="",this.SQUARED=this.ROUNDED=this.HEXAGONAL=this.replacementGlowFilter=null,this.SMALL_PADDING=this.GRID_UNIT,this.MEDIUM_PADDING=2*this.GRID_UNIT,this.MEDIUM_LARGE_PADDING=3*this.GRID_UNIT,this.LARGE_PADDING=4*this.GRID_UNIT,this.CORNER_RADIUS=1*this.GRID_UNIT,this.NOTCH_WIDTH=9*this.GRID_UNIT,this.NOTCH_HEIGHT=2*this.GRID_UNIT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=3*this.GRID_UNIT,this.MIN_BLOCK_WIDTH=2*this.GRID_UNIT,this.MIN_BLOCK_HEIGHT=12*this.GRID_UNIT,this.EMPTY_STATEMENT_INPUT_HEIGHT=6*this.GRID_UNIT,this.TOP_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=6*this.GRID_UNIT,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT,this.STATEMENT_INPUT_SPACER_MIN_WIDTH=40*this.GRID_UNIT,this.STATEMENT_INPUT_PADDING_LEFT=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_PADDING=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_MIN_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=6*this.GRID_UNIT,this.CURSOR_WS_WIDTH=20*this.GRID_UNIT,this.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT,this.FIELD_BORDER_RECT_RADIUS=this.CORNER_RADIUS,this.FIELD_BORDER_RECT_X_PADDING=2*this.GRID_UNIT,this.FIELD_BORDER_RECT_Y_PADDING=1.625*this.GRID_UNIT,this.FIELD_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_COLOUR_DEFAULT_WIDTH=6*this.GRID_UNIT,this.FIELD_COLOUR_DEFAULT_HEIGHT=8*this.GRID_UNIT,this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT,this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT}setFontConstants_(e){super.setFontConstants_(e),this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING}init(){super.init(),this.HEXAGONAL=this.makeHexagonal(),this.ROUNDED=this.makeRounded(),this.SQUARED=this.makeSquared(),this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT+this.INSIDE_CORNERS.rightWidth}setDynamicProperties_(e){super.setDynamicProperties_(e),this.SELECTED_GLOW_COLOUR=e.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;const t=Number(e.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=t&&!isNaN(t)?t:this.SELECTED_GLOW_SIZE,this.REPLACEMENT_GLOW_COLOUR=e.getComponentStyle("replacementGlowColour")||this.REPLACEMENT_GLOW_COLOUR,this.REPLACEMENT_GLOW_SIZE=(e=Number(e.getComponentStyle("replacementGlowSize")))&&!isNaN(e)?e:this.REPLACEMENT_GLOW_SIZE}dispose(){super.dispose(),this.selectedGlowFilter&&le(this.selectedGlowFilter),this.replacementGlowFilter&&le(this.replacementGlowFilter)}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH;return{height:e,width:t,path:ni("c",[ti(25,-e),ti(71,-e),ti(t,0)])}}makeHexagonal(){function e(e,n,o){var r=e/2;return ii(-(o=o?-1:1)*(r=r>t?t:r),e=(n?-1:1)*e/2)+ii(o*r,e)}const 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){const r=e>n?e-n:0,i=o===t?"0":"1";return li("a","0 0,"+i,e=(e>n?n:e)/2,ti((o?1:-1)*e,(t?-1:1)*e))+ai("v",(t?-1:1)*r)+li("a","0 0,"+i,e,ti((o?-1:1)*e,(t?-1:1)*e))}const t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,n=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,n,o){e-=2*t;const r=o===n?"0":"1";return li("a","0 0,"+r,t,ti((o?1:-1)*t,(n?-1:1)*t))+ai("v",(n?-1:1)*e)+li("a","0 0,"+r,t,ti((o?-1:1)*t,(n?-1:1)*t))}const 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 zc.INPUT_VALUE:case zc.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}return t&&-1!==t.indexOf("Boolean")?this.HEXAGONAL:(t&&-1!==t.indexOf("Number")||t&&t.indexOf("String"),this.ROUNDED);case zc.PREVIOUS_STATEMENT:case zc.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(e){return ni("c",[ti(e*r/2,0),ti(e*r*3/4,s/2),ti(e*r,s)])+si([ti(e*r,i)])+ni("c",[ti(e*r/4,s/2),ti(e*r/2,s),ti(e*r,s)])+ai("h",e*o)+ni("c",[ti(e*r/2,0),ti(e*r*3/4,-s/2),ti(e*r,-s)])+si([ti(e*r,-i)])+ni("c",[ti(e*r/4,-s/2),ti(e*r/2,-s),ti(e*r,-s)])}const t=this.NOTCH_WIDTH,n=this.NOTCH_HEIGHT,o=t/3,r=o/3,i=n/2,s=i/2,a=e(1),l=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:n,pathLeft:a,pathRight:l}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=li("a","0 0,0",e,ti(-e,e)),n=li("a","0 0,1",e,ti(-e,e));return{width:e,height:e,pathTop:t,pathBottom:li("a","0 0,0",e,ti(e,e)),rightWidth:e,rightHeight:e,pathTopRight:n,pathBottomRight:li("a","0 0,1",e,ti(e,e))}}generateSecondaryColour_(e){return Cr("#000",e,.15)||e}generateTertiaryColour_(e){return Cr("#000",e,.25)||e}createDom(e,t,n){super.createDom(e,t,n),e=oe(El.DEFS,{},e),t=oe(El.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),oe(El.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),n=oe(El.FECOMPONENTTRANSFER,{result:"outBlur"},t),oe(El.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},n),oe(El.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),oe(El.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=oe(El.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),oe(El.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=oe(El.FECOMPONENTTRANSFER,{result:"outBlur"},e),oe(El.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),oe(El.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),oe(El.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),oe(El.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter=e}getCSS_(e){return["".concat(e," .blocklyText,"),"".concat(e," .blocklyFlyoutLabelText {"),"font: ".concat(this.FIELD_TEXT_FONTWEIGHT," ").concat(this.FIELD_TEXT_FONTSIZE)+"pt ".concat(this.FIELD_TEXT_FONTFAMILY,";"),"}","".concat(e," .blocklyText {"),"fill: #fff;","}","".concat(e," .blocklyNonEditableText>rect:not(.blocklyDropdownRect),"),"".concat(e," .blocklyEditableText>rect:not(.blocklyDropdownRect) {"),"fill: ".concat(this.FIELD_BORDER_RECT_COLOUR,";"),"}","".concat(e," .blocklyNonEditableText>text,"),"".concat(e," .blocklyEditableText>text,"),"".concat(e," .blocklyNonEditableText>g>text,"),"".concat(e," .blocklyEditableText>g>text {"),"fill: #575E75;","}","".concat(e," .blocklyFlyoutLabelText {"),"fill: #575E75;","}","".concat(e," .blocklyText.blocklyBubbleText {"),"fill: #575E75;","}","".concat(e," .blocklyDraggable:not(.blocklyDisabled)")," .blocklyEditableText:not(.editing):hover>rect,","".concat(e," .blocklyDraggable:not(.blocklyDisabled)")," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}","".concat(e," .blocklyHtmlInput {"),"font-family: ".concat(this.FIELD_TEXT_FONTFAMILY,";"),"font-weight: ".concat(this.FIELD_TEXT_FONTWEIGHT,";"),"color: #575E75;","}","".concat(e," .blocklyDropdownText {"),"fill: #fff !important;","}","".concat(e,".blocklyWidgetDiv .goog-menuitem,"),"".concat(e,".blocklyDropDownDiv .goog-menuitem {"),"font-family: ".concat(this.FIELD_TEXT_FONTFAMILY,";"),"}","".concat(e,".blocklyDropDownDiv .goog-menuitem-content {"),"color: #fff;","}","".concat(e," .blocklyHighlightedConnectionPath {"),"stroke: ".concat(this.SELECTED_GLOW_COLOUR,";"),"}","".concat(e," .blocklyDisabled > .blocklyOutlinePath {"),"fill: url(#blocklyDisabledPattern".concat(this.randomIdentifier,")"),"}","".concat(e," .blocklyInsertionMarker>.blocklyPath {"),"fill-opacity: ".concat(this.INSERTION_MARKER_OPACITY,";"),"stroke: none;","}"]}},Cf=class extends Md{constructor(e,t){super(e,t)}draw(){const 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(!(0>=e.height)){if(hd.isSpacer(e)){const o=e.precedesStatement;var t=e.followsStatement;if(o||t){const r=this.constants_.INSIDE_CORNERS;var n=r.rightHeight;return n=e.height-(o?n:0),t=t?r.pathBottomRight:"",e=0=n||0>=t)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new Sl(t,n+kf.Y_PADDING),this.imageHeight=n,"function"===typeof r&&(this.clickHandler=r),e!==Rh.SKIP_SETUP&&(s?this.configure_(s):(this.flipRtl=!!i,this.altText=Or(o)||""),this.setValue(Or(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=Or(e.alt))}initView(){this.imageElement=oe(El.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(bl,"xlink:href",this.value_),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(bl,"xlink:href",this.value_)}getFlipRtl(){return this.flipRtl}setAlt(e){e!==this.altText&&(this.altText=e||"",this.imageElement&&this.imageElement.setAttribute("alt",this.altText))}showEditor_(){this.clickHandler&&this.clickHandler(this)}setOnClickHandler(e){this.clickHandler=e}getText_(){return this.altText}static fromJson(e){if(!e.src||!e.width||!e.height)throw Error("src, width, and height values for an image field arerequired. The width and height must be non-zero.");return new this(e.src,e.width,e.height,void 0,void 0,void 0,e)}};kf.Y_PADDING=1,Mr("field_image",kf),kf.prototype.DEFAULT_VALUE="";var $f=class extends Rh{constructor(e,t,n){super(Rh.SKIP_SETUP),this.spellcheck_=!0,this.htmlInput_=null,this.isTextValid_=this.isBeingEdited_=!1,this.onKeyInputWrapper_=this.onKeyDownWrapper_=this.valueWhenEditorWasOpened_=null,this.fullBlockClickTarget_=!1,this.workspace_=null,this.SERIALIZABLE=!0,this.CURSOR="text",e!==Rh.SKIP_SETUP&&(n&&this.configure_(n),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 xh;super.initView(),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot())}isFullBlockField(){const e=this.getSourceBlock();if(!e)throw new xh;let t;return this.fullBlockClickTarget_=!(null==(t=this.getConstants())||!t.FULL_BLOCK_FIELDS)&&e.isSimpleReporter()}doValueInvalid_(e){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,e=this.value_,this.value_=this.htmlInput_.getAttribute("data-untyped-default-value"),this.sourceBlock_&&N()&&A(new(B(Ms.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock_,"field",this.name||null,e,this.value_)))}doValueUpdate_(e){this.isTextValid_=this.isDirty_=!0,this.value_=e}applyColour(){const e=this.getSourceBlock();if(!e)throw new xh;this.getConstants().FULL_BLOCK_FIELDS&&this.fieldGroup_&&(!this.isFullBlockField()&&this.borderRect_?(this.borderRect_.style.display="block",this.borderRect_.setAttribute("stroke",e.style.colourTertiary)):(this.borderRect_.style.display="none",e.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR)))}getSize(){let e;return null!=(e=this.getConstants())&&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_?(se(e,"blocklyInvalidInput"),Bn(e,nu.INVALID,!1)):(re(e,"blocklyInvalidInput"),Bn(e,nu.INVALID,!0))}if(!(e=this.getSourceBlock()))throw new xh;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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.workspace_=this.sourceBlock_.workspace,!t&&this.workspace_.options.modalInputs&&(el||Ja||qa)?this.showPromptEditor_():this.showInlineEditor_(t)}showPromptEditor_(){et(Ms.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){const t=this.getSourceBlock();if(!t)throw new xh;Gn(this,t.RTL,this.widgetDispose_.bind(this)),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 xh;Ms.setGroup$$module$build$src$core$events$utils(!0);const t=Fn();var n=this.getClickTarget_();if(!n)throw Error("A click target has not been set.");re(n,"editing"),(n=document.createElement("input")).className="blocklyHtmlInput",n.setAttribute("spellcheck",this.spellcheck_);const o=this.workspace_.getScale();var r=this.getConstants().FIELD_TEXT_FONTSIZE*o+"pt";return t.style.fontSize=r,n.style.fontSize=r,r=$f.BORDERRADIUS*o+"px",this.isFullBlockField()&&(r=((r=this.getScaledBBox()).bottom-r.top)/2+"px",e=e.getParent()?e.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary,n.style.border=1*o+"px solid "+e,t.style.borderRadius=r,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")),n.style.borderRadius=r,t.appendChild(n),n.value=n.defaultValue=this.getEditorText_(this.value_),n.setAttribute("data-untyped-default-value",String(this.value_)),this.resizeEditor_(),this.bindInputEvents_(n),n}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&N()&&null!==this.valueWhenEditorWasOpened_&&this.valueWhenEditorWasOpened_!==this.value_&&(A(new(B(Ms.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),Ms.setGroup$$module$build$src$core$events$utils(!1),this.unbindInputEvents_();var e=Fn().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.");se(e,"editing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper_=z(e,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper_=z(e,"input",this,this.onHtmlInputChange_)}unbindInputEvents_(){this.onKeyDownWrapper_&&(Y(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyInputWrapper_&&(Y(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}onHtmlInputKeyDown_(e){"Enter"===e.key?(Vn(),Lo()):"Escape"===e.key?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),Vn(),Lo()):"Tab"===e.key&&(Vn(),Lo(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())}onHtmlInputChange_(e){e=this.value_,this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&N()&&this.value_!==e&&A(new(B(Qs))(this.sourceBlock_,this.name||null,e,this.value_))}setEditorValue_(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.isDirty_=!0,this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(e)),this.setValue(e,t)}resizeEditor_(){var e=this.getSourceBlock();if(!e)throw new xh;const t=Fn(),n=this.getScaledBBox();t.style.width=n.right-n.left+"px",t.style.height=n.bottom-n.top+"px",e=new hl(e.RTL?n.right-t.offsetWidth:n.left,n.top),t.style.left=e.x+"px",t.style.top=e.y+"px"}repositionForWindowResize(){const e=this.getSourceBlock();return e instanceof Op&&(Zi(this.workspace_,this.workspace_.getMetricsManager().getViewMetrics(!0),e)||this.resizeEditor_(),!0)}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(e){return"".concat(e)}getValueFromEditorText_(e){return e}};$f.BORDERRADIUS=4;var Af=class extends $f{constructor(e,t,n){super(e,t,n)}doClassValidation_(e){return void 0===e?null:"".concat(e)}static fromJson(e){return new this(Or(e.text),void 0,e)}};Mr("field_input",Af),Af.prototype.DEFAULT_VALUE="";var Of=class extends fd{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){return!!e.outputConnection}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},Rf=class extends Id{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)}}},xf=class extends dd{constructor(e){super(e),this.width=this.height=0,this.type|=hd.getType("RIGHT_CONNECTION")}},Lf=class extends xd{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){const 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}},Nf=class extends Hd{constructor(e,t){super(e,t),this.isInline=!0,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.topRow=new Lf(this.constants_),this.bottomRow=new Of(this.constants_),this.isMultiRow=!t.getInputsInline()||t.isCollapsed(),this.hasStatementInput=0=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!o.precedesStatement,hd.isInputRow(i)&&i.hasStatement){let n,o;i.measure(),t=i.width-(null!=(o=null==(n=i.getLastInput())?void 0:n.width)?o:0)+e}else if(n&&(2===r||o)&&hd.isInputRow(i)&&!i.hasStatement){o=i.xPos,n=null;for(let e=0;en?n:this.height/2)*(1-Math.sin(Math.acos((n-this.constants_.SMALL_PADDING)/n)))):0;if(hd.isInlineInput(e)&&e instanceof md){const r=e.connectedBlock;return null==(e=r?r.pathObject.outputShapeType:e.shape.type)||r&&r.outputConnection&&(r.statementInputCount||r.nextConnection)||n===o.SHAPES.HEXAGONAL&&n!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[n][e]}return hd.isField(e)&&e instanceof _d?n===o.SHAPES.ROUND&&e.field instanceof Af?t-2.75*o.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[n][0]:hd.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let o=2;o=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!s.precedesStatement;if(e?this.topRow.hasPreviousConnection:r.followsStatement){var n=i.elements[1];if(n=3===i.elements.length&&n instanceof _d&&(n.field instanceof Dd||n.field instanceof kf),!e&&n)r.height-=this.constants_.SMALL_PADDING,s.height-=this.constants_.SMALL_PADDING,i.height-=this.constants_.MEDIUM_PADDING;else if(e||t){if(t){for(e=!1,t=0;tn;n+=15)oe(El.LINE,{x1:Hf.HALF+Hf.RADIUS,y1:Hf.HALF,x2:Hf.HALF+Hf.RADIUS-(0===n%45?10:5),y2:Hf.HALF,class:"blocklyAngleMarks",transform:"rotate("+n+","+Hf.HALF+","+Hf.HALF+")"},e);return this.boundEvents.push(z(e,"click",this,this.hide)),this.boundEvents.push(z(t,"pointerdown",this,this.onMouseMove_,!0)),this.boundEvents.push(z(t,"pointermove",this,this.onMouseMove_,!0)),e}dropdownDispose(){for(const e of this.boundEvents)Y(e);this.boundEvents.length=0,this.line=this.gauge=null}hide(){Ro(this),Vn()}onMouseMove_(e){var t=this.gauge.ownerSVGElement.getBoundingClientRect();const n=e.clientX-t.left-Hf.HALF;e=e.clientY-t.top-Hf.HALF,t=Math.atan(-e/n),isNaN(t)||(t=ho(t),0>n?t+=180:0(e%=360)&&(e+=360),e>this.wrap&&(e-=360),e}static fromJson(e){return new this(e.angle,void 0,e)}};Hf.HALF=50,Hf.RADIUS=Hf.HALF-1,Hf.CLOCKWISE=!1,Hf.OFFSET=0,Hf.WRAP=360,Hf.ROUND=15,Mr("field_angle",Hf),Hf.prototype.DEFAULT_VALUE=0,ee("\n.blocklyAngleCircle {\n stroke: #444;\n stroke-width: 1;\n fill: #ddd;\n fill-opacity: 0.8;\n}\n\n.blocklyAngleMarks {\n stroke: #444;\n stroke-width: 1;\n}\n\n.blocklyAngleGauge {\n fill: #f88;\n fill-opacity: 0.8;\n pointer-events: none;\n}\n\n.blocklyAngleLine {\n stroke: #f00;\n stroke-width: 2;\n stroke-linecap: round;\n pointer-events: none;\n}\n"),function(e){e.COMPASS="compass",e.PROTRACTOR="protractor"}(Uf||(Uf={}));var Gf={};Gf.FieldAngle=Hf,Gf.Mode=Uf;var Vf=class extends Rh{constructor(e,t,n){super(Rh.SKIP_SETUP),this.SERIALIZABLE=!0,this.CURSOR="default",this.value_=this.value_,this.checkChar=Vf.CHECK_CHAR,e!==Rh.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.checkCharacter&&(this.checkChar=e.checkCharacter)}saveState(){const e=this.saveLegacyState(Vf);return null!==e?e:this.getValueBoolean()}initView(){super.initView();const e=this.getTextElement();re(e,"blocklyCheckbox"),e.style.display=this.value_?"block":"none"}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)}getDisplayText_(){return this.checkChar}setCheckCharacter(e){this.checkChar=e||Vf.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)}};Vf.CHECK_CHAR="\u2713",Mr("field_checkbox",Vf),Vf.prototype.DEFAULT_VALUE=!1;var Wf=class extends Rh{constructor(e,t,n){super(Rh.SKIP_SETUP),this.highlightedIndex=this.picker=null,this.boundEvents=[],this.SERIALIZABLE=!0,this.CURSOR="default",this.isDirty_=!1,this.titles=this.colours=null,this.columns=0,e!==Rh.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.colourOptions&&(this.colours=e.colourOptions),e.colourTitles&&(this.titles=e.colourTitles),e.columns&&(this.columns=e.columns)}initView(){this.size_=new Sl(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT),this.createBorderRect_(),this.getBorderRect().style.fillOpacity="1",this.getBorderRect().setAttribute("stroke","#fff"),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot())}isFullBlockField(){const e=this.getSourceBlock();if(!e)throw new xh;const t=this.getConstants();return e.isSimpleReporter()&&!(null==t||!t.FIELD_COLOUR_FULL_BLOCK)}applyColour(){const e=this.getSourceBlock();if(!e)throw new xh;if(this.fieldGroup_){var t=this.borderRect_;if(!t)throw Error("The border rect has not been initialized");this.isFullBlockField()?(t.style.display="none",e.pathObject.svgPath.setAttribute("fill",this.getValue()),e.pathObject.svgPath.setAttribute("stroke","#fff")):(t.style.display="block",t.style.fill=this.getValue())}}getSize(){let e;return null!=(e=this.getConstants())&&e.FIELD_COLOUR_FULL_BLOCK&&(this.render_(),this.isDirty_=!1),super.getSize()}render_(){super.render_();const e=this.getSourceBlock();if(!e)throw new xh;e.applyColour()}updateSize_(e){var t=this.getConstants();this.isFullBlockField()?(e=2*(null!=e?e:0),t=t.FIELD_TEXT_HEIGHT):(e=t.FIELD_COLOUR_DEFAULT_WIDTH,t=t.FIELD_COLOUR_DEFAULT_HEIGHT),this.size_.height=t,this.size_.width=e,this.positionBorderRect_()}doClassValidation_(e){return"string"!==typeof e?null:Er(e)}getText(){let e=this.value_;return/^#(.)\1(.)\2(.)\3$/.test(e)&&(e="#"+e[1]+e[3]+e[5]),e}setColours(e,t){return this.colours=e,t&&(this.titles=t),this}setColumns(e){return this.columns=e,this}showEditor_(){this.dropdownCreate(),bo().appendChild(this.picker),yo(this,this.dropdownDispose.bind(this)),this.picker.focus({preventScroll:!0})}onClick(e){null!==(e=(e=e.target)&&e.getAttribute("data-colour"))&&(this.setValue(e),Ro(this))}onKeyDown(e){let t=!0;var n;switch(e.key){case"ArrowUp":this.moveHighlightBy(0,-1);break;case"ArrowDown":this.moveHighlightBy(0,1);break;case"ArrowLeft":this.moveHighlightBy(-1,0);break;case"ArrowRight":this.moveHighlightBy(1,0);break;case"Enter":(n=this.getHighlighted())&&null!==(n=n.getAttribute("data-colour"))&&this.setValue(n),Lo();break;default:t=!1}t&&e.stopPropagation()}moveHighlightBy(e,t){if(this.highlightedIndex){var n=this.colours||Wf.COLOURS,o=this.columns||Wf.COLUMNS,r=this.highlightedIndex%o,i=Math.floor(this.highlightedIndex/o);r+=e,i+=t,0>e?0>r&&0r&&(r=0):0o-1&&io-1&&r--:0>t?0>i&&(i=0):0Math.floor(n.length/o)-1&&(i=Math.floor(n.length/o)-1),this.setHighlightedCell(this.picker.childNodes[i].childNodes[r],i*o+r)}}onMouseMove(e){const t=(e=e.target)&&Number(e.getAttribute("data-index"));null!==t&&t!==this.highlightedIndex&&this.setHighlightedCell(e,t)}onMouseEnter(){let e;null==(e=this.picker)||e.focus({preventScroll:!0})}onMouseLeave(){var e;null==(e=this.picker)||e.blur(),(e=this.getHighlighted())&&se(e,"blocklyColourHighlighted")}getHighlighted(){if(!this.highlightedIndex)return null;const e=this.columns||Wf.COLUMNS,t=this.picker.childNodes[Math.floor(this.highlightedIndex/e)];return t?t.childNodes[this.highlightedIndex%e]:null}setHighlightedCell(e,t){const n=this.getHighlighted();n&&se(n,"blocklyColourHighlighted"),re(e,"blocklyColourHighlighted"),this.highlightedIndex=t,(e=e.getAttribute("id"))&&this.picker&&Bn(this.picker,nu.ACTIVEDESCENDANT,e)}dropdownCreate(){const e=this.columns||Wf.COLUMNS,t=this.colours||Wf.COLOURS,n=this.titles||Wf.TITLES,o=this.getValue(),r=document.createElement("table");let i;r.className="blocklyColourTable",r.tabIndex=0,r.dir="ltr",Pn(r,tu.GRID),Bn(r,nu.EXPANDED,!0),Bn(r,nu.ROWCOUNT,Math.floor(t.length/e)),Bn(r,nu.COLCOUNT,e);for(let s=0;str>td {\n border: 0.5px solid #888;\n box-sizing: border-box;\n cursor: pointer;\n display: inline-block;\n height: 20px;\n padding: 0;\n width: 20px;\n}\n\n.blocklyColourTable>tr>td.blocklyColourHighlighted {\n border-color: #eee;\n box-shadow: 2px 2px 7px 2px rgba(0, 0, 0, 0.3);\n position: relative;\n}\n\n.blocklyColourSelected, .blocklyColourSelected:hover {\n border-color: #eee !important;\n outline: 1px solid #333;\n position: relative;\n}\n");var jf=class extends Dd{constructor(e,t,n){super(String(null!=e?e:""),t,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(Or(e.text),void 0,e)}};Mr("field_label_serializable",jf);var zf=class extends Af{constructor(e,t,n){super(Rh.SKIP_SETUP),this.textGroup=null,this.maxLines_=1/0,this.isOverflowedY_=!1,e!==Rh.SKIP_SETUP&&(n&&this.configure_(n),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.maxLines&&this.setMaxLines(e.maxLines)}toXml(e){return e.textContent=this.getValue().replace(/\n/g," "),e}fromXml(e){this.setValue(e.textContent.replace(/ /g,"\n"))}saveState(){const e=this.saveLegacyState(zf);return null!==e?e:this.getValue()}loadState(e){this.loadLegacyState(Rh,e)||this.setValue(e)}initView(){this.createBorderRect_(),this.textGroup=oe(El.G,{class:"blocklyEditableText"},this.fieldGroup_)}getDisplayText_(){const e=this.getSourceBlock();if(!e)throw new xh;let t=this.getText();if(!t)return Rh.NBSP;const n=t.split("\n");t="";const o=this.isOverflowedY_?this.maxLines_:n.length;for(let r=0;rthis.maxDisplayLength?e=e.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&r===o-1&&(e=e.substring(0,e.length-3)+"..."),e=e.replace(/\s/g,Rh.NBSP),t+=e,r!==o-1&&(t+="\n")}return e.RTL&&(t+="\u200f"),t}doValueUpdate_(e){super.doValueUpdate_(e),null!==this.value_&&(this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_)}render_(){var e=this.getSourceBlock();if(!e)throw new xh;for(var t,n=this.textGroup;t=n.firstChild;)n.removeChild(t);t=this.getDisplayText_().split("\n");let o=0;for(let r=0;rr&&(r=a),i+=this.getConstants().FIELD_TEXT_HEIGHT+(0this.maxDisplayLength&&(e[a]=e[a].substring(0,this.maxDisplayLength)),s.textContent=e[a];const i=ge(s,t,n,o);i>r&&(r=i)}r+=this.htmlInput_.offsetWidth-this.htmlInput_.clientWidth}this.borderRect_&&(i+=2*this.getConstants().FIELD_BORDER_RECT_Y_PADDING,r+=2*this.getConstants().FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width","".concat(r)),this.borderRect_.setAttribute("height","".concat(i))),this.size_.width=r,this.size_.height=i,this.positionBorderRect_()}showEditor_(e,t){super.showEditor_(e,t),this.forceRerender()}widgetCreate_(){const e=Fn(),t=this.workspace_.getScale(),n=document.createElement("textarea");n.className="blocklyHtmlInput blocklyHtmlTextAreaInput",n.setAttribute("spellcheck",String(this.spellcheck_));var o=this.getConstants().FIELD_TEXT_FONTSIZE*t+"pt";e.style.fontSize=o,n.style.fontSize=o,n.style.borderRadius=Af.BORDERRADIUS*t+"px",o=this.getConstants().FIELD_BORDER_RECT_X_PADDING*t;const r=this.getConstants().FIELD_BORDER_RECT_Y_PADDING*t/2;return n.style.padding=r+"px "+o+"px "+r+"px "+o+"px",o=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,n.style.lineHeight=o*t+"px",e.appendChild(n),n.value=n.defaultValue=this.getEditorText_(this.value_),n.setAttribute("data-untyped-default-value",String(this.value_)),n.setAttribute("data-old-value",""),Ka?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(n),n}setMaxLines(e){"number"===typeof e&&0this.max_&&(e.max="".concat(this.max_),Bn(e,nu.VALUEMAX,this.max_)),e}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};Mr("field_number",Xf),Xf.prototype.DEFAULT_VALUE=0;var Yf=class extends Bh{constructor(e,t,n,o,r){super(Rh.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=Yf.dropdownCreate,this.defaultVariableName="string"===typeof e?e:"",this.size_=new Sl(0,0),e!==Rh.SKIP_SETUP&&(r?this.configure_(r):this.setTypes(n,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 xh;this.variable||(e=Ms.getOrCreateVariablePackage$$module$build$src$core$variables(e.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(e.getId()))}shouldAddBorderRect_(){const e=this.getSourceBlock();if(!e)throw new xh;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 xh;const n=e.getAttribute("id"),o=e.textContent,r=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=Ms.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,n,o,r),null!==r&&r!==t.type)throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.type+", and does not match variable field that references it: "+Bt(e)+".");this.setValue(t.getId())}toXml(e){return this.initModel(),e.id=this.variable.getId(),e.textContent=this.variable.name,this.variable.type&&e.setAttribute("variabletype",this.variable.type),e}saveState(e){var t=this.saveLegacyState(Yf);return null!==t||(this.initModel(),t={id:this.variable.getId()},e&&(t.name=this.variable.name,t.type=this.variable.type)),t}loadState(e){const t=this.getSourceBlock();if(!t)throw new xh;this.loadLegacyState(Yf,e)||(e=Ms.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,e.id||null,e.name,e.type||""),this.setValue(e.getId()))}setSourceBlock(e){if(e.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(e)}getValue(){return this.variable?this.variable.getId():null}getText(){return this.variable?this.variable.name:""}getVariable(){return this.variable}getValidator(){return this.variable?this.validator_:null}doClassValidation_(e){if(null===e)return null;var t=this.getSourceBlock();if(!t)throw new xh;return(t=Ms.getVariable$$module$build$src$core$variables(t.workspace,e))?(t=t.type,this.typeIsAllowed(t)?e:(console.warn("Variable type doesn't match this field! Type was "+t),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+e),null)}doValueUpdate_(e){const t=this.getSourceBlock();if(!t)throw new xh;this.variable=Ms.getVariable$$module$build$src$core$variables(t.workspace,e),super.doValueUpdate_(e)}typeIsAllowed(e){const t=this.getVariableTypes();if(!t)return!0;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(Array.isArray(e)){let n=!1;for(let o=0;o{this.targetWorkspace.isDragging()||t.addSelect()}))),this.listeners.push(X(e,"pointerleave",t,(()=>{this.targetWorkspace.isDragging()||t.removeSelect()}))),this.listeners.push(X(n,"pointerenter",t,(()=>{this.targetWorkspace.isDragging()||t.addSelect()}))),this.listeners.push(X(n,"pointerleave",t,(()=>{this.targetWorkspace.isDragging()||t.removeSelect()})))}blockMouseDown(e){return t=>{const n=this.targetWorkspace.getGesture(t);n&&(n.setStartBlock(e),n.handleFlyoutStart(t,this))}}onMouseDown(e){const t=this.targetWorkspace.getGesture(e);t&&t.handleFlyoutStart(e,this)}isBlockCreatable(e){return e.isEnabled()}createBlock(e){let t=null;Ms.disable$$module$build$src$core$events$utils();var n=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{t=this.placeNewBlock(e)}finally{Ms.enable$$module$build$src$core$events$utils()}if(this.targetWorkspace.hideChaff(),e=Tt(this.targetWorkspace,n),N()){for(Ms.setGroup$$module$build$src$core$events$utils(!0),n=0;n90-t||e>-90-t&&e<-90+t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.top;return this.toolboxPosition_===Fl.TOP?new Il(-1e9,t+e.height,-1e9,1e9):new Il(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;const t=this.workspace_.getTopBlocks(!1);for(let o,r=0;o=t[r];r++)e=Math.max(e,o.getHeightWidth().height);const n=this.buttons_;for(let o,r=0;o=n[r];r++)e=Math.max(e,o.height);if(e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=Ol.scrollbarThickness,this.height_!==e){for(let e,n=0;e=t[n];n++)this.rectMap_.has(e)&&this.moveRectToBlock_(this.rectMap_.get(e),e);this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==Fl.TOP||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};e(Us.FLYOUTS_HORIZONTAL_TOOLBOX,Fs,Qf);var eg=class extends Zf{constructor(e){super(e)}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),n=t.getScrollMetrics(),o=t.getViewMetrics();t=t.getAbsoluteMetrics(),"number"===typeof e.y&&(this.workspace_.scrollY=-(n.top+(n.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();const t=e.getAbsoluteMetrics(),n=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===Fl.LEFT?e.width:n.width-this.width_:this.toolboxPosition_===Fl.LEFT?0:n.width:this.toolboxPosition_===Fl.LEFT?0:n.width+t.left-this.width_}getY(){return 0}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=e.height,this.setBackgroundPath(this.width_-this.CORNER_RADIUS,e.height-2*this.CORNER_RADIUS),e=this.getX();var t=this.getY();this.positionAt_(this.width_,this.height_,e,t)}}setBackgroundPath(e,t){const n=this.toolboxPosition_===Fl.RIGHT;var o=e+this.CORNER_RADIUS;(o=["M "+(n?o:0)+",0"]).push("h",n?-e:e),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,n?0:1,n?-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,n?0:1,n?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("h",n?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=Z(e);if(t.y){const e=this.workspace_.getMetricsManager(),n=e.getScrollMetrics();let o;t=e.getViewMetrics().top-n.top+t.y,null==(o=this.workspace_.scrollbar)||o.setY(t),Vn(),Lo()}e.preventDefault(),e.stopPropagation()}layout_(e,t){this.workspace_.scale=this.targetWorkspace.scale;var n=this.MARGIN;const o=this.RTL?n:n+this.tabWidth_;for(let a,l=0;a=e[l];l++)if("block"===a.type){var r=a.block,i=r.getDescendants(!1);for(let t,n=0;t=i[n];n++)t.isInFlyout=!0;i=r.getSvgRoot();const e=r.getHeightWidth();var s=r.outputConnection?o-this.tabWidth_:o;r.moveBy(s,n),s=this.createRect_(r,this.RTL?s-e.width:s,n,e,l),this.addBlockListeners_(i,r,s),n+=e.height+t[l]}else"button"===a.type&&(r=a.button,this.initFlyoutButton_(r,o,n),n+=r.height+t[l])}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;const t=this.dragAngleRange_;return e-t||e<-180+t||e>180-t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.left;return this.toolboxPosition_===Fl.LEFT?new Il(-1e9,1e9,-1e9,t+e.width):new Il(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;var t=this.workspace_.getTopBlocks(!1);for(let o,r=0;o=t[r];r++){var n=o.getHeightWidth().width;o.outputConnection&&(n-=this.tabWidth_),e=Math.max(e,n)}for(let o,r=0;o=this.buttons_[r];r++)e=Math.max(e,o.width);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=Ol.scrollbarThickness,this.width_!==e){for(let o,r=0;o=t[r];r++){if(this.RTL){n=o.getRelativeToSurfaceXY().x;let t=e/this.workspace_.scale-this.MARGIN;o.outputConnection||(t-=this.tabWidth_),o.moveBy(t-n,0)}this.rectMap_.has(o)&&this.moveRectToBlock_(this.rectMap_.get(o),o)}if(this.RTL)for(let n,o=0;n=this.buttons_[o];o++)t=n.getPosition().y,n.moveTo(e/this.workspace_.scale-n.width-this.MARGIN-this.tabWidth_,t);this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==Fl.LEFT||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};eg.registryName="verticalFlyout",e(Us.FLYOUTS_VERTICAL_TOOLBOX,Fs,eg),Ms.CodeGenerator$$module$build$src$core$generator=class{constructor(e){this.forBlock=Object.create(null),this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}",this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null,this.INDENT=" ",this.COMMENT_WRAP=60,this.ORDER_OVERRIDES=[],this.isInitialized=null,this.RESERVED_WORDS_="",this.definitions_=Object.create(null),this.functionNames_=Object.create(null),this.nameDB_=void 0,this.name_=e,this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=f());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let n,o=0;n=e[o];o++){let e=this.blockToCode(n);Array.isArray(e)&&(e=e[0]),e&&(n.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!n.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,n)+e),this.STATEMENT_SUFFIX&&!n.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,n))),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){const t=[];e=e.getDescendants(!0);for(let n=0;n{null==o||o.positionNearConnection(r,i,s),null==o||o.getSvgRoot().setAttribute("visibility","visible")})),r}createInsertionMarker(e){const t=this.workspace.newBlock(e.type);if(t.setInsertionMarker(!0),e.saveExtraState){var n=e.saveExtraState(!0);n&&t.loadExtraState&&t.loadExtraState(n)}else e.mutationToDom&&(n=e.mutationToDom())&&t.domToMutation&&t.domToMutation(n);for(n=0;n.blocklyPathLight,"),"".concat(e," .blocklyInsertionMarker>.blocklyPathDark {"),"fill-opacity: ".concat(this.INSERTION_MARKER_OPACITY,";"),"stroke: none;","}"])}},sg=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_+=ri(e.xPos,this.info_.startY);for(let t,n=0;t=e.elements[n];n++)hd.isLeftSquareCorner(t)?this.steps_+=this.highlightConstants_.START_POINT:hd.isLeftRoundedCorner(t)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):hd.isPreviousConnection(t)?this.steps_+=this.notchPaths_.pathLeft:hd.isHat(t)?this.steps_+=this.startPaths_.path(this.RTL_):hd.isSpacer(t)&&0!==t.width&&(this.steps_+=ai("H",t.xPos+t.width-this.highlightOffset));this.steps_+=ai("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+ai("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(e){const t=e.getLastInput();if(this.RTL_){const n=e.height-t.connectionHeight;this.steps_+=oi(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+ai("v",n)}else this.steps_+=oi(t.xPos+t.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(e){const t=e.getLastInput();if(t)if(this.RTL_){const n=e.height-2*this.insideCornerPaths_.height;this.steps_+=oi(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+ai("v",n)+this.insideCornerPaths_.pathBottom(this.RTL_)+ii(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=oi(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+ii(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){const t=e.xPos+e.width-this.highlightOffset;e instanceof Od&&e.followsStatement&&(this.steps_+=ai("H",t)),this.RTL_&&(this.steps_+=ai("H",t),e.height>this.highlightOffset&&(this.steps_+=ai("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=ai("V",e.baseline-this.highlightOffset);else{const t=this.info_.bottomRow.elements[0];hd.isLeftSquareCorner(t)?this.steps_+=oi(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):hd.isLeftRoundedCorner(t)&&(this.steps_+=oi(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_+=oi(this.info_.startX,e):(this.steps_+=oi(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=ai("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,hd.isLeftRoundedCorner(e.elements[0])?this.steps_+=ai("V",this.outsideCornerPaths_.height):this.steps_+=ai("V",e.capline+this.highlightOffset))}drawInlineInput(e){const t=this.highlightOffset,n=e.xPos+e.connectionWidth;var o=e.centerline-e.height/2;const r=e.width-e.connectionWidth,i=o+t;this.RTL_?(o=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=oi(n-t,i)+ai("v",o)+this.puzzleTabPaths_.pathDown(this.RTL_)+ai("v",e)+ai("h",r)):this.inlineSteps_+=oi(e.xPos+e.width+t,i)+ai("v",e.height)+ai("h",-r)+oi(n,o+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},ag=class extends Md{constructor(e,t){super(e,t),this.highlighter_=new sg(t)}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights();const 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_+=ai("H",e.xPos+e.width)+ai("V",e.yPos+e.height)}drawBottom_(){this.highlighter_.drawBottomRow(this.info_.bottomRow),super.drawBottom_()}drawLeft_(){this.highlighter_.drawLeft(),super.drawLeft_()}drawInlineInput_(e){this.highlighter_.drawInlineInput(e),super.drawInlineInput_(e)}positionInlineInputConnection_(e){const t=e.centerline-e.height/2;if(e.connectionModel){let n=e.xPos+e.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(n*=-1),e.connectionModel.setOffsetInBlock(n,t+e.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(e){const t=e.getLastInput();if(null!=t&&t.connectionModel){let n=e.xPos+e.statementEdge+t.notchOffset;n=this.info_.RTL?-1*n:n+this.constants_.DARK_PATH_OFFSET,t.connectionModel.setOffsetInBlock(n,e.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(e){const t=e.getLastInput();if(t&&t.connectionModel){let n=e.xPos+e.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(n*=-1),t.connectionModel.setOffsetInBlock(n,e.yPos)}}positionNextConnection_(){const e=this.info_.bottomRow;if(e.connection){const t=e.connection,n=t.xPos;t.connectionModel.setOffsetInBlock((this.info_.RTL?-n:n)+this.constants_.DARK_PATH_OFFSET/2,e.baseline+this.constants_.DARK_PATH_OFFSET)}}},lg=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=ri(this.OFFSET,this.OFFSET)}init(){this.INSIDE_CORNER=this.makeInsideCorner(),this.OUTSIDE_CORNER=this.makeOutsideCorner(),this.PUZZLE_TAB=this.makePuzzleTab(),this.NOTCH=this.makeNotch(),this.JAGGED_TEETH=this.makeJaggedTeeth(),this.START_HAT=this.makeStartHat()}makeInsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,n=(1-Math.SQRT1_2)*(e+t)-t,o=ri(n,n)+li("a","0 0,0",e,ti(-n-t,e-n)),r=li("a","0 0,0",e+t,ti(e+t,e+t)),i=ri(n,-n)+li("a","0 0,0",e+t,ti(e-n,n+t));return{width:e+t,height:e,pathTop:e=>e?o:"",pathBottom:e=>e?r:i}}makeOutsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,n=(1-Math.SQRT1_2)*(e-t)+t,o=ri(n,n)+li("a","0 0,1",e-t,ti(e-n,-n+t)),r=ri(t,e)+li("a","0 0,1",e-t,ti(e,-e+t)),i=-n,s=ri(n,i)+li("a","0 0,1",e-t,ti(-n+t,-i-e));return{height:e,topLeft:e=>e?o:r,bottomLeft:()=>s}}makePuzzleTab(){const e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,n=ri(-2,3.4-t)+ii(-.45*e,-2.1),o=ai("v",2.5)+ri(.97*-e,2.5)+ni("q",[ti(.05*-e,10),ti(.3*e,9.5)])+ri(.67*e,-1.9)+ai("v",2.5),r=ai("v",-1.5)+ri(-.92*e,-.5)+ni("q",[ti(-.19*e,-5.5),ti(0,-11)])+ri(.92*e,1),i=ri(-5,t-.7)+ii(.46*e,-2.1);return{width:e,height:t,pathUp:e=>e?n:r,pathDown:e=>e?o:i}}makeNotch(){return{pathLeft:ai("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:ii(5.1,2.6)+ri(-10.2,6.8)+ii(5.1,2.6),height:12,width:10.2}}makeStartHat(){const e=this.constantProvider.START_HAT.height,t=ri(25,-8.7)+ni("c",[ti(29.7,-6.2),ti(57.2,-.5),ti(75,8.7)]),n=ni("c",[ti(17.8,-9.2),ti(45.3,-14.9),ti(75,-8.7)])+oi(100.5,e+.5);return{path:e=>e?t:n}}},cg=class extends Ed{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)}},ug=class extends Id{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},hg=class extends Hd{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 Ud||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}addInput_(e,t){this.isInline&&e instanceof Ms.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new cg(this.constants_,e)),t.hasInlineInput=!0):e instanceof Ud?(t.elements.push(new ug(this.constants_,e)),t.hasStatement=!0):e instanceof Ms.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new bd(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Bd||e instanceof Fd)&&(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 n,o=0;n=this.rows[o];o++)n.hasExternalInput&&(e=!0);for(let n,o=0;n=this.rows[o];o++){var t=n.elements;if(n.elements=[],n.startsWithElemSpacer()&&n.elements.push(new yd(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let e=0;e>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyTreeIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyTreeIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyTreeLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyTreeLabel {\n cursor: url("<<>>/handdelete.cur"), auto;\n}\n\n.blocklyTreeSelected .blocklyTreeLabel {\n color: #fff;\n}\n'),e(Us.TOOLBOX_ITEM,Cg.registrationName,Cg);var kg=class extends wg{constructor(e,t){super(e,t),this.cssConfig_={container:"blocklyTreeSeparator"},this.htmlDiv_=null,Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}init(){this.createDom_()}createDom_(){const e=document.createElement("div"),t=this.cssConfig_.container;return t&&re(e,t),this.htmlDiv_=e}getDiv(){return this.htmlDiv_}dispose(){le(this.htmlDiv_)}};kg.registrationName="sep",ee('\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolboxDiv[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'),e(Us.TOOLBOX_ITEM,kg.registrationName,kg);var $g=class extends Cg{constructor(e,t,n){super(e,t,n),this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[]}makeDefaultCssConfig_(){const e=super.makeDefaultCssConfig_();return e.contents="blocklyToolboxContents",e}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else{const t=e.contents;if(t){this.flyoutItems_=[],e=!0;for(let n=0;n>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolboxDiv {\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.blocklyToolboxContents {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxContents:focus {\n outline: none;\n}\n'),e(Us.TOOLBOX,Fs,Ag);var Og="10.4.3",Rg=Ms.Align$$module$build$src$core$inputs$align.LEFT,xg=Ms.Align$$module$build$src$core$inputs$align.CENTRE,Lg=Ms.Align$$module$build$src$core$inputs$align.RIGHT,Ng=zc.INPUT_VALUE,Mg=zc.OUTPUT_VALUE,Dg=zc.NEXT_STATEMENT,Pg=zc.PREVIOUS_STATEMENT,Bg=Ms.inputTypes$$module$build$src$core$inputs$input_types.DUMMY,Fg=Fl.TOP,Ug=Fl.BOTTOM,Hg=Fl.LEFT,Gg=Fl.RIGHT;dp.prototype.newBlock=function(e,t){return new yp(this,e,t)},bp.prototype.newBlock=function(e,t){return new Op(this,e,t)},bp.newTrashcan=function(e){return new Np(e)},Tc.prototype.showContextMenu=function(e){if(!this.workspace.options.readOnly){var t=[];this.isDeletable()&&this.isMovable()&&(t.push(lo(this)),t.push(ao(this))),eo(e,t,this.RTL)}},Wh.prototype.newWorkspaceSvg=function(e){return new bp(e)},Ms.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=(e=hi(e))[0].concat(e[1]);for(let t=0;t{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))}});var g=Object.assign({},f,{init:function(){this.mixin(m);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))}});d.text_prompt=g,d.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})}},d.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})}},d.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 m={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,n=0;t=this.inputList[n];n++)for(let o,r=0;o=t.fieldRow[r];r++)if(e===o.name)return t.insertFieldAt(r,this.newQuote_(!0)),void t.insertFieldAt(r+2,this.newQuote_(!1));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?"\u201c":"\u201d"})}},b=function(){this.mixin(m),this.quoteField_("TEXT")},_={itemCount_:0,mutationToDom:function(){const e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("items","".concat(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){const t=e.newBlock("text_create_join_container");t.initSvg();let n=t.getInput("STACK").connection;for(let o=0;ot.Msg$$module$build$src$core$msg.TEXT_INDEXOF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1")))},y={isAt_:!1,mutationToDom:function(){const e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("at","".concat(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}},E=function(){this.getField("WHERE").setValidator((function(e){e="FROM_START"===e||"FROM_END"===e;const t=this.getSourceBlock();e!==t.isAt_&&t.updateAt_(e)})),this.updateAt_(!0),this.setTooltip((()=>{var e=this.getFieldValue("WHERE");let n=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)&&(n+=" "+e.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),n}))};t.register$$module$build$src$core$extensions("text_indexOf_tooltip",v),t.register$$module$build$src$core$extensions("text_quotes",b),t.registerMixin$$module$build$src$core$extensions("quote_image_mixin",m),t.registerMutator$$module$build$src$core$extensions("text_join_mutator",_,T),t.registerMutator$$module$build$src$core$extensions("text_charAt_mutator",y,E),t.defineBlocks$$module$build$src$core$common(d);var I={blocks:d},S={},w={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){const n=t.createElement$$module$build$src$core$utils$xml("mutation");e&&n.setAttribute("name",this.getFieldValue("NAME"));for(let o=0;o","GT"],["\u200f\u2265","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}"}]),z={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.register$$module$build$src$core$extensions("logic_op_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("OP",z));var X={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;const 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;const 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?1:0,this.updateShape_()},decompose:function(e){const t=e.newBlock("controls_if_if");t.initSvg();let n=t.nextConnection;for(let o=1;o<=this.elseifCount_;o++){const t=e.newBlock("controls_if_elseif");t.initSvg(),n.connect(t.previousConnection),n=t.nextConnection}return this.elseCount_&&((e=e.newBlock("controls_if_else")).initSvg(),n.connect(e.previousConnection)),t},compose:function(e){e=e.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;const t=[null],n=[null];let o=null;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":this.elseifCount_++,t.push(e.valueConnection_),n.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,n,o)},saveConnections:function(e){e=e.nextConnection.targetBlock();let t=1;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":var n=this.getInput("IF"+t);const o=this.getInput("DO"+t);e.valueConnection_=n&&n.connection.targetConnection,e.statementConnection_=o&&o.connection.targetConnection,t++;break;case"controls_if_else":n=this.getInput("ELSE"),e.statementConnection_=n&&n.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.getNextBlock()}},rebuildShape_:function(){const e=[null],t=[null];let n=null;this.getInput("ELSE")&&(n=this.getInput("ELSE").connection.targetConnection);for(let o=1;this.getInput("IF"+o);o++){const n=this.getInput("IF"+o),r=this.getInput("DO"+o);e.push(n.connection.targetConnection),t.push(r.connection.targetConnection)}this.updateShape_(),this.reconnectChildBlocks_(e,t,n)},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,n){for(let o=1;o<=this.elseifCount_;o++){let n,r;null==(n=e[o])||n.reconnect(this,"IF"+o),null==(r=t[o])||r.reconnect(this,"DO"+o)}null==n||n.reconnect(this,"ELSE")}};t.registerMutator$$module$build$src$core$extensions("controls_if_mutator",X,null,["controls_if_elseif","controls_if_else"]);var Y=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))};t.register$$module$build$src$core$extensions("controls_if_tooltip",Y);var K={onchange:function(e){this.prevBlocks_||(this.prevBlocks_=[null,null]);var n=this.getInputTargetBlock("A");const o=this.getInputTargetBlock("B");n&&o&&!this.workspace.connectionChecker.doTypeChecks(n.outputConnection,o.outputConnection)&&(t.setGroup$$module$build$src$core$events$utils(e.group),(e=this.prevBlocks_[0])!==n&&(n.unplug(),!e||e.isDisposed()||e.isShadow()||this.getInput("A").connection.connect(e.outputConnection)),(n=this.prevBlocks_[1])!==o&&(o.unplug(),!n||n.isDisposed()||n.isShadow()||this.getInput("B").connection.connect(n.outputConnection)),this.bumpNeighbours(),t.setGroup$$module$build$src$core$events$utils(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},J=function(){this.mixin(K)};t.register$$module$build$src$core$extensions("logic_compare",J);var q={prevParentConnection_:null,onchange:function(e){const n=this.getInputTargetBlock("THEN"),o=this.getInputTargetBlock("ELSE"),r=this.outputConnection.targetConnection;if((n||o)&&r)for(let i=0;2>i;i++){const s=1===i?n:o;s&&!s.workspace.connectionChecker.doTypeChecks(s.outputConnection,r)&&(t.setGroup$$module$build$src$core$events$utils(e.group),r===this.prevParentConnection_?(this.unplug(),r.getSourceBlock().bumpNeighbours()):(s.unplug(),s.bumpNeighbours()),t.setGroup$$module$build$src$core$events$utils(!1))}this.prevParentConnection_=r}};t.registerMixin$$module$build$src$core$extensions("logic_ternary",q),t.defineBlocks$$module$build$src$core$common(j);var Z=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}"}]),Q={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(){const 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 new 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){const t=e.newBlock("lists_create_with_container");t.initSvg();let n=t.getInput("STACK").connection;for(let o=0;ot.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1")))}};Z.lists_indexOf=ne;var oe={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"),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((()=>{const e=this.getFieldValue("MODE"),n=this.getFieldValue("WHERE");let o="";switch(e+" "+n){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"!==n&&"FROM_END"!==n||(o+=" "+("FROM_START"===n?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(){const e=t.createElement$$module$build$src$core$utils$xml("mutation");e.setAttribute("statement",String(!this.outputConnection));const n=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(n)),e},domToMutation:function(e){const 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){e!==!this.outputConnection&&(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");const n=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS});n.setValidator((function(t){const n="FROM_START"===t||"FROM_END"===t;if(n!==e){const e=this.getSourceBlock();return e.updateAt_(n),e.setFieldValue(t,"WHERE"),null}})),this.getInput("AT").appendField(n,"WHERE"),t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};Z.lists_getIndex=oe;var re={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"),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((()=>{const e=this.getFieldValue("MODE"),n=this.getFieldValue("WHERE");let o="";switch(e+" "+n){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"!==n&&"FROM_END"!==n||(o+=" "+t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),o}))},mutationToDom:function(){const e=t.createElement$$module$build$src$core$utils$xml("mutation"),n=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(n)),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");const n=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS});n.setValidator((function(t){const n="FROM_START"===t||"FROM_END"===t;if(n!==e){const e=this.getSourceBlock();return e.updateAt_(n),e.setFieldValue(t,"WHERE"),null}})),this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO"),this.getInput("AT").appendField(n,"WHERE")}};Z.lists_setIndex=re;var ie={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),this.appendDummyInput("AT1"),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(){const e=t.createElement$$module$build$src$core$utils$xml("mutation");var n=this.getInput("AT1")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at1",String(n)),n=this.getInput("AT2")instanceof t.ValueInput$$module$build$src$core$inputs$value_input,e.setAttribute("at2",String(n)),e},domToMutation:function(e){const 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,n){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),n?(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);const o=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+e]});o.setValidator((function(t){const o="FROM_START"===t||"FROM_END"===t;if(o!==n){const n=this.getSourceBlock();return n.updateAt_(e,o),n.setFieldValue(t,"WHERE"+e),null}})),this.getInput("AT"+e).appendField(o,"WHERE"+e),1===e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2")),t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};Z.lists_getSublist=ie,Z.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}"})}},Z.lists_split={init:function(){const 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((()=>{const 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){const e=this.getInput("INPUT").connection;e.setShadowDom(null);const 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(){const 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 null},loadExtraState:function(){}},t.defineBlocks$$module$build$src$core$common(Z);var se={blocks:Z},ae=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]);t.defineBlocks$$module$build$src$core$common(ae);var le={blocks:ae},ce={blocks:Object.assign({},ae,Z,j,B,R,S,a,n),colour:le,lists:se,loops:W,math:P,procedures:O,texts:I,variables:h,variablesDynamic:s};return ce.__namespace__=t,ce})?o.apply(t,r):o)||(e.exports=i)},46484:function(e,t,n){var o,r,i;r=[n(72560),n(12823),n(18192),n(85397)],void 0===(i="function"===typeof(o=function(e,t,n,o){"use strict";return e.setLocale(t),e})?o.apply(t,r):o)||(e.exports=i)},72560:function(e,t,n){var o,r,i;r=[n(83514)],void 0===(i="function"===typeof(o=function(e){"use strict";return e})?o.apply(t,r):o)||(e.exports=i)},1720:function(e,t,n){var o,r,i;r=[n(46484)],void 0===(i="function"===typeof(o=function(e){return e})?o.apply(t,r):o)||(e.exports=i)},85397:function(e,t,n){var o,r,i;r=[n(72560),n(47117)],void 0===(i="function"===typeof(o=function(e,t){return t})?o.apply(t,r):o)||(e.exports=i)},47117:function(e,t,n){var o,r,i;r=[n(33096)],o=function(e){var t,n,o=e.__namespace__,r=function(e,n){return[n.quote_(e.getFieldValue("COLOUR")),t.ATOMIC]},i=function(e,n){return[n.provideFunction_("colourRandom","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"() {\n var num = Math.floor(Math.random() * Math.pow(2, 24));\n return '#' + ('00000' + num.toString(16)).substr(-6);\n}\n"))+"()",t.FUNCTION_CALL]},s=function(e,n){const o=n.valueToCode(e,"RED",t.NONE)||0,r=n.valueToCode(e,"GREEN",t.NONE)||0;return e=n.valueToCode(e,"BLUE",t.NONE)||0,[n.provideFunction_("colourRgb","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(r, g, b) {\n r = Math.max(Math.min(Number(r), 100), 0) * 2.55;\n g = Math.max(Math.min(Number(g), 100), 0) * 2.55;\n b = Math.max(Math.min(Number(b), 100), 0) * 2.55;\n r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);\n g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);\n b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);\n return '#' + r + g + b;\n}\n"))+"("+o+", "+r+", "+e+")",t.FUNCTION_CALL]},a=function(e,n){const o=n.valueToCode(e,"COLOUR1",t.NONE)||"'#000000'",r=n.valueToCode(e,"COLOUR2",t.NONE)||"'#000000'";return e=n.valueToCode(e,"RATIO",t.NONE)||.5,[n.provideFunction_("colourBlend","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(c1, c2, ratio) {\n ratio = Math.max(Math.min(Number(ratio), 1), 0);\n var r1 = parseInt(c1.substring(1, 3), 16);\n var g1 = parseInt(c1.substring(3, 5), 16);\n var b1 = parseInt(c1.substring(5, 7), 16);\n var r2 = parseInt(c2.substring(1, 3), 16);\n var g2 = parseInt(c2.substring(3, 5), 16);\n var b2 = parseInt(c2.substring(5, 7), 16);\n var r = Math.round(r1 * (1 - ratio) + r2 * ratio);\n var g = Math.round(g1 * (1 - ratio) + g2 * ratio);\n var b = Math.round(b1 * (1 - ratio) + b2 * ratio);\n r = ('0' + (r || 0).toString(16)).slice(-2);\n g = ('0' + (g || 0).toString(16)).slice(-2);\n b = ('0' + (b || 0).toString(16)).slice(-2);\n return '#' + r + g + b;\n}\n"))+"("+o+", "+r+", "+e+")",t.FUNCTION_CALL]},l=function(e,n){return["[]",t.ATOMIC]},c=function(e,n){const o=Array(e.itemCount_);for(let r=0;r String(b) ? 1 : -1; },\n 'IGNORE_CASE': function(a, b) {\n return String(a).toLowerCase() > String(b).toLowerCase() ? 1 : -1; },\n };\n var compare = compareFuncs[type];\n return function(a, b) { return compare(a, b) * direction; };\n}\n ")))+'("'+e+'", '+r+"))",t.FUNCTION_CALL]},_=function(e,n){let o=n.valueToCode(e,"INPUT",t.MEMBER);if(n=n.valueToCode(e,"DELIM",t.NONE)||"''","SPLIT"===(e=e.getFieldValue("MODE")))o||(o="''"),e="split";else{if("JOIN"!==e)throw Error("Unknown mode: "+e);o||(o="[]"),e="join"}return[o+"."+e+"("+n+")",t.FUNCTION_CALL]},T=function(e,n){return[(n.valueToCode(e,"LIST",t.FUNCTION_CALL)||"[]")+".slice().reverse()",t.FUNCTION_CALL]},v=function(e,n){var o=0;let r="";n.STATEMENT_PREFIX&&(r+=n.injectId(n.STATEMENT_PREFIX,e));do{const i=n.valueToCode(e,"IF"+o,t.NONE)||"false";let s=n.statementToCode(e,"DO"+o);n.STATEMENT_SUFFIX&&(s=n.prefixLines(n.injectId(n.STATEMENT_SUFFIX,e),n.INDENT)+s),r+=(0",GTE:">="}[e.getFieldValue("OP")],r="=="===o||"!="===o?t.EQUALITY:t.RELATIONAL;return[(n.valueToCode(e,"A",r)||"0")+" "+o+" "+(e=n.valueToCode(e,"B",r)||"0"),r]},E=function(e,n){const o="AND"===e.getFieldValue("OP")?"&&":"||",r="&&"===o?t.LOGICAL_AND:t.LOGICAL_OR;let i=n.valueToCode(e,"A",r);return e=n.valueToCode(e,"B",r),i||e?(n="&&"===o?"true":"false",i||(i=n),e||(e=n)):e=i="false",[i+" "+o+" "+e,r]},I=function(e,n){const o=t.LOGICAL_NOT;return["!"+(n.valueToCode(e,"BOOL",o)||"true"),o]},S=function(e,n){return["TRUE"===e.getFieldValue("BOOL")?"true":"false",t.ATOMIC]},w=function(e,n){return["null",t.ATOMIC]},C=function(e,n){return[(n.valueToCode(e,"IF",t.CONDITIONAL)||"false")+" ? "+(n.valueToCode(e,"THEN",t.CONDITIONAL)||"null")+" : "+(e=n.valueToCode(e,"ELSE",t.CONDITIONAL)||"null"),t.CONDITIONAL]},k=function(e,n){let r;r=e.getField("TIMES")?String(Number(e.getFieldValue("TIMES"))):n.valueToCode(e,"TIMES",t.ASSIGNMENT)||"0";let i=n.statementToCode(e,"DO");i=n.addLoopTrap(i,e),e="";const s=n.nameDB_.getDistinctName("count",o.NameType$$module$build$src$core$names.VARIABLE);let a=r;return r.match(/^\w+$/)||o.isNumber$$module$build$src$core$utils$string(r)||(a=n.nameDB_.getDistinctName("repeat_end",o.NameType$$module$build$src$core$names.VARIABLE),e+="var "+a+" = "+r+";\n"),e+"for (var "+s+" = 0; "+s+" < "+a+"; "+s+"++) {\n"+i+"}\n"},$=function(e,n){const o="UNTIL"===e.getFieldValue("MODE");let r=n.valueToCode(e,"BOOL",o?t.LOGICAL_NOT:t.NONE)||"false",i=n.statementToCode(e,"DO");return i=n.addLoopTrap(i,e),o&&(r="!"+r),"while ("+r+") {\n"+i+"}\n"},A=function(e,n){var r=n.getVariableName(e.getFieldValue("VAR")),i=n.valueToCode(e,"FROM",t.ASSIGNMENT)||"0",s=n.valueToCode(e,"TO",t.ASSIGNMENT)||"0";const a=n.valueToCode(e,"BY",t.ASSIGNMENT)||"1";let l=n.statementToCode(e,"DO");if(l=n.addLoopTrap(l,e),o.isNumber$$module$build$src$core$utils$string(i)&&o.isNumber$$module$build$src$core$utils$string(s)&&o.isNumber$$module$build$src$core$utils$string(a))e="for ("+r+" = "+i+"; "+r+((n=Number(i)<=Number(s))?" <= ":" >= ")+s+"; "+r,e=1===(r=Math.abs(Number(a)))?e+(n?"++":"--"):e+(n?" += ":" -= ")+r,e+=") {\n"+l+"}\n";else{e="";let t=i;i.match(/^\w+$/)||o.isNumber$$module$build$src$core$utils$string(i)||(t=n.nameDB_.getDistinctName(r+"_start",o.NameType$$module$build$src$core$names.VARIABLE),e+="var "+t+" = "+i+";\n"),i=s,s.match(/^\w+$/)||o.isNumber$$module$build$src$core$utils$string(s)||(e+="var "+(i=n.nameDB_.getDistinctName(r+"_end",o.NameType$$module$build$src$core$names.VARIABLE))+" = "+s+";\n"),e+="var "+(s=n.nameDB_.getDistinctName(r+"_inc",o.NameType$$module$build$src$core$names.VARIABLE))+" = ",e=o.isNumber$$module$build$src$core$utils$string(a)?e+(Math.abs(Number(a))+";\n"):e+"Math.abs("+a+");\n",e+="if ("+t+" > "+i+") {\n",e=(e+=n.INDENT+s+" = -"+s+";\n")+"}\nfor ("+r+" = "+t+"; "+s+" >= 0 ? "+r+" <= "+i+" : "+r+" >= "+i+"; "+r+" += "+s+") {\n"+l+"}\n"}return e},O=function(e,n){const r=n.getVariableName(e.getFieldValue("VAR"));var i=n.valueToCode(e,"LIST",t.ASSIGNMENT)||"[]";let s=n.statementToCode(e,"DO");s=n.addLoopTrap(s,e),e="";let a=i;return i.match(/^\w+$/)||(a=n.nameDB_.getDistinctName(r+"_list",o.NameType$$module$build$src$core$names.VARIABLE),e+="var "+a+" = "+i+";\n"),i=n.nameDB_.getDistinctName(r+"_index",o.NameType$$module$build$src$core$names.VARIABLE),s=n.INDENT+r+" = "+a+"["+i+"];\n"+s,e+"for (var "+i+" in "+a+") {\n"+s+"}\n"},R=function(e,t){let n="";if(t.STATEMENT_PREFIX&&(n+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(n+=t.injectId(t.STATEMENT_SUFFIX,e)),t.STATEMENT_PREFIX){const o=e.getSurroundLoop();o&&!o.suppressPrefixSuffix&&(n+=t.injectId(t.STATEMENT_PREFIX,o))}switch(e.getFieldValue("FLOW")){case"BREAK":return n+"break;\n";case"CONTINUE":return n+"continue;\n"}throw Error("Unknown flow statement.")},x=function(e,n){return e=Number(e.getFieldValue("NUM")),[String(e),0<=e?t.ATOMIC:t.UNARY_NEGATION]},L=function(e,n){var o={ADD:[" + ",t.ADDITION],MINUS:[" - ",t.SUBTRACTION],MULTIPLY:[" * ",t.MULTIPLICATION],DIVIDE:[" / ",t.DIVISION],POWER:[null,t.NONE]}[e.getFieldValue("OP")];const r=o[0];o=o[1];const i=n.valueToCode(e,"A",o)||"0";return e=n.valueToCode(e,"B",o)||"0",r?[i+r+e,o]:["Math.pow("+i+", "+e+")",t.FUNCTION_CALL]},N=function(e,n){const o=e.getFieldValue("OP");let r;if("NEG"===o)return"-"===(e=n.valueToCode(e,"NUM",t.UNARY_NEGATION)||"0")[0]&&(e=" "+e),["-"+e,t.UNARY_NEGATION];switch(e="SIN"===o||"COS"===o||"TAN"===o?n.valueToCode(e,"NUM",t.DIVISION)||"0":n.valueToCode(e,"NUM",t.NONE)||"0",o){case"ABS":r="Math.abs("+e+")";break;case"ROOT":r="Math.sqrt("+e+")";break;case"LN":r="Math.log("+e+")";break;case"EXP":r="Math.exp("+e+")";break;case"POW10":r="Math.pow(10,"+e+")";break;case"ROUND":r="Math.round("+e+")";break;case"ROUNDUP":r="Math.ceil("+e+")";break;case"ROUNDDOWN":r="Math.floor("+e+")";break;case"SIN":r="Math.sin("+e+" / 180 * Math.PI)";break;case"COS":r="Math.cos("+e+" / 180 * Math.PI)";break;case"TAN":r="Math.tan("+e+" / 180 * Math.PI)"}if(r)return[r,t.FUNCTION_CALL];switch(o){case"LOG10":r="Math.log("+e+") / Math.log(10)";break;case"ASIN":r="Math.asin("+e+") / Math.PI * 180";break;case"ACOS":r="Math.acos("+e+") / Math.PI * 180";break;case"ATAN":r="Math.atan("+e+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+o)}return[r,t.DIVISION]},M=function(e,n){return{PI:["Math.PI",t.MEMBER],E:["Math.E",t.MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",t.DIVISION],SQRT2:["Math.SQRT2",t.MEMBER],SQRT1_2:["Math.SQRT1_2",t.MEMBER],INFINITY:["Infinity",t.ATOMIC]}[e.getFieldValue("CONSTANT")]},D=function(e,n){var o={EVEN:[" % 2 === 0",t.MODULUS,t.EQUALITY],ODD:[" % 2 === 1",t.MODULUS,t.EQUALITY],WHOLE:[" % 1 === 0",t.MODULUS,t.EQUALITY],POSITIVE:[" > 0",t.RELATIONAL,t.RELATIONAL],NEGATIVE:[" < 0",t.RELATIONAL,t.RELATIONAL],DIVISIBLE_BY:[null,t.MODULUS,t.EQUALITY],PRIME:[null,t.NONE,t.FUNCTION_CALL]};const r=e.getFieldValue("PROPERTY"),[i,s,a]=o[r];return o=n.valueToCode(e,"NUMBER_TO_CHECK",s)||"0",[e="PRIME"===r?n.provideFunction_("mathIsPrime","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(n) {\n // https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n if (n == 2 || n == 3) {\n return true;\n }\n // False if n is NaN, negative, is 1, or not whole.\n // And false if n is divisible by 2 or 3.\n if (isNaN(n) || n <= 1 || n % 1 !== 0 || n % 2 === 0 || n % 3 === 0) {\n return false;\n }\n // Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {\n if (n % (x - 1) === 0 || n % (x + 1) === 0) {\n return false;\n }\n }\n return true;\n}\n"))+"("+o+")":"DIVISIBLE_BY"===r?o+" % "+(e=n.valueToCode(e,"DIVISOR",t.MODULUS)||"0")+" === 0":o+i,a]},P=function(e,n){const o=n.valueToCode(e,"DELTA",t.ADDITION)||"0";return(e=n.getVariableName(e.getFieldValue("VAR")))+" = (typeof "+e+" === 'number' ? "+e+" : 0) + "+o+";\n"},B=function(e,n){var o=e.getFieldValue("OP");switch(o){case"SUM":e=n.valueToCode(e,"LIST",t.MEMBER)||"[]",e+=".reduce(function(x, y) {return x + y;}, 0)";break;case"MIN":e="Math.min.apply(null, "+(e=n.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"MAX":e="Math.max.apply(null, "+(e=n.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"AVERAGE":e=(o=n.provideFunction_("mathMean","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(myList) {\n return myList.reduce(function(x, y) {return x + y;}, 0) / myList.length;\n}\n")))+"("+(e=n.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"MEDIAN":e=(o=n.provideFunction_("mathMedian","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(myList) {\n var localList = myList.filter(function (x) {return typeof x === 'number';});\n if (!localList.length) return null;\n localList.sort(function(a, b) {return b - a;});\n if (localList.length % 2 === 0) {\n return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;\n } else {\n return localList[(localList.length - 1) / 2];\n }\n}\n")))+"("+(e=n.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"MODE":e=(o=n.provideFunction_("mathModes","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(values) {\n var modes = [];\n var counts = [];\n var maxCount = 0;\n for (var i = 0; i < values.length; i++) {\n var value = values[i];\n var found = false;\n var thisCount;\n for (var j = 0; j < counts.length; j++) {\n if (counts[j][0] === value) {\n thisCount = ++counts[j][1];\n found = true;\n break;\n }\n }\n if (!found) {\n counts.push([value, 1]);\n thisCount = 1;\n }\n maxCount = Math.max(thisCount, maxCount);\n }\n for (var j = 0; j < counts.length; j++) {\n if (counts[j][1] === maxCount) {\n modes.push(counts[j][0]);\n }\n }\n return modes;\n}\n")))+"("+(e=n.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"STD_DEV":e=(o=n.provideFunction_("mathStandardDeviation","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(numbers) {\n var n = numbers.length;\n if (!n) return null;\n var mean = numbers.reduce(function(x, y) {return x + y;}) / n;\n var variance = 0;\n for (var j = 0; j < n; j++) {\n variance += Math.pow(numbers[j] - mean, 2);\n }\n variance = variance / n;\n return Math.sqrt(variance);\n}\n")))+"("+(e=n.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"RANDOM":e=(o=n.provideFunction_("mathRandomList","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(list) {\n var x = Math.floor(Math.random() * list.length);\n return list[x];\n}\n")))+"("+(e=n.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;default:throw Error("Unknown operator: "+o)}return[e,t.FUNCTION_CALL]},F=function(e,n){return[(n.valueToCode(e,"DIVIDEND",t.MODULUS)||"0")+" % "+(e=n.valueToCode(e,"DIVISOR",t.MODULUS)||"0"),t.MODULUS]},U=function(e,n){return["Math.min(Math.max("+(n.valueToCode(e,"VALUE",t.NONE)||"0")+", "+(n.valueToCode(e,"LOW",t.NONE)||"0")+"), "+(e=n.valueToCode(e,"HIGH",t.NONE)||"Infinity")+")",t.FUNCTION_CALL]},H=function(e,n){const o=n.valueToCode(e,"FROM",t.NONE)||"0";return e=n.valueToCode(e,"TO",t.NONE)||"0",[n.provideFunction_("mathRandomInt","\nfunction ".concat(n.FUNCTION_NAME_PLACEHOLDER_,"(a, b) {\n if (a > b) {\n // Swap a and b to ensure a is smaller.\n var c = a;\n a = b;\n b = c;\n }\n return Math.floor(Math.random() * (b - a + 1) + a);\n}\n"))+"("+o+", "+e+")",t.FUNCTION_CALL]},G=function(e,n){return["Math.random()",t.FUNCTION_CALL]},V=function(e,n){const o=n.valueToCode(e,"X",t.NONE)||"0";return["Math.atan2("+(n.valueToCode(e,"Y",t.NONE)||"0")+", "+o+") / Math.PI * 180",t.DIVISION]},W=function(e,n){const o=n.getProcedureName(e.getFieldValue("NAME"));var r="";n.STATEMENT_PREFIX&&(r+=n.injectId(n.STATEMENT_PREFIX,e)),n.STATEMENT_SUFFIX&&(r+=n.injectId(n.STATEMENT_SUFFIX,e)),r&&(r=n.prefixLines(r,n.INDENT));let i="";n.INFINITE_LOOP_TRAP&&(i=n.prefixLines(n.injectId(n.INFINITE_LOOP_TRAP,e),n.INDENT));const s=n.statementToCode(e,"STACK");let a=n.valueToCode(e,"RETURN",t.NONE)||"",l="";s&&a&&(l=r),a&&(a=n.INDENT+"return "+a+";\n");const c=[],u=e.getVars();for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:"JavaScript";super(e),this.ORDER_OVERRIDES=[[t.FUNCTION_CALL,t.MEMBER],[t.FUNCTION_CALL,t.FUNCTION_CALL],[t.MEMBER,t.MEMBER],[t.MEMBER,t.FUNCTION_CALL],[t.LOGICAL_NOT,t.LOGICAL_NOT],[t.MULTIPLICATION,t.MULTIPLICATION],[t.ADDITION,t.ADDITION],[t.LOGICAL_AND,t.LOGICAL_AND],[t.LOGICAL_OR,t.LOGICAL_OR]],this.isInitialized=!1;for(const n in t)e=t[n],"string"!==typeof e&&(this["ORDER_"+n]=e);this.addReservedWords("break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,in,instanceof,new,return,super,switch,this,throw,try,typeof,var,void,while,with,yield,enum,implements,interface,let,package,private,protected,public,static,await,null,true,false,arguments,"+Object.getOwnPropertyNames(globalThis).join(","))}init(e){super.init(e),this.nameDB_?this.nameDB_.reset():this.nameDB_=new o.Names$$module$build$src$core$names(this.RESERVED_WORDS_),this.nameDB_.setVariableMap(e.getVariableMap()),this.nameDB_.populateVariables(e),this.nameDB_.populateProcedures(e);const t=[];var n=o.allDeveloperVariables$$module$build$src$core$variables(e);for(let r=0;r2&&void 0!==arguments[2]&&arguments[2],r="";if(!e.outputConnection||!e.outputConnection.targetConnection){var i=e.getCommentText();i&&(i=o.wrap$$module$build$src$core$utils$string(i,this.COMMENT_WRAP-3),r+=this.prefixLines(i+"\n","// "));for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.NONE;e.workspace.options.oneBasedIndex&&r--;const a=e.workspace.options.oneBasedIndex?"1":"0";let l=s;return 0r?l=t.SUBTRACTION:i&&(l=t.UNARY_NEGATION),e=this.valueToCode(e,n,l)||a,0!==r||i?o.isNumber$$module$build$src$core$utils$string(e)?(e=String(Number(e)+r),i&&(e=String(-Number(e))),e):(0r&&(e="".concat(e," - ").concat(-r)),i&&(e=r?"-(".concat(e,")"):"-".concat(e)),Math.floor(s)>=Math.floor(l)&&(e="(".concat(e,")")),e):e}},pe={};pe.JavascriptGenerator=de,pe.Order=t;var fe={};fe.colour_blend=a,fe.colour_picker=r,fe.colour_random=i,fe.colour_rgb=s;var ge=function(e,t,n){return"FIRST"===t?"0":"FROM_END"===t?e+".length - 1 - "+n:"LAST"===t?e+".length - 1":n},me={};me.lists_create_empty=l,me.lists_create_with=c,me.lists_getIndex=f,me.lists_getSublist=m,me.lists_indexOf=p,me.lists_isEmpty=d,me.lists_length=h,me.lists_repeat=u,me.lists_reverse=T,me.lists_setIndex=g,me.lists_sort=b,me.lists_split=_;var be={};be.controls_if=v,be.controls_ifelse=v,be.logic_boolean=S,be.logic_compare=y,be.logic_negate=I,be.logic_null=w,be.logic_operation=E,be.logic_ternary=C;var _e={};_e.controls_flow_statements=R,_e.controls_for=A,_e.controls_forEach=O,_e.controls_repeat=k,_e.controls_repeat_ext=k,_e.controls_whileUntil=$;var Te={};Te.math_arithmetic=L,Te.math_atan2=V,Te.math_change=P,Te.math_constant=M,Te.math_constrain=U,Te.math_modulo=F,Te.math_number=x,Te.math_number_property=D,Te.math_on_list=B,Te.math_random_float=G,Te.math_random_int=H,Te.math_round=N,Te.math_single=N,Te.math_trig=N;var ve={};ve.procedures_callnoreturn=z,ve.procedures_callreturn=j,ve.procedures_defnoreturn=W,ve.procedures_defreturn=W,ve.procedures_ifreturn=X;var ye=/^\s*'([^']|\\')*'\s*$/,Ee=function(e){return ye.test(e)?[e,t.ATOMIC]:["String("+e+")",t.FUNCTION_CALL]},Ie=function(e,t,n){return"FIRST"===t?"0":"FROM_END"===t?e+".length - 1 - "+n:"LAST"===t?e+".length - 1":n},Se={};Se.text=Y,Se.text_append=q,Se.text_changeCase=oe,Se.text_charAt=te,Se.text_count=ae,Se.text_getSubstring=ne,Se.text_indexOf=ee,Se.text_isEmpty=Q,Se.text_join=J,Se.text_length=Z,Se.text_multiline=K,Se.text_print=ie,Se.text_prompt=se,Se.text_prompt_ext=se,Se.text_replace=le,Se.text_reverse=ce,Se.text_trim=re;var we={};we.variables_get=ue,we.variables_set=he;var Ce={};Ce.variables_get_dynamic=ue,Ce.variables_set_dynamic=he;var ke=new de,$e=Object.assign({},fe,me,be,_e,Te,ve,Se,we,Ce);for(const Oe in $e)ke.forBlock[Oe]=$e[Oe];var Ae={};return Ae.JavascriptGenerator=de,Ae.Order=t,Ae.javascriptGenerator=ke,Ae.__namespace__=o,Ae},void 0===(i="function"===typeof o?o.apply(t,r):o)||(e.exports=i)},12823:function(e,t){var n,o,r;o=[],void 0===(r="function"===typeof(n=function(){"use strict";var e=e||{Msg:Object.create(null)};return e.Msg.ADD_COMMENT="Add Comment",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.CLEAN_UP="Clean up Blocks",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.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.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.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.INLINE_INPUTS="Inline Inputs",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_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#getting-items-from-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.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: \u03c0 (3.141\u2026), e (2.718\u2026), \u03c6 (1.618\u2026), sqrt(2) (1.414\u2026), sqrt(\xbd) (0.707\u2026), or \u221e (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="\xf7",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 \xf7 %2",e.Msg.MATH_MODULO_TOOLTIP="Return the remainder from dividing the two numbers.",e.Msg.MATH_MULTIPLICATION_SYMBOL="\xd7",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.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.ORDINAL_NUMBER_SUFFIX="",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_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.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.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.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})?n.apply(t,o):n)||(e.exports=r)},73374:(e,t,n)=>{"use strict";var o=n(95932),r=n(88110),i=r(o("String.prototype.indexOf"));e.exports=function(e,t){var n=o(e,!!t);return"function"===typeof n&&i(e,".prototype.")>-1?r(n):n}},88110:(e,t,n)=>{"use strict";var o=n(22142),r=n(95932),i=n(20200),s=n(12032),a=r("%Function.prototype.apply%"),l=r("%Function.prototype.call%"),c=r("%Reflect.apply%",!0)||o.call(l,a),u=n(3184),h=r("%Math.max%");e.exports=function(e){if("function"!==typeof e)throw new s("a function is required");var t=c(o,l,arguments);return i(t,1+h(0,e.length-(arguments.length-1)),!0)};var d=function(){return c(o,a,arguments)};u?u(e.exports,"apply",{value:d}):e.exports.apply=d},58854:(e,t,n)=>{"use strict";function o(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;tr});const r=function(){for(var e,t,n=0,r="";n{var o=n(38183),r={};for(var i in o)o.hasOwnProperty(i)&&(r[o[i]]=i);var s=e.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var a in s)if(s.hasOwnProperty(a)){if(!("channels"in s[a]))throw new Error("missing channels property: "+a);if(!("labels"in s[a]))throw new Error("missing channel labels property: "+a);if(s[a].labels.length!==s[a].channels)throw new Error("channel and label counts mismatch: "+a);var l=s[a].channels,c=s[a].labels;delete s[a].channels,delete s[a].labels,Object.defineProperty(s[a],"channels",{value:l}),Object.defineProperty(s[a],"labels",{value:c})}s.rgb.hsl=function(e){var t,n,o=e[0]/255,r=e[1]/255,i=e[2]/255,s=Math.min(o,r,i),a=Math.max(o,r,i),l=a-s;return a===s?t=0:o===a?t=(r-i)/l:r===a?t=2+(i-o)/l:i===a&&(t=4+(o-r)/l),(t=Math.min(60*t,360))<0&&(t+=360),n=(s+a)/2,[t,100*(a===s?0:n<=.5?l/(a+s):l/(2-a-s)),100*n]},s.rgb.hsv=function(e){var t,n,o,r,i,s=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),h=function(e){return(c-e)/6/u+.5};return 0===u?r=i=0:(i=u/c,t=h(s),n=h(a),o=h(l),s===c?r=o-n:a===c?r=1/3+t-o:l===c&&(r=2/3+n-t),r<0?r+=1:r>1&&(r-=1)),[360*r,100*i,100*c]},s.rgb.hwb=function(e){var t=e[0],n=e[1],o=e[2];return[s.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(n,o))),100*(o=1-1/255*Math.max(t,Math.max(n,o)))]},s.rgb.cmyk=function(e){var t,n=e[0]/255,o=e[1]/255,r=e[2]/255;return[100*((1-n-(t=Math.min(1-n,1-o,1-r)))/(1-t)||0),100*((1-o-t)/(1-t)||0),100*((1-r-t)/(1-t)||0),100*t]},s.rgb.keyword=function(e){var t=r[e];if(t)return t;var n,i,s,a=1/0;for(var l in o)if(o.hasOwnProperty(l)){var c=o[l],u=(i=e,s=c,Math.pow(i[0]-s[0],2)+Math.pow(i[1]-s[1],2)+Math.pow(i[2]-s[2],2));u.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(o=o>.04045?Math.pow((o+.055)/1.055,2.4):o/12.92)),100*(.2126*t+.7152*n+.0722*o),100*(.0193*t+.1192*n+.9505*o)]},s.rgb.lab=function(e){var t=s.rgb.xyz(e),n=t[0],o=t[1],r=t[2];return o/=100,r/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116)-16,500*(n-o),200*(o-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},s.hsl.rgb=function(e){var t,n,o,r,i,s=e[0]/360,a=e[1]/100,l=e[2]/100;if(0===a)return[i=255*l,i,i];t=2*l-(n=l<.5?l*(1+a):l+a-l*a),r=[0,0,0];for(var c=0;c<3;c++)(o=s+1/3*-(c-1))<0&&o++,o>1&&o--,i=6*o<1?t+6*(n-t)*o:2*o<1?n:3*o<2?t+(n-t)*(2/3-o)*6:t,r[c]=255*i;return r},s.hsl.hsv=function(e){var t=e[0],n=e[1]/100,o=e[2]/100,r=n,i=Math.max(o,.01);return n*=(o*=2)<=1?o:2-o,r*=i<=1?i:2-i,[t,100*(0===o?2*r/(i+r):2*n/(o+n)),100*((o+n)/2)]},s.hsv.rgb=function(e){var t=e[0]/60,n=e[1]/100,o=e[2]/100,r=Math.floor(t)%6,i=t-Math.floor(t),s=255*o*(1-n),a=255*o*(1-n*i),l=255*o*(1-n*(1-i));switch(o*=255,r){case 0:return[o,l,s];case 1:return[a,o,s];case 2:return[s,o,l];case 3:return[s,a,o];case 4:return[l,s,o];case 5:return[o,s,a]}},s.hsv.hsl=function(e){var t,n,o,r=e[0],i=e[1]/100,s=e[2]/100,a=Math.max(s,.01);return o=(2-i)*s,n=i*a,[r,100*(n=(n/=(t=(2-i)*a)<=1?t:2-t)||0),100*(o/=2)]},s.hwb.rgb=function(e){var t,n,o,r,i,s,a,l=e[0]/360,c=e[1]/100,u=e[2]/100,h=c+u;switch(h>1&&(c/=h,u/=h),o=6*l-(t=Math.floor(6*l)),0!==(1&t)&&(o=1-o),r=c+o*((n=1-u)-c),t){default:case 6:case 0:i=n,s=r,a=c;break;case 1:i=r,s=n,a=c;break;case 2:i=c,s=n,a=r;break;case 3:i=c,s=r,a=n;break;case 4:i=r,s=c,a=n;break;case 5:i=n,s=c,a=r}return[255*i,255*s,255*a]},s.cmyk.rgb=function(e){var t=e[0]/100,n=e[1]/100,o=e[2]/100,r=e[3]/100;return[255*(1-Math.min(1,t*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,o*(1-r)+r))]},s.xyz.rgb=function(e){var t,n,o,r=e[0]/100,i=e[1]/100,s=e[2]/100;return n=-.9689*r+1.8758*i+.0415*s,o=.0557*r+-.204*i+1.057*s,t=(t=3.2406*r+-1.5372*i+-.4986*s)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:12.92*o,[255*(t=Math.min(Math.max(0,t),1)),255*(n=Math.min(Math.max(0,n),1)),255*(o=Math.min(Math.max(0,o),1))]},s.xyz.lab=function(e){var t=e[0],n=e[1],o=e[2];return n/=100,o/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(t-n),200*(n-(o=o>.008856?Math.pow(o,1/3):7.787*o+16/116))]},s.lab.xyz=function(e){var t,n,o,r=e[0];t=e[1]/500+(n=(r+16)/116),o=n-e[2]/200;var i=Math.pow(n,3),s=Math.pow(t,3),a=Math.pow(o,3);return n=i>.008856?i:(n-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,o=a>.008856?a:(o-16/116)/7.787,[t*=95.047,n*=100,o*=108.883]},s.lab.lch=function(e){var t,n=e[0],o=e[1],r=e[2];return(t=360*Math.atan2(r,o)/2/Math.PI)<0&&(t+=360),[n,Math.sqrt(o*o+r*r),t]},s.lch.lab=function(e){var t,n=e[0],o=e[1];return t=e[2]/360*2*Math.PI,[n,o*Math.cos(t),o*Math.sin(t)]},s.rgb.ansi16=function(e){var t=e[0],n=e[1],o=e[2],r=1 in arguments?arguments[1]:s.rgb.hsv(e)[2];if(0===(r=Math.round(r/50)))return 30;var i=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return 2===r&&(i+=60),i},s.hsv.ansi16=function(e){return s.rgb.ansi16(s.hsv.rgb(e),e[2])},s.rgb.ansi256=function(e){var t=e[0],n=e[1],o=e[2];return t===n&&n===o?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5)},s.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},s.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var n;return e-=16,[Math.floor(e/36)/5*255,Math.floor((n=e%36)/6)/5*255,n%6/5*255]},s.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},s.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var n=t[0];3===t[0].length&&(n=n.split("").map((function(e){return e+e})).join(""));var o=parseInt(n,16);return[o>>16&255,o>>8&255,255&o]},s.rgb.hcg=function(e){var t,n=e[0]/255,o=e[1]/255,r=e[2]/255,i=Math.max(Math.max(n,o),r),s=Math.min(Math.min(n,o),r),a=i-s;return t=a<=0?0:i===n?(o-r)/a%6:i===o?2+(r-n)/a:4+(n-o)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?s/(1-a):0)]},s.hsl.hcg=function(e){var t=e[1]/100,n=e[2]/100,o=1,r=0;return(o=n<.5?2*t*n:2*t*(1-n))<1&&(r=(n-.5*o)/(1-o)),[e[0],100*o,100*r]},s.hsv.hcg=function(e){var t=e[1]/100,n=e[2]/100,o=t*n,r=0;return o<1&&(r=(n-o)/(1-o)),[e[0],100*o,100*r]},s.hcg.rgb=function(e){var t=e[0]/360,n=e[1]/100,o=e[2]/100;if(0===n)return[255*o,255*o,255*o];var r,i=[0,0,0],s=t%1*6,a=s%1,l=1-a;switch(Math.floor(s)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=l,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=l,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=l}return r=(1-n)*o,[255*(n*i[0]+r),255*(n*i[1]+r),255*(n*i[2]+r)]},s.hcg.hsv=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t),o=0;return n>0&&(o=t/n),[e[0],100*o,100*n]},s.hcg.hsl=function(e){var t=e[1]/100,n=e[2]/100*(1-t)+.5*t,o=0;return n>0&&n<.5?o=t/(2*n):n>=.5&&n<1&&(o=t/(2*(1-n))),[e[0],100*o,100*n]},s.hcg.hwb=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},s.hwb.hcg=function(e){var t=e[1]/100,n=1-e[2]/100,o=n-t,r=0;return o<1&&(r=(n-o)/(1-o)),[e[0],100*o,100*r]},s.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},s.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},s.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},s.gray.hsl=s.gray.hsv=function(e){return[0,0,e[0]]},s.gray.hwb=function(e){return[0,100,e[0]]},s.gray.cmyk=function(e){return[0,0,0,e[0]]},s.gray.lab=function(e){return[e[0],0,0]},s.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},s.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},61235:(e,t,n)=>{var o=n(14114),r=n(73798),i={};Object.keys(o).forEach((function(e){i[e]={},Object.defineProperty(i[e],"channels",{value:o[e].channels}),Object.defineProperty(i[e],"labels",{value:o[e].labels});var t=r(e);Object.keys(t).forEach((function(n){var o=t[n];i[e][n]=function(e){var t=function(t){if(void 0===t||null===t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=e(t);if("object"===typeof n)for(var o=n.length,r=0;r1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(o)}))})),e.exports=i},73798:(e,t,n)=>{var o=n(14114);function r(e){var t=function(){for(var e={},t=Object.keys(o),n=t.length,r=0;r{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},4569:(e,t,n)=>{var o=n(38183),r=n(3851),i=Object.hasOwnProperty,s=Object.create(null);for(var a in o)i.call(o,a)&&(s[o[a]]=a);var l=e.exports={to:{},get:{}};function c(e,t,n){return Math.min(Math.max(t,e),n)}function u(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}l.get=function(e){var t,n;switch(e.substring(0,3).toLowerCase()){case"hsl":t=l.get.hsl(e),n="hsl";break;case"hwb":t=l.get.hwb(e),n="hwb";break;default:t=l.get.rgb(e),n="rgb"}return t?{model:n,value:t}:null},l.get.rgb=function(e){if(!e)return null;var t,n,r,s=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=t[2],t=t[1],n=0;n<3;n++){var a=2*n;s[n]=parseInt(t.slice(a,a+2),16)}r&&(s[3]=parseInt(r,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(r=(t=t[1])[3],n=0;n<3;n++)s[n]=parseInt(t[n]+t[n],16);r&&(s[3]=parseInt(r+r,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)s[n]=parseInt(t[n+1],0);t[4]&&(t[5]?s[3]=.01*parseFloat(t[4]):s[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:i.call(o,t[1])?((s=o[t[1]])[3]=1,s):null:null;for(n=0;n<3;n++)s[n]=Math.round(2.55*parseFloat(t[n+1]));t[4]&&(t[5]?s[3]=.01*parseFloat(t[4]):s[3]=parseFloat(t[4]))}for(n=0;n<3;n++)s[n]=c(s[n],0,255);return s[3]=c(s[3],0,1),s},l.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,c(parseFloat(t[2]),0,100),c(parseFloat(t[3]),0,100),c(isNaN(n)?1:n,0,1)]}return null},l.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,c(parseFloat(t[2]),0,100),c(parseFloat(t[3]),0,100),c(isNaN(n)?1:n,0,1)]}return null},l.to.hex=function(){var e=r(arguments);return"#"+u(e[0])+u(e[1])+u(e[2])+(e[3]<1?u(Math.round(255*e[3])):"")},l.to.rgb=function(){var e=r(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},l.to.rgb.percent=function(){var e=r(arguments),t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),o=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+n+"%, "+o+"%)":"rgba("+t+"%, "+n+"%, "+o+"%, "+e[3]+")"},l.to.hsl=function(){var e=r(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},l.to.hwb=function(){var e=r(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},l.to.keyword=function(e){return s[e.slice(0,3)]}},97981:(e,t,n)=>{"use strict";var o=n(4569),r=n(61235),i=[].slice,s=["keyword","gray","hex"],a={};Object.keys(r).forEach((function(e){a[i.call(r[e].labels).sort().join("")]=e}));var l={};function c(e,t){if(!(this instanceof c))return new c(e,t);if(t&&t in s&&(t=null),t&&!(t in r))throw new Error("Unknown model: "+t);var n,u;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof c)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"===typeof e){var h=o.get(e);if(null===h)throw new Error("Unable to parse color from string: "+e);this.model=h.model,u=r[this.model].channels,this.color=h.value.slice(0,u),this.valpha="number"===typeof h.value[u]?h.value[u]:1}else if(e.length){this.model=t||"rgb",u=r[this.model].channels;var p=i.call(e,0,u);this.color=d(p,u),this.valpha="number"===typeof e[u]?e[u]:1}else if("number"===typeof e)e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;var f=Object.keys(e);"alpha"in e&&(f.splice(f.indexOf("alpha"),1),this.valpha="number"===typeof e.alpha?e.alpha:0);var g=f.sort().join("");if(!(g in a))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=a[g];var m=r[this.model].labels,b=[];for(n=0;nn?(t+.05)/(n+.05):(n+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return c.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),n=t.color[0];return n=(n=(n+e)%360)<0?360+n:n,t.color[0]=n,t},mix:function(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);var n=e.rgb(),o=this.rgb(),r=void 0===t?.5:t,i=2*r-1,s=n.alpha()-o.alpha(),a=((i*s===-1?i:(i+s)/(1+i*s))+1)/2,l=1-a;return c.rgb(a*n.red()+l*o.red(),a*n.green()+l*o.green(),a*n.blue()+l*o.blue(),n.alpha()*r+o.alpha()*(1-r))}},Object.keys(r).forEach((function(e){if(-1===s.indexOf(e)){var t=r[e].channels;c.prototype[e]=function(){if(this.model===e)return new c(this);if(arguments.length)return new c(arguments,e);var n,o="number"===typeof arguments[t]?t:this.valpha;return new c((n=r[this.model][e].raw(this.color),Array.isArray(n)?n:[n]).concat(o),e)},c[e]=function(n){return"number"===typeof n&&(n=d(i.call(arguments),t)),new c(n,e)}}})),e.exports=c},71224:(e,t)=>{"use strict";t.parse=function(e,t){if("string"!==typeof e)throw new TypeError("argument str must be a string");var n={},o=(t||{}).decode||r,i=0;for(;i-1};function c(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!==typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return o&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:r&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&r&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=f(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),o=0;o-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function v(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),o=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(r))}})),t}function y(e){var t=new d;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),o=n.shift().trim();if(o){var r=n.join(":").trim();t.append(o,r)}})),t}function E(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}T.prototype.clone=function(){return new T(this,{body:this._bodyInit})},b.call(T.prototype),b.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var I=[301,302,303,307,308];E.redirect=function(e,t){if(-1===I.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(w){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,n){return new Promise((function(o,i){var s=new T(e,n);if(s.signal&&s.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function l(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:y(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;o(new E(t,e))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",l),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",l)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}S.polyfill=!0,e.fetch||(e.fetch=S,e.Headers=d,e.Request=T,e.Response=E),t.Headers=d,t.Request=T,t.Response=E,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!==typeof self?self:this)},87610:(e,t,n)=>{"use strict";var o=n(3184),r=n(76759),i=n(12032),s=n(46716);e.exports=function(e,t,n){if(!e||"object"!==typeof e&&"function"!==typeof e)throw new i("`obj` must be an object or a function`");if("string"!==typeof t&&"symbol"!==typeof t)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!==typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!==typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!==typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!==typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],h=!!s&&s(e,t);if(o)o(e,t,{configurable:null===c&&h?h.configurable:!c,enumerable:null===a&&h?h.enumerable:!a,value:n,writable:null===l&&h?h.writable:!l});else{if(!u&&(a||l||c))throw new r("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=n}}},1525:(e,t,n)=>{"use strict";var o=n(42312),r="function"===typeof Symbol&&"symbol"===typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,a=n(87610),l=n(40907)(),c=function(e,t,n,o){if(t in e)if(!0===o){if(e[t]===n)return}else if("function"!==typeof(r=o)||"[object Function]"!==i.call(r)||!o())return;var r;l?a(e,t,n,!0):a(e,t,n)},u=function(e,t){var n=arguments.length>2?arguments[2]:{},i=o(t);r&&(i=s.call(i,Object.getOwnPropertySymbols(t)));for(var a=0;a{"use strict";var o=n(95932)("%Object.defineProperty%",!0)||!1;if(o)try{o({},"a",{value:1})}catch(r){o=!1}e.exports=o},84450:e=>{"use strict";e.exports=EvalError},61218:e=>{"use strict";e.exports=Error},79140:e=>{"use strict";e.exports=RangeError},45915:e=>{"use strict";e.exports=ReferenceError},76759:e=>{"use strict";e.exports=SyntaxError},12032:e=>{"use strict";e.exports=TypeError},78128:e=>{"use strict";e.exports=URIError},42023:(e,t,n)=>{"use strict";var o=n(12032);e.exports=function(e){if(null==e)throw new o(arguments.length>0&&arguments[1]||"Cannot call method on "+e);return e}},13074:(e,t,n)=>{"use strict";var o="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator,r=n(40743),i=n(45325),s=n(76515),a=n(68101);e.exports=function(e){if(r(e))return e;var t,n="default";if(arguments.length>1&&(arguments[1]===String?n="string":arguments[1]===Number&&(n="number")),o&&(Symbol.toPrimitive?t=function(e,t){var n=e[t];if(null!==n&&"undefined"!==typeof n){if(!i(n))throw new TypeError(n+" returned for property "+t+" of object "+e+" is not a function");return n}}(e,Symbol.toPrimitive):a(e)&&(t=Symbol.prototype.valueOf)),"undefined"!==typeof t){var l=t.call(e,n);if(r(l))return l;throw new TypeError("unable to convert exotic object to primitive")}return"default"===n&&(s(e)||a(e))&&(n="string"),function(e,t){if("undefined"===typeof e||null===e)throw new TypeError("Cannot call method on "+e);if("string"!==typeof t||"number"!==t&&"string"!==t)throw new TypeError('hint must be "string" or "number"');var n,o,s,a="string"===t?["toString","valueOf"]:["valueOf","toString"];for(s=0;s{"use strict";e.exports=function(e){return null===e||"function"!==typeof e&&"object"!==typeof e}},16536:function(e,t,n){var o,r,i;r=[],void 0===(i="function"===typeof(o=function(){"use strict";function t(e,t){return"undefined"==typeof t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function o(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){l(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function r(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(o){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var s="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,a=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=s.saveAs||("object"!=typeof window||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(e,t,n){var a=s.URL||s.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?i(l):r(l.href)?o(e,t,n):i(l,l.target="_blank")):(l.href=a.createObjectURL(e),setTimeout((function(){a.revokeObjectURL(l.href)}),4e4),setTimeout((function(){i(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,n,s){if(n=n||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,s),n);else if(r(e))o(e,n,s);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout((function(){i(a)}))}}:function(e,t,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return o(e,t,n);var i="application/octet-stream"===e.type,l=/constructor/i.test(s.HTMLElement)||s.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||i&&l||a)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=function(){var e=u.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},u.readAsDataURL(e)}else{var h=s.URL||s.webkitURL,d=h.createObjectURL(e);r?r.location=d:location.href=d,r=null,setTimeout((function(){h.revokeObjectURL(d)}),4e4)}});s.saveAs=l.saveAs=l,e.exports=l})?o.apply(t,r):o)||(e.exports=i)},20845:(e,t,n)=>{"use strict";var o=n(45325),r=Object.prototype.toString,i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!o(t))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=n),"[object Array]"===r.call(e)?function(e,t,n){for(var o=0,r=e.length;o{"use strict";var t=Object.prototype.toString,n=Math.max,o=function(e,t){for(var n=[],o=0;o{"use strict";var o=n(43958);e.exports=Function.prototype.bind||o},95932:(e,t,n)=>{"use strict";var o,r=n(61218),i=n(84450),s=n(79140),a=n(45915),l=n(76759),c=n(12032),u=n(78128),h=Function,d=function(e){try{return h('"use strict"; return ('+e+").constructor;")()}catch(t){}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch(M){p=null}var f=function(){throw new c},g=p?function(){try{return f}catch(e){try{return p(arguments,"callee").get}catch(t){return f}}}():f,m=n(13290)(),b=n(60713)(),_=Object.getPrototypeOf||(b?function(e){return e.__proto__}:null),T={},v="undefined"!==typeof Uint8Array&&_?_(Uint8Array):o,y={__proto__:null,"%AggregateError%":"undefined"===typeof AggregateError?o:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"===typeof ArrayBuffer?o:ArrayBuffer,"%ArrayIteratorPrototype%":m&&_?_([][Symbol.iterator]()):o,"%AsyncFromSyncIteratorPrototype%":o,"%AsyncFunction%":T,"%AsyncGenerator%":T,"%AsyncGeneratorFunction%":T,"%AsyncIteratorPrototype%":T,"%Atomics%":"undefined"===typeof Atomics?o:Atomics,"%BigInt%":"undefined"===typeof BigInt?o:BigInt,"%BigInt64Array%":"undefined"===typeof BigInt64Array?o:BigInt64Array,"%BigUint64Array%":"undefined"===typeof BigUint64Array?o:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"===typeof DataView?o:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":i,"%Float32Array%":"undefined"===typeof Float32Array?o:Float32Array,"%Float64Array%":"undefined"===typeof Float64Array?o:Float64Array,"%FinalizationRegistry%":"undefined"===typeof FinalizationRegistry?o:FinalizationRegistry,"%Function%":h,"%GeneratorFunction%":T,"%Int8Array%":"undefined"===typeof Int8Array?o:Int8Array,"%Int16Array%":"undefined"===typeof Int16Array?o:Int16Array,"%Int32Array%":"undefined"===typeof Int32Array?o:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&_?_(_([][Symbol.iterator]())):o,"%JSON%":"object"===typeof JSON?JSON:o,"%Map%":"undefined"===typeof Map?o:Map,"%MapIteratorPrototype%":"undefined"!==typeof Map&&m&&_?_((new Map)[Symbol.iterator]()):o,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"===typeof Promise?o:Promise,"%Proxy%":"undefined"===typeof Proxy?o:Proxy,"%RangeError%":s,"%ReferenceError%":a,"%Reflect%":"undefined"===typeof Reflect?o:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"===typeof Set?o:Set,"%SetIteratorPrototype%":"undefined"!==typeof Set&&m&&_?_((new Set)[Symbol.iterator]()):o,"%SharedArrayBuffer%":"undefined"===typeof SharedArrayBuffer?o:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&_?_(""[Symbol.iterator]()):o,"%Symbol%":m?Symbol:o,"%SyntaxError%":l,"%ThrowTypeError%":g,"%TypedArray%":v,"%TypeError%":c,"%Uint8Array%":"undefined"===typeof Uint8Array?o:Uint8Array,"%Uint8ClampedArray%":"undefined"===typeof Uint8ClampedArray?o:Uint8ClampedArray,"%Uint16Array%":"undefined"===typeof Uint16Array?o:Uint16Array,"%Uint32Array%":"undefined"===typeof Uint32Array?o:Uint32Array,"%URIError%":u,"%WeakMap%":"undefined"===typeof WeakMap?o:WeakMap,"%WeakRef%":"undefined"===typeof WeakRef?o:WeakRef,"%WeakSet%":"undefined"===typeof WeakSet?o:WeakSet};if(_)try{null.error}catch(M){var E=_(_(M));y["%Error.prototype%"]=E}var I=function e(t){var n;if("%AsyncFunction%"===t)n=d("async function () {}");else if("%GeneratorFunction%"===t)n=d("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=d("async function* () {}");else if("%AsyncGenerator%"===t){var o=e("%AsyncGeneratorFunction%");o&&(n=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var r=e("%AsyncGenerator%");r&&_&&(n=_(r.prototype))}return y[t]=n,n},S={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},w=n(22142),C=n(1518),k=w.call(Function.call,Array.prototype.concat),$=w.call(Function.apply,Array.prototype.splice),A=w.call(Function.call,String.prototype.replace),O=w.call(Function.call,String.prototype.slice),R=w.call(Function.call,RegExp.prototype.exec),x=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,L=/\\(\\)?/g,N=function(e,t){var n,o=e;if(C(S,o)&&(o="%"+(n=S[o])[0]+"%"),C(y,o)){var r=y[o];if(r===T&&(r=I(o)),"undefined"===typeof r&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:o,value:r}}throw new l("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!==typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!==typeof t)throw new c('"allowMissing" argument must be a boolean');if(null===R(/^%?[^%]*%?$/,e))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(e){var t=O(e,0,1),n=O(e,-1);if("%"===t&&"%"!==n)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new l("invalid intrinsic syntax, expected opening `%`");var o=[];return A(e,x,(function(e,t,n,r){o[o.length]=n?A(r,L,"$1"):t||e})),o}(e),o=n.length>0?n[0]:"",r=N("%"+o+"%",t),i=r.name,s=r.value,a=!1,u=r.alias;u&&(o=u[0],$(n,k([0,1],u)));for(var h=1,d=!0;h=n.length){var b=p(s,f);s=(d=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:s[f]}else d=C(s,f),s=s[f];d&&!a&&(y[i]=s)}}return s}},46716:(e,t,n)=>{"use strict";var o=n(95932)("%Object.getOwnPropertyDescriptor%",!0);if(o)try{o([],"length")}catch(r){o=null}e.exports=o},40907:(e,t,n)=>{"use strict";var o=n(3184),r=function(){return!!o};r.hasArrayLengthDefineBug=function(){if(!o)return null;try{return 1!==o([],"length",{value:1}).length}catch(e){return!0}},e.exports=r},60713:e=>{"use strict";var t={__proto__:null,foo:{}},n=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof n)}},13290:(e,t,n)=>{"use strict";var o="undefined"!==typeof Symbol&&Symbol,r=n(1488);e.exports=function(){return"function"===typeof o&&("function"===typeof Symbol&&("symbol"===typeof o("foo")&&("symbol"===typeof Symbol("bar")&&r())))}},1488:e=>{"use strict";e.exports=function(){if("function"!==typeof Symbol||"function"!==typeof Object.getOwnPropertySymbols)return!1;if("symbol"===typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"===typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"===typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"===typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var o=Object.getOwnPropertySymbols(e);if(1!==o.length||o[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"===typeof Object.getOwnPropertyDescriptor){var r=Object.getOwnPropertyDescriptor(e,t);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},61885:(e,t,n)=>{"use strict";var o=n(1488);e.exports=function(){return o()&&!!Symbol.toStringTag}},1518:(e,t,n)=>{"use strict";var o=Function.prototype.call,r=Object.prototype.hasOwnProperty,i=n(22142);e.exports=i.call(o,r)},22341:(e,t,n)=>{"use strict";var o=n(30325),r={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function l(e){return o.isMemo(e)?s:a[e.$$typeof]||r}a[o.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[o.Memo]=s;var c=Object.defineProperty,u=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,f=Object.prototype;e.exports=function e(t,n,o){if("string"!==typeof n){if(f){var r=p(n);r&&r!==f&&e(t,r,o)}var s=u(n);h&&(s=s.concat(h(n)));for(var a=l(t),g=l(n),m=0;m{"use strict";var n="function"===typeof Symbol&&Symbol.for,o=n?Symbol.for("react.element"):60103,r=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,a=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,p=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,_=n?Symbol.for("react.fundamental"):60117,T=n?Symbol.for("react.responder"):60118,v=n?Symbol.for("react.scope"):60119;function y(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case u:case h:case i:case a:case s:case p:return e;default:switch(e=e&&e.$$typeof){case c:case d:case m:case g:case l:return e;default:return t}}case r:return t}}}function E(e){return y(e)===h}t.AsyncMode=u,t.ConcurrentMode=h,t.ContextConsumer=c,t.ContextProvider=l,t.Element=o,t.ForwardRef=d,t.Fragment=i,t.Lazy=m,t.Memo=g,t.Portal=r,t.Profiler=a,t.StrictMode=s,t.Suspense=p,t.isAsyncMode=function(e){return E(e)||y(e)===u},t.isConcurrentMode=E,t.isContextConsumer=function(e){return y(e)===c},t.isContextProvider=function(e){return y(e)===l},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return y(e)===d},t.isFragment=function(e){return y(e)===i},t.isLazy=function(e){return y(e)===m},t.isMemo=function(e){return y(e)===g},t.isPortal=function(e){return y(e)===r},t.isProfiler=function(e){return y(e)===a},t.isStrictMode=function(e){return y(e)===s},t.isSuspense=function(e){return y(e)===p},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===i||e===h||e===a||e===s||e===p||e===f||"object"===typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===g||e.$$typeof===l||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===T||e.$$typeof===v||e.$$typeof===b)},t.typeOf=y},30325:(e,t,n)=>{"use strict";e.exports=n(42329)},12519:(e,t,n)=>{"use strict";var o=n(88110),r=n(73374),i=n(95932)("%ArrayBuffer%",!0),s=r("ArrayBuffer.prototype.byteLength",!0),a=r("Object.prototype.toString"),l=!!i&&!s&&new i(0).slice,c=!!l&&o(l);e.exports=s||c?function(e){if(!e||"object"!==typeof e)return!1;try{return s?s(e):c(e,0),!0}catch(t){return!1}}:i?function(e){return"[object ArrayBuffer]"===a(e)}:function(e){return!1}},45325:e=>{"use strict";var t,n,o=Function.prototype.toString,r="object"===typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"===typeof r&&"function"===typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw n}}),n={},r((function(){throw 42}),null,t)}catch(p){p!==n&&(r=null)}else r=null;var i=/^\s*class\b/,s=function(e){try{var t=o.call(e);return i.test(t)}catch(n){return!1}},a=function(e){try{return!s(e)&&(o.call(e),!0)}catch(t){return!1}},l=Object.prototype.toString,c="function"===typeof Symbol&&!!Symbol.toStringTag,u=!(0 in[,]),h=function(){return!1};if("object"===typeof document){var d=document.all;l.call(d)===l.call(document.all)&&(h=function(e){if((u||!e)&&("undefined"===typeof e||"object"===typeof e))try{var t=l.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(n){}return!1})}e.exports=r?function(e){if(h(e))return!0;if(!e)return!1;if("function"!==typeof e&&"object"!==typeof e)return!1;try{r(e,null,t)}catch(o){if(o!==n)return!1}return!s(e)&&a(e)}:function(e){if(h(e))return!0;if(!e)return!1;if("function"!==typeof e&&"object"!==typeof e)return!1;if(c)return a(e);if(s(e))return!1;var t=l.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&a(e)}},76515:(e,t,n)=>{"use strict";var o=Date.prototype.getDay,r=Object.prototype.toString,i=n(61885)();e.exports=function(e){return"object"===typeof e&&null!==e&&(i?function(e){try{return o.call(e),!0}catch(t){return!1}}(e):"[object Date]"===r.call(e))}},49020:(e,t,n)=>{"use strict";var o,r,i,s,a=n(73374),l=n(61885)();if(l){o=a("Object.prototype.hasOwnProperty"),r=a("RegExp.prototype.exec"),i={};var c=function(){throw i};s={toString:c,valueOf:c},"symbol"===typeof Symbol.toPrimitive&&(s[Symbol.toPrimitive]=c)}var u=a("Object.prototype.toString"),h=Object.getOwnPropertyDescriptor;e.exports=l?function(e){if(!e||"object"!==typeof e)return!1;var t=h(e,"lastIndex");if(!(t&&o(t,"value")))return!1;try{r(e,s)}catch(n){return n===i}}:function(e){return!(!e||"object"!==typeof e&&"function"!==typeof e)&&"[object RegExp]"===u(e)}},24265:(e,t,n)=>{"use strict";var o=n(73374)("SharedArrayBuffer.prototype.byteLength",!0);e.exports=o?function(e){if(!e||"object"!==typeof e)return!1;try{return o(e),!0}catch(t){return!1}}:function(e){return!1}},68101:(e,t,n)=>{"use strict";var o=Object.prototype.toString;if(n(13290)()){var r=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;e.exports=function(e){if("symbol"===typeof e)return!0;if("[object Symbol]"!==o.call(e))return!1;try{return function(e){return"symbol"===typeof e.valueOf()&&i.test(r.call(e))}(e)}catch(t){return!1}}}else e.exports=function(e){return!1}},3755:(e,t,n)=>{"use strict";var o=n(30302);e.exports=function(e){return!!o(e)}},51811:e=>{var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},75114:(e,t,n)=>{var o="Expected a function",r="__lodash_placeholder__",i=1,s=2,a=4,l=8,c=16,u=32,h=64,d=128,p=512,f=1/0,g=9007199254740991,m=17976931348623157e292,b=NaN,_=[["ary",d],["bind",i],["bindKey",s],["curry",l],["curryRight",c],["flip",p],["partial",u],["partialRight",h],["rearg",256]],T="[object Function]",v="[object GeneratorFunction]",y="[object Symbol]",E=/^\s+|\s+$/g,I=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,S=/\{\n\/\* \[wrapped with (.+)\] \*/,w=/,? & /,C=/^[-+]0x[0-9a-f]+$/i,k=/^0b[01]+$/i,$=/^\[object .+?Constructor\]$/,A=/^0o[0-7]+$/i,O=/^(?:0|[1-9]\d*)$/,R=parseInt,x="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,L="object"==typeof self&&self&&self.Object===Object&&self,N=x||L||Function("return this")();function M(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function D(e,t){return!!(e?e.length:0)&&function(e,t,n){if(t!==t)return function(e,t,n,o){var r=e.length,i=n+(o?1:-1);for(;o?i--:++i-1}function P(e){return e!==e}function B(e,t){for(var n=-1,o=e.length,i=0,s=[];++n2?e:void 0}();function q(e){if(!ue(e)||(t=e,G&&G in t))return!1;var t,n=function(e){var t=ue(e)?j.call(e):"";return t==T||t==v}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}(e)?z:$;return n.test(function(e){if(null!=e){try{return V.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e))}function Z(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n,o=ue(n=e.prototype)?X(n):{},r=e.apply(o,t);return ue(r)?r:o}}function Q(e,t,n,o,r,a,u,h,f,g){var m=t&d,b=t&i,_=t&s,T=t&(l|c),v=t&p,y=_?void 0:Z(e);return function i(){for(var s=arguments.length,l=Array(s),c=s;c--;)l[c]=arguments[c];if(T)var d=ne(i),p=function(e,t){for(var n=e.length,o=0;n--;)e[n]===t&&o++;return o}(l,d);if(o&&(l=function(e,t,n,o){for(var r=-1,i=e.length,s=n.length,a=-1,l=t.length,c=Y(i-s,0),u=Array(l+c),h=!o;++a1&&l.reverse(),m&&f1?"& ":"")+t[o],t=t.join(n>2?", ":" "),e.replace(I,"{\n/* [wrapped with "+t+"] */\n")}function se(e,t){return!!(t=null==t?g:t)&&("number"==typeof e||O.test(e))&&e>-1&&e%1==0&&e{var o=n(7765),r=n(37445),i=n(17356),s=n(77576),a=n(10536);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var o=n(8277),r=n(32261),i=n(97676),s=n(8936),a=n(85512);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var o=n(51615)(n(13674),"Map");e.exports=o},39230:(e,t,n)=>{var o=n(61285),r=n(98165),i=n(82332),s=n(77240),a=n(3352);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var o=n(13674).Symbol;e.exports=o},61715:e=>{e.exports=function(e,t){for(var n=-1,o=null==e?0:e.length,r=Array(o);++n{var o=n(34953);e.exports=function(e,t){for(var n=e.length;n--;)if(o(e[n][0],t))return n;return-1}},17919:(e,t,n)=>{var o=n(1594),r=n(5820);e.exports=function(e,t){for(var n=0,i=(t=o(t,e)).length;null!=e&&n{var o=n(24590),r=n(51154),i=n(77313),s=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?r(e):i(e)}},91252:(e,t,n)=>{var o=n(32827),r=n(81939),i=n(81688),s=n(77342),a=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,u=l.toString,h=c.hasOwnProperty,d=RegExp("^"+u.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||r(e))&&(o(e)?d:a).test(s(e))}},43815:(e,t,n)=>{var o=n(24590),r=n(61715),i=n(13890),s=n(71423),a=o?o.prototype:void 0,l=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return r(t,e)+"";if(s(t))return l?l.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},1594:(e,t,n)=>{var o=n(13890),r=n(18759),i=n(44625),s=n(36039);e.exports=function(e,t){return o(e)?e:r(e,t)?[e]:i(s(e))}},18082:(e,t,n)=>{var o=n(13674)["__core-js_shared__"];e.exports=o},15139:(e,t,n)=>{var o="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=o},9968:(e,t,n)=>{var o=n(11679);e.exports=function(e,t){var n=e.__data__;return o(t)?n["string"==typeof t?"string":"hash"]:n.map}},51615:(e,t,n)=>{var o=n(91252),r=n(19911);e.exports=function(e,t){var n=r(e,t);return o(n)?n:void 0}},51154:(e,t,n)=>{var o=n(24590),r=Object.prototype,i=r.hasOwnProperty,s=r.toString,a=o?o.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var o=!0}catch(l){}var r=s.call(e);return o&&(t?e[a]=n:delete e[a]),r}},19911:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},7765:(e,t,n)=>{var o=n(13229);e.exports=function(){this.__data__=o?o(null):{},this.size=0}},37445:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},17356:(e,t,n)=>{var o=n(13229),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(o){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return r.call(t,e)?t[e]:void 0}},77576:(e,t,n)=>{var o=n(13229),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return o?void 0!==t[e]:r.call(t,e)}},10536:(e,t,n)=>{var o=n(13229);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=o&&void 0===t?"__lodash_hash_undefined__":t,this}},18759:(e,t,n)=>{var o=n(13890),r=n(71423),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=function(e,t){if(o(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!r(e))||(s.test(e)||!i.test(e)||null!=t&&e in Object(t))}},11679:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},81939:(e,t,n)=>{var o=n(18082),r=function(){var e=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=function(e){return!!r&&r in e}},8277:e=>{e.exports=function(){this.__data__=[],this.size=0}},32261:(e,t,n)=>{var o=n(15630),r=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=o(t,e);return!(n<0)&&(n==t.length-1?t.pop():r.call(t,n,1),--this.size,!0)}},97676:(e,t,n)=>{var o=n(15630);e.exports=function(e){var t=this.__data__,n=o(t,e);return n<0?void 0:t[n][1]}},8936:(e,t,n)=>{var o=n(15630);e.exports=function(e){return o(this.__data__,e)>-1}},85512:(e,t,n)=>{var o=n(15630);e.exports=function(e,t){var n=this.__data__,r=o(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}},61285:(e,t,n)=>{var o=n(63598),r=n(36718),i=n(1358);e.exports=function(){this.size=0,this.__data__={hash:new o,map:new(i||r),string:new o}}},98165:(e,t,n)=>{var o=n(9968);e.exports=function(e){var t=o(this,e).delete(e);return this.size-=t?1:0,t}},82332:(e,t,n)=>{var o=n(9968);e.exports=function(e){return o(this,e).get(e)}},77240:(e,t,n)=>{var o=n(9968);e.exports=function(e){return o(this,e).has(e)}},3352:(e,t,n)=>{var o=n(9968);e.exports=function(e,t){var n=o(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}},83001:(e,t,n)=>{var o=n(71255);e.exports=function(e){var t=o(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},13229:(e,t,n)=>{var o=n(51615)(Object,"create");e.exports=o},77313:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},13674:(e,t,n)=>{var o=n(15139),r="object"==typeof self&&self&&self.Object===Object&&self,i=o||r||Function("return this")();e.exports=i},44625:(e,t,n)=>{var o=n(83001),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=o((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(r,(function(e,n,o,r){t.push(o?r.replace(i,"$1"):n||e)})),t}));e.exports=s},5820:(e,t,n)=>{var o=n(71423);e.exports=function(e){if("string"==typeof e||o(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},77342:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(n){}try{return e+""}catch(n){}}return""}},34953:e=>{e.exports=function(e,t){return e===t||e!==e&&t!==t}},97727:(e,t,n)=>{var o=n(17919);e.exports=function(e,t,n){var r=null==e?void 0:o(e,t);return void 0===r?n:r}},13890:e=>{var t=Array.isArray;e.exports=t},32827:(e,t,n)=>{var o=n(94039),r=n(81688);e.exports=function(e){if(!r(e))return!1;var t=o(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},81688:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},5567:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},71423:(e,t,n)=>{var o=n(94039),r=n(5567);e.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==o(e)}},71255:(e,t,n)=>{var o=n(39230);function r(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var o=arguments,r=t?t.apply(this,o):o[0],i=n.cache;if(i.has(r))return i.get(r);var s=e.apply(this,o);return n.cache=i.set(r,s)||i,s};return n.cache=new(r.Cache||o),n}r.Cache=o,e.exports=r},36039:(e,t,n)=>{var o=n(43815);e.exports=function(e){return null==e?"":o(e)}},20392:(e,t,n)=>{var o="function"===typeof Map&&Map.prototype,r=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=o&&r&&"function"===typeof r.get?r.get:null,s=o&&Map.prototype.forEach,a="function"===typeof Set&&Set.prototype,l=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=a&&l&&"function"===typeof l.get?l.get:null,u=a&&Set.prototype.forEach,h="function"===typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"===typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"===typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,g=Object.prototype.toString,m=Function.prototype.toString,b=String.prototype.match,_=String.prototype.slice,T=String.prototype.replace,v=String.prototype.toUpperCase,y=String.prototype.toLowerCase,E=RegExp.prototype.test,I=Array.prototype.concat,S=Array.prototype.join,w=Array.prototype.slice,C=Math.floor,k="function"===typeof BigInt?BigInt.prototype.valueOf:null,$=Object.getOwnPropertySymbols,A="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?Symbol.prototype.toString:null,O="function"===typeof Symbol&&"object"===typeof Symbol.iterator,R="function"===typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===O||"symbol")?Symbol.toStringTag:null,x=Object.prototype.propertyIsEnumerable,L=("function"===typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function N(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||E.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"===typeof e){var o=e<0?-C(-e):C(e);if(o!==e){var r=String(o),i=_.call(t,r.length+1);return T.call(r,n,"$&_")+"."+T.call(T.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return T.call(t,n,"$&_")}var M=n(42634),D=M.custom,P=G(D)?D:null;function B(e,t,n){var o="double"===(n.quoteStyle||t)?'"':"'";return o+e+o}function F(e){return T.call(String(e),/"/g,""")}function U(e){return"[object Array]"===j(e)&&(!R||!("object"===typeof e&&R in e))}function H(e){return"[object RegExp]"===j(e)&&(!R||!("object"===typeof e&&R in e))}function G(e){if(O)return e&&"object"===typeof e&&e instanceof Symbol;if("symbol"===typeof e)return!0;if(!e||"object"!==typeof e||!A)return!1;try{return A.call(e),!0}catch(t){}return!1}e.exports=function e(t,o,r,a){var l=o||{};if(W(l,"quoteStyle")&&"single"!==l.quoteStyle&&"double"!==l.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(W(l,"maxStringLength")&&("number"===typeof l.maxStringLength?l.maxStringLength<0&&l.maxStringLength!==1/0:null!==l.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var g=!W(l,"customInspect")||l.customInspect;if("boolean"!==typeof g&&"symbol"!==g)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(W(l,"indent")&&null!==l.indent&&"\t"!==l.indent&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(W(l,"numericSeparator")&&"boolean"!==typeof l.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var v=l.numericSeparator;if("undefined"===typeof t)return"undefined";if(null===t)return"null";if("boolean"===typeof t)return t?"true":"false";if("string"===typeof t)return X(t,l);if("number"===typeof t){if(0===t)return 1/0/t>0?"0":"-0";var E=String(t);return v?N(t,E):E}if("bigint"===typeof t){var C=String(t)+"n";return v?N(t,C):C}var $="undefined"===typeof l.depth?5:l.depth;if("undefined"===typeof r&&(r=0),r>=$&&$>0&&"object"===typeof t)return U(t)?"[Array]":"[Object]";var D=function(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"===typeof e.indent&&e.indent>0))return null;n=S.call(Array(e.indent+1)," ")}return{base:n,prev:S.call(Array(t+1),n)}}(l,r);if("undefined"===typeof a)a=[];else if(z(a,t)>=0)return"[Circular]";function V(t,n,o){if(n&&(a=w.call(a)).push(n),o){var i={depth:l.depth};return W(l,"quoteStyle")&&(i.quoteStyle=l.quoteStyle),e(t,i,r+1,a)}return e(t,l,r+1,a)}if("function"===typeof t&&!H(t)){var Y=function(e){if(e.name)return e.name;var t=b.call(m.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),ee=Q(t,V);return"[Function"+(Y?": "+Y:" (anonymous)")+"]"+(ee.length>0?" { "+S.call(ee,", ")+" }":"")}if(G(t)){var te=O?T.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):A.call(t);return"object"!==typeof t||O?te:K(te)}if(function(e){if(!e||"object"!==typeof e)return!1;if("undefined"!==typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"===typeof e.nodeName&&"function"===typeof e.getAttribute}(t)){for(var ne="<"+y.call(String(t.nodeName)),oe=t.attributes||[],re=0;re"}if(U(t)){if(0===t.length)return"[]";var ie=Q(t,V);return D&&!function(e){for(var t=0;t=0)return!1;return!0}(ie)?"["+Z(ie,D)+"]":"[ "+S.call(ie,", ")+" ]"}if(function(e){return"[object Error]"===j(e)&&(!R||!("object"===typeof e&&R in e))}(t)){var se=Q(t,V);return"cause"in Error.prototype||!("cause"in t)||x.call(t,"cause")?0===se.length?"["+String(t)+"]":"{ ["+String(t)+"] "+S.call(se,", ")+" }":"{ ["+String(t)+"] "+S.call(I.call("[cause]: "+V(t.cause),se),", ")+" }"}if("object"===typeof t&&g){if(P&&"function"===typeof t[P]&&M)return M(t,{depth:$-r});if("symbol"!==g&&"function"===typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!==typeof e)return!1;try{i.call(e);try{c.call(e)}catch(ne){return!0}return e instanceof Map}catch(t){}return!1}(t)){var ae=[];return s&&s.call(t,(function(e,n){ae.push(V(n,t,!0)+" => "+V(e,t))})),q("Map",i.call(t),ae,D)}if(function(e){if(!c||!e||"object"!==typeof e)return!1;try{c.call(e);try{i.call(e)}catch(t){return!0}return e instanceof Set}catch(n){}return!1}(t)){var le=[];return u&&u.call(t,(function(e){le.push(V(e,t))})),q("Set",c.call(t),le,D)}if(function(e){if(!h||!e||"object"!==typeof e)return!1;try{h.call(e,h);try{d.call(e,d)}catch(ne){return!0}return e instanceof WeakMap}catch(t){}return!1}(t))return J("WeakMap");if(function(e){if(!d||!e||"object"!==typeof e)return!1;try{d.call(e,d);try{h.call(e,h)}catch(ne){return!0}return e instanceof WeakSet}catch(t){}return!1}(t))return J("WeakSet");if(function(e){if(!p||!e||"object"!==typeof e)return!1;try{return p.call(e),!0}catch(t){}return!1}(t))return J("WeakRef");if(function(e){return"[object Number]"===j(e)&&(!R||!("object"===typeof e&&R in e))}(t))return K(V(Number(t)));if(function(e){if(!e||"object"!==typeof e||!k)return!1;try{return k.call(e),!0}catch(t){}return!1}(t))return K(V(k.call(t)));if(function(e){return"[object Boolean]"===j(e)&&(!R||!("object"===typeof e&&R in e))}(t))return K(f.call(t));if(function(e){return"[object String]"===j(e)&&(!R||!("object"===typeof e&&R in e))}(t))return K(V(String(t)));if("undefined"!==typeof window&&t===window)return"{ [object Window] }";if(t===n.g)return"{ [object globalThis] }";if(!function(e){return"[object Date]"===j(e)&&(!R||!("object"===typeof e&&R in e))}(t)&&!H(t)){var ce=Q(t,V),ue=L?L(t)===Object.prototype:t instanceof Object||t.constructor===Object,he=t instanceof Object?"":"null prototype",de=!ue&&R&&Object(t)===t&&R in t?_.call(j(t),8,-1):he?"Object":"",pe=(ue||"function"!==typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(de||he?"["+S.call(I.call([],de||[],he||[]),": ")+"] ":"");return 0===ce.length?pe+"{}":D?pe+"{"+Z(ce,D)+"}":pe+"{ "+S.call(ce,", ")+" }"}return String(t)};var V=Object.prototype.hasOwnProperty||function(e){return e in this};function W(e,t){return V.call(e,t)}function j(e){return g.call(e)}function z(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,o=e.length;nt.maxStringLength){var n=e.length-t.maxStringLength,o="... "+n+" more character"+(n>1?"s":"");return X(_.call(e,0,t.maxStringLength),t)+o}return B(T.call(T.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Y),"single",t)}function Y(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+v.call(t.toString(16))}function K(e){return"Object("+e+")"}function J(e){return e+" { ? }"}function q(e,t,n,o){return e+" ("+t+") {"+(o?Z(n,o):S.call(n,", "))+"}"}function Z(e,t){if(0===e.length)return"";var n="\n"+t.prev+t.base;return n+S.call(e,","+n)+"\n"+t.prev}function Q(e,t){var n=U(e),o=[];if(n){o.length=e.length;for(var r=0;r{"use strict";var o;if(!Object.keys){var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=n(16268),a=Object.prototype.propertyIsEnumerable,l=!a.call({toString:null},"toString"),c=a.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(e){var t=e.constructor;return t&&t.prototype===e},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"===typeof window)return!1;for(var e in window)try{if(!d["$"+e]&&r.call(window,e)&&null!==window[e]&&"object"===typeof window[e])try{h(window[e])}catch(t){return!0}}catch(t){return!0}return!1}();o=function(e){var t=null!==e&&"object"===typeof e,n="[object Function]"===i.call(e),o=s(e),a=t&&"[object String]"===i.call(e),d=[];if(!t&&!n&&!o)throw new TypeError("Object.keys called on a non-object");var f=c&&n;if(a&&e.length>0&&!r.call(e,0))for(var g=0;g0)for(var m=0;m{"use strict";var o=Array.prototype.slice,r=n(16268),i=Object.keys,s=i?function(e){return i(e)}:n(80012),a=Object.keys;s.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return r(e)?a(o.call(e)):a(e)})}else Object.keys=s;return Object.keys||s},e.exports=s},16268:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var n=t.call(e),o="[object Arguments]"===n;return o||(o="[object Array]"!==n&&null!==e&&"object"===typeof e&&"number"===typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),o}},31177:e=>{"use strict";e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},73306:e=>{"use strict";var t=String.prototype.replace,n=/%20/g,o="RFC1738",r="RFC3986";e.exports={default:r,formatters:{RFC1738:function(e){return t.call(e,n,"+")},RFC3986:function(e){return String(e)}},RFC1738:o,RFC3986:r}},63966:(e,t,n)=>{"use strict";var o=n(47843),r=n(57261),i=n(73306);e.exports={formats:i,parse:r,stringify:o}},57261:(e,t,n)=>{"use strict";var o=n(31439),r=Object.prototype.hasOwnProperty,i=Array.isArray,s={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:o.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},l=function(e,t){return e&&"string"===typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},c=function(e,t,n,o){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/g,a=n.depth>0&&/(\[[^[\]]*])/.exec(i),c=a?i.slice(0,a.index):i,u=[];if(c){if(!n.plainObjects&&r.call(Object.prototype,c)&&!n.allowPrototypes)return;u.push(c)}for(var h=0;n.depth>0&&null!==(a=s.exec(i))&&h=0;--i){var s,a=e[i];if("[]"===a&&n.parseArrays)s=n.allowEmptyArrays&&""===r?[]:[].concat(r);else{s=n.plainObjects?Object.create(null):{};var c="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,u=n.decodeDotInKeys?c.replace(/%2E/g,"."):c,h=parseInt(u,10);n.parseArrays||""!==u?!isNaN(h)&&a!==u&&String(h)===u&&h>=0&&n.parseArrays&&h<=n.arrayLimit?(s=[])[h]=r:"__proto__"!==u&&(s[u]=r):s={0:r}}r=s}return r}(u,t,n,o)}};e.exports=function(e,t){var n=function(e){if(!e)return s;if("undefined"!==typeof e.allowEmptyArrays&&"boolean"!==typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if("undefined"!==typeof e.decodeDotInKeys&&"boolean"!==typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&"undefined"!==typeof e.decoder&&"function"!==typeof e.decoder)throw new TypeError("Decoder has to be a function.");if("undefined"!==typeof e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t="undefined"===typeof e.charset?s.charset:e.charset,n="undefined"===typeof e.duplicates?s.duplicates:e.duplicates;if("combine"!==n&&"first"!==n&&"last"!==n)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:"undefined"===typeof e.allowDots?!0===e.decodeDotInKeys||s.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"===typeof e.allowEmptyArrays?!!e.allowEmptyArrays:s.allowEmptyArrays,allowPrototypes:"boolean"===typeof e.allowPrototypes?e.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"===typeof e.allowSparse?e.allowSparse:s.allowSparse,arrayLimit:"number"===typeof e.arrayLimit?e.arrayLimit:s.arrayLimit,charset:t,charsetSentinel:"boolean"===typeof e.charsetSentinel?e.charsetSentinel:s.charsetSentinel,comma:"boolean"===typeof e.comma?e.comma:s.comma,decodeDotInKeys:"boolean"===typeof e.decodeDotInKeys?e.decodeDotInKeys:s.decodeDotInKeys,decoder:"function"===typeof e.decoder?e.decoder:s.decoder,delimiter:"string"===typeof e.delimiter||o.isRegExp(e.delimiter)?e.delimiter:s.delimiter,depth:"number"===typeof e.depth||!1===e.depth?+e.depth:s.depth,duplicates:n,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"===typeof e.interpretNumericEntities?e.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"===typeof e.parameterLimit?e.parameterLimit:s.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"===typeof e.plainObjects?e.plainObjects:s.plainObjects,strictNullHandling:"boolean"===typeof e.strictNullHandling?e.strictNullHandling:s.strictNullHandling}}(t);if(""===e||null===e||"undefined"===typeof e)return n.plainObjects?Object.create(null):{};for(var u="string"===typeof e?function(e,t){var n,c={__proto__:null},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,h=t.parameterLimit===1/0?void 0:t.parameterLimit,d=u.split(t.delimiter,h),p=-1,f=t.charset;if(t.charsetSentinel)for(n=0;n-1&&(m=i(m)?[m]:m);var v=r.call(c,g);v&&"combine"===t.duplicates?c[g]=o.combine(c[g],m):v&&"last"!==t.duplicates||(c[g]=m)}return c}(e,n):e,h=n.plainObjects?Object.create(null):{},d=Object.keys(u),p=0;p{"use strict";var o=n(93547),r=n(31439),i=n(73306),s=Object.prototype.hasOwnProperty,a={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},l=Array.isArray,c=Array.prototype.push,u=function(e,t){c.apply(e,l(t)?t:[t])},h=Date.prototype.toISOString,d=i.default,p={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:r.encode,encodeValuesOnly:!1,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return h.call(e)},skipNulls:!1,strictNullHandling:!1},f={},g=function e(t,n,i,s,a,c,h,d,g,m,b,_,T,v,y,E,I,S){for(var w,C=t,k=S,$=0,A=!1;void 0!==(k=k.get(f))&&!A;){var O=k.get(t);if($+=1,"undefined"!==typeof O){if(O===$)throw new RangeError("Cyclic object value");A=!0}"undefined"===typeof k.get(f)&&($=0)}if("function"===typeof m?C=m(n,C):C instanceof Date?C=T(C):"comma"===i&&l(C)&&(C=r.maybeMap(C,(function(e){return e instanceof Date?T(e):e}))),null===C){if(c)return g&&!E?g(n,p.encoder,I,"key",v):n;C=""}if("string"===typeof(w=C)||"number"===typeof w||"boolean"===typeof w||"symbol"===typeof w||"bigint"===typeof w||r.isBuffer(C))return g?[y(E?n:g(n,p.encoder,I,"key",v))+"="+y(g(C,p.encoder,I,"value",v))]:[y(n)+"="+y(String(C))];var R,x=[];if("undefined"===typeof C)return x;if("comma"===i&&l(C))E&&g&&(C=r.maybeMap(C,g)),R=[{value:C.length>0?C.join(",")||null:void 0}];else if(l(m))R=m;else{var L=Object.keys(C);R=b?L.sort(b):L}var N=d?n.replace(/\./g,"%2E"):n,M=s&&l(C)&&1===C.length?N+"[]":N;if(a&&l(C)&&0===C.length)return M+"[]";for(var D=0;D0?v+T:""}},31439:(e,t,n)=>{"use strict";var o=n(73306),r=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},o=0;o1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var o=[],r=0;r=l?a.slice(u,u+l):a,d=[],p=0;p=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||i===o.RFC1738&&(40===f||41===f)?d[d.length]=h.charAt(p):f<128?d[d.length]=s[f]:f<2048?d[d.length]=s[192|f>>6]+s[128|63&f]:f<55296||f>=57344?d[d.length]=s[224|f>>12]+s[128|f>>6&63]+s[128|63&f]:(p+=1,f=65536+((1023&f)<<10|1023&h.charCodeAt(p)),d[d.length]=s[240|f>>18]+s[128|f>>12&63]+s[128|f>>6&63]+s[128|63&f])}c+=d.join("")}return c},isBuffer:function(e){return!(!e||"object"!==typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var n=[],o=0;o{"use strict";var o=n(27565);function r(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n