// Do not edit this file; automatically generated by gulp. /* eslint-disable */ ;(function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD define([], factory); } else if (typeof exports === 'object') { // Node.js module.exports = factory(); } else { // Browser root.Blockly = factory(); } }(this, function() { 'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(a){return a.raw=a};$jscomp.createTemplateTagFirstArgWithRaw=function(a,b){a.raw=b;return a};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b>>0,$jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE? $jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+c+"$"+e),$jscomp.defineProperty(d,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:b})))}; $jscomp.getConstructImplementation=function(){function a(){function c(){}new c;Reflect.construct(c,[],function(){});return new c instanceof c}if($jscomp.TRUST_ES6_POLYFILLS&&"undefined"!=typeof Reflect&&Reflect.construct){if(a())return Reflect.construct;var b=Reflect.construct;return function(c,d,e){c=b(c,d);e&&Reflect.setPrototypeOf(c,e.prototype);return c}}return function(c,d,e){void 0===e&&(e=c);e=$jscomp.objectCreate(e.prototype||Object.prototype);return Function.prototype.apply.call(c,e,d)|| e}};$jscomp.construct={valueOf:$jscomp.getConstructImplementation}.valueOf();$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},b={};try{return b.__proto__=a,b.a}catch(c){}return!1};$jscomp.setPrototypeOf=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null; $jscomp.inherits=function(a,b){a.prototype=$jscomp.objectCreate(b.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var c=$jscomp.setPrototypeOf;c(a,b)}else for(c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.superClass_=b.prototype};$jscomp.polyfill("Reflect",function(a){return a?a:{}},"es6","es3");$jscomp.polyfill("Reflect.construct",function(a){return $jscomp.construct},"es6","es3"); $jscomp.polyfill("Reflect.setPrototypeOf",function(a){if(a)return a;if($jscomp.setPrototypeOf){var b=$jscomp.setPrototypeOf;return function(c,d){try{return b(c,d),!0}catch(e){return!1}}}return null},"es6","es5");$jscomp.checkStringArgs=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""}; $jscomp.polyfill("String.prototype.startsWith",function(a){return a?a:function(b,c){var d=$jscomp.checkStringArgs(this,b,"startsWith");b+="";var e=d.length,f=b.length;c=Math.max(0,Math.min(c|0,d.length));for(var g=0;g=f}},"es6","es3");$jscomp.polyfill("Object.setPrototypeOf",function(a){return a||$jscomp.setPrototypeOf},"es6","es5");$jscomp.initSymbol=function(){}; $jscomp.polyfill("Symbol",function(a){if(a)return a;var b=function(f,g){this.$jscomp$symbol$id_=f;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:g})};b.prototype.toString=function(){return this.$jscomp$symbol$id_};var c="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",d=0,e=function(f){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new b(c+(f||"")+"_"+d++,f)};return e},"es6","es3"); $jscomp.polyfill("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;cb&&(b=c[d].length);var e=-Infinity,f=1;do{d=e;var g=a;a=[];e=c.length/f;for(var h=1,k=0;kd);return g}, module$contents$Blockly$utils$string_wrapScore=function(a,b,c){for(var d=[0],e=[],f=0;fd&&(d=h,e=g)}return e?module$contents$Blockly$utils$string_wrapMutate(a,e,c):b},module$contents$Blockly$utils$string_wrapToText=function(a,b){for(var c=[],d=0;d=this.left&&a<=this.right&&b>=this.top&&b<=this.bottom};module$exports$Blockly$utils$Rect.prototype.intersects=function(a){return!(this.left>a.right||this.righta.bottom||this.bottoma&&0<=b&&256>b&&0<=c&&256> c)?(0,module$exports$Blockly$utils$colour.rgbToHex)(a,b,c):null},rgbToHex:function(a,b,c){b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)},hexToRgb:function(a){a=(0,module$exports$Blockly$utils$colour.parse)(a);if(!a)return[0,0,0];a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]},hsvToHex:function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=c;else{var g=Math.floor(a/60),h=a/60-g;a=c*(1-b);var k=c*(1-b*h);b=c*(1-b*(1-h));switch(g){case 1:d=k;e=c;f=a;break;case 2:d= a;e=c;f=b;break;case 3:d=a;e=k;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=k;break;case 6:case 0:d=c,e=b,f=a}}return(0,module$exports$Blockly$utils$colour.rgbToHex)(Math.floor(d),Math.floor(e),Math.floor(f))},blend:function(a,b,c){a=(0,module$exports$Blockly$utils$colour.parse)(a);if(!a)return null;b=(0,module$exports$Blockly$utils$colour.parse)(b);if(!b)return null;a=(0,module$exports$Blockly$utils$colour.hexToRgb)(a);b=(0,module$exports$Blockly$utils$colour.hexToRgb)(b);return(0,module$exports$Blockly$utils$colour.rgbToHex)(Math.round(b[0]+ c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2])))},names:{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"},hueToHex:function(a){return(0,module$exports$Blockly$utils$colour.hsvToHex)(a,module$exports$Blockly$internalConstants.HSV_SATURATION,255*module$exports$Blockly$internalConstants.HSV_VALUE)}};var module$exports$Blockly$utils$deprecation={warn:function(a,b,c,d){a=a+" was deprecated on "+b+" and will be deleted on "+c+".";d&&(a+="\nUse "+d+" instead.");console.warn(a)}};var module$exports$Blockly$utils$idGenerator={TEST_ONLY:{}},module$contents$Blockly$utils$idGenerator_nextId=0;module$exports$Blockly$utils$idGenerator.getNextUniqueId=function(){return"blockly-"+(module$contents$Blockly$utils$idGenerator_nextId++).toString(36)};var module$contents$Blockly$utils$idGenerator_soup="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; module$exports$Blockly$utils$idGenerator.TEST_ONLY.genUid=function(){for(var a=module$contents$Blockly$utils$idGenerator_soup.length,b=[],c=0;20>c;c++)b[c]=module$contents$Blockly$utils$idGenerator_soup.charAt(Math.random()*a);return b.join("")};module$exports$Blockly$utils$idGenerator.genUid=function(){return module$exports$Blockly$utils$idGenerator.TEST_ONLY.genUid()};var module$exports$Blockly$utils$math={toRadians:function(a){return a*Math.PI/180},toDegrees:function(a){return 180*a/Math.PI},clamp:function(a,b,c){if(c/g,"<$1$2>")};module$exports$Blockly$Xml.domToPrettyText=function(a){a=(0,module$exports$Blockly$Xml.domToText)(a).split("<");for(var b="",c=1;c"!=d.slice(-2)&&(b+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1");return a.replace(/^\n/,"")}; module$exports$Blockly$Xml.textToDom=function(a){var b=(0,module$exports$Blockly$utils$xml.textToDomDocument)(a);if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return b.documentElement};module$exports$Blockly$Xml.clearWorkspaceAndLoadFromXml=function(a,b){b.setResizesEnabled(!1);b.clear();a=(0,module$exports$Blockly$Xml.domToWorkspace)(a,b);b.setResizesEnabled(!0);return a}; module$exports$Blockly$Xml.domToWorkspace=function(a,b){if(a instanceof module$exports$Blockly$Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to domToWorkspace, swap the arguments.")}var d;b.RTL&&(d=b.getWidth());c=[];(0,module$exports$Blockly$utils$dom.startTextWidthCache)();var e=(0,module$exports$Blockly$Events$utils.getGroup)();e||(0,module$exports$Blockly$Events$utils.setGroup)(!0);b.setResizesEnabled&&b.setResizesEnabled(!1);var f=!0;try{for(var g=0,h=void 0;h=a.childNodes[g];g++){var k= h.nodeName.toLowerCase(),l=h;if("block"==k||"shadow"==k&&!(0,module$exports$Blockly$Events$utils.getRecordUndo)()){var m=(0,module$exports$Blockly$Xml.domToBlock)(l,b);c.push(m.id);var n=l.hasAttribute("x")?parseInt(l.getAttribute("x"),10):10,p=l.hasAttribute("y")?parseInt(l.getAttribute("y"),10):10;isNaN(n)||isNaN(p)||m.moveBy(b.RTL?d-n:n,p);f=!1}else{if("shadow"==k)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==k)if(b.rendered){var q=module$exports$Blockly$WorkspaceCommentSvg; q?q.fromXml(l,b,d):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment.")}else(q=module$exports$Blockly$WorkspaceComment)?q.fromXml(l,b):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==k){if(f)(0,module$exports$Blockly$Xml.domToVariables)(l,b);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");f=!1}}}}finally{e|| (0,module$exports$Blockly$Events$utils.setGroup)(!1),(0,module$exports$Blockly$utils$dom.stopTextWidthCache)()}b.setResizesEnabled&&b.setResizesEnabled(!0);(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.FINISHED_LOADING))(b));return c}; module$exports$Blockly$Xml.appendDomToWorkspace=function(a,b){var c;Object.prototype.hasOwnProperty.call(b,"scale")&&(c=b.getBlocksBoundingBox());a=(0,module$exports$Blockly$Xml.domToWorkspace)(a,b);if(c&&c.top!=c.bottom){var d=c.bottom;c=b.RTL?c.right:c.left;for(var e=Infinity,f=-Infinity,g=Infinity,h=0;hf&&(f=k.x)}d=d-g+10;c=b.RTL?c-f:c-e;for(e=0;e document.");}else a=null;return a};var module$exports$Blockly$utils={aria:module$exports$Blockly$utils$aria,colour:module$exports$Blockly$utils$colour,Coordinate:module$exports$Blockly$utils$Coordinate,deprecation:module$exports$Blockly$utils$deprecation,dom:module$exports$Blockly$utils$dom};module$exports$Blockly$utils.global=module$exports$Blockly$utils$global.globalThis;module$exports$Blockly$utils.idGenerator=module$exports$Blockly$utils$idGenerator;module$exports$Blockly$utils.KeyCodes=module$exports$Blockly$utils$KeyCodes; module$exports$Blockly$utils.math=module$exports$Blockly$utils$math;module$exports$Blockly$utils.Metrics=module$exports$Blockly$utils$Metrics;module$exports$Blockly$utils.object=module$exports$Blockly$utils$object;module$exports$Blockly$utils.Rect=module$exports$Blockly$utils$Rect;module$exports$Blockly$utils.Size=module$exports$Blockly$utils$Size;module$exports$Blockly$utils.string=module$exports$Blockly$utils$string;module$exports$Blockly$utils.style=module$exports$Blockly$utils$style; module$exports$Blockly$utils.Svg=module$exports$Blockly$utils$Svg;module$exports$Blockly$utils.svgPaths=module$exports$Blockly$utils$svgPaths;module$exports$Blockly$utils.toolbox=module$exports$Blockly$utils$toolbox;module$exports$Blockly$utils.userAgent=module$exports$Blockly$utils$userAgent;module$exports$Blockly$utils.xml=module$exports$Blockly$utils$xml; module$exports$Blockly$utils.noEvent=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.noEvent","September 2021","September 2022");a.preventDefault();a.stopPropagation()};module$exports$Blockly$utils.isTargetInput=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.isTargetInput","September 2021","September 2022","Blockly.browserEvents.isTargetInput");return(0,module$exports$Blockly$browserEvents.isTargetInput)(a)}; module$exports$Blockly$utils.getRelativeXY=function(a){var b=new module$exports$Blockly$utils$Coordinate(0,0),c=a.getAttribute("x");c&&(b.x=parseInt(c,10));if(c=a.getAttribute("y"))b.y=parseInt(c,10);if(c=(c=a.getAttribute("transform"))&&c.match(module$exports$Blockly$utils.getRelativeXY.XY_REGEX_))b.x+=Number(c[1]),c[3]&&(b.y+=Number(c[3]));(a=a.getAttribute("style"))&&-1=h?(e=2,f=h,(h=a.join(""))&&c.push(h),a.length=0):"{"==h?e=3:(a.push("%",h),e=0):2==e?"0"<=h&&"9">=h?f+=h:(c.push(parseInt(f,10)),g--,e=0):3==e&&(""==h?(a.splice(0,0,"%{"),g--,e=0):"}"!=h?a.push(h):(e=a.join(""),/[A-Z]\w*/i.test(e)? (h=e.toUpperCase(),(h=(0,module$exports$Blockly$utils$string.startsWith)(h,"BKY_")?h.substring(4):null)&&h in Blockly.Msg?(e=Blockly.Msg[h],"string"==typeof e?Array.prototype.push.apply(c,module$contents$Blockly$utils_tokenizeInterpolation_(e,b)):b?c.push(String(e)):c.push(e)):c.push("%{"+e+"}")):c.push("%{"+e+"}"),e=a.length=0))}(b=a.join(""))&&c.push(b);d=[];for(f=a.length=0;f=c)return{hue:c,hex:(0,module$exports$Blockly$utils$colour.hsvToHex)(c,module$exports$Blockly$internalConstants.HSV_SATURATION,255*module$exports$Blockly$internalConstants.HSV_VALUE)};if(c=(0,module$exports$Blockly$utils$colour.parse)(b))return{hue:null,hex:c};c='Invalid colour: "'+b+'"';a!=b&&(c+=' (from "'+a+'")');throw Error(c); };var module$exports$Blockly$Scrollbar=function(a,b,c,d,e){this.workspace_=a;this.pair_=c||!1;this.horizontal_=b;this.margin_=void 0!==e?e:module$exports$Blockly$Scrollbar.DEFAULT_SCROLLBAR_MARGIN;this.ratio=this.oldHostMetrics_=null;this.createDom_(d);this.position=new module$exports$Blockly$utils$Coordinate(0,0);a=module$exports$Blockly$Scrollbar.scrollbarThickness;b?(this.svgBackground_.setAttribute("height",a),this.outerSvg_.setAttribute("height",a),this.svgHandle_.setAttribute("height",a-5),this.svgHandle_.setAttribute("y", 2.5),this.lengthAttribute_="width",this.positionAttribute_="x"):(this.svgBackground_.setAttribute("width",a),this.outerSvg_.setAttribute("width",a),this.svgHandle_.setAttribute("width",a-5),this.svgHandle_.setAttribute("x",2.5),this.lengthAttribute_="height",this.positionAttribute_="y");this.onMouseDownBarWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgBackground_,"mousedown",this,this.onMouseDownBar_);this.onMouseDownHandleWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgHandle_, "mousedown",this,this.onMouseDownHandle_)};module$exports$Blockly$Scrollbar.prototype.origin_=new module$exports$Blockly$utils$Coordinate(0,0);module$exports$Blockly$Scrollbar.prototype.startDragMouse_=0;module$exports$Blockly$Scrollbar.prototype.scrollbarLength_=0;module$exports$Blockly$Scrollbar.prototype.handleLength_=0;module$exports$Blockly$Scrollbar.prototype.handlePosition_=0;module$exports$Blockly$Scrollbar.prototype.isVisible_=!0; module$exports$Blockly$Scrollbar.prototype.containerVisible_=!0;module$exports$Blockly$Scrollbar.scrollbarThickness=15;module$exports$Blockly$Touch.TOUCH_ENABLED&&(module$exports$Blockly$Scrollbar.scrollbarThickness=25);module$exports$Blockly$Scrollbar.DEFAULT_SCROLLBAR_MARGIN=.5; module$exports$Blockly$Scrollbar.metricsAreEquivalent_=function(a,b){return a.viewWidth==b.viewWidth&&a.viewHeight==b.viewHeight&&a.viewLeft==b.viewLeft&&a.viewTop==b.viewTop&&a.absoluteTop==b.absoluteTop&&a.absoluteLeft==b.absoluteLeft&&a.scrollWidth==b.scrollWidth&&a.scrollHeight==b.scrollHeight&&a.scrollLeft==b.scrollLeft&&a.scrollTop==b.scrollTop}; module$exports$Blockly$Scrollbar.prototype.dispose=function(){this.cleanUp_();(0,module$exports$Blockly$browserEvents.unbind)(this.onMouseDownBarWrapper_);this.onMouseDownBarWrapper_=null;(0,module$exports$Blockly$browserEvents.unbind)(this.onMouseDownHandleWrapper_);this.onMouseDownHandleWrapper_=null;(0,module$exports$Blockly$utils$dom.removeNode)(this.outerSvg_);this.svgBackground_=this.svgGroup_=this.outerSvg_=null;this.svgHandle_&&(this.workspace_.getThemeManager().unsubscribe(this.svgHandle_), this.svgHandle_=null);this.workspace_=null};module$exports$Blockly$Scrollbar.prototype.constrainHandleLength_=function(a){return a=0>=a||isNaN(a)?0:Math.min(a,this.scrollbarLength_)};module$exports$Blockly$Scrollbar.prototype.setHandleLength_=function(a){this.handleLength_=a;this.svgHandle_.setAttribute(this.lengthAttribute_,this.handleLength_)};module$exports$Blockly$Scrollbar.prototype.constrainHandlePosition_=function(a){return a=0>=a||isNaN(a)?0:Math.min(a,this.scrollbarLength_-this.handleLength_)}; module$exports$Blockly$Scrollbar.prototype.setHandlePosition=function(a){this.handlePosition_=a;this.svgHandle_.setAttribute(this.positionAttribute_,this.handlePosition_)};module$exports$Blockly$Scrollbar.prototype.setScrollbarLength_=function(a){this.scrollbarLength_=a;this.outerSvg_.setAttribute(this.lengthAttribute_,this.scrollbarLength_);this.svgBackground_.setAttribute(this.lengthAttribute_,this.scrollbarLength_)}; module$exports$Blockly$Scrollbar.prototype.setPosition=function(a,b){this.position.x=a;this.position.y=b;(0,module$exports$Blockly$utils$dom.setCssTransform)(this.outerSvg_,"translate("+(this.position.x+this.origin_.x)+"px,"+(this.position.y+this.origin_.y)+"px)")}; module$exports$Blockly$Scrollbar.prototype.resize=function(a){if(!a&&(a=this.workspace_.getMetrics(),!a))return;this.oldHostMetrics_&&module$exports$Blockly$Scrollbar.metricsAreEquivalent_(a,this.oldHostMetrics_)||(this.horizontal_?this.resizeHorizontal_(a):this.resizeVertical_(a),this.oldHostMetrics_=a,this.updateMetrics_())}; module$exports$Blockly$Scrollbar.prototype.requiresViewResize_=function(a){return this.oldHostMetrics_?this.oldHostMetrics_.viewWidth!==a.viewWidth||this.oldHostMetrics_.viewHeight!==a.viewHeight||this.oldHostMetrics_.absoluteLeft!==a.absoluteLeft||this.oldHostMetrics_.absoluteTop!==a.absoluteTop:!0};module$exports$Blockly$Scrollbar.prototype.resizeHorizontal_=function(a){this.requiresViewResize_(a)?this.resizeViewHorizontal(a):this.resizeContentHorizontal(a)}; module$exports$Blockly$Scrollbar.prototype.resizeViewHorizontal=function(a){var b=a.viewWidth-2*this.margin_;this.pair_&&(b-=module$exports$Blockly$Scrollbar.scrollbarThickness);this.setScrollbarLength_(Math.max(0,b));b=a.absoluteLeft+this.margin_;this.pair_&&this.workspace_.RTL&&(b+=module$exports$Blockly$Scrollbar.scrollbarThickness);this.setPosition(b,a.absoluteTop+a.viewHeight-module$exports$Blockly$Scrollbar.scrollbarThickness-this.margin_);this.resizeContentHorizontal(a)}; module$exports$Blockly$Scrollbar.prototype.resizeContentHorizontal=function(a){if(a.viewWidth>=a.scrollWidth)this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1);else{this.pair_||this.setVisible(!0);var b=this.scrollbarLength_*a.viewWidth/a.scrollWidth;b=this.constrainHandleLength_(b);this.setHandleLength_(b);b=a.scrollWidth-a.viewWidth;var c=this.scrollbarLength_-this.handleLength_;a=(a.viewLeft-a.scrollLeft)/b*c;a=this.constrainHandlePosition_(a); this.setHandlePosition(a);this.ratio=c/b}};module$exports$Blockly$Scrollbar.prototype.resizeVertical_=function(a){this.requiresViewResize_(a)?this.resizeViewVertical(a):this.resizeContentVertical(a)}; module$exports$Blockly$Scrollbar.prototype.resizeViewVertical=function(a){var b=a.viewHeight-2*this.margin_;this.pair_&&(b-=module$exports$Blockly$Scrollbar.scrollbarThickness);this.setScrollbarLength_(Math.max(0,b));this.setPosition(this.workspace_.RTL?a.absoluteLeft+this.margin_:a.absoluteLeft+a.viewWidth-module$exports$Blockly$Scrollbar.scrollbarThickness-this.margin_,a.absoluteTop+this.margin_);this.resizeContentVertical(a)}; module$exports$Blockly$Scrollbar.prototype.resizeContentVertical=function(a){if(a.viewHeight>=a.scrollHeight)this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1);else{this.pair_||this.setVisible(!0);var b=this.scrollbarLength_*a.viewHeight/a.scrollHeight;b=this.constrainHandleLength_(b);this.setHandleLength_(b);b=a.scrollHeight-a.viewHeight;var c=this.scrollbarLength_-this.handleLength_;a=(a.viewTop-a.scrollTop)/b*c;a=this.constrainHandlePosition_(a); this.setHandlePosition(a);this.ratio=c/b}}; module$exports$Blockly$Scrollbar.prototype.createDom_=function(a){var b="blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical");a&&(b+=" "+a);this.outerSvg_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.SVG,{"class":b},null);this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{},this.outerSvg_);this.svgBackground_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"blocklyScrollbarBackground"}, this.svgGroup_);a=Math.floor((module$exports$Blockly$Scrollbar.scrollbarThickness-5)/2);this.svgHandle_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"blocklyScrollbarHandle",rx:a,ry:a},this.svgGroup_);this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarColour","fill");this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarOpacity","fill-opacity");(0,module$exports$Blockly$utils$dom.insertAfter)(this.outerSvg_, this.workspace_.getParentSvg())};module$exports$Blockly$Scrollbar.prototype.isVisible=function(){return this.isVisible_};module$exports$Blockly$Scrollbar.prototype.setContainerVisible=function(a){var b=a!=this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()};module$exports$Blockly$Scrollbar.prototype.setVisible=function(a){var b=a!=this.isVisible();if(this.pair_)throw Error("Unable to toggle visibility of paired scrollbars.");this.isVisible_=a;b&&this.updateDisplay_()}; module$exports$Blockly$Scrollbar.prototype.updateDisplay_=function(){this.containerVisible_&&this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")}; module$exports$Blockly$Scrollbar.prototype.onMouseDownBar_=function(a){this.workspace_.markFocused();(0,module$exports$Blockly$Touch.clearTouchIdentifier)();this.cleanUp_();if((0,module$exports$Blockly$browserEvents.isRightButton)(a))a.stopPropagation();else{var b=(0,module$exports$Blockly$browserEvents.mouseToSvg)(a,this.workspace_.getParentSvg(),this.workspace_.getInverseScreenCTM());b=this.horizontal_?b.x:b.y;var c=(0,module$exports$Blockly$utils.getInjectionDivXY_)(this.svgHandle_);c=this.horizontal_? c.x:c.y;var d=this.handlePosition_,e=.95*this.handleLength_;b<=c?d-=e:b>=c+this.handleLength_&&(d+=e);this.setHandlePosition(this.constrainHandlePosition_(d));this.updateMetrics_();a.stopPropagation();a.preventDefault()}}; module$exports$Blockly$Scrollbar.prototype.onMouseDownHandle_=function(a){this.workspace_.markFocused();this.cleanUp_();(0,module$exports$Blockly$browserEvents.isRightButton)(a)?a.stopPropagation():(this.startDragHandle=this.handlePosition_,this.workspace_.setupDragSurface(),this.startDragMouse_=this.horizontal_?a.clientX:a.clientY,module$exports$Blockly$Scrollbar.onMouseUpWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mouseup",this,this.onMouseUpHandle_),module$exports$Blockly$Scrollbar.onMouseMoveWrapper_= (0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mousemove",this,this.onMouseMoveHandle_),a.stopPropagation(),a.preventDefault())};module$exports$Blockly$Scrollbar.prototype.onMouseMoveHandle_=function(a){this.setHandlePosition(this.constrainHandlePosition_(this.startDragHandle+((this.horizontal_?a.clientX:a.clientY)-this.startDragMouse_)));this.updateMetrics_()}; module$exports$Blockly$Scrollbar.prototype.onMouseUpHandle_=function(){this.workspace_.resetDragSurface();(0,module$exports$Blockly$Touch.clearTouchIdentifier)();this.cleanUp_()}; module$exports$Blockly$Scrollbar.prototype.cleanUp_=function(){this.workspace_.hideChaff(!0);module$exports$Blockly$Scrollbar.onMouseUpWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(module$exports$Blockly$Scrollbar.onMouseUpWrapper_),module$exports$Blockly$Scrollbar.onMouseUpWrapper_=null);module$exports$Blockly$Scrollbar.onMouseMoveWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(module$exports$Blockly$Scrollbar.onMouseMoveWrapper_),module$exports$Blockly$Scrollbar.onMouseMoveWrapper_= null)};module$exports$Blockly$Scrollbar.prototype.getRatio_=function(){var a=this.handlePosition_/(this.scrollbarLength_-this.handleLength_);isNaN(a)&&(a=0);return a};module$exports$Blockly$Scrollbar.prototype.updateMetrics_=function(){var a=this.getRatio_(),b={};this.horizontal_?b.x=a:b.y=a;this.workspace_.setMetrics(b)};module$exports$Blockly$Scrollbar.prototype.set=function(a,b){this.setHandlePosition(this.constrainHandlePosition_(a*this.ratio));(b||void 0===b)&&this.updateMetrics_()}; module$exports$Blockly$Scrollbar.prototype.setOrigin=function(a,b){this.origin_=new module$exports$Blockly$utils$Coordinate(a,b)};var module$exports$Blockly$IASTNodeLocation=function(){};var module$exports$Blockly$Theme=function(a,b,c,d){this.name=a;this.blockStyles=b||Object.create(null);this.categoryStyles=c||Object.create(null);this.componentStyles=d||Object.create(null);this.fontStyle=Object.create(null);this.startHats=null;(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.THEME,a,this)};module$exports$Blockly$Theme.prototype.getClassName=function(){return this.name+"-theme"}; module$exports$Blockly$Theme.prototype.setBlockStyle=function(a,b){this.blockStyles[a]=b};module$exports$Blockly$Theme.prototype.setCategoryStyle=function(a,b){this.categoryStyles[a]=b};module$exports$Blockly$Theme.prototype.getComponentStyle=function(a){return(a=this.componentStyles[a])&&"string"==typeof a&&this.getComponentStyle(a)?this.getComponentStyle(a):a?String(a):null};module$exports$Blockly$Theme.prototype.setComponentStyle=function(a,b){this.componentStyles[a]=b}; module$exports$Blockly$Theme.prototype.setFontStyle=function(a){this.fontStyle=a};module$exports$Blockly$Theme.prototype.setStartHats=function(a){this.startHats=a}; module$exports$Blockly$Theme.defineTheme=function(a,b){var c=new module$exports$Blockly$Theme(a),d=b.base;d&&("string"==typeof d&&(d=(0,module$exports$Blockly$registry.getObject)(module$exports$Blockly$registry.Type.THEME,d)),d instanceof module$exports$Blockly$Theme&&((0,module$exports$Blockly$utils$object.deepMerge)(c,d),c.name=a));(0,module$exports$Blockly$utils$object.deepMerge)(c.blockStyles,b.blockStyles);(0,module$exports$Blockly$utils$object.deepMerge)(c.categoryStyles,b.categoryStyles);(0,module$exports$Blockly$utils$object.deepMerge)(c.componentStyles, b.componentStyles);(0,module$exports$Blockly$utils$object.deepMerge)(c.fontStyle,b.fontStyle);null!=b.startHats&&(c.startHats=b.startHats);return c};var module$contents$Blockly$Themes$Classic_defaultBlockStyles={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"}},module$contents$Blockly$Themes$Classic_categoryStyles={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"}},module$exports$Blockly$Themes$Classic=new module$exports$Blockly$Theme("classic",module$contents$Blockly$Themes$Classic_defaultBlockStyles,module$contents$Blockly$Themes$Classic_categoryStyles);var module$exports$Blockly$Options=function(a){var b=null,c=!1,d=!1,e=!1,f=!1,g=!1,h=!1,k=!!a.readOnly;k||(b=(0,module$exports$Blockly$utils$toolbox.convertToolboxDefToJson)(a.toolbox),c=(0,module$exports$Blockly$utils$toolbox.hasCategories)(b),d=a.trashcan,void 0===d&&(d=c),e=a.collapse,void 0===e&&(e=c),f=a.comments,void 0===f&&(f=c),g=a.disable,void 0===g&&(g=c),h=a.sounds,void 0===h&&(h=!0));var l=a.maxTrashcanContents;d?void 0===l&&(l=32):l=0;var m=!!a.rtl,n=a.horizontalLayout;void 0===n&&(n= !1);var p=a.toolboxPosition;p="end"!==p;p=n?p?module$exports$Blockly$utils$toolbox.Position.TOP:module$exports$Blockly$utils$toolbox.Position.BOTTOM:p==m?module$exports$Blockly$utils$toolbox.Position.RIGHT:module$exports$Blockly$utils$toolbox.Position.LEFT;var q=a.css;void 0===q&&(q=!0);var r="https://blockly-demo.appspot.com/static/media/";a.media?r=a.media:a.path&&(r=a.path+"media/");var t=void 0===a.oneBasedIndex?!0:!!a.oneBasedIndex;var u=a.renderer||"geras",v=a.plugins||{};this.RTL=m;this.oneBasedIndex= t;this.collapse=e;this.comments=f;this.disable=g;this.readOnly=k;this.maxBlocks=a.maxBlocks||Infinity;this.maxInstances=a.maxInstances;this.pathToMedia=r;this.hasCategories=c;this.moveOptions=module$exports$Blockly$Options.parseMoveOptions_(a,c);this.hasScrollbars=!!this.moveOptions.scrollbars;this.hasTrashcan=d;this.maxTrashcanContents=l;this.hasSounds=h;this.hasCss=q;this.horizontalLayout=n;this.languageTree=b;this.gridOptions=module$exports$Blockly$Options.parseGridOptions_(a);this.zoomOptions= module$exports$Blockly$Options.parseZoomOptions_(a);this.toolboxPosition=p;this.theme=module$exports$Blockly$Options.parseThemeOptions_(a);this.renderer=u;this.rendererOverrides=a.rendererOverrides;this.gridPattern=null;this.parentWorkspace=a.parentWorkspace;this.plugins=v}; module$exports$Blockly$Options.parseMoveOptions_=function(a,b){var c=a.move||{},d={};void 0===c.scrollbars&&void 0===a.scrollbars?d.scrollbars=b:"object"==typeof c.scrollbars?(d.scrollbars={},d.scrollbars.horizontal=!!c.scrollbars.horizontal,d.scrollbars.vertical=!!c.scrollbars.vertical,d.scrollbars.horizontal&&d.scrollbars.vertical?d.scrollbars=!0:d.scrollbars.horizontal||d.scrollbars.vertical||(d.scrollbars=!1)):d.scrollbars=!!c.scrollbars||!!a.scrollbars;d.wheel=d.scrollbars&&void 0!==c.wheel? !!c.wheel:"object"==typeof d.scrollbars;d.drag=d.scrollbars?void 0===c.drag?!0:!!c.drag:!1;return d}; module$exports$Blockly$Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};b.controls=void 0===a.controls?!1:!!a.controls;b.wheel=void 0===a.wheel?!1:!!a.wheel;b.startScale=void 0===a.startScale?1:Number(a.startScale);b.maxScale=void 0===a.maxScale?3:Number(a.maxScale);b.minScale=void 0===a.minScale?.3:Number(a.minScale);b.scaleSpeed=void 0===a.scaleSpeed?1.2:Number(a.scaleSpeed);b.pinch=void 0===a.pinch?b.wheel||b.controls:!!a.pinch;return b}; module$exports$Blockly$Options.parseGridOptions_=function(a){a=a.grid||{};var b={};b.spacing=Number(a.spacing)||0;b.colour=a.colour||"#888";b.length=void 0===a.length?1:Number(a.length);b.snap=01'),d.appendChild(c),b.push(d));if(module$exports$Blockly$blocks.Blocks.variables_get)for(a.sort(module$exports$Blockly$VariableModel.compareByName), c=0;d=a[c];c++){var e=(0,module$exports$Blockly$utils$xml.createElement)("block");e.setAttribute("type","variables_get");e.setAttribute("gap",8);e.appendChild((0,module$exports$Blockly$Variables.generateVariableFieldDom)(d));b.push(e)}}return b};module$exports$Blockly$Variables.VAR_LETTER_OPTIONS="ijkmnopqrstuvwxyzabcdefgh"; module$exports$Blockly$Variables.generateUniqueName=function(a){return(0,module$exports$Blockly$Variables.generateUniqueNameFromOptions)(module$exports$Blockly$Variables.VAR_LETTER_OPTIONS.charAt(0),a.getAllVariableNames())}; module$exports$Blockly$Variables.generateUniqueNameFromOptions=function(a,b){if(!b.length)return a;for(var c=module$exports$Blockly$Variables.VAR_LETTER_OPTIONS,d="",e=c.indexOf(a);;){for(var f=!1,g=0;gc||b.getSourceBlock().isInsertionMarker())return!1;switch(b.type){case module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(a,b);case module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isInsertionMarker()||a.isConnected())return!1;break;case module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE:if(b.isConnected()&& !b.targetBlock().isMovable()&&!b.targetBlock().isShadow())return!1;break;case module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT:if(b.isConnected()&&!a.getSourceBlock().nextConnection&&!b.targetBlock().isShadow()&&b.targetBlock().nextConnection)return!1;break;default:return!1}return-1!=module$exports$Blockly$common.draggingConnections.indexOf(b)?!1:!0}; module$exports$Blockly$ConnectionChecker.prototype.canConnectToPrevious_=function(a,b){if(a.targetConnection||-1!=module$exports$Blockly$common.draggingConnections.indexOf(b))return!1;if(!b.targetConnection)return!0;a=b.targetBlock();return a.isInsertionMarker()?!a.getPreviousBlock():!1};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.CONNECTION_CHECKER,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$ConnectionChecker);var module$contents$Blockly$Workspace_WorkspaceDB_=Object.create(null),module$exports$Blockly$Workspace=function(a){this.id=(0,module$exports$Blockly$utils$idGenerator.genUid)();module$contents$Blockly$Workspace_WorkspaceDB_[this.id]=this;this.options=a||new module$exports$Blockly$Options({});this.RTL=!!this.options.RTL;this.horizontalLayout=!!this.options.horizontalLayout;this.toolboxPosition=this.options.toolboxPosition;this.connectionChecker=new ((0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.CONNECTION_CHECKER, this.options,!0))(this);this.topBlocks_=[];this.topComments_=[];this.commentDB_=Object.create(null);this.listeners_=[];this.undoStack_=[];this.redoStack_=[];this.blockDB_=Object.create(null);this.typedBlocksDB_=Object.create(null);this.variableMap_=new module$exports$Blockly$VariableMap(this);this.potentialVariableMap_=null};module$exports$Blockly$Workspace.prototype.rendered=!1;module$exports$Blockly$Workspace.prototype.isClearing=!1;module$exports$Blockly$Workspace.prototype.MAX_UNDO=1024; module$exports$Blockly$Workspace.prototype.connectionDBList=null;module$exports$Blockly$Workspace.prototype.dispose=function(){this.listeners_.length=0;this.clear();delete module$contents$Blockly$Workspace_WorkspaceDB_[this.id]};module$exports$Blockly$Workspace.SCAN_ANGLE=3; module$exports$Blockly$Workspace.prototype.sortObjects_=function(a,b){a=a.getRelativeToSurfaceXY();b=b.getRelativeToSurfaceXY();return a.y+module$exports$Blockly$Workspace.prototype.sortObjects_.offset*a.x-(b.y+module$exports$Blockly$Workspace.prototype.sortObjects_.offset*b.x)};module$exports$Blockly$Workspace.prototype.addTopBlock=function(a){this.topBlocks_.push(a)}; module$exports$Blockly$Workspace.prototype.removeTopBlock=function(a){if(!(0,module$exports$Blockly$utils.arrayRemove)(this.topBlocks_,a))throw Error("Block not present in workspace's list of top-most blocks.");}; module$exports$Blockly$Workspace.prototype.getTopBlocks=function(a){var b=[].concat(this.topBlocks_);a&&1this.remainingCapacityOfType(c))return!1;b+=a[c]}return b>this.remainingCapacity()?!1:!0};module$exports$Blockly$Workspace.prototype.hasBlockLimits=function(){return Infinity!=this.options.maxBlocks||!!this.options.maxInstances};module$exports$Blockly$Workspace.prototype.getUndoStack=function(){return this.undoStack_}; module$exports$Blockly$Workspace.prototype.getRedoStack=function(){return this.redoStack_};module$exports$Blockly$Workspace.prototype.undo=function(a){var b=a?this.redoStack_:this.undoStack_,c=a?this.undoStack_:this.redoStack_,d=b.pop();if(d){for(var e=[d];b.length&&d.group&&d.group==b[b.length-1].group;)e.push(b.pop());for(b=0;bthis.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(var b=0;ba.width)return b;if(this.workspace_.RTL){var c=this.anchorXY_.x-b,d=a.left+a.width;a=a.left+module$exports$Blockly$Scrollbar.scrollbarThickness/this.workspace_.scale;c-this.width_d&&(b=-(d-this.anchorXY_.x))}else{c=b+this.anchorXY_.x;d=c+this.width_;var e=a.left;a=a.left+a.width-module$exports$Blockly$Scrollbar.scrollbarThickness/this.workspace_.scale; ca&&(b=a-this.anchorXY_.x-this.width_)}return b};module$exports$Blockly$Bubble.prototype.getOptimalRelativeTop_=function(a){var b=-this.height_/4;if(this.height_>a.height)return b;var c=this.anchorXY_.y+b,d=c+this.height_,e=a.top;a=a.top+a.height-module$exports$Blockly$Scrollbar.scrollbarThickness/this.workspace_.scale;var f=this.anchorXY_.y;ca&&(b=a-f-this.height_);return b}; module$exports$Blockly$Bubble.prototype.positionBubble_=function(){var a=this.anchorXY_.x;a=this.workspace_.RTL?a-(this.relativeLeft_+this.width_):a+this.relativeLeft_;this.moveTo(a,this.relativeTop_+this.anchorXY_.y)};module$exports$Blockly$Bubble.prototype.moveTo=function(a,b){this.bubbleGroup_.setAttribute("transform","translate("+a+","+b+")")};module$exports$Blockly$Bubble.prototype.setDragging=function(a){!a&&this.moveCallback_&&this.moveCallback_()}; module$exports$Blockly$Bubble.prototype.getBubbleSize=function(){return new module$exports$Blockly$utils$Size(this.width_,this.height_)}; module$exports$Blockly$Bubble.prototype.setBubbleSize=function(a,b){var c=2*module$exports$Blockly$Bubble.BORDER_WIDTH;a=Math.max(a,c+45);b=Math.max(b,c+20);this.width_=a;this.height_=b;this.bubbleBack_.setAttribute("width",a);this.bubbleBack_.setAttribute("height",b);this.resizeGroup_&&(this.workspace_.RTL?this.resizeGroup_.setAttribute("transform","translate("+2*module$exports$Blockly$Bubble.BORDER_WIDTH+","+(b-c)+") scale(-1 1)"):this.resizeGroup_.setAttribute("transform","translate("+(a-c)+","+ (b-c)+")"));this.autoLayout_&&this.layoutBubble_();this.positionBubble_();this.renderArrow_();this.resizeCallback_&&this.resizeCallback_()}; module$exports$Blockly$Bubble.prototype.renderArrow_=function(){var a=[],b=this.width_/2,c=this.height_/2,d=-this.relativeLeft_,e=-this.relativeTop_;if(b==d&&c==e)a.push("M "+b+","+c);else{e-=c;d-=b;this.workspace_.RTL&&(d*=-1);var f=Math.sqrt(e*e+d*d),g=Math.acos(d/f);0>e&&(g=2*Math.PI-g);var h=g+Math.PI/2;h>2*Math.PI&&(h-=2*Math.PI);var k=Math.sin(h),l=Math.cos(h),m=this.getBubbleSize();h=(m.width+m.height)/module$exports$Blockly$Bubble.ARROW_THICKNESS;h=Math.min(h,m.width,m.height)/4;m=1-module$exports$Blockly$Bubble.ANCHOR_RADIUS/ f;d=b+m*d;e=c+m*e;m=b+h*l;var n=c+h*k;b-=h*l;c-=h*k;k=g+this.arrow_radians_;k>2*Math.PI&&(k-=2*Math.PI);g=Math.sin(k)*f/module$exports$Blockly$Bubble.ARROW_BEND;f=Math.cos(k)*f/module$exports$Blockly$Bubble.ARROW_BEND;a.push("M"+m+","+n);a.push("C"+(m+f)+","+(n+g)+" "+d+","+e+" "+d+","+e);a.push("C"+d+","+e+" "+(b+f)+","+(c+g)+" "+b+","+c)}a.push("z");this.bubbleArrow_.setAttribute("d",a.join(" "))}; module$exports$Blockly$Bubble.prototype.setColour=function(a){this.bubbleBack_.setAttribute("fill",a);this.bubbleArrow_.setAttribute("fill",a)}; module$exports$Blockly$Bubble.prototype.dispose=function(){this.onMouseDownBubbleWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onMouseDownBubbleWrapper_);this.onMouseDownResizeWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onMouseDownResizeWrapper_);module$exports$Blockly$Bubble.unbindDragEvents_();(0,module$exports$Blockly$utils$dom.removeNode)(this.bubbleGroup_);this.disposed=!0}; module$exports$Blockly$Bubble.prototype.moveDuringDrag=function(a,b){a?a.translateSurface(b.x,b.y):this.moveTo(b.x,b.y);this.relativeLeft_=this.workspace_.RTL?this.anchorXY_.x-b.x-this.width_:b.x-this.anchorXY_.x;this.relativeTop_=b.y-this.anchorXY_.y;this.renderArrow_()}; module$exports$Blockly$Bubble.prototype.getRelativeToSurfaceXY=function(){return new module$exports$Blockly$utils$Coordinate(this.workspace_.RTL?-this.relativeLeft_+this.anchorXY_.x-this.width_:this.anchorXY_.x+this.relativeLeft_,this.anchorXY_.y+this.relativeTop_)};module$exports$Blockly$Bubble.prototype.setAutoLayout=function(a){this.autoLayout_=a}; module$exports$Blockly$Bubble.textToDom=function(a){var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.TEXT,{"class":"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:module$exports$Blockly$Bubble.BORDER_WIDTH},null);a=a.split("\n");for(var c=0;c>>/g,a),a=document.createElement("style"),a.id="blockly-common-style",c=document.createTextNode(c),a.appendChild(c),document.head.insertBefore(a,document.head.firstChild))}}; module$exports$Blockly$Css.CONTENT=[".blocklySvg {\n background-color: #fff;\n outline: none;\n overflow: hidden; /* IE overflows by default. */\n position: absolute;\n display: block;\n}",".blocklyWidgetDiv {\n display: none;\n position: absolute;\n z-index: 99999; /* big value for bootstrap3 compatibility */\n}",".injectionDiv {\n height: 100%;\n position: relative;\n overflow: hidden; /* So blocks in drag surface disappear at edges */\n touch-action: none;\n}",".blocklyNonSelectable {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}", ".blocklyWsDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n}",".blocklyWsDragSurface.blocklyOverflowVisible {\n overflow: visible;\n}",".blocklyBlockDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: visible !important;\n z-index: 50;', /* Display below toolbox, but above everything else. */\n}",".blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\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}",".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}", ".blocklyDropDownDiv.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}",".blocklyDropDownContent {\n max-height: 300px;', // @todo: spec for maximum height.\n overflow: auto;\n overflow-x: hidden;\n position: relative;\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}",".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}", ".blocklyArrowTop {\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}",".blocklyArrowBottom {\n border-bottom: 1px solid;\n border-right: 1px solid;\n border-bottom-right-radius: 4px;\n border-color: inherit;\n}",".blocklyResizeSE {\n cursor: se-resize;\n fill: #aaa;\n}",".blocklyResizeSW {\n cursor: sw-resize;\n fill: #aaa;\n}",".blocklyResizeLine {\n stroke: #515A5A;\n stroke-width: 1;\n}",".blocklyHighlightedConnectionPath {\n fill: none;\n stroke: #fc3;\n stroke-width: 4px;\n}", ".blocklyPathLight {\n fill: none;\n stroke-linecap: round;\n stroke-width: 1;\n}",".blocklySelected>.blocklyPathLight {\n display: none;\n}",'.blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don\'t support grab */\n cursor: url("<<>>/handopen.cur"), auto;\n cursor: grab;\n cursor: -webkit-grab;\n}','.blocklyDragging {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}', '.blocklyDraggable:active {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}','.blocklyBlockDragSurface .blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}','.blocklyDragging.blocklyDraggingDelete {\n cursor: url("<<>>/handdelete.cur"), auto;\n}', ".blocklyDragging>.blocklyPath,\n.blocklyDragging>.blocklyPathLight {\n fill-opacity: .8;\n stroke-opacity: .8;\n}",".blocklyDragging>.blocklyPathDark {\n display: none;\n}",".blocklyDisabled>.blocklyPath {\n fill-opacity: .5;\n stroke-opacity: .5;\n}",".blocklyDisabled>.blocklyPathLight,\n.blocklyDisabled>.blocklyPathDark {\n display: none;\n}",".blocklyInsertionMarker>.blocklyPath,\n.blocklyInsertionMarker>.blocklyPathLight,\n.blocklyInsertionMarker>.blocklyPathDark {\n fill-opacity: .2;\n stroke: none;\n}", ".blocklyMultilineText {\n font-family: monospace;\n}",".blocklyNonEditableText>text {\n pointer-events: none;\n}",".blocklyFlyout {\n position: absolute;\n z-index: 20;\n}",".blocklyText text {\n cursor: default;\n}",".blocklySvg text,\n.blocklyBlockDragSurface text {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n cursor: inherit;\n}",".blocklyHidden {\n display: none;\n}",".blocklyFieldDropdown:not(.blocklyHidden) {\n display: block;\n}",".blocklyIconGroup {\n cursor: default;\n}", ".blocklyIconGroup:not(:hover),\n.blocklyIconGroupReadonly {\n opacity: .6;\n}",".blocklyIconShape {\n fill: #00f;\n stroke: #fff;\n stroke-width: 1px;\n}",".blocklyIconSymbol {\n fill: #fff;\n}",".blocklyMinimalBody {\n margin: 0;\n padding: 0;\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}",".blocklyHtmlInput::-ms-clear {\n display: none;\n}", ".blocklyMainBackground {\n stroke-width: 1;\n stroke: #c6c6c6;', /* Equates to #ddd due to border being off-pixel. */\n}",".blocklyMutatorBackground {\n fill: #fff;\n stroke: #ddd;\n stroke-width: 1;\n}",".blocklyFlyoutBackground {\n fill: #ddd;\n fill-opacity: .8;\n}",".blocklyMainWorkspaceScrollbar {\n z-index: 20;\n}",".blocklyFlyoutScrollbar {\n z-index: 30;\n}",".blocklyScrollbarHorizontal,\n.blocklyScrollbarVertical {\n position: absolute;\n outline: none;\n}",".blocklyScrollbarBackground {\n opacity: 0;\n}", ".blocklyScrollbarHandle {\n fill: #ccc;\n}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyScrollbarHandle:hover {\n fill: #bbb;\n}",".blocklyFlyout .blocklyScrollbarHandle {\n fill: #bbb;\n}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyFlyout .blocklyScrollbarHandle:hover {\n fill: #aaa;\n}",".blocklyInvalidInput {\n background: #faa;\n}",".blocklyVerticalMarker {\n stroke-width: 3px;\n fill: rgba(255,255,255,.5);\n pointer-events: none;\n}", ".blocklyComputeCanvas {\n position: absolute;\n width: 0;\n height: 0;\n}",".blocklyNoPointerEvents {\n pointer-events: none;\n}",".blocklyContextMenu {\n border-radius: 4px;\n max-height: 100%;\n}",".blocklyDropdownMenu {\n border-radius: 2px;\n padding: 0 !important;\n}",".blocklyDropdownMenu .blocklyMenuItem {\n /* 28px on the left for icon or checkbox. */\n padding-left: 28px;\n}",".blocklyDropdownMenu .blocklyMenuItemRtl {\n /* Flip left/right padding for BiDi. */\n padding-left: 5px;\n padding-right: 28px;\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}",".blocklyWidgetDiv .blocklyMenu.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\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}", ".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}",".blocklyMenuItemDisabled {\n color: #ccc;\n cursor: inherit;\n}",".blocklyMenuItemHighlight {\n background-color: rgba(0,0,0,.1);\n}",".blocklyMenuItemCheckbox {\n height: 16px;\n position: absolute;\n width: 16px;\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}", ".blocklyMenuItemRtl .blocklyMenuItemCheckbox {\n float: right;\n margin-right: -24px;\n}"];var module$exports$Blockly$ToolboxItem=function(a,b,c){this.id_=a.toolboxitemid||(0,module$exports$Blockly$utils$idGenerator.getNextUniqueId)();this.level_=(this.parent_=c||null)?this.parent_.getLevel()+1:0;this.toolboxItemDef_=a;this.parentToolbox_=b;this.workspace_=this.parentToolbox_.getWorkspace()};module$exports$Blockly$ToolboxItem.prototype.init=function(){};module$exports$Blockly$ToolboxItem.prototype.getDiv=function(){return null};module$exports$Blockly$ToolboxItem.prototype.getId=function(){return this.id_}; module$exports$Blockly$ToolboxItem.prototype.getParent=function(){return null};module$exports$Blockly$ToolboxItem.prototype.getLevel=function(){return this.level_};module$exports$Blockly$ToolboxItem.prototype.isSelectable=function(){return!1};module$exports$Blockly$ToolboxItem.prototype.isCollapsible=function(){return!1};module$exports$Blockly$ToolboxItem.prototype.dispose=function(){};var module$exports$Blockly$ToolboxCategory=function(a,b,c){module$exports$Blockly$ToolboxCategory.superClass_.constructor.call(this,a,b,c);this.name_=(0,module$exports$Blockly$utils.replaceMessageReferences)(a.name);this.colour_=this.getColour_(a);this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null;this.cssConfig_=this.makeDefaultCssConfig_();(0,module$exports$Blockly$utils$object.mixin)(this.cssConfig_,a.cssconfig||a.cssConfig);this.isDisabled_=this.isHidden_=!1;this.flyoutItems_= [];this.parseContents_(a)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$ToolboxCategory,module$exports$Blockly$ToolboxItem);module$exports$Blockly$ToolboxCategory.registrationName="category";module$exports$Blockly$ToolboxCategory.nestedPadding=19;module$exports$Blockly$ToolboxCategory.borderWidth=8;module$exports$Blockly$ToolboxCategory.defaultBackgroundColour="#57e"; module$exports$Blockly$ToolboxCategory.prototype.makeDefaultCssConfig_=function(){return{container:"blocklyToolboxCategory",row:"blocklyTreeRow",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyTreeIcon",label:"blocklyTreeLabel",contents:"blocklyToolboxContents",selected:"blocklyTreeSelected",openicon:"blocklyTreeIconOpen",closedicon:"blocklyTreeIconClosed"}}; module$exports$Blockly$ToolboxCategory.prototype.parseContents_=function(a){var b=a.contents;if(a.custom)this.flyoutItems_=a.custom;else if(b)for(a=0;a>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}",".blocklyTreeIconClosed {\n background-position: -32px -1px;\n}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {\n background-position: 0 -1px;\n}',".blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: -32px -17px;\n}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: 0 -17px;\n}', ".blocklyTreeIconOpen {\n background-position: -16px -1px;\n}",".blocklyTreeSelected>.blocklyTreeIconOpen {\n background-position: -16px -17px;\n}",".blocklyTreeLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}",'.blocklyToolboxDelete .blocklyTreeLabel {\n cursor: url("<<>>/handdelete.cur"), auto;\n}',".blocklyTreeSelected .blocklyTreeLabel {\n color: #fff;\n}"]); (0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.TOOLBOX_ITEM,module$exports$Blockly$ToolboxCategory.registrationName,module$exports$Blockly$ToolboxCategory);var module$exports$Blockly$ToolboxSeparator=function(a,b){module$exports$Blockly$ToolboxSeparator.superClass_.constructor.call(this,a,b);this.cssConfig_={container:"blocklyTreeSeparator"};(0,module$exports$Blockly$utils$object.mixin)(this.cssConfig_,a.cssconfig||a.cssConfig)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$ToolboxSeparator,module$exports$Blockly$ToolboxItem);module$exports$Blockly$ToolboxSeparator.registrationName="sep"; module$exports$Blockly$ToolboxSeparator.prototype.init=function(){this.createDom_()};module$exports$Blockly$ToolboxSeparator.prototype.createDom_=function(){var a=document.createElement("div");(0,module$exports$Blockly$utils$dom.addClass)(a,this.cssConfig_.container);return this.htmlDiv_=a};module$exports$Blockly$ToolboxSeparator.prototype.getDiv=function(){return this.htmlDiv_};module$exports$Blockly$ToolboxSeparator.prototype.dispose=function(){(0,module$exports$Blockly$utils$dom.removeNode)(this.htmlDiv_)}; (0,module$exports$Blockly$Css.register)([".blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\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}']);(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.TOOLBOX_ITEM,module$exports$Blockly$ToolboxSeparator.registrationName,module$exports$Blockly$ToolboxSeparator);var module$exports$Blockly$CollapsibleToolboxCategory=function(a,b,c){this.subcategoriesDiv_=null;this.expanded_=!1;this.toolboxItems_=[];module$exports$Blockly$CollapsibleToolboxCategory.superClass_.constructor.call(this,a,b,c)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$CollapsibleToolboxCategory,module$exports$Blockly$ToolboxCategory);module$exports$Blockly$CollapsibleToolboxCategory.registrationName="collapsibleCategory"; module$exports$Blockly$CollapsibleToolboxCategory.prototype.makeDefaultCssConfig_=function(){var a=module$exports$Blockly$CollapsibleToolboxCategory.superClass_.makeDefaultCssConfig_.call(this);a.contents="blocklyToolboxContents";return a}; module$exports$Blockly$CollapsibleToolboxCategory.prototype.parseContents_=function(a){var b=a.contents,c=!0;if(a.custom)this.flyoutItems_=a.custom;else if(b)for(a=0;a"));(0,module$exports$Blockly$Events$utils.fire)(new module$exports$Blockly$Events$BlockChange(b,"mutation",null,c,a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.blockId)}; module$exports$Blockly$Events$BlockChange.getExtraBlockState_=function(a){return a.saveExtraState?(a=a.saveExtraState())?JSON.stringify(a):"":a.mutationToDom?(a=a.mutationToDom())?(0,module$exports$Blockly$Xml.domToText)(a):"":""};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.CHANGE,module$exports$Blockly$Events$BlockChange);var module$exports$Blockly$Events$UiBase=function(a){module$exports$Blockly$Events$UiBase.superClass_.constructor.call(this);this.isBlank="undefined"==typeof a;this.workspaceId=a?a:"";this.recordUndo=!1};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$Events$UiBase,module$exports$Blockly$Events$Abstract);module$exports$Blockly$Events$UiBase.prototype.isUiEvent=!0;var module$exports$Blockly$Events$BubbleOpen=function(a,b,c){module$exports$Blockly$Events$BubbleOpen.superClass_.constructor.call(this,a?a.workspace.id:void 0);this.blockId=a?a.id:null;this.isOpen=b;this.bubbleType=c};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$Events$BubbleOpen,module$exports$Blockly$Events$UiBase);module$exports$Blockly$Events$BubbleOpen.prototype.type=module$exports$Blockly$Events$utils.BUBBLE_OPEN; module$exports$Blockly$Events$BubbleOpen.prototype.toJson=function(){var a=module$exports$Blockly$Events$BubbleOpen.superClass_.toJson.call(this);a.isOpen=this.isOpen;a.bubbleType=this.bubbleType;a.blockId=this.blockId;return a};module$exports$Blockly$Events$BubbleOpen.prototype.fromJson=function(a){module$exports$Blockly$Events$BubbleOpen.superClass_.fromJson.call(this,a);this.isOpen=a.isOpen;this.bubbleType=a.bubbleType;this.blockId=a.blockId}; (0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.BUBBLE_OPEN,module$exports$Blockly$Events$BubbleOpen);var module$exports$Blockly$Warning=function(a){module$exports$Blockly$Warning.superClass_.constructor.call(this,a);this.createIcon();this.text_=Object.create(null)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$Warning,module$exports$Blockly$Icon);module$exports$Blockly$Warning.prototype.collapseHidden=!1; module$exports$Blockly$Warning.prototype.drawIcon_=function(a){(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.PATH,{"class":"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.PATH,{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT, {"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)};module$exports$Blockly$Warning.prototype.setVisible=function(a){a!=this.isVisible()&&((0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.BUBBLE_OPEN))(this.block_,a,"warning")),a?this.createBubble_():this.disposeBubble_())}; module$exports$Blockly$Warning.prototype.createBubble_=function(){this.paragraphElement_=module$exports$Blockly$Bubble.textToDom(this.getText());this.bubble_=module$exports$Blockly$Bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_);this.applyColour()};module$exports$Blockly$Warning.prototype.disposeBubble_=function(){this.bubble_.dispose();this.paragraphElement_=this.bubble_=null}; module$exports$Blockly$Warning.prototype.setText=function(a,b){this.text_[b]!=a&&(a?this.text_[b]=a:delete this.text_[b],this.isVisible()&&(this.setVisible(!1),this.setVisible(!0)))};module$exports$Blockly$Warning.prototype.getText=function(){var a=[],b;for(b in this.text_)a.push(this.text_[b]);return a.join("\n")};module$exports$Blockly$Warning.prototype.dispose=function(){this.block_.warning=null;module$exports$Blockly$Icon.prototype.dispose.call(this)};var module$exports$Blockly$Comment=function(a){module$exports$Blockly$Comment.superClass_.constructor.call(this,a);this.model_=a.commentModel;this.model_.text=this.model_.text||"";this.cachedText_="";this.onInputWrapper_=this.onChangeWrapper_=this.onWheelWrapper_=this.onMouseUpWrapper_=null;this.createIcon()};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$Comment,module$exports$Blockly$Icon); module$exports$Blockly$Comment.prototype.drawIcon_=function(a){(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CIRCLE,{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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"},a); (0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},a)}; module$exports$Blockly$Comment.prototype.createEditor_=function(){this.foreignObject_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FOREIGNOBJECT,{x:module$exports$Blockly$Bubble.BORDER_WIDTH,y:module$exports$Blockly$Bubble.BORDER_WIDTH},null);var a=document.createElementNS(module$exports$Blockly$utils$dom.HTML_NS,"body");a.setAttribute("xmlns",module$exports$Blockly$utils$dom.HTML_NS);a.className="blocklyMinimalBody";var b=this.textarea_=document.createElementNS(module$exports$Blockly$utils$dom.HTML_NS, "textarea");b.className="blocklyCommentTextarea";b.setAttribute("dir",this.block_.RTL?"RTL":"LTR");b.value=this.model_.text;this.resizeTextarea_();a.appendChild(b);this.foreignObject_.appendChild(a);this.onMouseUpWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"mouseup",this,this.startEdit_,!0,!0);this.onWheelWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"wheel",this,function(c){c.stopPropagation()});this.onChangeWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b, "change",this,function(c){this.cachedText_!=this.model_.text&&(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(this.block_,"comment",null,this.cachedText_,this.model_.text))});this.onInputWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"input",this,function(c){this.model_.text=b.value});setTimeout(b.focus.bind(b),0);return this.foreignObject_}; module$exports$Blockly$Comment.prototype.updateEditable=function(){module$exports$Blockly$Comment.superClass_.updateEditable.call(this);this.isVisible()&&(this.disposeBubble_(),this.createBubble_())};module$exports$Blockly$Comment.prototype.onBubbleResize_=function(){this.isVisible()&&(this.model_.size=this.bubble_.getBubbleSize(),this.resizeTextarea_())}; module$exports$Blockly$Comment.prototype.resizeTextarea_=function(){var a=this.model_.size,b=2*module$exports$Blockly$Bubble.BORDER_WIDTH,c=a.width-b;a=a.height-b;this.foreignObject_.setAttribute("width",c);this.foreignObject_.setAttribute("height",a);this.textarea_.style.width=c-4+"px";this.textarea_.style.height=a-4+"px"}; module$exports$Blockly$Comment.prototype.setVisible=function(a){a!=this.isVisible()&&((0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.BUBBLE_OPEN))(this.block_,a,"comment")),(this.model_.pinned=a)?this.createBubble_():this.disposeBubble_())};module$exports$Blockly$Comment.prototype.createBubble_=function(){!this.block_.isEditable()||module$exports$Blockly$utils$userAgent.IE?this.createNonEditableBubble_():this.createEditableBubble_()}; module$exports$Blockly$Comment.prototype.createEditableBubble_=function(){this.bubble_=new module$exports$Blockly$Bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,this.model_.size.width,this.model_.size.height);this.bubble_.setSvgId(this.block_.id);this.bubble_.registerResizeEvent(this.onBubbleResize_.bind(this));this.applyColour()}; module$exports$Blockly$Comment.prototype.createNonEditableBubble_=function(){this.paragraphElement_=module$exports$Blockly$Bubble.textToDom(this.block_.getCommentText());this.bubble_=module$exports$Blockly$Bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_);this.applyColour()}; module$exports$Blockly$Comment.prototype.disposeBubble_=function(){this.onMouseUpWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null);this.onWheelWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onWheelWrapper_),this.onWheelWrapper_=null);this.onChangeWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onChangeWrapper_),this.onChangeWrapper_=null);this.onInputWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onInputWrapper_), this.onInputWrapper_=null);this.bubble_.dispose();this.paragraphElement_=this.foreignObject_=this.textarea_=this.bubble_=null};module$exports$Blockly$Comment.prototype.startEdit_=function(a){this.bubble_.promote()&&this.textarea_.focus();this.cachedText_=this.model_.text};module$exports$Blockly$Comment.prototype.getBubbleSize=function(){return this.model_.size}; module$exports$Blockly$Comment.prototype.setBubbleSize=function(a,b){this.bubble_?this.bubble_.setBubbleSize(a,b):(this.model_.size.width=a,this.model_.size.height=b)};module$exports$Blockly$Comment.prototype.updateText=function(){this.textarea_?this.textarea_.value=this.model_.text:this.paragraphElement_&&(this.paragraphElement_.firstChild.textContent=this.model_.text)};module$exports$Blockly$Comment.prototype.dispose=function(){this.block_.comment=null;module$exports$Blockly$Icon.prototype.dispose.call(this)}; (0,module$exports$Blockly$Css.register)(".blocklyCommentTextarea {,background-color: #fef49c;,border: 0;,outline: 0;,margin: 0;,padding: 3px;,resize: none;,display: block;,text-overflow: hidden;,}".split(","));var module$exports$Blockly$ConnectionDB=function(a){this.connections_=[];this.connectionChecker_=a};module$exports$Blockly$ConnectionDB.prototype.addConnection=function(a,b){b=this.calculateIndexForYPos_(b);this.connections_.splice(b,0,a)}; module$exports$Blockly$ConnectionDB.prototype.findIndexOfConnection_=function(a,b){if(!this.connections_.length)return-1;var c=this.calculateIndexForYPos_(b);if(c>=this.connections_.length)return-1;b=a.y;for(var d=c;0<=d&&this.connections_[d].y==b;){if(this.connections_[d]==a)return d;d--}for(d=c;da)c=d;else{b=d;break}}return b};module$exports$Blockly$ConnectionDB.prototype.removeConnection=function(a,b){a=this.findIndexOfConnection_(a,b);if(-1==a)throw Error("Unable to find connection in connectionDB.");this.connections_.splice(a,1)}; module$exports$Blockly$ConnectionDB.prototype.getNeighbours=function(a,b){function c(l){var m=e-d[l].x,n=f-d[l].y;Math.sqrt(m*m+n*n)<=b&&k.push(d[l]);return na?this.menuItems_.length:a,-1)};module$exports$Blockly$Menu.prototype.highlightFirst_=function(){this.highlightHelper_(-1,1)}; module$exports$Blockly$Menu.prototype.highlightLast_=function(){this.highlightHelper_(this.menuItems_.length,-1)};module$exports$Blockly$Menu.prototype.highlightHelper_=function(a,b){a+=b;for(var c;c=this.menuItems_[a];){if(c.isEnabled()){this.setHighlighted(c);break}a+=b}};module$exports$Blockly$Menu.prototype.handleMouseOver_=function(a){(a=this.getMenuItem_(a.target))&&(a.isEnabled()?this.highlightedItem_!=a&&this.setHighlighted(a):this.setHighlighted(null))}; module$exports$Blockly$Menu.prototype.handleClick_=function(a){var b=this.openingCoords;this.openingCoords=null;if(b&&"number"==typeof a.clientX){var c=new module$exports$Blockly$utils$Coordinate(a.clientX,a.clientY);if(1>module$exports$Blockly$utils$Coordinate.distance(b,c))return}(a=this.getMenuItem_(a.target))&&a.performAction()};module$exports$Blockly$Menu.prototype.handleMouseEnter_=function(a){this.focus()}; module$exports$Blockly$Menu.prototype.handleMouseLeave_=function(a){this.getElement()&&(this.blur_(),this.setHighlighted(null))}; module$exports$Blockly$Menu.prototype.handleKeyEvent_=function(a){if(this.menuItems_.length&&!(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)){var b=this.highlightedItem_;switch(a.keyCode){case module$exports$Blockly$utils$KeyCodes.ENTER:case module$exports$Blockly$utils$KeyCodes.SPACE:b&&b.performAction();break;case module$exports$Blockly$utils$KeyCodes.UP:this.highlightPrevious();break;case module$exports$Blockly$utils$KeyCodes.DOWN:this.highlightNext();break;case module$exports$Blockly$utils$KeyCodes.PAGE_UP:case module$exports$Blockly$utils$KeyCodes.HOME:this.highlightFirst_(); break;case module$exports$Blockly$utils$KeyCodes.PAGE_DOWN:case module$exports$Blockly$utils$KeyCodes.END:this.highlightLast_();break;default:return}a.preventDefault();a.stopPropagation()}};module$exports$Blockly$Menu.prototype.getSize=function(){var a=this.getElement(),b=(0,module$exports$Blockly$utils$style.getSize)(a);b.height=a.scrollHeight;return b};var module$exports$Blockly$MenuItem=function(a,b){this.content_=a;this.value_=b;this.enabled_=!0;this.element_=null;this.rightToLeft_=!1;this.roleName_=null;this.highlight_=this.checked_=this.checkable_=!1;this.actionHandler_=null}; module$exports$Blockly$MenuItem.prototype.createDom=function(){var a=document.createElement("div");a.id=(0,module$exports$Blockly$utils$idGenerator.getNextUniqueId)();this.element_=a;a.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 ":"");var b= document.createElement("div");b.className="blocklyMenuItemContent goog-menuitem-content";if(this.checkable_){var c=document.createElement("div");c.className="blocklyMenuItemCheckbox goog-menuitem-checkbox";b.appendChild(c)}c=this.content_;"string"==typeof this.content_&&(c=document.createTextNode(this.content_));b.appendChild(c);a.appendChild(b);this.roleName_&&(0,module$exports$Blockly$utils$aria.setRole)(a,this.roleName_);(0,module$exports$Blockly$utils$aria.setState)(a,module$exports$Blockly$utils$aria.State.SELECTED, this.checkable_&&this.checked_||!1);(0,module$exports$Blockly$utils$aria.setState)(a,module$exports$Blockly$utils$aria.State.DISABLED,!this.enabled_);return a};module$exports$Blockly$MenuItem.prototype.dispose=function(){this.element_=null};module$exports$Blockly$MenuItem.prototype.getElement=function(){return this.element_};module$exports$Blockly$MenuItem.prototype.getId=function(){return this.element_.id};module$exports$Blockly$MenuItem.prototype.getValue=function(){return this.value_}; module$exports$Blockly$MenuItem.prototype.setRightToLeft=function(a){this.rightToLeft_=a};module$exports$Blockly$MenuItem.prototype.setRole=function(a){this.roleName_=a};module$exports$Blockly$MenuItem.prototype.setCheckable=function(a){this.checkable_=a};module$exports$Blockly$MenuItem.prototype.setChecked=function(a){this.checked_=a}; module$exports$Blockly$MenuItem.prototype.setHighlighted=function(a){this.highlight_=a;var b=this.getElement();b&&this.isEnabled()&&(a?((0,module$exports$Blockly$utils$dom.addClass)(b,"blocklyMenuItemHighlight"),(0,module$exports$Blockly$utils$dom.addClass)(b,"goog-menuitem-highlight")):((0,module$exports$Blockly$utils$dom.removeClass)(b,"blocklyMenuItemHighlight"),(0,module$exports$Blockly$utils$dom.removeClass)(b,"goog-menuitem-highlight")))}; module$exports$Blockly$MenuItem.prototype.isEnabled=function(){return this.enabled_};module$exports$Blockly$MenuItem.prototype.setEnabled=function(a){this.enabled_=a};module$exports$Blockly$MenuItem.prototype.performAction=function(){this.isEnabled()&&this.actionHandler_&&this.actionHandler_(this)};module$exports$Blockly$MenuItem.prototype.onAction=function(a,b){this.actionHandler_=a.bind(b)};var module$exports$Blockly$WidgetDiv={},module$contents$Blockly$WidgetDiv_owner=null,module$contents$Blockly$WidgetDiv_dispose=null,module$contents$Blockly$WidgetDiv_rendererClassName="",module$contents$Blockly$WidgetDiv_themeClassName="",module$contents$Blockly$WidgetDiv_DIV;module$exports$Blockly$WidgetDiv.getDiv=function(){return module$contents$Blockly$WidgetDiv_DIV};module$exports$Blockly$WidgetDiv.testOnly_setDiv=function(a){module$contents$Blockly$WidgetDiv_DIV=a}; Object.defineProperties(module$exports$Blockly$WidgetDiv,{DIV:{get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.WidgetDiv.DIV","September 2021","September 2022","Blockly.WidgetDiv.getDiv()");return(0,module$exports$Blockly$WidgetDiv.getDiv)()}}}); module$exports$Blockly$WidgetDiv.createDom=function(){module$contents$Blockly$WidgetDiv_DIV||(module$contents$Blockly$WidgetDiv_DIV=document.createElement("div"),module$contents$Blockly$WidgetDiv_DIV.className="blocklyWidgetDiv",((0,module$exports$Blockly$common.getParentContainer)()||document.body).appendChild(module$contents$Blockly$WidgetDiv_DIV))}; module$exports$Blockly$WidgetDiv.show=function(a,b,c){(0,module$exports$Blockly$WidgetDiv.hide)();module$contents$Blockly$WidgetDiv_owner=a;module$contents$Blockly$WidgetDiv_dispose=c;a=module$contents$Blockly$WidgetDiv_DIV;a.style.direction=b?"rtl":"ltr";a.style.display="block";b=(0,module$exports$Blockly$common.getMainWorkspace)();module$contents$Blockly$WidgetDiv_rendererClassName=b.getRenderer().getClassName();module$contents$Blockly$WidgetDiv_themeClassName=b.getTheme().getClassName();(0,module$exports$Blockly$utils$dom.addClass)(a, module$contents$Blockly$WidgetDiv_rendererClassName);(0,module$exports$Blockly$utils$dom.addClass)(a,module$contents$Blockly$WidgetDiv_themeClassName)}; module$exports$Blockly$WidgetDiv.hide=function(){if((0,module$exports$Blockly$WidgetDiv.isVisible)()){module$contents$Blockly$WidgetDiv_owner=null;var a=module$contents$Blockly$WidgetDiv_DIV;a.style.display="none";a.style.left="";a.style.top="";module$contents$Blockly$WidgetDiv_dispose&&module$contents$Blockly$WidgetDiv_dispose();module$contents$Blockly$WidgetDiv_dispose=null;a.textContent="";module$contents$Blockly$WidgetDiv_rendererClassName&&((0,module$exports$Blockly$utils$dom.removeClass)(a, module$contents$Blockly$WidgetDiv_rendererClassName),module$contents$Blockly$WidgetDiv_rendererClassName="");module$contents$Blockly$WidgetDiv_themeClassName&&((0,module$exports$Blockly$utils$dom.removeClass)(a,module$contents$Blockly$WidgetDiv_themeClassName),module$contents$Blockly$WidgetDiv_themeClassName="");(0,module$exports$Blockly$common.getMainWorkspace)().markFocused()}};module$exports$Blockly$WidgetDiv.isVisible=function(){return!!module$contents$Blockly$WidgetDiv_owner}; module$exports$Blockly$WidgetDiv.hideIfOwner=function(a){module$contents$Blockly$WidgetDiv_owner==a&&(0,module$exports$Blockly$WidgetDiv.hide)()};var module$contents$Blockly$WidgetDiv_positionInternal=function(a,b,c){module$contents$Blockly$WidgetDiv_DIV.style.left=a+"px";module$contents$Blockly$WidgetDiv_DIV.style.top=b+"px";module$contents$Blockly$WidgetDiv_DIV.style.height=c+"px"}; module$exports$Blockly$WidgetDiv.positionWithAnchor=function(a,b,c,d){var e=module$contents$Blockly$WidgetDiv_calculateY(a,b,c);a=module$contents$Blockly$WidgetDiv_calculateX(a,b,c,d);0>e?module$contents$Blockly$WidgetDiv_positionInternal(a,0,c.height+e):module$contents$Blockly$WidgetDiv_positionInternal(a,e,c.height)}; var module$contents$Blockly$WidgetDiv_calculateX=function(a,b,c,d){return d?Math.min(Math.max(b.right-c.width,a.left),a.right-c.width):Math.max(Math.min(b.left,a.right-c.width),a.left)},module$contents$Blockly$WidgetDiv_calculateY=function(a,b,c){return b.bottom+c.height>=a.bottom?b.top-c.height:b.bottom};var module$exports$Blockly$clipboard={},module$contents$Blockly$clipboard_copyData=null;module$exports$Blockly$clipboard.copy=function(a){module$contents$Blockly$clipboard_copyData=a.toCopyData()}; module$exports$Blockly$clipboard.paste=function(){if(!module$contents$Blockly$clipboard_copyData)return!1;var a=module$contents$Blockly$clipboard_copyData.source;a.isFlyout&&(a=a.targetWorkspace);return module$contents$Blockly$clipboard_copyData.typeCounts&&a.isCapacityAvailable(module$contents$Blockly$clipboard_copyData.typeCounts)?((0,module$exports$Blockly$Events$utils.setGroup)(!0),a.paste(module$contents$Blockly$clipboard_copyData.saveInfo),(0,module$exports$Blockly$Events$utils.setGroup)(!1), !0):!1};module$exports$Blockly$clipboard.duplicate=function(a){var b=module$contents$Blockly$clipboard_copyData;(0,module$exports$Blockly$clipboard.copy)(a);a.workspace.paste(module$contents$Blockly$clipboard_copyData.saveInfo);module$contents$Blockly$clipboard_copyData=b};var module$exports$Blockly$Events$BlockCreate=function(a){module$exports$Blockly$Events$BlockCreate.superClass_.constructor.call(this,a);a&&(a.isShadow()&&(this.recordUndo=!1),this.xml=(0,module$exports$Blockly$Xml.blockToDomWithXY)(a),this.ids=(0,module$exports$Blockly$Events$utils.getDescendantIds)(a),this.json=Blockly.serialization.blocks.save(a,{addCoordinates:!0}))};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$Events$BlockCreate,module$exports$Blockly$Events$BlockBase); module$exports$Blockly$Events$BlockCreate.prototype.type=module$exports$Blockly$Events$utils.CREATE;module$exports$Blockly$Events$BlockCreate.prototype.toJson=function(){var a=module$exports$Blockly$Events$BlockCreate.superClass_.toJson.call(this);a.xml=(0,module$exports$Blockly$Xml.domToText)(this.xml);a.ids=this.ids;a.json=this.json;this.recordUndo||(a.recordUndo=this.recordUndo);return a}; module$exports$Blockly$Events$BlockCreate.prototype.fromJson=function(a){module$exports$Blockly$Events$BlockCreate.superClass_.fromJson.call(this,a);this.xml=(0,module$exports$Blockly$Xml.textToDom)(a.xml);this.ids=a.ids;this.json=a.json;void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)}; module$exports$Blockly$Events$BlockCreate.prototype.run=function(a){var b=this.getEventWorkspace_();if(a)Blockly.serialization.blocks.append(this.json,b);else for(a=0;ab.length?module$contents$Blockly$ContextMenuItems_deleteNext_(b,c):(0,module$exports$Blockly$dialog.confirm)(Blockly.Msg.DELETE_ALL_BLOCKS.replace("%1",b.length),function(d){d&&module$contents$Blockly$ContextMenuItems_deleteNext_(b,c)})}},scopeType:module$exports$Blockly$ContextMenuRegistry.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})}; var module$contents$Blockly$ContextMenuItems_registerWorkspaceOptions_=function(){(0,module$exports$Blockly$ContextMenuItems.registerUndo)();(0,module$exports$Blockly$ContextMenuItems.registerRedo)();(0,module$exports$Blockly$ContextMenuItems.registerCleanup)();(0,module$exports$Blockly$ContextMenuItems.registerCollapse)();(0,module$exports$Blockly$ContextMenuItems.registerExpand)();(0,module$exports$Blockly$ContextMenuItems.registerDeleteAll)()}; module$exports$Blockly$ContextMenuItems.registerDuplicate=function(){module$exports$Blockly$ContextMenuRegistry.registry.register({displayText:function(){return Blockly.Msg.DUPLICATE_BLOCK},preconditionFn:function(a){a=a.block;return!a.isInFlyout&&a.isDeletable()&&a.isMovable()?a.isDuplicatable()?"enabled":"disabled":"hidden"},callback:function(a){a.block&&(0,module$exports$Blockly$clipboard.duplicate)(a.block)},scopeType:module$exports$Blockly$ContextMenuRegistry.ScopeType.BLOCK,id:"blockDuplicate", weight:1})}; module$exports$Blockly$ContextMenuItems.registerComment=function(){module$exports$Blockly$ContextMenuRegistry.registry.register({displayText:function(a){return a.block.getCommentIcon()?Blockly.Msg.REMOVE_COMMENT:Blockly.Msg.ADD_COMMENT},preconditionFn:function(a){a=a.block;return module$exports$Blockly$utils$userAgent.IE||a.isInFlyout||!a.workspace.options.comments||a.isCollapsed()||!a.isEditable()?"hidden":"enabled"},callback:function(a){a=a.block;a.getCommentIcon()?a.setCommentText(null):a.setCommentText("")}, scopeType:module$exports$Blockly$ContextMenuRegistry.ScopeType.BLOCK,id:"blockComment",weight:2})}; module$exports$Blockly$ContextMenuItems.registerInline=function(){module$exports$Blockly$ContextMenuRegistry.registry.register({displayText:function(a){return a.block.getInputsInline()?Blockly.Msg.EXTERNAL_INPUTS:Blockly.Msg.INLINE_INPUTS},preconditionFn:function(a){a=a.block;if(!a.isInFlyout&&a.isMovable()&&!a.isCollapsed())for(var b=1;be.top?module$contents$Blockly$DropDownDiv_getPositionAboveMetrics(c,d,e,f):b+f.heightdocument.documentElement.clientTop?module$contents$Blockly$DropDownDiv_getPositionAboveMetrics(c,d,e,f):module$contents$Blockly$DropDownDiv_getPositionTopOfPageMetrics(a,e,f)}; var module$contents$Blockly$DropDownDiv_getPositionBelowMetrics=function(a,b,c,d){a=module$exports$Blockly$DropDownDiv.getPositionX(a,c.left,c.right,d.width);return{initialX:a.divX,initialY:b,finalX:a.divX,finalY:b+module$exports$Blockly$DropDownDiv.PADDING_Y,arrowX:a.arrowX,arrowY:-(module$exports$Blockly$DropDownDiv.ARROW_SIZE/2+module$exports$Blockly$DropDownDiv.BORDER_SIZE),arrowAtTop:!0,arrowVisible:!0}},module$contents$Blockly$DropDownDiv_getPositionAboveMetrics=function(a,b,c,d){a=module$exports$Blockly$DropDownDiv.getPositionX(a, c.left,c.right,d.width);return{initialX:a.divX,initialY:b-d.height,finalX:a.divX,finalY:b-d.height-module$exports$Blockly$DropDownDiv.PADDING_Y,arrowX:a.arrowX,arrowY:d.height-2*module$exports$Blockly$DropDownDiv.BORDER_SIZE-module$exports$Blockly$DropDownDiv.ARROW_SIZE/2,arrowAtTop:!1,arrowVisible:!0}},module$contents$Blockly$DropDownDiv_getPositionTopOfPageMetrics=function(a,b,c){a=module$exports$Blockly$DropDownDiv.getPositionX(a,b.left,b.right,c.width);return{initialX:a.divX,initialY:0,finalX:a.divX, finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}};module$exports$Blockly$DropDownDiv.getPositionX=function(a,b,c,d){var e=a;a=(0,module$exports$Blockly$utils$math.clamp)(b,a-d/2,c-d);e-=module$exports$Blockly$DropDownDiv.ARROW_SIZE/2;b=module$exports$Blockly$DropDownDiv.ARROW_HORIZONTAL_PADDING;d=(0,module$exports$Blockly$utils$math.clamp)(b,e-a,d-b-module$exports$Blockly$DropDownDiv.ARROW_SIZE);return{arrowX:d,divX:a}};module$exports$Blockly$DropDownDiv.isVisible=function(){return!!module$exports$Blockly$DropDownDiv.owner_}; module$exports$Blockly$DropDownDiv.hideIfOwner=function(a,b){return module$exports$Blockly$DropDownDiv.owner_===a?(b?module$exports$Blockly$DropDownDiv.hideWithoutAnimation():module$exports$Blockly$DropDownDiv.hide(),!0):!1}; module$exports$Blockly$DropDownDiv.hide=function(){module$exports$Blockly$DropDownDiv.DIV_.style.transform="translate(0, 0)";module$exports$Blockly$DropDownDiv.DIV_.style.opacity=0;module$exports$Blockly$DropDownDiv.animateOutTimer_=setTimeout(function(){module$exports$Blockly$DropDownDiv.hideWithoutAnimation()},1E3*module$exports$Blockly$DropDownDiv.ANIMATION_TIME);module$exports$Blockly$DropDownDiv.onHide_&&(module$exports$Blockly$DropDownDiv.onHide_(),module$exports$Blockly$DropDownDiv.onHide_= null)}; module$exports$Blockly$DropDownDiv.hideWithoutAnimation=function(){if(module$exports$Blockly$DropDownDiv.isVisible()){module$exports$Blockly$DropDownDiv.animateOutTimer_&&clearTimeout(module$exports$Blockly$DropDownDiv.animateOutTimer_);var a=module$exports$Blockly$DropDownDiv.DIV_;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor="";a.style.borderColor="";module$exports$Blockly$DropDownDiv.onHide_&&(module$exports$Blockly$DropDownDiv.onHide_(),module$exports$Blockly$DropDownDiv.onHide_= null);module$exports$Blockly$DropDownDiv.clearContent();module$exports$Blockly$DropDownDiv.owner_=null;module$exports$Blockly$DropDownDiv.rendererClassName_&&((0,module$exports$Blockly$utils$dom.removeClass)(a,module$exports$Blockly$DropDownDiv.rendererClassName_),module$exports$Blockly$DropDownDiv.rendererClassName_="");module$exports$Blockly$DropDownDiv.themeClassName_&&((0,module$exports$Blockly$utils$dom.removeClass)(a,module$exports$Blockly$DropDownDiv.themeClassName_),module$exports$Blockly$DropDownDiv.themeClassName_= "");(0,module$exports$Blockly$common.getMainWorkspace)().markFocused()}}; var module$contents$Blockly$DropDownDiv_positionInternal=function(a,b,c,d){a=module$contents$Blockly$DropDownDiv_internal.getPositionMetrics(a,b,c,d);a.arrowVisible?(module$exports$Blockly$DropDownDiv.arrow_.style.display="",module$exports$Blockly$DropDownDiv.arrow_.style.transform="translate("+a.arrowX+"px,"+a.arrowY+"px) rotate(45deg)",module$exports$Blockly$DropDownDiv.arrow_.setAttribute("class",a.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):module$exports$Blockly$DropDownDiv.arrow_.style.display= "none";b=Math.floor(a.initialX);c=Math.floor(a.initialY);d=Math.floor(a.finalX);var e=Math.floor(a.finalY),f=module$exports$Blockly$DropDownDiv.DIV_;f.style.left=b+"px";f.style.top=c+"px";f.style.display="block";f.style.opacity=1;f.style.transform="translate("+(d-b)+"px,"+(e-c)+"px)";return!!a.arrowAtTop}; module$exports$Blockly$DropDownDiv.repositionForWindowResize=function(){if(module$exports$Blockly$DropDownDiv.owner_){var a=module$exports$Blockly$DropDownDiv.owner_,b=a.getSourceBlock();a=module$exports$Blockly$DropDownDiv.positionToField_?module$contents$Blockly$DropDownDiv_getScaledBboxOfField(a):module$contents$Blockly$DropDownDiv_getScaledBboxOfBlock(b);b=a.left+(a.right-a.left)/2;module$contents$Blockly$DropDownDiv_positionInternal(b,a.bottom,b,a.top)}else module$exports$Blockly$DropDownDiv.hide()}; module$exports$Blockly$DropDownDiv.TEST_ONLY=module$contents$Blockly$DropDownDiv_internal;var module$exports$Blockly$IASTNodeLocationSvg=function(){};var module$exports$Blockly$IKeyboardAccessible=function(){};var module$exports$Blockly$IRegistrable=function(){};var module$exports$Blockly$MarkerManager=function(a){this.cursorSvg_=this.cursor_=null;this.markers_=Object.create(null);this.workspace_=a};module$exports$Blockly$MarkerManager.LOCAL_MARKER="local_marker_1";module$exports$Blockly$MarkerManager.prototype.registerMarker=function(a,b){this.markers_[a]&&this.unregisterMarker(a);b.setDrawer(this.workspace_.getRenderer().makeMarkerDrawer(this.workspace_,b));this.setMarkerSvg(b.getDrawer().createDom());this.markers_[a]=b}; module$exports$Blockly$MarkerManager.prototype.unregisterMarker=function(a){var b=this.markers_[a];if(b)b.dispose(),delete this.markers_[a];else throw Error("Marker with ID "+a+" does not exist. Can only unregister markers that exist.");};module$exports$Blockly$MarkerManager.prototype.getCursor=function(){return this.cursor_};module$exports$Blockly$MarkerManager.prototype.getMarker=function(a){return this.markers_[a]||null}; module$exports$Blockly$MarkerManager.prototype.setCursor=function(a){this.cursor_&&this.cursor_.getDrawer()&&this.cursor_.getDrawer().dispose();if(this.cursor_=a)a=this.workspace_.getRenderer().makeMarkerDrawer(this.workspace_,this.cursor_),this.cursor_.setDrawer(a),this.setCursorSvg(this.cursor_.getDrawer().createDom())};module$exports$Blockly$MarkerManager.prototype.setCursorSvg=function(a){a?(this.workspace_.getBlockCanvas().appendChild(a),this.cursorSvg_=a):this.cursorSvg_=null}; module$exports$Blockly$MarkerManager.prototype.setMarkerSvg=function(a){a?this.workspace_.getBlockCanvas()&&(this.cursorSvg_?this.workspace_.getBlockCanvas().insertBefore(a,this.cursorSvg_):this.workspace_.getBlockCanvas().appendChild(a)):this.markerSvg_=null};module$exports$Blockly$MarkerManager.prototype.updateMarkers=function(){this.workspace_.keyboardAccessibilityMode&&this.cursorSvg_&&this.workspace_.getCursor().draw()}; module$exports$Blockly$MarkerManager.prototype.dispose=function(){for(var a=Object.keys(this.markers_),b=0,c;c=a[b];b++)this.unregisterMarker(c);this.markers_=null;this.cursor_&&(this.cursor_.dispose(),this.cursor_=null)};var module$exports$Blockly$Tooltip={},module$contents$Blockly$Tooltip_visible=!1;module$exports$Blockly$Tooltip.isVisible=function(){return module$contents$Blockly$Tooltip_visible};Object.defineProperties(module$exports$Blockly$Tooltip,{visible:{get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.Tooltip.visible","September 2021","September 2022","Blockly.Tooltip.isVisible()");return(0,module$exports$Blockly$Tooltip.isVisible)()}}}); var module$contents$Blockly$Tooltip_blocked=!1;module$exports$Blockly$Tooltip.LIMIT=50;var module$contents$Blockly$Tooltip_mouseOutPid=0,module$contents$Blockly$Tooltip_showPid=0,module$contents$Blockly$Tooltip_lastX=0,module$contents$Blockly$Tooltip_lastY=0,module$contents$Blockly$Tooltip_element=null,module$contents$Blockly$Tooltip_poisonedElement=null;module$exports$Blockly$Tooltip.OFFSET_X=0;module$exports$Blockly$Tooltip.OFFSET_Y=10;module$exports$Blockly$Tooltip.RADIUS_OK=10; module$exports$Blockly$Tooltip.HOVER_MS=750;module$exports$Blockly$Tooltip.MARGINS=5;var module$contents$Blockly$Tooltip_DIV=null;module$exports$Blockly$Tooltip.getDiv=function(){return module$contents$Blockly$Tooltip_DIV};Object.defineProperties(module$exports$Blockly$Tooltip,{DIV:{get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.Tooltip.DIV","September 2021","September 2022","Blockly.Tooltip.getDiv()");return(0,module$exports$Blockly$Tooltip.getDiv)()}}}); module$exports$Blockly$Tooltip.getTooltipOfObject=function(a){if(a=module$contents$Blockly$Tooltip_getTargetObject(a)){for(a=a.tooltip;"function"==typeof a;)a=a();if("string"!=typeof a)throw Error("Tooltip function must return a string.");return a}return""};var module$contents$Blockly$Tooltip_getTargetObject=function(a){for(;a&&a.tooltip;){if("string"==typeof a.tooltip||"function"==typeof a.tooltip)return a;a=a.tooltip}return null}; module$exports$Blockly$Tooltip.createDom=function(){module$contents$Blockly$Tooltip_DIV||(module$contents$Blockly$Tooltip_DIV=document.createElement("div"),module$contents$Blockly$Tooltip_DIV.className="blocklyTooltipDiv",((0,module$exports$Blockly$common.getParentContainer)()||document.body).appendChild(module$contents$Blockly$Tooltip_DIV))}; module$exports$Blockly$Tooltip.bindMouseEvents=function(a){a.mouseOverWrapper_=(0,module$exports$Blockly$browserEvents.bind)(a,"mouseover",null,module$contents$Blockly$Tooltip_onMouseOver);a.mouseOutWrapper_=(0,module$exports$Blockly$browserEvents.bind)(a,"mouseout",null,module$contents$Blockly$Tooltip_onMouseOut);a.addEventListener("mousemove",module$contents$Blockly$Tooltip_onMouseMove,!1)}; module$exports$Blockly$Tooltip.unbindMouseEvents=function(a){a&&((0,module$exports$Blockly$browserEvents.unbind)(a.mouseOverWrapper_),(0,module$exports$Blockly$browserEvents.unbind)(a.mouseOutWrapper_),a.removeEventListener("mousemove",module$contents$Blockly$Tooltip_onMouseMove))}; var module$contents$Blockly$Tooltip_onMouseOver=function(a){module$contents$Blockly$Tooltip_blocked||(a=module$contents$Blockly$Tooltip_getTargetObject(a.currentTarget),module$contents$Blockly$Tooltip_element!=a&&((0,module$exports$Blockly$Tooltip.hide)(),module$contents$Blockly$Tooltip_poisonedElement=null,module$contents$Blockly$Tooltip_element=a),clearTimeout(module$contents$Blockly$Tooltip_mouseOutPid))},module$contents$Blockly$Tooltip_onMouseOut=function(a){module$contents$Blockly$Tooltip_blocked|| (module$contents$Blockly$Tooltip_mouseOutPid=setTimeout(function(){module$contents$Blockly$Tooltip_poisonedElement=module$contents$Blockly$Tooltip_element=null;(0,module$exports$Blockly$Tooltip.hide)()},1),clearTimeout(module$contents$Blockly$Tooltip_showPid))},module$contents$Blockly$Tooltip_onMouseMove=function(a){if(module$contents$Blockly$Tooltip_element&&module$contents$Blockly$Tooltip_element.tooltip&&!module$contents$Blockly$Tooltip_blocked)if(module$contents$Blockly$Tooltip_visible){var b= module$contents$Blockly$Tooltip_lastX-a.pageX;a=module$contents$Blockly$Tooltip_lastY-a.pageY;Math.sqrt(b*b+a*a)>module$exports$Blockly$Tooltip.RADIUS_OK&&(0,module$exports$Blockly$Tooltip.hide)()}else module$contents$Blockly$Tooltip_poisonedElement!=module$contents$Blockly$Tooltip_element&&(clearTimeout(module$contents$Blockly$Tooltip_showPid),module$contents$Blockly$Tooltip_lastX=a.pageX,module$contents$Blockly$Tooltip_lastY=a.pageY,module$contents$Blockly$Tooltip_showPid=setTimeout(module$contents$Blockly$Tooltip_show, module$exports$Blockly$Tooltip.HOVER_MS))};module$exports$Blockly$Tooltip.dispose=function(){module$contents$Blockly$Tooltip_poisonedElement=module$contents$Blockly$Tooltip_element=null;(0,module$exports$Blockly$Tooltip.hide)()};module$exports$Blockly$Tooltip.hide=function(){module$contents$Blockly$Tooltip_visible&&(module$contents$Blockly$Tooltip_visible=!1,module$contents$Blockly$Tooltip_DIV&&(module$contents$Blockly$Tooltip_DIV.style.display="none"));module$contents$Blockly$Tooltip_showPid&&clearTimeout(module$contents$Blockly$Tooltip_showPid)}; module$exports$Blockly$Tooltip.block=function(){(0,module$exports$Blockly$Tooltip.hide)();module$contents$Blockly$Tooltip_blocked=!0};module$exports$Blockly$Tooltip.unblock=function(){module$contents$Blockly$Tooltip_blocked=!1}; var module$contents$Blockly$Tooltip_show=function(){if(!module$contents$Blockly$Tooltip_blocked&&(module$contents$Blockly$Tooltip_poisonedElement=module$contents$Blockly$Tooltip_element,module$contents$Blockly$Tooltip_DIV)){module$contents$Blockly$Tooltip_DIV.textContent="";var a=(0,module$exports$Blockly$Tooltip.getTooltipOfObject)(module$contents$Blockly$Tooltip_element);a=(0,module$exports$Blockly$utils$string.wrap)(a,module$exports$Blockly$Tooltip.LIMIT);a=a.split("\n");for(var b=0;bc+window.scrollY&&(e-=module$contents$Blockly$Tooltip_DIV.offsetHeight+2*module$exports$Blockly$Tooltip.OFFSET_Y);a?d=Math.max(module$exports$Blockly$Tooltip.MARGINS-window.scrollX,d):d+module$contents$Blockly$Tooltip_DIV.offsetWidth>b+window.scrollX-2*module$exports$Blockly$Tooltip.MARGINS&& (d=b-module$contents$Blockly$Tooltip_DIV.offsetWidth-2*module$exports$Blockly$Tooltip.MARGINS);module$contents$Blockly$Tooltip_DIV.style.top=e+"px";module$contents$Blockly$Tooltip_DIV.style.left=d+"px"}};var module$exports$Blockly$WorkspaceDragger=function(a){this.workspace_=a;this.horizontalScrollEnabled_=this.workspace_.isMovableHorizontally();this.verticalScrollEnabled_=this.workspace_.isMovableVertically();this.startScrollXY_=new module$exports$Blockly$utils$Coordinate(a.scrollX,a.scrollY)};module$exports$Blockly$WorkspaceDragger.prototype.dispose=function(){this.workspace_=null}; module$exports$Blockly$WorkspaceDragger.prototype.startDrag=function(){(0,module$exports$Blockly$common.getSelected)()&&(0,module$exports$Blockly$common.getSelected)().unselect();this.workspace_.setupDragSurface()};module$exports$Blockly$WorkspaceDragger.prototype.endDrag=function(a){this.drag(a);this.workspace_.resetDragSurface()}; module$exports$Blockly$WorkspaceDragger.prototype.drag=function(a){a=module$exports$Blockly$utils$Coordinate.sum(this.startScrollXY_,a);if(this.horizontalScrollEnabled_&&this.verticalScrollEnabled_)this.workspace_.scroll(a.x,a.y);else if(this.horizontalScrollEnabled_)this.workspace_.scroll(a.x,this.workspace_.scrollY);else if(this.verticalScrollEnabled_)this.workspace_.scroll(this.workspace_.scrollX,a.y);else throw new TypeError("Invalid state.");};var module$exports$Blockly$blockAnimations={},module$contents$Blockly$blockAnimations_disconnectPid=0,module$contents$Blockly$blockAnimations_disconnectGroup=null; module$exports$Blockly$blockAnimations.disposeUiEffect=function(a){var b=a.workspace,c=a.getSvgRoot();b.getAudioManager().play("delete");a=b.getSvgXY(c);c=c.cloneNode(!0);c.translateX_=a.x;c.translateY_=a.y;c.setAttribute("transform","translate("+a.x+","+a.y+")");b.getParentSvg().appendChild(c);c.bBox_=c.getBBox();module$contents$Blockly$blockAnimations_disposeUiStep(c,b.RTL,new Date,b.scale)}; var module$contents$Blockly$blockAnimations_disposeUiStep=function(a,b,c,d){var e=(new Date-c)/150;1c)){var d=b.getSvgXY(a.getSvgRoot());a.outputConnection?(d.x+=(a.RTL?3:-3)*c,d.y+=13*c):a.previousConnection&&(d.x+=(a.RTL?-23:23)*c,d.y+=3*c);a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CIRCLE,{cx:d.x,cy:d.y,r:0,fill:"none",stroke:"#888","stroke-width":10},b.getParentSvg());module$contents$Blockly$blockAnimations_connectionUiStep(a, new Date,c)}};var module$contents$Blockly$blockAnimations_connectionUiStep=function(a,b,c){var d=(new Date-b)/150;1a.workspace.scale)){var b=a.getHeightWidth().height;b=Math.atan(10/b)/Math.PI*180;a.RTL||(b*=-1);module$contents$Blockly$blockAnimations_disconnectUiStep(a.getSvgRoot(),b,new Date)}}; var module$contents$Blockly$blockAnimations_disconnectUiStep=function(a,b,c){var d=(new Date-c)/200;1b-module$exports$Blockly$internalConstants.CURRENT_CONNECTION_PREFERENCE)}if(this.localConnection_||this.closestConnection_)console.error("Only one of localConnection_ and closestConnection_ was set."); else return!0}else return!(!this.localConnection_||!this.closestConnection_);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0};module$exports$Blockly$InsertionMarkerManager.prototype.getCandidate_=function(a){for(var b=this.getStartRadius_(),c=null,d=null,e=0;eb.oldScale&&(0,module$exports$Blockly$bumpObjects.bumpTopObjectsIntoBounds)(a)}}},module$contents$Blockly$bumpObjects_extractObjectFromEvent=function(a,b){var c=null;switch(b.type){case module$exports$Blockly$Events$utils.CREATE:case module$exports$Blockly$Events$utils.MOVE:(c=a.getBlockById(b.blockId))&&(c=c.getRootBlock());break;case module$exports$Blockly$Events$utils.COMMENT_CREATE:case module$exports$Blockly$Events$utils.COMMENT_MOVE:c= a.getCommentById(b.commentId)}return c};module$exports$Blockly$bumpObjects.bumpTopObjectsIntoBounds=function(a){var b=a.getMetricsManager();if(b.hasFixedEdges()&&!a.isDragging()){b=b.getScrollMetrics(!0);for(var c=a.getTopBoundedElements(),d=0,e;e=c[d];d++)(0,module$exports$Blockly$bumpObjects.bumpIntoBounds)(a,b,e)}};var module$exports$Blockly$Events$BlockDrag=function(a,b,c){module$exports$Blockly$Events$BlockDrag.superClass_.constructor.call(this,a?a.workspace.id:void 0);this.blockId=a?a.id:null;this.isStart=b;this.blocks=c};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$Events$BlockDrag,module$exports$Blockly$Events$UiBase);module$exports$Blockly$Events$BlockDrag.prototype.type=module$exports$Blockly$Events$utils.BLOCK_DRAG; module$exports$Blockly$Events$BlockDrag.prototype.toJson=function(){var a=module$exports$Blockly$Events$BlockDrag.superClass_.toJson.call(this);a.isStart=this.isStart;a.blockId=this.blockId;a.blocks=this.blocks;return a};module$exports$Blockly$Events$BlockDrag.prototype.fromJson=function(a){module$exports$Blockly$Events$BlockDrag.superClass_.fromJson.call(this,a);this.isStart=a.isStart;this.blockId=a.blockId;this.blocks=a.blocks}; (0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.BLOCK_DRAG,module$exports$Blockly$Events$BlockDrag);var module$exports$Blockly$BlockDragger={BlockDragger:function(a,b){this.draggingBlock_=a;this.workspace_=b;this.draggedConnectionManager_=new module$exports$Blockly$InsertionMarkerManager(this.draggingBlock_);this.dragTarget_=null;this.wouldDeleteBlock_=!1;this.startXY_=this.draggingBlock_.getRelativeToSurfaceXY();this.dragIconData_=module$contents$Blockly$BlockDragger_initIconData(a)}}; module$exports$Blockly$BlockDragger.BlockDragger.prototype.dispose=function(){this.dragIconData_.length=0;this.draggedConnectionManager_&&this.draggedConnectionManager_.dispose()};var module$contents$Blockly$BlockDragger_initIconData=function(a){var b=[];a=a.getDescendants(!1);for(var c=0,d;d=a[c];c++){d=d.getIcons();for(var e=0;e(this.flyout_?module$exports$Blockly$internalConstants.FLYOUT_DRAG_RADIUS:module$exports$Blockly$internalConstants.DRAG_RADIUS)}; module$exports$Blockly$Gesture.prototype.updateIsDraggingFromFlyout_=function(){return this.targetBlock_&&this.flyout_.isBlockCreatable_(this.targetBlock_)?!this.flyout_.isScrollable()||this.flyout_.isDragTowardWorkspace(this.currentDragDeltaXY_)?(this.startWorkspace_=this.flyout_.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),(0,module$exports$Blockly$Events$utils.getGroup)()||(0,module$exports$Blockly$Events$utils.setGroup)(!0),this.startBlock_=null,this.targetBlock_= this.flyout_.createBlock(this.targetBlock_),this.targetBlock_.select(),!0):!1:!1};module$exports$Blockly$Gesture.prototype.updateIsDraggingBubble_=function(){if(!this.startBubble_)return!1;this.isDraggingBubble_=!0;this.startDraggingBubble_();return!0}; module$exports$Blockly$Gesture.prototype.updateIsDraggingBlock_=function(){if(!this.targetBlock_)return!1;this.flyout_?this.isDraggingBlock_=this.updateIsDraggingFromFlyout_():this.targetBlock_.isMovable()&&(this.isDraggingBlock_=!0);return this.isDraggingBlock_?(this.startDraggingBlock_(),!0):!1}; module$exports$Blockly$Gesture.prototype.updateIsDraggingWorkspace_=function(){if(this.flyout_?this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())this.workspaceDragger_=new module$exports$Blockly$WorkspaceDragger(this.startWorkspace_),this.isDraggingWorkspace_=!0,this.workspaceDragger_.startDrag()}; module$exports$Blockly$Gesture.prototype.updateIsDragging_=function(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging_=!0;this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()}; module$exports$Blockly$Gesture.prototype.startDraggingBlock_=function(){this.blockDragger_=new ((0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.BLOCK_DRAGGER,this.creatorWorkspace_.options,!0))(this.targetBlock_,this.startWorkspace_);this.blockDragger_.startDrag(this.currentDragDeltaXY_,this.healStack_);this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_)}; module$exports$Blockly$Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new module$exports$Blockly$BubbleDragger(this.startBubble_,this.startWorkspace_);this.bubbleDragger_.startBubbleDrag();this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)}; module$exports$Blockly$Gesture.prototype.doStart=function(a){(0,module$exports$Blockly$browserEvents.isTargetInput)(a)?this.cancel():(this.hasStarted_=!0,(0,module$exports$Blockly$blockAnimations.disconnectUiStop)(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.startWorkspace_.hideChaff(!!this.flyout_),this.startWorkspace_.markFocused(),this.mostRecentEvent_=a,(0,module$exports$Blockly$Tooltip.block)(),this.targetBlock_&& this.targetBlock_.select(),(0,module$exports$Blockly$browserEvents.isRightButton)(a)?this.handleRightClick(a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||(0,module$exports$Blockly$Touch.longStart)(a,this),this.mouseDownXY_=new module$exports$Blockly$utils$Coordinate(a.clientX,a.clientY),this.healStack_=a.altKey||a.ctrlKey||a.metaKey,this.bindMouseEvents(a)))}; module$exports$Blockly$Gesture.prototype.bindMouseEvents=function(a){this.onMoveWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mousemove",null,this.handleMove.bind(this));this.onUpWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mouseup",null,this.handleUp.bind(this));a.preventDefault();a.stopPropagation()}; module$exports$Blockly$Gesture.prototype.handleMove=function(a){this.updateFromEvent_(a);this.isDraggingWorkspace_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBubble_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_);a.preventDefault();a.stopPropagation()}; module$exports$Blockly$Gesture.prototype.handleUp=function(a){this.updateFromEvent_(a);(0,module$exports$Blockly$Touch.longStop)();this.isEnding_?console.log("Trying to end a gesture recursively."):(this.isEnding_=!0,this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(a,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endDrag(a,this.currentDragDeltaXY_):this.isDraggingWorkspace_?this.workspaceDragger_.endDrag(this.currentDragDeltaXY_):this.isBubbleClick_()?this.doBubbleClick_(): this.isFieldClick_()?this.doFieldClick_():this.isBlockClick_()?this.doBlockClick_():this.isWorkspaceClick_()&&this.doWorkspaceClick_(a),a.preventDefault(),a.stopPropagation(),this.dispose())}; module$exports$Blockly$Gesture.prototype.cancel=function(){this.isEnding_||((0,module$exports$Blockly$Touch.longStop)(),this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingWorkspace_&&this.workspaceDragger_.endDrag(this.currentDragDeltaXY_),this.dispose())}; module$exports$Blockly$Gesture.prototype.handleRightClick=function(a){this.targetBlock_?(this.bringBlockToFront_(),this.targetBlock_.workspace.hideChaff(!!this.flyout_),this.targetBlock_.showContextMenu(a)):this.startBubble_?this.startBubble_.showContextMenu(a):this.startWorkspace_&&!this.flyout_&&(this.startWorkspace_.hideChaff(),this.startWorkspace_.showContextMenu(a));a.preventDefault();a.stopPropagation();this.dispose()}; module$exports$Blockly$Gesture.prototype.handleWsStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace_(b);this.mostRecentEvent_=a;this.doStart(a)};module$exports$Blockly$Gesture.prototype.fireWorkspaceClick_=function(a){(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CLICK))(null,a.id,"workspace"))}; module$exports$Blockly$Gesture.prototype.handleFlyoutStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout_(b);this.handleWsStart(a,b.getWorkspace())};module$exports$Blockly$Gesture.prototype.handleBlockStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(b);this.mostRecentEvent_=a}; module$exports$Blockly$Gesture.prototype.handleBubbleStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(b);this.mostRecentEvent_=a};module$exports$Blockly$Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus();this.startBubble_.select&&this.startBubble_.select()}; module$exports$Blockly$Gesture.prototype.doFieldClick_=function(){this.startField_.showEditor(this.mostRecentEvent_);this.bringBlockToFront_()}; module$exports$Blockly$Gesture.prototype.doBlockClick_=function(){if(this.flyout_&&this.flyout_.autoClose)this.targetBlock_.isEnabled()&&((0,module$exports$Blockly$Events$utils.getGroup)()||(0,module$exports$Blockly$Events$utils.setGroup)(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump());else{var a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CLICK))(this.startBlock_,this.startWorkspace_.id,"block");(0,module$exports$Blockly$Events$utils.fire)(a)}this.bringBlockToFront_(); (0,module$exports$Blockly$Events$utils.setGroup)(!1)};module$exports$Blockly$Gesture.prototype.doWorkspaceClick_=function(a){a=this.creatorWorkspace_;(0,module$exports$Blockly$common.getSelected)()&&(0,module$exports$Blockly$common.getSelected)().unselect();this.fireWorkspaceClick_(this.startWorkspace_||a)};module$exports$Blockly$Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()}; module$exports$Blockly$Gesture.prototype.setStartField=function(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)};module$exports$Blockly$Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)}; module$exports$Blockly$Gesture.prototype.setStartBlock=function(a){this.startBlock_||this.startBubble_||(this.startBlock_=a,a.isInFlyout&&a!=a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))};module$exports$Blockly$Gesture.prototype.setTargetBlock_=function(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a};module$exports$Blockly$Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)}; module$exports$Blockly$Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)};module$exports$Blockly$Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_};module$exports$Blockly$Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()}; module$exports$Blockly$Gesture.prototype.isFieldClick_=function(){return(this.startField_?this.startField_.isClickable():!1)&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)};module$exports$Blockly$Gesture.prototype.isWorkspaceClick_=function(){return!this.startBlock_&&!this.startBubble_&&!this.startField_&&!this.hasExceededDragRadius_};module$exports$Blockly$Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_}; module$exports$Blockly$Gesture.prototype.hasStarted=function(){return this.hasStarted_};module$exports$Blockly$Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]};module$exports$Blockly$Gesture.prototype.getCurrentDragger=function(){return this.isDraggingBlock_?this.blockDragger_:this.isDraggingWorkspace_?this.workspaceDragger_:this.isDraggingBubble_?this.bubbleDragger_:null}; module$exports$Blockly$Gesture.inProgress=function(){for(var a=module$exports$Blockly$Workspace.getAll(),b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1};var module$exports$Blockly$Field=function(a,b,c){this.value_=this.DEFAULT_VALUE;this.tooltip_=this.validator_=null;this.size_=new module$exports$Blockly$utils$Size(0,0);this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=null;c&&this.configure_(c);this.setValue(a);b&&this.setValidator(b)};module$exports$Blockly$Field.prototype.DEFAULT_VALUE=null;module$exports$Blockly$Field.prototype.name=void 0; module$exports$Blockly$Field.prototype.disposed=!1;module$exports$Blockly$Field.prototype.maxDisplayLength=50;module$exports$Blockly$Field.prototype.sourceBlock_=null;module$exports$Blockly$Field.prototype.isDirty_=!0;module$exports$Blockly$Field.prototype.visible_=!0;module$exports$Blockly$Field.prototype.enabled_=!0;module$exports$Blockly$Field.prototype.clickTarget_=null;module$exports$Blockly$Field.NBSP="\u00a0";module$exports$Blockly$Field.prototype.EDITABLE=!0; module$exports$Blockly$Field.prototype.SERIALIZABLE=!1;module$exports$Blockly$Field.prototype.configure_=function(a){var b=a.tooltip;"string"==typeof b&&(b=(0,module$exports$Blockly$utils.replaceMessageReferences)(a.tooltip));b&&this.setTooltip(b)};module$exports$Blockly$Field.prototype.setSourceBlock=function(a){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=a}; module$exports$Blockly$Field.prototype.getConstants=function(){!this.constants_&&this.sourceBlock_&&this.sourceBlock_.workspace&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants());return this.constants_};module$exports$Blockly$Field.prototype.getSourceBlock=function(){return this.sourceBlock_}; module$exports$Blockly$Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{},null),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())};module$exports$Blockly$Field.prototype.initView=function(){this.createBorderRect_();this.createTextElement_()}; module$exports$Blockly$Field.prototype.initModel=function(){};module$exports$Blockly$Field.prototype.createBorderRect_=function(){this.borderRect_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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_)}; module$exports$Blockly$Field.prototype.createTextElement_=function(){this.textElement_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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_)}; module$exports$Blockly$Field.prototype.bindEvents_=function(){(0,module$exports$Blockly$Tooltip.bindMouseEvents)(this.getClickTarget_());this.mouseDownWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.getClickTarget_(),"mousedown",this,this.onMouseDown_)};module$exports$Blockly$Field.prototype.fromXml=function(a){this.setValue(a.textContent)};module$exports$Blockly$Field.prototype.toXml=function(a){a.textContent=this.getValue();return a}; module$exports$Blockly$Field.prototype.saveState=function(a){a=this.saveLegacyState(module$exports$Blockly$Field);return null!==a?a:this.getValue()};module$exports$Blockly$Field.prototype.loadState=function(a){this.loadLegacyState(module$exports$Blockly$Field,a)||this.setValue(a)}; module$exports$Blockly$Field.prototype.saveLegacyState=function(a){return a.prototype.saveState===this.saveState&&a.prototype.toXml!==this.toXml?(a=(0,module$exports$Blockly$utils$xml.createElement)("field"),a.setAttribute("name",this.name||""),(0,module$exports$Blockly$Xml.domToText)(this.toXml(a)).replace(' xmlns="https://developers.google.com/blockly/xml"',"")):null}; module$exports$Blockly$Field.prototype.loadLegacyState=function(a,b){return a.prototype.loadState===this.loadState&&a.prototype.fromXml!==this.fromXml?(this.fromXml((0,module$exports$Blockly$Xml.textToDom)(b)),!0):!1}; module$exports$Blockly$Field.prototype.dispose=function(){module$exports$Blockly$DropDownDiv.hideIfOwner(this);(0,module$exports$Blockly$WidgetDiv.hideIfOwner)(this);(0,module$exports$Blockly$Tooltip.unbindMouseEvents)(this.getClickTarget_());this.mouseDownWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.mouseDownWrapper_);(0,module$exports$Blockly$utils$dom.removeNode)(this.fieldGroup_);this.disposed=!0}; module$exports$Blockly$Field.prototype.updateEditable=function(){var a=this.fieldGroup_;this.EDITABLE&&a&&(this.enabled_&&this.sourceBlock_.isEditable()?((0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyEditableText"),(0,module$exports$Blockly$utils$dom.removeClass)(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):((0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyNonEditableText"),(0,module$exports$Blockly$utils$dom.removeClass)(a,"blocklyEditableText"),a.style.cursor=""))}; module$exports$Blockly$Field.prototype.setEnabled=function(a){this.enabled_=a;this.updateEditable()};module$exports$Blockly$Field.prototype.isEnabled=function(){return this.enabled_};module$exports$Blockly$Field.prototype.isClickable=function(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&!!this.showEditor_&&"function"===typeof this.showEditor_}; module$exports$Blockly$Field.prototype.isCurrentlyEditable=function(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()};module$exports$Blockly$Field.prototype.isSerializable=function(){var a=!1;this.name&&(this.SERIALIZABLE?a=!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."),a=!0));return a}; module$exports$Blockly$Field.prototype.isVisible=function(){return this.visible_};module$exports$Blockly$Field.prototype.setVisible=function(a){if(this.visible_!=a){this.visible_=a;var b=this.getSvgRoot();b&&(b.style.display=a?"block":"none")}};module$exports$Blockly$Field.prototype.setValidator=function(a){this.validator_=a};module$exports$Blockly$Field.prototype.getValidator=function(){return this.validator_};module$exports$Blockly$Field.prototype.getSvgRoot=function(){return this.fieldGroup_}; module$exports$Blockly$Field.prototype.applyColour=function(){};module$exports$Blockly$Field.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_()};module$exports$Blockly$Field.prototype.showEditor=function(a){this.isClickable()&&this.showEditor_(a)}; module$exports$Blockly$Field.prototype.updateSize_=function(a){var b=this.getConstants();a=void 0!=a?a:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var c=2*a,d=b.FIELD_TEXT_HEIGHT,e=0;this.textElement_&&(e=(0,module$exports$Blockly$utils$dom.getFastTextWidth)(this.textElement_,b.FIELD_TEXT_FONTSIZE,b.FIELD_TEXT_FONTWEIGHT,b.FIELD_TEXT_FONTFAMILY),c+=e);this.borderRect_&&(d=Math.max(d,b.FIELD_BORDER_RECT_HEIGHT));this.size_.height=d;this.size_.width=c;this.positionTextElement_(a, e);this.positionBorderRect_()};module$exports$Blockly$Field.prototype.positionTextElement_=function(a,b){if(this.textElement_){var c=this.getConstants(),d=this.size_.height/2;this.textElement_.setAttribute("x",this.sourceBlock_.RTL?this.size_.width-b-a:a);this.textElement_.setAttribute("y",c.FIELD_TEXT_BASELINE_CENTER?d:d-c.FIELD_TEXT_HEIGHT/2+c.FIELD_TEXT_BASELINE)}}; module$exports$Blockly$Field.prototype.positionBorderRect_=function(){this.borderRect_&&(this.borderRect_.setAttribute("width",this.size_.width),this.borderRect_.setAttribute("height",this.size_.height),this.borderRect_.setAttribute("rx",this.getConstants().FIELD_BORDER_RECT_RADIUS),this.borderRect_.setAttribute("ry",this.getConstants().FIELD_BORDER_RECT_RADIUS))}; module$exports$Blockly$Field.prototype.getSize=function(){if(!this.isVisible())return new module$exports$Blockly$utils$Size(0,0);this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&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.render_());return this.size_}; module$exports$Blockly$Field.prototype.getScaledBBox=function(){if(this.borderRect_){var a=this.borderRect_.getBoundingClientRect();var b=(0,module$exports$Blockly$utils$style.getPageOffset)(this.borderRect_);var c=a.width;var d=a.height}else d=this.sourceBlock_.getHeightWidth(),a=this.sourceBlock_.workspace.scale,b=this.getAbsoluteXY_(),c=d.width*a,d=d.height*a,module$exports$Blockly$utils$userAgent.GECKO?(b.x+=1.5*a,b.y+=1.5*a):module$exports$Blockly$utils$userAgent.EDGE||module$exports$Blockly$utils$userAgent.IE|| (b.x-=.5*a,b.y-=.5*a),c+=1*a,d+=1*a;return new module$exports$Blockly$utils$Rect(b.y,b.y+d,b.x,b.x+c)};module$exports$Blockly$Field.prototype.getDisplayText_=function(){var a=this.getText();if(!a)return module$exports$Blockly$Field.NBSP;a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,module$exports$Blockly$Field.NBSP);this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="\u200f");return a}; module$exports$Blockly$Field.prototype.getText=function(){if(this.getText_){var a=this.getText_.call(this);if(null!==a)return String(a)}return String(this.getValue())};module$exports$Blockly$Field.prototype.markDirty=function(){this.isDirty_=!0;this.constants_=null};module$exports$Blockly$Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())}; module$exports$Blockly$Field.prototype.setValue=function(a){if(null!==a){var b=this.doClassValidation_(a);a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,b),a instanceof Error)return;b=this.sourceBlock_;if(!b||!b.disposed){var c=this.getValue();c===a?this.doValueUpdate_(a):(this.doValueUpdate_(a),b&&(0,module$exports$Blockly$Events$utils.isEnabled)()&&(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(b, "field",this.name||null,c,a)),this.isDirty_&&this.forceRerender())}}}};module$exports$Blockly$Field.prototype.processValidation_=function(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a};module$exports$Blockly$Field.prototype.getValue=function(){return this.value_};module$exports$Blockly$Field.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:a}; module$exports$Blockly$Field.prototype.doValueUpdate_=function(a){this.value_=a;this.isDirty_=!0};module$exports$Blockly$Field.prototype.doValueInvalid_=function(a){};module$exports$Blockly$Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)}; module$exports$Blockly$Field.prototype.setTooltip=function(a){a||""===a||(a=this.sourceBlock_);var b=this.getClickTarget_();b?b.tooltip=a:this.tooltip_=a};module$exports$Blockly$Field.prototype.getTooltip=function(){var a=this.getClickTarget_();return a?(0,module$exports$Blockly$Tooltip.getTooltipOfObject)(a):(0,module$exports$Blockly$Tooltip.getTooltipOfObject)({tooltip:this.tooltip_})};module$exports$Blockly$Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()}; module$exports$Blockly$Field.prototype.getAbsoluteXY_=function(){return(0,module$exports$Blockly$utils$style.getPageOffset)(this.getClickTarget_())};module$exports$Blockly$Field.prototype.referencesVariables=function(){return!1};module$exports$Blockly$Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;db?!1:module$exports$Blockly$RenderedConnection.superClass_.isConnectionAllowed.call(this,a)}; module$exports$Blockly$RenderedConnection.prototype.onFailedConnect=function(a){var b=this.getSourceBlock();if((0,module$exports$Blockly$Events$utils.getRecordUndo)()){var c=(0,module$exports$Blockly$Events$utils.getGroup)();setTimeout(function(){b.isDisposed()||b.getParent()||((0,module$exports$Blockly$Events$utils.setGroup)(c),this.bumpAwayFrom(a),(0,module$exports$Blockly$Events$utils.setGroup)(!1))}.bind(this),module$exports$Blockly$internalConstants.BUMP_DELAY)}}; module$exports$Blockly$RenderedConnection.prototype.disconnectInternal_=function(a,b){module$exports$Blockly$RenderedConnection.superClass_.disconnectInternal_.call(this,a,b);a.rendered&&a.render();b.rendered&&(b.updateDisabled(),b.render(),b.getSvgRoot().style.display="block")}; module$exports$Blockly$RenderedConnection.prototype.respawnShadow_=function(){module$exports$Blockly$RenderedConnection.superClass_.respawnShadow_.call(this);var a=this.targetBlock();a&&(a.initSvg(),a.render(!1),a=this.getSourceBlock(),a.rendered&&a.render())};module$exports$Blockly$RenderedConnection.prototype.neighbours=function(a){return this.dbOpposite_.getNeighbours(this,a)}; module$exports$Blockly$RenderedConnection.prototype.connect_=function(a){module$exports$Blockly$RenderedConnection.superClass_.connect_.call(this,a);var b=this.getSourceBlock();a=a.getSourceBlock();var c=b.rendered,d=a.rendered;c&&b.updateDisabled();d&&a.updateDisabled();c&&d&&(this.type==module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT||this.type==module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT?a.render():b.render());if(b=b.getInputWithBlock(a))b=b.isVisible(), a.getSvgRoot().style.display=b?"block":"none"};module$exports$Blockly$RenderedConnection.prototype.onCheckChanged_=function(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours())};var module$exports$Blockly$ASTNode={ASTNode:function(a,b,c){if(!b)throw Error("Cannot create a node without a location.");this.type_=a;this.isConnection_=module$exports$Blockly$ASTNode.ASTNode.isConnectionType_(a);this.location_=b;this.wsCoordinate_=null;this.processParams_(c||null)}};module$exports$Blockly$ASTNode.ASTNode.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"}; module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS=!1;module$exports$Blockly$ASTNode.ASTNode.DEFAULT_OFFSET_Y=-20;module$exports$Blockly$ASTNode.ASTNode.isConnectionType_=function(a){switch(a){case module$exports$Blockly$ASTNode.ASTNode.types.PREVIOUS:case module$exports$Blockly$ASTNode.ASTNode.types.NEXT:case module$exports$Blockly$ASTNode.ASTNode.types.INPUT:case module$exports$Blockly$ASTNode.ASTNode.types.OUTPUT:return!0}return!1}; module$exports$Blockly$ASTNode.ASTNode.createFieldNode=function(a){return a?new module$exports$Blockly$ASTNode.ASTNode(module$exports$Blockly$ASTNode.ASTNode.types.FIELD,a):null}; module$exports$Blockly$ASTNode.ASTNode.createConnectionNode=function(a){if(!a)return null;var b=a.type;return b==module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE||b==module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT&&a.getParentInput()?module$exports$Blockly$ASTNode.ASTNode.createInputNode(a.getParentInput()):b==module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT?new module$exports$Blockly$ASTNode.ASTNode(module$exports$Blockly$ASTNode.ASTNode.types.NEXT, a):b==module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE?new module$exports$Blockly$ASTNode.ASTNode(module$exports$Blockly$ASTNode.ASTNode.types.OUTPUT,a):b==module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT?new module$exports$Blockly$ASTNode.ASTNode(module$exports$Blockly$ASTNode.ASTNode.types.PREVIOUS,a):null}; module$exports$Blockly$ASTNode.ASTNode.createInputNode=function(a){return a&&a.connection?new module$exports$Blockly$ASTNode.ASTNode(module$exports$Blockly$ASTNode.ASTNode.types.INPUT,a.connection):null};module$exports$Blockly$ASTNode.ASTNode.createBlockNode=function(a){return a?new module$exports$Blockly$ASTNode.ASTNode(module$exports$Blockly$ASTNode.ASTNode.types.BLOCK,a):null}; module$exports$Blockly$ASTNode.ASTNode.createStackNode=function(a){return a?new module$exports$Blockly$ASTNode.ASTNode(module$exports$Blockly$ASTNode.ASTNode.types.STACK,a):null};module$exports$Blockly$ASTNode.ASTNode.createWorkspaceNode=function(a,b){return b&&a?new module$exports$Blockly$ASTNode.ASTNode(module$exports$Blockly$ASTNode.ASTNode.types.WORKSPACE,a,{wsCoordinate:b}):null}; module$exports$Blockly$ASTNode.ASTNode.createTopNode=function(a){var b=a.previousConnection||a.outputConnection;return b?module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(b):module$exports$Blockly$ASTNode.ASTNode.createBlockNode(a)};module$exports$Blockly$ASTNode.ASTNode.prototype.processParams_=function(a){a&&a.wsCoordinate&&(this.wsCoordinate_=a.wsCoordinate)};module$exports$Blockly$ASTNode.ASTNode.prototype.getLocation=function(){return this.location_}; module$exports$Blockly$ASTNode.ASTNode.prototype.getType=function(){return this.type_};module$exports$Blockly$ASTNode.ASTNode.prototype.getWsCoordinate=function(){return this.wsCoordinate_};module$exports$Blockly$ASTNode.ASTNode.prototype.isConnection=function(){return this.isConnection_}; module$exports$Blockly$ASTNode.ASTNode.prototype.findNextForInput_=function(){var a=this.location_.getParentInput(),b=a.getSourceBlock();for(a=b.inputList.indexOf(a)+1;aa||a>this.fieldRow.length)throw Error("index "+a+" out of bounds.");if(!(b||""==b&&c))return a;"string"==typeof b&&(b=(0,module$exports$Blockly$fieldRegistry.fromJson)({type:"field_label",text:b}));b.setSourceBlock(this.sourceBlock_);this.sourceBlock_.rendered&&(b.init(),b.applyColour());b.name=c;b.setVisible(this.isVisible());b.prefixField&&(a=this.insertFieldAt(a,b.prefixField));this.fieldRow.splice(a,0,b);++a;b.suffixField&& (a=this.insertFieldAt(a,b.suffixField));this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours());return a}; module$exports$Blockly$Input.prototype.removeField=function(a,b){for(var c=0,d;d=this.fieldRow[c];c++)if(d.name===a)return d.dispose(),this.fieldRow.splice(c,1),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours()),!0;if(b)return!1;throw Error('Field "'+a+'" not found.');};module$exports$Blockly$Input.prototype.isVisible=function(){return this.visible_}; module$exports$Blockly$Input.prototype.setVisible=function(a){var b=[];if(this.visible_==a)return b;this.visible_=a;for(var c=0,d;d=this.fieldRow[c];c++)d.setVisible(a);this.connection&&(this.connection=this.connection,a?b=this.connection.startTrackingAll():this.connection.stopTrackingAll(),c=this.connection.targetBlock())&&(c.getSvgRoot().style.display=a?"block":"none");return b};module$exports$Blockly$Input.prototype.markDirty=function(){for(var a=0,b;b=this.fieldRow[a];a++)b.markDirty()}; module$exports$Blockly$Input.prototype.setCheck=function(a){if(!this.connection)throw Error("This input does not have a connection.");this.connection.setCheck(a);return this};module$exports$Blockly$Input.prototype.setAlign=function(a){this.align=a;this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render());return this}; module$exports$Blockly$Input.prototype.setShadowDom=function(a){if(!this.connection)throw Error("This input does not have a connection.");this.connection.setShadowDom(a);return this};module$exports$Blockly$Input.prototype.getShadowDom=function(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()};module$exports$Blockly$Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var a=0;aa&&(e=e.substring(0,a-3)+"...");return e};module$exports$Blockly$Block.Block.prototype.appendValueInput=function(a){return this.appendInput_(module$exports$Blockly$inputTypes.VALUE,a)}; module$exports$Blockly$Block.Block.prototype.appendStatementInput=function(a){return this.appendInput_(module$exports$Blockly$inputTypes.STATEMENT,a)};module$exports$Blockly$Block.Block.prototype.appendDummyInput=function(a){return this.appendInput_(module$exports$Blockly$inputTypes.DUMMY,a||"")}; module$exports$Blockly$Block.Block.prototype.jsonInit=function(a){var b=a.type?'Block "'+a.type+'": ':"";if(a.output&&a.previousStatement)throw Error(b+"Must not have both an output and a previousStatement.");a.style&&a.style.hat&&(this.hat=a.style.hat,a.style=null);if(a.style&&a.colour)throw Error(b+"Must not have both a colour and a style.");a.style?this.jsonInitStyle_(a,b):this.jsonInitColour_(a,b);for(var c=0;void 0!==a["message"+c];)this.interpolate_(a["message"+c],a["args"+c]||[],a["lastDummyAlign"+ c],b),c++;void 0!==a.inputsInline&&this.setInputsInline(a.inputsInline);void 0!==a.output&&this.setOutput(!0,a.output);void 0!==a.outputShape&&this.setOutputShape(a.outputShape);void 0!==a.previousStatement&&this.setPreviousStatement(!0,a.previousStatement);void 0!==a.nextStatement&&this.setNextStatement(!0,a.nextStatement);void 0!==a.tooltip&&(c=(0,module$exports$Blockly$utils.replaceMessageReferences)(a.tooltip),this.setTooltip(c));void 0!==a.enableContextMenu&&(this.contextMenu=!!a.enableContextMenu); void 0!==a.suppressPrefixSuffix&&(this.suppressPrefixSuffix=!!a.suppressPrefixSuffix);void 0!==a.helpUrl&&(c=(0,module$exports$Blockly$utils.replaceMessageReferences)(a.helpUrl),this.setHelpUrl(c));"string"==typeof a.extensions&&(console.warn(b+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+a.type+"' block."),a.extensions=[a.extensions]);void 0!==a.mutator&&(0,module$exports$Blockly$Extensions.apply)(a.mutator,this,!0);a=a.extensions;if(Array.isArray(a))for(b= 0;bf||f>b)throw Error('Block "'+this.type+'": Message index %'+f+" out of range.");if(c[f])throw Error('Block "'+this.type+'": Message index %'+f+" duplicated.");c[f]=!0;d++}}if(d!=b)throw Error('Block "'+this.type+'": Message does not reference all '+b+" arg(s).");}; module$exports$Blockly$Block.Block.prototype.interpolateArguments_=function(a,b,c){for(var d=[],e=0;e=this.inputList.length)throw RangeError("Input index "+a+" out of bounds.");if(b>this.inputList.length)throw RangeError("Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1);a=a&&this.sourceBlock_.outputConnection&&!b}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_();this.createTextElement_()}; module$exports$Blockly$FieldTextInput.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)}; module$exports$Blockly$FieldTextInput.prototype.doValueInvalid_=function(a){this.isBeingEdited_&&(this.isTextValid_=!1,a=this.value_,this.value_=this.htmlInput_.untypedDefaultValue_,this.sourceBlock_&&(0,module$exports$Blockly$Events$utils.isEnabled)()&&(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(this.sourceBlock_,"field",this.name||null,a,this.value_)))}; module$exports$Blockly$FieldTextInput.prototype.doValueUpdate_=function(a){this.isTextValid_=!0;this.value_=a;this.isBeingEdited_||(this.isDirty_=!0)};module$exports$Blockly$FieldTextInput.prototype.applyColour=function(){this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS&&(this.borderRect_?this.borderRect_.setAttribute("stroke",this.sourceBlock_.style.colourTertiary):this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR))}; module$exports$Blockly$FieldTextInput.prototype.render_=function(){module$exports$Blockly$FieldTextInput.superClass_.render_.call(this);if(this.isBeingEdited_){this.resizeEditor_();var a=this.htmlInput_;this.isTextValid_?((0,module$exports$Blockly$utils$dom.removeClass)(a,"blocklyInvalidInput"),(0,module$exports$Blockly$utils$aria.setState)(a,module$exports$Blockly$utils$aria.State.INVALID,!1)):((0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyInvalidInput"),(0,module$exports$Blockly$utils$aria.setState)(a, module$exports$Blockly$utils$aria.State.INVALID,!0))}};module$exports$Blockly$FieldTextInput.prototype.setSpellcheck=function(a){a!=this.spellcheck_&&(this.spellcheck_=a,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}; module$exports$Blockly$FieldTextInput.prototype.showEditor_=function(a,b){this.workspace_=this.sourceBlock_.workspace;a=b||!1;!a&&(module$exports$Blockly$utils$userAgent.MOBILE||module$exports$Blockly$utils$userAgent.ANDROID||module$exports$Blockly$utils$userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(a)};module$exports$Blockly$FieldTextInput.prototype.showPromptEditor_=function(){(0,module$exports$Blockly$dialog.prompt)(Blockly.Msg.CHANGE_VALUE_TITLE,this.getText(),function(a){this.setValue(this.getValueFromEditorText_(a))}.bind(this))}; module$exports$Blockly$FieldTextInput.prototype.showInlineEditor_=function(a){(0,module$exports$Blockly$WidgetDiv.show)(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_();this.isBeingEdited_=!0;a||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}; module$exports$Blockly$FieldTextInput.prototype.widgetCreate_=function(){(0,module$exports$Blockly$Events$utils.setGroup)(!0);var a=(0,module$exports$Blockly$WidgetDiv.getDiv)();(0,module$exports$Blockly$utils$dom.addClass)(this.getClickTarget_(),"editing");var b=document.createElement("input");b.className="blocklyHtmlInput";b.setAttribute("spellcheck",this.spellcheck_);var c=this.workspace_.getScale(),d=this.getConstants().FIELD_TEXT_FONTSIZE*c+"pt";a.style.fontSize=d;b.style.fontSize=d;d=module$exports$Blockly$FieldTextInput.BORDERRADIUS* c+"px";if(this.fullBlockClickTarget_){d=this.getScaledBBox();d=(d.bottom-d.top)/2+"px";var e=this.sourceBlock_.getParent()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;b.style.border=1*c+"px solid "+e;a.style.borderRadius=d;a.style.transition="box-shadow 0.25s ease 0s";this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(a.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*c+"px")}b.style.borderRadius=d;a.appendChild(b);b.value=b.defaultValue=this.getEditorText_(this.value_); b.untypedDefaultValue_=this.value_;b.oldValue_=null;this.resizeEditor_();this.bindInputEvents_(b);return b}; module$exports$Blockly$FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1;this.isTextValid_=!0;this.forceRerender();if(this.onFinishEditing_)this.onFinishEditing_(this.value_);(0,module$exports$Blockly$Events$utils.setGroup)(!1);this.unbindInputEvents_();var a=(0,module$exports$Blockly$WidgetDiv.getDiv)().style;a.width="auto";a.height="auto";a.fontSize="";a.transition="";a.boxShadow="";this.htmlInput_=null;(0,module$exports$Blockly$utils$dom.removeClass)(this.getClickTarget_(), "editing")};module$exports$Blockly$FieldTextInput.prototype.bindInputEvents_=function(a){this.onKeyDownWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(a,"keydown",this,this.onHtmlInputKeyDown_);this.onKeyInputWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(a,"input",this,this.onHtmlInputChange_)}; module$exports$Blockly$FieldTextInput.prototype.unbindInputEvents_=function(){this.onKeyDownWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null);this.onKeyInputWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}; module$exports$Blockly$FieldTextInput.prototype.onHtmlInputKeyDown_=function(a){a.keyCode==module$exports$Blockly$utils$KeyCodes.ENTER?((0,module$exports$Blockly$WidgetDiv.hide)(),module$exports$Blockly$DropDownDiv.hideWithoutAnimation()):a.keyCode==module$exports$Blockly$utils$KeyCodes.ESC?(this.setValue(this.htmlInput_.untypedDefaultValue_),(0,module$exports$Blockly$WidgetDiv.hide)(),module$exports$Blockly$DropDownDiv.hideWithoutAnimation()):a.keyCode==module$exports$Blockly$utils$KeyCodes.TAB&& ((0,module$exports$Blockly$WidgetDiv.hide)(),module$exports$Blockly$DropDownDiv.hideWithoutAnimation(),this.sourceBlock_.tab(this,!a.shiftKey),a.preventDefault())};module$exports$Blockly$FieldTextInput.prototype.onHtmlInputChange_=function(a){a=this.htmlInput_.value;a!==this.htmlInput_.oldValue_&&(this.htmlInput_.oldValue_=a,a=this.getValueFromEditorText_(a),this.setValue(a),this.forceRerender(),this.resizeEditor_())}; module$exports$Blockly$FieldTextInput.prototype.setEditorValue_=function(a){this.isDirty_=!0;this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(a));this.setValue(a)}; module$exports$Blockly$FieldTextInput.prototype.resizeEditor_=function(){var a=(0,module$exports$Blockly$WidgetDiv.getDiv)(),b=this.getScaledBBox();a.style.width=b.right-b.left+"px";a.style.height=b.bottom-b.top+"px";b=new module$exports$Blockly$utils$Coordinate(this.sourceBlock_.RTL?b.right-a.offsetWidth:b.left,b.top);a.style.left=b.x+"px";a.style.top=b.y+"px"};module$exports$Blockly$FieldTextInput.prototype.isTabNavigable=function(){return!0}; module$exports$Blockly$FieldTextInput.prototype.getText_=function(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null};module$exports$Blockly$FieldTextInput.prototype.getEditorText_=function(a){return String(a)};module$exports$Blockly$FieldTextInput.prototype.getValueFromEditorText_=function(a){return a};(0,module$exports$Blockly$fieldRegistry.register)("field_input",module$exports$Blockly$FieldTextInput);var module$exports$Blockly$FieldAngle=function(a,b,c){this.clockwise_=module$exports$Blockly$FieldAngle.CLOCKWISE;this.offset_=module$exports$Blockly$FieldAngle.OFFSET;this.wrap_=module$exports$Blockly$FieldAngle.WRAP;this.round_=module$exports$Blockly$FieldAngle.ROUND;module$exports$Blockly$FieldAngle.superClass_.constructor.call(this,a,b,c);this.moveSurfaceWrapper_=this.clickSurfaceWrapper_=this.clickWrapper_=this.line_=this.gauge_=this.editor_=null}; (0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$FieldAngle,module$exports$Blockly$FieldTextInput);module$exports$Blockly$FieldAngle.prototype.DEFAULT_VALUE=0;module$exports$Blockly$FieldAngle.fromJson=function(a){return new this(a.angle,void 0,a)};module$exports$Blockly$FieldAngle.prototype.SERIALIZABLE=!0;module$exports$Blockly$FieldAngle.ROUND=15;module$exports$Blockly$FieldAngle.HALF=50;module$exports$Blockly$FieldAngle.CLOCKWISE=!1; module$exports$Blockly$FieldAngle.OFFSET=0;module$exports$Blockly$FieldAngle.WRAP=360;module$exports$Blockly$FieldAngle.RADIUS=module$exports$Blockly$FieldAngle.HALF-1; module$exports$Blockly$FieldAngle.prototype.configure_=function(a){module$exports$Blockly$FieldAngle.superClass_.configure_.call(this,a);switch(a.mode){case "compass":this.clockwise_=!0;this.offset_=90;break;case "protractor":this.clockwise_=!1,this.offset_=0}var b=a.clockwise;"boolean"==typeof b&&(this.clockwise_=b);b=a.offset;null!=b&&(b=Number(b),isNaN(b)||(this.offset_=b));b=a.wrap;null!=b&&(b=Number(b),isNaN(b)||(this.wrap_=b));a=a.round;null!=a&&(a=Number(a),isNaN(a)||(this.round_=a))}; module$exports$Blockly$FieldAngle.prototype.initView=function(){module$exports$Blockly$FieldAngle.superClass_.initView.call(this);this.symbol_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.TSPAN,{},null);this.symbol_.appendChild(document.createTextNode("\u00b0"));this.textElement_.appendChild(this.symbol_)};module$exports$Blockly$FieldAngle.prototype.render_=function(){module$exports$Blockly$FieldAngle.superClass_.render_.call(this);this.updateGraph_()}; module$exports$Blockly$FieldAngle.prototype.showEditor_=function(a){module$exports$Blockly$FieldAngle.superClass_.showEditor_.call(this,a,module$exports$Blockly$utils$userAgent.MOBILE||module$exports$Blockly$utils$userAgent.ANDROID||module$exports$Blockly$utils$userAgent.IPAD);this.dropdownCreate_();module$exports$Blockly$DropDownDiv.getContentDiv().appendChild(this.editor_);module$exports$Blockly$DropDownDiv.setColour(this.sourceBlock_.style.colourPrimary,this.sourceBlock_.style.colourTertiary); module$exports$Blockly$DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this));this.updateGraph_()}; module$exports$Blockly$FieldAngle.prototype.dropdownCreate_=function(){var a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.SVG,{xmlns:module$exports$Blockly$utils$dom.SVG_NS,"xmlns:html":module$exports$Blockly$utils$dom.HTML_NS,"xmlns:xlink":module$exports$Blockly$utils$dom.XLINK_NS,version:"1.1",height:2*module$exports$Blockly$FieldAngle.HALF+"px",width:2*module$exports$Blockly$FieldAngle.HALF+"px",style:"touch-action: none"},null),b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CIRCLE, {cx:module$exports$Blockly$FieldAngle.HALF,cy:module$exports$Blockly$FieldAngle.HALF,r:module$exports$Blockly$FieldAngle.RADIUS,"class":"blocklyAngleCircle"},a);this.gauge_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.PATH,{"class":"blocklyAngleGauge"},a);this.line_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.LINE,{x1:module$exports$Blockly$FieldAngle.HALF,y1:module$exports$Blockly$FieldAngle.HALF,"class":"blocklyAngleLine"}, a);for(var c=0;360>c;c+=15)(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.LINE,{x1:module$exports$Blockly$FieldAngle.HALF+module$exports$Blockly$FieldAngle.RADIUS,y1:module$exports$Blockly$FieldAngle.HALF,x2:module$exports$Blockly$FieldAngle.HALF+module$exports$Blockly$FieldAngle.RADIUS-(0==c%45?10:5),y2:module$exports$Blockly$FieldAngle.HALF,"class":"blocklyAngleMarks",transform:"rotate("+c+","+module$exports$Blockly$FieldAngle.HALF+","+module$exports$Blockly$FieldAngle.HALF+ ")"},a);this.clickWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(a,"click",this,this.hide_);this.clickSurfaceWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"click",this,this.onMouseMove_,!0,!0);this.moveSurfaceWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"mousemove",this,this.onMouseMove_,!0,!0);this.editor_=a}; module$exports$Blockly$FieldAngle.prototype.dropdownDispose_=function(){this.clickWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.clickWrapper_),this.clickWrapper_=null);this.clickSurfaceWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.clickSurfaceWrapper_),this.clickSurfaceWrapper_=null);this.moveSurfaceWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.moveSurfaceWrapper_),this.moveSurfaceWrapper_=null);this.line_=this.gauge_=null}; module$exports$Blockly$FieldAngle.prototype.hide_=function(){module$exports$Blockly$DropDownDiv.hideIfOwner(this);(0,module$exports$Blockly$WidgetDiv.hide)()}; module$exports$Blockly$FieldAngle.prototype.onMouseMove_=function(a){var b=this.gauge_.ownerSVGElement.getBoundingClientRect(),c=a.clientX-b.left-module$exports$Blockly$FieldAngle.HALF;a=a.clientY-b.top-module$exports$Blockly$FieldAngle.HALF;b=Math.atan(-a/c);isNaN(b)||(b=(0,module$exports$Blockly$utils$math.toDegrees)(b),0>c?b+=180:0a&&(a+=360);a>this.wrap_&&(a-=360);return a}; (0,module$exports$Blockly$Css.register)([".blocklyAngleCircle {\n stroke: #444;\n stroke-width: 1;\n fill: #ddd;\n fill-opacity: .8;\n}",".blocklyAngleMarks {\n stroke: #444;\n stroke-width: 1;\n}",".blocklyAngleGauge {\n fill: #f88;\n fill-opacity: .8;\n pointer-events: none;\n}",".blocklyAngleLine {\n stroke: #f00;\n stroke-width: 2;\n stroke-linecap: round;\n pointer-events: none;\n}"]);(0,module$exports$Blockly$fieldRegistry.register)("field_angle",module$exports$Blockly$FieldAngle);var module$exports$Blockly$FieldCheckbox=function(a,b,c){this.checkChar_=null;module$exports$Blockly$FieldCheckbox.superClass_.constructor.call(this,a,b,c)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$FieldCheckbox,module$exports$Blockly$Field);module$exports$Blockly$FieldCheckbox.prototype.DEFAULT_VALUE=!1;module$exports$Blockly$FieldCheckbox.fromJson=function(a){return new this(a.checked,void 0,a)};module$exports$Blockly$FieldCheckbox.CHECK_CHAR="\u2713"; module$exports$Blockly$FieldCheckbox.prototype.SERIALIZABLE=!0;module$exports$Blockly$FieldCheckbox.prototype.CURSOR="default";module$exports$Blockly$FieldCheckbox.prototype.configure_=function(a){module$exports$Blockly$FieldCheckbox.superClass_.configure_.call(this,a);a.checkCharacter&&(this.checkChar_=a.checkCharacter)};module$exports$Blockly$FieldCheckbox.prototype.saveState=function(){var a=this.saveLegacyState(module$exports$Blockly$FieldCheckbox);return null!==a?a:this.getValueBoolean()}; module$exports$Blockly$FieldCheckbox.prototype.initView=function(){module$exports$Blockly$FieldCheckbox.superClass_.initView.call(this);(0,module$exports$Blockly$utils$dom.addClass)(this.textElement_,"blocklyCheckbox");this.textElement_.style.display=this.value_?"block":"none"};module$exports$Blockly$FieldCheckbox.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)}; module$exports$Blockly$FieldCheckbox.prototype.getDisplayText_=function(){return this.checkChar_||module$exports$Blockly$FieldCheckbox.CHECK_CHAR};module$exports$Blockly$FieldCheckbox.prototype.setCheckCharacter=function(a){this.checkChar_=a;this.forceRerender()};module$exports$Blockly$FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)}; module$exports$Blockly$FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};module$exports$Blockly$FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a);this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")};module$exports$Blockly$FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"}; module$exports$Blockly$FieldCheckbox.prototype.getValueBoolean=function(){return this.value_};module$exports$Blockly$FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))};module$exports$Blockly$FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a};(0,module$exports$Blockly$fieldRegistry.register)("field_checkbox",module$exports$Blockly$FieldCheckbox);var module$exports$Blockly$FieldColour=function(a,b,c){module$exports$Blockly$FieldColour.superClass_.constructor.call(this,a,b,c);this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$FieldColour,module$exports$Blockly$Field);module$exports$Blockly$FieldColour.fromJson=function(a){return new this(a.colour,void 0,a)}; module$exports$Blockly$FieldColour.prototype.SERIALIZABLE=!0;module$exports$Blockly$FieldColour.prototype.CURSOR="default";module$exports$Blockly$FieldColour.prototype.isDirty_=!1;module$exports$Blockly$FieldColour.prototype.colours_=null;module$exports$Blockly$FieldColour.prototype.titles_=null;module$exports$Blockly$FieldColour.prototype.columns_=0; module$exports$Blockly$FieldColour.prototype.configure_=function(a){module$exports$Blockly$FieldColour.superClass_.configure_.call(this,a);a.colourOptions&&(this.colours_=a.colourOptions,this.titles_=a.colourTitles);a.columns&&(this.columns_=a.columns)}; module$exports$Blockly$FieldColour.prototype.initView=function(){this.size_=new module$exports$Blockly$utils$Size(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT);this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.clickTarget_=this.sourceBlock_.getSvgRoot():(this.createBorderRect_(),this.borderRect_.style.fillOpacity="1")}; module$exports$Blockly$FieldColour.prototype.applyColour=function(){this.getConstants().FIELD_COLOUR_FULL_BLOCK?(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())};module$exports$Blockly$FieldColour.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:(0,module$exports$Blockly$utils$colour.parse)(a)}; module$exports$Blockly$FieldColour.prototype.doValueUpdate_=function(a){this.value_=a;this.borderRect_?this.borderRect_.style.fill=a:this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",a),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff"))};module$exports$Blockly$FieldColour.prototype.getText=function(){var a=this.value_;/^#(.)\1(.)\2(.)\3$/.test(a)&&(a="#"+a[1]+a[3]+a[5]);return a};module$exports$Blockly$FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "); module$exports$Blockly$FieldColour.prototype.DEFAULT_VALUE=module$exports$Blockly$FieldColour.COLOURS[0];module$exports$Blockly$FieldColour.TITLES=[];module$exports$Blockly$FieldColour.COLUMNS=7;module$exports$Blockly$FieldColour.prototype.setColours=function(a,b){this.colours_=a;b&&(this.titles_=b);return this};module$exports$Blockly$FieldColour.prototype.setColumns=function(a){this.columns_=a;return this}; module$exports$Blockly$FieldColour.prototype.showEditor_=function(){this.dropdownCreate_();module$exports$Blockly$DropDownDiv.getContentDiv().appendChild(this.picker_);module$exports$Blockly$DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this));this.picker_.focus({preventScroll:!0})};module$exports$Blockly$FieldColour.prototype.onClick_=function(a){a=(a=a.target)&&a.label;null!==a&&(this.setValue(a),module$exports$Blockly$DropDownDiv.hideIfOwner(this))}; module$exports$Blockly$FieldColour.prototype.onKeyDown_=function(a){var b=!1;if(a.keyCode===module$exports$Blockly$utils$KeyCodes.UP)this.moveHighlightBy_(0,-1),b=!0;else if(a.keyCode===module$exports$Blockly$utils$KeyCodes.DOWN)this.moveHighlightBy_(0,1),b=!0;else if(a.keyCode===module$exports$Blockly$utils$KeyCodes.LEFT)this.moveHighlightBy_(-1,0),b=!0;else if(a.keyCode===module$exports$Blockly$utils$KeyCodes.RIGHT)this.moveHighlightBy_(1,0),b=!0;else if(a.keyCode===module$exports$Blockly$utils$KeyCodes.ENTER){if(b= this.getHighlighted_())b=b&&b.label,null!==b&&this.setValue(b);module$exports$Blockly$DropDownDiv.hideWithoutAnimation();b=!0}b&&a.stopPropagation()}; module$exports$Blockly$FieldColour.prototype.moveHighlightBy_=function(a,b){var c=this.colours_||module$exports$Blockly$FieldColour.COLOURS,d=this.columns_||module$exports$Blockly$FieldColour.COLUMNS,e=this.highlightedIndex_%d,f=Math.floor(this.highlightedIndex_/d);e+=a;f+=b;0>a?0>e&&0e&&(e=0):0d-1&&fd-1&&e--:0>b?0>f&&(f=0):0Math.floor(c.length/d)-1&&(f=Math.floor(c.length/d)-1);this.setHighlightedCell_(this.picker_.childNodes[f].childNodes[e], f*d+e)};module$exports$Blockly$FieldColour.prototype.onMouseMove_=function(a){var b=(a=a.target)&&Number(a.getAttribute("data-index"));null!==b&&b!==this.highlightedIndex_&&this.setHighlightedCell_(a,b)};module$exports$Blockly$FieldColour.prototype.onMouseEnter_=function(){this.picker_.focus({preventScroll:!0})};module$exports$Blockly$FieldColour.prototype.onMouseLeave_=function(){this.picker_.blur();var a=this.getHighlighted_();a&&(0,module$exports$Blockly$utils$dom.removeClass)(a,"blocklyColourHighlighted")}; module$exports$Blockly$FieldColour.prototype.getHighlighted_=function(){var a=this.columns_||module$exports$Blockly$FieldColour.COLUMNS,b=this.picker_.childNodes[Math.floor(this.highlightedIndex_/a)];return b?b.childNodes[this.highlightedIndex_%a]:null}; module$exports$Blockly$FieldColour.prototype.setHighlightedCell_=function(a,b){var c=this.getHighlighted_();c&&(0,module$exports$Blockly$utils$dom.removeClass)(c,"blocklyColourHighlighted");(0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyColourHighlighted");this.highlightedIndex_=b;(0,module$exports$Blockly$utils$aria.setState)(this.picker_,module$exports$Blockly$utils$aria.State.ACTIVEDESCENDANT,a.getAttribute("id"))}; module$exports$Blockly$FieldColour.prototype.dropdownCreate_=function(){var a=this.columns_||module$exports$Blockly$FieldColour.COLUMNS,b=this.colours_||module$exports$Blockly$FieldColour.COLOURS,c=this.titles_||module$exports$Blockly$FieldColour.TITLES,d=this.getValue(),e=document.createElement("table");e.className="blocklyColourTable";e.tabIndex=0;e.dir="ltr";(0,module$exports$Blockly$utils$aria.setRole)(e,module$exports$Blockly$utils$aria.Role.GRID);(0,module$exports$Blockly$utils$aria.setState)(e, module$exports$Blockly$utils$aria.State.EXPANDED,!0);(0,module$exports$Blockly$utils$aria.setState)(e,module$exports$Blockly$utils$aria.State.ROWCOUNT,Math.floor(b.length/a));(0,module$exports$Blockly$utils$aria.setState)(e,module$exports$Blockly$utils$aria.State.COLCOUNT,a);for(var f,g=0;gtr>td {","border: .5px solid #888;","box-sizing: border-box;","cursor: pointer;","display: inline-block;","height: 20px;","padding: 0;","width: 20px;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","position: relative;","}",".blocklyColourSelected, .blocklyColourSelected:hover {", "border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}"]);(0,module$exports$Blockly$fieldRegistry.register)("field_colour",module$exports$Blockly$FieldColour);var module$exports$Blockly$FieldDropdown=function(a,b,c){"function"!=typeof a&&module$contents$Blockly$FieldDropdown_validateOptions(a);this.menuGenerator_=a;this.suffixField=this.prefixField=this.generatedOptions_=null;this.trimOptions_();this.selectedOption_=this.getOptions(!1)[0];module$exports$Blockly$FieldDropdown.superClass_.constructor.call(this,this.selectedOption_[1],b,c);this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null}; (0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$FieldDropdown,module$exports$Blockly$Field);module$exports$Blockly$FieldDropdown.fromJson=function(a){return new this(a.options,void 0,a)};module$exports$Blockly$FieldDropdown.prototype.fromXml=function(a){this.isOptionListDynamic()&&this.getOptions(!1);this.setValue(a.textContent)}; module$exports$Blockly$FieldDropdown.prototype.loadState=function(a){this.loadLegacyState(module$exports$Blockly$FieldDropdown,a)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(a))};module$exports$Blockly$FieldDropdown.prototype.SERIALIZABLE=!0;module$exports$Blockly$FieldDropdown.CHECKMARK_OVERHANG=25;module$exports$Blockly$FieldDropdown.MAX_MENU_HEIGHT_VH=.45;var module$contents$Blockly$FieldDropdown_IMAGE_Y_OFFSET=5,module$contents$Blockly$FieldDropdown_IMAGE_Y_PADDING=2*module$contents$Blockly$FieldDropdown_IMAGE_Y_OFFSET; module$exports$Blockly$FieldDropdown.ARROW_CHAR=module$exports$Blockly$utils$userAgent.ANDROID?"\u25bc":"\u25be";module$exports$Blockly$FieldDropdown.prototype.CURSOR="default"; module$exports$Blockly$FieldDropdown.prototype.initView=function(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot();this.createTextElement_();this.imageElement_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.IMAGE,{},this.fieldGroup_);this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_();this.borderRect_&&(0,module$exports$Blockly$utils$dom.addClass)(this.borderRect_, "blocklyDropdownRect")};module$exports$Blockly$FieldDropdown.prototype.shouldAddBorderRect_=function(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()}; module$exports$Blockly$FieldDropdown.prototype.createTextArrow_=function(){this.arrow_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.TSPAN,{},this.textElement_);this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?module$exports$Blockly$FieldDropdown.ARROW_CHAR+" ":" "+module$exports$Blockly$FieldDropdown.ARROW_CHAR));this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):this.textElement_.appendChild(this.arrow_)}; module$exports$Blockly$FieldDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}; module$exports$Blockly$FieldDropdown.prototype.showEditor_=function(a){this.dropdownCreate_();this.menu_.openingCoords=a&&"number"===typeof a.clientX?new module$exports$Blockly$utils$Coordinate(a.clientX,a.clientY):null;this.menu_.render(module$exports$Blockly$DropDownDiv.getContentDiv());a=this.menu_.getElement();(0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyDropdownMenu");if(this.getConstants().FIELD_DROPDOWN_COLOURED_DIV){a=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().getColour(): this.sourceBlock_.getColour();var b=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;module$exports$Blockly$DropDownDiv.setColour(a,b)}module$exports$Blockly$DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this));this.menu_.focus();this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_);this.applyColour()}; module$exports$Blockly$FieldDropdown.prototype.dropdownCreate_=function(){var a=new module$exports$Blockly$Menu;a.setRole(module$exports$Blockly$utils$aria.Role.LISTBOX);this.menu_=a;var b=this.getOptions(!1);this.selectedMenuItem_=null;for(var c=0;ca.length)){b=[];for(c=0;c=c||0>=b)throw Error("Height and width values of an image field must be greater than 0."); this.flipRtl_=!1;this.altText_="";module$exports$Blockly$FieldImage.superClass_.constructor.call(this,a,null,g);g||(this.flipRtl_=!!f,this.altText_=(0,module$exports$Blockly$utils.replaceMessageReferences)(d)||"");this.size_=new module$exports$Blockly$utils$Size(b,c+module$exports$Blockly$FieldImage.Y_PADDING);this.imageHeight_=c;this.clickHandler_=null;"function"==typeof e&&(this.clickHandler_=e);this.imageElement_=null}; (0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$FieldImage,module$exports$Blockly$Field);module$exports$Blockly$FieldImage.prototype.DEFAULT_VALUE="";module$exports$Blockly$FieldImage.fromJson=function(a){return new this(a.src,a.width,a.height,void 0,void 0,void 0,a)};module$exports$Blockly$FieldImage.Y_PADDING=1;module$exports$Blockly$FieldImage.prototype.EDITABLE=!1;module$exports$Blockly$FieldImage.prototype.isDirty_=!1; module$exports$Blockly$FieldImage.prototype.configure_=function(a){module$exports$Blockly$FieldImage.superClass_.configure_.call(this,a);this.flipRtl_=!!a.flipRtl;this.altText_=(0,module$exports$Blockly$utils.replaceMessageReferences)(a.alt)||""}; module$exports$Blockly$FieldImage.prototype.initView=function(){this.imageElement_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.IMAGE,{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.altText_},this.fieldGroup_);this.imageElement_.setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS,"xlink:href",this.value_);this.clickHandler_&&(this.imageElement_.style.cursor="pointer")};module$exports$Blockly$FieldImage.prototype.updateSize_=function(){}; module$exports$Blockly$FieldImage.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:a};module$exports$Blockly$FieldImage.prototype.doValueUpdate_=function(a){this.value_=a;this.imageElement_&&this.imageElement_.setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS,"xlink:href",String(this.value_))};module$exports$Blockly$FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_}; module$exports$Blockly$FieldImage.prototype.setAlt=function(a){a!=this.altText_&&(this.altText_=a||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))};module$exports$Blockly$FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)};module$exports$Blockly$FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};module$exports$Blockly$FieldImage.prototype.getText_=function(){return this.altText_}; (0,module$exports$Blockly$fieldRegistry.register)("field_image",module$exports$Blockly$FieldImage);var module$exports$Blockly$FieldLabelSerializable=function(a,b,c){module$exports$Blockly$FieldLabelSerializable.superClass_.constructor.call(this,a,b,c)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$FieldLabelSerializable,module$exports$Blockly$FieldLabel);module$exports$Blockly$FieldLabelSerializable.fromJson=function(a){return new this((0,module$exports$Blockly$utils.replaceMessageReferences)(a.text),void 0,a)}; module$exports$Blockly$FieldLabelSerializable.prototype.EDITABLE=!1;module$exports$Blockly$FieldLabelSerializable.prototype.SERIALIZABLE=!0;(0,module$exports$Blockly$fieldRegistry.register)("field_label_serializable",module$exports$Blockly$FieldLabelSerializable);var module$exports$Blockly$FieldMultilineInput=function(a,b,c){module$exports$Blockly$FieldMultilineInput.superClass_.constructor.call(this,a,b,c);this.textGroup_=null;this.maxLines_=Infinity;this.isOverflowedY_=!1};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$FieldMultilineInput,module$exports$Blockly$FieldTextInput); module$exports$Blockly$FieldMultilineInput.prototype.configure_=function(a){module$exports$Blockly$FieldMultilineInput.superClass_.configure_.call(this,a);a.maxLines&&this.setMaxLines(a.maxLines)};module$exports$Blockly$FieldMultilineInput.fromJson=function(a){return new this((0,module$exports$Blockly$utils.replaceMessageReferences)(a.text),void 0,a)};module$exports$Blockly$FieldMultilineInput.prototype.toXml=function(a){a.textContent=this.getValue().replace(/\n/g," ");return a}; module$exports$Blockly$FieldMultilineInput.prototype.fromXml=function(a){this.setValue(a.textContent.replace(/ /g,"\n"))};module$exports$Blockly$FieldMultilineInput.prototype.saveState=function(){var a=this.saveLegacyState(module$exports$Blockly$FieldMultilineInput);return null!==a?a:this.getValue()};module$exports$Blockly$FieldMultilineInput.prototype.loadState=function(a){this.loadLegacyState(module$exports$Blockly$Field,a)||this.setValue(a)}; module$exports$Blockly$FieldMultilineInput.prototype.initView=function(){this.createBorderRect_();this.textGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{"class":"blocklyEditableText"},this.fieldGroup_)}; module$exports$Blockly$FieldMultilineInput.prototype.getDisplayText_=function(){var a=this.getText();if(!a)return module$exports$Blockly$Field.NBSP;var b=a.split("\n");a="";for(var c=this.isOverflowedY_?this.maxLines_:b.length,d=0;dthis.maxDisplayLength?e=e.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&d===c-1&&(e=e.substring(0,e.length-3)+"...");e=e.replace(/\s/g,module$exports$Blockly$Field.NBSP);a+=e;d!==c-1&&(a+="\n")}this.sourceBlock_.RTL&&(a+="\u200f"); return a};module$exports$Blockly$FieldMultilineInput.prototype.doValueUpdate_=function(a){module$exports$Blockly$FieldMultilineInput.superClass_.doValueUpdate_.call(this,a);this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_}; module$exports$Blockly$FieldMultilineInput.prototype.render_=function(){for(var a;a=this.textGroup_.firstChild;)this.textGroup_.removeChild(a);a=this.getDisplayText_().split("\n");for(var b=0,c=0;cb&&(b=e);c+=this.getConstants().FIELD_TEXT_HEIGHT+(0this.maxDisplayLength&&(a[d]=a[d].substring(0,this.maxDisplayLength));e.textContent=a[d];var k=(0,module$exports$Blockly$utils$dom.getFastTextWidth)(e,f,g,h);k>b&&(b=k)}b+=this.htmlInput_.offsetWidth-this.htmlInput_.clientWidth}this.borderRect_&&(c+=2*this.getConstants().FIELD_BORDER_RECT_Y_PADDING,b+=2*this.getConstants().FIELD_BORDER_RECT_X_PADDING, this.borderRect_.setAttribute("width",b),this.borderRect_.setAttribute("height",c));this.size_.width=b;this.size_.height=c;this.positionBorderRect_()};module$exports$Blockly$FieldMultilineInput.prototype.showEditor_=function(a,b){module$exports$Blockly$FieldMultilineInput.superClass_.showEditor_.call(this,a,b);this.forceRerender()}; module$exports$Blockly$FieldMultilineInput.prototype.widgetCreate_=function(){var a=(0,module$exports$Blockly$WidgetDiv.getDiv)(),b=this.workspace_.getScale(),c=document.createElement("textarea");c.className="blocklyHtmlInput blocklyHtmlTextAreaInput";c.setAttribute("spellcheck",this.spellcheck_);var d=this.getConstants().FIELD_TEXT_FONTSIZE*b+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=module$exports$Blockly$FieldTextInput.BORDERRADIUS*b+"px";d=this.getConstants().FIELD_BORDER_RECT_X_PADDING* b;var e=this.getConstants().FIELD_BORDER_RECT_Y_PADDING*b/2;c.style.padding=e+"px "+d+"px "+e+"px "+d+"px";d=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING;c.style.lineHeight=d*b+"px";a.appendChild(c);c.value=c.defaultValue=this.getEditorText_(this.value_);c.untypedDefaultValue_=this.value_;c.oldValue_=null;module$exports$Blockly$utils$userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();this.bindInputEvents_(c);return c}; module$exports$Blockly$FieldMultilineInput.prototype.setMaxLines=function(a){"number"===typeof a&&0this.max_&&(0,module$exports$Blockly$utils$aria.setState)(a,module$exports$Blockly$utils$aria.State.VALUEMAX,this.max_);return a};(0,module$exports$Blockly$fieldRegistry.register)("field_number",module$exports$Blockly$FieldNumber);var module$exports$Blockly$FieldVariable=function(a,b,c,d,e){this.menuGenerator_=module$exports$Blockly$FieldVariable.dropdownCreate;this.defaultVariableName="string"===typeof a?a:"";this.size_=new module$exports$Blockly$utils$Size(0,0);e&&this.configure_(e);b&&this.setValidator(b);e||this.setTypes_(c,d)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$FieldVariable,module$exports$Blockly$FieldDropdown); module$exports$Blockly$FieldVariable.fromJson=function(a){return new this((0,module$exports$Blockly$utils.replaceMessageReferences)(a.variable),void 0,void 0,void 0,a)};module$exports$Blockly$FieldVariable.prototype.SERIALIZABLE=!0;module$exports$Blockly$FieldVariable.prototype.configure_=function(a){module$exports$Blockly$FieldVariable.superClass_.configure_.call(this,a);this.setTypes_(a.variableTypes,a.defaultType)}; module$exports$Blockly$FieldVariable.prototype.initModel=function(){if(!this.variable_){var a=(0,module$exports$Blockly$Variables.getOrCreateVariablePackage)(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(a.getId())}}; module$exports$Blockly$FieldVariable.prototype.shouldAddBorderRect_=function(){return module$exports$Blockly$FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!=this.sourceBlock_.type)}; module$exports$Blockly$FieldVariable.prototype.fromXml=function(a){var b=a.getAttribute("id"),c=a.textContent,d=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=(0,module$exports$Blockly$Variables.getOrCreateVariablePackage)(this.sourceBlock_.workspace,b,c,d);if(null!=d&&d!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+(0,module$exports$Blockly$Xml.domToText)(a)+".");this.setValue(b.getId())}; module$exports$Blockly$FieldVariable.prototype.toXml=function(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a};module$exports$Blockly$FieldVariable.prototype.saveState=function(a){var b=this.saveLegacyState(module$exports$Blockly$FieldVariable);if(null!==b)return b;this.initModel();b={id:this.variable_.getId()};a&&(b.name=this.variable_.name,b.type=this.variable_.type);return b}; module$exports$Blockly$FieldVariable.prototype.loadState=function(a){this.loadLegacyState(module$exports$Blockly$FieldVariable,a)||(a=(0,module$exports$Blockly$Variables.getOrCreateVariablePackage)(this.sourceBlock_.workspace,a.id||null,a.name,a.type||""),this.setValue(a.getId()))}; module$exports$Blockly$FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");module$exports$Blockly$FieldVariable.superClass_.setSourceBlock.call(this,a)};module$exports$Blockly$FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null};module$exports$Blockly$FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""}; module$exports$Blockly$FieldVariable.prototype.getVariable=function(){return this.variable_};module$exports$Blockly$FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null}; module$exports$Blockly$FieldVariable.prototype.doClassValidation_=function(a){if(null===a)return null;var b=(0,module$exports$Blockly$Variables.getVariable)(this.sourceBlock_.workspace,a);if(!b)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;b=b.type;return this.typeIsAllowed_(b)?a:(console.warn("Variable type doesn't match this field! Type was "+b),null)}; module$exports$Blockly$FieldVariable.prototype.doValueUpdate_=function(a){this.variable_=(0,module$exports$Blockly$Variables.getVariable)(this.sourceBlock_.workspace,a);module$exports$Blockly$FieldVariable.superClass_.doValueUpdate_.call(this,a)};module$exports$Blockly$FieldVariable.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;cthis.previousScale_){var c=b-this.previousScale_;c=0Object.keys(this.cachedPoints_).length&&(this.cachedPoints_=Object.create(null),this.previousScale_=0)}; module$exports$Blockly$TouchGesture.prototype.getTouchPoint=function(a){return this.startWorkspace_?new module$exports$Blockly$utils$Coordinate(a.pageX?a.pageX:a.changedTouches[0].pageX,a.pageY?a.pageY:a.changedTouches[0].pageY):null};var module$exports$Blockly$WorkspaceAudio=function(a){this.parentWorkspace_=a;this.SOUNDS_=Object.create(null)};module$exports$Blockly$WorkspaceAudio.prototype.lastSound_=null;module$exports$Blockly$WorkspaceAudio.prototype.dispose=function(){this.SOUNDS_=this.parentWorkspace_=null}; module$exports$Blockly$WorkspaceAudio.prototype.load=function(a,b){if(a.length){try{var c=new module$exports$Blockly$utils$global.globalThis.Audio}catch(h){return}for(var d,e=0;erect,",a+" .blocklyEditableText>rect {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","fill-opacity: .6;","stroke: none;","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text {", "fill: #000;","}",a+" .blocklyFlyoutLabelText {","fill: #000;","}",a+" .blocklyText.blocklyBubbleText {","fill: #000;","}",a+" .blocklyEditableText:not(.editing):hover>rect {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",a+" .blocklyHighlightedConnectionPath {","stroke: #fc3;","}",a+" .blocklyReplaceable .blocklyPath {", "fill-opacity: .5;","}",a+" .blocklyReplaceable .blocklyPathLight,",a+" .blocklyReplaceable .blocklyPathDark {","display: none;","}",a+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]};var module$exports$Blockly$blockRendering$Debug=function(a){this.debugElements_=[];this.svgRoot_=null;this.constants_=a};module$exports$Blockly$blockRendering$Debug.config={rowSpacers:!0,elemSpacers:!0,rows:!0,elems:!0,connections:!0,blockBounds:!0,connectedBlockBounds:!0,render:!0};module$exports$Blockly$blockRendering$Debug.prototype.clearElems=function(){for(var a=0;aa.height;e&&(b-=d);this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"rowSpacerRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:b,width:a.width,height:d,stroke:e?"black":"blue",fill:"blue","fill-opacity":"0.5","stroke-width":"1px"},this.svgRoot_))}}; module$exports$Blockly$blockRendering$Debug.prototype.drawSpacerElem=function(a,b,c){if(module$exports$Blockly$blockRendering$Debug.config.elemSpacers){b=Math.abs(a.width);var d=0>a.width,e=d?a.xPos-b:a.xPos;c&&(e=-(e+b));this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"elemSpacerRect blockRenderDebug",x:e,y:a.centerline-a.height/2,width:b,height:a.height,stroke:"pink",fill:d?"black":"pink","fill-opacity":"0.5","stroke-width":"1px"}, this.svgRoot_))}}; module$exports$Blockly$blockRendering$Debug.prototype.drawRenderedElem=function(a,b){if(module$exports$Blockly$blockRendering$Debug.config.elems){var c=a.xPos;b&&(c=-(c+a.width));b=a.centerline-a.height/2;this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"rowRenderingRect blockRenderDebug",x:c,y:b,width:a.width,height:a.height,stroke:"black",fill:"none","stroke-width":"1px"},this.svgRoot_));module$exports$Blockly$blockRendering$Types.isField(a)&&a.field instanceof module$exports$Blockly$FieldLabel&&this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"rowRenderingRect blockRenderDebug",x:c,y:b+this.constants_.FIELD_TEXT_BASELINE,width:a.width,height:"0.1px",stroke:"red",fill:"none","stroke-width":"0.5px"},this.svgRoot_))}module$exports$Blockly$blockRendering$Types.isInput(a)&&module$exports$Blockly$blockRendering$Debug.config.connections&&this.drawConnection(a.connectionModel)}; module$exports$Blockly$blockRendering$Debug.prototype.drawConnection=function(a){if(module$exports$Blockly$blockRendering$Debug.config.connections){if(a.type==module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE){var b=4;var c="magenta";var d="none"}else a.type==module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE?(b=2,d=c="magenta"):a.type==module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT?(b=4,c="goldenrod",d="none"):a.type==module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT&& (b=2,d=c="goldenrod");this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CIRCLE,{"class":"blockRenderDebug",cx:a.offsetInBlock_.x,cy:a.offsetInBlock_.y,r:b,fill:d,stroke:c},this.svgRoot_))}}; module$exports$Blockly$blockRendering$Debug.prototype.drawRenderedRow=function(a,b,c){module$exports$Blockly$blockRendering$Debug.config.rows&&(this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"elemRenderingRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:a.yPos,width:a.width,height:a.height,stroke:"red",fill:"none","stroke-width":"1px"},this.svgRoot_)),module$exports$Blockly$blockRendering$Types.isTopOrBottomRow(a)|| module$exports$Blockly$blockRendering$Debug.config.connectedBlockBounds&&this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"connectedBlockWidth blockRenderDebug",x:c?-(a.xPos+a.widthWithConnectedBlocks):a.xPos,y:a.yPos,width:a.widthWithConnectedBlocks,height:a.height,stroke:this.randomColour_,fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))}; module$exports$Blockly$blockRendering$Debug.prototype.drawRowWithElements=function(a,b,c){for(var d=0;dMath.abs(b-this.oldTop_)&&1>Math.abs(c-this.oldLeft_))){var d=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.VIEWPORT_CHANGE))(b,c,a,this.id,this.oldScale_);this.oldScale_=a;this.oldTop_=b;this.oldLeft_=c;(0,module$exports$Blockly$Events$utils.fire)(d)}}}; module$exports$Blockly$WorkspaceSvg.prototype.translate=function(a,b){if(this.useWorkspaceDragSurface_&&this.isDragSurfaceActive_)this.workspaceDragSurface_.translateSurface(a,b);else{var c="translate("+a+","+b+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",c);this.svgBubbleCanvas_.setAttribute("transform",c)}this.blockDragSurface_&&this.blockDragSurface_.translateAndScaleGroup(a,b,this.scale);this.grid_&&this.grid_.moveTo(a,b);this.maybeFireViewportChangeEvent()}; module$exports$Blockly$WorkspaceSvg.prototype.resetDragSurface=function(){if(this.useWorkspaceDragSurface_){this.isDragSurfaceActive_=!1;var a=this.workspaceDragSurface_.getSurfaceTranslation();this.workspaceDragSurface_.clearAndHide(this.svgGroup_);a="translate("+a.x+","+a.y+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",a);this.svgBubbleCanvas_.setAttribute("transform",a)}}; module$exports$Blockly$WorkspaceSvg.prototype.setupDragSurface=function(){if(this.useWorkspaceDragSurface_&&!this.isDragSurfaceActive_){this.isDragSurfaceActive_=!0;var a=this.svgBlockCanvas_.previousSibling,b=parseInt(this.getParentSvg().getAttribute("width"),10),c=parseInt(this.getParentSvg().getAttribute("height"),10),d=(0,module$exports$Blockly$utils.getRelativeXY)(this.getCanvas());this.workspaceDragSurface_.setContentsAndShow(this.getCanvas(),this.getBubbleCanvas(),a,b,c,this.scale);this.workspaceDragSurface_.translateSurface(d.x, d.y)}};module$exports$Blockly$WorkspaceSvg.prototype.getBlockDragSurface=function(){return this.blockDragSurface_};module$exports$Blockly$WorkspaceSvg.prototype.getWidth=function(){var a=this.getMetrics();return a?a.viewWidth/this.scale:0}; module$exports$Blockly$WorkspaceSvg.prototype.setVisible=function(a){this.isVisible_=a;if(this.svgGroup_)if(this.scrollbar&&this.scrollbar.setContainerVisible(a),this.getFlyout()&&this.getFlyout().setContainerVisible(a),this.getParentSvg().style.display=a?"block":"none",this.toolbox_&&this.toolbox_.setVisible(a),a){a=this.getAllBlocks(!1);for(var b=a.length-1;0<=b;b--)a[b].markDirty();this.render();this.toolbox_&&this.toolbox_.position()}else this.hideChaff(!0)}; module$exports$Blockly$WorkspaceSvg.prototype.render=function(){for(var a=this.getAllBlocks(!1),b=a.length-1;0<=b;b--)a[b].render(!1);if(this.currentGesture_)for(a=this.currentGesture_.getInsertionMarkers(),b=0;b=Math.abs(c-h.x)&&1>=Math.abs(d-h.y)){f=!0;break}}if(!f){var k=e.getConnections_(!1);a=0;for(b=void 0;b=k[a];a++)if(b.closest(module$exports$Blockly$internalConstants.SNAP_RADIUS,new module$exports$Blockly$utils$Coordinate(c,d)).connection){f=!0;break}}f&&(c=this.RTL?c-module$exports$Blockly$internalConstants.SNAP_RADIUS:c+module$exports$Blockly$internalConstants.SNAP_RADIUS,d+=2*module$exports$Blockly$internalConstants.SNAP_RADIUS)}while(f);e.moveTo(new module$exports$Blockly$utils$Coordinate(c, d))}}finally{(0,module$exports$Blockly$Events$utils.enable)()}(0,module$exports$Blockly$Events$utils.isEnabled)()&&!e.isShadow()&&(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CREATE))(e));e.select()}; module$exports$Blockly$WorkspaceSvg.prototype.pasteWorkspaceComment_=function(a){(0,module$exports$Blockly$Events$utils.disable)();try{var b=module$exports$Blockly$WorkspaceCommentSvg.fromXml(a,this);var c=parseInt(a.getAttribute("x"),10),d=parseInt(a.getAttribute("y"),10);isNaN(c)||isNaN(d)||(this.RTL&&(c=-c),b.moveBy(c+50,d+50))}finally{(0,module$exports$Blockly$Events$utils.enable)()}(0,module$exports$Blockly$Events$utils.isEnabled)()&&module$exports$Blockly$WorkspaceComment.fireCreateEvent(b); b.select()};module$exports$Blockly$WorkspaceSvg.prototype.refreshToolboxSelection=function(){var a=this.isFlyout?this.targetWorkspace:this;a&&!a.currentGesture_&&a.toolbox_&&a.toolbox_.getFlyout()&&a.toolbox_.refreshSelection()};module$exports$Blockly$WorkspaceSvg.prototype.renameVariableById=function(a,b){module$exports$Blockly$WorkspaceSvg.superClass_.renameVariableById.call(this,a,b);this.refreshToolboxSelection()}; module$exports$Blockly$WorkspaceSvg.prototype.deleteVariableById=function(a){module$exports$Blockly$WorkspaceSvg.superClass_.deleteVariableById.call(this,a);this.refreshToolboxSelection()};module$exports$Blockly$WorkspaceSvg.prototype.createVariable=function(a,b,c){a=module$exports$Blockly$WorkspaceSvg.superClass_.createVariable.call(this,a,b,c);this.refreshToolboxSelection();return a}; module$exports$Blockly$WorkspaceSvg.prototype.recordDeleteAreas=function(){module$exports$Blockly$utils.deprecation.warn("WorkspaceSvg.prototype.recordDeleteAreas","June 2021","June 2022","WorkspaceSvg.prototype.recordDragTargets");this.recordDragTargets()}; module$exports$Blockly$WorkspaceSvg.prototype.recordDragTargets=function(){var a=this.componentManager_.getComponents(module$exports$Blockly$ComponentManager.Capability.DRAG_TARGET,!0);this.dragTargetAreas_=[];for(var b=0,c;c=a[b];b++){var d=c.getClientRect();d&&this.dragTargetAreas_.push({component:c,clientRect:d})}}; module$exports$Blockly$WorkspaceSvg.prototype.getDragTarget=function(a){for(var b=0,c;c=this.dragTargetAreas_[b];b++)if(c.clientRect.contains(a.clientX,a.clientY))return c.component;return null};module$exports$Blockly$WorkspaceSvg.prototype.onMouseDown_=function(a){var b=this.getGesture(a);b&&b.handleWsStart(a,this)}; module$exports$Blockly$WorkspaceSvg.prototype.startDrag=function(a,b){a=(0,module$exports$Blockly$browserEvents.mouseToSvg)(a,this.getParentSvg(),this.getInverseScreenCTM());a.x/=this.scale;a.y/=this.scale;this.dragDeltaXY_=module$exports$Blockly$utils$Coordinate.difference(b,a)}; module$exports$Blockly$WorkspaceSvg.prototype.moveDrag=function(a){a=(0,module$exports$Blockly$browserEvents.mouseToSvg)(a,this.getParentSvg(),this.getInverseScreenCTM());a.x/=this.scale;a.y/=this.scale;return module$exports$Blockly$utils$Coordinate.sum(this.dragDeltaXY_,a)};module$exports$Blockly$WorkspaceSvg.prototype.isDragging=function(){return null!=this.currentGesture_&&this.currentGesture_.isDragging()}; module$exports$Blockly$WorkspaceSvg.prototype.isDraggable=function(){return this.options.moveOptions&&this.options.moveOptions.drag};module$exports$Blockly$WorkspaceSvg.prototype.isMovable=function(){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}; module$exports$Blockly$WorkspaceSvg.prototype.isMovableHorizontally=function(){var a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollHorizontally())};module$exports$Blockly$WorkspaceSvg.prototype.isMovableVertically=function(){var a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollVertically())}; module$exports$Blockly$WorkspaceSvg.prototype.onMouseWheel_=function(a){if(module$exports$Blockly$Gesture.inProgress())a.preventDefault(),a.stopPropagation();else{var b=this.options.zoomOptions&&this.options.zoomOptions.wheel,c=this.options.moveOptions&&this.options.moveOptions.wheel;if(b||c){var d=(0,module$exports$Blockly$browserEvents.getScrollDeltaPixels)(a);if(module$exports$Blockly$utils$userAgent.MAC)var e=a.metaKey;b&&(a.ctrlKey||e||!c)?(d=-d.y/50,b=(0,module$exports$Blockly$browserEvents.mouseToSvg)(a, this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(b.x,b.y,d)):(b=this.scrollX-d.x,c=this.scrollY-d.y,a.shiftKey&&!d.x&&(b=this.scrollX-d.y,c=this.scrollY),this.scroll(b,c));a.preventDefault()}}}; module$exports$Blockly$WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var a=this.getTopBoundedElements();if(!a.length)return new module$exports$Blockly$utils$Rect(0,0,0,0);for(var b=a[0].getBoundingRectangle(),c=1;cb.bottom&&(b.bottom=d.bottom),d.leftb.right&&(b.right=d.right))}return b}; module$exports$Blockly$WorkspaceSvg.prototype.cleanUp=function(){this.setResizesEnabled(!1);(0,module$exports$Blockly$Events$utils.setGroup)(!0);for(var a=this.getTopBlocks(!0),b=0,c=0,d;d=a[c];c++)if(d.isMovable()){var e=d.getRelativeToSurfaceXY();d.moveBy(-e.x,b-e.y);d.snapToGrid();b=d.getRelativeToSurfaceXY().y+d.getHeightWidth().height+this.renderer_.getConstants().MIN_BLOCK_HEIGHT}(0,module$exports$Blockly$Events$utils.setGroup)(!1);this.setResizesEnabled(!0)}; module$exports$Blockly$WorkspaceSvg.prototype.showContextMenu=function(a){if(!this.options.readOnly&&!this.isFlyout){var b=module$exports$Blockly$ContextMenuRegistry.registry.getContextMenuOptions(module$exports$Blockly$ContextMenuRegistry.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(b,a);(0,module$exports$Blockly$ContextMenu.show)(a,b,this.RTL)}}; module$exports$Blockly$WorkspaceSvg.prototype.updateToolbox=function(a){if(a=(0,module$exports$Blockly$utils$toolbox.convertToolboxDefToJson)(a)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if((0,module$exports$Blockly$utils$toolbox.hasCategories)(a)){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=a;this.toolbox_.render(a)}else{if(!this.flyout_)throw Error("Existing toolbox has categories. Can't change mode."); this.options.languageTree=a;this.flyout_.show(a)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.");};module$exports$Blockly$WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():((0,module$exports$Blockly$common.setMainWorkspace)(this),this.setBrowserFocus())}; module$exports$Blockly$WorkspaceSvg.prototype.setBrowserFocus=function(){document.activeElement&&document.activeElement.blur&&document.activeElement.blur();try{this.getParentSvg().focus({preventScroll:!0})}catch(a){try{this.getParentSvg().parentNode.setActive()}catch(b){this.getParentSvg().parentNode.focus({preventScroll:!0})}}}; module$exports$Blockly$WorkspaceSvg.prototype.zoom=function(a,b,c){c=Math.pow(this.options.zoomOptions.scaleSpeed,c);var d=this.scale*c;if(this.scale!=d){d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:dthis.options.zoomOptions.maxScale?a=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&a90-b||a>-90-b&&a<-90+b?!0:!1}; module$exports$Blockly$HorizontalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.top;return this.toolboxPosition_==module$exports$Blockly$utils$toolbox.Position.TOP?new module$exports$Blockly$utils$Rect(-1E9,b+a.height,-1E9,1E9):new module$exports$Blockly$utils$Rect(b,1E9,-1E9,1E9)}; module$exports$Blockly$HorizontalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.getFlyoutScale();for(var a=0,b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)a=Math.max(a,d.getHeightWidth().height);c=this.buttons_;d=0;for(var e;e=c[d];d++)a=Math.max(a,e.height);a+=1.5*this.MARGIN;a*=this.workspace_.scale;a+=module$exports$Blockly$Scrollbar.scrollbarThickness;if(this.height_!=a){for(c=0;d=b[c];c++)d.flyoutRect_&&this.moveRectToBlock_(d.flyoutRect_,d);this.targetWorkspace.toolboxPosition!= this.toolboxPosition_||this.toolboxPosition_!=module$exports$Blockly$utils$toolbox.Position.TOP||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+a);this.height_=a;this.position();this.targetWorkspace.recordDragTargets()}};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$HorizontalFlyout);var module$exports$Blockly$IAutoHideable=function(){};var module$exports$Blockly$IPositionable=function(){};var module$exports$Blockly$IRegistrableField={};var module$exports$Blockly$IStyleable=function(){};var module$exports$Blockly$IToolbox=function(){};var module$exports$Blockly$Mutator=function(a){module$exports$Blockly$Mutator.superClass_.constructor.call(this,null);this.quarkNames_=a};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$Mutator,module$exports$Blockly$Icon);module$exports$Blockly$Mutator.prototype.workspace_=null;module$exports$Blockly$Mutator.prototype.workspaceWidth_=0;module$exports$Blockly$Mutator.prototype.workspaceHeight_=0;module$exports$Blockly$Mutator.prototype.setBlock=function(a){this.block_=a}; module$exports$Blockly$Mutator.prototype.getWorkspace=function(){return this.workspace_}; module$exports$Blockly$Mutator.prototype.drawIcon_=function(a){(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.PATH,{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},a); (0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CIRCLE,{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};module$exports$Blockly$Mutator.prototype.iconClick_=function(a){this.block_.isEditable()&&module$exports$Blockly$Icon.prototype.iconClick_.call(this,a)}; module$exports$Blockly$Mutator.prototype.createEditor_=function(){this.svgDialog_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.SVG,{x:module$exports$Blockly$Bubble.BORDER_WIDTH,y:module$exports$Blockly$Bubble.BORDER_WIDTH},null);if(this.quarkNames_.length){var a=(0,module$exports$Blockly$utils$xml.createElement)("xml");for(var b=0,c;c=this.quarkNames_[b];b++){var d=(0,module$exports$Blockly$utils$xml.createElement)("block");d.setAttribute("type",c);a.appendChild(d)}}else a= null;b=new module$exports$Blockly$Options({disable:!1,parentWorkspace:this.block_.workspace,media:this.block_.workspace.options.pathToMedia,rtl:this.block_.RTL,horizontalLayout:!1,renderer:this.block_.workspace.options.renderer,rendererOverrides:this.block_.workspace.options.rendererOverrides});b.toolboxPosition=this.block_.RTL?module$exports$Blockly$utils$toolbox.Position.RIGHT:module$exports$Blockly$utils$toolbox.Position.LEFT;if(c=!!a)b.languageTree=(0,module$exports$Blockly$utils$toolbox.convertToolboxDefToJson)(a); this.workspace_=new module$exports$Blockly$WorkspaceSvg(b);this.workspace_.isMutator=!0;this.workspace_.addChangeListener(module$exports$Blockly$Events$utils.disableOrphans);a=c?this.workspace_.addFlyout(module$exports$Blockly$utils$Svg.G):null;b=this.workspace_.createDom("blocklyMutatorBackground");a&&b.insertBefore(a,this.workspace_.svgBlockCanvas_);this.svgDialog_.appendChild(b);return this.svgDialog_}; module$exports$Blockly$Mutator.prototype.updateEditable=function(){module$exports$Blockly$Mutator.superClass_.updateEditable.call(this);this.block_.isInFlyout||(this.block_.isEditable()?this.iconGroup_&&(0,module$exports$Blockly$utils$dom.removeClass)(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&(0,module$exports$Blockly$utils$dom.addClass)(this.iconGroup_,"blocklyIconGroupReadonly")))}; module$exports$Blockly$Mutator.prototype.resizeBubble_=function(){var a=2*module$exports$Blockly$Bubble.BORDER_WIDTH,b=this.workspace_.getCanvas().getBBox(),c=b.width+b.x,d=b.height+3*a,e=this.workspace_.getFlyout();if(e){var f=e.getWorkspace().getMetricsManager().getScrollMetrics();d=Math.max(d,f.height+20);c+=e.getWidth()}this.block_.RTL&&(c=-b.x);c+=3*a;if(Math.abs(this.workspaceWidth_-c)>a||Math.abs(this.workspaceHeight_-d)>a)this.workspaceWidth_=c,this.workspaceHeight_=d,this.bubble_.setBubbleSize(c+ a,d+a),this.svgDialog_.setAttribute("width",this.workspaceWidth_),this.svgDialog_.setAttribute("height",this.workspaceHeight_),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_);this.block_.RTL&&(a="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",a));this.workspace_.resize()};module$exports$Blockly$Mutator.prototype.onBubbleMove_=function(){this.workspace_&&this.workspace_.recordDragTargets()}; module$exports$Blockly$Mutator.prototype.setVisible=function(a){if(a!=this.isVisible())if((0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.BUBBLE_OPEN))(this.block_,a,"mutator")),a){this.bubble_=new module$exports$Blockly$Bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,null,null);this.bubble_.setSvgId(this.block_.id);this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this)); var b=this.workspace_.options.languageTree;a=this.workspace_.getFlyout();b&&(a.init(this.workspace_),a.show(b));this.rootBlock_=this.block_.decompose(this.workspace_);b=this.rootBlock_.getDescendants(!1);for(var c=0,d=void 0;d=b[c];c++)d.render();this.rootBlock_.setMovable(!1);this.rootBlock_.setDeletable(!1);a?(b=2*a.CORNER_RADIUS,a=this.rootBlock_.RTL?a.getWidth()+b:b):a=b=16;this.block_.RTL&&(a=-a);this.rootBlock_.moveBy(a,b);if(this.block_.saveConnections){var e=this,f=this.block_;f.saveConnections(this.rootBlock_); this.sourceListener_=function(){f.saveConnections(e.rootBlock_)};this.block_.workspace.addChangeListener(this.sourceListener_)}this.resizeBubble_();this.workspace_.addChangeListener(this.workspaceChanged_.bind(this));this.updateWorkspace_();this.applyColour()}else this.svgDialog_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,this.bubble_.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(this.block_.workspace.removeChangeListener(this.sourceListener_), this.sourceListener_=null)};module$exports$Blockly$Mutator.prototype.workspaceChanged_=function(a){a.isUiEvent||a.type==module$exports$Blockly$Events$utils.CHANGE&&"disabled"==a.element||a.type==module$exports$Blockly$Events$utils.CREATE||this.updateWorkspace_()}; module$exports$Blockly$Mutator.prototype.updateWorkspace_=function(){if(!this.workspace_.isDragging())for(var a=this.workspace_.getTopBlocks(!1),b=0,c=void 0;c=a[b];b++){var d=c.getRelativeToSurfaceXY();20>d.y&&c.moveBy(0,20-d.y);if(c.RTL){var e=-20,f=this.workspace_.getFlyout();f&&(e-=f.getWidth());d.x>e&&c.moveBy(e-d.x,0)}else 20>d.x&&c.moveBy(20-d.x,0)}if(this.rootBlock_.workspace==this.workspace_){(0,module$exports$Blockly$Events$utils.setGroup)(!0);var g=this.block_;a=module$exports$Blockly$Events$BlockChange.getExtraBlockState_(g); b=g.rendered;g.rendered=!1;g.compose(this.rootBlock_);g.rendered=b;g.initSvg();g.rendered&&g.render();b=module$exports$Blockly$Events$BlockChange.getExtraBlockState_(g);if(a!=b){(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(g,"mutation",null,a,b));var h=(0,module$exports$Blockly$Events$utils.getGroup)();setTimeout(function(){(0,module$exports$Blockly$Events$utils.setGroup)(h);g.bumpNeighbours();(0,module$exports$Blockly$Events$utils.setGroup)(!1)}, module$exports$Blockly$internalConstants.BUMP_DELAY)}this.workspace_.isDragging()||this.resizeBubble_();(0,module$exports$Blockly$Events$utils.setGroup)(!1)}};module$exports$Blockly$Mutator.prototype.dispose=function(){this.block_.mutator=null;module$exports$Blockly$Icon.prototype.dispose.call(this)}; module$exports$Blockly$Mutator.prototype.updateBlockStyle=function(){var a=this.workspace_;if(a&&a.getAllBlocks(!1)){for(var b=a.getAllBlocks(!1),c=0,d;d=b[c];c++)d.setStyle(d.getStyleName());if(a=a.getFlyout())for(a=a.workspace_.getAllBlocks(!1),b=0;c=a[b];b++)c.setStyle(c.getStyleName())}}; module$exports$Blockly$Mutator.reconnect=function(a,b,c){if(!a||!a.getSourceBlock().workspace)return!1;c=b.getInput(c).connection;var d=a.targetBlock();return d&&d!=b||c.targetConnection==a?!1:(c.isConnected()&&c.disconnect(),c.connect(a),!0)};module$exports$Blockly$Mutator.findParentWs=function(a){var b=null;if(a&&a.options){var c=a.options.parentWorkspace;a.isFlyout?c&&c.options&&(b=c.options.parentWorkspace):c&&(b=c)}return b};var module$exports$Blockly$Procedures={DEFAULT_ARG:"x",allProcedures:function(a){var b=a.getBlocksByType("procedures_defnoreturn",!1).map(function(c){return c.getProcedureDef()});a=a.getBlocksByType("procedures_defreturn",!1).map(function(c){return c.getProcedureDef()});b.sort(module$contents$Blockly$Procedures_procTupleComparator);a.sort(module$contents$Blockly$Procedures_procTupleComparator);return[b,a]}},module$contents$Blockly$Procedures_procTupleComparator=function(a,b){return a[0].localeCompare(b[0], void 0,{sensitivity:"base"})};module$exports$Blockly$Procedures.findLegalName=function(a,b){if(b.isInFlyout)return a;for(a=a||Blockly.Msg.UNNAMED_KEY||"unnamed";!module$contents$Blockly$Procedures_isLegalName(a,b.workspace,b);){var c=a.match(/^(.*?)(\d+)$/);a=c?c[1]+(parseInt(c[2],10)+1):a+"2"}return a};var module$contents$Blockly$Procedures_isLegalName=function(a,b,c){return!(0,module$exports$Blockly$Procedures.isNameUsed)(a,b,c)}; module$exports$Blockly$Procedures.isNameUsed=function(a,b,c){b=b.getAllBlocks(!1);for(var d=0;db.indexOf(d))throw Error(d+" is not a valid modifier key.");}; module$exports$Blockly$ShortcutRegistry.prototype.createSerializedKey=function(a,b){var c="";if(b){this.checkModifiers_(b);for(var d in module$exports$Blockly$ShortcutRegistry.modifierKeys)-1>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","padding: 4px 0 4px 0;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyToolboxContents {","display: flex;","flex-wrap: wrap;", "flex-direction: column;","}",".blocklyToolboxContents:focus {","outline: none;","}"]);(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.TOOLBOX,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$Toolbox);var module$exports$Blockly$uiPosition={verticalPosition:{TOP:0,BOTTOM:1},horizontalPosition:{LEFT:0,RIGHT:1},bumpDirection:{UP:0,DOWN:1},getStartPositionRect:function(a,b,c,d,e,f){var g=f.scrollbar&&f.scrollbar.canScrollVertically();a.horizontal===module$exports$Blockly$uiPosition.horizontalPosition.LEFT?(c=e.absoluteMetrics.left+c,g&&f.RTL&&(c+=module$exports$Blockly$Scrollbar.scrollbarThickness)):(c=e.absoluteMetrics.left+e.viewMetrics.width-b.width-c,g&&!f.RTL&&(c-=module$exports$Blockly$Scrollbar.scrollbarThickness)); a.vertical===module$exports$Blockly$uiPosition.verticalPosition.TOP?a=e.absoluteMetrics.top+d:(a=e.absoluteMetrics.top+e.viewMetrics.height-b.height-d,f.scrollbar&&f.scrollbar.canScrollHorizontally()&&(a-=module$exports$Blockly$Scrollbar.scrollbarThickness));return new module$exports$Blockly$utils$Rect(a,a+b.height,c,c+b.width)},getCornerOppositeToolbox:function(a,b){return{horizontal:b.toolboxMetrics.position===module$exports$Blockly$utils$toolbox.Position.LEFT||a.horizontalLayout&&!a.RTL?module$exports$Blockly$uiPosition.horizontalPosition.RIGHT: module$exports$Blockly$uiPosition.horizontalPosition.LEFT,vertical:b.toolboxMetrics.position===module$exports$Blockly$utils$toolbox.Position.BOTTOM?module$exports$Blockly$uiPosition.verticalPosition.TOP:module$exports$Blockly$uiPosition.verticalPosition.BOTTOM}},bumpPositionRect:function(a,b,c,d){for(var e=a.left,f=a.right-a.left,g=a.bottom-a.top,h=0;h=this.workspace_.options.maxTrashcanContents||(a=new module$exports$Blockly$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,move:{scrollbars:!0}}), this.workspace_.horizontalLayout?(a.toolboxPosition=this.workspace_.toolboxPosition==module$exports$Blockly$utils$toolbox.Position.TOP?module$exports$Blockly$utils$toolbox.Position.BOTTOM:module$exports$Blockly$utils$toolbox.Position.TOP,this.flyout=new ((0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace_.options,!0))(a)):(a.toolboxPosition=this.workspace_.toolboxPosition==module$exports$Blockly$utils$toolbox.Position.RIGHT? module$exports$Blockly$utils$toolbox.Position.LEFT:module$exports$Blockly$utils$toolbox.Position.RIGHT,this.flyout=new ((0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.FLYOUTS_VERTICAL_TOOLBOX,this.workspace_.options,!0))(a)),this.workspace_.addChangeListener(this.onDelete_.bind(this)))};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$Trashcan,module$exports$Blockly$DeleteArea); var module$contents$Blockly$Trashcan_WIDTH=47,module$contents$Blockly$Trashcan_BODY_HEIGHT=44,module$contents$Blockly$Trashcan_LID_HEIGHT=16,module$contents$Blockly$Trashcan_MARGIN_VERTICAL=20,module$contents$Blockly$Trashcan_MARGIN_HORIZONTAL=20,module$contents$Blockly$Trashcan_MARGIN_HOTSPOT=10,module$contents$Blockly$Trashcan_SPRITE_LEFT=0,module$contents$Blockly$Trashcan_SPRITE_TOP=32,module$contents$Blockly$Trashcan_HAS_BLOCKS_LID_ANGLE=.1,module$contents$Blockly$Trashcan_ANIMATION_LENGTH=80, module$contents$Blockly$Trashcan_ANIMATION_FRAMES=4,module$contents$Blockly$Trashcan_OPACITY_MIN=.4,module$contents$Blockly$Trashcan_OPACITY_MAX=.8,module$contents$Blockly$Trashcan_MAX_LID_ANGLE=45;module$exports$Blockly$Trashcan.prototype.isLidOpen=!1;module$exports$Blockly$Trashcan.prototype.minOpenness_=0;module$exports$Blockly$Trashcan.prototype.svgGroup_=null;module$exports$Blockly$Trashcan.prototype.svgLid_=null;module$exports$Blockly$Trashcan.prototype.lidTask_=0; module$exports$Blockly$Trashcan.prototype.lidOpen_=0;module$exports$Blockly$Trashcan.prototype.left_=0;module$exports$Blockly$Trashcan.prototype.top_=0;module$exports$Blockly$Trashcan.prototype.initialized_=!1; module$exports$Blockly$Trashcan.prototype.createDom=function(){this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CLIPPATH,{id:"blocklyTrashBodyClipPath"+a},this.svgGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{width:module$contents$Blockly$Trashcan_WIDTH, height:module$contents$Blockly$Trashcan_BODY_HEIGHT,y:module$contents$Blockly$Trashcan_LID_HEIGHT},b);var c=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.IMAGE,{width:module$exports$Blockly$internalConstants.SPRITE.width,x:-module$contents$Blockly$Trashcan_SPRITE_LEFT,height:module$exports$Blockly$internalConstants.SPRITE.height,y:-module$contents$Blockly$Trashcan_SPRITE_TOP,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.svgGroup_);c.setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS, "xlink:href",this.workspace_.options.pathToMedia+module$exports$Blockly$internalConstants.SPRITE.url);b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CLIPPATH,{id:"blocklyTrashLidClipPath"+a},this.svgGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{width:module$contents$Blockly$Trashcan_WIDTH,height:module$contents$Blockly$Trashcan_LID_HEIGHT},b);this.svgLid_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.IMAGE, {width:module$exports$Blockly$internalConstants.SPRITE.width,x:-module$contents$Blockly$Trashcan_SPRITE_LEFT,height:module$exports$Blockly$internalConstants.SPRITE.height,y:-module$contents$Blockly$Trashcan_SPRITE_TOP,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.svgGroup_);this.svgLid_.setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+module$exports$Blockly$internalConstants.SPRITE.url);(0,module$exports$Blockly$browserEvents.bind)(this.svgGroup_, "mousedown",this,this.blockMouseDownWhenOpenable_);(0,module$exports$Blockly$browserEvents.bind)(this.svgGroup_,"mouseup",this,this.click);(0,module$exports$Blockly$browserEvents.bind)(c,"mouseover",this,this.mouseOver_);(0,module$exports$Blockly$browserEvents.bind)(c,"mouseout",this,this.mouseOut_);this.animateLid_();return this.svgGroup_}; module$exports$Blockly$Trashcan.prototype.init=function(){0 this.minOpenness_&&1>this.lidOpen_&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),module$contents$Blockly$Trashcan_ANIMATION_LENGTH/a))}; module$exports$Blockly$Trashcan.prototype.setLidAngle_=function(a){var b=this.workspace_.toolboxPosition==module$exports$Blockly$utils$toolbox.Position.RIGHT||this.workspace_.horizontalLayout&&this.workspace_.RTL;this.svgLid_.setAttribute("transform","rotate("+(b?-a:a)+","+(b?4:module$contents$Blockly$Trashcan_WIDTH-4)+","+(module$contents$Blockly$Trashcan_LID_HEIGHT-2)+")")}; module$exports$Blockly$Trashcan.prototype.setMinOpenness_=function(a){this.minOpenness_=a;this.isLidOpen||this.setLidAngle_(a*module$contents$Blockly$Trashcan_MAX_LID_ANGLE)};module$exports$Blockly$Trashcan.prototype.closeLid=function(){this.setLidOpen(!1)};module$exports$Blockly$Trashcan.prototype.click=function(){this.hasContents_()&&this.openFlyout()}; module$exports$Blockly$Trashcan.prototype.fireUiEvent_=function(a){a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.TRASHCAN_OPEN))(a,this.workspace_.id);(0,module$exports$Blockly$Events$utils.fire)(a)};module$exports$Blockly$Trashcan.prototype.blockMouseDownWhenOpenable_=function(a){!this.contentsIsOpen()&&this.hasContents_()&&a.stopPropagation()};module$exports$Blockly$Trashcan.prototype.mouseOver_=function(){this.hasContents_()&&this.setLidOpen(!0)}; module$exports$Blockly$Trashcan.prototype.mouseOut_=function(){this.setLidOpen(!1)};module$exports$Blockly$Trashcan.prototype.onDelete_=function(a){if(!(0>=this.workspace_.options.maxTrashcanContents||a.type!=module$exports$Blockly$Events$utils.DELETE||a.wasShadow)&&(a=this.cleanBlockJson_(a.oldJson),-1==this.contents_.indexOf(a))){for(this.contents_.unshift(a);this.contents_.length>this.workspace_.options.maxTrashcanContents;)this.contents_.pop();this.setMinOpenness_(module$contents$Blockly$Trashcan_HAS_BLOCKS_LID_ANGLE)}}; module$exports$Blockly$Trashcan.prototype.cleanBlockJson_=function(a){function b(c){if(c){delete c.id;delete c.x;delete c.y;delete c.enabled;if(c.icons&&c.icons.comment){var d=c.icons.comment;delete d.height;delete d.width;delete d.pinned}d=c.inputs;for(var e in d){var f=d[e];b(f.block);b(f.shadow)}c.next&&(c=c.next,b(c.block),b(c.shadow))}}a=JSON.parse(JSON.stringify(a));b(a);a.kind="BLOCK";return JSON.stringify(a)};var module$exports$Blockly$VariablesDynamic={onCreateVariableButtonClick_String:function(a){(0,module$exports$Blockly$Variables.createVariableButtonHandler)(a.getTargetWorkspace(),void 0,"String")},onCreateVariableButtonClick_Number:function(a){(0,module$exports$Blockly$Variables.createVariableButtonHandler)(a.getTargetWorkspace(),void 0,"Number")},onCreateVariableButtonClick_Colour:function(a){(0,module$exports$Blockly$Variables.createVariableButtonHandler)(a.getTargetWorkspace(),void 0,"Colour")}, flyoutCategory:function(a){var b=[],c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_STRING_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_STRING");b.push(c);c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_NUMBER_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER");b.push(c);c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_COLOUR_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR");b.push(c); a.registerButtonCallback("CREATE_VARIABLE_STRING",module$exports$Blockly$VariablesDynamic.onCreateVariableButtonClick_String);a.registerButtonCallback("CREATE_VARIABLE_NUMBER",module$exports$Blockly$VariablesDynamic.onCreateVariableButtonClick_Number);a.registerButtonCallback("CREATE_VARIABLE_COLOUR",module$exports$Blockly$VariablesDynamic.onCreateVariableButtonClick_Colour);a=(0,module$exports$Blockly$VariablesDynamic.flyoutCategoryBlocks)(a);return b=b.concat(a)},flyoutCategoryBlocks:function(a){a= a.getAllVariables();var b=[];if(0-b||a<-180+b||a>180-b?!0:!1}; module$exports$Blockly$VerticalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.left;return this.toolboxPosition_==module$exports$Blockly$utils$toolbox.Position.LEFT?new module$exports$Blockly$utils$Rect(-1E9,1E9,-1E9,b+a.width):new module$exports$Blockly$utils$Rect(-1E9,1E9,b,1E9)}; module$exports$Blockly$VerticalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.getFlyoutScale();for(var a=0,b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++){var e=d.getHeightWidth().width;d.outputConnection&&(e-=this.tabWidth_);a=Math.max(a,e)}for(c=0;d=this.buttons_[c];c++)a=Math.max(a,d.width);a+=1.5*this.MARGIN+this.tabWidth_;a*=this.workspace_.scale;a+=module$exports$Blockly$Scrollbar.scrollbarThickness;if(this.width_!=a){for(c=0;d=b[c];c++){if(this.RTL){e=d.getRelativeToSurfaceXY().x; var f=a/this.workspace_.scale-this.MARGIN;d.outputConnection||(f-=this.tabWidth_);d.moveBy(f-e,0)}d.flyoutRect_&&this.moveRectToBlock_(d.flyoutRect_,d)}if(this.RTL)for(b=0;c=this.buttons_[b];b++)d=c.getPosition().y,c.moveTo(a/this.workspace_.scale-c.width-this.MARGIN-this.tabWidth_,d);this.targetWorkspace.toolboxPosition!=this.toolboxPosition_||this.toolboxPosition_!=module$exports$Blockly$utils$toolbox.Position.LEFT||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX+ a,this.targetWorkspace.scrollY);this.width_=a;this.position();this.targetWorkspace.recordDragTargets()}};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.FLYOUTS_VERTICAL_TOOLBOX,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$VerticalFlyout);var module$exports$Blockly$WorkspaceComment=function(a,b,c,d,e){this.id=e&&!a.getCommentById(e)?e:(0,module$exports$Blockly$utils$idGenerator.genUid)();a.addTopComment(this);this.xy_=new module$exports$Blockly$utils$Coordinate(0,0);this.height_=c;this.width_=d;this.workspace=a;this.RTL=a.RTL;this.editable_=this.movable_=this.deletable_=!0;this.content_=b;this.disposed_=!1;this.isComment=!0;module$exports$Blockly$WorkspaceComment.fireCreateEvent(this)}; module$exports$Blockly$WorkspaceComment.prototype.dispose=function(){this.disposed_||((0,module$exports$Blockly$Events$utils.isEnabled)()&&(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.COMMENT_DELETE))(this)),this.workspace.removeTopComment(this),this.disposed_=!0)};module$exports$Blockly$WorkspaceComment.prototype.getHeight=function(){return this.height_}; module$exports$Blockly$WorkspaceComment.prototype.setHeight=function(a){this.height_=a};module$exports$Blockly$WorkspaceComment.prototype.getWidth=function(){return this.width_};module$exports$Blockly$WorkspaceComment.prototype.setWidth=function(a){this.width_=a};module$exports$Blockly$WorkspaceComment.prototype.getXY=function(){return new module$exports$Blockly$utils$Coordinate(this.xy_.x,this.xy_.y)}; module$exports$Blockly$WorkspaceComment.prototype.moveBy=function(a,b){var c=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.COMMENT_MOVE))(this);this.xy_.translate(a,b);c.recordNew();(0,module$exports$Blockly$Events$utils.fire)(c)};module$exports$Blockly$WorkspaceComment.prototype.isDeletable=function(){return this.deletable_&&!(this.workspace&&this.workspace.options.readOnly)}; module$exports$Blockly$WorkspaceComment.prototype.setDeletable=function(a){this.deletable_=a};module$exports$Blockly$WorkspaceComment.prototype.isMovable=function(){return this.movable_&&!(this.workspace&&this.workspace.options.readOnly)};module$exports$Blockly$WorkspaceComment.prototype.setMovable=function(a){this.movable_=a};module$exports$Blockly$WorkspaceComment.prototype.isEditable=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)}; module$exports$Blockly$WorkspaceComment.prototype.setEditable=function(a){this.editable_=a};module$exports$Blockly$WorkspaceComment.prototype.getContent=function(){return this.content_};module$exports$Blockly$WorkspaceComment.prototype.setContent=function(a){this.content_!=a&&((0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.COMMENT_CHANGE))(this,this.content_,a)),this.content_=a)}; module$exports$Blockly$WorkspaceComment.prototype.toXmlWithXY=function(a){a=this.toXml(a);a.setAttribute("x",Math.round(this.xy_.x));a.setAttribute("y",Math.round(this.xy_.y));a.setAttribute("h",this.height_);a.setAttribute("w",this.width_);return a};module$exports$Blockly$WorkspaceComment.prototype.toXml=function(a){var b=(0,module$exports$Blockly$utils$xml.createElement)("comment");a||(b.id=this.id);b.textContent=this.getContent();return b}; module$exports$Blockly$WorkspaceComment.fireCreateEvent=function(a){if((0,module$exports$Blockly$Events$utils.isEnabled)()){var b=(0,module$exports$Blockly$Events$utils.getGroup)();b||(0,module$exports$Blockly$Events$utils.setGroup)(!0);try{(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.COMMENT_CREATE))(a))}finally{b||(0,module$exports$Blockly$Events$utils.setGroup)(!1)}}}; module$exports$Blockly$WorkspaceComment.fromXml=function(a,b){var c=module$exports$Blockly$WorkspaceComment.parseAttributes(a);b=new module$exports$Blockly$WorkspaceComment(b,c.content,c.h,c.w,c.id);c=parseInt(a.getAttribute("x"),10);a=parseInt(a.getAttribute("y"),10);isNaN(c)||isNaN(a)||b.moveBy(c,a);module$exports$Blockly$WorkspaceComment.fireCreateEvent(b);return b}; module$exports$Blockly$WorkspaceComment.parseAttributes=function(a){var b=a.getAttribute("h"),c=a.getAttribute("w");return{id:a.getAttribute("id"),h:b?parseInt(b,10):100,w:c?parseInt(c,10):100,x:parseInt(a.getAttribute("x"),10),y:parseInt(a.getAttribute("y"),10),content:a.textContent}};var module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE=8,module$contents$Blockly$WorkspaceCommentSvg_BORDER_RADIUS=3,module$contents$Blockly$WorkspaceCommentSvg_TEXTAREA_OFFSET=2,module$exports$Blockly$WorkspaceCommentSvg=function(a,b,c,d,e){this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null;this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{"class":"blocklyComment"},null);this.svgGroup_.translate_="";this.svgRect_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT, {"class":"blocklyCommentRect",x:0,y:0,rx:module$contents$Blockly$WorkspaceCommentSvg_BORDER_RADIUS,ry:module$contents$Blockly$WorkspaceCommentSvg_BORDER_RADIUS});this.svgGroup_.appendChild(this.svgRect_);this.rendered_=!1;this.useDragSurface_=(0,module$exports$Blockly$utils.is3dSupported)()&&!!a.getBlockDragSurface();module$exports$Blockly$WorkspaceCommentSvg.superClass_.constructor.call(this,a,b,c,d,e);this.render()}; (0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$WorkspaceCommentSvg,module$exports$Blockly$WorkspaceComment);module$exports$Blockly$WorkspaceCommentSvg.DEFAULT_SIZE=100;module$exports$Blockly$WorkspaceCommentSvg.TOP_OFFSET=10; module$exports$Blockly$WorkspaceCommentSvg.prototype.dispose=function(){this.disposed_||((0,module$exports$Blockly$common.getSelected)()==this&&(this.unselect(),this.workspace.cancelCurrentGesture()),(0,module$exports$Blockly$Events$utils.isEnabled)()&&(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.COMMENT_DELETE))(this)),(0,module$exports$Blockly$utils$dom.removeNode)(this.svgGroup_),this.disposeInternal_(),(0,module$exports$Blockly$Events$utils.disable)(), module$exports$Blockly$WorkspaceCommentSvg.superClass_.dispose.call(this),(0,module$exports$Blockly$Events$utils.enable)())}; module$exports$Blockly$WorkspaceCommentSvg.prototype.initSvg=function(a){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");this.workspace.options.readOnly||this.eventsInit_||((0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgRectTarget_,"mousedown",this,this.pathMouseDown_),(0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgHandleTarget_,"mousedown",this,this.pathMouseDown_));this.eventsInit_=!0;this.updateMovable();this.getSvgRoot().parentNode||this.workspace.getBubbleCanvas().appendChild(this.getSvgRoot()); !a&&this.textarea_&&this.textarea_.select()};module$exports$Blockly$WorkspaceCommentSvg.prototype.pathMouseDown_=function(a){var b=this.workspace.getGesture(a);b&&b.handleBubbleStart(a,this)}; module$exports$Blockly$WorkspaceCommentSvg.prototype.showContextMenu=function(a){if(!this.workspace.options.readOnly){var b=[];this.isDeletable()&&this.isMovable()&&(b.push((0,module$exports$Blockly$ContextMenu.commentDuplicateOption)(this)),b.push((0,module$exports$Blockly$ContextMenu.commentDeleteOption)(this)));(0,module$exports$Blockly$ContextMenu.show)(a,b,this.RTL)}}; module$exports$Blockly$WorkspaceCommentSvg.prototype.select=function(){if((0,module$exports$Blockly$common.getSelected)()!=this){var a=null;if((0,module$exports$Blockly$common.getSelected)()){a=(0,module$exports$Blockly$common.getSelected)().id;(0,module$exports$Blockly$Events$utils.disable)();try{(0,module$exports$Blockly$common.getSelected)().unselect()}finally{(0,module$exports$Blockly$Events$utils.enable)()}}a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.SELECTED))(a, this.id,this.workspace.id);(0,module$exports$Blockly$Events$utils.fire)(a);(0,module$exports$Blockly$common.setSelected)(this);this.addSelect()}}; module$exports$Blockly$WorkspaceCommentSvg.prototype.unselect=function(){if((0,module$exports$Blockly$common.getSelected)()==this){var a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.SELECTED))(this.id,null,this.workspace.id);(0,module$exports$Blockly$Events$utils.fire)(a);(0,module$exports$Blockly$common.setSelected)(null);this.removeSelect();this.blurFocus()}}; module$exports$Blockly$WorkspaceCommentSvg.prototype.addSelect=function(){(0,module$exports$Blockly$utils$dom.addClass)(this.svgGroup_,"blocklySelected");this.setFocus()};module$exports$Blockly$WorkspaceCommentSvg.prototype.removeSelect=function(){(0,module$exports$Blockly$utils$dom.removeClass)(this.svgGroup_,"blocklySelected");this.blurFocus()};module$exports$Blockly$WorkspaceCommentSvg.prototype.addFocus=function(){(0,module$exports$Blockly$utils$dom.addClass)(this.svgGroup_,"blocklyFocused")}; module$exports$Blockly$WorkspaceCommentSvg.prototype.removeFocus=function(){(0,module$exports$Blockly$utils$dom.removeClass)(this.svgGroup_,"blocklyFocused")}; module$exports$Blockly$WorkspaceCommentSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.useDragSurface_?this.workspace.getBlockDragSurface().getGroup():null,d=this.getSvgRoot();if(d){do{var e=(0,module$exports$Blockly$utils.getRelativeXY)(d);a+=e.x;b+=e.y;this.useDragSurface_&&this.workspace.getBlockDragSurface().getCurrentBlock()==d&&(e=this.workspace.getBlockDragSurface().getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!=this.workspace.getBubbleCanvas()&&d!=c)}return this.xy_= new module$exports$Blockly$utils$Coordinate(a,b)};module$exports$Blockly$WorkspaceCommentSvg.prototype.moveBy=function(a,b){var c=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.COMMENT_MOVE))(this),d=this.getRelativeToSurfaceXY();this.translate(d.x+a,d.y+b);this.xy_=new module$exports$Blockly$utils$Coordinate(d.x+a,d.y+b);c.recordNew();(0,module$exports$Blockly$Events$utils.fire)(c);this.workspace.resizeContents()}; module$exports$Blockly$WorkspaceCommentSvg.prototype.translate=function(a,b){this.xy_=new module$exports$Blockly$utils$Coordinate(a,b);this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};module$exports$Blockly$WorkspaceCommentSvg.prototype.moveToDragSurface=function(){if(this.useDragSurface_){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.getBlockDragSurface().translateSurface(a.x,a.y);this.workspace.getBlockDragSurface().setBlocksAndShow(this.getSvgRoot())}}; module$exports$Blockly$WorkspaceCommentSvg.prototype.moveDuringDrag=function(a,b){a?a.translateSurface(b.x,b.y):(this.svgGroup_.translate_="translate("+b.x+","+b.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))};module$exports$Blockly$WorkspaceCommentSvg.prototype.moveTo=function(a,b){this.translate(a,b)};module$exports$Blockly$WorkspaceCommentSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().removeAttribute("transform")}; module$exports$Blockly$WorkspaceCommentSvg.prototype.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(),b=this.getHeightWidth(),c=a.y,d=a.y+b.height;if(this.RTL){var e=a.x-b.width;a=a.x}else e=a.x,a=a.x+b.width;return new module$exports$Blockly$utils$Rect(c,d,e,a)}; module$exports$Blockly$WorkspaceCommentSvg.prototype.updateMovable=function(){this.isMovable()?(0,module$exports$Blockly$utils$dom.addClass)(this.svgGroup_,"blocklyDraggable"):(0,module$exports$Blockly$utils$dom.removeClass)(this.svgGroup_,"blocklyDraggable")};module$exports$Blockly$WorkspaceCommentSvg.prototype.setMovable=function(a){module$exports$Blockly$WorkspaceCommentSvg.superClass_.setMovable.call(this,a);this.updateMovable()}; module$exports$Blockly$WorkspaceCommentSvg.prototype.setEditable=function(a){module$exports$Blockly$WorkspaceCommentSvg.superClass_.setEditable.call(this,a);this.textarea_&&(this.textarea_.readOnly=!a)};module$exports$Blockly$WorkspaceCommentSvg.prototype.setDragging=function(a){a?(a=this.getSvgRoot(),a.translate_="",a.skew_="",(0,module$exports$Blockly$utils$dom.addClass)(this.svgGroup_,"blocklyDragging")):(0,module$exports$Blockly$utils$dom.removeClass)(this.svgGroup_,"blocklyDragging")}; module$exports$Blockly$WorkspaceCommentSvg.prototype.getSvgRoot=function(){return this.svgGroup_};module$exports$Blockly$WorkspaceCommentSvg.prototype.getContent=function(){return this.textarea_?this.textarea_.value:this.content_};module$exports$Blockly$WorkspaceCommentSvg.prototype.setContent=function(a){module$exports$Blockly$WorkspaceCommentSvg.superClass_.setContent.call(this,a);this.textarea_&&(this.textarea_.value=a)}; module$exports$Blockly$WorkspaceCommentSvg.prototype.setDeleteStyle=function(a){a?(0,module$exports$Blockly$utils$dom.addClass)(this.svgGroup_,"blocklyDraggingDelete"):(0,module$exports$Blockly$utils$dom.removeClass)(this.svgGroup_,"blocklyDraggingDelete")};module$exports$Blockly$WorkspaceCommentSvg.prototype.setAutoLayout=function(a){}; module$exports$Blockly$WorkspaceCommentSvg.fromXml=function(a,b,c){(0,module$exports$Blockly$Events$utils.disable)();try{var d=module$exports$Blockly$WorkspaceComment.parseAttributes(a);var e=new module$exports$Blockly$WorkspaceCommentSvg(b,d.content,d.h,d.w,d.id);b.rendered&&(e.initSvg(!0),e.render());if(!isNaN(d.x)&&!isNaN(d.y))if(b.RTL){var f=c||b.getWidth();e.moveBy(f-d.x,d.y)}else e.moveBy(d.x,d.y)}finally{(0,module$exports$Blockly$Events$utils.enable)()}module$exports$Blockly$WorkspaceComment.fireCreateEvent(e); return e};module$exports$Blockly$WorkspaceCommentSvg.prototype.toXmlWithXY=function(a){var b;this.workspace.RTL&&(b=this.workspace.getWidth());a=this.toXml(a);var c=this.getRelativeToSurfaceXY();a.setAttribute("x",Math.round(this.workspace.RTL?b-c.x:c.x));a.setAttribute("y",Math.round(c.y));a.setAttribute("h",this.getHeight());a.setAttribute("w",this.getWidth());return a}; module$exports$Blockly$WorkspaceCommentSvg.prototype.toCopyData=function(){return{saveInfo:this.toXmlWithXY(),source:this.workspace,typeCounts:null}};module$exports$Blockly$WorkspaceCommentSvg.prototype.getHeightWidth=function(){return{width:this.getWidth(),height:this.getHeight()}}; module$exports$Blockly$WorkspaceCommentSvg.prototype.render=function(){if(!this.rendered_){var a=this.getHeightWidth();this.createEditor_();this.svgGroup_.appendChild(this.foreignObject_);this.svgHandleTarget_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{"class":"blocklyCommentHandleTarget",x:0,y:0});this.svgGroup_.appendChild(this.svgHandleTarget_);this.svgRectTarget_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT, {"class":"blocklyCommentTarget",x:0,y:0,rx:module$contents$Blockly$WorkspaceCommentSvg_BORDER_RADIUS,ry:module$contents$Blockly$WorkspaceCommentSvg_BORDER_RADIUS});this.svgGroup_.appendChild(this.svgRectTarget_);this.addResizeDom_();this.isDeletable()&&this.addDeleteDom_();this.setSize_(a.width,a.height);this.textarea_.value=this.content_;this.rendered_=!0;this.resizeGroup_&&(0,module$exports$Blockly$browserEvents.conditionalBind)(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_);this.isDeletable()&& ((0,module$exports$Blockly$browserEvents.conditionalBind)(this.deleteGroup_,"mousedown",this,this.deleteMouseDown_),(0,module$exports$Blockly$browserEvents.conditionalBind)(this.deleteGroup_,"mouseout",this,this.deleteMouseOut_),(0,module$exports$Blockly$browserEvents.conditionalBind)(this.deleteGroup_,"mouseup",this,this.deleteMouseUp_))}}; module$exports$Blockly$WorkspaceCommentSvg.prototype.createEditor_=function(){this.foreignObject_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FOREIGNOBJECT,{x:0,y:module$exports$Blockly$WorkspaceCommentSvg.TOP_OFFSET,"class":"blocklyCommentForeignObject"},null);var a=document.createElementNS(module$exports$Blockly$utils$dom.HTML_NS,"body");a.setAttribute("xmlns",module$exports$Blockly$utils$dom.HTML_NS);a.className="blocklyMinimalBody";var b=document.createElementNS(module$exports$Blockly$utils$dom.HTML_NS, "textarea");b.className="blocklyCommentTextarea";b.setAttribute("dir",this.RTL?"RTL":"LTR");b.readOnly=!this.isEditable();a.appendChild(b);this.textarea_=b;this.foreignObject_.appendChild(a);(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"wheel",this,function(c){c.stopPropagation()});(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"change",this,function(c){this.setContent(b.value)});return this.foreignObject_}; module$exports$Blockly$WorkspaceCommentSvg.prototype.addResizeDom_=function(){this.resizeGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{"class":this.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.svgGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.POLYGON,{points:"0,x x,x x,0".replace(/x/g,module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE.toString())},this.resizeGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.LINE, {"class":"blocklyResizeLine",x1:module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE/3,y1:module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE-1,x2:module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE-1,y2:module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE/3},this.resizeGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.LINE,{"class":"blocklyResizeLine",x1:2*module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE/3,y1:module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE- 1,x2:module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE-1,y2:2*module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE/3},this.resizeGroup_)}; module$exports$Blockly$WorkspaceCommentSvg.prototype.addDeleteDom_=function(){this.deleteGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{"class":"blocklyCommentDeleteIcon"},this.svgGroup_);this.deleteIconBorder_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CIRCLE,{"class":"blocklyDeleteIconShape",r:"7",cx:"7.5",cy:"7.5"},this.deleteGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.LINE, {x1:"5",y1:"10",x2:"10",y2:"5",stroke:"#fff","stroke-width":"2"},this.deleteGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.LINE,{x1:"5",y1:"5",x2:"10",y2:"10",stroke:"#fff","stroke-width":"2"},this.deleteGroup_)}; module$exports$Blockly$WorkspaceCommentSvg.prototype.resizeMouseDown_=function(a){this.unbindDragEvents_();(0,module$exports$Blockly$browserEvents.isRightButton)(a)||(this.workspace.startDrag(a,new module$exports$Blockly$utils$Coordinate(this.workspace.RTL?-this.width_:this.width_,this.height_)),this.onMouseUpWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mouseup",this,this.resizeMouseUp_),this.onMouseMoveWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document, "mousemove",this,this.resizeMouseMove_),this.workspace.hideChaff());a.stopPropagation()};module$exports$Blockly$WorkspaceCommentSvg.prototype.deleteMouseDown_=function(a){(0,module$exports$Blockly$utils$dom.addClass)(this.deleteIconBorder_,"blocklyDeleteIconHighlighted");a.stopPropagation()};module$exports$Blockly$WorkspaceCommentSvg.prototype.deleteMouseOut_=function(a){(0,module$exports$Blockly$utils$dom.removeClass)(this.deleteIconBorder_,"blocklyDeleteIconHighlighted")}; module$exports$Blockly$WorkspaceCommentSvg.prototype.deleteMouseUp_=function(a){this.dispose();a.stopPropagation()};module$exports$Blockly$WorkspaceCommentSvg.prototype.unbindDragEvents_=function(){this.onMouseUpWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null);this.onMouseMoveWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}; module$exports$Blockly$WorkspaceCommentSvg.prototype.resizeMouseUp_=function(a){(0,module$exports$Blockly$Touch.clearTouchIdentifier)();this.unbindDragEvents_()};module$exports$Blockly$WorkspaceCommentSvg.prototype.resizeMouseMove_=function(a){this.autoLayout_=!1;a=this.workspace.moveDrag(a);this.setSize_(this.RTL?-a.x:a.x,a.y)}; module$exports$Blockly$WorkspaceCommentSvg.prototype.resizeComment_=function(){var a=this.getHeightWidth(),b=module$exports$Blockly$WorkspaceCommentSvg.TOP_OFFSET,c=2*module$contents$Blockly$WorkspaceCommentSvg_TEXTAREA_OFFSET;this.foreignObject_.setAttribute("width",a.width);this.foreignObject_.setAttribute("height",a.height-b);this.RTL&&this.foreignObject_.setAttribute("x",-a.width);this.textarea_.style.width=a.width-c+"px";this.textarea_.style.height=a.height-c-b+"px"}; module$exports$Blockly$WorkspaceCommentSvg.prototype.setSize_=function(a,b){a=Math.max(a,45);b=Math.max(b,20+module$exports$Blockly$WorkspaceCommentSvg.TOP_OFFSET);this.width_=a;this.height_=b;this.svgRect_.setAttribute("width",a);this.svgRect_.setAttribute("height",b);this.svgRectTarget_.setAttribute("width",a);this.svgRectTarget_.setAttribute("height",b);this.svgHandleTarget_.setAttribute("width",a);this.svgHandleTarget_.setAttribute("height",module$exports$Blockly$WorkspaceCommentSvg.TOP_OFFSET); this.RTL&&(this.svgRect_.setAttribute("transform","scale(-1 1)"),this.svgRectTarget_.setAttribute("transform","scale(-1 1)"));this.resizeGroup_&&(this.RTL?(this.resizeGroup_.setAttribute("transform","translate("+(-a+module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE)+","+(b-module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE)+") scale(-1 1)"),this.deleteGroup_.setAttribute("transform","translate("+(-a+module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE)+","+-module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE+ ") scale(-1 1)")):(this.resizeGroup_.setAttribute("transform","translate("+(a-module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE)+","+(b-module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE)+")"),this.deleteGroup_.setAttribute("transform","translate("+(a-module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE)+","+-module$contents$Blockly$WorkspaceCommentSvg_RESIZE_SIZE+")")));this.resizeComment_()}; module$exports$Blockly$WorkspaceCommentSvg.prototype.disposeInternal_=function(){this.svgHandleTarget_=this.svgRectTarget_=this.foreignObject_=this.textarea_=null;this.disposed_=!0}; module$exports$Blockly$WorkspaceCommentSvg.prototype.setFocus=function(){var a=this;this.focused_=!0;setTimeout(function(){a.disposed_||(a.textarea_.focus(),a.addFocus(),(0,module$exports$Blockly$utils$dom.addClass)(a.svgRectTarget_,"blocklyCommentTargetFocused"),(0,module$exports$Blockly$utils$dom.addClass)(a.svgHandleTarget_,"blocklyCommentHandleTargetFocused"))},0)}; module$exports$Blockly$WorkspaceCommentSvg.prototype.blurFocus=function(){var a=this;this.focused_=!1;setTimeout(function(){a.disposed_||(a.textarea_.blur(),a.removeFocus(),(0,module$exports$Blockly$utils$dom.removeClass)(a.svgRectTarget_,"blocklyCommentTargetFocused"),(0,module$exports$Blockly$utils$dom.removeClass)(a.svgHandleTarget_,"blocklyCommentHandleTargetFocused"))},0)};(0,module$exports$Blockly$Css.register)(".blocklyCommentForeignObject {,position: relative;,z-index: 0;,},.blocklyCommentRect {,fill: #E7DE8E;,stroke: #bcA903;,stroke-width: 1px;,},.blocklyCommentTarget {,fill: transparent;,stroke: #bcA903;,},.blocklyCommentTargetFocused {,fill: none;,},.blocklyCommentHandleTarget {,fill: none;,},.blocklyCommentHandleTargetFocused {,fill: transparent;,},.blocklyFocused>.blocklyCommentRect {,fill: #B9B272;,stroke: #B9B272;,},.blocklySelected>.blocklyCommentTarget {,stroke: #fc3;,stroke-width: 3px;,},.blocklyCommentDeleteIcon {,cursor: pointer;,fill: #000;,display: none;,},.blocklySelected > .blocklyCommentDeleteIcon {,display: block;,},.blocklyDeleteIconShape {,fill: #000;,stroke: #000;,stroke-width: 1px;,},.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {,stroke: #fc3;,}".split(","));var module$exports$Blockly$WorkspaceDragSurfaceSvg=function(a){this.container_=a;this.createDom()};module$exports$Blockly$WorkspaceDragSurfaceSvg.prototype.SVG_=null;module$exports$Blockly$WorkspaceDragSurfaceSvg.prototype.container_=null; module$exports$Blockly$WorkspaceDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.SVG,{xmlns:module$exports$Blockly$utils$dom.SVG_NS,"xmlns:html":module$exports$Blockly$utils$dom.HTML_NS,"xmlns:xlink":module$exports$Blockly$utils$dom.XLINK_NS,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.container_.appendChild(this.SVG_))}; module$exports$Blockly$WorkspaceDragSurfaceSvg.prototype.translateSurface=function(a,b){a=a.toFixed(0);b=b.toFixed(0);this.SVG_.style.display="block";(0,module$exports$Blockly$utils$dom.setCssTransform)(this.SVG_,"translate3d("+a+"px, "+b+"px, 0)")};module$exports$Blockly$WorkspaceDragSurfaceSvg.prototype.getSurfaceTranslation=function(){return(0,module$exports$Blockly$utils.getRelativeXY)(this.SVG_)}; module$exports$Blockly$WorkspaceDragSurfaceSvg.prototype.clearAndHide=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var b=this.SVG_.childNodes[0],c=this.SVG_.childNodes[1];if(!(b&&c&&(0,module$exports$Blockly$utils$dom.hasClass)(b,"blocklyBlockCanvas")&&(0,module$exports$Blockly$utils$dom.hasClass)(c,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!=this.previousSibling_?(0,module$exports$Blockly$utils$dom.insertAfter)(b, this.previousSibling_):a.insertBefore(b,a.firstChild);(0,module$exports$Blockly$utils$dom.insertAfter)(c,b);this.SVG_.style.display="none";if(this.SVG_.childNodes.length)throw Error("Drag surface was not cleared.");(0,module$exports$Blockly$utils$dom.setCssTransform)(this.SVG_,"");this.previousSibling_=null}; module$exports$Blockly$WorkspaceDragSurfaceSvg.prototype.setContentsAndShow=function(a,b,c,d,e,f){if(this.SVG_.childNodes.length)throw Error("Already dragging a block.");this.previousSibling_=c;a.setAttribute("transform","translate(0, 0) scale("+f+")");b.setAttribute("transform","translate(0, 0) scale("+f+")");this.SVG_.setAttribute("width",d);this.SVG_.setAttribute("height",e);this.SVG_.appendChild(a);this.SVG_.appendChild(b);this.SVG_.style.display="block"};var module$exports$Blockly$ZoomControls=function(a){this.workspace_=a;this.id="zoomControls";this.zoomResetGroup_=this.zoomOutGroup_=this.zoomInGroup_=this.onZoomOutWrapper_=this.onZoomInWrapper_=this.onZoomResetWrapper_=null};module$exports$Blockly$ZoomControls.prototype.WIDTH_=32;module$exports$Blockly$ZoomControls.prototype.HEIGHT_=32;module$exports$Blockly$ZoomControls.prototype.SMALL_SPACING_=2;module$exports$Blockly$ZoomControls.prototype.LARGE_SPACING_=11; module$exports$Blockly$ZoomControls.prototype.MARGIN_VERTICAL_=20;module$exports$Blockly$ZoomControls.prototype.MARGIN_HORIZONTAL_=20;module$exports$Blockly$ZoomControls.prototype.svgGroup_=null;module$exports$Blockly$ZoomControls.prototype.left_=0;module$exports$Blockly$ZoomControls.prototype.top_=0;module$exports$Blockly$ZoomControls.prototype.initialized_=!1; module$exports$Blockly$ZoomControls.prototype.createDom=function(){this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{},null);var a=String(Math.random()).substring(2);this.createZoomOutSvg_(a);this.createZoomInSvg_(a);this.workspace_.isMovable()&&this.createZoomResetSvg_(a);return this.svgGroup_}; module$exports$Blockly$ZoomControls.prototype.init=function(){this.workspace_.getComponentManager().addComponent({component:this,weight:2,capabilities:[module$exports$Blockly$ComponentManager.Capability.POSITIONABLE]});this.initialized_=!0}; module$exports$Blockly$ZoomControls.prototype.dispose=function(){this.workspace_.getComponentManager().removeComponent("zoomControls");this.svgGroup_&&(0,module$exports$Blockly$utils$dom.removeNode)(this.svgGroup_);this.onZoomResetWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onZoomResetWrapper_);this.onZoomInWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onZoomInWrapper_);this.onZoomOutWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onZoomOutWrapper_)}; module$exports$Blockly$ZoomControls.prototype.getBoundingRectangle=function(){var a=this.SMALL_SPACING_+2*this.HEIGHT_;this.zoomResetGroup_&&(a+=this.LARGE_SPACING_+this.HEIGHT_);return new module$exports$Blockly$utils$Rect(this.top_,this.top_+a,this.left_,this.left_+this.WIDTH_)}; module$exports$Blockly$ZoomControls.prototype.position=function(a,b){if(this.initialized_){var c=(0,module$exports$Blockly$uiPosition.getCornerOppositeToolbox)(this.workspace_,a),d=this.SMALL_SPACING_+2*this.HEIGHT_;this.zoomResetGroup_&&(d+=this.LARGE_SPACING_+this.HEIGHT_);a=(0,module$exports$Blockly$uiPosition.getStartPositionRect)(c,new module$exports$Blockly$utils$Size(this.WIDTH_,d),this.MARGIN_HORIZONTAL_,this.MARGIN_VERTICAL_,a,this.workspace_);c=c.vertical;b=(0,module$exports$Blockly$uiPosition.bumpPositionRect)(a, this.MARGIN_VERTICAL_,c===module$exports$Blockly$uiPosition.verticalPosition.TOP?module$exports$Blockly$uiPosition.bumpDirection.DOWN:module$exports$Blockly$uiPosition.bumpDirection.UP,b);c===module$exports$Blockly$uiPosition.verticalPosition.TOP?(c=this.SMALL_SPACING_+this.HEIGHT_,this.zoomInGroup_.setAttribute("transform","translate(0, "+c+")"),this.zoomResetGroup_&&this.zoomResetGroup_.setAttribute("transform","translate(0, "+(c+this.LARGE_SPACING_+this.HEIGHT_)+")")):(c=this.zoomResetGroup_?this.LARGE_SPACING_+ this.HEIGHT_:0,this.zoomInGroup_.setAttribute("transform","translate(0, "+c+")"),this.zoomOutGroup_.setAttribute("transform","translate(0, "+(c+this.SMALL_SPACING_+this.HEIGHT_)+")"));this.top_=b.top;this.left_=b.left;this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")")}}; module$exports$Blockly$ZoomControls.prototype.createZoomOutSvg_=function(a){this.zoomOutGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{"class":"blocklyZoom"},this.svgGroup_);var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CLIPPATH,{id:"blocklyZoomoutClipPath"+a},this.zoomOutGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{width:32,height:32},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.IMAGE, {width:module$exports$Blockly$internalConstants.SPRITE.width,height:module$exports$Blockly$internalConstants.SPRITE.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+a+")"},this.zoomOutGroup_).setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+module$exports$Blockly$internalConstants.SPRITE.url);this.onZoomOutWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.zoomOutGroup_,"mousedown",null,this.zoom_.bind(this,-1))}; module$exports$Blockly$ZoomControls.prototype.createZoomInSvg_=function(a){this.zoomInGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{"class":"blocklyZoom"},this.svgGroup_);var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CLIPPATH,{id:"blocklyZoominClipPath"+a},this.zoomInGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{width:32,height:32},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.IMAGE, {width:module$exports$Blockly$internalConstants.SPRITE.width,height:module$exports$Blockly$internalConstants.SPRITE.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+a+")"},this.zoomInGroup_).setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+module$exports$Blockly$internalConstants.SPRITE.url);this.onZoomInWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.zoomInGroup_,"mousedown",null,this.zoom_.bind(this,1))}; module$exports$Blockly$ZoomControls.prototype.zoom_=function(a,b){this.workspace_.markFocused();this.workspace_.zoomCenter(a);this.fireZoomEvent_();(0,module$exports$Blockly$Touch.clearTouchIdentifier)();b.stopPropagation();b.preventDefault()}; module$exports$Blockly$ZoomControls.prototype.createZoomResetSvg_=function(a){this.zoomResetGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.G,{"class":"blocklyZoom"},this.svgGroup_);var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.CLIPPATH,{id:"blocklyZoomresetClipPath"+a},this.zoomResetGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.RECT,{width:32,height:32},b); (0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.IMAGE,{width:module$exports$Blockly$internalConstants.SPRITE.width,height:module$exports$Blockly$internalConstants.SPRITE.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+a+")"},this.zoomResetGroup_).setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+module$exports$Blockly$internalConstants.SPRITE.url);this.onZoomResetWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.zoomResetGroup_, "mousedown",null,this.resetZoom_.bind(this))}; module$exports$Blockly$ZoomControls.prototype.resetZoom_=function(a){this.workspace_.markFocused();var b=Math.log(this.workspace_.options.zoomOptions.startScale/this.workspace_.scale)/Math.log(this.workspace_.options.zoomOptions.scaleSpeed);this.workspace_.beginCanvasTransition();this.workspace_.zoomCenter(b);this.workspace_.scrollCenter();setTimeout(this.workspace_.endCanvasTransition.bind(this.workspace_),500);this.fireZoomEvent_();(0,module$exports$Blockly$Touch.clearTouchIdentifier)();a.stopPropagation(); a.preventDefault()};module$exports$Blockly$ZoomControls.prototype.fireZoomEvent_=function(){var a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CLICK))(null,this.workspace_.id,"zoom_controls");(0,module$exports$Blockly$Events$utils.fire)(a)};(0,module$exports$Blockly$Css.register)([".blocklyZoom>image, .blocklyZoom>svg>image {\n opacity: .4;\n}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {\n opacity: .6;\n}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {\n 'opacity: .8;\n}"]);var module$exports$Blockly$geras$ConstantProvider=function(){module$exports$Blockly$geras$ConstantProvider.superClass_.constructor.call(this);this.FIELD_TEXT_BASELINE_CENTER=!1;this.DARK_PATH_OFFSET=1;this.MAX_BOTTOM_WIDTH=30;this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT/2};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$geras$ConstantProvider,module$exports$Blockly$blockRendering$ConstantProvider); module$exports$Blockly$geras$ConstantProvider.prototype.getCSS_=function(a){return module$exports$Blockly$geras$ConstantProvider.superClass_.getCSS_.call(this,a).concat([a+" .blocklyInsertionMarker>.blocklyPathLight,",a+" .blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"])};var module$exports$Blockly$geras$Highlighter=function(a){this.info_=a;this.inlineSteps_=this.steps_="";this.RTL_=this.info_.RTL;a=a.getRenderer();this.constants_=a.getConstants();this.highlightConstants_=a.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};module$exports$Blockly$geras$Highlighter.prototype.getPath=function(){return this.steps_+"\n"+this.inlineSteps_}; module$exports$Blockly$geras$Highlighter.prototype.drawTopCorner=function(a){this.steps_+=(0,module$exports$Blockly$utils$svgPaths.moveBy)(a.xPos,this.info_.startY);for(var b=0,c;c=a.elements[b];b++)module$exports$Blockly$blockRendering$Types.isLeftSquareCorner(c)?this.steps_+=this.highlightConstants_.START_POINT:module$exports$Blockly$blockRendering$Types.isLeftRoundedCorner(c)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):module$exports$Blockly$blockRendering$Types.isPreviousConnection(c)? this.steps_+=this.notchPaths_.pathLeft:module$exports$Blockly$blockRendering$Types.isHat(c)?this.steps_+=this.startPaths_.path(this.RTL_):module$exports$Blockly$blockRendering$Types.isSpacer(c)&&0!=c.width&&(this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",c.xPos+c.width-this.highlightOffset_));this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",a.xPos+a.width-this.highlightOffset_)}; module$exports$Blockly$geras$Highlighter.prototype.drawJaggedEdge_=function(a){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset_))}; module$exports$Blockly$geras$Highlighter.prototype.drawValueInput=function(a){var b=a.getLastInput();if(this.RTL_){var c=a.height-b.connectionHeight;this.steps_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(b.xPos+b.width-this.highlightOffset_,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",c)}else this.steps_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}; module$exports$Blockly$geras$Highlighter.prototype.drawStatementInput=function(a){var b=a.getLastInput();if(this.RTL_){var c=a.height-2*this.insideCornerPaths_.height;this.steps_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(b.xPos,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)+(0,module$exports$Blockly$utils$svgPaths.lineTo)(a.width-b.xPos-this.insideCornerPaths_.width,0)}else this.steps_+= (0,module$exports$Blockly$utils$svgPaths.moveTo)(b.xPos,a.yPos+a.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+(0,module$exports$Blockly$utils$svgPaths.lineTo)(a.width-b.xPos-this.insideCornerPaths_.width,0)}; module$exports$Blockly$geras$Highlighter.prototype.drawRightSideRow=function(a){var b=a.xPos+a.width-this.highlightOffset_;a.followsStatement&&(this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",b));this.RTL_&&(this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",b),a.height>this.highlightOffset_&&(this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a.yPos+a.height-this.highlightOffset_)))}; module$exports$Blockly$geras$Highlighter.prototype.drawBottomRow=function(a){if(this.RTL_)this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a.baseline-this.highlightOffset_);else{var b=this.info_.bottomRow.elements[0];module$exports$Blockly$blockRendering$Types.isLeftSquareCorner(b)?this.steps_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(a.xPos+this.highlightOffset_,a.baseline-this.highlightOffset_):module$exports$Blockly$blockRendering$Types.isLeftRoundedCorner(b)&&(this.steps_+= (0,module$exports$Blockly$utils$svgPaths.moveTo)(a.xPos,a.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft())}}; module$exports$Blockly$geras$Highlighter.prototype.drawLeft=function(){var a=this.info_.outputConnection;a&&(a=a.connectionOffsetY+a.height,this.RTL_?this.steps_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(this.info_.startX,a):(this.steps_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(this.info_.startX+this.highlightOffset_,this.info_.bottomRow.baseline-this.highlightOffset_),this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)); this.RTL_||(a=this.info_.topRow,module$exports$Blockly$blockRendering$Types.isLeftRoundedCorner(a.elements[0])?this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",this.outsideCornerPaths_.height):this.steps_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a.capline+this.highlightOffset_))}; module$exports$Blockly$geras$Highlighter.prototype.drawInlineInput=function(a){var b=this.highlightOffset_,c=a.xPos+a.connectionWidth,d=a.centerline-a.height/2,e=a.width-a.connectionWidth,f=d+b;this.RTL_?(d=a.connectionOffsetY-b,a=a.height-(a.connectionOffsetY+a.connectionHeight)+b,this.inlineSteps_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(c-b,f)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",d)+this.puzzleTabPaths_.pathDown(this.RTL_)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v", a)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",e)):this.inlineSteps_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(a.xPos+a.width+b,f)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",a.height)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",-e)+(0,module$exports$Blockly$utils$svgPaths.moveTo)(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)};var module$exports$Blockly$geras$Drawer=function(a,b){module$exports$Blockly$geras$Drawer.superClass_.constructor.call(this,a,b);this.highlighter_=new module$exports$Blockly$geras$Highlighter(b)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$geras$Drawer,module$exports$Blockly$blockRendering$Drawer); module$exports$Blockly$geras$Drawer.prototype.draw=function(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();var a=this.block_.pathObject;a.setPath(this.outlinePath_+"\n"+this.inlinePath_);a.setHighlightPath(this.highlighter_.getPath());this.info_.RTL&&a.flipRTL();(0,module$exports$Blockly$blockRendering$debug.isDebuggerEnabled)()&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_()}; module$exports$Blockly$geras$Drawer.prototype.drawTop_=function(){this.highlighter_.drawTopCorner(this.info_.topRow);this.highlighter_.drawRightSideRow(this.info_.topRow);module$exports$Blockly$geras$Drawer.superClass_.drawTop_.call(this)};module$exports$Blockly$geras$Drawer.prototype.drawJaggedEdge_=function(a){this.highlighter_.drawJaggedEdge_(a);module$exports$Blockly$geras$Drawer.superClass_.drawJaggedEdge_.call(this,a)}; module$exports$Blockly$geras$Drawer.prototype.drawValueInput_=function(a){this.highlighter_.drawValueInput(a);module$exports$Blockly$geras$Drawer.superClass_.drawValueInput_.call(this,a)};module$exports$Blockly$geras$Drawer.prototype.drawStatementInput_=function(a){this.highlighter_.drawStatementInput(a);module$exports$Blockly$geras$Drawer.superClass_.drawStatementInput_.call(this,a)}; module$exports$Blockly$geras$Drawer.prototype.drawRightSideRow_=function(a){this.highlighter_.drawRightSideRow(a);this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",a.xPos+a.width)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a.yPos+a.height)};module$exports$Blockly$geras$Drawer.prototype.drawBottom_=function(){this.highlighter_.drawBottomRow(this.info_.bottomRow);module$exports$Blockly$geras$Drawer.superClass_.drawBottom_.call(this)}; module$exports$Blockly$geras$Drawer.prototype.drawLeft_=function(){this.highlighter_.drawLeft();module$exports$Blockly$geras$Drawer.superClass_.drawLeft_.call(this)};module$exports$Blockly$geras$Drawer.prototype.drawInlineInput_=function(a){this.highlighter_.drawInlineInput(a);module$exports$Blockly$geras$Drawer.superClass_.drawInlineInput_.call(this,a)}; module$exports$Blockly$geras$Drawer.prototype.positionInlineInputConnection_=function(a){var b=a.centerline-a.height/2;if(a.connectionModel){var c=a.xPos+a.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);a.connectionModel.setOffsetInBlock(c,b+a.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}; module$exports$Blockly$geras$Drawer.prototype.positionStatementInputConnection_=function(a){var b=a.getLastInput();if(b.connectionModel){var c=a.xPos+a.statementEdge+b.notchOffset;c=this.info_.RTL?-1*c:c+this.constants_.DARK_PATH_OFFSET;b.connectionModel.setOffsetInBlock(c,a.yPos+this.constants_.DARK_PATH_OFFSET)}}; module$exports$Blockly$geras$Drawer.prototype.positionExternalValueConnection_=function(a){var b=a.getLastInput();if(b.connectionModel){var c=a.xPos+a.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}}; module$exports$Blockly$geras$Drawer.prototype.positionNextConnection_=function(){var a=this.info_.bottomRow;if(a.connection){var b=a.connection,c=b.xPos;b.connectionModel.setOffsetInBlock((this.info_.RTL?-c:c)+this.constants_.DARK_PATH_OFFSET/2,a.baseline+this.constants_.DARK_PATH_OFFSET)}};var module$exports$Blockly$geras$HighlightConstantProvider=function(a){this.constantProvider=a;this.OFFSET=.5;this.START_POINT=(0,module$exports$Blockly$utils$svgPaths.moveBy)(this.OFFSET,this.OFFSET)};module$exports$Blockly$geras$HighlightConstantProvider.prototype.init=function(){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()}; module$exports$Blockly$geras$HighlightConstantProvider.prototype.makeInsideCorner=function(){var a=this.constantProvider.CORNER_RADIUS,b=this.OFFSET,c=(1-Math.SQRT1_2)*(a+b)-b,d=(0,module$exports$Blockly$utils$svgPaths.moveBy)(c,c)+(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,0",a,(0,module$exports$Blockly$utils$svgPaths.point)(-c-b,a-c)),e=(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,0",a+b,(0,module$exports$Blockly$utils$svgPaths.point)(a+b,a+b)),f=(0,module$exports$Blockly$utils$svgPaths.moveBy)(c, -c)+(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,0",a+b,(0,module$exports$Blockly$utils$svgPaths.point)(a-c,c+b));return{width:a+b,height:a,pathTop:function(g){return g?d:""},pathBottom:function(g){return g?e:f}}}; module$exports$Blockly$geras$HighlightConstantProvider.prototype.makeOutsideCorner=function(){var a=this.constantProvider.CORNER_RADIUS,b=this.OFFSET,c=(1-Math.SQRT1_2)*(a-b)+b,d=(0,module$exports$Blockly$utils$svgPaths.moveBy)(c,c)+(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",a-b,(0,module$exports$Blockly$utils$svgPaths.point)(a-c,-c+b)),e=(0,module$exports$Blockly$utils$svgPaths.moveBy)(b,a)+(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",a-b,(0,module$exports$Blockly$utils$svgPaths.point)(a, -a+b)),f=-c,g=(0,module$exports$Blockly$utils$svgPaths.moveBy)(c,f)+(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",a-b,(0,module$exports$Blockly$utils$svgPaths.point)(-c+b,-f-a));return{height:a,topLeft:function(h){return h?d:e},bottomLeft:function(){return g}}}; module$exports$Blockly$geras$HighlightConstantProvider.prototype.makePuzzleTab=function(){var a=this.constantProvider.TAB_WIDTH,b=this.constantProvider.TAB_HEIGHT,c=(0,module$exports$Blockly$utils$svgPaths.moveBy)(-2,-b+3.4)+(0,module$exports$Blockly$utils$svgPaths.lineTo)(-.45*a,-2.1),d=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",2.5)+(0,module$exports$Blockly$utils$svgPaths.moveBy)(.97*-a,2.5)+(0,module$exports$Blockly$utils$svgPaths.curve)("q",[(0,module$exports$Blockly$utils$svgPaths.point)(.05* -a,10),(0,module$exports$Blockly$utils$svgPaths.point)(.3*a,9.5)])+(0,module$exports$Blockly$utils$svgPaths.moveBy)(.67*a,-1.9)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",2.5),e=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",-1.5)+(0,module$exports$Blockly$utils$svgPaths.moveBy)(-.92*a,-.5)+(0,module$exports$Blockly$utils$svgPaths.curve)("q",[(0,module$exports$Blockly$utils$svgPaths.point)(-.19*a,-5.5),(0,module$exports$Blockly$utils$svgPaths.point)(0,-11)])+(0,module$exports$Blockly$utils$svgPaths.moveBy)(.92* a,1),f=(0,module$exports$Blockly$utils$svgPaths.moveBy)(-5,b-.7)+(0,module$exports$Blockly$utils$svgPaths.lineTo)(.46*a,-2.1);return{width:a,height:b,pathUp:function(g){return g?c:e},pathDown:function(g){return g?d:f}}};module$exports$Blockly$geras$HighlightConstantProvider.prototype.makeNotch=function(){return{pathLeft:(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}; module$exports$Blockly$geras$HighlightConstantProvider.prototype.makeJaggedTeeth=function(){return{pathLeft:(0,module$exports$Blockly$utils$svgPaths.lineTo)(5.1,2.6)+(0,module$exports$Blockly$utils$svgPaths.moveBy)(-10.2,6.8)+(0,module$exports$Blockly$utils$svgPaths.lineTo)(5.1,2.6),height:12,width:10.2}}; module$exports$Blockly$geras$HighlightConstantProvider.prototype.makeStartHat=function(){var a=this.constantProvider.START_HAT.height,b=(0,module$exports$Blockly$utils$svgPaths.moveBy)(25,-8.7)+(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(29.7,-6.2),(0,module$exports$Blockly$utils$svgPaths.point)(57.2,-.5),(0,module$exports$Blockly$utils$svgPaths.point)(75,8.7)]),c=(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(17.8, -9.2),(0,module$exports$Blockly$utils$svgPaths.point)(45.3,-14.9),(0,module$exports$Blockly$utils$svgPaths.point)(75,-8.7)])+(0,module$exports$Blockly$utils$svgPaths.moveTo)(100.5,a+.5);return{path:function(d){return d?b:c}}};var module$exports$Blockly$geras$InlineInput=function(a,b){module$exports$Blockly$geras$InlineInput.superClass_.constructor.call(this,a,b);this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$geras$InlineInput,module$exports$Blockly$blockRendering$InlineInput);var module$exports$Blockly$geras$PathObject=function(a,b,c){this.constants=c;this.svgRoot=a;this.svgPathDark=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.PATH,{"class":"blocklyPathDark",transform:"translate(1,1)"},this.svgRoot);this.svgPath=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.PATH,{"class":"blocklyPath"},this.svgRoot);this.svgPathLight=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.PATH, {"class":"blocklyPathLight"},this.svgRoot);this.colourDark="#000000";this.style=b};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$geras$PathObject,module$exports$Blockly$blockRendering$PathObject);module$exports$Blockly$geras$PathObject.prototype.setPath=function(a){this.svgPath.setAttribute("d",a);this.svgPathDark.setAttribute("d",a)};module$exports$Blockly$geras$PathObject.prototype.setHighlightPath=function(a){this.svgPathLight.setAttribute("d",a)}; module$exports$Blockly$geras$PathObject.prototype.flipRTL=function(){this.svgPath.setAttribute("transform","scale(-1 1)");this.svgPathLight.setAttribute("transform","scale(-1 1)");this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)")}; module$exports$Blockly$geras$PathObject.prototype.applyColour=function(a){this.svgPathLight.style.display="";this.svgPathDark.style.display="";this.svgPathLight.setAttribute("stroke",this.style.colourTertiary);this.svgPathDark.setAttribute("fill",this.colourDark);module$exports$Blockly$geras$PathObject.superClass_.applyColour.call(this,a);this.svgPath.setAttribute("stroke","none")}; module$exports$Blockly$geras$PathObject.prototype.setStyle=function(a){this.style=a;this.colourDark=(0,module$exports$Blockly$utils$colour.blend)("#000",this.style.colourPrimary,.2)||this.colourDark};module$exports$Blockly$geras$PathObject.prototype.updateHighlighted=function(a){a?(this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"),this.svgPathLight.style.display="none"):(this.svgPath.setAttribute("filter","none"),this.svgPathLight.style.display="inline")}; module$exports$Blockly$geras$PathObject.prototype.updateShadow_=function(a){a&&(this.svgPathLight.style.display="none",this.svgPathDark.setAttribute("fill",this.style.colourSecondary),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))};module$exports$Blockly$geras$PathObject.prototype.updateDisabled_=function(a){module$exports$Blockly$geras$PathObject.superClass_.updateDisabled_.call(this,a);a&&this.svgPath.setAttribute("stroke","none")};var module$exports$Blockly$geras$StatementInput=function(a,b){module$exports$Blockly$geras$StatementInput.superClass_.constructor.call(this,a,b);this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$geras$StatementInput,module$exports$Blockly$blockRendering$StatementInput);var module$exports$Blockly$geras$RenderInfo=function(a,b){module$exports$Blockly$geras$RenderInfo.superClass_.constructor.call(this,a,b)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$geras$RenderInfo,module$exports$Blockly$blockRendering$RenderInfo);module$exports$Blockly$geras$RenderInfo.prototype.getRenderer=function(){return this.renderer_}; module$exports$Blockly$geras$RenderInfo.prototype.populateBottomRow_=function(){module$exports$Blockly$geras$RenderInfo.superClass_.populateBottomRow_.call(this);this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==module$exports$Blockly$inputTypes.STATEMENT||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}; module$exports$Blockly$geras$RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type==module$exports$Blockly$inputTypes.VALUE?(b.elements.push(new module$exports$Blockly$geras$InlineInput(this.constants_,a)),b.hasInlineInput=!0):a.type==module$exports$Blockly$inputTypes.STATEMENT?(b.elements.push(new module$exports$Blockly$geras$StatementInput(this.constants_,a)),b.hasStatement=!0):a.type==module$exports$Blockly$inputTypes.VALUE?(b.elements.push(new module$exports$Blockly$blockRendering$ExternalValueInput(this.constants_, a)),b.hasExternalInput=!0):a.type==module$exports$Blockly$inputTypes.DUMMY&&(b.minHeight=Math.max(b.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),b.hasDummyInput=!0);this.isInline||null!=b.align||(b.align=a.align)}; module$exports$Blockly$geras$RenderInfo.prototype.addElemSpacing_=function(){for(var a=!1,b=0,c;c=this.rows[b];b++)c.hasExternalInput&&(a=!0);for(b=0;c=this.rows[b];b++){var d=c.elements;c.elements=[];c.startsWithElemSpacer()&&c.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer(this.constants_,this.getInRowSpacing_(null,d[0])));if(d.length){for(var e=0;eb?b:f;e=e?-1:1;c=(d?-1:1)*c/2;return(0,module$exports$Blockly$utils$svgPaths.lineTo)(-e*f,c)+(0,module$exports$Blockly$utils$svgPaths.lineTo)(e*f,c)}var b=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width:function(c){c/=2;return c>b?b:c},height:function(c){return c},connectionOffsetY:function(c){return c/2},connectionOffsetX:function(c){return-c}, pathDown:function(c){return a(c,!1,!1)},pathUp:function(c){return a(c,!0,!1)},pathRightDown:function(c){return a(c,!1,!0)},pathRightUp:function(c){return a(c,!1,!0)}}}; module$exports$Blockly$zelos$ConstantProvider.prototype.makeRounded=function(){function a(d,e,f){var g=d>c?d-c:0;d=(d>c?c:d)/2;return(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",d,(0,module$exports$Blockly$utils$svgPaths.point)((e?-1:1)*d,(e?-1:1)*d))+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",(f?1:-1)*g)+(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",d,(0,module$exports$Blockly$utils$svgPaths.point)((e?1:-1)*d,(e?-1:1)*d))}var b=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH, c=2*b;return{type:this.SHAPES.ROUND,isDynamic:!0,width:function(d){d/=2;return d>b?b:d},height:function(d){return d},connectionOffsetY:function(d){return d/2},connectionOffsetX:function(d){return-d},pathDown:function(d){return a(d,!1,!1)},pathUp:function(d){return a(d,!0,!1)},pathRightDown:function(d){return a(d,!1,!0)},pathRightUp:function(d){return a(d,!1,!0)}}}; module$exports$Blockly$zelos$ConstantProvider.prototype.makeSquared=function(){function a(c,d,e){c-=2*b;return(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",b,(0,module$exports$Blockly$utils$svgPaths.point)((d?-1:1)*b,(d?-1:1)*b))+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",(e?1:-1)*c)+(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",b,(0,module$exports$Blockly$utils$svgPaths.point)((d?1:-1)*b,(d?-1:1)*b))}var b=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0, width:function(c){return b},height:function(c){return c},connectionOffsetY:function(c){return c/2},connectionOffsetX:function(c){return-c},pathDown:function(c){return a(c,!1,!1)},pathUp:function(c){return a(c,!0,!1)},pathRightDown:function(c){return a(c,!1,!0)},pathRightUp:function(c){return a(c,!1,!0)}}}; module$exports$Blockly$zelos$ConstantProvider.prototype.shapeFor=function(a){var b=a.getCheck();!b&&a.targetConnection&&(b=a.targetConnection.getCheck());switch(a.type){case module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE:case module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE:a=a.getSourceBlock().getOutputShape();if(null!=a)switch(a){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}if(b&& -1!=b.indexOf("Boolean"))return this.HEXAGONAL;if(b&&-1!=b.indexOf("Number"))return this.ROUNDED;b&&b.indexOf("String");return this.ROUNDED;case module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT:case module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type");}}; module$exports$Blockly$zelos$ConstantProvider.prototype.makeNotch=function(){function a(l){return(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(l*e/2,0),(0,module$exports$Blockly$utils$svgPaths.point)(l*e*3/4,g/2),(0,module$exports$Blockly$utils$svgPaths.point)(l*e,g)])+(0,module$exports$Blockly$utils$svgPaths.line)([(0,module$exports$Blockly$utils$svgPaths.point)(l*e,f)])+(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(l* e/4,g/2),(0,module$exports$Blockly$utils$svgPaths.point)(l*e/2,g),(0,module$exports$Blockly$utils$svgPaths.point)(l*e,g)])+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",l*d)+(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(l*e/2,0),(0,module$exports$Blockly$utils$svgPaths.point)(l*e*3/4,-(g/2)),(0,module$exports$Blockly$utils$svgPaths.point)(l*e,-g)])+(0,module$exports$Blockly$utils$svgPaths.line)([(0,module$exports$Blockly$utils$svgPaths.point)(l* e,-f)])+(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(l*e/4,-(g/2)),(0,module$exports$Blockly$utils$svgPaths.point)(l*e/2,-g),(0,module$exports$Blockly$utils$svgPaths.point)(l*e,-g)])}var b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=b/3,e=d/3,f=c/2,g=f/2,h=a(1),k=a(-1);return{type:this.SHAPES.NOTCH,width:b,height:c,pathLeft:h,pathRight:k}}; module$exports$Blockly$zelos$ConstantProvider.prototype.makeInsideCorners=function(){var a=this.CORNER_RADIUS,b=(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,0",a,(0,module$exports$Blockly$utils$svgPaths.point)(-a,a)),c=(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",a,(0,module$exports$Blockly$utils$svgPaths.point)(-a,a)),d=(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,0",a,(0,module$exports$Blockly$utils$svgPaths.point)(a,a)),e=(0,module$exports$Blockly$utils$svgPaths.arc)("a", "0 0,1",a,(0,module$exports$Blockly$utils$svgPaths.point)(a,a));return{width:a,height:a,pathTop:b,pathBottom:d,rightWidth:a,rightHeight:a,pathTopRight:c,pathBottomRight:e}};module$exports$Blockly$zelos$ConstantProvider.prototype.generateSecondaryColour_=function(a){return(0,module$exports$Blockly$utils$colour.blend)("#000",a,.15)||a};module$exports$Blockly$zelos$ConstantProvider.prototype.generateTertiaryColour_=function(a){return(0,module$exports$Blockly$utils$colour.blend)("#000",a,.25)||a}; module$exports$Blockly$zelos$ConstantProvider.prototype.createDom=function(a,b,c){module$exports$Blockly$zelos$ConstantProvider.superClass_.createDom.call(this,a,b,c);a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.DEFS,{},a);b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FEGAUSSIANBLUR, {"in":"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},b);c=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FECOMPONENTTRANSFER,{result:"outBlur"},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},c);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1, result:"outColor"},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FECOMPOSITE,{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},b);this.selectedGlowFilterId=b.id;this.selectedGlowFilter_=b;a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FEGAUSSIANBLUR, {"in":"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},a);b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FECOMPONENTTRANSFER,{result:"outBlur"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1, result:"outColor"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FECOMPOSITE,{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.FECOMPOSITE,{"in":"SourceGraphic",in2:"outGlow",operator:"over"},a);this.replacementGlowFilterId=a.id;this.replacementGlowFilter_=a}; module$exports$Blockly$zelos$ConstantProvider.prototype.getCSS_=function(a){return[a+" .blocklyText,",a+" .blocklyFlyoutLabelText {","font: "+this.FIELD_TEXT_FONTWEIGHT+" "+this.FIELD_TEXT_FONTSIZE+"pt "+this.FIELD_TEXT_FONTFAMILY+";","}",a+" .blocklyText {","fill: #fff;","}",a+" .blocklyNonEditableText>rect:not(.blocklyDropdownRect),",a+" .blocklyEditableText>rect:not(.blocklyDropdownRect) {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text,", a+" .blocklyNonEditableText>g>text,",a+" .blocklyEditableText>g>text {","fill: #575E75;","}",a+" .blocklyFlyoutLabelText {","fill: #575E75;","}",a+" .blocklyText.blocklyBubbleText {","fill: #575E75;","}",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>rect,",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+ ";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","color: #575E75;","}",a+" .blocklyDropdownText {","fill: #fff !important;","}",a+".blocklyWidgetDiv .goog-menuitem,",a+".blocklyDropDownDiv .goog-menuitem {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","}",a+".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",a+" .blocklyHighlightedConnectionPath {","stroke: "+this.SELECTED_GLOW_COLOUR+";","}",a+" .blocklyDisabled > .blocklyOutlinePath {","fill: url(#blocklyDisabledPattern"+this.randomIdentifier+ ")","}",a+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]};var module$exports$Blockly$zelos$Drawer=function(a,b){module$exports$Blockly$zelos$Drawer.superClass_.constructor.call(this,a,b)};(0,module$exports$Blockly$utils$object.inherits)(module$exports$Blockly$zelos$Drawer,module$exports$Blockly$blockRendering$Drawer); module$exports$Blockly$zelos$Drawer.prototype.draw=function(){var a=this.block_.pathObject;a.beginDrawing();this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();a.setPath(this.outlinePath_+"\n"+this.inlinePath_);this.info_.RTL&&a.flipRTL();(0,module$exports$Blockly$blockRendering$debug.isDebuggerEnabled)()&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_();this.info_.outputConnection&&(a.outputShapeType=this.info_.outputConnection.shape.type);a.endDrawing()}; module$exports$Blockly$zelos$Drawer.prototype.drawOutline_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):module$exports$Blockly$zelos$Drawer.superClass_.drawOutline_.call(this)}; module$exports$Blockly$zelos$Drawer.prototype.drawLeft_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():module$exports$Blockly$zelos$Drawer.superClass_.drawLeft_.call(this)}; module$exports$Blockly$zelos$Drawer.prototype.drawRightSideRow_=function(a){if(!(0>=a.height))if(a.precedesStatement||a.followsStatement){var b=this.constants_.INSIDE_CORNERS.rightHeight;b=a.height-(a.precedesStatement?b:0);this.outlinePath_+=(a.followsStatement?this.constants_.INSIDE_CORNERS.pathBottomRight:"")+(0=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!f.precedesStatement;if(module$exports$Blockly$blockRendering$Types.isInputRow(e)&&e.hasStatement)e.measure(),b=e.width-e.getLastInput().width+ a;else if(d&&(2==c||f)&&module$exports$Blockly$blockRendering$Types.isInputRow(e)&&!e.hasStatement){f=e.xPos;d=null;for(var g=0;cc?c:this.height/2,b-c*(1-Math.sin(Math.acos((c-this.constants_.SMALL_PADDING)/c)));default:return 0}if(module$exports$Blockly$blockRendering$Types.isInlineInput(a)){var e= a.connectedBlock;a=e?e.pathObject.outputShapeType:a.shape.type;return e&&e.outputConnection&&(e.statementInputCount||e.nextConnection)||c==d.SHAPES.HEXAGONAL&&c!=a?0:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][a]}return module$exports$Blockly$blockRendering$Types.isField(a)?c==d.SHAPES.ROUND&&a.field instanceof module$exports$Blockly$FieldTextInput?b-2.75*d.GRID_UNIT:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][0]:module$exports$Blockly$blockRendering$Types.isIcon(a)?this.constants_.SMALL_PADDING: 0}; module$exports$Blockly$zelos$RenderInfo.prototype.finalizeVerticalAlignment_=function(){if(!this.outputConnection)for(var a=2;a=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!d.precedesStatement;if(e?this.topRow.hasPreviousConnection:b.followsStatement){var g=3==c.elements.length&&(c.elements[1].field instanceof module$exports$Blockly$FieldLabel||c.elements[1].field instanceof module$exports$Blockly$FieldImage);if(!e&& g)b.height-=this.constants_.SMALL_PADDING,d.height-=this.constants_.SMALL_PADDING,c.height-=this.constants_.MEDIUM_PADDING;else if(!e&&!f)b.height+=this.constants_.SMALL_PADDING;else if(f){e=!1;for(f=0;f