ocoge/google-blockly/blockly_compressed.js

2017 lines
906 KiB
JavaScript

// Do not edit this file; automatically generated.
/* 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
var factoryExports = factory();
root.Blockly = factoryExports;
}
}(this, function() {
var $={};
/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
$.$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<a.length?{done:!1,value:a[b++]}:{done:!0}}};$.$jscomp.arrayIterator=function(a){return{next:$.$jscomp.arrayIteratorImpl(a)}};
$.$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$.$jscomp.arrayIterator(a)};$.$jscomp.arrayFromIterator=function(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c};$.$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$.$jscomp.arrayFromIterator($.$jscomp.makeIterator(a))};$.$jscomp.owns=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};$.$jscomp.ASSUME_ES5=!1;
$.$jscomp.ASSUME_NO_NATIVE_MAP=!1;$.$jscomp.ASSUME_NO_NATIVE_SET=!1;$.$jscomp.SIMPLE_FROUND_POLYFILL=!1;$.$jscomp.ISOLATE_POLYFILLS=!1;$.$jscomp.FORCE_POLYFILL_PROMISE=!1;$.$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$.$jscomp.defineProperty=$.$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
$.$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$.$jscomp.global=$.$jscomp.getGlobal(this);$.$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$.$jscomp.TRUST_ES6_POLYFILLS=!$.$jscomp.ISOLATE_POLYFILLS||$.$jscomp.IS_SYMBOL_NATIVE;
$.$jscomp.polyfills={};$.$jscomp.propertyToPolyfillSymbol={};$.$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var c=$.$jscomp.propertyToPolyfillSymbol[b];if(null==c)return a[b];c=a[c];return void 0!==c?c:a[b]};$.$jscomp.polyfill=function(a,b,c,d){b&&($.$jscomp.ISOLATE_POLYFILLS?$.$jscomp.polyfillIsolated(a,b,c,d):$.$jscomp.polyfillUnisolated(a,b,c,d))};
$.$jscomp.polyfillUnisolated=function(a,b,c,d){c=$.$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))return;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$.$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})};
$.$jscomp.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $.$jscomp.polyfills?$.$jscomp.polyfills:$.$jscomp.global;for(var f=0;f<e.length-1;f++){var g=e[f];if(!(g in d))return;d=d[g]}e=e[e.length-1];c=$.$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?d[e]:null;b=b(c);null!=b&&(a?$.$jscomp.defineProperty($.$jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==c&&(void 0===$.$jscomp.propertyToPolyfillSymbol[e]&&(c=1E9*Math.random()>>>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.assign=$.$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)$.$jscomp.owns(d,e)&&(a[e]=d[e])}return a};
$.$jscomp.polyfill("Object.assign",function(a){return a||$.$jscomp.assign},"es6","es3");$.$jscomp.objectCreate=$.$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var b=function(){};b.prototype=a;return new 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.polyfill("globalThis",function(a){return a||$.$jscomp.global},"es_2020","es3");
$.$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&&c<e;)if(d[c++]!=b[g++])return!1;return g>=f}},"es6","es3");$.$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;c<b.length;c++){var d=$.$jscomp.global[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&$.$jscomp.defineProperty(d.prototype,a,{configurable:!0,writable:!0,value:function(){return $.$jscomp.iteratorPrototype($.$jscomp.arrayIteratorImpl(this))}})}return a},
"es6","es3");$.$jscomp.iteratorPrototype=function(a){a={next:a};a[Symbol.iterator]=function(){return this};return a};$.$jscomp.iteratorFromArray=function(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var f=c++;return{value:b(f,a[f]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e};
$.$jscomp.polyfill("Array.prototype.keys",function(a){return a?a:function(){return $.$jscomp.iteratorFromArray(this,function(b){return b})}},"es6","es3");$.$jscomp.polyfill("Object.setPrototypeOf",function(a){return a||$.$jscomp.setPrototypeOf},"es6","es5");$.$jscomp.polyfill("Array.prototype.values",function(a){return a?a:function(){return $.$jscomp.iteratorFromArray(this,function(b,c){return c})}},"es8","es3");
$.$jscomp.checkEs6ConformanceViaProxy=function(){try{var a={},b=Object.create(new $.$jscomp.global.Proxy(a,{get:function(c,d,e){return c==a&&"q"==d&&e==b}}));return!0===b.q}catch(c){return!1}};$.$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1;$.$jscomp.ES6_CONFORMANCE=$.$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$.$jscomp.checkEs6ConformanceViaProxy();
$.$jscomp.polyfill("WeakMap",function(a){function b(){if(!a||!Object.seal)return!1;try{var l=Object.seal({}),m=Object.seal({}),n=new a([[l,2],[m,3]]);if(2!=n.get(l)||3!=n.get(m))return!1;n.delete(l);n.set(m,4);return!n.has(l)&&4==n.get(m)}catch(p){return!1}}function c(){}function d(l){var m=typeof l;return"object"===m&&null!==l||"function"===m}function e(l){if(!$.$jscomp.owns(l,g)){var m=new c;$.$jscomp.defineProperty(l,g,{value:m})}}function f(l){if(!$.$jscomp.ISOLATE_POLYFILLS){var m=Object[l];
m&&(Object[l]=function(n){if(n instanceof c)return n;Object.isExtensible(n)&&e(n);return m(n)})}}if($.$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(a&&$.$jscomp.ES6_CONFORMANCE)return a}else if(b())return a;var g="$jscomp_hidden_"+Math.random();f("freeze");f("preventExtensions");f("seal");var h=0,k=function(l){this.id_=(h+=Math.random()+1).toString();if(l){l=$.$jscomp.makeIterator(l);for(var m;!(m=l.next()).done;)m=m.value,this.set(m[0],m[1])}};k.prototype.set=function(l,m){if(!d(l))throw Error("Invalid WeakMap key");
e(l);if(!$.$jscomp.owns(l,g))throw Error("WeakMap key fail: "+l);l[g][this.id_]=m;return this};k.prototype.get=function(l){return d(l)&&$.$jscomp.owns(l,g)?l[g][this.id_]:void 0};k.prototype.has=function(l){return d(l)&&$.$jscomp.owns(l,g)&&$.$jscomp.owns(l[g],this.id_)};k.prototype.delete=function(l){return d(l)&&$.$jscomp.owns(l,g)&&$.$jscomp.owns(l[g],this.id_)?delete l[g][this.id_]:!1};return k},"es6","es3");
$.$jscomp.polyfill("Object.entries",function(a){return a?a:function(b){var c=[],d;for(d in b)$.$jscomp.owns(b,d)&&c.push([d,b[d]]);return c}},"es8","es3");$.$jscomp.polyfill("Object.getOwnPropertySymbols",function(a){return a?a:function(){return[]}},"es6","es5");
$.$jscomp.polyfill("Reflect.ownKeys",function(a){return a?a:function(b){var c=[],d=Object.getOwnPropertyNames(b);b=Object.getOwnPropertySymbols(b);for(var e=0;e<d.length;e++)("jscomp_symbol_"==d[e].substring(0,14)?b:c).push(d[e]);return c.concat(b)}},"es6","es5");$.$jscomp.polyfill("Object.getOwnPropertyDescriptors",function(a){return a?a:function(b){for(var c={},d=Reflect.ownKeys(b),e=0;e<d.length;e++)c[d[e]]=Object.getOwnPropertyDescriptor(b,d[e]);return c}},"es8","es5");
$.$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(b,c,d){var e=this.length||0;0>c&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);c<d;c++)this[c]=b;return this}},"es6","es3");$.$jscomp.typedArrayFill=function(a){return a?a:Array.prototype.fill};$.$jscomp.polyfill("Int8Array.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");$.$jscomp.polyfill("Uint8Array.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");
$.$jscomp.polyfill("Uint8ClampedArray.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");$.$jscomp.polyfill("Int16Array.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");$.$jscomp.polyfill("Uint16Array.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");$.$jscomp.polyfill("Int32Array.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");$.$jscomp.polyfill("Uint32Array.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");
$.$jscomp.polyfill("Float32Array.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");$.$jscomp.polyfill("Float64Array.prototype.fill",$.$jscomp.typedArrayFill,"es6","es5");$.$jscomp.MapEntry=function(){};
$.$jscomp.polyfill("Map",function(a){function b(){if($.$jscomp.ASSUME_NO_NATIVE_MAP||!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var k=Object.seal({x:4}),l=new a($.$jscomp.makeIterator([[k,"s"]]));if("s"!=l.get(k)||1!=l.size||l.get({x:4})||l.set({x:4},"t")!=l||2!=l.size)return!1;var m=l.entries(),n=m.next();if(n.done||n.value[0]!=k||"s"!=n.value[1])return!1;n=m.next();return n.done||4!=n.value[0].x||"t"!=n.value[1]||!m.next().done?!1:!0}catch(p){return!1}}
if($.$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(a&&$.$jscomp.ES6_CONFORMANCE)return a}else if(b())return a;var c=new WeakMap,d=function(k){this.data_={};this.head_=g();this.size=0;if(k){k=$.$jscomp.makeIterator(k);for(var l;!(l=k.next()).done;)l=l.value,this.set(l[0],l[1])}};d.prototype.set=function(k,l){k=0===k?0:k;var m=e(this,k);m.list||(m.list=this.data_[m.id]=[]);m.entry?m.entry.value=l:(m.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:k,value:l},m.list.push(m.entry),
this.head_.previous.next=m.entry,this.head_.previous=m.entry,this.size++);return this};d.prototype.delete=function(k){k=e(this,k);return k.entry&&k.list?(k.list.splice(k.index,1),k.list.length||delete this.data_[k.id],k.entry.previous.next=k.entry.next,k.entry.next.previous=k.entry.previous,k.entry.head=null,this.size--,!0):!1};d.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=g();this.size=0};d.prototype.has=function(k){return!!e(this,k).entry};d.prototype.get=function(k){return(k=
e(this,k).entry)&&k.value};d.prototype.entries=function(){return f(this,function(k){return[k.key,k.value]})};d.prototype.keys=function(){return f(this,function(k){return k.key})};d.prototype.values=function(){return f(this,function(k){return k.value})};d.prototype.forEach=function(k,l){for(var m=this.entries(),n;!(n=m.next()).done;)n=n.value,k.call(l,n[1],n[0],this)};d.prototype[Symbol.iterator]=d.prototype.entries;var e=function(k,l){var m=l&&typeof l;"object"==m||"function"==m?c.has(l)?m=c.get(l):
(m=""+ ++h,c.set(l,m)):m="p_"+l;var n=k.data_[m];if(n&&$.$jscomp.owns(k.data_,m))for(k=0;k<n.length;k++){var p=n[k];if(l!==l&&p.key!==p.key||l===p.key)return{id:m,list:n,index:k,entry:p}}return{id:m,list:n,index:-1,entry:void 0}},f=function(k,l){var m=k.head_;return $.$jscomp.iteratorPrototype(function(){if(m){for(;m.head!=k.head_;)m=m.previous;for(;m.next!=m.head;)return m=m.next,{done:!1,value:l(m)};m=null}return{done:!0,value:void 0}})},g=function(){var k={};return k.previous=k.next=k.head=k},
h=0;return d},"es6","es3");
$.$jscomp.polyfill("Set",function(a){function b(){if($.$jscomp.ASSUME_NO_NATIVE_SET||!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var d=Object.seal({x:4}),e=new a($.$jscomp.makeIterator([d]));if(!e.has(d)||1!=e.size||e.add(d)!=e||1!=e.size||e.add({x:4})!=e||2!=e.size)return!1;var f=e.entries(),g=f.next();if(g.done||g.value[0]!=d||g.value[1]!=d)return!1;g=f.next();return g.done||g.value[0]==d||4!=g.value[0].x||g.value[1]!=g.value[0]?!1:f.next().done}catch(h){return!1}}
if($.$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(a&&$.$jscomp.ES6_CONFORMANCE)return a}else if(b())return a;var c=function(d){this.map_=new Map;if(d){d=$.$jscomp.makeIterator(d);for(var e;!(e=d.next()).done;)this.add(e.value)}this.size=this.map_.size};c.prototype.add=function(d){d=0===d?0:d;this.map_.set(d,d);this.size=this.map_.size;return this};c.prototype.delete=function(d){d=this.map_.delete(d);this.size=this.map_.size;return d};c.prototype.clear=function(){this.map_.clear();this.size=0};
c.prototype.has=function(d){return this.map_.has(d)};c.prototype.entries=function(){return this.map_.entries()};c.prototype.values=function(){return this.map_.values()};c.prototype.keys=c.prototype.values;c.prototype[Symbol.iterator]=c.prototype.values;c.prototype.forEach=function(d,e){var f=this;this.map_.forEach(function(g){return d.call(e,g,g,f)})};return c},"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=globalThis||root;goog.define=function(a,b){return b};goog.DEBUG=!1;
goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG;goog.provide=function(a){};goog.module=function(a){};goog.module.get=function(a){};goog.module.declareLegacyNamespace=function(){};goog.setTestOnly=function(a){if(goog.DISALLOW_TEST_ONLY_CODE)throw a=a||"",Error("Importing test-only code into non-debug environment"+(a?": "+a:"."));};goog.require=function(a){};goog.requireType=function(a){};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$Css={},module$contents$Blockly$Css_injected=!1;module$exports$Blockly$Css.register=function(a){if(module$contents$Blockly$Css_injected)throw Error("CSS already injected");Array.isArray(a)?((0,module$exports$Blockly$utils$deprecation.warn)("Registering CSS by passing an array of strings","September 2021","September 2022","css.register passing a multiline string"),module$exports$Blockly$Css.content+="\n"+a.join("\n")):module$exports$Blockly$Css.content+="\n"+a};
module$exports$Blockly$Css.inject=function(a,b){module$contents$Blockly$Css_injected||(module$contents$Blockly$Css_injected=!0,a&&(a=b.replace(/[\\/]$/,""),b=module$exports$Blockly$Css.content.replace(/<<<PATH>>>/g,a),module$exports$Blockly$Css.content="",a=document.createElement("style"),a.id="blockly-common-style",b=document.createTextNode(b),a.appendChild(b),document.head.insertBefore(a,document.head.firstChild)))};module$exports$Blockly$Css.content='\n.blocklySvg {\n background-color: #fff;\n outline: none;\n overflow: hidden; /* IE overflows by default. */\n position: absolute;\n display: block;\n}\n\n.blocklyWidgetDiv {\n display: none;\n position: absolute;\n z-index: 99999; /* big value for bootstrap3 compatibility */\n}\n\n.injectionDiv {\n height: 100%;\n position: relative;\n overflow: hidden; /* So blocks in drag surface disappear at edges */\n touch-action: none;\n}\n\n.blocklyNonSelectable {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.blocklyWsDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n/* Added as a separate rule with multiple classes to make it more specific\n than a bootstrap rule that selects svg:root. See issue #1275 for context.\n*/\n.blocklyWsDragSurface.blocklyOverflowVisible {\n overflow: visible;\n}\n\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}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\n}\n\n.blocklyTooltipDiv {\n background-color: #ffffc7;\n border: 1px solid #ddc;\n box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);\n color: #000;\n display: none;\n font: 9pt sans-serif;\n opacity: .9;\n padding: 2px;\n position: absolute;\n z-index: 100000; /* big value for bootstrap3 compatibility */\n}\n\n.blocklyDropDownDiv {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n display: none;\n border: 1px solid;\n border-color: #dadce0;\n background-color: #fff;\n border-radius: 2px;\n padding: 4px;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownContent {\n max-height: 300px; // @todo: spec for maximum height.\n overflow: auto;\n overflow-x: hidden;\n position: relative;\n}\n\n.blocklyDropDownArrow {\n position: absolute;\n left: 0;\n top: 0;\n width: 16px;\n height: 16px;\n z-index: -1;\n background-color: inherit;\n border-color: inherit;\n}\n\n.blocklyDropDownButton {\n display: inline-block;\n float: left;\n padding: 0;\n margin: 4px;\n border-radius: 4px;\n outline: none;\n border: 1px solid;\n transition: box-shadow .1s;\n cursor: pointer;\n}\n\n.blocklyArrowTop {\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyArrowBottom {\n border-bottom: 1px solid;\n border-right: 1px solid;\n border-bottom-right-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyResizeSE {\n cursor: se-resize;\n fill: #aaa;\n}\n\n.blocklyResizeSW {\n cursor: sw-resize;\n fill: #aaa;\n}\n\n.blocklyResizeLine {\n stroke: #515A5A;\n stroke-width: 1;\n}\n\n.blocklyHighlightedConnectionPath {\n fill: none;\n stroke: #fc3;\n stroke-width: 4px;\n}\n\n.blocklyPathLight {\n fill: none;\n stroke-linecap: round;\n stroke-width: 1;\n}\n\n.blocklySelected>.blocklyPathLight {\n display: none;\n}\n\n.blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don\'t support grab */\n cursor: url("<<<PATH>>>/handopen.cur"), auto;\n cursor: grab;\n cursor: -webkit-grab;\n}\n\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n.blocklyDragging {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n /* Changes cursor on mouse down. Not effective in Firefox because of\n https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */\n.blocklyDraggable:active {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Change the cursor on the whole drag surface in case the mouse gets\n ahead of block during a drag. This way the cursor is still a closed hand.\n */\n.blocklyBlockDragSurface .blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n.blocklyDragging.blocklyDraggingDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyDragging>.blocklyPath,\n.blocklyDragging>.blocklyPathLight {\n fill-opacity: .8;\n stroke-opacity: .8;\n}\n\n.blocklyDragging>.blocklyPathDark {\n display: none;\n}\n\n.blocklyDisabled>.blocklyPath {\n fill-opacity: .5;\n stroke-opacity: .5;\n}\n\n.blocklyDisabled>.blocklyPathLight,\n.blocklyDisabled>.blocklyPathDark {\n display: none;\n}\n\n.blocklyInsertionMarker>.blocklyPath,\n.blocklyInsertionMarker>.blocklyPathLight,\n.blocklyInsertionMarker>.blocklyPathDark {\n fill-opacity: .2;\n stroke: none;\n}\n\n.blocklyMultilineText {\n font-family: monospace;\n}\n\n.blocklyNonEditableText>text {\n pointer-events: none;\n}\n\n.blocklyFlyout {\n position: absolute;\n z-index: 20;\n}\n\n.blocklyText text {\n cursor: default;\n}\n\n/*\n Don\'t allow users to select text. It gets annoying when trying to\n drag a block and selected text moves instead.\n*/\n.blocklySvg text,\n.blocklyBlockDragSurface text {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n cursor: inherit;\n}\n\n.blocklyHidden {\n display: none;\n}\n\n.blocklyFieldDropdown:not(.blocklyHidden) {\n display: block;\n}\n\n.blocklyIconGroup {\n cursor: default;\n}\n\n.blocklyIconGroup:not(:hover),\n.blocklyIconGroupReadonly {\n opacity: .6;\n}\n\n.blocklyIconShape {\n fill: #00f;\n stroke: #fff;\n stroke-width: 1px;\n}\n\n.blocklyIconSymbol {\n fill: #fff;\n}\n\n.blocklyMinimalBody {\n margin: 0;\n padding: 0;\n}\n\n.blocklyHtmlInput {\n border: none;\n border-radius: 4px;\n height: 100%;\n margin: 0;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: center;\n display: block;\n box-sizing: border-box;\n}\n\n/* Edge and IE introduce a close icon when the input value is longer than a\n certain length. This affects our sizing calculations of the text input.\n Hiding the close icon to avoid that. */\n.blocklyHtmlInput::-ms-clear {\n display: none;\n}\n\n.blocklyMainBackground {\n stroke-width: 1;\n stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */\n}\n\n.blocklyMutatorBackground {\n fill: #fff;\n stroke: #ddd;\n stroke-width: 1;\n}\n\n.blocklyFlyoutBackground {\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyMainWorkspaceScrollbar {\n z-index: 20;\n}\n\n.blocklyFlyoutScrollbar {\n z-index: 30;\n}\n\n.blocklyScrollbarHorizontal,\n.blocklyScrollbarVertical {\n position: absolute;\n outline: none;\n}\n\n.blocklyScrollbarBackground {\n opacity: 0;\n}\n\n.blocklyScrollbarHandle {\n fill: #ccc;\n}\n\n.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyScrollbarHandle:hover {\n fill: #bbb;\n}\n\n/* Darken flyout scrollbars due to being on a grey background. */\n/* By contrast, workspace scrollbars are on a white background. */\n.blocklyFlyout .blocklyScrollbarHandle {\n fill: #bbb;\n}\n\n.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyFlyout .blocklyScrollbarHandle:hover {\n fill: #aaa;\n}\n\n.blocklyInvalidInput {\n background: #faa;\n}\n\n.blocklyVerticalMarker {\n stroke-width: 3px;\n fill: rgba(255,255,255,.5);\n pointer-events: none;\n}\n\n.blocklyComputeCanvas {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.blocklyNoPointerEvents {\n pointer-events: none;\n}\n\n.blocklyContextMenu {\n border-radius: 4px;\n max-height: 100%;\n}\n\n.blocklyDropdownMenu {\n border-radius: 2px;\n padding: 0 !important;\n}\n\n.blocklyDropdownMenu .blocklyMenuItem {\n /* 28px on the left for icon or checkbox. */\n padding-left: 28px;\n}\n\n/* BiDi override for the resting state. */\n.blocklyDropdownMenu .blocklyMenuItemRtl {\n /* Flip left/right padding for BiDi. */\n padding-left: 5px;\n padding-right: 28px;\n}\n\n.blocklyWidgetDiv .blocklyMenu {\n background: #fff;\n border: 1px solid transparent;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n font: normal 13px Arial, sans-serif;\n margin: 0;\n outline: none;\n padding: 4px 0;\n position: absolute;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n.blocklyWidgetDiv .blocklyMenu.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\n background: inherit; /* Compatibility with gapi, reset from goog-menu */\n border: inherit; /* Compatibility with gapi, reset from goog-menu */\n font: normal 13px "Helvetica Neue", Helvetica, sans-serif;\n outline: none;\n position: relative; /* Compatibility with gapi, reset from goog-menu */\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n/* State: resting. */\n.blocklyMenuItem {\n border: none;\n color: #000;\n cursor: pointer;\n list-style: none;\n margin: 0;\n /* 7em on the right for shortcut. */\n min-width: 7em;\n padding: 6px 15px;\n white-space: nowrap;\n}\n\n/* State: disabled. */\n.blocklyMenuItemDisabled {\n color: #ccc;\n cursor: inherit;\n}\n\n/* State: hover. */\n.blocklyMenuItemHighlight {\n background-color: rgba(0,0,0,.1);\n}\n\n/* State: selected/checked. */\n.blocklyMenuItemCheckbox {\n height: 16px;\n position: absolute;\n width: 16px;\n}\n\n.blocklyMenuItemSelected .blocklyMenuItemCheckbox {\n background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;\n float: left;\n margin-left: -24px;\n position: static; /* Scroll with the menu. */\n}\n\n.blocklyMenuItemRtl .blocklyMenuItemCheckbox {\n float: right;\n margin-right: -24px;\n}\n';var module$contents$Blockly$utils$string_wrapLine,module$contents$Blockly$utils$string_wrapScore,module$contents$Blockly$utils$string_wrapMutate,module$contents$Blockly$utils$string_wrapToText;
$.module$exports$Blockly$utils$string={startsWith:function(a,b){return 0===a.lastIndexOf(b,0)},shortestStringLength:function(a){return a.length?a.reduce(function(b,c){return b.length<c.length?b:c}).length:0},commonWordPrefix:function(a,b){if(!a.length)return 0;if(1===a.length)return a[0].length;var c=0;b=b||(0,$.module$exports$Blockly$utils$string.shortestStringLength)(a);var d;for(d=0;d<b;d++){for(var e=a[0][d],f=1;f<a.length;f++)if(e!==a[f][d])return c;" "===e&&(c=d+1)}for(e=1;e<a.length;e++)if((f=
a[e][d])&&" "!==f)return c;return b},commonWordSuffix:function(a,b){if(!a.length)return 0;if(1===a.length)return a[0].length;var c=0;b=b||(0,$.module$exports$Blockly$utils$string.shortestStringLength)(a);var d;for(d=0;d<b;d++){for(var e=a[0].substr(-d-1,1),f=1;f<a.length;f++)if(e!==a[f].substr(-d-1,1))return c;" "===e&&(c=d+1)}for(e=1;e<a.length;e++)if((f=a[e].charAt(a[e].length-d-1))&&" "!==f)return c;return b},wrap:function(a,b){a=a.split("\n");for(var c=0;c<a.length;c++)a[c]=module$contents$Blockly$utils$string_wrapLine(a[c],
b);return a.join("\n")}};module$contents$Blockly$utils$string_wrapLine=function(a,b){if(a.length<=b)return a;for(var c=a.trim().split(/\s+/),d=0;d<c.length;d++)c[d].length>b&&(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;k<c.length-1;k++)h<(k+1.5)/e?(h++,a[k]=!0):a[k]=!1;a=module$contents$Blockly$utils$string_wrapMutate(c,a,b);e=module$contents$Blockly$utils$string_wrapScore(c,a,b);a=module$contents$Blockly$utils$string_wrapToText(c,a);f++}while(e>d);return g};
module$contents$Blockly$utils$string_wrapScore=function(a,b,c){for(var d=[0],e=[],f=0;f<a.length;f++)d[d.length-1]+=a[f].length,!0===b[f]?(d.push(0),e.push(a[f].charAt(a[f].length-1))):!1===b[f]&&d[d.length-1]++;a=Math.max.apply(Math,d);for(f=b=0;f<d.length;f++)b-=2*Math.pow(Math.abs(c-d[f]),1.5),b-=Math.pow(a-d[f],1.5),-1!==".?!".indexOf(e[f])?b+=c/3:-1!==",;)]}".indexOf(e[f])&&(b+=c/4);1<d.length&&d[d.length-1]<=d[d.length-2]&&(b+=.5);return b};
module$contents$Blockly$utils$string_wrapMutate=function(a,b,c){for(var d=module$contents$Blockly$utils$string_wrapScore(a,b,c),e,f=0;f<b.length-1;f++)if(b[f]!==b[f+1]){var g=[].concat(b);g[f]=!g[f];g[f+1]=!g[f+1];var h=module$contents$Blockly$utils$string_wrapScore(a,g,c);h>d&&(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<a.length;d++)c.push(a[d]),void 0!==b[d]&&c.push(b[d]?"\n":" ");return c.join("")};
$.module$exports$Blockly$utils$string.isNumber=function(a){return/^\s*-?\d+(\.\d+)?\s*$/.test(a)};$.module$exports$Blockly$utils$global={};$.module$exports$Blockly$utils$global.globalThis=function(){return"object"===typeof globalThis?globalThis:"object"===typeof self?self:"object"===typeof window?window:"object"===typeof global?global:this}();var module$exports$Blockly$Touch={},module$contents$Blockly$Touch_LONGPRESS=750;module$exports$Blockly$Touch.TOUCH_ENABLED="ontouchstart"in $.module$exports$Blockly$utils$global.globalThis||!!($.module$exports$Blockly$utils$global.globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!$.module$exports$Blockly$utils$global.globalThis.navigator||!$.module$exports$Blockly$utils$global.globalThis.navigator.maxTouchPoints&&!$.module$exports$Blockly$utils$global.globalThis.navigator.msMaxTouchPoints);
var module$contents$Blockly$Touch_touchIdentifier_=null;module$exports$Blockly$Touch.TOUCH_MAP={};
$.module$exports$Blockly$utils$global.globalThis.PointerEvent?module$exports$Blockly$Touch.TOUCH_MAP={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:module$exports$Blockly$Touch.TOUCH_ENABLED&&(module$exports$Blockly$Touch.TOUCH_MAP={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend",
"touchcancel"]});var module$contents$Blockly$Touch_longPid_=0;module$exports$Blockly$Touch.longStart=function(a,b){(0,module$exports$Blockly$Touch.longStop)();a.changedTouches&&1!==a.changedTouches.length||(module$contents$Blockly$Touch_longPid_=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);b&&b.handleRightClick(a)},module$contents$Blockly$Touch_LONGPRESS))};
module$exports$Blockly$Touch.longStop=function(){module$contents$Blockly$Touch_longPid_&&(clearTimeout(module$contents$Blockly$Touch_longPid_),module$contents$Blockly$Touch_longPid_=0)};module$exports$Blockly$Touch.clearTouchIdentifier=function(){module$contents$Blockly$Touch_touchIdentifier_=null};module$exports$Blockly$Touch.shouldHandleEvent=function(a){return!(0,module$exports$Blockly$Touch.isMouseOrTouchEvent)(a)||(0,module$exports$Blockly$Touch.checkTouchIdentifier)(a)};
module$exports$Blockly$Touch.getTouchIdentifierFromEvent=function(a){return void 0!==a.pointerId?a.pointerId:a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?a.changedTouches[0].identifier:"mouse"};
module$exports$Blockly$Touch.checkTouchIdentifier=function(a){var b=(0,module$exports$Blockly$Touch.getTouchIdentifierFromEvent)(a);return void 0!==module$contents$Blockly$Touch_touchIdentifier_&&null!==module$contents$Blockly$Touch_touchIdentifier_?module$contents$Blockly$Touch_touchIdentifier_===b:"mousedown"===a.type||"touchstart"===a.type||"pointerdown"===a.type?(module$contents$Blockly$Touch_touchIdentifier_=b,!0):!1};
module$exports$Blockly$Touch.setClientFromTouch=function(a){if((0,$.module$exports$Blockly$utils$string.startsWith)(a.type,"touch")&&a.changedTouches){var b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}};module$exports$Blockly$Touch.isMouseOrTouchEvent=function(a){return(0,$.module$exports$Blockly$utils$string.startsWith)(a.type,"touch")||(0,$.module$exports$Blockly$utils$string.startsWith)(a.type,"mouse")||(0,$.module$exports$Blockly$utils$string.startsWith)(a.type,"pointer")};
module$exports$Blockly$Touch.isTouchEvent=function(a){return(0,$.module$exports$Blockly$utils$string.startsWith)(a.type,"touch")||(0,$.module$exports$Blockly$utils$string.startsWith)(a.type,"pointer")};
module$exports$Blockly$Touch.splitEventByTouches=function(a){var b=[];if(a.changedTouches)for(var c=0;c<a.changedTouches.length;c++)b[c]={type:a.type,changedTouches:[a.changedTouches[c]],target:a.target,stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()}};else b.push(a);return b};var module$exports$Blockly$utils$userAgent={};
(function(a){function b(d){return-1!==c.indexOf(d.toUpperCase())}module$exports$Blockly$utils$userAgent.raw=a;var c=module$exports$Blockly$utils$userAgent.raw.toUpperCase();module$exports$Blockly$utils$userAgent.IE=b("Trident")||b("MSIE");module$exports$Blockly$utils$userAgent.EDGE=b("Edge");module$exports$Blockly$utils$userAgent.JavaFx=b("JavaFX");module$exports$Blockly$utils$userAgent.CHROME=(b("Chrome")||b("CriOS"))&&!module$exports$Blockly$utils$userAgent.EDGE;module$exports$Blockly$utils$userAgent.WEBKIT=
b("WebKit")&&!module$exports$Blockly$utils$userAgent.EDGE;module$exports$Blockly$utils$userAgent.GECKO=b("Gecko")&&!module$exports$Blockly$utils$userAgent.WEBKIT&&!module$exports$Blockly$utils$userAgent.IE&&!module$exports$Blockly$utils$userAgent.EDGE;module$exports$Blockly$utils$userAgent.ANDROID=b("Android");a=$.module$exports$Blockly$utils$global.globalThis.navigator&&$.module$exports$Blockly$utils$global.globalThis.navigator.maxTouchPoints;module$exports$Blockly$utils$userAgent.IPAD=b("iPad")||
b("Macintosh")&&0<a;module$exports$Blockly$utils$userAgent.IPOD=b("iPod");module$exports$Blockly$utils$userAgent.IPHONE=b("iPhone")&&!module$exports$Blockly$utils$userAgent.IPAD&&!module$exports$Blockly$utils$userAgent.IPOD;module$exports$Blockly$utils$userAgent.MAC=b("Macintosh");module$exports$Blockly$utils$userAgent.TABLET=module$exports$Blockly$utils$userAgent.IPAD||module$exports$Blockly$utils$userAgent.ANDROID&&!b("Mobile")||b("Silk");module$exports$Blockly$utils$userAgent.MOBILE=!module$exports$Blockly$utils$userAgent.TABLET&&
(module$exports$Blockly$utils$userAgent.IPOD||module$exports$Blockly$utils$userAgent.IPHONE||module$exports$Blockly$utils$userAgent.ANDROID||b("IEMobile"))})($.module$exports$Blockly$utils$global.globalThis.navigator&&$.module$exports$Blockly$utils$global.globalThis.navigator.userAgent||"");var module$exports$Blockly$browserEvents={},module$contents$Blockly$browserEvents_LINE_MODE_MULTIPLIER=40,module$contents$Blockly$browserEvents_PAGE_MODE_MULTIPLIER=125;
module$exports$Blockly$browserEvents.conditionalBind=function(a,b,c,d,e,f){var g=!1,h=function(p){var q=!e;p=(0,module$exports$Blockly$Touch.splitEventByTouches)(p);for(var r=0;r<p.length;r++){var t=p[r];if(!q||(0,module$exports$Blockly$Touch.shouldHandleEvent)(t))(0,module$exports$Blockly$Touch.setClientFromTouch)(t),c?d.call(c,t):d(t),g=!0}},k=[];if($.module$exports$Blockly$utils$global.globalThis.PointerEvent&&b in module$exports$Blockly$Touch.TOUCH_MAP)for(var l=0;l<module$exports$Blockly$Touch.TOUCH_MAP[b].length;l++){var m=
module$exports$Blockly$Touch.TOUCH_MAP[b][l];a.addEventListener(m,h,!1);k.push([a,m,h])}else if(a.addEventListener(b,h,!1),k.push([a,b,h]),b in module$exports$Blockly$Touch.TOUCH_MAP)for(l=function(p){h(p);var q=!f;g&&q&&p.preventDefault()},m=0;m<module$exports$Blockly$Touch.TOUCH_MAP[b].length;m++){var n=module$exports$Blockly$Touch.TOUCH_MAP[b][m];a.addEventListener(n,l,!1);k.push([a,n,l])}return k};
module$exports$Blockly$browserEvents.bind=function(a,b,c,d){var e=function(l){c?d.call(c,l):d(l)},f=[];if($.module$exports$Blockly$utils$global.globalThis.PointerEvent&&b in module$exports$Blockly$Touch.TOUCH_MAP)for(var g=0;g<module$exports$Blockly$Touch.TOUCH_MAP[b].length;g++){var h=module$exports$Blockly$Touch.TOUCH_MAP[b][g];a.addEventListener(h,e,!1);f.push([a,h,e])}else if(a.addEventListener(b,e,!1),f.push([a,b,e]),b in module$exports$Blockly$Touch.TOUCH_MAP)for(g=function(l){if(l.changedTouches&&
1===l.changedTouches.length){var m=l.changedTouches[0];l.clientX=m.clientX;l.clientY=m.clientY}e(l);l.preventDefault()},h=0;h<module$exports$Blockly$Touch.TOUCH_MAP[b].length;h++){var k=module$exports$Blockly$Touch.TOUCH_MAP[b][h];a.addEventListener(k,g,!1);f.push([a,k,g])}return f};module$exports$Blockly$browserEvents.unbind=function(a){for(var b;a.length;){b=a.pop();var c=b[0],d=b[1];b=b[2];c.removeEventListener(d,b,!1)}return b};
module$exports$Blockly$browserEvents.isTargetInput=function(a){return"textarea"===a.target.type||"text"===a.target.type||"number"===a.target.type||"email"===a.target.type||"password"===a.target.type||"search"===a.target.type||"tel"===a.target.type||"url"===a.target.type||a.target.isContentEditable||a.target.dataset&&"true"===a.target.dataset.isTextInput};module$exports$Blockly$browserEvents.isRightButton=function(a){return a.ctrlKey&&module$exports$Blockly$utils$userAgent.MAC?!0:2===a.button};
module$exports$Blockly$browserEvents.mouseToSvg=function(a,b,c){var d=b.createSVGPoint();d.x=a.clientX;d.y=a.clientY;c||(c=b.getScreenCTM().inverse());return d.matrixTransform(c)};
module$exports$Blockly$browserEvents.getScrollDeltaPixels=function(a){switch(a.deltaMode){default:return{x:a.deltaX,y:a.deltaY};case 1:return{x:a.deltaX*module$contents$Blockly$browserEvents_LINE_MODE_MULTIPLIER,y:a.deltaY*module$contents$Blockly$browserEvents_LINE_MODE_MULTIPLIER};case 2:return{x:a.deltaX*module$contents$Blockly$browserEvents_PAGE_MODE_MULTIPLIER,y:a.deltaY*module$contents$Blockly$browserEvents_PAGE_MODE_MULTIPLIER}}};var module$exports$Blockly$blocks={};module$exports$Blockly$blocks.Blocks=Object.create(null);var module$contents$Blockly$common_mainWorkspace;$.module$exports$Blockly$common={};$.module$exports$Blockly$common.getMainWorkspace=function(){return module$contents$Blockly$common_mainWorkspace};$.module$exports$Blockly$common.setMainWorkspace=function(a){module$contents$Blockly$common_mainWorkspace=a};var module$contents$Blockly$common_selected=null;$.module$exports$Blockly$common.getSelected=function(){return module$contents$Blockly$common_selected};
$.module$exports$Blockly$common.setSelected=function(a){module$contents$Blockly$common_selected=a};var module$contents$Blockly$common_parentContainer;$.module$exports$Blockly$common.getParentContainer=function(){return module$contents$Blockly$common_parentContainer};$.module$exports$Blockly$common.setParentContainer=function(a){module$contents$Blockly$common_parentContainer=a};
$.module$exports$Blockly$common.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=a.getCachedParentSvgSize(),d=b.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.width!==e&&(b.setAttribute("width",e+"px"),a.setCachedParentSvgSize(e,null));c.height!==d&&(b.setAttribute("height",d+"px"),a.setCachedParentSvgSize(null,d));a.resize()}};$.module$exports$Blockly$common.draggingConnections=[];
$.module$exports$Blockly$common.getBlockTypeCounts=function(a,b){var c=Object.create(null),d=a.getDescendants(!0);b&&(a=a.getNextBlock())&&(a=d.indexOf(a),d.splice(a,d.length-a));for(a=0;b=d[a];a++)c[b.type]?c[b.type]++:c[b.type]=1;return c};var module$contents$Blockly$common_jsonInitFactory=function(a){return function(){this.jsonInit(a)}};$.module$exports$Blockly$common.defineBlocksWithJsonArray=function(a){(0,$.module$exports$Blockly$common.defineBlocks)((0,$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray)(a))};
$.module$exports$Blockly$common.createBlockDefinitionsFromJsonArray=function(a){for(var b={},c=0;c<a.length;c++){var d=a[c];if(d){var e=d.type;e?b[e]={init:module$contents$Blockly$common_jsonInitFactory(d)}:console.warn("Block definition #"+c+" in JSON array is missing a type attribute. Skipping.")}else console.warn("Block definition #"+c+" in JSON array is "+d+". Skipping")}return b};
$.module$exports$Blockly$common.defineBlocks=function(a){for(var b=$.$jscomp.makeIterator(Object.keys(a)),c=b.next();!c.done;c=b.next()){c=c.value;var d=a[c];c in module$exports$Blockly$blocks.Blocks&&console.warn('Block definiton "'+c+'" overwrites previous definition.');module$exports$Blockly$blocks.Blocks[c]=d}};var module$exports$Blockly$Tooltip={},module$contents$Blockly$Tooltip_customTooltip=void 0;module$exports$Blockly$Tooltip.setCustomTooltip=function(a){module$contents$Blockly$Tooltip_customTooltip=a};module$exports$Blockly$Tooltip.getCustomTooltip=function(){return module$contents$Blockly$Tooltip_customTooltip};var 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_renderContent=function(){module$contents$Blockly$Tooltip_DIV&&module$contents$Blockly$Tooltip_element&&("function"===typeof module$contents$Blockly$Tooltip_customTooltip?module$contents$Blockly$Tooltip_customTooltip(module$contents$Blockly$Tooltip_DIV,module$contents$Blockly$Tooltip_element):module$contents$Blockly$Tooltip_renderDefaultContent())},module$contents$Blockly$Tooltip_renderDefaultContent=function(){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;b<a.length;b++){var c=document.createElement("div");c.appendChild(document.createTextNode(a[b]));module$contents$Blockly$Tooltip_DIV.appendChild(c)}},module$contents$Blockly$Tooltip_getPosition=function(a){var b=document.documentElement.clientWidth,c=document.documentElement.clientHeight,d=module$contents$Blockly$Tooltip_lastX;d=a?d-(module$exports$Blockly$Tooltip.OFFSET_X+module$contents$Blockly$Tooltip_DIV.offsetWidth):
d+module$exports$Blockly$Tooltip.OFFSET_X;var e=module$contents$Blockly$Tooltip_lastY+module$exports$Blockly$Tooltip.OFFSET_Y;e+module$contents$Blockly$Tooltip_DIV.offsetHeight>c+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);return{x:d,y:e}},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="";module$contents$Blockly$Tooltip_renderContent();var a=module$contents$Blockly$Tooltip_element.RTL;module$contents$Blockly$Tooltip_DIV.style.direction=a?"rtl":"ltr";module$contents$Blockly$Tooltip_DIV.style.display=
"block";module$contents$Blockly$Tooltip_visible=!0;a=module$contents$Blockly$Tooltip_getPosition(a);var b=a.y;module$contents$Blockly$Tooltip_DIV.style.left=a.x+"px";module$contents$Blockly$Tooltip_DIV.style.top=b+"px"}};var module$exports$Blockly$utils$dom={SVG_NS:"http://www.w3.org/2000/svg",HTML_NS:"http://www.w3.org/1999/xhtml",XLINK_NS:"http://www.w3.org/1999/xlink",NodeType:{ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16}},module$contents$Blockly$utils$dom_cacheWidths=null,module$contents$Blockly$utils$dom_cacheReference=0,module$contents$Blockly$utils$dom_canvasContext=null;
module$exports$Blockly$utils$dom.createSvgElement=function(a,b,c){a=document.createElementNS(module$exports$Blockly$utils$dom.SVG_NS,String(a));for(var d in b)a.setAttribute(d,b[d]);document.body.runtimeStyle&&(a.runtimeStyle=a.currentStyle=a.style);c&&c.appendChild(a);return a};module$exports$Blockly$utils$dom.addClass=function(a,b){var c=a.getAttribute("class")||"";if(-1!==(" "+c+" ").indexOf(" "+b+" "))return!1;c&&(c+=" ");a.setAttribute("class",c+b);return!0};
module$exports$Blockly$utils$dom.removeClasses=function(a,b){b=b.split(" ");for(var c=0;c<b.length;c++)(0,module$exports$Blockly$utils$dom.removeClass)(a,b[c])};module$exports$Blockly$utils$dom.removeClass=function(a,b){var c=a.getAttribute("class");if(-1===(" "+c+" ").indexOf(" "+b+" "))return!1;c=c.split(/\s+/);for(var d=0;d<c.length;d++)c[d]&&c[d]!==b||(c.splice(d,1),d--);c.length?a.setAttribute("class",c.join(" ")):a.removeAttribute("class");return!0};
module$exports$Blockly$utils$dom.hasClass=function(a,b){return-1!==(" "+a.getAttribute("class")+" ").indexOf(" "+b+" ")};module$exports$Blockly$utils$dom.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};module$exports$Blockly$utils$dom.insertAfter=function(a,b){var c=b.nextSibling;b=b.parentNode;if(!b)throw Error("Reference node has no parent.");c?b.insertBefore(a,c):b.appendChild(a)};
module$exports$Blockly$utils$dom.containsNode=function(a,b){return!!(a.compareDocumentPosition(b)&module$exports$Blockly$utils$dom.NodeType.DOCUMENT_POSITION_CONTAINED_BY)};module$exports$Blockly$utils$dom.setCssTransform=function(a,b){a.style.transform=b;a.style["-webkit-transform"]=b};module$exports$Blockly$utils$dom.startTextWidthCache=function(){module$contents$Blockly$utils$dom_cacheReference++;module$contents$Blockly$utils$dom_cacheWidths||(module$contents$Blockly$utils$dom_cacheWidths=Object.create(null))};
module$exports$Blockly$utils$dom.stopTextWidthCache=function(){module$contents$Blockly$utils$dom_cacheReference--;module$contents$Blockly$utils$dom_cacheReference||(module$contents$Blockly$utils$dom_cacheWidths=null)};
module$exports$Blockly$utils$dom.getTextWidth=function(a){var b=a.textContent+"\n"+a.className.baseVal,c;if(module$contents$Blockly$utils$dom_cacheWidths&&(c=module$contents$Blockly$utils$dom_cacheWidths[b]))return c;try{c=module$exports$Blockly$utils$userAgent.IE||module$exports$Blockly$utils$userAgent.EDGE?a.getBBox().width:a.getComputedTextLength()}catch(d){return 8*a.textContent.length}module$contents$Blockly$utils$dom_cacheWidths&&(module$contents$Blockly$utils$dom_cacheWidths[b]=c);return c};
module$exports$Blockly$utils$dom.getFastTextWidth=function(a,b,c,d){return(0,module$exports$Blockly$utils$dom.getFastTextWidthWithSizeString)(a,b+"pt",c,d)};
module$exports$Blockly$utils$dom.getFastTextWidthWithSizeString=function(a,b,c,d){var e=a.textContent;a=e+"\n"+a.className.baseVal;var f;if(module$contents$Blockly$utils$dom_cacheWidths&&(f=module$contents$Blockly$utils$dom_cacheWidths[a]))return f;module$contents$Blockly$utils$dom_canvasContext||(f=document.createElement("canvas"),f.className="blocklyComputeCanvas",document.body.appendChild(f),module$contents$Blockly$utils$dom_canvasContext=f.getContext("2d"));module$contents$Blockly$utils$dom_canvasContext.font=
c+" "+b+" "+d;f=module$contents$Blockly$utils$dom_canvasContext.measureText(e).width;module$contents$Blockly$utils$dom_cacheWidths&&(module$contents$Blockly$utils$dom_cacheWidths[a]=f);return f};
module$exports$Blockly$utils$dom.measureFontMetrics=function(a,b,c,d){var e=document.createElement("span");e.style.font=c+" "+b+" "+d;e.textContent=a;a=document.createElement("div");a.style.width="1px";a.style.height=0;b=document.createElement("div");b.setAttribute("style","position: fixed; top: 0; left: 0; display: flex;");b.appendChild(e);b.appendChild(a);document.body.appendChild(b);c={height:0,baseline:0};try{b.style.alignItems="baseline",c.baseline=a.offsetTop-e.offsetTop,b.style.alignItems=
"flex-end",c.height=a.offsetTop-e.offsetTop}finally{document.body.removeChild(b)}return c};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$utils$aria={},module$contents$Blockly$utils$aria_ARIA_PREFIX="aria-",module$contents$Blockly$utils$aria_ROLE_ATTRIBUTE="role";module$exports$Blockly$utils$aria.Role={GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",LISTBOX:"listbox",MENU:"menu",MENUITEM:"menuitem",MENUITEMCHECKBOX:"menuitemcheckbox",OPTION:"option",PRESENTATION:"presentation",ROW:"row",TREE:"tree",TREEITEM:"treeitem"};
module$exports$Blockly$utils$aria.State={ACTIVEDESCENDANT:"activedescendant",COLCOUNT:"colcount",DISABLED:"disabled",EXPANDED:"expanded",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",ORIENTATION:"orientation",POSINSET:"posinset",ROWCOUNT:"rowcount",SELECTED:"selected",SETSIZE:"setsize",VALUEMAX:"valuemax",VALUEMIN:"valuemin"};module$exports$Blockly$utils$aria.setRole=function(a,b){a.setAttribute(module$contents$Blockly$utils$aria_ROLE_ATTRIBUTE,b)};
module$exports$Blockly$utils$aria.setState=function(a,b,c){Array.isArray(c)&&(c=c.join(" "));a.setAttribute(module$contents$Blockly$utils$aria_ARIA_PREFIX+b,c)};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$registry={},module$contents$Blockly$registry_typeMap=Object.create(null);module$exports$Blockly$registry.TEST_ONLY={typeMap:module$contents$Blockly$registry_typeMap};var module$contents$Blockly$registry_nameMap=Object.create(null);module$exports$Blockly$registry.DEFAULT="default";module$exports$Blockly$registry.Type=function(a){this.name_=a};module$exports$Blockly$registry.Type.prototype.toString=function(){return this.name_};
module$exports$Blockly$registry.Type.CONNECTION_CHECKER=new module$exports$Blockly$registry.Type("connectionChecker");module$exports$Blockly$registry.Type.CURSOR=new module$exports$Blockly$registry.Type("cursor");module$exports$Blockly$registry.Type.EVENT=new module$exports$Blockly$registry.Type("event");module$exports$Blockly$registry.Type.FIELD=new module$exports$Blockly$registry.Type("field");module$exports$Blockly$registry.Type.RENDERER=new module$exports$Blockly$registry.Type("renderer");
module$exports$Blockly$registry.Type.TOOLBOX=new module$exports$Blockly$registry.Type("toolbox");module$exports$Blockly$registry.Type.THEME=new module$exports$Blockly$registry.Type("theme");module$exports$Blockly$registry.Type.TOOLBOX_ITEM=new module$exports$Blockly$registry.Type("toolboxItem");module$exports$Blockly$registry.Type.FLYOUTS_VERTICAL_TOOLBOX=new module$exports$Blockly$registry.Type("flyoutsVerticalToolbox");module$exports$Blockly$registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX=new module$exports$Blockly$registry.Type("flyoutsHorizontalToolbox");
module$exports$Blockly$registry.Type.METRICS_MANAGER=new module$exports$Blockly$registry.Type("metricsManager");module$exports$Blockly$registry.Type.BLOCK_DRAGGER=new module$exports$Blockly$registry.Type("blockDragger");module$exports$Blockly$registry.Type.SERIALIZER=new module$exports$Blockly$registry.Type("serializer");
module$exports$Blockly$registry.register=function(a,b,c,d){if(!(a instanceof module$exports$Blockly$registry.Type)&&"string"!==typeof a||""===String(a).trim())throw Error('Invalid type "'+a+'". The type must be a non-empty string or a Blockly.registry.Type.');a=String(a).toLowerCase();if("string"!==typeof b||""===b.trim())throw Error('Invalid name "'+b+'". The name must be a non-empty string.');var e=b.toLowerCase();if(!c)throw Error("Can not register a null value");var f=module$contents$Blockly$registry_typeMap[a],
g=module$contents$Blockly$registry_nameMap[a];f||(f=module$contents$Blockly$registry_typeMap[a]=Object.create(null),g=module$contents$Blockly$registry_nameMap[a]=Object.create(null));module$contents$Blockly$registry_validate(a,c);if(!d&&f[e])throw Error('Name "'+e+'" with type "'+a+'" already registered.');f[e]=c;g[e]=b};
var module$contents$Blockly$registry_validate=function(a,b){switch(a){case String(module$exports$Blockly$registry.Type.FIELD):if("function"!==typeof b.fromJson)throw Error('Type "'+a+'" must have a fromJson function');}};
module$exports$Blockly$registry.unregister=function(a,b){a=String(a).toLowerCase();b=b.toLowerCase();var c=module$contents$Blockly$registry_typeMap[a];c&&c[b]?(delete module$contents$Blockly$registry_typeMap[a][b],delete module$contents$Blockly$registry_nameMap[a][b]):console.warn("Unable to unregister ["+b+"]["+a+"] from the registry.")};
var module$contents$Blockly$registry_getItem=function(a,b,c){a=String(a).toLowerCase();b=b.toLowerCase();var d=module$contents$Blockly$registry_typeMap[a];if(!d||!d[b]){b="Unable to find ["+b+"]["+a+"] in the registry.";if(c)throw Error(b+" You must require or register a "+a+" plugin.");console.warn(b);return null}return d[b]};module$exports$Blockly$registry.hasItem=function(a,b){a=String(a).toLowerCase();b=b.toLowerCase();return(a=module$contents$Blockly$registry_typeMap[a])?!!a[b]:!1};
module$exports$Blockly$registry.getClass=function(a,b,c){return module$contents$Blockly$registry_getItem(a,b,c)};module$exports$Blockly$registry.getObject=function(a,b,c){return module$contents$Blockly$registry_getItem(a,b,c)};
module$exports$Blockly$registry.getAllItems=function(a,b,c){a=String(a).toLowerCase();var d=module$contents$Blockly$registry_typeMap[a];if(!d){d="Unable to find ["+a+"] in the registry.";if(c)throw Error(d+" You must require or register a "+a+" plugin.");console.warn(d);return null}if(!b)return d;a=module$contents$Blockly$registry_nameMap[a];c=Object.create(null);b=Object.keys(d);for(var e=0;e<b.length;e++){var f=b[e];c[a[f]]=d[f]}return c};
module$exports$Blockly$registry.getClassFromOptions=function(a,b,c){b=b.plugins[a.toString()]||module$exports$Blockly$registry.DEFAULT;return"function"===typeof b?b:(0,module$exports$Blockly$registry.getClass)(a,b,c)};var module$exports$Blockly$Events$utils={},module$contents$Blockly$Events$utils_group="",module$contents$Blockly$Events$utils_recordUndo=!0;module$exports$Blockly$Events$utils.setRecordUndo=function(a){module$contents$Blockly$Events$utils_recordUndo=a};module$exports$Blockly$Events$utils.getRecordUndo=function(){return module$contents$Blockly$Events$utils_recordUndo};var module$contents$Blockly$Events$utils_disabled=0;module$exports$Blockly$Events$utils.CREATE="create";
module$exports$Blockly$Events$utils.BLOCK_CREATE=module$exports$Blockly$Events$utils.CREATE;module$exports$Blockly$Events$utils.DELETE="delete";module$exports$Blockly$Events$utils.BLOCK_DELETE=module$exports$Blockly$Events$utils.DELETE;module$exports$Blockly$Events$utils.CHANGE="change";module$exports$Blockly$Events$utils.BLOCK_CHANGE=module$exports$Blockly$Events$utils.CHANGE;module$exports$Blockly$Events$utils.MOVE="move";module$exports$Blockly$Events$utils.BLOCK_MOVE=module$exports$Blockly$Events$utils.MOVE;
module$exports$Blockly$Events$utils.VAR_CREATE="var_create";module$exports$Blockly$Events$utils.VAR_DELETE="var_delete";module$exports$Blockly$Events$utils.VAR_RENAME="var_rename";module$exports$Blockly$Events$utils.UI="ui";module$exports$Blockly$Events$utils.BLOCK_DRAG="drag";module$exports$Blockly$Events$utils.SELECTED="selected";module$exports$Blockly$Events$utils.CLICK="click";module$exports$Blockly$Events$utils.MARKER_MOVE="marker_move";module$exports$Blockly$Events$utils.BUBBLE_OPEN="bubble_open";
module$exports$Blockly$Events$utils.TRASHCAN_OPEN="trashcan_open";module$exports$Blockly$Events$utils.TOOLBOX_ITEM_SELECT="toolbox_item_select";module$exports$Blockly$Events$utils.THEME_CHANGE="theme_change";module$exports$Blockly$Events$utils.VIEWPORT_CHANGE="viewport_change";module$exports$Blockly$Events$utils.COMMENT_CREATE="comment_create";module$exports$Blockly$Events$utils.COMMENT_DELETE="comment_delete";module$exports$Blockly$Events$utils.COMMENT_CHANGE="comment_change";
module$exports$Blockly$Events$utils.COMMENT_MOVE="comment_move";module$exports$Blockly$Events$utils.FINISHED_LOADING="finished_loading";module$exports$Blockly$Events$utils.BUMP_EVENTS=[module$exports$Blockly$Events$utils.CREATE,module$exports$Blockly$Events$utils.MOVE,module$exports$Blockly$Events$utils.COMMENT_CREATE,module$exports$Blockly$Events$utils.COMMENT_MOVE];var module$contents$Blockly$Events$utils_FIRE_QUEUE=[];
module$exports$Blockly$Events$utils.fire=function(a){(0,module$exports$Blockly$Events$utils.isEnabled)()&&(module$contents$Blockly$Events$utils_FIRE_QUEUE.length||setTimeout(module$contents$Blockly$Events$utils_fireNow,0),module$contents$Blockly$Events$utils_FIRE_QUEUE.push(a))};
var module$contents$Blockly$Events$utils_fireNow=function(){for(var a=(0,module$exports$Blockly$Events$utils.filter)(module$contents$Blockly$Events$utils_FIRE_QUEUE,!0),b=module$contents$Blockly$Events$utils_FIRE_QUEUE.length=0,c;c=a[b];b++)if(c.workspaceId){var d=module$exports$Blockly$Workspace.Workspace.getById(c.workspaceId);d&&d.fireChangeListener(c)}};
module$exports$Blockly$Events$utils.filter=function(a,b){a=a.slice();b||a.reverse();for(var c=[],d=Object.create(null),e=0,f=void 0;f=a[e];e++)if(!f.isNull()){var g=[f.isUiEvent?module$exports$Blockly$Events$utils.UI:f.type,f.blockId,f.workspaceId].join(" "),h=d[g],k=h?h.event:null;if(!h)d[g]={event:f,index:e},c.push(f);else if(f.type===module$exports$Blockly$Events$utils.MOVE&&h.index===e-1)k.newParentId=f.newParentId,k.newInputName=f.newInputName,k.newCoordinate=f.newCoordinate,h.index=e;else if(f.type===
module$exports$Blockly$Events$utils.CHANGE&&f.element===k.element&&f.name===k.name)k.newValue=f.newValue;else if(f.type===module$exports$Blockly$Events$utils.VIEWPORT_CHANGE)h=f,k.viewTop=h.viewTop,k.viewLeft=h.viewLeft,k.scale=h.scale,k.oldScale=h.oldScale;else if(f.type!==module$exports$Blockly$Events$utils.CLICK||k.type!==module$exports$Blockly$Events$utils.BUBBLE_OPEN)d[g]={event:f,index:e},c.push(f)}a=c.filter(function(l){return!l.isNull()});b||a.reverse();b=1;for(c=void 0;c=a[b];b++)c.type===
module$exports$Blockly$Events$utils.CHANGE&&"mutation"===c.element&&a.unshift(a.splice(b,1)[0]);return a};module$exports$Blockly$Events$utils.clearPendingUndo=function(){for(var a=0,b;b=module$contents$Blockly$Events$utils_FIRE_QUEUE[a];a++)b.recordUndo=!1};module$exports$Blockly$Events$utils.disable=function(){module$contents$Blockly$Events$utils_disabled++};module$exports$Blockly$Events$utils.enable=function(){module$contents$Blockly$Events$utils_disabled--};
module$exports$Blockly$Events$utils.isEnabled=function(){return 0===module$contents$Blockly$Events$utils_disabled};module$exports$Blockly$Events$utils.getGroup=function(){return module$contents$Blockly$Events$utils_group};module$exports$Blockly$Events$utils.setGroup=function(a){module$contents$Blockly$Events$utils_group="boolean"===typeof a?a?(0,module$exports$Blockly$utils$idGenerator.genUid)():"":a};
module$exports$Blockly$Events$utils.getDescendantIds=function(a){var b=[];a=a.getDescendants(!1);for(var c=0,d;d=a[c];c++)b[c]=d.id;return b};module$exports$Blockly$Events$utils.fromJson=function(a,b){var c=(0,module$exports$Blockly$Events$utils.get)(a.type);if(!c)throw Error("Unknown event type.");c=new c;c.fromJson(a);c.workspaceId=b.id;return c};module$exports$Blockly$Events$utils.get=function(a){return(0,module$exports$Blockly$registry.getClass)(module$exports$Blockly$registry.Type.EVENT,a)};
module$exports$Blockly$Events$utils.disableOrphans=function(a){if((a.type===module$exports$Blockly$Events$utils.MOVE||a.type===module$exports$Blockly$Events$utils.CREATE)&&a.workspaceId){var b=module$exports$Blockly$Workspace.Workspace.getById(a.workspaceId),c=b.getBlockById(a.blockId);if(c){a=module$contents$Blockly$Events$utils_recordUndo;try{module$contents$Blockly$Events$utils_recordUndo=!1;var d=c.getParent();if(d&&d.isEnabled()){var e=c.getDescendants(!1);b=0;for(d=void 0;d=e[b];b++)d.setEnabled(!0)}else if((c.outputConnection||
c.previousConnection)&&!b.isDragging()){do c.setEnabled(!1),c=c.getNextBlock();while(c)}}finally{module$contents$Blockly$Events$utils_recordUndo=a}}}};module$exports$Blockly$Events$utils.TEST_ONLY={FIRE_QUEUE:module$contents$Blockly$Events$utils_FIRE_QUEUE,fireNow:module$contents$Blockly$Events$utils_fireNow};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<a){var d=c;c=a;a=d}return Math.max(a,Math.min(b,c))}};var module$exports$Blockly$bumpObjects={bumpIntoBounds:function(a,b,c){var d=c.getBoundingRectangle(),e=d.right-d.left,f=(0,module$exports$Blockly$utils$math.clamp)(b.top,d.top,b.top+b.height-(d.bottom-d.top))-d.top,g=b.left;b=b.left+b.width-e;a.RTL?g=Math.min(b,g):b=Math.max(g,b);return(a=(0,module$exports$Blockly$utils$math.clamp)(g,d.left,b)-d.left)||f?(c.moveBy(a,f),!0):!1},bumpIntoBoundsHandler:function(a){return function(b){var c=a.getMetricsManager();if(c.hasFixedEdges()&&!a.isDragging())if(-1!==
module$exports$Blockly$Events$utils.BUMP_EVENTS.indexOf(b.type)){c=c.getScrollMetrics(!0);var d=module$contents$Blockly$bumpObjects_extractObjectFromEvent(a,b);if(d){var e=(0,module$exports$Blockly$Events$utils.getGroup)();(0,module$exports$Blockly$Events$utils.setGroup)(b.group);(0,module$exports$Blockly$bumpObjects.bumpIntoBounds)(a,c,d)&&!b.group&&console.warn("Moved object in bounds but there was no event group. This may break undo.");null!==e&&(0,module$exports$Blockly$Events$utils.setGroup)(e)}}else b.type===
module$exports$Blockly$Events$utils.VIEWPORT_CHANGE&&b.scale>b.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$utils$Coordinate={Coordinate:function(a,b){this.x=a;this.y=b}};module$exports$Blockly$utils$Coordinate.Coordinate.prototype.clone=function(){return new module$exports$Blockly$utils$Coordinate.Coordinate(this.x,this.y)};module$exports$Blockly$utils$Coordinate.Coordinate.prototype.scale=function(a){this.x*=a;this.y*=a;return this};module$exports$Blockly$utils$Coordinate.Coordinate.prototype.translate=function(a,b){this.x+=a;this.y+=b;return this};
module$exports$Blockly$utils$Coordinate.Coordinate.equals=function(a,b){return a===b?!0:a&&b?a.x===b.x&&a.y===b.y:!1};module$exports$Blockly$utils$Coordinate.Coordinate.distance=function(a,b){var c=a.x-b.x;a=a.y-b.y;return Math.sqrt(c*c+a*a)};module$exports$Blockly$utils$Coordinate.Coordinate.magnitude=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};
module$exports$Blockly$utils$Coordinate.Coordinate.difference=function(a,b){return new module$exports$Blockly$utils$Coordinate.Coordinate(a.x-b.x,a.y-b.y)};module$exports$Blockly$utils$Coordinate.Coordinate.sum=function(a,b){return new module$exports$Blockly$utils$Coordinate.Coordinate(a.x+b.x,a.y+b.y)};var module$exports$Blockly$utils$Size={Size:function(a,b){this.width=a;this.height=b}};module$exports$Blockly$utils$Size.Size.equals=function(a,b){return a===b?!0:a&&b?a.width===b.width&&a.height===b.height:!1};var module$exports$Blockly$utils$style={getSize:function(a){if("none"!==module$contents$Blockly$utils$style_getStyle(a,"display"))return module$contents$Blockly$utils$style_getSizeWithDisplay(a);var b=a.style,c=b.display,d=b.visibility,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";var f=a.offsetWidth;a=a.offsetHeight;b.display=c;b.position=e;b.visibility=d;return new module$exports$Blockly$utils$Size.Size(f,a)}},module$contents$Blockly$utils$style_getSizeWithDisplay=
function(a){return new module$exports$Blockly$utils$Size.Size(a.offsetWidth,a.offsetHeight)},module$contents$Blockly$utils$style_getStyle=function(a,b){return(0,module$exports$Blockly$utils$style.getComputedStyle)(a,b)||(0,module$exports$Blockly$utils$style.getCascadedStyle)(a,b)||a.style&&a.style[b]};
module$exports$Blockly$utils$style.getComputedStyle=function(a,b){return document.defaultView&&document.defaultView.getComputedStyle&&(a=document.defaultView.getComputedStyle(a,null))?a[b]||a.getPropertyValue(b)||"":""};module$exports$Blockly$utils$style.getCascadedStyle=function(a,b){return a.currentStyle?a.currentStyle[b]:null};
module$exports$Blockly$utils$style.getPageOffset=function(a){var b=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0);a=a.getBoundingClientRect();var c=document.documentElement;c=new module$exports$Blockly$utils$Coordinate.Coordinate(window.pageXOffset||c.scrollLeft,window.pageYOffset||c.scrollTop);b.x=a.left+c.x;b.y=a.top+c.y;return b};
module$exports$Blockly$utils$style.getViewportPageOffset=function(){var a=document.body,b=document.documentElement;return new module$exports$Blockly$utils$Coordinate.Coordinate(a.scrollLeft||b.scrollLeft,a.scrollTop||b.scrollTop)};module$exports$Blockly$utils$style.setElementShown=function(a,b){a.style.display=b?"":"none"};module$exports$Blockly$utils$style.isRightToLeft=function(a){return"rtl"===module$contents$Blockly$utils$style_getStyle(a,"direction")};
module$exports$Blockly$utils$style.getBorderBox=function(a){var b=(0,module$exports$Blockly$utils$style.getComputedStyle)(a,"borderLeftWidth"),c=(0,module$exports$Blockly$utils$style.getComputedStyle)(a,"borderRightWidth"),d=(0,module$exports$Blockly$utils$style.getComputedStyle)(a,"borderTopWidth");a=(0,module$exports$Blockly$utils$style.getComputedStyle)(a,"borderBottomWidth");return{top:parseFloat(d),right:parseFloat(c),bottom:parseFloat(a),left:parseFloat(b)}};
module$exports$Blockly$utils$style.scrollIntoContainerView=function(a,b,c){a=(0,module$exports$Blockly$utils$style.getContainerOffsetToScrollInto)(a,b,c);b.scrollLeft=a.x;b.scrollTop=a.y};
module$exports$Blockly$utils$style.getContainerOffsetToScrollInto=function(a,b,c){var d=(0,module$exports$Blockly$utils$style.getPageOffset)(a),e=(0,module$exports$Blockly$utils$style.getPageOffset)(b),f=(0,module$exports$Blockly$utils$style.getBorderBox)(b),g=d.x-e.x-f.left;d=d.y-e.y-f.top;e=module$contents$Blockly$utils$style_getSizeWithDisplay(a);a=b.clientWidth-e.width;e=b.clientHeight-e.height;f=b.scrollLeft;b=b.scrollTop;c?(f+=g-a/2,b+=d-e/2):(f+=Math.min(g,Math.max(g-a,0)),b+=Math.min(d,Math.max(d-
e,0)));return new module$exports$Blockly$utils$Coordinate.Coordinate(f,b)};var module$exports$Blockly$utils$Rect={Rect:function(a,b,c,d){this.top=a;this.bottom=b;this.left=c;this.right=d}};module$exports$Blockly$utils$Rect.Rect.prototype.contains=function(a,b){return a>=this.left&&a<=this.right&&b>=this.top&&b<=this.bottom};module$exports$Blockly$utils$Rect.Rect.prototype.intersects=function(a){return!(this.left>a.right||this.right<a.left||this.top>a.bottom||this.bottom<a.top)};var module$exports$Blockly$dropDownDiv={ARROW_SIZE:16,BORDER_SIZE:1,ARROW_HORIZONTAL_PADDING:12,PADDING_Y:16,ANIMATION_TIME:.25},module$contents$Blockly$dropDownDiv_animateOutTimer=null,module$contents$Blockly$dropDownDiv_onHide=null,module$contents$Blockly$dropDownDiv_renderedClassName="",module$contents$Blockly$dropDownDiv_themeClassName="",module$contents$Blockly$dropDownDiv_div,module$contents$Blockly$dropDownDiv_content,module$contents$Blockly$dropDownDiv_arrow,module$contents$Blockly$dropDownDiv_boundsElement=
null,module$contents$Blockly$dropDownDiv_owner=null,module$contents$Blockly$dropDownDiv_positionToField=null;
module$exports$Blockly$dropDownDiv.createDom=function(){module$contents$Blockly$dropDownDiv_div||(module$contents$Blockly$dropDownDiv_div=document.createElement("div"),module$contents$Blockly$dropDownDiv_div.className="blocklyDropDownDiv",((0,$.module$exports$Blockly$common.getParentContainer)()||document.body).appendChild(module$contents$Blockly$dropDownDiv_div),module$contents$Blockly$dropDownDiv_content=document.createElement("div"),module$contents$Blockly$dropDownDiv_content.className="blocklyDropDownContent",
module$contents$Blockly$dropDownDiv_div.appendChild(module$contents$Blockly$dropDownDiv_content),module$contents$Blockly$dropDownDiv_arrow=document.createElement("div"),module$contents$Blockly$dropDownDiv_arrow.className="blocklyDropDownArrow",module$contents$Blockly$dropDownDiv_div.appendChild(module$contents$Blockly$dropDownDiv_arrow),module$contents$Blockly$dropDownDiv_div.style.opacity=0,module$contents$Blockly$dropDownDiv_div.style.transition="transform "+module$exports$Blockly$dropDownDiv.ANIMATION_TIME+
"s, opacity "+module$exports$Blockly$dropDownDiv.ANIMATION_TIME+"s",module$contents$Blockly$dropDownDiv_div.addEventListener("focusin",function(){(0,module$exports$Blockly$utils$dom.addClass)(module$contents$Blockly$dropDownDiv_div,"blocklyFocused")}),module$contents$Blockly$dropDownDiv_div.addEventListener("focusout",function(){(0,module$exports$Blockly$utils$dom.removeClass)(module$contents$Blockly$dropDownDiv_div,"blocklyFocused")}))};
module$exports$Blockly$dropDownDiv.setBoundsElement=function(a){module$contents$Blockly$dropDownDiv_boundsElement=a};module$exports$Blockly$dropDownDiv.getContentDiv=function(){return module$contents$Blockly$dropDownDiv_content};module$exports$Blockly$dropDownDiv.clearContent=function(){module$contents$Blockly$dropDownDiv_content.textContent="";module$contents$Blockly$dropDownDiv_content.style.width=""};
module$exports$Blockly$dropDownDiv.setColour=function(a,b){module$contents$Blockly$dropDownDiv_div.style.backgroundColor=a;module$contents$Blockly$dropDownDiv_div.style.borderColor=b};module$exports$Blockly$dropDownDiv.showPositionedByBlock=function(a,b,c,d){return module$contents$Blockly$dropDownDiv_showPositionedByRect(module$contents$Blockly$dropDownDiv_getScaledBboxOfBlock(b),a,c,d)};
module$exports$Blockly$dropDownDiv.showPositionedByField=function(a,b,c){module$contents$Blockly$dropDownDiv_positionToField=!0;return module$contents$Blockly$dropDownDiv_showPositionedByRect(module$contents$Blockly$dropDownDiv_getScaledBboxOfField(a),a,b,c)};
var module$contents$Blockly$dropDownDiv_getScaledBboxOfBlock=function(a){var b=a.getSvgRoot(),c=b.getBBox(),d=a.workspace.scale;a=c.height*d;c=c.width*d;b=(0,module$exports$Blockly$utils$style.getPageOffset)(b);return new module$exports$Blockly$utils$Rect.Rect(b.y,b.y+a,b.x,b.x+c)},module$contents$Blockly$dropDownDiv_getScaledBboxOfField=function(a){a=a.getScaledBBox();return new module$exports$Blockly$utils$Rect.Rect(a.top,a.bottom,a.left,a.right)},module$contents$Blockly$dropDownDiv_showPositionedByRect=
function(a,b,c,d){var e=a.left+(a.right-a.left)/2,f=a.bottom;a=a.top;d&&(a+=d);d=b.getSourceBlock();for(var g=d.workspace;g.options.parentWorkspace;)g=g.options.parentWorkspace;(0,module$exports$Blockly$dropDownDiv.setBoundsElement)(g.getParentSvg().parentNode);return(0,module$exports$Blockly$dropDownDiv.show)(b,d.RTL,e,f,e,a,c)};
module$exports$Blockly$dropDownDiv.show=function(a,b,c,d,e,f,g){module$contents$Blockly$dropDownDiv_owner=a;module$contents$Blockly$dropDownDiv_onHide=g||null;module$contents$Blockly$dropDownDiv_div.style.direction=b?"rtl":"ltr";a=(0,$.module$exports$Blockly$common.getMainWorkspace)();module$contents$Blockly$dropDownDiv_renderedClassName=a.getRenderer().getClassName();module$contents$Blockly$dropDownDiv_themeClassName=a.getTheme().getClassName();(0,module$exports$Blockly$utils$dom.addClass)(module$contents$Blockly$dropDownDiv_div,
module$contents$Blockly$dropDownDiv_renderedClassName);(0,module$exports$Blockly$utils$dom.addClass)(module$contents$Blockly$dropDownDiv_div,module$contents$Blockly$dropDownDiv_themeClassName);return module$contents$Blockly$dropDownDiv_positionInternal(c,d,e,f)};module$exports$Blockly$dropDownDiv.TEST_ONLY={};
module$exports$Blockly$dropDownDiv.TEST_ONLY.getBoundsInfo=function(){var a=(0,module$exports$Blockly$utils$style.getPageOffset)(module$contents$Blockly$dropDownDiv_boundsElement),b=(0,module$exports$Blockly$utils$style.getSize)(module$contents$Blockly$dropDownDiv_boundsElement);return{left:a.x,right:a.x+b.width,top:a.y,bottom:a.y+b.height,width:b.width,height:b.height}};
module$exports$Blockly$dropDownDiv.TEST_ONLY.getPositionMetrics=function(a,b,c,d){var e=module$exports$Blockly$dropDownDiv.TEST_ONLY.getBoundsInfo(),f=(0,module$exports$Blockly$utils$style.getSize)(module$contents$Blockly$dropDownDiv_div);return b+f.height<e.bottom?module$contents$Blockly$dropDownDiv_getPositionBelowMetrics(a,b,e,f):d-f.height>e.top?module$contents$Blockly$dropDownDiv_getPositionAboveMetrics(c,d,e,f):b+f.height<document.documentElement.clientHeight?module$contents$Blockly$dropDownDiv_getPositionBelowMetrics(a,
b,e,f):d-f.height>document.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=(0,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=(0,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=(0,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){b=(0,module$exports$Blockly$utils$math.clamp)(b,a-d/2,c-d);a=a-module$exports$Blockly$dropDownDiv.ARROW_SIZE/2-b;c=module$exports$Blockly$dropDownDiv.ARROW_HORIZONTAL_PADDING;a=(0,module$exports$Blockly$utils$math.clamp)(c,a,d-c-module$exports$Blockly$dropDownDiv.ARROW_SIZE);return{arrowX:a,divX:b}};module$exports$Blockly$dropDownDiv.isVisible=function(){return!!module$contents$Blockly$dropDownDiv_owner};
module$exports$Blockly$dropDownDiv.hideIfOwner=function(a,b){return module$contents$Blockly$dropDownDiv_owner===a?(b?(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)():(0,module$exports$Blockly$dropDownDiv.hide)(),!0):!1};
module$exports$Blockly$dropDownDiv.hide=function(){module$contents$Blockly$dropDownDiv_div.style.transform="translate(0, 0)";module$contents$Blockly$dropDownDiv_div.style.opacity=0;module$contents$Blockly$dropDownDiv_animateOutTimer=setTimeout(function(){(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)()},1E3*module$exports$Blockly$dropDownDiv.ANIMATION_TIME);module$contents$Blockly$dropDownDiv_onHide&&(module$contents$Blockly$dropDownDiv_onHide(),module$contents$Blockly$dropDownDiv_onHide=
null)};
module$exports$Blockly$dropDownDiv.hideWithoutAnimation=function(){(0,module$exports$Blockly$dropDownDiv.isVisible)()&&(module$contents$Blockly$dropDownDiv_animateOutTimer&&clearTimeout(module$contents$Blockly$dropDownDiv_animateOutTimer),module$contents$Blockly$dropDownDiv_div.style.transform="",module$contents$Blockly$dropDownDiv_div.style.left="",module$contents$Blockly$dropDownDiv_div.style.top="",module$contents$Blockly$dropDownDiv_div.style.opacity=0,module$contents$Blockly$dropDownDiv_div.style.display="none",
module$contents$Blockly$dropDownDiv_div.style.backgroundColor="",module$contents$Blockly$dropDownDiv_div.style.borderColor="",module$contents$Blockly$dropDownDiv_onHide&&(module$contents$Blockly$dropDownDiv_onHide(),module$contents$Blockly$dropDownDiv_onHide=null),(0,module$exports$Blockly$dropDownDiv.clearContent)(),module$contents$Blockly$dropDownDiv_owner=null,module$contents$Blockly$dropDownDiv_renderedClassName&&((0,module$exports$Blockly$utils$dom.removeClass)(module$contents$Blockly$dropDownDiv_div,
module$contents$Blockly$dropDownDiv_renderedClassName),module$contents$Blockly$dropDownDiv_renderedClassName=""),module$contents$Blockly$dropDownDiv_themeClassName&&((0,module$exports$Blockly$utils$dom.removeClass)(module$contents$Blockly$dropDownDiv_div,module$contents$Blockly$dropDownDiv_themeClassName),module$contents$Blockly$dropDownDiv_themeClassName=""),(0,$.module$exports$Blockly$common.getMainWorkspace)().markFocused())};
var module$contents$Blockly$dropDownDiv_positionInternal=function(a,b,c,d){a=module$exports$Blockly$dropDownDiv.TEST_ONLY.getPositionMetrics(a,b,c,d);a.arrowVisible?(module$contents$Blockly$dropDownDiv_arrow.style.display="",module$contents$Blockly$dropDownDiv_arrow.style.transform="translate("+a.arrowX+"px,"+a.arrowY+"px) rotate(45deg)",module$contents$Blockly$dropDownDiv_arrow.setAttribute("class",a.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):module$contents$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);module$contents$Blockly$dropDownDiv_div.style.left=b+"px";module$contents$Blockly$dropDownDiv_div.style.top=c+"px";module$contents$Blockly$dropDownDiv_div.style.display="block";module$contents$Blockly$dropDownDiv_div.style.opacity=1;module$contents$Blockly$dropDownDiv_div.style.transform="translate("+(d-b)+"px,"+(e-c)+"px)";return!!a.arrowAtTop};
module$exports$Blockly$dropDownDiv.repositionForWindowResize=function(){if(module$contents$Blockly$dropDownDiv_owner){var a=module$contents$Blockly$dropDownDiv_owner,b=a.getSourceBlock();a=module$contents$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(0,module$exports$Blockly$dropDownDiv.hide)()};var module$exports$Blockly$utils$svgMath={},module$contents$Blockly$utils$svgMath_XY_REGEX=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,module$contents$Blockly$utils$svgMath_XY_STYLE_REGEX=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/;
module$exports$Blockly$utils$svgMath.getRelativeXY=function(a){var b=new module$exports$Blockly$utils$Coordinate.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$contents$Blockly$utils$svgMath_XY_REGEX))b.x+=Number(c[1]),c[3]&&(b.y+=Number(c[3]));(a=a.getAttribute("style"))&&-1<a.indexOf("translate")&&(a=a.match(module$contents$Blockly$utils$svgMath_XY_STYLE_REGEX))&&(b.x+=Number(a[1]),a[3]&&
(b.y+=Number(a[3])));return b};module$exports$Blockly$utils$svgMath.getInjectionDivXY=function(a){for(var b=0,c=0;a;){var d=(0,module$exports$Blockly$utils$svgMath.getRelativeXY)(a);b+=d.x;c+=d.y;if(-1!==(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv "))break;a=a.parentNode}return new module$exports$Blockly$utils$Coordinate.Coordinate(b,c)};
module$exports$Blockly$utils$svgMath.is3dSupported=function(){if(void 0!==module$exports$Blockly$utils$svgMath.is3dSupported.cached_)return module$exports$Blockly$utils$svgMath.is3dSupported.cached_;if(!$.module$exports$Blockly$utils$global.globalThis.getComputedStyle)return!1;var a=document.createElement("p"),b="none",c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(a,null);
for(var d in c)if(void 0!==a.style[d]){a.style[d]="translate3d(1px,1px,1px)";b=$.module$exports$Blockly$utils$global.globalThis.getComputedStyle(a);if(!b)return document.body.removeChild(a),!1;b=b.getPropertyValue(c[d])}document.body.removeChild(a);module$exports$Blockly$utils$svgMath.is3dSupported.cached_="none"!==b;return module$exports$Blockly$utils$svgMath.is3dSupported.cached_};
module$exports$Blockly$utils$svgMath.getViewportBBox=function(){var a=(0,module$exports$Blockly$utils$style.getViewportPageOffset)();return new module$exports$Blockly$utils$Rect.Rect(a.y,document.documentElement.clientHeight+a.y,a.x,document.documentElement.clientWidth+a.x)};
module$exports$Blockly$utils$svgMath.getDocumentScroll=function(){var a=document.documentElement,b=window;return module$exports$Blockly$utils$userAgent.IE&&b.pageYOffset!==a.scrollTop?new module$exports$Blockly$utils$Coordinate.Coordinate(a.scrollLeft,a.scrollTop):new module$exports$Blockly$utils$Coordinate.Coordinate(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)};
module$exports$Blockly$utils$svgMath.screenToWsCoordinates=function(a,b){var c=b.x;b=b.y;var d=a.getInjectionDiv().getBoundingClientRect();c=new module$exports$Blockly$utils$Coordinate.Coordinate(c-d.left,b-d.top);b=a.getOriginOffsetInPixels();return module$exports$Blockly$utils$Coordinate.Coordinate.difference(c,b).scale(1/a.scale)};
module$exports$Blockly$utils$svgMath.svgSize=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.svgSize","March 2021","March 2022","workspace.getCachedParentSvgSize");return new module$exports$Blockly$utils$Size.Size(a.cachedWidth_,a.cachedHeight_)};module$exports$Blockly$utils$svgMath.TEST_ONLY={XY_REGEX:module$contents$Blockly$utils$svgMath_XY_REGEX,XY_STYLE_REGEX:module$contents$Blockly$utils$svgMath_XY_STYLE_REGEX};var module$exports$Blockly$utils$Svg={Svg:function(a){this.tagName_=a}};module$exports$Blockly$utils$Svg.Svg.prototype.toString=function(){return this.tagName_};module$exports$Blockly$utils$Svg.Svg.ANIMATE=new module$exports$Blockly$utils$Svg.Svg("animate");module$exports$Blockly$utils$Svg.Svg.CIRCLE=new module$exports$Blockly$utils$Svg.Svg("circle");module$exports$Blockly$utils$Svg.Svg.CLIPPATH=new module$exports$Blockly$utils$Svg.Svg("clipPath");module$exports$Blockly$utils$Svg.Svg.DEFS=new module$exports$Blockly$utils$Svg.Svg("defs");
module$exports$Blockly$utils$Svg.Svg.FECOMPOSITE=new module$exports$Blockly$utils$Svg.Svg("feComposite");module$exports$Blockly$utils$Svg.Svg.FECOMPONENTTRANSFER=new module$exports$Blockly$utils$Svg.Svg("feComponentTransfer");module$exports$Blockly$utils$Svg.Svg.FEFLOOD=new module$exports$Blockly$utils$Svg.Svg("feFlood");module$exports$Blockly$utils$Svg.Svg.FEFUNCA=new module$exports$Blockly$utils$Svg.Svg("feFuncA");module$exports$Blockly$utils$Svg.Svg.FEGAUSSIANBLUR=new module$exports$Blockly$utils$Svg.Svg("feGaussianBlur");
module$exports$Blockly$utils$Svg.Svg.FEPOINTLIGHT=new module$exports$Blockly$utils$Svg.Svg("fePointLight");module$exports$Blockly$utils$Svg.Svg.FESPECULARLIGHTING=new module$exports$Blockly$utils$Svg.Svg("feSpecularLighting");module$exports$Blockly$utils$Svg.Svg.FILTER=new module$exports$Blockly$utils$Svg.Svg("filter");module$exports$Blockly$utils$Svg.Svg.FOREIGNOBJECT=new module$exports$Blockly$utils$Svg.Svg("foreignObject");module$exports$Blockly$utils$Svg.Svg.G=new module$exports$Blockly$utils$Svg.Svg("g");
module$exports$Blockly$utils$Svg.Svg.IMAGE=new module$exports$Blockly$utils$Svg.Svg("image");module$exports$Blockly$utils$Svg.Svg.LINE=new module$exports$Blockly$utils$Svg.Svg("line");module$exports$Blockly$utils$Svg.Svg.PATH=new module$exports$Blockly$utils$Svg.Svg("path");module$exports$Blockly$utils$Svg.Svg.PATTERN=new module$exports$Blockly$utils$Svg.Svg("pattern");module$exports$Blockly$utils$Svg.Svg.POLYGON=new module$exports$Blockly$utils$Svg.Svg("polygon");
module$exports$Blockly$utils$Svg.Svg.RECT=new module$exports$Blockly$utils$Svg.Svg("rect");module$exports$Blockly$utils$Svg.Svg.SVG=new module$exports$Blockly$utils$Svg.Svg("svg");module$exports$Blockly$utils$Svg.Svg.TEXT=new module$exports$Blockly$utils$Svg.Svg("text");module$exports$Blockly$utils$Svg.Svg.TSPAN=new module$exports$Blockly$utils$Svg.Svg("tspan");var module$exports$Blockly$BlockDragSurfaceSvg={BlockDragSurfaceSvg:function(a){this.dragGroup_=this.SVG_=null;this.container_=a;this.scale_=1;this.surfaceXY_=null;this.childSurfaceXY_=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0);this.createDom()}};
module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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":"blocklyBlockDragSurface"},this.container_),this.dragGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,
{},this.SVG_))};module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.setBlocksAndShow=function(a){if(this.dragGroup_.childNodes.length)throw Error("Already dragging a block.");this.dragGroup_.appendChild(a);this.SVG_.style.display="block";this.surfaceXY_=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0)};
module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){this.scale_=c;a=a.toFixed(0);b=b.toFixed(0);this.childSurfaceXY_.x=parseInt(a,10);this.childSurfaceXY_.y=parseInt(b,10);this.dragGroup_.setAttribute("transform","translate("+a+","+b+") scale("+c+")")};
module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.translateSurfaceInternal_=function(){var a=this.surfaceXY_.x,b=this.surfaceXY_.y;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$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.translateBy=function(a,b){this.surfaceXY_=new module$exports$Blockly$utils$Coordinate.Coordinate(this.surfaceXY_.x+a,this.surfaceXY_.y+b);this.translateSurfaceInternal_()};module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.translateSurface=function(a,b){this.surfaceXY_=new module$exports$Blockly$utils$Coordinate.Coordinate(a*this.scale_,b*this.scale_);this.translateSurfaceInternal_()};
module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.getSurfaceTranslation=function(){var a=(0,module$exports$Blockly$utils$svgMath.getRelativeXY)(this.SVG_);return new module$exports$Blockly$utils$Coordinate.Coordinate(a.x/this.scale_,a.y/this.scale_)};module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_};module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.getSvgRoot=function(){return this.SVG_};
module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.firstChild};module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.getWsTranslation=function(){return this.childSurfaceXY_.clone()};
module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg.prototype.clearAndHide=function(a){var b=this.getCurrentBlock();b&&(a?a.appendChild(b):this.dragGroup_.removeChild(b));this.SVG_.style.display="none";if(this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=null};var module$exports$Blockly$Grid={Grid:function(a,b){this.scale_=1;this.gridPattern_=a;this.spacing_=b.spacing;this.length_=b.length;this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling;this.snapToGrid_=b.snap}};module$exports$Blockly$Grid.Grid.prototype.dispose=function(){this.gridPattern_=null};module$exports$Blockly$Grid.Grid.prototype.shouldSnap=function(){return this.snapToGrid_};module$exports$Blockly$Grid.Grid.prototype.getSpacing=function(){return this.spacing_};
module$exports$Blockly$Grid.Grid.prototype.getPatternId=function(){return this.gridPattern_.id};module$exports$Blockly$Grid.Grid.prototype.update=function(a){this.scale_=a;var b=this.spacing_*a||100;this.gridPattern_.setAttribute("width",b);this.gridPattern_.setAttribute("height",b);b=Math.floor(this.spacing_/2)+.5;var c=b-this.length_/2,d=b+this.length_/2;b*=a;c*=a;d*=a;this.setLineAttributes_(this.line1_,a,c,d,b,b);this.setLineAttributes_(this.line2_,a,b,b,c,d)};
module$exports$Blockly$Grid.Grid.prototype.setLineAttributes_=function(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",b),a.setAttribute("x1",c),a.setAttribute("y1",e),a.setAttribute("x2",d),a.setAttribute("y2",f))};module$exports$Blockly$Grid.Grid.prototype.moveTo=function(a,b){this.gridPattern_.setAttribute("x",a);this.gridPattern_.setAttribute("y",b);(module$exports$Blockly$utils$userAgent.IE||module$exports$Blockly$utils$userAgent.EDGE)&&this.update(this.scale_)};
module$exports$Blockly$Grid.Grid.createDom=function(a,b,c){a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATTERN,{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c);0<b.length&&0<b.spacing?((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.LINE,{stroke:b.colour},a),1<b.length&&(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.LINE,{stroke:b.colour},a)):(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.LINE,
{},a);return a};$.module$exports$Blockly$Msg={};$.module$exports$Blockly$Msg.Msg=Object.create(null);var module$contents$Blockly$utils$xml_xmlDocument;$.module$exports$Blockly$utils$xml={NAME_SPACE:"https://developers.google.com/blockly/xml"};module$contents$Blockly$utils$xml_xmlDocument=$.module$exports$Blockly$utils$global.globalThis.document;$.module$exports$Blockly$utils$xml.getDocument=function(){return module$contents$Blockly$utils$xml_xmlDocument};$.module$exports$Blockly$utils$xml.setDocument=function(a){module$contents$Blockly$utils$xml_xmlDocument=a};
$.module$exports$Blockly$utils$xml.createElement=function(a){return module$contents$Blockly$utils$xml_xmlDocument.createElementNS($.module$exports$Blockly$utils$xml.NAME_SPACE,a)};$.module$exports$Blockly$utils$xml.createTextNode=function(a){return module$contents$Blockly$utils$xml_xmlDocument.createTextNode(a)};$.module$exports$Blockly$utils$xml.textToDomDocument=function(a){return(new DOMParser).parseFromString(a,"text/xml")};$.module$exports$Blockly$utils$xml.domToText=function(a){return(new XMLSerializer).serializeToString(a)};$.module$exports$Blockly$ConnectionType={ConnectionType:{INPUT_VALUE:1,OUTPUT_VALUE:2,NEXT_STATEMENT:3,PREVIOUS_STATEMENT:4}};$.module$exports$Blockly$inputTypes={};$.module$exports$Blockly$inputTypes.inputTypes={VALUE:$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE,STATEMENT:$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT,DUMMY:5};var module$contents$Blockly$Xml_fieldToDom,module$contents$Blockly$Xml_allFieldsToDom;
$.module$exports$Blockly$Xml={workspaceToDom:function(a,b){var c=(0,$.module$exports$Blockly$utils$xml.createElement)("xml"),d=(0,$.module$exports$Blockly$Xml.variablesToDom)($.module$exports$Blockly$Variables.allUsedVarModels(a));d.hasChildNodes()&&c.appendChild(d);d=a.getTopComments(!0);for(var e=0;e<d.length;e++)c.appendChild(d[e].toXmlWithXY(b));a=a.getTopBlocks(!0);for(d=0;d<a.length;d++)c.appendChild((0,$.module$exports$Blockly$Xml.blockToDomWithXY)(a[d],b));return c},variablesToDom:function(a){for(var b=
(0,$.module$exports$Blockly$utils$xml.createElement)("variables"),c=0;c<a.length;c++){var d=a[c],e=(0,$.module$exports$Blockly$utils$xml.createElement)("variable");e.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(d.name));d.type&&e.setAttribute("type",d.type);e.id=d.getId();b.appendChild(e)}return b},blockToDomWithXY:function(a,b){if(a.isInsertionMarker()&&(a=a.getChildren(!1)[0],!a))return new DocumentFragment;var c;a.workspace.RTL&&(c=a.workspace.getWidth());b=(0,$.module$exports$Blockly$Xml.blockToDom)(a,
b);var d=a.getRelativeToSurfaceXY();b.setAttribute("x",Math.round(a.workspace.RTL?c-d.x:d.x));b.setAttribute("y",Math.round(d.y));return b}};module$contents$Blockly$Xml_fieldToDom=function(a){if(a.isSerializable()){var b=(0,$.module$exports$Blockly$utils$xml.createElement)("field");b.setAttribute("name",a.name||"");return a.toXml(b)}return null};
module$contents$Blockly$Xml_allFieldsToDom=function(a,b){for(var c=0;c<a.inputList.length;c++)for(var d=a.inputList[c],e=0;e<d.fieldRow.length;e++){var f=module$contents$Blockly$Xml_fieldToDom(d.fieldRow[e]);f&&b.appendChild(f)}};
$.module$exports$Blockly$Xml.blockToDom=function(a,b){if(a.isInsertionMarker())return(b=a.getChildren(!1)[0])?(0,$.module$exports$Blockly$Xml.blockToDom)(b):new DocumentFragment;var c=(0,$.module$exports$Blockly$utils$xml.createElement)(a.isShadow()?"shadow":"block");c.setAttribute("type",a.type);b||c.setAttribute("id",a.id);if(a.mutationToDom){var d=a.mutationToDom();d&&(d.hasChildNodes()||d.hasAttributes())&&c.appendChild(d)}module$contents$Blockly$Xml_allFieldsToDom(a,c);if(d=a.getCommentText()){var e=
a.commentModel.size,f=a.commentModel.pinned,g=(0,$.module$exports$Blockly$utils$xml.createElement)("comment");g.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(d));g.setAttribute("pinned",f);g.setAttribute("h",e.height);g.setAttribute("w",e.width);c.appendChild(g)}a.data&&(d=(0,$.module$exports$Blockly$utils$xml.createElement)("data"),d.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)(a.data)),c.appendChild(d));for(d=0;d<a.inputList.length;d++)if(e=a.inputList[d],
f=void 0,g=!0,e.type!==$.module$exports$Blockly$inputTypes.inputTypes.DUMMY){var h=e.connection.targetBlock();e.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE?f=(0,$.module$exports$Blockly$utils$xml.createElement)("value"):e.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT&&(f=(0,$.module$exports$Blockly$utils$xml.createElement)("statement"));var k=e.connection.getShadowDom();!k||h&&h.isShadow()||f.appendChild(module$contents$Blockly$Xml_cloneShadow(k,b));h&&(h=(0,$.module$exports$Blockly$Xml.blockToDom)(h,
b),h.nodeType===module$exports$Blockly$utils$dom.NodeType.ELEMENT_NODE&&(f.appendChild(h),g=!1));f.setAttribute("name",e.name);g||c.appendChild(f)}void 0!==a.inputsInline&&a.inputsInline!==a.inputsInlineDefault&&c.setAttribute("inline",a.inputsInline);a.isCollapsed()&&c.setAttribute("collapsed",!0);a.isEnabled()||c.setAttribute("disabled",!0);a.isDeletable()||a.isShadow()||c.setAttribute("deletable",!1);a.isMovable()||a.isShadow()||c.setAttribute("movable",!1);a.isEditable()||c.setAttribute("editable",
!1);d=a.getNextBlock();if(d&&(e=(0,$.module$exports$Blockly$Xml.blockToDom)(d,b),e.nodeType===module$exports$Blockly$utils$dom.NodeType.ELEMENT_NODE)){var l=(0,$.module$exports$Blockly$utils$xml.createElement)("next");l.appendChild(e);c.appendChild(l)}a=a.nextConnection&&a.nextConnection.getShadowDom();!a||d&&d.isShadow()||l.appendChild(module$contents$Blockly$Xml_cloneShadow(a,b));return c};
var module$contents$Blockly$Xml_cloneShadow=function(a,b){for(var c=a=a.cloneNode(!0),d;c;)if(b&&"shadow"===c.nodeName&&c.removeAttribute("id"),c.firstChild)c=c.firstChild;else{for(;c&&!c.nextSibling;)d=c,c=c.parentNode,d.nodeType===module$exports$Blockly$utils$dom.NodeType.TEXT_NODE&&""===d.data.trim()&&c.firstChild!==d&&(0,module$exports$Blockly$utils$dom.removeNode)(d);c&&(d=c,c=c.nextSibling,d.nodeType===module$exports$Blockly$utils$dom.NodeType.TEXT_NODE&&""===d.data.trim()&&(0,module$exports$Blockly$utils$dom.removeNode)(d))}return a};
$.module$exports$Blockly$Xml.domToText=function(a){return(0,$.module$exports$Blockly$utils$xml.domToText)(a).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")};$.module$exports$Blockly$Xml.domToPrettyText=function(a){a=(0,$.module$exports$Blockly$Xml.domToText)(a).split("<");for(var b="",c=1;c<a.length;c++){var d=a[c];"/"===d[0]&&(b=b.substring(2));a[c]=b+"<"+d;"/"!==d[0]&&"/>"!==d.slice(-2)&&(b+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>");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.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.WorkspaceCommentSvg;
q?q.fromXmlRendered(l,b,d):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment.")}else{var r=module$exports$Blockly$WorkspaceComment.WorkspaceComment;r?r.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){if(!b.getBlocksBoundingBox)return(0,$.module$exports$Blockly$Xml.domToWorkspace)(a,b);var 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;h<a.length;h++){var k=b.getBlockById(a[h]).getRelativeToSurfaceXY();k.y<g&&(g=k.y);k.x<e&&(e=k.x);k.x>f&&(f=k.x)}d=d-g+10;c=b.RTL?c-f:c-e;for(e=0;e<a.length;e++)b.getBlockById(a[e]).moveBy(c,
d)}return a};
$.module$exports$Blockly$Xml.domToBlock=function(a,b){if(a instanceof module$exports$Blockly$Workspace.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to domToBlock, swap the arguments.")}(0,module$exports$Blockly$Events$utils.disable)();c=b.getAllVariables();try{var d=module$contents$Blockly$Xml_domToBlockHeadless(a,b);if(b.rendered){var e=d,f=d.getDescendants(!1);e.setConnectionTracking(!1);for(var g=f.length-1;0<=g;g--)f[g].initSvg();for(var h=f.length-1;0<=h;h--)f[h].render(!1);setTimeout(function(){e.disposed||
e.setConnectionTracking(!0)},1);e.updateDisabled();b.resizeContents()}else for(var k=d.getDescendants(!1),l=k.length-1;0<=l;l--)k[l].initModel()}finally{(0,module$exports$Blockly$Events$utils.enable)()}if((0,module$exports$Blockly$Events$utils.isEnabled)()){a=$.module$exports$Blockly$Variables.getAddedVariables(b,c);for(b=0;b<a.length;b++)f=a[b],(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.VAR_CREATE))(f));(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CREATE))(d))}return d};
$.module$exports$Blockly$Xml.domToVariables=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType===module$exports$Blockly$utils$dom.NodeType.ELEMENT_NODE){var e=d.getAttribute("type"),f=d.getAttribute("id");b.createVariable(d.textContent,e,f)}}};
var module$contents$Blockly$Xml_childNodeTagMap,module$contents$Blockly$Xml_mapSupportedXmlTags=function(a){for(var b={mutation:[],comment:[],data:[],field:[],input:[],next:[]},c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType!==module$exports$Blockly$utils$dom.NodeType.TEXT_NODE)switch(d.nodeName.toLowerCase()){case "mutation":b.mutation.push(d);break;case "comment":if(!module$exports$Blockly$Comment){console.warn("Missing require for Comment, ignoring block comment.");break}b.comment.push(d);
break;case "data":b.data.push(d);break;case "title":case "field":b.field.push(d);break;case "value":case "statement":b.input.push(d);break;case "next":b.next.push(d);break;default:console.warn("Ignoring unknown tag: "+d.nodeName)}}return b},module$contents$Blockly$Xml_applyMutationTagNodes=function(a,b){for(var c=!1,d=0;d<a.length;d++){var e=a[d];b.domToMutation&&(b.domToMutation(e),b.initSvg&&(c=!0))}return c},module$contents$Blockly$Xml_applyCommentTagNodes=function(a,b){for(var c={},d=0;d<a.length;c=
{$jscomp$loop$prop$blockSvg$289:c.$jscomp$loop$prop$blockSvg$289},d++){var e=a[d],f=e.textContent,g="true"===e.getAttribute("pinned"),h=parseInt(e.getAttribute("w"),10);e=parseInt(e.getAttribute("h"),10);b.setCommentText(f);b.commentModel.pinned=g;isNaN(h)||isNaN(e)||(b.commentModel.size=new module$exports$Blockly$utils$Size.Size(h,e));g&&b.getCommentIcon&&!b.isInFlyout&&(c.$jscomp$loop$prop$blockSvg$289=b,setTimeout(function(k){return function(){k.$jscomp$loop$prop$blockSvg$289.getCommentIcon().setVisible(!0)}}(c),
1))}},module$contents$Blockly$Xml_applyDataTagNodes=function(a,b){for(var c=0;c<a.length;c++)b.data=a[c].textContent},module$contents$Blockly$Xml_applyFieldTagNodes=function(a,b){for(var c=0;c<a.length;c++){var d=a[c],e=d.getAttribute("name");module$contents$Blockly$Xml_domToField(b,e,d)}},module$contents$Blockly$Xml_findChildBlocks=function(a){for(var b={childBlockElement:null,childShadowElement:null},c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];d.nodeType===module$exports$Blockly$utils$dom.NodeType.ELEMENT_NODE&&
("block"===d.nodeName.toLowerCase()?b.childBlockElement=d:"shadow"===d.nodeName.toLowerCase()&&(b.childShadowElement=d))}return b},module$contents$Blockly$Xml_applyInputTagNodes=function(a,b,c,d){for(var e=0;e<a.length;e++){var f=a[e],g=f.getAttribute("name"),h=c.getInput(g);if(!h){console.warn("Ignoring non-existent input "+g+" in block "+d);break}f=module$contents$Blockly$Xml_findChildBlocks(f);if(f.childBlockElement){if(!h.connection)throw TypeError("Input connection does not exist.");module$contents$Blockly$Xml_domToBlockHeadless(f.childBlockElement,
b,h.connection,!1)}f.childShadowElement&&h.connection.setShadowDom(f.childShadowElement)}},module$contents$Blockly$Xml_applyNextTagNodes=function(a,b,c){for(var d=0;d<a.length;d++){var e=module$contents$Blockly$Xml_findChildBlocks(a[d]);if(e.childBlockElement){if(!c.nextConnection)throw TypeError("Next statement does not exist.");if(c.nextConnection.isConnected())throw TypeError("Next statement is already connected.");module$contents$Blockly$Xml_domToBlockHeadless(e.childBlockElement,b,c.nextConnection,
!0)}e.childShadowElement&&c.nextConnection&&c.nextConnection.setShadowDom(e.childShadowElement)}},module$contents$Blockly$Xml_domToBlockHeadless=function(a,b,c,d){var e=a.getAttribute("type");if(!e)throw TypeError("Block type unspecified: "+a.outerHTML);var f=a.getAttribute("id");f=b.newBlock(e,f);var g=module$contents$Blockly$Xml_mapSupportedXmlTags(a),h=module$contents$Blockly$Xml_applyMutationTagNodes(g.mutation,f);module$contents$Blockly$Xml_applyCommentTagNodes(g.comment,f);module$contents$Blockly$Xml_applyDataTagNodes(g.data,
f);if(c)if(d)if(f.previousConnection)c.connect(f.previousConnection);else throw TypeError("Next block does not have previous statement.");else if(f.outputConnection)c.connect(f.outputConnection);else if(f.previousConnection)c.connect(f.previousConnection);else throw TypeError("Child block does not have output or previous statement.");module$contents$Blockly$Xml_applyFieldTagNodes(g.field,f);module$contents$Blockly$Xml_applyInputTagNodes(g.input,b,f,e);module$contents$Blockly$Xml_applyNextTagNodes(g.next,
b,f);h&&f.initSvg();(b=a.getAttribute("inline"))&&f.setInputsInline("true"===b);(b=a.getAttribute("disabled"))&&f.setEnabled("true"!==b&&"disabled"!==b);(b=a.getAttribute("deletable"))&&f.setDeletable("true"===b);(b=a.getAttribute("movable"))&&f.setMovable("true"===b);(b=a.getAttribute("editable"))&&f.setEditable("true"===b);(b=a.getAttribute("collapsed"))&&f.setCollapsed("true"===b);if("shadow"===a.nodeName.toLowerCase()){a=f.getChildren(!1);for(b=0;b<a.length;b++)if(!a[b].isShadow())throw TypeError("Shadow block not allowed non-shadow child.");
if(f.getVarModels().length)throw TypeError("Shadow blocks cannot have variable references.");f.setShadow(!0)}return f},module$contents$Blockly$Xml_domToField=function(a,b,c){var d=a.getField(b);d?d.fromXml(c):console.warn("Ignoring non-existent field "+b+" in block "+a.type)};$.module$exports$Blockly$Xml.deleteNext=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("next"===c.nodeName.toLowerCase()){a.removeChild(c);break}}};var module$exports$Blockly$utils$toolbox={},module$contents$Blockly$utils$toolbox_CATEGORY_TOOLBOX_KIND="categoryToolbox",module$contents$Blockly$utils$toolbox_FLYOUT_TOOLBOX_KIND="flyoutToolbox";module$exports$Blockly$utils$toolbox.Position={TOP:0,BOTTOM:1,LEFT:2,RIGHT:3};
module$exports$Blockly$utils$toolbox.convertToolboxDefToJson=function(a){if(!a)return null;if(a instanceof Element||"string"===typeof a)a=(0,module$exports$Blockly$utils$toolbox.parseToolboxTree)(a),a=module$contents$Blockly$utils$toolbox_convertToToolboxJson(a);module$contents$Blockly$utils$toolbox_validateToolbox(a);return a};
var module$contents$Blockly$utils$toolbox_validateToolbox=function(a){var b=a.kind;a=a.contents;if(b&&b!==module$contents$Blockly$utils$toolbox_FLYOUT_TOOLBOX_KIND&&b!==module$contents$Blockly$utils$toolbox_CATEGORY_TOOLBOX_KIND)throw Error("Invalid toolbox kind "+b+". Please supply either "+module$contents$Blockly$utils$toolbox_FLYOUT_TOOLBOX_KIND+" or "+module$contents$Blockly$utils$toolbox_CATEGORY_TOOLBOX_KIND);if(!a)throw Error("Toolbox must have a contents attribute.");};
module$exports$Blockly$utils$toolbox.convertFlyoutDefToJsonArray=function(a){return a?a.contents?a.contents:Array.isArray(a)&&0<a.length&&!a[0].nodeType?a:module$contents$Blockly$utils$toolbox_xmlToJsonArray(a):[]};module$exports$Blockly$utils$toolbox.hasCategories=function(a){if(!a)return!1;var b=a.kind;return b?b===module$contents$Blockly$utils$toolbox_CATEGORY_TOOLBOX_KIND:!!a.contents.filter(function(c){return"CATEGORY"===c.kind.toUpperCase()}).length};
module$exports$Blockly$utils$toolbox.isCategoryCollapsible=function(a){return a&&a.contents?!!a.contents.filter(function(b){return"CATEGORY"===b.kind.toUpperCase()}).length:!1};
var module$contents$Blockly$utils$toolbox_convertToToolboxJson=function(a){var b={contents:module$contents$Blockly$utils$toolbox_xmlToJsonArray(a)};a instanceof Node&&module$contents$Blockly$utils$toolbox_addAttributes(a,b);return b},module$contents$Blockly$utils$toolbox_xmlToJsonArray=function(a){var b=[],c=a.childNodes;c||(c=a);a=0;for(var d;d=c[a];a++)if(d.tagName){var e={},f=d.tagName.toUpperCase();e.kind=f;"BLOCK"===f?e.blockxml=d:d.childNodes&&0<d.childNodes.length&&(e.contents=module$contents$Blockly$utils$toolbox_xmlToJsonArray(d));
module$contents$Blockly$utils$toolbox_addAttributes(d,e);b.push(e)}return b},module$contents$Blockly$utils$toolbox_addAttributes=function(a,b){for(var c=0;c<a.attributes.length;c++){var d=a.attributes[c];-1<d.nodeName.indexOf("css-")?(b.cssconfig=b.cssconfig||{},b.cssconfig[d.nodeName.replace("css-","")]=d.value):b[d.nodeName]=d.value}};
module$exports$Blockly$utils$toolbox.parseToolboxTree=function(a){if(a){if("string"!==typeof a&&(module$exports$Blockly$utils$userAgent.IE&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"===typeof a&&(a=(0,$.module$exports$Blockly$Xml.textToDom)(a),"xml"!==a.nodeName.toLowerCase()))throw TypeError("Toolbox should be an <xml> document.");}else a=null;return a};$.module$exports$Blockly$utils$object={inherits:function(a,b){a.superClass_=b.prototype;Object.setPrototypeOf(a,b);a.prototype=Object.create(b.prototype);a.prototype.constructor=a},mixin:function(a,b){for(var c in b)a[c]=b[c]},deepMerge:function(a,b){for(var c in b)a[c]=null!==b[c]&&"object"===typeof b[c]?(0,$.module$exports$Blockly$utils$object.deepMerge)(a[c]||Object.create(null),b[c]):b[c];return a},values:function(a){return Object.values?Object.values(a):Object.keys(a).map(function(b){return a[b]})}};var module$exports$Blockly$Theme={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.Theme.prototype.getClassName=function(){return this.name+"-theme"};
module$exports$Blockly$Theme.Theme.prototype.setBlockStyle=function(a,b){this.blockStyles[a]=b};module$exports$Blockly$Theme.Theme.prototype.setCategoryStyle=function(a,b){this.categoryStyles[a]=b};module$exports$Blockly$Theme.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.Theme.prototype.setComponentStyle=function(a,b){this.componentStyles[a]=b};
module$exports$Blockly$Theme.Theme.prototype.setFontStyle=function(a){this.fontStyle=a};module$exports$Blockly$Theme.Theme.prototype.setStartHats=function(a){this.startHats=a};
module$exports$Blockly$Theme.Theme.defineTheme=function(a,b){var c=new module$exports$Blockly$Theme.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.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$exports$Blockly$Themes$Classic={},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.Classic=new module$exports$Blockly$Theme.Theme("classic",module$contents$Blockly$Themes$Classic_defaultBlockStyles,module$contents$Blockly$Themes$Classic_categoryStyles);var module$exports$Blockly$Options={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.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.Options.parseGridOptions_(a);
this.zoomOptions=module$exports$Blockly$Options.Options.parseZoomOptions_(a);this.toolboxPosition=p;this.theme=module$exports$Blockly$Options.Options.parseThemeOptions_(a);this.renderer=u;this.rendererOverrides=a.rendererOverrides;this.gridPattern=null;this.parentWorkspace=a.parentWorkspace;this.plugins=v;this.getMetrics=this.setMetrics=void 0}};
module$exports$Blockly$Options.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.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.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=0<b.spacing&&!!a.snap;return b};
module$exports$Blockly$Options.Options.parseThemeOptions_=function(a){a=a.theme||module$exports$Blockly$Themes$Classic.Classic;return"string"===typeof a?(0,module$exports$Blockly$registry.getObject)(module$exports$Blockly$registry.Type.THEME,a):a instanceof module$exports$Blockly$Theme.Theme?a:module$exports$Blockly$Theme.Theme.defineTheme(a.name||"builtin"+(0,module$exports$Blockly$utils$idGenerator.getNextUniqueId)(),a)};var module$exports$Blockly$Scrollbar={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.Scrollbar.DEFAULT_SCROLLBAR_MARGIN;this.ratio=this.oldHostMetrics_=null;this.origin_=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0);this.startDragHandle=this.handlePosition_=this.handleLength_=this.scrollbarLength_=this.startDragMouse_=0;this.containerVisible_=this.isVisible_=!0;this.svgGroup_=this.outerSvg_=
this.svgHandle_=this.svgBackground_=null;this.createDom_(d);this.position=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0);a=module$exports$Blockly$Scrollbar.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.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.Scrollbar.prototype.constrainHandleLength_=function(a){return a=0>=a||isNaN(a)?0:Math.min(a,this.scrollbarLength_)};module$exports$Blockly$Scrollbar.Scrollbar.prototype.setHandleLength_=function(a){this.handleLength_=a;this.svgHandle_.setAttribute(this.lengthAttribute_,this.handleLength_)};
module$exports$Blockly$Scrollbar.Scrollbar.prototype.constrainHandlePosition_=function(a){return a=0>=a||isNaN(a)?0:Math.min(a,this.scrollbarLength_-this.handleLength_)};module$exports$Blockly$Scrollbar.Scrollbar.prototype.setHandlePosition=function(a){this.handlePosition_=a;this.svgHandle_.setAttribute(this.positionAttribute_,this.handlePosition_)};
module$exports$Blockly$Scrollbar.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.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.Scrollbar.prototype.resize=function(a){if(!a&&(a=this.workspace_.getMetrics(),!a))return;this.oldHostMetrics_&&module$exports$Blockly$Scrollbar.Scrollbar.metricsAreEquivalent_(a,this.oldHostMetrics_)||(this.horizontal_?this.resizeHorizontal_(a):this.resizeVertical_(a),this.oldHostMetrics_=a,this.updateMetrics_())};
module$exports$Blockly$Scrollbar.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.Scrollbar.prototype.resizeHorizontal_=function(a){this.requiresViewResize_(a)?this.resizeViewHorizontal(a):this.resizeContentHorizontal(a)};
module$exports$Blockly$Scrollbar.Scrollbar.prototype.resizeViewHorizontal=function(a){var b=a.viewWidth-2*this.margin_;this.pair_&&(b-=module$exports$Blockly$Scrollbar.Scrollbar.scrollbarThickness);this.setScrollbarLength_(Math.max(0,b));b=a.absoluteLeft+this.margin_;this.pair_&&this.workspace_.RTL&&(b+=module$exports$Blockly$Scrollbar.Scrollbar.scrollbarThickness);this.setPosition(b,a.absoluteTop+a.viewHeight-module$exports$Blockly$Scrollbar.Scrollbar.scrollbarThickness-this.margin_);this.resizeContentHorizontal(a)};
module$exports$Blockly$Scrollbar.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.Scrollbar.prototype.resizeVertical_=function(a){this.requiresViewResize_(a)?this.resizeViewVertical(a):this.resizeContentVertical(a)};
module$exports$Blockly$Scrollbar.Scrollbar.prototype.resizeViewVertical=function(a){var b=a.viewHeight-2*this.margin_;this.pair_&&(b-=module$exports$Blockly$Scrollbar.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.Scrollbar.scrollbarThickness-this.margin_,a.absoluteTop+this.margin_);this.resizeContentVertical(a)};
module$exports$Blockly$Scrollbar.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.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.SVG,{"class":b},null);this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{},this.outerSvg_);this.svgBackground_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{"class":"blocklyScrollbarBackground"},
this.svgGroup_);a=Math.floor((module$exports$Blockly$Scrollbar.Scrollbar.scrollbarThickness-5)/2);this.svgHandle_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Scrollbar.prototype.isVisible=function(){return this.isVisible_};module$exports$Blockly$Scrollbar.Scrollbar.prototype.setContainerVisible=function(a){var b=a!==this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()};
module$exports$Blockly$Scrollbar.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.Scrollbar.prototype.updateDisplay_=function(){this.containerVisible_&&this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")};
module$exports$Blockly$Scrollbar.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$svgMath.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.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.Scrollbar.onMouseUpWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mouseup",this,this.onMouseUpHandle_),
module$exports$Blockly$Scrollbar.Scrollbar.onMouseMoveWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mousemove",this,this.onMouseMoveHandle_),a.stopPropagation(),a.preventDefault())};module$exports$Blockly$Scrollbar.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.Scrollbar.prototype.onMouseUpHandle_=function(){this.workspace_.resetDragSurface();(0,module$exports$Blockly$Touch.clearTouchIdentifier)();this.cleanUp_()};
module$exports$Blockly$Scrollbar.Scrollbar.prototype.cleanUp_=function(){this.workspace_.hideChaff(!0);module$exports$Blockly$Scrollbar.Scrollbar.onMouseUpWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(module$exports$Blockly$Scrollbar.Scrollbar.onMouseUpWrapper_),module$exports$Blockly$Scrollbar.Scrollbar.onMouseUpWrapper_=null);module$exports$Blockly$Scrollbar.Scrollbar.onMouseMoveWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(module$exports$Blockly$Scrollbar.Scrollbar.onMouseMoveWrapper_),
module$exports$Blockly$Scrollbar.Scrollbar.onMouseMoveWrapper_=null)};module$exports$Blockly$Scrollbar.Scrollbar.prototype.getRatio_=function(){var a=this.handlePosition_/(this.scrollbarLength_-this.handleLength_);isNaN(a)&&(a=0);return a};module$exports$Blockly$Scrollbar.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.Scrollbar.prototype.set=function(a,b){this.setHandlePosition(this.constrainHandlePosition_(a*this.ratio));(b||void 0===b)&&this.updateMetrics_()};module$exports$Blockly$Scrollbar.Scrollbar.prototype.setOrigin=function(a,b){this.origin_=new module$exports$Blockly$utils$Coordinate.Coordinate(a,b)};
module$exports$Blockly$Scrollbar.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.Scrollbar.scrollbarThickness=15;
module$exports$Blockly$Touch.TOUCH_ENABLED&&(module$exports$Blockly$Scrollbar.Scrollbar.scrollbarThickness=25);module$exports$Blockly$Scrollbar.Scrollbar.DEFAULT_SCROLLBAR_MARGIN=.5;var module$exports$Blockly$ScrollbarPair={ScrollbarPair:function(a,b,c,d,e){this.workspace_=a;b=void 0===b?!0:b;c=void 0===c?!0:c;var f=b&&c;b&&(this.hScroll=new module$exports$Blockly$Scrollbar.Scrollbar(a,!0,f,d,e));c&&(this.vScroll=new module$exports$Blockly$Scrollbar.Scrollbar(a,!1,f,d,e));f&&(this.corner_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{height:module$exports$Blockly$Scrollbar.Scrollbar.scrollbarThickness,width:module$exports$Blockly$Scrollbar.Scrollbar.scrollbarThickness,
"class":"blocklyScrollbarBackground"},null),(0,module$exports$Blockly$utils$dom.insertAfter)(this.corner_,a.getBubbleCanvas()));this.oldHostMetrics_=null}};module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.dispose=function(){(0,module$exports$Blockly$utils$dom.removeNode)(this.corner_);this.oldHostMetrics_=this.workspace_=this.corner_=null;this.hScroll&&(this.hScroll.dispose(),this.hScroll=null);this.vScroll&&(this.vScroll.dispose(),this.vScroll=null)};
module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.resize=function(){var a=this.workspace_.getMetrics();if(a){var b=!1,c=!1;this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth===a.viewWidth&&this.oldHostMetrics_.viewHeight===a.viewHeight&&this.oldHostMetrics_.absoluteTop===a.absoluteTop&&this.oldHostMetrics_.absoluteLeft===a.absoluteLeft?(this.oldHostMetrics_&&this.oldHostMetrics_.scrollWidth===a.scrollWidth&&this.oldHostMetrics_.viewLeft===a.viewLeft&&this.oldHostMetrics_.scrollLeft===
a.scrollLeft||(b=!0),this.oldHostMetrics_&&this.oldHostMetrics_.scrollHeight===a.scrollHeight&&this.oldHostMetrics_.viewTop===a.viewTop&&this.oldHostMetrics_.scrollTop===a.scrollTop||(c=!0)):c=b=!0;if(b||c){try{(0,module$exports$Blockly$Events$utils.disable)(),this.hScroll&&b&&this.hScroll.resize(a),this.vScroll&&c&&this.vScroll.resize(a)}finally{(0,module$exports$Blockly$Events$utils.enable)()}this.workspace_.maybeFireViewportChangeEvent()}this.hScroll&&this.vScroll&&(this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth===
a.viewWidth&&this.oldHostMetrics_.absoluteLeft===a.absoluteLeft||this.corner_.setAttribute("x",this.vScroll.position.x),this.oldHostMetrics_&&this.oldHostMetrics_.viewHeight===a.viewHeight&&this.oldHostMetrics_.absoluteTop===a.absoluteTop||this.corner_.setAttribute("y",this.hScroll.position.y));this.oldHostMetrics_=a}};module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.canScrollHorizontally=function(){return!!this.hScroll};
module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.canScrollVertically=function(){return!!this.vScroll};module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.setOrigin=function(a,b){this.hScroll&&this.hScroll.setOrigin(a,b);this.vScroll&&this.vScroll.setOrigin(a,b)};
module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.set=function(a,b,c){this.hScroll&&this.hScroll.set(a,!1);this.vScroll&&this.vScroll.set(b,!1);if(c||void 0===c)a={},this.hScroll&&(a.x=this.hScroll.getRatio_()),this.vScroll&&(a.y=this.vScroll.getRatio_()),this.workspace_.setMetrics(a)};module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.setX=function(a){this.hScroll&&this.hScroll.set(a,!0)};
module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.setY=function(a){this.vScroll&&this.vScroll.set(a,!0)};module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.setContainerVisible=function(a){this.hScroll&&this.hScroll.setContainerVisible(a);this.vScroll&&this.vScroll.setContainerVisible(a)};module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.isVisible=function(){var a=!1;this.hScroll&&(a=this.hScroll.isVisible());this.vScroll&&(a=a||this.vScroll.isVisible());return a};
module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.resizeContent=function(a){this.hScroll&&this.hScroll.resizeContentHorizontal(a);this.vScroll&&this.vScroll.resizeContentVertical(a)};module$exports$Blockly$ScrollbarPair.ScrollbarPair.prototype.resizeView=function(a){this.hScroll&&this.hScroll.resizeViewHorizontal(a);this.vScroll&&this.vScroll.resizeViewVertical(a)};var module$exports$Blockly$utils$KeyCodes={KeyCodes:{WIN_KEY_FF_LINUX:0,MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PLUS_SIGN:43,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,FF_SEMICOLON:59,FF_EQUALS:61,FF_DASH:173,FF_HASH:163,QUESTION_MARK:63,AT_SIGN:64,A:65,B:66,C:67,D:68,E:69,F:70,G:71,
H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SCROLL_LOCK:145,FIRST_MEDIA_KEY:166,LAST_MEDIA_KEY:183,SEMICOLON:186,
DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,TILDE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,MAC_WK_CMD_LEFT:91,MAC_WK_CMD_RIGHT:93,WIN_IME:229,VK_NONAME:252,PHANTOM:255}};var module$exports$Blockly$ShortcutRegistry={ShortcutRegistry:function(){this.reset()}};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.reset=function(){this.registry_=Object.create(null);this.keyMap_=Object.create(null)};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.register=function(a,b){if(this.registry_[a.name]&&!b)throw Error('Shortcut with name "'+a.name+'" already exists.');this.registry_[a.name]=a};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.unregister=function(a){if(!this.registry_[a])return console.warn('Keyboard shortcut with name "'+a+'" not found.'),!1;this.removeAllKeyMappings(a);delete this.registry_[a];return!0};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.addKeyMapping=function(a,b,c){a=String(a);var d=this.keyMap_[a];if(d&&!c)throw Error('Shortcut with name "'+b+'" collides with shortcuts '+d.toString());d&&c?d.unshift(b):this.keyMap_[a]=[b]};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.removeKeyMapping=function(a,b,c){var d=this.keyMap_[a];if(!d&&!c)return console.warn('No keyboard shortcut with name "'+b+'" registered with key code "'+a+'"'),!1;var e=d.indexOf(b);if(-1<e)return d.splice(e,1),0===d.length&&delete this.keyMap_[a],!0;c||console.warn('No keyboard shortcut with name "'+b+'" registered with key code "'+a+'"');return!1};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.removeAllKeyMappings=function(a){for(var b in this.keyMap_)this.removeKeyMapping(b,a,!0)};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.setKeyMap=function(a){this.keyMap_=a};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.getKeyMap=function(){return(0,$.module$exports$Blockly$utils$object.deepMerge)(Object.create(null),this.keyMap_)};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.getRegistry=function(){return(0,$.module$exports$Blockly$utils$object.deepMerge)(Object.create(null),this.registry_)};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.onKeyDown=function(a,b){var c=this.serializeKeyEvent_(b);c=this.getShortcutNamesByKeyCode(c);if(!c)return!1;for(var d=0,e;e=c[d];d++)if(e=this.registry_[e],(!e.preconditionFn||e.preconditionFn(a))&&e.callback&&e.callback(a,b,e))return!0;return!1};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.getShortcutNamesByKeyCode=function(a){return this.keyMap_[a]||[]};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.getKeyCodesByShortcutName=function(a){var b=[],c;for(c in this.keyMap_)-1<this.keyMap_[c].indexOf(a)&&b.push(c);return b};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.serializeKeyEvent_=function(a){var b="",c;for(c in module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.modifierKeys)a.getModifierState(c)&&(""!==b&&(b+="+"),b+=c);""!==b&&a.keyCode?b=b+"+"+a.keyCode:a.keyCode&&(b=a.keyCode.toString());return b};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.checkModifiers_=function(a){for(var b=(0,$.module$exports$Blockly$utils$object.values)(module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.modifierKeys),c=0,d;d=a[c];c++)if(0>b.indexOf(d))throw Error(d+" is not a valid modifier key.");};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.prototype.createSerializedKey=function(a,b){var c="";if(b){this.checkModifiers_(b);for(var d in module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.modifierKeys)-1<b.indexOf(module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.modifierKeys[d])&&(""!==c&&(c+="+"),c+=d)}""!==c&&a?c=c+"+"+a:a&&(c=a.toString());return c};
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.modifierKeys={Shift:module$exports$Blockly$utils$KeyCodes.KeyCodes.SHIFT,Control:module$exports$Blockly$utils$KeyCodes.KeyCodes.CTRL,Alt:module$exports$Blockly$utils$KeyCodes.KeyCodes.ALT,Meta:module$exports$Blockly$utils$KeyCodes.KeyCodes.META};var module$contents$Blockly$ShortcutRegistry_registry=new module$exports$Blockly$ShortcutRegistry.ShortcutRegistry;module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry=module$contents$Blockly$ShortcutRegistry_registry;var module$exports$Blockly$WorkspaceDragSurfaceSvg={WorkspaceDragSurfaceSvg:function(a){this.SVG_=null;this.container_=a;this.previousSibling_=null;this.createDom()}};
module$exports$Blockly$WorkspaceDragSurfaceSvg.WorkspaceDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.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.WorkspaceDragSurfaceSvg.prototype.getSurfaceTranslation=function(){return(0,module$exports$Blockly$utils$svgMath.getRelativeXY)(this.SVG_)};
module$exports$Blockly$WorkspaceDragSurfaceSvg.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.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$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 null;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)?a.paste(module$contents$Blockly$clipboard_copyData.saveInfo):null};
module$exports$Blockly$clipboard.duplicate=function(a){var b=module$contents$Blockly$clipboard_copyData;(0,module$exports$Blockly$clipboard.copy)(a);a=a.workspace.paste(module$contents$Blockly$clipboard_copyData.saveInfo);module$contents$Blockly$clipboard_copyData=b;return a};var module$contents$Blockly$config_Config,module$contents$Blockly$config_DEFAULT_SNAP_RADIUS;$.module$exports$Blockly$config={};module$contents$Blockly$config_DEFAULT_SNAP_RADIUS=28;$.module$exports$Blockly$config.config={dragRadius:5,flyoutDragRadius:10,snapRadius:module$contents$Blockly$config_DEFAULT_SNAP_RADIUS,connectingSnapRadius:module$contents$Blockly$config_DEFAULT_SNAP_RADIUS,currentConnectionPreference:8,bumpDelay:250};var module$exports$Blockly$MenuItem={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.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.MenuItem.prototype.dispose=function(){this.element_=null};module$exports$Blockly$MenuItem.MenuItem.prototype.getElement=function(){return this.element_};module$exports$Blockly$MenuItem.MenuItem.prototype.getId=function(){return this.element_.id};module$exports$Blockly$MenuItem.MenuItem.prototype.getValue=function(){return this.value_};
module$exports$Blockly$MenuItem.MenuItem.prototype.setRightToLeft=function(a){this.rightToLeft_=a};module$exports$Blockly$MenuItem.MenuItem.prototype.setRole=function(a){this.roleName_=a};module$exports$Blockly$MenuItem.MenuItem.prototype.setCheckable=function(a){this.checkable_=a};module$exports$Blockly$MenuItem.MenuItem.prototype.setChecked=function(a){this.checked_=a};
module$exports$Blockly$MenuItem.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.MenuItem.prototype.isEnabled=function(){return this.enabled_};module$exports$Blockly$MenuItem.MenuItem.prototype.setEnabled=function(a){this.enabled_=a};module$exports$Blockly$MenuItem.MenuItem.prototype.performAction=function(){this.isEnabled()&&this.actionHandler_&&this.actionHandler_(this)};module$exports$Blockly$MenuItem.MenuItem.prototype.onAction=function(a,b){this.actionHandler_=a.bind(b)};var module$exports$Blockly$Menu={Menu:function(){this.menuItems_=[];this.roleName_=this.element_=this.onKeyDownHandler_=this.mouseLeaveHandler_=this.mouseEnterHandler_=this.clickHandler_=this.mouseOverHandler_=this.highlightedItem_=this.openingCoords=null}};module$exports$Blockly$Menu.Menu.prototype.addChild=function(a){this.menuItems_.push(a)};
module$exports$Blockly$Menu.Menu.prototype.render=function(a){var b=document.createElement("div");b.className="blocklyMenu goog-menu blocklyNonSelectable";b.tabIndex=0;this.roleName_&&(0,module$exports$Blockly$utils$aria.setRole)(b,this.roleName_);this.element_=b;for(var c=0,d;d=this.menuItems_[c];c++)b.appendChild(d.createDom());this.mouseOverHandler_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"mouseover",this,this.handleMouseOver_,!0);this.clickHandler_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,
"click",this,this.handleClick_,!0);this.mouseEnterHandler_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"mouseenter",this,this.handleMouseEnter_,!0);this.mouseLeaveHandler_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"mouseleave",this,this.handleMouseLeave_,!0);this.onKeyDownHandler_=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"keydown",this,this.handleKeyEvent_);a.appendChild(b)};module$exports$Blockly$Menu.Menu.prototype.getElement=function(){return this.element_};
module$exports$Blockly$Menu.Menu.prototype.focus=function(){var a=this.getElement();a&&(a.focus({preventScroll:!0}),(0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyFocused"))};module$exports$Blockly$Menu.Menu.prototype.blur_=function(){var a=this.getElement();a&&(a.blur(),(0,module$exports$Blockly$utils$dom.removeClass)(a,"blocklyFocused"))};module$exports$Blockly$Menu.Menu.prototype.setRole=function(a){this.roleName_=a};
module$exports$Blockly$Menu.Menu.prototype.dispose=function(){this.mouseOverHandler_&&((0,module$exports$Blockly$browserEvents.unbind)(this.mouseOverHandler_),this.mouseOverHandler_=null);this.clickHandler_&&((0,module$exports$Blockly$browserEvents.unbind)(this.clickHandler_),this.clickHandler_=null);this.mouseEnterHandler_&&((0,module$exports$Blockly$browserEvents.unbind)(this.mouseEnterHandler_),this.mouseEnterHandler_=null);this.mouseLeaveHandler_&&((0,module$exports$Blockly$browserEvents.unbind)(this.mouseLeaveHandler_),
this.mouseLeaveHandler_=null);this.onKeyDownHandler_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onKeyDownHandler_),this.onKeyDownHandler_=null);for(var a=0,b;b=this.menuItems_[a];a++)b.dispose();this.element_=null};module$exports$Blockly$Menu.Menu.prototype.getMenuItem_=function(a){for(var b=this.getElement();a&&a!==b;){if((0,module$exports$Blockly$utils$dom.hasClass)(a,"blocklyMenuItem"))for(var c=0,d;d=this.menuItems_[c];c++)if(d.getElement()===a)return d;a=a.parentElement}return null};
module$exports$Blockly$Menu.Menu.prototype.setHighlighted=function(a){var b=this.highlightedItem_;b&&(b.setHighlighted(!1),this.highlightedItem_=null);a&&(a.setHighlighted(!0),this.highlightedItem_=a,b=this.getElement(),(0,module$exports$Blockly$utils$style.scrollIntoContainerView)(a.getElement(),b),(0,module$exports$Blockly$utils$aria.setState)(b,module$exports$Blockly$utils$aria.State.ACTIVEDESCENDANT,a.getId()))};
module$exports$Blockly$Menu.Menu.prototype.highlightNext=function(){var a=this.menuItems_.indexOf(this.highlightedItem_);this.highlightHelper_(a,1)};module$exports$Blockly$Menu.Menu.prototype.highlightPrevious=function(){var a=this.menuItems_.indexOf(this.highlightedItem_);this.highlightHelper_(0>a?this.menuItems_.length:a,-1)};module$exports$Blockly$Menu.Menu.prototype.highlightFirst_=function(){this.highlightHelper_(-1,1)};
module$exports$Blockly$Menu.Menu.prototype.highlightLast_=function(){this.highlightHelper_(this.menuItems_.length,-1)};module$exports$Blockly$Menu.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.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.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.Coordinate(a.clientX,a.clientY);if(1>module$exports$Blockly$utils$Coordinate.Coordinate.distance(b,c))return}(a=this.getMenuItem_(a.target))&&a.performAction()};module$exports$Blockly$Menu.Menu.prototype.handleMouseEnter_=function(a){this.focus()};
module$exports$Blockly$Menu.Menu.prototype.handleMouseLeave_=function(a){this.getElement()&&(this.blur_(),this.setHighlighted(null))};
module$exports$Blockly$Menu.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.KeyCodes.ENTER:case module$exports$Blockly$utils$KeyCodes.KeyCodes.SPACE:b&&b.performAction();break;case module$exports$Blockly$utils$KeyCodes.KeyCodes.UP:this.highlightPrevious();break;case module$exports$Blockly$utils$KeyCodes.KeyCodes.DOWN:this.highlightNext();break;
case module$exports$Blockly$utils$KeyCodes.KeyCodes.PAGE_UP:case module$exports$Blockly$utils$KeyCodes.KeyCodes.HOME:this.highlightFirst_();break;case module$exports$Blockly$utils$KeyCodes.KeyCodes.PAGE_DOWN:case module$exports$Blockly$utils$KeyCodes.KeyCodes.END:this.highlightLast_();break;default:return}a.preventDefault();a.stopPropagation()}};
module$exports$Blockly$Menu.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$serialization$priorities={VARIABLES:100,BLOCKS:50};var module$exports$Blockly$serialization$registry={register:function(a,b){(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.SERIALIZER,a,b)},unregister:function(a){(0,module$exports$Blockly$registry.unregister)(module$exports$Blockly$registry.Type.SERIALIZER,a)}};var module$exports$Blockly$serialization$exceptions={DeserializationError:function(){var a=Error.apply(this,arguments);this.message=a.message;"stack"in a&&(this.stack=a.stack)}};$.$jscomp.inherits(module$exports$Blockly$serialization$exceptions.DeserializationError,Error);
module$exports$Blockly$serialization$exceptions.MissingBlockType=function(a){module$exports$Blockly$serialization$exceptions.DeserializationError.call(this,"Expected to find a 'type' property, defining the block type");this.state=a};$.$jscomp.inherits(module$exports$Blockly$serialization$exceptions.MissingBlockType,module$exports$Blockly$serialization$exceptions.DeserializationError);
module$exports$Blockly$serialization$exceptions.MissingConnection=function(a,b,c){module$exports$Blockly$serialization$exceptions.DeserializationError.call(this,"The block "+b.toDevString()+" is missing a(n) "+a+"\nconnection");this.block=b;this.state=c};$.$jscomp.inherits(module$exports$Blockly$serialization$exceptions.MissingConnection,module$exports$Blockly$serialization$exceptions.DeserializationError);
module$exports$Blockly$serialization$exceptions.BadConnectionCheck=function(a,b,c,d){module$exports$Blockly$serialization$exceptions.DeserializationError.call(this,"The block "+c.toDevString()+" could not connect its\n"+b+" to its parent, because: "+a);this.childBlock=c;this.childState=d};$.$jscomp.inherits(module$exports$Blockly$serialization$exceptions.BadConnectionCheck,module$exports$Blockly$serialization$exceptions.DeserializationError);
module$exports$Blockly$serialization$exceptions.RealChildOfShadow=function(a){module$exports$Blockly$serialization$exceptions.DeserializationError.call(this,"Encountered a real block which is defined as a child of a shadow\nblock. It is an invariant of Blockly that shadow blocks only have shadow\nchildren");this.state=a};$.$jscomp.inherits(module$exports$Blockly$serialization$exceptions.RealChildOfShadow,module$exports$Blockly$serialization$exceptions.DeserializationError);var module$exports$Blockly$serialization$ISerializer={ISerializer:function(){}};module$exports$Blockly$serialization$ISerializer.ISerializer.prototype.save=function(a){};module$exports$Blockly$serialization$ISerializer.ISerializer.prototype.load=function(a,b){};module$exports$Blockly$serialization$ISerializer.ISerializer.prototype.clear=function(a){};var module$exports$Blockly$serialization$blocks={save:function(a,b){var c=void 0===b?{}:b;b=void 0===c.addCoordinates?!1:c.addCoordinates;var d=void 0===c.addInputBlocks?!0:c.addInputBlocks,e=void 0===c.addNextBlocks?!0:c.addNextBlocks;c=void 0===c.doFullSerialization?!0:c.doFullSerialization;if(a.isInsertionMarker())return null;var f={type:a.type,id:a.id};b&&module$contents$Blockly$serialization$blocks_saveCoords(a,f);module$contents$Blockly$serialization$blocks_saveAttributes(a,f);module$contents$Blockly$serialization$blocks_saveExtraState(a,
f);module$contents$Blockly$serialization$blocks_saveIcons(a,f);module$contents$Blockly$serialization$blocks_saveFields(a,f,c);d&&module$contents$Blockly$serialization$blocks_saveInputBlocks(a,f,c);e&&module$contents$Blockly$serialization$blocks_saveNextBlocks(a,f,c);return f}},module$contents$Blockly$serialization$blocks_saveAttributes=function(a,b){a.isCollapsed()&&(b.collapsed=!0);a.isEnabled()||(b.enabled=!1);void 0!==a.inputsInline&&a.inputsInline!==a.inputsInlineDefault&&(b.inline=a.inputsInline);
a.data&&(b.data=a.data)},module$contents$Blockly$serialization$blocks_saveCoords=function(a,b){var c=a.workspace;a=a.getRelativeToSurfaceXY();b.x=Math.round(c.RTL?c.getWidth()-a.x:a.x);b.y=Math.round(a.y)},module$contents$Blockly$serialization$blocks_saveExtraState=function(a,b){a.saveExtraState?(a=a.saveExtraState(),null!==a&&(b.extraState=a)):a.mutationToDom&&(a=a.mutationToDom(),null!==a&&(b.extraState=(0,$.module$exports$Blockly$Xml.domToText)(a).replace(' xmlns="https://developers.google.com/blockly/xml"',
"")))},module$contents$Blockly$serialization$blocks_saveIcons=function(a,b){a.getCommentText()&&(b.icons={comment:{text:a.getCommentText(),pinned:a.commentModel.pinned,height:Math.round(a.commentModel.size.height),width:Math.round(a.commentModel.size.width)}})},module$contents$Blockly$serialization$blocks_saveFields=function(a,b,c){for(var d=Object.create(null),e=0;e<a.inputList.length;e++)for(var f=a.inputList[e],g=0;g<f.fieldRow.length;g++){var h=f.fieldRow[g];h.isSerializable()&&(d[h.name]=h.saveState(c))}Object.keys(d).length&&
(b.fields=d)},module$contents$Blockly$serialization$blocks_saveInputBlocks=function(a,b,c){for(var d=Object.create(null),e=0;e<a.inputList.length;e++){var f=a.inputList[e];if(f.type!==$.module$exports$Blockly$inputTypes.inputTypes.DUMMY){var g=module$contents$Blockly$serialization$blocks_saveConnection(f.connection,c);g&&(d[f.name]=g)}}Object.keys(d).length&&(b.inputs=d)},module$contents$Blockly$serialization$blocks_saveNextBlocks=function(a,b,c){a.nextConnection&&(a=module$contents$Blockly$serialization$blocks_saveConnection(a.nextConnection,
c))&&(b.next=a)},module$contents$Blockly$serialization$blocks_saveConnection=function(a,b){var c=a.getShadowState(!0);a=a.targetBlock();if(!c&&!a)return null;var d=Object.create(null);c&&(d.shadow=c);a&&!a.isShadow()&&(d.block=(0,module$exports$Blockly$serialization$blocks.save)(a,{doFullSerialization:b}));return d};
module$exports$Blockly$serialization$blocks.append=function(a,b,c){c=void 0===c?{}:c;return(0,module$exports$Blockly$serialization$blocks.appendInternal)(a,b,{recordUndo:void 0===c.recordUndo?!1:c.recordUndo})};
module$exports$Blockly$serialization$blocks.appendInternal=function(a,b,c){var d=void 0===c?{}:c;c=void 0===d.parentConnection?void 0:d.parentConnection;var e=void 0===d.isShadow?!1:d.isShadow,f=void 0===d.recordUndo?!1:d.recordUndo;d=(0,module$exports$Blockly$Events$utils.getRecordUndo)();(0,module$exports$Blockly$Events$utils.setRecordUndo)(f);(f=(0,module$exports$Blockly$Events$utils.getGroup)())||(0,module$exports$Blockly$Events$utils.setGroup)(!0);(0,module$exports$Blockly$Events$utils.disable)();
var g=module$contents$Blockly$serialization$blocks_appendPrivate(a,b,{parentConnection:c,isShadow:e});(0,module$exports$Blockly$Events$utils.enable)();(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CREATE))(g));(0,module$exports$Blockly$Events$utils.setGroup)(f);(0,module$exports$Blockly$Events$utils.setRecordUndo)(d);b.rendered&&setTimeout(function(){g.disposed||g.setConnectionTracking(!0)},1);return g};
var module$contents$Blockly$serialization$blocks_appendPrivate=function(a,b,c){var d=void 0===c?{}:c;c=void 0===d.parentConnection?void 0:d.parentConnection;d=void 0===d.isShadow?!1:d.isShadow;if(!a.type)throw new module$exports$Blockly$serialization$exceptions.MissingBlockType(a);var e=b.newBlock(a.type,a.id);e.setShadow(d);module$contents$Blockly$serialization$blocks_loadCoords(e,a);module$contents$Blockly$serialization$blocks_loadAttributes(e,a);module$contents$Blockly$serialization$blocks_loadExtraState(e,
a);module$contents$Blockly$serialization$blocks_tryToConnectParent(c,e,a);module$contents$Blockly$serialization$blocks_loadIcons(e,a);module$contents$Blockly$serialization$blocks_loadFields(e,a);module$contents$Blockly$serialization$blocks_loadInputBlocks(e,a);module$contents$Blockly$serialization$blocks_loadNextBlocks(e,a);module$contents$Blockly$serialization$blocks_initBlock(e,b.rendered);return e},module$contents$Blockly$serialization$blocks_loadCoords=function(a,b){var c=void 0===b.x?0:b.x;b=
void 0===b.y?0:b.y;var d=a.workspace;c=d.RTL?d.getWidth()-c:c;a.moveBy(c,b)},module$contents$Blockly$serialization$blocks_loadAttributes=function(a,b){b.collapsed&&a.setCollapsed(!0);!1===b.enabled&&a.setEnabled(!1);void 0!==b.inline&&a.setInputsInline(b.inline);void 0!==b.data&&(a.data=b.data)},module$contents$Blockly$serialization$blocks_loadExtraState=function(a,b){b.extraState&&(a.loadExtraState?a.loadExtraState(b.extraState):a.domToMutation((0,$.module$exports$Blockly$Xml.textToDom)(b.extraState)))},
module$contents$Blockly$serialization$blocks_tryToConnectParent=function(a,b,c){if(a){if(a.getSourceBlock().isShadow()&&!b.isShadow())throw new module$exports$Blockly$serialization$exceptions.RealChildOfShadow(c);if(a.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE){var d=b.outputConnection;if(!d)throw new module$exports$Blockly$serialization$exceptions.MissingConnection("output",b,c);}else if(d=b.previousConnection,!d)throw new module$exports$Blockly$serialization$exceptions.MissingConnection("previous",
b,c);if(!a.connect(d)){var e=b.workspace.connectionChecker;throw new module$exports$Blockly$serialization$exceptions.BadConnectionCheck(e.getErrorMessage(e.canConnectWithReason(d,a,!1),d,a),a.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE?"output connection":"previous connection",b,c);}}},module$contents$Blockly$serialization$blocks_loadIcons=function(a,b){b.icons&&(b=b.icons.comment)&&(a.setCommentText(b.text),"pinned"in b&&(a.commentModel.pinned=b.pinned),"width"in b&&"height"in b&&
(a.commentModel.size=new module$exports$Blockly$utils$Size.Size(b.width,b.height)),b.pinned&&a.rendered&&!a.isInFlyout&&setTimeout(function(){return a.getCommentIcon().setVisible(!0)},1))},module$contents$Blockly$serialization$blocks_loadFields=function(a,b){if(b.fields)for(var c=Object.keys(b.fields),d=0;d<c.length;d++){var e=c[d],f=b.fields[e],g=a.getField(e);g?g.loadState(f):console.warn("Ignoring non-existant field "+e+" in block "+a.type)}},module$contents$Blockly$serialization$blocks_loadInputBlocks=
function(a,b){if(b.inputs)for(var c=Object.keys(b.inputs),d=0;d<c.length;d++){var e=c[d],f=a.getInput(e);if(!f||!f.connection)throw new module$exports$Blockly$serialization$exceptions.MissingConnection(e,a,b);module$contents$Blockly$serialization$blocks_loadConnection(f.connection,b.inputs[e])}},module$contents$Blockly$serialization$blocks_loadNextBlocks=function(a,b){if(b.next){if(!a.nextConnection)throw new module$exports$Blockly$serialization$exceptions.MissingConnection("next",a,b);module$contents$Blockly$serialization$blocks_loadConnection(a.nextConnection,
b.next)}},module$contents$Blockly$serialization$blocks_loadConnection=function(a,b){b.shadow&&a.setShadowState(b.shadow);b.block&&module$contents$Blockly$serialization$blocks_appendPrivate(b.block,a.getSourceBlock().workspace,{parentConnection:a})},module$contents$Blockly$serialization$blocks_initBlock=function(a,b){if(b)for(a.setConnectionTracking(!1),a.initSvg(),a.render(!1),a=a.getIcons(),b=0;b<a.length;b++)a[b].computeIconLocation();else a.initModel()},module$contents$Blockly$serialization$blocks_saveBlock=
module$exports$Blockly$serialization$blocks.save,module$contents$Blockly$serialization$blocks_BlockSerializer=function(){this.priority=module$exports$Blockly$serialization$priorities.BLOCKS};
module$contents$Blockly$serialization$blocks_BlockSerializer.prototype.save=function(a){var b=[];a=$.$jscomp.makeIterator(a.getTopBlocks(!1));for(var c=a.next();!c.done;c=a.next())(c=module$contents$Blockly$serialization$blocks_saveBlock(c.value,{addCoordinates:!0,doFullSerialization:!1}))&&b.push(c);return b.length?{languageVersion:0,blocks:b}:null};
module$contents$Blockly$serialization$blocks_BlockSerializer.prototype.load=function(a,b){a=$.$jscomp.makeIterator(a.blocks);for(var c=a.next();!c.done;c=a.next())(0,module$exports$Blockly$serialization$blocks.append)(c.value,b,{recordUndo:(0,module$exports$Blockly$Events$utils.getRecordUndo)()})};module$contents$Blockly$serialization$blocks_BlockSerializer.prototype.clear=function(a){a=$.$jscomp.makeIterator(a.getTopBlocks(!1));for(var b=a.next();!b.done;b=a.next())b.value.dispose(!1)};
(0,module$exports$Blockly$serialization$registry.register)("blocks",new module$contents$Blockly$serialization$blocks_BlockSerializer);var module$exports$Blockly$Events$Abstract={Abstract:function(){this.isBlank=null;this.workspaceId=void 0;this.group=(0,module$exports$Blockly$Events$utils.getGroup)();this.recordUndo=(0,module$exports$Blockly$Events$utils.getRecordUndo)();this.isUiEvent=!1;this.type=void 0}};module$exports$Blockly$Events$Abstract.Abstract.prototype.toJson=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};
module$exports$Blockly$Events$Abstract.Abstract.prototype.fromJson=function(a){this.isBlank=!1;this.group=a.group};module$exports$Blockly$Events$Abstract.Abstract.prototype.isNull=function(){return!1};module$exports$Blockly$Events$Abstract.Abstract.prototype.run=function(a){};
module$exports$Blockly$Events$Abstract.Abstract.prototype.getEventWorkspace_=function(){var a;this.workspaceId&&(a=module$exports$Blockly$Workspace.Workspace.getById(this.workspaceId));if(!a)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return a};var module$exports$Blockly$Events$BlockBase={BlockBase:function(a){module$exports$Blockly$Events$Abstract.Abstract.call(this);this.blockId=(this.isBlank="undefined"===typeof a)?"":a.id;this.workspaceId=this.isBlank?"":a.workspace.id}};$.$jscomp.inherits(module$exports$Blockly$Events$BlockBase.BlockBase,module$exports$Blockly$Events$Abstract.Abstract);
module$exports$Blockly$Events$BlockBase.BlockBase.prototype.toJson=function(){var a=module$exports$Blockly$Events$Abstract.Abstract.prototype.toJson.call(this);a.blockId=this.blockId;return a};module$exports$Blockly$Events$BlockBase.BlockBase.prototype.fromJson=function(a){module$exports$Blockly$Events$Abstract.Abstract.prototype.fromJson.call(this,a);this.blockId=a.blockId};var module$exports$Blockly$Events$BlockCreate={BlockCreate:function(a){module$exports$Blockly$Events$BlockBase.BlockBase.call(this,a);this.type=module$exports$Blockly$Events$utils.CREATE;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=(0,module$exports$Blockly$serialization$blocks.save)(a,{addCoordinates:!0}))}};
$.$jscomp.inherits(module$exports$Blockly$Events$BlockCreate.BlockCreate,module$exports$Blockly$Events$BlockBase.BlockBase);module$exports$Blockly$Events$BlockCreate.BlockCreate.prototype.toJson=function(){var a=module$exports$Blockly$Events$BlockBase.BlockBase.prototype.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.BlockCreate.prototype.fromJson=function(a){module$exports$Blockly$Events$BlockBase.BlockBase.prototype.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.BlockCreate.prototype.run=function(a){var b=this.getEventWorkspace_();if(a)(0,module$exports$Blockly$serialization$blocks.append)(this.json,b);else for(a=0;a<this.ids.length;a++){var c=this.ids[a],d=b.getBlockById(c);d?d.dispose(!1):c===this.blockId&&console.warn("Can't uncreate non-existent block: "+c)}};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.CREATE,module$exports$Blockly$Events$BlockCreate.BlockCreate);var module$contents$Blockly$ContextMenu_currentBlock;$.module$exports$Blockly$ContextMenu={};module$contents$Blockly$ContextMenu_currentBlock=null;$.module$exports$Blockly$ContextMenu.getCurrentBlock=function(){return module$contents$Blockly$ContextMenu_currentBlock};$.module$exports$Blockly$ContextMenu.setCurrentBlock=function(a){module$contents$Blockly$ContextMenu_currentBlock=a};
Object.defineProperties($.module$exports$Blockly$ContextMenu,{currentBlock:{get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.ContextMenu.currentBlock","September 2021","September 2022","Blockly.Tooltip.getCurrentBlock()");return(0,$.module$exports$Blockly$ContextMenu.getCurrentBlock)()},set:function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.ContextMenu.currentBlock","September 2021","September 2022","Blockly.Tooltip.setCurrentBlock(block)");(0,$.module$exports$Blockly$ContextMenu.setCurrentBlock)(a)}}});
var module$contents$Blockly$ContextMenu_menu_=null;$.module$exports$Blockly$ContextMenu.show=function(a,b,c){(0,module$exports$Blockly$WidgetDiv.show)($.module$exports$Blockly$ContextMenu,c,$.module$exports$Blockly$ContextMenu.dispose);if(b.length){var d=module$contents$Blockly$ContextMenu_populate_(b,c);module$contents$Blockly$ContextMenu_menu_=d;module$contents$Blockly$ContextMenu_position_(d,a,c);setTimeout(function(){d.focus()},1);module$contents$Blockly$ContextMenu_currentBlock=null}else(0,$.module$exports$Blockly$ContextMenu.hide)()};
var module$contents$Blockly$ContextMenu_populate_=function(a,b){var c=new module$exports$Blockly$Menu.Menu;c.setRole(module$exports$Blockly$utils$aria.Role.MENU);for(var d=0;d<a.length;d++){var e=a[d],f=new module$exports$Blockly$MenuItem.MenuItem(e.text);f.setRightToLeft(b);f.setRole(module$exports$Blockly$utils$aria.Role.MENUITEM);c.addChild(f);f.setEnabled(e.enabled);if(e.enabled)f.onAction(function(g){(0,$.module$exports$Blockly$ContextMenu.hide)();this.callback(this.scope)},e)}return c},module$contents$Blockly$ContextMenu_position_=
function(a,b,c){var d=(0,module$exports$Blockly$utils$svgMath.getViewportBBox)();b=new module$exports$Blockly$utils$Rect.Rect(b.clientY+d.top,b.clientY+d.top,b.clientX+d.left,b.clientX+d.left);module$contents$Blockly$ContextMenu_createWidget_(a);var e=a.getSize();c&&(b.left+=e.width,b.right+=e.width,d.left+=e.width,d.right+=e.width);(0,module$exports$Blockly$WidgetDiv.positionWithAnchor)(d,b,e,c);a.focus()},module$contents$Blockly$ContextMenu_createWidget_=function(a){var b=(0,module$exports$Blockly$WidgetDiv.getDiv)();
if(!b)throw Error("Attempting to create a context menu when widget div is null");a.render(b);b=a.getElement();(0,module$exports$Blockly$utils$dom.addClass)(b,"blocklyContextMenu");(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"contextmenu",null,module$contents$Blockly$ContextMenu_haltPropagation);a.focus()},module$contents$Blockly$ContextMenu_haltPropagation=function(a){a.preventDefault();a.stopPropagation()};
$.module$exports$Blockly$ContextMenu.hide=function(){(0,module$exports$Blockly$WidgetDiv.hideIfOwner)($.module$exports$Blockly$ContextMenu);module$contents$Blockly$ContextMenu_currentBlock=null};$.module$exports$Blockly$ContextMenu.dispose=function(){module$contents$Blockly$ContextMenu_menu_&&(module$contents$Blockly$ContextMenu_menu_.dispose(),module$contents$Blockly$ContextMenu_menu_=null)};
$.module$exports$Blockly$ContextMenu.callbackFactory=function(a,b){return function(){(0,module$exports$Blockly$Events$utils.disable)();try{var c=(0,$.module$exports$Blockly$Xml.domToBlock)(b,a.workspace);var d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-$.module$exports$Blockly$config.config.snapRadius:d.x+$.module$exports$Blockly$config.config.snapRadius;d.y+=2*$.module$exports$Blockly$config.config.snapRadius;c.moveBy(d.x,d.y)}finally{(0,module$exports$Blockly$Events$utils.enable)()}(0,module$exports$Blockly$Events$utils.isEnabled)()&&
!c.isShadow()&&(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CREATE))(c));c.select()}};$.module$exports$Blockly$ContextMenu.commentDeleteOption=function(a){return{text:$.module$exports$Blockly$Msg.Msg.REMOVE_COMMENT,enabled:!0,callback:function(){(0,module$exports$Blockly$Events$utils.setGroup)(!0);a.dispose();(0,module$exports$Blockly$Events$utils.setGroup)(!1)}}};
$.module$exports$Blockly$ContextMenu.commentDuplicateOption=function(a){return{text:$.module$exports$Blockly$Msg.Msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){(0,module$exports$Blockly$clipboard.duplicate)(a)}}};
$.module$exports$Blockly$ContextMenu.workspaceCommentOption=function(a,b){var c=module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg;if(!c)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!module$exports$Blockly$utils$userAgent.IE};d.text=$.module$exports$Blockly$Msg.Msg.ADD_COMMENT;d.callback=function(){var e=new c(a,$.module$exports$Blockly$Msg.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,c.DEFAULT_SIZE,c.DEFAULT_SIZE),f=a.getInjectionDiv().getBoundingClientRect();f=
new module$exports$Blockly$utils$Coordinate.Coordinate(b.clientX-f.left,b.clientY-f.top);var g=a.getOriginOffsetInPixels();f=module$exports$Blockly$utils$Coordinate.Coordinate.difference(f,g);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.rendered&&(e.initSvg(),e.render(),e.select())};return d};var module$exports$Blockly$utils$array={removeElem:function(a,b){b=a.indexOf(b);if(-1===b)return!1;a.splice(b,1);return!0}};var module$exports$Blockly$blockRendering$debug={},module$contents$Blockly$blockRendering$debug_useDebugger=!1;module$exports$Blockly$blockRendering$debug.isDebuggerEnabled=function(){return module$contents$Blockly$blockRendering$debug_useDebugger};
module$exports$Blockly$blockRendering$debug.startDebugger=function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.blockRendering.debug.startDebugger()","February 2022","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");module$contents$Blockly$blockRendering$debug_useDebugger=!0};
module$exports$Blockly$blockRendering$debug.stopDebugger=function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.blockRendering.debug.stopDebugger()","February 2022","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");module$contents$Blockly$blockRendering$debug_useDebugger=!1};var module$exports$Blockly$blockRendering$Types={Types:{NONE:0,FIELD:1,HAT:2,ICON:4,SPACER:8,BETWEEN_ROW_SPACER:16,IN_ROW_SPACER:32,EXTERNAL_VALUE_INPUT:64,INPUT:128,INLINE_INPUT:256,STATEMENT_INPUT:512,CONNECTION:1024,PREVIOUS_CONNECTION:2048,NEXT_CONNECTION:4096,OUTPUT_CONNECTION:8192,CORNER:16384,LEFT_SQUARE_CORNER:32768,LEFT_ROUND_CORNER:65536,RIGHT_SQUARE_CORNER:131072,RIGHT_ROUND_CORNER:262144,JAGGED_EDGE:524288,ROW:1048576,TOP_ROW:2097152,BOTTOM_ROW:4194304,INPUT_ROW:8388608}};
module$exports$Blockly$blockRendering$Types.Types.LEFT_CORNER=module$exports$Blockly$blockRendering$Types.Types.LEFT_SQUARE_CORNER|module$exports$Blockly$blockRendering$Types.Types.LEFT_ROUND_CORNER;module$exports$Blockly$blockRendering$Types.Types.RIGHT_CORNER=module$exports$Blockly$blockRendering$Types.Types.RIGHT_SQUARE_CORNER|module$exports$Blockly$blockRendering$Types.Types.RIGHT_ROUND_CORNER;module$exports$Blockly$blockRendering$Types.Types.nextTypeValue_=16777216;
module$exports$Blockly$blockRendering$Types.Types.getType=function(a){Object.prototype.hasOwnProperty.call(module$exports$Blockly$blockRendering$Types.Types,a)||(module$exports$Blockly$blockRendering$Types.Types[a]=module$exports$Blockly$blockRendering$Types.Types.nextTypeValue_,module$exports$Blockly$blockRendering$Types.Types.nextTypeValue_<<=1);return module$exports$Blockly$blockRendering$Types.Types[a]};module$exports$Blockly$blockRendering$Types.Types.isField=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.FIELD};
module$exports$Blockly$blockRendering$Types.Types.isHat=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.HAT};module$exports$Blockly$blockRendering$Types.Types.isIcon=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.ICON};module$exports$Blockly$blockRendering$Types.Types.isSpacer=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.SPACER};
module$exports$Blockly$blockRendering$Types.Types.isInRowSpacer=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.IN_ROW_SPACER};module$exports$Blockly$blockRendering$Types.Types.isInput=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.INPUT};module$exports$Blockly$blockRendering$Types.Types.isExternalInput=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.EXTERNAL_VALUE_INPUT};
module$exports$Blockly$blockRendering$Types.Types.isInlineInput=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.INLINE_INPUT};module$exports$Blockly$blockRendering$Types.Types.isStatementInput=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.STATEMENT_INPUT};module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.PREVIOUS_CONNECTION};
module$exports$Blockly$blockRendering$Types.Types.isNextConnection=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.NEXT_CONNECTION};module$exports$Blockly$blockRendering$Types.Types.isPreviousOrNextConnection=function(a){return a.type&(module$exports$Blockly$blockRendering$Types.Types.PREVIOUS_CONNECTION|module$exports$Blockly$blockRendering$Types.Types.NEXT_CONNECTION)};module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.LEFT_ROUND_CORNER};
module$exports$Blockly$blockRendering$Types.Types.isRightRoundedCorner=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.RIGHT_ROUND_CORNER};module$exports$Blockly$blockRendering$Types.Types.isLeftSquareCorner=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.LEFT_SQUARE_CORNER};module$exports$Blockly$blockRendering$Types.Types.isRightSquareCorner=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.RIGHT_SQUARE_CORNER};
module$exports$Blockly$blockRendering$Types.Types.isCorner=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.CORNER};module$exports$Blockly$blockRendering$Types.Types.isJaggedEdge=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.JAGGED_EDGE};module$exports$Blockly$blockRendering$Types.Types.isRow=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.ROW};
module$exports$Blockly$blockRendering$Types.Types.isBetweenRowSpacer=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.BETWEEN_ROW_SPACER};module$exports$Blockly$blockRendering$Types.Types.isTopRow=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.TOP_ROW};module$exports$Blockly$blockRendering$Types.Types.isBottomRow=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.BOTTOM_ROW};
module$exports$Blockly$blockRendering$Types.Types.isTopOrBottomRow=function(a){return a.type&(module$exports$Blockly$blockRendering$Types.Types.TOP_ROW|module$exports$Blockly$blockRendering$Types.Types.BOTTOM_ROW)};module$exports$Blockly$blockRendering$Types.Types.isInputRow=function(a){return a.type&module$exports$Blockly$blockRendering$Types.Types.INPUT_ROW};var module$exports$Blockly$blockRendering$Row={Row:function(a){this.type=module$exports$Blockly$blockRendering$Types.Types.ROW;this.elements=[];this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0;this.hasStatement=this.hasExternalInput=!1;this.statementEdge=0;this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=!1;this.constants_=a;this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT;this.align=null}};
module$exports$Blockly$blockRendering$Row.Row.prototype.getLastInput=function(){for(var a=this.elements.length-1;0<=a;a--){var b=this.elements[a];if(module$exports$Blockly$blockRendering$Types.Types.isInput(b))return b}return null};module$exports$Blockly$blockRendering$Row.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};module$exports$Blockly$blockRendering$Row.Row.prototype.startsWithElemSpacer=function(){return!0};
module$exports$Blockly$blockRendering$Row.Row.prototype.endsWithElemSpacer=function(){return!0};module$exports$Blockly$blockRendering$Row.Row.prototype.getFirstSpacer=function(){for(var a=0;a<this.elements.length;a++){var b=this.elements[a];if(module$exports$Blockly$blockRendering$Types.Types.isSpacer(b))return b}return null};module$exports$Blockly$blockRendering$Row.Row.prototype.getLastSpacer=function(){for(var a=this.elements.length-1;0<=a;a--){var b=this.elements[a];if(module$exports$Blockly$blockRendering$Types.Types.isSpacer(b))return b}return null};var module$exports$Blockly$blockRendering$BottomRow={BottomRow:function(a){module$exports$Blockly$blockRendering$Row.Row.call(this,a);this.type|=module$exports$Blockly$blockRendering$Types.Types.BOTTOM_ROW;this.hasNextConnection=!1;this.connection=null;this.baseline=this.descenderHeight=0}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$BottomRow.BottomRow,module$exports$Blockly$blockRendering$Row.Row);
module$exports$Blockly$blockRendering$BottomRow.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection||!!a.getNextBlock()};module$exports$Blockly$blockRendering$BottomRow.BottomRow.prototype.hasRightSquareCorner=function(a){return!0};
module$exports$Blockly$blockRendering$BottomRow.BottomRow.prototype.measure=function(){for(var a=0,b=0,c=0,d=0;d<this.elements.length;d++){var e=this.elements[d];b+=e.width;module$exports$Blockly$blockRendering$Types.Types.isSpacer(e)||(module$exports$Blockly$blockRendering$Types.Types.isNextConnection(e)?c=Math.max(c,e.height):a=Math.max(a,e.height))}this.width=Math.max(this.minWidth,b);this.height=Math.max(this.minHeight,a)+c;this.descenderHeight=c;this.widthWithConnectedBlocks=this.width};
module$exports$Blockly$blockRendering$BottomRow.BottomRow.prototype.startsWithElemSpacer=function(){return!1};module$exports$Blockly$blockRendering$BottomRow.BottomRow.prototype.endsWithElemSpacer=function(){return!1};var module$exports$Blockly$blockRendering$Measurable={Measurable:function(a){this.height=this.width=0;this.type=module$exports$Blockly$blockRendering$Types.Types.NONE;this.centerline=this.xPos=0;this.constants_=a;this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}};var module$exports$Blockly$blockRendering$Connection={Connection:function(a,b){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.connectionModel=b;this.shape=this.constants_.shapeFor(b);this.isDynamicShape=!!this.shape.isDynamic;this.type|=module$exports$Blockly$blockRendering$Types.Types.CONNECTION}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$Connection.Connection,module$exports$Blockly$blockRendering$Measurable.Measurable);var module$exports$Blockly$utils$colour={},module$contents$Blockly$utils$colour_hsvSaturation=.45;module$exports$Blockly$utils$colour.getHsvSaturation=function(){return module$contents$Blockly$utils$colour_hsvSaturation};module$exports$Blockly$utils$colour.setHsvSaturation=function(a){module$contents$Blockly$utils$colour_hsvSaturation=a};var module$contents$Blockly$utils$colour_hsvValue=.65;module$exports$Blockly$utils$colour.getHsvValue=function(){return module$contents$Blockly$utils$colour_hsvValue};
module$exports$Blockly$utils$colour.setHsvValue=function(a){module$contents$Blockly$utils$colour_hsvValue=a};
module$exports$Blockly$utils$colour.parse=function(a){a=String(a).toLowerCase().trim();var b=module$exports$Blockly$utils$colour.names[a];if(b)return b;b="0x"===a.substring(0,2)?"#"+a.substring(2):a;b="#"===b[0]?b:"#"+b;if(/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&256>a&&0<=b&&256>b&&0<=c&&256>c)?
(0,module$exports$Blockly$utils$colour.rgbToHex)(a,b,c):null};module$exports$Blockly$utils$colour.rgbToHex=function(a,b,c){b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)};module$exports$Blockly$utils$colour.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]};
module$exports$Blockly$utils$colour.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))};
module$exports$Blockly$utils$colour.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])))};
module$exports$Blockly$utils$colour.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"};module$exports$Blockly$utils$colour.hueToHex=function(a){return(0,module$exports$Blockly$utils$colour.hsvToHex)(a,module$contents$Blockly$utils$colour_hsvSaturation,255*module$contents$Blockly$utils$colour_hsvValue)};var module$exports$Blockly$utils$svgPaths={point:function(a,b){return" "+a+","+b+" "},curve:function(a,b){return" "+a+b.join("")},moveTo:function(a,b){return" M "+a+","+b+" "},moveBy:function(a,b){return" m "+a+","+b+" "},lineTo:function(a,b){return" l "+a+","+b+" "},line:function(a){return" l"+a.join("")},lineOnAxis:function(a,b){return" "+a+" "+b+" "},arc:function(a,b,c,d){return a+" "+c+" "+c+" "+b+d}};var module$exports$Blockly$utils$parsing={},module$contents$Blockly$utils$parsing_tokenizeInterpolationInternal=function(a,b){var c=[],d=a.split("");d.push("");var e=0;a=[];for(var f=null,g=0;g<d.length;g++){var h=d[g];0===e?"%"===h?((e=a.join(""))&&c.push(e),a.length=0,e=1):a.push(h):1===e?"%"===h?(a.push(h),e=0):b&&"0"<=h&&"9">=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 $.module$exports$Blockly$Msg.Msg?(e=$.module$exports$Blockly$Msg.Msg[h],"string"===typeof e?Array.prototype.push.apply(c,module$contents$Blockly$utils$parsing_tokenizeInterpolationInternal(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.length;f++)"string"===typeof c[f]?a.push(c[f]):((b=a.join(""))&&d.push(b),a.length=0,d.push(c[f]));(b=a.join(""))&&d.push(b);a.length=0;return d};module$exports$Blockly$utils$parsing.tokenizeInterpolation=function(a){return module$contents$Blockly$utils$parsing_tokenizeInterpolationInternal(a,!0)};
module$exports$Blockly$utils$parsing.replaceMessageReferences=function(a){if("string"!==typeof a)return a;a=module$contents$Blockly$utils$parsing_tokenizeInterpolationInternal(a,!1);return a.length?String(a[0]):""};module$exports$Blockly$utils$parsing.checkMessageReferences=function(a){for(var b=!0,c=$.module$exports$Blockly$Msg.Msg,d=a.match(/%{BKY_[A-Z]\w*}/ig),e=0;e<d.length;e++){var f=d[e].toUpperCase();void 0===c[f.slice(6,-1)]&&(console.warn("No message string for "+d[e]+" in "+a),b=!1)}return b};
module$exports$Blockly$utils$parsing.parseBlockColour=function(a){var b="string"===typeof a?(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a):a,c=Number(b);if(!isNaN(c)&&0<=c&&360>=c)return{hue:c,hex:(0,module$exports$Blockly$utils$colour.hsvToHex)(c,(0,module$exports$Blockly$utils$colour.getHsvSaturation)(),255*(0,module$exports$Blockly$utils$colour.getHsvValue)())};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$blockRendering$ConstantProvider={ConstantProvider:function(){this.NO_PADDING=0;this.SMALL_PADDING=3;this.MEDIUM_PADDING=5;this.MEDIUM_LARGE_PADDING=8;this.LARGE_PADDING=10;this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING;this.TAB_HEIGHT=15;this.TAB_OFFSET_FROM_TOP=5;this.TAB_VERTICAL_OVERLAP=2.5;this.TAB_WIDTH=8;this.NOTCH_WIDTH=15;this.NOTCH_HEIGHT=4;this.MIN_BLOCK_WIDTH=12;this.EMPTY_BLOCK_SPACER_HEIGHT=16;this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=this.DUMMY_INPUT_MIN_HEIGHT=
this.TAB_HEIGHT;this.CORNER_RADIUS=8;this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=15;this.STATEMENT_BOTTOM_SPACER=0;this.STATEMENT_INPUT_PADDING_LEFT=20;this.BETWEEN_STATEMENT_PADDING_Y=4;this.TOP_ROW_MIN_HEIGHT=this.MEDIUM_PADDING;this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.BOTTOM_ROW_MIN_HEIGHT=this.MEDIUM_PADDING;this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.ADD_START_HATS=!1;this.START_HAT_HEIGHT=15;this.START_HAT_WIDTH=100;this.SPACER_DEFAULT_HEIGHT=
15;this.MIN_BLOCK_HEIGHT=24;this.EMPTY_INLINE_INPUT_PADDING=14.5;this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11;this.EXTERNAL_VALUE_INPUT_PADDING=2;this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT;this.START_POINT=(0,module$exports$Blockly$utils$svgPaths.moveBy)(0,0);this.JAGGED_TEETH_HEIGHT=12;this.JAGGED_TEETH_WIDTH=6;this.FIELD_TEXT_FONTSIZE=11;this.FIELD_TEXT_FONTWEIGHT="normal";this.FIELD_TEXT_FONTFAMILY="sans-serif";this.FIELD_TEXT_BASELINE=this.FIELD_TEXT_HEIGHT=-1;this.FIELD_BORDER_RECT_RADIUS=
4;this.FIELD_BORDER_RECT_HEIGHT=16;this.FIELD_BORDER_RECT_X_PADDING=5;this.FIELD_BORDER_RECT_Y_PADDING=3;this.FIELD_BORDER_RECT_COLOUR="#fff";this.FIELD_TEXT_BASELINE_CENTER=!module$exports$Blockly$utils$userAgent.IE&&!module$exports$Blockly$utils$userAgent.EDGE;this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT;this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1;this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING;
this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12;this.FIELD_DROPDOWN_SVG_ARROW_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=";
this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1;this.FIELD_COLOUR_DEFAULT_WIDTH=26;this.FIELD_COLOUR_DEFAULT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT;this.FIELD_CHECKBOX_X_OFFSET=this.FIELD_BORDER_RECT_X_PADDING-3;this.randomIdentifier=String(Math.random()).substring(2);this.defs_=null;this.embossFilterId="";this.embossFilter_=null;this.disabledPatternId="";this.disabledPattern_=null;this.debugFilterId="";this.cssNode_=this.debugFilter_=null;this.CURSOR_COLOUR="#cc0a0a";this.MARKER_COLOUR=
"#4286f4";this.CURSOR_WS_WIDTH=100;this.WS_CURSOR_HEIGHT=5;this.CURSOR_STACK_PADDING=10;this.CURSOR_BLOCK_PADDING=2;this.CURSOR_STROKE_WIDTH=4;this.FULL_BLOCK_FIELDS=!1;this.INSERTION_MARKER_COLOUR="#000000";this.INSERTION_MARKER_OPACITY=.2;this.SHAPES={PUZZLE:1,NOTCH:2}}};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.init=function(){this.JAGGED_TEETH=this.makeJaggedTeeth();this.NOTCH=this.makeNotch();this.START_HAT=this.makeStartHat();this.PUZZLE_TAB=this.makePuzzleTab();this.INSIDE_CORNERS=this.makeInsideCorners();this.OUTSIDE_CORNERS=this.makeOutsideCorners()};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.setTheme=function(a){this.blockStyles=Object.create(null);var b=a.blockStyles,c;for(c in b)this.blockStyles[c]=this.validatedBlockStyle_(b[c]);this.setDynamicProperties_(a)};module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.setDynamicProperties_=function(a){this.setFontConstants_(a);this.setComponentConstants_(a);this.ADD_START_HATS=null!==a.startHats?a.startHats:this.ADD_START_HATS};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.setFontConstants_=function(a){a.fontStyle&&a.fontStyle.family&&(this.FIELD_TEXT_FONTFAMILY=a.fontStyle.family);a.fontStyle&&a.fontStyle.weight&&(this.FIELD_TEXT_FONTWEIGHT=a.fontStyle.weight);a.fontStyle&&a.fontStyle.size&&(this.FIELD_TEXT_FONTSIZE=a.fontStyle.size);a=(0,module$exports$Blockly$utils$dom.measureFontMetrics)("Hg",this.FIELD_TEXT_FONTSIZE+"pt",this.FIELD_TEXT_FONTWEIGHT,this.FIELD_TEXT_FONTFAMILY);this.FIELD_TEXT_HEIGHT=
a.height;this.FIELD_TEXT_BASELINE=a.baseline};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.setComponentConstants_=function(a){this.CURSOR_COLOUR=a.getComponentStyle("cursorColour")||this.CURSOR_COLOUR;this.MARKER_COLOUR=a.getComponentStyle("markerColour")||this.MARKER_COLOUR;this.INSERTION_MARKER_COLOUR=a.getComponentStyle("insertionMarkerColour")||this.INSERTION_MARKER_COLOUR;this.INSERTION_MARKER_OPACITY=Number(a.getComponentStyle("insertionMarkerOpacity"))||this.INSERTION_MARKER_OPACITY};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.getBlockStyleForColour=function(a){var b="auto_"+a;this.blockStyles[b]||(this.blockStyles[b]=this.createBlockStyle_(a));return{style:this.blockStyles[b],name:b}};module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.getBlockStyle=function(a){return this.blockStyles[a||""]||(a&&0===a.indexOf("auto_")?this.getBlockStyleForColour(a.substring(5)).style:this.createBlockStyle_("#000000"))};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.createBlockStyle_=function(a){return this.validatedBlockStyle_({colourPrimary:a})};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.validatedBlockStyle_=function(a){var b={};a&&(0,$.module$exports$Blockly$utils$object.mixin)(b,a);a=(0,module$exports$Blockly$utils$parsing.parseBlockColour)(b.colourPrimary||"#000");b.colourPrimary=a.hex;b.colourSecondary=b.colourSecondary?(0,module$exports$Blockly$utils$parsing.parseBlockColour)(b.colourSecondary).hex:this.generateSecondaryColour_(b.colourPrimary);b.colourTertiary=b.colourTertiary?(0,module$exports$Blockly$utils$parsing.parseBlockColour)(b.colourTertiary).hex:
this.generateTertiaryColour_(b.colourPrimary);b.hat=b.hat||"";return b};module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.generateSecondaryColour_=function(a){return(0,module$exports$Blockly$utils$colour.blend)("#fff",a,.6)||a};module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.generateTertiaryColour_=function(a){return(0,module$exports$Blockly$utils$colour.blend)("#fff",a,.3)||a};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.dispose=function(){this.embossFilter_&&(0,module$exports$Blockly$utils$dom.removeNode)(this.embossFilter_);this.disabledPattern_&&(0,module$exports$Blockly$utils$dom.removeNode)(this.disabledPattern_);this.debugFilter_&&(0,module$exports$Blockly$utils$dom.removeNode)(this.debugFilter_);this.cssNode_=null};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.makeJaggedTeeth=function(){var a=this.JAGGED_TEETH_HEIGHT,b=this.JAGGED_TEETH_WIDTH,c=(0,module$exports$Blockly$utils$svgPaths.line)([(0,module$exports$Blockly$utils$svgPaths.point)(b,a/4),(0,module$exports$Blockly$utils$svgPaths.point)(2*-b,a/2),(0,module$exports$Blockly$utils$svgPaths.point)(b,a/4)]);return{height:a,width:b,path:c}};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.makeStartHat=function(){var a=this.START_HAT_HEIGHT,b=this.START_HAT_WIDTH,c=(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(30,-a),(0,module$exports$Blockly$utils$svgPaths.point)(70,-a),(0,module$exports$Blockly$utils$svgPaths.point)(b,0)]);return{height:a,width:b,path:c}};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.makePuzzleTab=function(){function a(f){f=f?-1:1;var g=-f,h=c/2,k=h+2.5,l=h+.5,m=(0,module$exports$Blockly$utils$svgPaths.point)(-b,f*h);h=(0,module$exports$Blockly$utils$svgPaths.point)(b,f*h);return(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(0,f*k),(0,module$exports$Blockly$utils$svgPaths.point)(-b,g*l),m])+(0,module$exports$Blockly$utils$svgPaths.curve)("s",
[(0,module$exports$Blockly$utils$svgPaths.point)(b,2.5*g),h])}var b=this.TAB_WIDTH,c=this.TAB_HEIGHT,d=a(!0),e=a(!1);return{type:this.SHAPES.PUZZLE,width:b,height:c,pathDown:e,pathUp:d}};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.makeNotch=function(){function a(g){return(0,module$exports$Blockly$utils$svgPaths.line)([(0,module$exports$Blockly$utils$svgPaths.point)(g*d,c),(0,module$exports$Blockly$utils$svgPaths.point)(3*g,0),(0,module$exports$Blockly$utils$svgPaths.point)(g*d,-c)])}var b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=(b-3)/2,e=a(1),f=a(-1);return{type:this.SHAPES.NOTCH,width:b,height:c,pathLeft:e,pathRight:f}};
module$exports$Blockly$blockRendering$ConstantProvider.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,0",a,(0,module$exports$Blockly$utils$svgPaths.point)(a,a));return{width:a,height:a,pathTop:b,pathBottom:c}};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.makeOutsideCorners=function(){var a=this.CORNER_RADIUS,b=(0,module$exports$Blockly$utils$svgPaths.moveBy)(0,a)+(0,module$exports$Blockly$utils$svgPaths.arc)("a","0 0,1",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,1",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{topLeft:b,topRight:c,bottomRight:e,bottomLeft:d,rightHeight:a}};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.shapeFor=function(a){switch(a.type){case $.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE:case $.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE:return this.PUZZLE_TAB;case $.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT:case $.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type");
}};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.createDom=function(a,b,c){this.injectCSS_(b,c);this.defs_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.DEFS,{},a);a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},this.defs_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FEGAUSSIANBLUR,{"in":"SourceAlpha",
stdDeviation:1,result:"blur"},a);b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FESPECULARLIGHTING,{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FEPOINTLIGHT,{x:-5E3,y:-1E4,z:2E4},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FECOMPOSITE,{"in":"specOut",
in2:"SourceAlpha",operator:"in",result:"specOut"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FECOMPOSITE,{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},a);this.embossFilterId=a.id;this.embossFilter_=a;a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,
{width:10,height:10,fill:"#aaa"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},a);this.disabledPatternId=a.id;this.disabledPattern_=a;this.createDebugFilter()};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.createDebugFilter=function(){if(!this.debugFilter_){var a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs_),b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FECOMPONENTTRANSFER,{result:"outBlur"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Svg.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FECOMPOSITE,{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},a);this.debugFilterId=a.id;this.debugFilter_=a}};
module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.injectCSS_=function(a,b){b=this.getCSS_(b);a="blockly-renderer-style-"+a;this.cssNode_=document.getElementById(a);var c=b.join("\n");this.cssNode_?this.cssNode_.firstChild.textContent=c:(b=document.createElement("style"),b.id=a,a=document.createTextNode(c),b.appendChild(a),document.head.insertBefore(b,document.head.firstChild),this.cssNode_=b)};
module$exports$Blockly$blockRendering$ConstantProvider.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,",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$Field={Field:function(a,b,c){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.field=b;this.isEditable=b.EDITABLE;this.flipRtl=b.getFlipRtl();this.type|=module$exports$Blockly$blockRendering$Types.Types.FIELD;a=this.field.getSize();this.height=a.height;this.width=a.width;this.parentInput=c}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$Field.Field,module$exports$Blockly$blockRendering$Measurable.Measurable);var module$exports$Blockly$fieldRegistry={register:function(a,b){(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.FIELD,a,b)},unregister:function(a){(0,module$exports$Blockly$registry.unregister)(module$exports$Blockly$registry.Type.FIELD,a)},fromJson:function(a){var b=(0,module$exports$Blockly$registry.getObject)(module$exports$Blockly$registry.Type.FIELD,a.type);return b?b.fromJson(a):(console.warn("Blockly could not create a field of type "+a.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),
null)}};var module$exports$Blockly$IASTNodeLocation={IASTNodeLocation:function(){}};var module$exports$Blockly$IASTNodeLocationSvg={IASTNodeLocationSvg:function(){}};var module$exports$Blockly$IASTNodeLocationWithBlock={IASTNodeLocationWithBlock:function(){}};var module$exports$Blockly$IKeyboardAccessible={IKeyboardAccessible:function(){}};var module$exports$Blockly$IRegistrable={IRegistrable:function(){}};var module$exports$Blockly$MarkerManager={MarkerManager:function(a){this.cursorSvg_=this.cursor_=null;this.markers_=Object.create(null);this.workspace_=a;this.markerSvg_=null}};module$exports$Blockly$MarkerManager.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.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.MarkerManager.prototype.getCursor=function(){return this.cursor_};module$exports$Blockly$MarkerManager.MarkerManager.prototype.getMarker=function(a){return this.markers_[a]||null};
module$exports$Blockly$MarkerManager.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.MarkerManager.prototype.setCursorSvg=function(a){a?(this.workspace_.getBlockCanvas().appendChild(a),this.cursorSvg_=a):this.cursorSvg_=null};module$exports$Blockly$MarkerManager.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.MarkerManager.prototype.updateMarkers=function(){this.workspace_.keyboardAccessibilityMode&&this.cursorSvg_&&this.workspace_.getCursor().draw()};module$exports$Blockly$MarkerManager.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)};module$exports$Blockly$MarkerManager.MarkerManager.LOCAL_MARKER="local_marker_1";var module$exports$Blockly$utils$Sentinel={Sentinel:function(){}};var module$exports$Blockly$Events$BlockChange={BlockChange:function(a,b,c,d,e){module$exports$Blockly$Events$BlockBase.BlockBase.call(this,a);this.type=module$exports$Blockly$Events$utils.CHANGE;a&&(this.element="undefined"===typeof b?"":b,this.name="undefined"===typeof c?"":c,this.oldValue="undefined"===typeof d?"":d,this.newValue="undefined"===typeof e?"":e)}};$.$jscomp.inherits(module$exports$Blockly$Events$BlockChange.BlockChange,module$exports$Blockly$Events$BlockBase.BlockBase);
module$exports$Blockly$Events$BlockChange.BlockChange.prototype.toJson=function(){var a=module$exports$Blockly$Events$BlockBase.BlockBase.prototype.toJson.call(this);a.element=this.element;this.name&&(a.name=this.name);a.oldValue=this.oldValue;a.newValue=this.newValue;return a};
module$exports$Blockly$Events$BlockChange.BlockChange.prototype.fromJson=function(a){module$exports$Blockly$Events$BlockBase.BlockBase.prototype.fromJson.call(this,a);this.element=a.element;this.name=a.name;this.oldValue=a.oldValue;this.newValue=a.newValue};module$exports$Blockly$Events$BlockChange.BlockChange.prototype.isNull=function(){return this.oldValue===this.newValue};
module$exports$Blockly$Events$BlockChange.BlockChange.prototype.run=function(a){var b=this.getEventWorkspace_().getBlockById(this.blockId);if(b)switch(b.mutator&&b.mutator.setVisible(!1),a=a?this.newValue:this.oldValue,this.element){case "field":(b=b.getField(this.name))?b.setValue(a):console.warn("Can't set non-existent field: "+this.name);break;case "comment":b.setCommentText(a||null);break;case "collapsed":b.setCollapsed(!!a);break;case "disabled":b.setEnabled(!a);break;case "inline":b.setInputsInline(!!a);
break;case "mutation":var c=module$exports$Blockly$Events$BlockChange.BlockChange.getExtraBlockState_(b);b.loadExtraState?b.loadExtraState(JSON.parse(a||"{}")):b.domToMutation&&b.domToMutation((0,$.module$exports$Blockly$Xml.textToDom)(a||"<mutation/>"));(0,module$exports$Blockly$Events$utils.fire)(new module$exports$Blockly$Events$BlockChange.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.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.BlockChange);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;1<e?(0,module$exports$Blockly$utils$dom.removeNode)(a):(a.setAttribute("transform","translate("+(a.translateX_+(b?-1:1)*a.bBox_.width*d/2*e)+","+(a.translateY_+a.bBox_.height*d*e)+") scale("+(1-e)*d+")"),setTimeout(module$contents$Blockly$blockAnimations_disposeUiStep,10,a,b,c,d))};
module$exports$Blockly$blockAnimations.connectionUiEffect=function(a){var b=a.workspace,c=b.scale;b.getAudioManager().play("click");if(!(1>c)){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.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;1<d?(0,module$exports$Blockly$utils$dom.removeNode)(a):(a.setAttribute("r",25*d*c),a.style.opacity=1-d,module$contents$Blockly$blockAnimations_disconnectPid=setTimeout(module$contents$Blockly$blockAnimations_connectionUiStep,10,a,b,c))};
module$exports$Blockly$blockAnimations.disconnectUiEffect=function(a){a.workspace.getAudioManager().play("disconnect");if(!(1>a.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;1<d?a.skew_="":(a.skew_="skewX("+Math.round(Math.sin(d*Math.PI*3)*(1-d)*b)+")",module$contents$Blockly$blockAnimations_disconnectGroup=a,module$contents$Blockly$blockAnimations_disconnectPid=setTimeout(module$contents$Blockly$blockAnimations_disconnectUiStep,10,a,b,c));a.setAttribute("transform",a.translate_+a.skew_)};
module$exports$Blockly$blockAnimations.disconnectUiStop=function(){if(module$contents$Blockly$blockAnimations_disconnectGroup){clearTimeout(module$contents$Blockly$blockAnimations_disconnectPid);var a=module$contents$Blockly$blockAnimations_disconnectGroup;a.skew_="";a.setAttribute("transform",a.translate_);module$contents$Blockly$blockAnimations_disconnectGroup=null}};var module$exports$Blockly$internalConstants={COLLAPSE_CHARS:30,DRAG_STACK:!0,OPPOSITE_TYPE:[]};module$exports$Blockly$internalConstants.OPPOSITE_TYPE[$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE]=$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE;module$exports$Blockly$internalConstants.OPPOSITE_TYPE[$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE]=$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;
module$exports$Blockly$internalConstants.OPPOSITE_TYPE[$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT]=$.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT;module$exports$Blockly$internalConstants.OPPOSITE_TYPE[$.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT]=$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT;module$exports$Blockly$internalConstants.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";
module$exports$Blockly$internalConstants.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";var module$exports$Blockly$ComponentManager={ComponentManager:function(){this.componentData_=Object.create(null);this.capabilityToComponentIds_=Object.create(null)}};
module$exports$Blockly$ComponentManager.ComponentManager.prototype.addComponent=function(a,b){var c=a.component.id;if(!b&&this.componentData_[c])throw Error('Plugin "'+c+'" with capabilities "'+this.componentData_[c].capabilities+'" already added.');this.componentData_[c]=a;b=[];for(var d=0;d<a.capabilities.length;d++){var e=String(a.capabilities[d]).toLowerCase();b.push(e);void 0===this.capabilityToComponentIds_[e]?this.capabilityToComponentIds_[e]=[c]:this.capabilityToComponentIds_[e].push(c)}this.componentData_[c].capabilities=
b};module$exports$Blockly$ComponentManager.ComponentManager.prototype.removeComponent=function(a){var b=this.componentData_[a];if(b){for(var c=0;c<b.capabilities.length;c++){var d=String(b.capabilities[c]).toLowerCase();(0,module$exports$Blockly$utils$array.removeElem)(this.capabilityToComponentIds_[d],a)}delete this.componentData_[a]}};
module$exports$Blockly$ComponentManager.ComponentManager.prototype.addCapability=function(a,b){if(!this.getComponent(a))throw Error('Cannot add capability, "'+b+'". Plugin "'+a+'" has not been added to the ComponentManager');this.hasCapability(a,b)?console.warn('Plugin "'+a+'already has capability "'+b+'"'):(b=String(b).toLowerCase(),this.componentData_[a].capabilities.push(b),this.capabilityToComponentIds_[b].push(a))};
module$exports$Blockly$ComponentManager.ComponentManager.prototype.removeCapability=function(a,b){if(!this.getComponent(a))throw Error('Cannot remove capability, "'+b+'". Plugin "'+a+'" has not been added to the ComponentManager');this.hasCapability(a,b)?(b=String(b).toLowerCase(),(0,module$exports$Blockly$utils$array.removeElem)(this.componentData_[a].capabilities,b),(0,module$exports$Blockly$utils$array.removeElem)(this.capabilityToComponentIds_[b],a)):console.warn('Plugin "'+a+"doesn't have capability \""+
b+'" to remove')};module$exports$Blockly$ComponentManager.ComponentManager.prototype.hasCapability=function(a,b){b=String(b).toLowerCase();return-1!==this.componentData_[a].capabilities.indexOf(b)};module$exports$Blockly$ComponentManager.ComponentManager.prototype.getComponent=function(a){return this.componentData_[a]&&this.componentData_[a].component};
module$exports$Blockly$ComponentManager.ComponentManager.prototype.getComponents=function(a,b){a=String(a).toLowerCase();a=this.capabilityToComponentIds_[a];if(!a)return[];var c=[];if(b){var d=[],e=this.componentData_;a.forEach(function(g){d.push(e[g])});d.sort(function(g,h){return g.weight-h.weight});d.forEach(function(g){c.push(g.component)})}else{var f=this.componentData_;a.forEach(function(g){c.push(f[g].component)})}return c};
module$exports$Blockly$ComponentManager.ComponentManager.Capability=function(a){this.name_=a};module$exports$Blockly$ComponentManager.ComponentManager.Capability.prototype.toString=function(){return this.name_};module$exports$Blockly$ComponentManager.ComponentManager.Capability.POSITIONABLE=new module$exports$Blockly$ComponentManager.ComponentManager.Capability("positionable");module$exports$Blockly$ComponentManager.ComponentManager.Capability.DRAG_TARGET=new module$exports$Blockly$ComponentManager.ComponentManager.Capability("drag_target");
module$exports$Blockly$ComponentManager.ComponentManager.Capability.DELETE_AREA=new module$exports$Blockly$ComponentManager.ComponentManager.Capability("delete_area");module$exports$Blockly$ComponentManager.ComponentManager.Capability.AUTOHIDEABLE=new module$exports$Blockly$ComponentManager.ComponentManager.Capability("autohideable");var module$exports$Blockly$IContextMenu={IContextMenu:function(){}};var module$exports$Blockly$IDeletable={IDeletable:function(){}};var module$exports$Blockly$IDraggable={IDraggable:function(){}};var module$exports$Blockly$IBubble={IBubble:function(){}};var module$exports$Blockly$dialog={},module$contents$Blockly$dialog_alertImplementation=function(a,b){window.alert(a);b&&b()},module$contents$Blockly$dialog_confirmImplementation=function(a,b){b(window.confirm(a))},module$contents$Blockly$dialog_promptImplementation=function(a,b,c){c(window.prompt(a,b))};module$exports$Blockly$dialog.alert=function(a,b){module$contents$Blockly$dialog_alertImplementation(a,b)};
module$exports$Blockly$dialog.setAlert=function(a){module$contents$Blockly$dialog_alertImplementation=a};module$exports$Blockly$dialog.confirm=function(a,b){module$contents$Blockly$dialog_confirmImplementation(a,b)};module$exports$Blockly$dialog.setConfirm=function(a){module$contents$Blockly$dialog_confirmImplementation=a};module$exports$Blockly$dialog.prompt=function(a,b,c){module$contents$Blockly$dialog_promptImplementation(a,b,c)};
module$exports$Blockly$dialog.setPrompt=function(a){module$contents$Blockly$dialog_promptImplementation=a};var module$exports$Blockly$Events$VarBase={VarBase:function(a){module$exports$Blockly$Events$Abstract.Abstract.call(this);this.varId=(this.isBlank="undefined"===typeof a)?"":a.getId();this.workspaceId=this.isBlank?"":a.workspace.id}};$.$jscomp.inherits(module$exports$Blockly$Events$VarBase.VarBase,module$exports$Blockly$Events$Abstract.Abstract);
module$exports$Blockly$Events$VarBase.VarBase.prototype.toJson=function(){var a=module$exports$Blockly$Events$Abstract.Abstract.prototype.toJson.call(this);a.varId=this.varId;return a};module$exports$Blockly$Events$VarBase.VarBase.prototype.fromJson=function(a){module$exports$Blockly$Events$Abstract.Abstract.prototype.fromJson.call(this,a);this.varId=a.varId};var module$exports$Blockly$Events$VarCreate={VarCreate:function(a){module$exports$Blockly$Events$VarBase.VarBase.call(this,a);this.type=module$exports$Blockly$Events$utils.VAR_CREATE;a&&(this.varType=a.type,this.varName=a.name)}};$.$jscomp.inherits(module$exports$Blockly$Events$VarCreate.VarCreate,module$exports$Blockly$Events$VarBase.VarBase);
module$exports$Blockly$Events$VarCreate.VarCreate.prototype.toJson=function(){var a=module$exports$Blockly$Events$VarBase.VarBase.prototype.toJson.call(this);a.varType=this.varType;a.varName=this.varName;return a};module$exports$Blockly$Events$VarCreate.VarCreate.prototype.fromJson=function(a){module$exports$Blockly$Events$VarBase.VarBase.prototype.fromJson.call(this,a);this.varType=a.varType;this.varName=a.varName};
module$exports$Blockly$Events$VarCreate.VarCreate.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.createVariable(this.varName,this.varType,this.varId):b.deleteVariableById(this.varId)};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.VAR_CREATE,module$exports$Blockly$Events$VarCreate.VarCreate);var module$exports$Blockly$VariableModel={VariableModel:function(a,b,c,d){this.workspace=a;this.name=b;this.type=c||"";this.id_=d||(0,module$exports$Blockly$utils$idGenerator.genUid)();(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.VAR_CREATE))(this))}};module$exports$Blockly$VariableModel.VariableModel.prototype.getId=function(){return this.id_};
module$exports$Blockly$VariableModel.VariableModel.compareByName=function(a,b){return a.name.localeCompare(b.name,void 0,{sensitivity:"base"})};var module$contents$Blockly$Variables_ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE;$.module$exports$Blockly$Variables={CATEGORY_NAME:"VARIABLE",allUsedVarModels:function(a){var b=a.getAllBlocks(!1);a=Object.create(null);for(var c=0;c<b.length;c++){var d=b[c].getVarModels();if(d)for(var e=0;e<d.length;e++){var f=d[e],g=f.getId();g&&(a[g]=f)}}b=[];for(var h in a)b.push(a[h]);return b}};module$contents$Blockly$Variables_ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE={};
$.module$exports$Blockly$Variables.allDeveloperVariables=function(a){a=a.getAllBlocks(!1);for(var b=Object.create(null),c=0,d;d=a[c];c++){var e=d.getDeveloperVariables;!e&&d.getDeveloperVars&&(e=d.getDeveloperVars,module$contents$Blockly$Variables_ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE[d.type]||(console.warn("Function getDeveloperVars() deprecated. Use getDeveloperVariables() (block type '"+d.type+"')"),module$contents$Blockly$Variables_ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE[d.type]=!0));if(e)for(d=
e(),e=0;e<d.length;e++)b[d[e]]=!0}return Object.keys(b)};$.module$exports$Blockly$Variables.flyoutCategory=function(a){var b=[],c=document.createElement("button");c.setAttribute("text","%{BKY_NEW_VARIABLE}");c.setAttribute("callbackKey","CREATE_VARIABLE");a.registerButtonCallback("CREATE_VARIABLE",function(d){(0,$.module$exports$Blockly$Variables.createVariableButtonHandler)(d.getTargetWorkspace())});b.push(c);a=(0,$.module$exports$Blockly$Variables.flyoutCategoryBlocks)(a);return b=b.concat(a)};
$.module$exports$Blockly$Variables.flyoutCategoryBlocks=function(a){a=a.getVariablesOfType("");var b=[];if(0<a.length){var c=a[a.length-1];if(module$exports$Blockly$blocks.Blocks.variables_set){var d=(0,$.module$exports$Blockly$utils$xml.createElement)("block");d.setAttribute("type","variables_set");d.setAttribute("gap",module$exports$Blockly$blocks.Blocks.math_change?8:24);d.appendChild((0,$.module$exports$Blockly$Variables.generateVariableFieldDom)(c));b.push(d)}module$exports$Blockly$blocks.Blocks.math_change&&
(d=(0,$.module$exports$Blockly$utils$xml.createElement)("block"),d.setAttribute("type","math_change"),d.setAttribute("gap",module$exports$Blockly$blocks.Blocks.variables_get?20:8),d.appendChild((0,$.module$exports$Blockly$Variables.generateVariableFieldDom)(c)),c=(0,$.module$exports$Blockly$Xml.textToDom)('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),d.appendChild(c),b.push(d));if(module$exports$Blockly$blocks.Blocks.variables_get)for(a.sort(module$exports$Blockly$VariableModel.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;g<b.length;g++)if(b[g].toLowerCase()===a){f=!0;break}if(!f)return a;e++;e===c.length&&(e=0,d=Number(d)+1);a=c.charAt(e)+d}};
$.module$exports$Blockly$Variables.createVariableButtonHandler=function(a,b,c){var d=c||"",e=function(f){(0,$.module$exports$Blockly$Variables.promptName)($.module$exports$Blockly$Msg.Msg.NEW_VARIABLE_TITLE,f,function(g){if(g){var h=(0,$.module$exports$Blockly$Variables.nameUsedWithAnyType)(g,a);if(h){if(h.type===d)var k=$.module$exports$Blockly$Msg.Msg.VARIABLE_ALREADY_EXISTS.replace("%1",h.name);else k=$.module$exports$Blockly$Msg.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,k=k.replace("%1",h.name).replace("%2",
h.type);(0,module$exports$Blockly$dialog.alert)(k,function(){e(g)})}else a.createVariable(g,d),b&&b(g)}else b&&b(null)})};e("")};
$.module$exports$Blockly$Variables.renameVariable=function(a,b,c){var d=function(e){var f=$.module$exports$Blockly$Msg.Msg.RENAME_VARIABLE_TITLE.replace("%1",b.name);(0,$.module$exports$Blockly$Variables.promptName)(f,e,function(g){if(g){var h=module$contents$Blockly$Variables_nameUsedWithOtherType(g,b.type,a);h?(h=$.module$exports$Blockly$Msg.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",h.name).replace("%2",h.type),(0,module$exports$Blockly$dialog.alert)(h,function(){d(g)})):(a.renameVariableById(b.getId(),
g),c&&c(g))}else c&&c(null)})};d("")};$.module$exports$Blockly$Variables.promptName=function(a,b,c){(0,module$exports$Blockly$dialog.prompt)(a,b,function(d){d&&(d=d.replace(/[\s\xa0]+/g," ").trim(),d===$.module$exports$Blockly$Msg.Msg.RENAME_VARIABLE||d===$.module$exports$Blockly$Msg.Msg.NEW_VARIABLE)&&(d=null);c(d)})};
var module$contents$Blockly$Variables_nameUsedWithOtherType=function(a,b,c){c=c.getVariableMap().getAllVariables();a=a.toLowerCase();for(var d=0,e;e=c[d];d++)if(e.name.toLowerCase()===a&&e.type!==b)return e;return null};$.module$exports$Blockly$Variables.nameUsedWithAnyType=function(a,b){b=b.getVariableMap().getAllVariables();a=a.toLowerCase();for(var c=0,d;d=b[c];c++)if(d.name.toLowerCase()===a)return d;return null};
$.module$exports$Blockly$Variables.generateVariableFieldDom=function(a){var b=(0,$.module$exports$Blockly$utils$xml.createElement)("field");b.setAttribute("name","VAR");b.setAttribute("id",a.getId());b.setAttribute("variabletype",a.type);a=(0,$.module$exports$Blockly$utils$xml.createTextNode)(a.name);b.appendChild(a);return b};
$.module$exports$Blockly$Variables.getOrCreateVariablePackage=function(a,b,c,d){var e=(0,$.module$exports$Blockly$Variables.getVariable)(a,b,c,d);e||(e=module$contents$Blockly$Variables_createVariable(a,b,c,d));return e};
$.module$exports$Blockly$Variables.getVariable=function(a,b,c,d){var e=a.getPotentialVariableMap(),f=null;if(b&&(f=a.getVariableById(b),!f&&e&&(f=e.getVariableById(b)),f))return f;if(c){if(void 0===d)throw Error("Tried to look up a variable by name without a type");f=a.getVariable(c,d);!f&&e&&(f=e.getVariable(c,d))}return f};
var module$contents$Blockly$Variables_createVariable=function(a,b,c,d){var e=a.getPotentialVariableMap();c||(c=$.module$exports$Blockly$Variables.generateUniqueName(a.isFlyout?a.targetWorkspace:a));return e?e.createVariable(c,d,b):a.createVariable(c,d,b)};$.module$exports$Blockly$Variables.getAddedVariables=function(a,b){a=a.getAllVariables();var c=[];if(b.length!==a.length)for(var d=0;d<a.length;d++){var e=a[d];-1===b.indexOf(e)&&c.push(e)}return c};$.module$exports$Blockly$Names={Names:function(a,b){this.variablePrefix_=b||"";this.reservedDict_=Object.create(null);this.db_=Object.create(null);this.dbReverse_=Object.create(null);this.variableMap_=null;if(a)for(a=a.split(","),b=0;b<a.length;b++)this.reservedDict_[a[b]]=!0;this.reset()}};$.module$exports$Blockly$Names.Names.prototype.reset=function(){this.db_=Object.create(null);this.dbReverse_=Object.create(null);this.variableMap_=null};
$.module$exports$Blockly$Names.Names.prototype.setVariableMap=function(a){this.variableMap_=a};$.module$exports$Blockly$Names.Names.prototype.getNameForUserVariable_=function(a){return this.variableMap_?(a=this.variableMap_.getVariableById(a))?a.name:null:(console.warn("Deprecated call to Names.prototype.getName without defining a variable map. To fix, add the following code in your generator's init() function:\nBlockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());"),null)};
$.module$exports$Blockly$Names.Names.prototype.populateVariables=function(a){a=(0,$.module$exports$Blockly$Variables.allUsedVarModels)(a);for(var b=0;b<a.length;b++)this.getName(a[b].getId(),$.module$exports$Blockly$Names.NameType.VARIABLE)};$.module$exports$Blockly$Names.Names.prototype.populateProcedures=function(a){a=$.module$exports$Blockly$Procedures.allProcedures(a);a=a[0].concat(a[1]);for(var b=0;b<a.length;b++)this.getName(a[b][0],$.module$exports$Blockly$Names.NameType.PROCEDURE)};
$.module$exports$Blockly$Names.Names.prototype.getName=function(a,b){var c=a;b===$.module$exports$Blockly$Names.NameType.VARIABLE&&(a=this.getNameForUserVariable_(a))&&(c=a);a=c.toLowerCase();var d=b===$.module$exports$Blockly$Names.NameType.VARIABLE||b===$.module$exports$Blockly$Names.NameType.DEVELOPER_VARIABLE?this.variablePrefix_:"";b in this.db_||(this.db_[b]=Object.create(null));var e=this.db_[b];if(a in e)return d+e[a];b=this.getDistinctName(c,b);e[a]=b.substr(d.length);return b};
$.module$exports$Blockly$Names.Names.prototype.getUserNames=function(a){return Object.keys(this.db_[a]||{})};$.module$exports$Blockly$Names.Names.prototype.getDistinctName=function(a,b){a=this.safeName_(a);for(var c="";this.dbReverse_[a+c]||a+c in this.reservedDict_;)c=c?c+1:2;a+=c;this.dbReverse_[a]=!0;return(b===$.module$exports$Blockly$Names.NameType.VARIABLE||b===$.module$exports$Blockly$Names.NameType.DEVELOPER_VARIABLE?this.variablePrefix_:"")+a};
$.module$exports$Blockly$Names.Names.prototype.safeName_=function(a){a?(a=encodeURI(a.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!=="0123456789".indexOf(a[0])&&(a="my_"+a)):a=$.module$exports$Blockly$Msg.Msg.UNNAMED_KEY||"unnamed";return a};$.module$exports$Blockly$Names.Names.equals=function(a,b){return a.toLowerCase()===b.toLowerCase()};$.module$exports$Blockly$Names.NameType={DEVELOPER_VARIABLE:"DEVELOPER_VARIABLE",VARIABLE:"VARIABLE",PROCEDURE:"PROCEDURE"};
$.module$exports$Blockly$Names.Names.NameType=$.module$exports$Blockly$Names.NameType;$.module$exports$Blockly$Names.Names.DEVELOPER_VARIABLE_TYPE=$.module$exports$Blockly$Names.NameType.DEVELOPER_VARIABLE;var module$exports$Blockly$Events$VarDelete={VarDelete:function(a){module$exports$Blockly$Events$VarBase.VarBase.call(this,a);this.type=module$exports$Blockly$Events$utils.VAR_DELETE;a&&(this.varType=a.type,this.varName=a.name)}};$.$jscomp.inherits(module$exports$Blockly$Events$VarDelete.VarDelete,module$exports$Blockly$Events$VarBase.VarBase);
module$exports$Blockly$Events$VarDelete.VarDelete.prototype.toJson=function(){var a=module$exports$Blockly$Events$VarBase.VarBase.prototype.toJson.call(this);a.varType=this.varType;a.varName=this.varName;return a};module$exports$Blockly$Events$VarDelete.VarDelete.prototype.fromJson=function(a){module$exports$Blockly$Events$VarBase.VarBase.prototype.fromJson.call(this,a);this.varType=a.varType;this.varName=a.varName};
module$exports$Blockly$Events$VarDelete.VarDelete.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.deleteVariableById(this.varId):b.createVariable(this.varName,this.varType,this.varId)};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.VAR_DELETE,module$exports$Blockly$Events$VarDelete.VarDelete);var module$exports$Blockly$Events$VarRename={VarRename:function(a,b){module$exports$Blockly$Events$VarBase.VarBase.call(this,a);this.type=module$exports$Blockly$Events$utils.VAR_RENAME;a&&(this.oldName=a.name,this.newName="undefined"===typeof b?"":b)}};$.$jscomp.inherits(module$exports$Blockly$Events$VarRename.VarRename,module$exports$Blockly$Events$VarBase.VarBase);
module$exports$Blockly$Events$VarRename.VarRename.prototype.toJson=function(){var a=module$exports$Blockly$Events$VarBase.VarBase.prototype.toJson.call(this);a.oldName=this.oldName;a.newName=this.newName;return a};module$exports$Blockly$Events$VarRename.VarRename.prototype.fromJson=function(a){module$exports$Blockly$Events$VarBase.VarBase.prototype.fromJson.call(this,a);this.oldName=a.oldName;this.newName=a.newName};
module$exports$Blockly$Events$VarRename.VarRename.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.renameVariableById(this.varId,this.newName):b.renameVariableById(this.varId,this.oldName)};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.VAR_RENAME,module$exports$Blockly$Events$VarRename.VarRename);var module$exports$Blockly$VariableMap={VariableMap:function(a){this.variableMap_=Object.create(null);this.workspace=a}};module$exports$Blockly$VariableMap.VariableMap.prototype.clear=function(){this.variableMap_=Object.create(null)};
module$exports$Blockly$VariableMap.VariableMap.prototype.renameVariable=function(a,b){var c=this.getVariable(b,a.type),d=this.workspace.getAllBlocks(!1);(0,module$exports$Blockly$Events$utils.setGroup)(!0);try{c&&c.getId()!==a.getId()?this.renameVariableWithConflict_(a,b,c,d):this.renameVariableAndUses_(a,b,d)}finally{(0,module$exports$Blockly$Events$utils.setGroup)(!1)}};
module$exports$Blockly$VariableMap.VariableMap.prototype.renameVariableById=function(a,b){var c=this.getVariableById(a);if(!c)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.renameVariable(c,b)};module$exports$Blockly$VariableMap.VariableMap.prototype.renameVariableAndUses_=function(a,b,c){(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.VAR_RENAME))(a,b));a.name=b;for(b=0;b<c.length;b++)c[b].updateVarName(a)};
module$exports$Blockly$VariableMap.VariableMap.prototype.renameVariableWithConflict_=function(a,b,c,d){var e=a.type;b!==c.name&&this.renameVariableAndUses_(c,b,d);for(b=0;b<d.length;b++)d[b].renameVarById(a.getId(),c.getId());(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.VAR_DELETE))(a));(0,module$exports$Blockly$utils$array.removeElem)(this.variableMap_[e],a)};
module$exports$Blockly$VariableMap.VariableMap.prototype.createVariable=function(a,b,c){var d=this.getVariable(a,b);if(d){if(c&&d.getId()!==c)throw Error('Variable "'+a+'" is already in use and its id is "'+d.getId()+'" which conflicts with the passed in id, "'+c+'".');return d}if(c&&this.getVariableById(c))throw Error('Variable id, "'+c+'", is already in use.');d=c||(0,module$exports$Blockly$utils$idGenerator.genUid)();b=b||"";d=new module$exports$Blockly$VariableModel.VariableModel(this.workspace,
a,b,d);a=this.variableMap_[b]||[];a.push(d);delete this.variableMap_[b];this.variableMap_[b]=a;return d};module$exports$Blockly$VariableMap.VariableMap.prototype.deleteVariable=function(a){for(var b=a.getId(),c=this.variableMap_[a.type],d=0;d<c.length;d++)if(c[d].getId()===b){c.splice(d,1);(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.VAR_DELETE))(a));break}};
module$exports$Blockly$VariableMap.VariableMap.prototype.deleteVariableById=function(a){var b=this.getVariableById(a);if(b){var c=b.name,d=this.getVariableUsesById(a);a=0;for(var e=void 0;e=d[a];a++)if("procedures_defnoreturn"===e.type||"procedures_defreturn"===e.type){a=String(e.getFieldValue("NAME"));c=$.module$exports$Blockly$Msg.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",c).replace("%2",a);(0,module$exports$Blockly$dialog.alert)(c);return}var f=this;1<d.length?(c=$.module$exports$Blockly$Msg.Msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",
String(d.length)).replace("%2",c),(0,module$exports$Blockly$dialog.confirm)(c,function(g){g&&b&&f.deleteVariableInternal(b,d)})):f.deleteVariableInternal(b,d)}else console.warn("Can't delete non-existent variable: "+a)};
module$exports$Blockly$VariableMap.VariableMap.prototype.deleteVariableInternal=function(a,b){var c=(0,module$exports$Blockly$Events$utils.getGroup)();c||(0,module$exports$Blockly$Events$utils.setGroup)(!0);try{for(var d=0;d<b.length;d++)b[d].dispose(!0);this.deleteVariable(a)}finally{c||(0,module$exports$Blockly$Events$utils.setGroup)(!1)}};
module$exports$Blockly$VariableMap.VariableMap.prototype.getVariable=function(a,b){if(b=this.variableMap_[b||""])for(var c=0,d;d=b[c];c++)if($.module$exports$Blockly$Names.Names.equals(d.name,a))return d;return null};module$exports$Blockly$VariableMap.VariableMap.prototype.getVariableById=function(a){for(var b=Object.keys(this.variableMap_),c=0;c<b.length;c++)for(var d=b[c],e=0,f;f=this.variableMap_[d][e];e++)if(f.getId()===a)return f;return null};
module$exports$Blockly$VariableMap.VariableMap.prototype.getVariablesOfType=function(a){return(a=this.variableMap_[a||""])?a.slice():[]};
module$exports$Blockly$VariableMap.VariableMap.prototype.getVariableTypes=function(a){var b={};(0,$.module$exports$Blockly$utils$object.mixin)(b,this.variableMap_);a&&a.getPotentialVariableMap()&&(0,$.module$exports$Blockly$utils$object.mixin)(b,a.getPotentialVariableMap().variableMap_);a=Object.keys(b);b=!1;for(var c=0;c<a.length;c++)""===a[c]&&(b=!0);b||a.push("");return a};
module$exports$Blockly$VariableMap.VariableMap.prototype.getAllVariables=function(){var a=[],b;for(b in this.variableMap_)a=a.concat(this.variableMap_[b]);return a};module$exports$Blockly$VariableMap.VariableMap.prototype.getAllVariableNames=function(){var a=[],b;for(b in this.variableMap_)for(var c=this.variableMap_[b],d=0,e;e=c[d];d++)a.push(e.name);return a};
module$exports$Blockly$VariableMap.VariableMap.prototype.getVariableUsesById=function(a){for(var b=[],c=this.workspace.getAllBlocks(!1),d=0;d<c.length;d++){var e=c[d].getVarModels();if(e)for(var f=0;f<e.length;f++)e[f].getId()===a&&b.push(c[d])}return b};var module$exports$Blockly$Events$BlockMove={BlockMove:function(a){module$exports$Blockly$Events$BlockBase.BlockBase.call(this,a);this.type=module$exports$Blockly$Events$utils.MOVE;a&&(a.isShadow()&&(this.recordUndo=!1),a=this.currentLocation_(),this.oldParentId=a.parentId,this.oldInputName=a.inputName,this.oldCoordinate=a.coordinate,this.newCoordinate=this.newInputName=this.newParentId=null)}};$.$jscomp.inherits(module$exports$Blockly$Events$BlockMove.BlockMove,module$exports$Blockly$Events$BlockBase.BlockBase);
module$exports$Blockly$Events$BlockMove.BlockMove.prototype.toJson=function(){var a=module$exports$Blockly$Events$BlockBase.BlockBase.prototype.toJson.call(this);this.newParentId&&(a.newParentId=this.newParentId);this.newInputName&&(a.newInputName=this.newInputName);this.newCoordinate&&(a.newCoordinate=Math.round(this.newCoordinate.x)+","+Math.round(this.newCoordinate.y));this.recordUndo||(a.recordUndo=this.recordUndo);return a};
module$exports$Blockly$Events$BlockMove.BlockMove.prototype.fromJson=function(a){module$exports$Blockly$Events$BlockBase.BlockBase.prototype.fromJson.call(this,a);this.newParentId=a.newParentId;this.newInputName=a.newInputName;if(a.newCoordinate){var b=a.newCoordinate.split(",");this.newCoordinate=new module$exports$Blockly$utils$Coordinate.Coordinate(Number(b[0]),Number(b[1]))}void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)};
module$exports$Blockly$Events$BlockMove.BlockMove.prototype.recordNew=function(){var a=this.currentLocation_();this.newParentId=a.parentId;this.newInputName=a.inputName;this.newCoordinate=a.coordinate};module$exports$Blockly$Events$BlockMove.BlockMove.prototype.currentLocation_=function(){var a=this.getEventWorkspace_().getBlockById(this.blockId),b={},c=a.getParent();if(c){if(b.parentId=c.id,a=c.getInputWithBlock(a))b.inputName=a.name}else b.coordinate=a.getRelativeToSurfaceXY();return b};
module$exports$Blockly$Events$BlockMove.BlockMove.prototype.isNull=function(){return this.oldParentId===this.newParentId&&this.oldInputName===this.newInputName&&module$exports$Blockly$utils$Coordinate.Coordinate.equals(this.oldCoordinate,this.newCoordinate)};
module$exports$Blockly$Events$BlockMove.BlockMove.prototype.run=function(a){var b=this.getEventWorkspace_(),c=b.getBlockById(this.blockId);if(c){var d=a?this.newParentId:this.oldParentId,e=a?this.newInputName:this.oldInputName;a=a?this.newCoordinate:this.oldCoordinate;if(d){var f=b.getBlockById(d);if(!f){console.warn("Can't connect to non-existent block: "+d);return}}c.getParent()&&c.unplug();if(a)e=c.getRelativeToSurfaceXY(),c.moveBy(a.x-e.x,a.y-e.y);else{b=c.outputConnection;if(!b||c.previousConnection&&
c.previousConnection.isConnected())b=c.previousConnection;c=b.type;if(e){if(c=f.getInput(e))var g=c.connection}else c===$.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT&&(g=f.nextConnection);g?b.connect(g):console.warn("Can't connect to non-existent input: "+e)}}else console.warn("Can't move non-existent block: "+this.blockId)};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.MOVE,module$exports$Blockly$Events$BlockMove.BlockMove);var module$exports$Blockly$constants={COLLAPSED_INPUT_NAME:"_TEMP_COLLAPSED_INPUT",COLLAPSED_FIELD_NAME:"_TEMP_COLLAPSED_FIELD"};var module$exports$Blockly$Connection={Connection:function(a,b){this.sourceBlock_=a;this.type=b;this.targetConnection=null;this.disposed=!1;this.shadowDom_=this.check_=null;this.y=this.x=0;this.shadowState_=null}};
module$exports$Blockly$Connection.Connection.prototype.connect_=function(a){var b=$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE,c=this.getSourceBlock(),d=a.getSourceBlock();a.isConnected()&&a.disconnect();if(this.isConnected()){var e=this.stashShadowState_(),f=this.targetBlock();if(f.isShadow())f.dispose(!1);else{this.disconnect();var g=f}this.applyShadowState_(e)}var h;(0,module$exports$Blockly$Events$utils.isEnabled)()&&(h=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.MOVE))(d));
module$contents$Blockly$Connection_connectReciprocally(this,a);d.setParent(c);h&&(h.recordNew(),(0,module$exports$Blockly$Events$utils.fire)(h));if(g)if(a=this.type===b?g.outputConnection:g.previousConnection,d=module$exports$Blockly$Connection.Connection.getConnectionForOrphanedConnection(d,a))a.connect(d);else a.onFailedConnect(this)};
module$exports$Blockly$Connection.Connection.prototype.dispose=function(){if(this.isConnected()){this.setShadowStateInternal_();var a=this.targetBlock();a&&a.unplug()}this.disposed=!0};module$exports$Blockly$Connection.Connection.prototype.getSourceBlock=function(){return this.sourceBlock_};module$exports$Blockly$Connection.Connection.prototype.isSuperior=function(){return this.type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE||this.type===$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT};
module$exports$Blockly$Connection.Connection.prototype.isConnected=function(){return!!this.targetConnection};module$exports$Blockly$Connection.Connection.prototype.getConnectionChecker=function(){return this.sourceBlock_.workspace.connectionChecker};module$exports$Blockly$Connection.Connection.prototype.onFailedConnect=function(a){};
module$exports$Blockly$Connection.Connection.prototype.connect=function(a){if(this.targetConnection===a)return!0;if(this.getConnectionChecker().canConnect(this,a,!1)){var b=(0,module$exports$Blockly$Events$utils.getGroup)();b||(0,module$exports$Blockly$Events$utils.setGroup)(!0);this.isSuperior()?this.connect_(a):a.connect_(this);b||(0,module$exports$Blockly$Events$utils.setGroup)(!1)}return this.isConnected()};
module$exports$Blockly$Connection.Connection.prototype.disconnect=function(){var a=this.targetConnection;if(!a)throw Error("Source connection not connected.");if(a.targetConnection!==this)throw Error("Target connection not connected to source connection.");if(this.isSuperior()){var b=this.sourceBlock_;var c=a.getSourceBlock();a=this}else b=a.getSourceBlock(),c=this.sourceBlock_;var d=(0,module$exports$Blockly$Events$utils.getGroup)();d||(0,module$exports$Blockly$Events$utils.setGroup)(!0);this.disconnectInternal_(b,
c);c.isShadow()||a.respawnShadow_();d||(0,module$exports$Blockly$Events$utils.setGroup)(!1)};module$exports$Blockly$Connection.Connection.prototype.disconnectInternal_=function(a,b){var c;(0,module$exports$Blockly$Events$utils.isEnabled)()&&(c=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.MOVE))(b));this.targetConnection=this.targetConnection.targetConnection=null;b.setParent(null);c&&(c.recordNew(),(0,module$exports$Blockly$Events$utils.fire)(c))};
module$exports$Blockly$Connection.Connection.prototype.respawnShadow_=function(){this.createShadowBlock_(!0)};module$exports$Blockly$Connection.Connection.prototype.targetBlock=function(){return this.isConnected()?this.targetConnection.getSourceBlock():null};module$exports$Blockly$Connection.Connection.prototype.onCheckChanged_=function(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()};
module$exports$Blockly$Connection.Connection.prototype.setCheck=function(a){a?(Array.isArray(a)||(a=[a]),this.check_=a,this.onCheckChanged_()):this.check_=null;return this};module$exports$Blockly$Connection.Connection.prototype.getCheck=function(){return this.check_};module$exports$Blockly$Connection.Connection.prototype.setShadowDom=function(a){this.setShadowStateInternal_({shadowDom:a})};
module$exports$Blockly$Connection.Connection.prototype.getShadowDom=function(a){return a&&this.targetBlock().isShadow()?(0,$.module$exports$Blockly$Xml.blockToDom)(this.targetBlock()):this.shadowDom_};module$exports$Blockly$Connection.Connection.prototype.setShadowState=function(a){this.setShadowStateInternal_({shadowState:a})};
module$exports$Blockly$Connection.Connection.prototype.getShadowState=function(a){return a&&this.targetBlock()&&this.targetBlock().isShadow()?(0,module$exports$Blockly$serialization$blocks.save)(this.targetBlock()):this.shadowState_};module$exports$Blockly$Connection.Connection.prototype.neighbours=function(a){return[]};
module$exports$Blockly$Connection.Connection.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_.inputList,c=0;c<b.length;c++)if(b[c].connection===this){a=b[c];break}return a};
module$exports$Blockly$Connection.Connection.prototype.toString=function(){var a=this.sourceBlock_;if(!a)return"Orphan Connection";if(a.outputConnection===this)var b="Output Connection of ";else if(a.previousConnection===this)b="Previous Connection of ";else if(a.nextConnection===this)b="Next Connection of ";else{b=null;for(var c=0,d;d=a.inputList[c];c++)if(d.connection===this){b=d;break}if(b)b='Input "'+b.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),
"Orphan Connection"}return b+a.toDevString()};module$exports$Blockly$Connection.Connection.prototype.stashShadowState_=function(){var a=this.getShadowDom(!0),b=this.getShadowState(!0);this.shadowState_=this.shadowDom_=null;return{shadowDom:a,shadowState:b}};module$exports$Blockly$Connection.Connection.prototype.applyShadowState_=function(a){var b=a.shadowState;this.shadowDom_=a.shadowDom;this.shadowState_=b};
module$exports$Blockly$Connection.Connection.prototype.setShadowStateInternal_=function(a){a=void 0===a?{}:a;var b=void 0===a.shadowState?null:a.shadowState;this.shadowDom_=void 0===a.shadowDom?null:a.shadowDom;this.shadowState_=b;(a=this.targetBlock())?a.isShadow()?(a.dispose(!1),this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow_(this.targetBlock())):(a=this.createShadowBlock_(!1),this.serializeShadow_(a),a&&a.dispose(!1)):(this.respawnShadow_(),this.targetBlock()&&
this.targetBlock().isShadow()&&this.serializeShadow_(this.targetBlock()))};
module$exports$Blockly$Connection.Connection.prototype.createShadowBlock_=function(a){var b=this.getSourceBlock(),c=this.getShadowState(),d=this.getShadowDom();if(!b.workspace||!c&&!d)return null;if(c)return b=(0,module$exports$Blockly$serialization$blocks.appendInternal)(c,b.workspace,{parentConnection:a?this:void 0,isShadow:!0,recordUndo:!1});if(d){b=(0,$.module$exports$Blockly$Xml.domToBlock)(d,b.workspace);if(a)if(this.type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE){if(!b.outputConnection)throw Error("Shadow block is missing an output connection");
if(!this.connect(b.outputConnection))throw Error("Could not connect shadow block to connection");}else if(this.type===$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT){if(!b.previousConnection)throw Error("Shadow block is missing previous connection");if(!this.connect(b.previousConnection))throw Error("Could not connect shadow block to connection");}else throw Error("Cannot connect a shadow block to a previous/output connection");return b}return null};
module$exports$Blockly$Connection.Connection.prototype.serializeShadow_=function(a){a&&(this.shadowDom_=(0,$.module$exports$Blockly$Xml.blockToDom)(a),this.shadowState_=(0,module$exports$Blockly$serialization$blocks.save)(a))};
module$exports$Blockly$Connection.Connection.getConnectionForOrphanedConnection=function(a,b){if(b.type===$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE)return module$contents$Blockly$Connection_getConnectionForOrphanedOutput(a,b.getSourceBlock());a=a.lastConnectionInStack(!0);var c=b.getConnectionChecker();return a&&c.canConnect(b,a,!1)?a:null};module$exports$Blockly$Connection.Connection.CAN_CONNECT=0;module$exports$Blockly$Connection.Connection.REASON_SELF_CONNECTION=1;
module$exports$Blockly$Connection.Connection.REASON_WRONG_TYPE=2;module$exports$Blockly$Connection.Connection.REASON_TARGET_NULL=3;module$exports$Blockly$Connection.Connection.REASON_CHECKS_FAILED=4;module$exports$Blockly$Connection.Connection.REASON_DIFFERENT_WORKSPACES=5;module$exports$Blockly$Connection.Connection.REASON_SHADOW_PARENT=6;module$exports$Blockly$Connection.Connection.REASON_DRAG_CHECKS_FAILED=7;module$exports$Blockly$Connection.Connection.REASON_PREVIOUS_AND_OUTPUT=8;
var module$contents$Blockly$Connection_connectReciprocally=function(a,b){if(!a||!b)throw Error("Cannot connect null connections.");a.targetConnection=b;b.targetConnection=a},module$contents$Blockly$Connection_getSingleConnection=function(a,b){var c=null;b=b.outputConnection;for(var d=b.getConnectionChecker(),e=0,f;f=a.inputList[e];e++)if((f=f.connection)&&d.canConnect(b,f,!1)){if(c)return null;c=f}return c},module$contents$Blockly$Connection_getConnectionForOrphanedOutput=function(a,b){for(var c;c=
module$contents$Blockly$Connection_getSingleConnection(a,b);)if(a=c.targetBlock(),!a||a.isShadow())return c;return null};var module$exports$Blockly$IConnectionChecker={IConnectionChecker:function(){}};var module$exports$Blockly$ConnectionChecker={ConnectionChecker:function(){}};module$exports$Blockly$ConnectionChecker.ConnectionChecker.prototype.canConnect=function(a,b,c,d){return this.canConnectWithReason(a,b,c,d)===module$exports$Blockly$Connection.Connection.CAN_CONNECT};
module$exports$Blockly$ConnectionChecker.ConnectionChecker.prototype.canConnectWithReason=function(a,b,c,d){var e=this.doSafetyChecks(a,b);return e!==module$exports$Blockly$Connection.Connection.CAN_CONNECT?e:this.doTypeChecks(a,b)?c&&!this.doDragChecks(a,b,d||0)?module$exports$Blockly$Connection.Connection.REASON_DRAG_CHECKS_FAILED:module$exports$Blockly$Connection.Connection.CAN_CONNECT:module$exports$Blockly$Connection.Connection.REASON_CHECKS_FAILED};
module$exports$Blockly$ConnectionChecker.ConnectionChecker.prototype.getErrorMessage=function(a,b,c){switch(a){case module$exports$Blockly$Connection.Connection.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case module$exports$Blockly$Connection.Connection.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case module$exports$Blockly$Connection.Connection.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case module$exports$Blockly$Connection.Connection.REASON_TARGET_NULL:return"Target connection is null.";
case module$exports$Blockly$Connection.Connection.REASON_CHECKS_FAILED:return"Connection checks failed. "+(b+" expected "+b.getCheck()+", found "+c.getCheck());case module$exports$Blockly$Connection.Connection.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case module$exports$Blockly$Connection.Connection.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case module$exports$Blockly$Connection.Connection.REASON_PREVIOUS_AND_OUTPUT:return"Block would have an output and a previous connection.";
default:return"Unknown connection failure: this should never happen!"}};
module$exports$Blockly$ConnectionChecker.ConnectionChecker.prototype.doSafetyChecks=function(a,b){if(!a||!b)return module$exports$Blockly$Connection.Connection.REASON_TARGET_NULL;if(a.isSuperior()){var c=a.getSourceBlock();var d=b.getSourceBlock();var e=b}else d=a.getSourceBlock(),c=b.getSourceBlock(),e=a,a=b;return c===d?module$exports$Blockly$Connection.Connection.REASON_SELF_CONNECTION:e.type!==module$exports$Blockly$internalConstants.OPPOSITE_TYPE[a.type]?module$exports$Blockly$Connection.Connection.REASON_WRONG_TYPE:
c.workspace!==d.workspace?module$exports$Blockly$Connection.Connection.REASON_DIFFERENT_WORKSPACES:c.isShadow()&&!d.isShadow()?module$exports$Blockly$Connection.Connection.REASON_SHADOW_PARENT:e.type===$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE&&d.previousConnection&&d.previousConnection.isConnected()||e.type===$.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT&&d.outputConnection&&d.outputConnection.isConnected()?module$exports$Blockly$Connection.Connection.REASON_PREVIOUS_AND_OUTPUT:
module$exports$Blockly$Connection.Connection.CAN_CONNECT};module$exports$Blockly$ConnectionChecker.ConnectionChecker.prototype.doTypeChecks=function(a,b){a=a.getCheck();b=b.getCheck();if(!a||!b)return!0;for(var c=0;c<a.length;c++)if(-1!==b.indexOf(a[c]))return!0;return!1};
module$exports$Blockly$ConnectionChecker.ConnectionChecker.prototype.doDragChecks=function(a,b,c){if(a.distanceFrom(b)>c||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.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.ConnectionChecker);var module$exports$Blockly$Workspace={},module$contents$Blockly$Workspace_WorkspaceDB_=Object.create(null);
module$exports$Blockly$Workspace.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.Options({});this.RTL=!!this.options.RTL;this.horizontalLayout=!!this.options.horizontalLayout;this.toolboxPosition=this.options.toolboxPosition;this.isClearing=this.isMutator=this.isFlyout=this.rendered=!1;this.MAX_UNDO=1024;this.connectionDBList=null;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.VariableMap(this);this.potentialVariableMap_=null};
module$exports$Blockly$Workspace.Workspace.prototype.dispose=function(){this.listeners_.length=0;this.clear();delete module$contents$Blockly$Workspace_WorkspaceDB_[this.id]};module$exports$Blockly$Workspace.Workspace.prototype.sortObjects_=function(a,b){a=a.getRelativeToSurfaceXY();b=b.getRelativeToSurfaceXY();return a.y+module$exports$Blockly$Workspace.Workspace.prototype.sortObjects_.offset*a.x-(b.y+module$exports$Blockly$Workspace.Workspace.prototype.sortObjects_.offset*b.x)};
module$exports$Blockly$Workspace.Workspace.prototype.addTopBlock=function(a){this.topBlocks_.push(a)};module$exports$Blockly$Workspace.Workspace.prototype.removeTopBlock=function(a){if(!(0,module$exports$Blockly$utils$array.removeElem)(this.topBlocks_,a))throw Error("Block not present in workspace's list of top-most blocks.");};
module$exports$Blockly$Workspace.Workspace.prototype.getTopBlocks=function(a){var b=[].concat(this.topBlocks_);a&&1<b.length&&(this.sortObjects_.offset=Math.sin((0,module$exports$Blockly$utils$math.toRadians)(module$exports$Blockly$Workspace.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),b.sort(this.sortObjects_));return b};module$exports$Blockly$Workspace.Workspace.prototype.addTypedBlock=function(a){this.typedBlocksDB_[a.type]||(this.typedBlocksDB_[a.type]=[]);this.typedBlocksDB_[a.type].push(a)};
module$exports$Blockly$Workspace.Workspace.prototype.removeTypedBlock=function(a){(0,module$exports$Blockly$utils$array.removeElem)(this.typedBlocksDB_[a.type],a);this.typedBlocksDB_[a.type].length||delete this.typedBlocksDB_[a.type]};
module$exports$Blockly$Workspace.Workspace.prototype.getBlocksByType=function(a,b){if(!this.typedBlocksDB_[a])return[];a=this.typedBlocksDB_[a].slice(0);b&&1<a.length&&(this.sortObjects_.offset=Math.sin((0,module$exports$Blockly$utils$math.toRadians)(module$exports$Blockly$Workspace.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),a.sort(this.sortObjects_));return a.filter(function(c){return!c.isInsertionMarker()})};
module$exports$Blockly$Workspace.Workspace.prototype.addTopComment=function(a){this.topComments_.push(a);this.commentDB_[a.id]&&console.warn('Overriding an existing comment on this workspace, with id "'+a.id+'"');this.commentDB_[a.id]=a};module$exports$Blockly$Workspace.Workspace.prototype.removeTopComment=function(a){if(!(0,module$exports$Blockly$utils$array.removeElem)(this.topComments_,a))throw Error("Comment not present in workspace's list of top-most comments.");delete this.commentDB_[a.id]};
module$exports$Blockly$Workspace.Workspace.prototype.getTopComments=function(a){var b=[].concat(this.topComments_);a&&1<b.length&&(this.sortObjects_.offset=Math.sin((0,module$exports$Blockly$utils$math.toRadians)(module$exports$Blockly$Workspace.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),b.sort(this.sortObjects_));return b};
module$exports$Blockly$Workspace.Workspace.prototype.getAllBlocks=function(a){if(a){var b=this.getTopBlocks(!0);a=[];for(var c=0;c<b.length;c++)a.push.apply(a,b[c].getDescendants(!0))}else for(a=this.getTopBlocks(!1),b=0;b<a.length;b++)a.push.apply(a,a[b].getChildren(!1));return a.filter(function(d){return!d.isInsertionMarker()})};
module$exports$Blockly$Workspace.Workspace.prototype.clear=function(){this.isClearing=!0;try{var a=(0,module$exports$Blockly$Events$utils.getGroup)();for(a||(0,module$exports$Blockly$Events$utils.setGroup)(!0);this.topBlocks_.length;)this.topBlocks_[0].dispose(!1);for(;this.topComments_.length;)this.topComments_[this.topComments_.length-1].dispose();a||(0,module$exports$Blockly$Events$utils.setGroup)(!1);this.variableMap_.clear();this.potentialVariableMap_&&this.potentialVariableMap_.clear()}finally{this.isClearing=
!1}};module$exports$Blockly$Workspace.Workspace.prototype.renameVariableById=function(a,b){this.variableMap_.renameVariableById(a,b)};module$exports$Blockly$Workspace.Workspace.prototype.createVariable=function(a,b,c){return this.variableMap_.createVariable(a,b,c)};module$exports$Blockly$Workspace.Workspace.prototype.getVariableUsesById=function(a){return this.variableMap_.getVariableUsesById(a)};module$exports$Blockly$Workspace.Workspace.prototype.deleteVariableById=function(a){this.variableMap_.deleteVariableById(a)};
module$exports$Blockly$Workspace.Workspace.prototype.getVariable=function(a,b){return this.variableMap_.getVariable(a,b)};module$exports$Blockly$Workspace.Workspace.prototype.getVariableById=function(a){return this.variableMap_.getVariableById(a)};module$exports$Blockly$Workspace.Workspace.prototype.getVariablesOfType=function(a){return this.variableMap_.getVariablesOfType(a)};module$exports$Blockly$Workspace.Workspace.prototype.getVariableTypes=function(){return this.variableMap_.getVariableTypes(this)};
module$exports$Blockly$Workspace.Workspace.prototype.getAllVariables=function(){return this.variableMap_.getAllVariables()};module$exports$Blockly$Workspace.Workspace.prototype.getAllVariableNames=function(){return this.variableMap_.getAllVariableNames()};module$exports$Blockly$Workspace.Workspace.prototype.getWidth=function(){return 0};module$exports$Blockly$Workspace.Workspace.prototype.newBlock=function(a,b){return new module$exports$Blockly$Block.Block(this,a,b)};
module$exports$Blockly$Workspace.Workspace.prototype.remainingCapacity=function(){return isNaN(this.options.maxBlocks)?Infinity:this.options.maxBlocks-this.getAllBlocks(!1).length};module$exports$Blockly$Workspace.Workspace.prototype.remainingCapacityOfType=function(a){return this.options.maxInstances?(void 0!==this.options.maxInstances[a]?this.options.maxInstances[a]:Infinity)-this.getBlocksByType(a,!1).length:Infinity};
module$exports$Blockly$Workspace.Workspace.prototype.isCapacityAvailable=function(a){if(!this.hasBlockLimits())return!0;var b=0,c;for(c in a){if(a[c]>this.remainingCapacityOfType(c))return!1;b+=a[c]}return b>this.remainingCapacity()?!1:!0};module$exports$Blockly$Workspace.Workspace.prototype.hasBlockLimits=function(){return Infinity!==this.options.maxBlocks||!!this.options.maxInstances};module$exports$Blockly$Workspace.Workspace.prototype.getUndoStack=function(){return this.undoStack_};
module$exports$Blockly$Workspace.Workspace.prototype.getRedoStack=function(){return this.redoStack_};
module$exports$Blockly$Workspace.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;b<e.length;b++)c.push(e[b]);e=(0,module$exports$Blockly$Events$utils.filter)(e,a);(0,module$exports$Blockly$Events$utils.setRecordUndo)(!1);try{for(c=0;c<e.length;c++)e[c].run(a)}finally{(0,module$exports$Blockly$Events$utils.setRecordUndo)(!0)}}};
module$exports$Blockly$Workspace.Workspace.prototype.clearUndo=function(){this.undoStack_.length=0;this.redoStack_.length=0;(0,module$exports$Blockly$Events$utils.clearPendingUndo)()};module$exports$Blockly$Workspace.Workspace.prototype.addChangeListener=function(a){this.listeners_.push(a);return a};module$exports$Blockly$Workspace.Workspace.prototype.removeChangeListener=function(a){(0,module$exports$Blockly$utils$array.removeElem)(this.listeners_,a)};
module$exports$Blockly$Workspace.Workspace.prototype.fireChangeListener=function(a){if(a.recordUndo)for(this.undoStack_.push(a),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(var b=0;b<this.listeners_.length;b++)(0,this.listeners_[b])(a)};module$exports$Blockly$Workspace.Workspace.prototype.getBlockById=function(a){return this.blockDB_[a]||null};
module$exports$Blockly$Workspace.Workspace.prototype.setBlockById=function(a,b){this.blockDB_[a]=b};module$exports$Blockly$Workspace.Workspace.prototype.removeBlockById=function(a){delete this.blockDB_[a]};module$exports$Blockly$Workspace.Workspace.prototype.getCommentById=function(a){return this.commentDB_[a]||null};module$exports$Blockly$Workspace.Workspace.prototype.allInputsFilled=function(a){for(var b=this.getTopBlocks(!1),c=0;c<b.length;c++)if(!b[c].allInputsFilled(a))return!1;return!0};
module$exports$Blockly$Workspace.Workspace.prototype.getPotentialVariableMap=function(){return this.potentialVariableMap_};module$exports$Blockly$Workspace.Workspace.prototype.createPotentialVariableMap=function(){this.potentialVariableMap_=new module$exports$Blockly$VariableMap.VariableMap(this)};module$exports$Blockly$Workspace.Workspace.prototype.getVariableMap=function(){return this.variableMap_};
module$exports$Blockly$Workspace.Workspace.prototype.setVariableMap=function(a){this.variableMap_=a};module$exports$Blockly$Workspace.Workspace.getById=function(a){return module$contents$Blockly$Workspace_WorkspaceDB_[a]||null};module$exports$Blockly$Workspace.Workspace.getAll=function(){var a=[],b;for(b in module$contents$Blockly$Workspace_WorkspaceDB_)a.push(module$contents$Blockly$Workspace_WorkspaceDB_[b]);return a};module$exports$Blockly$Workspace.Workspace.SCAN_ANGLE=3;var module$exports$Blockly$Bubble={Bubble:function(a,b,c,d,e,f){this.workspace_=a;this.content_=b;this.shape_=c;this.rendered_=!1;this.anchorXY_=this.resizeGroup_=this.bubbleBack_=this.bubbleArrow_=this.bubbleGroup_=null;this.height_=this.width_=this.relativeTop_=this.relativeLeft_=0;this.autoLayout_=!0;this.onMouseDownResizeWrapper_=this.onMouseDownBubbleWrapper_=this.moveCallback_=this.resizeCallback_=null;this.disposed=!1;c=module$exports$Blockly$Bubble.Bubble.ARROW_ANGLE;this.workspace_.RTL&&
(c=-c);this.arrow_radians_=(0,module$exports$Blockly$utils$math.toRadians)(c);a.getBubbleCanvas().appendChild(this.createDom_(b,!(!e||!f)));this.setAnchorLocation(d);e&&f||(a=this.content_.getBBox(),e=a.width+2*module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH,f=a.height+2*module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH);this.setBubbleSize(e,f);this.positionBubble_();this.renderArrow_();this.rendered_=!0}};
module$exports$Blockly$Bubble.Bubble.prototype.createDom_=function(a,b){this.bubbleGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{},null);var c={filter:"url(#"+this.workspace_.getRenderer().getConstants().embossFilterId+")"};module$exports$Blockly$utils$userAgent.JAVA_FX&&(c={});c=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,c,this.bubbleGroup_);this.bubbleArrow_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,
{},c);this.bubbleBack_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{"class":"blocklyDraggable",x:0,y:0,rx:module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH,ry:module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH},c);b?(this.resizeGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":this.workspace_.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.bubbleGroup_),b=2*module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH,
(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.POLYGON,{points:"0,x x,x x,0".replace(/x/g,b.toString())},this.resizeGroup_),(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.LINE,{"class":"blocklyResizeLine",x1:b/3,y1:b-1,x2:b-1,y2:b/3},this.resizeGroup_),(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.LINE,{"class":"blocklyResizeLine",x1:2*b/3,y1:b-1,x2:b-1,y2:2*b/3},this.resizeGroup_)):
this.resizeGroup_=null;this.workspace_.options.readOnly||(this.onMouseDownBubbleWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.bubbleBack_,"mousedown",this,this.bubbleMouseDown_),this.resizeGroup_&&(this.onMouseDownResizeWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_)));this.bubbleGroup_.appendChild(a);return this.bubbleGroup_};module$exports$Blockly$Bubble.Bubble.prototype.getSvgRoot=function(){return this.bubbleGroup_};
module$exports$Blockly$Bubble.Bubble.prototype.setSvgId=function(a){this.bubbleGroup_.dataset&&(this.bubbleGroup_.dataset.blockId=a)};module$exports$Blockly$Bubble.Bubble.prototype.bubbleMouseDown_=function(a){var b=this.workspace_.getGesture(a);b&&b.handleBubbleStart(a,this)};module$exports$Blockly$Bubble.Bubble.prototype.showContextMenu=function(a){};module$exports$Blockly$Bubble.Bubble.prototype.isDeletable=function(){return!1};module$exports$Blockly$Bubble.Bubble.prototype.setDeleteStyle=function(a){};
module$exports$Blockly$Bubble.Bubble.prototype.resizeMouseDown_=function(a){this.promote();module$exports$Blockly$Bubble.Bubble.unbindDragEvents_();(0,module$exports$Blockly$browserEvents.isRightButton)(a)||(this.workspace_.startDrag(a,new module$exports$Blockly$utils$Coordinate.Coordinate(this.workspace_.RTL?-this.width_:this.width_,this.height_)),module$exports$Blockly$Bubble.Bubble.onMouseUpWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mouseup",this,module$exports$Blockly$Bubble.Bubble.bubbleMouseUp_),
module$exports$Blockly$Bubble.Bubble.onMouseMoveWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mousemove",this,this.resizeMouseMove_),this.workspace_.hideChaff());a.stopPropagation()};module$exports$Blockly$Bubble.Bubble.prototype.resizeMouseMove_=function(a){this.autoLayout_=!1;a=this.workspace_.moveDrag(a);this.setBubbleSize(this.workspace_.RTL?-a.x:a.x,a.y);this.workspace_.RTL&&this.positionBubble_()};
module$exports$Blockly$Bubble.Bubble.prototype.registerResizeEvent=function(a){this.resizeCallback_=a};module$exports$Blockly$Bubble.Bubble.prototype.registerMoveEvent=function(a){this.moveCallback_=a};module$exports$Blockly$Bubble.Bubble.prototype.promote=function(){var a=this.bubbleGroup_.parentNode;return a.lastChild!==this.bubbleGroup_?(a.appendChild(this.bubbleGroup_),!0):!1};module$exports$Blockly$Bubble.Bubble.prototype.setAnchorLocation=function(a){this.anchorXY_=a;this.rendered_&&this.positionBubble_()};
module$exports$Blockly$Bubble.Bubble.prototype.layoutBubble_=function(){var a=this.workspace_.getMetricsManager().getViewMetrics(!0),b=this.getOptimalRelativeLeft_(a),c=this.getOptimalRelativeTop_(a),d=this.shape_.getBBox(),e={x:b,y:-this.height_-this.workspace_.getRenderer().getConstants().MIN_BLOCK_HEIGHT},f={x:-this.width_-30,y:c};c={x:d.width,y:c};var g={x:b,y:d.height};b=d.width<d.height?c:g;d=d.width<d.height?g:c;c=this.getOverlap_(e,a);g=this.getOverlap_(f,a);var h=this.getOverlap_(b,a);a=
this.getOverlap_(d,a);a=Math.max(c,g,h,a);c===a?(this.relativeLeft_=e.x,this.relativeTop_=e.y):g===a?(this.relativeLeft_=f.x,this.relativeTop_=f.y):h===a?(this.relativeLeft_=b.x,this.relativeTop_=b.y):(this.relativeLeft_=d.x,this.relativeTop_=d.y)};
module$exports$Blockly$Bubble.Bubble.prototype.getOverlap_=function(a,b){var c=this.workspace_.RTL?this.anchorXY_.x-a.x-this.width_:a.x+this.anchorXY_.x;a=a.y+this.anchorXY_.y;return Math.max(0,Math.min(1,(Math.min(c+this.width_,b.left+b.width)-Math.max(c,b.left))*(Math.min(a+this.height_,b.top+b.height)-Math.max(a,b.top))/(this.width_*this.height_)))};
module$exports$Blockly$Bubble.Bubble.prototype.getOptimalRelativeLeft_=function(a){var b=-this.width_/4;if(this.width_>a.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.Scrollbar.scrollbarThickness/this.workspace_.scale;c-this.width_<a?b=-(a-this.anchorXY_.x+this.width_):c>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.Scrollbar.scrollbarThickness/
this.workspace_.scale;c<e?b=e-this.anchorXY_.x:d>a&&(b=a-this.anchorXY_.x-this.width_)}return b};module$exports$Blockly$Bubble.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.Scrollbar.scrollbarThickness/this.workspace_.scale;var f=this.anchorXY_.y;c<e?b=e-f:d>a&&(b=a-f-this.height_);return b};
module$exports$Blockly$Bubble.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.Bubble.prototype.moveTo=function(a,b){this.bubbleGroup_.setAttribute("transform","translate("+a+","+b+")")};module$exports$Blockly$Bubble.Bubble.prototype.setDragging=function(a){!a&&this.moveCallback_&&this.moveCallback_()};
module$exports$Blockly$Bubble.Bubble.prototype.getBubbleSize=function(){return new module$exports$Blockly$utils$Size.Size(this.width_,this.height_)};
module$exports$Blockly$Bubble.Bubble.prototype.setBubbleSize=function(a,b){var c=2*module$exports$Blockly$Bubble.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.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.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.Bubble.ARROW_THICKNESS;h=Math.min(h,m.width,m.height)/
4;m=1-module$exports$Blockly$Bubble.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.Bubble.ARROW_BEND;f=Math.cos(k)*f/module$exports$Blockly$Bubble.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.Bubble.prototype.setColour=function(a){this.bubbleBack_.setAttribute("fill",a);this.bubbleArrow_.setAttribute("fill",a)};
module$exports$Blockly$Bubble.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.Bubble.unbindDragEvents_();(0,module$exports$Blockly$utils$dom.removeNode)(this.bubbleGroup_);this.disposed=!0};
module$exports$Blockly$Bubble.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.Bubble.prototype.getRelativeToSurfaceXY=function(){return new module$exports$Blockly$utils$Coordinate.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.Bubble.prototype.setAutoLayout=function(a){this.autoLayout_=a};
module$exports$Blockly$Bubble.Bubble.unbindDragEvents_=function(){module$exports$Blockly$Bubble.Bubble.onMouseUpWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(module$exports$Blockly$Bubble.Bubble.onMouseUpWrapper_),module$exports$Blockly$Bubble.Bubble.onMouseUpWrapper_=null);module$exports$Blockly$Bubble.Bubble.onMouseMoveWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(module$exports$Blockly$Bubble.Bubble.onMouseMoveWrapper_),module$exports$Blockly$Bubble.Bubble.onMouseMoveWrapper_=
null)};module$exports$Blockly$Bubble.Bubble.bubbleMouseUp_=function(a){(0,module$exports$Blockly$Touch.clearTouchIdentifier)();module$exports$Blockly$Bubble.Bubble.unbindDragEvents_()};
module$exports$Blockly$Bubble.Bubble.textToDom=function(a){var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.TEXT,{"class":"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH},null);a=a.split("\n");for(var c=0;c<a.length;c++){var d=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.TSPAN,{dy:"1em",x:module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH},b),e=document.createTextNode(a[c]);
d.appendChild(e)}return b};module$exports$Blockly$Bubble.Bubble.createNonEditableBubble=function(a,b,c){c=new module$exports$Blockly$Bubble.Bubble(b.workspace,a,b.pathObject.svgPath,c,null,null);c.setSvgId(b.id);if(b.RTL){b=a.getBBox().width;for(var d=0,e;e=a.childNodes[d];d++)e.setAttribute("text-anchor","end"),e.setAttribute("x",b+module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH)}return c};module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH=6;
module$exports$Blockly$Bubble.Bubble.ARROW_THICKNESS=5;module$exports$Blockly$Bubble.Bubble.ARROW_ANGLE=20;module$exports$Blockly$Bubble.Bubble.ARROW_BEND=4;module$exports$Blockly$Bubble.Bubble.ANCHOR_RADIUS=8;module$exports$Blockly$Bubble.Bubble.onMouseUpWrapper_=null;module$exports$Blockly$Bubble.Bubble.onMouseMoveWrapper_=null;var module$exports$Blockly$Events$CommentBase={CommentBase:function(a){module$exports$Blockly$Events$Abstract.Abstract.call(this);this.commentId=(this.isBlank="undefined"===typeof a)?"":a.id;this.workspaceId=this.isBlank?"":a.workspace.id;this.group=(0,module$exports$Blockly$Events$utils.getGroup)();this.recordUndo=(0,module$exports$Blockly$Events$utils.getRecordUndo)()}};$.$jscomp.inherits(module$exports$Blockly$Events$CommentBase.CommentBase,module$exports$Blockly$Events$Abstract.Abstract);
module$exports$Blockly$Events$CommentBase.CommentBase.prototype.toJson=function(){var a=module$exports$Blockly$Events$Abstract.Abstract.prototype.toJson.call(this);this.commentId&&(a.commentId=this.commentId);return a};module$exports$Blockly$Events$CommentBase.CommentBase.prototype.fromJson=function(a){module$exports$Blockly$Events$Abstract.Abstract.prototype.fromJson.call(this,a);this.commentId=a.commentId};
module$exports$Blockly$Events$CommentBase.CommentBase.CommentCreateDeleteHelper=function(a,b){var c=a.getEventWorkspace_();b?(b=(0,$.module$exports$Blockly$utils$xml.createElement)("xml"),b.appendChild(a.xml),(0,$.module$exports$Blockly$Xml.domToWorkspace)(b,c)):(c=c.getCommentById(a.commentId))?c.dispose():console.warn("Can't uncreate non-existent comment: "+a.commentId)};var module$exports$Blockly$Events$CommentMove={CommentMove:function(a){module$exports$Blockly$Events$CommentBase.CommentBase.call(this,a);this.type=module$exports$Blockly$Events$utils.COMMENT_MOVE;a&&(this.comment_=a,this.oldCoordinate_=a.getXY(),this.newCoordinate_=null)}};$.$jscomp.inherits(module$exports$Blockly$Events$CommentMove.CommentMove,module$exports$Blockly$Events$CommentBase.CommentBase);
module$exports$Blockly$Events$CommentMove.CommentMove.prototype.recordNew=function(){if(!this.comment_)throw Error("Tried to record the new position of a comment on the same event twice.");this.newCoordinate_=this.comment_.getXY();this.comment_=null};module$exports$Blockly$Events$CommentMove.CommentMove.prototype.setOldCoordinate=function(a){this.oldCoordinate_=a};
module$exports$Blockly$Events$CommentMove.CommentMove.prototype.toJson=function(){var a=module$exports$Blockly$Events$CommentBase.CommentBase.prototype.toJson.call(this);this.oldCoordinate_&&(a.oldCoordinate=Math.round(this.oldCoordinate_.x)+","+Math.round(this.oldCoordinate_.y));this.newCoordinate_&&(a.newCoordinate=Math.round(this.newCoordinate_.x)+","+Math.round(this.newCoordinate_.y));return a};
module$exports$Blockly$Events$CommentMove.CommentMove.prototype.fromJson=function(a){module$exports$Blockly$Events$CommentBase.CommentBase.prototype.fromJson.call(this,a);if(a.oldCoordinate){var b=a.oldCoordinate.split(",");this.oldCoordinate_=new module$exports$Blockly$utils$Coordinate.Coordinate(Number(b[0]),Number(b[1]))}a.newCoordinate&&(a=a.newCoordinate.split(","),this.newCoordinate_=new module$exports$Blockly$utils$Coordinate.Coordinate(Number(a[0]),Number(a[1])))};
module$exports$Blockly$Events$CommentMove.CommentMove.prototype.isNull=function(){return module$exports$Blockly$utils$Coordinate.Coordinate.equals(this.oldCoordinate_,this.newCoordinate_)};module$exports$Blockly$Events$CommentMove.CommentMove.prototype.run=function(a){var b=this.getEventWorkspace_().getCommentById(this.commentId);if(b){a=a?this.newCoordinate_:this.oldCoordinate_;var c=b.getXY();b.moveBy(a.x-c.x,a.y-c.y)}else console.warn("Can't move non-existent comment: "+this.commentId)};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.COMMENT_MOVE,module$exports$Blockly$Events$CommentMove.CommentMove);var module$exports$Blockly$BubbleDragger={BubbleDragger:function(a,b){this.draggingBubble_=a;this.workspace_=b;this.dragTarget_=null;this.wouldDeleteBubble_=!1;this.startXY_=this.draggingBubble_.getRelativeToSurfaceXY();this.dragSurface_=(0,module$exports$Blockly$utils$svgMath.is3dSupported)()&&b.getBlockDragSurface()?b.getBlockDragSurface():null}};module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.dispose=function(){this.dragSurface_=this.workspace_=this.draggingBubble_=null};
module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.startBubbleDrag=function(){(0,module$exports$Blockly$Events$utils.getGroup)()||(0,module$exports$Blockly$Events$utils.setGroup)(!0);this.workspace_.setResizesEnabled(!1);this.draggingBubble_.setAutoLayout(!1);this.dragSurface_&&this.moveToDragSurface_();this.draggingBubble_.setDragging&&this.draggingBubble_.setDragging(!0)};
module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.dragBubble=function(a,b){b=this.pixelsToWorkspaceUnits_(b);b=module$exports$Blockly$utils$Coordinate.Coordinate.sum(this.startXY_,b);this.draggingBubble_.moveDuringDrag(this.dragSurface_,b);b=this.dragTarget_;this.dragTarget_=this.workspace_.getDragTarget(a);a=this.wouldDeleteBubble_;this.wouldDeleteBubble_=this.shouldDelete_(this.dragTarget_);a!==this.wouldDeleteBubble_&&this.updateCursorDuringBubbleDrag_();this.dragTarget_!==b&&(b&&b.onDragExit(this.draggingBubble_),
this.dragTarget_&&this.dragTarget_.onDragEnter(this.draggingBubble_));this.dragTarget_&&this.dragTarget_.onDragOver(this.draggingBubble_)};module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.shouldDelete_=function(a){return a&&this.workspace_.getComponentManager().hasCapability(a.id,module$exports$Blockly$ComponentManager.ComponentManager.Capability.DELETE_AREA)?a.wouldDelete(this.draggingBubble_,!1):!1};
module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.updateCursorDuringBubbleDrag_=function(){this.draggingBubble_.setDeleteStyle(this.wouldDeleteBubble_)};
module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.endBubbleDrag=function(a,b){this.dragBubble(a,b);this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBubble_)?a=this.startXY_:(a=this.pixelsToWorkspaceUnits_(b),a=module$exports$Blockly$utils$Coordinate.Coordinate.sum(this.startXY_,a));this.draggingBubble_.moveTo(a.x,a.y);if(this.dragTarget_)this.dragTarget_.onDrop(this.draggingBubble_);this.wouldDeleteBubble_?(this.fireMoveEvent_(),this.draggingBubble_.dispose(!1,!0)):(this.dragSurface_&&
this.dragSurface_.clearAndHide(this.workspace_.getBubbleCanvas()),this.draggingBubble_.setDragging&&this.draggingBubble_.setDragging(!1),this.fireMoveEvent_());this.workspace_.setResizesEnabled(!0);(0,module$exports$Blockly$Events$utils.setGroup)(!1)};
module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.fireMoveEvent_=function(){if(this.draggingBubble_.isComment){var a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.COMMENT_MOVE))(this.draggingBubble_);a.setOldCoordinate(this.startXY_);a.recordNew();(0,module$exports$Blockly$Events$utils.fire)(a)}};
module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.pixelsToWorkspaceUnits_=function(a){a=new module$exports$Blockly$utils$Coordinate.Coordinate(a.x/this.workspace_.scale,a.y/this.workspace_.scale);this.workspace_.isMutator&&a.scale(1/this.workspace_.options.parentWorkspace.scale);return a};module$exports$Blockly$BubbleDragger.BubbleDragger.prototype.moveToDragSurface_=function(){this.draggingBubble_.moveTo(0,0);this.dragSurface_.translateSurface(this.startXY_.x,this.startXY_.y);this.dragSurface_.setBlocksAndShow(this.draggingBubble_.getSvgRoot())};var module$exports$Blockly$WorkspaceDragger={WorkspaceDragger:function(a){this.workspace_=a;this.horizontalScrollEnabled_=this.workspace_.isMovableHorizontally();this.verticalScrollEnabled_=this.workspace_.isMovableVertically();this.startScrollXY_=new module$exports$Blockly$utils$Coordinate.Coordinate(a.scrollX,a.scrollY)}};module$exports$Blockly$WorkspaceDragger.WorkspaceDragger.prototype.dispose=function(){this.workspace_=null};
module$exports$Blockly$WorkspaceDragger.WorkspaceDragger.prototype.startDrag=function(){(0,$.module$exports$Blockly$common.getSelected)()&&(0,$.module$exports$Blockly$common.getSelected)().unselect();this.workspace_.setupDragSurface()};module$exports$Blockly$WorkspaceDragger.WorkspaceDragger.prototype.endDrag=function(a){this.drag(a);this.workspace_.resetDragSurface()};
module$exports$Blockly$WorkspaceDragger.WorkspaceDragger.prototype.drag=function(a){a=module$exports$Blockly$utils$Coordinate.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$IBlockDragger={IBlockDragger:function(){}};var module$exports$Blockly$InsertionMarkerManager={},module$contents$Blockly$InsertionMarkerManager_DUPLICATE_BLOCK_ERROR="The insertion marker manager tried to create a marker but the result is missing %1. If you are using a mutator, make sure your domToMutation method is properly defined.";
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager=function(a){(0,$.module$exports$Blockly$common.setSelected)(a);this.topBlock_=a;this.workspace_=a.workspace;this.lastMarker_=this.lastOnStack_=null;this.firstMarker_=this.createMarkerBlock_(this.topBlock_);this.localConnection_=this.closestConnection_=null;this.wouldDeleteBlock_=!1;this.fadedBlock_=this.highlightedBlock_=this.markerConnection_=null;this.availableConnections_=this.initAvailableConnections_()};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.dispose=function(){this.availableConnections_.length=0;(0,module$exports$Blockly$Events$utils.disable)();try{this.firstMarker_&&this.firstMarker_.dispose(),this.lastMarker_&&this.lastMarker_.dispose()}finally{(0,module$exports$Blockly$Events$utils.enable)()}};module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.updateAvailableConnections=function(){this.availableConnections_=this.initAvailableConnections_()};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.wouldDeleteBlock=function(){return this.wouldDeleteBlock_};module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.wouldConnectBlock=function(){return!!this.closestConnection_};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.applyConnections=function(){if(this.closestConnection_&&((0,module$exports$Blockly$Events$utils.disable)(),this.hidePreview_(),(0,module$exports$Blockly$Events$utils.enable)(),this.localConnection_.connect(this.closestConnection_),this.topBlock_.rendered)){var a=this.localConnection_.isSuperior()?this.closestConnection_:this.localConnection_;(0,module$exports$Blockly$blockAnimations.connectionUiEffect)(a.getSourceBlock());
this.topBlock_.getRootBlock().bringToFront()}};module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.update=function(a,b){var c=this.getCandidate_(a);if((this.wouldDeleteBlock_=this.shouldDelete_(c,b))||this.shouldUpdatePreviews_(c,a))(0,module$exports$Blockly$Events$utils.disable)(),this.maybeHidePreview_(c),this.maybeShowPreview_(c),(0,module$exports$Blockly$Events$utils.enable)()};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.createMarkerBlock_=function(a){var b=a.type;(0,module$exports$Blockly$Events$utils.disable)();try{var c=this.workspace_.newBlock(b);c.setInsertionMarker(!0);if(a.saveExtraState){var d=a.saveExtraState();d&&c.loadExtraState(d)}else if(a.mutationToDom){var e=a.mutationToDom();e&&c.domToMutation(e)}for(b=0;b<a.inputList.length;b++){var f=a.inputList[b];if(f.name!==module$exports$Blockly$constants.COLLAPSED_INPUT_NAME){var g=
c.inputList[b];if(!g)throw Error(module$contents$Blockly$InsertionMarkerManager_DUPLICATE_BLOCK_ERROR.replace("%1","an input"));for(d=0;d<f.fieldRow.length;d++){var h=f.fieldRow[d],k=g.fieldRow[d];if(!k)throw Error(module$contents$Blockly$InsertionMarkerManager_DUPLICATE_BLOCK_ERROR.replace("%1","a field"));k.setValue(h.getValue())}}}c.setCollapsed(a.isCollapsed());c.setInputsInline(a.getInputsInline());c.initSvg();c.getSvgRoot().setAttribute("visibility","hidden")}finally{(0,module$exports$Blockly$Events$utils.enable)()}return c};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.initAvailableConnections_=function(){var a=this.topBlock_.getConnections_(!1),b=this.topBlock_.lastConnectionInStack(!0);if(b&&b!==this.topBlock_.nextConnection){a.push(b);this.lastOnStack_=b;if(this.lastMarker_){(0,module$exports$Blockly$Events$utils.disable)();try{this.lastMarker_.dispose()}finally{(0,module$exports$Blockly$Events$utils.enable)()}}this.lastMarker_=this.createMarkerBlock_(b.getSourceBlock())}return a};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.shouldUpdatePreviews_=function(a,b){var c=a.local,d=a.closest;a=a.radius;if(c&&d){if(this.localConnection_&&this.closestConnection_){if(this.closestConnection_===d&&this.localConnection_===c)return!1;c=this.localConnection_.x+b.x-this.closestConnection_.x;b=this.localConnection_.y+b.y-this.closestConnection_.y;b=Math.sqrt(c*c+b*b);return!(d&&a>b-$.module$exports$Blockly$config.config.currentConnectionPreference)}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.InsertionMarkerManager.prototype.getCandidate_=function(a){var b=this.getStartRadius_(),c=null,d=null;this.markerConnection_&&this.markerConnection_.isConnected()||this.updateAvailableConnections();for(var e=0;e<this.availableConnections_.length;e++){var f=this.availableConnections_[e],g=f.closest(b,a);g.connection&&(c=g.connection,d=f,b=g.radius)}return{closest:c,local:d,radius:b}};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.getStartRadius_=function(){return this.closestConnection_&&this.localConnection_?$.module$exports$Blockly$config.config.connectingSnapRadius:$.module$exports$Blockly$config.config.snapRadius};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.shouldDelete_=function(a,b){return b&&this.workspace_.getComponentManager().hasCapability(b.id,module$exports$Blockly$ComponentManager.ComponentManager.Capability.DELETE_AREA)?b.wouldDelete(this.topBlock_,a&&!!a.closest):!1};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.maybeShowPreview_=function(a){if(!this.wouldDeleteBlock_){var b=a.closest;a=a.local;b&&(b===this.closestConnection_||b.getSourceBlock().isInsertionMarker()?console.log("Trying to connect to an insertion marker"):(this.closestConnection_=b,this.localConnection_=a,this.showPreview_()))}};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.showPreview_=function(){var a=this.closestConnection_,b=this.workspace_.getRenderer();switch(b.getConnectionPreviewMethod(a,this.localConnection_,this.topBlock_)){case module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE:this.showInsertionInputOutline_();break;case module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER:this.showInsertionMarker_();
break;case module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE:this.showReplacementFade_()}a&&b.shouldHighlightConnection(a)&&a.highlight()};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.maybeHidePreview_=function(a){if(a.closest){var b=this.closestConnection_!==a.closest;a=this.localConnection_!==a.local;this.closestConnection_&&this.localConnection_&&(b||a||this.wouldDeleteBlock_)&&this.hidePreview_()}else this.hidePreview_();this.localConnection_=this.closestConnection_=this.markerConnection_=null};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.hidePreview_=function(){this.closestConnection_&&this.closestConnection_.targetBlock()&&this.workspace_.getRenderer().shouldHighlightConnection(this.closestConnection_)&&this.closestConnection_.unhighlight();this.fadedBlock_?this.hideReplacementFade_():this.highlightedBlock_?this.hideInsertionInputOutline_():this.markerConnection_&&this.hideInsertionMarker_()};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.showInsertionMarker_=function(){var a=this.localConnection_,b=this.closestConnection_,c=this.lastOnStack_&&a===this.lastOnStack_,d=c?this.lastMarker_:this.firstMarker_;try{var e=d.getMatchingConnection(a.getSourceBlock(),a)}catch(f){this.firstMarker_=this.createMarkerBlock_(this.topBlock_),d=c?this.lastMarker_:this.firstMarker_,e=d.getMatchingConnection(a.getSourceBlock(),a)}if(e===this.markerConnection_)throw Error("Made it to showInsertionMarker_ even though the marker isn't changing");
d.render();d.rendered=!0;d.getSvgRoot().setAttribute("visibility","visible");e&&b&&d.positionNearConnection(e,b);b&&e.connect(b);this.markerConnection_=e};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.hideInsertionMarker_=function(){if(this.markerConnection_){var a=this.markerConnection_,b=a.getSourceBlock(),c=b.nextConnection,d=b.previousConnection,e=b.outputConnection;e=a.type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE&&!(e&&e.targetConnection);!(a!==c||d&&d.targetConnection)||e?a.targetBlock().unplug(!1):a.type===$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT&&a!==
c?(c=a.targetConnection,c.getSourceBlock().unplug(!1),d=d?d.targetConnection:null,b.unplug(!0),d&&d.connect(c)):b.unplug(!0);if(a.targetConnection)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");this.markerConnection_=null;(a=b.getSvgRoot())&&a.setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.showInsertionInputOutline_=function(){var a=this.closestConnection_;this.highlightedBlock_=a.getSourceBlock();this.highlightedBlock_.highlightShapeForInput(a,!0)};module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.hideInsertionInputOutline_=function(){this.highlightedBlock_.highlightShapeForInput(this.closestConnection_,!1);this.highlightedBlock_=null};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.showReplacementFade_=function(){this.fadedBlock_=this.closestConnection_.targetBlock();this.fadedBlock_.fadeForReplacement(!0)};module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.hideReplacementFade_=function(){this.fadedBlock_.fadeForReplacement(!1);this.fadedBlock_=null};
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.prototype.getInsertionMarkers=function(){var a=[];this.firstMarker_&&a.push(this.firstMarker_);this.lastMarker_&&a.push(this.lastMarker_);return a};module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE={INSERTION_MARKER:0,INPUT_OUTLINE:1,REPLACEMENT_FADE:2};var module$exports$Blockly$Events$UiBase={UiBase:function(a){module$exports$Blockly$Events$Abstract.Abstract.call(this);this.isBlank="undefined"===typeof a;this.workspaceId=a?a:"";this.recordUndo=!1;this.isUiEvent=!0}};$.$jscomp.inherits(module$exports$Blockly$Events$UiBase.UiBase,module$exports$Blockly$Events$Abstract.Abstract);var module$exports$Blockly$Events$BlockDrag={BlockDrag:function(a,b,c){module$exports$Blockly$Events$UiBase.UiBase.call(this,a?a.workspace.id:void 0);this.blockId=a?a.id:null;this.isStart=b;this.blocks=c;this.type=module$exports$Blockly$Events$utils.BLOCK_DRAG}};$.$jscomp.inherits(module$exports$Blockly$Events$BlockDrag.BlockDrag,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$BlockDrag.BlockDrag.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.isStart=this.isStart;a.blockId=this.blockId;a.blocks=this.blocks;return a};module$exports$Blockly$Events$BlockDrag.BlockDrag.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.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.BlockDrag);var module$exports$Blockly$BlockDragger={BlockDragger:function(a,b){this.draggingBlock_=a;this.workspace_=b;this.draggedConnectionManager_=new module$exports$Blockly$InsertionMarkerManager.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()};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.startDrag=function(a,b){(0,module$exports$Blockly$Events$utils.getGroup)()||(0,module$exports$Blockly$Events$utils.setGroup)(!0);this.fireDragStartEvent_();this.workspace_.isMutator&&this.draggingBlock_.bringToFront();(0,module$exports$Blockly$utils$dom.startTextWidthCache)();this.workspace_.setResizesEnabled(!1);(0,module$exports$Blockly$blockAnimations.disconnectUiStop)();this.shouldDisconnect_(b)&&this.disconnectBlock_(b,a);this.draggingBlock_.setDragging(!0);
this.draggingBlock_.moveToDragSurface()};module$exports$Blockly$BlockDragger.BlockDragger.prototype.shouldDisconnect_=function(a){return!!(this.draggingBlock_.getParent()||a&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock())};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.disconnectBlock_=function(a,b){this.draggingBlock_.unplug(a);a=this.pixelsToWorkspaceUnits_(b);a=module$exports$Blockly$utils$Coordinate.Coordinate.sum(this.startXY_,a);this.draggingBlock_.translate(a.x,a.y);(0,module$exports$Blockly$blockAnimations.disconnectUiEffect)(this.draggingBlock_);this.draggedConnectionManager_.updateAvailableConnections()};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.fireDragStartEvent_=function(){var a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.BLOCK_DRAG))(this.draggingBlock_,!0,this.draggingBlock_.getDescendants(!1));(0,module$exports$Blockly$Events$utils.fire)(a)};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.drag=function(a,b){b=this.pixelsToWorkspaceUnits_(b);var c=module$exports$Blockly$utils$Coordinate.Coordinate.sum(this.startXY_,b);this.draggingBlock_.moveDuringDrag(c);this.dragIcons_(b);c=this.dragTarget_;this.dragTarget_=this.workspace_.getDragTarget(a);this.draggedConnectionManager_.update(b,this.dragTarget_);a=this.wouldDeleteBlock_;this.wouldDeleteBlock_=this.draggedConnectionManager_.wouldDeleteBlock();a!==this.wouldDeleteBlock_&&this.updateCursorDuringBlockDrag_();
this.dragTarget_!==c&&(c&&c.onDragExit(this.draggingBlock_),this.dragTarget_&&this.dragTarget_.onDragEnter(this.draggingBlock_));this.dragTarget_&&this.dragTarget_.onDragOver(this.draggingBlock_)};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.endDrag=function(a,b){this.drag(a,b);this.dragIconData_=[];this.fireDragEndEvent_();(0,module$exports$Blockly$utils$dom.stopTextWidthCache)();(0,module$exports$Blockly$blockAnimations.disconnectUiStop)();if(this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBlock_))a=this.startXY_;else{a=this.getNewLocationAfterDrag_(b);var c=a.delta;a=a.newLocation}this.draggingBlock_.moveOffDragSurface(a);if(this.dragTarget_)this.dragTarget_.onDrop(this.draggingBlock_);
this.maybeDeleteBlock_()||(this.draggingBlock_.setDragging(!1),c?this.updateBlockAfterMove_(c):(0,module$exports$Blockly$bumpObjects.bumpIntoBounds)(this.draggingBlock_.workspace,this.workspace_.getMetricsManager().getScrollMetrics(!0),this.draggingBlock_));this.workspace_.setResizesEnabled(!0);(0,module$exports$Blockly$Events$utils.setGroup)(!1)};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.getNewLocationAfterDrag_=function(a){var b={};b.delta=this.pixelsToWorkspaceUnits_(a);b.newLocation=module$exports$Blockly$utils$Coordinate.Coordinate.sum(this.startXY_,b.delta);return b};module$exports$Blockly$BlockDragger.BlockDragger.prototype.maybeDeleteBlock_=function(){return this.wouldDeleteBlock_?(this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0),$.module$exports$Blockly$common.draggingConnections.length=0,!0):!1};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.updateBlockAfterMove_=function(a){this.draggingBlock_.moveConnections(a.x,a.y);this.fireMoveEvent_();this.draggedConnectionManager_.wouldConnectBlock()?this.draggedConnectionManager_.applyConnections():this.draggingBlock_.render();this.draggingBlock_.scheduleSnapAndBump()};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.fireDragEndEvent_=function(){var a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.BLOCK_DRAG))(this.draggingBlock_,!1,this.draggingBlock_.getDescendants(!1));(0,module$exports$Blockly$Events$utils.fire)(a)};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.updateToolboxStyle_=function(a){var b=this.workspace_.getToolbox();if(b){var c=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";a&&"function"===typeof b.removeStyle?b.removeStyle(c):a||"function"!==typeof b.addStyle||b.addStyle(c)}};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.fireMoveEvent_=function(){var a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.MOVE))(this.draggingBlock_);a.oldCoordinate=this.startXY_;a.recordNew();(0,module$exports$Blockly$Events$utils.fire)(a)};module$exports$Blockly$BlockDragger.BlockDragger.prototype.updateCursorDuringBlockDrag_=function(){this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_)};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.pixelsToWorkspaceUnits_=function(a){a=new module$exports$Blockly$utils$Coordinate.Coordinate(a.x/this.workspace_.scale,a.y/this.workspace_.scale);this.workspace_.isMutator&&a.scale(1/this.workspace_.options.parentWorkspace.scale);return a};
module$exports$Blockly$BlockDragger.BlockDragger.prototype.dragIcons_=function(a){for(var b=0;b<this.dragIconData_.length;b++){var c=this.dragIconData_[b];c.icon.setIconLocation(module$exports$Blockly$utils$Coordinate.Coordinate.sum(c.location,a))}};module$exports$Blockly$BlockDragger.BlockDragger.prototype.getInsertionMarkers=function(){return this.draggedConnectionManager_&&this.draggedConnectionManager_.getInsertionMarkers?this.draggedConnectionManager_.getInsertionMarkers():[]};
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<d.length;e++){var f={location:d[e].getIconLocation(),icon:d[e]};b.push(f)}}return b};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.BLOCK_DRAGGER,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$BlockDragger.BlockDragger);var module$exports$Blockly$Events$Click={Click:function(a,b,c){b=a?a.workspace.id:b;null===b&&(b=void 0);module$exports$Blockly$Events$UiBase.UiBase.call(this,b);this.blockId=a?a.id:null;this.targetType=c;this.type=module$exports$Blockly$Events$utils.CLICK}};$.$jscomp.inherits(module$exports$Blockly$Events$Click.Click,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$Click.Click.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.targetType=this.targetType;this.blockId&&(a.blockId=this.blockId);return a};module$exports$Blockly$Events$Click.Click.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.fromJson.call(this,a);this.targetType=a.targetType;this.blockId=a.blockId};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.CLICK,module$exports$Blockly$Events$Click.Click);var module$exports$Blockly$Gesture={Gesture:function(a,b){this.mouseDownXY_=null;this.currentDragDeltaXY_=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0);this.startWorkspace_=this.targetBlock_=this.startBlock_=this.startField_=this.startBubble_=null;this.creatorWorkspace_=b;this.isDraggingBubble_=this.isDraggingBlock_=this.isDraggingWorkspace_=this.hasExceededDragRadius_=!1;this.mostRecentEvent_=a;this.flyout_=this.workspaceDragger_=this.blockDragger_=this.bubbleDragger_=this.onUpWrapper_=
this.onMoveWrapper_=null;this.isEnding_=this.hasStarted_=this.calledUpdateIsDragging_=!1;this.healStack_=!module$exports$Blockly$internalConstants.DRAG_STACK}};
module$exports$Blockly$Gesture.Gesture.prototype.dispose=function(){(0,module$exports$Blockly$Touch.clearTouchIdentifier)();(0,module$exports$Blockly$Tooltip.unblock)();this.creatorWorkspace_.clearGesture();this.onMoveWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onMoveWrapper_);this.onUpWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onUpWrapper_);this.blockDragger_&&this.blockDragger_.dispose();this.workspaceDragger_&&this.workspaceDragger_.dispose();this.bubbleDragger_&&
this.bubbleDragger_.dispose()};module$exports$Blockly$Gesture.Gesture.prototype.updateFromEvent_=function(a){var b=new module$exports$Blockly$utils$Coordinate.Coordinate(a.clientX,a.clientY);this.updateDragDelta_(b)&&(this.updateIsDragging_(),(0,module$exports$Blockly$Touch.longStop)());this.mostRecentEvent_=a};
module$exports$Blockly$Gesture.Gesture.prototype.updateDragDelta_=function(a){this.currentDragDeltaXY_=module$exports$Blockly$utils$Coordinate.Coordinate.difference(a,this.mouseDownXY_);return this.hasExceededDragRadius_?!1:this.hasExceededDragRadius_=module$exports$Blockly$utils$Coordinate.Coordinate.magnitude(this.currentDragDeltaXY_)>(this.flyout_?$.module$exports$Blockly$config.config.flyoutDragRadius:$.module$exports$Blockly$config.config.dragRadius)};
module$exports$Blockly$Gesture.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.Gesture.prototype.updateIsDraggingBubble_=function(){if(!this.startBubble_)return!1;this.isDraggingBubble_=!0;this.startDraggingBubble_();return!0};
module$exports$Blockly$Gesture.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.Gesture.prototype.updateIsDraggingWorkspace_=function(){if(this.flyout_?this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())this.workspaceDragger_=new module$exports$Blockly$WorkspaceDragger.WorkspaceDragger(this.startWorkspace_),this.isDraggingWorkspace_=!0,this.workspaceDragger_.startDrag()};
module$exports$Blockly$Gesture.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.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.Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new module$exports$Blockly$BubbleDragger.BubbleDragger(this.startBubble_,this.startWorkspace_);this.bubbleDragger_.startBubbleDrag();this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)};
module$exports$Blockly$Gesture.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.Coordinate(a.clientX,a.clientY),this.healStack_=a.altKey||a.ctrlKey||a.metaKey,this.bindMouseEvents(a)))};
module$exports$Blockly$Gesture.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.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.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.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.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.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.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.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.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.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.Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus();this.startBubble_.select&&this.startBubble_.select()};module$exports$Blockly$Gesture.Gesture.prototype.doFieldClick_=function(){this.startField_.showEditor(this.mostRecentEvent_);this.bringBlockToFront_()};
module$exports$Blockly$Gesture.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.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.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()};
module$exports$Blockly$Gesture.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.Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)};
module$exports$Blockly$Gesture.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.Gesture.prototype.setTargetBlock_=function(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a};
module$exports$Blockly$Gesture.Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)};module$exports$Blockly$Gesture.Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)};module$exports$Blockly$Gesture.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_};module$exports$Blockly$Gesture.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()};
module$exports$Blockly$Gesture.Gesture.prototype.isFieldClick_=function(){return(this.startField_?this.startField_.isClickable():!1)&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)};module$exports$Blockly$Gesture.Gesture.prototype.isWorkspaceClick_=function(){return!this.startBlock_&&!this.startBubble_&&!this.startField_&&!this.hasExceededDragRadius_};
module$exports$Blockly$Gesture.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_};module$exports$Blockly$Gesture.Gesture.prototype.hasStarted=function(){return this.hasStarted_};module$exports$Blockly$Gesture.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]};
module$exports$Blockly$Gesture.Gesture.prototype.getCurrentDragger=function(){return this.isDraggingBlock_?this.blockDragger_:this.isDraggingWorkspace_?this.workspaceDragger_:this.isDraggingBubble_?this.bubbleDragger_:null};module$exports$Blockly$Gesture.Gesture.inProgress=function(){for(var a=module$exports$Blockly$Workspace.Workspace.getAll(),b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1};var module$exports$Blockly$Field={Field:function(a,b,c){this.name=void 0;this.value_=this.constructor.prototype.DEFAULT_VALUE;this.tooltip_=this.validator_=null;this.size_=new module$exports$Blockly$utils$Size.Size(0,0);this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=null;this.disposed=!1;this.maxDisplayLength=50;this.sourceBlock_=null;this.enabled_=this.visible_=this.isDirty_=!0;this.suffixField=this.prefixField=
this.clickTarget_=null;this.EDITABLE=!0;this.SERIALIZABLE=!1;this.CURSOR="";a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}};module$exports$Blockly$Field.Field.prototype.configure_=function(a){var b=a.tooltip;"string"===typeof b&&(b=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a.tooltip));b&&this.setTooltip(b)};
module$exports$Blockly$Field.Field.prototype.setSourceBlock=function(a){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=a};module$exports$Blockly$Field.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.Field.prototype.getSourceBlock=function(){return this.sourceBlock_};
module$exports$Blockly$Field.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Field.prototype.initView=function(){this.createBorderRect_();this.createTextElement_()};module$exports$Blockly$Field.Field.prototype.initModel=function(){};
module$exports$Blockly$Field.Field.prototype.createBorderRect_=function(){this.borderRect_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Field.prototype.createTextElement_=function(){this.textElement_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.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.Field.prototype.fromXml=function(a){this.setValue(a.textContent)};module$exports$Blockly$Field.Field.prototype.toXml=function(a){a.textContent=this.getValue();return a};
module$exports$Blockly$Field.Field.prototype.saveState=function(a){a=this.saveLegacyState(module$exports$Blockly$Field.Field);return null!==a?a:this.getValue()};module$exports$Blockly$Field.Field.prototype.loadState=function(a){this.loadLegacyState(module$exports$Blockly$Field.Field,a)||this.setValue(a)};
module$exports$Blockly$Field.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.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.Field.prototype.dispose=function(){(0,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.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.Field.prototype.setEnabled=function(a){this.enabled_=a;this.updateEditable()};module$exports$Blockly$Field.Field.prototype.isEnabled=function(){return this.enabled_};module$exports$Blockly$Field.Field.prototype.isClickable=function(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==module$exports$Blockly$Field.Field.prototype.showEditor_};
module$exports$Blockly$Field.Field.prototype.isCurrentlyEditable=function(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()};module$exports$Blockly$Field.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.Field.prototype.isVisible=function(){return this.visible_};module$exports$Blockly$Field.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.Field.prototype.setValidator=function(a){this.validator_=a};module$exports$Blockly$Field.Field.prototype.getValidator=function(){return this.validator_};module$exports$Blockly$Field.Field.prototype.getSvgRoot=function(){return this.fieldGroup_};
module$exports$Blockly$Field.Field.prototype.applyColour=function(){};module$exports$Blockly$Field.Field.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_()};module$exports$Blockly$Field.Field.prototype.showEditor=function(a){this.isClickable()&&this.showEditor_(a)};module$exports$Blockly$Field.Field.prototype.showEditor_=function(a){};
module$exports$Blockly$Field.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.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.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.Field.prototype.getSize=function(){if(!this.isVisible())return new module$exports$Blockly$utils$Size.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.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.Rect(b.y,b.y+d,b.x,b.x+c)};module$exports$Blockly$Field.Field.prototype.getDisplayText_=function(){var a=this.getText();if(!a)return module$exports$Blockly$Field.Field.NBSP;a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,module$exports$Blockly$Field.Field.NBSP);this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="\u200f");return a};
module$exports$Blockly$Field.Field.prototype.getText=function(){var a=this.getText_();return null!==a?String(a):String(this.getValue())};module$exports$Blockly$Field.Field.prototype.getText_=function(){return null};module$exports$Blockly$Field.Field.prototype.markDirty=function(){this.isDirty_=!0;this.constants_=null};
module$exports$Blockly$Field.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())};
module$exports$Blockly$Field.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.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.Field.prototype.getValue=function(){return this.value_};module$exports$Blockly$Field.Field.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:a};
module$exports$Blockly$Field.Field.prototype.doValueUpdate_=function(a){this.value_=a;this.isDirty_=!0};module$exports$Blockly$Field.Field.prototype.doValueInvalid_=function(a){};module$exports$Blockly$Field.Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)};
module$exports$Blockly$Field.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.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.Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()};module$exports$Blockly$Field.Field.prototype.getAbsoluteXY_=function(){return(0,module$exports$Blockly$utils$style.getPageOffset)(this.getClickTarget_())};module$exports$Blockly$Field.Field.prototype.referencesVariables=function(){return!1};module$exports$Blockly$Field.Field.prototype.refreshVariableName=function(){};
module$exports$Blockly$Field.Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;d<b.inputList.length;d++)for(var e=c[d],f=e.fieldRow,g=0;g<f.length;g++)if(f[g]===this){a=e;break}return a};module$exports$Blockly$Field.Field.prototype.getFlipRtl=function(){return!1};module$exports$Blockly$Field.Field.prototype.isTabNavigable=function(){return!1};module$exports$Blockly$Field.Field.prototype.onShortcut=function(a){return!1};
module$exports$Blockly$Field.Field.prototype.setCursorSvg=function(a){a?(this.fieldGroup_.appendChild(a),this.cursorSvg_=a):this.cursorSvg_=null};module$exports$Blockly$Field.Field.prototype.setMarkerSvg=function(a){a?(this.fieldGroup_.appendChild(a),this.markerSvg_=a):this.markerSvg_=null};
module$exports$Blockly$Field.Field.prototype.updateMarkers_=function(){var a=this.sourceBlock_.workspace;a.keyboardAccessibilityMode&&this.cursorSvg_&&a.getCursor().draw();a.keyboardAccessibilityMode&&this.markerSvg_&&a.getMarker(module$exports$Blockly$MarkerManager.MarkerManager.LOCAL_MARKER).draw()};module$exports$Blockly$Field.Field.prototype.DEFAULT_VALUE=null;module$exports$Blockly$Field.Field.NBSP="\u00a0";module$exports$Blockly$Field.Field.SKIP_SETUP=new module$exports$Blockly$utils$Sentinel.Sentinel;$.module$exports$Blockly$FieldLabel={FieldLabel:function(a,b,c){module$exports$Blockly$Field.Field.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.class_=null;this.EDITABLE=!1;a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(c?this.configure_(c):this.class_=b||null,this.setValue(a))}};$.$jscomp.inherits($.module$exports$Blockly$FieldLabel.FieldLabel,module$exports$Blockly$Field.Field);
$.module$exports$Blockly$FieldLabel.FieldLabel.prototype.configure_=function(a){module$exports$Blockly$Field.Field.prototype.configure_.call(this,a);this.class_=a["class"]};$.module$exports$Blockly$FieldLabel.FieldLabel.prototype.initView=function(){this.createTextElement_();this.class_&&(0,module$exports$Blockly$utils$dom.addClass)(this.textElement_,this.class_)};$.module$exports$Blockly$FieldLabel.FieldLabel.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};
$.module$exports$Blockly$FieldLabel.FieldLabel.prototype.setClass=function(a){this.textElement_&&(this.class_&&(0,module$exports$Blockly$utils$dom.removeClass)(this.textElement_,this.class_),a&&(0,module$exports$Blockly$utils$dom.addClass)(this.textElement_,a));this.class_=a};$.module$exports$Blockly$FieldLabel.FieldLabel.fromJson=function(a){return new this((0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a.text),void 0,a)};
$.module$exports$Blockly$FieldLabel.FieldLabel.prototype.DEFAULT_VALUE="";(0,module$exports$Blockly$fieldRegistry.register)("field_label",$.module$exports$Blockly$FieldLabel.FieldLabel);var module$exports$Blockly$blockRendering$InputConnection={InputConnection:function(a,b){module$exports$Blockly$blockRendering$Connection.Connection.call(this,a,b.connection);this.type|=module$exports$Blockly$blockRendering$Types.Types.INPUT;this.input=b;this.align=b.align;(this.connectedBlock=b.connection&&b.connection.targetBlock()?b.connection.targetBlock():null)?(a=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=a.width,this.connectedBlockHeight=a.height):this.connectedBlockHeight=
this.connectedBlockWidth=0;this.connectionOffsetY=this.connectionOffsetX=0}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$InputConnection.InputConnection,module$exports$Blockly$blockRendering$Connection.Connection);var module$exports$Blockly$blockRendering$Debug={Debug:function(a){this.debugElements_=[];this.svgRoot_=null;this.constants_=a;this.randomColour_=""}};module$exports$Blockly$blockRendering$Debug.Debug.prototype.clearElems=function(){for(var a=0;a<this.debugElements_.length;a++)(0,module$exports$Blockly$utils$dom.removeNode)(this.debugElements_[a]);this.debugElements_=[]};
module$exports$Blockly$blockRendering$Debug.Debug.prototype.drawSpacerRow=function(a,b,c){if(module$exports$Blockly$blockRendering$Debug.Debug.config.rowSpacers){var d=Math.abs(a.height),e=0>a.height;e&&(b-=d);this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Debug.prototype.drawSpacerElem=function(a,b,c){if(module$exports$Blockly$blockRendering$Debug.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.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.Debug.prototype.drawRenderedElem=function(a,b){if(module$exports$Blockly$blockRendering$Debug.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.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.Types.isField(a)&&
a instanceof module$exports$Blockly$blockRendering$Field.Field&&a.field instanceof $.module$exports$Blockly$FieldLabel.FieldLabel&&this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Types.isInput(a)&&a instanceof
module$exports$Blockly$blockRendering$InputConnection.InputConnection&&module$exports$Blockly$blockRendering$Debug.Debug.config.connections&&this.drawConnection(a.connectionModel)};
module$exports$Blockly$blockRendering$Debug.Debug.prototype.drawConnection=function(a){if(module$exports$Blockly$blockRendering$Debug.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.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.Debug.prototype.drawRenderedRow=function(a,b,c){module$exports$Blockly$blockRendering$Debug.Debug.config.rows&&(this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Types.isTopOrBottomRow(a)||
module$exports$Blockly$blockRendering$Debug.Debug.config.connectedBlockBounds&&this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Debug.prototype.drawRowWithElements=function(a,b,c){for(var d=0;d<a.elements.length;d++){var e=a.elements[d];e?module$exports$Blockly$blockRendering$Types.Types.isSpacer(e)?this.drawSpacerElem(e,a.height,c):this.drawRenderedElem(e,c):console.warn("A row has an undefined or null element.",a,e)}this.drawRenderedRow(a,b,c)};
module$exports$Blockly$blockRendering$Debug.Debug.prototype.drawBoundingBox=function(a){if(module$exports$Blockly$blockRendering$Debug.Debug.config.blockBounds){var b=a.RTL?-a.width:0;this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{"class":"blockBoundingBox blockRenderDebug",x:b,y:0,width:a.width,height:a.height,stroke:"black",fill:"none","stroke-width":"1px","stroke-dasharray":"5,5"},this.svgRoot_));module$exports$Blockly$blockRendering$Debug.Debug.config.connectedBlockBounds&&
(b=a.RTL?-a.widthWithChildren:0,this.debugElements_.push((0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{"class":"blockRenderDebug",x:b,y:0,width:a.widthWithChildren,height:a.height,stroke:"#DF57BC",fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))}};
module$exports$Blockly$blockRendering$Debug.Debug.prototype.drawDebug=function(a,b){this.clearElems();this.svgRoot_=a.getSvgRoot();this.randomColour_="#"+Math.floor(16777215*Math.random()).toString(16);for(var c=0,d=0;d<b.rows.length;d++){var e=b.rows[d];module$exports$Blockly$blockRendering$Types.Types.isBetweenRowSpacer(e)?this.drawSpacerRow(e,c,b.RTL):this.drawRowWithElements(e,c,b.RTL);c+=e.height}a.previousConnection&&this.drawConnection(a.previousConnection);a.nextConnection&&this.drawConnection(a.nextConnection);
a.outputConnection&&this.drawConnection(a.outputConnection);b.rightSide&&this.drawRenderedElem(b.rightSide,b.RTL);this.drawBoundingBox(b);this.drawRender(a.pathObject.svgPath)};module$exports$Blockly$blockRendering$Debug.Debug.prototype.drawRender=function(a){module$exports$Blockly$blockRendering$Debug.Debug.config.render&&(a.setAttribute("filter","url(#"+this.constants_.debugFilterId+")"),setTimeout(function(){a.setAttribute("filter","")},100))};
module$exports$Blockly$blockRendering$Debug.Debug.config={rowSpacers:!0,elemSpacers:!0,rows:!0,elems:!0,connections:!0,blockBounds:!0,connectedBlockBounds:!0,render:!0};var module$exports$Blockly$blockRendering$Drawer={Drawer:function(a,b){this.block_=a;this.info_=b;this.topLeft_=a.getRelativeToSurfaceXY();this.inlinePath_=this.outlinePath_="";this.constants_=b.getRenderer().getConstants()}};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.draw=function(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();this.block_.pathObject.setPath(this.outlinePath_+"\n"+this.inlinePath_);this.info_.RTL&&this.block_.pathObject.flipRTL();(0,module$exports$Blockly$blockRendering$debug.isDebuggerEnabled)()&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_()};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.recordSizeOnBlock_=function(){this.block_.height=this.info_.height;this.block_.width=this.info_.widthWithChildren};module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.hideHiddenIcons_=function(){for(var a=0,b;b=this.info_.hiddenIcons[a];a++)b.icon.iconGroup_.setAttribute("display","none")};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawOutline_=function(){this.drawTop_();for(var a=1;a<this.info_.rows.length-1;a++){var b=this.info_.rows[a];b.hasJaggedEdge?this.drawJaggedEdge_(b):b.hasStatement?this.drawStatementInput_(b):b.hasExternalInput?this.drawValueInput_(b):this.drawRightSideRow_(b)}this.drawBottom_();this.drawLeft_()};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawTop_=function(){var a=this.info_.topRow,b=a.elements;this.positionPreviousConnection_();this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.moveBy)(a.xPos,this.info_.startY);for(var c=0,d;d=b[c];c++)module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:module$exports$Blockly$blockRendering$Types.Types.isRightRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:
module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection(d)&&d instanceof module$exports$Blockly$blockRendering$Connection.Connection?this.outlinePath_+=d.shape.pathLeft:module$exports$Blockly$blockRendering$Types.Types.isHat(d)?this.outlinePath_+=this.constants_.START_HAT.path:module$exports$Blockly$blockRendering$Types.Types.isSpacer(d)&&(this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",d.width));this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",
a.height)};module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawJaggedEdge_=function(a){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",a.height-this.constants_.JAGGED_TEETH.height)};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawValueInput_=function(a){var b=a.getLastInput();this.positionExternalValueConnection_(a);var c="function"===typeof b.shape.pathDown?b.shape.pathDown(b.height):b.shape.pathDown;this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",b.xPos+b.width)+c+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",a.height-b.connectionHeight)};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawStatementInput_=function(a){var b=a.getLastInput(),c=b.xPos+b.notchOffset+b.shape.width;b=b.shape.pathRight+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",-(b.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var d=a.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",c)+b+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",
d)+this.constants_.INSIDE_CORNERS.pathBottom+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",a.xPos+a.width);this.positionStatementInputConnection_(a)};module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawRightSideRow_=function(a){this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a.yPos+a.height)};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawBottom_=function(){var a=this.info_.bottomRow,b=a.elements;this.positionNextConnection_();for(var c=0,d="",e=b.length-1,f;f=b[e];e--)module$exports$Blockly$blockRendering$Types.Types.isNextConnection(f)&&f instanceof module$exports$Blockly$blockRendering$Connection.Connection?d+=f.shape.pathRight:module$exports$Blockly$blockRendering$Types.Types.isLeftSquareCorner(f)?d+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",a.xPos):
module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(f)?d+=this.constants_.OUTSIDE_CORNERS.bottomLeft:module$exports$Blockly$blockRendering$Types.Types.isRightRoundedCorner(f)?(d+=this.constants_.OUTSIDE_CORNERS.bottomRight,c=this.constants_.OUTSIDE_CORNERS.rightHeight):module$exports$Blockly$blockRendering$Types.Types.isSpacer(f)&&(d+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",-1*f.width));this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",
a.baseline-c);this.outlinePath_+=d};module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawLeft_=function(){var a=this.info_.outputConnection;this.positionOutputConnection_();if(a){var b=a.connectionOffsetY+a.height;a="function"===typeof a.shape.pathUp?a.shape.pathUp(a.height):a.shape.pathUp;this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",b)+a}this.outlinePath_+="z"};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawInternals_=function(){for(var a=0,b;b=this.info_.rows[a];a++)for(var c=0,d;d=b.elements[c];c++)module$exports$Blockly$blockRendering$Types.Types.isInlineInput(d)?this.drawInlineInput_(d):(module$exports$Blockly$blockRendering$Types.Types.isIcon(d)||module$exports$Blockly$blockRendering$Types.Types.isField(d))&&this.layoutField_(d)};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.layoutField_=function(a){if(module$exports$Blockly$blockRendering$Types.Types.isField(a))var b=a.field.getSvgRoot();else module$exports$Blockly$blockRendering$Types.Types.isIcon(a)&&(b=a.icon.iconGroup_);var c=a.centerline-a.height/2,d=a.xPos,e="";this.info_.RTL&&(d=-(d+a.width),a.flipRtl&&(d+=a.width,e="scale(-1 1)"));module$exports$Blockly$blockRendering$Types.Types.isIcon(a)?(b.setAttribute("display","block"),b.setAttribute("transform",
"translate("+d+","+c+")"),a.icon.computeIconLocation()):b.setAttribute("transform","translate("+d+","+c+")"+e);this.info_.isInsertionMarker&&b.setAttribute("display","none")};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawInlineInput_=function(a){var b=a.width,c=a.height,d=a.connectionOffsetY,e=a.connectionHeight+d;this.inlinePath_+=(0,module$exports$Blockly$utils$svgPaths.moveTo)(a.xPos+a.connectionWidth,a.centerline-c/2)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",d)+a.shape.pathDown+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",c-e)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",b-a.connectionWidth)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",
-c)+"z";this.positionInlineInputConnection_(a)};module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.positionInlineInputConnection_=function(a){var b=a.centerline-a.height/2;if(a.connectionModel){var c=a.xPos+a.connectionWidth+a.connectionOffsetX;this.info_.RTL&&(c*=-1);a.connectionModel.setOffsetInBlock(c,b+a.connectionOffsetY)}};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.positionStatementInputConnection_=function(a){var b=a.getLastInput();if(b.connectionModel){var c=a.xPos+a.statementEdge+b.notchOffset;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.positionExternalValueConnection_=function(a){var b=a.getLastInput();if(b.connectionModel){var c=a.xPos+a.width;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}};module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.positionPreviousConnection_=function(){var a=this.info_.topRow;if(a.connection){var b=a.xPos+a.notchOffset;a.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-b:b,0)}};
module$exports$Blockly$blockRendering$Drawer.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,a.baseline)}};
module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.positionOutputConnection_=function(){if(this.info_.outputConnection){var a=this.info_.startX+this.info_.outputConnection.connectionOffsetX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-a:a,this.info_.outputConnection.connectionOffsetY)}};var module$exports$Blockly$blockRendering$ExternalValueInput={ExternalValueInput:function(a,b){module$exports$Blockly$blockRendering$InputConnection.InputConnection.call(this,a,b);this.type|=module$exports$Blockly$blockRendering$Types.Types.EXTERNAL_VALUE_INPUT;this.height=0;this.height=this.connectedBlock?this.connectedBlockHeight-this.constants_.TAB_OFFSET_FROM_TOP-this.constants_.MEDIUM_PADDING:this.shape.height;this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING;this.connectionOffsetY=
this.constants_.TAB_OFFSET_FROM_TOP;this.connectionHeight=this.shape.height;this.connectionWidth=this.shape.width}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$ExternalValueInput.ExternalValueInput,module$exports$Blockly$blockRendering$InputConnection.InputConnection);var module$exports$Blockly$blockRendering$Hat={Hat:function(a){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.type|=module$exports$Blockly$blockRendering$Types.Types.HAT;this.height=this.constants_.START_HAT.height;this.width=this.constants_.START_HAT.width;this.ascenderHeight=this.height}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$Hat.Hat,module$exports$Blockly$blockRendering$Measurable.Measurable);var module$exports$Blockly$blockRendering$IPathObject={IPathObject:function(a,b){}};var module$exports$Blockly$blockRendering$Icon={Icon:function(a,b){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.icon=b;this.isVisible=b.isVisible();this.type|=module$exports$Blockly$blockRendering$Types.Types.ICON;a=b.getCorrectedSize();this.height=a.height;this.width=a.width}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$Icon.Icon,module$exports$Blockly$blockRendering$Measurable.Measurable);var module$exports$Blockly$blockRendering$InRowSpacer={InRowSpacer:function(a,b){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.type=this.type|module$exports$Blockly$blockRendering$Types.Types.SPACER|module$exports$Blockly$blockRendering$Types.Types.IN_ROW_SPACER;this.width=b;this.height=this.constants_.SPACER_DEFAULT_HEIGHT}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer,module$exports$Blockly$blockRendering$Measurable.Measurable);var module$exports$Blockly$blockRendering$InlineInput={InlineInput:function(a,b){module$exports$Blockly$blockRendering$InputConnection.InputConnection.call(this,a,b);this.type|=module$exports$Blockly$blockRendering$Types.Types.INLINE_INPUT;this.connectedBlock?(this.width=this.connectedBlockWidth,this.height=this.connectedBlockHeight):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.constants_.EMPTY_INLINE_INPUT_PADDING);this.connectionHeight=this.isDynamicShape?this.shape.height(this.height):
this.shape.height;this.connectionWidth=this.isDynamicShape?this.shape.width(this.height):this.shape.width;this.connectedBlock||(this.width+=this.connectionWidth*(this.isDynamicShape?2:1));this.connectionOffsetY=this.isDynamicShape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP;this.connectionOffsetX=this.isDynamicShape?this.shape.connectionOffsetX(this.connectionWidth):0}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$InlineInput.InlineInput,module$exports$Blockly$blockRendering$InputConnection.InputConnection);var module$exports$Blockly$blockRendering$StatementInput={StatementInput:function(a,b){module$exports$Blockly$blockRendering$InputConnection.InputConnection.call(this,a,b);this.type|=module$exports$Blockly$blockRendering$Types.Types.STATEMENT_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT;this.width=this.constants_.STATEMENT_INPUT_NOTCH_OFFSET+this.shape.width}};
$.$jscomp.inherits(module$exports$Blockly$blockRendering$StatementInput.StatementInput,module$exports$Blockly$blockRendering$InputConnection.InputConnection);var module$exports$Blockly$blockRendering$InputRow={InputRow:function(a){module$exports$Blockly$blockRendering$Row.Row.call(this,a);this.type|=module$exports$Blockly$blockRendering$Types.Types.INPUT_ROW;this.connectedBlockWidths=0}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$InputRow.InputRow,module$exports$Blockly$blockRendering$Row.Row);
module$exports$Blockly$blockRendering$InputRow.InputRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b=0;b<this.elements.length;b++){var c=this.elements[b];this.width+=c.width;module$exports$Blockly$blockRendering$Types.Types.isInput(c)&&c instanceof module$exports$Blockly$blockRendering$InputConnection.InputConnection&&(module$exports$Blockly$blockRendering$Types.Types.isStatementInput(c)&&c instanceof module$exports$Blockly$blockRendering$StatementInput.StatementInput?
a+=c.connectedBlockWidth:module$exports$Blockly$blockRendering$Types.Types.isExternalInput(c)&&c instanceof module$exports$Blockly$blockRendering$ExternalValueInput.ExternalValueInput&&0!==c.connectedBlockWidth&&(a+=c.connectedBlockWidth-c.connectionWidth));module$exports$Blockly$blockRendering$Types.Types.isSpacer(c)||(this.height=Math.max(this.height,c.height))}this.connectedBlockWidths=a;this.widthWithConnectedBlocks=this.width+a};
module$exports$Blockly$blockRendering$InputRow.InputRow.prototype.endsWithElemSpacer=function(){return!this.hasExternalInput&&!this.hasStatement};var module$exports$Blockly$blockRendering$JaggedEdge={JaggedEdge:function(a){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.type|=module$exports$Blockly$blockRendering$Types.Types.JAGGED_EDGE;this.height=this.constants_.JAGGED_TEETH.height;this.width=this.constants_.JAGGED_TEETH.width}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$JaggedEdge.JaggedEdge,module$exports$Blockly$blockRendering$Measurable.Measurable);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.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;a<b.inputList.length;a++){for(var c=b.inputList[a],d=c.fieldRow,e=0;e<d.length;e++){var f=d[e];if(f.isClickable()||module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS)return module$exports$Blockly$ASTNode.ASTNode.createFieldNode(f)}if(c.connection)return module$exports$Blockly$ASTNode.ASTNode.createInputNode(c)}return null};
module$exports$Blockly$ASTNode.ASTNode.prototype.findNextForField_=function(){var a=this.location_,b=a.getParentInput(),c=a.getSourceBlock(),d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)+1;d<c.inputList.length;d++){b=c.inputList[d];for(var e=b.fieldRow;a<e.length;){if(e[a].isClickable()||module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS)return module$exports$Blockly$ASTNode.ASTNode.createFieldNode(e[a]);a++}a=0;if(b.connection)return module$exports$Blockly$ASTNode.ASTNode.createInputNode(b)}return null};
module$exports$Blockly$ASTNode.ASTNode.prototype.findPrevForInput_=function(){for(var a=this.location_.getParentInput(),b=a.getSourceBlock(),c=b.inputList.indexOf(a);0<=c;c--){var d=b.inputList[c];if(d.connection&&d!==a)return module$exports$Blockly$ASTNode.ASTNode.createInputNode(d);d=d.fieldRow;for(var e=d.length-1;0<=e;e--){var f=d[e];if(f.isClickable()||module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS)return module$exports$Blockly$ASTNode.ASTNode.createFieldNode(f)}}return null};
module$exports$Blockly$ASTNode.ASTNode.prototype.findPrevForField_=function(){var a=this.location_,b=a.getParentInput(),c=a.getSourceBlock(),d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)-1;0<=d;d--){var e=c.inputList[d];if(e.connection&&e!==b)return module$exports$Blockly$ASTNode.ASTNode.createInputNode(e);for(e=e.fieldRow;-1<a;){if(e[a].isClickable()||module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS)return module$exports$Blockly$ASTNode.ASTNode.createFieldNode(e[a]);a--}0<=d-1&&
(a=c.inputList[d-1].fieldRow.length-1)}return null};
module$exports$Blockly$ASTNode.ASTNode.prototype.navigateBetweenStacks_=function(a){var b=this.getLocation();b.getSourceBlock&&(b=b.getSourceBlock());if(!b||!b.workspace)return null;var c=b.getRootBlock();b=c.workspace.getTopBlocks(!0);for(var d=0;d<b.length;d++)if(c.id===b[d].id)return a=d+(a?1:-1),-1===a||a===b.length?null:module$exports$Blockly$ASTNode.ASTNode.createStackNode(b[a]);throw Error("Couldn't find "+(a?"next":"previous")+" stack?!");};
module$exports$Blockly$ASTNode.ASTNode.prototype.findTopASTNodeForBlock_=function(a){var b=module$contents$Blockly$ASTNode_getParentConnection(a);return b?module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(b):module$exports$Blockly$ASTNode.ASTNode.createBlockNode(a)};
module$exports$Blockly$ASTNode.ASTNode.prototype.getOutAstNodeForBlock_=function(a){if(!a)return null;a=a.getTopStackBlock();var b=module$contents$Blockly$ASTNode_getParentConnection(a);return b&&b.targetConnection&&b.targetConnection.getParentInput()?module$exports$Blockly$ASTNode.ASTNode.createInputNode(b.targetConnection.getParentInput()):module$exports$Blockly$ASTNode.ASTNode.createStackNode(a)};
module$exports$Blockly$ASTNode.ASTNode.prototype.findFirstFieldOrInput_=function(a){a=a.inputList;for(var b=0;b<a.length;b++){for(var c=a[b],d=c.fieldRow,e=0;e<d.length;e++){var f=d[e];if(f.isClickable()||module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS)return module$exports$Blockly$ASTNode.ASTNode.createFieldNode(f)}if(c.connection)return module$exports$Blockly$ASTNode.ASTNode.createInputNode(c)}return null};
module$exports$Blockly$ASTNode.ASTNode.prototype.getSourceBlock=function(){return this.getType()===module$exports$Blockly$ASTNode.ASTNode.types.BLOCK?this.getLocation():this.getType()===module$exports$Blockly$ASTNode.ASTNode.types.STACK?this.getLocation():this.getType()===module$exports$Blockly$ASTNode.ASTNode.types.WORKSPACE?null:this.getLocation().getSourceBlock()};
module$exports$Blockly$ASTNode.ASTNode.prototype.next=function(){switch(this.type_){case module$exports$Blockly$ASTNode.ASTNode.types.STACK:return this.navigateBetweenStacks_(!0);case module$exports$Blockly$ASTNode.ASTNode.types.OUTPUT:return module$exports$Blockly$ASTNode.ASTNode.createBlockNode(this.location_.getSourceBlock());case module$exports$Blockly$ASTNode.ASTNode.types.FIELD:return this.findNextForField_();case module$exports$Blockly$ASTNode.ASTNode.types.INPUT:return this.findNextForInput_();
case module$exports$Blockly$ASTNode.ASTNode.types.BLOCK:return module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(this.location_.nextConnection);case module$exports$Blockly$ASTNode.ASTNode.types.PREVIOUS:return module$exports$Blockly$ASTNode.ASTNode.createBlockNode(this.location_.getSourceBlock());case module$exports$Blockly$ASTNode.ASTNode.types.NEXT:return module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(this.location_.targetConnection)}return null};
module$exports$Blockly$ASTNode.ASTNode.prototype.in=function(){switch(this.type_){case module$exports$Blockly$ASTNode.ASTNode.types.WORKSPACE:var a=this.location_.getTopBlocks(!0);if(0<a.length)return module$exports$Blockly$ASTNode.ASTNode.createStackNode(a[0]);break;case module$exports$Blockly$ASTNode.ASTNode.types.STACK:return this.findTopASTNodeForBlock_(this.location_);case module$exports$Blockly$ASTNode.ASTNode.types.BLOCK:return this.findFirstFieldOrInput_(this.location_);case module$exports$Blockly$ASTNode.ASTNode.types.INPUT:return module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(this.location_.targetConnection)}return null};
module$exports$Blockly$ASTNode.ASTNode.prototype.prev=function(){switch(this.type_){case module$exports$Blockly$ASTNode.ASTNode.types.STACK:return this.navigateBetweenStacks_(!1);case module$exports$Blockly$ASTNode.ASTNode.types.FIELD:return this.findPrevForField_();case module$exports$Blockly$ASTNode.ASTNode.types.INPUT:return this.findPrevForInput_();case module$exports$Blockly$ASTNode.ASTNode.types.BLOCK:var a=module$contents$Blockly$ASTNode_getParentConnection(this.location_);return module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(a);
case module$exports$Blockly$ASTNode.ASTNode.types.PREVIOUS:if((a=this.location_.targetConnection)&&!a.getParentInput())return module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(a);break;case module$exports$Blockly$ASTNode.ASTNode.types.NEXT:return module$exports$Blockly$ASTNode.ASTNode.createBlockNode(this.location_.getSourceBlock())}return null};
module$exports$Blockly$ASTNode.ASTNode.prototype.out=function(){switch(this.type_){case module$exports$Blockly$ASTNode.ASTNode.types.STACK:var a=this.location_,b=a.getRelativeToSurfaceXY();b=new module$exports$Blockly$utils$Coordinate.Coordinate(b.x,b.y+module$exports$Blockly$ASTNode.ASTNode.DEFAULT_OFFSET_Y);return module$exports$Blockly$ASTNode.ASTNode.createWorkspaceNode(a.workspace,b);case module$exports$Blockly$ASTNode.ASTNode.types.OUTPUT:return a=this.location_,(b=a.targetConnection)?module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(b):
module$exports$Blockly$ASTNode.ASTNode.createStackNode(a.getSourceBlock());case module$exports$Blockly$ASTNode.ASTNode.types.FIELD:return module$exports$Blockly$ASTNode.ASTNode.createBlockNode(this.location_.getSourceBlock());case module$exports$Blockly$ASTNode.ASTNode.types.INPUT:return module$exports$Blockly$ASTNode.ASTNode.createBlockNode(this.location_.getSourceBlock());case module$exports$Blockly$ASTNode.ASTNode.types.BLOCK:return this.getOutAstNodeForBlock_(this.location_);case module$exports$Blockly$ASTNode.ASTNode.types.PREVIOUS:return this.getOutAstNodeForBlock_(this.location_.getSourceBlock());
case module$exports$Blockly$ASTNode.ASTNode.types.NEXT:return this.getOutAstNodeForBlock_(this.location_.getSourceBlock())}return null};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=module$contents$Blockly$ASTNode_getParentConnection(a);return b?module$exports$Blockly$ASTNode.ASTNode.createConnectionNode(b):module$exports$Blockly$ASTNode.ASTNode.createBlockNode(a)};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;var module$contents$Blockly$ASTNode_getParentConnection=function(a){var b=a.outputConnection;if(!b||a.previousConnection&&a.previousConnection.isConnected())b=a.previousConnection;return b};var module$exports$Blockly$Events$MarkerMove={MarkerMove:function(a,b,c,d){var e=a?a.workspace.id:void 0;d&&d.getType()===module$exports$Blockly$ASTNode.ASTNode.types.WORKSPACE&&(e=d.getLocation().id);module$exports$Blockly$Events$UiBase.UiBase.call(this,e);this.blockId=a?a.id:null;this.oldNode=c;this.newNode=d;this.isCursor=b;this.type=module$exports$Blockly$Events$utils.MARKER_MOVE}};$.$jscomp.inherits(module$exports$Blockly$Events$MarkerMove.MarkerMove,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$MarkerMove.MarkerMove.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.isCursor=this.isCursor;a.blockId=this.blockId;a.oldNode=this.oldNode;a.newNode=this.newNode;return a};
module$exports$Blockly$Events$MarkerMove.MarkerMove.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.fromJson.call(this,a);this.isCursor=a.isCursor;this.blockId=a.blockId;this.oldNode=a.oldNode;this.newNode=a.newNode};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.MARKER_MOVE,module$exports$Blockly$Events$MarkerMove.MarkerMove);var module$exports$Blockly$blockRendering$MarkerSvg={},module$contents$Blockly$blockRendering$MarkerSvg_CURSOR_CLASS="blocklyCursor",module$contents$Blockly$blockRendering$MarkerSvg_MARKER_CLASS="blocklyMarker",module$contents$Blockly$blockRendering$MarkerSvg_HEIGHT_MULTIPLIER=.75;
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg=function(a,b,c){this.workspace_=a;this.marker_=c;this.parent_=null;this.constants_=b;this.currentMarkerSvg=null;a=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=c.colour||a;this.markerSvgRect_=this.markerSvgLine_=this.markerInput_=this.markerBlock_=this.svgGroup_=this.markerSvg_=null};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.getSvgRoot=function(){return this.svgGroup_};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.getMarker=function(){return this.marker_};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.isCursor=function(){return"cursor"===this.marker_.type};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.createDom=function(){var a=this.isCursor()?module$contents$Blockly$blockRendering$MarkerSvg_CURSOR_CLASS:module$contents$Blockly$blockRendering$MarkerSvg_MARKER_CLASS;this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":a},null);this.createDomInternal_();return this.svgGroup_};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.setParent_=function(a){this.isCursor()?(this.parent_&&this.parent_.setCursorSvg(null),a.setCursorSvg(this.getSvgRoot())):(this.parent_&&this.parent_.setMarkerSvg(null),a.setMarkerSvg(this.getSvgRoot()));this.parent_=a};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.draw=function(a,b){if(b){this.constants_=this.workspace_.getRenderer().getConstants();var c=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=this.marker_.colour||c;this.applyColour_(b);this.showAtLocation_(b);this.fireMarkerEvent_(a,b);a=this.currentMarkerSvg.childNodes[0];void 0!==a&&a.beginElement&&a.beginElement()}else this.hide()};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showAtLocation_=function(a){var b=a.getLocation().type;a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.BLOCK?this.showWithBlock_(a):a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.OUTPUT?this.showWithOutput_(a):b===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE?this.showWithInput_(a):b===$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT?this.showWithNext_(a):a.getType()===
module$exports$Blockly$ASTNode.ASTNode.types.PREVIOUS?this.showWithPrevious_(a):a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.FIELD?this.showWithField_(a):a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.WORKSPACE?this.showWithCoordinates_(a):a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.STACK&&this.showWithStack_(a)};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithBlockPrevOutput_=function(a){a=a.getSourceBlock();var b=a.width,c=a.height,d=c*module$contents$Blockly$blockRendering$MarkerSvg_HEIGHT_MULTIPLIER,e=this.constants_.CURSOR_BLOCK_PADDING;a.previousConnection?(c=this.constants_.shapeFor(a.previousConnection),this.positionPrevious_(b,e,d,c)):a.outputConnection?(d=this.constants_.shapeFor(a.outputConnection),this.positionOutput_(b,c,d)):this.positionBlock_(b,e,d);this.setParent_(a);
this.showCurrent_()};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithBlock_=function(a){this.showWithBlockPrevOutput_(a)};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithPrevious_=function(a){this.showWithBlockPrevOutput_(a)};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithOutput_=function(a){this.showWithBlockPrevOutput_(a)};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithCoordinates_=function(a){var b=a.getWsCoordinate();a=b.x;b=b.y;this.workspace_.RTL&&(a-=this.constants_.CURSOR_WS_WIDTH);this.positionLine_(a,b,this.constants_.CURSOR_WS_WIDTH);this.setParent_(this.workspace_);this.showCurrent_()};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithField_=function(a){a=a.getLocation();var b=a.getSize().width,c=a.getSize().height;this.positionRect_(0,0,b,c);this.setParent_(a);this.showCurrent_()};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithInput_=function(a){a=a.getLocation();var b=a.getSourceBlock();this.positionInput_(a);this.setParent_(b);this.showCurrent_()};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithNext_=function(a){var b=a.getLocation();a=b.getSourceBlock();var c=0;b=b.getOffsetInBlock().y;var d=a.getHeightWidth().width;this.workspace_.RTL&&(c=-d);this.positionLine_(c,b,d);this.setParent_(a);this.showCurrent_()};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showWithStack_=function(a){a=a.getLocation();var b=a.getHeightWidth(),c=b.width+this.constants_.CURSOR_STACK_PADDING;b=b.height+this.constants_.CURSOR_STACK_PADDING;var d=-this.constants_.CURSOR_STACK_PADDING/2,e=-this.constants_.CURSOR_STACK_PADDING/2,f=d;this.workspace_.RTL&&(f=-(c+d));this.positionRect_(f,e,c,b);this.setParent_(a);this.showCurrent_()};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.showCurrent_=function(){this.hide();this.currentMarkerSvg.style.display=""};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.positionBlock_=function(a,b,c){a=(0,module$exports$Blockly$utils$svgPaths.moveBy)(-b,c)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",-b)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",a+2*b)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",c);this.markerBlock_.setAttribute("d",a);this.workspace_.RTL&&this.flipRtl_(this.markerBlock_);this.currentMarkerSvg=this.markerBlock_};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.positionInput_=function(a){var b=a.getOffsetInBlock().x,c=a.getOffsetInBlock().y;a=(0,module$exports$Blockly$utils$svgPaths.moveTo)(0,0)+this.constants_.shapeFor(a).pathDown;this.markerInput_.setAttribute("d",a);this.markerInput_.setAttribute("transform","translate("+b+","+c+")"+(this.workspace_.RTL?" scale(-1 1)":""));this.currentMarkerSvg=this.markerInput_};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.positionLine_=function(a,b,c){this.markerSvgLine_.setAttribute("x",a);this.markerSvgLine_.setAttribute("y",b);this.markerSvgLine_.setAttribute("width",c);this.currentMarkerSvg=this.markerSvgLine_};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.positionOutput_=function(a,b,c){a=(0,module$exports$Blockly$utils$svgPaths.moveBy)(a,0)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",-(a-c.width))+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",this.constants_.TAB_OFFSET_FROM_TOP)+c.pathDown+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",b)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",a);this.markerBlock_.setAttribute("d",a);this.workspace_.RTL&&
this.flipRtl_(this.markerBlock_);this.currentMarkerSvg=this.markerBlock_};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.positionPrevious_=function(a,b,c,d){a=(0,module$exports$Blockly$utils$svgPaths.moveBy)(-b,c)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",-b)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",this.constants_.NOTCH_OFFSET_LEFT)+d.pathLeft+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",a+2*b)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",c);this.markerBlock_.setAttribute("d",a);this.workspace_.RTL&&
this.flipRtl_(this.markerBlock_);this.currentMarkerSvg=this.markerBlock_};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.positionRect_=function(a,b,c,d){this.markerSvgRect_.setAttribute("x",a);this.markerSvgRect_.setAttribute("y",b);this.markerSvgRect_.setAttribute("width",c);this.markerSvgRect_.setAttribute("height",d);this.currentMarkerSvg=this.markerSvgRect_};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.flipRtl_=function(a){a.setAttribute("transform","scale(-1 1)")};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.hide=function(){this.markerSvgLine_.style.display="none";this.markerSvgRect_.style.display="none";this.markerInput_.style.display="none";this.markerBlock_.style.display="none"};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.fireMarkerEvent_=function(a,b){var c=b.getSourceBlock();a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.MARKER_MOVE))(c,this.isCursor(),a,b);(0,module$exports$Blockly$Events$utils.fire)(a)};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.getBlinkProperties_=function(){return{attributeType:"XML",attributeName:"fill",dur:"1s",values:this.colour_+";transparent;transparent;",repeatCount:"indefinite"}};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.createDomInternal_=function(){this.markerSvg_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_);this.markerSvgLine_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT,style:"display: none"},
this.markerSvg_);this.markerSvgRect_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{"class":"blocklyVerticalMarker",rx:10,ry:10,style:"display: none"},this.markerSvg_);this.markerInput_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{transform:"",style:"display: none"},this.markerSvg_);this.markerBlock_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{transform:"",
style:"display: none",fill:"none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_);if(this.isCursor()){var a=this.getBlinkProperties_();(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.ANIMATE,a,this.markerSvgLine_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.ANIMATE,a,this.markerInput_);a.attributeName="stroke";(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.ANIMATE,
a,this.markerBlock_)}return this.markerSvg_};
module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.applyColour_=function(a){this.markerSvgLine_.setAttribute("fill",this.colour_);this.markerSvgRect_.setAttribute("stroke",this.colour_);this.markerInput_.setAttribute("fill",this.colour_);this.markerBlock_.setAttribute("stroke",this.colour_);this.isCursor()&&(a=this.colour_+";transparent;transparent;",this.markerSvgLine_.firstChild.setAttribute("values",a),this.markerInput_.firstChild.setAttribute("values",a),this.markerBlock_.firstChild.setAttribute("values",
a))};module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.dispose=function(){this.svgGroup_&&(0,module$exports$Blockly$utils$dom.removeNode)(this.svgGroup_)};var module$exports$Blockly$blockRendering$NextConnection={NextConnection:function(a,b){module$exports$Blockly$blockRendering$Connection.Connection.call(this,a,b);this.type|=module$exports$Blockly$blockRendering$Types.Types.NEXT_CONNECTION;this.height=this.shape.height;this.width=this.shape.width}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$NextConnection.NextConnection,module$exports$Blockly$blockRendering$Connection.Connection);var module$exports$Blockly$blockRendering$OutputConnection={OutputConnection:function(a,b){module$exports$Blockly$blockRendering$Connection.Connection.call(this,a,b);this.type|=module$exports$Blockly$blockRendering$Types.Types.OUTPUT_CONNECTION;this.height=this.isDynamicShape?0:this.shape.height;this.startX=this.width=this.isDynamicShape?0:this.shape.width;this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.connectionOffsetX=0}};
$.$jscomp.inherits(module$exports$Blockly$blockRendering$OutputConnection.OutputConnection,module$exports$Blockly$blockRendering$Connection.Connection);var module$exports$Blockly$blockRendering$PathObject={PathObject:function(a,b,c){this.constants=c;this.svgRoot=a;this.svgPath=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{"class":"blocklyPath"},this.svgRoot);this.style=b;this.markerSvg=this.cursorSvg=null}};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.setPath=function(a){this.svgPath.setAttribute("d",a)};
module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.flipRTL=function(){this.svgPath.setAttribute("transform","scale(-1 1)")};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.setCursorSvg=function(a){a?(this.svgRoot.appendChild(a),this.cursorSvg=a):this.cursorSvg=null};
module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.setMarkerSvg=function(a){a?(this.cursorSvg?this.svgRoot.insertBefore(a,this.cursorSvg):this.svgRoot.appendChild(a),this.markerSvg=a):this.markerSvg=null};
module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.applyColour=function(a){this.svgPath.setAttribute("stroke",this.style.colourTertiary);this.svgPath.setAttribute("fill",this.style.colourPrimary);this.updateShadow_(a.isShadow());this.updateDisabled_(!a.isEnabled()||a.getInheritedDisabled())};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.setStyle=function(a){this.style=a};
module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.setClass_=function(a,b){b?(0,module$exports$Blockly$utils$dom.addClass)(this.svgRoot,a):(0,module$exports$Blockly$utils$dom.removeClass)(this.svgRoot,a)};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateHighlighted=function(a){a?this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"):this.svgPath.setAttribute("filter","none")};
module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateShadow_=function(a){a&&(this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateDisabled_=function(a){this.setClass_("blocklyDisabled",a);a&&this.svgPath.setAttribute("fill","url(#"+this.constants.disabledPatternId+")")};
module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateSelected=function(a){this.setClass_("blocklySelected",a)};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateDraggingDelete=function(a){this.setClass_("blocklyDraggingDelete",a)};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateInsertionMarker=function(a){this.setClass_("blocklyInsertionMarker",a)};
module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateMovable=function(a){this.setClass_("blocklyDraggable",a)};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateReplacementFade=function(a){this.setClass_("blocklyReplaceable",a)};module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateShapeForInputHighlight=function(a,b){};var module$exports$Blockly$blockRendering$PreviousConnection={PreviousConnection:function(a,b){module$exports$Blockly$blockRendering$Connection.Connection.call(this,a,b);this.type|=module$exports$Blockly$blockRendering$Types.Types.PREVIOUS_CONNECTION;this.height=this.shape.height;this.width=this.shape.width}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$PreviousConnection.PreviousConnection,module$exports$Blockly$blockRendering$Connection.Connection);$.module$exports$Blockly$Input={Input:function(a,b,c,d){if(a!==$.module$exports$Blockly$inputTypes.inputTypes.DUMMY&&!b)throw Error("Value inputs and statement inputs must have non-empty name.");this.type=a;this.name=b;this.sourceBlock_=c;this.connection=d;this.fieldRow=[];this.align=$.module$exports$Blockly$Input.Align.LEFT;this.visible_=!0}};$.module$exports$Blockly$Input.Input.prototype.getSourceBlock=function(){return this.sourceBlock_};
$.module$exports$Blockly$Input.Input.prototype.appendField=function(a,b){this.insertFieldAt(this.fieldRow.length,a,b);return this};
$.module$exports$Blockly$Input.Input.prototype.insertFieldAt=function(a,b,c){if(0>a||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.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.Input.prototype.isVisible=function(){return this.visible_};
$.module$exports$Blockly$Input.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.Input.prototype.markDirty=function(){for(var a=0,b;b=this.fieldRow[a];a++)b.markDirty()};
$.module$exports$Blockly$Input.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.Input.prototype.setAlign=function(a){this.align=a;this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render());return this};
$.module$exports$Blockly$Input.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.Input.prototype.getShadowDom=function(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()};$.module$exports$Blockly$Input.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var a=0;a<this.fieldRow.length;a++)this.fieldRow[a].init()};
$.module$exports$Blockly$Input.Input.prototype.dispose=function(){for(var a=0,b;b=this.fieldRow[a];a++)b.dispose();this.connection&&this.connection.dispose();this.sourceBlock_=null};$.module$exports$Blockly$Input.Align={LEFT:-1,CENTRE:0,RIGHT:1};$.module$exports$Blockly$Input.Input.Align=$.module$exports$Blockly$Input.Align;var module$exports$Blockly$blockRendering$RoundCorner={RoundCorner:function(a,b){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.type=(b&&"left"!==b?module$exports$Blockly$blockRendering$Types.Types.RIGHT_ROUND_CORNER:module$exports$Blockly$blockRendering$Types.Types.LEFT_ROUND_CORNER)|module$exports$Blockly$blockRendering$Types.Types.CORNER;this.width=this.constants_.CORNER_RADIUS;this.height=this.constants_.CORNER_RADIUS/2}};
$.$jscomp.inherits(module$exports$Blockly$blockRendering$RoundCorner.RoundCorner,module$exports$Blockly$blockRendering$Measurable.Measurable);var module$exports$Blockly$blockRendering$SpacerRow={SpacerRow:function(a,b,c){module$exports$Blockly$blockRendering$Row.Row.call(this,a);this.type=this.type|module$exports$Blockly$blockRendering$Types.Types.SPACER|module$exports$Blockly$blockRendering$Types.Types.BETWEEN_ROW_SPACER;this.width=c;this.height=b;this.precedesStatement=this.followsStatement=!1;this.widthWithConnectedBlocks=0;this.elements=[new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,c)]}};
$.$jscomp.inherits(module$exports$Blockly$blockRendering$SpacerRow.SpacerRow,module$exports$Blockly$blockRendering$Row.Row);module$exports$Blockly$blockRendering$SpacerRow.SpacerRow.prototype.measure=function(){};var module$exports$Blockly$blockRendering$SquareCorner={SquareCorner:function(a,b){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.type=(b&&"left"!==b?module$exports$Blockly$blockRendering$Types.Types.RIGHT_SQUARE_CORNER:module$exports$Blockly$blockRendering$Types.Types.LEFT_SQUARE_CORNER)|module$exports$Blockly$blockRendering$Types.Types.CORNER;this.width=this.height=this.constants_.NO_PADDING}};
$.$jscomp.inherits(module$exports$Blockly$blockRendering$SquareCorner.SquareCorner,module$exports$Blockly$blockRendering$Measurable.Measurable);var module$exports$Blockly$blockRendering$TopRow={TopRow:function(a){module$exports$Blockly$blockRendering$Row.Row.call(this,a);this.type|=module$exports$Blockly$blockRendering$Types.Types.TOP_ROW;this.ascenderHeight=this.capline=0;this.hasPreviousConnection=!1;this.connection=null}};$.$jscomp.inherits(module$exports$Blockly$blockRendering$TopRow.TopRow,module$exports$Blockly$blockRendering$Row.Row);
module$exports$Blockly$blockRendering$TopRow.TopRow.prototype.hasLeftSquareCorner=function(a){var b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection,c=a.getPreviousBlock();return!!a.outputConnection||b||(c?c.getNextBlock()===a:!1)};module$exports$Blockly$blockRendering$TopRow.TopRow.prototype.hasRightSquareCorner=function(a){return!0};
module$exports$Blockly$blockRendering$TopRow.TopRow.prototype.measure=function(){for(var a=0,b=0,c=0,d=0;d<this.elements.length;d++){var e=this.elements[d];b+=e.width;module$exports$Blockly$blockRendering$Types.Types.isSpacer(e)||(module$exports$Blockly$blockRendering$Types.Types.isHat(e)&&e instanceof module$exports$Blockly$blockRendering$Hat.Hat?c=Math.max(c,e.ascenderHeight):a=Math.max(a,e.height))}this.width=Math.max(this.minWidth,b);this.height=Math.max(this.minHeight,a)+c;this.capline=this.ascenderHeight=
c;this.widthWithConnectedBlocks=this.width};module$exports$Blockly$blockRendering$TopRow.TopRow.prototype.startsWithElemSpacer=function(){return!1};module$exports$Blockly$blockRendering$TopRow.TopRow.prototype.endsWithElemSpacer=function(){return!1};var module$exports$Blockly$blockRendering$RenderInfo={RenderInfo:function(a,b){this.block_=b;this.renderer_=a;this.constants_=this.renderer_.getConstants();this.outputConnection=b.outputConnection?new module$exports$Blockly$blockRendering$OutputConnection.OutputConnection(this.constants_,b.outputConnection):null;this.isInline=b.getInputsInline()&&!b.isCollapsed();this.isCollapsed=b.isCollapsed();this.isInsertionMarker=b.isInsertionMarker();this.RTL=b.RTL;this.statementEdge=this.width=this.widthWithChildren=
this.height=0;this.rows=[];this.inputRows=[];this.hiddenIcons=[];this.topRow=new module$exports$Blockly$blockRendering$TopRow.TopRow(this.constants_);this.bottomRow=new module$exports$Blockly$blockRendering$BottomRow.BottomRow(this.constants_);this.startY=this.startX=0}};module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getRenderer=function(){return this.renderer_};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.measure=function(){this.createRows_();this.addElemSpacing_();this.addRowSpacing_();this.computeBounds_();this.alignRowElements_();this.finalize_()};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.createRows_=function(){this.populateTopRow_();this.rows.push(this.topRow);var a=new module$exports$Blockly$blockRendering$InputRow.InputRow(this.constants_);this.inputRows.push(a);for(var b=this.block_.getIcons(),c=0,d;d=b[c];c++){var e=new module$exports$Blockly$blockRendering$Icon.Icon(this.constants_,d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}d=null;for(b=0;c=this.block_.inputList[b];b++)if(c.isVisible()){this.shouldStartNewRow_(c,
d)&&(this.rows.push(a),a=new module$exports$Blockly$blockRendering$InputRow.InputRow(this.constants_),this.inputRows.push(a));for(d=0;e=c.fieldRow[d];d++)a.elements.push(new module$exports$Blockly$blockRendering$Field.Field(this.constants_,e,c));this.addInput_(c,a);d=c}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new module$exports$Blockly$blockRendering$JaggedEdge.JaggedEdge(this.constants_)));(a.elements.length||a.hasDummyInput)&&this.rows.push(a);this.populateBottomRow_();this.rows.push(this.bottomRow)};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.populateTopRow_=function(){var a=!!this.block_.previousConnection,b=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!a,c=this.topRow.hasLeftSquareCorner(this.block_)?module$exports$Blockly$blockRendering$SquareCorner.SquareCorner:module$exports$Blockly$blockRendering$RoundCorner.RoundCorner;this.topRow.elements.push(new c(this.constants_));b?(a=new module$exports$Blockly$blockRendering$Hat.Hat(this.constants_),
this.topRow.elements.push(a),this.topRow.capline=a.ascenderHeight):a&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new module$exports$Blockly$blockRendering$PreviousConnection.PreviousConnection(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection));this.block_.inputList.length&&this.block_.inputList[0].type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:
this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT;c=this.topRow.hasRightSquareCorner(this.block_)?module$exports$Blockly$blockRendering$SquareCorner.SquareCorner:module$exports$Blockly$blockRendering$RoundCorner.RoundCorner;this.topRow.elements.push(new c(this.constants_,"right"))};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.populateBottomRow_=function(){this.bottomRow.hasNextConnection=!!this.block_.nextConnection;this.bottomRow.minHeight=this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT;this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new module$exports$Blockly$blockRendering$SquareCorner.SquareCorner(this.constants_)):
this.bottomRow.elements.push(new module$exports$Blockly$blockRendering$RoundCorner.RoundCorner(this.constants_));this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new module$exports$Blockly$blockRendering$NextConnection.NextConnection(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection));this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new module$exports$Blockly$blockRendering$SquareCorner.SquareCorner(this.constants_,
"right")):this.bottomRow.elements.push(new module$exports$Blockly$blockRendering$RoundCorner.RoundCorner(this.constants_,"right"))};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE?(b.elements.push(new module$exports$Blockly$blockRendering$InlineInput.InlineInput(this.constants_,a)),b.hasInlineInput=!0):a.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT?(b.elements.push(new module$exports$Blockly$blockRendering$StatementInput.StatementInput(this.constants_,a)),b.hasStatement=!0):a.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE?
(b.elements.push(new module$exports$Blockly$blockRendering$ExternalValueInput.ExternalValueInput(this.constants_,a)),b.hasExternalInput=!0):a.type===$.module$exports$Blockly$inputTypes.inputTypes.DUMMY&&(b.minHeight=Math.max(b.minHeight,a.getSourceBlock()&&a.getSourceBlock().isShadow()?this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT:this.constants_.DUMMY_INPUT_MIN_HEIGHT),b.hasDummyInput=!0);null===b.align&&(b.align=a.align)};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT||b.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT?!0:a.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE||a.type===$.module$exports$Blockly$inputTypes.inputTypes.DUMMY?!this.isInline:!1:!1};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.addElemSpacing_=function(){for(var a=0,b;b=this.rows[a];a++){var c=b.elements;b.elements=[];b.startsWithElemSpacer()&&b.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,this.getInRowSpacing_(null,c[0])));if(c.length){for(var d=0;d<c.length-1;d++){b.elements.push(c[d]);var e=this.getInRowSpacing_(c[d],c[d+1]);b.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,
e))}b.elements.push(c[c.length-1]);b.endsWithElemSpacer()&&b.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,this.getInRowSpacing_(c[c.length-1],null)))}}};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a&&b&&module$exports$Blockly$blockRendering$Types.Types.isStatementInput(b))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(a&&module$exports$Blockly$blockRendering$Types.Types.isInput(a)&&!b){if(module$exports$Blockly$blockRendering$Types.Types.isExternalInput(a))return this.constants_.NO_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;
if(module$exports$Blockly$blockRendering$Types.Types.isStatementInput(a))return this.constants_.NO_PADDING}return a&&module$exports$Blockly$blockRendering$Types.Types.isLeftSquareCorner(a)&&b&&(module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection(b)||module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b))?b.notchOffset:a&&module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(a)&&b&&(module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection(b)||
module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b))?b.notchOffset-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.computeBounds_=function(){for(var a=0,b=0,c=0,d=0,e;e=this.rows[d];d++){e.measure();b=Math.max(b,e.width);if(e.hasStatement){var f=e.getLastInput();a=Math.max(a,e.width-f.width)}c=Math.max(c,e.widthWithConnectedBlocks)}this.statementEdge=a;this.width=b;for(a=0;d=this.rows[a];a++)d.hasStatement&&(d.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(b,c);this.outputConnection&&(this.startX=this.outputConnection.width,
this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)};module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.alignRowElements_=function(){for(var a=0,b;b=this.rows[a];a++)if(b.hasStatement)this.alignStatementRow_(b);else{var c=b.width;c=this.getDesiredRowWidth_(b)-c;0<c&&this.addAlignmentPadding_(b,c);module$exports$Blockly$blockRendering$Types.Types.isTopOrBottomRow(b)&&(b.widthWithConnectedBlocks=b.width)}};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getDesiredRowWidth_=function(a){return this.width-this.startX};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.addAlignmentPadding_=function(a,b){var c=a.getFirstSpacer(),d=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)a.widthWithConnectedBlocks+=b;a.align===$.module$exports$Blockly$Input.Align.LEFT?d.width+=b:a.align===$.module$exports$Blockly$Input.Align.CENTRE?(c.width+=b/2,d.width+=b/2):a.align===$.module$exports$Blockly$Input.Align.RIGHT?c.width+=b:d.width+=b;a.width+=b};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.alignStatementRow_=function(a){var b=a.getLastInput(),c=a.width-b.width,d=this.statementEdge;c=d-c;0<c&&this.addAlignmentPadding_(a,c);c=a.width;d=this.getDesiredRowWidth_(a);b.width+=d-c;b.height=Math.max(b.height,a.height);a.width+=d-c;a.widthWithConnectedBlocks=Math.max(a.width,this.statementEdge+a.connectedBlockWidths)};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.addRowSpacing_=function(){var a=this.rows;this.rows=[];for(var b=0;b<a.length;b++)this.rows.push(a[b]),b!==a.length-1&&this.rows.push(this.makeSpacerRow_(a[b],a[b+1]))};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.makeSpacerRow_=function(a,b){var c=this.getSpacerRowHeight_(a,b),d=this.getSpacerRowWidth_(a,b);c=new module$exports$Blockly$blockRendering$SpacerRow.SpacerRow(this.constants_,c,d);a.hasStatement&&(c.followsStatement=!0);b.hasStatement&&(c.precedesStatement=!0);return c};module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getSpacerRowWidth_=function(a,b){return this.width-this.startX};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return this.constants_.MEDIUM_PADDING};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getElemCenterline_=function(a,b){return module$exports$Blockly$blockRendering$Types.Types.isSpacer(b)?a.yPos+b.height/2:module$exports$Blockly$blockRendering$Types.Types.isBottomRow(a)?(a=a.yPos+a.height-a.descenderHeight,module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b)?a+b.height/2:a-b.height/2):module$exports$Blockly$blockRendering$Types.Types.isTopRow(a)?module$exports$Blockly$blockRendering$Types.Types.isHat(b)?
a.capline-b.height/2:a.capline+b.height/2:a.yPos+a.height/2};module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.recordElemPositions_=function(a){for(var b=a.xPos,c=0,d;d=a.elements[c];c++)module$exports$Blockly$blockRendering$Types.Types.isSpacer(d)&&(d.height=a.height),d.xPos=b,d.centerline=this.getElemCenterline_(a,d),b+=d.width};
module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];c++)d.yPos=b,d.xPos=this.startX,b+=d.height,a=Math.max(a,d.widthWithConnectedBlocks),this.recordElemPositions_(d);this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(a=Math.max(a,this.block_.nextConnection.targetBlock().getHeightWidth().width));this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.capline;this.bottomRow.baseline=
b-this.bottomRow.descenderHeight};var module$exports$Blockly$blockRendering$Renderer={Renderer:function(a){this.name=a;this.overrides=this.constants_=null}};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.getClassName=function(){return this.name+"-renderer"};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.init=function(a,b){this.constants_=this.makeConstants_();b&&(this.overrides=b,(0,$.module$exports$Blockly$utils$object.mixin)(this.constants_,b));this.constants_.setTheme(a);this.constants_.init()};
module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.createDom=function(a,b){this.constants_.createDom(a,this.name+"-"+b.name,"."+this.getClassName()+"."+b.getClassName())};
module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.refreshDom=function(a,b){var c=this.getConstants();c.dispose();this.constants_=this.makeConstants_();this.overrides&&(0,$.module$exports$Blockly$utils$object.mixin)(this.constants_,this.overrides);this.constants_.randomIdentifier=c.randomIdentifier;this.constants_.setTheme(b);this.constants_.init();this.createDom(a,b)};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.dispose=function(){this.constants_&&this.constants_.dispose()};
module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.makeConstants_=function(){return new module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.makeRenderInfo_=function(a){return new module$exports$Blockly$blockRendering$RenderInfo.RenderInfo(this,a)};
module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.makeDrawer_=function(a,b){return new module$exports$Blockly$blockRendering$Drawer.Drawer(a,b)};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.makeDebugger_=function(){var a=module$exports$Blockly$blockRendering$Debug.Debug;if(!a)throw Error("Missing require for Blockly.blockRendering.Debug");return new a(this.getConstants())};
module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.makeMarkerDrawer=function(a,b){return new module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg(a,this.getConstants(),b)};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.makePathObject=function(a,b){return new module$exports$Blockly$blockRendering$PathObject.PathObject(a,b,this.constants_)};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.getConstants=function(){return this.constants_};
module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.shouldHighlightConnection=function(a){return!0};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.orphanCanConnectAtEnd=function(a,b,c){return!!module$exports$Blockly$Connection.Connection.getConnectionForOrphanedConnection(a,c===$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE?b.outputConnection:b.previousConnection)};
module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.getConnectionPreviewMethod=function(a,b,c){return b.type===$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE||b.type===$.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT?!a.isConnected()||this.orphanCanConnectAtEnd(c,a.targetBlock(),b.type)?module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER:module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE:
module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER};module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.render=function(a){(0,module$exports$Blockly$blockRendering$debug.isDebuggerEnabled)()&&!a.renderingDebugger&&(a.renderingDebugger=this.makeDebugger_());var b=this.makeRenderInfo_(a);b.measure();this.makeDrawer_(a,b).draw()};var module$exports$Blockly$blockRendering={isDebuggerEnabled:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.blockRendering.isDebuggerEnabled()","September 2021","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");return(0,module$exports$Blockly$blockRendering$debug.isDebuggerEnabled)()},register:function(a,b){(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.RENDERER,a,b)},unregister:function(a){(0,module$exports$Blockly$registry.unregister)(module$exports$Blockly$registry.Type.RENDERER,
a)},startDebugger:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.blockRendering.startDebugger()","September 2021","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");(0,module$exports$Blockly$blockRendering$debug.startDebugger)()},stopDebugger:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.blockRendering.stopDebugger()","September 2021","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");
(0,module$exports$Blockly$blockRendering$debug.stopDebugger)()},init:function(a,b,c){a=new ((0,module$exports$Blockly$registry.getClass)(module$exports$Blockly$registry.Type.RENDERER,a))(a);a.init(b,c);return a}};module$exports$Blockly$blockRendering.BottomRow=module$exports$Blockly$blockRendering$BottomRow.BottomRow;module$exports$Blockly$blockRendering.Connection=module$exports$Blockly$blockRendering$Connection.Connection;module$exports$Blockly$blockRendering.ConstantProvider=module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider;
module$exports$Blockly$blockRendering.Debug=module$exports$Blockly$blockRendering$Debug.Debug;module$exports$Blockly$blockRendering.Drawer=module$exports$Blockly$blockRendering$Drawer.Drawer;module$exports$Blockly$blockRendering.ExternalValueInput=module$exports$Blockly$blockRendering$ExternalValueInput.ExternalValueInput;module$exports$Blockly$blockRendering.Field=module$exports$Blockly$blockRendering$Field.Field;module$exports$Blockly$blockRendering.Hat=module$exports$Blockly$blockRendering$Hat.Hat;
module$exports$Blockly$blockRendering.Icon=module$exports$Blockly$blockRendering$Icon.Icon;module$exports$Blockly$blockRendering.InRowSpacer=module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer;module$exports$Blockly$blockRendering.InlineInput=module$exports$Blockly$blockRendering$InlineInput.InlineInput;module$exports$Blockly$blockRendering.InputConnection=module$exports$Blockly$blockRendering$InputConnection.InputConnection;module$exports$Blockly$blockRendering.InputRow=module$exports$Blockly$blockRendering$InputRow.InputRow;
module$exports$Blockly$blockRendering.IPathObject=module$exports$Blockly$blockRendering$IPathObject.IPathObject;module$exports$Blockly$blockRendering.JaggedEdge=module$exports$Blockly$blockRendering$JaggedEdge.JaggedEdge;module$exports$Blockly$blockRendering.MarkerSvg=module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg;module$exports$Blockly$blockRendering.Measurable=module$exports$Blockly$blockRendering$Measurable.Measurable;module$exports$Blockly$blockRendering.NextConnection=module$exports$Blockly$blockRendering$NextConnection.NextConnection;
module$exports$Blockly$blockRendering.OutputConnection=module$exports$Blockly$blockRendering$OutputConnection.OutputConnection;module$exports$Blockly$blockRendering.PathObject=module$exports$Blockly$blockRendering$PathObject.PathObject;module$exports$Blockly$blockRendering.PreviousConnection=module$exports$Blockly$blockRendering$PreviousConnection.PreviousConnection;module$exports$Blockly$blockRendering.Renderer=module$exports$Blockly$blockRendering$Renderer.Renderer;
module$exports$Blockly$blockRendering.RenderInfo=module$exports$Blockly$blockRendering$RenderInfo.RenderInfo;module$exports$Blockly$blockRendering.RoundCorner=module$exports$Blockly$blockRendering$RoundCorner.RoundCorner;module$exports$Blockly$blockRendering.Row=module$exports$Blockly$blockRendering$Row.Row;module$exports$Blockly$blockRendering.SpacerRow=module$exports$Blockly$blockRendering$SpacerRow.SpacerRow;module$exports$Blockly$blockRendering.SquareCorner=module$exports$Blockly$blockRendering$SquareCorner.SquareCorner;
module$exports$Blockly$blockRendering.StatementInput=module$exports$Blockly$blockRendering$StatementInput.StatementInput;module$exports$Blockly$blockRendering.TopRow=module$exports$Blockly$blockRendering$TopRow.TopRow;module$exports$Blockly$blockRendering.Types=module$exports$Blockly$blockRendering$Types.Types;module$exports$Blockly$blockRendering.debug=module$exports$Blockly$blockRendering$debug;$.module$exports$Blockly$FieldDropdown={FieldDropdown:function(a,b,c){module$exports$Blockly$Field.Field.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null;this.SERIALIZABLE=!0;this.CURSOR="default";a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(Array.isArray(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],c&&this.configure_(c),this.setValue(this.selectedOption_[1]),b&&this.setValidator(b))}};$.$jscomp.inherits($.module$exports$Blockly$FieldDropdown.FieldDropdown,module$exports$Blockly$Field.Field);$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.fromXml=function(a){this.isOptionListDynamic()&&this.getOptions(!1);this.setValue(a.textContent)};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.loadState=function(a){this.loadLegacyState($.module$exports$Blockly$FieldDropdown.FieldDropdown,a)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(a))};
$.module$exports$Blockly$FieldDropdown.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.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.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.FieldDropdown.prototype.createTextArrow_=function(){this.arrow_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.TSPAN,{},this.textElement_);this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?$.module$exports$Blockly$FieldDropdown.FieldDropdown.ARROW_CHAR+" ":" "+$.module$exports$Blockly$FieldDropdown.FieldDropdown.ARROW_CHAR));this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):
this.textElement_.appendChild(this.arrow_)};$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.FieldDropdown.prototype.showEditor_=function(a){this.dropdownCreate_();this.menu_.openingCoords=a&&"number"===typeof a.clientX?new module$exports$Blockly$utils$Coordinate.Coordinate(a.clientX,a.clientY):null;(0,module$exports$Blockly$dropDownDiv.clearContent)();this.menu_.render((0,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;(0,module$exports$Blockly$dropDownDiv.setColour)(a,b)}(0,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.FieldDropdown.prototype.dropdownCreate_=function(){var a=new module$exports$Blockly$Menu.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;c<b.length;c++){var d=b[c][0],e=b[c][1];if("object"===typeof d){var f=new Image(d.width,d.height);f.src=d.src;f.alt=d.alt||"";d=f}d=new module$exports$Blockly$MenuItem.MenuItem(d,e);d.setRole(module$exports$Blockly$utils$aria.Role.OPTION);
d.setRightToLeft(this.sourceBlock_.RTL);d.setCheckable(!0);a.addChild(d);d.setChecked(e===this.value_);e===this.value_&&(this.selectedMenuItem_=d);d.onAction(this.handleMenuActionEvent_,this)}};$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.dropdownDispose_=function(){this.menu_&&this.menu_.dispose();this.selectedMenuItem_=this.menu_=null;this.applyColour()};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.handleMenuActionEvent_=function(a){(0,module$exports$Blockly$dropDownDiv.hideIfOwner)(this,!0);this.onItemSelected_(this.menu_,a)};$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.onItemSelected_=function(a,b){this.setValue(b.getValue())};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.trimOptions_=function(){var a=this.menuGenerator_;if(Array.isArray(a)){for(var b=!1,c=0;c<a.length;c++){var d=a[c][0];"string"===typeof d?a[c][0]=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(d):(null!==d.alt&&(a[c][0].alt=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(d.alt)),b=!0)}if(!(b||2>a.length)){b=[];for(c=0;c<a.length;c++)b.push(a[c][0]);c=(0,$.module$exports$Blockly$utils$string.shortestStringLength)(b);
d=(0,$.module$exports$Blockly$utils$string.commonWordPrefix)(b,c);var e=(0,$.module$exports$Blockly$utils$string.commonWordSuffix)(b,c);!d&&!e||c<=d+e||(d&&(this.prefixField=b[0].substring(0,d-1)),e&&(this.suffixField=b[0].substr(1-e)),this.menuGenerator_=$.module$exports$Blockly$FieldDropdown.FieldDropdown.applyTrim_(a,d,e))}}};$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.isOptionListDynamic=function(){return"function"===typeof this.menuGenerator_};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.getOptions=function(a){return this.isOptionListDynamic()?(this.generatedOptions_&&a||(this.generatedOptions_=this.menuGenerator_.call(this),module$contents$Blockly$FieldDropdown_validateOptions(this.generatedOptions_)),this.generatedOptions_):this.menuGenerator_};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.doClassValidation_=function(a){for(var b=!1,c=this.getOptions(!0),d=0,e;e=c[d];d++)if(e[1]===a){b=!0;break}return b?a:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+a),null)};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.doValueUpdate_=function(a){module$exports$Blockly$Field.Field.prototype.doValueUpdate_.call(this,a);a=this.getOptions(!0);for(var b=0,c;c=a[b];b++)c[1]===this.value_&&(this.selectedOption_=c)};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.applyColour=function(){this.borderRect_&&(this.borderRect_.setAttribute("stroke",this.sourceBlock_.style.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",this.sourceBlock_.style.colourTertiary):this.borderRect_.setAttribute("fill","transparent"));this.sourceBlock_&&this.arrow_&&(this.sourceBlock_.isShadow()?this.arrow_.style.fill=this.sourceBlock_.style.colourSecondary:this.arrow_.style.fill=this.sourceBlock_.style.colourPrimary)};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.render_=function(){this.textContent_.nodeValue="";this.imageElement_.style.display="none";var a=this.selectedOption_&&this.selectedOption_[0];a&&"object"===typeof a?this.renderSelectedImage_(a):this.renderSelectedText_();this.positionBorderRect_()};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.renderSelectedImage_=function(a){this.imageElement_.style.display="";this.imageElement_.setAttributeNS(module$exports$Blockly$utils$dom.XLINK_NS,"xlink:href",a.src);this.imageElement_.setAttribute("height",a.height);this.imageElement_.setAttribute("width",a.width);var b=Number(a.height);a=Number(a.width);var c=!!this.borderRect_,d=Math.max(c?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,b+module$contents$Blockly$FieldDropdown_IMAGE_Y_PADDING);
c=c?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var e=this.svgArrow_?this.positionSVGArrow_(a+c,d/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):(0,module$exports$Blockly$utils$dom.getFastTextWidth)(this.arrow_,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);this.size_.width=a+e+2*c;this.size_.height=d;var f=0;this.sourceBlock_.RTL?this.imageElement_.setAttribute("x",c+e):(f=a+e,this.textElement_.setAttribute("text-anchor",
"end"),this.imageElement_.setAttribute("x",c));this.imageElement_.setAttribute("y",d/2-b/2);this.positionTextElement_(f+c,a+e)};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.renderSelectedText_=function(){this.textContent_.nodeValue=this.getDisplayText_();(0,module$exports$Blockly$utils$dom.addClass)(this.textElement_,"blocklyDropdownText");this.textElement_.setAttribute("text-anchor","start");var a=!!this.borderRect_,b=Math.max(a?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT),c=(0,module$exports$Blockly$utils$dom.getFastTextWidth)(this.textElement_,this.getConstants().FIELD_TEXT_FONTSIZE,
this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);a=a?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var d=0;this.svgArrow_&&(d=this.positionSVGArrow_(c+a,b/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2));this.size_.width=c+d+2*a;this.size_.height=b;this.positionTextElement_(a,c)};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.positionSVGArrow_=function(a,b){if(!this.svgArrow_)return 0;var c=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,d=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,e=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;this.svgArrow_.setAttribute("transform","translate("+(this.sourceBlock_.RTL?c:a+d)+","+b+")");return e+d};
$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.getText_=function(){if(!this.selectedOption_)return null;var a=this.selectedOption_[0];return"object"===typeof a?a.alt:a};$.module$exports$Blockly$FieldDropdown.FieldDropdown.fromJson=function(a){return new this(a.options,void 0,a)};$.module$exports$Blockly$FieldDropdown.FieldDropdown.applyTrim_=function(a,b,c){for(var d=[],e=0;e<a.length;e++){var f=a[e][0],g=a[e][1];f=f.substring(b,f.length-c);d[e]=[f,g]}return d};var module$contents$Blockly$FieldDropdown_ImageProperties;
$.module$exports$Blockly$FieldDropdown.FieldDropdown.CHECKMARK_OVERHANG=25;$.module$exports$Blockly$FieldDropdown.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.FieldDropdown.ARROW_CHAR=module$exports$Blockly$utils$userAgent.ANDROID?"\u25bc":"\u25be";
var module$contents$Blockly$FieldDropdown_validateOptions=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");if(!a.length)throw TypeError("FieldDropdown options must not be an empty array.");for(var b=!1,c=0;c<a.length;c++){var d=a[c];Array.isArray(d)?"string"!==typeof d[1]?(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option id must be a string. Found "+d[1]+" in: ",d)):d[0]&&"string"!==typeof d[0]&&"string"!==typeof d[0].src&&(b=!0,console.error("Invalid option["+
c+"]: Each FieldDropdown option must have a string label or image description. Found"+d[0]+" in: ",d)):(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option must be an array. Found: ",d))}if(b)throw TypeError("Found invalid FieldDropdown options.");};(0,module$exports$Blockly$fieldRegistry.register)("field_dropdown",$.module$exports$Blockly$FieldDropdown.FieldDropdown);var module$contents$Blockly$Extensions_allExtensions;$.module$exports$Blockly$Extensions={};module$contents$Blockly$Extensions_allExtensions=Object.create(null);$.module$exports$Blockly$Extensions.TEST_ONLY={allExtensions:module$contents$Blockly$Extensions_allExtensions};
$.module$exports$Blockly$Extensions.register=function(a,b){if("string"!==typeof a||""===a.trim())throw Error('Error: Invalid extension name "'+a+'"');if(module$contents$Blockly$Extensions_allExtensions[a])throw Error('Error: Extension "'+a+'" is already registered.');if("function"!==typeof b)throw Error('Error: Extension "'+a+'" must be a function');module$contents$Blockly$Extensions_allExtensions[a]=b};
$.module$exports$Blockly$Extensions.registerMixin=function(a,b){if(!b||"object"!==typeof b)throw Error('Error: Mixin "'+a+'" must be a object');(0,$.module$exports$Blockly$Extensions.register)(a,function(){this.mixin(b)})};
$.module$exports$Blockly$Extensions.registerMutator=function(a,b,c,d){var e='Error when registering mutator "'+a+'": ';module$contents$Blockly$Extensions_checkHasMutatorProperties(e,b);var f=module$contents$Blockly$Extensions_checkMutatorDialog(b,e);if(c&&"function"!==typeof c)throw Error(e+'Extension "'+a+'" is not a function');(0,$.module$exports$Blockly$Extensions.register)(a,function(){if(f){var g=$.module$exports$Blockly$Mutator.Mutator;if(!g)throw Error(e+"Missing require for Blockly.Mutator");
this.setMutator(new g(d||[]))}this.mixin(b);c&&c.apply(this)})};$.module$exports$Blockly$Extensions.unregister=function(a){(0,$.module$exports$Blockly$Extensions.isRegistered)(a)?delete module$contents$Blockly$Extensions_allExtensions[a]:console.warn('No extension mapping for name "'+a+'" found to unregister')};$.module$exports$Blockly$Extensions.isRegistered=function(a){return!!module$contents$Blockly$Extensions_allExtensions[a]};
$.module$exports$Blockly$Extensions.apply=function(a,b,c){var d=module$contents$Blockly$Extensions_allExtensions[a];if("function"!==typeof d)throw Error('Error: Extension "'+a+'" not found.');var e;c?module$contents$Blockly$Extensions_checkNoMutatorProperties(a,b):e=module$contents$Blockly$Extensions_getMutatorProperties(b);d.apply(b);if(c)module$contents$Blockly$Extensions_checkHasMutatorProperties('Error after applying mutator "'+a+'": ',b);else if(!module$contents$Blockly$Extensions_mutatorPropertiesMatch(e,
b))throw Error('Error when applying extension "'+a+'": mutation properties changed when applying a non-mutator extension.');};
var module$contents$Blockly$Extensions_checkNoMutatorProperties=function(a,b){if(module$contents$Blockly$Extensions_getMutatorProperties(b).length)throw Error('Error: tried to apply mutation "'+a+'" to a block that already has mutator functions. Block id: '+b.id);},module$contents$Blockly$Extensions_checkXmlHooks=function(a,b){return module$contents$Blockly$Extensions_checkHasFunctionPair(a.mutationToDom,a.domToMutation,b+" mutationToDom/domToMutation")},module$contents$Blockly$Extensions_checkJsonHooks=
function(a,b){return module$contents$Blockly$Extensions_checkHasFunctionPair(a.saveExtraState,a.loadExtraState,b+" saveExtraState/loadExtraState")},module$contents$Blockly$Extensions_checkMutatorDialog=function(a,b){return module$contents$Blockly$Extensions_checkHasFunctionPair(a.compose,a.decompose,b+" compose/decompose")},module$contents$Blockly$Extensions_checkHasFunctionPair=function(a,b,c){if(a&&b){if("function"!==typeof a||"function"!==typeof b)throw Error(c+" must be a function");return!0}if(!a&&
!b)return!1;throw Error(c+"Must have both or neither functions");},module$contents$Blockly$Extensions_checkHasMutatorProperties=function(a,b){var c=module$contents$Blockly$Extensions_checkXmlHooks(b,a),d=module$contents$Blockly$Extensions_checkJsonHooks(b,a);if(!c&&!d)throw Error(a+"Mutations must contain either XML hooks, or JSON hooks, or both");module$contents$Blockly$Extensions_checkMutatorDialog(b,a)},module$contents$Blockly$Extensions_getMutatorProperties=function(a){var b=[];void 0!==a.domToMutation&&
b.push(a.domToMutation);void 0!==a.mutationToDom&&b.push(a.mutationToDom);void 0!==a.saveExtraState&&b.push(a.saveExtraState);void 0!==a.loadExtraState&&b.push(a.loadExtraState);void 0!==a.compose&&b.push(a.compose);void 0!==a.decompose&&b.push(a.decompose);return b},module$contents$Blockly$Extensions_mutatorPropertiesMatch=function(a,b){b=module$contents$Blockly$Extensions_getMutatorProperties(b);if(b.length!==a.length)return!1;for(var c=0;c<b.length;c++)if(a[c]!==b[c])return!1;return!0};
$.module$exports$Blockly$Extensions.runAfterPageLoad=function(a){if("object"!==typeof document)throw Error("runAfterPageLoad() requires browser document.");if("complete"===document.readyState)a();else var b=setInterval(function(){"complete"===document.readyState&&(clearInterval(b),a())},10)};
$.module$exports$Blockly$Extensions.buildTooltipForDropdown=function(a,b){var c=[];"object"===typeof document&&(0,$.module$exports$Blockly$Extensions.runAfterPageLoad)(function(){for(var d in b)(0,module$exports$Blockly$utils$parsing.checkMessageReferences)(b[d])});return function(){this.type&&-1===c.indexOf(this.type)&&(module$contents$Blockly$Extensions_checkDropdownOptionsInTable(this,a,b),c.push(this.type));this.setTooltip(function(){var d=String(this.getFieldValue(a)),e=b[d];null===e?-1===c.indexOf(this.type)&&
(d="No tooltip mapping for value "+d+" of field "+a,null!==this.type&&(d+=" of block type "+this.type),console.warn(d+".")):e=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(e);return e}.bind(this))}};
var module$contents$Blockly$Extensions_checkDropdownOptionsInTable=function(a,b,c){var d=a.getField(b);if(d instanceof $.module$exports$Blockly$FieldDropdown.FieldDropdown&&!d.isOptionListDynamic()){d=d.getOptions();for(var e=0;e<d.length;e++){var f=d[e][1];null===c[f]&&console.warn("No tooltip mapping for value "+f+" of field "+b+" of block type "+a.type)}}};
$.module$exports$Blockly$Extensions.buildTooltipWithFieldText=function(a,b){"object"===typeof document&&(0,$.module$exports$Blockly$Extensions.runAfterPageLoad)(function(){(0,module$exports$Blockly$utils$parsing.checkMessageReferences)(a)});return function(){this.setTooltip(function(){var c=this.getField(b);return(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a).replace("%1",c?c.getText():"")}.bind(this))}};
var module$contents$Blockly$Extensions_extensionParentTooltip=function(){var a=this.tooltip;this.setTooltip(function(){var b=this.getParent();return b&&b.getInputsInline()&&b.tooltip||a}.bind(this))};(0,$.module$exports$Blockly$Extensions.register)("parent_tooltip_when_inline",module$contents$Blockly$Extensions_extensionParentTooltip);var module$exports$Blockly$utils$Metrics={Metrics:function(){}};var module$exports$Blockly$utils={aria:module$exports$Blockly$utils$aria,colour:module$exports$Blockly$utils$colour};module$exports$Blockly$utils.Coordinate=module$exports$Blockly$utils$Coordinate.Coordinate;module$exports$Blockly$utils.deprecation=module$exports$Blockly$utils$deprecation;module$exports$Blockly$utils.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.KeyCodes;module$exports$Blockly$utils.math=module$exports$Blockly$utils$math;module$exports$Blockly$utils.Metrics=module$exports$Blockly$utils$Metrics.Metrics;module$exports$Blockly$utils.object=$.module$exports$Blockly$utils$object;module$exports$Blockly$utils.parsing=module$exports$Blockly$utils$parsing;module$exports$Blockly$utils.Rect=module$exports$Blockly$utils$Rect.Rect;module$exports$Blockly$utils.Size=module$exports$Blockly$utils$Size.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.Svg;module$exports$Blockly$utils.svgPaths=module$exports$Blockly$utils$svgPaths;module$exports$Blockly$utils.svgMath=module$exports$Blockly$utils$svgMath;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){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.getRelativeXY","December 2021","December 2022","Blockly.utils.svgMath.getRelativeXY");return(0,module$exports$Blockly$utils$svgMath.getRelativeXY)(a)};module$exports$Blockly$utils.getInjectionDivXY_=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.getInjectionDivXY_","December 2021","December 2022","Blockly.utils.svgMath.getInjectionDivXY");return(0,module$exports$Blockly$utils$svgMath.getInjectionDivXY)(a)};
module$exports$Blockly$utils.isRightButton=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.isRightButton","September 2021","September 2022","Blockly.browserEvents.isRightButton");return(0,module$exports$Blockly$browserEvents.isRightButton)(a)};
module$exports$Blockly$utils.mouseToSvg=function(a,b,c){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.mouseToSvg","September 2021","September 2022","Blockly.browserEvents.mouseToSvg");return(0,module$exports$Blockly$browserEvents.mouseToSvg)(a,b,c)};module$exports$Blockly$utils.getScrollDeltaPixels=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.getScrollDeltaPixels","September 2021","September 2022","Blockly.browserEvents.getScrollDeltaPixels");return(0,module$exports$Blockly$browserEvents.getScrollDeltaPixels)(a)};
module$exports$Blockly$utils.tokenizeInterpolation=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.tokenizeInterpolation","December 2021","December 2022","Blockly.utils.parsing.tokenizeInterpolation");return(0,module$exports$Blockly$utils$parsing.tokenizeInterpolation)(a)};
module$exports$Blockly$utils.replaceMessageReferences=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.replaceMessageReferences","December 2021","December 2022","Blockly.utils.parsing.replaceMessageReferences");return(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a)};
module$exports$Blockly$utils.checkMessageReferences=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.checkMessageReferences","December 2021","December 2022","Blockly.utils.parsing.checkMessageReferences");return(0,module$exports$Blockly$utils$parsing.checkMessageReferences)(a)};module$exports$Blockly$utils.genUid=function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.genUid","September 2021","September 2022","Blockly.utils.idGenerator.genUid");return(0,module$exports$Blockly$utils$idGenerator.genUid)()};
module$exports$Blockly$utils.is3dSupported=function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.is3dSupported","December 2021","December 2022","Blockly.utils.svgMath.is3dSupported");return(0,module$exports$Blockly$utils$svgMath.is3dSupported)()};module$exports$Blockly$utils.getViewportBBox=function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.getViewportBBox","December 2021","December 2022","Blockly.utils.svgMath.getViewportBBox");return(0,module$exports$Blockly$utils$svgMath.getViewportBBox)()};
module$exports$Blockly$utils.arrayRemove=function(a,b){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.arrayRemove","December 2021","December 2022");return(0,module$exports$Blockly$utils$array.removeElem)(a,b)};module$exports$Blockly$utils.getDocumentScroll=function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.getDocumentScroll","December 2021","December 2022","Blockly.utils.svgMath.getDocumentScroll");return(0,module$exports$Blockly$utils$svgMath.getDocumentScroll)()};
module$exports$Blockly$utils.getBlockTypeCounts=function(a,b){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.getBlockTypeCounts","December 2021","December 2022","Blockly.common.getBlockTypeCounts");return(0,$.module$exports$Blockly$common.getBlockTypeCounts)(a,b)};
module$exports$Blockly$utils.screenToWsCoordinates=function(a,b){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.screenToWsCoordinates","December 2021","December 2022","Blockly.utils.svgMath.screenToWsCoordinates");return(0,module$exports$Blockly$utils$svgMath.screenToWsCoordinates)(a,b)};
module$exports$Blockly$utils.parseBlockColour=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.parseBlockColour","December 2021","December 2022","Blockly.utils.parsing.parseBlockColour");return(0,module$exports$Blockly$utils$parsing.parseBlockColour)(a)};module$exports$Blockly$utils.runAfterPageLoad=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.utils.runAfterPageLoad","December 2021","December 2022");(0,$.module$exports$Blockly$Extensions.runAfterPageLoad)(a)};var module$exports$Blockly$Events$BlockDelete={BlockDelete:function(a){module$exports$Blockly$Events$BlockBase.BlockBase.call(this,a);this.type=module$exports$Blockly$Events$utils.DELETE;if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");a.isShadow()&&(this.recordUndo=!1);this.oldXml=(0,$.module$exports$Blockly$Xml.blockToDomWithXY)(a);this.ids=(0,module$exports$Blockly$Events$utils.getDescendantIds)(a);this.wasShadow=a.isShadow();this.oldJson=(0,module$exports$Blockly$serialization$blocks.save)(a,
{addCoordinates:!0})}}};$.$jscomp.inherits(module$exports$Blockly$Events$BlockDelete.BlockDelete,module$exports$Blockly$Events$BlockBase.BlockBase);module$exports$Blockly$Events$BlockDelete.BlockDelete.prototype.toJson=function(){var a=module$exports$Blockly$Events$BlockBase.BlockBase.prototype.toJson.call(this);a.oldXml=(0,$.module$exports$Blockly$Xml.domToText)(this.oldXml);a.ids=this.ids;a.wasShadow=this.wasShadow;a.oldJson=this.oldJson;this.recordUndo||(a.recordUndo=this.recordUndo);return a};
module$exports$Blockly$Events$BlockDelete.BlockDelete.prototype.fromJson=function(a){module$exports$Blockly$Events$BlockBase.BlockBase.prototype.fromJson.call(this,a);this.oldXml=(0,$.module$exports$Blockly$Xml.textToDom)(a.oldXml);this.ids=a.ids;this.wasShadow=a.wasShadow||"shadow"===this.oldXml.tagName.toLowerCase();this.oldJson=a.oldJson;void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)};
module$exports$Blockly$Events$BlockDelete.BlockDelete.prototype.run=function(a){var b=this.getEventWorkspace_();if(a)for(a=0;a<this.ids.length;a++){var c=this.ids[a],d=b.getBlockById(c);d?d.dispose(!1):c===this.blockId&&console.warn("Can't delete non-existent block: "+c)}else(0,module$exports$Blockly$serialization$blocks.append)(this.oldJson,b)};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.DELETE,module$exports$Blockly$Events$BlockDelete.BlockDelete);var module$exports$Blockly$Block={Block:function(a,b,c){var d=$.module$exports$Blockly$Generator.Generator;if(d&&"undefined"!==typeof d.prototype[b])throw Error('Block prototypeName "'+b+'" conflicts with Blockly.Generator members.');this.data=null;this.disposed=!1;this.hue_=null;this.colour_="#000000";this.styleName_="";this.loadExtraState=this.saveExtraState=this.domToMutation=this.mutationToDom=this.init=void 0;this.suppressPrefixSuffix=!1;this.getDeveloperVariables=void 0;this.id=c&&!a.getBlockById(c)?
c:(0,module$exports$Blockly$utils$idGenerator.genUid)();a.setBlockById(this.id,this);this.previousConnection=this.nextConnection=this.outputConnection=null;this.inputList=[];this.inputsInline=void 0;this.disabled=!1;this.tooltip="";this.contextMenu=!0;this.parentBlock_=null;this.childBlocks_=[];this.editable_=this.movable_=this.deletable_=!0;this.collapsed_=this.isShadow_=!1;this.comment=this.outputShape_=null;this.commentModel={text:null,pinned:!1,size:new module$exports$Blockly$utils$Size.Size(160,
80)};this.xy_=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0);this.workspace=a;this.isInFlyout=a.isFlyout;this.isInMutator=a.isMutator;this.RTL=a.RTL;this.isInsertionMarker_=!1;this.hat=void 0;this.onchangeWrapper_=this.helpUrl=this.rendered=null;this.statementInputCount=0;if(b){this.type=b;c=module$exports$Blockly$blocks.Blocks[b];if(!c||"object"!==typeof c)throw TypeError("Invalid block definition for type: "+b);(0,$.module$exports$Blockly$utils$object.mixin)(this,c)}a.addTopBlock(this);
a.addTypedBlock(this);this.constructor===module$exports$Blockly$Block.Block&&this.doInit_()}};
module$exports$Blockly$Block.Block.prototype.doInit_=function(){var a=(0,module$exports$Blockly$Events$utils.getGroup)();a||(0,module$exports$Blockly$Events$utils.setGroup)(!0);var b=(0,module$exports$Blockly$Events$utils.getRecordUndo)();try{"function"===typeof this.init&&((0,module$exports$Blockly$Events$utils.setRecordUndo)(!1),this.init(),(0,module$exports$Blockly$Events$utils.setRecordUndo)(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.CREATE))(this))}finally{a||
(0,module$exports$Blockly$Events$utils.setGroup)(!1),(0,module$exports$Blockly$Events$utils.setRecordUndo)(b)}this.inputsInlineDefault=this.inputsInline;"function"===typeof this.onchange&&this.setOnChange(this.onchange)};
module$exports$Blockly$Block.Block.prototype.dispose=function(a){if(this.workspace){this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);this.unplug(a);(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.DELETE))(this));(0,module$exports$Blockly$Events$utils.disable)();try{this.workspace&&(this.workspace.removeTopBlock(this),this.workspace.removeTypedBlock(this),
this.workspace.removeBlockById(this.id),this.workspace=null);(0,$.module$exports$Blockly$common.getSelected)()===this&&(0,$.module$exports$Blockly$common.setSelected)(null);for(var b=this.childBlocks_.length-1;0<=b;b--)this.childBlocks_[b].dispose(!1);a=0;for(b=void 0;b=this.inputList[a];a++)b.dispose();this.inputList.length=0;var c=this.getConnections_(!0);a=0;for(b=void 0;b=c[a];a++)b.dispose()}finally{(0,module$exports$Blockly$Events$utils.enable)(),this.disposed=!0}}};
module$exports$Blockly$Block.Block.prototype.initModel=function(){for(var a=0,b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.initModel&&d.initModel()};module$exports$Blockly$Block.Block.prototype.unplug=function(a){this.outputConnection&&this.unplugFromRow_(a);this.previousConnection&&this.unplugFromStack_(a)};
module$exports$Blockly$Block.Block.prototype.unplugFromRow_=function(a){var b=null;this.outputConnection.isConnected()&&(b=this.outputConnection.targetConnection,this.outputConnection.disconnect());if(b&&a&&(a=this.getOnlyValueConnection_())&&a.isConnected()&&!a.targetBlock().isShadow())if(a=a.targetConnection,a.disconnect(),this.workspace.connectionChecker.canConnect(a,b,!1))b.connect(a);else a.onFailedConnect(b)};
module$exports$Blockly$Block.Block.prototype.getOnlyValueConnection_=function(){for(var a=null,b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;if(c&&c.type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE&&c.targetConnection){if(a)return null;a=c}}return a};
module$exports$Blockly$Block.Block.prototype.unplugFromStack_=function(a){var b=null;this.previousConnection.isConnected()&&(b=this.previousConnection.targetConnection,this.previousConnection.disconnect());var c=this.getNextBlock();a&&c&&!c.isShadow()&&(a=this.nextConnection.targetConnection,a.disconnect(),b&&this.workspace.connectionChecker.canConnect(b,a,!1)&&b.connect(a))};
module$exports$Blockly$Block.Block.prototype.getConnections_=function(a){a=[];this.outputConnection&&a.push(this.outputConnection);this.previousConnection&&a.push(this.previousConnection);this.nextConnection&&a.push(this.nextConnection);for(var b=0,c;c=this.inputList[b];b++)c.connection&&a.push(c.connection);return a};module$exports$Blockly$Block.Block.prototype.lastConnectionInStack=function(a){for(var b=this.nextConnection;b;){var c=b.targetBlock();if(!c||a&&c.isShadow())return b;b=c.nextConnection}return null};
module$exports$Blockly$Block.Block.prototype.bumpNeighbours=function(){};module$exports$Blockly$Block.Block.prototype.getParent=function(){return this.parentBlock_};module$exports$Blockly$Block.Block.prototype.getInputWithBlock=function(a){for(var b=0,c;c=this.inputList[b];b++)if(c.connection&&c.connection.targetBlock()===a)return c;return null};
module$exports$Blockly$Block.Block.prototype.getSurroundParent=function(){var a=this;do{var b=a;a=a.getParent();if(!a)return null}while(a.getNextBlock()===b);return a};module$exports$Blockly$Block.Block.prototype.getNextBlock=function(){return this.nextConnection&&this.nextConnection.targetBlock()};module$exports$Blockly$Block.Block.prototype.getPreviousBlock=function(){return this.previousConnection&&this.previousConnection.targetBlock()};
module$exports$Blockly$Block.Block.prototype.getFirstStatementConnection=function(){for(var a=0,b;b=this.inputList[a];a++)if(b.connection&&b.connection.type===$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT)return b.connection;return null};module$exports$Blockly$Block.Block.prototype.getRootBlock=function(){var a=this;do{var b=a;a=b.parentBlock_}while(a);return b};
module$exports$Blockly$Block.Block.prototype.getTopStackBlock=function(){var a=this;do var b=a.getPreviousBlock();while(b&&b.getNextBlock()===a&&(a=b));return a};module$exports$Blockly$Block.Block.prototype.getChildren=function(a){if(!a)return this.childBlocks_;a=[];for(var b=0,c;c=this.inputList[b];b++)c.connection&&(c=c.connection.targetBlock())&&a.push(c);(b=this.getNextBlock())&&a.push(b);return a};
module$exports$Blockly$Block.Block.prototype.setParent=function(a){if(a!==this.parentBlock_){var b=this.previousConnection&&this.previousConnection.targetBlock()||this.outputConnection&&this.outputConnection.targetBlock(),c=!!b;if(c&&a&&b!==a)throw Error("Block connected to superior one that is not new parent.");if(!c&&a)throw Error("Block not connected to new parent.");if(c&&!a)throw Error("Cannot set parent to null while block is still connected to superior block.");this.parentBlock_?(0,module$exports$Blockly$utils$array.removeElem)(this.parentBlock_.childBlocks_,
this):this.workspace.removeTopBlock(this);(this.parentBlock_=a)?a.childBlocks_.push(this):this.workspace.addTopBlock(this)}};module$exports$Blockly$Block.Block.prototype.getDescendants=function(a){for(var b=[this],c=this.getChildren(a),d,e=0;d=c[e];e++)b.push.apply(b,d.getDescendants(a));return b};module$exports$Blockly$Block.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};
module$exports$Blockly$Block.Block.prototype.setDeletable=function(a){this.deletable_=a};module$exports$Blockly$Block.Block.prototype.isMovable=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};module$exports$Blockly$Block.Block.prototype.setMovable=function(a){this.movable_=a};
module$exports$Blockly$Block.Block.prototype.isDuplicatable=function(){return this.workspace.hasBlockLimits()?this.workspace.isCapacityAvailable((0,$.module$exports$Blockly$common.getBlockTypeCounts)(this,!0)):!0};module$exports$Blockly$Block.Block.prototype.isShadow=function(){return this.isShadow_};module$exports$Blockly$Block.Block.prototype.setShadow=function(a){this.isShadow_=a};module$exports$Blockly$Block.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_};
module$exports$Blockly$Block.Block.prototype.setInsertionMarker=function(a){this.isInsertionMarker_=a};module$exports$Blockly$Block.Block.prototype.isEditable=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)};module$exports$Blockly$Block.Block.prototype.setEditable=function(a){this.editable_=a;a=0;for(var b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.updateEditable()};module$exports$Blockly$Block.Block.prototype.isDisposed=function(){return this.disposed};
module$exports$Blockly$Block.Block.prototype.getMatchingConnection=function(a,b){var c=this.getConnections_(!0);a=a.getConnections_(!0);if(c.length!==a.length)throw Error("Connection lists did not match in length.");for(var d=0;d<a.length;d++)if(a[d]===b)return c[d];return null};module$exports$Blockly$Block.Block.prototype.setHelpUrl=function(a){this.helpUrl=a};module$exports$Blockly$Block.Block.prototype.setTooltip=function(a){this.tooltip=a};
module$exports$Blockly$Block.Block.prototype.getTooltip=function(){return(0,module$exports$Blockly$Tooltip.getTooltipOfObject)(this)};module$exports$Blockly$Block.Block.prototype.getColour=function(){return this.colour_};module$exports$Blockly$Block.Block.prototype.getStyleName=function(){return this.styleName_};module$exports$Blockly$Block.Block.prototype.getHue=function(){return this.hue_};
module$exports$Blockly$Block.Block.prototype.setColour=function(a){a=(0,module$exports$Blockly$utils$parsing.parseBlockColour)(a);this.hue_=a.hue;this.colour_=a.hex};module$exports$Blockly$Block.Block.prototype.setStyle=function(a){this.styleName_=a};
module$exports$Blockly$Block.Block.prototype.setOnChange=function(a){if(a&&"function"!==typeof a)throw Error("onchange must be a function.");this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);if(this.onchange=a)this.onchangeWrapper_=a.bind(this),this.workspace.addChangeListener(this.onchangeWrapper_)};
module$exports$Blockly$Block.Block.prototype.getField=function(a){if("string"!==typeof a)throw TypeError("Block.prototype.getField expects a string with the field name but received "+(void 0===a?"nothing":a+" of type "+typeof a)+" instead");for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)if(e.name===a)return e;return null};
module$exports$Blockly$Block.Block.prototype.getVars=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.push(e.getValue());return a};module$exports$Blockly$Block.Block.prototype.getVarModels=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&(e=this.workspace.getVariableById(e.getValue()))&&a.push(e);return a};
module$exports$Blockly$Block.Block.prototype.updateVarName=function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.getId()===e.getValue()&&e.refreshVariableName()};module$exports$Blockly$Block.Block.prototype.renameVarById=function(a,b){for(var c=0,d;d=this.inputList[c];c++)for(var e=0,f;f=d.fieldRow[e];e++)f.referencesVariables()&&a===f.getValue()&&f.setValue(b)};
module$exports$Blockly$Block.Block.prototype.getFieldValue=function(a){return(a=this.getField(a))?a.getValue():null};module$exports$Blockly$Block.Block.prototype.setFieldValue=function(a,b){var c=this.getField(b);if(!c)throw Error('Field "'+b+'" not found.');c.setValue(a)};
module$exports$Blockly$Block.Block.prototype.setPreviousStatement=function(a,b){if(a)void 0===b&&(b=null),this.previousConnection||(this.previousConnection=this.makeConnection_($.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT)),this.previousConnection.setCheck(b);else if(this.previousConnection){if(this.previousConnection.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.previousConnection.dispose();this.previousConnection=null}};
module$exports$Blockly$Block.Block.prototype.setNextStatement=function(a,b){if(a)void 0===b&&(b=null),this.nextConnection||(this.nextConnection=this.makeConnection_($.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT)),this.nextConnection.setCheck(b);else if(this.nextConnection){if(this.nextConnection.isConnected())throw Error("Must disconnect next statement before removing connection.");this.nextConnection.dispose();this.nextConnection=null}};
module$exports$Blockly$Block.Block.prototype.setOutput=function(a,b){if(a)void 0===b&&(b=null),this.outputConnection||(this.outputConnection=this.makeConnection_($.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE)),this.outputConnection.setCheck(b);else if(this.outputConnection){if(this.outputConnection.isConnected())throw Error("Must disconnect output value before removing connection.");this.outputConnection.dispose();this.outputConnection=null}};
module$exports$Blockly$Block.Block.prototype.setInputsInline=function(a){this.inputsInline!==a&&((0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(this,"inline",null,this.inputsInline,a)),this.inputsInline=a)};
module$exports$Blockly$Block.Block.prototype.getInputsInline=function(){if(void 0!==this.inputsInline)return this.inputsInline;for(var a=1;a<this.inputList.length;a++)if(this.inputList[a-1].type===$.module$exports$Blockly$inputTypes.inputTypes.DUMMY&&this.inputList[a].type===$.module$exports$Blockly$inputTypes.inputTypes.DUMMY)return!1;for(a=1;a<this.inputList.length;a++)if(this.inputList[a-1].type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE&&this.inputList[a].type===$.module$exports$Blockly$inputTypes.inputTypes.DUMMY)return!0;
return!1};module$exports$Blockly$Block.Block.prototype.setOutputShape=function(a){this.outputShape_=a};module$exports$Blockly$Block.Block.prototype.getOutputShape=function(){return this.outputShape_};module$exports$Blockly$Block.Block.prototype.isEnabled=function(){return!this.disabled};
module$exports$Blockly$Block.Block.prototype.setEnabled=function(a){if(this.isEnabled()!==a){var b=this.disabled;this.disabled=!a;(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(this,"disabled",null,b,!a))}};module$exports$Blockly$Block.Block.prototype.getInheritedDisabled=function(){for(var a=this.getSurroundParent();a;){if(a.disabled)return!0;a=a.getSurroundParent()}return!1};
module$exports$Blockly$Block.Block.prototype.isCollapsed=function(){return this.collapsed_};module$exports$Blockly$Block.Block.prototype.setCollapsed=function(a){this.collapsed_!==a&&((0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(this,"collapsed",null,this.collapsed_,a)),this.collapsed_=a)};
module$exports$Blockly$Block.Block.prototype.toString=function(a,b){function c(l){var m=l.getCheck();!m&&l.targetConnection&&(m=l.targetConnection.getCheck());return!!m&&(-1!==m.indexOf("Boolean")||-1!==m.indexOf("Number"))}function d(){g&&g.getType()===h.getType()&&g.getLocation()===h.getLocation()&&(g=null)}var e=[];b=b||"?";var f=module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS;module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS=!0;for(var g=module$exports$Blockly$ASTNode.ASTNode.createBlockNode(this),
h=g;g;){switch(g.getType()){case module$exports$Blockly$ASTNode.ASTNode.types.INPUT:var k=g.getLocation();g.in()?c(k)&&e.push("("):e.push(b);break;case module$exports$Blockly$ASTNode.ASTNode.types.FIELD:k=g.getLocation(),k.name!==module$exports$Blockly$constants.COLLAPSED_FIELD_NAME&&e.push(k.getText())}k=g;g=k.in()||k.next();if(!g){g=k.out();for(d();g&&!g.next();)g=g.out(),d(),g&&g.getType()===module$exports$Blockly$ASTNode.ASTNode.types.INPUT&&c(g.getLocation())&&e.push(")");g&&(g=g.next())}}module$exports$Blockly$ASTNode.ASTNode.NAVIGATE_ALL_FIELDS=
f;for(b=2;b<e.length;b++)"("===e[b-2]&&")"===e[b]&&(e[b-2]=e[b-1],e.splice(b-1,2));e=e.reduce(function(l,m){return l+("("===l.substr(-1)||")"===m?"":" ")+m},"");e=e.trim()||"???";a&&e.length>a&&(e=e.substring(0,a-3)+"...");return e};module$exports$Blockly$Block.Block.prototype.appendValueInput=function(a){return this.appendInput_($.module$exports$Blockly$inputTypes.inputTypes.VALUE,a)};
module$exports$Blockly$Block.Block.prototype.appendStatementInput=function(a){return this.appendInput_($.module$exports$Blockly$inputTypes.inputTypes.STATEMENT,a)};module$exports$Blockly$Block.Block.prototype.appendDummyInput=function(a){return this.appendInput_($.module$exports$Blockly$inputTypes.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$parsing.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$parsing.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;b<a.length;b++)(0,$.module$exports$Blockly$Extensions.apply)(a[b],this,!1)};module$exports$Blockly$Block.Block.prototype.jsonInitColour_=function(a,b){if("colour"in a)if(void 0===a.colour)console.warn(b+"Undefined colour value.");else{a=a.colour;try{this.setColour(a)}catch(c){console.warn(b+"Illegal colour value: ",a)}}};module$exports$Blockly$Block.Block.prototype.jsonInitStyle_=function(a,b){a=a.style;try{this.setStyle(a)}catch(c){console.warn(b+"Style does not exist: ",a)}};
module$exports$Blockly$Block.Block.prototype.mixin=function(a,b){if(void 0!==b&&"boolean"!==typeof b)throw Error("opt_disableCheck must be a boolean if provided");if(!b){b=[];for(var c in a)void 0!==this[c]&&b.push(c);if(b.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(b));}(0,$.module$exports$Blockly$utils$object.mixin)(this,a)};
module$exports$Blockly$Block.Block.prototype.interpolate_=function(a,b,c,d){a=(0,module$exports$Blockly$utils$parsing.tokenizeInterpolation)(a);this.validateTokens_(a,b.length);b=this.interpolateArguments_(a,b,c);c=[];a=0;for(var e;e=b[a];a++)if(this.isInputKeyword_(e.type)){if(e=this.inputFromJson_(e,d)){for(var f=0,g;g=c[f];f++)e.appendField(g[0],g[1]);c.length=0}}else(f=this.fieldFromJson_(e))&&c.push([f,e.name])};
module$exports$Blockly$Block.Block.prototype.validateTokens_=function(a,b){for(var c=[],d=0,e=0;e<a.length;e++){var f=a[e];if("number"===typeof f){if(1>f||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<a.length;e++){var f=a[e];"number"===typeof f&&(f=b[f-1]);if("string"===typeof f&&(f=this.stringToFieldJson_(f),!f))continue;d.push(f)}(a=d.length)&&!this.isInputKeyword_(d[a-1].type)&&(a={type:"input_dummy"},c&&(a.align=c),d.push(a));return d};
module$exports$Blockly$Block.Block.prototype.fieldFromJson_=function(a){var b=(0,module$exports$Blockly$fieldRegistry.fromJson)(a);return!b&&a.alt?"string"===typeof a.alt?(a=this.stringToFieldJson_(a.alt))?this.fieldFromJson_(a):null:this.fieldFromJson_(a.alt):b};
module$exports$Blockly$Block.Block.prototype.inputFromJson_=function(a,b){var c={LEFT:$.module$exports$Blockly$Input.Align.LEFT,RIGHT:$.module$exports$Blockly$Input.Align.RIGHT,CENTRE:$.module$exports$Blockly$Input.Align.CENTRE,CENTER:$.module$exports$Blockly$Input.Align.CENTRE},d=null;switch(a.type){case "input_value":d=this.appendValueInput(a.name);break;case "input_statement":d=this.appendStatementInput(a.name);break;case "input_dummy":d=this.appendDummyInput(a.name)}if(!d)return null;a.check&&
d.setCheck(a.check);a.align&&(c=c[a.align.toUpperCase()],void 0===c?console.warn(b+"Illegal align value: ",a.align):d.setAlign(c));return d};module$exports$Blockly$Block.Block.prototype.isInputKeyword_=function(a){return"input_value"===a||"input_statement"===a||"input_dummy"===a};module$exports$Blockly$Block.Block.prototype.stringToFieldJson_=function(a){return(a=a.trim())?{type:"field_label",text:a}:null};
module$exports$Blockly$Block.Block.prototype.appendInput_=function(a,b){var c=null;if(a===$.module$exports$Blockly$inputTypes.inputTypes.VALUE||a===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT)c=this.makeConnection_(a);a===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT&&this.statementInputCount++;a=new $.module$exports$Blockly$Input.Input(a,b,this,c);this.inputList.push(a);return a};
module$exports$Blockly$Block.Block.prototype.moveInputBefore=function(a,b){if(a!==b){for(var c=-1,d=b?-1:this.inputList.length,e=0,f;f=this.inputList[e];e++)if(f.name===a){if(c=e,-1!==d)break}else if(b&&f.name===b&&(d=e,-1!==c))break;if(-1===c)throw Error('Named input "'+a+'" not found.');if(-1===d)throw Error('Reference input "'+b+'" not found.');this.moveNumberedInputBefore(c,d)}};
module$exports$Blockly$Block.Block.prototype.moveNumberedInputBefore=function(a,b){if(a===b)throw Error("Can't move input to itself.");if(a>=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<b&&b--;this.inputList.splice(b,0,c)};
module$exports$Blockly$Block.Block.prototype.removeInput=function(a,b){for(var c=0,d;d=this.inputList[c];c++)if(d.name===a)return d.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT&&this.statementInputCount--,d.dispose(),this.inputList.splice(c,1),!0;if(b)return!1;throw Error("Input not found: "+a);};module$exports$Blockly$Block.Block.prototype.getInput=function(a){for(var b=0,c;c=this.inputList[b];b++)if(c.name===a)return c;return null};
module$exports$Blockly$Block.Block.prototype.getInputTargetBlock=function(a){return(a=this.getInput(a))&&a.connection&&a.connection.targetBlock()};module$exports$Blockly$Block.Block.prototype.getCommentText=function(){return this.commentModel.text};
module$exports$Blockly$Block.Block.prototype.setCommentText=function(a){this.commentModel.text!==a&&((0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(this,"comment",null,this.commentModel.text,a)),this.comment=this.commentModel.text=a)};module$exports$Blockly$Block.Block.prototype.setWarningText=function(a,b){};module$exports$Blockly$Block.Block.prototype.setMutator=function(a){};
module$exports$Blockly$Block.Block.prototype.getRelativeToSurfaceXY=function(){return this.xy_};module$exports$Blockly$Block.Block.prototype.moveBy=function(a,b){if(this.parentBlock_)throw Error("Block has parent.");var c=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.MOVE))(this);this.xy_.translate(a,b);c.recordNew();(0,module$exports$Blockly$Events$utils.fire)(c)};
module$exports$Blockly$Block.Block.prototype.makeConnection_=function(a){return new module$exports$Blockly$Connection.Connection(this,a)};module$exports$Blockly$Block.Block.prototype.allInputsFilled=function(a){void 0===a&&(a=!0);if(!a&&this.isShadow())return!1;for(var b=0,c;c=this.inputList[b];b++)if(c.connection&&(c=c.connection.targetBlock(),!c||!c.allInputsFilled(a)))return!1;return(b=this.getNextBlock())?b.allInputsFilled(a):!0};
module$exports$Blockly$Block.Block.prototype.toDevString=function(){var a=this.type?'"'+this.type+'" block':"Block";this.id&&(a+=' (id="'+this.id+'")');return a};module$exports$Blockly$Block.Block.COLLAPSED_INPUT_NAME=module$exports$Blockly$constants.COLLAPSED_INPUT_NAME;module$exports$Blockly$Block.Block.COLLAPSED_FIELD_NAME=module$exports$Blockly$constants.COLLAPSED_FIELD_NAME;var module$exports$Blockly$ContextMenuRegistry={ContextMenuRegistry:function(){this.reset()}};module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.prototype.reset=function(){this.registry_=Object.create(null)};module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.prototype.register=function(a){if(this.registry_[a.id])throw Error('Menu item with ID "'+a.id+'" is already registered.');this.registry_[a.id]=a};
module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.prototype.unregister=function(a){if(!this.registry_[a])throw Error('Menu item with ID "'+a+'" not found.');delete this.registry_[a]};module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.prototype.getItem=function(a){return this.registry_[a]||null};
module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.prototype.getContextMenuOptions=function(a,b){var c=[],d=this.registry_;Object.keys(d).forEach(function(e){e=d[e];if(a===e.scopeType){var f=e.preconditionFn(b);"hidden"!==f&&(e={text:"function"===typeof e.displayText?e.displayText(b):e.displayText,enabled:"enabled"===f,callback:e.callback,scope:b,weight:e.weight},c.push(e))}});c.sort(function(e,f){return e.weight-f.weight});return c};
module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType={BLOCK:"block",WORKSPACE:"workspace"};module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry=new module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry;var module$exports$Blockly$IBoundedElement={IBoundedElement:function(){}};var module$exports$Blockly$IMovable={IMovable:function(){}};var module$exports$Blockly$ISelectable={ISelectable:function(){}};var module$exports$Blockly$ICopyable={ICopyable:function(){}};var module$exports$Blockly$RenderedConnection={},module$contents$Blockly$RenderedConnection_BUMP_RANDOMNESS=10;
module$exports$Blockly$RenderedConnection.RenderedConnection=function(a,b){module$exports$Blockly$Connection.Connection.call(this,a,b);this.db_=a.workspace.connectionDBList[b];this.dbOpposite_=a.workspace.connectionDBList[module$exports$Blockly$internalConstants.OPPOSITE_TYPE[b]];this.offsetInBlock_=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0);this.trackedState_=module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.WILL_TRACK;this.targetConnection=null};
$.$jscomp.inherits(module$exports$Blockly$RenderedConnection.RenderedConnection,module$exports$Blockly$Connection.Connection);module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.dispose=function(){module$exports$Blockly$Connection.Connection.prototype.dispose.call(this);this.trackedState_===module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y)};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.getSourceBlock=function(){return module$exports$Blockly$Connection.Connection.prototype.getSourceBlock.call(this)};module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.targetBlock=function(){return module$exports$Blockly$Connection.Connection.prototype.targetBlock.call(this)};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.distanceFrom=function(a){var b=this.x-a.x;a=this.y-a.y;return Math.sqrt(b*b+a*a)};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.bumpAwayFrom=function(a){if(!this.sourceBlock_.workspace.isDragging()){var b=this.sourceBlock_.getRootBlock();if(!b.isInFlyout){var c=!1;if(!b.isMovable()){b=a.getSourceBlock().getRootBlock();if(!b.isMovable())return;a=this;c=!0}var d=(0,$.module$exports$Blockly$common.getSelected)()==b;d||b.addSelect();var e=a.x+$.module$exports$Blockly$config.config.snapRadius+Math.floor(Math.random()*module$contents$Blockly$RenderedConnection_BUMP_RANDOMNESS)-
this.x,f=a.y+$.module$exports$Blockly$config.config.snapRadius+Math.floor(Math.random()*module$contents$Blockly$RenderedConnection_BUMP_RANDOMNESS)-this.y;c&&(f=-f);b.RTL&&(e=a.x-$.module$exports$Blockly$config.config.snapRadius-Math.floor(Math.random()*module$contents$Blockly$RenderedConnection_BUMP_RANDOMNESS)-this.x);b.moveBy(e,f);d||b.removeSelect()}}};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.moveTo=function(a,b){this.trackedState_===module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.WILL_TRACK?(this.db_.addConnection(this,b),this.trackedState_=module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.TRACKED):this.trackedState_===module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.TRACKED&&(this.db_.removeConnection(this,this.y),this.db_.addConnection(this,
b));this.x=a;this.y=b};module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.moveBy=function(a,b){this.moveTo(this.x+a,this.y+b)};module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.moveToOffset=function(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)};module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.setOffsetInBlock=function(a,b){this.offsetInBlock_.x=a;this.offsetInBlock_.y=b};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.getOffsetInBlock=function(){return this.offsetInBlock_};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.tighten=function(){var a=this.targetConnection.x-this.x,b=this.targetConnection.y-this.y;if(0!==a||0!==b){var c=this.targetBlock(),d=c.getSvgRoot();if(!d)throw Error("block is not rendered.");d=(0,module$exports$Blockly$utils$svgMath.getRelativeXY)(d);c.getSvgRoot().setAttribute("transform","translate("+(d.x-a)+","+(d.y-b)+")");c.moveConnections(-a,-b)}};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.closest=function(a,b){return this.dbOpposite_.searchForClosest(this,a,b)};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.highlight=function(){var a=this.sourceBlock_.workspace.getRenderer().getConstants();var b=a.shapeFor(this);this.type===$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE||this.type===$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE?(a=a.TAB_OFFSET_FROM_TOP,b=(0,module$exports$Blockly$utils$svgPaths.moveBy)(0,-a)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",a)+b.pathDown+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",
a)):(a=a.NOTCH_OFFSET_LEFT-a.CORNER_RADIUS,b=(0,module$exports$Blockly$utils$svgPaths.moveBy)(-a,0)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",a)+b.pathLeft+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",a));a=this.sourceBlock_.getRelativeToSurfaceXY();module$exports$Blockly$Connection.Connection.highlightedPath_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{"class":"blocklyHighlightedConnectionPath",d:b,transform:"translate("+
(this.x-a.x)+","+(this.y-a.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())};module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.unhighlight=function(){(0,module$exports$Blockly$utils$dom.removeNode)(module$exports$Blockly$Connection.Connection.highlightedPath_);delete module$exports$Blockly$Connection.Connection.highlightedPath_};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.setTracking=function(a){a&&this.trackedState_===module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.TRACKED||!a&&this.trackedState_===module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(a?(this.db_.addConnection(this,this.y),this.trackedState_=module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.TRACKED):(this.trackedState_===
module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y),this.trackedState_=module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState.UNTRACKED))};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.stopTrackingAll=function(){this.setTracking(!1);if(this.targetConnection)for(var a=this.targetBlock().getDescendants(!1),b=0;b<a.length;b++){for(var c=a[b],d=c.getConnections_(!0),e=0;e<d.length;e++)d[e].setTracking(!1);c=c.getIcons();for(d=0;d<c.length;d++)c[d].setVisible(!1)}};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.startTrackingAll=function(){this.setTracking(!0);var a=[];if(this.type!==$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE&&this.type!==$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT)return a;var b=this.targetBlock();if(b){if(b.isCollapsed()){var c=[];b.outputConnection&&c.push(b.outputConnection);b.nextConnection&&c.push(b.nextConnection);b.previousConnection&&c.push(b.previousConnection)}else c=
b.getConnections_(!0);for(var d=0;d<c.length;d++)a.push.apply(a,c[d].startTrackingAll());a.length||(a=[b])}return a};
module$exports$Blockly$RenderedConnection.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$config.config.bumpDelay)}};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.disconnectInternal_=function(a,b){module$exports$Blockly$Connection.Connection.prototype.disconnectInternal_.call(this,a,b);a.rendered&&a.render();b.rendered&&(b.updateDisabled(),b.render(),b.getSvgRoot().style.display="block")};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.respawnShadow_=function(){module$exports$Blockly$Connection.Connection.prototype.respawnShadow_.call(this);var a=this.targetBlock();a&&(a.initSvg(),a.render(!1),a=this.getSourceBlock(),a.rendered&&a.render())};module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.neighbours=function(a){return this.dbOpposite_.getNeighbours(this,a)};
module$exports$Blockly$RenderedConnection.RenderedConnection.prototype.connect_=function(a){module$exports$Blockly$Connection.Connection.prototype.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.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())};module$exports$Blockly$RenderedConnection.RenderedConnection.TrackedState={WILL_TRACK:-1,UNTRACKED:0,TRACKED:1};var module$exports$Blockly$Marker={Marker:function(){this.drawer_=this.curNode_=this.colour=null;this.type="marker"}};module$exports$Blockly$Marker.Marker.prototype.setDrawer=function(a){this.drawer_=a};module$exports$Blockly$Marker.Marker.prototype.getDrawer=function(){return this.drawer_};module$exports$Blockly$Marker.Marker.prototype.getCurNode=function(){return this.curNode_};
module$exports$Blockly$Marker.Marker.prototype.setCurNode=function(a){var b=this.curNode_;this.curNode_=a;this.drawer_&&this.drawer_.draw(b,this.curNode_)};module$exports$Blockly$Marker.Marker.prototype.draw=function(){this.drawer_&&this.drawer_.draw(this.curNode_,this.curNode_)};module$exports$Blockly$Marker.Marker.prototype.hide=function(){this.drawer_&&this.drawer_.hide()};module$exports$Blockly$Marker.Marker.prototype.dispose=function(){this.getDrawer()&&this.getDrawer().dispose()};var module$exports$Blockly$Cursor={Cursor:function(){module$exports$Blockly$Marker.Marker.call(this);this.type="cursor"}};$.$jscomp.inherits(module$exports$Blockly$Cursor.Cursor,module$exports$Blockly$Marker.Marker);
module$exports$Blockly$Cursor.Cursor.prototype.next=function(){var a=this.getCurNode();if(!a)return null;for(a=a.next();a&&a.next()&&(a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.NEXT||a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.BLOCK);)a=a.next();a&&this.setCurNode(a);return a};
module$exports$Blockly$Cursor.Cursor.prototype.in=function(){var a=this.getCurNode();if(!a)return null;if(a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.PREVIOUS||a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.OUTPUT)a=a.next();(a=a.in())&&this.setCurNode(a);return a};
module$exports$Blockly$Cursor.Cursor.prototype.prev=function(){var a=this.getCurNode();if(!a)return null;for(a=a.prev();a&&a.prev()&&(a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.NEXT||a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.BLOCK);)a=a.prev();a&&this.setCurNode(a);return a};
module$exports$Blockly$Cursor.Cursor.prototype.out=function(){var a=this.getCurNode();if(!a)return null;(a=a.out())&&a.getType()===module$exports$Blockly$ASTNode.ASTNode.types.BLOCK&&(a=a.prev()||a);a&&this.setCurNode(a);return a};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.CURSOR,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$Cursor.Cursor);var module$exports$Blockly$BasicCursor={BasicCursor:function(){module$exports$Blockly$Cursor.Cursor.call(this)}};$.$jscomp.inherits(module$exports$Blockly$BasicCursor.BasicCursor,module$exports$Blockly$Cursor.Cursor);module$exports$Blockly$BasicCursor.BasicCursor.prototype.next=function(){var a=this.getCurNode();if(!a)return null;(a=this.getNextNode_(a,this.validNode_))&&this.setCurNode(a);return a};module$exports$Blockly$BasicCursor.BasicCursor.prototype.in=function(){return this.next()};
module$exports$Blockly$BasicCursor.BasicCursor.prototype.prev=function(){var a=this.getCurNode();if(!a)return null;(a=this.getPreviousNode_(a,this.validNode_))&&this.setCurNode(a);return a};module$exports$Blockly$BasicCursor.BasicCursor.prototype.out=function(){return this.prev()};
module$exports$Blockly$BasicCursor.BasicCursor.prototype.getNextNode_=function(a,b){if(!a)return null;var c=a.in()||a.next();if(b(c))return c;if(c)return this.getNextNode_(c,b);a=this.findSiblingOrParent_(a.out());return b(a)?a:a?this.getNextNode_(a,b):null};module$exports$Blockly$BasicCursor.BasicCursor.prototype.getPreviousNode_=function(a,b){if(!a)return null;var c=a.prev();c=c?this.getRightMostChild_(c):a.out();return b(c)?c:c?this.getPreviousNode_(c,b):null};
module$exports$Blockly$BasicCursor.BasicCursor.prototype.validNode_=function(a){var b=!1;a=a&&a.getType();if(a===module$exports$Blockly$ASTNode.ASTNode.types.OUTPUT||a===module$exports$Blockly$ASTNode.ASTNode.types.INPUT||a===module$exports$Blockly$ASTNode.ASTNode.types.FIELD||a===module$exports$Blockly$ASTNode.ASTNode.types.NEXT||a===module$exports$Blockly$ASTNode.ASTNode.types.PREVIOUS||a===module$exports$Blockly$ASTNode.ASTNode.types.WORKSPACE)b=!0;return b};
module$exports$Blockly$BasicCursor.BasicCursor.prototype.findSiblingOrParent_=function(a){if(!a)return null;var b=a.next();return b?b:this.findSiblingOrParent_(a.out())};module$exports$Blockly$BasicCursor.BasicCursor.prototype.getRightMostChild_=function(a){if(!a.in())return a;for(a=a.in();a.next();)a=a.next();return this.getRightMostChild_(a)};module$exports$Blockly$BasicCursor.BasicCursor.registrationName="basicCursor";
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.CURSOR,module$exports$Blockly$BasicCursor.BasicCursor.registrationName,module$exports$Blockly$BasicCursor.BasicCursor);var module$exports$Blockly$TabNavigateCursor={TabNavigateCursor:function(){module$exports$Blockly$BasicCursor.BasicCursor.apply(this,arguments)}};$.$jscomp.inherits(module$exports$Blockly$TabNavigateCursor.TabNavigateCursor,module$exports$Blockly$BasicCursor.BasicCursor);
module$exports$Blockly$TabNavigateCursor.TabNavigateCursor.prototype.validNode_=function(a){var b=!1,c=a&&a.getType();a&&(a=a.getLocation(),c===module$exports$Blockly$ASTNode.ASTNode.types.FIELD&&a&&a.isTabNavigable()&&a.isClickable()&&(b=!0));return b};var module$exports$Blockly$Events$Selected={Selected:function(a,b,c){module$exports$Blockly$Events$UiBase.UiBase.call(this,c);this.oldElementId=a;this.newElementId=b;this.type=module$exports$Blockly$Events$utils.SELECTED}};$.$jscomp.inherits(module$exports$Blockly$Events$Selected.Selected,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$Selected.Selected.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.oldElementId=this.oldElementId;a.newElementId=this.newElementId;return a};module$exports$Blockly$Events$Selected.Selected.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.fromJson.call(this,a);this.oldElementId=a.oldElementId;this.newElementId=a.newElementId};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.SELECTED,module$exports$Blockly$Events$Selected.Selected);var module$exports$Blockly$BlockSvg={BlockSvg:function(a,b,c){module$exports$Blockly$Block.Block.call(this,a,b,c);this.decompose=this.decompose;this.compose=this.compose;this.saveConnections=this.saveConnections;this.customContextMenu=this.customContextMenu;this.renderingDebugger=null;this.width=this.height=0;this.warning=this.commentIcon_=this.comment=this.mutator=this.warningTextDb_=null;this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,
{},null);this.svgGroup_.translate_="";this.style=a.getRenderer().getConstants().getBlockStyle(null);this.pathObject=a.getRenderer().makePathObject(this.svgGroup_,this.style);this.eventsInit_=this.renderIsInProgress_=this.rendered=!1;this.useDragSurface_=(0,module$exports$Blockly$utils$svgMath.is3dSupported)()&&!!a.getBlockDragSurface();a=this.pathObject.svgPath;a.tooltip=this;(0,module$exports$Blockly$Tooltip.bindMouseEvents)(a);this.svgGroup_.dataset?this.svgGroup_.dataset.id=this.id:module$exports$Blockly$utils$userAgent.IE&&
this.svgGroup_.setAttribute("data-id",this.id);this.doInit_()}};$.$jscomp.inherits(module$exports$Blockly$BlockSvg.BlockSvg,module$exports$Blockly$Block.Block);
module$exports$Blockly$BlockSvg.BlockSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(var a=0,b;b=this.inputList[a];a++)b.init();a=this.getIcons();for(b=0;b<a.length;b++)a[b].createIcon();this.applyColour();this.pathObject.updateMovable(this.isMovable());a=this.getSvgRoot();this.workspace.options.readOnly||this.eventsInit_||!a||(0,module$exports$Blockly$browserEvents.conditionalBind)(a,"mousedown",this,this.onMouseDown_);this.eventsInit_=!0;
a.parentNode||this.workspace.getCanvas().appendChild(a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getColourSecondary=function(){return this.style.colourSecondary};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getColourTertiary=function(){return this.style.colourTertiary};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.select=function(){if(this.isShadow()&&this.getParent())this.getParent().select();else 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$BlockSvg.BlockSvg.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);a.workspaceId=this.workspace.id;(0,module$exports$Blockly$Events$utils.fire)(a);(0,$.module$exports$Blockly$common.setSelected)(null);this.removeSelect()}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.getIcons=function(){var a=[];this.mutator&&a.push(this.mutator);this.commentIcon_&&a.push(this.commentIcon_);this.warning&&a.push(this.warning);return a};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setParent=function(a){var b=this.parentBlock_;if(a!==b){(0,module$exports$Blockly$utils$dom.startTextWidthCache)();module$exports$Blockly$Block.Block.prototype.setParent.call(this,a);(0,module$exports$Blockly$utils$dom.stopTextWidthCache)();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?(a.getSvgRoot().appendChild(c),a=this.getRelativeToSurfaceXY(),this.moveConnections(a.x-d.x,a.y-d.y)):b&&(this.workspace.getCanvas().appendChild(c),
this.translate(d.x,d.y));this.applyColour()}}};
module$exports$Blockly$BlockSvg.BlockSvg.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$svgMath.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.getCanvas()&&d!==
c)}return new module$exports$Blockly$utils$Coordinate.Coordinate(a,b)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.moveBy=function(a,b){if(this.parentBlock_)throw Error("Block has parent.");var c=(0,module$exports$Blockly$Events$utils.isEnabled)(),d;c&&(d=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.MOVE))(this));var e=this.getRelativeToSurfaceXY();this.translate(e.x+a,e.y+b);this.moveConnections(a,b);c&&(d.recordNew(),(0,module$exports$Blockly$Events$utils.fire)(d));this.workspace.resizeContents()};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.translate=function(a,b){this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};module$exports$Blockly$BlockSvg.BlockSvg.prototype.moveToDragSurface=function(){if(this.useDragSurface_){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.getBlockDragSurface().translateSurface(a.x,a.y);(a=this.getSvgRoot())&&this.workspace.getBlockDragSurface().setBlocksAndShow(a)}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.moveTo=function(a){var b=this.getRelativeToSurfaceXY();this.moveBy(a.x-b.x,a.y-b.y)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.moveOffDragSurface=function(a){this.useDragSurface_&&(this.translate(a.x,a.y),this.workspace.getBlockDragSurface().clearAndHide(this.workspace.getCanvas()))};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.moveDuringDrag=function(a){this.useDragSurface_?this.workspace.getBlockDragSurface().translateSurface(a.x,a.y):(this.svgGroup_.translate_="translate("+a.x+","+a.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))};module$exports$Blockly$BlockSvg.BlockSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().removeAttribute("transform")};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.snapToGrid=function(){if(this.workspace&&!this.workspace.isDragging()&&!this.getParent()&&!this.isInFlyout){var a=this.workspace.getGrid();if(a&&a.shouldSnap()){var b=a.getSpacing(),c=b/2,d=this.getRelativeToSurfaceXY();a=Math.round(Math.round((d.x-c)/b)*b+c-d.x);b=Math.round(Math.round((d.y-c)/b)*b+c-d.y);(a||b)&&this.moveBy(a,b)}}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(),b=this.getHeightWidth();if(this.RTL){var c=a.x-b.width;var d=a.x}else c=a.x,d=a.x+b.width;return new module$exports$Blockly$utils$Rect.Rect(a.y,a.y+b.height,c,d)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.markDirty=function(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(var a=0,b;b=this.inputList[a];a++)b.markDirty()};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setCollapsed=function(a){this.collapsed_!==a&&(module$exports$Blockly$Block.Block.prototype.setCollapsed.call(this,a),a?this.rendered&&this.render():this.updateCollapsed_())};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.updateCollapsed_=function(){for(var a=this.isCollapsed(),b=module$exports$Blockly$constants.COLLAPSED_INPUT_NAME,c=module$exports$Blockly$constants.COLLAPSED_FIELD_NAME,d=0,e;e=this.inputList[d];d++)e.name!==b&&e.setVisible(!a);if(a){a=this.getIcons();for(d=0;e=a[d];d++)e.setVisible(!1);a=this.toString(module$exports$Blockly$internalConstants.COLLAPSE_CHARS);(d=this.getField(c))?d.setValue(a):(this.getInput(b)||this.appendDummyInput(b)).appendField(new $.module$exports$Blockly$FieldLabel.FieldLabel(a),
c)}else this.updateDisabled(),this.removeInput(b)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.tab=function(a,b){var c=new module$exports$Blockly$TabNavigateCursor.TabNavigateCursor;c.setCurNode(module$exports$Blockly$ASTNode.ASTNode.createFieldNode(a));a=c.getCurNode();b?c.next():c.prev();(b=c.getCurNode())&&b!==a&&(b.getLocation().showEditor(),this.workspace.keyboardAccessibilityMode&&this.workspace.getCursor().setCurNode(b))};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.onMouseDown_=function(a){var b=this.workspace&&this.workspace.getGesture(a);b&&b.handleBlockStart(a,this)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.showHelp=function(){var a="function"===typeof this.helpUrl?this.helpUrl():this.helpUrl;a&&window.open(a)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.generateContextMenu=function(){if(this.workspace.options.readOnly||!this.contextMenu)return null;var a=module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.getContextMenuOptions(module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.BLOCK,{block:this});this.customContextMenu&&this.customContextMenu(a);return a};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.showContextMenu=function(a){var b=this.generateContextMenu();b&&b.length&&((0,$.module$exports$Blockly$ContextMenu.show)(a,b,this.RTL),(0,$.module$exports$Blockly$ContextMenu.setCurrentBlock)(this))};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.moveConnections=function(a,b){if(this.rendered){for(var c=this.getConnections_(!1),d=0;d<c.length;d++)c[d].moveBy(a,b);c=this.getIcons();for(d=0;d<c.length;d++)c[d].computeIconLocation();for(c=0;c<this.childBlocks_.length;c++)this.childBlocks_[c].moveConnections(a,b)}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setDragging=function(a){if(a){var b=this.getSvgRoot();b.translate_="";b.skew_="";$.module$exports$Blockly$common.draggingConnections.push.apply($.module$exports$Blockly$common.draggingConnections,$.$jscomp.arrayFromIterable(this.getConnections_(!0)));(0,module$exports$Blockly$utils$dom.addClass)(this.svgGroup_,"blocklyDragging")}else $.module$exports$Blockly$common.draggingConnections.length=0,(0,module$exports$Blockly$utils$dom.removeClass)(this.svgGroup_,
"blocklyDragging");for(b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging(a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setMovable=function(a){module$exports$Blockly$Block.Block.prototype.setMovable.call(this,a);this.pathObject.updateMovable(a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setEditable=function(a){module$exports$Blockly$Block.Block.prototype.setEditable.call(this,a);a=this.getIcons();for(var b=0;b<a.length;b++)a[b].updateEditable()};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setShadow=function(a){module$exports$Blockly$Block.Block.prototype.setShadow.call(this,a);this.applyColour()};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!==a&&(this.isInsertionMarker_=a)&&(this.setColour(this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR),this.pathObject.updateInsertionMarker(!0))};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getSvgRoot=function(){return this.svgGroup_};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.dispose=function(a,b){if(this.workspace){(0,module$exports$Blockly$Tooltip.dispose)();(0,module$exports$Blockly$Tooltip.unbindMouseEvents)(this.pathObject.svgPath);(0,module$exports$Blockly$utils$dom.startTextWidthCache)();var c=this.workspace;(0,$.module$exports$Blockly$common.getSelected)()===this&&(this.unselect(),this.workspace.cancelCurrentGesture());(0,$.module$exports$Blockly$ContextMenu.getCurrentBlock)()===this&&(0,$.module$exports$Blockly$ContextMenu.hide)();
b&&this.rendered&&(this.unplug(a),(0,module$exports$Blockly$blockAnimations.disposeUiEffect)(this));this.rendered=!1;if(this.warningTextDb_){for(var d in this.warningTextDb_)clearTimeout(this.warningTextDb_[d]);this.warningTextDb_=null}b=this.getIcons();for(d=0;d<b.length;d++)b[d].dispose();module$exports$Blockly$Block.Block.prototype.dispose.call(this,!!a);(0,module$exports$Blockly$utils$dom.removeNode)(this.svgGroup_);c.resizeContents();this.svgGroup_=null;(0,module$exports$Blockly$utils$dom.stopTextWidthCache)()}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.checkAndDelete=function(){this.workspace.isFlyout||((0,module$exports$Blockly$Events$utils.setGroup)(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),(0,module$exports$Blockly$Events$utils.setGroup)(!1))};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.toCopyData=function(){return this.isInsertionMarker_?null:{saveInfo:(0,module$exports$Blockly$serialization$blocks.save)(this,{addCoordinates:!0,addNextBlocks:!1}),source:this.workspace,typeCounts:(0,$.module$exports$Blockly$common.getBlockTypeCounts)(this,!0)}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.applyColour=function(){this.pathObject.applyColour(this);for(var a=this.getIcons(),b=0;b<a.length;b++)a[b].applyColour();for(a=0;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.applyColour()};module$exports$Blockly$BlockSvg.BlockSvg.prototype.updateDisabled=function(){var a=this.getChildren(!1);this.applyColour();if(!this.isCollapsed())for(var b=0,c;c=a[b];b++)c.rendered&&c.updateDisabled()};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.getCommentIcon=function(){return this.commentIcon_};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setCommentText=function(a){var b=module$exports$Blockly$Comment.Comment;if(!b)throw Error("Missing require for Blockly.Comment");this.commentModel.text!==a&&(module$exports$Blockly$Block.Block.prototype.setCommentText.call(this,a),a=null!==a,!!this.commentIcon_===a?this.commentIcon_.updateText():(a?this.comment=this.commentIcon_=new b(this):(this.commentIcon_.dispose(),this.comment=this.commentIcon_=null),this.rendered&&(this.render(),this.bumpNeighbours())))};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setWarningText=function(a,b){var c=module$exports$Blockly$Warning.Warning;if(!c)throw Error("Missing require for Blockly.Warning");this.warningTextDb_||(this.warningTextDb_=Object.create(null));var d=b||"";if(d)this.warningTextDb_[d]&&(clearTimeout(this.warningTextDb_[d]),delete this.warningTextDb_[d]);else{b=$.$jscomp.makeIterator(Object.keys(this.warningTextDb_));for(var e=b.next();!e.done;e=b.next())e=e.value,clearTimeout(this.warningTextDb_[e]),
delete this.warningTextDb_[e]}if(this.workspace.isDragging()){var f=this;this.warningTextDb_[d]=setTimeout(function(){f.workspace&&(delete f.warningTextDb_[d],f.setWarningText(a,d))},100)}else{this.isInFlyout&&(a=null);b=!1;if("string"===typeof a){e=this.getSurroundParent();for(var g=null;e;)e.isCollapsed()&&(g=e),e=e.getSurroundParent();g&&g.setWarningText($.module$exports$Blockly$Msg.Msg.COLLAPSED_WARNINGS_WARNING,module$exports$Blockly$BlockSvg.BlockSvg.COLLAPSED_WARNING_ID);this.warning||(this.warning=
new c(this),b=!0);this.warning.setText(a,d)}else this.warning&&!d?(this.warning.dispose(),b=!0):this.warning&&(c=this.warning.getText(),this.warning.setText("",d),(b=this.warning.getText())||this.warning.dispose(),b=c!==b);b&&this.rendered&&(this.render(),this.bumpNeighbours())}};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setMutator=function(a){this.mutator&&this.mutator!==a&&this.mutator.dispose();a&&(a.setBlock(this),this.mutator=a,a.createIcon());this.rendered&&(this.render(),this.bumpNeighbours())};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setEnabled=function(a){this.isEnabled()!==a&&(module$exports$Blockly$Block.Block.prototype.setEnabled.call(this,a),this.rendered&&!this.getInheritedDisabled()&&this.updateDisabled())};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setHighlighted=function(a){this.rendered&&this.pathObject.updateHighlighted(a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.addSelect=function(){this.pathObject.updateSelected(!0)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.removeSelect=function(){this.pathObject.updateSelected(!1)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setDeleteStyle=function(a){this.pathObject.updateDraggingDelete(a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getColour=function(){return this.style.colourPrimary};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setColour=function(a){module$exports$Blockly$Block.Block.prototype.setColour.call(this,a);a=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_);this.pathObject.setStyle(a.style);this.style=a.style;this.styleName_=a.name;this.applyColour()};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setStyle=function(a){var b=this.workspace.getRenderer().getConstants().getBlockStyle(a);this.styleName_=a;if(b)this.hat=b.hat,this.pathObject.setStyle(b),this.colour_=b.colourPrimary,this.style=b,this.applyColour();else throw Error("Invalid style name: "+a);};module$exports$Blockly$BlockSvg.BlockSvg.prototype.bringToFront=function(){var a=this;do{var b=a.getSvgRoot(),c=b.parentNode,d=c.childNodes;d[d.length-1]!==b&&c.appendChild(b);a=a.getParent()}while(a)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setPreviousStatement=function(a,b){module$exports$Blockly$Block.Block.prototype.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setNextStatement=function(a,b){module$exports$Blockly$Block.Block.prototype.setNextStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setOutput=function(a,b){module$exports$Blockly$Block.Block.prototype.setOutput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setInputsInline=function(a){module$exports$Blockly$Block.Block.prototype.setInputsInline.call(this,a);this.rendered&&(this.render(),this.bumpNeighbours())};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.removeInput=function(a,b){a=module$exports$Blockly$Block.Block.prototype.removeInput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours());return a};module$exports$Blockly$BlockSvg.BlockSvg.prototype.moveNumberedInputBefore=function(a,b){module$exports$Blockly$Block.Block.prototype.moveNumberedInputBefore.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours())};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.appendInput_=function(a,b){a=module$exports$Blockly$Block.Block.prototype.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours());return a};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setConnectionTracking=function(a){this.previousConnection&&this.previousConnection.setTracking(a);this.outputConnection&&this.outputConnection.setTracking(a);if(this.nextConnection){this.nextConnection.setTracking(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionTracking(a)}if(!this.collapsed_)for(b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.setTracking(a),(c=c.targetBlock())&&c.setConnectionTracking(a))}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.lastConnectionInStack=function(a){return module$exports$Blockly$Block.Block.prototype.lastConnectionInStack.call(this,a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getMatchingConnection=function(a,b){return module$exports$Blockly$Block.Block.prototype.getMatchingConnection.call(this,a,b)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.makeConnection_=function(a){return new module$exports$Blockly$RenderedConnection.RenderedConnection(this,a)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.bumpNeighbours=function(){if(this.workspace&&!this.workspace.isDragging()){var a=this.getRootBlock();if(!a.isInFlyout)for(var b=this.getConnections_(!1),c=0,d;d=b[c];c++){var e=d;e.isConnected()&&e.isSuperior()&&e.targetBlock().bumpNeighbours();d=d.neighbours($.module$exports$Blockly$config.config.snapRadius);for(var f=0,g;g=d[f];f++)e.isConnected()&&g.isConnected()||g.getSourceBlock().getRootBlock()!==a&&(e.isSuperior()?g.bumpAwayFrom(e):e.bumpAwayFrom(g))}}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.scheduleSnapAndBump=function(){var a=this,b=(0,module$exports$Blockly$Events$utils.getGroup)();setTimeout(function(){(0,module$exports$Blockly$Events$utils.setGroup)(b);a.snapToGrid();(0,module$exports$Blockly$Events$utils.setGroup)(!1)},$.module$exports$Blockly$config.config.bumpDelay/2);setTimeout(function(){(0,module$exports$Blockly$Events$utils.setGroup)(b);a.bumpNeighbours();(0,module$exports$Blockly$Events$utils.setGroup)(!1)},$.module$exports$Blockly$config.config.bumpDelay)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.positionNearConnection=function(a,b){a.type!==$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT&&a.type!==$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE||this.moveBy(b.x-a.x,b.y-a.y)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getParent=function(){return module$exports$Blockly$Block.Block.prototype.getParent.call(this)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getSurroundParent=function(){return module$exports$Blockly$Block.Block.prototype.getSurroundParent.call(this)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.getNextBlock=function(){return module$exports$Blockly$Block.Block.prototype.getNextBlock.call(this)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getPreviousBlock=function(){return module$exports$Blockly$Block.Block.prototype.getPreviousBlock.call(this)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getFirstStatementConnection=function(){return module$exports$Blockly$Block.Block.prototype.getFirstStatementConnection.call(this)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.getTopStackBlock=function(){return module$exports$Blockly$Block.Block.prototype.getTopStackBlock.call(this)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getChildren=function(a){return module$exports$Blockly$Block.Block.prototype.getChildren.call(this,a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getDescendants=function(a){return module$exports$Blockly$Block.Block.prototype.getDescendants.call(this,a)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.getInputTargetBlock=function(a){return module$exports$Blockly$Block.Block.prototype.getInputTargetBlock.call(this,a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getRootBlock=function(){return module$exports$Blockly$Block.Block.prototype.getRootBlock.call(this)};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.render=function(a){if(!this.renderIsInProgress_){this.renderIsInProgress_=!0;try{this.rendered=!0;(0,module$exports$Blockly$utils$dom.startTextWidthCache)();this.isCollapsed()&&this.updateCollapsed_();this.workspace.getRenderer().render(this);this.updateConnectionLocations_();if(!1!==a){var b=this.getParent();b?b.render(!0):this.workspace.resizeContents()}(0,module$exports$Blockly$utils$dom.stopTextWidthCache)();this.updateMarkers_()}finally{this.renderIsInProgress_=
!1}}};module$exports$Blockly$BlockSvg.BlockSvg.prototype.updateMarkers_=function(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw();this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(module$exports$Blockly$MarkerManager.MarkerManager.LOCAL_MARKER).draw()};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.updateConnectionLocations_=function(){var a=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(a);this.outputConnection&&this.outputConnection.moveToOffset(a);for(var b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.moveToOffset(a),c.isConnected()&&c.tighten())}this.nextConnection&&(this.nextConnection.moveToOffset(a),this.nextConnection.isConnected()&&this.nextConnection.tighten())};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.setCursorSvg=function(a){this.pathObject.setCursorSvg(a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.setMarkerSvg=function(a){this.pathObject.setMarkerSvg(a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.getHeightWidth=function(){var a=this.height,b=this.width,c=this.getNextBlock();if(c){c=c.getHeightWidth();var d=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;a+=c.height-d;b=Math.max(b,c.width)}return{height:a,width:b}};
module$exports$Blockly$BlockSvg.BlockSvg.prototype.fadeForReplacement=function(a){this.pathObject.updateReplacementFade(a)};module$exports$Blockly$BlockSvg.BlockSvg.prototype.highlightShapeForInput=function(a,b){this.pathObject.updateShapeForInputHighlight(a,b)};module$exports$Blockly$BlockSvg.BlockSvg.INLINE=-1;module$exports$Blockly$BlockSvg.BlockSvg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var module$exports$Blockly$ConnectionDB={ConnectionDB:function(a){this.connections_=[];this.connectionChecker_=a}};module$exports$Blockly$ConnectionDB.ConnectionDB.prototype.addConnection=function(a,b){b=this.calculateIndexForYPos_(b);this.connections_.splice(b,0,a)};
module$exports$Blockly$ConnectionDB.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;d<this.connections_.length&&this.connections_[d].y===b;){if(this.connections_[d]===a)return d;d++}return-1};
module$exports$Blockly$ConnectionDB.ConnectionDB.prototype.calculateIndexForYPos_=function(a){if(!this.connections_.length)return 0;for(var b=0,c=this.connections_.length;b<c;){var d=Math.floor((b+c)/2);if(this.connections_[d].y<a)b=d+1;else if(this.connections_[d].y>a)c=d;else{b=d;break}}return b};
module$exports$Blockly$ConnectionDB.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.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 n<b}var d=this.connections_,e=a.x,f=a.y;a=0;for(var g=d.length-2,h=g;a<h;)d[h].y<f?a=h:g=h,h=Math.floor((a+g)/2);var k=[];g=a=h;if(d.length){for(;0<=a&&c(a);)a--;do g++;while(g<d.length&&c(g))}return k};
module$exports$Blockly$ConnectionDB.ConnectionDB.prototype.isInYRange_=function(a,b,c){return Math.abs(this.connections_[a].y-b)<=c};
module$exports$Blockly$ConnectionDB.ConnectionDB.prototype.searchForClosest=function(a,b,c){if(!this.connections_.length)return{connection:null,radius:b};var d=a.y,e=a.x;a.x=e+c.x;a.y=d+c.y;var f=this.calculateIndexForYPos_(a.y);c=null;for(var g=b,h,k=f-1;0<=k&&this.isInYRange_(k,a.y,b);)h=this.connections_[k],this.connectionChecker_.canConnect(a,h,!0,g)&&(c=h,g=h.distanceFrom(a)),k--;for(;f<this.connections_.length&&this.isInYRange_(f,a.y,b);)h=this.connections_[f],this.connectionChecker_.canConnect(a,
h,!0,g)&&(c=h,g=h.distanceFrom(a)),f++;a.x=e;a.y=d;return{connection:c,radius:g}};
module$exports$Blockly$ConnectionDB.ConnectionDB.init=function(a){var b=[];b[$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE]=new module$exports$Blockly$ConnectionDB.ConnectionDB(a);b[$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE]=new module$exports$Blockly$ConnectionDB.ConnectionDB(a);b[$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT]=new module$exports$Blockly$ConnectionDB.ConnectionDB(a);b[$.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT]=
new module$exports$Blockly$ConnectionDB.ConnectionDB(a);return b};var module$exports$Blockly$ThemeManager={ThemeManager:function(a,b){this.workspace_=a;this.theme_=b;this.subscribedWorkspaces_=[];this.componentDB_=Object.create(null)}};module$exports$Blockly$ThemeManager.ThemeManager.prototype.getTheme=function(){return this.theme_};
module$exports$Blockly$ThemeManager.ThemeManager.prototype.setTheme=function(a){var b=this.theme_;this.theme_=a;if(a=this.workspace_.getInjectionDiv())b&&(0,module$exports$Blockly$utils$dom.removeClass)(a,b.getClassName()),(0,module$exports$Blockly$utils$dom.addClass)(a,this.theme_.getClassName());for(b=0;a=this.subscribedWorkspaces_[b];b++)a.refreshTheme();b=0;a=Object.keys(this.componentDB_);for(var c;c=a[b];b++)for(var d=0,e;e=this.componentDB_[c][d];d++){var f=e.element;e=e.propertyName;var g=
this.theme_&&this.theme_.getComponentStyle(c);f.style[e]=g||""}b=$.$jscomp.makeIterator(this.subscribedWorkspaces_);for(a=b.next();!a.done;a=b.next())a.value.hideChaff()};module$exports$Blockly$ThemeManager.ThemeManager.prototype.subscribeWorkspace=function(a){this.subscribedWorkspaces_.push(a)};
module$exports$Blockly$ThemeManager.ThemeManager.prototype.unsubscribeWorkspace=function(a){if(!(0,module$exports$Blockly$utils$array.removeElem)(this.subscribedWorkspaces_,a))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");};
module$exports$Blockly$ThemeManager.ThemeManager.prototype.subscribe=function(a,b,c){this.componentDB_[b]||(this.componentDB_[b]=[]);this.componentDB_[b].push({element:a,propertyName:c});b=this.theme_&&this.theme_.getComponentStyle(b);a.style[c]=b||""};
module$exports$Blockly$ThemeManager.ThemeManager.prototype.unsubscribe=function(a){if(a)for(var b=Object.keys(this.componentDB_),c=0,d;d=b[c];c++){for(var e=this.componentDB_[d],f=e.length-1;0<=f;f--)e[f].element===a&&e.splice(f,1);this.componentDB_[d].length||delete this.componentDB_[d]}};module$exports$Blockly$ThemeManager.ThemeManager.prototype.dispose=function(){this.componentDB_=this.subscribedWorkspaces_=this.theme_=this.owner_=null};var module$exports$Blockly$TouchGesture={},module$contents$Blockly$TouchGesture_ZOOM_IN_MULTIPLIER=5,module$contents$Blockly$TouchGesture_ZOOM_OUT_MULTIPLIER=6;module$exports$Blockly$TouchGesture.TouchGesture=function(a,b){module$exports$Blockly$Gesture.Gesture.call(this,a,b);this.isMultiTouch_=!1;this.cachedPoints_=Object.create(null);this.startDistance_=this.previousScale_=0;this.isPinchZoomEnabled_=this.onStartWrapper_=null};$.$jscomp.inherits(module$exports$Blockly$TouchGesture.TouchGesture,module$exports$Blockly$Gesture.Gesture);
module$exports$Blockly$TouchGesture.TouchGesture.prototype.doStart=function(a){this.isPinchZoomEnabled_=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch;module$exports$Blockly$Gesture.Gesture.prototype.doStart.call(this,a);!this.isEnding_&&(0,module$exports$Blockly$Touch.isTouchEvent)(a)&&this.handleTouchStart(a)};
module$exports$Blockly$TouchGesture.TouchGesture.prototype.bindMouseEvents=function(a){this.onStartWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mousedown",null,this.handleStart.bind(this),!0);this.onMoveWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mousemove",null,this.handleMove.bind(this),!0);this.onUpWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mouseup",null,this.handleUp.bind(this),!0);a.preventDefault();
a.stopPropagation()};module$exports$Blockly$TouchGesture.TouchGesture.prototype.handleStart=function(a){!this.isDragging()&&(0,module$exports$Blockly$Touch.isTouchEvent)(a)&&(this.handleTouchStart(a),this.isMultiTouch()&&(0,module$exports$Blockly$Touch.longStop)())};
module$exports$Blockly$TouchGesture.TouchGesture.prototype.handleMove=function(a){this.isDragging()?(0,module$exports$Blockly$Touch.shouldHandleEvent)(a)&&module$exports$Blockly$Gesture.Gesture.prototype.handleMove.call(this,a):this.isMultiTouch()?((0,module$exports$Blockly$Touch.isTouchEvent)(a)&&this.handleTouchMove(a),(0,module$exports$Blockly$Touch.longStop)()):module$exports$Blockly$Gesture.Gesture.prototype.handleMove.call(this,a)};
module$exports$Blockly$TouchGesture.TouchGesture.prototype.handleUp=function(a){(0,module$exports$Blockly$Touch.isTouchEvent)(a)&&!this.isDragging()&&this.handleTouchEnd(a);!this.isMultiTouch()||this.isDragging()?(0,module$exports$Blockly$Touch.shouldHandleEvent)(a)&&module$exports$Blockly$Gesture.Gesture.prototype.handleUp.call(this,a):(a.preventDefault(),a.stopPropagation(),this.dispose())};module$exports$Blockly$TouchGesture.TouchGesture.prototype.isMultiTouch=function(){return this.isMultiTouch_};
module$exports$Blockly$TouchGesture.TouchGesture.prototype.dispose=function(){module$exports$Blockly$Gesture.Gesture.prototype.dispose.call(this);this.onStartWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onStartWrapper_)};
module$exports$Blockly$TouchGesture.TouchGesture.prototype.handleTouchStart=function(a){var b=(0,module$exports$Blockly$Touch.getTouchIdentifierFromEvent)(a);this.cachedPoints_[b]=this.getTouchPoint(a);b=Object.keys(this.cachedPoints_);2===b.length&&(this.startDistance_=module$exports$Blockly$utils$Coordinate.Coordinate.distance(this.cachedPoints_[b[0]],this.cachedPoints_[b[1]]),this.isMultiTouch_=!0,a.preventDefault())};
module$exports$Blockly$TouchGesture.TouchGesture.prototype.handleTouchMove=function(a){var b=(0,module$exports$Blockly$Touch.getTouchIdentifierFromEvent)(a);this.cachedPoints_[b]=this.getTouchPoint(a);b=Object.keys(this.cachedPoints_);this.isPinchZoomEnabled_&&2===b.length?this.handlePinch_(a):module$exports$Blockly$Gesture.Gesture.prototype.handleMove.call(this,a)};
module$exports$Blockly$TouchGesture.TouchGesture.prototype.handlePinch_=function(a){var b=Object.keys(this.cachedPoints_);b=module$exports$Blockly$utils$Coordinate.Coordinate.distance(this.cachedPoints_[b[0]],this.cachedPoints_[b[1]])/this.startDistance_;if(0<this.previousScale_&&Infinity>this.previousScale_){var c=b-this.previousScale_;c=0<c?c*module$contents$Blockly$TouchGesture_ZOOM_IN_MULTIPLIER:c*module$contents$Blockly$TouchGesture_ZOOM_OUT_MULTIPLIER;var d=this.startWorkspace_,e=(0,module$exports$Blockly$browserEvents.mouseToSvg)(a,
d.getParentSvg(),d.getInverseScreenCTM());d.zoom(e.x,e.y,c)}this.previousScale_=b;a.preventDefault()};module$exports$Blockly$TouchGesture.TouchGesture.prototype.handleTouchEnd=function(a){a=(0,module$exports$Blockly$Touch.getTouchIdentifierFromEvent)(a);this.cachedPoints_[a]&&delete this.cachedPoints_[a];2>Object.keys(this.cachedPoints_).length&&(this.cachedPoints_=Object.create(null),this.previousScale_=0)};
module$exports$Blockly$TouchGesture.TouchGesture.prototype.getTouchPoint=function(a){return this.startWorkspace_?new module$exports$Blockly$utils$Coordinate.Coordinate(a.changedTouches?a.changedTouches[0].pageX:a.pageX,a.changedTouches?a.changedTouches[0].pageY:a.pageY):null};var module$exports$Blockly$WorkspaceAudio={},module$contents$Blockly$WorkspaceAudio_SOUND_LIMIT=100;module$exports$Blockly$WorkspaceAudio.WorkspaceAudio=function(a){this.parentWorkspace_=a;this.SOUNDS_=Object.create(null);this.lastSound_=null};module$exports$Blockly$WorkspaceAudio.WorkspaceAudio.prototype.dispose=function(){this.SOUNDS_=this.parentWorkspace_=null};
module$exports$Blockly$WorkspaceAudio.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;e<a.length;e++){var f=a[e],g=f.match(/\.(\w+)$/);if(g&&c.canPlayType("audio/"+g[1])){d=new $.module$exports$Blockly$utils$global.globalThis.Audio(f);break}}d&&d.play&&(this.SOUNDS_[b]=d)}};
module$exports$Blockly$WorkspaceAudio.WorkspaceAudio.prototype.preload=function(){for(var a in this.SOUNDS_){var b=this.SOUNDS_[a];b.volume=.01;var c=b.play();void 0!==c?c.then(b.pause).catch(function(){}):b.pause();if(module$exports$Blockly$utils$userAgent.IPAD||module$exports$Blockly$utils$userAgent.IPHONE)break}};
module$exports$Blockly$WorkspaceAudio.WorkspaceAudio.prototype.play=function(a,b){var c=this.SOUNDS_[a];c?(a=new Date,null!==this.lastSound_&&a-this.lastSound_<module$contents$Blockly$WorkspaceAudio_SOUND_LIMIT||(this.lastSound_=a,c=module$exports$Blockly$utils$userAgent.IPAD||module$exports$Blockly$utils$userAgent.ANDROID?c:c.cloneNode(),c.volume=void 0===b?1:b,c.play())):this.parentWorkspace_&&this.parentWorkspace_.getAudioManager().play(a,b)};var module$exports$Blockly$Events$ThemeChange={ThemeChange:function(a,b){module$exports$Blockly$Events$UiBase.UiBase.call(this,b);this.themeName=a;this.type=module$exports$Blockly$Events$utils.THEME_CHANGE}};$.$jscomp.inherits(module$exports$Blockly$Events$ThemeChange.ThemeChange,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$ThemeChange.ThemeChange.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.themeName=this.themeName;return a};module$exports$Blockly$Events$ThemeChange.ThemeChange.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.fromJson.call(this,a);this.themeName=a.themeName};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.THEME_CHANGE,module$exports$Blockly$Events$ThemeChange.ThemeChange);var module$exports$Blockly$Events$ViewportChange={ViewportChange:function(a,b,c,d,e){module$exports$Blockly$Events$UiBase.UiBase.call(this,d);this.viewTop=a;this.viewLeft=b;this.scale=c;this.oldScale=e;this.type=module$exports$Blockly$Events$utils.VIEWPORT_CHANGE}};$.$jscomp.inherits(module$exports$Blockly$Events$ViewportChange.ViewportChange,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$ViewportChange.ViewportChange.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.viewTop=this.viewTop;a.viewLeft=this.viewLeft;a.scale=this.scale;a.oldScale=this.oldScale;return a};
module$exports$Blockly$Events$ViewportChange.ViewportChange.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.fromJson.call(this,a);this.viewTop=a.viewTop;this.viewLeft=a.viewLeft;this.scale=a.scale;this.oldScale=a.oldScale};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.VIEWPORT_CHANGE,module$exports$Blockly$Events$ViewportChange.ViewportChange);var module$exports$Blockly$IMetricsManager={IMetricsManager:function(){}};var module$exports$Blockly$MetricsManager={MetricsManager:function(a){this.workspace_=a}};module$exports$Blockly$MetricsManager.MetricsManager.prototype.getDimensionsPx_=function(a){var b=0,c=0;a&&(b=a.getWidth(),c=a.getHeight());return new module$exports$Blockly$utils$Size.Size(b,c)};module$exports$Blockly$MetricsManager.MetricsManager.prototype.getFlyoutMetrics=function(a){a=this.getDimensionsPx_(this.workspace_.getFlyout(a));return{width:a.width,height:a.height,position:this.workspace_.toolboxPosition}};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getToolboxMetrics=function(){var a=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:a.width,height:a.height,position:this.workspace_.toolboxPosition}};module$exports$Blockly$MetricsManager.MetricsManager.prototype.getSvgMetrics=function(){return this.workspace_.getCachedParentSvgSize()};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getAbsoluteMetrics=function(){var a=0,b=this.getToolboxMetrics(),c=this.getFlyoutMetrics(!0),d=!!this.workspace_.getToolbox(),e=!!this.workspace_.getFlyout(!0),f=d?b.position:c.position,g=f===module$exports$Blockly$utils$toolbox.Position.LEFT;f=f===module$exports$Blockly$utils$toolbox.Position.TOP;d&&g?a=b.width:e&&g&&(a=c.width);g=0;d&&f?g=b.height:e&&f&&(g=c.height);return{top:g,left:a}};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getViewMetrics=function(a){a=a?this.workspace_.scale:1;var b=this.getSvgMetrics(),c=this.getToolboxMetrics(),d=this.getFlyoutMetrics(!0),e=this.workspace_.getToolbox()?c.position:d.position;if(this.workspace_.getToolbox())if(e===module$exports$Blockly$utils$toolbox.Position.TOP||e===module$exports$Blockly$utils$toolbox.Position.BOTTOM)b.height-=c.height;else{if(e===module$exports$Blockly$utils$toolbox.Position.LEFT||e===module$exports$Blockly$utils$toolbox.Position.RIGHT)b.width-=
c.width}else if(this.workspace_.getFlyout(!0))if(e===module$exports$Blockly$utils$toolbox.Position.TOP||e===module$exports$Blockly$utils$toolbox.Position.BOTTOM)b.height-=d.height;else if(e===module$exports$Blockly$utils$toolbox.Position.LEFT||e===module$exports$Blockly$utils$toolbox.Position.RIGHT)b.width-=d.width;return{height:b.height/a,width:b.width/a,top:-this.workspace_.scrollY/a,left:-this.workspace_.scrollX/a}};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getContentMetrics=function(a){a=a?1:this.workspace_.scale;var b=this.workspace_.getBlocksBoundingBox();return{height:(b.bottom-b.top)*a,width:(b.right-b.left)*a,top:b.top*a,left:b.left*a}};module$exports$Blockly$MetricsManager.MetricsManager.prototype.hasFixedEdges=function(){return!this.workspace_.isMovableHorizontally()||!this.workspace_.isMovableVertically()};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getComputedFixedEdges_=function(a){if(!this.hasFixedEdges())return{};var b=this.workspace_.isMovableHorizontally(),c=this.workspace_.isMovableVertically();a=a||this.getViewMetrics(!1);var d={};c||(d.top=a.top,d.bottom=a.top+a.height);b||(d.left=a.left,d.right=a.left+a.width);return d};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getPaddedContent_=function(a,b){var c=b.top+b.height,d=b.left+b.width,e=a.width;a=a.height;var f=e/2,g=a/2;return{top:Math.min(b.top-g,c-a),bottom:Math.max(c+g,b.top+a),left:Math.min(b.left-f,d-e),right:Math.max(d+f,b.left+e)}};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getScrollMetrics=function(a,b,c){a=a?this.workspace_.scale:1;b=b||this.getViewMetrics(!1);var d=c||this.getContentMetrics();c=this.getComputedFixedEdges_(b);b=this.getPaddedContent_(b,d);d=void 0!==c.top?c.top:b.top;var e=void 0!==c.left?c.left:b.left;return{top:d/a,left:e/a,width:((void 0!==c.right?c.right:b.right)-e)/a,height:((void 0!==c.bottom?c.bottom:b.bottom)-d)/a}};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getUiMetrics=function(){return{viewMetrics:this.getViewMetrics(),absoluteMetrics:this.getAbsoluteMetrics(),toolboxMetrics:this.getToolboxMetrics()}};
module$exports$Blockly$MetricsManager.MetricsManager.prototype.getMetrics=function(){var a=this.getToolboxMetrics(),b=this.getFlyoutMetrics(!0),c=this.getSvgMetrics(),d=this.getAbsoluteMetrics(),e=this.getViewMetrics(),f=this.getContentMetrics(),g=this.getScrollMetrics(!1,e,f);return{contentHeight:f.height,contentWidth:f.width,contentTop:f.top,contentLeft:f.left,scrollHeight:g.height,scrollWidth:g.width,scrollTop:g.top,scrollLeft:g.left,viewHeight:e.height,viewWidth:e.width,viewTop:e.top,viewLeft:e.left,
absoluteTop:d.top,absoluteLeft:d.left,svgHeight:c.height,svgWidth:c.width,toolboxWidth:a.width,toolboxHeight:a.height,toolboxPosition:a.position,flyoutWidth:b.width,flyoutHeight:b.height}};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.METRICS_MANAGER,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$MetricsManager.MetricsManager);var module$exports$Blockly$WorkspaceSvg={WorkspaceSvg:function(a,b,c){module$exports$Blockly$Workspace.Workspace.call(this,a);this.resizeHandlerWrapper_=null;this.resizesEnabled_=this.isVisible_=this.rendered=!0;this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0;this.dragDeltaXY_=null;this.oldScale_=this.scale=1;this.oldLeft_=this.oldTop_=0;this.workspaceDragSurface_=this.blockDragSurface_=this.currentGesture_=this.toolbox_=this.flyout_=this.scrollbar=this.trashcan=null;this.isDragSurfaceActive_=
this.useWorkspaceDragSurface_=!1;this.inverseScreenCTM_=this.targetWorkspace=this.lastRecordedPageScroll_=this.injectionDiv_=null;this.inverseScreenCTMDirty_=!0;this.metricsManager_=new ((0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.METRICS_MANAGER,a,!0))(this);this.getMetrics=a.getMetrics||this.metricsManager_.getMetrics.bind(this.metricsManager_);this.setMetrics=a.setMetrics||module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.setTopLevelWorkspaceMetrics_;
this.componentManager_=new module$exports$Blockly$ComponentManager.ComponentManager;this.connectionDBList=module$exports$Blockly$ConnectionDB.ConnectionDB.init(this.connectionChecker);b&&(this.blockDragSurface_=b);c&&(this.workspaceDragSurface_=c);this.useWorkspaceDragSurface_=!!this.workspaceDragSurface_&&(0,module$exports$Blockly$utils$svgMath.is3dSupported)();this.highlightedBlocks_=[];this.audioManager_=new module$exports$Blockly$WorkspaceAudio.WorkspaceAudio(a.parentWorkspace);this.grid_=this.options.gridPattern?
new module$exports$Blockly$Grid.Grid(this.options.gridPattern,a.gridOptions):null;this.markerManager_=new module$exports$Blockly$MarkerManager.MarkerManager(this);this.toolboxCategoryCallbacks_=Object.create(null);this.flyoutButtonCallbacks_=Object.create(null);(a=$.module$exports$Blockly$Variables)&&a.flyoutCategory&&this.registerToolboxCategoryCallback(a.CATEGORY_NAME,a.flyoutCategory);(a=module$exports$Blockly$VariablesDynamic)&&a.flyoutCategory&&this.registerToolboxCategoryCallback(a.CATEGORY_NAME,
a.flyoutCategory);(a=$.module$exports$Blockly$Procedures)&&a.flyoutCategory&&(this.registerToolboxCategoryCallback(a.CATEGORY_NAME,a.flyoutCategory),this.addChangeListener(a.mutatorOpenListener));this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new module$exports$Blockly$ThemeManager.ThemeManager(this,this.options.theme||module$exports$Blockly$Themes$Classic.Classic);this.themeManager_.subscribeWorkspace(this);this.renderer_=(0,module$exports$Blockly$blockRendering.init)(this.options.renderer||
"geras",this.getTheme(),this.options.rendererOverrides);this.cachedParentSvg_=null;this.keyboardAccessibilityMode=!1;this.topBoundedElements_=[];this.dragTargetAreas_=[];this.cachedParentSvgSize_=new module$exports$Blockly$utils$Size.Size(0,0)}};$.$jscomp.inherits(module$exports$Blockly$WorkspaceSvg.WorkspaceSvg,module$exports$Blockly$Workspace.Workspace);module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getMarkerManager=function(){return this.markerManager_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getMetricsManager=function(){return this.metricsManager_};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.setMetricsManager=function(a){this.metricsManager_=a;this.getMetrics=this.metricsManager_.getMetrics.bind(this.metricsManager_)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getComponentManager=function(){return this.componentManager_};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.setCursorSvg=function(a){this.markerManager_.setCursorSvg(a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.setMarkerSvg=function(a){this.markerManager_.setMarkerSvg(a)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getMarker=function(a){return this.markerManager_?this.markerManager_.getMarker(a):null};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getCursor=function(){return this.markerManager_?this.markerManager_.getCursor():null};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getRenderer=function(){return this.renderer_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getThemeManager=function(){return this.themeManager_};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getTheme=function(){return this.themeManager_.getTheme()};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.setTheme=function(a){a||(a=module$exports$Blockly$Themes$Classic.Classic);this.themeManager_.setTheme(a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.refreshTheme=function(){this.svgGroup_&&this.renderer_.refreshDom(this.svgGroup_,this.getTheme());this.updateBlockStyles_(this.getAllBlocks(!1).filter(function(b){return!!b.getStyleName()}));this.refreshToolboxSelection();this.toolbox_&&this.toolbox_.refreshTheme();this.isVisible()&&this.setVisible(!0);var a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.THEME_CHANGE))(this.getTheme().name,this.id);(0,module$exports$Blockly$Events$utils.fire)(a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.updateBlockStyles_=function(a){for(var b=0,c;c=a[b];b++){var d=c.getStyleName();d&&(c.setStyle(d),c.mutator&&c.mutator.updateBlockStyle())}};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getInverseScreenCTM=function(){if(this.inverseScreenCTMDirty_){var a=this.getParentSvg().getScreenCTM();a&&(this.inverseScreenCTM_=a.inverse(),this.inverseScreenCTMDirty_=!1)}return this.inverseScreenCTM_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.updateInverseScreenCTM=function(){this.inverseScreenCTMDirty_=!0};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.isVisible=function(){return this.isVisible_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getSvgXY=function(a){var b=0,c=0,d=1;if((0,module$exports$Blockly$utils$dom.containsNode)(this.getCanvas(),a)||(0,module$exports$Blockly$utils$dom.containsNode)(this.getBubbleCanvas(),a))d=this.scale;do{var e=(0,module$exports$Blockly$utils$svgMath.getRelativeXY)(a);if(a===this.getCanvas()||a===this.getBubbleCanvas())d=1;b+=e.x*d;c+=e.y*d;a=a.parentNode}while(a&&a!==this.getParentSvg());return new module$exports$Blockly$utils$Coordinate.Coordinate(b,
c)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getCachedParentSvgSize=function(){var a=this.cachedParentSvgSize_;return new module$exports$Blockly$utils$Size.Size(a.width,a.height)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getOriginOffsetInPixels=function(){return(0,module$exports$Blockly$utils$svgMath.getInjectionDivXY)(this.getCanvas())};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getInjectionDiv=function(){if(!this.injectionDiv_)for(var a=this.svgGroup_;a;){if(-1!==(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){this.injectionDiv_=a;break}a=a.parentNode}return this.injectionDiv_};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getBlockCanvas=function(){return this.svgBlockCanvas_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.setResizeHandlerWrapper=function(a){this.resizeHandlerWrapper_=a};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.createDom=function(a){this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyWorkspace"},null);a&&(this.svgBackground_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{height:"100%",width:"100%","class":a},this.svgGroup_),"blocklyMainBackground"===a&&this.grid_?this.svgBackground_.style.fill="url(#"+this.grid_.getPatternId()+
")":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill"));this.svgBlockCanvas_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyBlockCanvas"},this.svgGroup_);this.svgBubbleCanvas_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyBubbleCanvas"},this.svgGroup_);this.isFlyout||((0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgGroup_,
"mousedown",this,this.onMouseDown_,!1,!0),document.body.addEventListener("wheel",function(){}),(0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgGroup_,"wheel",this,this.onMouseWheel_));this.options.hasCategories&&(this.toolbox_=new ((0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.TOOLBOX,this.options,!0))(this));this.grid_&&this.grid_.update(this.scale);this.recordDragTargets();(a=(0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.CURSOR,
this.options))&&this.markerManager_.setCursor(new a);this.renderer_.createDom(this.svgGroup_,this.getTheme());return this.svgGroup_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.dispose=function(){this.rendered=!1;this.currentGesture_&&this.currentGesture_.cancel();this.svgGroup_&&((0,module$exports$Blockly$utils$dom.removeNode)(this.svgGroup_),this.svgGroup_=null);this.svgBubbleCanvas_=this.svgBlockCanvas_=null;this.toolbox_&&(this.toolbox_.dispose(),this.toolbox_=null);this.flyout_&&(this.flyout_.dispose(),this.flyout_=null);this.trashcan&&(this.trashcan.dispose(),this.trashcan=null);this.scrollbar&&(this.scrollbar.dispose(),
this.scrollbar=null);this.zoomControls_&&(this.zoomControls_.dispose(),this.zoomControls_=null);this.audioManager_&&(this.audioManager_.dispose(),this.audioManager_=null);this.grid_&&(this.grid_.dispose(),this.grid_=null);this.renderer_.dispose();this.markerManager_&&(this.markerManager_.dispose(),this.markerManager_=null);module$exports$Blockly$Workspace.Workspace.prototype.dispose.call(this);this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),
this.options.parentWorkspace||(this.themeManager_.dispose(),this.themeManager_=null));this.flyoutButtonCallbacks_=this.toolboxCategoryCallbacks_=this.connectionDBList=null;if(!this.options.parentWorkspace){var a=this.getParentSvg();a&&a.parentNode&&(0,module$exports$Blockly$utils$dom.removeNode)(a.parentNode)}this.resizeHandlerWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.resizeHandlerWrapper_),this.resizeHandlerWrapper_=null)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.newBlock=function(a,b){return new module$exports$Blockly$BlockSvg.BlockSvg(this,a,b)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.addTrashcan=function(){var a=module$exports$Blockly$Trashcan.Trashcan;if(!a)throw Error("Missing require for Blockly.Trashcan");this.trashcan=new a(this);a=this.trashcan.createDom();this.svgGroup_.insertBefore(a,this.svgBlockCanvas_)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.addZoomControls=function(){var a=module$exports$Blockly$ZoomControls.ZoomControls;if(!a)throw Error("Missing require for Blockly.ZoomControls");this.zoomControls_=new a(this);a=this.zoomControls_.createDom();this.svgGroup_.appendChild(a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.addFlyout=function(a){var b=new module$exports$Blockly$Options.Options({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,move:{scrollbars:!0}});b.toolboxPosition=this.options.toolboxPosition;this.flyout_=this.horizontalLayout?new ((0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,
this.options,!0))(b):new ((0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(b);this.flyout_.autoClose=!1;this.flyout_.getWorkspace().setVisible(!0);return this.flyout_.createDom(a)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getFlyout=function(a){return this.flyout_||a?this.flyout_:this.toolbox_?this.toolbox_.getFlyout():null};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getToolbox=function(){return this.toolbox_};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.updateScreenCalculations_=function(){this.updateInverseScreenCTM();this.recordDragTargets()};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.resizeContents=function(){this.resizesEnabled_&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.resize=function(){this.toolbox_&&this.toolbox_.position();this.flyout_&&this.flyout_.position();for(var a=this.componentManager_.getComponents(module$exports$Blockly$ComponentManager.ComponentManager.Capability.POSITIONABLE,!0),b=this.getMetricsManager().getUiMetrics(),c=[],d=0,e;e=a[d];d++)e.position(b,c),(e=e.getBoundingRectangle())&&c.push(e);this.scrollbar&&this.scrollbar.resize();this.updateScreenCalculations_()};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled=function(){var a=(0,module$exports$Blockly$utils$svgMath.getDocumentScroll)();module$exports$Blockly$utils$Coordinate.Coordinate.equals(this.lastRecordedPageScroll_,a)||(this.lastRecordedPageScroll_=a,this.updateScreenCalculations_())};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getCanvas=function(){return this.svgBlockCanvas_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.setCachedParentSvgSize=function(a,b){var c=this.getParentSvg();null!=a&&(this.cachedParentSvgSize_.width=a,c.cachedWidth_=a);null!=b&&(this.cachedParentSvgSize_.height=b,c.cachedHeight_=b)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getBubbleCanvas=function(){return this.svgBubbleCanvas_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getParentSvg=function(){if(!this.cachedParentSvg_)for(var a=this.svgGroup_;a;){if("svg"===a.tagName){this.cachedParentSvg_=a;break}a=a.parentNode}return this.cachedParentSvg_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.maybeFireViewportChangeEvent=function(){if((0,module$exports$Blockly$Events$utils.isEnabled)()){var a=this.scale,b=-this.scrollY,c=-this.scrollX;if(!(a===this.oldScale_&&1>Math.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.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.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.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$svgMath.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.WorkspaceSvg.prototype.getBlockDragSurface=function(){return this.blockDragSurface_};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getWidth=function(){var a=this.getMetrics();return a?a.viewWidth/this.scale:0};
module$exports$Blockly$WorkspaceSvg.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.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<a.length;b++)a[b].render(!1);this.markerManager_.updateMarkers()};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.highlightBlock=function(a,b){if(void 0===b){for(var c=0,d;d=this.highlightedBlocks_[c];c++)d.setHighlighted(!1);this.highlightedBlocks_.length=0}if(a=a?this.getBlockById(a):null)(b=void 0===b||b)?-1===this.highlightedBlocks_.indexOf(a)&&this.highlightedBlocks_.push(a):(0,module$exports$Blockly$utils$array.removeElem)(this.highlightedBlocks_,a),a.setHighlighted(b)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.paste=function(a){if(!this.rendered||!a.type&&!a.tagName)return null;this.currentGesture_&&this.currentGesture_.cancel();var b=(0,module$exports$Blockly$Events$utils.getGroup)();b||(0,module$exports$Blockly$Events$utils.setGroup)(!0);a=a.type?this.pasteBlock_(null,a):"comment"===a.tagName.toLowerCase()?this.pasteWorkspaceComment_(a):this.pasteBlock_(a,null);(0,module$exports$Blockly$Events$utils.setGroup)(b);return a};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.pasteBlock_=function(a,b){(0,module$exports$Blockly$Events$utils.disable)();try{var c=0,d=0;if(a){var e=(0,$.module$exports$Blockly$Xml.domToBlock)(a,this);c=parseInt(a.getAttribute("x"),10);this.RTL&&(c=-c);d=parseInt(a.getAttribute("y"),10)}else b&&(e=(0,module$exports$Blockly$serialization$blocks.append)(b,this),c=b.x||10,this.RTL&&(c=this.getWidth()-c),d=b.y||10);if(!isNaN(c)&&!isNaN(d)){do{var f=!1;var g=this.getAllBlocks(!1);a=0;for(b=
void 0;b=g[a];a++){var h=b.getRelativeToSurfaceXY();if(1>=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$config.config.snapRadius,new module$exports$Blockly$utils$Coordinate.Coordinate(c,d)).connection){f=!0;break}}f&&(c=this.RTL?c-$.module$exports$Blockly$config.config.snapRadius:c+$.module$exports$Blockly$config.config.snapRadius,d+=2*$.module$exports$Blockly$config.config.snapRadius)}while(f);
e.moveTo(new module$exports$Blockly$utils$Coordinate.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();return e};
module$exports$Blockly$WorkspaceSvg.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();return b};module$exports$Blockly$WorkspaceSvg.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.WorkspaceSvg.prototype.renameVariableById=function(a,b){module$exports$Blockly$Workspace.Workspace.prototype.renameVariableById.call(this,a,b);this.refreshToolboxSelection()};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.deleteVariableById=function(a){module$exports$Blockly$Workspace.Workspace.prototype.deleteVariableById.call(this,a);this.refreshToolboxSelection()};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.createVariable=function(a,b,c){a=module$exports$Blockly$Workspace.Workspace.prototype.createVariable.call(this,a,b,c);this.refreshToolboxSelection();return a};
module$exports$Blockly$WorkspaceSvg.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.WorkspaceSvg.prototype.recordDragTargets=function(){var a=this.componentManager_.getComponents(module$exports$Blockly$ComponentManager.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.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.WorkspaceSvg.prototype.onMouseDown_=function(a){var b=this.getGesture(a);b&&b.handleWsStart(a,this)};
module$exports$Blockly$WorkspaceSvg.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.Coordinate.difference(b,a)};
module$exports$Blockly$WorkspaceSvg.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.Coordinate.sum(this.dragDeltaXY_,a)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.isDragging=function(){return null!==this.currentGesture_&&this.currentGesture_.isDragging()};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.isDraggable=function(){return this.options.moveOptions&&this.options.moveOptions.drag};module$exports$Blockly$WorkspaceSvg.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.WorkspaceSvg.prototype.isMovableHorizontally=function(){var a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollHorizontally())};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.isMovableVertically=function(){var a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollVertically())};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.onMouseWheel_=function(a){if(module$exports$Blockly$Gesture.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.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var a=this.getTopBoundedElements();if(!a.length)return new module$exports$Blockly$utils$Rect.Rect(0,0,0,0);for(var b=a[0].getBoundingRectangle(),c=1;c<a.length;c++){var d=a[c];d.isInsertionMarker&&d.isInsertionMarker()||(d=d.getBoundingRectangle(),d.top<b.top&&(b.top=d.top),d.bottom>b.bottom&&(b.bottom=d.bottom),d.left<b.left&&(b.left=d.left),d.right>b.right&&(b.right=d.right))}return b};
module$exports$Blockly$WorkspaceSvg.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.WorkspaceSvg.prototype.showContextMenu=function(a){if(!this.options.readOnly&&!this.isFlyout){var b=module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.getContextMenuOptions(module$exports$Blockly$ContextMenuRegistry.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.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.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():((0,$.module$exports$Blockly$common.setMainWorkspace)(this),this.setBrowserFocus())};
module$exports$Blockly$WorkspaceSvg.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.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:d<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale/this.scale);var e=this.getCanvas().getCTM(),f=this.getParentSvg().createSVGPoint();f.x=a;f.y=b;f=f.matrixTransform(e.inverse());a=f.x;b=f.y;e=e.translate(a*(1-c),b*(1-c)).scale(c);
this.scrollX=e.e;this.scrollY=e.f;this.setScale(d)}};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.zoomCenter=function(a){var b=this.getMetrics();if(this.flyout_){var c=b.svgWidth?b.svgWidth/2:0;b=b.svgHeight?b.svgHeight/2:0}else c=b.viewWidth/2+b.absoluteLeft,b=b.viewHeight/2+b.absoluteTop;this.zoom(c,b,a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.zoomToFit=function(){if(this.isMovable()){var a=this.getMetrics(),b=a.viewWidth;a=a.viewHeight;var c=this.getBlocksBoundingBox(),d=c.right-c.left;c=c.bottom-c.top;if(d){this.flyout_&&(this.horizontalLayout?(a+=this.flyout_.getHeight(),c+=this.flyout_.getHeight()/this.scale):(b+=this.flyout_.getWidth(),d+=this.flyout_.getWidth()/this.scale));b/=d;a/=c;(0,module$exports$Blockly$Events$utils.disable)();try{this.setScale(Math.min(b,a)),this.scrollCenter()}finally{(0,module$exports$Blockly$Events$utils.enable)()}this.maybeFireViewportChangeEvent()}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.beginCanvasTransition=function(){(0,module$exports$Blockly$utils$dom.addClass)(this.svgBlockCanvas_,"blocklyCanvasTransitioning");(0,module$exports$Blockly$utils$dom.addClass)(this.svgBubbleCanvas_,"blocklyCanvasTransitioning")};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.endCanvasTransition=function(){(0,module$exports$Blockly$utils$dom.removeClass)(this.svgBlockCanvas_,"blocklyCanvasTransitioning");(0,module$exports$Blockly$utils$dom.removeClass)(this.svgBubbleCanvas_,"blocklyCanvasTransitioning")};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.scrollCenter=function(){if(this.isMovable()){var a=this.getMetrics(),b=(a.scrollWidth-a.viewWidth)/2,c=(a.scrollHeight-a.viewHeight)/2;b=-b-a.scrollLeft;c=-c-a.scrollTop;this.scroll(b,c)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.centerOnBlock=function(a){if(this.isMovable()){if(a=a?this.getBlockById(a):null){var b=a.getRelativeToSurfaceXY(),c=a.getHeightWidth(),d=this.scale;a=(b.x+(this.RTL?-1:1)*c.width/2)*d;b=(b.y+c.height/2)*d;c=this.getMetrics();this.scroll(-(a-c.viewWidth/2),-(b-c.viewHeight/2))}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.setScale=function(a){this.options.zoomOptions.maxScale&&a>this.options.zoomOptions.maxScale?a=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&a<this.options.zoomOptions.minScale&&(a=this.options.zoomOptions.minScale);this.scale=a;this.hideChaff(!1);(a=this.getFlyout(!1))&&a.isVisible()&&(a.reflow(),this.recordDragTargets());this.grid_&&this.grid_.update(this.scale);a=this.getMetrics();this.scrollX-=a.absoluteLeft;this.scrollY-=
a.absoluteTop;a.viewLeft+=a.absoluteLeft;a.viewTop+=a.absoluteTop;this.scroll(this.scrollX,this.scrollY);this.scrollbar&&(this.flyout_?this.scrollbar.resizeView(a):this.scrollbar.resizeContent(a))};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getScale=function(){return this.options.parentWorkspace?this.options.parentWorkspace.getScale():this.scale};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.scroll=function(a,b){this.hideChaff(!0);var c=this.getMetrics();a=Math.min(a,-c.scrollLeft);b=Math.min(b,-c.scrollTop);var d=c.scrollTop+Math.max(0,c.scrollHeight-c.viewHeight);a=Math.max(a,-(c.scrollLeft+Math.max(0,c.scrollWidth-c.viewWidth)));b=Math.max(b,-d);this.scrollX=a;this.scrollY=b;this.scrollbar&&this.scrollbar.set(-(a+c.scrollLeft),-(b+c.scrollTop),!1);a+=c.absoluteLeft;b+=c.absoluteTop;this.translate(a,b)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getBlockById=function(a){return module$exports$Blockly$Workspace.Workspace.prototype.getBlockById.call(this,a)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getAllBlocks=function(a){return module$exports$Blockly$Workspace.Workspace.prototype.getAllBlocks.call(this,a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getTopBlocks=function(a){return module$exports$Blockly$Workspace.Workspace.prototype.getTopBlocks.call(this,a)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.addTopBlock=function(a){this.addTopBoundedElement(a);module$exports$Blockly$Workspace.Workspace.prototype.addTopBlock.call(this,a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.removeTopBlock=function(a){this.removeTopBoundedElement(a);module$exports$Blockly$Workspace.Workspace.prototype.removeTopBlock.call(this,a)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.addTopComment=function(a){this.addTopBoundedElement(a);module$exports$Blockly$Workspace.Workspace.prototype.addTopComment.call(this,a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.removeTopComment=function(a){this.removeTopBoundedElement(a);module$exports$Blockly$Workspace.Workspace.prototype.removeTopComment.call(this,a)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.addTopBoundedElement=function(a){this.topBoundedElements_.push(a)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.removeTopBoundedElement=function(a){(0,module$exports$Blockly$utils$array.removeElem)(this.topBoundedElements_,a)};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getTopBoundedElements=function(){return[].concat(this.topBoundedElements_)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.setResizesEnabled=function(a){var b=!this.resizesEnabled_&&a;this.resizesEnabled_=a;b&&this.resizeContents()};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.clear=function(){this.setResizesEnabled(!1);module$exports$Blockly$Workspace.Workspace.prototype.clear.call(this);this.topBoundedElements_=[];this.setResizesEnabled(!0)};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.registerButtonCallback=function(a,b){if("function"!==typeof b)throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks_[a]=b};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getButtonCallback=function(a){return(a=this.flyoutButtonCallbacks_[a])?a:null};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.removeButtonCallback=function(a){this.flyoutButtonCallbacks_[a]=null};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.registerToolboxCategoryCallback=function(a,b){if("function"!==typeof b)throw TypeError("Toolbox category callbacks must be functions.");this.toolboxCategoryCallbacks_[a]=b};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getToolboxCategoryCallback=function(a){return this.toolboxCategoryCallbacks_[a]||null};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.removeToolboxCategoryCallback=function(a){this.toolboxCategoryCallbacks_[a]=null};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getGesture=function(a){var b="mousedown"===a.type||"touchstart"===a.type||"pointerdown"===a.type,c=this.currentGesture_;return c?b&&c.hasStarted()?(console.warn("Tried to start the same gesture twice."),c.cancel(),null):c:b?this.currentGesture_=new module$exports$Blockly$TouchGesture.TouchGesture(a,this):null};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.clearGesture=function(){this.currentGesture_=null};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.cancelCurrentGesture=function(){this.currentGesture_&&this.currentGesture_.cancel()};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getAudioManager=function(){return this.audioManager_};module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.getGrid=function(){return this.grid_};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.prototype.hideChaff=function(a){(0,module$exports$Blockly$Tooltip.hide)();(0,module$exports$Blockly$WidgetDiv.hide)();(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)();var b=!!a;this.getComponentManager().getComponents(module$exports$Blockly$ComponentManager.ComponentManager.Capability.AUTOHIDEABLE,!0).forEach(function(c){return c.autoHide(b)})};
module$exports$Blockly$WorkspaceSvg.WorkspaceSvg.setTopLevelWorkspaceMetrics_=function(a){var b=this.getMetrics();"number"===typeof a.x&&(this.scrollX=-(b.scrollLeft+(b.scrollWidth-b.viewWidth)*a.x));"number"===typeof a.y&&(this.scrollY=-(b.scrollTop+(b.scrollHeight-b.viewHeight)*a.y));this.translate(this.scrollX+b.absoluteLeft,this.scrollY+b.absoluteTop)};module$exports$Blockly$WorkspaceSvg.resizeSvgContents=function(a){a.resizeContents()};var module$exports$Blockly$inject={inject:function(a,b){"string"===typeof a&&(a=document.getElementById(a)||document.querySelector(a));if(!a||!(0,module$exports$Blockly$utils$dom.containsNode)(document,a))throw Error("Error: container is not in current document.");b=new module$exports$Blockly$Options.Options(b||{});var c=document.createElement("div");c.className="injectionDiv";c.tabIndex=0;(0,module$exports$Blockly$utils$aria.setState)(c,module$exports$Blockly$utils$aria.State.LABEL,$.module$exports$Blockly$Msg.Msg.WORKSPACE_ARIA_LABEL);
a.appendChild(c);a=module$contents$Blockly$inject_createDom(c,b);var d=new module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg(c),e=new module$exports$Blockly$WorkspaceDragSurfaceSvg.WorkspaceDragSurfaceSvg(c),f=module$contents$Blockly$inject_createMainWorkspace(a,b,d,e);module$contents$Blockly$inject_init(f);(0,$.module$exports$Blockly$common.setMainWorkspace)(f);(0,$.module$exports$Blockly$common.svgResize)(f);c.addEventListener("focusin",function(){(0,$.module$exports$Blockly$common.setMainWorkspace)(f)});
return f}},module$contents$Blockly$inject_createDom=function(a,b){a.setAttribute("dir","LTR");(0,module$exports$Blockly$Css.inject)(b.hasCss,b.pathToMedia);a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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":"blocklySvg",tabindex:"0"},a);var c=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.DEFS,
{},a),d=String(Math.random()).substring(2);b.gridPattern=module$exports$Blockly$Grid.Grid.createDom(d,b.gridOptions,c);return a},module$contents$Blockly$inject_createMainWorkspace=function(a,b,c,d){b.parentWorkspace=null;b=new module$exports$Blockly$WorkspaceSvg.WorkspaceSvg(b,c,d);c=b.options;b.scale=c.zoomOptions.startScale;a.appendChild(b.createDom("blocklyMainBackground"));(0,module$exports$Blockly$utils$dom.addClass)(b.getInjectionDiv(),b.getRenderer().getClassName());(0,module$exports$Blockly$utils$dom.addClass)(b.getInjectionDiv(),
b.getTheme().getClassName());!c.hasCategories&&c.languageTree&&(d=b.addFlyout(module$exports$Blockly$utils$Svg.Svg.SVG),(0,module$exports$Blockly$utils$dom.insertAfter)(d,a));c.hasTrashcan&&b.addTrashcan();c.zoomOptions&&c.zoomOptions.controls&&b.addZoomControls();b.getThemeManager().subscribe(a,"workspaceBackgroundColour","background-color");b.translate(0,0);b.addChangeListener((0,module$exports$Blockly$bumpObjects.bumpIntoBoundsHandler)(b));(0,$.module$exports$Blockly$common.svgResize)(b);(0,module$exports$Blockly$WidgetDiv.createDom)();
(0,module$exports$Blockly$dropDownDiv.createDom)();(0,module$exports$Blockly$Tooltip.createDom)();return b},module$contents$Blockly$inject_init=function(a){var b=a.options,c=a.getParentSvg();(0,module$exports$Blockly$browserEvents.conditionalBind)(c.parentNode,"contextmenu",null,function(e){(0,module$exports$Blockly$browserEvents.isTargetInput)(e)||e.preventDefault()});c=(0,module$exports$Blockly$browserEvents.conditionalBind)(window,"resize",null,function(){a.hideChaff(!0);(0,$.module$exports$Blockly$common.svgResize)(a);
module$exports$Blockly$bumpObjects.bumpTopObjectsIntoBounds(a)});a.setResizeHandlerWrapper(c);module$contents$Blockly$inject_bindDocumentEvents();if(b.languageTree){c=a.getToolbox();var d=a.getFlyout(!0);c?c.init():d&&(d.init(a),d.show(b.languageTree),"function"===typeof d.scrollToStart&&d.scrollToStart())}b.hasTrashcan&&a.trashcan.init();b.zoomOptions&&b.zoomOptions.controls&&a.zoomControls_.init();b.moveOptions&&b.moveOptions.scrollbars?(a.scrollbar=new module$exports$Blockly$ScrollbarPair.ScrollbarPair(a,
!0===b.moveOptions.scrollbars||!!b.moveOptions.scrollbars.horizontal,!0===b.moveOptions.scrollbars||!!b.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),a.scrollbar.resize()):a.setMetrics({x:.5,y:.5});b.hasSounds&&module$contents$Blockly$inject_loadSounds(b.pathToMedia,a)},module$contents$Blockly$inject_onKeyDown=function(a){var b=(0,$.module$exports$Blockly$common.getMainWorkspace)();if(b&&!((0,module$exports$Blockly$browserEvents.isTargetInput)(a)||b.rendered&&!b.isVisible()))module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.onKeyDown(b,
a)},module$contents$Blockly$inject_documentEventsBound=!1,module$contents$Blockly$inject_bindDocumentEvents=function(){module$contents$Blockly$inject_documentEventsBound||((0,module$exports$Blockly$browserEvents.conditionalBind)(document,"scroll",null,function(){for(var a=module$exports$Blockly$Workspace.Workspace.getAll(),b=0,c;c=a[b];b++)c.updateInverseScreenCTM&&c.updateInverseScreenCTM()}),(0,module$exports$Blockly$browserEvents.conditionalBind)(document,"keydown",null,module$contents$Blockly$inject_onKeyDown),
(0,module$exports$Blockly$browserEvents.bind)(document,"touchend",null,module$exports$Blockly$Touch.longStop),(0,module$exports$Blockly$browserEvents.bind)(document,"touchcancel",null,module$exports$Blockly$Touch.longStop),module$exports$Blockly$utils$userAgent.IPAD&&(0,module$exports$Blockly$browserEvents.conditionalBind)(window,"orientationchange",document,function(){(0,$.module$exports$Blockly$common.svgResize)((0,$.module$exports$Blockly$common.getMainWorkspace)())}));module$contents$Blockly$inject_documentEventsBound=
!0},module$contents$Blockly$inject_loadSounds=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");c.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[];a=function(){for(;d.length;)(0,module$exports$Blockly$browserEvents.unbind)(d.pop());c.preload()};d.push((0,module$exports$Blockly$browserEvents.conditionalBind)(document,"mousemove",null,a,!0));d.push((0,module$exports$Blockly$browserEvents.conditionalBind)(document,
"touchstart",null,a,!0))};var module$exports$Blockly$IComponent={IComponent:function(){}};var module$exports$Blockly$IDragTarget={IDragTarget:function(){}};var module$exports$Blockly$DragTarget={DragTarget:function(){}};module$exports$Blockly$DragTarget.DragTarget.prototype.onDragEnter=function(a){};module$exports$Blockly$DragTarget.DragTarget.prototype.onDragOver=function(a){};module$exports$Blockly$DragTarget.DragTarget.prototype.onDragExit=function(a){};module$exports$Blockly$DragTarget.DragTarget.prototype.onDrop=function(a){};module$exports$Blockly$DragTarget.DragTarget.prototype.getClientRect=function(){return null};
module$exports$Blockly$DragTarget.DragTarget.prototype.shouldPreventMove=function(a){return!1};var module$exports$Blockly$IDeleteArea={IDeleteArea:function(){}};var module$exports$Blockly$DeleteArea={DeleteArea:function(){module$exports$Blockly$DragTarget.DragTarget.call(this);this.wouldDelete_=!1}};$.$jscomp.inherits(module$exports$Blockly$DeleteArea.DeleteArea,module$exports$Blockly$DragTarget.DragTarget);module$exports$Blockly$DeleteArea.DeleteArea.prototype.wouldDelete=function(a,b){a instanceof module$exports$Blockly$BlockSvg.BlockSvg?(a=!a.getParent()&&a.isDeletable(),this.updateWouldDelete_(a&&!b)):this.updateWouldDelete_(a.isDeletable());return this.wouldDelete_};
module$exports$Blockly$DeleteArea.DeleteArea.prototype.updateWouldDelete_=function(a){this.wouldDelete_=a};var module$exports$Blockly$FlyoutMetricsManager={FlyoutMetricsManager:function(a,b){module$exports$Blockly$MetricsManager.MetricsManager.call(this,a);this.flyout_=b}};$.$jscomp.inherits(module$exports$Blockly$FlyoutMetricsManager.FlyoutMetricsManager,module$exports$Blockly$MetricsManager.MetricsManager);module$exports$Blockly$FlyoutMetricsManager.FlyoutMetricsManager.prototype.getBoundingBox_=function(){try{var a=this.workspace_.getCanvas().getBBox()}catch(b){a={height:0,y:0,width:0,x:0}}return a};
module$exports$Blockly$FlyoutMetricsManager.FlyoutMetricsManager.prototype.getContentMetrics=function(a){var b=this.getBoundingBox_();a=a?1:this.workspace_.scale;return{height:b.height*a,width:b.width*a,top:b.y*a,left:b.x*a}};module$exports$Blockly$FlyoutMetricsManager.FlyoutMetricsManager.prototype.getScrollMetrics=function(a,b,c){b=c||this.getContentMetrics();c=this.flyout_.MARGIN*this.workspace_.scale;a=a?this.workspace_.scale:1;return{height:(b.height+2*c)/a,width:(b.width+b.left+c)/a,top:0,left:0}};var module$exports$Blockly$IFlyout={IFlyout:function(){}};var module$exports$Blockly$Flyout={Flyout:function(a){module$exports$Blockly$DeleteArea.DeleteArea.call(this);a.setMetrics=this.setMetrics_.bind(this);this.workspace_=new module$exports$Blockly$WorkspaceSvg.WorkspaceSvg(a);this.workspace_.setMetricsManager(new module$exports$Blockly$FlyoutMetricsManager.FlyoutMetricsManager(this.workspace_,this));this.workspace_.isFlyout=!0;this.workspace_.setVisible(this.isVisible_);this.id=(0,module$exports$Blockly$utils$idGenerator.genUid)();this.RTL=!!a.RTL;this.horizontalLayout=
!1;this.toolboxPosition_=a.toolboxPosition;this.eventWrappers_=[];this.filterWrapper_=this.reflowWrapper_=null;this.mats_=[];this.buttons_=[];this.listeners_=[];this.permanentlyDisabled_=[];this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH;this.targetWorkspace=null;this.recycledBlocks_=[];this.autoClose=!0;this.isVisible_=!1;this.containerVisible_=!0;this.rectMap_=new WeakMap;this.MARGIN=this.CORNER_RADIUS=8;this.GAP_X=3*this.MARGIN;this.GAP_Y=3*this.MARGIN;this.SCROLLBAR_MARGIN=
2.5;this.height_=this.width_=0;this.dragAngleRange_=70;this.svgGroup_=this.svgBackground_=null}};$.$jscomp.inherits(module$exports$Blockly$Flyout.Flyout,module$exports$Blockly$DeleteArea.DeleteArea);
module$exports$Blockly$Flyout.Flyout.prototype.createDom=function(a){this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(a,{"class":"blocklyFlyout",style:"display: none"},null);this.svgBackground_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{"class":"blocklyFlyoutBackground"},this.svgGroup_);this.svgGroup_.appendChild(this.workspace_.createDom());this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutBackgroundColour",
"fill");this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutOpacity","fill-opacity");return this.svgGroup_};
module$exports$Blockly$Flyout.Flyout.prototype.init=function(a){this.targetWorkspace=a;this.workspace_.targetWorkspace=a;this.workspace_.scrollbar=new module$exports$Blockly$ScrollbarPair.ScrollbarPair(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN);this.hide();Array.prototype.push.apply(this.eventWrappers_,(0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgGroup_,"wheel",this,this.wheel_));this.autoClose||(this.filterWrapper_=
this.filterForCapacity_.bind(this),this.targetWorkspace.addChangeListener(this.filterWrapper_));Array.prototype.push.apply(this.eventWrappers_,(0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgBackground_,"mousedown",this,this.onMouseDown_));this.workspace_.getGesture=this.targetWorkspace.getGesture.bind(this.targetWorkspace);this.workspace_.setVariableMap(this.targetWorkspace.getVariableMap());this.workspace_.createPotentialVariableMap();a.getComponentManager().addComponent({component:this,
weight:1,capabilities:[module$exports$Blockly$ComponentManager.ComponentManager.Capability.DELETE_AREA,module$exports$Blockly$ComponentManager.ComponentManager.Capability.DRAG_TARGET]})};
module$exports$Blockly$Flyout.Flyout.prototype.dispose=function(){this.hide();this.workspace_.getComponentManager().removeComponent(this.id);(0,module$exports$Blockly$browserEvents.unbind)(this.eventWrappers_);this.filterWrapper_&&(this.targetWorkspace.removeChangeListener(this.filterWrapper_),this.filterWrapper_=null);this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.targetWorkspace=null,this.workspace_.dispose(),this.workspace_=null);this.svgGroup_&&
((0,module$exports$Blockly$utils$dom.removeNode)(this.svgGroup_),this.svgGroup_=null);this.targetWorkspace=this.svgBackground_=null};module$exports$Blockly$Flyout.Flyout.prototype.getWidth=function(){return this.width_};module$exports$Blockly$Flyout.Flyout.prototype.getHeight=function(){return this.height_};module$exports$Blockly$Flyout.Flyout.prototype.getFlyoutScale=function(){return this.targetWorkspace.scale};module$exports$Blockly$Flyout.Flyout.prototype.getWorkspace=function(){return this.workspace_};
module$exports$Blockly$Flyout.Flyout.prototype.isVisible=function(){return this.isVisible_};module$exports$Blockly$Flyout.Flyout.prototype.setVisible=function(a){var b=a!==this.isVisible();this.isVisible_=a;b&&(this.autoClose||this.workspace_.recordDragTargets(),this.updateDisplay_())};module$exports$Blockly$Flyout.Flyout.prototype.setContainerVisible=function(a){var b=a!==this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()};
module$exports$Blockly$Flyout.Flyout.prototype.updateDisplay_=function(){var a=this.containerVisible_?this.isVisible():!1;this.svgGroup_.style.display=a?"block":"none";this.workspace_.scrollbar.setContainerVisible(a)};
module$exports$Blockly$Flyout.Flyout.prototype.positionAt_=function(a,b,c,d){this.svgGroup_.setAttribute("width",a);this.svgGroup_.setAttribute("height",b);this.workspace_.setCachedParentSvgSize(a,b);"svg"===this.svgGroup_.tagName?(0,module$exports$Blockly$utils$dom.setCssTransform)(this.svgGroup_,"translate("+c+"px,"+d+"px)"):this.svgGroup_.setAttribute("transform","translate("+c+","+d+")");if(a=this.workspace_.scrollbar)a.setOrigin(c,d),a.resize(),a.hScroll&&a.hScroll.setPosition(a.hScroll.position.x,
a.hScroll.position.y),a.vScroll&&a.vScroll.setPosition(a.vScroll.position.x,a.vScroll.position.y)};module$exports$Blockly$Flyout.Flyout.prototype.hide=function(){if(this.isVisible()){this.setVisible(!1);for(var a=0,b;b=this.listeners_[a];a++)(0,module$exports$Blockly$browserEvents.unbind)(b);this.listeners_.length=0;this.reflowWrapper_&&(this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowWrapper_=null)}};
module$exports$Blockly$Flyout.Flyout.prototype.show=function(a){this.workspace_.setResizesEnabled(!1);this.hide();this.clearOldBlocks_();"string"===typeof a&&(a=this.getDynamicCategoryContents_(a));this.setVisible(!0);a=(0,module$exports$Blockly$utils$toolbox.convertFlyoutDefToJsonArray)(a);a=this.createFlyoutInfo_(a);this.layout_(a.contents,a.gaps);this.listeners_.push((0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgBackground_,"mouseover",this,function(){for(var b=this.workspace_.getTopBlocks(!1),
c=0,d;d=b[c];c++)d.removeSelect()}));this.horizontalLayout?this.height_=0:this.width_=0;this.workspace_.setResizesEnabled(!0);this.reflow();this.filterForCapacity_();this.position();this.reflowWrapper_=this.reflow.bind(this);this.workspace_.addChangeListener(this.reflowWrapper_);this.emptyRecycledBlocks_()};
module$exports$Blockly$Flyout.Flyout.prototype.createFlyoutInfo_=function(a){var b=[],c=[];this.permanentlyDisabled_.length=0;for(var d=this.horizontalLayout?this.GAP_X:this.GAP_Y,e=0,f;f=a[e];e++)switch(f.custom&&(f=this.getDynamicCategoryContents_(f.custom),f=(0,module$exports$Blockly$utils$toolbox.convertFlyoutDefToJsonArray)(f),a.splice.apply(a,[e,1].concat(f)),f=a[e]),f.kind.toUpperCase()){case "BLOCK":var g=this.createFlyoutBlock_(f);b.push({type:"block",block:g});this.addBlockGap_(f,c,d);break;
case "SEP":this.addSeparatorGap_(f,c,d);break;case "LABEL":f=this.createButton_(f,!0);b.push({type:"button",button:f});c.push(d);break;case "BUTTON":f=this.createButton_(f,!1),b.push({type:"button",button:f}),c.push(d)}return{contents:b,gaps:c}};
module$exports$Blockly$Flyout.Flyout.prototype.getDynamicCategoryContents_=function(a){a=this.workspace_.targetWorkspace.getToolboxCategoryCallback(a);if("function"!==typeof a)throw TypeError("Couldn't find a callback function when opening a toolbox category.");return a(this.workspace_.targetWorkspace)};
module$exports$Blockly$Flyout.Flyout.prototype.createButton_=function(a,b){var c=module$exports$Blockly$FlyoutButton.FlyoutButton;if(!c)throw Error("Missing require for Blockly.FlyoutButton");return new c(this.workspace_,this.targetWorkspace,a,b)};
module$exports$Blockly$Flyout.Flyout.prototype.createFlyoutBlock_=function(a){var b;a.blockxml?(a="string"===typeof a.blockxml?(0,$.module$exports$Blockly$Xml.textToDom)(a.blockxml):a.blockxml,(b=this.getRecycledBlock_(a.getAttribute("type")))||(b=(0,$.module$exports$Blockly$Xml.domToBlock)(a,this.workspace_))):(b=this.getRecycledBlock_(a.type),b||(void 0===a.enabled&&(a.enabled="true"!==a.disabled&&!0!==a.disabled),b=(0,module$exports$Blockly$serialization$blocks.append)(a,this.workspace_)));b.isEnabled()||
this.permanentlyDisabled_.push(b);return b};module$exports$Blockly$Flyout.Flyout.prototype.getRecycledBlock_=function(a){for(var b=-1,c=0;c<this.recycledBlocks_.length;c++)if(this.recycledBlocks_[c].type===a){b=c;break}return-1===b?void 0:this.recycledBlocks_.splice(b,1)[0]};
module$exports$Blockly$Flyout.Flyout.prototype.addBlockGap_=function(a,b,c){if(a.gap)var d=parseInt(a.gap,10);else a.blockxml&&(a="string"===typeof a.blockxml?(0,$.module$exports$Blockly$Xml.textToDom)(a.blockxml):a.blockxml,d=parseInt(a.getAttribute("gap"),10));b.push(isNaN(d)?c:d)};module$exports$Blockly$Flyout.Flyout.prototype.addSeparatorGap_=function(a,b,c){a=parseInt(a.gap,10);!isNaN(a)&&0<b.length?b[b.length-1]=a:b.push(c)};
module$exports$Blockly$Flyout.Flyout.prototype.clearOldBlocks_=function(){for(var a=this.workspace_.getTopBlocks(!1),b=0,c;c=a[b];b++)this.blockIsRecyclable_(c)?this.recycleBlock_(c):c.dispose(!1,!1);for(a=0;a<this.mats_.length;a++)if(b=this.mats_[a])(0,module$exports$Blockly$Tooltip.unbindMouseEvents)(b),(0,module$exports$Blockly$utils$dom.removeNode)(b);for(a=this.mats_.length=0;b=this.buttons_[a];a++)b.dispose();this.buttons_.length=0;this.workspace_.getPotentialVariableMap().clear()};
module$exports$Blockly$Flyout.Flyout.prototype.emptyRecycledBlocks_=function(){for(var a=0;a<this.recycledBlocks_.length;a++)this.recycledBlocks_[a].dispose();this.recycledBlocks_=[]};module$exports$Blockly$Flyout.Flyout.prototype.blockIsRecyclable_=function(a){return!1};module$exports$Blockly$Flyout.Flyout.prototype.recycleBlock_=function(a){var b=a.getRelativeToSurfaceXY();a.moveBy(-b.x,-b.y);this.recycledBlocks_.push(a)};
module$exports$Blockly$Flyout.Flyout.prototype.addBlockListeners_=function(a,b,c){this.listeners_.push((0,module$exports$Blockly$browserEvents.conditionalBind)(a,"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push((0,module$exports$Blockly$browserEvents.conditionalBind)(c,"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push((0,module$exports$Blockly$browserEvents.bind)(a,"mouseenter",b,b.addSelect));this.listeners_.push((0,module$exports$Blockly$browserEvents.bind)(a,"mouseleave",
b,b.removeSelect));this.listeners_.push((0,module$exports$Blockly$browserEvents.bind)(c,"mouseenter",b,b.addSelect));this.listeners_.push((0,module$exports$Blockly$browserEvents.bind)(c,"mouseleave",b,b.removeSelect))};module$exports$Blockly$Flyout.Flyout.prototype.blockMouseDown_=function(a){var b=this;return function(c){var d=b.targetWorkspace.getGesture(c);d&&(d.setStartBlock(a),d.handleFlyoutStart(c,b))}};
module$exports$Blockly$Flyout.Flyout.prototype.onMouseDown_=function(a){var b=this.targetWorkspace.getGesture(a);b&&b.handleFlyoutStart(a,this)};module$exports$Blockly$Flyout.Flyout.prototype.isBlockCreatable_=function(a){return a.isEnabled()};
module$exports$Blockly$Flyout.Flyout.prototype.createBlock=function(a){var b=null;(0,module$exports$Blockly$Events$utils.disable)();var c=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{b=this.placeNewBlock_(a)}finally{(0,module$exports$Blockly$Events$utils.enable)()}this.targetWorkspace.hideChaff();a=(0,$.module$exports$Blockly$Variables.getAddedVariables)(this.targetWorkspace,c);if((0,module$exports$Blockly$Events$utils.isEnabled)()){(0,module$exports$Blockly$Events$utils.setGroup)(!0);
for(c=0;c<a.length;c++){var d=a[c];(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.VAR_CREATE))(d))}(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CREATE))(b))}this.autoClose?this.hide():this.filterForCapacity_();return b};
module$exports$Blockly$Flyout.Flyout.prototype.initFlyoutButton_=function(a,b,c){var d=a.createDom();a.moveTo(b,c);a.show();this.listeners_.push((0,module$exports$Blockly$browserEvents.conditionalBind)(d,"mousedown",this,this.onMouseDown_));this.buttons_.push(a)};
module$exports$Blockly$Flyout.Flyout.prototype.createRect_=function(a,b,c,d,e){b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{"fill-opacity":0,x:b,y:c,height:d.height,width:d.width},null);b.tooltip=a;(0,module$exports$Blockly$Tooltip.bindMouseEvents)(b);this.workspace_.getCanvas().insertBefore(b,a.getSvgRoot());this.rectMap_.set(a,b);return this.mats_[e]=b};
module$exports$Blockly$Flyout.Flyout.prototype.moveRectToBlock_=function(a,b){var c=b.getHeightWidth();a.setAttribute("width",c.width);a.setAttribute("height",c.height);b=b.getRelativeToSurfaceXY();a.setAttribute("y",b.y);a.setAttribute("x",this.RTL?b.x-c.width:b.x)};
module$exports$Blockly$Flyout.Flyout.prototype.filterForCapacity_=function(){for(var a=this.workspace_.getTopBlocks(!1),b=0,c;c=a[b];b++)if(-1===this.permanentlyDisabled_.indexOf(c))for(var d=this.targetWorkspace.isCapacityAvailable((0,$.module$exports$Blockly$common.getBlockTypeCounts)(c));c;)c.setEnabled(d),c=c.getNextBlock()};
module$exports$Blockly$Flyout.Flyout.prototype.reflow=function(){this.reflowWrapper_&&this.workspace_.removeChangeListener(this.reflowWrapper_);this.reflowInternal_();this.reflowWrapper_&&this.workspace_.addChangeListener(this.reflowWrapper_)};module$exports$Blockly$Flyout.Flyout.prototype.isScrollable=function(){return this.workspace_.scrollbar?this.workspace_.scrollbar.isVisible():!1};
module$exports$Blockly$Flyout.Flyout.prototype.placeNewBlock_=function(a){var b=this.targetWorkspace;if(!a.getSvgRoot())throw Error("oldBlock is not rendered.");var c=(0,module$exports$Blockly$serialization$blocks.save)(a);b.setResizesEnabled(!1);b=(0,module$exports$Blockly$serialization$blocks.append)(c,b);this.positionNewBlock_(a,b);return b};
module$exports$Blockly$Flyout.Flyout.prototype.positionNewBlock_=function(a,b){var c=this.targetWorkspace,d=c.getOriginOffsetInPixels(),e=this.workspace_.getOriginOffsetInPixels();a=a.getRelativeToSurfaceXY();a.scale(this.workspace_.scale);e=module$exports$Blockly$utils$Coordinate.Coordinate.sum(e,a);d=module$exports$Blockly$utils$Coordinate.Coordinate.difference(e,d);d.scale(1/c.scale);b.moveTo(new module$exports$Blockly$utils$Coordinate.Coordinate(d.x,d.y))};var module$exports$Blockly$VerticalFlyout={VerticalFlyout:function(a){module$exports$Blockly$Flyout.Flyout.call(this,a)}};$.$jscomp.inherits(module$exports$Blockly$VerticalFlyout.VerticalFlyout,module$exports$Blockly$Flyout.Flyout);
module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.setMetrics_=function(a){if(this.isVisible()){var b=this.workspace_.getMetricsManager(),c=b.getScrollMetrics(),d=b.getViewMetrics();b=b.getAbsoluteMetrics();"number"===typeof a.y&&(this.workspace_.scrollY=-(c.top+(c.height-d.height)*a.y));this.workspace_.translate(this.workspace_.scrollX+b.left,this.workspace_.scrollY+b.top)}};
module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.getX=function(){if(!this.isVisible())return 0;var a=this.targetWorkspace.getMetricsManager(),b=a.getAbsoluteMetrics(),c=a.getViewMetrics();a=a.getToolboxMetrics();return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===module$exports$Blockly$utils$toolbox.Position.LEFT?a.width:c.width-this.width_:this.toolboxPosition_===module$exports$Blockly$utils$toolbox.Position.LEFT?
0:c.width:this.toolboxPosition_===module$exports$Blockly$utils$toolbox.Position.LEFT?0:c.width+b.left-this.width_};module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.getY=function(){return 0};
module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.position=function(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var a=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=a.height;this.setBackgroundPath_(this.width_-this.CORNER_RADIUS,a.height-2*this.CORNER_RADIUS);a=this.getX();var b=this.getY();this.positionAt_(this.width_,this.height_,a,b)}};
module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.setBackgroundPath_=function(a,b){var c=this.toolboxPosition_===module$exports$Blockly$utils$toolbox.Position.RIGHT,d=a+this.CORNER_RADIUS;d=["M "+(c?d:0)+",0"];d.push("h",c?-a:a);d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,c?0:1,c?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS);d.push("v",Math.max(0,b));d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,c?0:1,c?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS);
d.push("h",c?a:-a);d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))};module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.scrollToStart=function(){this.workspace_.scrollbar.setY(0)};
module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.wheel_=function(a){var b=(0,module$exports$Blockly$browserEvents.getScrollDeltaPixels)(a);if(b.y){var c=this.workspace_.getMetricsManager(),d=c.getScrollMetrics();b=c.getViewMetrics().top-d.top+b.y;this.workspace_.scrollbar.setY(b);(0,module$exports$Blockly$WidgetDiv.hide)();(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)()}a.preventDefault();a.stopPropagation()};
module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.layout_=function(a,b){this.workspace_.scale=this.targetWorkspace.scale;for(var c=this.MARGIN,d=this.RTL?c:c+this.tabWidth_,e=0,f;f=a[e];e++)if("block"===f.type){f=f.block;for(var g=f.getDescendants(!1),h=0,k;k=g[h];h++)k.isInFlyout=!0;f.render();g=f.getSvgRoot();h=f.getHeightWidth();k=f.outputConnection?d-this.tabWidth_:d;f.moveBy(k,c);k=this.createRect_(f,this.RTL?k-h.width:k,c,h,e);this.addBlockListeners_(g,f,k);c+=h.height+b[e]}else"button"===
f.type&&(this.initFlyoutButton_(f.button,d,c),c+=f.button.height+b[e])};module$exports$Blockly$VerticalFlyout.VerticalFlyout.prototype.isDragTowardWorkspace=function(a){a=Math.atan2(a.y,a.x)/Math.PI*180;var b=this.dragAngleRange_;return a<b&&a>-b||a<-180+b||a>180-b?!0:!1};
module$exports$Blockly$VerticalFlyout.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.Rect(-1E9,1E9,-1E9,b+a.width):new module$exports$Blockly$utils$Rect.Rect(-1E9,1E9,b,1E9)};
module$exports$Blockly$VerticalFlyout.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.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)}this.rectMap_.has(d)&&this.moveRectToBlock_(this.rectMap_.get(d),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()}};module$exports$Blockly$VerticalFlyout.VerticalFlyout.registryName="verticalFlyout";(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.FLYOUTS_VERTICAL_TOOLBOX,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$VerticalFlyout.VerticalFlyout);var module$exports$Blockly$IToolboxItem={IToolboxItem:function(){}};var module$exports$Blockly$ISelectableToolboxItem={ISelectableToolboxItem:function(){}};var module$exports$Blockly$ICollapsibleToolboxItem={ICollapsibleToolboxItem:function(){}};var module$exports$Blockly$ToolboxItem={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.ToolboxItem.prototype.init=function(){};module$exports$Blockly$ToolboxItem.ToolboxItem.prototype.getDiv=function(){return null};
module$exports$Blockly$ToolboxItem.ToolboxItem.prototype.getClickTarget=function(){return null};module$exports$Blockly$ToolboxItem.ToolboxItem.prototype.getId=function(){return this.id_};module$exports$Blockly$ToolboxItem.ToolboxItem.prototype.getParent=function(){return null};module$exports$Blockly$ToolboxItem.ToolboxItem.prototype.getLevel=function(){return this.level_};module$exports$Blockly$ToolboxItem.ToolboxItem.prototype.isSelectable=function(){return!1};
module$exports$Blockly$ToolboxItem.ToolboxItem.prototype.isCollapsible=function(){return!1};module$exports$Blockly$ToolboxItem.ToolboxItem.prototype.dispose=function(){};var module$exports$Blockly$ToolboxCategory={ToolboxCategory:function(a,b,c){module$exports$Blockly$ToolboxItem.ToolboxItem.call(this,a,b,c);this.colour_=this.name_="";this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null;this.cssConfig_=this.makeDefaultCssConfig_();this.isDisabled_=this.isHidden_=!1;this.flyoutItems_=[]}};$.$jscomp.inherits(module$exports$Blockly$ToolboxCategory.ToolboxCategory,module$exports$Blockly$ToolboxItem.ToolboxItem);
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.init=function(){this.parseCategoryDef_(this.toolboxItemDef_);this.parseContents_(this.toolboxItemDef_);this.createDom_();"true"===this.toolboxItemDef_.hidden&&this.hide()};
module$exports$Blockly$ToolboxCategory.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.ToolboxCategory.prototype.parseContents_=function(a){var b=a.contents;if(a.custom)this.flyoutItems_=a.custom;else if(b)for(a=0;a<b.length;a++)this.flyoutItems_.push(b[a])};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.parseCategoryDef_=function(a){this.name_=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a.name);this.colour_=this.getColour_(a);(0,$.module$exports$Blockly$utils$object.mixin)(this.cssConfig_,a.cssconfig||a.cssConfig)};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.createDom_=function(){this.htmlDiv_=this.createContainer_();(0,module$exports$Blockly$utils$aria.setRole)(this.htmlDiv_,module$exports$Blockly$utils$aria.Role.TREEITEM);(0,module$exports$Blockly$utils$aria.setState)(this.htmlDiv_,module$exports$Blockly$utils$aria.State.SELECTED,!1);(0,module$exports$Blockly$utils$aria.setState)(this.htmlDiv_,module$exports$Blockly$utils$aria.State.LEVEL,this.level_);this.rowDiv_=this.createRowContainer_();
this.rowDiv_.style.pointerEvents="auto";this.htmlDiv_.appendChild(this.rowDiv_);this.rowContents_=this.createRowContentsContainer_();this.rowContents_.style.pointerEvents="none";this.rowDiv_.appendChild(this.rowContents_);this.iconDom_=this.createIconDom_();(0,module$exports$Blockly$utils$aria.setRole)(this.iconDom_,module$exports$Blockly$utils$aria.Role.PRESENTATION);this.rowContents_.appendChild(this.iconDom_);this.labelDom_=this.createLabelDom_(this.name_);this.rowContents_.appendChild(this.labelDom_);
(0,module$exports$Blockly$utils$aria.setState)(this.htmlDiv_,module$exports$Blockly$utils$aria.State.LABELLEDBY,this.labelDom_.getAttribute("id"));this.addColourBorder_(this.colour_);return this.htmlDiv_};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.createContainer_=function(){var a=document.createElement("div");(0,module$exports$Blockly$utils$dom.addClass)(a,this.cssConfig_.container);return a};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.createRowContainer_=function(){var a=document.createElement("div");(0,module$exports$Blockly$utils$dom.addClass)(a,this.cssConfig_.row);var b=module$exports$Blockly$ToolboxCategory.ToolboxCategory.nestedPadding*this.getLevel();b=b.toString()+"px";this.workspace_.RTL?a.style.paddingRight=b:a.style.paddingLeft=b;return a};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.createRowContentsContainer_=function(){var a=document.createElement("div");(0,module$exports$Blockly$utils$dom.addClass)(a,this.cssConfig_.rowcontentcontainer);return a};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.createIconDom_=function(){var a=document.createElement("span");this.parentToolbox_.isHorizontal()||(0,module$exports$Blockly$utils$dom.addClass)(a,this.cssConfig_.icon);a.style.display="inline-block";return a};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.createLabelDom_=function(a){var b=document.createElement("span");b.setAttribute("id",this.getId()+".label");b.textContent=a;(0,module$exports$Blockly$utils$dom.addClass)(b,this.cssConfig_.label);return b};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.refreshTheme=function(){this.colour_=this.getColour_(this.toolboxItemDef_);this.addColourBorder_(this.colour_)};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.addColourBorder_=function(a){a&&(a=module$exports$Blockly$ToolboxCategory.ToolboxCategory.borderWidth+"px solid "+(a||"#ddd"),this.workspace_.RTL?this.rowDiv_.style.borderRight=a:this.rowDiv_.style.borderLeft=a)};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.getColour_=function(a){var b=a.categorystyle||a.categoryStyle;if((a=a.colour)&&b)console.warn('Toolbox category "'+this.name_+'" must not have both a style and a colour');else return b?this.getColourfromStyle_(b):this.parseColour_(a);return""};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.getColourfromStyle_=function(a){var b=this.workspace_.getTheme();if(a&&b){if((b=b.categoryStyles[a])&&b.colour)return this.parseColour_(b.colour);console.warn('Style "'+a+'" must exist and contain a colour value')}return""};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.getClickTarget=function(){return this.rowDiv_};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.parseColour_=function(a){a=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a);if(null==a||""===a)return"";var b=Number(a);if(isNaN(b)){if(b=(0,module$exports$Blockly$utils$colour.parse)(a))return b;console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+a);return""}return(0,module$exports$Blockly$utils$colour.hueToHex)(b)};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.openIcon_=function(a){a&&((0,module$exports$Blockly$utils$dom.removeClasses)(a,this.cssConfig_.closedicon),(0,module$exports$Blockly$utils$dom.addClass)(a,this.cssConfig_.openicon))};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.closeIcon_=function(a){a&&((0,module$exports$Blockly$utils$dom.removeClasses)(a,this.cssConfig_.openicon),(0,module$exports$Blockly$utils$dom.addClass)(a,this.cssConfig_.closedicon))};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.setVisible_=function(a){this.htmlDiv_.style.display=a?"block":"none";this.isHidden_=!a;this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.hide=function(){this.setVisible_(!1)};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.show=function(){this.setVisible_(!0)};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.isVisible=function(){return!this.isHidden_&&this.allAncestorsExpanded_()};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.allAncestorsExpanded_=function(){for(var a=this;a.getParent();)if(a=a.getParent(),!a.isExpanded())return!1;return!0};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.isSelectable=function(){return this.isVisible()&&!this.isDisabled_};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.onClick=function(a){};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.setSelected=function(a){if(a){var b=this.parseColour_(module$exports$Blockly$ToolboxCategory.ToolboxCategory.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||b;(0,module$exports$Blockly$utils$dom.addClass)(this.rowDiv_,this.cssConfig_.selected)}else this.rowDiv_.style.backgroundColor="",(0,module$exports$Blockly$utils$dom.removeClass)(this.rowDiv_,this.cssConfig_.selected);(0,module$exports$Blockly$utils$aria.setState)(this.htmlDiv_,
module$exports$Blockly$utils$aria.State.SELECTED,a)};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.setDisabled=function(a){this.isDisabled_=a;this.getDiv().setAttribute("disabled",a);a?this.getDiv().setAttribute("disabled","true"):this.getDiv().removeAttribute("disabled")};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.getName=function(){return this.name_};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.getParent=function(){return this.parent_};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.getDiv=function(){return this.htmlDiv_};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.getContents=function(){return this.flyoutItems_};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.updateFlyoutContents=function(a){this.flyoutItems_=[];"string"===typeof a?this.toolboxItemDef_.custom=a:(delete this.toolboxItemDef_.custom,this.toolboxItemDef_.contents=(0,module$exports$Blockly$utils$toolbox.convertFlyoutDefToJsonArray)(a));this.parseContents_(this.toolboxItemDef_)};module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.dispose=function(){(0,module$exports$Blockly$utils$dom.removeNode)(this.htmlDiv_)};
module$exports$Blockly$ToolboxCategory.ToolboxCategory.registrationName="category";module$exports$Blockly$ToolboxCategory.ToolboxCategory.nestedPadding=19;module$exports$Blockly$ToolboxCategory.ToolboxCategory.borderWidth=8;module$exports$Blockly$ToolboxCategory.ToolboxCategory.defaultBackgroundColour="#57e";(0,module$exports$Blockly$Css.register)('\n.blocklyTreeRow:not(.blocklyTreeSelected):hover {\n background-color: rgba(255, 255, 255, .2);\n}\n\n.blocklyToolboxDiv[layout="h"] .blocklyToolboxCategory {\n margin: 1px 5px 1px 0;\n}\n\n.blocklyToolboxDiv[dir="RTL"][layout="h"] .blocklyToolboxCategory {\n margin: 1px 0 1px 5px;\n}\n\n.blocklyTreeRow {\n height: 22px;\n line-height: 22px;\n margin-bottom: 3px;\n padding-right: 8px;\n white-space: nowrap;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {\n margin-left: 8px;\n padding-right: 0;\n}\n\n.blocklyTreeIcon {\n background-image: url(<<<PATH>>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyTreeIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyTreeIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyTreeLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyTreeLabel {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyTreeSelected .blocklyTreeLabel {\n color: #fff;\n}\n');
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.TOOLBOX_ITEM,module$exports$Blockly$ToolboxCategory.ToolboxCategory.registrationName,module$exports$Blockly$ToolboxCategory.ToolboxCategory);var module$exports$Blockly$ToolboxSeparator={ToolboxSeparator:function(a,b){module$exports$Blockly$ToolboxItem.ToolboxItem.call(this,a,b);this.cssConfig_={container:"blocklyTreeSeparator"};this.htmlDiv_=null;(0,$.module$exports$Blockly$utils$object.mixin)(this.cssConfig_,a.cssconfig||a.cssConfig)}};$.$jscomp.inherits(module$exports$Blockly$ToolboxSeparator.ToolboxSeparator,module$exports$Blockly$ToolboxItem.ToolboxItem);module$exports$Blockly$ToolboxSeparator.ToolboxSeparator.prototype.init=function(){this.createDom_()};
module$exports$Blockly$ToolboxSeparator.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.ToolboxSeparator.prototype.getDiv=function(){return this.htmlDiv_};module$exports$Blockly$ToolboxSeparator.ToolboxSeparator.prototype.dispose=function(){(0,module$exports$Blockly$utils$dom.removeNode)(this.htmlDiv_)};
module$exports$Blockly$ToolboxSeparator.ToolboxSeparator.registrationName="sep";(0,module$exports$Blockly$Css.register)('\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {\n border-right: solid #e5e5e5 1px;\n border-bottom: none;\n height: auto;\n margin: 0 5px 0 5px;\n padding: 5px 0;\n width: 0;\n}\n');
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.TOOLBOX_ITEM,module$exports$Blockly$ToolboxSeparator.ToolboxSeparator.registrationName,module$exports$Blockly$ToolboxSeparator.ToolboxSeparator);var module$exports$Blockly$CollapsibleToolboxCategory={CollapsibleToolboxCategory:function(a,b,c){module$exports$Blockly$ToolboxCategory.ToolboxCategory.call(this,a,b,c);this.subcategoriesDiv_=null;this.expanded_=!1;this.toolboxItems_=[]}};$.$jscomp.inherits(module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory,module$exports$Blockly$ToolboxCategory.ToolboxCategory);
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.makeDefaultCssConfig_=function(){var a=module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.makeDefaultCssConfig_.call(this);a.contents="blocklyToolboxContents";return a};
module$exports$Blockly$CollapsibleToolboxCategory.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<b.length;a++){var d=b[a];!(0,module$exports$Blockly$registry.hasItem)(module$exports$Blockly$registry.Type.TOOLBOX_ITEM,d.kind)||d.kind.toLowerCase()===module$exports$Blockly$ToolboxSeparator.ToolboxSeparator.registrationName&&c?(this.flyoutItems_.push(d),c=!0):(this.createToolboxItem_(d),c=!1)}};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.createToolboxItem_=function(a){var b=a.kind;"CATEGORY"==b.toUpperCase()&&(0,module$exports$Blockly$utils$toolbox.isCategoryCollapsible)(a)&&(b=module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.registrationName);a=new ((0,module$exports$Blockly$registry.getClass)(module$exports$Blockly$registry.Type.TOOLBOX_ITEM,b))(a,this.parentToolbox_,this);this.toolboxItems_.push(a)};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.init=function(){module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.init.call(this);this.setExpanded("true"===this.toolboxItemDef_.expanded||this.toolboxItemDef_.expanded)};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.createDom_=function(){module$exports$Blockly$ToolboxCategory.ToolboxCategory.prototype.createDom_.call(this);var a=this.getChildToolboxItems();this.subcategoriesDiv_=this.createSubCategoriesDom_(a);(0,module$exports$Blockly$utils$aria.setRole)(this.subcategoriesDiv_,module$exports$Blockly$utils$aria.Role.GROUP);this.htmlDiv_.appendChild(this.subcategoriesDiv_);return this.htmlDiv_};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.createIconDom_=function(){var a=document.createElement("span");this.parentToolbox_.isHorizontal()||((0,module$exports$Blockly$utils$dom.addClass)(a,this.cssConfig_.icon),a.style.visibility="visible");a.style.display="inline-block";return a};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.createSubCategoriesDom_=function(a){var b=document.createElement("div");(0,module$exports$Blockly$utils$dom.addClass)(b,this.cssConfig_.contents);for(var c=0;c<a.length;c++){var d=a[c];d.init();var e=d.getDiv();b.appendChild(e);d.getClickTarget&&d.getClickTarget().setAttribute("id",d.getId())}return b};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.setExpanded=function(a){this.expanded_!==a&&((this.expanded_=a)?(this.subcategoriesDiv_.style.display="block",this.openIcon_(this.iconDom_)):(this.subcategoriesDiv_.style.display="none",this.closeIcon_(this.iconDom_)),(0,module$exports$Blockly$utils$aria.setState)(this.htmlDiv_,module$exports$Blockly$utils$aria.State.EXPANDED,a),this.parentToolbox_.handleToolboxItemResize())};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.setVisible_=function(a){this.htmlDiv_.style.display=a?"block":"none";for(var b=this.getChildToolboxItems(),c=0;c<b.length;c++)b[c].setVisible_(a);this.isHidden_=!a;this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()};module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.isExpanded=function(){return this.expanded_};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.isCollapsible=function(){return!0};module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.onClick=function(a){this.toggleExpanded()};module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.toggleExpanded=function(){this.setExpanded(!this.expanded_)};module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.getDiv=function(){return this.htmlDiv_};
module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.prototype.getChildToolboxItems=function(){return this.toolboxItems_};module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.registrationName="collapsibleCategory";(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.TOOLBOX_ITEM,module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.registrationName,module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory);var module$exports$Blockly$IAutoHideable={IAutoHideable:function(){}};var module$exports$Blockly$IStyleable={IStyleable:function(){}};var module$exports$Blockly$IToolbox={IToolbox:function(){}};var module$exports$Blockly$Events$ToolboxItemSelect={ToolboxItemSelect:function(a,b,c){module$exports$Blockly$Events$UiBase.UiBase.call(this,c);this.oldItem=a;this.newItem=b;this.type=module$exports$Blockly$Events$utils.TOOLBOX_ITEM_SELECT}};$.$jscomp.inherits(module$exports$Blockly$Events$ToolboxItemSelect.ToolboxItemSelect,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$ToolboxItemSelect.ToolboxItemSelect.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.oldItem=this.oldItem;a.newItem=this.newItem;return a};module$exports$Blockly$Events$ToolboxItemSelect.ToolboxItemSelect.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.fromJson.call(this,a);this.oldItem=a.oldItem;this.newItem=a.newItem};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.TOOLBOX_ITEM_SELECT,module$exports$Blockly$Events$ToolboxItemSelect.ToolboxItemSelect);var module$exports$Blockly$Toolbox={Toolbox:function(a){module$exports$Blockly$DeleteArea.DeleteArea.call(this);this.workspace_=a;this.id="toolbox";this.toolboxDef_=a.options.languageTree||{contents:[]};this.horizontalLayout_=a.options.horizontalLayout;this.contentsDiv_=this.HtmlDiv=null;this.isVisible_=!1;this.contents_=[];this.height_=this.width_=0;this.RTL=a.options.RTL;this.flyout_=null;this.contentMap_=Object.create(null);this.toolboxPosition=a.options.toolboxPosition;this.previouslySelectedItem_=
this.selectedItem_=null;this.boundEvents_=[]}};$.$jscomp.inherits(module$exports$Blockly$Toolbox.Toolbox,module$exports$Blockly$DeleteArea.DeleteArea);module$exports$Blockly$Toolbox.Toolbox.prototype.onShortcut=function(a){return!1};
module$exports$Blockly$Toolbox.Toolbox.prototype.init=function(){var a=this.workspace_,b=a.getParentSvg();this.flyout_=this.createFlyout_();this.HtmlDiv=this.createDom_(this.workspace_);(0,module$exports$Blockly$utils$dom.insertAfter)(this.flyout_.createDom("svg"),b);this.setVisible(!0);this.flyout_.init(a);this.render(this.toolboxDef_);a=a.getThemeManager();a.subscribe(this.HtmlDiv,"toolboxBackgroundColour","background-color");a.subscribe(this.HtmlDiv,"toolboxForegroundColour","color");this.workspace_.getComponentManager().addComponent({component:this,
weight:1,capabilities:[module$exports$Blockly$ComponentManager.ComponentManager.Capability.AUTOHIDEABLE,module$exports$Blockly$ComponentManager.ComponentManager.Capability.DELETE_AREA,module$exports$Blockly$ComponentManager.ComponentManager.Capability.DRAG_TARGET]})};
module$exports$Blockly$Toolbox.Toolbox.prototype.createDom_=function(a){a=a.getParentSvg();var b=this.createContainer_();this.contentsDiv_=this.createContentsContainer_();this.contentsDiv_.tabIndex=0;(0,module$exports$Blockly$utils$aria.setRole)(this.contentsDiv_,module$exports$Blockly$utils$aria.Role.TREE);b.appendChild(this.contentsDiv_);a.parentNode.insertBefore(b,a);this.attachEvents_(b,this.contentsDiv_);return b};
module$exports$Blockly$Toolbox.Toolbox.prototype.createContainer_=function(){var a=document.createElement("div");a.setAttribute("layout",this.isHorizontal()?"h":"v");(0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyToolboxDiv");(0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyNonSelectable");a.setAttribute("dir",this.RTL?"RTL":"LTR");return a};
module$exports$Blockly$Toolbox.Toolbox.prototype.createContentsContainer_=function(){var a=document.createElement("div");(0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyToolboxContents");this.isHorizontal()&&(a.style.flexDirection="row");return a};
module$exports$Blockly$Toolbox.Toolbox.prototype.attachEvents_=function(a,b){a=(0,module$exports$Blockly$browserEvents.conditionalBind)(a,"click",this,this.onClick_,!1,!0);this.boundEvents_.push(a);b=(0,module$exports$Blockly$browserEvents.conditionalBind)(b,"keydown",this,this.onKeyDown_,!1,!0);this.boundEvents_.push(b)};
module$exports$Blockly$Toolbox.Toolbox.prototype.onClick_=function(a){if((0,module$exports$Blockly$browserEvents.isRightButton)(a)||a.target===this.HtmlDiv)(0,$.module$exports$Blockly$common.getMainWorkspace)().hideChaff(!1);else{var b=a.target.getAttribute("id");b&&(b=this.getToolboxItemById(b),b.isSelectable()&&(this.setSelectedItem(b),b.onClick(a)));(0,$.module$exports$Blockly$common.getMainWorkspace)().hideChaff(!0)}(0,module$exports$Blockly$Touch.clearTouchIdentifier)()};
module$exports$Blockly$Toolbox.Toolbox.prototype.onKeyDown_=function(a){var b=!1;switch(a.keyCode){case module$exports$Blockly$utils$KeyCodes.KeyCodes.DOWN:b=this.selectNext_();break;case module$exports$Blockly$utils$KeyCodes.KeyCodes.UP:b=this.selectPrevious_();break;case module$exports$Blockly$utils$KeyCodes.KeyCodes.LEFT:b=this.selectParent_();break;case module$exports$Blockly$utils$KeyCodes.KeyCodes.RIGHT:b=this.selectChild_();break;case module$exports$Blockly$utils$KeyCodes.KeyCodes.ENTER:case module$exports$Blockly$utils$KeyCodes.KeyCodes.SPACE:this.selectedItem_&&
this.selectedItem_.isCollapsible()&&(this.selectedItem_.toggleExpanded(),b=!0);break;default:b=!1}!b&&this.selectedItem_&&this.selectedItem_.onKeyDown&&(b=this.selectedItem_.onKeyDown(a));b&&a.preventDefault()};
module$exports$Blockly$Toolbox.Toolbox.prototype.createFlyout_=function(){var a=this.workspace_,b=new module$exports$Blockly$Options.Options({parentWorkspace:a,rtl:a.RTL,oneBasedIndex:a.options.oneBasedIndex,horizontalLayout:a.horizontalLayout,renderer:a.options.renderer,rendererOverrides:a.options.rendererOverrides,move:{scrollbars:!0}});b.toolboxPosition=a.options.toolboxPosition;return new (a.horizontalLayout?(0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,
a.options,!0):(0,module$exports$Blockly$registry.getClassFromOptions)(module$exports$Blockly$registry.Type.FLYOUTS_VERTICAL_TOOLBOX,a.options,!0))(b)};module$exports$Blockly$Toolbox.Toolbox.prototype.render=function(a){this.toolboxDef_=a;for(var b=0;b<this.contents_.length;b++){var c=this.contents_[b];c&&c.dispose()}this.contents_=[];this.contentMap_=Object.create(null);this.renderContents_(a.contents);this.position();this.handleToolboxItemResize()};
module$exports$Blockly$Toolbox.Toolbox.prototype.renderContents_=function(a){for(var b=document.createDocumentFragment(),c=0;c<a.length;c++)this.createToolboxItem_(a[c],b);this.contentsDiv_.appendChild(b)};
module$exports$Blockly$Toolbox.Toolbox.prototype.createToolboxItem_=function(a,b){var c=a.kind;"CATEGORY"===c.toUpperCase()&&(0,module$exports$Blockly$utils$toolbox.isCategoryCollapsible)(a)&&(c=module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory.registrationName);if(c=(0,module$exports$Blockly$registry.getClass)(module$exports$Blockly$registry.Type.TOOLBOX_ITEM,c.toLowerCase()))a=new c(a,this),a.init(),this.addToolboxItem_(a),(c=a.getDiv())&&b.appendChild(c),a.getClickTarget()&&
a.getClickTarget().setAttribute("id",a.getId())};module$exports$Blockly$Toolbox.Toolbox.prototype.addToolboxItem_=function(a){this.contents_.push(a);this.contentMap_[a.getId()]=a;if(a.isCollapsible()){a=a.getChildToolboxItems();for(var b=0;b<a.length;b++)this.addToolboxItem_(a[b])}};module$exports$Blockly$Toolbox.Toolbox.prototype.getToolboxItems=function(){return this.contents_};
module$exports$Blockly$Toolbox.Toolbox.prototype.addStyle=function(a){(0,module$exports$Blockly$utils$dom.addClass)(this.HtmlDiv,a)};module$exports$Blockly$Toolbox.Toolbox.prototype.removeStyle=function(a){(0,module$exports$Blockly$utils$dom.removeClass)(this.HtmlDiv,a)};
module$exports$Blockly$Toolbox.Toolbox.prototype.getClientRect=function(){if(!this.HtmlDiv||!this.isVisible_)return null;var a=this.HtmlDiv.getBoundingClientRect(),b=a.top,c=b+a.height,d=a.left;a=d+a.width;return this.toolboxPosition===module$exports$Blockly$utils$toolbox.Position.TOP?new module$exports$Blockly$utils$Rect.Rect(-1E7,c,-1E7,1E7):this.toolboxPosition===module$exports$Blockly$utils$toolbox.Position.BOTTOM?new module$exports$Blockly$utils$Rect.Rect(b,1E7,-1E7,1E7):this.toolboxPosition===
module$exports$Blockly$utils$toolbox.Position.LEFT?new module$exports$Blockly$utils$Rect.Rect(-1E7,1E7,-1E7,a):new module$exports$Blockly$utils$Rect.Rect(-1E7,1E7,d,1E7)};module$exports$Blockly$Toolbox.Toolbox.prototype.wouldDelete=function(a,b){a instanceof module$exports$Blockly$BlockSvg.BlockSvg?this.updateWouldDelete_(!a.getParent()&&a.isDeletable()):this.updateWouldDelete_(a.isDeletable());return this.wouldDelete_};module$exports$Blockly$Toolbox.Toolbox.prototype.onDragEnter=function(a){this.updateCursorDeleteStyle_(!0)};
module$exports$Blockly$Toolbox.Toolbox.prototype.onDragExit=function(a){this.updateCursorDeleteStyle_(!1)};module$exports$Blockly$Toolbox.Toolbox.prototype.onDrop=function(a){this.updateCursorDeleteStyle_(!1)};module$exports$Blockly$Toolbox.Toolbox.prototype.updateWouldDelete_=function(a){a!==this.wouldDelete_&&(this.updateCursorDeleteStyle_(!1),this.wouldDelete_=a,this.updateCursorDeleteStyle_(!0))};
module$exports$Blockly$Toolbox.Toolbox.prototype.updateCursorDeleteStyle_=function(a){var b=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";a?this.addStyle(b):this.removeStyle(b)};module$exports$Blockly$Toolbox.Toolbox.prototype.getToolboxItemById=function(a){return this.contentMap_[a]||null};module$exports$Blockly$Toolbox.Toolbox.prototype.getWidth=function(){return this.width_};module$exports$Blockly$Toolbox.Toolbox.prototype.getHeight=function(){return this.height_};
module$exports$Blockly$Toolbox.Toolbox.prototype.getFlyout=function(){return this.flyout_};module$exports$Blockly$Toolbox.Toolbox.prototype.getWorkspace=function(){return this.workspace_};module$exports$Blockly$Toolbox.Toolbox.prototype.getSelectedItem=function(){return this.selectedItem_};module$exports$Blockly$Toolbox.Toolbox.prototype.getPreviouslySelectedItem=function(){return this.previouslySelectedItem_};module$exports$Blockly$Toolbox.Toolbox.prototype.isHorizontal=function(){return this.horizontalLayout_};
module$exports$Blockly$Toolbox.Toolbox.prototype.position=function(){var a=this.workspace_.getMetrics(),b=this.HtmlDiv;b&&(this.horizontalLayout_?(b.style.left="0",b.style.height="auto",b.style.width="100%",this.height_=b.offsetHeight,this.width_=a.viewWidth,this.toolboxPosition===module$exports$Blockly$utils$toolbox.Position.TOP?b.style.top="0":b.style.bottom="0"):(this.toolboxPosition===module$exports$Blockly$utils$toolbox.Position.RIGHT?b.style.right="0":b.style.left="0",b.style.height="100%",
this.width_=b.offsetWidth,this.height_=a.viewHeight),this.flyout_.position())};module$exports$Blockly$Toolbox.Toolbox.prototype.handleToolboxItemResize=function(){var a=this.workspace_,b=this.HtmlDiv.getBoundingClientRect();a.translate(this.toolboxPosition===module$exports$Blockly$utils$toolbox.Position.LEFT?a.scrollX+b.width:a.scrollX,this.toolboxPosition===module$exports$Blockly$utils$toolbox.Position.TOP?a.scrollY+b.height:a.scrollY);(0,$.module$exports$Blockly$common.svgResize)(a)};
module$exports$Blockly$Toolbox.Toolbox.prototype.clearSelection=function(){this.setSelectedItem(null)};module$exports$Blockly$Toolbox.Toolbox.prototype.refreshTheme=function(){for(var a=0;a<this.contents_.length;a++){var b=this.contents_[a];b.refreshTheme&&b.refreshTheme()}};module$exports$Blockly$Toolbox.Toolbox.prototype.refreshSelection=function(){this.selectedItem_&&this.selectedItem_.isSelectable()&&this.selectedItem_.getContents().length&&this.flyout_.show(this.selectedItem_.getContents())};
module$exports$Blockly$Toolbox.Toolbox.prototype.setVisible=function(a){this.isVisible_!==a&&(this.HtmlDiv.style.display=a?"block":"none",this.isVisible_=a,this.workspace_.recordDragTargets())};module$exports$Blockly$Toolbox.Toolbox.prototype.autoHide=function(a){!a&&this.flyout_&&this.flyout_.autoClose&&this.clearSelection()};
module$exports$Blockly$Toolbox.Toolbox.prototype.setSelectedItem=function(a){var b=this.selectedItem_;!a&&!b||a&&!a.isSelectable()||(this.shouldDeselectItem_(b,a)&&null!==b&&this.deselectItem_(b),this.shouldSelectItem_(b,a)&&null!==a&&this.selectItem_(b,a),this.updateFlyout_(b,a),this.fireSelectEvent_(b,a))};module$exports$Blockly$Toolbox.Toolbox.prototype.shouldDeselectItem_=function(a,b){return null!==a&&(!a.isCollapsible()||a!==b)};
module$exports$Blockly$Toolbox.Toolbox.prototype.shouldSelectItem_=function(a,b){return null!==b&&b!==a};module$exports$Blockly$Toolbox.Toolbox.prototype.deselectItem_=function(a){this.selectedItem_=null;this.previouslySelectedItem_=a;a.setSelected(!1);(0,module$exports$Blockly$utils$aria.setState)(this.contentsDiv_,module$exports$Blockly$utils$aria.State.ACTIVEDESCENDANT,"")};
module$exports$Blockly$Toolbox.Toolbox.prototype.selectItem_=function(a,b){this.selectedItem_=b;this.previouslySelectedItem_=a;b.setSelected(!0);(0,module$exports$Blockly$utils$aria.setState)(this.contentsDiv_,module$exports$Blockly$utils$aria.State.ACTIVEDESCENDANT,b.getId())};module$exports$Blockly$Toolbox.Toolbox.prototype.selectItemByPosition=function(a){-1<a&&a<this.contents_.length&&(a=this.contents_[a],a.isSelectable()&&this.setSelectedItem(a))};
module$exports$Blockly$Toolbox.Toolbox.prototype.updateFlyout_=function(a,b){b&&(a!==b||b.isCollapsible())&&b.getContents().length?(this.flyout_.show(b.getContents()),this.flyout_.scrollToStart()):this.flyout_.hide()};module$exports$Blockly$Toolbox.Toolbox.prototype.fireSelectEvent_=function(a,b){var c=a&&a.getName(),d=b&&b.getName();a===b&&(d=null);a=new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.TOOLBOX_ITEM_SELECT))(c,d,this.workspace_.id);(0,module$exports$Blockly$Events$utils.fire)(a)};
module$exports$Blockly$Toolbox.Toolbox.prototype.selectParent_=function(){return this.selectedItem_?this.selectedItem_.isCollapsible()&&this.selectedItem_.isExpanded()?(this.selectedItem_.setExpanded(!1),!0):this.selectedItem_.getParent()&&this.selectedItem_.getParent().isSelectable()?(this.setSelectedItem(this.selectedItem_.getParent()),!0):!1:!1};
module$exports$Blockly$Toolbox.Toolbox.prototype.selectChild_=function(){if(!this.selectedItem_||!this.selectedItem_.isCollapsible())return!1;var a=this.selectedItem_;a.isExpanded()?this.selectNext_():a.setExpanded(!0);return!0};
module$exports$Blockly$Toolbox.Toolbox.prototype.selectNext_=function(){if(!this.selectedItem_)return!1;var a=this.contents_.indexOf(this.selectedItem_)+1;if(-1<a&&a<this.contents_.length){for(var b=this.contents_[a];b&&!b.isSelectable();)b=this.contents_[++a];if(b&&b.isSelectable())return this.setSelectedItem(b),!0}return!1};
module$exports$Blockly$Toolbox.Toolbox.prototype.selectPrevious_=function(){if(!this.selectedItem_)return!1;var a=this.contents_.indexOf(this.selectedItem_)-1;if(-1<a&&a<this.contents_.length){for(var b=this.contents_[a];b&&!b.isSelectable();)b=this.contents_[--a];if(b&&b.isSelectable())return this.setSelectedItem(b),!0}return!1};
module$exports$Blockly$Toolbox.Toolbox.prototype.dispose=function(){this.workspace_.getComponentManager().removeComponent("toolbox");this.flyout_.dispose();for(var a=0;a<this.contents_.length;a++)this.contents_[a].dispose();for(a=0;a<this.boundEvents_.length;a++)(0,module$exports$Blockly$browserEvents.unbind)(this.boundEvents_[a]);this.boundEvents_=[];this.contents_=[];this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv);(0,module$exports$Blockly$utils$dom.removeNode)(this.HtmlDiv)};(0,module$exports$Blockly$Css.register)('\n.blocklyToolboxDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolboxDiv {\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxContents {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxContents:focus {\n outline: none;\n}\n');
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.TOOLBOX,module$exports$Blockly$registry.DEFAULT,module$exports$Blockly$Toolbox.Toolbox);var module$exports$Blockly$HorizontalFlyout={HorizontalFlyout:function(a){module$exports$Blockly$Flyout.Flyout.call(this,a);this.horizontalLayout=!0}};$.$jscomp.inherits(module$exports$Blockly$HorizontalFlyout.HorizontalFlyout,module$exports$Blockly$Flyout.Flyout);
module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.setMetrics_=function(a){if(this.isVisible()){var b=this.workspace_.getMetricsManager(),c=b.getScrollMetrics(),d=b.getViewMetrics();b=b.getAbsoluteMetrics();"number"===typeof a.x&&(this.workspace_.scrollX=-(c.left+(c.width-d.width)*a.x));this.workspace_.translate(this.workspace_.scrollX+b.left,this.workspace_.scrollY+b.top)}};module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.getX=function(){return 0};
module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.getY=function(){if(!this.isVisible())return 0;var a=this.targetWorkspace.getMetricsManager(),b=a.getAbsoluteMetrics(),c=a.getViewMetrics();a=a.getToolboxMetrics();var d=this.toolboxPosition_===module$exports$Blockly$utils$toolbox.Position.TOP;return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?d?a.height:c.height-this.height_:d?0:c.height:d?0:c.height+b.top-this.height_};
module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.position=function(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var a=this.targetWorkspace.getMetricsManager().getViewMetrics();this.width_=a.width;this.setBackgroundPath_(a.width-2*this.CORNER_RADIUS,this.height_-this.CORNER_RADIUS);a=this.getX();var b=this.getY();this.positionAt_(this.width_,this.height_,a,b)}};
module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.setBackgroundPath_=function(a,b){var c=this.toolboxPosition_===module$exports$Blockly$utils$toolbox.Position.TOP,d=["M 0,"+(c?0:this.CORNER_RADIUS)];c?(d.push("h",a+2*this.CORNER_RADIUS),d.push("v",b),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("h",-a),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(d.push("a",this.CORNER_RADIUS,
this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),d.push("h",a),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("v",b),d.push("h",-a-2*this.CORNER_RADIUS));d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))};module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.scrollToStart=function(){this.workspace_.scrollbar.setX(this.RTL?Infinity:0)};
module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.wheel_=function(a){var b=(0,module$exports$Blockly$browserEvents.getScrollDeltaPixels)(a);if(b=b.x||b.y){var c=this.workspace_.getMetricsManager(),d=c.getScrollMetrics();b=c.getViewMetrics().left-d.left+b;this.workspace_.scrollbar.setX(b);(0,module$exports$Blockly$WidgetDiv.hide)();(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)()}a.preventDefault();a.stopPropagation()};
module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.layout_=function(a,b){this.workspace_.scale=this.targetWorkspace.scale;var c=this.MARGIN,d=c+this.tabWidth_;this.RTL&&(a=a.reverse());for(var e=0,f;f=a[e];e++)if("block"===f.type){f=f.block;for(var g=f.getDescendants(!1),h=0,k;k=g[h];h++)k.isInFlyout=!0;f.render();g=f.getSvgRoot();h=f.getHeightWidth();k=f.outputConnection?this.tabWidth_:0;k=this.RTL?d+h.width:d-k;f.moveBy(k,c);k=this.createRect_(f,k,c,h,e);d+=h.width+b[e];this.addBlockListeners_(g,
f,k)}else"button"===f.type&&(this.initFlyoutButton_(f.button,d,c),d+=f.button.width+b[e])};module$exports$Blockly$HorizontalFlyout.HorizontalFlyout.prototype.isDragTowardWorkspace=function(a){a=Math.atan2(a.y,a.x)/Math.PI*180;var b=this.dragAngleRange_;return a<90+b&&a>90-b||a>-90-b&&a<-90+b?!0:!1};
module$exports$Blockly$HorizontalFlyout.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.Rect(-1E9,b+a.height,-1E9,1E9):new module$exports$Blockly$utils$Rect.Rect(b,1E9,-1E9,1E9)};
module$exports$Blockly$HorizontalFlyout.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.Scrollbar.scrollbarThickness;if(this.height_!==a){for(c=0;d=b[c];c++)this.rectMap_.has(d)&&this.moveRectToBlock_(this.rectMap_.get(d),
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.HorizontalFlyout);$.module$exports$Blockly$Generator={Generator:function(a){this.name_=a;this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}";this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g");this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null;this.INDENT=" ";this.COMMENT_WRAP=60;this.ORDER_OVERRIDES=[];this.isInitialized=null;this.RESERVED_WORDS_="";this.nameDB_=this.functionNames_=this.definitions_=void 0}};
$.module$exports$Blockly$Generator.Generator.prototype.workspaceToCode=function(a){a||(console.warn("No workspace specified in workspaceToCode call. Guessing."),a=(0,$.module$exports$Blockly$common.getMainWorkspace)());var b=[];this.init(a);a=a.getTopBlocks(!0);for(var c=0,d;d=a[c];c++){var e=this.blockToCode(d);Array.isArray(e)&&(e=e[0]);e&&(d.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!d.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,d)+e),this.STATEMENT_SUFFIX&&
!d.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,d))),b.push(e))}b=b.join("\n");b=this.finish(b);b=b.replace(/^\s+\n/,"");b=b.replace(/\n\s+$/,"\n");return b=b.replace(/[ \t]+\n/g,"\n")};$.module$exports$Blockly$Generator.Generator.prototype.prefixLines=function(a,b){return b+a.replace(/(?!\n$)\n/g,"\n"+b)};
$.module$exports$Blockly$Generator.Generator.prototype.allNestedComments=function(a){var b=[];a=a.getDescendants(!0);for(var c=0;c<a.length;c++){var d=a[c].getCommentText();d&&b.push(d)}b.length&&b.push("");return b.join("\n")};
$.module$exports$Blockly$Generator.Generator.prototype.blockToCode=function(a,b){!1===this.isInitialized&&console.warn("Generator init was not called before blockToCode was called.");if(!a)return"";if(!a.isEnabled())return b?"":this.blockToCode(a.getNextBlock());if(a.isInsertionMarker())return b?"":this.blockToCode(a.getChildren(!1)[0]);var c=this[a.type];if("function"!==typeof c)throw Error('Language "'+this.name_+'" does not know how to generate code for block type "'+a.type+'".');c=c.call(a,a);
if(Array.isArray(c)){if(!a.outputConnection)throw TypeError("Expecting string from statement block: "+a.type);return[this.scrub_(a,c[0],b),c[1]]}if("string"===typeof c)return this.STATEMENT_PREFIX&&!a.suppressPrefixSuffix&&(c=this.injectId(this.STATEMENT_PREFIX,a)+c),this.STATEMENT_SUFFIX&&!a.suppressPrefixSuffix&&(c+=this.injectId(this.STATEMENT_SUFFIX,a)),this.scrub_(a,c,b);if(null===c)return"";throw SyntaxError("Invalid code generated: "+c);};
$.module$exports$Blockly$Generator.Generator.prototype.valueToCode=function(a,b,c){if(isNaN(c))throw TypeError("Expecting valid order from block: "+a.type);var d=a.getInputTargetBlock(b);if(!d)return"";b=this.blockToCode(d);if(""===b)return"";if(!Array.isArray(b))throw TypeError("Expecting tuple from value block: "+d.type);a=b[0];b=b[1];if(isNaN(b))throw TypeError("Expecting valid order from value block: "+d.type);if(!a)return"";d=!1;var e=Math.floor(c),f=Math.floor(b);if(e<=f&&(e!==f||0!==e&&99!==
e))for(d=!0,e=0;e<this.ORDER_OVERRIDES.length;e++)if(this.ORDER_OVERRIDES[e][0]===c&&this.ORDER_OVERRIDES[e][1]===b){d=!1;break}d&&(a="("+a+")");return a};$.module$exports$Blockly$Generator.Generator.prototype.statementToCode=function(a,b){a=a.getInputTargetBlock(b);b=this.blockToCode(a);if("string"!==typeof b)throw TypeError("Expecting code from statement block: "+(a&&a.type));b&&(b=this.prefixLines(b,this.INDENT));return b};
$.module$exports$Blockly$Generator.Generator.prototype.addLoopTrap=function(a,b){this.INFINITE_LOOP_TRAP&&(a=this.prefixLines(this.injectId(this.INFINITE_LOOP_TRAP,b),this.INDENT)+a);this.STATEMENT_SUFFIX&&!b.suppressPrefixSuffix&&(a=this.prefixLines(this.injectId(this.STATEMENT_SUFFIX,b),this.INDENT)+a);this.STATEMENT_PREFIX&&!b.suppressPrefixSuffix&&(a+=this.prefixLines(this.injectId(this.STATEMENT_PREFIX,b),this.INDENT));return a};
$.module$exports$Blockly$Generator.Generator.prototype.injectId=function(a,b){b=b.id.replace(/\$/g,"$$$$");return a.replace(/%1/g,"'"+b+"'")};$.module$exports$Blockly$Generator.Generator.prototype.addReservedWords=function(a){this.RESERVED_WORDS_+=a+","};
$.module$exports$Blockly$Generator.Generator.prototype.provideFunction_=function(a,b){if(!this.definitions_[a]){var c=this.nameDB_.getDistinctName(a,$.module$exports$Blockly$Names.NameType.PROCEDURE);this.functionNames_[a]=c;Array.isArray(b)&&(b=b.join("\n"));b=b.trim().replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,c);for(var d;d!==b;)d=b,b=b.replace(/^(( {2})*) {2}/gm,"$1\x00");b=b.replace(/\0/g,this.INDENT);this.definitions_[a]=b}return this.functionNames_[a]};
$.module$exports$Blockly$Generator.Generator.prototype.init=function(a){this.definitions_=Object.create(null);this.functionNames_=Object.create(null)};$.module$exports$Blockly$Generator.Generator.prototype.scrub_=function(a,b,c){return b};$.module$exports$Blockly$Generator.Generator.prototype.finish=function(a){delete this.definitions_;delete this.functionNames_;return a};$.module$exports$Blockly$Generator.Generator.prototype.scrubNakedValue=function(a){return a};
Object.defineProperties($.module$exports$Blockly$Generator.Generator.prototype,{variableDB_:{get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("variableDB_","May 2021","May 2026","nameDB_");return this.nameDB_},set:function(a){(0,module$exports$Blockly$utils$deprecation.warn)("variableDB_","May 2021","May 2026","nameDB_");this.nameDB_=a}}});var module$exports$Blockly$FieldVariable={FieldVariable:function(a,b,c,d,e){$.module$exports$Blockly$FieldDropdown.FieldDropdown.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.menuGenerator_=module$exports$Blockly$FieldVariable.FieldVariable.dropdownCreate;this.defaultVariableName="string"===typeof a?a:"";this.defaultType_="";this.variableTypes=[];this.size_=new module$exports$Blockly$utils$Size.Size(0,0);this.variable_=null;this.SERIALIZABLE=!0;a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&
(e?this.configure_(e):this.setTypes_(c,d),b&&this.setValidator(b))}};$.$jscomp.inherits(module$exports$Blockly$FieldVariable.FieldVariable,$.module$exports$Blockly$FieldDropdown.FieldDropdown);module$exports$Blockly$FieldVariable.FieldVariable.prototype.configure_=function(a){$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.configure_.call(this,a);this.setTypes_(a.variableTypes,a.defaultType)};
module$exports$Blockly$FieldVariable.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.FieldVariable.prototype.shouldAddBorderRect_=function(){return $.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!==this.sourceBlock_.type)};
module$exports$Blockly$FieldVariable.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.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.FieldVariable.prototype.saveState=function(a){var b=this.saveLegacyState(module$exports$Blockly$FieldVariable.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.FieldVariable.prototype.loadState=function(a){this.loadLegacyState(module$exports$Blockly$FieldVariable.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.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.setSourceBlock.call(this,a)};module$exports$Blockly$FieldVariable.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null};
module$exports$Blockly$FieldVariable.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""};module$exports$Blockly$FieldVariable.FieldVariable.prototype.getVariable=function(){return this.variable_};module$exports$Blockly$FieldVariable.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null};
module$exports$Blockly$FieldVariable.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.FieldVariable.prototype.doValueUpdate_=function(a){this.variable_=(0,$.module$exports$Blockly$Variables.getVariable)(this.sourceBlock_.workspace,a);$.module$exports$Blockly$FieldDropdown.FieldDropdown.prototype.doValueUpdate_.call(this,a)};module$exports$Blockly$FieldVariable.FieldVariable.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;c<b.length;c++)if(a===b[c])return!0;return!1};
module$exports$Blockly$FieldVariable.FieldVariable.prototype.getVariableTypes_=function(){var a=this.variableTypes;if(null===a&&this.sourceBlock_&&this.sourceBlock_.workspace)return this.sourceBlock_.workspace.getVariableTypes();a=a||[""];if(0===a.length)throw a=this.getText(),Error("'variableTypes' of field variable "+a+" was an empty list");return a};
module$exports$Blockly$FieldVariable.FieldVariable.prototype.setTypes_=function(a,b){b=b||"";if(null===a||void 0===a)a=null;else if(Array.isArray(a)){for(var c=!1,d=0;d<a.length;d++)a[d]===b&&(c=!0);if(!c)throw Error("Invalid default type '"+b+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");this.defaultType_=b;this.variableTypes=a};module$exports$Blockly$FieldVariable.FieldVariable.prototype.refreshVariableName=function(){this.forceRerender()};
module$exports$Blockly$FieldVariable.FieldVariable.prototype.onItemSelected_=function(a,b){a=b.getValue();if(this.sourceBlock_&&this.sourceBlock_.workspace){if(a===module$exports$Blockly$internalConstants.RENAME_VARIABLE_ID){(0,$.module$exports$Blockly$Variables.renameVariable)(this.sourceBlock_.workspace,this.variable_);return}if(a===module$exports$Blockly$internalConstants.DELETE_VARIABLE_ID){this.sourceBlock_.workspace.deleteVariableById(this.variable_.getId());return}}this.setValue(a)};
module$exports$Blockly$FieldVariable.FieldVariable.prototype.referencesVariables=function(){return!0};module$exports$Blockly$FieldVariable.FieldVariable.fromJson=function(a){return new this((0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a.variable),void 0,void 0,void 0,a)};
module$exports$Blockly$FieldVariable.FieldVariable.dropdownCreate=function(){if(!this.variable_)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");var a=this.getText(),b=[];if(this.sourceBlock_&&this.sourceBlock_.workspace)for(var c=this.getVariableTypes_(),d=0;d<c.length;d++){var e=this.sourceBlock_.workspace.getVariablesOfType(c[d]);b=b.concat(e)}b.sort(module$exports$Blockly$VariableModel.VariableModel.compareByName);c=[];for(d=0;d<b.length;d++)c[d]=[b[d].name,
b[d].getId()];c.push([$.module$exports$Blockly$Msg.Msg.RENAME_VARIABLE,module$exports$Blockly$internalConstants.RENAME_VARIABLE_ID]);$.module$exports$Blockly$Msg.Msg.DELETE_VARIABLE&&c.push([$.module$exports$Blockly$Msg.Msg.DELETE_VARIABLE.replace("%1",a),module$exports$Blockly$internalConstants.DELETE_VARIABLE_ID]);return c};(0,module$exports$Blockly$fieldRegistry.register)("field_variable",module$exports$Blockly$FieldVariable.FieldVariable);$.module$exports$Blockly$FieldTextInput={FieldTextInput:function(a,b,c){module$exports$Blockly$Field.Field.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.spellcheck_=!0;this.htmlInput_=null;this.isTextValid_=this.isBeingEdited_=!1;this.onKeyInputWrapper_=this.onKeyDownWrapper_=null;this.fullBlockClickTarget_=!1;this.workspace_=null;this.SERIALIZABLE=!0;this.CURSOR="text";a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}};
$.$jscomp.inherits($.module$exports$Blockly$FieldTextInput.FieldTextInput,module$exports$Blockly$Field.Field);$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.configure_=function(a){module$exports$Blockly$Field.Field.prototype.configure_.call(this,a);"boolean"===typeof a.spellcheck&&(this.spellcheck_=a.spellcheck)};
$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.initView=function(){if(this.getConstants().FULL_BLOCK_FIELDS){for(var a=0,b=0,c=0,d;d=this.sourceBlock_.inputList[c];c++){for(var e=0;d.fieldRow[e];e++)a++;d.connection&&b++}this.fullBlockClickTarget_=1>=a&&this.sourceBlock_.outputConnection&&!b}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_();this.createTextElement_()};
$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};
$.module$exports$Blockly$FieldTextInput.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.FieldTextInput.prototype.doValueUpdate_=function(a){this.isTextValid_=!0;this.value_=a;this.isBeingEdited_||(this.isDirty_=!0)};$.module$exports$Blockly$FieldTextInput.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.FieldTextInput.prototype.render_=function(){module$exports$Blockly$Field.Field.prototype.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.FieldTextInput.prototype.setSpellcheck=function(a){a!==this.spellcheck_&&(this.spellcheck_=a,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))};
$.module$exports$Blockly$FieldTextInput.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.FieldTextInput.prototype.showPromptEditor_=function(){(0,module$exports$Blockly$dialog.prompt)($.module$exports$Blockly$Msg.Msg.CHANGE_VALUE_TITLE,this.getText(),function(a){null!==a&&this.setValue(this.getValueFromEditorText_(a))}.bind(this))};
$.module$exports$Blockly$FieldTextInput.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.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.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.FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1;this.isTextValid_=!0;this.forceRerender();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.FieldTextInput.prototype.onFinishEditing_=function(a){};$.module$exports$Blockly$FieldTextInput.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.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.FieldTextInput.prototype.onHtmlInputKeyDown_=function(a){a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.ENTER?((0,module$exports$Blockly$WidgetDiv.hide)(),(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)()):a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.ESC?(this.setValue(this.htmlInput_.untypedDefaultValue_),(0,module$exports$Blockly$WidgetDiv.hide)(),(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)()):a.keyCode===
module$exports$Blockly$utils$KeyCodes.KeyCodes.TAB&&((0,module$exports$Blockly$WidgetDiv.hide)(),(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)(),this.sourceBlock_.tab(this,!a.shiftKey),a.preventDefault())};$.module$exports$Blockly$FieldTextInput.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.FieldTextInput.prototype.setEditorValue_=function(a){this.isDirty_=!0;this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(a));this.setValue(a)};
$.module$exports$Blockly$FieldTextInput.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.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.FieldTextInput.prototype.isTabNavigable=function(){return!0};
$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.getText_=function(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null};$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.getEditorText_=function(a){return String(a)};$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.getValueFromEditorText_=function(a){return a};
$.module$exports$Blockly$FieldTextInput.FieldTextInput.fromJson=function(a){return new this((0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a.text),void 0,a)};$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.DEFAULT_VALUE="";$.module$exports$Blockly$FieldTextInput.FieldTextInput.BORDERRADIUS=4;(0,module$exports$Blockly$fieldRegistry.register)("field_input",$.module$exports$Blockly$FieldTextInput.FieldTextInput);var module$exports$Blockly$FieldNumber={FieldNumber:function(a,b,c,d,e,f){$.module$exports$Blockly$FieldTextInput.FieldTextInput.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.min_=-Infinity;this.max_=Infinity;this.precision_=0;this.decimalPlaces_=null;this.SERIALIZABLE=!0;a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(f?this.configure_(f):this.setConstraints(b,c,d),this.setValue(a),e&&this.setValidator(e))}};$.$jscomp.inherits(module$exports$Blockly$FieldNumber.FieldNumber,$.module$exports$Blockly$FieldTextInput.FieldTextInput);
module$exports$Blockly$FieldNumber.FieldNumber.prototype.configure_=function(a){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.configure_.call(this,a);this.setMinInternal_(a.min);this.setMaxInternal_(a.max);this.setPrecisionInternal_(a.precision)};module$exports$Blockly$FieldNumber.FieldNumber.prototype.setConstraints=function(a,b,c){this.setMinInternal_(a);this.setMaxInternal_(b);this.setPrecisionInternal_(c);this.setValue(this.getValue())};
module$exports$Blockly$FieldNumber.FieldNumber.prototype.setMin=function(a){this.setMinInternal_(a);this.setValue(this.getValue())};module$exports$Blockly$FieldNumber.FieldNumber.prototype.setMinInternal_=function(a){null==a?this.min_=-Infinity:(a=Number(a),isNaN(a)||(this.min_=a))};module$exports$Blockly$FieldNumber.FieldNumber.prototype.getMin=function(){return this.min_};module$exports$Blockly$FieldNumber.FieldNumber.prototype.setMax=function(a){this.setMaxInternal_(a);this.setValue(this.getValue())};
module$exports$Blockly$FieldNumber.FieldNumber.prototype.setMaxInternal_=function(a){null==a?this.max_=Infinity:(a=Number(a),isNaN(a)||(this.max_=a))};module$exports$Blockly$FieldNumber.FieldNumber.prototype.getMax=function(){return this.max_};module$exports$Blockly$FieldNumber.FieldNumber.prototype.setPrecision=function(a){this.setPrecisionInternal_(a);this.setValue(this.getValue())};
module$exports$Blockly$FieldNumber.FieldNumber.prototype.setPrecisionInternal_=function(a){this.precision_=Number(a)||0;var b=String(this.precision_);-1!==b.indexOf("e")&&(b=this.precision_.toLocaleString("en-US",{maximumFractionDigits:20}));var c=b.indexOf(".");this.decimalPlaces_=-1===c?a?0:null:b.length-c-1};module$exports$Blockly$FieldNumber.FieldNumber.prototype.getPrecision=function(){return this.precision_};
module$exports$Blockly$FieldNumber.FieldNumber.prototype.doClassValidation_=function(a){if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=a.replace(/infinity/i,"Infinity");a=Number(a||0);if(isNaN(a))return null;a=Math.min(Math.max(a,this.min_),this.max_);this.precision_&&isFinite(a)&&(a=Math.round(a/this.precision_)*this.precision_);null!==this.decimalPlaces_&&(a=Number(a.toFixed(this.decimalPlaces_)));return a};
module$exports$Blockly$FieldNumber.FieldNumber.prototype.widgetCreate_=function(){var a=$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.widgetCreate_.call(this);-Infinity<this.min_&&(0,module$exports$Blockly$utils$aria.setState)(a,module$exports$Blockly$utils$aria.State.VALUEMIN,this.min_);Infinity>this.max_&&(0,module$exports$Blockly$utils$aria.setState)(a,module$exports$Blockly$utils$aria.State.VALUEMAX,this.max_);return a};
module$exports$Blockly$FieldNumber.FieldNumber.fromJson=function(a){return new this(a.value,void 0,void 0,void 0,void 0,a)};module$exports$Blockly$FieldNumber.FieldNumber.prototype.DEFAULT_VALUE=0;(0,module$exports$Blockly$fieldRegistry.register)("field_number",module$exports$Blockly$FieldNumber.FieldNumber);var module$exports$Blockly$FieldMultilineInput={FieldMultilineInput:function(a,b,c){$.module$exports$Blockly$FieldTextInput.FieldTextInput.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.textGroup_=null;this.maxLines_=Infinity;this.isOverflowedY_=!1;a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}};$.$jscomp.inherits(module$exports$Blockly$FieldMultilineInput.FieldMultilineInput,$.module$exports$Blockly$FieldTextInput.FieldTextInput);
module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.configure_=function(a){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.configure_.call(this,a);a.maxLines&&this.setMaxLines(a.maxLines)};module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.toXml=function(a){a.textContent=this.getValue().replace(/\n/g,"&#10;");return a};
module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.fromXml=function(a){this.setValue(a.textContent.replace(/&#10;/g,"\n"))};module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.saveState=function(){var a=this.saveLegacyState(module$exports$Blockly$FieldMultilineInput.FieldMultilineInput);return null!==a?a:this.getValue()};
module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.loadState=function(a){this.loadLegacyState(module$exports$Blockly$Field.Field,a)||this.setValue(a)};module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.initView=function(){this.createBorderRect_();this.textGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyEditableText"},this.fieldGroup_)};
module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.getDisplayText_=function(){var a=this.getText();if(!a)return module$exports$Blockly$Field.Field.NBSP;var b=a.split("\n");a="";for(var c=this.isOverflowedY_?this.maxLines_:b.length,d=0;d<c;d++){var e=b[d];e.length>this.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.Field.NBSP);a+=e;d!==c-1&&(a+="\n")}this.sourceBlock_.RTL&&
(a+="\u200f");return a};module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.doValueUpdate_=function(a){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.doValueUpdate_.call(this,a);this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_};
module$exports$Blockly$FieldMultilineInput.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;c<a.length;c++){var d=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING;(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.TEXT,{"class":"blocklyText blocklyMultilineText",x:this.getConstants().FIELD_BORDER_RECT_X_PADDING,
y:b+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,dy:this.getConstants().FIELD_TEXT_BASELINE},this.textGroup_).appendChild(document.createTextNode(a[c]));b+=d}this.isBeingEdited_&&(a=this.htmlInput_,this.isOverflowedY_?(0,module$exports$Blockly$utils$dom.addClass)(a,"blocklyHtmlTextAreaInputOverflowedY"):(0,module$exports$Blockly$utils$dom.removeClass)(a,"blocklyHtmlTextAreaInputOverflowedY"));this.updateSize_();this.isBeingEdited_&&(this.sourceBlock_.RTL?setTimeout(this.resizeEditor_.bind(this),
0):this.resizeEditor_(),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$FieldMultilineInput.FieldMultilineInput.prototype.updateSize_=function(){for(var a=this.textGroup_.childNodes,b=0,c=0,d=0;d<a.length;d++){var e=(0,module$exports$Blockly$utils$dom.getTextWidth)(a[d]);e>b&&(b=e);c+=this.getConstants().FIELD_TEXT_HEIGHT+(0<d?this.getConstants().FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){a=this.value_.split("\n");d=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.TEXT,{"class":"blocklyText blocklyMultilineText"});
e=this.getConstants().FIELD_TEXT_FONTSIZE;for(var f=this.getConstants().FIELD_TEXT_FONTWEIGHT,g=this.getConstants().FIELD_TEXT_FONTFAMILY,h=0;h<a.length;h++){a[h].length>this.maxDisplayLength&&(a[h]=a[h].substring(0,this.maxDisplayLength));d.textContent=a[h];var k=(0,module$exports$Blockly$utils$dom.getFastTextWidth)(d,e,f,g);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.FieldMultilineInput.prototype.showEditor_=function(a,b){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.showEditor_.call(this,a,b);this.forceRerender()};
module$exports$Blockly$FieldMultilineInput.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.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.FieldMultilineInput.prototype.setMaxLines=function(a){"number"===typeof a&&0<a&&a!==this.maxLines_&&(this.maxLines_=a,this.forceRerender())};module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.getMaxLines=function(){return this.maxLines_};
module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.prototype.onHtmlInputKeyDown_=function(a){a.keyCode!==module$exports$Blockly$utils$KeyCodes.KeyCodes.ENTER&&$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.onHtmlInputKeyDown_.call(this,a)};module$exports$Blockly$FieldMultilineInput.FieldMultilineInput.fromJson=function(a){return new this((0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a.text),void 0,a)};(0,module$exports$Blockly$Css.register)("\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n");
(0,module$exports$Blockly$fieldRegistry.register)("field_multilinetext",module$exports$Blockly$FieldMultilineInput.FieldMultilineInput);var module$exports$Blockly$FieldLabelSerializable={FieldLabelSerializable:function(a,b,c){$.module$exports$Blockly$FieldLabel.FieldLabel.call(this,String(null!=a?a:""),b,c);this.EDITABLE=!1;this.SERIALIZABLE=!0}};$.$jscomp.inherits(module$exports$Blockly$FieldLabelSerializable.FieldLabelSerializable,$.module$exports$Blockly$FieldLabel.FieldLabel);
module$exports$Blockly$FieldLabelSerializable.FieldLabelSerializable.fromJson=function(a){return new this((0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a.text),void 0,a)};(0,module$exports$Blockly$fieldRegistry.register)("field_label_serializable",module$exports$Blockly$FieldLabelSerializable.FieldLabelSerializable);var module$exports$Blockly$FieldColour={FieldColour:function(a,b,c){module$exports$Blockly$Field.Field.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null;this.SERIALIZABLE=!0;this.CURSOR="default";this.isDirty_=!1;this.titles_=this.colours_=null;this.columns_=0;a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(c&&this.configure_(c),
this.setValue(a),b&&this.setValidator(b))}};$.$jscomp.inherits(module$exports$Blockly$FieldColour.FieldColour,module$exports$Blockly$Field.Field);module$exports$Blockly$FieldColour.FieldColour.prototype.configure_=function(a){module$exports$Blockly$Field.Field.prototype.configure_.call(this,a);a.colourOptions&&(this.colours_=a.colourOptions,this.titles_=a.colourTitles);a.columns&&(this.columns_=a.columns)};
module$exports$Blockly$FieldColour.FieldColour.prototype.initView=function(){this.size_=new module$exports$Blockly$utils$Size.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.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.FieldColour.prototype.doClassValidation_=function(a){return"string"!==typeof a?null:(0,module$exports$Blockly$utils$colour.parse)(a)};
module$exports$Blockly$FieldColour.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.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.FieldColour.prototype.setColours=function(a,b){this.colours_=a;b&&(this.titles_=b);return this};module$exports$Blockly$FieldColour.FieldColour.prototype.setColumns=function(a){this.columns_=a;return this};
module$exports$Blockly$FieldColour.FieldColour.prototype.showEditor_=function(){this.dropdownCreate_();(0,module$exports$Blockly$dropDownDiv.getContentDiv)().appendChild(this.picker_);(0,module$exports$Blockly$dropDownDiv.showPositionedByField)(this,this.dropdownDispose_.bind(this));this.picker_.focus({preventScroll:!0})};module$exports$Blockly$FieldColour.FieldColour.prototype.onClick_=function(a){a=(a=a.target)&&a.label;null!==a&&(this.setValue(a),(0,module$exports$Blockly$dropDownDiv.hideIfOwner)(this))};
module$exports$Blockly$FieldColour.FieldColour.prototype.onKeyDown_=function(a){var b=!1;if(a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.UP)this.moveHighlightBy_(0,-1),b=!0;else if(a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.DOWN)this.moveHighlightBy_(0,1),b=!0;else if(a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.LEFT)this.moveHighlightBy_(-1,0),b=!0;else if(a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.RIGHT)this.moveHighlightBy_(1,0),b=!0;
else if(a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.ENTER){if(b=this.getHighlighted_())b=b&&b.label,null!==b&&this.setValue(b);(0,module$exports$Blockly$dropDownDiv.hideWithoutAnimation)();b=!0}b&&a.stopPropagation()};
module$exports$Blockly$FieldColour.FieldColour.prototype.moveHighlightBy_=function(a,b){var c=this.colours_||module$exports$Blockly$FieldColour.FieldColour.COLOURS,d=this.columns_||module$exports$Blockly$FieldColour.FieldColour.COLUMNS,e=this.highlightedIndex_%d,f=Math.floor(this.highlightedIndex_/d);e+=a;f+=b;0>a?0>e&&0<f?(e=d-1,f--):0>e&&(e=0):0<a?e>d-1&&f<Math.floor(c.length/d)-1?(e=0,f++):e>d-1&&e--:0>b?0>f&&(f=0):0<b&&f>Math.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.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.FieldColour.prototype.onMouseEnter_=function(){this.picker_.focus({preventScroll:!0})};
module$exports$Blockly$FieldColour.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.FieldColour.prototype.getHighlighted_=function(){var a=this.columns_||module$exports$Blockly$FieldColour.FieldColour.COLUMNS,b=this.picker_.childNodes[Math.floor(this.highlightedIndex_/a)];return b?b.childNodes[this.highlightedIndex_%a]:null};
module$exports$Blockly$FieldColour.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.FieldColour.prototype.dropdownCreate_=function(){var a=this.columns_||module$exports$Blockly$FieldColour.FieldColour.COLUMNS,b=this.colours_||module$exports$Blockly$FieldColour.FieldColour.COLOURS,c=this.titles_||module$exports$Blockly$FieldColour.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;g<b.length;g++){0===g%a&&(f=document.createElement("tr"),(0,module$exports$Blockly$utils$aria.setRole)(f,module$exports$Blockly$utils$aria.Role.ROW),e.appendChild(f));
var h=document.createElement("td");f.appendChild(h);h.label=b[g];h.title=c[g]||b[g];h.id=(0,module$exports$Blockly$utils$idGenerator.getNextUniqueId)();h.setAttribute("data-index",g);(0,module$exports$Blockly$utils$aria.setRole)(h,module$exports$Blockly$utils$aria.Role.GRIDCELL);(0,module$exports$Blockly$utils$aria.setState)(h,module$exports$Blockly$utils$aria.State.LABEL,b[g]);(0,module$exports$Blockly$utils$aria.setState)(h,module$exports$Blockly$utils$aria.State.SELECTED,b[g]===d);h.style.backgroundColor=
b[g];b[g]===d&&(h.className="blocklyColourSelected",this.highlightedIndex_=g)}this.onClickWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(e,"click",this,this.onClick_,!0);this.onMouseMoveWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(e,"mousemove",this,this.onMouseMove_,!0);this.onMouseEnterWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(e,"mouseenter",this,this.onMouseEnter_,!0);this.onMouseLeaveWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(e,
"mouseleave",this,this.onMouseLeave_,!0);this.onKeyDownWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(e,"keydown",this,this.onKeyDown_);this.picker_=e};
module$exports$Blockly$FieldColour.FieldColour.prototype.dropdownDispose_=function(){this.onClickWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onClickWrapper_),this.onClickWrapper_=null);this.onMouseMoveWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null);this.onMouseEnterWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onMouseEnterWrapper_),this.onMouseEnterWrapper_=null);this.onMouseLeaveWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onMouseLeaveWrapper_),
this.onMouseLeaveWrapper_=null);this.onKeyDownWrapper_&&((0,module$exports$Blockly$browserEvents.unbind)(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null);this.highlightedIndex_=this.picker_=null};module$exports$Blockly$FieldColour.FieldColour.fromJson=function(a){return new this(a.colour,void 0,a)};module$exports$Blockly$FieldColour.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.FieldColour.prototype.DEFAULT_VALUE=module$exports$Blockly$FieldColour.FieldColour.COLOURS[0];module$exports$Blockly$FieldColour.FieldColour.TITLES=[];module$exports$Blockly$FieldColour.FieldColour.COLUMNS=7;(0,module$exports$Blockly$Css.register)("\n.blocklyColourTable {\n border-collapse: collapse;\n display: block;\n outline: none;\n padding: 1px;\n}\n\n.blocklyColourTable>tr>td {\n border: .5px solid #888;\n box-sizing: border-box;\n cursor: pointer;\n display: inline-block;\n height: 20px;\n padding: 0;\n width: 20px;\n}\n\n.blocklyColourTable>tr>td.blocklyColourHighlighted {\n border-color: #eee;\n box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);\n position: relative;\n}\n\n.blocklyColourSelected, .blocklyColourSelected:hover {\n border-color: #eee !important;\n outline: 1px solid #333;\n position: relative;\n}\n");
(0,module$exports$Blockly$fieldRegistry.register)("field_colour",module$exports$Blockly$FieldColour.FieldColour);$.module$exports$Blockly$FieldCheckbox={FieldCheckbox:function(a,b,c){module$exports$Blockly$Field.Field.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.checkChar_=$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.CHECK_CHAR;this.SERIALIZABLE=!0;this.CURSOR="default";a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}};$.$jscomp.inherits($.module$exports$Blockly$FieldCheckbox.FieldCheckbox,module$exports$Blockly$Field.Field);
$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.configure_=function(a){module$exports$Blockly$Field.Field.prototype.configure_.call(this,a);a.checkCharacter&&(this.checkChar_=a.checkCharacter)};$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.saveState=function(){var a=this.saveLegacyState($.module$exports$Blockly$FieldCheckbox.FieldCheckbox);return null!==a?a:this.getValueBoolean()};
$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.initView=function(){module$exports$Blockly$Field.Field.prototype.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.FieldCheckbox.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)};
$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.getDisplayText_=function(){return this.checkChar_};$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.setCheckCharacter=function(a){this.checkChar_=a||$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.CHECK_CHAR;this.forceRerender()};$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)};
$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a);this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")};$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"};
$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_};$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))};$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"===typeof a?"TRUE"===a:!!a};$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.fromJson=function(a){return new this(a.checked,void 0,a)};
$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.prototype.DEFAULT_VALUE=!1;$.module$exports$Blockly$FieldCheckbox.FieldCheckbox.CHECK_CHAR="\u2713";(0,module$exports$Blockly$fieldRegistry.register)("field_checkbox",$.module$exports$Blockly$FieldCheckbox.FieldCheckbox);var module$exports$Blockly$FieldAngle={FieldAngle:function(a,b,c){$.module$exports$Blockly$FieldTextInput.FieldTextInput.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);this.clockwise_=module$exports$Blockly$FieldAngle.FieldAngle.CLOCKWISE;this.offset_=module$exports$Blockly$FieldAngle.FieldAngle.OFFSET;this.wrap_=module$exports$Blockly$FieldAngle.FieldAngle.WRAP;this.round_=module$exports$Blockly$FieldAngle.FieldAngle.ROUND;this.moveSurfaceWrapper_=this.clickSurfaceWrapper_=this.clickWrapper_=
this.symbol_=this.line_=this.gauge_=this.editor_=null;this.SERIALIZABLE=!0;a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}};$.$jscomp.inherits(module$exports$Blockly$FieldAngle.FieldAngle,$.module$exports$Blockly$FieldTextInput.FieldTextInput);
module$exports$Blockly$FieldAngle.FieldAngle.prototype.configure_=function(a){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.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.FieldAngle.prototype.initView=function(){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.initView.call(this);this.symbol_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.TSPAN,{},null);this.symbol_.appendChild(document.createTextNode("\u00b0"));this.textElement_.appendChild(this.symbol_)};
module$exports$Blockly$FieldAngle.FieldAngle.prototype.render_=function(){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.render_.call(this);this.updateGraph_()};
module$exports$Blockly$FieldAngle.FieldAngle.prototype.showEditor_=function(a){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.showEditor_.call(this,a,module$exports$Blockly$utils$userAgent.MOBILE||module$exports$Blockly$utils$userAgent.ANDROID||module$exports$Blockly$utils$userAgent.IPAD);this.dropdownCreate_();(0,module$exports$Blockly$dropDownDiv.getContentDiv)().appendChild(this.editor_);(0,module$exports$Blockly$dropDownDiv.setColour)(this.sourceBlock_.style.colourPrimary,this.sourceBlock_.style.colourTertiary);
(0,module$exports$Blockly$dropDownDiv.showPositionedByField)(this,this.dropdownDispose_.bind(this));this.updateGraph_()};
module$exports$Blockly$FieldAngle.FieldAngle.prototype.dropdownCreate_=function(){var a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.FieldAngle.HALF+"px",width:2*module$exports$Blockly$FieldAngle.FieldAngle.HALF+"px",style:"touch-action: none"},
null),b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.CIRCLE,{cx:module$exports$Blockly$FieldAngle.FieldAngle.HALF,cy:module$exports$Blockly$FieldAngle.FieldAngle.HALF,r:module$exports$Blockly$FieldAngle.FieldAngle.RADIUS,"class":"blocklyAngleCircle"},a);this.gauge_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{"class":"blocklyAngleGauge"},a);this.line_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.LINE,
{x1:module$exports$Blockly$FieldAngle.FieldAngle.HALF,y1:module$exports$Blockly$FieldAngle.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.Svg.LINE,{x1:module$exports$Blockly$FieldAngle.FieldAngle.HALF+module$exports$Blockly$FieldAngle.FieldAngle.RADIUS,y1:module$exports$Blockly$FieldAngle.FieldAngle.HALF,x2:module$exports$Blockly$FieldAngle.FieldAngle.HALF+module$exports$Blockly$FieldAngle.FieldAngle.RADIUS-
(0===c%45?10:5),y2:module$exports$Blockly$FieldAngle.FieldAngle.HALF,"class":"blocklyAngleMarks",transform:"rotate("+c+","+module$exports$Blockly$FieldAngle.FieldAngle.HALF+","+module$exports$Blockly$FieldAngle.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.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.FieldAngle.prototype.hide_=function(){(0,module$exports$Blockly$dropDownDiv.hideIfOwner)(this);(0,module$exports$Blockly$WidgetDiv.hide)()};
module$exports$Blockly$FieldAngle.FieldAngle.prototype.onMouseMove_=function(a){var b=this.gauge_.ownerSVGElement.getBoundingClientRect(),c=a.clientX-b.left-module$exports$Blockly$FieldAngle.FieldAngle.HALF;a=a.clientY-b.top-module$exports$Blockly$FieldAngle.FieldAngle.HALF;b=Math.atan(-a/c);isNaN(b)||(b=(0,module$exports$Blockly$utils$math.toDegrees)(b),0>c?b+=180:0<a&&(b+=360),b=this.clockwise_?this.offset_+360-b:360-(this.offset_-b),this.displayMouseOrKeyboardValue_(b))};
module$exports$Blockly$FieldAngle.FieldAngle.prototype.displayMouseOrKeyboardValue_=function(a){this.round_&&(a=Math.round(a/this.round_)*this.round_);a=this.wrapValue_(a);a!==this.value_&&this.setEditorValue_(a)};
module$exports$Blockly$FieldAngle.FieldAngle.prototype.updateGraph_=function(){if(this.gauge_){var a=Number(this.getText())+this.offset_,b=(0,module$exports$Blockly$utils$math.toRadians)(a%360);a=["M ",module$exports$Blockly$FieldAngle.FieldAngle.HALF,",",module$exports$Blockly$FieldAngle.FieldAngle.HALF];var c=module$exports$Blockly$FieldAngle.FieldAngle.HALF,d=module$exports$Blockly$FieldAngle.FieldAngle.HALF;if(!isNaN(b)){var e=Number(this.clockwise_),f=(0,module$exports$Blockly$utils$math.toRadians)(this.offset_),
g=Math.cos(f)*module$exports$Blockly$FieldAngle.FieldAngle.RADIUS,h=Math.sin(f)*-module$exports$Blockly$FieldAngle.FieldAngle.RADIUS;e&&(b=2*f-b);c+=Math.cos(b)*module$exports$Blockly$FieldAngle.FieldAngle.RADIUS;d-=Math.sin(b)*module$exports$Blockly$FieldAngle.FieldAngle.RADIUS;b=Math.abs(Math.floor((b-f)/Math.PI)%2);e&&(b=1-b);a.push(" l ",g,",",h," A ",module$exports$Blockly$FieldAngle.FieldAngle.RADIUS,",",module$exports$Blockly$FieldAngle.FieldAngle.RADIUS," 0 ",b," ",e," ",c,",",d," z")}this.gauge_.setAttribute("d",
a.join(""));this.line_.setAttribute("x2",c);this.line_.setAttribute("y2",d)}};
module$exports$Blockly$FieldAngle.FieldAngle.prototype.onHtmlInputKeyDown_=function(a){$.module$exports$Blockly$FieldTextInput.FieldTextInput.prototype.onHtmlInputKeyDown_.call(this,a);var b;a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.LEFT?b=this.sourceBlock_.RTL?1:-1:a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.RIGHT?b=this.sourceBlock_.RTL?-1:1:a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.DOWN?b=-1:a.keyCode===module$exports$Blockly$utils$KeyCodes.KeyCodes.UP&&
(b=1);if(b){var c=this.getValue();this.displayMouseOrKeyboardValue_(c+b*this.round_);a.preventDefault();a.stopPropagation()}};module$exports$Blockly$FieldAngle.FieldAngle.prototype.doClassValidation_=function(a){a=Number(a);return isNaN(a)||!isFinite(a)?null:this.wrapValue_(a)};module$exports$Blockly$FieldAngle.FieldAngle.prototype.wrapValue_=function(a){a%=360;0>a&&(a+=360);a>this.wrap_&&(a-=360);return a};
module$exports$Blockly$FieldAngle.FieldAngle.fromJson=function(a){return new this(a.angle,void 0,a)};module$exports$Blockly$FieldAngle.FieldAngle.prototype.DEFAULT_VALUE=0;module$exports$Blockly$FieldAngle.FieldAngle.ROUND=15;module$exports$Blockly$FieldAngle.FieldAngle.HALF=50;module$exports$Blockly$FieldAngle.FieldAngle.CLOCKWISE=!1;module$exports$Blockly$FieldAngle.FieldAngle.OFFSET=0;module$exports$Blockly$FieldAngle.FieldAngle.WRAP=360;
module$exports$Blockly$FieldAngle.FieldAngle.RADIUS=module$exports$Blockly$FieldAngle.FieldAngle.HALF-1;(0,module$exports$Blockly$Css.register)("\n.blocklyAngleCircle {\n stroke: #444;\n stroke-width: 1;\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyAngleMarks {\n stroke: #444;\n stroke-width: 1;\n}\n\n.blocklyAngleGauge {\n fill: #f88;\n fill-opacity: .8;\n pointer-events: none;\n}\n\n.blocklyAngleLine {\n stroke: #f00;\n stroke-width: 2;\n stroke-linecap: round;\n pointer-events: none;\n}\n");
(0,module$exports$Blockly$fieldRegistry.register)("field_angle",module$exports$Blockly$FieldAngle.FieldAngle);var module$exports$Blockly$zelos$BottomRow={BottomRow:function(a){module$exports$Blockly$blockRendering$BottomRow.BottomRow.call(this,a)}};$.$jscomp.inherits(module$exports$Blockly$zelos$BottomRow.BottomRow,module$exports$Blockly$blockRendering$BottomRow.BottomRow);module$exports$Blockly$zelos$BottomRow.BottomRow.prototype.endsWithElemSpacer=function(){return!1};module$exports$Blockly$zelos$BottomRow.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection};
module$exports$Blockly$zelos$BottomRow.BottomRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection};var module$exports$Blockly$zelos$ConstantProvider={ConstantProvider:function(){module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.call(this);this.SMALL_PADDING=this.GRID_UNIT=4;this.MEDIUM_PADDING=2*this.GRID_UNIT;this.MEDIUM_LARGE_PADDING=3*this.GRID_UNIT;this.LARGE_PADDING=4*this.GRID_UNIT;this.CORNER_RADIUS=1*this.GRID_UNIT;this.NOTCH_WIDTH=9*this.GRID_UNIT;this.NOTCH_HEIGHT=2*this.GRID_UNIT;this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=3*this.GRID_UNIT;this.MIN_BLOCK_WIDTH=
2*this.GRID_UNIT;this.MIN_BLOCK_HEIGHT=12*this.GRID_UNIT;this.EMPTY_STATEMENT_INPUT_HEIGHT=6*this.GRID_UNIT;this.TAB_OFFSET_FROM_TOP=0;this.TOP_ROW_MIN_HEIGHT=this.CORNER_RADIUS;this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.BOTTOM_ROW_MIN_HEIGHT=this.CORNER_RADIUS;this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=6*this.GRID_UNIT;this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT;this.STATEMENT_INPUT_SPACER_MIN_WIDTH=40*this.GRID_UNIT;this.STATEMENT_INPUT_PADDING_LEFT=4*this.GRID_UNIT;
this.EMPTY_INLINE_INPUT_PADDING=4*this.GRID_UNIT;this.EMPTY_INLINE_INPUT_HEIGHT=8*this.GRID_UNIT;this.DUMMY_INPUT_MIN_HEIGHT=8*this.GRID_UNIT;this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=6*this.GRID_UNIT;this.CURSOR_WS_WIDTH=20*this.GRID_UNIT;this.CURSOR_COLOUR="#ffa200";this.CURSOR_RADIUS=5;this.JAGGED_TEETH_WIDTH=this.JAGGED_TEETH_HEIGHT=0;this.START_HAT_HEIGHT=22;this.START_HAT_WIDTH=96;this.SHAPES={HEXAGONAL:1,ROUND:2,SQUARE:3,PUZZLE:4,NOTCH:5};this.SHAPE_IN_SHAPE_PADDING={1:{0:5*this.GRID_UNIT,1:2*this.GRID_UNIT,
2:5*this.GRID_UNIT,3:5*this.GRID_UNIT},2:{0:3*this.GRID_UNIT,1:3*this.GRID_UNIT,2:1*this.GRID_UNIT,3:2*this.GRID_UNIT},3:{0:2*this.GRID_UNIT,1:2*this.GRID_UNIT,2:2*this.GRID_UNIT,3:2*this.GRID_UNIT}};this.FULL_BLOCK_FIELDS=!0;this.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT;this.FIELD_TEXT_FONTWEIGHT="bold";this.FIELD_TEXT_FONTFAMILY='"Helvetica Neue", "Segoe UI", Helvetica, sans-serif';this.FIELD_BORDER_RECT_RADIUS=this.CORNER_RADIUS;this.FIELD_BORDER_RECT_X_PADDING=2*this.GRID_UNIT;this.FIELD_BORDER_RECT_Y_PADDING=
1.625*this.GRID_UNIT;this.FIELD_BORDER_RECT_HEIGHT=8*this.GRID_UNIT;this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=8*this.GRID_UNIT;this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0;this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING;this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!0;this.FIELD_COLOUR_DEFAULT_WIDTH=2*this.GRID_UNIT;this.FIELD_COLOUR_DEFAULT_HEIGHT=4*this.GRID_UNIT;this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT;
this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT;this.SELECTED_GLOW_COLOUR="#fff200";this.SELECTED_GLOW_SIZE=.5;this.REPLACEMENT_GLOW_COLOUR="#fff200";this.REPLACEMENT_GLOW_SIZE=2;this.selectedGlowFilterId="";this.selectedGlowFilter_=null;this.replacementGlowFilterId="";this.SQUARED=this.ROUNDED=this.HEXAGONAL=this.replacementGlowFilter_=null}};$.$jscomp.inherits(module$exports$Blockly$zelos$ConstantProvider.ConstantProvider,module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider);
module$exports$Blockly$zelos$ConstantProvider.ConstantProvider.prototype.setFontConstants_=function(a){module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.setFontConstants_.call(this,a);this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING};
module$exports$Blockly$zelos$ConstantProvider.ConstantProvider.prototype.init=function(){module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.init.call(this);this.HEXAGONAL=this.makeHexagonal();this.ROUNDED=this.makeRounded();this.SQUARED=this.makeSquared();this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT+this.INSIDE_CORNERS.rightWidth};
module$exports$Blockly$zelos$ConstantProvider.ConstantProvider.prototype.setDynamicProperties_=function(a){module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.setDynamicProperties_.call(this,a);this.SELECTED_GLOW_COLOUR=a.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;var b=Number(a.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=b&&!isNaN(b)?b:this.SELECTED_GLOW_SIZE;this.REPLACEMENT_GLOW_COLOUR=a.getComponentStyle("replacementGlowColour")||
this.REPLACEMENT_GLOW_COLOUR;this.REPLACEMENT_GLOW_SIZE=(a=Number(a.getComponentStyle("replacementGlowSize")))&&!isNaN(a)?a:this.REPLACEMENT_GLOW_SIZE};module$exports$Blockly$zelos$ConstantProvider.ConstantProvider.prototype.dispose=function(){module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.dispose.call(this);this.selectedGlowFilter_&&(0,module$exports$Blockly$utils$dom.removeNode)(this.selectedGlowFilter_);this.replacementGlowFilter_&&(0,module$exports$Blockly$utils$dom.removeNode)(this.replacementGlowFilter_)};
module$exports$Blockly$zelos$ConstantProvider.ConstantProvider.prototype.makeStartHat=function(){var a=this.START_HAT_HEIGHT,b=this.START_HAT_WIDTH,c=(0,module$exports$Blockly$utils$svgPaths.curve)("c",[(0,module$exports$Blockly$utils$svgPaths.point)(25,-a),(0,module$exports$Blockly$utils$svgPaths.point)(71,-a),(0,module$exports$Blockly$utils$svgPaths.point)(b,0)]);return{height:a,width:b,path:c}};
module$exports$Blockly$zelos$ConstantProvider.ConstantProvider.prototype.makeHexagonal=function(){function a(c,d,e){var f=c/2;f=f>b?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.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.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.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.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.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.ConstantProvider.prototype.generateSecondaryColour_=function(a){return(0,module$exports$Blockly$utils$colour.blend)("#000",a,.15)||a};
module$exports$Blockly$zelos$ConstantProvider.ConstantProvider.prototype.generateTertiaryColour_=function(a){return(0,module$exports$Blockly$utils$colour.blend)("#000",a,.25)||a};
module$exports$Blockly$zelos$ConstantProvider.ConstantProvider.prototype.createDom=function(a,b,c){module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.createDom.call(this,a,b,c);a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.DEFS,{},a);b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Svg.FEGAUSSIANBLUR,{"in":"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},b);c=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FECOMPONENTTRANSFER,{result:"outBlur"},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.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.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.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.Svg.FEGAUSSIANBLUR,{"in":"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},a);b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FECOMPONENTTRANSFER,{result:"outBlur"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.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.Svg.FECOMPOSITE,{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FECOMPOSITE,{"in":"SourceGraphic",in2:"outGlow",operator:"over"},a);this.replacementGlowFilterId=a.id;this.replacementGlowFilter_=a};
module$exports$Blockly$zelos$ConstantProvider.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={Drawer:function(a,b){module$exports$Blockly$blockRendering$Drawer.Drawer.call(this,a,b)}};$.$jscomp.inherits(module$exports$Blockly$zelos$Drawer.Drawer,module$exports$Blockly$blockRendering$Drawer.Drawer);
module$exports$Blockly$zelos$Drawer.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.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$blockRendering$Drawer.Drawer.prototype.drawOutline_.call(this)};
module$exports$Blockly$zelos$Drawer.Drawer.prototype.drawLeft_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawLeft_.call(this)};
module$exports$Blockly$zelos$Drawer.Drawer.prototype.drawRightSideRow_=function(a){if(!(0>=a.height))if(module$exports$Blockly$blockRendering$Types.Types.isSpacer(a)&&(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<b?(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a.yPos+b):"")+(a.precedesStatement?this.constants_.INSIDE_CORNERS.pathTopRight:
"")}else this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a.yPos+a.height)};module$exports$Blockly$zelos$Drawer.Drawer.prototype.drawRightDynamicConnection_=function(){this.outlinePath_+=this.info_.outputConnection.shape.pathRightDown(this.info_.outputConnection.height)};
module$exports$Blockly$zelos$Drawer.Drawer.prototype.drawLeftDynamicConnection_=function(){this.positionOutputConnection_();this.outlinePath_+=this.info_.outputConnection.shape.pathUp(this.info_.outputConnection.height);this.outlinePath_+="z"};
module$exports$Blockly$zelos$Drawer.Drawer.prototype.drawFlatTop_=function(){var a=this.info_.topRow;this.positionPreviousConnection_();this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.moveBy)(a.xPos,this.info_.startY);this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",a.width)};
module$exports$Blockly$zelos$Drawer.Drawer.prototype.drawFlatBottom_=function(){var a=this.info_.bottomRow;this.positionNextConnection_();this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("V",a.baseline);this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",-a.width)};
module$exports$Blockly$zelos$Drawer.Drawer.prototype.drawInlineInput_=function(a){this.positionInlineInputConnection_(a);var b=a.input.name;if(!a.connectedBlock&&!this.info_.isInsertionMarker){var c=a.width-2*a.connectionWidth;a=(0,module$exports$Blockly$utils$svgPaths.moveTo)(a.xPos+a.connectionWidth,a.centerline-a.height/2)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",c)+a.shape.pathRightDown(a.height)+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",-c)+a.shape.pathUp(a.height)+
"z";this.block_.pathObject.setOutlinePath(b,a)}};
module$exports$Blockly$zelos$Drawer.Drawer.prototype.drawStatementInput_=function(a){var b=a.getLastInput(),c=b.xPos+b.notchOffset+b.shape.width,d=b.shape.pathRight+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",-(b.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop,e=a.height-2*this.constants_.INSIDE_CORNERS.height;b=this.constants_.INSIDE_CORNERS.pathBottom+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("h",b.notchOffset-this.constants_.INSIDE_CORNERS.width)+
(b.connectedBottomNextConnection?"":b.shape.pathLeft);this.outlinePath_+=(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",c)+d+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("v",e)+b+(0,module$exports$Blockly$utils$svgPaths.lineOnAxis)("H",a.xPos+a.width);this.positionStatementInputConnection_(a)};var module$exports$Blockly$zelos$MarkerSvg={MarkerSvg:function(a,b,c){module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.call(this,a,b,c);this.markerCircle_=null}};$.$jscomp.inherits(module$exports$Blockly$zelos$MarkerSvg.MarkerSvg,module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg);
module$exports$Blockly$zelos$MarkerSvg.MarkerSvg.prototype.showWithInputOutput_=function(a){var b=a.getSourceBlock();a=a.getLocation().getOffsetInBlock();this.positionCircle_(a.x,a.y);this.setParent_(b);this.showCurrent_()};module$exports$Blockly$zelos$MarkerSvg.MarkerSvg.prototype.showWithOutput_=function(a){this.showWithInputOutput_(a)};module$exports$Blockly$zelos$MarkerSvg.MarkerSvg.prototype.showWithInput_=function(a){this.showWithInputOutput_(a)};
module$exports$Blockly$zelos$MarkerSvg.MarkerSvg.prototype.showWithBlock_=function(a){a=a.getLocation();var b=a.getHeightWidth();this.positionRect_(0,0,b.width,b.height);this.setParent_(a);this.showCurrent_()};module$exports$Blockly$zelos$MarkerSvg.MarkerSvg.prototype.positionCircle_=function(a,b){this.markerCircle_.setAttribute("cx",a);this.markerCircle_.setAttribute("cy",b);this.currentMarkerSvg=this.markerCircle_};
module$exports$Blockly$zelos$MarkerSvg.MarkerSvg.prototype.hide=function(){module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.hide.call(this);this.markerCircle_.style.display="none"};
module$exports$Blockly$zelos$MarkerSvg.MarkerSvg.prototype.createDomInternal_=function(){module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.createDomInternal_.call(this);this.markerCircle_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.CIRCLE,{r:this.constants_.CURSOR_RADIUS,style:"display: none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_);if(this.isCursor()){var a=this.getBlinkProperties_();(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.ANIMATE,
a,this.markerCircle_)}return this.markerSvg_};module$exports$Blockly$zelos$MarkerSvg.MarkerSvg.prototype.applyColour_=function(a){module$exports$Blockly$blockRendering$MarkerSvg.MarkerSvg.prototype.applyColour_.call(this,a);this.markerCircle_.setAttribute("fill",this.colour_);this.markerCircle_.setAttribute("stroke",this.colour_);this.isCursor()&&this.markerCircle_.firstChild.setAttribute("values",this.colour_+";transparent;transparent;")};var module$exports$Blockly$zelos$PathObject={PathObject:function(a,b,c){module$exports$Blockly$blockRendering$PathObject.PathObject.call(this,a,b,c);this.constants=c;this.svgPathSelected_=null;this.outlines_=Object.create(null);this.outputShapeType=this.remainingOutlines_=null}};$.$jscomp.inherits(module$exports$Blockly$zelos$PathObject.PathObject,module$exports$Blockly$blockRendering$PathObject.PathObject);
module$exports$Blockly$zelos$PathObject.PathObject.prototype.setPath=function(a){module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.setPath.call(this,a);this.svgPathSelected_&&this.svgPathSelected_.setAttribute("d",a)};
module$exports$Blockly$zelos$PathObject.PathObject.prototype.applyColour=function(a){module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.applyColour.call(this,a);a.isShadow()&&a.getParent()&&this.svgPath.setAttribute("stroke",a.getParent().style.colourTertiary);for(var b in this.outlines_)this.outlines_[b].setAttribute("fill",this.style.colourTertiary)};
module$exports$Blockly$zelos$PathObject.PathObject.prototype.flipRTL=function(){module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.flipRTL.call(this);for(var a in this.outlines_)this.outlines_[a].setAttribute("transform","scale(-1 1)")};
module$exports$Blockly$zelos$PathObject.PathObject.prototype.updateSelected=function(a){this.setClass_("blocklySelected",a);a?this.svgPathSelected_||(this.svgPathSelected_=this.svgPath.cloneNode(!0),this.svgPathSelected_.setAttribute("fill","none"),this.svgPathSelected_.setAttribute("filter","url(#"+this.constants.selectedGlowFilterId+")"),this.svgRoot.appendChild(this.svgPathSelected_)):this.svgPathSelected_&&(this.svgRoot.removeChild(this.svgPathSelected_),this.svgPathSelected_=null)};
module$exports$Blockly$zelos$PathObject.PathObject.prototype.updateReplacementFade=function(a){this.setClass_("blocklyReplaceable",a);a?this.svgPath.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):this.svgPath.removeAttribute("filter")};
module$exports$Blockly$zelos$PathObject.PathObject.prototype.updateShapeForInputHighlight=function(a,b){a=a.getParentInput().name;(a=this.getOutlinePath_(a))&&(b?a.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):a.removeAttribute("filter"))};module$exports$Blockly$zelos$PathObject.PathObject.prototype.beginDrawing=function(){this.remainingOutlines_=Object.create(null);for(var a in this.outlines_)this.remainingOutlines_[a]=1};
module$exports$Blockly$zelos$PathObject.PathObject.prototype.endDrawing=function(){if(this.remainingOutlines_)for(var a in this.remainingOutlines_)this.removeOutlinePath_(a);this.remainingOutlines_=null};module$exports$Blockly$zelos$PathObject.PathObject.prototype.setOutlinePath=function(a,b){a=this.getOutlinePath_(a);a.setAttribute("d",b);a.setAttribute("fill",this.style.colourTertiary)};
module$exports$Blockly$zelos$PathObject.PathObject.prototype.getOutlinePath_=function(a){this.outlines_[a]||(this.outlines_[a]=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{"class":"blocklyOutlinePath",d:""},this.svgRoot));this.remainingOutlines_&&delete this.remainingOutlines_[a];return this.outlines_[a]};
module$exports$Blockly$zelos$PathObject.PathObject.prototype.removeOutlinePath_=function(a){this.outlines_[a].parentNode.removeChild(this.outlines_[a]);delete this.outlines_[a]};$.module$exports$Blockly$FieldImage={FieldImage:function(a,b,c,d,e,f,g){module$exports$Blockly$Field.Field.call(this,module$exports$Blockly$Field.Field.SKIP_SETUP);if(!a)throw Error("Src value of an image field is required");c=Number((0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(c));b=Number((0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(b));if(isNaN(c)||isNaN(b))throw Error("Height and width values of an image field must cast to numbers.");if(0>=c||0>=b)throw Error("Height and width values of an image field must be greater than 0.");
this.size_=new module$exports$Blockly$utils$Size.Size(b,c+$.module$exports$Blockly$FieldImage.FieldImage.Y_PADDING);this.imageHeight_=c;this.clickHandler_=null;"function"===typeof e&&(this.clickHandler_=e);this.imageElement_=null;this.flipRtl_=this.isDirty_=this.EDITABLE=!1;this.altText_="";a!==module$exports$Blockly$Field.Field.SKIP_SETUP&&(g?this.configure_(g):(this.flipRtl_=!!f,this.altText_=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(d)||""),this.setValue((0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a)))}};
$.$jscomp.inherits($.module$exports$Blockly$FieldImage.FieldImage,module$exports$Blockly$Field.Field);$.module$exports$Blockly$FieldImage.FieldImage.prototype.configure_=function(a){module$exports$Blockly$Field.Field.prototype.configure_.call(this,a);this.flipRtl_=!!a.flipRtl;this.altText_=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(a.alt)||""};
$.module$exports$Blockly$FieldImage.FieldImage.prototype.initView=function(){this.imageElement_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.FieldImage.prototype.updateSize_=function(){};$.module$exports$Blockly$FieldImage.FieldImage.prototype.doClassValidation_=function(a){return"string"!==typeof a?null:a};$.module$exports$Blockly$FieldImage.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.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_};$.module$exports$Blockly$FieldImage.FieldImage.prototype.setAlt=function(a){a!==this.altText_&&(this.altText_=a||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))};$.module$exports$Blockly$FieldImage.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)};
$.module$exports$Blockly$FieldImage.FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};$.module$exports$Blockly$FieldImage.FieldImage.prototype.getText_=function(){return this.altText_};$.module$exports$Blockly$FieldImage.FieldImage.fromJson=function(a){return new this(a.src,a.width,a.height,void 0,void 0,void 0,a)};$.module$exports$Blockly$FieldImage.FieldImage.prototype.DEFAULT_VALUE="";$.module$exports$Blockly$FieldImage.FieldImage.Y_PADDING=1;
(0,module$exports$Blockly$fieldRegistry.register)("field_image",$.module$exports$Blockly$FieldImage.FieldImage);var module$exports$Blockly$zelos$RightConnectionShape={RightConnectionShape:function(a){module$exports$Blockly$blockRendering$Measurable.Measurable.call(this,a);this.type|=module$exports$Blockly$blockRendering$Types.Types.getType("RIGHT_CONNECTION");this.width=this.height=0}};$.$jscomp.inherits(module$exports$Blockly$zelos$RightConnectionShape.RightConnectionShape,module$exports$Blockly$blockRendering$Measurable.Measurable);var module$exports$Blockly$zelos$StatementInput={StatementInput:function(a,b){module$exports$Blockly$blockRendering$StatementInput.StatementInput.call(this,a,b);if(this.connectedBlock){for(a=this.connectedBlock;b=a.getNextBlock();)a=b;a.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}}};$.$jscomp.inherits(module$exports$Blockly$zelos$StatementInput.StatementInput,module$exports$Blockly$blockRendering$StatementInput.StatementInput);var module$exports$Blockly$zelos$TopRow={TopRow:function(a){module$exports$Blockly$blockRendering$TopRow.TopRow.call(this,a)}};$.$jscomp.inherits(module$exports$Blockly$zelos$TopRow.TopRow,module$exports$Blockly$blockRendering$TopRow.TopRow);module$exports$Blockly$zelos$TopRow.TopRow.prototype.endsWithElemSpacer=function(){return!1};
module$exports$Blockly$zelos$TopRow.TopRow.prototype.hasLeftSquareCorner=function(a){var b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection;return!!a.outputConnection||b};module$exports$Blockly$zelos$TopRow.TopRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection};var module$exports$Blockly$zelos$RenderInfo={RenderInfo:function(a,b){module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.call(this,a,b);this.topRow=new module$exports$Blockly$zelos$TopRow.TopRow(this.constants_);this.bottomRow=new module$exports$Blockly$zelos$BottomRow.BottomRow(this.constants_);this.isInline=!0;this.isMultiRow=!b.getInputsInline()||b.isCollapsed();this.hasStatementInput=0<b.statementInputCount;this.rightSide=this.outputConnection?new module$exports$Blockly$zelos$RightConnectionShape.RightConnectionShape(this.constants_):
null;this.rightAlignedDummyInputs_=new WeakMap}};$.$jscomp.inherits(module$exports$Blockly$zelos$RenderInfo.RenderInfo,module$exports$Blockly$blockRendering$RenderInfo.RenderInfo);module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.getRenderer=function(){return this.renderer_};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.measure=function(){this.createRows_();this.addElemSpacing_();this.addRowSpacing_();this.adjustXPosition_();this.computeBounds_();this.alignRowElements_();this.finalize_()};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.shouldStartNewRow_=function(a,b){return b?a.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT||b.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT?!0:a.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE||a.type===$.module$exports$Blockly$inputTypes.inputTypes.DUMMY?!this.isInline||this.isMultiRow:!1:!1};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.getDesiredRowWidth_=function(a){return a.hasStatement?this.width-this.startX-(this.constants_.INSIDE_CORNERS.rightWidth||0):module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getDesiredRowWidth_.call(this,a)};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.getInRowSpacing_=function(a,b){return a&&b||!this.outputConnection||!this.outputConnection.isDynamicShape||this.hasStatementInput||this.bottomRow.hasNextConnection?!a&&b&&module$exports$Blockly$blockRendering$Types.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:a&&module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(a)&&b&&(module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection(b)||
module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b))?b.notchOffset-this.constants_.CORNER_RADIUS:a&&module$exports$Blockly$blockRendering$Types.Types.isLeftSquareCorner(a)&&b&&module$exports$Blockly$blockRendering$Types.Types.isHat(b)?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){if(module$exports$Blockly$blockRendering$Types.Types.isTopRow(a)&&module$exports$Blockly$blockRendering$Types.Types.isBottomRow(b))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;var c=module$exports$Blockly$blockRendering$Types.Types.isInputRow(a)&&a.hasStatement,d=module$exports$Blockly$blockRendering$Types.Types.isInputRow(b)&&b.hasStatement;return d||c?(a=Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.INSIDE_CORNERS.rightHeight||
0),d&&c?Math.max(a,this.constants_.DUMMY_INPUT_MIN_HEIGHT):a):module$exports$Blockly$blockRendering$Types.Types.isTopRow(a)?a.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):module$exports$Blockly$blockRendering$Types.Types.isBottomRow(b)?this.outputConnection?!b.hasNextConnection&&this.hasStatementInput?Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):this.constants_.NO_PADDING:
Math.max(this.topRow.minHeight,Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.CORNER_RADIUS))-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.getSpacerRowWidth_=function(a,b){var c=this.width-this.startX;return module$exports$Blockly$blockRendering$Types.Types.isInputRow(a)&&a.hasStatement||module$exports$Blockly$blockRendering$Types.Types.isInputRow(b)&&b.hasStatement?Math.max(c,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):c};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.getElemCenterline_=function(a,b){if(a.hasStatement&&!module$exports$Blockly$blockRendering$Types.Types.isSpacer(b)&&!module$exports$Blockly$blockRendering$Types.Types.isStatementInput(b))return a.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(b)&&b instanceof module$exports$Blockly$blockRendering$InputConnection.InputConnection){var c=b.connectedBlock;if(c&&c.outputConnection&&
c.nextConnection)return a.yPos+c.height/2}return module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getElemCenterline_.call(this,a,b)};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.addInput_=function(a,b){if(a.type===$.module$exports$Blockly$inputTypes.inputTypes.DUMMY&&b.hasDummyInput&&b.align===$.module$exports$Blockly$Input.Align.LEFT&&a.align===$.module$exports$Blockly$Input.Align.RIGHT)this.rightAlignedDummyInputs_.set(b,a);else if(a.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT){b.elements.push(new module$exports$Blockly$zelos$StatementInput.StatementInput(this.constants_,a));b.hasStatement=
!0;null===b.align&&(b.align=a.align);return}module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.addInput_.call(this,a,b)};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.addAlignmentPadding_=function(a,b){if(this.rightAlignedDummyInputs_.get(a)){for(var c,d=0;d<a.elements.length;d++){var e=a.elements[d];module$exports$Blockly$blockRendering$Types.Types.isSpacer(e)&&(c=e);if(module$exports$Blockly$blockRendering$Types.Types.isField(e)&&e instanceof module$exports$Blockly$blockRendering$Field.Field&&e.parentInput===this.rightAlignedDummyInputs_.get(a))break}if(c){c.width+=b;a.width+=b;return}}module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.addAlignmentPadding_.call(this,
a,b)};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.adjustXPosition_=function(){for(var a=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH,b=a,c=2;c<this.rows.length-1;c+=2){var d=this.rows[c-1],e=this.rows[c],f=this.rows[c+1];d=2===c?!!this.topRow.hasPreviousConnection:!!d.followsStatement;f=c+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!f.precedesStatement;if(module$exports$Blockly$blockRendering$Types.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.Types.isInputRow(e)&&!e.hasStatement){f=e.xPos;d=null;for(var g=0;g<e.elements.length;g++){var h=e.elements[g];module$exports$Blockly$blockRendering$Types.Types.isSpacer(h)&&(d=h);d&&(module$exports$Blockly$blockRendering$Types.Types.isField(h)||module$exports$Blockly$blockRendering$Types.Types.isInput(h))&&f<b&&!(module$exports$Blockly$blockRendering$Types.Types.isField(h)&&h instanceof module$exports$Blockly$blockRendering$Field.Field&&
(h.field instanceof $.module$exports$Blockly$FieldLabel.FieldLabel||h.field instanceof $.module$exports$Blockly$FieldImage.FieldImage))&&(d.width+=b-f);f+=h.width}}}};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.finalizeOutputConnection_=function(){if(this.outputConnection&&this.outputConnection.isDynamicShape){for(var a=0,b=0;b<this.rows.length;b++){var c=this.rows[b];c.yPos=a;a+=c.height}this.height=a;b=this.bottomRow.hasNextConnection?this.height-this.bottomRow.descenderHeight:this.height;a=this.outputConnection.shape.height(b);b=this.outputConnection.shape.width(b);this.outputConnection.height=a;this.outputConnection.width=b;this.outputConnection.startX=
b;this.outputConnection.connectionOffsetY=this.outputConnection.shape.connectionOffsetY(a);this.outputConnection.connectionOffsetX=this.outputConnection.shape.connectionOffsetX(b);c=0;this.hasStatementInput||this.bottomRow.hasNextConnection||(c=b,this.rightSide.height=a,this.rightSide.width=c,this.rightSide.centerline=a/2,this.rightSide.xPos=this.width+c);this.startX=b;this.width+=b+c;this.widthWithChildren+=b+c}};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.finalizeHorizontalAlignment_=function(){if(this.outputConnection&&!this.hasStatementInput&&!this.bottomRow.hasNextConnection){for(var a=0,b=0;b<this.rows.length;b++){var c=this.rows[b];if(module$exports$Blockly$blockRendering$Types.Types.isInputRow(c)){a=c.elements[c.elements.length-2];var d=this.getNegativeSpacing_(c.elements[1]),e=this.getNegativeSpacing_(a);a=d+e;var f=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-
a<f&&(a=this.width-f,d=a/2,e=a/2);c.elements.unshift(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,-d));c.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,-e))}}if(a)for(this.width-=a,this.widthWithChildren-=a,this.rightSide.xPos-=a,b=0;b<this.rows.length;b++)c=this.rows[b],module$exports$Blockly$blockRendering$Types.Types.isTopOrBottomRow(c)&&(c.elements[1].width-=a),c.width-=a,c.widthWithConnectedBlocks-=a}};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.getNegativeSpacing_=function(a){if(!a)return 0;var b=this.outputConnection.width,c=this.outputConnection.shape.type,d=this.constants_;if(this.isMultiRow&&1<this.inputRows.length)switch(c){case d.SHAPES.ROUND:return c=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,c=this.height/2>c?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.Types.isInlineInput(a)&&
a instanceof module$exports$Blockly$blockRendering$InputConnection.InputConnection){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.Types.isField(a)&&a instanceof module$exports$Blockly$blockRendering$Field.Field?c===d.SHAPES.ROUND&&a.field instanceof $.module$exports$Blockly$FieldTextInput.FieldTextInput?
b-2.75*d.GRID_UNIT:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][0]:module$exports$Blockly$blockRendering$Types.Types.isIcon(a)?this.constants_.SMALL_PADDING:0};
module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.finalizeVerticalAlignment_=function(){if(!this.outputConnection)for(var a=2;a<this.rows.length-1;a+=2){var b=this.rows[a-1],c=this.rows[a],d=this.rows[a+1],e=2===a,f=a+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!d.precedesStatement;if(e?this.topRow.hasPreviousConnection:b.followsStatement){var g=c.elements[1];g=3===c.elements.length&&g instanceof module$exports$Blockly$blockRendering$Field.Field&&(g.field instanceof $.module$exports$Blockly$FieldLabel.FieldLabel||
g.field instanceof $.module$exports$Blockly$FieldImage.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<c.elements.length;f++)if(g=c.elements[f],g instanceof module$exports$Blockly$blockRendering$InputConnection.InputConnection&&module$exports$Blockly$blockRendering$Types.Types.isInlineInput(g)&&g.connectedBlock&&!g.connectedBlock.isShadow()&&
40<=g.connectedBlock.getHeightWidth().height){e=!0;break}e&&(b.height-=this.constants_.SMALL_PADDING,d.height-=this.constants_.SMALL_PADDING)}}}};module$exports$Blockly$zelos$RenderInfo.RenderInfo.prototype.finalize_=function(){this.finalizeOutputConnection_();this.finalizeHorizontalAlignment_();this.finalizeVerticalAlignment_();module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.finalize_.call(this);this.rightSide&&(this.widthWithChildren+=this.rightSide.width)};var module$exports$Blockly$zelos$Renderer={Renderer:function(a){module$exports$Blockly$blockRendering$Renderer.Renderer.call(this,a)}};$.$jscomp.inherits(module$exports$Blockly$zelos$Renderer.Renderer,module$exports$Blockly$blockRendering$Renderer.Renderer);module$exports$Blockly$zelos$Renderer.Renderer.prototype.makeConstants_=function(){return new module$exports$Blockly$zelos$ConstantProvider.ConstantProvider};
module$exports$Blockly$zelos$Renderer.Renderer.prototype.makeRenderInfo_=function(a){return new module$exports$Blockly$zelos$RenderInfo.RenderInfo(this,a)};module$exports$Blockly$zelos$Renderer.Renderer.prototype.makeDrawer_=function(a,b){return new module$exports$Blockly$zelos$Drawer.Drawer(a,b)};module$exports$Blockly$zelos$Renderer.Renderer.prototype.makeMarkerDrawer=function(a,b){return new module$exports$Blockly$zelos$MarkerSvg.MarkerSvg(a,this.getConstants(),b)};
module$exports$Blockly$zelos$Renderer.Renderer.prototype.makePathObject=function(a,b){return new module$exports$Blockly$zelos$PathObject.PathObject(a,b,this.getConstants())};module$exports$Blockly$zelos$Renderer.Renderer.prototype.shouldHighlightConnection=function(a){return a.type!==$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE&&a.type!==$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE};
module$exports$Blockly$zelos$Renderer.Renderer.prototype.getConnectionPreviewMethod=function(a,b,c){return b.type===$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE?a.isConnected()?module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE:module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE:module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.getConnectionPreviewMethod.call(this,a,b,
c)};(0,module$exports$Blockly$blockRendering.register)("zelos",module$exports$Blockly$zelos$Renderer.Renderer);var module$exports$Blockly$zelos={};module$exports$Blockly$zelos.BottomRow=module$exports$Blockly$zelos$BottomRow.BottomRow;module$exports$Blockly$zelos.ConstantProvider=module$exports$Blockly$zelos$ConstantProvider.ConstantProvider;module$exports$Blockly$zelos.Drawer=module$exports$Blockly$zelos$Drawer.Drawer;module$exports$Blockly$zelos.MarkerSvg=module$exports$Blockly$zelos$MarkerSvg.MarkerSvg;module$exports$Blockly$zelos.PathObject=module$exports$Blockly$zelos$PathObject.PathObject;
module$exports$Blockly$zelos.RenderInfo=module$exports$Blockly$zelos$RenderInfo.RenderInfo;module$exports$Blockly$zelos.Renderer=module$exports$Blockly$zelos$Renderer.Renderer;module$exports$Blockly$zelos.RightConnectionShape=module$exports$Blockly$zelos$RightConnectionShape.RightConnectionShape;module$exports$Blockly$zelos.StatementInput=module$exports$Blockly$zelos$StatementInput.StatementInput;module$exports$Blockly$zelos.TopRow=module$exports$Blockly$zelos$TopRow.TopRow;var module$exports$Blockly$thrasos$RenderInfo={RenderInfo:function(a,b){module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.call(this,a,b)}};$.$jscomp.inherits(module$exports$Blockly$thrasos$RenderInfo.RenderInfo,module$exports$Blockly$blockRendering$RenderInfo.RenderInfo);module$exports$Blockly$thrasos$RenderInfo.RenderInfo.prototype.getRenderer=function(){return this.renderer_};
module$exports$Blockly$thrasos$RenderInfo.RenderInfo.prototype.addElemSpacing_=function(){for(var a=!1,b=0;b<this.rows.length;b++)if(this.rows[b].hasExternalInput){a=!0;break}for(b=0;b<this.rows.length;b++){var c=this.rows[b],d=c.elements;c.elements=[];c.startsWithElemSpacer()&&c.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,this.getInRowSpacing_(null,d[0])));for(var e=0;e<d.length-1;e++){c.elements.push(d[e]);var f=this.getInRowSpacing_(d[e],d[e+
1]);c.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,f))}c.elements.push(d[d.length-1]);c.endsWithElemSpacer()&&(d=this.getInRowSpacing_(d[d.length-1],null),a&&c.hasDummyInput&&(d+=this.constants_.TAB_WIDTH),c.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,d)))}};
module$exports$Blockly$thrasos$RenderInfo.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b&&module$exports$Blockly$blockRendering$Types.Types.isField(b)&&b.isEditable?this.constants_.MEDIUM_PADDING:b&&module$exports$Blockly$blockRendering$Types.Types.isInlineInput(b)?this.constants_.MEDIUM_LARGE_PADDING:b&&module$exports$Blockly$blockRendering$Types.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!module$exports$Blockly$blockRendering$Types.Types.isInput(a)&&
!b)return module$exports$Blockly$blockRendering$Types.Types.isField(a)&&a.isEditable?this.constants_.MEDIUM_PADDING:module$exports$Blockly$blockRendering$Types.Types.isIcon(a)?2*this.constants_.LARGE_PADDING+1:module$exports$Blockly$blockRendering$Types.Types.isHat(a)?this.constants_.NO_PADDING:module$exports$Blockly$blockRendering$Types.Types.isPreviousOrNextConnection(a)?this.constants_.LARGE_PADDING:module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(a)?this.constants_.MIN_BLOCK_WIDTH:
module$exports$Blockly$blockRendering$Types.Types.isJaggedEdge(a)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isInput(a)&&!b){if(module$exports$Blockly$blockRendering$Types.Types.isExternalInput(a))return this.constants_.NO_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isStatementInput(a))return this.constants_.NO_PADDING}if(!module$exports$Blockly$blockRendering$Types.Types.isInput(a)&&
b&&module$exports$Blockly$blockRendering$Types.Types.isInput(b)){if(module$exports$Blockly$blockRendering$Types.Types.isField(a)&&a.isEditable){if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(b)||module$exports$Blockly$blockRendering$Types.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(b)||module$exports$Blockly$blockRendering$Types.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;
if(module$exports$Blockly$blockRendering$Types.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(module$exports$Blockly$blockRendering$Types.Types.isIcon(a)&&b&&!module$exports$Blockly$blockRendering$Types.Types.isInput(b))return this.constants_.LARGE_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(a)&&b&&module$exports$Blockly$blockRendering$Types.Types.isField(b))return b.isEditable?this.constants_.MEDIUM_PADDING:
this.constants_.LARGE_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isLeftSquareCorner(a)&&b){if(module$exports$Blockly$blockRendering$Types.Types.isHat(b))return this.constants_.NO_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection(b)||module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b))return b.notchOffset}return module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(a)&&b?b.notchOffset-this.constants_.CORNER_RADIUS:
module$exports$Blockly$blockRendering$Types.Types.isField(a)&&b&&module$exports$Blockly$blockRendering$Types.Types.isField(b)&&a.isEditable===b.isEditable||b&&module$exports$Blockly$blockRendering$Types.Types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
module$exports$Blockly$thrasos$RenderInfo.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return module$exports$Blockly$blockRendering$Types.Types.isTopRow(a)&&module$exports$Blockly$blockRendering$Types.Types.isBottomRow(b)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:module$exports$Blockly$blockRendering$Types.Types.isTopRow(a)||module$exports$Blockly$blockRendering$Types.Types.isBottomRow(b)?this.constants_.NO_PADDING:a.hasExternalInput&&b.hasExternalInput?this.constants_.LARGE_PADDING:!a.hasStatement&&
b.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:a.hasStatement&&b.hasStatement||a.hasDummyInput||b.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
module$exports$Blockly$thrasos$RenderInfo.RenderInfo.prototype.getElemCenterline_=function(a,b){if(module$exports$Blockly$blockRendering$Types.Types.isSpacer(b))return a.yPos+b.height/2;if(module$exports$Blockly$blockRendering$Types.Types.isBottomRow(a))return a=a.yPos+a.height-a.descenderHeight,module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b)?a+b.height/2:a-b.height/2;if(module$exports$Blockly$blockRendering$Types.Types.isTopRow(a))return module$exports$Blockly$blockRendering$Types.Types.isHat(b)?
a.capline-b.height/2:a.capline+b.height/2;var c=a.yPos;return c=module$exports$Blockly$blockRendering$Types.Types.isField(b)&&a.hasStatement?c+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+b.height/2):c+a.height/2};
module$exports$Blockly$thrasos$RenderInfo.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0;c<this.rows.length;c++){var d=this.rows[c];d.yPos=b;d.xPos=this.startX;b+=d.height;a=Math.max(a,d.widthWithConnectedBlocks);var e=b-this.topRow.ascenderHeight;d===this.bottomRow&&e<this.constants_.MIN_BLOCK_HEIGHT&&(e=this.constants_.MIN_BLOCK_HEIGHT-e,this.bottomRow.height+=e,b+=e);this.recordElemPositions_(d)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&
(a=Math.max(a,this.block_.nextConnection.targetBlock().getHeightWidth().width));this.bottomRow.baseline=b-this.bottomRow.descenderHeight;this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.capline};var module$exports$Blockly$thrasos$Renderer={Renderer:function(a){module$exports$Blockly$blockRendering$Renderer.Renderer.call(this,a)}};$.$jscomp.inherits(module$exports$Blockly$thrasos$Renderer.Renderer,module$exports$Blockly$blockRendering$Renderer.Renderer);module$exports$Blockly$thrasos$Renderer.Renderer.prototype.makeRenderInfo_=function(a){return new module$exports$Blockly$thrasos$RenderInfo.RenderInfo(this,a)};(0,module$exports$Blockly$blockRendering.register)("thrasos",module$exports$Blockly$thrasos$Renderer.Renderer);var module$exports$Blockly$thrasos={};module$exports$Blockly$thrasos.RenderInfo=module$exports$Blockly$thrasos$RenderInfo.RenderInfo;module$exports$Blockly$thrasos.Renderer=module$exports$Blockly$thrasos$Renderer.Renderer;var module$exports$Blockly$serialization$workspaces={save:function(a){var b=Object.create(null),c=(0,module$exports$Blockly$registry.getAllItems)(module$exports$Blockly$registry.Type.SERIALIZER,!0),d;for(d in c){var e=c[d].save(a);e&&(b[d]=e)}return b},load:function(a,b,c){c=void 0===c?{}:c;var d=void 0===c.recordUndo?!1:c.recordUndo;if(c=(0,module$exports$Blockly$registry.getAllItems)(module$exports$Blockly$registry.Type.SERIALIZER,!0)){var e=Object.entries(c).sort(function(h,k){return k[1].priority-
h[1].priority});c=(0,module$exports$Blockly$Events$utils.getRecordUndo)();(0,module$exports$Blockly$Events$utils.setRecordUndo)(d);(d=(0,module$exports$Blockly$Events$utils.getGroup)())||(0,module$exports$Blockly$Events$utils.setGroup)(!0);(0,module$exports$Blockly$utils$dom.startTextWidthCache)();b instanceof module$exports$Blockly$WorkspaceSvg.WorkspaceSvg&&b.setResizesEnabled(!1);for(var f=$.$jscomp.makeIterator(e.reverse()),g=f.next();!g.done;g=f.next())g=$.$jscomp.makeIterator(g.value),g.next(),
g.next().value.clear(b);e=$.$jscomp.makeIterator(e.reverse());for(f=e.next();!f.done;f=e.next())g=$.$jscomp.makeIterator(f.value),f=g.next().value,g=g.next().value,a[f]&&g.load(a[f],b);b instanceof module$exports$Blockly$WorkspaceSvg.WorkspaceSvg&&b.setResizesEnabled(!0);(0,module$exports$Blockly$utils$dom.stopTextWidthCache)();(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.FINISHED_LOADING))(b));(0,module$exports$Blockly$Events$utils.setGroup)(d);
(0,module$exports$Blockly$Events$utils.setRecordUndo)(c)}}};var module$exports$Blockly$serialization$variables={},module$contents$Blockly$serialization$variables_VariableSerializer=function(){this.priority=module$exports$Blockly$serialization$priorities.VARIABLES};module$contents$Blockly$serialization$variables_VariableSerializer.prototype.save=function(a){var b=[];a=$.$jscomp.makeIterator(a.getAllVariables());for(var c=a.next();!c.done;c=a.next()){c=c.value;var d={name:c.name,id:c.getId()};c.type&&(d.type=c.type);b.push(d)}return b.length?b:null};
module$contents$Blockly$serialization$variables_VariableSerializer.prototype.load=function(a,b){a=$.$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next())c=c.value,b.createVariable(c.name,c.type,c.id)};module$contents$Blockly$serialization$variables_VariableSerializer.prototype.clear=function(a){a.getVariableMap().clear()};(0,module$exports$Blockly$serialization$registry.register)("variables",new module$contents$Blockly$serialization$variables_VariableSerializer);var module$exports$Blockly$minimalist$ConstantProvider={ConstantProvider:function(){module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.call(this)}};$.$jscomp.inherits(module$exports$Blockly$minimalist$ConstantProvider.ConstantProvider,module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider);var module$exports$Blockly$minimalist$Drawer={Drawer:function(a,b){module$exports$Blockly$blockRendering$Drawer.Drawer.call(this,a,b)}};$.$jscomp.inherits(module$exports$Blockly$minimalist$Drawer.Drawer,module$exports$Blockly$blockRendering$Drawer.Drawer);var module$exports$Blockly$minimalist$RenderInfo={RenderInfo:function(a,b){module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.call(this,a,b)}};$.$jscomp.inherits(module$exports$Blockly$minimalist$RenderInfo.RenderInfo,module$exports$Blockly$blockRendering$RenderInfo.RenderInfo);module$exports$Blockly$minimalist$RenderInfo.RenderInfo.prototype.getRenderer=function(){return this.renderer_};var module$exports$Blockly$minimalist$Renderer={Renderer:function(a){module$exports$Blockly$blockRendering$Renderer.Renderer.call(this,a)}};$.$jscomp.inherits(module$exports$Blockly$minimalist$Renderer.Renderer,module$exports$Blockly$blockRendering$Renderer.Renderer);module$exports$Blockly$minimalist$Renderer.Renderer.prototype.makeConstants_=function(){return new module$exports$Blockly$minimalist$ConstantProvider.ConstantProvider};
module$exports$Blockly$minimalist$Renderer.Renderer.prototype.makeRenderInfo_=function(a){return new module$exports$Blockly$minimalist$RenderInfo.RenderInfo(this,a)};module$exports$Blockly$minimalist$Renderer.Renderer.prototype.makeDrawer_=function(a,b){return new module$exports$Blockly$minimalist$Drawer.Drawer(a,b)};(0,module$exports$Blockly$blockRendering.register)("minimalist",module$exports$Blockly$minimalist$Renderer.Renderer);var module$exports$Blockly$minimalist={};module$exports$Blockly$minimalist.ConstantProvider=module$exports$Blockly$minimalist$ConstantProvider.ConstantProvider;module$exports$Blockly$minimalist.Drawer=module$exports$Blockly$minimalist$Drawer.Drawer;module$exports$Blockly$minimalist.RenderInfo=module$exports$Blockly$minimalist$RenderInfo.RenderInfo;module$exports$Blockly$minimalist.Renderer=module$exports$Blockly$minimalist$Renderer.Renderer;var module$exports$Blockly$geras$StatementInput={StatementInput:function(a,b){module$exports$Blockly$blockRendering$StatementInput.StatementInput.call(this,a,b);this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}};$.$jscomp.inherits(module$exports$Blockly$geras$StatementInput.StatementInput,module$exports$Blockly$blockRendering$StatementInput.StatementInput);var module$exports$Blockly$geras$PathObject={PathObject:function(a,b,c){module$exports$Blockly$blockRendering$PathObject.PathObject.call(this,a,b,c);this.constants=c;this.svgPathDark=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,{"class":"blocklyPathDark",transform:"translate(1,1)"});this.svgRoot.insertBefore(this.svgPathDark,this.svgPath);this.svgPathLight=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.PATH,
{"class":"blocklyPathLight"},this.svgRoot);this.colourDark="#000000"}};$.$jscomp.inherits(module$exports$Blockly$geras$PathObject.PathObject,module$exports$Blockly$blockRendering$PathObject.PathObject);module$exports$Blockly$geras$PathObject.PathObject.prototype.setPath=function(a){this.svgPath.setAttribute("d",a);this.svgPathDark.setAttribute("d",a)};module$exports$Blockly$geras$PathObject.PathObject.prototype.setHighlightPath=function(a){this.svgPathLight.setAttribute("d",a)};
module$exports$Blockly$geras$PathObject.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.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$blockRendering$PathObject.PathObject.prototype.applyColour.call(this,a);this.svgPath.setAttribute("stroke","none")};
module$exports$Blockly$geras$PathObject.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.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.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.PathObject.prototype.updateDisabled_=function(a){module$exports$Blockly$blockRendering$PathObject.PathObject.prototype.updateDisabled_.call(this,a);a&&this.svgPath.setAttribute("stroke","none")};var module$exports$Blockly$geras$ConstantProvider={ConstantProvider:function(){module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.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}};$.$jscomp.inherits(module$exports$Blockly$geras$ConstantProvider.ConstantProvider,module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider);
module$exports$Blockly$geras$ConstantProvider.ConstantProvider.prototype.getCSS_=function(a){return module$exports$Blockly$blockRendering$ConstantProvider.ConstantProvider.prototype.getCSS_.call(this,a).concat([a+" .blocklyInsertionMarker>.blocklyPathLight,",a+" .blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"])};var module$exports$Blockly$geras$InlineInput={InlineInput:function(a,b){module$exports$Blockly$blockRendering$InlineInput.InlineInput.call(this,a,b);this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)}};$.$jscomp.inherits(module$exports$Blockly$geras$InlineInput.InlineInput,module$exports$Blockly$blockRendering$InlineInput.InlineInput);var module$exports$Blockly$geras$Highlighter={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.Highlighter.prototype.getPath=function(){return this.steps_+"\n"+this.inlineSteps_};
module$exports$Blockly$geras$Highlighter.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.Types.isLeftSquareCorner(c)?this.steps_+=this.highlightConstants_.START_POINT:module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(c)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection(c)?
this.steps_+=this.notchPaths_.pathLeft:module$exports$Blockly$blockRendering$Types.Types.isHat(c)?this.steps_+=this.startPaths_.path(this.RTL_):module$exports$Blockly$blockRendering$Types.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.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.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.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.Highlighter.prototype.drawRightSideRow=function(a){var b=a.xPos+a.width-this.highlightOffset_;a instanceof module$exports$Blockly$blockRendering$SpacerRow.SpacerRow&&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.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.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.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.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.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.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={Drawer:function(a,b){module$exports$Blockly$blockRendering$Drawer.Drawer.call(this,a,b);this.highlighter_=new module$exports$Blockly$geras$Highlighter.Highlighter(b)}};$.$jscomp.inherits(module$exports$Blockly$geras$Drawer.Drawer,module$exports$Blockly$blockRendering$Drawer.Drawer);
module$exports$Blockly$geras$Drawer.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.Drawer.prototype.drawTop_=function(){this.highlighter_.drawTopCorner(this.info_.topRow);this.highlighter_.drawRightSideRow(this.info_.topRow);module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawTop_.call(this)};module$exports$Blockly$geras$Drawer.Drawer.prototype.drawJaggedEdge_=function(a){this.highlighter_.drawJaggedEdge_(a);module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawJaggedEdge_.call(this,a)};
module$exports$Blockly$geras$Drawer.Drawer.prototype.drawValueInput_=function(a){this.highlighter_.drawValueInput(a);module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawValueInput_.call(this,a)};module$exports$Blockly$geras$Drawer.Drawer.prototype.drawStatementInput_=function(a){this.highlighter_.drawStatementInput(a);module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawStatementInput_.call(this,a)};
module$exports$Blockly$geras$Drawer.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.Drawer.prototype.drawBottom_=function(){this.highlighter_.drawBottomRow(this.info_.bottomRow);module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawBottom_.call(this)};
module$exports$Blockly$geras$Drawer.Drawer.prototype.drawLeft_=function(){this.highlighter_.drawLeft();module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawLeft_.call(this)};module$exports$Blockly$geras$Drawer.Drawer.prototype.drawInlineInput_=function(a){this.highlighter_.drawInlineInput(a);module$exports$Blockly$blockRendering$Drawer.Drawer.prototype.drawInlineInput_.call(this,a)};
module$exports$Blockly$geras$Drawer.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.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.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.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={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.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.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.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.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.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.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.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$RenderInfo={RenderInfo:function(a,b){module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.call(this,a,b)}};$.$jscomp.inherits(module$exports$Blockly$geras$RenderInfo.RenderInfo,module$exports$Blockly$blockRendering$RenderInfo.RenderInfo);module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.getRenderer=function(){return this.renderer_};
module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.populateBottomRow_=function(){module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.populateBottomRow_.call(this);this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)};
module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.addInput_=function(a,b){this.isInline&&a.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE?(b.elements.push(new module$exports$Blockly$geras$InlineInput.InlineInput(this.constants_,a)),b.hasInlineInput=!0):a.type===$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT?(b.elements.push(new module$exports$Blockly$geras$StatementInput.StatementInput(this.constants_,a)),b.hasStatement=!0):a.type===$.module$exports$Blockly$inputTypes.inputTypes.VALUE?
(b.elements.push(new module$exports$Blockly$blockRendering$ExternalValueInput.ExternalValueInput(this.constants_,a)),b.hasExternalInput=!0):a.type===$.module$exports$Blockly$inputTypes.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.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.InRowSpacer(this.constants_,this.getInRowSpacing_(null,d[0])));if(d.length){for(var e=0;e<d.length-1;e++){c.elements.push(d[e]);var f=this.getInRowSpacing_(d[e],d[e+1]);c.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,
f))}c.elements.push(d[d.length-1]);c.endsWithElemSpacer()&&(d=this.getInRowSpacing_(d[d.length-1],null),a&&c.hasDummyInput&&(d+=this.constants_.TAB_WIDTH),c.elements.push(new module$exports$Blockly$blockRendering$InRowSpacer.InRowSpacer(this.constants_,d)))}}};
module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a)return b&&module$exports$Blockly$blockRendering$Types.Types.isField(b)&&b.isEditable?this.constants_.MEDIUM_PADDING:b&&module$exports$Blockly$blockRendering$Types.Types.isInlineInput(b)?this.constants_.MEDIUM_LARGE_PADDING:b&&module$exports$Blockly$blockRendering$Types.Types.isStatementInput(b)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!module$exports$Blockly$blockRendering$Types.Types.isInput(a)&&
(!b||module$exports$Blockly$blockRendering$Types.Types.isStatementInput(b)))return module$exports$Blockly$blockRendering$Types.Types.isField(a)&&a.isEditable?this.constants_.MEDIUM_PADDING:module$exports$Blockly$blockRendering$Types.Types.isIcon(a)?2*this.constants_.LARGE_PADDING+1:module$exports$Blockly$blockRendering$Types.Types.isHat(a)?this.constants_.NO_PADDING:module$exports$Blockly$blockRendering$Types.Types.isPreviousOrNextConnection(a)?this.constants_.LARGE_PADDING:module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(a)?
this.constants_.MIN_BLOCK_WIDTH:module$exports$Blockly$blockRendering$Types.Types.isJaggedEdge(a)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isInput(a)&&!b){if(module$exports$Blockly$blockRendering$Types.Types.isExternalInput(a))return this.constants_.NO_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isStatementInput(a))return this.constants_.NO_PADDING}if(!module$exports$Blockly$blockRendering$Types.Types.isInput(a)&&
b&&module$exports$Blockly$blockRendering$Types.Types.isInput(b)){if(module$exports$Blockly$blockRendering$Types.Types.isField(a)&&a.isEditable){if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(b)||module$exports$Blockly$blockRendering$Types.Types.isExternalInput(b))return this.constants_.SMALL_PADDING}else{if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(b)||module$exports$Blockly$blockRendering$Types.Types.isExternalInput(b))return this.constants_.MEDIUM_LARGE_PADDING;
if(module$exports$Blockly$blockRendering$Types.Types.isStatementInput(b))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(module$exports$Blockly$blockRendering$Types.Types.isIcon(a)&&b&&!module$exports$Blockly$blockRendering$Types.Types.isInput(b))return this.constants_.LARGE_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isInlineInput(a)&&b&&module$exports$Blockly$blockRendering$Types.Types.isField(b))return b.isEditable?this.constants_.MEDIUM_PADDING:
this.constants_.LARGE_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isLeftSquareCorner(a)&&b){if(module$exports$Blockly$blockRendering$Types.Types.isHat(b))return this.constants_.NO_PADDING;if(module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection(b))return b.notchOffset;if(module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b))return b.notchOffset+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}if(module$exports$Blockly$blockRendering$Types.Types.isLeftRoundedCorner(a)&&
b){if(module$exports$Blockly$blockRendering$Types.Types.isPreviousConnection(b))return b.notchOffset-this.constants_.CORNER_RADIUS;if(module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b))return b.notchOffset-this.constants_.CORNER_RADIUS+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}return module$exports$Blockly$blockRendering$Types.Types.isField(a)&&b&&module$exports$Blockly$blockRendering$Types.Types.isField(b)&&a.isEditable===b.isEditable||b&&module$exports$Blockly$blockRendering$Types.Types.isJaggedEdge(b)?
this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.getSpacerRowHeight_=function(a,b){return module$exports$Blockly$blockRendering$Types.Types.isTopRow(a)&&module$exports$Blockly$blockRendering$Types.Types.isBottomRow(b)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:module$exports$Blockly$blockRendering$Types.Types.isTopRow(a)||module$exports$Blockly$blockRendering$Types.Types.isBottomRow(b)?this.constants_.NO_PADDING:a.hasExternalInput&&b.hasExternalInput?this.constants_.LARGE_PADDING:!a.hasStatement&&
b.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:a.hasStatement&&b.hasStatement||!a.hasStatement&&b.hasDummyInput||a.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING};
module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.getElemCenterline_=function(a,b){if(module$exports$Blockly$blockRendering$Types.Types.isSpacer(b))return a.yPos+b.height/2;if(module$exports$Blockly$blockRendering$Types.Types.isBottomRow(a))return a=a.yPos+a.height-a.descenderHeight,module$exports$Blockly$blockRendering$Types.Types.isNextConnection(b)?a+b.height/2:a-b.height/2;if(module$exports$Blockly$blockRendering$Types.Types.isTopRow(a))return module$exports$Blockly$blockRendering$Types.Types.isHat(b)?
a.capline-b.height/2:a.capline+b.height/2;var c=a.yPos;module$exports$Blockly$blockRendering$Types.Types.isField(b)||module$exports$Blockly$blockRendering$Types.Types.isIcon(b)?(c+=b.height/2,(a.hasInlineInput||a.hasStatement)&&b.height+this.constants_.TALL_INPUT_FIELD_OFFSET_Y<=a.height&&(c+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y)):c=module$exports$Blockly$blockRendering$Types.Types.isInlineInput(b)?c+b.height/2:c+a.height/2;return c};
module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.alignRowElements_=function(){if(this.isInline){for(var a=0,b=new WeakMap,c=null,d=this.rows.length-1,e;e=this.rows[d];d--)b.set(e,a),module$exports$Blockly$blockRendering$Types.Types.isInputRow(e)&&(e.hasStatement&&this.alignStatementRow_(e),c&&c.hasStatement&&e.width<c.width?b.set(e,c.width):a=e.width,c=e);for(a=d=0;c=this.rows[a];a++)c.hasStatement?d=this.getDesiredRowWidth_(c):module$exports$Blockly$blockRendering$Types.Types.isSpacer(c)?
c.width=Math.max(d,b.get(c)):(e=c.width,d=Math.max(d,b.get(c))-e,0<d&&this.addAlignmentPadding_(c,d),d=c.width)}else module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.alignRowElements_.call(this)};
module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.getDesiredRowWidth_=function(a){return this.isInline&&a.hasStatement?this.statementEdge+this.constants_.MAX_BOTTOM_WIDTH+this.startX:module$exports$Blockly$blockRendering$RenderInfo.RenderInfo.prototype.getDesiredRowWidth_.call(this,a)};
module$exports$Blockly$geras$RenderInfo.RenderInfo.prototype.finalize_=function(){for(var a=0,b=0,c=0,d;d=this.rows[c];c++){d.yPos=b;d.xPos=this.startX;b+=d.height;a=Math.max(a,d.widthWithConnectedBlocks);var e=b-this.topRow.ascenderHeight;d===this.bottomRow&&e<this.constants_.MIN_BLOCK_HEIGHT&&(e=this.constants_.MIN_BLOCK_HEIGHT-e,this.bottomRow.height+=e,b+=e);this.recordElemPositions_(d)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(a=Math.max(a,
this.block_.nextConnection.targetBlock().getHeightWidth().width-this.constants_.DARK_PATH_OFFSET));this.bottomRow.baseline=b-this.bottomRow.descenderHeight;this.widthWithChildren=a+this.startX+this.constants_.DARK_PATH_OFFSET;this.width+=this.constants_.DARK_PATH_OFFSET;this.height=b+this.constants_.DARK_PATH_OFFSET;this.startY=this.topRow.capline};var module$exports$Blockly$geras$Renderer={Renderer:function(a){module$exports$Blockly$blockRendering$Renderer.Renderer.call(this,a);this.highlightConstants_=null}};$.$jscomp.inherits(module$exports$Blockly$geras$Renderer.Renderer,module$exports$Blockly$blockRendering$Renderer.Renderer);
module$exports$Blockly$geras$Renderer.Renderer.prototype.init=function(a,b){module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.init.call(this,a,b);this.highlightConstants_=this.makeHighlightConstants_();this.highlightConstants_.init()};module$exports$Blockly$geras$Renderer.Renderer.prototype.refreshDom=function(a,b){module$exports$Blockly$blockRendering$Renderer.Renderer.prototype.refreshDom.call(this,a,b);this.getHighlightConstants().init()};
module$exports$Blockly$geras$Renderer.Renderer.prototype.makeConstants_=function(){return new module$exports$Blockly$geras$ConstantProvider.ConstantProvider};module$exports$Blockly$geras$Renderer.Renderer.prototype.makeRenderInfo_=function(a){return new module$exports$Blockly$geras$RenderInfo.RenderInfo(this,a)};module$exports$Blockly$geras$Renderer.Renderer.prototype.makeDrawer_=function(a,b){return new module$exports$Blockly$geras$Drawer.Drawer(a,b)};
module$exports$Blockly$geras$Renderer.Renderer.prototype.makePathObject=function(a,b){return new module$exports$Blockly$geras$PathObject.PathObject(a,b,this.getConstants())};module$exports$Blockly$geras$Renderer.Renderer.prototype.makeHighlightConstants_=function(){return new module$exports$Blockly$geras$HighlightConstantProvider.HighlightConstantProvider(this.getConstants())};module$exports$Blockly$geras$Renderer.Renderer.prototype.getHighlightConstants=function(){return this.highlightConstants_};
(0,module$exports$Blockly$blockRendering.register)("geras",module$exports$Blockly$geras$Renderer.Renderer);var module$exports$Blockly$geras={};module$exports$Blockly$geras.ConstantProvider=module$exports$Blockly$geras$ConstantProvider.ConstantProvider;module$exports$Blockly$geras.Drawer=module$exports$Blockly$geras$Drawer.Drawer;module$exports$Blockly$geras.HighlightConstantProvider=module$exports$Blockly$geras$HighlightConstantProvider.HighlightConstantProvider;module$exports$Blockly$geras.Highlighter=module$exports$Blockly$geras$Highlighter.Highlighter;module$exports$Blockly$geras.InlineInput=module$exports$Blockly$geras$InlineInput.InlineInput;
module$exports$Blockly$geras.PathObject=module$exports$Blockly$geras$PathObject.PathObject;module$exports$Blockly$geras.RenderInfo=module$exports$Blockly$geras$RenderInfo.RenderInfo;module$exports$Blockly$geras.Renderer=module$exports$Blockly$geras$Renderer.Renderer;module$exports$Blockly$geras.StatementInput=module$exports$Blockly$geras$StatementInput.StatementInput;var module$exports$Blockly$Themes$Zelos={},module$contents$Blockly$Themes$Zelos_defaultBlockStyles={colour_blocks:{colourPrimary:"#CF63CF",colourSecondary:"#C94FC9",colourTertiary:"#BD42BD"},list_blocks:{colourPrimary:"#9966FF",colourSecondary:"#855CD6",colourTertiary:"#774DCB"},logic_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC"},loop_blocks:{colourPrimary:"#0fBD8C",colourSecondary:"#0DA57A",colourTertiary:"#0B8E69"},math_blocks:{colourPrimary:"#59C059",colourSecondary:"#46B946",
colourTertiary:"#389438"},procedure_blocks:{colourPrimary:"#FF6680",colourSecondary:"#FF4D6A",colourTertiary:"#FF3355"},text_blocks:{colourPrimary:"#FFBF00",colourSecondary:"#E6AC00",colourTertiary:"#CC9900"},variable_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},variable_dynamic_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},hat_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC",hat:"cap"}},
module$contents$Blockly$Themes$Zelos_categoryStyles={colour_category:{colour:"#CF63CF"},list_category:{colour:"#9966FF"},logic_category:{colour:"#4C97FF"},loop_category:{colour:"#0fBD8C"},math_category:{colour:"#59C059"},procedure_category:{colour:"#FF6680"},text_category:{colour:"#FFBF00"},variable_category:{colour:"#FF8C1A"},variable_dynamic_category:{colour:"#FF8C1A"}};
module$exports$Blockly$Themes$Zelos.Zelos=new module$exports$Blockly$Theme.Theme("zelos",module$contents$Blockly$Themes$Zelos_defaultBlockStyles,module$contents$Blockly$Themes$Zelos_categoryStyles);var module$exports$Blockly$Themes={};module$exports$Blockly$Themes.Classic=module$exports$Blockly$Themes$Classic.Classic;module$exports$Blockly$Themes.Zelos=module$exports$Blockly$Themes$Zelos.Zelos;var module$exports$Blockly$ShortcutItems={names:{ESCAPE:"escape",DELETE:"delete",COPY:"copy",CUT:"cut",PASTE:"paste",UNDO:"undo",REDO:"redo"},registerEscape:function(){var a={name:module$exports$Blockly$ShortcutItems.names.ESCAPE,preconditionFn:function(b){return!b.options.readOnly},callback:function(b){b.hideChaff();return!0}};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.register(a);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(module$exports$Blockly$utils$KeyCodes.KeyCodes.ESC,
a.name)},registerDelete:function(){var a={name:module$exports$Blockly$ShortcutItems.names.DELETE,preconditionFn:function(b){var c=(0,$.module$exports$Blockly$common.getSelected)();return!b.options.readOnly&&c&&c.isDeletable()},callback:function(b,c){c.preventDefault();if(module$exports$Blockly$Gesture.Gesture.inProgress())return!1;(0,$.module$exports$Blockly$common.getSelected)().checkAndDelete();return!0}};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.register(a);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(module$exports$Blockly$utils$KeyCodes.KeyCodes.DELETE,
a.name);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(module$exports$Blockly$utils$KeyCodes.KeyCodes.BACKSPACE,a.name)},registerCopy:function(){var a={name:module$exports$Blockly$ShortcutItems.names.COPY,preconditionFn:function(c){var d=(0,$.module$exports$Blockly$common.getSelected)();return!c.options.readOnly&&!module$exports$Blockly$Gesture.Gesture.inProgress()&&d&&d.isDeletable()&&d.isMovable()},callback:function(c,d){d.preventDefault();c.hideChaff();(0,module$exports$Blockly$clipboard.copy)((0,$.module$exports$Blockly$common.getSelected)());
return!0}};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.register(a);var b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.C,[module$exports$Blockly$utils$KeyCodes.KeyCodes.CTRL]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.C,
[module$exports$Blockly$utils$KeyCodes.KeyCodes.ALT]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.C,[module$exports$Blockly$utils$KeyCodes.KeyCodes.META]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name)},registerCut:function(){var a={name:module$exports$Blockly$ShortcutItems.names.CUT,
preconditionFn:function(c){var d=(0,$.module$exports$Blockly$common.getSelected)();return!c.options.readOnly&&!module$exports$Blockly$Gesture.Gesture.inProgress()&&d&&d.isDeletable()&&d.isMovable()&&!d.workspace.isFlyout},callback:function(){var c=(0,$.module$exports$Blockly$common.getSelected)();if(!c)return!1;(0,module$exports$Blockly$clipboard.copy)(c);c.checkAndDelete();return!0}};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.register(a);var b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.X,
[module$exports$Blockly$utils$KeyCodes.KeyCodes.CTRL]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.X,[module$exports$Blockly$utils$KeyCodes.KeyCodes.ALT]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.X,
[module$exports$Blockly$utils$KeyCodes.KeyCodes.META]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name)},registerPaste:function(){var a={name:module$exports$Blockly$ShortcutItems.names.PASTE,preconditionFn:function(c){return!c.options.readOnly&&!module$exports$Blockly$Gesture.Gesture.inProgress()},callback:function(){return(0,module$exports$Blockly$clipboard.paste)()}};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.register(a);var b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.V,
[module$exports$Blockly$utils$KeyCodes.KeyCodes.CTRL]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.V,[module$exports$Blockly$utils$KeyCodes.KeyCodes.ALT]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.V,
[module$exports$Blockly$utils$KeyCodes.KeyCodes.META]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name)},registerUndo:function(){var a={name:module$exports$Blockly$ShortcutItems.names.UNDO,preconditionFn:function(c){return!c.options.readOnly&&!module$exports$Blockly$Gesture.Gesture.inProgress()},callback:function(c){c.hideChaff();c.undo(!1);return!0}};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.register(a);var b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.Z,
[module$exports$Blockly$utils$KeyCodes.KeyCodes.CTRL]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.Z,[module$exports$Blockly$utils$KeyCodes.KeyCodes.ALT]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.Z,
[module$exports$Blockly$utils$KeyCodes.KeyCodes.META]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name)},registerRedo:function(){var a={name:module$exports$Blockly$ShortcutItems.names.REDO,preconditionFn:function(c){return!module$exports$Blockly$Gesture.Gesture.inProgress()&&!c.options.readOnly},callback:function(c){c.hideChaff();c.undo(!0);return!0}};module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.register(a);var b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.Z,
[module$exports$Blockly$utils$KeyCodes.KeyCodes.SHIFT,module$exports$Blockly$utils$KeyCodes.KeyCodes.CTRL]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.Z,[module$exports$Blockly$utils$KeyCodes.KeyCodes.SHIFT,module$exports$Blockly$utils$KeyCodes.KeyCodes.ALT]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,
a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.Z,[module$exports$Blockly$utils$KeyCodes.KeyCodes.SHIFT,module$exports$Blockly$utils$KeyCodes.KeyCodes.META]);module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name);b=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.createSerializedKey(module$exports$Blockly$utils$KeyCodes.KeyCodes.Y,[module$exports$Blockly$utils$KeyCodes.KeyCodes.CTRL]);
module$exports$Blockly$ShortcutRegistry.ShortcutRegistry.registry.addKeyMapping(b,a.name)},registerDefaultShortcuts:function(){(0,module$exports$Blockly$ShortcutItems.registerEscape)();(0,module$exports$Blockly$ShortcutItems.registerDelete)();(0,module$exports$Blockly$ShortcutItems.registerCopy)();(0,module$exports$Blockly$ShortcutItems.registerCut)();(0,module$exports$Blockly$ShortcutItems.registerPaste)();(0,module$exports$Blockly$ShortcutItems.registerUndo)();(0,module$exports$Blockly$ShortcutItems.registerRedo)()}};
(0,module$exports$Blockly$ShortcutItems.registerDefaultShortcuts)();var module$exports$Blockly$Events$FinishedLoading={FinishedLoading:function(a){module$exports$Blockly$Events$Abstract.Abstract.call(this);this.isBlank="undefined"===typeof a;this.workspaceId=a?a.id:"";this.recordUndo=!1;this.type=module$exports$Blockly$Events$utils.FINISHED_LOADING}};$.$jscomp.inherits(module$exports$Blockly$Events$FinishedLoading.FinishedLoading,module$exports$Blockly$Events$Abstract.Abstract);
module$exports$Blockly$Events$FinishedLoading.FinishedLoading.prototype.toJson=function(){var a={type:this.type};this.group&&(a.group=this.group);this.workspaceId&&(a.workspaceId=this.workspaceId);return a};module$exports$Blockly$Events$FinishedLoading.FinishedLoading.prototype.fromJson=function(a){this.isBlank=!1;this.workspaceId=a.workspaceId;this.group=a.group};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.FINISHED_LOADING,module$exports$Blockly$Events$FinishedLoading.FinishedLoading);var module$exports$Blockly$Events$Ui={Ui:function(a,b,c,d){module$exports$Blockly$Events$UiBase.UiBase.call(this,a?a.workspace.id:void 0);this.blockId=a?a.id:null;this.element="undefined"===typeof b?"":b;this.oldValue="undefined"===typeof c?"":c;this.newValue="undefined"===typeof d?"":d;this.type=module$exports$Blockly$Events$utils.UI}};$.$jscomp.inherits(module$exports$Blockly$Events$Ui.Ui,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$Ui.Ui.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.blockId&&(a.blockId=this.blockId);return a};module$exports$Blockly$Events$Ui.Ui.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.fromJson.call(this,a);this.element=a.element;this.newValue=a.newValue;this.blockId=a.blockId};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.UI,module$exports$Blockly$Events$Ui.Ui);var module$exports$Blockly$Events$BubbleOpen={BubbleOpen:function(a,b,c){module$exports$Blockly$Events$UiBase.UiBase.call(this,a?a.workspace.id:void 0);this.blockId=a?a.id:null;this.isOpen=b;this.bubbleType=c;this.type=module$exports$Blockly$Events$utils.BUBBLE_OPEN}};$.$jscomp.inherits(module$exports$Blockly$Events$BubbleOpen.BubbleOpen,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$BubbleOpen.BubbleOpen.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.isOpen=this.isOpen;a.bubbleType=this.bubbleType;a.blockId=this.blockId;return a};module$exports$Blockly$Events$BubbleOpen.BubbleOpen.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.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.BubbleOpen);var module$exports$Blockly$Events$CommentChange={CommentChange:function(a,b,c){module$exports$Blockly$Events$CommentBase.CommentBase.call(this,a);this.type=module$exports$Blockly$Events$utils.COMMENT_CHANGE;a&&(this.oldContents_="undefined"===typeof b?"":b,this.newContents_="undefined"===typeof c?"":c)}};$.$jscomp.inherits(module$exports$Blockly$Events$CommentChange.CommentChange,module$exports$Blockly$Events$CommentBase.CommentBase);
module$exports$Blockly$Events$CommentChange.CommentChange.prototype.toJson=function(){var a=module$exports$Blockly$Events$CommentBase.CommentBase.prototype.toJson.call(this);a.oldContents=this.oldContents_;a.newContents=this.newContents_;return a};module$exports$Blockly$Events$CommentChange.CommentChange.prototype.fromJson=function(a){module$exports$Blockly$Events$CommentBase.CommentBase.prototype.fromJson.call(this,a);this.oldContents_=a.oldContents;this.newContents_=a.newContents};
module$exports$Blockly$Events$CommentChange.CommentChange.prototype.isNull=function(){return this.oldContents_===this.newContents_};module$exports$Blockly$Events$CommentChange.CommentChange.prototype.run=function(a){var b=this.getEventWorkspace_().getCommentById(this.commentId);b?b.setContent(a?this.newContents_:this.oldContents_):console.warn("Can't change non-existent comment: "+this.commentId)};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.COMMENT_CHANGE,module$exports$Blockly$Events$CommentChange.CommentChange);var module$exports$Blockly$Events$CommentCreate={CommentCreate:function(a){module$exports$Blockly$Events$CommentBase.CommentBase.call(this,a);this.type=module$exports$Blockly$Events$utils.COMMENT_CREATE;a&&(this.xml=a.toXmlWithXY())}};$.$jscomp.inherits(module$exports$Blockly$Events$CommentCreate.CommentCreate,module$exports$Blockly$Events$CommentBase.CommentBase);
module$exports$Blockly$Events$CommentCreate.CommentCreate.prototype.toJson=function(){var a=module$exports$Blockly$Events$CommentBase.CommentBase.prototype.toJson.call(this);a.xml=(0,$.module$exports$Blockly$Xml.domToText)(this.xml);return a};module$exports$Blockly$Events$CommentCreate.CommentCreate.prototype.fromJson=function(a){module$exports$Blockly$Events$CommentBase.CommentBase.prototype.fromJson.call(this,a);this.xml=(0,$.module$exports$Blockly$Xml.textToDom)(a.xml)};
module$exports$Blockly$Events$CommentCreate.CommentCreate.prototype.run=function(a){module$exports$Blockly$Events$CommentBase.CommentBase.CommentCreateDeleteHelper(this,a)};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.COMMENT_CREATE,module$exports$Blockly$Events$CommentCreate.CommentCreate);var module$exports$Blockly$Events$CommentDelete={CommentDelete:function(a){module$exports$Blockly$Events$CommentBase.CommentBase.call(this,a);this.type=module$exports$Blockly$Events$utils.COMMENT_DELETE;a&&(this.xml=a.toXmlWithXY())}};$.$jscomp.inherits(module$exports$Blockly$Events$CommentDelete.CommentDelete,module$exports$Blockly$Events$CommentBase.CommentBase);module$exports$Blockly$Events$CommentDelete.CommentDelete.prototype.toJson=function(){return module$exports$Blockly$Events$CommentBase.CommentBase.prototype.toJson.call(this)};
module$exports$Blockly$Events$CommentDelete.CommentDelete.prototype.fromJson=function(a){module$exports$Blockly$Events$CommentBase.CommentBase.prototype.fromJson.call(this,a)};module$exports$Blockly$Events$CommentDelete.CommentDelete.prototype.run=function(a){module$exports$Blockly$Events$CommentBase.CommentBase.CommentCreateDeleteHelper(this,!a)};(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.COMMENT_DELETE,module$exports$Blockly$Events$CommentDelete.CommentDelete);var module$exports$Blockly$Events$TrashcanOpen={TrashcanOpen:function(a,b){module$exports$Blockly$Events$UiBase.UiBase.call(this,b);this.isOpen=a;this.type=module$exports$Blockly$Events$utils.TRASHCAN_OPEN}};$.$jscomp.inherits(module$exports$Blockly$Events$TrashcanOpen.TrashcanOpen,module$exports$Blockly$Events$UiBase.UiBase);
module$exports$Blockly$Events$TrashcanOpen.TrashcanOpen.prototype.toJson=function(){var a=module$exports$Blockly$Events$UiBase.UiBase.prototype.toJson.call(this);a.isOpen=this.isOpen;return a};module$exports$Blockly$Events$TrashcanOpen.TrashcanOpen.prototype.fromJson=function(a){module$exports$Blockly$Events$UiBase.UiBase.prototype.fromJson.call(this,a);this.isOpen=a.isOpen};
(0,module$exports$Blockly$registry.register)(module$exports$Blockly$registry.Type.EVENT,module$exports$Blockly$Events$utils.TRASHCAN_OPEN,module$exports$Blockly$Events$TrashcanOpen.TrashcanOpen);$.module$exports$Blockly$Events={};$.module$exports$Blockly$Events.Abstract=module$exports$Blockly$Events$Abstract.Abstract;$.module$exports$Blockly$Events.BubbleOpen=module$exports$Blockly$Events$BubbleOpen.BubbleOpen;$.module$exports$Blockly$Events.BlockBase=module$exports$Blockly$Events$BlockBase.BlockBase;$.module$exports$Blockly$Events.BlockChange=module$exports$Blockly$Events$BlockChange.BlockChange;$.module$exports$Blockly$Events.BlockCreate=module$exports$Blockly$Events$BlockCreate.BlockCreate;
$.module$exports$Blockly$Events.BlockDelete=module$exports$Blockly$Events$BlockDelete.BlockDelete;$.module$exports$Blockly$Events.BlockDrag=module$exports$Blockly$Events$BlockDrag.BlockDrag;$.module$exports$Blockly$Events.BlockMove=module$exports$Blockly$Events$BlockMove.BlockMove;$.module$exports$Blockly$Events.Click=module$exports$Blockly$Events$Click.Click;$.module$exports$Blockly$Events.CommentBase=module$exports$Blockly$Events$CommentBase.CommentBase;
$.module$exports$Blockly$Events.CommentChange=module$exports$Blockly$Events$CommentChange.CommentChange;$.module$exports$Blockly$Events.CommentCreate=module$exports$Blockly$Events$CommentCreate.CommentCreate;$.module$exports$Blockly$Events.CommentDelete=module$exports$Blockly$Events$CommentDelete.CommentDelete;$.module$exports$Blockly$Events.CommentMove=module$exports$Blockly$Events$CommentMove.CommentMove;$.module$exports$Blockly$Events.FinishedLoading=module$exports$Blockly$Events$FinishedLoading.FinishedLoading;
$.module$exports$Blockly$Events.MarkerMove=module$exports$Blockly$Events$MarkerMove.MarkerMove;$.module$exports$Blockly$Events.Selected=module$exports$Blockly$Events$Selected.Selected;$.module$exports$Blockly$Events.ThemeChange=module$exports$Blockly$Events$ThemeChange.ThemeChange;$.module$exports$Blockly$Events.ToolboxItemSelect=module$exports$Blockly$Events$ToolboxItemSelect.ToolboxItemSelect;$.module$exports$Blockly$Events.TrashcanOpen=module$exports$Blockly$Events$TrashcanOpen.TrashcanOpen;
$.module$exports$Blockly$Events.Ui=module$exports$Blockly$Events$Ui.Ui;$.module$exports$Blockly$Events.UiBase=module$exports$Blockly$Events$UiBase.UiBase;$.module$exports$Blockly$Events.VarBase=module$exports$Blockly$Events$VarBase.VarBase;$.module$exports$Blockly$Events.VarCreate=module$exports$Blockly$Events$VarCreate.VarCreate;$.module$exports$Blockly$Events.VarDelete=module$exports$Blockly$Events$VarDelete.VarDelete;$.module$exports$Blockly$Events.VarRename=module$exports$Blockly$Events$VarRename.VarRename;
$.module$exports$Blockly$Events.ViewportChange=module$exports$Blockly$Events$ViewportChange.ViewportChange;$.module$exports$Blockly$Events.BLOCK_CHANGE=module$exports$Blockly$Events$utils.CHANGE;$.module$exports$Blockly$Events.BLOCK_CREATE=module$exports$Blockly$Events$utils.CREATE;$.module$exports$Blockly$Events.BLOCK_DELETE=module$exports$Blockly$Events$utils.DELETE;$.module$exports$Blockly$Events.BLOCK_DRAG=module$exports$Blockly$Events$utils.BLOCK_DRAG;
$.module$exports$Blockly$Events.BLOCK_MOVE=module$exports$Blockly$Events$utils.MOVE;$.module$exports$Blockly$Events.BUBBLE_OPEN=module$exports$Blockly$Events$utils.BUBBLE_OPEN;$.module$exports$Blockly$Events.BumpEvent=module$exports$Blockly$Events$utils.BumpEvent;$.module$exports$Blockly$Events.BUMP_EVENTS=module$exports$Blockly$Events$utils.BUMP_EVENTS;$.module$exports$Blockly$Events.CHANGE=module$exports$Blockly$Events$utils.CHANGE;$.module$exports$Blockly$Events.CLICK=module$exports$Blockly$Events$utils.CLICK;
$.module$exports$Blockly$Events.COMMENT_CHANGE=module$exports$Blockly$Events$utils.COMMENT_CHANGE;$.module$exports$Blockly$Events.COMMENT_CREATE=module$exports$Blockly$Events$utils.COMMENT_CREATE;$.module$exports$Blockly$Events.COMMENT_DELETE=module$exports$Blockly$Events$utils.COMMENT_DELETE;$.module$exports$Blockly$Events.COMMENT_MOVE=module$exports$Blockly$Events$utils.COMMENT_MOVE;$.module$exports$Blockly$Events.CREATE=module$exports$Blockly$Events$utils.CREATE;
$.module$exports$Blockly$Events.DELETE=module$exports$Blockly$Events$utils.DELETE;$.module$exports$Blockly$Events.FINISHED_LOADING=module$exports$Blockly$Events$utils.FINISHED_LOADING;$.module$exports$Blockly$Events.MARKER_MOVE=module$exports$Blockly$Events$utils.MARKER_MOVE;$.module$exports$Blockly$Events.MOVE=module$exports$Blockly$Events$utils.MOVE;$.module$exports$Blockly$Events.SELECTED=module$exports$Blockly$Events$utils.SELECTED;$.module$exports$Blockly$Events.THEME_CHANGE=module$exports$Blockly$Events$utils.THEME_CHANGE;
$.module$exports$Blockly$Events.TOOLBOX_ITEM_SELECT=module$exports$Blockly$Events$utils.TOOLBOX_ITEM_SELECT;$.module$exports$Blockly$Events.TRASHCAN_OPEN=module$exports$Blockly$Events$utils.TRASHCAN_OPEN;$.module$exports$Blockly$Events.UI=module$exports$Blockly$Events$utils.UI;$.module$exports$Blockly$Events.VAR_CREATE=module$exports$Blockly$Events$utils.VAR_CREATE;$.module$exports$Blockly$Events.VAR_DELETE=module$exports$Blockly$Events$utils.VAR_DELETE;
$.module$exports$Blockly$Events.VAR_RENAME=module$exports$Blockly$Events$utils.VAR_RENAME;$.module$exports$Blockly$Events.VIEWPORT_CHANGE=module$exports$Blockly$Events$utils.VIEWPORT_CHANGE;$.module$exports$Blockly$Events.clearPendingUndo=module$exports$Blockly$Events$utils.clearPendingUndo;$.module$exports$Blockly$Events.disable=module$exports$Blockly$Events$utils.disable;$.module$exports$Blockly$Events.enable=module$exports$Blockly$Events$utils.enable;$.module$exports$Blockly$Events.filter=module$exports$Blockly$Events$utils.filter;
$.module$exports$Blockly$Events.fire=module$exports$Blockly$Events$utils.fire;$.module$exports$Blockly$Events.fromJson=module$exports$Blockly$Events$utils.fromJson;$.module$exports$Blockly$Events.getDescendantIds=module$exports$Blockly$Events$utils.getDescendantIds;$.module$exports$Blockly$Events.get=module$exports$Blockly$Events$utils.get;$.module$exports$Blockly$Events.getGroup=module$exports$Blockly$Events$utils.getGroup;$.module$exports$Blockly$Events.getRecordUndo=module$exports$Blockly$Events$utils.getRecordUndo;
$.module$exports$Blockly$Events.isEnabled=module$exports$Blockly$Events$utils.isEnabled;$.module$exports$Blockly$Events.setGroup=module$exports$Blockly$Events$utils.setGroup;$.module$exports$Blockly$Events.setRecordUndo=module$exports$Blockly$Events$utils.setRecordUndo;$.module$exports$Blockly$Events.disableOrphans=module$exports$Blockly$Events$utils.disableOrphans;
Object.defineProperties($.module$exports$Blockly$Events,{recordUndo:{get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.Events.recordUndo","September 2021","September 2022","Blockly.Events.getRecordUndo()");return(0,module$exports$Blockly$Events$utils.getRecordUndo)()},set:function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.Events.recordUndo","September 2021","September 2022","Blockly.Events.setRecordUndo()");(0,module$exports$Blockly$Events$utils.setRecordUndo)(a)}}});var module$exports$Blockly$ContextMenuItems={registerUndo:function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(){return $.module$exports$Blockly$Msg.Msg.UNDO},preconditionFn:function(a){return 0<a.workspace.getUndoStack().length?"enabled":"disabled"},callback:function(a){a.workspace.undo(!1)},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1})},registerRedo:function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(){return $.module$exports$Blockly$Msg.Msg.REDO},
preconditionFn:function(a){return 0<a.workspace.getRedoStack().length?"enabled":"disabled"},callback:function(a){a.workspace.undo(!0)},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2})},registerCleanup:function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(){return $.module$exports$Blockly$Msg.Msg.CLEAN_UP},preconditionFn:function(a){return a.workspace.isMovable()?1<
a.workspace.getTopBlocks(!1).length?"enabled":"disabled":"hidden"},callback:function(a){a.workspace.cleanUp()},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3})}},module$contents$Blockly$ContextMenuItems_toggleOption_=function(a,b){var c=0,d=0,e=function(h){d--;h.setCollapsed(a);0===d&&(0,$.module$exports$Blockly$Events.setGroup)(!1)};(0,$.module$exports$Blockly$Events.setGroup)(!0);for(var f=0;f<b.length;f++)for(var g=b[f];g;)d++,
setTimeout(e.bind(null,g),c),g=g.getNextBlock(),c+=10};
module$exports$Blockly$ContextMenuItems.registerCollapse=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(){return $.module$exports$Blockly$Msg.Msg.COLLAPSE_ALL},preconditionFn:function(a){if(a.workspace.options.collapse){a=a.workspace.getTopBlocks(!1);for(var b=0;b<a.length;b++)for(var c=a[b];c;){if(!c.isCollapsed())return"enabled";c=c.getNextBlock()}return"disabled"}return"hidden"},callback:function(a){module$contents$Blockly$ContextMenuItems_toggleOption_(!0,
a.workspace.getTopBlocks(!0))},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})};
module$exports$Blockly$ContextMenuItems.registerExpand=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(){return $.module$exports$Blockly$Msg.Msg.EXPAND_ALL},preconditionFn:function(a){if(a.workspace.options.collapse){a=a.workspace.getTopBlocks(!1);for(var b=0;b<a.length;b++)for(var c=a[b];c;){if(c.isCollapsed())return"enabled";c=c.getNextBlock()}return"disabled"}return"hidden"},callback:function(a){module$contents$Blockly$ContextMenuItems_toggleOption_(!1,
a.workspace.getTopBlocks(!0))},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})};
var module$contents$Blockly$ContextMenuItems_addDeletableBlocks_=function(a,b){if(a.isDeletable())Array.prototype.push.apply(b,a.getDescendants(!1));else{a=a.getChildren(!1);for(var c=0;c<a.length;c++)module$contents$Blockly$ContextMenuItems_addDeletableBlocks_(a[c],b)}},module$contents$Blockly$ContextMenuItems_getDeletableBlocks_=function(a){var b=[];a=a.getTopBlocks(!0);for(var c=0;c<a.length;c++)module$contents$Blockly$ContextMenuItems_addDeletableBlocks_(a[c],b);return b},module$contents$Blockly$ContextMenuItems_deleteNext_=
function(a,b){(0,module$exports$Blockly$Events$utils.setGroup)(b);var c=a.shift();c&&(c.workspace?(c.dispose(!1,!0),setTimeout(module$contents$Blockly$ContextMenuItems_deleteNext_,10,a,b)):module$contents$Blockly$ContextMenuItems_deleteNext_(a,b));(0,module$exports$Blockly$Events$utils.setGroup)(!1)};
module$exports$Blockly$ContextMenuItems.registerDeleteAll=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(a){if(a.workspace)return a=module$contents$Blockly$ContextMenuItems_getDeletableBlocks_(a.workspace).length,1===a?$.module$exports$Blockly$Msg.Msg.DELETE_BLOCK:$.module$exports$Blockly$Msg.Msg.DELETE_X_BLOCKS.replace("%1",String(a))},preconditionFn:function(a){if(a.workspace)return 0<module$contents$Blockly$ContextMenuItems_getDeletableBlocks_(a.workspace).length?
"enabled":"disabled"},callback:function(a){if(a.workspace){a.workspace.cancelCurrentGesture();var b=module$contents$Blockly$ContextMenuItems_getDeletableBlocks_(a.workspace),c=(0,module$exports$Blockly$utils$idGenerator.genUid)();2>b.length?module$contents$Blockly$ContextMenuItems_deleteNext_(b,c):(0,module$exports$Blockly$dialog.confirm)($.module$exports$Blockly$Msg.Msg.DELETE_ALL_BLOCKS.replace("%1",String(b.length)),function(d){d&&module$contents$Blockly$ContextMenuItems_deleteNext_(b,c)})}},scopeType:module$exports$Blockly$ContextMenuRegistry.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.ContextMenuRegistry.registry.register({displayText:function(){return $.module$exports$Blockly$Msg.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.ContextMenuRegistry.ScopeType.BLOCK,
id:"blockDuplicate",weight:1})};
module$exports$Blockly$ContextMenuItems.registerComment=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(a){return a.block.getCommentIcon()?$.module$exports$Blockly$Msg.Msg.REMOVE_COMMENT:$.module$exports$Blockly$Msg.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.ContextMenuRegistry.ScopeType.BLOCK,id:"blockComment",weight:2})};
module$exports$Blockly$ContextMenuItems.registerInline=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(a){return a.block.getInputsInline()?$.module$exports$Blockly$Msg.Msg.EXTERNAL_INPUTS:$.module$exports$Blockly$Msg.Msg.INLINE_INPUTS},preconditionFn:function(a){a=a.block;if(!a.isInFlyout&&a.isMovable()&&!a.isCollapsed())for(var b=1;b<a.inputList.length;b++)if(a.inputList[b-1].type!==$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT&&
a.inputList[b].type!==$.module$exports$Blockly$inputTypes.inputTypes.STATEMENT)return"enabled";return"hidden"},callback:function(a){a.block.setInputsInline(!a.block.getInputsInline())},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.BLOCK,id:"blockInline",weight:3})};
module$exports$Blockly$ContextMenuItems.registerCollapseExpandBlock=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(a){return a.block.isCollapsed()?$.module$exports$Blockly$Msg.Msg.EXPAND_BLOCK:$.module$exports$Blockly$Msg.Msg.COLLAPSE_BLOCK},preconditionFn:function(a){a=a.block;return!a.isInFlyout&&a.isMovable()&&a.workspace.options.collapse?"enabled":"hidden"},callback:function(a){a.block.setCollapsed(!a.block.isCollapsed())},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.BLOCK,
id:"blockCollapseExpand",weight:4})};
module$exports$Blockly$ContextMenuItems.registerDisable=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(a){return a.block.isEnabled()?$.module$exports$Blockly$Msg.Msg.DISABLE_BLOCK:$.module$exports$Blockly$Msg.Msg.ENABLE_BLOCK},preconditionFn:function(a){a=a.block;return!a.isInFlyout&&a.workspace.options.disable&&a.isEditable()?a.getInheritedDisabled()?"disabled":"enabled":"hidden"},callback:function(a){a=a.block;var b=(0,module$exports$Blockly$Events$utils.getGroup)();
b||(0,module$exports$Blockly$Events$utils.setGroup)(!0);a.setEnabled(!a.isEnabled());b||(0,module$exports$Blockly$Events$utils.setGroup)(!1)},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.BLOCK,id:"blockDisable",weight:5})};
module$exports$Blockly$ContextMenuItems.registerDelete=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(a){var b=a.block;a=b.getDescendants(!1).length;(b=b.getNextBlock())&&(a-=b.getDescendants(!1).length);return 1===a?$.module$exports$Blockly$Msg.Msg.DELETE_BLOCK:$.module$exports$Blockly$Msg.Msg.DELETE_X_BLOCKS.replace("%1",String(a))},preconditionFn:function(a){return!a.block.isInFlyout&&a.block.isDeletable()?"enabled":"hidden"},callback:function(a){a.block&&
a.block.checkAndDelete()},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.BLOCK,id:"blockDelete",weight:6})};
module$exports$Blockly$ContextMenuItems.registerHelp=function(){module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.registry.register({displayText:function(){return $.module$exports$Blockly$Msg.Msg.HELP},preconditionFn:function(a){a=a.block;return("function"===typeof a.helpUrl?a.helpUrl():a.helpUrl)?"enabled":"hidden"},callback:function(a){a.block.showHelp()},scopeType:module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry.ScopeType.BLOCK,id:"blockHelp",weight:7})};
var module$contents$Blockly$ContextMenuItems_registerBlockOptions_=function(){(0,module$exports$Blockly$ContextMenuItems.registerDuplicate)();(0,module$exports$Blockly$ContextMenuItems.registerComment)();(0,module$exports$Blockly$ContextMenuItems.registerInline)();(0,module$exports$Blockly$ContextMenuItems.registerCollapseExpandBlock)();(0,module$exports$Blockly$ContextMenuItems.registerDisable)();(0,module$exports$Blockly$ContextMenuItems.registerDelete)();(0,module$exports$Blockly$ContextMenuItems.registerHelp)()};
module$exports$Blockly$ContextMenuItems.registerDefaultOptions=function(){module$contents$Blockly$ContextMenuItems_registerWorkspaceOptions_();module$contents$Blockly$ContextMenuItems_registerBlockOptions_()};(0,module$exports$Blockly$ContextMenuItems.registerDefaultOptions)();var module$exports$Blockly$Icon={Icon:function(a){this.block_=a;this.iconGroup_=null;this.collapseHidden=!0;this.SIZE=17;this.iconXY_=this.bubble_=null}};
module$exports$Blockly$Icon.Icon.prototype.createIcon=function(){this.iconGroup_||(this.iconGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyIconGroup"},null),this.block_.isInFlyout&&(0,module$exports$Blockly$utils$dom.addClass)(this.iconGroup_,"blocklyIconGroupReadonly"),this.drawIcon_(this.iconGroup_),this.block_.getSvgRoot().appendChild(this.iconGroup_),(0,module$exports$Blockly$browserEvents.conditionalBind)(this.iconGroup_,"mouseup",
this,this.iconClick_),this.updateEditable())};module$exports$Blockly$Icon.Icon.prototype.dispose=function(){(0,module$exports$Blockly$utils$dom.removeNode)(this.iconGroup_);this.iconGroup_=null;this.setVisible(!1);this.block_=null};module$exports$Blockly$Icon.Icon.prototype.updateEditable=function(){};module$exports$Blockly$Icon.Icon.prototype.isVisible=function(){return!!this.bubble_};
module$exports$Blockly$Icon.Icon.prototype.iconClick_=function(a){this.block_.workspace.isDragging()||this.block_.isInFlyout||(0,module$exports$Blockly$browserEvents.isRightButton)(a)||this.setVisible(!this.isVisible())};module$exports$Blockly$Icon.Icon.prototype.applyColour=function(){this.isVisible()&&this.bubble_.setColour(this.block_.style.colourPrimary)};module$exports$Blockly$Icon.Icon.prototype.setIconLocation=function(a){this.iconXY_=a;this.isVisible()&&this.bubble_.setAnchorLocation(a)};
module$exports$Blockly$Icon.Icon.prototype.computeIconLocation=function(){var a=this.block_.getRelativeToSurfaceXY(),b=(0,module$exports$Blockly$utils$svgMath.getRelativeXY)(this.iconGroup_);a=new module$exports$Blockly$utils$Coordinate.Coordinate(a.x+b.x+this.SIZE/2,a.y+b.y+this.SIZE/2);module$exports$Blockly$utils$Coordinate.Coordinate.equals(this.getIconLocation(),a)||this.setIconLocation(a)};module$exports$Blockly$Icon.Icon.prototype.getIconLocation=function(){return this.iconXY_};
module$exports$Blockly$Icon.Icon.prototype.getCorrectedSize=function(){return new module$exports$Blockly$utils$Size.Size(this.SIZE,this.SIZE-2)};module$exports$Blockly$Icon.Icon.prototype.drawIcon_=function(a){};module$exports$Blockly$Icon.Icon.prototype.setVisible=function(a){};$.module$exports$Blockly$Mutator={Mutator:function(a){module$exports$Blockly$Icon.Icon.call(this,null);this.quarkNames_=a;this.workspace_=null;this.workspaceHeight_=this.workspaceWidth_=0;this.sourceListener_=this.rootBlock_=this.svgDialog_=null}};$.$jscomp.inherits($.module$exports$Blockly$Mutator.Mutator,module$exports$Blockly$Icon.Icon);$.module$exports$Blockly$Mutator.Mutator.prototype.setBlock=function(a){this.block_=a};$.module$exports$Blockly$Mutator.Mutator.prototype.getWorkspace=function(){return this.workspace_};
$.module$exports$Blockly$Mutator.Mutator.prototype.drawIcon_=function(a){(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.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.Svg.CIRCLE,{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};$.module$exports$Blockly$Mutator.Mutator.prototype.iconClick_=function(a){this.block_.isEditable()&&module$exports$Blockly$Icon.Icon.prototype.iconClick_.call(this,a)};
$.module$exports$Blockly$Mutator.Mutator.prototype.createEditor_=function(){this.svgDialog_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.SVG,{x:module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH,y:module$exports$Blockly$Bubble.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.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.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.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.Mutator.prototype.updateEditable=function(){module$exports$Blockly$Icon.Icon.prototype.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.Mutator.prototype.resizeBubble_=function(){var a=2*module$exports$Blockly$Bubble.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.Mutator.prototype.onBubbleMove_=function(){this.workspace_&&this.workspace_.recordDragTargets()};
$.module$exports$Blockly$Mutator.Mutator.prototype.setVisible=function(a){var b=this;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.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 c=this.workspace_.options.languageTree;a=this.workspace_.getFlyout();c&&(a.init(this.workspace_),a.show(c));this.rootBlock_=this.block_.decompose(this.workspace_);c=this.rootBlock_.getDescendants(!1);for(var d=0,e=void 0;e=c[d];d++)e.render();this.rootBlock_.setMovable(!1);this.rootBlock_.setDeletable(!1);a?(c=2*a.CORNER_RADIUS,a=this.rootBlock_.RTL?a.getWidth()+c:c):a=c=16;this.block_.RTL&&(a=-a);this.rootBlock_.moveBy(a,c);if(this.block_.saveConnections){var f=this.rootBlock_;this.block_.saveConnections(f);
this.sourceListener_=function(){b.block_&&b.block_.saveConnections(f)};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.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.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_){(a=(0,module$exports$Blockly$Events$utils.getGroup)())||(0,module$exports$Blockly$Events$utils.setGroup)(!0);
var g=this.block_;b=module$exports$Blockly$Events$BlockChange.BlockChange.getExtraBlockState_(g);c=g.rendered;g.rendered=!1;g.compose(this.rootBlock_);g.rendered=c;g.initSvg();g.rendered&&g.render();c=module$exports$Blockly$Events$BlockChange.BlockChange.getExtraBlockState_(g);if(b!==c){(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(g,"mutation",null,b,c));var h=(0,module$exports$Blockly$Events$utils.getGroup)();
setTimeout(function(){var k=(0,module$exports$Blockly$Events$utils.getGroup)();(0,module$exports$Blockly$Events$utils.setGroup)(h);g.bumpNeighbours();(0,module$exports$Blockly$Events$utils.setGroup)(k)},$.module$exports$Blockly$config.config.bumpDelay)}this.workspace_.isDragging()||this.resizeBubble_();(0,module$exports$Blockly$Events$utils.setGroup)(a)}};$.module$exports$Blockly$Mutator.Mutator.prototype.dispose=function(){this.block_.mutator=null;module$exports$Blockly$Icon.Icon.prototype.dispose.call(this)};
$.module$exports$Blockly$Mutator.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.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.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$Warning={Warning:function(a){module$exports$Blockly$Icon.Icon.call(this,a);this.createIcon();this.text_=Object.create(null);this.paragraphElement_=null;this.collapseHidden=!1}};$.$jscomp.inherits(module$exports$Blockly$Warning.Warning,module$exports$Blockly$Icon.Icon);
module$exports$Blockly$Warning.Warning.prototype.drawIcon_=function(a){(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.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.Svg.RECT,
{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)};module$exports$Blockly$Warning.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.Warning.prototype.createBubble_=function(){this.paragraphElement_=module$exports$Blockly$Bubble.Bubble.textToDom(this.getText());this.bubble_=module$exports$Blockly$Bubble.Bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_);this.applyColour()};module$exports$Blockly$Warning.Warning.prototype.disposeBubble_=function(){this.bubble_.dispose();this.paragraphElement_=this.bubble_=null};
module$exports$Blockly$Warning.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.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.Warning.prototype.dispose=function(){this.block_.warning=null;module$exports$Blockly$Icon.Icon.prototype.dispose.call(this)};var module$exports$Blockly$Comment={Comment:function(a){module$exports$Blockly$Icon.Icon.call(this,a);this.model_=a.commentModel;this.model_.text=this.model_.text||"";this.cachedText_="";this.paragraphElement_=this.textarea_=this.foreignObject_=this.onInputWrapper_=this.onChangeWrapper_=this.onWheelWrapper_=this.onMouseUpWrapper_=null;this.createIcon()}};$.$jscomp.inherits(module$exports$Blockly$Comment.Comment,module$exports$Blockly$Icon.Icon);
module$exports$Blockly$Comment.Comment.prototype.drawIcon_=function(a){(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.CIRCLE,{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},a);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Svg.RECT,{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},a)};
module$exports$Blockly$Comment.Comment.prototype.createEditor_=function(){this.foreignObject_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FOREIGNOBJECT,{x:module$exports$Blockly$Bubble.Bubble.BORDER_WIDTH,y:module$exports$Blockly$Bubble.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.Comment.prototype.updateEditable=function(){module$exports$Blockly$Icon.Icon.prototype.updateEditable.call(this);this.isVisible()&&(this.disposeBubble_(),this.createBubble_())};module$exports$Blockly$Comment.Comment.prototype.onBubbleResize_=function(){this.isVisible()&&(this.model_.size=this.bubble_.getBubbleSize(),this.resizeTextarea_())};
module$exports$Blockly$Comment.Comment.prototype.resizeTextarea_=function(){var a=this.model_.size,b=2*module$exports$Blockly$Bubble.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.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.Comment.prototype.createBubble_=function(){!this.block_.isEditable()||module$exports$Blockly$utils$userAgent.IE?this.createNonEditableBubble_():this.createEditableBubble_()};
module$exports$Blockly$Comment.Comment.prototype.createEditableBubble_=function(){this.bubble_=new module$exports$Blockly$Bubble.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.Comment.prototype.createNonEditableBubble_=function(){this.paragraphElement_=module$exports$Blockly$Bubble.Bubble.textToDom(this.block_.getCommentText());this.bubble_=module$exports$Blockly$Bubble.Bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_);this.applyColour()};
module$exports$Blockly$Comment.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.Comment.prototype.startEdit_=function(a){this.bubble_.promote()&&this.textarea_.focus();this.cachedText_=this.model_.text};module$exports$Blockly$Comment.Comment.prototype.getBubbleSize=function(){return this.model_.size};
module$exports$Blockly$Comment.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.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.Comment.prototype.dispose=function(){this.block_.comment=null;module$exports$Blockly$Icon.Icon.prototype.dispose.call(this)};
(0,module$exports$Blockly$Css.register)("\n.blocklyCommentTextarea {\n background-color: #fef49c;\n border: 0;\n display: block;\n margin: 0;\n outline: 0;\n padding: 3px;\n resize: none;\n text-overflow: hidden;\n}\n");var module$exports$Blockly$sprite={SPRITE:{width:96,height:124,url:"sprites.png"}};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.Scrollbar.scrollbarThickness)):(c=e.absoluteMetrics.left+e.viewMetrics.width-b.width-c,g&&!f.RTL&&(c-=module$exports$Blockly$Scrollbar.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.Scrollbar.scrollbarThickness));return new module$exports$Blockly$utils$Rect.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<d.length;h++){var k=d[h];a.intersects(k)&&(a=c===module$exports$Blockly$uiPosition.bumpDirection.UP?
k.top-g-b:k.bottom+b,a=new module$exports$Blockly$utils$Rect.Rect(a,a+g,e,e+f),h=-1)}return a}};var module$exports$Blockly$IPositionable={IPositionable:function(){}};var module$exports$Blockly$ZoomControls={ZoomControls:function(a){this.workspace_=a;this.id="zoomControls";this.zoomResetGroup_=this.zoomOutGroup_=this.zoomInGroup_=this.onZoomOutWrapper_=this.onZoomInWrapper_=this.onZoomResetWrapper_=null;this.HEIGHT_=this.WIDTH_=32;this.SMALL_SPACING_=2;this.LARGE_SPACING_=11;this.MARGIN_HORIZONTAL_=this.MARGIN_VERTICAL_=20;this.svgGroup_=null;this.top_=this.left_=0;this.initialized_=!1}};
module$exports$Blockly$ZoomControls.ZoomControls.prototype.createDom=function(){this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.ZoomControls.prototype.init=function(){this.workspace_.getComponentManager().addComponent({component:this,weight:2,capabilities:[module$exports$Blockly$ComponentManager.ComponentManager.Capability.POSITIONABLE]});this.initialized_=!0};
module$exports$Blockly$ZoomControls.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.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.Rect(this.top_,this.top_+a,this.left_,this.left_+this.WIDTH_)};
module$exports$Blockly$ZoomControls.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.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.ZoomControls.prototype.createZoomOutSvg_=function(a){this.zoomOutGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyZoom"},this.svgGroup_);var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.CLIPPATH,{id:"blocklyZoomoutClipPath"+a},this.zoomOutGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{width:32,
height:32},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.IMAGE,{width:module$exports$Blockly$sprite.SPRITE.width,height:module$exports$Blockly$sprite.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$sprite.SPRITE.url);this.onZoomOutWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.zoomOutGroup_,
"mousedown",null,this.zoom_.bind(this,-1))};
module$exports$Blockly$ZoomControls.ZoomControls.prototype.createZoomInSvg_=function(a){this.zoomInGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyZoom"},this.svgGroup_);var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.CLIPPATH,{id:"blocklyZoominClipPath"+a},this.zoomInGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{width:32,
height:32},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.IMAGE,{width:module$exports$Blockly$sprite.SPRITE.width,height:module$exports$Blockly$sprite.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$sprite.SPRITE.url);this.onZoomInWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.zoomInGroup_,
"mousedown",null,this.zoom_.bind(this,1))};module$exports$Blockly$ZoomControls.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.ZoomControls.prototype.createZoomResetSvg_=function(a){this.zoomResetGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyZoom"},this.svgGroup_);var b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.CLIPPATH,{id:"blocklyZoomresetClipPath"+a},this.zoomResetGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,
{width:32,height:32},b);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.IMAGE,{width:module$exports$Blockly$sprite.SPRITE.width,height:module$exports$Blockly$sprite.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$sprite.SPRITE.url);this.onZoomResetWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.zoomResetGroup_,
"mousedown",null,this.resetZoom_.bind(this))};
module$exports$Blockly$ZoomControls.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.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)("\n.blocklyZoom>image, .blocklyZoom>svg>image {\n opacity: .4;\n}\n\n.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {\n opacity: .6;\n}\n\n.blocklyZoom>image:active, .blocklyZoom>svg>image:active {\n opacity: .8;\n}\n");var module$exports$Blockly$WorkspaceComment={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.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.WorkspaceComment.fireCreateEvent(this)}};
module$exports$Blockly$WorkspaceComment.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.WorkspaceComment.prototype.getHeight=function(){return this.height_};
module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.setHeight=function(a){this.height_=a};module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.getWidth=function(){return this.width_};module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.setWidth=function(a){this.width_=a};module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.getXY=function(){return new module$exports$Blockly$utils$Coordinate.Coordinate(this.xy_.x,this.xy_.y)};
module$exports$Blockly$WorkspaceComment.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.WorkspaceComment.prototype.isDeletable=function(){return this.deletable_&&!(this.workspace&&this.workspace.options.readOnly)};
module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.setDeletable=function(a){this.deletable_=a};module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.isMovable=function(){return this.movable_&&!(this.workspace&&this.workspace.options.readOnly)};module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.setMovable=function(a){this.movable_=a};
module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.isEditable=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)};module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.setEditable=function(a){this.editable_=a};module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.getContent=function(){return this.content_};
module$exports$Blockly$WorkspaceComment.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.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.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.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.WorkspaceComment.fromXml=function(a,b){var c=module$exports$Blockly$WorkspaceComment.WorkspaceComment.parseAttributes(a);b=new module$exports$Blockly$WorkspaceComment.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.WorkspaceComment.fireCreateEvent(b);return b};
module$exports$Blockly$WorkspaceComment.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$exports$Blockly$WorkspaceCommentSvg={},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.WorkspaceCommentSvg=function(a,b,c,d,e){module$exports$Blockly$WorkspaceComment.WorkspaceComment.call(this,a,b,c,d,e);this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null;this.eventsInit_=!1;this.deleteIconBorder_=this.deleteGroup_=this.resizeGroup_=this.foreignObject_=this.svgHandleTarget_=this.svgRectTarget_=this.textarea_=null;this.autoLayout_=this.focused_=!1;this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,
{"class":"blocklyComment"},null);this.svgGroup_.translate_="";this.svgRect_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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$svgMath.is3dSupported)()&&!!a.getBlockDragSurface();this.render()};
$.$jscomp.inherits(module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg,module$exports$Blockly$WorkspaceComment.WorkspaceComment);
module$exports$Blockly$WorkspaceCommentSvg.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$WorkspaceComment.WorkspaceComment.prototype.dispose.call(this),(0,module$exports$Blockly$Events$utils.enable)())};
module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.pathMouseDown_=function(a){var b=this.workspace.getGesture(a);b&&b.handleBubbleStart(a,this)};
module$exports$Blockly$WorkspaceCommentSvg.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.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.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.WorkspaceCommentSvg.prototype.addSelect=function(){(0,module$exports$Blockly$utils$dom.addClass)(this.svgGroup_,"blocklySelected");this.setFocus()};module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.removeSelect=function(){(0,module$exports$Blockly$utils$dom.removeClass)(this.svgGroup_,"blocklySelected");this.blurFocus()};
module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.addFocus=function(){(0,module$exports$Blockly$utils$dom.addClass)(this.svgGroup_,"blocklyFocused")};module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.removeFocus=function(){(0,module$exports$Blockly$utils$dom.removeClass)(this.svgGroup_,"blocklyFocused")};
module$exports$Blockly$WorkspaceCommentSvg.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$svgMath.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.Coordinate(a,b)};module$exports$Blockly$WorkspaceCommentSvg.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.Coordinate(d.x+a,d.y+b);c.recordNew();(0,module$exports$Blockly$Events$utils.fire)(c);this.workspace.resizeContents()};
module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.translate=function(a,b){this.xy_=new module$exports$Blockly$utils$Coordinate.Coordinate(a,b);this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};module$exports$Blockly$WorkspaceCommentSvg.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.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.WorkspaceCommentSvg.prototype.moveTo=function(a,b){this.translate(a,b)};module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().removeAttribute("transform")};
module$exports$Blockly$WorkspaceCommentSvg.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.Rect(c,d,e,a)};
module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.setMovable=function(a){module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.setMovable.call(this,a);this.updateMovable()};
module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.setEditable=function(a){module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.setEditable.call(this,a);this.textarea_&&(this.textarea_.readOnly=!a)};
module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.getSvgRoot=function(){return this.svgGroup_};
module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.getContent=function(){return this.textarea_?this.textarea_.value:this.content_};module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.setContent=function(a){module$exports$Blockly$WorkspaceComment.WorkspaceComment.prototype.setContent.call(this,a);this.textarea_&&(this.textarea_.value=a)};
module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.setAutoLayout=function(a){};
module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.toCopyData=function(){return{saveInfo:this.toXmlWithXY(),source:this.workspace,typeCounts:null}};module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.getHeightWidth=function(){return{width:this.getWidth(),height:this.getHeight()}};
module$exports$Blockly$WorkspaceCommentSvg.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.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.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.WorkspaceCommentSvg.prototype.createEditor_=function(){this.foreignObject_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.FOREIGNOBJECT,{x:0,y:module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.addResizeDom_=function(){this.resizeGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":this.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.svgGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.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.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.WorkspaceCommentSvg.prototype.addDeleteDom_=function(){this.deleteGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":"blocklyCommentDeleteIcon"},this.svgGroup_);this.deleteIconBorder_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.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.Svg.LINE,{x1:"5",y1:"5",x2:"10",y2:"10",stroke:"#fff","stroke-width":"2"},this.deleteGroup_)};
module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.resizeMouseDown_=function(a){this.unbindDragEvents_();(0,module$exports$Blockly$browserEvents.isRightButton)(a)||(this.workspace.startDrag(a,new module$exports$Blockly$utils$Coordinate.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.WorkspaceCommentSvg.prototype.deleteMouseDown_=function(a){(0,module$exports$Blockly$utils$dom.addClass)(this.deleteIconBorder_,"blocklyDeleteIconHighlighted");a.stopPropagation()};module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.deleteMouseOut_=function(a){(0,module$exports$Blockly$utils$dom.removeClass)(this.deleteIconBorder_,"blocklyDeleteIconHighlighted")};
module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.prototype.deleteMouseUp_=function(a){this.dispose();a.stopPropagation()};module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.resizeMouseUp_=function(a){(0,module$exports$Blockly$Touch.clearTouchIdentifier)();this.unbindDragEvents_()};module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.resizeComment_=function(){var a=this.getHeightWidth(),b=module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceCommentSvg.prototype.setSize_=function(a,b){a=Math.max(a,45);b=Math.max(b,20+module$exports$Blockly$WorkspaceCommentSvg.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.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.WorkspaceCommentSvg.prototype.disposeInternal_=function(){this.svgHandleTarget_=this.svgRectTarget_=this.foreignObject_=this.textarea_=null;this.disposed_=!0};
module$exports$Blockly$WorkspaceCommentSvg.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.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)};
module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.fromXmlRendered=function(a,b,c){(0,module$exports$Blockly$Events$utils.disable)();try{var d=module$exports$Blockly$WorkspaceComment.WorkspaceComment.parseAttributes(a);var e=new module$exports$Blockly$WorkspaceCommentSvg.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.WorkspaceComment.fireCreateEvent(e);
return e};module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.DEFAULT_SIZE=100;module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg.TOP_OFFSET=10;(0,module$exports$Blockly$Css.register)("\n.blocklyCommentForeignObject {\n position: relative;\n z-index: 0;\n}\n\n.blocklyCommentRect {\n fill: #E7DE8E;\n stroke: #bcA903;\n stroke-width: 1px;\n}\n\n.blocklyCommentTarget {\n fill: transparent;\n stroke: #bcA903;\n}\n\n.blocklyCommentTargetFocused {\n fill: none;\n}\n\n.blocklyCommentHandleTarget {\n fill: none;\n}\n\n.blocklyCommentHandleTargetFocused {\n fill: transparent;\n}\n\n.blocklyFocused>.blocklyCommentRect {\n fill: #B9B272;\n stroke: #B9B272;\n}\n\n.blocklySelected>.blocklyCommentTarget {\n stroke: #fc3;\n stroke-width: 3px;\n}\n\n.blocklyCommentDeleteIcon {\n cursor: pointer;\n fill: #000;\n display: none;\n}\n\n.blocklySelected > .blocklyCommentDeleteIcon {\n display: block;\n}\n\n.blocklyDeleteIconShape {\n fill: #000;\n stroke: #000;\n stroke-width: 1px;\n}\n\n.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {\n stroke: #fc3;\n}\n");var module$exports$Blockly$Trashcan={Trashcan:function(a){module$exports$Blockly$DeleteArea.DeleteArea.call(this);this.workspace_=a;this.id="trashcan";this.contents_=[];this.flyout=null;0>=this.workspace_.options.maxTrashcanContents||(this.isLidOpen=!1,this.minOpenness_=0,this.svgLid_=this.svgGroup_=null,this.top_=this.left_=this.lidOpen_=this.lidTask_=0,this.initialized_=!1,a=new module$exports$Blockly$Options.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)))}};
$.$jscomp.inherits(module$exports$Blockly$Trashcan.Trashcan,module$exports$Blockly$DeleteArea.DeleteArea);
module$exports$Blockly$Trashcan.Trashcan.prototype.createDom=function(){this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Svg.CLIPPATH,{id:"blocklyTrashBodyClipPath"+a},this.svgGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Svg.IMAGE,{width:module$exports$Blockly$sprite.SPRITE.width,x:-module$contents$Blockly$Trashcan_SPRITE_LEFT,height:module$exports$Blockly$sprite.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$sprite.SPRITE.url);b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.CLIPPATH,{id:"blocklyTrashLidClipPath"+a},this.svgGroup_);(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.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.Svg.IMAGE,{width:module$exports$Blockly$sprite.SPRITE.width,x:-module$contents$Blockly$Trashcan_SPRITE_LEFT,height:module$exports$Blockly$sprite.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$sprite.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.Trashcan.prototype.init=function(){0<this.workspace_.options.maxTrashcanContents&&((0,module$exports$Blockly$utils$dom.insertAfter)(this.flyout.createDom(module$exports$Blockly$utils$Svg.Svg.SVG),this.workspace_.getParentSvg()),this.flyout.init(this.workspace_));this.workspace_.getComponentManager().addComponent({component:this,weight:1,capabilities:[module$exports$Blockly$ComponentManager.ComponentManager.Capability.AUTOHIDEABLE,module$exports$Blockly$ComponentManager.ComponentManager.Capability.DELETE_AREA,
module$exports$Blockly$ComponentManager.ComponentManager.Capability.DRAG_TARGET,module$exports$Blockly$ComponentManager.ComponentManager.Capability.POSITIONABLE]});this.initialized_=!0;this.setLidOpen(!1)};module$exports$Blockly$Trashcan.Trashcan.prototype.dispose=function(){this.workspace_.getComponentManager().removeComponent("trashcan");this.svgGroup_&&((0,module$exports$Blockly$utils$dom.removeNode)(this.svgGroup_),this.svgGroup_=null);this.workspace_=this.svgLid_=null;clearTimeout(this.lidTask_)};
module$exports$Blockly$Trashcan.Trashcan.prototype.hasContents_=function(){return!!this.contents_.length};module$exports$Blockly$Trashcan.Trashcan.prototype.contentsIsOpen=function(){return!!this.flyout&&this.flyout.isVisible()};module$exports$Blockly$Trashcan.Trashcan.prototype.openFlyout=function(){if(!this.contentsIsOpen()){var a=this.contents_.map(function(b){return JSON.parse(b)});this.flyout.show(a);this.fireUiEvent_(!0)}};
module$exports$Blockly$Trashcan.Trashcan.prototype.closeFlyout=function(){this.contentsIsOpen()&&(this.flyout.hide(),this.fireUiEvent_(!1),this.workspace_.recordDragTargets())};module$exports$Blockly$Trashcan.Trashcan.prototype.autoHide=function(a){!a&&this.flyout&&this.closeFlyout()};module$exports$Blockly$Trashcan.Trashcan.prototype.emptyContents=function(){this.hasContents_()&&(this.contents_.length=0,this.setMinOpenness_(0),this.closeFlyout())};
module$exports$Blockly$Trashcan.Trashcan.prototype.position=function(a,b){if(this.initialized_){var c=(0,module$exports$Blockly$uiPosition.getCornerOppositeToolbox)(this.workspace_,a);a=(0,module$exports$Blockly$uiPosition.getStartPositionRect)(c,new module$exports$Blockly$utils$Size.Size(module$contents$Blockly$Trashcan_WIDTH,module$contents$Blockly$Trashcan_BODY_HEIGHT+module$contents$Blockly$Trashcan_LID_HEIGHT),module$contents$Blockly$Trashcan_MARGIN_HORIZONTAL,module$contents$Blockly$Trashcan_MARGIN_VERTICAL,
a,this.workspace_);b=(0,module$exports$Blockly$uiPosition.bumpPositionRect)(a,module$contents$Blockly$Trashcan_MARGIN_VERTICAL,c.vertical===module$exports$Blockly$uiPosition.verticalPosition.TOP?module$exports$Blockly$uiPosition.bumpDirection.DOWN:module$exports$Blockly$uiPosition.bumpDirection.UP,b);this.top_=b.top;this.left_=b.left;this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")")}};
module$exports$Blockly$Trashcan.Trashcan.prototype.getBoundingRectangle=function(){return new module$exports$Blockly$utils$Rect.Rect(this.top_,this.top_+module$contents$Blockly$Trashcan_BODY_HEIGHT+module$contents$Blockly$Trashcan_LID_HEIGHT,this.left_,this.left_+module$contents$Blockly$Trashcan_WIDTH)};
module$exports$Blockly$Trashcan.Trashcan.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.top+module$contents$Blockly$Trashcan_SPRITE_TOP-module$contents$Blockly$Trashcan_MARGIN_HOTSPOT;a=a.left+module$contents$Blockly$Trashcan_SPRITE_LEFT-module$contents$Blockly$Trashcan_MARGIN_HOTSPOT;return new module$exports$Blockly$utils$Rect.Rect(b,b+module$contents$Blockly$Trashcan_LID_HEIGHT+module$contents$Blockly$Trashcan_BODY_HEIGHT+2*module$contents$Blockly$Trashcan_MARGIN_HOTSPOT,
a,a+module$contents$Blockly$Trashcan_WIDTH+2*module$contents$Blockly$Trashcan_MARGIN_HOTSPOT)};module$exports$Blockly$Trashcan.Trashcan.prototype.onDragOver=function(a){this.setLidOpen(this.wouldDelete_)};module$exports$Blockly$Trashcan.Trashcan.prototype.onDragExit=function(a){this.setLidOpen(!1)};module$exports$Blockly$Trashcan.Trashcan.prototype.onDrop=function(a){setTimeout(this.setLidOpen.bind(this,!1),100)};
module$exports$Blockly$Trashcan.Trashcan.prototype.setLidOpen=function(a){this.isLidOpen!==a&&(clearTimeout(this.lidTask_),this.isLidOpen=a,this.animateLid_())};
module$exports$Blockly$Trashcan.Trashcan.prototype.animateLid_=function(){var a=module$contents$Blockly$Trashcan_ANIMATION_FRAMES,b=1/(a+1);this.lidOpen_+=this.isLidOpen?b:-b;this.lidOpen_=Math.min(Math.max(this.lidOpen_,this.minOpenness_),1);this.setLidAngle_(this.lidOpen_*module$contents$Blockly$Trashcan_MAX_LID_ANGLE);this.svgGroup_.style.opacity=module$contents$Blockly$Trashcan_OPACITY_MIN+this.lidOpen_*(module$contents$Blockly$Trashcan_OPACITY_MAX-module$contents$Blockly$Trashcan_OPACITY_MIN);
this.lidOpen_>this.minOpenness_&&1>this.lidOpen_&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),module$contents$Blockly$Trashcan_ANIMATION_LENGTH/a))};
module$exports$Blockly$Trashcan.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.Trashcan.prototype.setMinOpenness_=function(a){this.minOpenness_=a;this.isLidOpen||this.setLidAngle_(a*module$contents$Blockly$Trashcan_MAX_LID_ANGLE)};module$exports$Blockly$Trashcan.Trashcan.prototype.closeLid=function(){this.setLidOpen(!1)};module$exports$Blockly$Trashcan.Trashcan.prototype.click=function(){this.hasContents_()&&this.openFlyout()};
module$exports$Blockly$Trashcan.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.Trashcan.prototype.blockMouseDownWhenOpenable_=function(a){!this.contentsIsOpen()&&this.hasContents_()&&a.stopPropagation()};
module$exports$Blockly$Trashcan.Trashcan.prototype.mouseOver_=function(){this.hasContents_()&&this.setLidOpen(!0)};module$exports$Blockly$Trashcan.Trashcan.prototype.mouseOut_=function(){this.setLidOpen(!1)};
module$exports$Blockly$Trashcan.Trashcan.prototype.onDelete_=function(a){if(!(0>=this.workspace_.options.maxTrashcanContents||a.type!==module$exports$Blockly$Events$utils.DELETE||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.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$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;var module$exports$Blockly$FlyoutButton={FlyoutButton:function(a,b,c,d){this.workspace_=a;this.targetWorkspace_=b;this.text_=c.text;this.position_=new module$exports$Blockly$utils$Coordinate.Coordinate(0,0);this.isLabel_=d;this.callbackKey_=c.callbackKey||c.callbackkey;this.cssClass_=c["web-class"]||null;this.onMouseUpWrapper_=null;this.info=c;this.height=this.width=0;this.svgText_=this.svgGroup_=null}};
module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.createDom=function(){var a=this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.cssClass_&&(a+=" "+this.cssClass_);this.svgGroup_=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.G,{"class":a},this.workspace_.getCanvas());var b;this.isLabel_||(b=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,
y:1},this.svgGroup_));a=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.RECT,{"class":this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.svgGroup_);var c=(0,module$exports$Blockly$utils$dom.createSvgElement)(module$exports$Blockly$utils$Svg.Svg.TEXT,{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_),d=(0,module$exports$Blockly$utils$parsing.replaceMessageReferences)(this.text_);
this.workspace_.RTL&&(d+="\u200f");c.textContent=d;this.isLabel_&&(this.svgText_=c,this.workspace_.getThemeManager().subscribe(this.svgText_,"flyoutForegroundColour","fill"));var e=(0,module$exports$Blockly$utils$style.getComputedStyle)(c,"fontSize"),f=(0,module$exports$Blockly$utils$style.getComputedStyle)(c,"fontWeight"),g=(0,module$exports$Blockly$utils$style.getComputedStyle)(c,"fontFamily");this.width=(0,module$exports$Blockly$utils$dom.getFastTextWidthWithSizeString)(c,e,f,g);d=(0,module$exports$Blockly$utils$dom.measureFontMetrics)(d,
e,f,g);this.height=d.height;this.isLabel_||(this.width+=2*module$exports$Blockly$FlyoutButton.FlyoutButton.TEXT_MARGIN_X,this.height+=2*module$exports$Blockly$FlyoutButton.FlyoutButton.TEXT_MARGIN_Y,b.setAttribute("width",this.width),b.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);c.setAttribute("x",this.width/2);c.setAttribute("y",this.height/2-d.height/2+d.baseline);this.updateTransform_();this.onMouseUpWrapper_=(0,module$exports$Blockly$browserEvents.conditionalBind)(this.svgGroup_,
"mouseup",this,this.onMouseUp_);return this.svgGroup_};module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.show=function(){this.updateTransform_();this.svgGroup_.setAttribute("display","block")};module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.updateTransform_=function(){this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")};
module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.moveTo=function(a,b){this.position_.x=a;this.position_.y=b;this.updateTransform_()};module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.isLabel=function(){return this.isLabel_};module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.getPosition=function(){return this.position_};module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.getButtonText=function(){return this.text_};
module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_};module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.dispose=function(){this.onMouseUpWrapper_&&(0,module$exports$Blockly$browserEvents.unbind)(this.onMouseUpWrapper_);this.svgGroup_&&(0,module$exports$Blockly$utils$dom.removeNode)(this.svgGroup_);this.svgText_&&this.workspace_.getThemeManager().unsubscribe(this.svgText_)};
module$exports$Blockly$FlyoutButton.FlyoutButton.prototype.onMouseUp_=function(a){(a=this.targetWorkspace_.getGesture(a))&&a.cancel();this.isLabel_&&this.callbackKey_?console.warn("Labels should not have callbacks. Label text: "+this.text_):this.isLabel_||this.callbackKey_&&this.targetWorkspace_.getButtonCallback(this.callbackKey_)?this.isLabel_||this.targetWorkspace_.getButtonCallback(this.callbackKey_)(this):console.warn("Buttons should have callbacks. Button text: "+this.text_)};
module$exports$Blockly$FlyoutButton.FlyoutButton.TEXT_MARGIN_X=5;module$exports$Blockly$FlyoutButton.FlyoutButton.TEXT_MARGIN_Y=2;(0,module$exports$Blockly$Css.register)("\n.blocklyFlyoutButton {\n fill: #888;\n cursor: default;\n}\n\n.blocklyFlyoutButtonShadow {\n fill: #666;\n}\n\n.blocklyFlyoutButton:hover {\n fill: #aaa;\n}\n\n.blocklyFlyoutLabel {\n cursor: default;\n}\n\n.blocklyFlyoutLabelBackground {\n opacity: 0;\n}\n");var module$exports$Blockly$BlocklyOptions={BlocklyOptions:function(){}};var module$exports$Blockly$VariablesDynamic={CATEGORY_NAME:"VARIABLE_DYNAMIC",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",$.module$exports$Blockly$Msg.Msg.NEW_STRING_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_STRING");b.push(c);c=document.createElement("button");c.setAttribute("text",$.module$exports$Blockly$Msg.Msg.NEW_NUMBER_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER");b.push(c);c=document.createElement("button");c.setAttribute("text",$.module$exports$Blockly$Msg.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<a.length){if(module$exports$Blockly$blocks.Blocks.variables_set_dynamic){var c=a[a.length-1],d=(0,$.module$exports$Blockly$utils$xml.createElement)("block");d.setAttribute("type","variables_set_dynamic");d.setAttribute("gap",24);d.appendChild((0,$.module$exports$Blockly$Variables.generateVariableFieldDom)(c));b.push(d)}if(module$exports$Blockly$blocks.Blocks.variables_get_dynamic)for(a.sort(module$exports$Blockly$VariableModel.VariableModel.compareByName),
c=0;d=a[c];c++){var e=(0,$.module$exports$Blockly$utils$xml.createElement)("block");e.setAttribute("type","variables_get_dynamic");e.setAttribute("gap",8);e.appendChild((0,$.module$exports$Blockly$Variables.generateVariableFieldDom)(d));b.push(e)}}return b}};var module$exports$Blockly$IRegistrableField={IRegistrableField:{}};var module$contents$Blockly$Procedures_procTupleComparator;$.module$exports$Blockly$Procedures={CATEGORY_NAME:"PROCEDURE",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||$.module$exports$Blockly$Msg.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;d<b.length;d++)if(b[d]!==c){var e=b[d];if(e.getProcedureDef&&(e=e.getProcedureDef(),$.module$exports$Blockly$Names.Names.equals(e[0],a)))return!0}return!1};
$.module$exports$Blockly$Procedures.rename=function(a){a=a.trim();var b=(0,$.module$exports$Blockly$Procedures.findLegalName)(a,this.getSourceBlock()),c=this.getValue();if(c!==a&&c!==b){a=this.getSourceBlock().workspace.getAllBlocks(!1);for(var d=0;d<a.length;d++){var e=a[d];e.renameProcedure&&e.renameProcedure(c,b)}}return b};
$.module$exports$Blockly$Procedures.flyoutCategory=function(a){function b(f,g){for(var h=0;h<f.length;h++){var k=f[h][0],l=f[h][1],m=(0,$.module$exports$Blockly$utils$xml.createElement)("block");m.setAttribute("type",g);m.setAttribute("gap",16);var n=(0,$.module$exports$Blockly$utils$xml.createElement)("mutation");n.setAttribute("name",k);m.appendChild(n);for(k=0;k<l.length;k++){var p=(0,$.module$exports$Blockly$utils$xml.createElement)("arg");p.setAttribute("name",l[k]);n.appendChild(p)}c.push(m)}}
var c=[];if(module$exports$Blockly$blocks.Blocks.procedures_defnoreturn){var d=(0,$.module$exports$Blockly$utils$xml.createElement)("block");d.setAttribute("type","procedures_defnoreturn");d.setAttribute("gap",16);var e=(0,$.module$exports$Blockly$utils$xml.createElement)("field");e.setAttribute("name","NAME");e.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFNORETURN_PROCEDURE));d.appendChild(e);c.push(d)}module$exports$Blockly$blocks.Blocks.procedures_defreturn&&
(d=(0,$.module$exports$Blockly$utils$xml.createElement)("block"),d.setAttribute("type","procedures_defreturn"),d.setAttribute("gap",16),e=(0,$.module$exports$Blockly$utils$xml.createElement)("field"),e.setAttribute("name","NAME"),e.appendChild((0,$.module$exports$Blockly$utils$xml.createTextNode)($.module$exports$Blockly$Msg.Msg.PROCEDURES_DEFRETURN_PROCEDURE)),d.appendChild(e),c.push(d));module$exports$Blockly$blocks.Blocks.procedures_ifreturn&&(d=(0,$.module$exports$Blockly$utils$xml.createElement)("block"),
d.setAttribute("type","procedures_ifreturn"),d.setAttribute("gap",16),c.push(d));c.length&&c[c.length-1].setAttribute("gap",24);a=(0,$.module$exports$Blockly$Procedures.allProcedures)(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c};
var module$contents$Blockly$Procedures_updateMutatorFlyout=function(a){for(var b=[],c=a.getBlocksByType("procedures_mutatorarg",!1),d=0,e;e=c[d];d++)b.push(e.getFieldValue("NAME"));c=(0,$.module$exports$Blockly$utils$xml.createElement)("xml");d=(0,$.module$exports$Blockly$utils$xml.createElement)("block");d.setAttribute("type","procedures_mutatorarg");e=(0,$.module$exports$Blockly$utils$xml.createElement)("field");e.setAttribute("name","NAME");b=(0,$.module$exports$Blockly$Variables.generateUniqueNameFromOptions)($.module$exports$Blockly$Procedures.DEFAULT_ARG,
b);b=(0,$.module$exports$Blockly$utils$xml.createTextNode)(b);e.appendChild(b);d.appendChild(e);c.appendChild(d);a.updateToolbox(c)};
$.module$exports$Blockly$Procedures.mutatorOpenListener=function(a){if(a.type===module$exports$Blockly$Events$utils.BUBBLE_OPEN&&"mutator"===a.bubbleType&&a.isOpen){a=module$exports$Blockly$Workspace.Workspace.getById(a.workspaceId).getBlockById(a.blockId);var b=a.type;if("procedures_defnoreturn"===b||"procedures_defreturn"===b)a=a.mutator.getWorkspace(),module$contents$Blockly$Procedures_updateMutatorFlyout(a),a.addChangeListener(module$contents$Blockly$Procedures_mutatorChangeListener)}};
var module$contents$Blockly$Procedures_mutatorChangeListener=function(a){if(a.type===module$exports$Blockly$Events$utils.CREATE||a.type===module$exports$Blockly$Events$utils.DELETE||a.type===module$exports$Blockly$Events$utils.CHANGE)a=module$exports$Blockly$Workspace.Workspace.getById(a.workspaceId),module$contents$Blockly$Procedures_updateMutatorFlyout(a)};
$.module$exports$Blockly$Procedures.getCallers=function(a,b){var c=[];b=b.getAllBlocks(!1);for(var d=0;d<b.length;d++){var e=b[d];e.getProcedureCall&&(e=e.getProcedureCall())&&$.module$exports$Blockly$Names.Names.equals(e,a)&&c.push(b[d])}return c};
$.module$exports$Blockly$Procedures.mutateCallers=function(a){var b=(0,module$exports$Blockly$Events$utils.getRecordUndo)(),c=a.getProcedureDef()[0],d=a.mutationToDom(!0);a=(0,$.module$exports$Blockly$Procedures.getCallers)(c,a.workspace);c=0;for(var e;e=a[c];c++){var f=e.mutationToDom();f=f&&(0,$.module$exports$Blockly$Xml.domToText)(f);e.domToMutation(d);var g=e.mutationToDom();g=g&&(0,$.module$exports$Blockly$Xml.domToText)(g);f!==g&&((0,module$exports$Blockly$Events$utils.setRecordUndo)(!1),(0,module$exports$Blockly$Events$utils.fire)(new ((0,module$exports$Blockly$Events$utils.get)(module$exports$Blockly$Events$utils.CHANGE))(e,
"mutation",null,f,g)),(0,module$exports$Blockly$Events$utils.setRecordUndo)(b))}};$.module$exports$Blockly$Procedures.getDefinition=function(a,b){b=b.getAllBlocks(!1);for(var c=0;c<b.length;c++){var d=b[c];if(d.getProcedureDef&&(d=d.getProcedureDef())&&$.module$exports$Blockly$Names.Names.equals(d[0],a))return b[c]}return null};$.Blockly={VERSION:"8.0.2"};$.Blockly.ALIGN_LEFT=$.module$exports$Blockly$Input.Align.LEFT;$.Blockly.ALIGN_CENTRE=$.module$exports$Blockly$Input.Align.CENTRE;$.Blockly.ALIGN_RIGHT=$.module$exports$Blockly$Input.Align.RIGHT;$.Blockly.INPUT_VALUE=$.module$exports$Blockly$ConnectionType.ConnectionType.INPUT_VALUE;$.Blockly.OUTPUT_VALUE=$.module$exports$Blockly$ConnectionType.ConnectionType.OUTPUT_VALUE;$.Blockly.NEXT_STATEMENT=$.module$exports$Blockly$ConnectionType.ConnectionType.NEXT_STATEMENT;
$.Blockly.PREVIOUS_STATEMENT=$.module$exports$Blockly$ConnectionType.ConnectionType.PREVIOUS_STATEMENT;$.Blockly.DUMMY_INPUT=$.module$exports$Blockly$inputTypes.inputTypes.DUMMY;$.Blockly.TOOLBOX_AT_TOP=module$exports$Blockly$utils$toolbox.Position.TOP;$.Blockly.TOOLBOX_AT_BOTTOM=module$exports$Blockly$utils$toolbox.Position.BOTTOM;$.Blockly.TOOLBOX_AT_LEFT=module$exports$Blockly$utils$toolbox.Position.LEFT;$.Blockly.TOOLBOX_AT_RIGHT=module$exports$Blockly$utils$toolbox.Position.RIGHT;
$.Blockly.svgResize=$.module$exports$Blockly$common.svgResize;var module$contents$Blockly_hideChaff=function(a){(0,$.module$exports$Blockly$common.getMainWorkspace)().hideChaff(a)};$.Blockly.hideChaff=module$contents$Blockly_hideChaff;$.Blockly.getMainWorkspace=$.module$exports$Blockly$common.getMainWorkspace;$.Blockly.defineBlocksWithJsonArray=$.module$exports$Blockly$common.defineBlocksWithJsonArray;$.Blockly.setParentContainer=$.module$exports$Blockly$common.setParentContainer;
Object.defineProperties($.Blockly,{alert:{set:function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.alert","December 2021","December 2022");(0,module$exports$Blockly$dialog.setAlert)(a)},get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.alert","December 2021","December 2022","Blockly.dialog.alert()");return module$exports$Blockly$dialog.alert}},confirm:{set:function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.confirm","December 2021","December 2022");
(0,module$exports$Blockly$dialog.setConfirm)(a)},get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.confirm","December 2021","December 2022","Blockly.dialog.confirm()");return module$exports$Blockly$dialog.confirm}},mainWorkspace:{set:function(a){(0,$.module$exports$Blockly$common.setMainWorkspace)(a)},get:function(){return(0,$.module$exports$Blockly$common.getMainWorkspace)()}},prompt:{set:function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.prompt","December 2021",
"December 2022");(0,module$exports$Blockly$dialog.setPrompt)(a)},get:function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.prompt","December 2021","December 2022","Blockly.dialog.prompt()");return module$exports$Blockly$dialog.prompt}},selected:{get:function(){return(0,$.module$exports$Blockly$common.getSelected)()},set:function(a){(0,$.module$exports$Blockly$common.setSelected)(a)}},HSV_SATURATION:{get:function(){return module$exports$Blockly$utils.colour.getHsvSaturation()},set:function(a){module$exports$Blockly$utils.colour.setHsvSaturation(a)}},
HSV_VALUE:{get:function(){return module$exports$Blockly$utils.colour.getHsvValue()},set:function(a){module$exports$Blockly$utils.colour.setHsvValue(a)}}});$.Blockly.svgSize=module$exports$Blockly$utils$svgMath.svgSize;var module$contents$Blockly_resizeSvgContentsLocal=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.resizeSvgContents","December 2021","December 2022","Blockly.WorkspaceSvg.resizeSvgContents");(0,module$exports$Blockly$WorkspaceSvg.resizeSvgContents)(a)};
$.Blockly.resizeSvgContents=module$contents$Blockly_resizeSvgContentsLocal;var module$contents$Blockly_copy=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.copy","December 2021","December 2022","Blockly.clipboard.copy");(0,module$exports$Blockly$clipboard.copy)(a)};$.Blockly.copy=module$contents$Blockly_copy;
var module$contents$Blockly_paste=function(){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.paste","December 2021","December 2022","Blockly.clipboard.paste");return!!(0,module$exports$Blockly$clipboard.paste)()};$.Blockly.paste=module$contents$Blockly_paste;var module$contents$Blockly_duplicate=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.duplicate","December 2021","December 2022","Blockly.clipboard.duplicate");(0,module$exports$Blockly$clipboard.duplicate)(a)};
$.Blockly.duplicate=module$contents$Blockly_duplicate;var module$contents$Blockly_isNumber=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.isNumber","December 2021","December 2022","Blockly.utils.string.isNumber");return module$exports$Blockly$utils.string.isNumber(a)};$.Blockly.isNumber=module$contents$Blockly_isNumber;
var module$contents$Blockly_hueToHex=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.hueToHex","December 2021","December 2022","Blockly.utils.colour.hueToHex");return(0,module$exports$Blockly$utils$colour.hueToHex)(a)};$.Blockly.hueToHex=module$contents$Blockly_hueToHex;
var module$contents$Blockly_bindEvent_=function(a,b,c,d){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.bindEvent_","December 2021","December 2022","Blockly.browserEvents.bind");return(0,module$exports$Blockly$browserEvents.bind)(a,b,c,d)};$.Blockly.bindEvent_=module$contents$Blockly_bindEvent_;var module$contents$Blockly_unbindEvent_=function(a){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.unbindEvent_","December 2021","December 2022","Blockly.browserEvents.unbind");return(0,module$exports$Blockly$browserEvents.unbind)(a)};
$.Blockly.unbindEvent_=module$contents$Blockly_unbindEvent_;var module$contents$Blockly_bindEventWithChecks_=function(a,b,c,d,e,f){(0,module$exports$Blockly$utils$deprecation.warn)("Blockly.bindEventWithChecks_","December 2021","December 2022","Blockly.browserEvents.conditionalBind");return(0,module$exports$Blockly$browserEvents.conditionalBind)(a,b,c,d,e,f)};$.Blockly.bindEventWithChecks_=module$contents$Blockly_bindEventWithChecks_;$.Blockly.COLLAPSE_CHARS=module$exports$Blockly$internalConstants.COLLAPSE_CHARS;
$.Blockly.DRAG_STACK=module$exports$Blockly$internalConstants.DRAG_STACK;$.Blockly.OPPOSITE_TYPE=module$exports$Blockly$internalConstants.OPPOSITE_TYPE;$.Blockly.RENAME_VARIABLE_ID=module$exports$Blockly$internalConstants.RENAME_VARIABLE_ID;$.Blockly.DELETE_VARIABLE_ID=module$exports$Blockly$internalConstants.DELETE_VARIABLE_ID;$.Blockly.COLLAPSED_INPUT_NAME=module$exports$Blockly$constants.COLLAPSED_INPUT_NAME;$.Blockly.COLLAPSED_FIELD_NAME=module$exports$Blockly$constants.COLLAPSED_FIELD_NAME;
$.Blockly.VARIABLE_CATEGORY_NAME=$.module$exports$Blockly$Variables.CATEGORY_NAME;$.Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME=module$exports$Blockly$VariablesDynamic.CATEGORY_NAME;$.Blockly.PROCEDURE_CATEGORY_NAME=$.module$exports$Blockly$Procedures.CATEGORY_NAME;$.Blockly.ASTNode=module$exports$Blockly$ASTNode.ASTNode;$.Blockly.BasicCursor=module$exports$Blockly$BasicCursor.BasicCursor;$.Blockly.Block=module$exports$Blockly$Block.Block;$.Blockly.BlocklyOptions=module$exports$Blockly$BlocklyOptions.BlocklyOptions;
$.Blockly.BlockDragger=module$exports$Blockly$BlockDragger.BlockDragger;$.Blockly.BlockDragSurfaceSvg=module$exports$Blockly$BlockDragSurfaceSvg.BlockDragSurfaceSvg;$.Blockly.BlockSvg=module$exports$Blockly$BlockSvg.BlockSvg;$.Blockly.Blocks=module$exports$Blockly$blocks.Blocks;$.Blockly.Bubble=module$exports$Blockly$Bubble.Bubble;$.Blockly.BubbleDragger=module$exports$Blockly$BubbleDragger.BubbleDragger;$.Blockly.CollapsibleToolboxCategory=module$exports$Blockly$CollapsibleToolboxCategory.CollapsibleToolboxCategory;
$.Blockly.Comment=module$exports$Blockly$Comment.Comment;$.Blockly.ComponentManager=module$exports$Blockly$ComponentManager.ComponentManager;$.Blockly.Connection=module$exports$Blockly$Connection.Connection;$.Blockly.ConnectionType=$.module$exports$Blockly$ConnectionType.ConnectionType;$.Blockly.ConnectionChecker=module$exports$Blockly$ConnectionChecker.ConnectionChecker;$.Blockly.ConnectionDB=module$exports$Blockly$ConnectionDB.ConnectionDB;$.Blockly.ContextMenu=$.module$exports$Blockly$ContextMenu;
$.Blockly.ContextMenuItems=module$exports$Blockly$ContextMenuItems;$.Blockly.ContextMenuRegistry=module$exports$Blockly$ContextMenuRegistry.ContextMenuRegistry;$.Blockly.Css=module$exports$Blockly$Css;$.Blockly.Cursor=module$exports$Blockly$Cursor.Cursor;$.Blockly.DeleteArea=module$exports$Blockly$DeleteArea.DeleteArea;$.Blockly.DragTarget=module$exports$Blockly$DragTarget.DragTarget;$.Blockly.DropDownDiv=module$exports$Blockly$dropDownDiv;$.Blockly.Events=$.module$exports$Blockly$Events;
$.Blockly.Extensions=$.module$exports$Blockly$Extensions;$.Blockly.Field=module$exports$Blockly$Field.Field;$.Blockly.FieldAngle=module$exports$Blockly$FieldAngle.FieldAngle;$.Blockly.FieldCheckbox=$.module$exports$Blockly$FieldCheckbox.FieldCheckbox;$.Blockly.FieldColour=module$exports$Blockly$FieldColour.FieldColour;$.Blockly.FieldDropdown=$.module$exports$Blockly$FieldDropdown.FieldDropdown;$.Blockly.FieldImage=$.module$exports$Blockly$FieldImage.FieldImage;$.Blockly.FieldLabel=$.module$exports$Blockly$FieldLabel.FieldLabel;
$.Blockly.FieldLabelSerializable=module$exports$Blockly$FieldLabelSerializable.FieldLabelSerializable;$.Blockly.FieldMultilineInput=module$exports$Blockly$FieldMultilineInput.FieldMultilineInput;$.Blockly.FieldNumber=module$exports$Blockly$FieldNumber.FieldNumber;$.Blockly.FieldTextInput=$.module$exports$Blockly$FieldTextInput.FieldTextInput;$.Blockly.FieldVariable=module$exports$Blockly$FieldVariable.FieldVariable;$.Blockly.Flyout=module$exports$Blockly$Flyout.Flyout;$.Blockly.FlyoutButton=module$exports$Blockly$FlyoutButton.FlyoutButton;
$.Blockly.FlyoutMetricsManager=module$exports$Blockly$FlyoutMetricsManager.FlyoutMetricsManager;$.Blockly.Generator=$.module$exports$Blockly$Generator.Generator;$.Blockly.Gesture=module$exports$Blockly$Gesture.Gesture;$.Blockly.Grid=module$exports$Blockly$Grid.Grid;$.Blockly.HorizontalFlyout=module$exports$Blockly$HorizontalFlyout.HorizontalFlyout;$.Blockly.IASTNodeLocation=module$exports$Blockly$IASTNodeLocation.IASTNodeLocation;$.Blockly.IASTNodeLocationSvg=module$exports$Blockly$IASTNodeLocationSvg.IASTNodeLocationSvg;
$.Blockly.IASTNodeLocationWithBlock=module$exports$Blockly$IASTNodeLocationWithBlock.IASTNodeLocationWithBlock;$.Blockly.IAutoHideable=module$exports$Blockly$IAutoHideable.IAutoHideable;$.Blockly.IBlockDragger=module$exports$Blockly$IBlockDragger.IBlockDragger;$.Blockly.IBoundedElement=module$exports$Blockly$IBoundedElement.IBoundedElement;$.Blockly.IBubble=module$exports$Blockly$IBubble.IBubble;$.Blockly.ICollapsibleToolboxItem=module$exports$Blockly$ICollapsibleToolboxItem.ICollapsibleToolboxItem;
$.Blockly.IComponent=module$exports$Blockly$IComponent.IComponent;$.Blockly.IConnectionChecker=module$exports$Blockly$IConnectionChecker.IConnectionChecker;$.Blockly.IContextMenu=module$exports$Blockly$IContextMenu.IContextMenu;$.Blockly.Icon=module$exports$Blockly$Icon.Icon;$.Blockly.ICopyable=module$exports$Blockly$ICopyable.ICopyable;$.Blockly.IDeletable=module$exports$Blockly$IDeletable.IDeletable;$.Blockly.IDeleteArea=module$exports$Blockly$IDeleteArea.IDeleteArea;$.Blockly.IDragTarget=module$exports$Blockly$IDragTarget.IDragTarget;
$.Blockly.IDraggable=module$exports$Blockly$IDraggable.IDraggable;$.Blockly.IFlyout=module$exports$Blockly$IFlyout.IFlyout;$.Blockly.IKeyboardAccessible=module$exports$Blockly$IKeyboardAccessible.IKeyboardAccessible;$.Blockly.IMetricsManager=module$exports$Blockly$IMetricsManager.IMetricsManager;$.Blockly.IMovable=module$exports$Blockly$IMovable.IMovable;$.Blockly.Input=$.module$exports$Blockly$Input.Input;$.Blockly.InsertionMarkerManager=module$exports$Blockly$InsertionMarkerManager.InsertionMarkerManager;
$.Blockly.IPositionable=module$exports$Blockly$IPositionable.IPositionable;$.Blockly.IRegistrable=module$exports$Blockly$IRegistrable.IRegistrable;$.Blockly.IRegistrableField=module$exports$Blockly$IRegistrableField.IRegistrableField;$.Blockly.ISelectable=module$exports$Blockly$ISelectable.ISelectable;$.Blockly.ISelectableToolboxItem=module$exports$Blockly$ISelectableToolboxItem.ISelectableToolboxItem;$.Blockly.IStyleable=module$exports$Blockly$IStyleable.IStyleable;$.Blockly.IToolbox=module$exports$Blockly$IToolbox.IToolbox;
$.Blockly.IToolboxItem=module$exports$Blockly$IToolboxItem.IToolboxItem;$.Blockly.Marker=module$exports$Blockly$Marker.Marker;$.Blockly.MarkerManager=module$exports$Blockly$MarkerManager.MarkerManager;$.Blockly.Menu=module$exports$Blockly$Menu.Menu;$.Blockly.MenuItem=module$exports$Blockly$MenuItem.MenuItem;$.Blockly.MetricsManager=module$exports$Blockly$MetricsManager.MetricsManager;$.Blockly.Mutator=$.module$exports$Blockly$Mutator.Mutator;$.Blockly.Msg=$.module$exports$Blockly$Msg.Msg;
$.Blockly.Names=$.module$exports$Blockly$Names.Names;$.Blockly.Options=module$exports$Blockly$Options.Options;$.Blockly.Procedures=$.module$exports$Blockly$Procedures;$.Blockly.RenderedConnection=module$exports$Blockly$RenderedConnection.RenderedConnection;$.Blockly.Scrollbar=module$exports$Blockly$Scrollbar.Scrollbar;$.Blockly.ScrollbarPair=module$exports$Blockly$ScrollbarPair.ScrollbarPair;$.Blockly.ShortcutItems=module$exports$Blockly$ShortcutItems;$.Blockly.ShortcutRegistry=module$exports$Blockly$ShortcutRegistry.ShortcutRegistry;
$.Blockly.TabNavigateCursor=module$exports$Blockly$TabNavigateCursor.TabNavigateCursor;$.Blockly.Theme=module$exports$Blockly$Theme.Theme;$.Blockly.Themes=module$exports$Blockly$Themes;$.Blockly.ThemeManager=module$exports$Blockly$ThemeManager.ThemeManager;$.Blockly.Toolbox=module$exports$Blockly$Toolbox.Toolbox;$.Blockly.ToolboxCategory=module$exports$Blockly$ToolboxCategory.ToolboxCategory;$.Blockly.ToolboxItem=module$exports$Blockly$ToolboxItem.ToolboxItem;$.Blockly.ToolboxSeparator=module$exports$Blockly$ToolboxSeparator.ToolboxSeparator;
$.Blockly.Tooltip=module$exports$Blockly$Tooltip;$.Blockly.Touch=module$exports$Blockly$Touch;$.Blockly.TouchGesture=module$exports$Blockly$TouchGesture.TouchGesture;$.Blockly.Trashcan=module$exports$Blockly$Trashcan.Trashcan;$.Blockly.VariableMap=module$exports$Blockly$VariableMap.VariableMap;$.Blockly.VariableModel=module$exports$Blockly$VariableModel.VariableModel;$.Blockly.Variables=$.module$exports$Blockly$Variables;$.Blockly.VariablesDynamic=module$exports$Blockly$VariablesDynamic;
$.Blockly.VerticalFlyout=module$exports$Blockly$VerticalFlyout.VerticalFlyout;$.Blockly.Warning=module$exports$Blockly$Warning.Warning;$.Blockly.WidgetDiv=module$exports$Blockly$WidgetDiv;$.Blockly.Workspace=module$exports$Blockly$Workspace.Workspace;$.Blockly.WorkspaceAudio=module$exports$Blockly$WorkspaceAudio.WorkspaceAudio;$.Blockly.WorkspaceComment=module$exports$Blockly$WorkspaceComment.WorkspaceComment;$.Blockly.WorkspaceCommentSvg=module$exports$Blockly$WorkspaceCommentSvg.WorkspaceCommentSvg;
$.Blockly.WorkspaceDragSurfaceSvg=module$exports$Blockly$WorkspaceDragSurfaceSvg.WorkspaceDragSurfaceSvg;$.Blockly.WorkspaceDragger=module$exports$Blockly$WorkspaceDragger.WorkspaceDragger;$.Blockly.WorkspaceSvg=module$exports$Blockly$WorkspaceSvg.WorkspaceSvg;$.Blockly.Xml=$.module$exports$Blockly$Xml;$.Blockly.ZoomControls=module$exports$Blockly$ZoomControls.ZoomControls;$.Blockly.blockAnimations=module$exports$Blockly$blockAnimations;$.Blockly.blockRendering=module$exports$Blockly$blockRendering;
$.Blockly.browserEvents=module$exports$Blockly$browserEvents;$.Blockly.bumpObjects=module$exports$Blockly$bumpObjects;$.Blockly.clipboard=module$exports$Blockly$clipboard;$.Blockly.common=$.module$exports$Blockly$common;$.Blockly.config=$.module$exports$Blockly$config.config;$.Blockly.connectionTypes=$.module$exports$Blockly$ConnectionType.ConnectionType;$.Blockly.constants=module$exports$Blockly$constants;$.Blockly.dialog=module$exports$Blockly$dialog;$.Blockly.fieldRegistry=module$exports$Blockly$fieldRegistry;
$.Blockly.geras=module$exports$Blockly$geras;$.Blockly.inject=module$exports$Blockly$inject.inject;$.Blockly.inputTypes=$.module$exports$Blockly$inputTypes.inputTypes;$.Blockly.minimalist=module$exports$Blockly$minimalist;$.Blockly.registry=module$exports$Blockly$registry;
$.Blockly.serialization={blocks:module$exports$Blockly$serialization$blocks,exceptions:module$exports$Blockly$serialization$exceptions,priorities:module$exports$Blockly$serialization$priorities,registry:module$exports$Blockly$serialization$registry,variables:module$exports$Blockly$serialization$variables,workspaces:module$exports$Blockly$serialization$workspaces,ISerializer:module$exports$Blockly$serialization$ISerializer.ISerializer};$.Blockly.thrasos=module$exports$Blockly$thrasos;
$.Blockly.uiPosition=module$exports$Blockly$uiPosition;$.Blockly.utils=module$exports$Blockly$utils;$.Blockly.zelos=module$exports$Blockly$zelos;"Blockly"in $.module$exports$Blockly$utils$global.globalThis||($.module$exports$Blockly$utils$global.globalThis.Blockly={Msg:$.module$exports$Blockly$Msg.Msg});
if(!COMPILED&&"object"===typeof $.module$exports$Blockly$utils$global.globalThis.Blockly&&$.module$exports$Blockly$utils$global.globalThis.Blockly!==$.Blockly){var descriptors=Object.getOwnPropertyDescriptors($.Blockly),accessors={},key;for(key in descriptors)if(descriptors[key].get||descriptors[key].set)accessors[key]=descriptors[key];Object.defineProperties($.module$exports$Blockly$utils$global.globalThis.Blockly,accessors)};
$.Blockly.__namespace__=$;
return $.Blockly;
}));
//# sourceMappingURL=blockly_compressed.js.map