// Automatically generated file.  Do not edit!

'use strict';var b,g={ed:{}};g.ed.Ft=!1;g.ed.register=function(a){if(g.ed.Ft)throw Error("CSS already injected");Array.prototype.push.apply(g.ed.Oq,a);a.length=0};g.ed.Th=function(a,c){if(!g.ed.Ft){g.ed.Ft=!0;var d=g.ed.Oq.join("\n");g.ed.Oq.length=0;a&&(a=c.replace(/[\\/]$/,""),d=d.replace(/<<<PATH>>>/g,a),a=document.createElement("style"),d=document.createTextNode(d),a.appendChild(d),document.head.insertBefore(a,document.head.firstChild))}};g.ed.Su=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")};
g.ed.Oq=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;",
"}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);",
"color: #000;","display: none;","font-family: sans-serif;","font-size: 9pt;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: fixed;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-radius: 2px;","padding: 4px;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;",
"overflow-x: hidden;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;","cursor: pointer;","}",".arrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;",
"border-color: inherit;","}",".arrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;",
"stroke-width: 1;","}",".blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<<PATH>>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;",
"}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;",
"}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none","}",".blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",".blocklyReplaceable .blocklyPathLight,",".blocklyReplaceable .blocklyPathDark {","display: none;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;",
"font-size: 11pt;","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text {","fill: #000;","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill: #000;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklySvg text, .blocklyBlockDragSurface text {",
"user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;",
"}",".blocklyCommentForeignObject {","position: relative;","z-index: 0;","}",".blocklyCommentRect {","fill: #E7DE8E;","stroke: #bcA903;","stroke-width: 1px","}",".blocklyCommentTarget {","fill: transparent;","stroke: #bcA903;","}",".blocklyCommentTargetFocused {","fill: none;","}",".blocklyCommentHandleTarget {","fill: none;","}",".blocklyCommentHandleTargetFocused {","fill: transparent;","}",".blocklyFocused>.blocklyCommentRect {","fill: #B9B272;","stroke: #B9B272;","}",".blocklySelected>.blocklyCommentTarget {",
"stroke: #fc3;","stroke-width: 3px;","}",".blocklyCommentTextarea {","background-color: #fef49c;","border: 0;","outline: 0;","margin: 0;","padding: 3px;","resize: none;","display: block;","overflow: hidden;","}",".blocklyCommentDeleteIcon {","cursor: pointer;","fill: #000;","display: none","}",".blocklySelected > .blocklyCommentDeleteIcon {","display: block","}",".blocklyDeleteIconShape {","fill: #000;","stroke: #000;","stroke-width: 1px;","}",".blocklyDeleteIconShape.blocklyDeleteIconHighlighted {",
"stroke: #fc3;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {",
"z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",
".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {",
"padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalCursor {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;",
"border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',
"outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem,",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem,",".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem {",
"padding-left: 12px;","}",".blocklyWidgetDiv .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-content {","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {","color: #000;","}",".blocklyWidgetDiv .goog-menuitem-disabled,",".blocklyDropDownDiv .goog-menuitem-disabled {","cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {",
"color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight ,",".blocklyDropDownDiv .goog-menuitem-highlight {","background-color: rgba(0,0,0,.1);","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-icon {",
"background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",
".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-right: -24px;","}"];
g.g={};g.g.global=function(){return"object"===typeof self?self:"object"===typeof window?window:"object"===typeof global?global:this}();g.h={};g.g.global.Blockly||(g.g.global.Blockly={});g.g.global.Blockly.Msg||(g.g.global.Blockly.Msg=g.h);g.g.N=function(a,c){this.x=a;this.y=c};g.g.N.He=function(a,c){return a==c?!0:a&&c?a.x==c.x&&a.y==c.y:!1};g.g.N.jp=function(a,c){var d=a.x-c.x;a=a.y-c.y;return Math.sqrt(d*d+a*a)};g.g.N.XF=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};g.g.N.xm=function(a,c){return new g.g.N(a.x-c.x,a.y-c.y)};g.g.N.sum=function(a,c){return new g.g.N(a.x+c.x,a.y+c.y)};g.g.N.prototype.scale=function(a){this.x*=a;this.y*=a;return this};g.g.N.prototype.translate=function(a,c){this.x+=a;this.y+=c;return this};g.g.eb={};g.g.eb.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};g.g.eb.Zu=function(a){return a.length?a.reduce(function(c,d){return c.length<d.length?c:d}).length:0};g.g.eb.WD=function(a,c){if(!a.length)return 0;if(1==a.length)return a[0].length;var d=0;c=c||g.g.eb.Zu(a);for(var e=0;e<c;e++){for(var f=a[0][e],h=1;h<a.length;h++)if(f!=a[h][e])return d;" "==f&&(d=e+1)}for(h=1;h<a.length;h++)if((f=a[h][e])&&" "!=f)return d;return c};
g.g.eb.XD=function(a,c){if(!a.length)return 0;if(1==a.length)return a[0].length;var d=0;c=c||g.g.eb.Zu(a);for(var e=0;e<c;e++){for(var f=a[0].substr(-e-1,1),h=1;h<a.length;h++)if(f!=a[h].substr(-e-1,1))return d;" "==f&&(d=e+1)}for(h=1;h<a.length;h++)if((f=a[h].charAt(a[h].length-e-1))&&" "!=f)return d;return c};g.g.eb.FA=function(a,c){a=a.split("\n");for(var d=0;d<a.length;d++)a[d]=g.g.eb.MH(a[d],c);return a.join("\n")};
g.g.eb.MH=function(a,c){if(a.length<=c)return a;for(var d=a.trim().split(/\s+/),e=0;e<d.length;e++)d[e].length>c&&(c=d[e].length);e=-Infinity;var f=1;do{var h=e;var k=a;a=[];var l=d.length/f,m=1;for(e=0;e<d.length-1;e++)m<(e+1.5)/l?(m++,a[e]=!0):a[e]=!1;a=g.g.eb.GA(d,a,c);e=g.g.eb.pv(d,a,c);a=g.g.eb.NH(d,a);f++}while(e>h);return k};
g.g.eb.pv=function(a,c,d){for(var e=[0],f=[],h=0;h<a.length;h++)e[e.length-1]+=a[h].length,!0===c[h]?(e.push(0),f.push(a[h].charAt(a[h].length-1))):!1===c[h]&&e[e.length-1]++;a=Math.max.apply(Math,e);for(h=c=0;h<e.length;h++)c-=2*Math.pow(Math.abs(d-e[h]),1.5),c-=Math.pow(a-e[h],1.5),-1!=".?!".indexOf(f[h])?c+=d/3:-1!=",;)]}".indexOf(f[h])&&(c+=d/4);1<e.length&&e[e.length-1]<=e[e.length-2]&&(c+=.5);return c};
g.g.eb.GA=function(a,c,d){for(var e=g.g.eb.pv(a,c,d),f,h=0;h<c.length-1;h++)if(c[h]!=c[h+1]){var k=[].concat(c);k[h]=!k[h];k[h+1]=!k[h+1];var l=g.g.eb.pv(a,k,d);l>e&&(e=l,f=k)}return f?g.g.eb.GA(a,f,d):c};g.g.eb.NH=function(a,c){for(var d=[],e=0;e<a.length;e++)d.push(a[e]),void 0!==c[e]&&d.push(c[e]?"\n":" ");return d.join("")};g.g.$e=function(a,c){this.width=a;this.height=c};g.g.$e.He=function(a,c){return a==c?!0:a&&c?a.width==c.width&&a.height==c.height:!1};g.g.style={};g.g.style.Ug=function(a){if("none"!=g.g.style.Ay(a,"display"))return g.g.style.yy(a);var c=a.style,d=c.display,e=c.visibility,f=c.position;c.visibility="hidden";c.position="absolute";c.display="inline";var h=a.offsetWidth;a=a.offsetHeight;c.display=d;c.position=f;c.visibility=e;return new g.g.$e(h,a)};g.g.style.yy=function(a){return new g.g.$e(a.offsetWidth,a.offsetHeight)};g.g.style.Ay=function(a,c){return g.g.style.getComputedStyle(a,c)||g.g.style.WE(a,c)||a.style&&a.style[c]};
g.g.style.getComputedStyle=function(a,c){return document.defaultView&&document.defaultView.getComputedStyle&&(a=document.defaultView.getComputedStyle(a,null))?a[c]||a.getPropertyValue(c)||"":""};g.g.style.WE=function(a,c){return a.currentStyle?a.currentStyle[c]:null};g.g.style.wp=function(a){var c=new g.g.N(0,0);a=a.getBoundingClientRect();var d=document.documentElement;d=new g.g.N(window.pageXOffset||d.scrollLeft,window.pageYOffset||d.scrollTop);c.x=a.left+d.x;c.y=a.top+d.y;return c};
g.g.style.Ey=function(){var a=document.body,c=document.documentElement;return new g.g.N(a.scrollLeft||c.scrollLeft,a.scrollTop||c.scrollTop)};g.g.style.Uu=function(a,c){a.style.display=c?"":"none"};g.g.style.Xk=function(){return"rtl"==g.g.style.Ay(void 0,"direction")};
g.g.style.TE=function(a){var c=g.g.style.getComputedStyle(a,"borderLeftWidth"),d=g.g.style.getComputedStyle(a,"borderRightWidth"),e=g.g.style.getComputedStyle(a,"borderTopWidth");a=g.g.style.getComputedStyle(a,"borderBottomWidth");return{top:parseFloat(e),right:parseFloat(d),bottom:parseFloat(a),left:parseFloat(c)}};g.g.style.Ru=function(a,c){a=g.g.style.YE(a,c);c.scrollLeft=a.x;c.scrollTop=a.y};
g.g.style.YE=function(a,c){var d=g.g.style.wp(a),e=g.g.style.wp(c),f=g.g.style.TE(c),h=d.x-e.x-f.left;d=d.y-e.y-f.top;a=g.g.style.yy(a);e=c.clientHeight-a.height;f=c.scrollLeft;var k=c.scrollTop;f+=Math.min(h,Math.max(h-(c.clientWidth-a.width),0));k+=Math.min(d,Math.max(d-e,0));return new g.g.N(f,k)};g.g.userAgent={};
(function(a){function c(e){return-1!=d.indexOf(e.toUpperCase())}g.g.userAgent.raw=a;var d=g.g.userAgent.raw.toUpperCase();g.g.userAgent.vg=c("Trident")||c("MSIE");g.g.userAgent.qo=c("Edge");g.g.userAgent.ZB=c("JavaFX");g.g.userAgent.Qr=c("WebKit")&&!g.g.userAgent.qo;g.g.userAgent.Yq=c("Gecko")&&!g.g.userAgent.Qr&&!g.g.userAgent.vg&&!g.g.userAgent.qo;g.g.userAgent.xi=c("Android");g.g.userAgent.xg=c("iPad");g.g.userAgent.aw=c("iPod");g.g.userAgent.cr=c("iPhone")&&!g.g.userAgent.xg&&!g.g.userAgent.aw;
g.g.userAgent.kC=c("Macintosh");g.g.userAgent.VC=g.g.userAgent.xg||g.g.userAgent.xi&&!c("Mobile")||c("Silk");g.g.userAgent.iw=!g.g.userAgent.VC&&(g.g.userAgent.aw||g.g.userAgent.cr||g.g.userAgent.xi||c("IEMobile"))})(g.g.global.navigator&&g.g.global.navigator.userAgent||"");
g.g.mG=function(a){a.preventDefault();a.stopPropagation()};g.g.Pp=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};
g.g.Ke=function(a){var c=new g.g.N(0,0),d=a.getAttribute("x");d&&(c.x=parseInt(d,10));if(d=a.getAttribute("y"))c.y=parseInt(d,10);if(d=(d=a.getAttribute("transform"))&&d.match(g.g.Ke.iD))c.x+=Number(d[1]),d[3]&&(c.y+=Number(d[3]));(a=a.getAttribute("style"))&&-1<a.indexOf("translate")&&(a=a.match(g.g.Ke.jD))&&(c.x+=Number(a[1]),a[3]&&(c.y+=Number(a[3])));return c};
g.g.Jm=function(a){for(var c=0,d=0;a;){var e=g.g.Ke(a);c+=e.x;d+=e.y;if(-1!=(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv "))break;a=a.parentNode}return new g.g.N(c,d)};g.g.Ke.iD=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/;g.g.Ke.jD=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/;g.g.tj=function(a){return a.ctrlKey&&g.g.userAgent.kC?!0:2==a.button};
g.g.kn=function(a,c,d){var e=c.createSVGPoint();e.x=a.clientX;e.y=a.clientY;d||(d=c.getScreenCTM().inverse());return e.matrixTransform(d)};g.g.xy=function(a){switch(a.deltaMode){case 0:return{x:a.deltaX,y:a.deltaY};case 1:return{x:a.deltaX*g.ew,y:a.deltaY*g.ew};case 2:return{x:a.deltaX*g.pw,y:a.deltaY*g.pw}}};g.g.uH=function(a){return g.g.gv(a,!0)};g.g.Xd=function(a){if("string"!=typeof a)return a;a=g.g.gv(a,!1);return a.length?a[0]:""};
g.g.bx=function(a){for(var c=g.h,d=a.match(/%{BKY_[A-Z]\w*}/ig),e=0;e<d.length;e++)void 0==c[d[e].toUpperCase().slice(6,-1)]&&console.log("WARNING: No message string for "+d[e]+" in "+a)};
g.g.gv=function(a,c){var d=[],e=a.split("");e.push("");var f=0;a=[];for(var h=null,k=0;k<e.length;k++){var l=e[k];0==f?"%"==l?((l=a.join(""))&&d.push(l),a.length=0,f=1):a.push(l):1==f?"%"==l?(a.push(l),f=0):c&&"0"<=l&&"9">=l?(f=2,h=l,(l=a.join(""))&&d.push(l),a.length=0):"{"==l?f=3:(a.push("%",l),f=0):2==f?"0"<=l&&"9">=l?h+=l:(d.push(parseInt(h,10)),k--,f=0):3==f&&(""==l?(a.splice(0,0,"%{"),k--,f=0):"}"!=l?a.push(l):(f=a.join(""),/[A-Z]\w*/i.test(f)?(l=f.toUpperCase(),(l=g.g.eb.startsWith(l,"BKY_")?
l.substring(4):null)&&l in g.h?(f=g.h[l],"string"==typeof f?Array.prototype.push.apply(d,g.g.gv(f,c)):c?d.push(String(f)):d.push(f)):d.push("%{"+f+"}")):d.push("%{"+f+"}"),f=a.length=0))}(l=a.join(""))&&d.push(l);c=[];for(k=a.length=0;k<d.length;++k)"string"==typeof d[k]?a.push(d[k]):((l=a.join(""))&&c.push(l),a.length=0,c.push(d[k]));(l=a.join(""))&&c.push(l);a.length=0;return c};g.g.Rg=function(){for(var a=g.g.Rg.kA.length,c=[],d=0;20>d;d++)c[d]=g.g.Rg.kA.charAt(Math.random()*a);return c.join("")};
g.g.Rg.kA="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
g.g.oj=function(){if(void 0!==g.g.oj.ps)return g.g.oj.ps;if(!g.g.global.getComputedStyle)return!1;var a=document.createElement("p"),c="none",d={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(a,null);for(var e in d)if(void 0!==a.style[e]){a.style[e]="translate3d(1px,1px,1px)";c=g.g.global.getComputedStyle(a);if(!c)return document.body.removeChild(a),!1;c=c.getPropertyValue(d[e])}document.body.removeChild(a);
g.g.oj.ps="none"!==c;return g.g.oj.ps};g.g.aA=function(a){if("object"!=typeof document)throw Error("Blockly.utils.runAfterPageLoad() requires browser document.");if("complete"==document.readyState)a();else var c=setInterval(function(){"complete"==document.readyState&&(clearInterval(c),a())},10)};g.g.iF=function(){var a=g.g.style.Ey();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}};
g.g.Qo=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};g.g.bF=function(){var a=document.documentElement,c=window;return g.g.userAgent.vg&&c.pageYOffset!=a.scrollTop?new g.g.N(a.scrollLeft,a.scrollTop):new g.g.N(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};g.g.gt=function(a,c){var d=Object.create(null),e=p(a,!0);c&&(a=q(a))&&(a=e.indexOf(a),e.splice(a,e.length-a));for(a=0;c=e[a];a++)d[c.type]?d[c.type]++:d[c.type]=1;return d};
g.g.YG=function(a,c){var d=c.x;c=c.y;var e=aa(a).getBoundingClientRect();d=new g.g.N(d-e.left,c-e.top);c=g.g.Jm(a.fb);return g.g.N.xm(d,c).scale(1/a.scale)};g.g.o={};g.g.o.Vl="http://www.w3.org/2000/svg";g.g.o.Fi="http://www.w3.org/1999/xhtml";g.g.o.Kf="http://www.w3.org/1999/xlink";g.g.o.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};g.g.o.Wi=null;g.g.o.ns=0;g.g.o.I=function(a,c,d){a=document.createElementNS(g.g.o.Vl,a);for(var e in c)a.setAttribute(e,c[e]);document.body.runtimeStyle&&(a.runtimeStyle=a.currentStyle=a.style);d&&d.appendChild(a);return a};
g.g.o.mb=function(a,c){var d=a.getAttribute("class")||"";if(-1!=(" "+d+" ").indexOf(" "+c+" "))return!1;d&&(d+=" ");a.setAttribute("class",d+c);return!0};g.g.o.Tb=function(a,c){var d=a.getAttribute("class");if(-1==(" "+d+" ").indexOf(" "+c+" "))return!1;d=d.split(/\s+/);for(var e=0;e<d.length;e++)d[e]&&d[e]!=c||(d.splice(e,1),e--);d.length?a.setAttribute("class",d.join(" ")):a.removeAttribute("class");return!0};g.g.o.yt=function(a,c){return-1!=(" "+a.getAttribute("class")+" ").indexOf(" "+c+" ")};
g.g.o.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};g.g.o.nj=function(a,c){var d=c.nextSibling;c=c.parentNode;if(!c)throw Error("Reference node has no parent.");d?c.insertBefore(a,d):c.appendChild(a)};g.g.o.containsNode=function(a,c){return!!(a.compareDocumentPosition(c)&g.g.o.Node.DOCUMENT_POSITION_CONTAINED_BY)};g.g.o.An=function(a,c){a.style.transform=c;a.style["-webkit-transform"]=c};g.g.o.In=function(){g.g.o.ns++;g.g.o.Wi||(g.g.o.Wi={})};
g.g.o.Jn=function(){g.g.o.ns--;g.g.o.ns||(g.g.o.Wi=null)};g.g.o.yp=function(a){var c=a.textContent+"\n"+a.className.baseVal,d;if(g.g.o.Wi&&(d=g.g.o.Wi[c]))return d;try{d=g.g.userAgent.vg||g.g.userAgent.qo?a.getBBox().width:a.getComputedTextLength()}catch(e){return 8*a.textContent.length}g.g.o.Wi&&(g.g.o.Wi[c]=d);return d};
g.fk=function(a,c,d,e){this.s=a;this.qb=c;this.mg=d.getAttribute("text");this.nd=new g.g.N(0,0);this.Zg=e;this.To=d.getAttribute("callbackKey")||d.getAttribute("callbackkey");this.yx=d.getAttribute("web-class")||null};g.fk.Xe=5;b=g.fk.prototype;b.width=0;b.height=0;b.Qe=null;
b.Ia=function(){var a=this.Zg?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.yx&&(a+=" "+this.yx);this.H=g.g.o.I("g",{"class":a},this.s.fb);if(!this.Zg)var c=g.g.o.I("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.H);a=g.g.o.I("rect",{"class":this.Zg?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.H);var d=g.g.o.I("text",{"class":this.Zg?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.H);d.textContent=g.g.Xd(this.mg);
this.Zg&&(this.ev=d,this.s.Wb.subscribe(this.ev,"flyoutText","fill"));this.width=g.g.o.yp(d);this.height=20;this.Zg||(this.width+=2*g.fk.Xe,c.setAttribute("width",this.width),c.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);d.setAttribute("x",this.width/2);d.setAttribute("y",this.height-g.fk.Xe);ba(this);this.Qe=g.la(this.H,"mouseup",this,this.GG);return this.H};b.show=function(){ba(this);this.H.setAttribute("display","block")};
function ba(a){a.H.setAttribute("transform","translate("+a.nd.x+","+a.nd.y+")")}b.moveTo=function(a,c){this.nd.x=a;this.nd.y=c;ba(this)};b.J=function(){this.Qe&&g.Xa(this.Qe);this.H&&g.g.o.removeNode(this.H);this.ev&&this.s.Wb.unsubscribe(this.ev)};
b.GG=function(a){(a=this.qb.Tg(a))&&a.cancel();this.Zg&&this.To?console.warn("Labels should not have callbacks. Label text: "+this.mg):this.Zg||this.To&&ca(this.qb,this.To)?this.Zg||ca(this.qb,this.To)(this):console.warn("Buttons should have callbacks. Button text: "+this.mg)};g.ed.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,},.blocklyFlyoutLabelText {,fill: #000;,}".split(","));g.Touch={};g.Touch.Gw="ontouchstart"in g.g.global||!!(g.g.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!g.g.global.navigator||!g.g.global.navigator.maxTouchPoints&&!g.g.global.navigator.msMaxTouchPoints);g.Touch.Pn=null;g.Touch.Hf={};
g.g.global.PointerEvent?g.Touch.Hf={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:g.Touch.Gw&&(g.Touch.Hf={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});g.Sp=0;
g.VF=function(a,c){g.ai();a.changedTouches&&1!=a.changedTouches.length||(g.Sp=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);c&&da(c,a)},g.hC))};g.ai=function(){g.Sp&&(clearTimeout(g.Sp),g.Sp=0)};g.Touch.Dh=function(){g.Touch.Pn=null};g.Touch.$u=function(a){return!g.Touch.OF(a)||g.Touch.OD(a)};
g.Touch.Ap=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"};g.Touch.OD=function(a){var c=g.Touch.Ap(a);return void 0!==g.Touch.Pn&&null!==g.Touch.Pn?g.Touch.Pn==c:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(g.Touch.Pn=c,!0):!1};
g.Touch.$G=function(a){if(g.g.eb.startsWith(a.type,"touch")){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY}};g.Touch.OF=function(a){return g.g.eb.startsWith(a.type,"touch")||g.g.eb.startsWith(a.type,"mouse")||g.g.eb.startsWith(a.type,"pointer")};g.Touch.Rp=function(a){return g.g.eb.startsWith(a.type,"touch")||g.g.eb.startsWith(a.type,"pointer")};
g.Touch.gH=function(a){var c=[];if(a.changedTouches)for(var d=0;d<a.changedTouches.length;d++)c[d]={type:a.type,changedTouches:[a.changedTouches[d]],target:a.target,stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()}};else c.push(a);return c};
g.rk=function(a){this.s=a;this.le=new g.La(a,!0,!0,"blocklyMainWorkspaceScrollbar");this.ue=new g.La(a,!1,!0,"blocklyMainWorkspaceScrollbar");this.om=g.g.o.I("rect",{height:g.La.tc,width:g.La.tc,"class":"blocklyScrollbarBackground"},null);g.g.o.nj(this.om,a.yf)};g.rk.prototype.Hb=null;g.rk.prototype.J=function(){g.g.o.removeNode(this.om);this.Hb=this.s=this.om=null;this.le.J();this.le=null;this.ue.J();this.ue=null};
g.rk.prototype.resize=function(){var a=this.s.hc();if(a){var c=!1,d=!1;this.Hb&&this.Hb.rb==a.rb&&this.Hb.yb==a.yb&&this.Hb.Ac==a.Ac&&this.Hb.oc==a.oc?(this.Hb&&this.Hb.ff==a.ff&&this.Hb.ec==a.ec&&this.Hb.Cc==a.Cc||(c=!0),this.Hb&&this.Hb.Pd==a.Pd&&this.Hb.mc==a.mc&&this.Hb.pc==a.pc||(d=!0)):d=c=!0;c&&this.le.resize(a);d&&this.ue.resize(a);this.Hb&&this.Hb.rb==a.rb&&this.Hb.oc==a.oc||this.om.setAttribute("x",this.ue.nd.x);this.Hb&&this.Hb.yb==a.yb&&this.Hb.Ac==a.Ac||this.om.setAttribute("y",this.le.nd.y);
this.Hb=a}};g.rk.prototype.set=function(a,c){var d={};a*=this.le.Ic;c*=this.ue.Ic;var e=this.ue.Te,f=a/this.le.Te;d.x=isNaN(f)?0:f;e=c/e;d.y=isNaN(e)?0:e;this.s.pi(d);ea(this.le,a);ea(this.ue,c)};
g.La=function(a,c,d,e){this.s=a;this.al=d||!1;this.lj=c;this.Hb=null;this.pm(e);this.nd=new g.g.N(0,0);a=g.La.tc;c?(this.Mc.setAttribute("height",a),this.$f.setAttribute("height",a),this.Zd.setAttribute("height",a-5),this.Zd.setAttribute("y",2.5),this.$m="width",this.Nz="x"):(this.Mc.setAttribute("width",a),this.$f.setAttribute("width",a),this.Zd.setAttribute("width",a-5),this.Zd.setAttribute("x",2.5),this.$m="height",this.Nz="y");this.Gz=g.la(this.Mc,"mousedown",this,this.zG);this.Hz=g.la(this.Zd,
"mousedown",this,this.AG)};b=g.La.prototype;b.xu=new g.g.N(0,0);b.mA=0;b.Te=0;b.Nh=0;b.Nm=0;b.Zh=!0;b.Yi=!0;g.La.tc=15;g.Touch.Gw&&(g.La.tc=25);g.La.YF=function(a,c){return a&&c&&a.rb==c.rb&&a.yb==c.yb&&a.ec==c.ec&&a.mc==c.mc&&a.Ac==c.Ac&&a.oc==c.oc&&a.ff==c.ff&&a.Pd==c.Pd&&a.Cc==c.Cc&&a.pc==c.pc?!0:!1};
g.La.prototype.J=function(){fa();g.Xa(this.Gz);this.Gz=null;g.Xa(this.Hz);this.Hz=null;g.g.o.removeNode(this.$f);this.Mc=this.H=this.$f=null;this.Zd&&(this.s.Wb.unsubscribe(this.Zd),this.Zd=null);this.s=null};function ea(a,c){a.Nm=c;a.Zd.setAttribute(a.Nz,a.Nm)}function ha(a,c){a.Te=c;a.$f.setAttribute(a.$m,a.Te);a.Mc.setAttribute(a.$m,a.Te)}g.rk.prototype.Ij=function(a){this.le.Ij(a);this.ue.Ij(a)};
function ia(a,c,d){a.nd.x=c;a.nd.y=d;g.g.o.An(a.$f,"translate("+(a.nd.x+a.xu.x)+"px,"+(a.nd.y+a.xu.y)+"px)")}b=g.La.prototype;b.resize=function(a){if(!a&&(a=this.s.hc(),!a))return;g.La.YF(a,this.Hb)||(this.Hb=a,this.lj?ja(this,a):ka(this,a),la(this))};function ja(a,c){var d=c.rb-1;a.al&&(d-=g.La.tc);ha(a,Math.max(0,d));d=c.oc+.5;a.al&&a.s.G&&(d+=g.La.tc);ia(a,d,c.Ac+c.yb-g.La.tc-.5);ma(a,c)}
function ma(a,c){a.al||a.Vb(a.Te<c.ff);a.Ic=a.Te/c.ff;if(-Infinity==a.Ic||Infinity==a.Ic||isNaN(a.Ic))a.Ic=0;a.Nh=Math.max(0,c.rb*a.Ic);a.Zd.setAttribute(a.$m,a.Nh);ea(a,na(a,(c.ec-c.Cc)*a.Ic))}function ka(a,c){var d=c.yb-1;a.al&&(d-=g.La.tc);ha(a,Math.max(0,d));d=c.oc+.5;a.s.G||(d+=c.rb-g.La.tc-1);ia(a,d,c.Ac+.5);oa(a,c)}
function oa(a,c){a.al||a.Vb(a.Te<c.Pd);a.Ic=a.Te/c.Pd;if(-Infinity==a.Ic||Infinity==a.Ic||isNaN(a.Ic))a.Ic=0;a.Nh=Math.max(0,c.yb*a.Ic);a.Zd.setAttribute(a.$m,a.Nh);ea(a,na(a,(c.mc-c.pc)*a.Ic))}
b.pm=function(a){var c="blocklyScrollbar"+(this.lj?"Horizontal":"Vertical");a&&(c+=" "+a);this.$f=g.g.o.I("svg",{"class":c},null);this.H=g.g.o.I("g",{},this.$f);this.Mc=g.g.o.I("rect",{"class":"blocklyScrollbarBackground"},this.H);a=Math.floor((g.La.tc-5)/2);this.Zd=g.g.o.I("rect",{"class":"blocklyScrollbarHandle",rx:a,ry:a},this.H);this.s.Wb.subscribe(this.Zd,"scrollbar","fill");this.s.Wb.subscribe(this.Zd,"scrollbarOpacity","fill-opacity");g.g.o.nj(this.$f,u(this.s))};b.isVisible=function(){return this.Zh};
b.Ij=function(a){var c=a!=this.Yi;this.Yi=a;c&&this.Tn()};b.Vb=function(a){var c=a!=this.isVisible();if(this.al)throw Error("Unable to toggle visibility of paired scrollbars.");this.Zh=a;c&&this.Tn()};b.Tn=function(){this.Yi&&this.isVisible()?this.$f.setAttribute("display","block"):this.$f.setAttribute("display","none")};
b.zG=function(a){pa(this.s);g.Touch.Dh();fa();if(g.g.tj(a))a.stopPropagation();else{var c=g.g.kn(a,u(this.s),qa(this.s));c=this.lj?c.x:c.y;var d=g.g.Jm(this.Zd);d=this.lj?d.x:d.y;var e=this.Nm,f=.95*this.Nh;c<=d?e-=f:c>=d+this.Nh&&(e+=f);ea(this,na(this,e));la(this);a.stopPropagation();a.preventDefault()}};
b.AG=function(a){pa(this.s);fa();g.g.tj(a)?a.stopPropagation():(this.jH=this.Nm,ra(this.s),this.mA=this.lj?a.clientX:a.clientY,g.La.Qe=g.la(document,"mouseup",this,this.FG),g.La.ii=g.la(document,"mousemove",this,this.BG),a.stopPropagation(),a.preventDefault())};b.BG=function(a){ea(this,na(this,this.jH+((this.lj?a.clientX:a.clientY)-this.mA)));la(this)};b.FG=function(){sa(this.s);g.Touch.Dh();fa()};function fa(){g.rc(!0);g.La.Qe&&(g.Xa(g.La.Qe),g.La.Qe=null);g.La.ii&&(g.Xa(g.La.ii),g.La.ii=null)}
function na(a,c){return c=0>=c||isNaN(c)||a.Te<a.Nh?0:Math.min(c,a.Te-a.Nh)}function la(a){var c=a.Nm/a.Te;isNaN(c)&&(c=0);var d={};a.lj?d.x=c:d.y=c;a.s.pi(d)}b.set=function(a){ea(this,na(this,a*this.Ic));la(this)};
g.Sr=function(a){this.s=a};b=g.Sr.prototype;b.Si=32;b.Uv=110;b.ir=20;b.Ml=20;b.H=null;b.Zm=0;b.vl=0;b.Ia=function(){this.H=g.g.o.I("g",{},null);var a=String(Math.random()).substring(2);ta(this,a);ua(this,a);this.s.Fc()&&va(this,a);return this.H};b.S=function(a){this.mh=this.ir+a;return this.mh+this.Uv};b.J=function(){this.H&&g.g.o.removeNode(this.H)};
b.position=function(){if(this.mh){var a=this.s.hc();a&&(this.Zm=a.Fa==g.Nd||this.s.Td&&!this.s.G?a.rb+a.oc-this.Si-this.Ml-g.La.tc:this.Ml+g.La.tc,a.Fa==g.Oi?(this.vl=this.mh,this.Cq.setAttribute("transform","translate(0, 34)"),this.Dq&&this.Dq.setAttribute("transform","translate(0, 77)")):(this.vl=a.yb+a.Ac-this.Uv-this.mh,this.Cq.setAttribute("transform","translate(0, 43)"),this.qv.setAttribute("transform","translate(0, 77)")),this.H.setAttribute("transform","translate("+this.Zm+","+this.vl+")"))}};
function ta(a,c){var d=a.s;a.qv=g.g.o.I("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.I("clipPath",{id:"blocklyZoomoutClipPath"+c},a.qv);g.g.o.I("rect",{width:32,height:32},e);a=g.g.o.I("image",{width:g.wd.width,height:g.wd.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+c+")"},a.qv);a.setAttributeNS(g.g.o.Kf,"xlink:href",d.options.uf+g.wd.url);g.la(a,"mousedown",null,function(f){pa(d);wa(d,-1);g.Touch.Dh();f.stopPropagation();f.preventDefault()})}
function ua(a,c){var d=a.s;a.Cq=g.g.o.I("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.I("clipPath",{id:"blocklyZoominClipPath"+c},a.Cq);g.g.o.I("rect",{width:32,height:32},e);a=g.g.o.I("image",{width:g.wd.width,height:g.wd.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+c+")"},a.Cq);a.setAttributeNS(g.g.o.Kf,"xlink:href",d.options.uf+g.wd.url);g.la(a,"mousedown",null,function(f){pa(d);wa(d,1);g.Touch.Dh();f.stopPropagation();f.preventDefault()})}
function va(a,c){var d=a.s;a.Dq=g.g.o.I("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.I("clipPath",{id:"blocklyZoomresetClipPath"+c},a.Dq);g.g.o.I("rect",{width:32,height:32},e);a=g.g.o.I("image",{width:g.wd.width,height:g.wd.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+c+")"},a.Dq);a.setAttributeNS(g.g.o.Kf,"xlink:href",d.options.uf+g.wd.url);g.la(a,"mousedown",null,function(f){pa(d);d.setScale(d.options.Eb.oA);g.g.o.mb(d.fb,"blocklyCanvasTransitioning");g.g.o.mb(d.yf,"blocklyCanvasTransitioning");
if(d.Fc()){var h=d.hc(),k=(h.ff-h.rb)/2,l=(h.Pd-h.yb)/2;k=-k-h.Cc;l=-l-h.pc;d.scroll(k,l)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.");setTimeout(d.GE.bind(d),500);g.Touch.Dh();f.stopPropagation();f.preventDefault()})}
g.ed.register([".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]);g.YL={};g.ew=40;g.pw=125;g.vB=5;g.EB=10;g.vd=28;g.kB=g.vd;g.nB=8;g.TB="#000000";g.co=250;g.Lq=10;g.hB=30;g.hC=750;g.MC=100;g.wB=!0;g.PB=.45;g.QB=.65;g.wd={width:96,height:124,url:"sprites.png"};g.Wa=1;g.Ye=2;g.jb=3;g.Ze=4;g.tg=5;g.Hq=-1;g.xv=0;g.yl=1;g.BI=0;g.CI=1;g.zI=1;g.AI=2;g.nk=[];g.nk[g.Wa]=g.Ye;g.nk[g.Ye]=g.Wa;g.nk[g.jb]=g.Ze;g.nk[g.Ze]=g.jb;g.Dg=0;g.Oi=1;g.Nd=2;g.Cg=3;g.Ov=null;g.Sq=1;g.Pv=2;g.Hw="VARIABLE";g.cD="VARIABLE_DYNAMIC";g.qw="PROCEDURE";g.xw="RENAME_VARIABLE_ID";g.Qv="DELETE_VARIABLE_ID";g.i={};g.i.Iy="";g.i.Jc=!0;g.i.Is=0;g.i.mo="create";g.i.Al=g.i.mo;g.i.Dl="delete";g.i.ao=g.i.Dl;g.i.zi="change";g.i.$H=g.i.zi;g.i.Nl="move";g.i.Dv=g.i.Nl;g.i.Iw="var_create";g.i.Jw="var_delete";g.i.Kw="var_rename";g.i.Oo="ui";g.i.io="comment_create";g.i.Jv="comment_delete";g.i.Iv="comment_change";g.i.jo="comment_move";g.i.DB="finished_loading";g.i.$A=[g.i.Al,g.i.Dv,g.i.io,g.i.jo];g.i.Fl=[];g.i.Ma=function(a){g.i.isEnabled()&&(g.i.Fl.length||setTimeout(g.i.ME,0),g.i.Fl.push(a))};
g.i.ME=function(){for(var a=g.i.filter(g.i.Fl,!0),c=g.i.Fl.length=0,d;d=a[c];c++)if(d.xc){var e=g.Jb.jt(d.xc);if(e){var f=d;if(f.Jc)for(e.Uj.push(f),e.tn.length=0;e.Uj.length>e.fw&&0<=e.fw;)e.Uj.shift();for(var h=0;d=e.Dd[h];h++)d(f)}}};
g.i.filter=function(a,c){a=a.slice();c||a.reverse();for(var d=[],e=Object.create(null),f=0,h;h=a[f];f++)if(!h.Vk()){var k=[h.type,h.Bc,h.xc].join(" "),l=e[k],m=l?l.event:null;if(!l)e[k]={event:h,index:f},d.push(h);else if(h.type==g.i.Nl&&l.index==f-1)m.Bj=h.Bj,m.Aj=h.Aj,m.di=h.di,l.index=f;else if(h.type==g.i.zi&&h.element==m.element&&h.name==m.name)m.newValue=h.newValue;else if(h.type!=g.i.Oo||"click"!=h.element||"commentOpen"!=m.element&&"mutatorOpen"!=m.element&&"warningOpen"!=m.element)e[k]={event:h,
index:1},d.push(h)}a=d.filter(function(n){return!n.Vk()});c||a.reverse();for(f=1;h=a[f];f++)h.type==g.i.zi&&"mutation"==h.element&&a.unshift(a.splice(f,1)[0]);return a};g.i.RD=function(){for(var a=0,c;c=g.i.Fl[a];a++)c.Jc=!1};g.i.disable=function(){g.i.Is++};g.i.enable=function(){g.i.Is--};g.i.isEnabled=function(){return 0==g.i.Is};g.i.$b=function(){return g.i.Iy};g.i.$=function(a){g.i.Iy="boolean"==typeof a?a?g.g.Rg():"":a};
g.i.py=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++)c[d]=e.id;return c};
g.i.va=function(a){switch(a.type){case g.i.mo:var c=new g.i.Ve(null);break;case g.i.Dl:c=new g.i.Df(null);break;case g.i.zi:c=new g.i.nh(null,"","","","");break;case g.i.Nl:c=new g.i.Hi(null);break;case g.i.Iw:c=new g.i.Ce(null);break;case g.i.Jw:c=new g.i.af(null);break;case g.i.Kw:c=new g.i.If(null,"");break;case g.i.Oo:c=new g.i.xd(null,"","","");break;case g.i.io:c=new g.i.rg(null);break;case g.i.Iv:c=new g.i.dk(null,"","");break;case g.i.jo:c=new g.i.Ai(null);break;case g.i.Jv:c=new g.i.sg(null);
break;default:throw Error("Unknown event type.");}c.va(a);c.xc=(void 0).id;return c};g.i.uE=function(a){if((a.type==g.i.Nl||a.type==g.i.mo)&&a.xc){var c=g.Jb.jt(a.xc);if(a=w(c,a.Bc)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.od(!0);else if((a.M||a.Z)&&!c.ic()){do a.od(!1),a=q(a);while(a)}}}};
g.i.Abstract=function(){this.xc=void 0;this.group=g.i.$b();this.Jc=g.i.Jc};g.i.Abstract.prototype.Za=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};g.i.Abstract.prototype.va=function(a){this.group=a.group};g.i.Abstract.prototype.Vk=function(){return!1};g.i.Abstract.prototype.run=function(){};function xa(a){if(a.xc)var c=g.Jb.jt(a.xc);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};g.g.object={};g.g.object.W=function(a,c){a.w=c.prototype;a.prototype=Object.create(c.prototype);a.prototype.constructor=a};g.g.object.yj=function(a,c){for(var d in c)a[d]=c[d]};g.g.object.values=function(a){return Object.values?Object.values(a):Object.keys(a).map(function(c){return a[c]})};g.i.xd=function(a,c,d,e){g.i.xd.w.constructor.call(this);this.Bc=a?a.id:null;this.xc=a?a.v.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.Jc=!1};g.g.object.W(g.i.xd,g.i.Abstract);g.i.xd.prototype.type=g.i.Oo;g.i.xd.prototype.Za=function(){var a=g.i.xd.w.Za.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.Bc&&(a.blockId=this.Bc);return a};
g.i.xd.prototype.va=function(a){g.i.xd.w.va.call(this,a);this.element=a.element;this.newValue=a.newValue;this.Bc=a.blockId};g.Hv=function(a){this.nm=a;this.Ia()};b=g.Hv.prototype;b.vb=null;b.kf=null;b.nm=null;b.oi=1;b.Kn=null;b.Ia=function(){this.vb||(this.vb=g.g.o.I("svg",{xmlns:g.g.o.Vl,"xmlns:html":g.g.o.Fi,"xmlns:xlink":g.g.o.Kf,version:"1.1","class":"blocklyBlockDragSurface"},this.nm),this.kf=g.g.o.I("g",{},this.vb))};function ya(a,c){if(a.kf.childNodes.length)throw Error("Already dragging a block.");a.kf.appendChild(c);a.vb.style.display="block";a.Kn=new g.g.N(0,0)}
b.Tj=function(a,c){this.Kn=new g.g.N(a*this.oi,c*this.oi);a=this.Kn.x;c=this.Kn.y;a=a.toFixed(0);c=c.toFixed(0);this.vb.style.display="block";g.g.o.An(this.vb,"translate3d("+a+"px, "+c+"px, 0px)")};b.rt=function(){var a=g.g.Ke(this.vb);return new g.g.N(a.x/this.oi,a.y/this.oi)};b.$b=function(){return this.kf};
b.Vo=function(a){a?a.appendChild(this.kf.firstChild):this.kf.removeChild(this.kf.firstChild);this.vb.style.display="none";if(this.kf.childNodes.length)throw Error("Drag group was not cleared.");this.Kn=null};g.g.xo={};g.g.xo.lG=0;g.g.xo.fF=function(){return"blockly:"+(g.g.xo.lG++).toString(36)};g.yc=function(){this.$z=g.yc.Ex;this.Rk=null;this.$c=!1;this.Wd=this.hb=null;this.kb=[];this.rs={}};g.yc.Ex=!1;g.yc.Error={Iq:"Component already rendered",wr:"Unable to set parent component",fB:"Child component index out of bounds"};b=g.yc.prototype;b.ua=function(){return this.Rk||(this.Rk=g.g.xo.fF())};b.ta=function(){return this.hb};
b.kl=function(a){if(this==a)throw Error(g.yc.Error.wr);var c;if(c=a&&this.Wd&&this.Rk)c=(c=this.Rk)?this.Wd.rs[c]||null:null;if(c&&this.Wd!=a)throw Error(g.yc.Error.wr);this.Wd=a};b.getParent=function(){return this.Wd};b.Ia=function(){this.hb=document.createElement("div")};b.za=function(a){this.eg(a)};b.eg=function(a,c){if(this.$c)throw Error(g.yc.Error.Iq);this.hb||this.Ia();a?a.insertBefore(this.hb,c||null):document.body.appendChild(this.hb);this.Wd&&!this.Wd.$c||this.lf()};
b.lf=function(){this.$c=!0;za(this,function(a){!a.$c&&a.ta()&&a.lf()})};b.Jh=function(){za(this,function(a){a.$c&&a.Jh()});this.$c=!1};b.J=function(){this.zE||(this.zE=!0,this.ym())};b.ym=function(){this.$c&&this.Jh();za(this,function(a){a.J()});this.hb&&g.g.o.removeNode(this.hb);this.Wd=this.hb=this.rs=this.kb=null};
b.cm=function(a,c,d){if(a.$c&&(d||!this.$c))throw Error(g.yc.Error.Iq);if(0>c||c>this.kb.length)throw Error(g.yc.Error.fB);this.rs[a.ua()]=a;if(a.getParent()==this){var e=this.kb.indexOf(a);-1<e&&this.kb.splice(e,1)}a.kl(this);this.kb.splice(c,0,a);a.$c&&this.$c&&a.getParent()==this?(d=this.hb,c=d.childNodes[c]||null,c!=a.ta()&&d.insertBefore(a.ta(),c)):d?(this.hb||this.Ia(),c=this.kb[c+1]||null,a.eg(this.hb,c?c.hb:null)):this.$c&&!a.$c&&a.hb&&a.hb.parentNode&&a.hb.parentNode.nodeType==g.g.o.Node.ELEMENT_NODE&&
a.lf()};b.Xk=function(){return this.$z};function Aa(a,c){if(a.$c)throw Error(g.yc.Error.Iq);a.$z=c}function Ba(a){return 0!=a.kb.length}function za(a,c,d){for(var e=0;e<a.kb.length;e++)c.call(d,a.kb[e],e)};g.g.Ja={};g.g.Ja.pd=function(a){return a*Math.PI/180};g.g.Ja.rl=function(a){return 180*a/Math.PI};g.g.Ja.Mf=function(a,c,d){if(d<a){var e=d;d=a;a=e}return Math.max(a,Math.min(c,d))};
g.D=function(){};g.D.ve=null;g.D.js=null;g.D.md=null;g.D.bq=null;g.D.$n=16;g.D.Gv=1;g.D.Bv=12;g.D.ow=16;g.D.Jq=.25;g.D.Mv="#dadce0";g.D.Nv="#fff";g.D.Wr=null;g.D.Ej=null;
g.D.Ia=function(){if(!g.D.ve){var a=document.createElement("div");a.className="blocklyDropDownDiv";a.style.backgroundColor=g.D.Nv;a.style.borderColor=g.D.Mv;document.body.appendChild(a);g.D.ve=a;var c=document.createElement("div");c.className="blocklyDropDownContent";a.appendChild(c);g.D.gf=c;c=document.createElement("div");c.className="blocklyDropDownArrow";a.appendChild(c);g.D.bf=c;g.D.ve.style.opacity=0;g.D.ve.style.transition="transform "+g.D.Jq+"s, opacity "+g.D.Jq+"s";a.addEventListener("focusin",
function(){g.g.o.mb(a,"focused")});a.addEventListener("focusout",function(){g.g.o.Tb(a,"focused")})}};g.D.cA=function(a){g.D.js=a};g.D.oy=function(){return g.D.gf};g.D.QD=function(){g.D.gf.innerHTML="";g.D.gf.style.width=""};g.D.Kc=function(a,c){g.D.ve.style.backgroundColor=a;g.D.ve.style.borderColor=c};g.D.AM=function(a){g.D.ve.setAttribute("data-category",a)};
g.D.CM=function(a,c,d,e){var f=c.v.scale,h=c.width,k=c.height;h*=f;k*=f;f=c.ya().getBoundingClientRect();h=f.left+h/2;k=f.top+k;f=f.top;e&&(f+=e);g.D.cA(u(c.v).parentNode);return g.D.show(a,c.G,h,k,h,f,d)};g.D.jA=function(a,c){var d=a.ya().getBoundingClientRect(),e=d.left+d.width/2,f=d.bottom;d=d.top;var h=a.B;g.D.bq=!0;g.D.cA(u(h.v).parentNode);g.D.show(a,h.G,e,f,e,d,c)};
g.D.show=function(a,c,d,e,f,h,k){g.D.md=a;g.D.Ej=k||null;a=g.D.wy(d,e,f,h);a.Yr?(g.D.bf.style.display="",g.D.bf.style.transform="translate("+a.em+"px,"+a.Tw+"px) rotate(45deg)",g.D.bf.setAttribute("class",a.Xr?"blocklyDropDownArrow arrowTop":"blocklyDropDownArrow arrowBottom")):g.D.bf.style.display="none";g.D.ve.style.direction=c?"rtl":"ltr";g.D.qn(a.Gp,a.Hp,a.op,a.pp);return a.Xr};
g.D.UE=function(){var a=g.D.js.getBoundingClientRect(),c=g.g.style.Ug(g.D.js);return{left:a.left,right:a.left+c.width,top:a.top,bottom:a.top+c.height,width:c.width,height:c.height}};g.D.wy=function(a,c,d,e){var f=g.D.UE(),h=g.g.style.Ug(g.D.ve);return c+h.height<f.bottom?g.D.vy(a,c,f,h):e-h.height>f.top?g.D.uy(d,e,f,h):c+h.height<document.documentElement.clientHeight?g.D.vy(a,c,f,h):e-h.height>document.documentElement.clientTop?g.D.uy(d,e,f,h):g.D.gF(a,f,h)};
g.D.vy=function(a,c,d,e){a=g.D.ot(a,d.left,d.right,e.width);return{Gp:a.Gk,Hp:c,op:a.Gk,pp:c+g.D.ow,em:a.em,Tw:-(g.D.$n/2+g.D.Gv),Xr:!0,Yr:!0}};g.D.uy=function(a,c,d,e){a=g.D.ot(a,d.left,d.right,e.width);return{Gp:a.Gk,Hp:c-e.height,op:a.Gk,pp:c-e.height-g.D.ow,em:a.em,Tw:e.height-2*g.D.Gv-g.D.$n/2,Xr:!1,Yr:!0}};g.D.gF=function(a,c,d){a=g.D.ot(a,c.left,c.right,d.width);return{Gp:a.Gk,Hp:0,op:a.Gk,pp:0,Yr:!1}};
g.D.ot=function(a,c,d,e){var f=a;a=g.g.Ja.Mf(c,a-e/2,d-e);f-=g.D.$n/2;c=g.g.Ja.Mf(g.D.Bv,f-a,e-g.D.Bv-g.D.$n);return{em:c,Gk:a}};g.D.isVisible=function(){return!!g.D.md};g.D.Nk=function(a,c){g.D.md===a&&(c?g.D.Ok():g.D.Ca())};g.D.Ca=function(){var a=g.D.ve;a.style.transform="translate(0, 0)";a.style.opacity=0;g.D.Wr=setTimeout(function(){g.D.Ok()},1E3*g.D.Jq);g.D.Ej&&(g.D.Ej(),g.D.Ej=null)};
g.D.Ok=function(){if(g.D.isVisible()){g.D.Wr&&clearTimeout(g.D.Wr);var a=g.D.ve;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=g.D.Nv;a.style.borderColor=g.D.Mv;g.D.Ej&&(g.D.Ej(),g.D.Ej=null);g.D.QD();g.D.md=null}};
g.D.qn=function(a,c,d,e){a=Math.floor(a);c=Math.floor(c);d=Math.floor(d);e=Math.floor(e);var f=g.D.ve;f.style.left=a+"px";f.style.top=c+"px";f.style.display="block";f.style.opacity=1;f.style.transform="translate("+(d-a)+"px,"+(e-c)+"px)"};
g.D.uM=function(){if(g.D.md){var a=g.D.md.B,c=a.v.scale,d=g.D.bq?g.D.md.cc.width:a.width,e=g.D.bq?g.D.md.cc.height:a.height;d*=c;e*=c;a=g.D.bq?g.D.md.mf.getBoundingClientRect():a.ya().getBoundingClientRect();d=a.left+d/2;e=g.D.wy(d,a.top+e,d,a.top);g.D.qn(e.Gp,e.Hp,e.op,e.pp)}else g.D.Ca()};
g.Ei=function(a,c){this.Lk=a;this.av=c.spacing;this.fz=c.length;this.SF=(this.Tt=a.firstChild)&&this.Tt.nextSibling;this.fH=c.snap};g.Ei.prototype.oi=1;g.Ei.prototype.J=function(){this.Lk=null};g.Ei.prototype.update=function(a){this.oi=a;var c=this.av*a||100;this.Lk.setAttribute("width",c);this.Lk.setAttribute("height",c);c=Math.floor(this.av/2)+.5;var d=c-this.fz/2,e=c+this.fz/2;c*=a;d*=a;e*=a;Ca(this.Tt,a,d,e,c,c);Ca(this.SF,a,c,c,d,e)};
function Ca(a,c,d,e,f,h){a&&(a.setAttribute("stroke-width",c),a.setAttribute("x1",d),a.setAttribute("y1",f),a.setAttribute("x2",e),a.setAttribute("y2",h))}g.Ei.prototype.moveTo=function(a,c){this.Lk.setAttribute("x",a);this.Lk.setAttribute("y",c);(g.g.userAgent.vg||g.g.userAgent.qo)&&this.update(this.oi)};
g.Ei.Ia=function(a,c,d){a=g.g.o.I("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},d);0<c.length&&0<c.spacing?(g.g.o.I("line",{stroke:c.colour},a),1<c.length&&g.g.o.I("line",{stroke:c.colour},a)):g.g.o.I("line",{},a);return a};g.g.xml={};g.g.xml.sC="https://developers.google.com/blockly/xml";g.g.xml.document=function(){return document};g.g.xml.createElement=function(a){return g.g.xml.document().createElementNS(g.g.xml.sC,a)};g.g.xml.createTextNode=function(a){return g.g.xml.document().createTextNode(a)};g.g.xml.rH=function(a){return(new DOMParser).parseFromString(a,"text/xml")};g.g.xml.Rd=function(a){return(new XMLSerializer).serializeToString(a)};g.i.Cf=function(a){g.i.Cf.w.constructor.call(this);this.Bc=a.id;this.xc=a.v.id};g.g.object.W(g.i.Cf,g.i.Abstract);g.i.Cf.prototype.Za=function(){var a=g.i.Cf.w.Za.call(this);a.blockId=this.Bc;return a};g.i.Cf.prototype.va=function(a){g.i.Cf.w.va.call(this,a);this.Bc=a.blockId};g.i.nh=function(a,c,d,e,f){a&&(g.i.nh.w.constructor.call(this,a),this.element=c,this.name=d,this.oldValue=e,this.newValue=f)};g.g.object.W(g.i.nh,g.i.Cf);g.i.pg=g.i.nh;b=g.i.nh.prototype;b.type=g.i.zi;
b.Za=function(){var a=g.i.nh.w.Za.call(this);a.element=this.element;this.name&&(a.name=this.name);a.newValue=this.newValue;return a};b.va=function(a){g.i.nh.w.va.call(this,a);this.element=a.element;this.name=a.name;this.newValue=a.newValue};b.Vk=function(){return this.oldValue==this.newValue};
b.run=function(a){var c=w(xa(this),this.Bc);if(c)switch(c.Vd&&c.Vd.Vb(!1),a=a?this.newValue:this.oldValue,this.element){case "field":(c=x(c,this.name))?c.setValue(a):console.warn("Can't set non-existent field: "+this.name);break;case "comment":c.gg(a||null);break;case "collapsed":c.gh(!!a);break;case "disabled":c.od(!a);break;case "inline":c.ad(!!a);break;case "mutation":var d="";c.cb&&(d=(d=c.cb())&&g.R.Rd(d));if(c.Cb){var e=g.R.jh(a||"<mutation/>");c.Cb(e)}g.i.Ma(new g.i.nh(c,"mutation",null,d,
a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.Bc)};g.i.Ve=function(a){a&&(g.i.Ve.w.constructor.call(this,a),this.xml=a.v.ba?g.R.gs(a):g.R.Bh(a),this.Ph=g.i.py(a))};g.g.object.W(g.i.Ve,g.i.Cf);g.i.fo=g.i.Ve;g.i.Ve.prototype.type=g.i.mo;g.i.Ve.prototype.Za=function(){var a=g.i.Ve.w.Za.call(this);a.xml=g.R.Rd(this.xml);a.ids=this.Ph;return a};
g.i.Ve.prototype.va=function(a){g.i.Ve.w.va.call(this,a);this.xml=g.R.jh(a.xml);this.Ph=a.ids};g.i.Ve.prototype.run=function(a){var c=xa(this);if(a)a=g.g.xml.createElement("xml"),a.appendChild(this.xml),g.R.Qg(a,c);else{a=0;for(var d;d=this.Ph[a];a++){var e=w(c,d);e?e.J(!1):d==this.Bc&&console.warn("Can't uncreate non-existent block: "+d)}}};
g.i.Df=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");g.i.Df.w.constructor.call(this,a);this.qu=a.v.ba?g.R.gs(a):g.R.Bh(a);this.Ph=g.i.py(a)}};g.g.object.W(g.i.Df,g.i.Cf);g.i.aB=g.i.Df;g.i.Df.prototype.type=g.i.Dl;g.i.Df.prototype.Za=function(){var a=g.i.Df.w.Za.call(this);a.ids=this.Ph;return a};g.i.Df.prototype.va=function(a){g.i.Df.w.va.call(this,a);this.Ph=a.ids};
g.i.Df.prototype.run=function(a){var c=xa(this);if(a){a=0;for(var d;d=this.Ph[a];a++){var e=w(c,d);e?e.J(!1):d==this.Bc&&console.warn("Can't delete non-existent block: "+d)}}else a=g.g.xml.createElement("xml"),a.appendChild(this.qu),g.R.Qg(a,c)};g.i.Hi=function(a){a&&(g.i.Hi.w.constructor.call(this,a),a=Da(this),this.xz=a.Kz,this.wz=a.Wy,this.nu=a.vx)};g.g.object.W(g.i.Hi,g.i.Cf);g.i.Bl=g.i.Hi;b=g.i.Hi.prototype;b.type=g.i.Nl;
b.Za=function(){var a=g.i.Hi.w.Za.call(this);this.Bj&&(a.newParentId=this.Bj);this.Aj&&(a.newInputName=this.Aj);this.di&&(a.newCoordinate=Math.round(this.di.x)+","+Math.round(this.di.y));return a};b.va=function(a){g.i.Hi.w.va.call(this,a);this.Bj=a.newParentId;this.Aj=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.di=new g.g.N(Number(a[0]),Number(a[1])))};b.Hj=function(){var a=Da(this);this.Bj=a.Kz;this.Aj=a.Wy;this.di=a.vx};
function Da(a){var c=w(xa(a),a.Bc);a={};var d=c.getParent();if(d){a.Kz=d.id;a:{for(var e=0,f;f=d.T[e];e++)if(f.connection&&y(f.connection)==c){c=f;break a}c=null}c&&(a.Wy=c.name)}else a.vx=c.Ra();return a}b.Vk=function(){return this.xz==this.Bj&&this.wz==this.Aj&&g.g.N.He(this.nu,this.di)};
b.run=function(a){var c=xa(this),d=w(c,this.Bc);if(d){var e=a?this.Bj:this.xz,f=a?this.Aj:this.wz;a=a?this.di:this.nu;var h=null;if(e&&(h=w(c,e),!h)){console.warn("Can't connect to non-existent block: "+e);return}d.getParent()&&z(d);if(a)f=d.Ra(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.M||d.Z;if(f){if(c=A(h,f))var k=c.connection}else d.type==g.Ze&&(k=h.X);k?d.connect(k):console.warn("Can't connect to non-existent input: "+f)}}else console.warn("Can't move non-existent block: "+this.Bc)};g.i.Gl=function(a){this.xc=a.id;this.group=g.i.$b();this.Jc=!1};g.g.object.W(g.i.Gl,g.i.Abstract);g.i.Gl.prototype.type=g.i.DB;g.i.Gl.prototype.Za=function(){var a={type:this.type};this.group&&(a.group=this.group);this.xc&&(a.workspaceId=this.xc);return a};g.i.Gl.prototype.va=function(a){this.xc=a.workspaceId;this.group=a.group};g.i.Eg=function(a){g.i.Eg.w.constructor.call(this);this.ti=a.ua();this.xc=a.v.id};g.g.object.W(g.i.Eg,g.i.Abstract);g.i.Eg.prototype.Za=function(){var a=g.i.Eg.w.Za.call(this);a.varId=this.ti;return a};g.i.Eg.prototype.va=function(a){g.i.Eg.w.Za.call(this);this.ti=a.varId};g.i.Ce=function(a){a&&(g.i.Ce.w.constructor.call(this,a),this.Xj=a.type,this.Wj=a.name)};g.g.object.W(g.i.Ce,g.i.Eg);g.i.Ce.prototype.type=g.i.Iw;
g.i.Ce.prototype.Za=function(){var a=g.i.Ce.w.Za.call(this);a.varType=this.Xj;a.varName=this.Wj;return a};g.i.Ce.prototype.va=function(a){g.i.Ce.w.va.call(this,a);this.Xj=a.varType;this.Wj=a.varName};g.i.Ce.prototype.run=function(a){var c=xa(this);a?c.Qd(this.Wj,this.Xj,this.ti):c.Rf(this.ti)};g.i.af=function(a){a&&(g.i.af.w.constructor.call(this,a),this.Xj=a.type,this.Wj=a.name)};g.g.object.W(g.i.af,g.i.Eg);g.i.af.prototype.type=g.i.Jw;
g.i.af.prototype.Za=function(){var a=g.i.af.w.Za.call(this);a.varType=this.Xj;a.varName=this.Wj;return a};g.i.af.prototype.va=function(a){g.i.af.w.va.call(this,a);this.Xj=a.varType;this.Wj=a.varName};g.i.af.prototype.run=function(a){var c=xa(this);a?c.Rf(this.ti):c.Qd(this.Wj,this.Xj,this.ti)};g.i.If=function(a,c){a&&(g.i.If.w.constructor.call(this,a),this.pu=a.name,this.ju=c)};g.g.object.W(g.i.If,g.i.Eg);g.i.If.prototype.type=g.i.Kw;
g.i.If.prototype.Za=function(){var a=g.i.If.w.Za.call(this);a.oldName=this.pu;a.newName=this.ju;return a};g.i.If.prototype.va=function(a){g.i.If.w.va.call(this,a);this.pu=a.oldName;this.ju=a.newName};g.i.If.prototype.run=function(a){var c=xa(this);a?c.ni(this.ti,this.ju):c.ni(this.ti,this.pu)};g.R={};g.R.EA=function(a){var c=B,d=g.g.xml.createElement("xml"),e=g.R.GH(g.O.Sw(c));e.hasChildNodes()&&d.appendChild(e);var f=Ea(c,!0);e=0;for(var h;h=f[e];e++)d.appendChild(h.fv(a));c=D(c,!0);for(e=0;f=c[e];e++)d.appendChild(g.R.gs(f,a));return d};g.R.GH=function(a){for(var c=g.g.xml.createElement("variables"),d=0,e;e=a[d];d++){var f=g.g.xml.createElement("variable");f.appendChild(g.g.xml.createTextNode(e.name));e.type&&f.setAttribute("type",e.type);f.id=e.ua();c.appendChild(f)}return c};
g.R.gs=function(a,c){var d;a.v.G&&(d=a.v.Xf());c=g.R.Bh(a,c);var e=a.Ra();c.setAttribute("x",Math.round(a.v.G?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c};g.R.KE=function(a){var c=!1;a.name&&(a.Ni?c=!0:a.ug&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),c=!0));return c?(c=g.g.xml.createElement("field"),c.setAttribute("name",a.name),a.uA(c)):null};
g.R.sD=function(a,c){for(var d=0,e;e=a.T[d];d++)for(var f=0,h;h=e.Qa[f];f++)(h=g.R.KE(h))&&c.appendChild(h)};
g.R.Bh=function(a,c){var d=g.g.xml.createElement(a.bb?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.cb){var e=a.cb();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}g.R.sD(a,d);if(e=a.Ee.text){var f=a.Ee.size,h=a.Ee.Du,k=g.g.xml.createElement("comment");k.appendChild(g.g.xml.createTextNode(e));k.setAttribute("pinned",h);k.setAttribute("h",f.height);k.setAttribute("w",f.width);d.appendChild(k)}a.data&&(e=g.g.xml.createElement("data"),e.appendChild(g.g.xml.createTextNode(a.data)),
d.appendChild(e));for(f=0;h=a.T[f];f++){var l;k=!0;if(h.type!=g.tg){var m=y(h.connection);h.type==g.Wa?l=g.g.xml.createElement("value"):h.type==g.jb&&(l=g.g.xml.createElement("statement"));e=h.connection.vf;!e||m&&m.bb||l.appendChild(g.R.gx(e,c));m&&(l.appendChild(g.R.Bh(m,c)),k=!1);l.setAttribute("name",h.name);k||d.appendChild(l)}}void 0!=a.Yg&&a.Yg!=a.JF&&d.setAttribute("inline",a.Yg);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.ne()||a.bb||d.setAttribute("deletable",
!1);a.Fc()||a.bb||d.setAttribute("movable",!1);a.ld()||d.setAttribute("editable",!1);if(f=q(a))l=g.g.xml.createElement("next"),l.appendChild(g.R.Bh(f,c)),d.appendChild(l);e=a.X&&a.X.vf;!e||f&&f.bb||l.appendChild(g.R.gx(e,c));return d};
g.R.gx=function(a,c){for(var d=a=a.cloneNode(!0),e;d;)if(c&&"shadow"==d.nodeName&&d.removeAttribute("id"),d.firstChild)d=d.firstChild;else{for(;d&&!d.nextSibling;)e=d,d=d.parentNode,e.nodeType==g.g.o.Node.TEXT_NODE&&""==e.data.trim()&&d.firstChild!=e&&g.g.o.removeNode(e);d&&(e=d,d=d.nextSibling,e.nodeType==g.g.o.Node.TEXT_NODE&&""==e.data.trim()&&g.g.o.removeNode(e))}return a};
g.R.Rd=function(a){a=g.g.xml.Rd(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1&#10;$2")}while(a!=d);return a};g.R.ZL=function(a){a=g.R.Rd(a).split("<");for(var c="",d=1;d<a.length;d++){var e=a[d];"/"==e[0]&&(c=c.substring(2));a[d]=c+"<"+e;"/"!=e[0]&&"/>"!=e.slice(-2)&&(c+="  ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>");return a.replace(/^\n/,"")};
g.R.jh=function(a){var c=g.g.xml.rH(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};g.R.UL=function(a,c){c.Lc(!1);c.clear();a=g.R.Qg(a,c);c.Lc(!0);return a};
g.R.Qg=function(a,c){if(a instanceof g.Jb){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var e;c.G&&(e=c.Xf());d=[];g.g.o.In();var f=a.childNodes.length,h=g.i.$b();h||g.i.$(!0);c.Lc&&c.Lc(!1);var k=!0;try{for(var l=0;l<f;l++){var m=a.childNodes[l],n=m.nodeName.toLowerCase();if("block"==n||"shadow"==n&&!g.i.Jc){var r=g.R.fj(m,c);d.push(r.id);var t=m.hasAttribute("x")?parseInt(m.getAttribute("x"),10):10,v=m.hasAttribute("y")?parseInt(m.getAttribute("y"),
10):10;isNaN(t)||isNaN(v)||r.moveBy(c.G?e-t:t,v);k=!1}else{if("shadow"==n)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==n)c.ba?g.vk?g.vk.Fm(m):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):g.hD?g.hD.Fm(m):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==n){if(k)g.R.CE(m,c);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.");
k=!1}}}}finally{h||g.i.$(!1),g.g.o.Jn()}c.Lc&&c.Lc(!0);g.i.Ma(new g.i.Gl(c));return d};g.R.RL=function(a,c){if(c.hasOwnProperty("scale")){var d=g.wa.xh;try{g.wa.xh=0;var e=Fa(c)}finally{g.wa.xh=d}}a=g.R.Qg(a,c);if(e&&e.top!=e.bottom){d=e.bottom;var f=e.left;var h=Infinity,k=Infinity;for(e=0;e<a.length;e++){var l=w(c,a[e]).Ra();l.y<k&&(k=l.y);l.x<h&&(h=l.x)}d=d-k+g.wa.IC;f-=h;var m;c.G&&(m=c.Xf());for(e=0;e<a.length;e++)w(c,a[e]).moveBy(c.G?m-f:f,d)}return a};
g.R.fj=function(a,c){if(a instanceof g.Jb){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}g.i.disable();d=c.Sg();try{var e=g.R.Ns(a,c),f=p(e,!1);if(c.ba){Ga(e,!0);for(var h=f.length-1;0<=h;h--)f[h].Ne();for(h=f.length-1;0<=h;h--)f[h].za(!1);setTimeout(function(){e.v&&Ga(e,!1)},1);Ha(e);Ia(c)}else for(h=f.length-1;0<=h;h--)f[h].mj()}finally{g.i.enable()}if(g.i.isEnabled()){a=g.O.ly(c,d);for(h=0;h<a.length;h++)g.i.Ma(new g.i.Ce(a[h]));g.i.Ma(new g.i.fo(e))}return e};
g.R.CE=function(a,c){for(var d=0,e;e=a.childNodes[d];d++)if(e.nodeType==g.g.o.Node.ELEMENT_NODE){var f=e.getAttribute("type"),h=e.getAttribute("id");c.Qd(e.textContent,f,h)}};
g.R.Ns=function(a,c){var d=null,e=a.getAttribute("type");if(!e)throw TypeError("Block type unspecified: "+a.outerHTML);var f=a.getAttribute("id");d=c.ci(e,f);var h=null;f=0;for(var k;k=a.childNodes[f];f++)if(k.nodeType!=g.g.o.Node.TEXT_NODE){for(var l=h=null,m=0,n;n=k.childNodes[m];m++)n.nodeType==g.g.o.Node.ELEMENT_NODE&&("block"==n.nodeName.toLowerCase()?h=n:"shadow"==n.nodeName.toLowerCase()&&(l=n));!h&&l&&(h=l);m=k.getAttribute("name");switch(k.nodeName.toLowerCase()){case "mutation":d.Cb&&(d.Cb(k),
d.Ne&&d.Ne());break;case "comment":if(!g.Comment){console.warn("Missing require for Blockly.Comment, ignoring block comment.");break}h=k.textContent;l="true"==k.getAttribute("pinned");m=parseInt(k.getAttribute("w"),10);k=parseInt(k.getAttribute("h"),10);d.gg(h);d.Ee.Du=l;isNaN(m)||isNaN(k)||(d.Ee.size=new g.g.$e(m,k));l&&d.XE&&!d.ac&&setTimeout(function(){d.Nf.Vb(!0)},1);break;case "data":d.data=k.textContent;break;case "title":case "field":g.R.BE(d,m,k);break;case "value":case "statement":k=A(d,
m);if(!k){console.warn("Ignoring non-existent input "+m+" in block "+e);break}l&&(k.connection.vf=l);if(h)if(h=g.R.Ns(h,c),h.M)k.connection.connect(h.M);else if(h.Z)k.connection.connect(h.Z);else throw TypeError("Child block does not have output or previous statement.");break;case "next":l&&d.X&&(d.X.vf=l);if(h){if(!d.X)throw TypeError("Next statement does not exist.");if(d.X.isConnected())throw TypeError("Next statement is already connected.");h=g.R.Ns(h,c);if(!h.Z)throw TypeError("Next block does not have previous statement.");
d.X.connect(h.Z)}break;default:console.warn("Ignoring unknown tag: "+k.nodeName)}}(f=a.getAttribute("inline"))&&d.ad("true"==f);(f=a.getAttribute("disabled"))&&d.od("true"!=f&&"disabled"!=f);if(f=a.getAttribute("deletable"))d.Bs="true"==f;(f=a.getAttribute("movable"))&&d.oq("true"==f);(f=a.getAttribute("editable"))&&d.Tu("true"==f);(f=a.getAttribute("collapsed"))&&d.gh("true"==f);if("shadow"==a.nodeName.toLowerCase()){a=d.Kh(!1);for(f=0;c=a[f];f++)if(!c.bb)throw TypeError("Shadow block not allowed non-shadow child.");
if(d.Vg().length)throw TypeError("Shadow blocks cannot have variable references.");d.Xu(!0)}return d};g.R.BE=function(a,c,d){var e=x(a,c);e?e.Fm(d):console.warn("Ignoring non-existent field "+c+" in block "+a.type)};g.R.qE=function(a){for(var c=0,d;d=a.childNodes[c];c++)if("next"==d.nodeName.toLowerCase()){a.removeChild(d);break}};g.Ae=function(a){var c=!!a.readOnly;if(c)var d=null,e=!1,f=!1,h=!1,k=!1,l=!1,m=!1;else{d=g.Ae.KG(a.toolbox||null);e=!(!d||!d.getElementsByTagName("category").length);f=a.trashcan;void 0===f&&(f=e);var n=a.maxTrashcanContents;f?void 0===n&&(n=32):n=0;h=a.collapse;void 0===h&&(h=e);k=a.comments;void 0===k&&(k=e);l=a.disable;void 0===l&&(l=e);m=a.sounds;void 0===m&&(m=!0)}var r=!!a.rtl,t=a.horizontalLayout;void 0===t&&(t=!1);var v=a.toolboxPosition;v="end"===v?!1:!0;v=t?v?g.Dg:g.Oi:v==r?g.Cg:g.Nd;var C=
a.css;void 0===C&&(C=!0);var Q="https://blockly-demo.appspot.com/static/media/";a.media?Q=a.media:a.path&&(Q=a.path+"media/");var T=void 0===a.oneBasedIndex?!0:!!a.oneBasedIndex,W=a.theme,xe=a.keyMap||g.sb.pb.bE(),ye=a.renderer||"geras";this.G=r;this.Re=T;this.collapse=h;this.km=k;this.disable=l;this.readOnly=c;this.au=a.maxBlocks||Infinity;this.bu=a.maxInstances;this.uf=Q;this.Ky=e;this.Hc=g.Ae.JG(a,e);this.Ny=f;this.Up=n;this.zF=m;this.xF=C;this.Td=t;this.Yk=d;this.Gy=g.Ae.IG(a);this.Eb=g.Ae.LG(a);
this.Fa=v;this.tH=W;this.pb=xe;this.dh=ye};g.Ae.prototype.Ob=null;g.Ae.prototype.pi=null;g.Ae.prototype.hc=null;g.Ae.JG=function(a,c){var d=a.move||{},e={};e.scrollbars=void 0===d.scrollbars&&void 0===a.scrollbars?c:!!d.scrollbars||!!a.scrollbars;e.Yj=e.scrollbars&&void 0!==d.wheel?!!d.wheel:!1;e.Ih=e.scrollbars?void 0===d.drag?!0:!!d.drag:!1;return e};
g.Ae.LG=function(a){a=a.zoom||{};var c={};c.controls=void 0===a.controls?!1:!!a.controls;c.Yj=void 0===a.wheel?!1:!!a.wheel;c.oA=void 0===a.startScale?1:Number(a.startScale);c.fn=void 0===a.maxScale?3:Number(a.maxScale);c.hn=void 0===a.minScale?.3:Number(a.minScale);c.XG=void 0===a.scaleSpeed?1.2:Number(a.scaleSpeed);return c};g.Ae.IG=function(a){a=a.grid||{};var c={};c.spacing=Number(a.spacing)||0;c.Mb=a.colour||"#888";c.length=Number(a.length)||1;c.DM=0<c.spacing&&!!a.snap;return c};
g.Ae.KG=function(a){if(a){if("string"!=typeof a&&(g.g.userAgent.vg&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"==typeof a&&(a=g.R.jh(a),"xml"!=a.nodeName.toLowerCase()))throw TypeError("Toolbox should be an <xml> document.");}else a=null;return a};g.K={};g.K.visible=!1;g.K.zk=!1;g.K.bC=50;g.K.qz=0;g.K.En=0;g.K.Qt=0;g.K.Rt=0;g.K.hb=null;g.K.aq=null;g.K.kw=0;g.K.lw=10;g.K.CC=10;g.K.OB=750;g.K.hr=5;g.K.Ga=null;g.K.Ia=function(){g.K.Ga||(g.K.Ga=document.createElement("div"),g.K.Ga.className="blocklyTooltipDiv",document.body.appendChild(g.K.Ga))};g.K.yk=function(a){g.hd(a,"mouseover",null,g.K.EG);g.hd(a,"mouseout",null,g.K.DG);a.addEventListener("mousemove",g.K.CG,!1)};
g.K.EG=function(a){if(!g.K.zk){for(a=a.currentTarget;"string"!=typeof a.zf&&"function"!=typeof a.zf;)a=a.zf;g.K.hb!=a&&(g.K.Ca(),g.K.aq=null,g.K.hb=a);clearTimeout(g.K.qz)}};g.K.DG=function(){g.K.zk||(g.K.qz=setTimeout(function(){g.K.hb=null;g.K.aq=null;g.K.Ca()},1),clearTimeout(g.K.En))};
g.K.CG=function(a){if(g.K.hb&&g.K.hb.zf&&!g.K.zk)if(g.K.visible){var c=g.K.Qt-a.pageX;a=g.K.Rt-a.pageY;Math.sqrt(c*c+a*a)>g.K.CC&&g.K.Ca()}else g.K.aq!=g.K.hb&&(clearTimeout(g.K.En),g.K.Qt=a.pageX,g.K.Rt=a.pageY,g.K.En=setTimeout(g.K.dH,g.K.OB))};g.K.Ca=function(){g.K.visible&&(g.K.visible=!1,g.K.Ga&&(g.K.Ga.style.display="none"));g.K.En&&clearTimeout(g.K.En)};g.K.block=function(){g.K.Ca();g.K.zk=!0};g.K.zH=function(){g.K.zk=!1};
g.K.dH=function(){if(!g.K.zk&&(g.K.aq=g.K.hb,g.K.Ga)){g.K.Ga.innerHTML="";for(var a=g.K.hb.zf;"function"==typeof a;)a=a();a=g.g.eb.FA(a,g.K.bC);a=a.split("\n");for(var c=0;c<a.length;c++){var d=document.createElement("div");d.appendChild(document.createTextNode(a[c]));g.K.Ga.appendChild(d)}a=g.K.hb.G;c=document.documentElement.clientWidth;d=document.documentElement.clientHeight;g.K.Ga.style.direction=a?"rtl":"ltr";g.K.Ga.style.display="block";g.K.visible=!0;var e=g.K.Qt;e=a?e-(g.K.kw+g.K.Ga.offsetWidth):
e+g.K.kw;var f=g.K.Rt+g.K.lw;f+g.K.Ga.offsetHeight>d+window.scrollY&&(f-=g.K.Ga.offsetHeight+2*g.K.lw);a?e=Math.max(g.K.hr-window.scrollX,e):e+g.K.Ga.offsetWidth>c+window.scrollX-2*g.K.hr&&(e=c-g.K.Ga.offsetWidth-2*g.K.hr);g.K.Ga.style.top=f+"px";g.K.Ga.style.left=e+"px"}};g.Nw=function(a){this.nm=a;this.Ia()};b=g.Nw.prototype;b.vb=null;b.kf=null;b.nm=null;b.Ia=function(){this.vb||(this.vb=g.g.o.I("svg",{xmlns:g.g.o.Vl,"xmlns:html":g.g.o.Fi,"xmlns:xlink":g.g.o.Kf,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.nm.appendChild(this.vb))};b.Tj=function(a,c){a=a.toFixed(0);c=c.toFixed(0);this.vb.style.display="block";g.g.o.An(this.vb,"translate3d("+a+"px, "+c+"px, 0px)")};b.rt=function(){return g.g.Ke(this.vb)};
b.Vo=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var c=this.vb.childNodes[0],d=this.vb.childNodes[1];if(!(c&&d&&g.g.o.yt(c,"blocklyBlockCanvas")&&g.g.o.yt(d,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!=this.fl?g.g.o.nj(c,this.fl):a.insertBefore(c,a.firstChild);g.g.o.nj(d,c);this.vb.style.display="none";if(this.vb.childNodes.length)throw Error("Drag surface was not cleared.");g.g.o.An(this.vb,
"");this.fl=null};g.L=Object.create(null);g.sa=function(a,c){this.B=a;this.type=c};g.sa.ho=0;g.sa.tw=1;g.sa.ww=2;g.sa.vw=3;g.sa.rw=4;g.sa.sw=5;g.sa.uw=6;b=g.sa.prototype;b.ca=null;b.df=null;b.vf=null;b.Xb=0;b.$a=0;
b.ef=function(a){var c=this,d=c.B,e=a.B;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=y(c),h=c.vf;c.vf=null;if(f.bb)h=g.R.Bh(f),f.J(),f=null;else if(c.type==g.Wa){if(!f.M)throw Error("Orphan block does not have an output connection.");var k=g.sa.dz(e,f);k&&(f.M.connect(k),f=null)}else if(c.type==g.jb){if(!f.Z)throw Error("Orphan block does not have a previous connection.");for(k=e;k.X;){var l=q(k);if(l&&!l.bb)k=l;else{Ja(f.Z,k.X)&&(k.X.connect(f.Z),f=null);break}}}if(f&&(c.disconnect(),
g.i.Jc)){var m=g.i.$b();setTimeout(function(){f.v&&!f.getParent()&&(g.i.$(m),f.M?f.M.Xp(c):f.Z&&f.Z.Xp(c),g.i.$(!1))},g.co)}c.vf=h}var n;g.i.isEnabled()&&(n=new g.i.Bl(e));g.sa.ZD(c,a);e.kl(d);n&&(n.Hj(),g.i.Ma(n))};b.J=function(){if(this.isConnected()){this.vf=null;var a=y(this);a.bb?a.J():z(a)}};function E(a){return a.type==g.Wa||a.type==g.jb}b.isConnected=function(){return!!this.ca};
function Ka(a,c){if(!c)return g.sa.vw;if(E(a))var d=a.B,e=c.B;else e=a.B,d=c.B;return d&&d==e?g.sa.tw:c.type!=g.nk[a.type]?g.sa.ww:d&&e&&d.v!==e.v?g.sa.sw:Ja(a,c)?d.bb&&!e.bb?g.sa.uw:g.sa.ho:g.sa.rw}
function La(a,c){switch(Ka(a,c)){case g.sa.ho:break;case g.sa.tw:throw Error("Attempted to connect a block to itself.");case g.sa.sw:throw Error("Blocks not on same workspace.");case g.sa.ww:throw Error("Attempt to connect incompatible types.");case g.sa.vw:throw Error("Target connection is null.");case g.sa.rw:throw Error("Connection checks failed. "+(a+" expected "+a.df+", found "+c.df));case g.sa.uw:throw Error("Connecting non-shadow to shadow block.");default:throw Error("Unknown connection failure: this should never happen!");
}}b.Kp=function(a){if(a.B.Vh()||Ka(this,a)!=g.sa.ho)return!1;switch(a.type){case g.Ze:return this.ca||-1!=g.zm.indexOf(a)?a=!1:a.ca?(a=y(a),a=a.Vh()?!(a.Z&&y(a.Z)):!1):a=!0,a;case g.Ye:if(a.isConnected()&&!y(a).Vh()||this.isConnected())return!1;break;case g.Wa:if(a.isConnected()&&!y(a).Fc()&&!y(a).bb)return!1;break;case g.jb:if(a.isConnected()&&!this.B.X&&!y(a).bb&&y(a).X)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=g.zm.indexOf(a)?!1:!0};b.Xp=function(){};
b.connect=function(a){if(this.ca!=a){La(this,a);var c=g.i.$b();c||g.i.$(!0);E(this)?this.ef(a):a.ef(this);c||g.i.$(!1)}};g.sa.ZD=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.ca=c;c.ca=a};g.sa.eH=function(a,c){for(var d=!1,e=0;e<a.T.length;e++){var f=a.T[e].connection;if(f&&f.type==g.Wa&&Ja(c.M,f)){if(d)return null;d=f}}return d};g.sa.dz=function(a,c){for(var d;d=g.sa.eH(a,c);)if(a=y(d),!a||a.bb)return d;return null};b=g.sa.prototype;
b.disconnect=function(){var a=this.ca;if(!a)throw Error("Source connection not connected.");if(a.ca!=this)throw Error("Target connection not connected to source connection.");if(E(this)){var c=this.B;var d=a.B;a=this}else c=a.B,d=this.B;var e=g.i.$b();e||g.i.$(!0);this.Js(c,d);a.Ou();e||g.i.$(!1)};b.Js=function(a,c){var d;g.i.isEnabled()&&(d=new g.i.Bl(c));this.ca=this.ca.ca=null;c.kl(null);d&&(d.Hj(),g.i.Ma(d))};
b.Ou=function(){var a=this.B,c=this.vf;if(a.v&&c&&g.i.Jc)if(a=g.R.fj(c,a.v),a.M)this.connect(a.M);else if(a.Z)this.connect(a.Z);else throw Error("Child block does not have output or previous statement.");};function y(a){return a.isConnected()?a.ca.B:null}function Ja(a,c){if(!a.df||!c.df)return!0;for(var d=0;d<a.df.length;d++)if(-1!=c.df.indexOf(a.df[d]))return!0;return!1}b.Bz=function(){this.isConnected()&&!Ja(this,this.ca)&&z(E(this)?y(this):this.B)};
b.xb=function(a){a?(Array.isArray(a)||(a=[a]),this.df=a,this.Bz()):this.df=null;return this};b.uz=function(){return[]};b.Wf=function(){for(var a=null,c=this.B,d=c.T,e=0;e<c.T.length;e++)if(d[e].connection===this){a=d[e];break}return a};
b.toString=function(){var a=this.B;if(a)if(a.M==this)var c="Output Connection of ";else if(a.Z==this)c="Previous Connection of ";else if(a.X==this)c="Next Connection of ";else{c=null;for(var d=0,e;e=a.T[d];d++)if(e.connection==this){c=e;break}if(c)c='Input "'+c.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}else return"Orphan Connection";d=a.type?'"'+a.type+'" block':"Block";a.id&&(d+=' (id="'+a.id+'")');return c+d};g.Y={};g.Y.zl={};g.Y.register=function(a,c){if("string"!=typeof a||""==a.trim())throw Error('Error: Invalid extension name "'+a+'"');if(g.Y.zl[a])throw Error('Error: Extension "'+a+'" is already registered.');if("function"!=typeof c)throw Error('Error: Extension "'+a+'" must be a function');g.Y.zl[a]=c};g.Y.fq=function(a,c){if(!c||"object"!=typeof c)throw Error('Error: Mixin "'+a+'" must be a object');g.Y.register(a,function(){this.yj(c)})};
g.Y.Ju=function(a,c,d,e){var f='Error when registering mutator "'+a+'": ';g.Y.ax(f,c.Cb,"domToMutation");g.Y.ax(f,c.cb,"mutationToDom");var h=g.Y.ex(c,f);if(d&&"function"!=typeof d)throw Error('Extension "'+a+'" is not a function');g.Y.register(a,function(){if(h){if(!g.Pb)throw Error(f+"Missing require for Blockly.Mutator");this.ri(new g.Pb(e))}this.yj(c);d&&d.apply(this)})};g.Y.unregister=function(a){g.Y.zl[a]?delete g.Y.zl[a]:console.warn('No extension mapping for name "'+a+'" found to unregister')};
g.Y.apply=function(a,c,d){var e=g.Y.zl[a];if("function"!=typeof e)throw Error('Error: Extension "'+a+'" not found.');if(d)g.Y.ND(a,c);else var f=g.Y.nt(c);e.apply(c);if(d)g.Y.LD('Error after applying mutator "'+a+'": ',c);else if(!g.Y.hG(f,c))throw Error('Error when applying extension "'+a+'": mutation properties changed when applying a non-mutator extension.');};
g.Y.ax=function(a,c,d){if(!c)throw Error(a+'missing required property "'+d+'"');if("function"!=typeof c)throw Error(a+'" required property "'+d+'" must be a function');};g.Y.ND=function(a,c){if(g.Y.nt(c).length)throw Error('Error: tried to apply mutation "'+a+'" to a block that already has mutator functions.  Block id: '+c.id);};
g.Y.ex=function(a,c){var d=void 0!==a.Kg,e=void 0!==a.Ng;if(d&&e){if("function"!=typeof a.Kg)throw Error(c+"compose must be a function.");if("function"!=typeof a.Ng)throw Error(c+"decompose must be a function.");return!0}if(d||e)throw Error(c+'Must have both or neither of "compose" and "decompose"');return!1};
g.Y.LD=function(a,c){if("function"!=typeof c.Cb)throw Error(a+'Applying a mutator didn\'t add "domToMutation"');if("function"!=typeof c.cb)throw Error(a+'Applying a mutator didn\'t add "mutationToDom"');g.Y.ex(c,a)};g.Y.nt=function(a){var c=[];void 0!==a.Cb&&c.push(a.Cb);void 0!==a.cb&&c.push(a.cb);void 0!==a.Kg&&c.push(a.Kg);void 0!==a.Ng&&c.push(a.Ng);return c};g.Y.hG=function(a,c){c=g.Y.nt(c);if(c.length!=a.length)return!1;for(var d=0;d<c.length;d++)if(a[d]!=c[d])return!1;return!0};
g.Y.Ro=function(a,c){var d=[];"object"==typeof document&&g.g.aA(function(){for(var e in c)g.g.bx(c[e])});return function(){this.type&&-1==d.indexOf(this.type)&&(g.Y.MD(this,a,c),d.push(this.type));this.Sa(function(){var e=F(this,a),f=c[e];null==f?-1==d.indexOf(this.type)&&(e="No tooltip mapping for value "+e+" of field "+a,null!=this.type&&(e+=" of block type "+this.type),console.warn(e+".")):f=g.g.Xd(f);return f}.bind(this))}};
g.Y.MD=function(a,c,d){var e=x(a,c);if("function"!=typeof e.xj){e=e.getOptions();for(var f=0;f<e.length;++f){var h=e[f][1];null==d[h]&&console.warn("No tooltip mapping for value "+h+" of field "+c+" of block type "+a.type)}}};g.Y.ls=function(a){"object"==typeof document&&g.g.aA(function(){g.g.bx(a)});return function(){this.Sa(function(){var c=x(this,"VAR");return g.g.Xd(a).replace("%1",c?c.Sb():"")}.bind(this))}};
g.Y.JE=function(){this.wH=this.zf;this.Sa(function(){var a=this.getParent();return a&&Ma(a)&&a.zf||this.wH}.bind(this))};g.Y.register("parent_tooltip_when_inline",g.Y.JE);g.ob={};g.ob.Ks=0;g.ob.gp=null;g.ob.yE=function(a){var c=a.v,d=a.ya();c.zh.play("delete");a=Na(c,d);d=d.cloneNode(!0);d.xH=a.x;d.yH=a.y;d.setAttribute("transform","translate("+a.x+","+a.y+")");u(c).appendChild(d);d.Uw=d.getBBox();g.ob.Nx(d,c.G,new Date,c.scale)};g.ob.Nx=function(a,c,d,e){var f=(new Date-d)/150;1<f?g.g.o.removeNode(a):(a.setAttribute("transform","translate("+(a.xH+(c?-1:1)*a.Uw.width*e/2*f)+","+(a.yH+a.Uw.height*e*f)+") scale("+(1-f)*e+")"),setTimeout(g.ob.Nx,10,a,c,d,e))};
g.ob.$D=function(a){var c=a.v,d=c.scale;c.zh.play("click");if(!(1>d)){var e=Na(c,a.ya());a.M?(e.x+=(a.G?3:-3)*d,e.y+=13*d):a.Z&&(e.x+=(a.G?-23:23)*d,e.y+=3*d);a=g.g.o.I("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},u(c));g.ob.qx(a,new Date,d)}};g.ob.qx=function(a,c,d){var e=(new Date-c)/150;1<e?g.g.o.removeNode(a):(a.setAttribute("r",25*e*d),a.style.opacity=1-e,g.ob.Ks=setTimeout(g.ob.qx,10,a,c,d))};
g.ob.xE=function(a){a.v.zh.play("disconnect");if(!(1>a.v.scale)){var c=G(a).height;c=Math.atan(10/c)/Math.PI*180;a.G||(c*=-1);g.ob.Lx(a.ya(),c,new Date)}};g.ob.Lx=function(a,c,d){var e=(new Date-d)/200;1<e?a.Fn="":(a.Fn="skewX("+Math.round(Math.sin(e*Math.PI*3)*(1-e)*c)+")",g.ob.gp=a,g.ob.Ks=setTimeout(g.ob.Lx,10,a,c,d));a.setAttribute("transform",a.Qn+a.Fn)};g.ob.Ls=function(){if(g.ob.gp){clearTimeout(g.ob.Ks);var a=g.ob.gp;a.Fn="";a.setAttribute("transform",a.Qn);g.ob.gp=null}};g.zo=function(a){this.Af=g.selected=a;this.s=a.v;this.uj=this.Ot=null;this.Hk=Oa(this,this.Af);this.Gc=this.Fb=null;this.og=!1;this.wj=null;this.Ct=!1;this.Pk=null;a=this.Af.Ie(!1);var c;a:{for(c=this.Af.X;c;){var d=y(c);if(!d)break a;c=d.X}c=null}c&&c!=this.Af.X&&(a.push(c),this.Ot=c,this.uj=Oa(this,c.B));this.bs=a};
g.zo.prototype.J=function(){this.s=this.Af=null;this.bs.length=0;this.Gc=this.Fb=null;g.i.disable();try{this.Hk&&(this.Hk.J(),this.Hk=null),this.uj&&(this.uj.J(),this.uj=null)}finally{g.i.enable()}this.Pk=null};
g.zo.prototype.update=function(a,c){var d=this.Fb&&this.Gc?g.kB:g.vd;for(var e=null,f=null,h=0;h<this.bs.length;h++){var k=this.bs[h],l=k.closest(d,a);l.connection&&(e=l.connection,f=k,d=l.cq)}e=(d={closest:e,local:f,cq:d},!!d.closest)&&c!=g.Pv;if((this.og=!!c&&!this.Af.getParent()&&this.Af.ne()&&!e)||Pa(this,d,a)){g.i.disable();d.closest?(a=this.Fb!=d.closest,c=this.Gc!=d.local,this.Fb&&this.Gc&&(a||c||this.og)&&Qa(this)):Qa(this);this.Gc=this.Fb=this.wj=null;if(!this.og&&(a=d.closest,c=d.local,
a))if(a==this.Fb||a.B.Vh())console.log("Trying to connect to an insertion marker");else{this.Fb=a;this.Gc=c;a=this.Fb;c=this.Gc;if(c.type==g.Ye)a=a.isConnected()&&!g.sa.dz(this.Af,a.ca.B);else{a:{for(d=0;e=c.B.T[d];d++)if(e.connection&&e.connection.type==g.jb){d=e.connection;break a}d=null}a=c==d?0:!this.Af.X&&c.type==g.Ze&&a.isConnected()}if(a)a=this.Fb,c=this.Gc,y(a)?(this.Pk=y(a),Ra(y(a),!0)):c.type==g.Ye&&(this.Pk=a.B,a.B.BF(a,!0)),this.Ct=!0;else{d=this.Gc;a=this.Fb;c=this.Ot&&d==this.Ot?this.uj:
this.Hk;a:{f=d.B;e=c.Ie(!0);f=f.Ie(!0);if(e.length!=f.length)throw Error("Connection lists did not match in length.");for(h=0;h<f.length;h++)if(f[h]==d){d=e[h];break a}d=null}if(d==this.wj)throw Error("Made it to connectMarker_ even though the marker isn't changing");c.za();c.ba=!0;c.ya().setAttribute("visibility","visible");d.type!=g.jb&&d.type!=g.Wa||c.moveBy(a.Xb-d.Xb,a.$a-d.$a);d.connect(a);this.wj=d}this.Fb&&this.Fb.Sy()}g.i.enable()}};
function Oa(a,c){var d=c.type;g.i.disable();try{var e=a.s.ci(d);e.eA(!0);e.gh(c.isCollapsed());if(c.cb){var f=c.cb();f&&e.Cb(f)}for(a=0;a<c.T.length;a++){var h=c.T[a],k=e.T[a];for(d=0;d<h.Qa.length;d++)k.Qa[d].setValue(h.Qa[d].getValue())}e.Ne();e.ya().setAttribute("visibility","hidden")}finally{g.i.enable()}return e}
function Pa(a,c,d){var e=c.local,f=c.closest;c=c.cq;if(e&&f){if(a.Gc&&a.Fb){if(a.Fb==f&&a.Gc==e)return!1;e=a.Gc.Xb+d.x-a.Fb.Xb;a=a.Gc.$a+d.y-a.Fb.$a;a=Math.sqrt(e*e+a*a);return!(f&&c>a-g.nB)}if(a.Gc||a.Fb)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Gc||!a.Fb);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0}
function Qa(a){a.Fb&&(g.g.o.removeNode(g.sa.Ty),delete g.sa.Ty);if(a.Ct){var c=a.Fb;c.type!=g.Wa||c.isConnected()?Ra(a.Pk,!1):a.Pk.BF(c,!1);a.Pk=null;a.Ct=!1}else if(a.wj)if(a.wj){c=a.wj;var d=c.B,e=d.X,f=d.Z,h=d.M;h=c.type==g.Wa&&!(h&&h.ca);!(c!=e||f&&f.ca)||h?z(y(c),!1):c.type==g.jb&&c!=e?(e=c.ca,z(e.B,!1),f=f?f.ca:null,z(d,!0),f&&f.connect(e)):z(d,!0);if(c.ca)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.wj=null;d.ya().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")}
g.zo.prototype.Jk=function(){var a=[];this.Hk&&a.push(this.Hk);this.uj&&a.push(this.uj);return a};g.yi=function(a,c){this.Gb=a;this.s=c;this.Tf=new g.zo(this.Gb);this.dj=null;this.og=!1;this.lg=this.Gb.Ra();this.kp=g.yi.GF(a)};g.yi.prototype.J=function(){this.vc=this.s=this.Gb=null;this.kp.length=0;this.Tf&&(this.Tf.J(),this.Tf=null)};g.yi.GF=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=Sa(e);for(var f=0;f<e.length;f++)c.push({location:e[f].Qk,icon:e[f]})}return c};
function Ta(a,c,d){d=a.bl(d);var e=g.g.N.sum(a.lg,d);a.Gb.fu(e);for(e=0;e<a.kp.length;e++){var f=a.kp[e];Ua(f.icon,g.g.N.sum(f.location,d))}a.dj=Va(a.s,c);a.Tf.update(d,a.dj);a.og=a.Tf.og;c=a.s.bd;a.og?(Wa(a.Gb,!0),a.dj==g.Sq&&c&&Xa(c,!0)):(Wa(a.Gb,!1),c&&Xa(c,!1))}
function Ya(a,c,d){Ta(a,c,d);a.kp=[];g.g.o.Jn();g.ob.Ls();c=a.bl(d);d=g.g.N.sum(a.lg,c);var e=a.Gb;e.Yn&&(e.translate(d.x,d.y),e.v.ie.Vo(e.v.fb));d=a.s.bd;a.og?(d&&setTimeout(d.close.bind(d),100),a.Dm(),a.Gb.J(!1,!0)):d&&d.close();a.og||(Za(a.Gb,c.x,c.y),a.Gb.Jj(!1),a.Dm(),a.Tf.Fb?(c=a.Tf,c.Fb&&(g.i.disable(),Qa(c),g.i.enable(),c.Gc.connect(c.Fb),c.Af.ba&&(g.ob.$D((E(c.Gc)?c.Fb:c.Gc).B),$a(H(c.Af))))):a.Gb.za(),ab(a.Gb));a.s.Lc(!0);(c=a.s.ra)&&g.g.o.Tb(c.zc,a.Gb.ne()?"blocklyToolboxDelete":"blocklyToolboxGrab");
g.i.$(!1)}g.yi.prototype.Dm=function(){var a=new g.i.Bl(this.Gb);a.nu=this.lg;a.Hj();g.i.Ma(a)};g.yi.prototype.bl=function(a){a=new g.g.N(a.x/this.s.scale,a.y/this.s.scale);this.s.sj&&a.scale(1/this.s.options.Ob.scale);return a};g.yi.prototype.Jk=function(){return this.Tf&&this.Tf.Jk?this.Tf.Jk():[]};g.po=function(){this.Ec=this.Rb=null};function I(a,c){a.Rb=c;a.Ec&&a.Ec.draw(a.Rb)}b=g.po.prototype;b.Ca=function(){this.Ec&&this.Ec.Ca()};b.next=function(){var a=this.Rb;if(!a)return null;for(a=a.next();a&&a.next()&&(a.Nb()==g.F.types.ze||a.Nb()==g.F.types.ee);)a=a.next();a&&I(this,a);return a};b.Pm=function(){var a=this.Rb;if(!a)return null;if(a.Nb()==g.F.types.Be||a.Nb()==g.F.types.qk)a=a.next();(a=a.Pm())&&I(this,a);return a};
b.cg=function(){var a=this.Rb;if(!a)return null;for(a=a.cg();a&&a.cg()&&(a.Nb()==g.F.types.ze||a.Nb()==g.F.types.ee);)a=a.cg();a&&I(this,a);return a};b.nn=function(){var a=this.Rb;if(!a)return null;(a=a.nn())&&a.Nb()==g.F.types.ee&&(a=a.cg()||a);a&&I(this,a);return a};g.ph=function(){g.ph.w.constructor.call(this)};g.g.object.W(g.ph,g.po);g.ph.prototype.next=function(){return null};g.ph.prototype.Pm=function(){return null};g.ph.prototype.cg=function(){return null};g.ph.prototype.nn=function(){return null};g.ZC=function(){var a=g.Pi.ck.HD;this.CD=g.Pi.ck.mE;this.ID=a;this.YD=Object.create(null)};function bb(a,c){return(c=a.YD[c])&&"string"==typeof propertyValue&&bb(a,c)?bb(a,c):c?String(c):null};g.Xl=function(a){this.vq=a;this.tq=[];this.Fh=Object.create(null)};g.Xl.prototype.zp=function(){return this.vq};g.Xl.prototype.subscribe=function(a,c,d){this.Fh[c]||(this.Fh[c]=[]);this.Fh[c].push({element:a,propertyName:d});a.style[d]=this.vq&&bb(this.vq,c)||""};g.Xl.prototype.unsubscribe=function(a){if(a)for(var c=Object.keys(this.Fh),d=0,e;e=c[d];d++){for(var f=this.Fh[e],h=f.length-1;0<=h;h--)f[h].element===a&&f.splice(h,1);this.Fh[e].length||delete this.Fh[e]}};
g.Xl.prototype.J=function(){this.Fh=this.tq=this.vq=this.md=null};g.Pi={};g.Pi.ck={};g.Pi.ck.mE={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"}};
g.Pi.ck.HD={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"}};g.Pi.ck=new g.ZC;g.Pr=function(a){this.Ta=Object.create(null);this.v=a};b=g.Pr.prototype;b.clear=function(){this.Ta=Object.create(null)};b.iq=function(a,c){var d=this.Xc(c,a.type),e=J(this.v,!1);g.i.$(!0);try{if(d&&d.ua()!=a.ua()){var f=a.type;c!=d.name&&cb(d,c,e);for(c=0;c<e.length;c++)e[c].hq(a.ua(),d.ua());g.i.Ma(new g.i.af(a));this.Ta[f].splice(this.Lm(f).indexOf(a),1)}else cb(a,c,e)}finally{g.i.$(!1)}};
b.ni=function(a,c){var d=this.nf(a);if(!d)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.iq(d,c)};function cb(a,c,d){g.i.Ma(new g.i.If(a,c));a.name=c;for(c=0;c<d.length;c++)d[c].zq(a)}
b.Qd=function(a,c,d){var e=this.Xc(a,c);if(e){if(d&&e.ua()!=d)throw Error('Variable "'+a+'" is already in use and its id is "'+e.ua()+'" which conflicts with the passed in id, "'+d+'".');return e}if(d&&this.nf(d))throw Error('Variable id, "'+d+'", is already in use.');e=d||g.g.Rg();c=c||"";e=new g.Zl(this.v,a,c,e);a=this.Ta[c]||[];a.push(e);delete this.Ta[c];this.Ta[c]=a;return e};
b.Rf=function(a){var c=this.nf(a);if(c){var d=c.name,e=this.vt(a);a=0;for(var f;f=e[a];a++)if("procedures_defnoreturn"==f.type||"procedures_defreturn"==f.type){a=F(f,"NAME");d=g.h.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",d).replace("%2",a);g.alert(d);return}var h=this;1<e.length?(d=g.h.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(e.length)).replace("%2",d),g.confirm(d,function(k){k&&h.ep(c,e)})):h.ep(c,e)}else console.warn("Can't delete non-existent variable: "+a)};
b.ep=function(a,c){var d=g.i.$b();d||g.i.$(!0);try{for(var e=0;e<c.length;e++)c[e].J(!0,!1);var f=this.Ta[a.type];c=0;for(var h;h=f[c];c++)if(h.ua()==a.ua()){f.splice(c,1);g.i.Ma(new g.i.af(a));break}}finally{d||g.i.$(!1)}};b.Xc=function(a,c){if(c=this.Ta[c||""])for(var d=0,e;e=c[d];d++)if(g.fe.He(e.name,a))return e;return null};b.nf=function(a){for(var c=Object.keys(this.Ta),d=0;d<c.length;d++)for(var e=c[d],f=0,h;h=this.Ta[e][f];f++)if(h.ua()==a)return h;return null};
b.Lm=function(a){return(a=this.Ta[a||""])?a.slice():[]};b.ut=function(a){var c=[];a&&a.ki&&(c=Object.keys(a.ki.Ta));a=Object.keys(this.Ta).concat(c);c=!1;for(var d=0;d<a.length;d++)""==a[d]&&(c=!0);c||a.push("");return a};b.Sg=function(){var a=[],c;for(c in this.Ta)a=a.concat(this.Ta[c]);return a};b.vt=function(a){for(var c=[],d=J(this.v,!1),e=0;e<d.length;e++){var f=d[e].Vg();if(f)for(var h=0;h<f.length;h++)f[h].ua()==a&&c.push(d[e])}return c};g.Jb=function(a){this.id=g.g.Rg();g.Jb.$l[this.id]=this;this.options=a||{};this.G=!!this.options.G;this.Td=!!this.options.Td;this.Fa=this.options.Fa;this.ul=[];this.wq=[];this.Zo=Object.create(null);this.Dd=[];this.Uj=[];this.tn=[];this.fs=Object.create(null);this.kh=Object.create(null);this.Ta=new g.Pr(this);this.ki=null;this.Ya=new g.po;this.bc=new g.ph;this.Wb=this.options.Ob?this.options.Ob.Wb:new g.Xl(this.options.tH||g.Pi.ck);this.Wb.tq.push(this)};b=g.Jb.prototype;b.ba=!1;b.It=!1;b.fw=1024;
b.ap=null;b.Su=function(a){this.Ya=a};b.fA=function(a){this.bc=a};b.zp=function(){return this.Wb.zp()};b.J=function(){this.Dd.length=0;this.clear();delete g.Jb.$l[this.id];if(this.Wb){var a=this.Wb,c=a.tq.indexOf(this);if(0>c)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.tq.splice(c,1);this.Wb.unsubscribe(this.Mc);this.options.Ob||(this.Wb.J(),this.Wb=null)}};g.Jb.yw=3;b=g.Jb.prototype;
b.kg=function(a,c){a=a.Ra();c=c.Ra();return a.y+g.Jb.prototype.kg.offset*a.x-(c.y+g.Jb.prototype.kg.offset*c.x)};function db(a,c){if(!g.g.Qo(a.ul,c))throw Error("Block not present in workspace's list of top-most blocks.");}function D(a,c){var d=[].concat(a.ul);c&&1<d.length&&(a.kg.offset=Math.sin(g.g.Ja.pd(g.Jb.yw)),a.G&&(a.kg.offset*=-1),d.sort(a.kg));return d}
function Ea(a,c){var d=[].concat(a.wq);c&&1<d.length&&(a.kg.offset=Math.sin(g.g.Ja.pd(g.Jb.yw)),a.G&&(a.kg.offset*=-1),d.sort(a.kg));return d}function J(a,c){if(c){a=D(a,!0);c=[];for(var d=0;d<a.length;d++)c.push.apply(c,p(a[d],!0))}else for(c=D(a,!1),d=0;d<c.length;d++)c.push.apply(c,c[d].Kh(!1));return c.filter(function(e){return!e.Vh()})}
b.clear=function(){this.It=!0;try{var a=g.i.$b();for(a||g.i.$(!0);this.ul.length;)this.ul[0].J();for(;this.wq.length;)this.wq[this.wq.length-1].J();a||g.i.$(!1);this.Ta.clear();this.ki&&this.ki.clear()}finally{this.It=!1}};b.ni=function(a,c){this.Ta.ni(a,c)};b.Qd=function(a,c,d){return this.Ta.Qd(a,c,d)};b.vt=function(a){return this.Ta.vt(a)};b.Rf=function(a){this.Ta.Rf(a)};b.ep=function(a,c){this.Ta.ep(a,c)};b.Xc=function(a,c){return this.Ta.Xc(a,c)};b.nf=function(a){return this.Ta.nf(a)};b.Lm=function(a){return this.Ta.Lm(a)};
b.ut=function(){return this.Ta.ut(this)};b.Sg=function(){return this.Ta.Sg()};b.Xf=function(){return 0};b.ci=function(a,c){return new g.eo(this,a,c)};function eb(a){return isNaN(a.options.au)?Infinity:a.options.au-J(a).length}function fb(a,c){if(!gb(a))return!0;var d=0,e;for(e in c){var f=c[e];if(a.options.bu){var h=a.options.bu[e]||Infinity;var k=a.kh[e]?a.kh[e].slice(0):[];h-=k.length}else h=Infinity;if(f>h)return!1;d+=c[e]}return d>eb(a)?!1:!0}
function gb(a){return Infinity!=a.options.au||!!a.options.bu}b.kv=function(a){var c=a?this.tn:this.Uj,d=a?this.Uj:this.tn,e=c.pop();if(e){for(var f=[e];c.length&&e.group&&e.group==c[c.length-1].group;)f.push(c.pop());for(c=0;e=f[c];c++)d.push(e);f=g.i.filter(f,a);g.i.Jc=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{g.i.Jc=!0}}};function hb(){var a=B;a.Uj.length=0;a.tn.length=0;g.i.RD()}function ib(a,c){a.Dd.push(c)}function jb(a,c){g.g.Qo(a.Dd,c)}function w(a,c){return a.fs[c]||null}g.Jb.$l=Object.create(null);
g.Jb.jt=function(a){return g.Jb.$l[a]||null};g.Jb.getAll=function(){var a=[],c;for(c in g.Jb.$l)a.push(g.Jb.$l[c]);return a};g.oa=function(a,c,d,e,f,h){this.s=a;this.gf=c;this.hA=d;d=g.oa.TA;this.s.G&&(d=-d);this.vD=g.g.Ja.pd(d);a.yf.appendChild(this.pm(c,!(!f||!h)));this.fc=e;this.Ku&&kb(this);f&&h||(c=this.gf.getBBox(),f=c.width+2*g.oa.dd,h=c.height+2*g.oa.dd);this.zn(f,h);kb(this);lb(this);this.Ku=!0;a.options.readOnly||(g.la(this.fm,"mousedown",this,this.DD),this.fg&&g.la(this.fg,"mousedown",this,this.UG))};g.oa.dd=6;g.oa.UA=5;g.oa.TA=20;g.oa.zv=4;g.oa.RA=8;g.oa.Qe=null;g.oa.ii=null;g.oa.prototype.Mu=null;
g.oa.jv=function(){g.oa.Qe&&(g.Xa(g.oa.Qe),g.oa.Qe=null);g.oa.ii&&(g.Xa(g.oa.ii),g.oa.ii=null)};g.oa.ED=function(){g.Touch.Dh();g.oa.jv()};b=g.oa.prototype;b.Ku=!1;b.fc=null;b.bh=0;b.mi=0;b.tb=0;b.Yc=0;b.$r=!0;
b.pm=function(a,c){this.je=g.g.o.I("g",{},null);var d={filter:"url(#"+this.s.options.Ux+")"};g.g.userAgent.ZB&&(d={});d=g.g.o.I("g",d,this.je);this.ks=g.g.o.I("path",{},d);this.fm=g.g.o.I("rect",{"class":"blocklyDraggable",x:0,y:0,rx:g.oa.dd,ry:g.oa.dd},d);c?(this.fg=g.g.o.I("g",{"class":this.s.G?"blocklyResizeSW":"blocklyResizeSE"},this.je),c=2*g.oa.dd,g.g.o.I("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.fg),g.g.o.I("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/
3},this.fg),g.g.o.I("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.fg)):this.fg=null;this.je.appendChild(a);return this.je};b.ya=function(){return this.je};function mb(a,c){a.je.dataset&&(a.je.dataset.blockId=c)}b.DD=function(a){var c=this.s.Tg(a);if(c){if(c.kj)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.re||(c.re=this);c.tf=a}};b.Dn=function(){};b.ne=function(){return!1};
b.UG=function(a){nb(this);g.oa.jv();g.g.tj(a)||(this.s.bv(a,new g.g.N(this.s.G?-this.tb:this.tb,this.Yc)),g.oa.Qe=g.la(document,"mouseup",this,g.oa.ED),g.oa.ii=g.la(document,"mousemove",this,this.VG),g.rc());a.stopPropagation()};b.VG=function(a){this.$r=!1;var c=this.s;a=g.g.kn(a,u(c),qa(c));a.x/=c.scale;a.y/=c.scale;c=g.g.N.sum(c.Rx,a);this.zn(this.s.G?-c.x:c.x,c.y);this.s.G&&kb(this)};function nb(a){var c=a.je.parentNode;return c.lastChild!==a.je?(c.appendChild(a.je),!0):!1}
function ob(a,c,d){var e=a.s.G?a.fc.x-c.x-a.tb:c.x+a.fc.x;c=c.y+a.fc.y;return Math.max(0,Math.min(1,(Math.min(e+a.tb,d.ec+d.rb)-Math.max(e,d.ec))*(Math.min(c+a.Yc,d.mc+d.yb)-Math.max(c,d.mc))/(a.tb*a.Yc)))}function kb(a){var c=a.fc.x;c=a.s.G?c-(a.bh+a.tb):c+a.bh;a.moveTo(c,a.mi+a.fc.y)}b.moveTo=function(a,c){this.je.setAttribute("transform","translate("+a+","+c+")")};b.ht=function(){return new g.g.$e(this.tb,this.Yc)};
b.zn=function(a,c){var d=2*g.oa.dd;a=Math.max(a,d+45);c=Math.max(c,d+20);this.tb=a;this.Yc=c;this.fm.setAttribute("width",a);this.fm.setAttribute("height",c);this.fg&&(this.s.G?this.fg.setAttribute("transform","translate("+2*g.oa.dd+","+(c-d)+") scale(-1 1)"):this.fg.setAttribute("transform","translate("+(a-d)+","+(c-d)+")"));if(this.$r){a=this.s.hc();a.ec/=this.s.scale;a.rb/=this.s.scale;a.mc/=this.s.scale;a.yb/=this.s.scale;c=-this.tb/4;if(!(this.tb>a.rb)){if(this.s.G){d=this.fc.x-c;var e=d-this.tb;
var f=a.ec+a.rb,h=a.ec+g.La.tc/this.s.scale}else e=c+this.fc.x,d=e+this.tb,h=a.ec,f=a.ec+a.rb-g.La.tc/this.s.scale;this.s.G?e<h?c=-(h-this.fc.x+this.tb):d>f&&(c=-(f-this.fc.x)):e<h?c=h-this.fc.x:d>f&&(c=f-this.fc.x-this.tb)}e=c;c=-this.Yc/4;if(!(this.Yc>a.yb)){d=this.fc.y+c;f=d+this.Yc;h=a.mc;var k=a.mc+a.yb-g.La.tc/this.s.scale,l=this.fc.y;d<h?c=h-l:f>k&&(c=k-l-this.Yc)}h=c;f=this.hA.getBBox();c={x:e,y:-this.Yc-g.wa.lr};d={x:-this.tb-30,y:h};h={x:f.width,y:h};k={x:e,y:f.height};e=f.width<f.height?
h:k;f=f.width<f.height?k:h;h=ob(this,c,a);k=ob(this,d,a);l=ob(this,e,a);a=Math.max(h,k,l,ob(this,f,a));h==a?(this.bh=c.x,this.mi=c.y):k==a?(this.bh=d.x,this.mi=d.y):l==a?(this.bh=e.x,this.mi=e.y):(this.bh=f.x,this.mi=f.y)}kb(this);lb(this);this.Mu&&this.Mu()};
function lb(a){var c=[],d=a.tb/2,e=a.Yc/2,f=-a.bh,h=-a.mi;if(d==f&&e==h)c.push("M "+d+","+e);else{h-=e;f-=d;a.s.G&&(f*=-1);var k=Math.sqrt(h*h+f*f),l=Math.acos(f/k);0>h&&(l=2*Math.PI-l);var m=l+Math.PI/2;m>2*Math.PI&&(m-=2*Math.PI);var n=Math.sin(m),r=Math.cos(m),t=a.ht();m=(t.width+t.height)/g.oa.UA;m=Math.min(m,t.width,t.height)/4;t=1-g.oa.RA/k;f=d+t*f;h=e+t*h;t=d+m*r;var v=e+m*n;d-=m*r;e-=m*n;n=l+a.vD;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/g.oa.zv;k=Math.cos(n)*k/g.oa.zv;c.push("M"+t+","+
v);c.push("C"+(t+k)+","+(v+l)+" "+f+","+h+" "+f+","+h);c.push("C"+f+","+h+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.ks.setAttribute("d",c.join(" "))}b.Kc=function(a){this.fm.setAttribute("fill",a);this.ks.setAttribute("fill",a)};b.J=function(){g.oa.jv();g.g.o.removeNode(this.je);this.hA=this.gf=this.s=this.fg=this.fm=this.ks=this.je=null};b.fu=function(a,c){a?a.Tj(c.x,c.y):this.moveTo(c.x,c.y);this.bh=this.s.G?this.fc.x-c.x-this.tb:c.x-this.fc.x;this.mi=c.y-this.fc.y;lb(this)};
b.Ra=function(){return new g.g.N(this.fc.x+this.bh,this.fc.y+this.mi)};g.i.qg=function(a){this.Of=a.id;this.xc=a.v.id;this.group=g.i.$b();this.Jc=g.i.Jc};g.g.object.W(g.i.qg,g.i.Abstract);g.i.qg.prototype.Za=function(){var a=g.i.qg.w.Za.call(this);this.Of&&(a.commentId=this.Of);return a};g.i.qg.prototype.va=function(a){g.i.qg.w.va.call(this,a);this.Of=a.commentId};g.i.dk=function(a,c,d){a&&(g.i.dk.w.constructor.call(this,a),this.vz=c,this.Wp=d)};g.g.object.W(g.i.dk,g.i.qg);b=g.i.dk.prototype;b.type=g.i.Iv;
b.Za=function(){var a=g.i.dk.w.Za.call(this);a.newContents=this.Wp;return a};b.va=function(a){g.i.dk.w.va.call(this,a);this.Wp=a.newValue};b.Vk=function(){return this.vz==this.Wp};b.run=function(a){var c;(c=xa(this).Zo[this.Of]||null)?c.BM(a?this.Wp:this.vz):console.warn("Can't change non-existent comment: "+this.Of)};g.i.rg=function(a){a&&(g.i.rg.w.constructor.call(this,a),this.xml=a.fv())};g.g.object.W(g.i.rg,g.i.qg);g.i.rg.prototype.type=g.i.io;
g.i.rg.prototype.Za=function(){var a=g.i.rg.w.Za.call(this);a.xml=g.R.Rd(this.xml);return a};g.i.rg.prototype.va=function(a){g.i.rg.w.va.call(this,a);this.xml=g.R.jh(a.xml)};g.i.rg.prototype.run=function(a){g.i.Lv(this,a)};g.i.Lv=function(a,c){var d=xa(a);c?(c=g.g.xml.createElement("xml"),c.appendChild(a.xml),g.R.Qg(c,d)):(d=d.Zo[a.Of]||null)?d.J(!1,!1):console.warn("Can't uncreate non-existent comment: "+a.Of)};g.i.sg=function(a){a&&(g.i.sg.w.constructor.call(this,a),this.xml=a.fv())};
g.g.object.W(g.i.sg,g.i.qg);g.i.sg.prototype.type=g.i.Jv;g.i.sg.prototype.Za=function(){return g.i.sg.w.Za.call(this)};g.i.sg.prototype.va=function(a){g.i.sg.w.va.call(this,a)};g.i.sg.prototype.run=function(a){g.i.Lv(this,!a)};g.i.Ai=function(a){a&&(g.i.Ai.w.constructor.call(this,a),this.us=a,this.ou=a.Fy(),this.zj=null)};g.g.object.W(g.i.Ai,g.i.qg);b=g.i.Ai.prototype;
b.Hj=function(){if(!this.us)throw Error("Tried to record the new position of a comment on the same event twice.");this.zj=this.us.Fy();this.us=null};b.type=g.i.jo;b.Za=function(){var a=g.i.Ai.w.Za.call(this);this.zj&&(a.newCoordinate=Math.round(this.zj.x)+","+Math.round(this.zj.y));return a};b.va=function(a){g.i.Ai.w.va.call(this,a);a.newCoordinate&&(a=a.newCoordinate.split(","),this.zj=new g.g.N(Number(a[0]),Number(a[1])))};b.Vk=function(){return g.g.N.He(this.ou,this.zj)};
b.run=function(a){var c;if(c=xa(this).Zo[this.Of]||null){a=a?this.zj:this.ou;var d=c.Fy();c.moveBy(a.x-d.x,a.y-d.y)}else console.warn("Can't move non-existent comment: "+this.Of)};g.Cl=function(a,c){this.qc=a;this.s=c;this.dj=null;this.Bq=!1;this.lg=this.qc.Ra();this.gj=g.g.oj()&&c.ie?c.ie:null};g.Cl.prototype.J=function(){this.gj=this.s=this.qc=null};function pb(a,c,d){d=a.bl(d);d=g.g.N.sum(a.lg,d);a.qc.fu(a.gj,d);a.qc.ne()&&(a.dj=Va(a.s,c),a.Bq=a.dj!=g.Ov,c=a.s.bd,a.Bq?(Wa(a.qc,!0),a.dj==g.Sq&&c&&Xa(c,!0)):(Wa(a.qc,!1),c&&Xa(c,!1)))}
function qb(a,c,d){pb(a,c,d);c=a.bl(d);c=g.g.N.sum(a.lg,c);a.qc.moveTo(c.x,c.y);c=a.s.bd;a.Bq?(c&&setTimeout(c.close.bind(c),100),a.Dm(),a.qc.J(!1,!0)):c&&c.close();a.Bq||(a.gj&&a.gj.Vo(a.s.yf),a.qc.Jj&&a.qc.Jj(!1),a.Dm());a.s.Lc(!0);a.s.ra&&g.g.o.Tb(a.s.ra.zc,a.qc.ne()?"blocklyToolboxDelete":"blocklyToolboxGrab");g.i.$(!1)}g.Cl.prototype.Dm=function(){if(this.qc.$y){var a=new g.i.Ai(this.qc);a.ou=this.lg;a.Hj();g.i.Ma(a)}};
g.Cl.prototype.bl=function(a){a=new g.g.N(a.x/this.s.scale,a.y/this.s.scale);this.s.sj&&a.scale(1/this.s.options.Ob.scale);return a};g.Cl.prototype.iu=function(){this.qc.moveTo(0,0);this.gj.Tj(this.lg.x,this.lg.y);ya(this.gj,this.qc.ya())};g.am=function(a){this.s=a;this.pA=new g.g.N(a.scrollX,a.scrollY)};g.am.prototype.J=function(){this.s=null};g.am.prototype.bv=function(){g.selected&&rb(g.selected);ra(this.s)};g.am.prototype.Ih=function(a){a=g.g.N.sum(this.pA,a);this.s.scroll(a.x,a.y)};g.to=function(a){g.to.w.constructor.call(this,a.Kk());this.uc=a.uc;this.qf=a.qf};g.g.object.W(g.to,g.am);g.to.prototype.Ih=function(a){a=g.g.N.sum(this.pA,a);this.qf?this.uc.set(-a.x):this.uc.set(-a.y)};g.gk=function(a,c){this.vc=this.wc=this.Lj=this.Mj=this.re=this.yd=this.pz=null;this.ys=c;this.Sm=this.qj=this.Tm=this.ij=!1;this.tf=a;this.P=this.wi=this.cf=this.Gg=this.Zp=this.Yp=null;this.Mp=this.kj=this.Zw=!1;this.Oy=!g.wB};b=g.gk.prototype;b.J=function(){g.Touch.Dh();g.K.zH();this.ys.Dc=null;this.Yp&&g.Xa(this.Yp);this.Zp&&g.Xa(this.Zp);this.P=this.vc=this.wc=this.Lj=this.Mj=null;this.cf&&(this.cf.J(),this.cf=null);this.wi&&(this.wi.J(),this.wi=null);this.Gg&&(this.Gg.J(),this.Gg=null)};
function sb(a,c){a.yd=g.g.N.xm(new g.g.N(c.clientX,c.clientY),a.pz);if(a.ij)var d=!1;else a.ij=g.g.N.XF(a.yd)>(a.P?g.EB:g.vB),d=a.ij;if(d){if(a.Zw)throw Error("updateIsDragging_ should only be called once per gesture.");a.Zw=!0;if(a.re){a.Sm=!0;a.Gg=new g.Cl(a.re,a.vc);d=a.Gg;g.i.$b()||g.i.$(!0);d.s.Lc(!1);d.qc.$r=!1;d.gj&&d.iu();d.qc.Jj&&d.qc.Jj(!0);var e=d.s.ra;e&&g.g.o.mb(e.zc,d.qc.ne()?"blocklyToolboxDelete":"blocklyToolboxGrab");pb(a.Gg,a.tf,a.yd);d=!0}else d=!1;if(!d){if(a.wc)if(a.P?(a.P.Zy(a.wc)?
((d=!tb(a.P))||(d=a.yd,d=Math.atan2(d.y,d.x)/Math.PI*180,e=a.P.DE,d=d<e&&d>-e||d<-180+e||d>180-e?!0:!1),d?(a.vc=a.P.qb,ub(a.vc),g.i.$b()||g.i.$(!0),a.Lj=null,a.wc=vb(a.P,a.wc),a.wc.select(),d=!0):d=!1):d=!1,a.qj=d):a.wc.Fc()&&(a.qj=!0),a.qj){a.cf=new g.yi(a.wc,a.vc);d=a.cf;e=a.yd;var f=a.Oy;g.i.$b()||g.i.$(!0);d.s.sj&&$a(d.Gb);g.g.o.In();d.s.Lc(!1);g.ob.Ls();if(d.Gb.getParent()||f&&d.Gb.X&&y(d.Gb.X))z(d.Gb,f),e=d.bl(e),e=g.g.N.sum(d.lg,e),d.Gb.translate(e.x,e.y),g.ob.xE(d.Gb);d.Gb.Jj(!0);d.Gb.iu();
(e=d.s.ra)&&g.g.o.mb(e.zc,d.Gb.ne()?"blocklyToolboxDelete":"blocklyToolboxGrab");Ta(a.cf,a.tf,a.yd);d=!0}else d=!1;else d=!1;if(d=!d)if(a.P)d=tb(a.P);else if(d=a.vc)d=a.vc,d=d.options.Hc&&d.options.Hc.Ih;d&&(a.wi=a.P?new g.to(a.P):new g.am(a.vc),a.Tm=!0,a.wi.bv())}g.ai()}a.tf=c}
b.Ms=function(a){g.g.Pp(a)?this.cancel():(this.kj=!0,g.ob.Ls(),ub(this.vc),this.vc.sj&&this.vc.resize(),pa(this.vc),this.tf=a,g.rc(!!this.P),g.K.block(),this.wc&&(!this.wc.ac&&a.shiftKey?(g.navigation.Zs(),I(this.ys.Ya,g.navigation.tt(this.wc))):this.wc.select()),g.g.tj(a)?da(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||g.VF(a,this),this.pz=new g.g.N(a.clientX,a.clientY),this.Oy=a.altKey||a.ctrlKey||a.metaKey,this.yk(a)))};
b.yk=function(a){this.Yp=g.la(document,"mousemove",null,this.Mm.bind(this));this.Zp=g.la(document,"mouseup",null,this.Bp.bind(this));a.preventDefault();a.stopPropagation()};b.Mm=function(a){sb(this,a);this.Tm?this.wi.Ih(this.yd):this.qj?Ta(this.cf,this.tf,this.yd):this.Sm&&pb(this.Gg,this.tf,this.yd);a.preventDefault();a.stopPropagation()};
b.Bp=function(a){sb(this,a);g.ai();if(this.Mp)console.log("Trying to end a gesture recursively.");else{this.Mp=!0;if(this.Sm)qb(this.Gg,a,this.yd);else if(this.qj)Ya(this.cf,a,this.yd);else if(this.Tm){var c=this.wi;c.Ih(this.yd);sa(c.s)}else if(this.re&&!this.ij)this.re.aH&&this.re.aH(),this.re.select&&this.re.select();else if(wb(this))this.Mj.wf(),xb(this);else if(this.Lj&&!this.ij&&!wb(this))this.P&&this.P.xk?this.wc.isEnabled()&&(g.i.$b()||g.i.$(!0),ab(vb(this.P,this.wc))):g.i.Ma(new g.i.xd(this.Lj,
"click",void 0,void 0)),xb(this),g.i.$(!1);else if(!(this.Lj||this.re||this.Mj||this.ij))if(c=this.ys,a.shiftKey){g.navigation.Zs();var d=g.g.YG(c,new g.g.N(a.clientX,a.clientY));d=g.F.sm(c,d);I(c.Ya,d)}else g.selected&&rb(g.selected);a.preventDefault();a.stopPropagation();this.J()}};b.cancel=function(){if(!this.Mp){g.ai();if(this.Sm)qb(this.Gg,this.tf,this.yd);else if(this.qj)Ya(this.cf,this.tf,this.yd);else if(this.Tm){var a=this.wi;a.Ih(this.yd);sa(a.s)}this.J()}};
function da(a,c){a.wc?(xb(a),g.rc(a.P),a.wc.Dn(c)):a.re?a.re.Dn(c):a.vc&&!a.P&&(g.rc(),a.vc.Dn(c));c.preventDefault();c.stopPropagation();a.J()}function yb(a,c,d){if(a.kj)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");a.vc||(a.vc=d);a.tf=c;a.Ms(c);g.Oe&&g.navigation.Ib(g.navigation.Ul)}function zb(a,c,d){if(a.kj)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");a.P||(a.P=d);yb(a,c,d.Kk())}
function xb(a){a.wc&&!a.P&&$a(a.wc)}function Ab(a,c){a.Lj||a.re||(a.Lj=c,c.ac&&c!=H(c)?Bb(a,H(c)):Bb(a,c))}function Bb(a,c){c.bb?Bb(a,c.getParent()):a.wc=c}function wb(a){if(a.Mj){var c=a.Mj;c=!!c.B&&c.B.ld()&&!!c.wf&&"function"===typeof c.wf}else c=!1;return c&&!a.ij&&(!a.P||!a.P.xk)}b.ic=function(){return this.Tm||this.qj||this.Sm};b.Jk=function(){return this.cf?this.cf.Jk():[]};g.gk.Et=function(){for(var a=g.Jb.getAll(),c=0,d;d=a[c];c++)if(d.Dc)return!0;return!1};g.Pa=function(a,c,d){this.wA=this.Vj=this.dc=null;this.cc=new g.g.$e(0,0);this.Vc=null;d&&this.Od(d);this.setValue(a);c&&(this.Vj=c)};g.Pa.Fv=16;g.Pa.Ew=12.5;g.Pa.bm=10;g.Pa.PL=10;g.Pa.Ci=g.Pa.bm/2;b=g.Pa.prototype;b.name=void 0;b.mz=50;b.B=null;b.Zf=!0;b.ui=!0;b.Wo=null;g.Pa.jw="\u00a0";b=g.Pa.prototype;b.ug=!0;b.Ni=!1;b.Od=function(a){var c=a.tooltip;"string"==typeof c&&(c=g.g.Xd(a.tooltip));c&&this.Sa(c)};b.Yu=function(a){if(this.B)throw Error("Field already bound to a block.");this.B=a};
b.S=function(){this.mf||(this.mf=g.g.o.I("g",{},null),this.isVisible()||(this.mf.style.display="none"),this.B.ya().appendChild(this.mf),this.Sh(),this.lh(),this.Sa(this.wA),g.K.yk(this.Wo||this.ya()),this.oz=g.la(this.Wo||this.ya(),"mousedown",this,this.gi),this.mj())};b.Sh=function(){this.cc.height=Math.max(this.cc.height,g.Pa.Fv);this.cc.width=Math.max(this.cc.width,g.Pa.bm);this.Vi=g.g.o.I("rect",{rx:4,ry:4,x:0,y:0,height:this.cc.height,width:this.cc.width},this.mf);Cb(this)};b.mj=function(){};
function Cb(a){a.kc=g.g.o.I("text",{"class":"blocklyText",y:g.Pa.Ew,x:a.Vi?g.Pa.Ci:0},a.mf);a.Rj=document.createTextNode("");a.kc.appendChild(a.Rj)}b.Fm=function(a){this.setValue(a.textContent)};b.uA=function(a){a.textContent=this.getValue();return a};b.J=function(){g.D.Nk(this);g.aa.Nk(this);this.oz&&g.Xa(this.oz);g.g.o.removeNode(this.mf)};
b.lh=function(){var a=this.Wo||this.ya();this.ug&&a&&(this.B.ld()?(g.g.o.mb(a,"blocklyEditableText"),g.g.o.Tb(a,"blocklyNonEditableText"),a.style.cursor=this.Rq):(g.g.o.mb(a,"blocklyNonEditableText"),g.g.o.Tb(a,"blocklyEditableText"),a.style.cursor=""))};b.isVisible=function(){return this.ui};b.Vb=function(a){if(this.ui!=a){this.ui=a;var c=this.ya();c&&(c.style.display=a?"block":"none")}};function Db(a,c){a.Vj=c}b.Dy=function(){return this.Vj};b.ya=function(){return this.mf};b.Ue=function(){};
b.eg=function(){if(this.Rj){this.Rj.nodeValue=Eb(this);var a=g.g.o.yp(this.kc);this.Vi&&(a+=g.Pa.bm,this.Vi.setAttribute("width",a));this.cc.width=a}};b.Ug=function(){if(!this.isVisible())return new g.g.$e(0,0);this.Zf?(this.eg(),this.Zf=!1):this.ui&&0==this.cc.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.eg());return this.cc};
function Eb(a){var c=a.Sb();if(!c)return g.Pa.jw;c.length>a.mz&&(c=c.substring(0,a.mz-2)+"\u2026");c=c.replace(/\s/g,g.Pa.jw);a.B&&a.B.G&&(c+="\u200f");return c}b.Sb=function(){if(this.st){var a=this.st.call(this);if(null!==a)return String(a)}return String(this.getValue())};b.ll=function(){throw Error("setText method is deprecated");};b.dn=function(){this.Zf=!0};function Fb(a){a.Zf=!0;a.B&&a.B.ba&&(a.B.za(),a.B.Lb())}
b.setValue=function(a){if(null!==a){var c=this.Hh(a);a=Gb(this,a,c);if(!(a instanceof Error)){if(c=this.Dy())if(c=c.call(this,a),a=Gb(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.B&&g.i.isEnabled()&&g.i.Ma(new g.i.pg(this.B,"field",this.name||null,c,a)),this.ej(a),this.Zf&&Fb(this))}}};function Gb(a,c,d){if(null===d)return a.Qx(),a.Zf&&Fb(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.dc};b.Hh=function(a){return null===a||void 0===a?null:a};
b.ej=function(a){this.dc=a;this.Zf=!0};b.Qx=function(){};b.gi=function(a){if(this.B&&this.B.v&&(a=this.B.v.Tg(a))){if(a.kj)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.Mj||(a.Mj=this)}};b.Sa=function(a){var c=this.Wo||this.ya();c?c.zf=a||""===a?a:this.B:this.wA=a};b.un=function(){return!1};b.Wf=function(){for(var a=null,c=this.B,d=c.T,e=0;e<c.T.length;e++)for(var f=d[e],h=f.Qa,k=0;k<h.length;k++)if(h[k]===this){a=f;break}return a};b.bz=function(){return!1};
b.ei=function(){return!1};b.Bn=function(a){a?(this.mf.appendChild(a),this.Vc=a):this.Vc=null};b.Cn=function(a){a&&this.mf.appendChild(a)};g.Wc={};g.Wc.Rn={};g.Wc.register=function(a,c){if("string"!=typeof a||""==a.trim())throw Error('Invalid field type "'+a+'". The type must be a non-empty string.');if(g.Wc.Rn[a])throw Error('Error: Field "'+a+'" is already registered.');if(!c||"function"!=typeof c.va)throw Error('Field "'+c+'" must have a fromJson function');a=a.toLowerCase();g.Wc.Rn[a]=c};g.Wc.unregister=function(a){g.Wc.Rn[a]?delete g.Wc.Rn[a]:console.warn('No field mapping for type "'+a+'" found to unregister')};
g.Wc.va=function(a){var c=g.Wc.Rn[a.type.toLowerCase()];return c?c.va(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)};g.Id=function(a,c,d){this.Uo=null;null==a&&(a="");g.Id.w.constructor.call(this,a,null,d);d||(this.Uo=c||null);this.cc=new g.g.$e(0,g.Pa.Ew)};g.g.object.W(g.Id,g.Pa);g.Id.va=function(a){var c=g.g.Xd(a.text);return new g.Id(c,void 0,a)};g.Id.prototype.ug=!1;g.Id.prototype.Od=function(a){g.Id.w.Od.call(this,a);this.Uo=a["class"]};g.Id.prototype.Sh=function(){Cb(this);this.kc.setAttribute("y",this.cc.height);this.Uo&&g.g.o.mb(this.kc,this.Uo)};
g.Id.prototype.Hh=function(a){return null===a||void 0===a?null:String(a)};g.Wc.register("field_label",g.Id);g.bw=function(a,c,d,e){if(a!=g.tg&&!c)throw Error("Value inputs and statement inputs must have non-empty name.");this.type=a;this.name=c;this.B=d;this.connection=e;this.Qa=[]};b=g.bw.prototype;b.align=g.Hq;b.ui=!0;function K(a,c,d){Hb(a,a.Qa.length,c,d);return a}
function Hb(a,c,d,e){if(0>c||c>a.Qa.length)throw Error("index "+c+" out of bounds.");if(!(d||""==d&&e))return c;"string"==typeof d&&(d=new g.Id(d));d.Yu(a.B);a.B.ba&&d.S();d.name=e;d.Eu&&(c=Hb(a,c,d.Eu));a.Qa.splice(c,0,d);++c;d.dv&&(c=Hb(a,c,d.dv));a.B.ba&&(a.B.za(),a.B.Lb());return c}function Ib(a,c){for(var d=0,e;e=a.Qa[d];d++)if(e.name===c){e.J();a.Qa.splice(d,1);a.B.ba&&(a.B.za(),a.B.Lb());return}throw Error('Field "%s" not found.',c);}b.isVisible=function(){return this.ui};
b.Vb=function(a){var c=[];if(this.ui==a)return c;for(var d=(this.ui=a)?"block":"none",e=0,f;f=this.Qa[e];e++)f.Vb(a);if(this.connection){if(a)c=Jb(this.connection);else if(e=this.connection,Kb(e,!0),e.ca)for(e=p(y(e),!1),f=0;f<e.length;f++){for(var h=e[f],k=h.Ie(!0),l=0;l<k.length;l++)Kb(k[l],!0);h=Sa(h);for(l=0;l<h.length;l++)h[l].Vb(!1)}if(e=y(this.connection))e.ya().style.display=d,a||(e.ba=!1)}return c};b.dn=function(){for(var a=0,c;c=this.Qa[a];a++)c.dn()};
b.xb=function(a){if(!this.connection)throw Error("This input does not have a connection.");this.connection.xb(a);return this};function Lb(a,c){a.align=c;a.B.ba&&a.B.za();return a}b.S=function(){if(this.B.v.ba)for(var a=0;a<this.Qa.length;a++)this.Qa[a].S()};b.J=function(){for(var a=0,c;c=this.Qa[a];a++)c.J();this.connection&&this.connection.J();this.B=null};g.g.Mb={};g.g.Mb.parse=function(a){a=String(a).toLowerCase().trim();var c=g.g.Mb.names[a];if(c)return c;c="#"==a[0]?a:"#"+a;if(/^#[0-9a-f]{6}$/.test(c))return c;if(/^#[0-9a-f]{3}$/.test(c))return["#",c[1],c[1],c[2],c[2],c[3],c[3]].join("");var d=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return d&&(a=Number(d[1]),c=Number(d[2]),d=Number(d[3]),0<=a&&256>a&&0<=c&&256>c&&0<=d&&256>d)?g.g.Mb.Pu(a,c,d):null};
g.g.Mb.Pu=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};g.g.Mb.Py=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]};
g.g.Mb.CF=function(a){var c=g.PB,d=255*g.QB,e=0,f=0,h=0;if(0==c)h=f=e=d;else{var k=Math.floor(a/60),l=a/60-k;a=d*(1-c);var m=d*(1-c*l);c=d*(1-c*(1-l));switch(k){case 1:e=m;f=d;h=a;break;case 2:e=a;f=d;h=c;break;case 3:e=a;f=m;h=d;break;case 4:e=c;f=a;h=d;break;case 5:e=d;f=a;h=m;break;case 6:case 0:e=d,f=c,h=a}}return g.g.Mb.Pu(Math.floor(e),Math.floor(f),Math.floor(h))};
g.g.Mb.ds=function(a,c,d){a=g.g.Mb.Py(g.g.Mb.parse(a));c=g.g.Mb.Py(g.g.Mb.parse(c));return g.g.Mb.Pu(Math.round(c[0]+d*(a[0]-c[0])),Math.round(c[1]+d*(a[1]-c[1])),Math.round(c[2]+d*(a[2]-c[2])))};g.g.Mb.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"};g.eo=function(a,c,d){if(g.Generator&&"undefined"!=typeof g.Generator.prototype[c])throw Error('Block prototypeName "'+c+'" conflicts with Blockly.Generator members.');this.id=d&&!w(a,d)?d:g.g.Rg();a.fs[this.id]=this;this.Z=this.X=this.M=null;this.T=[];this.Yg=void 0;this.disabled=!1;this.zf="";this.contextMenu=!0;this.ag=null;this.Ig=[];this.Tx=this.rz=this.Bs=!0;this.Jg=this.bb=!1;this.Bk=null;this.Ee={text:null,Du:!1,size:new g.g.$e(160,80)};this.KA=new g.g.N(0,0);this.v=a;this.ac=a.oe;this.G=a.G;
this.Wm=!1;this.Wg=void 0;if(c){this.type=c;d=g.L[c];if(!d||"object"!=typeof d)throw TypeError("Unknown block type: "+c);g.g.object.yj(this,d)}a.ul.push(this);a.kh[this.type]||(a.kh[this.type]=[]);a.kh[this.type].push(this);"function"==typeof this.S&&this.S();this.JF=this.Yg;if(g.i.isEnabled()){(a=g.i.$b())||g.i.$(!0);try{g.i.Ma(new g.i.fo(this))}finally{a||g.i.$(!1)}}if("function"==typeof this.onchange){if((a=this.onchange)&&"function"!=typeof a)throw Error("onchange must be a function.");this.mn&&
jb(this.v,this.mn);if(this.onchange=a)this.mn=a.bind(this),ib(this.v,this.mn)}};b=g.eo.prototype;b.data=null;b.Eh="#000000";b.kx=null;b.lx=null;
b.J=function(a){if(this.v){this.mn&&jb(this.v,this.mn);g.Oe&&g.navigation.sz(this);z(this,a);g.i.isEnabled()&&g.i.Ma(new g.i.aB(this));g.i.disable();try{if(this.v){db(this.v,this);var c=this.v;c.kh[this.type].splice(c.kh[this.type].indexOf(this),1);c.kh[this.type].length||delete c.kh[this.type];delete this.v.fs[this.id];this.v=null}g.selected==this&&(g.selected=null);for(var d=this.Ig.length-1;0<=d;d--)this.Ig[d].J(!1);d=0;for(var e;e=this.T[d];d++)e.J();this.T.length=0;var f=this.Ie(!0);d=0;for(var h;h=
f[d];d++)h.J()}finally{g.i.enable()}}};b.mj=function(){for(var a=0,c;c=this.T[a];a++)for(var d=0,e;e=c.Qa[d];d++)e.mj&&e.mj()};
function z(a,c){if(a.M){var d=null;a.M.isConnected()&&(d=a.M.ca,a.M.disconnect());if(d&&c){a:{c=null;for(var e=0;e<a.T.length;e++){var f=a.T[e].connection;if(f&&f.type==g.Wa&&f.ca){if(c){a=null;break a}c=f}}a=c}a&&a.isConnected()&&!y(a).bb&&(a=a.ca,a.disconnect(),Ja(a,d)?d.connect(a):a.Xp(d))}}else a.Z&&(d=null,a.Z.isConnected()&&(d=a.Z.ca,a.Z.disconnect()),e=q(a),c&&e&&!e.bb&&(a=a.X.ca,a.disconnect(),d&&Ja(d,a)&&d.connect(a)))}
b.Ie=function(){var a=[];this.M&&a.push(this.M);this.Z&&a.push(this.Z);this.X&&a.push(this.X);for(var c=0,d;d=this.T[c];c++)d.connection&&a.push(d.connection);return a};b.Lb=function(){console.warn("Not expected to reach Block.bumpNeighbours function. BlockSvg.bumpNeighbours was expected to be called instead.")};b.getParent=function(){return this.ag};function Mb(a){do{var c=a;a=a.getParent();if(!a)return null}while(q(a)==c);return a}function q(a){return a.X&&y(a.X)}
function H(a){var c=a;do a=c,c=a.ag;while(c);return a}b.Kh=function(a){if(!a)return this.Ig;a=[];for(var c=0,d;d=this.T[c];c++)d.connection&&(d=y(d.connection))&&a.push(d);(c=q(this))&&a.push(c);return a};b.kl=function(a){if(a!=this.ag){if(this.ag){g.g.Qo(this.ag.Ig,this);if(this.Z&&this.Z.isConnected())throw Error("Still connected to previous block.");if(this.M&&this.M.isConnected())throw Error("Still connected to parent block.");this.ag=null}else db(this.v,this);(this.ag=a)?a.Ig.push(this):this.v.ul.push(this)}};
function p(a,c){var d=[a];a=a.Kh(c);for(var e,f=0;e=a[f];f++)d.push.apply(d,p(e,c));return d}b.ne=function(){return this.Bs&&!this.bb&&!(this.v&&this.v.options.readOnly)};b.Fc=function(){return this.rz&&!this.bb&&!(this.v&&this.v.options.readOnly)};b.oq=function(a){this.rz=a};b.Xu=function(a){this.bb=a};b.Vh=function(){return this.Wm};b.eA=function(a){this.Wm=a};b.ld=function(){return this.Tx&&!(this.v&&this.v.options.readOnly)};
b.Tu=function(a){this.Tx=a;a=0;for(var c;c=this.T[a];a++)for(var d=0,e;e=c.Qa[d];d++)e.lh()};b.Sa=function(a){this.zf=a};function Nb(a){var c=a.kx;return c?c:g.g.Mb.ds("#fff",a.Eh,.6)}function Ob(a){var c=a.lx;if(c)return{Yo:c,ts:null,jx:null};a=a.Eh;return{Yo:null,ts:g.g.Mb.ds("#fff",a,.3),jx:g.g.Mb.ds("#000",a,.2)}}
b.Kc=function(a){var c="string"==typeof a?g.g.Xd(a):a,d=Number(c);if(!isNaN(d)&&0<=d&&360>=d)this.Eh=g.Uy(d);else if(d=g.g.Mb.parse(c))this.Eh=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);};function L(a,c){var d=a.v.zp().CD[c];if(d)a.kx=d.colourSecondary,a.lx=d.colourTertiary,a.Wg=d.Wg,a.Kc(d.colourPrimary);else throw Error("Invalid style name: "+c);}function x(a,c){for(var d=0,e;e=a.T[d];d++)for(var f=0,h;h=e.Qa[f];f++)if(h.name==c)return h;return null}
b.wt=function(){for(var a=[],c=0,d;d=this.T[c];c++)for(var e=0,f;f=d.Qa[e];e++)f.un()&&a.push(f.getValue());return a};b.Vg=function(){for(var a=[],c=0,d;d=this.T[c];c++)for(var e=0,f;f=d.Qa[e];e++)f.un()&&(f=this.v.nf(f.getValue()))&&a.push(f);return a};b.zq=function(a){for(var c=0,d;d=this.T[c];c++)for(var e=0,f;f=d.Qa[e];e++)f.un()&&a.ua()==f.getValue()&&Fb(f)};b.hq=function(a,c){for(var d=0,e;e=this.T[d];d++)for(var f=0,h;h=e.Qa[f];f++)h.un()&&a==h.getValue()&&h.setValue(c)};
function F(a,c){return(a=x(a,c))?a.getValue():null}function Pb(a,c,d){a=x(a,d);if(!a)throw Error('Field "'+d+'" not found.');a.setValue(c)}b.qe=function(a,c){if(a){void 0===c&&(c=null);if(!this.Z){if(this.M)throw Error("Remove output connection prior to adding previous connection.");this.Z=this.cn(g.Ze)}this.Z.xb(c)}else if(this.Z){if(this.Z.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.Z.J();this.Z=null}};
b.pe=function(a,c){if(a)void 0===c&&(c=null),this.X||(this.X=this.cn(g.jb)),this.X.xb(c);else if(this.X){if(this.X.isConnected())throw Error("Must disconnect next statement before removing connection.");this.X.J();this.X=null}};
b.Ed=function(a,c){if(a){void 0===c&&(c=null);if(!this.M){if(this.Z)throw Error("Remove previous connection prior to adding output connection.");this.M=this.cn(g.Ye)}this.M.xb(c)}else if(this.M){if(this.M.isConnected())throw Error("Must disconnect output value before removing connection.");this.M.J();this.M=null}};b.ad=function(a){this.Yg!=a&&(g.i.Ma(new g.i.pg(this,"inline",null,this.Yg,a)),this.Yg=a)};
function Ma(a){if(void 0!=a.Yg)return a.Yg;for(var c=1;c<a.T.length;c++)if(a.T[c-1].type==g.tg&&a.T[c].type==g.tg)return!1;for(c=1;c<a.T.length;c++)if(a.T[c-1].type==g.Wa&&a.T[c].type==g.tg)return!0;return!1}b.isEnabled=function(){return!this.disabled};b.od=function(a){this.isEnabled()!=a&&(g.i.Ma(new g.i.pg(this,"disabled",null,this.disabled,!a)),this.disabled=!a)};function Qb(a){for(a=Mb(a);a;){if(a.disabled)return!0;a=Mb(a)}return!1}b.isCollapsed=function(){return this.Jg};
b.gh=function(a){this.Jg!=a&&(g.i.Ma(new g.i.pg(this,"collapsed",null,this.Jg,a)),this.Jg=a)};b.toString=function(a,c){var d=[],e=c||"?";if(this.Jg)d.push(A(this,"_TEMP_COLLAPSED_INPUT").Qa[0].Sb());else for(var f=0,h;h=this.T[f];f++){for(var k=0,l;l=h.Qa[k];k++)d.push(l.Sb());h.connection&&((h=y(h.connection))?d.push(h.toString(void 0,c)):d.push(e))}d=d.join(" ").trim()||"???";a&&d.length>a&&(d=d.substring(0,a-3)+"...");return d};function M(a,c){return a.dm(g.Wa,c)}
function Rb(a,c){return a.dm(g.jb,c)}function N(a,c){return a.dm(g.tg,c||"")}
function O(a,c){var d=c.type?'Block "'+c.type+'": ':"";if(c.output&&c.previousStatement)throw Error(d+"Must not have both an output and a previousStatement.");c.style&&c.style.Wg&&(a.Wg=c.style.Wg,c.style=null);if(c.style&&c.colour)throw Error(d+"Must not have both a colour and a style.");if(c.style){var e=c.style;try{L(a,e)}catch(C){console.warn(d+"Style does not exist: ",e)}}else if("colour"in c)if(void 0===c.colour)console.warn(d+"Undefined colour value.");else{e=c.colour;try{a.Kc(e)}catch(C){console.warn(d+
"Illegal colour value: ",e)}}for(e=0;void 0!==c["message"+e];){for(var f=a,h=c["args"+e]||[],k=c["lastDummyAlign"+e],l=g.g.uH(c["message"+e]),m=[],n=0,r=[],t=0;t<l.length;t++){var v=l[t];if("number"==typeof v){if(0>=v||v>h.length)throw Error('Block "'+f.type+'": Message index %'+v+" out of range.");if(m[v])throw Error('Block "'+f.type+'": Message index %'+v+" duplicated.");m[v]=!0;n++;r.push(h[v-1])}else(v=v.trim())&&r.push(v)}if(n!=h.length)throw Error('Block "'+f.type+'": Message does not reference all '+
h.length+" arg(s).");r.length&&("string"==typeof r[r.length-1]||g.g.eb.startsWith(r[r.length-1].type,"field_"))&&(t={type:"input_dummy"},k&&(t.align=k),r.push(t));k={LEFT:g.Hq,RIGHT:g.yl,CENTRE:g.xv};h=[];for(t=0;t<r.length;t++)if(m=r[t],"string"==typeof m)h.push([m,void 0]);else{l=n=null;do if(v=!1,"string"==typeof m)n=new g.Id(m);else switch(m.type){case "input_value":l=M(f,m.name);break;case "input_statement":l=Rb(f,m.name);break;case "input_dummy":l=N(f,m.name);break;default:n=g.Wc.va(m),!n&&
m.alt&&(m=m.alt,v=!0)}while(v);if(n)h.push([n,m.name]);else if(l){m.check&&l.xb(m.check);m.align&&Lb(l,k[m.align]);for(m=0;m<h.length;m++)K(l,h[m][0],h[m][1]);h.length=0}}e++}void 0!==c.inputsInline&&a.ad(c.inputsInline);void 0!==c.output&&a.Ed(!0,c.output);void 0!==c.previousStatement&&a.qe(!0,c.previousStatement);void 0!==c.nextStatement&&a.pe(!0,c.nextStatement);void 0!==c.tooltip&&(e=c.tooltip,e=g.g.Xd(e),a.Sa(e));void 0!==c.enableContextMenu&&(e=c.enableContextMenu,a.contextMenu=!!e);void 0!==
c.helpUrl&&(e=c.helpUrl,e=g.g.Xd(e),a.wb=e);"string"==typeof c.extensions&&(console.warn(d+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+c.type+"' block."),c.extensions=[c.extensions]);void 0!==c.mutator&&g.Y.apply(c.mutator,a,!0);if(Array.isArray(c.extensions))for(c=c.extensions,d=0;d<c.length;++d)g.Y.apply(c[d],a,!1)}
b.yj=function(a,c){if(void 0!==c&&"boolean"!=typeof c)throw Error("opt_disableCheck must be a boolean if provided");if(!c){c=[];for(var d in a)void 0!==this[d]&&c.push(d);if(c.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(c));}g.g.object.yj(this,a)};b.dm=function(a,c){var d=null;if(a==g.Wa||a==g.jb)d=this.cn(a);a=new g.bw(a,c,this,d);this.T.push(a);return a};
function Sb(a,c,d){if(c!=d){for(var e=-1,f=d?-1:a.T.length,h=0,k;k=a.T[h];h++)if(k.name==c){if(e=h,-1!=f)break}else if(d&&k.name==d&&(f=h,-1!=e))break;if(-1==e)throw Error('Named input "'+c+'" not found.');if(-1==f)throw Error('Reference input "'+d+'" not found.');a.gu(e,f)}}
b.gu=function(a,c){if(a==c)throw Error("Can't move input to itself.");if(a>=this.T.length)throw RangeError("Input index "+a+" out of bounds.");if(c>this.T.length)throw RangeError("Reference input "+c+" out of bounds.");var d=this.T[a];this.T.splice(a,1);a<c&&c--;this.T.splice(c,0,d)};b.ib=function(a,c){for(var d=0,e;e=this.T[d];d++)if(e.name==a){e.J();this.T.splice(d,1);return}if(!c)throw Error("Input not found: "+a);};function A(a,c){for(var d=0,e;e=a.T[d];d++)if(e.name==c)return e;return null}
function Tb(a,c){return(a=A(a,c))&&a.connection&&y(a.connection)}b.gg=function(a){this.Ee.text!=a&&(g.i.Ma(new g.i.pg(this,"comment",null,this.Ee.text,a)),this.Bk=this.Ee.text=a)};b.ih=function(){};b.ri=function(){};b.Ra=function(){return this.KA};b.moveBy=function(a,c){if(this.ag)throw Error("Block has parent.");var d=new g.i.Bl(this);this.KA.translate(a,c);d.Hj();g.i.Ma(d)};b.cn=function(a){return new g.sa(this,a)};g.m={};g.m.rJ=function(){};g.m.Ki=function(a){this.Pj=a;this.ml=g.g.o.I("path",{"class":"blocklyPath"},this.Pj);this.On=g.g.o.I("path",{"class":"blocklyPathLight"},this.Pj);this.Mn=g.g.o.I("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Pj)};g.m.Ki.prototype.Vu=function(a){this.ml.setAttribute("d",a);this.On.style.display="none";this.Mn.style.display="none"};g.m.Ki.prototype.bt=function(){this.ml.setAttribute("transform","scale(-1 1)")};g.g.V={};g.g.V.SA="aria-";g.g.V.Cr="role";
g.g.V.Li={PH:"alert",QH:"alertdialog",SH:"application",TH:"article",ZH:"banner",bI:"button",dI:"checkbox",iI:"columnheader",jI:"combobox",lI:"complementary",mI:"contentinfo",sI:"definition",vI:"dialog",wI:"directory",yI:"document",cJ:"form",gJ:"grid",hJ:"gridcell",LB:"group",lJ:"heading",oJ:"img",xJ:"link",yJ:"list",zJ:"listbox",AJ:"listitem",CJ:"log",IJ:"main",JJ:"marquee",KJ:"math",nC:"menu",MJ:"menubar",oC:"menuitem",pC:"menuitemcheckbox",NJ:"menuitemradio",RJ:"navigation",UJ:"note",oK:"option",
BC:"presentation",QK:"progressbar",TK:"radio",UK:"radiogroup",WK:"region",Dr:"row",bL:"rowgroup",cL:"rowheader",eL:"scrollbar",gL:"search",iL:"separator",nL:"slider",qL:"spinbutton",rL:"status",Cw:"tab",sL:"table",tL:"tablist",uL:"tabpanel",vL:"textbox",wL:"textinfo",zL:"timer",AL:"toolbar",BL:"tooltip",XC:"tree",CL:"treegrid",YC:"treeitem"};
g.g.V.State={wv:"activedescendant",UH:"atomic",WH:"autocomplete",aI:"busy",eI:"checked",hI:"colindex",oI:"controls",uI:"describedby",xI:"disabled",DI:"dropeffect",Xq:"expanded",bJ:"flowto",fJ:"grabbed",jJ:"haspopup",mJ:"hidden",qJ:"invalid",uJ:"label",dw:"labelledby",aC:"level",BJ:"live",OJ:"multiline",PJ:"multiselectable",xC:"orientation",GK:"owns",AC:"posinset",OK:"pressed",VK:"readonly",XK:"relevant",$K:"required",dL:"rowindex",Sl:"selected",JC:"setsize",oL:"sort",aD:"valuemax",bD:"valuemin",FL:"valuenow",
GL:"valuetext"};g.g.V.hg=function(a,c){c?a.setAttribute(g.g.V.Cr,c):g.g.V.TG(a)};g.g.V.eM=function(a){return a.getAttribute(g.g.V.Cr)||null};g.g.V.TG=function(a){a.removeAttribute(g.g.V.Cr)};g.g.V.Ib=function(a,c,d){Array.isArray(d)&&(d=d.join(" "));a.setAttribute(g.g.V.RE(c),d)};g.g.V.RE=function(a){return g.g.V.SA+a};g.Gi=function(){g.yc.call(this);this.Xg=-1};g.g.object.W(g.Gi,g.yc);b=g.Gi.prototype;b.Ia=function(){var a=document.createElement("div");a.id=this.ua();this.hb=a;a.className="goog-menu goog-menu-vertical blocklyNonSelectable";a.tabIndex=0;g.g.V.hg(a,this.Qu||g.g.V.Li.nC)};b.focus=function(){var a=this.ta();a&&(a.focus(),g.g.o.mb(a,"focused"))};b.blur=function(){var a=this.ta();a&&(a.blur(),g.g.o.Tb(a,"focused"))};b.hg=function(a){this.Qu=a};
b.lf=function(){g.Gi.w.lf.call(this);za(this,function(a){if(a.$c){var c=a.ta();c=c.id||(c.id=a.ua());this.Ak||(this.Ak={});this.Ak[c]=a}},this);this.Zr()};b.Jh=function(){Ub(this,-1);g.Gi.w.Jh.call(this)};b.ym=function(){g.Gi.w.ym.call(this);this.Ds()};b.Zr=function(){var a=this.ta();this.cG=g.la(a,"mouseover",this,this.uF,!0);this.SD=g.la(a,"click",this,this.mF,!0);this.$F=g.la(a,"mouseenter",this,this.rF,!0);this.aG=g.la(a,"mouseleave",this,this.tF,!0);this.vu=g.la(a,"keydown",this,this.xt)};
b.Ds=function(){g.Xa(this.cG);g.Xa(this.SD);g.Xa(this.$F);g.Xa(this.aG);g.Xa(this.vu)};b.Ak=null;function Vb(a,c){if(a.Ak)for(var d=a.ta();c&&c!==d;){var e=c.id;if(e in a.Ak)return a.Ak[e];c=c.parentNode}return null}function Wb(a){(a=a.kb[a.Xg]||null)&&a.hh(!1)}function Ub(a,c){var d=a.kb[c]||null;d?(d.hh(!0),a.Xg=c):-1<a.Xg&&((a.kb[a.Xg]||null).hh(!1),a.Xg=-1);d&&g.g.style.Ru(d.ta(),a.ta())}b.hh=function(a){Ub(this,this.kb.indexOf(a))};
function Xb(a){Wb(a);Yb(a,function(c,d){return(c+1)%d},a.Xg)}function Zb(a){Wb(a);Yb(a,function(c,d){c--;return 0>c?d-1:c},a.Xg)}function Yb(a,c,d){var e=a.kb.length;d=c.call(a,0>d?-1:d,e);for(var f=0;f<=e;){var h=a.kb[d]||null;if(h&&h.isEnabled()){Ub(a,d);break}f++;d=c.call(a,d,e)}}b.uF=function(a){(a=Vb(this,a.target))&&a.isEnabled()&&(this.kb[this.Xg]||null)!==a&&(Wb(this),this.hh(a))};b.mF=function(a){var c=Vb(this,a.target),d;if(d=c)c.isEnabled()&&(c.hh(!0),$b(c)),d=void 0;d&&a.preventDefault()};
b.rF=function(){this.focus()};b.tF=function(){this.ta()&&(this.blur(),Wb(this),Ub(this,-1))};b.xt=function(a){return 0!=this.kb.length&&ac(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1};function ac(a,c){var d=a.kb[a.Xg]||null;if(d&&"function"==typeof d.xt&&d.xt(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case g.g.Ba.Uq:d&&$b(d);break;case g.g.Ba.Yl:Zb(a);break;case g.g.Ba.El:Xb(a);break;default:return!1}return!0};g.Co=function(a,c){g.yc.call(this);this.gf=a;this.setValue(c);this.lp=!0};g.g.object.W(g.Co,g.yc);b=g.Co.prototype;
b.Ia=function(){var a=document.createElement("div");a.id=this.ua();this.hb=a;a.className="goog-menuitem goog-option "+(this.lp?"":"goog-menuitem-disabled ")+(this.qs?"goog-option-selected ":"")+(this.Xk()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.hm){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(bc(this));g.g.V.hg(a,this.Qu||(this.hm?g.g.V.Li.pC:
g.g.V.Li.oC));g.g.V.Ib(a,g.g.V.State.Sl,this.hm&&this.qs||!1)};function bc(a){a=a.gf;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.dc=a};b.getValue=function(){return this.dc};b.hg=function(a){this.Qu=a};function cc(a,c){if(a.hm){a.qs=c;var d=a.ta();d&&a.isEnabled()&&(c?(g.g.o.mb(d,"goog-option-selected"),g.g.V.Ib(d,g.g.V.State.Sl,!0)):(g.g.o.Tb(d,"goog-option-selected"),g.g.V.Ib(d,g.g.V.State.Sl,!1)))}}
b.hh=function(a){var c=this.ta();c&&this.isEnabled()&&(a?g.g.o.mb(c,"goog-menuitem-highlight"):g.g.o.Tb(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.lp};b.od=function(a){this.lp=a;(a=this.ta())&&(this.lp?g.g.o.Tb(a,"goog-menuitem-disabled"):g.g.o.mb(a,"goog-menuitem-disabled"))};function $b(a){a.hm&&cc(a,!a.qs);a.Qw&&a.Qw.call(a.oD,a)}function dc(a,c,d){a.Qw=c;a.oD=d};g.g.xq={};g.g.xq.Ug=function(a){a=a.ta();var c=g.g.style.Ug(a);c.height=a.scrollHeight;return c};g.g.xq.qD=function(a,c,d){c.left+=d.width;c.right+=d.width;a.left+=d.width;a.right+=d.width};g.Ea={};g.Ea.cp=null;g.Ea.Wx=null;g.Ea.show=function(a,c,d){g.aa.show(g.Ea,d,null);if(c.length){var e=g.Ea.MG(c,d);g.Ea.nd(e,a,d);setTimeout(function(){e.ta().focus()},1);g.Ea.cp=null}else g.Ea.Ca()};g.Ea.MG=function(a,c){var d=new g.Gi;Aa(d,c);for(var e=0,f;f=a[e];e++){var h=new g.Co(f.text);Aa(h,c);d.cm(h,d.kb.length,!0);h.od(f.enabled);f.enabled&&dc(h,function(){g.Ea.Ca();this.Bb()},f)}return d};
g.Ea.nd=function(a,c,d){var e=g.g.iF();c={top:c.clientY+e.top,bottom:c.clientY+e.top,left:c.clientX+e.left,right:c.clientX+e.left};g.Ea.fE(a);var f=g.g.xq.Ug(a);d&&g.g.xq.qD(e,c,f);g.aa.NG(e,c,f,d);a.ta().focus()};g.Ea.fE=function(a){a.za(g.aa.Ga);var c=a.ta();g.g.o.mb(c,"blocklyContextMenu");g.la(c,"contextmenu",null,g.g.mG);a.focus()};g.Ea.Ca=function(){g.aa.Nk(g.Ea);g.Ea.cp=null;g.Ea.Wx&&g.Xa(g.Ea.Wx)};
g.Ea.So=function(a,c){return function(){g.i.disable();try{var d=g.R.fj(c,a.v),e=a.Ra();e.x=a.G?e.x-g.vd:e.x+g.vd;e.y+=2*g.vd;d.moveBy(e.x,e.y)}finally{g.i.enable()}g.i.isEnabled()&&!d.bb&&g.i.Ma(new g.i.fo(d));d.select()}};g.Ea.zD=function(a){var c=p(a,!1).length,d=q(a);d&&(c-=p(d,!1).length);return{text:1==c?g.h.DELETE_BLOCK:g.h.DELETE_X_BLOCKS.replace("%1",String(c)),enabled:!0,Bb:function(){g.i.$(!0);a.J(!0,!0);g.i.$(!1)}}};
g.Ea.BD=function(a){return{enabled:!("function"==typeof a.wb?!a.wb():!a.wb),text:g.h.HELP,Bb:function(){var c="function"==typeof a.wb?a.wb():a.wb;c&&window.open(c)}}};g.Ea.AD=function(a){var c=gb(a.v)?fb(a.v,g.g.gt(a,!0)):!0;return{text:g.h.DUPLICATE_BLOCK,enabled:c,Bb:function(){g.Sx(a)}}};g.Ea.yD=function(a){var c={enabled:!g.g.userAgent.vg};a.Bk?(c.text=g.h.REMOVE_COMMENT,c.Bb=function(){a.gg(null)}):(c.text=g.h.ADD_COMMENT,c.Bb=function(){a.gg("")});return c};
g.Ea.VL=function(a){return{text:g.h.YK,enabled:!0,Bb:function(){g.i.$(!0);a.J(!0,!0);g.i.$(!1)}}};g.Ea.WL=function(a){return{text:g.h.EI,enabled:!0,Bb:function(){g.Sx(a)}}};
g.Ea.IM=function(a,c){if(!g.vk)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!g.g.userAgent.vg};d.text=g.h.OH;d.Bb=function(){var e=new g.vk(a,g.h.NL,g.vk.tB,g.vk.tB),f=aa(a).getBoundingClientRect();f=new g.g.N(c.clientX-f.left,c.clientY-f.top);var h=g.g.Jm(a.fb);f=g.g.N.xm(f,h);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.ba&&(e.Ne(),e.za(),e.select())};return d};g.Ag=function(a,c){g.Ag.w.constructor.call(this,a,c);this.Qf=a.v.ap[c];this.Cx=a.v.ap[g.nk[c]];this.Cj=new g.g.N(0,0);this.Rh=!1;this.Ry=!this.Qf};g.g.object.W(g.Ag,g.sa);b=g.Ag.prototype;b.J=function(){g.Ag.w.J.call(this);this.Rh&&ec(this.Qf,this)};function fc(a,c){var d=a.Xb-c.Xb;a=a.$a-c.$a;return Math.sqrt(d*d+a*a)}
function gc(a,c){if(!a.B.v.ic()){var d=H(a.B);if(!d.ac){var e=!1;if(!d.Fc()){d=H(c.B);if(!d.Fc())return;c=a;e=!0}var f=g.selected==d;f||d.Po();var h=c.Xb+g.vd+Math.floor(Math.random()*g.Lq)-a.Xb,k=c.$a+g.vd+Math.floor(Math.random()*g.Lq)-a.$a;e&&(k=-k);d.G&&(h=c.Xb-g.vd-Math.floor(Math.random()*g.Lq)-a.Xb);d.moveBy(h,k);f||d.vn()}}}b.moveTo=function(a,c){this.Rh&&ec(this.Qf,this);this.Xb=a;this.$a=c;this.Ry||hc(this.Qf,this)};b.moveBy=function(a,c){this.moveTo(this.Xb+a,this.$a+c)};
function ic(a,c){a.moveTo(c.x+a.Cj.x,c.y+a.Cj.y)}function jc(a,c,d){a.Cj.x=c;a.Cj.y=d}function kc(a){var c=a.ca.Xb-a.Xb,d=a.ca.$a-a.$a;if(0!=c||0!=d){a=y(a);var e=a.ya();if(!e)throw Error("block is not rendered.");e=g.g.Ke(e);a.ya().setAttribute("transform","translate("+(e.x-c)+","+(e.y-d)+")");Za(a,-c,-d)}}
b.closest=function(a,c){var d=this.Cx;if(d.gc.length){var e=this.$a,f=this.Xb;this.Xb=f+c.x;this.$a=e+c.y;var h=lc(d,this);c=null;for(var k=a,l,m=h-1;0<=m&&Math.abs(d.gc[m].$a-this.$a)<=a;)l=d.gc[m],this.Kp(l,k)&&(c=l,k=fc(l,this)),m--;for(;h<d.gc.length&&Math.abs(d.gc[h].$a-this.$a)<=a;)l=d.gc[h],this.Kp(l,k)&&(c=l,k=fc(l,this)),h++;this.Xb=f;this.$a=e;a={connection:c,cq:k}}else a={connection:null,cq:a};return a};
b.Sy=function(){var a=this.B.v.eh.C;a=this.type==g.Wa||this.type==g.Ye?g.g.A.moveBy(0,-5)+g.g.A.ea("v",5)+a.Ji.Se+g.g.A.ea("v",5):g.g.A.moveBy(-5,0)+g.g.A.ea("h",5)+a.mk.ji+g.g.A.ea("h",5);var c=this.B.Ra();g.sa.Ty=g.g.o.I("path",{"class":"blocklyHighlightedConnectionPath",d:a,transform:"translate("+(this.Xb-c.x)+","+(this.$a-c.y)+")"+(this.B.G?" scale(-1 1)":"")},this.B.ya())};
function Jb(a){Kb(a,!1);var c=[];if(a.type!=g.Wa&&a.type!=g.jb)return c;if(a=y(a)){if(a.isCollapsed()){var d=[];a.M&&d.push(a.M);a.X&&d.push(a.X);a.Z&&d.push(a.Z)}else d=a.Ie(!0);for(var e=0;e<d.length;e++)c.push.apply(c,Jb(d[e]));c.length||(c[0]=a)}return c}function Kb(a,c){(a.Ry=c)&&a.Rh?ec(a.Qf,a):c||a.Rh||hc(a.Qf,a)}b.Kp=function(a,c){return fc(this,a)>c?!1:g.Ag.w.Kp.call(this,a)};b.Xp=function(a){gc(this,a)};b.Js=function(a,c){g.Ag.w.Js.call(this,a,c);a.ba&&a.za();c.ba&&(Ha(c),c.za())};
b.Ou=function(){var a=this.B,c=this.vf;if(a.v&&c&&g.i.Jc){g.Ag.w.Ou.call(this);c=y(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.Ne();c.za(!1);a.ba&&a.za()}};b.uz=function(a){return mc(this.Cx,this,a)};b.ef=function(a){g.Ag.w.ef.call(this,a);var c=this.B;a=a.B;c.ba&&Ha(c);a.ba&&Ha(a);c.ba&&a.ba&&(this.type==g.jb||this.type==g.Ze?a.za():c.za())};b.Bz=function(){this.isConnected()&&!Ja(this,this.ca)&&(z(E(this)?y(this):this.B),this.B.Lb())};g.g.Rect=function(a,c,d,e){this.top=a;this.bottom=c;this.left=d;this.right=e};g.g.Rect.prototype.contains=function(a,c){return a>=this.left&&a<=this.right&&c>=this.top&&c<=this.bottom};g.Ld=function(a){this.U=a};b=g.Ld.prototype;b.ix=!0;b.Ko=17;b.Zb=null;b.Qk=null;function nc(a){a.Ud||(a.Ud=g.g.o.I("g",{"class":"blocklyIconGroup"},null),a.U.ac&&g.g.o.mb(a.Ud,"blocklyIconGroupReadonly"),a.Qs(a.Ud),a.U.ya().appendChild(a.Ud),g.la(a.Ud,"mouseup",a,a.Dt),a.lh())}b.J=function(){g.g.o.removeNode(this.Ud);this.Ud=null;this.Vb(!1);this.U=null};b.lh=function(){};b.isVisible=function(){return!!this.Zb};b.Dt=function(a){this.U.v.ic()||this.U.ac||g.g.tj(a)||this.Vb(!this.isVisible())};
b.Ue=function(){this.isVisible()&&this.Zb.Kc(this.U.Eh)};function Ua(a,c){a.Qk=c;a.isVisible()&&(a=a.Zb,a.fc=c,a.Ku&&kb(a))}function oc(a){var c=a.U.Ra(),d=g.g.Ke(a.Ud);c=new g.g.N(c.x+d.x+a.Ko/2,c.y+d.y+a.Ko/2);g.g.N.He(a.Qk,c)||Ua(a,c)};g.Jf=function(a){g.Jf.w.constructor.call(this,a);nc(this);this.mg={}};g.g.object.W(g.Jf,g.Ld);g.Jf.prototype.ix=!1;g.Jf.prototype.Qs=function(a){g.g.o.I("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);g.g.o.I("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);g.g.o.I("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)};
g.Jf.sH=function(a){var c=g.g.o.I("text",{"class":"blocklyText blocklyBubbleText",y:g.oa.dd},null);a=a.split("\n");for(var d=0;d<a.length;d++){var e=g.g.o.I("tspan",{dy:"1em",x:g.oa.dd},c),f=document.createTextNode(a[d]);e.appendChild(f)}return c};b=g.Jf.prototype;b.Vb=function(a){a!=this.isVisible()&&(g.i.Ma(new g.i.xd(this.U,"warningOpen",!a,a)),a?this.wx():this.Mx())};
b.wx=function(){this.Fj=g.Jf.sH(this.Sb());this.Zb=new g.oa(this.U.v,this.Fj,this.U.$d,this.Qk,null,null);mb(this.Zb,this.U.id);if(this.U.G)for(var a=this.Fj.getBBox().width,c=0,d;d=this.Fj.childNodes[c];c++)d.setAttribute("text-anchor","end"),d.setAttribute("x",a+g.oa.dd);this.Ue()};b.Mx=function(){this.Zb.J();this.Fj=this.Zb=null};b.ll=function(a,c){this.mg[c]!=a&&(a?this.mg[c]=a:delete this.mg[c],this.isVisible()&&(this.Vb(!1),this.Vb(!0)))};
b.Sb=function(){var a=[],c;for(c in this.mg)a.push(this.mg[c]);return a.join("\n")};b.J=function(){this.U.cd=null;g.Ld.prototype.J.call(this)};g.wa=function(a,c,d){this.H=g.g.o.I("g",{},null);this.H.Qn="";this.Gj=a.eh.kz(this.H);this.Nn=this.Gj.Mn||null;this.$d=this.Gj.ml||null;this.Oj=this.Gj.On||null;this.$d.zf=this;this.ba=!1;this.Yn=g.g.oj()&&!!a.ie;g.K.yk(this.$d);g.wa.w.constructor.call(this,a,c,d);this.H.dataset&&(this.H.dataset.id=this.id);this.Vc=null};g.g.object.W(g.wa,g.eo);g.wa.prototype.height=0;g.wa.prototype.width=0;g.wa.prototype.ce=null;g.wa.pJ=-1;g.wa.Mq="TEMP_COLLAPSED_WARNING_";g.wa.IC=10;g.wa.lr=25;g.wa.xh=8;
g.wa.Bg=!1;b=g.wa.prototype;b.Ne=function(){if(!this.v.ba)throw TypeError("Workspace is headless.");for(var a=0,c;c=this.T[a];a++)c.S();c=Sa(this);for(a=0;a<c.length;a++)nc(c[a]);this.Ue();pc(this);this.v.options.readOnly||this.HE||g.la(this.ya(),"mousedown",this,this.gi);this.HE=!0;this.ya().parentNode||this.v.fb.appendChild(this.ya())};
b.select=function(){if(this.bb&&this.getParent())this.getParent().select();else if(g.selected!=this){var a=null;if(g.selected){a=g.selected.id;g.i.disable();try{rb(g.selected)}finally{g.i.enable()}}a=new g.i.xd(null,"selected",a,this.id);a.xc=this.v.id;g.i.Ma(a);g.selected=this;this.Po()}};function rb(a){if(g.selected==a){var c=new g.i.xd(null,"selected",a.id,null);c.xc=a.v.id;g.i.Ma(c);g.selected=null;a.vn()}}b.Vd=null;b.Bk=null;b.Nf=null;b.cd=null;
function Sa(a){var c=[];a.Vd&&c.push(a.Vd);a.Nf&&c.push(a.Nf);a.cd&&c.push(a.cd);return c}b.kl=function(a){var c=this.ag;if(a!=c){g.g.o.In();g.wa.w.kl.call(this,a);g.g.o.Jn();var d=this.ya();if(!this.v.It&&d){var e=this.Ra();a?(a.ya().appendChild(d),a=this.Ra(),Za(this,a.x-e.x,a.y-e.y)):c&&(this.v.fb.appendChild(d),this.translate(e.x,e.y))}}};
b.Ra=function(){var a=0,c=0,d=this.Yn?this.v.ie.$b():null,e=this.ya();if(e){do{var f=g.g.Ke(e);a+=f.x;c+=f.y;this.Yn&&this.v.ie.kf.firstChild==e&&(f=this.v.ie.rt(),a+=f.x,c+=f.y);e=e.parentNode}while(e&&e!=this.v.fb&&e!=d)}return new g.g.N(a,c)};b.moveBy=function(a,c){if(this.ag)throw Error("Block has parent.");var d=g.i.isEnabled();if(d)var e=new g.i.Bl(this);var f=this.Ra();this.translate(f.x+a,f.y+c);Za(this,a,c);d&&(e.Hj(),g.i.Ma(e));Ia(this.v)};
b.translate=function(a,c){this.ya().setAttribute("transform","translate("+a+","+c+")")};b.iu=function(){if(this.Yn){var a=this.Ra();this.ya().removeAttribute("transform");this.v.ie.Tj(a.x,a.y);ya(this.v.ie,this.ya())}};b.moveTo=function(a){var c=this.Ra();this.moveBy(a.x-c.x,a.y-c.y)};b.fu=function(a){this.Yn?this.v.ie.Tj(a.x,a.y):(this.H.Qn="translate("+a.x+","+a.y+")",this.H.setAttribute("transform",this.H.Qn+this.H.Fn))};
function qc(a){if(a.v&&!a.v.ic()&&!a.getParent()&&!a.ac){var c=a.v.Me;if(c&&c.fH){var d=c.av,e=d/2,f=a.Ra();c=Math.round((f.x-e)/d)*d+e-f.x;d=Math.round((f.y-e)/d)*d+e-f.y;c=Math.round(c);d=Math.round(d);0==c&&0==d||a.moveBy(c,d)}}}function rc(a){var c=a.Ra(),d=a.M?g.wa.xh:0,e=G(a),f=c.y,h=c.y+e.height;a.G?(a=c.x-(e.width-d),c=c.x+d):(a=c.x-d,c=c.x+e.width-d);return new g.g.Rect(f,h,a,c)}b.dn=function(){for(var a=0,c;c=this.T[a];a++)c.dn()};
b.gh=function(a){if(this.Jg!=a){for(var c=[],d=0,e;e=this.T[d];d++)c.push.apply(c,e.Vb(!a));if(a){e=Sa(this);for(d=0;d<e.length;d++)e[d].Vb(!1);d=this.toString(g.hB);K(N(this,"_TEMP_COLLAPSED_INPUT"),d).S();e=p(this,!0);if(d=q(this))d=e.indexOf(d),e.splice(d,e.length-d);d=1;for(var f;f=e[d];d++)if(f.cd){this.ih(g.h.COLLAPSED_WARNINGS_WARNING,g.wa.Mq);break}}else this.ib("_TEMP_COLLAPSED_INPUT"),this.cd&&(this.cd.ll("",g.wa.Mq),Object.keys(this.cd.mg).length||this.ih(null));g.wa.w.gh.call(this,a);
c.length||(c[0]=this);if(this.ba)for(d=0;f=c[d];d++)f.za()}};function sc(a,c,d){for(var e=[],f=0,h;h=a.T[f];f++){for(var k=0,l;l=h.Qa[k];k++)l.bz()&&l.isVisible()&&e.push(l);h.connection&&(h=y(h.connection))&&e.push(h)}c=e.indexOf(c);-1==c&&(c=d?-1:e.length);(e=e[d?c+1:c-1])?e instanceof g.Pa?e.wf():sc(e,null,d):(e=a.getParent())&&sc(e,a,d)}
b.gi=function(a){var c=this.v&&this.v.Tg(a);if(c){if(c.kj)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");Ab(c,this);c.tf=a}};
function tc(a){if(a.v.options.readOnly||!a.contextMenu)return null;var c=[];if(!a.ac){a.ne()&&a.Fc()&&c.push(g.Ea.AD(a));a.v.options.km&&!a.Jg&&a.ld()&&c.push(g.Ea.yD(a));if(a.Fc())if(a.Jg)a.v.options.collapse&&(d={enabled:!0},d.text=g.h.EXPAND_BLOCK,d.Bb=function(){a.gh(!1)},c.push(d));else{for(var d=1;d<a.T.length;d++)if(a.T[d-1].type!=g.jb&&a.T[d].type!=g.jb){d={enabled:!0};var e=Ma(a);d.text=e?g.h.EXTERNAL_INPUTS:g.h.INLINE_INPUTS;d.Bb=function(){a.ad(!e)};c.push(d);break}a.v.options.collapse&&
(d={enabled:!0},d.text=g.h.COLLAPSE_BLOCK,d.Bb=function(){a.gh(!0)},c.push(d))}a.v.options.disable&&a.ld()&&(d={text:a.isEnabled()?g.h.DISABLE_BLOCK:g.h.ENABLE_BLOCK,enabled:!Qb(a),Bb:function(){var f=g.i.$b();f||g.i.$(!0);a.od(!a.isEnabled());f||g.i.$(!1)}},c.push(d));a.ne()&&c.push(g.Ea.zD(a))}c.push(g.Ea.BD(a));a.Mg&&a.Mg(c);return c}b.Dn=function(a){var c=tc(this);c&&c.length&&(g.Ea.show(a,c,this.G),g.Ea.cp=this)};
function Za(a,c,d){if(a.ba){for(var e=a.Ie(!1),f=0;f<e.length;f++)e[f].moveBy(c,d);e=Sa(a);for(f=0;f<e.length;f++)oc(e[f]);for(f=0;f<a.Ig.length;f++)Za(a.Ig[f],c,d)}}b.Jj=function(a){if(a){var c=this.ya();c.Qn="";c.Fn="";g.zm=g.zm.concat(this.Ie(!0));g.g.o.mb(this.H,"blocklyDragging")}else g.zm=[],g.g.o.Tb(this.H,"blocklyDragging");for(c=0;c<this.Ig.length;c++)this.Ig[c].Jj(a)};function pc(a){a.Fc()?g.g.o.mb(a.H,"blocklyDraggable"):g.g.o.Tb(a.H,"blocklyDraggable")}
b.oq=function(a){g.wa.w.oq.call(this,a);pc(this)};b.Tu=function(a){g.wa.w.Tu.call(this,a);a=Sa(this);for(var c=0;c<a.length;c++)a[c].lh()};b.Xu=function(a){g.wa.w.Xu.call(this,a);this.Ue()};b.eA=function(a){this.Wm!=a&&(this.Wm=a)&&(this.Kc(g.TB),g.g.o.mb(this.H,"blocklyInsertionMarker"))};b.ya=function(){return this.H};
b.J=function(a,c){if(this.v){g.K.Ca();g.g.o.In();var d=this.v;if(g.selected==this){rb(this);var e=this.v;e.Dc&&e.Dc.cancel()}g.Ea.cp==this&&g.Ea.Ca();g.Oe&&g.navigation.sz(this);c&&this.ba&&(z(this,a),g.ob.yE(this));this.ba=!1;if(this.ce){for(var f in this.ce)clearTimeout(this.ce[f]);this.ce=null}c=Sa(this);for(e=0;e<c.length;e++)c[e].J();g.wa.w.J.call(this,a);g.g.o.removeNode(this.H);Ia(d);this.Nn=this.Oj=this.$d=this.H=null;g.g.o.Jn()}};
b.Ue=function(){if(this.isEnabled()){if(this.bb){var a=Nb(this);this.Oj.style.display="none";this.Nn.setAttribute("fill",a);this.$d.setAttribute("stroke","none");this.$d.setAttribute("fill",a)}else a=Ob(this),a.Yo?(this.Oj.style.display="none",this.Nn.style.display="none",this.$d.setAttribute("stroke",a.Yo)):(this.Oj.style.display="",this.Nn.style.display="",this.$d.setAttribute("stroke","none"),this.Oj.setAttribute("stroke",a.ts),this.Nn.setAttribute("fill",a.jx)),this.$d.setAttribute("fill",this.Eh);
a=Sa(this);for(var c=0;c<a.length;c++)a[c].Ue();for(a=0;c=this.T[a];a++)for(var d=0,e;e=c.Qa[d];d++)e.Ue()}};function Ha(a){!a.isEnabled()||Qb(a)?g.g.o.mb(a.H,"blocklyDisabled")&&a.$d.setAttribute("fill","url(#"+a.v.options.Pg+")"):g.g.o.Tb(a.H,"blocklyDisabled")&&a.Ue();a=a.Kh(!1);for(var c=0,d;d=a[c];c++)Ha(d)}b.XE=function(){return this.Nf};
b.gg=function(a){if(!g.Comment)throw Error("Missing require for Blockly.Comment");this.Ee.text!=a&&(g.wa.w.gg.call(this,a),a=null!=a,!!this.Nf==a?uc(this.Nf):(a?this.Bk=this.Nf=new g.Comment(this):(this.Nf.J(),this.Bk=this.Nf=null),this.ba&&(this.za(),this.Lb())))};
b.ih=function(a,c){this.ce||(this.ce=Object.create(null));var d=c||"";if(d)this.ce[d]&&(clearTimeout(this.ce[d]),delete this.ce[d]);else for(var e in this.ce)clearTimeout(this.ce[e]),delete this.ce[e];if(this.v.ic()){var f=this;this.ce[d]=setTimeout(function(){f.v&&(delete f.ce[d],f.ih(a,d))},100)}else{this.ac&&(a=null);c=Mb(this);for(e=null;c;)c.isCollapsed()&&(e=c),c=Mb(c);e&&e.ih(g.h.COLLAPSED_WARNINGS_WARNING,g.wa.Mq);c=!1;"string"==typeof a?(this.cd||(this.cd=new g.Jf(this),c=!0),this.cd.ll(a,
d)):this.cd&&!d?(this.cd.J(),c=!0):this.cd&&(c=this.cd.Sb(),this.cd.ll("",d),(e=this.cd.Sb())||this.cd.J(),c=c!=e);c&&this.ba&&(this.za(),this.Lb())}};b.ri=function(a){this.Vd&&this.Vd!==a&&this.Vd.J();a&&(a.U=this,this.Vd=a,nc(a))};b.od=function(a){this.isEnabled()!=a&&(g.wa.w.od.call(this,a),this.ba&&Ha(this))};b.hh=function(a){this.ba&&(a?(this.$d.setAttribute("filter","url(#"+this.v.options.Ux+")"),this.Oj.style.display="none"):(this.$d.setAttribute("filter","none"),this.Oj.style.display="inline"))};
b.Po=function(){g.g.o.mb(this.H,"blocklySelected")};b.vn=function(){g.g.o.Tb(this.H,"blocklySelected")};function Wa(a,c){c?g.g.o.mb(a.H,"blocklyDraggingDelete"):g.g.o.Tb(a.H,"blocklyDraggingDelete")}b.Kc=function(a){g.wa.w.Kc.call(this,a);this.ba&&this.Ue()};function $a(a){do{var c=a.ya();c.parentNode.appendChild(c);a=a.getParent()}while(a)}b.qe=function(a,c){g.wa.w.qe.call(this,a,c);this.ba&&(this.za(),this.Lb())};b.pe=function(a,c){g.wa.w.pe.call(this,a,c);this.ba&&(this.za(),this.Lb())};
b.Ed=function(a,c){g.wa.w.Ed.call(this,a,c);this.ba&&(this.za(),this.Lb())};b.ad=function(a){g.wa.w.ad.call(this,a);this.ba&&(this.za(),this.Lb())};b.ib=function(a,c){g.wa.w.ib.call(this,a,c);this.ba&&(this.za(),this.Lb())};b.gu=function(a,c){g.wa.w.gu.call(this,a,c);this.ba&&(this.za(),this.Lb())};b.dm=function(a,c){a=g.wa.w.dm.call(this,a,c);this.ba&&(this.za(),this.Lb());return a};
function Ga(a,c){if(!c&&a.isCollapsed()){if(a.M&&Kb(a.M,c),a.Z&&Kb(a.Z,c),a.X){Kb(a.X,c);var d=y(a.X);d&&Ga(d,c)}}else{a=a.Ie(!0);for(var e=0;d=a[e];e++)Kb(d,c),E(d)&&(d=y(d))&&Ga(d,c)}}b.Ie=function(a){var c=[];if(a||this.ba)if(this.M&&c.push(this.M),this.Z&&c.push(this.Z),this.X&&c.push(this.X),a||!this.Jg){a=0;for(var d;d=this.T[a];a++)d.connection&&c.push(d.connection)}return c};b.cn=function(a){return new g.Ag(this,a)};
b.Lb=function(){if(this.v&&!this.v.ic()){var a=H(this);if(!a.ac)for(var c=this.Ie(!1),d=0,e;e=c[d];d++){e.isConnected()&&E(e)&&y(e).Lb();for(var f=e.uz(g.vd),h=0,k;k=f[h];h++)e.isConnected()&&k.isConnected()||H(k.B)!=a&&(E(e)?gc(k,e):gc(e,k))}}};function ab(a){var c=g.i.$b();setTimeout(function(){g.i.$(c);qc(a);g.i.$(!1)},g.co/2);setTimeout(function(){g.i.$(c);a.Lb();g.i.$(!1)},g.co)}
b.za=function(a){g.g.o.In();this.ba=!0;this.v.eh.za(this);var c=this.Ra();this.Z&&ic(this.Z,c);this.M&&ic(this.M,c);for(var d=0;d<this.T.length;d++){var e=this.T[d].connection;e&&(ic(e,c),e.isConnected()&&kc(e))}this.X&&(ic(this.X,c),this.X.isConnected()&&kc(this.X));!1!==a&&((a=this.getParent())?a.za(!0):Ia(this.v));g.g.o.Jn()};b.Bn=function(a){a?(this.H.appendChild(a),this.Vc=a):this.Vc=null};b.Cn=function(a){a&&(this.Vc?this.H.insertBefore(a,this.Vc):this.H.appendChild(a))};
function G(a){var c=a.height,d=a.width;if(a=q(a))a=G(a),c+=a.height-4,d=Math.max(d,a.width);return{height:c,width:d}}function Ra(a,c){c?g.g.o.mb(a.H,"blocklyReplaceable"):g.g.o.Tb(a.H,"blocklyReplaceable")};g.m.il={};g.m.Xn=!1;g.m.register=function(a,c){if(g.m.il[a])throw Error("Renderer has already been registered.");g.m.il[a]=c};g.m.unregister=function(a){g.m.il[a]?delete g.m.il[a]:console.warn('No renderer mapping for name "'+a+'" found to unregister')};g.m.EM=function(){g.m.Xn=!0};g.m.FM=function(){g.m.Xn=!1};g.m.S=function(a){function c(){c.w.constructor.call(this)}if(!g.m.il[a])throw Error("Renderer not registered: ",a);g.g.object.W(c,g.m.il[a]);a=new c;a.S();return a};g.ek=function(){this.gc=[]};function hc(a,c){if(c.Rh)throw Error("Connection already in database.");c.B.ac||(a.gc.splice(lc(a,c),0,c),c.Rh=!0)}function vc(a,c){if(!a.gc.length)return-1;var d=lc(a,c);if(d>=a.gc.length)return-1;for(var e=c.$a,f=d;0<=f&&a.gc[f].$a==e;){if(a.gc[f]==c)return f;f--}for(;d<a.gc.length&&a.gc[d].$a==e;){if(a.gc[d]==c)return d;d++}return-1}
function lc(a,c){if(!a.gc.length)return 0;for(var d=0,e=a.gc.length;d<e;){var f=Math.floor((d+e)/2);if(a.gc[f].$a<c.$a)d=f+1;else if(a.gc[f].$a>c.$a)e=f;else{d=f;break}}return d}function ec(a,c){if(!c.Rh)throw Error("Connection not in database.");var d=vc(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.Rh=!1;a.gc.splice(d,1)}
function mc(a,c,d){function e(n){var r=h-f[n].Xb,t=k-f[n].$a;Math.sqrt(r*r+t*t)<=d&&m.push(f[n]);return t<d}var f=a.gc,h=c.Xb,k=c.$a;a=0;for(var l=c=f.length-2;a<l;)f[l].$a<k?a=l:c=l,l=Math.floor((a+c)/2);var m=[];c=a=l;if(f.length){for(;0<=a&&e(a);)a--;do c++;while(c<f.length&&e(c))}return m}g.ek.S=function(){var a=[];a[g.Wa]=new g.ek;a[g.Ye]=new g.ek;a[g.jb]=new g.ek;a[g.Ze]=new g.ek;return a};g.ge=function(a,c){g.ge.w.constructor.call(this,a,c);this.Op=!1;this.De={};this.lA=this.rn=0;this.wu=null};g.g.object.W(g.ge,g.gk);g.ge.lD=5;g.ge.mD=6;b=g.ge.prototype;b.Ms=function(a){g.ge.w.Ms.call(this,a);!this.Mp&&g.Touch.Rp(a)&&wc(this,a)};b.yk=function(a){this.wu=g.la(document,"mousedown",null,this.wF.bind(this),!0);this.Yp=g.la(document,"mousemove",null,this.Mm.bind(this),!0);this.Zp=g.la(document,"mouseup",null,this.Bp.bind(this),!0);a.preventDefault();a.stopPropagation()};
b.wF=function(a){!this.ic()&&g.Touch.Rp(a)&&(wc(this,a),this.Op&&g.ai())};b.Mm=function(a){if(this.ic())g.Touch.$u(a)&&g.ge.w.Mm.call(this,a);else if(this.Op){if(g.Touch.Rp(a)){this.De[g.Touch.Ap(a)]=xc(this,a);var c=Object.keys(this.De);if(2==c.length){c=g.g.N.jp(this.De[c[0]],this.De[c[1]])/this.lA;if(0<this.rn&&Infinity>this.rn){var d=c-this.rn;d=0<d?d*g.ge.lD:d*g.ge.mD;var e=this.vc,f=g.g.kn(a,u(e),qa(e));e.zoom(f.x,f.y,d)}this.rn=c;a.preventDefault()}}g.ai()}else g.ge.w.Mm.call(this,a)};
b.Bp=function(a){if(g.Touch.Rp(a)&&!this.ic()){var c=g.Touch.Ap(a);this.De[c]&&delete this.De[c];2>Object.keys(this.De).length&&(this.De={},this.rn=0)}!this.Op||this.ic()?g.Touch.$u(a)&&g.ge.w.Bp.call(this,a):(a.preventDefault(),a.stopPropagation(),this.J())};b.J=function(){g.ge.w.J.call(this);this.wu&&g.Xa(this.wu)};function wc(a,c){a.De[g.Touch.Ap(c)]=xc(a,c);var d=Object.keys(a.De);2==d.length&&(a.lA=g.g.N.jp(a.De[d[0]],a.De[d[1]]),a.Op=!0,c.preventDefault())}
function xc(a,c){return a.vc?new g.g.N(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};g.Mw=function(a){this.Au=a;this.Tl=Object.create(null)};b=g.Mw.prototype;b.Pt=null;b.J=function(){this.Tl=this.Au=null};b.load=function(a,c){if(a.length){try{var d=new g.g.global.Audio}catch(l){return}for(var e,f=0;f<a.length;f++){var h=a[f],k=h.match(/\.(\w+)$/);if(k&&d.canPlayType("audio/"+k[1])){e=new g.g.global.Audio(h);break}}e&&e.play&&(this.Tl[c]=e)}};
b.preload=function(){for(var a in this.Tl){var c=this.Tl[a];c.volume=.01;var d=c.play();void 0!==d?d.then(c.pause).catch(function(){}):c.pause();if(g.g.userAgent.xg||g.g.userAgent.cr)break}};b.play=function(a,c){var d=this.Tl[a];d?(a=new Date,null!=this.Pt&&a-this.Pt<g.MC||(this.Pt=a,d=g.g.userAgent.xg||g.g.userAgent.xi?d:d.cloneNode(),d.volume=void 0===c?1:c,d.play())):this.Au&&this.Au.zh.play(a,c)};
g.lb=function(a,c,d){g.lb.w.constructor.call(this,a);this.hc=a.hc||g.lb.hF;this.pi=a.pi||g.lb.cH;this.ap=g.ek.S();c&&(this.ie=c);d&&(this.Zj=d);this.Aq=this.Zj&&g.g.oj();this.Om=[];this.zh=new g.Mw(a.Ob);this.Me=this.options.Hy?new g.Ei(a.Hy,a.Gy):null;this.Vc=null;g.O&&g.O.hj&&yc(this,g.Hw,g.O.hj);g.Lw&&g.Lw.hj&&yc(this,g.cD,g.Lw.hj);g.Ha&&g.Ha.hj&&yc(this,g.qw,g.Ha.hj);this.eh=g.m.S(this.options.dh||"geras")};g.g.object.W(g.lb,g.Jb);b=g.lb.prototype;b.kq=null;b.ba=!0;b.Zh=!0;b.oe=!1;b.sj=!1;
b.Nu=!0;b.scrollX=0;b.scrollY=0;b.Rx=null;b.scale=1;b.bd=null;b.Ub=null;b.P=null;b.ra=null;b.Dc=null;b.ie=null;b.Zj=null;b.Aq=!1;b.Lp=!1;b.Gt=null;b.ez=null;b.ct={};b.hv={};b.nx=null;b.Qj=null;b.Yy=null;b.Ht=!0;b.Su=function(a){this.Ya&&this.Ya.Ec&&this.Ya.Ec.J();if(this.Ya=a)this.Ya.Ec=new g.Aa(this,!1),this.Bn(this.Ya.Ec.Ia())};b.fA=function(a){this.bc&&this.bc.Ec&&this.bc.Ec.J();if(this.bc=a)this.bc.Ec=new g.Aa(this,!0),this.Cn(this.bc.Ec.Ia())};
b.Bn=function(a){a?this.fb&&(this.fb.appendChild(a),this.Vc=a):this.Vc=null};b.Cn=function(a){a&&this.fb&&(this.Vc?this.fb.insertBefore(a,this.Vc):this.fb.appendChild(a))};function qa(a){if(a.Ht){var c=u(a).getScreenCTM();c&&(a.Yy=c.inverse(),a.Ht=!1)}return a.Yy}b.Un=function(){this.Ht=!0};b.isVisible=function(){return this.Zh};
function Na(a,c){var d=0,e=0,f=1;if(g.g.o.containsNode(a.fb,c)||g.g.o.containsNode(a.yf,c))f=a.scale;do{var h=g.g.Ke(c);if(c==a.fb||c==a.yf)f=1;d+=h.x*f;e+=h.y*f;c=c.parentNode}while(c&&c!=u(a));return new g.g.N(d,e)}function aa(a){if(!a.Gt)for(var c=a.H;c;){if(-1!=(" "+(c.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){a.Gt=c;break}c=c.parentNode}return a.Gt}
b.Ia=function(a){this.H=g.g.o.I("g",{"class":"blocklyWorkspace"},null);a&&(this.Mc=g.g.o.I("rect",{height:"100%",width:"100%","class":a},this.H),"blocklyMainBackground"==a&&this.Me?this.Mc.style.fill="url(#"+this.Me.Lk.id+")":this.Wb.subscribe(this.Mc,"workspace","fill"));this.fb=g.g.o.I("g",{"class":"blocklyBlockCanvas"},this.H);this.yf=g.g.o.I("g",{"class":"blocklyBubbleCanvas"},this.H);this.oe||(g.la(this.H,"mousedown",this,this.gi,!1,!0),g.la(this.H,"wheel",this,this.HG));if(this.options.Ky){if(!g.Qi)throw Error("Missing require for Blockly.Toolbox");
this.ra=new g.Qi(this)}this.Me&&this.Me.update(this.scale);zc(this);this.Ya.Ec=new g.Aa(this,!1);a=this.Ya.Ec.Ia();this.H.appendChild(a);this.bc.Ec=new g.Aa(this,!0);a=this.bc.Ec.Ia();this.H.appendChild(a);return this.H};
b.J=function(){this.ba=!1;this.Dc&&this.Dc.cancel();this.H&&(g.g.o.removeNode(this.H),this.H=null);this.yf=this.fb=null;this.ra&&(this.ra.J(),this.ra=null);this.P&&(this.P.J(),this.P=null);this.bd&&(this.bd.J(),this.bd=null);this.Ub&&(this.Ub.J(),this.Ub=null);this.$j&&(this.$j.J(),this.$j=null);this.bc&&this.bc.Ec.J();this.Ya&&this.Ya.Ec.J();this.zh&&(this.zh.J(),this.zh=null);this.Me&&(this.Me.J(),this.Me=null);this.Wb&&this.Wb.unsubscribe(this.Mc);g.lb.w.J.call(this);this.ct=this.hv=this.ap=null;
if(!this.options.Ob){var a=u(this).parentNode;a&&g.g.o.removeNode(a)}this.kq&&(g.Xa(this.kq),this.kq=null)};b.ci=function(a,c){return new g.wa(this,a,c)};function Ac(a){if(!g.Nr)throw Error("Missing require for Blockly.Trashcan");a.bd=new g.Nr(a);var c=a.bd.Ia();a.H.insertBefore(c,a.fb)}function Bc(a){if(!g.Sr)throw Error("Missing require for Blockly.ZoomControls");a.$j=new g.Sr(a);var c=a.$j.Ia();a.H.appendChild(c)}
function Cc(a,c){var d={Pg:a.options.Pg,Ob:a,G:a.G,Re:a.options.Re,Td:a.Td,Fa:a.options.Fa,dh:a.options.dh};if(a.Td){if(!g.Jl)throw Error("Missing require for Blockly.HorizontalFlyout");a.P=new g.Jl(d)}else{if(!g.Fg)throw Error("Missing require for Blockly.VerticalFlyout");a.P=new g.Fg(d)}a.P.xk=!1;return a.P.Ia(c)}function Dc(a){return a.P?a.P:a.ra?a.ra.P:null}function Ia(a){if(a.Nu&&a.ba){if(a.Ub){var c=a.hc();ma(a.Ub.le,c);oa(a.Ub.ue,c)}a.Un()}}
b.resize=function(){this.ra&&this.ra.position();this.P&&this.P.position();this.bd&&this.bd.position();this.$j&&this.$j.position();this.Ub&&this.Ub.resize();this.Un();zc(this)};function ub(a){var c=g.g.bF();g.g.N.He(a.ez,c)||(a.ez=c,a.Un(),zc(a))}function u(a){if(a.Ww)return a.Ww;for(var c=a.H;c;){if("svg"==c.tagName)return a.Ww=c;c=c.parentNode}return null}
b.translate=function(a,c){if(this.Aq&&this.Lp)this.Zj.Tj(a,c);else{var d="translate("+a+","+c+") scale("+this.scale+")";this.fb.setAttribute("transform",d);this.yf.setAttribute("transform",d)}if(this.ie){d=this.ie;var e=this.scale;d.oi=e;d.kf.setAttribute("transform","translate("+a.toFixed(0)+","+c.toFixed(0)+") scale("+e+")")}this.Me&&this.Me.moveTo(a,c)};
function sa(a){if(a.Aq){a.Lp=!1;var c=a.Zj.rt();a.Zj.Vo(a.H);c="translate("+c.x+","+c.y+") scale("+a.scale+")";a.fb.setAttribute("transform",c);a.yf.setAttribute("transform",c)}}
function ra(a){if(a.Aq&&!a.Lp){a.Lp=!0;var c=a.fb.previousSibling,d=parseInt(u(a).getAttribute("width"),10),e=parseInt(u(a).getAttribute("height"),10),f=g.g.Ke(a.fb),h=a.Zj,k=a.fb,l=a.yf,m=a.scale;if(h.vb.childNodes.length)throw Error("Already dragging a block.");h.fl=c;k.setAttribute("transform","translate(0, 0) scale("+m+")");l.setAttribute("transform","translate(0, 0) scale("+m+")");h.vb.setAttribute("width",d);h.vb.setAttribute("height",e);h.vb.appendChild(k);h.vb.appendChild(l);h.vb.style.display=
"block";a.Zj.Tj(f.x,f.y)}}b.Xf=function(){var a=this.hc();return a?a.rb/this.scale:0};b.Vb=function(a){this.Ub&&this.Ub.Ij(a);Dc(this)&&Dc(this).Ij(a);u(this).style.display=a?"block":"none";this.ra&&(this.ra.zc.style.display=a?"block":"none");if(a){for(var c=J(this,!1),d=c.length-1;0<=d;d--)c[d].dn();this.za();this.ra&&this.ra.position()}else g.rc(!0);this.Zh=a};b.za=function(){for(var a=J(this,!1),c=a.length-1;0<=c;c--)a[c].za(!1);if(this.Dc)for(a=this.Dc.Jk(),c=0;c<a.length;c++)a[c].za(!1)};
function Ec(a){var c=g.im;if(a.ba&&!(c.getElementsByTagName("block").length>=eb(a)))if(a.Dc&&a.Dc.cancel(),"comment"==c.tagName.toLowerCase()){g.i.disable();try{var d=g.vk.Fm(c),e=parseInt(c.getAttribute("x"),10),f=parseInt(c.getAttribute("y"),10);isNaN(e)||isNaN(f)||(a.G&&(e=-e),d.moveBy(e+50,f+50))}finally{g.i.enable()}d.select()}else a:{g.i.disable();try{var h=g.R.fj(c,a),k=a.bc.Rb;if(g.Oe&&k){g.navigation.Xy(h,k.qa);break a}var l=parseInt(c.getAttribute("x"),10),m=parseInt(c.getAttribute("y"),
10);if(!isNaN(l)&&!isNaN(m)){a.G&&(l=-l);do{c=!1;var n=J(a,!1);d=0;for(var r;r=n[d];d++){var t=r.Ra();if(1>=Math.abs(l-t.x)&&1>=Math.abs(m-t.y)){c=!0;break}}if(!c){var v=h.Ie(!1);d=0;for(var C;C=v[d];d++)if(C.closest(g.vd,new g.g.N(l,m)).connection){c=!0;break}}c&&(l=a.G?l-g.vd:l+g.vd,m+=2*g.vd)}while(c);h.moveBy(l,m)}}finally{g.i.enable()}g.i.isEnabled()&&!h.bb&&g.i.Ma(new g.i.fo(h));h.select()}}
function Fc(a){if((a=a.oe?a.Qj:a)&&!a.Dc&&a.ra&&a.ra.P){a=a.ra;var c=a.Fd.Yd;c&&c.Lf&&a.P.show(c.Lf)}}b.ni=function(a,c){g.lb.w.ni.call(this,a,c);Fc(this)};b.Rf=function(a){g.lb.w.Rf.call(this,a);Fc(this)};b.Qd=function(a,c,d){a=g.lb.w.Qd.call(this,a,c,d);Fc(this);return a};function zc(a){a.Gx=a.bd&&a.H.parentNode?a.bd.Hm():null;a.Fx=a.P?a.P.Hm():a.ra?a.ra.Hm():null}function Va(a,c){return a.Gx&&a.Gx.contains(c.clientX,c.clientY)?g.Sq:a.Fx&&a.Fx.contains(c.clientX,c.clientY)?g.Pv:g.Ov}
b.gi=function(a){var c=this.Tg(a);c&&yb(c,a,this)};b.bv=function(a,c){a=g.g.kn(a,u(this),qa(this));a.x/=this.scale;a.y/=this.scale;this.Rx=g.g.N.xm(c,a)};b.ic=function(){return null!=this.Dc&&this.Dc.ic()};function Gc(a){return a.options.Hc&&a.options.Hc.scrollbars||a.options.Hc&&a.options.Hc.Yj||a.options.Hc&&a.options.Hc.Ih||a.options.Eb&&a.options.Eb.controls||a.options.Eb&&a.options.Eb.Yj}
b.Fc=function(){return this.options.Hc&&this.options.Hc.scrollbars||this.options.Hc&&this.options.Hc.Yj||this.options.Hc&&this.options.Hc.Ih||this.options.Eb&&this.options.Eb.Yj};
b.HG=function(a){if(g.gk.Et())a.preventDefault(),a.stopPropagation();else{var c=this.options.Eb&&this.options.Eb.Yj,d=this.options.Hc&&this.options.Hc.Yj;if(c||d){var e=g.g.xy(a);!c||!a.ctrlKey&&d?(c=this.scrollX-e.x,d=this.scrollY-e.y,a.shiftKey&&!e.x&&(c=this.scrollX-e.y,d=this.scrollY),this.scroll(c,d)):(e=-e.y/50,c=g.g.kn(a,u(this),qa(this)),this.zoom(c.x,c.y,e));a.preventDefault()}}};
function Fa(a){var c=D(a,!1);a=Ea(a,!1);c=c.concat(a);if(!c.length)return new g.g.Rect(0,0,0,0);a=rc(c[0]);for(var d=1;d<c.length;d++){var e=rc(c[d]);e.top<a.top&&(a.top=e.top);e.bottom>a.bottom&&(a.bottom=e.bottom);e.left<a.left&&(a.left=e.left);e.right>a.right&&(a.right=e.right)}return a}b.PD=function(){this.Lc(!1);g.i.$(!0);for(var a=D(this,!0),c=0,d=0,e;e=a[d];d++)if(e.Fc()){var f=e.Ra();e.moveBy(-f.x,c-f.y);qc(e);c=e.Ra().y+G(e).height+g.wa.lr}g.i.$(!1);this.Lc(!0)};
b.Dn=function(a){function c(C){if(C.ne())v=v.concat(p(C,!1));else{C=C.Kh(!1);for(var Q=0;Q<C.length;Q++)c(C[Q])}}function d(){g.i.$(h);var C=v.shift();C&&(C.v?(C.J(!1,!0),setTimeout(d,10)):d());g.i.$(!1)}if(!this.options.readOnly&&!this.oe){var e=[],f=D(this,!0),h=g.g.Rg(),k=this,l={};l.text=g.h.UNDO;l.enabled=0<this.Uj.length;l.Bb=this.kv.bind(this,!1);e.push(l);l={};l.text=g.h.REDO;l.enabled=0<this.tn.length;l.Bb=this.kv.bind(this,!0);e.push(l);this.Fc()&&(l={},l.text=g.h.CLEAN_UP,l.enabled=1<f.length,
l.Bb=this.PD.bind(this),e.push(l));if(this.options.collapse){for(var m=l=!1,n=0;n<f.length;n++)for(var r=f[n];r;)r.isCollapsed()?l=!0:m=!0,r=q(r);var t=function(C){for(var Q=0,T=0;T<f.length;T++)for(var W=f[T];W;)setTimeout(W.gh.bind(W,C),Q),W=q(W),Q+=10};m={enabled:m};m.text=g.h.COLLAPSE_ALL;m.Bb=function(){t(!0)};e.push(m);l={enabled:l};l.text=g.h.EXPAND_ALL;l.Bb=function(){t(!1)};e.push(l)}var v=[];for(n=0;n<f.length;n++)c(f[n]);l={text:1==v.length?g.h.DELETE_BLOCK:g.h.DELETE_X_BLOCKS.replace("%1",
String(v.length)),enabled:0<v.length,Bb:function(){k.Dc&&k.Dc.cancel();2>v.length?d():g.confirm(g.h.DELETE_ALL_BLOCKS.replace("%1",v.length),function(C){C&&d()})}};e.push(l);this.nx&&this.nx(e);g.Ea.show(a,e,this.G)}};function pa(a){if(a.options.Ob)pa(a.options.Ob);else{g.an=a;document.activeElement&&document.activeElement.blur();try{u(a).focus()}catch(c){try{u(a).parentNode.setActive()}catch(d){u(a).parentNode.focus()}}}}
b.zoom=function(a,c,d){if(!this.oe&&!this.sj){d=Math.pow(this.options.Eb.XG,d);var e=this.scale*d;if(this.scale!=e){e>this.options.Eb.fn?d=this.options.Eb.fn/this.scale:e<this.options.Eb.hn&&(d=this.options.Eb.hn/this.scale);var f=this.fb.getCTM(),h=u(this).createSVGPoint();h.x=a;h.y=c;h=h.matrixTransform(f.inverse());a=h.x;c=h.y;f=f.translate(a*(1-d),c*(1-d)).scale(d);this.scrollX=f.e;this.scrollY=f.f;this.setScale(e)}}};
function wa(a,c){var d=a.hc();if(a.P){var e=d.qH/2;d=d.pH/2}else e=d.rb/2+d.oc,d=d.yb/2+d.Ac;a.zoom(e,d,c)}b.GE=function(){g.g.o.Tb(this.fb,"blocklyCanvasTransitioning");g.g.o.Tb(this.yf,"blocklyCanvasTransitioning")};
b.setScale=function(a){this.options.Eb.fn&&a>this.options.Eb.fn?a=this.options.Eb.fn:this.options.Eb.hn&&a<this.options.Eb.hn&&(a=this.options.Eb.hn);this.scale=a;g.rc(!1);this.P&&(this.P.Iu(),zc(this));this.Me&&this.Me.update(this.scale);a=this.hc();this.scrollX-=a.oc;this.scrollY-=a.Ac;a.ec+=a.oc;a.mc+=a.Ac;this.scroll(this.scrollX,this.scrollY);this.Ub&&(this.P?(ja(this.Ub.le,a),ka(this.Ub.ue,a)):(ma(this.Ub.le,a),oa(this.Ub.ue,a)))};
b.scroll=function(a,c){g.rc(!0);var d=this.hc(),e=d.ff+d.Cc-d.rb,f=d.Pd+d.pc-d.yb;a=Math.min(a,-d.Cc);c=Math.min(c,-d.pc);a=Math.max(a,-e);c=Math.max(c,-f);this.scrollX=a;this.scrollY=c;this.Ub&&(ea(this.Ub.le,-(a+d.Cc)*this.Ub.le.Ic),ea(this.Ub.ue,-(c+d.pc)*this.Ub.ue.Ic));a+=d.oc;c+=d.Ac;this.translate(a,c)};g.lb.qy=function(a){var c=0,d=0;a&&(c=a.Xf(),d=a.ty());return{width:c,height:d}};g.lb.$E=function(a,c){return Gc(a)?g.lb.ZE(a,c):g.lb.ny(a)};
g.lb.ny=function(a){var c=Fa(a),d=a.scale;a=c.top*d;var e=c.bottom*d,f=c.left*d;c=c.right*d;return{top:a,bottom:e,left:f,right:c,width:c-f,height:e-a}};g.lb.ZE=function(a,c){a=g.lb.ny(a);var d=c.width;c=c.height;var e=d/2,f=c/2,h=Math.min(a.left-e,a.right-d),k=Math.min(a.top-f,a.bottom-c);return{left:h,top:k,height:Math.max(a.bottom+f,a.top+c)-k,width:Math.max(a.right+e,a.left+d)-h}};
g.lb.hF=function(){var a=g.lb.qy(this.ra),c=g.lb.qy(this.P),d=g.rA(u(this)),e={height:d.height,width:d.width};if(this.ra)if(this.Fa==g.Dg||this.Fa==g.Oi)e.height-=a.height;else{if(this.Fa==g.Nd||this.Fa==g.Cg)e.width-=a.width}else if(this.P)if(this.Fa==g.Dg||this.Fa==g.Oi)e.height-=c.height;else if(this.Fa==g.Nd||this.Fa==g.Cg)e.width-=c.width;var f=g.lb.$E(this,e),h=0;this.ra&&this.Fa==g.Nd?h=a.width:this.P&&this.Fa==g.Nd&&(h=c.width);var k=0;this.ra&&this.Fa==g.Dg?k=a.height:this.P&&this.Fa==g.Dg&&
(k=c.height);return{Pd:f.height,ff:f.width,pc:f.top,Cc:f.left,yb:e.height,rb:e.width,mc:-this.scrollY,ec:-this.scrollX,Ac:k,oc:h,pH:d.height,qH:d.width,vA:a.width,HM:a.height,bM:c.width,aM:c.height,Fa:this.Fa}};g.lb.cH=function(a){var c=this.hc();"number"==typeof a.x&&(this.scrollX=-c.ff*a.x-c.Cc);"number"==typeof a.y&&(this.scrollY=-c.Pd*a.y-c.pc);this.translate(this.scrollX+c.oc,this.scrollY+c.Ac)};g.lb.prototype.Lc=function(a){var c=!this.Nu&&a;this.Nu=a;c&&Ia(this)};
g.lb.prototype.clear=function(){this.Lc(!1);g.lb.w.clear.call(this);this.Lc(!0)};function Hc(a,c){if("function"!=typeof c)throw TypeError("Button callbacks must be functions.");a.ct.CREATE_VARIABLE=c}function ca(a,c){return(a=a.ct[c])?a:null}function yc(a,c,d){if("function"!=typeof d)throw TypeError("Toolbox category callbacks must be functions.");a.hv[c]=d}
g.lb.prototype.Tg=function(a){var c="mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type,d=this.Dc;return d?c&&d.kj?(console.warn("Tried to start the same gesture twice."),d.cancel(),null):d:c?this.Dc=new g.ge(a,this):null};g.Th=function(a,c){g.KD();"string"==typeof a&&(a=document.getElementById(a)||document.querySelector(a));if(!g.g.o.containsNode(document,a))throw Error("Error: container is not in current document.");c=new g.Ae(c||{});var d=document.createElement("div");d.className="injectionDiv";a.appendChild(d);a=g.pm(d,c);var e=new g.Hv(d);d=new g.Nw(d);d=g.cE(a,c,e,d);g.sb.pb.bH(c.pb);g.IF(d);g.an=d;g.ol(d);return d};
g.pm=function(a,c){a.setAttribute("dir","LTR");g.yc.Ex=c.G;g.ed.Th(c.xF,c.uf);a=g.g.o.I("svg",{xmlns:g.g.o.Vl,"xmlns:html":g.g.o.Fi,"xmlns:xlink":g.g.o.Kf,version:"1.1","class":"blocklySvg"},a);var d=g.g.o.I("defs",{},a),e=String(Math.random()).substring(2),f=g.g.o.I("filter",{id:"blocklyEmbossFilter"+e},d);g.g.o.I("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:1,result:"blur"},f);var h=g.g.o.I("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",
result:"specOut"},f);g.g.o.I("fePointLight",{x:-5E3,y:-1E4,z:2E4},h);g.g.o.I("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},f);g.g.o.I("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},f);c.Ux=f.id;f=g.g.o.I("pattern",{id:"blocklyDisabledPattern"+e,patternUnits:"userSpaceOnUse",width:10,height:10},d);g.g.o.I("rect",{width:10,height:10,fill:"#aaa"},f);g.g.o.I("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},f);c.Pg=f.id;
c.Hy=g.Ei.Ia(e,c.Gy,d);return a};
g.cE=function(a,c,d,e){c.Ob=null;var f=new g.lb(c,d,e);f.scale=c.Eb.oA;a.appendChild(f.Ia("blocklyMainBackground"));!c.Ky&&c.Yk&&(d=Cc(f,"svg"),g.g.o.nj(d,a));c.Ny&&Ac(f);c.Eb&&c.Eb.controls&&Bc(f);f.Wb.subscribe(a,"workspace","background-color");f.translate(0,0);g.an=f;c.readOnly||f.Fc()||ib(f,function(h){if(!f.ic()&&!f.Fc()&&-1!=g.i.$A.indexOf(h.type)){var k=Object.create(null),l=f.hc(),m=f.scale;k.G=f.G;k.ec=l.ec/m;k.mc=l.mc/m;k.CA=(l.ec+l.rb)/m;k.BA=(l.mc+l.yb)/m;Gc(f)?(l=Fa(f),k.Cc=l.left,k.pc=
l.top,k.ux=l.right,k.sx=l.bottom):(k.Cc=l.Cc/m,k.pc=l.pc/m,k.ux=(l.Cc+l.ff)/m,k.sx=(l.pc+l.Pd)/m);if(k.pc<k.mc||k.sx>k.BA||k.Cc<k.ec||k.ux>k.CA){l=null;h&&(l=g.i.$b(),g.i.$(h.group));switch(h.type){case g.i.Al:case g.i.Dv:var n=w(f,h.Bc);n=H(n);break;case g.i.io:case g.i.jo:n=f.Zo[h.Of]||null}if(n){m=rc(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var r=k.mc,t=k.BA-m.height;t=Math.max(r,t);r=g.g.Ja.Mf(r,m.top,t)-m.top;t=k.ec;var v=k.CA-m.width;k.G?t=Math.min(v,t):v=Math.max(t,v);n.moveBy(g.g.Ja.Mf(t,
m.left,v)-m.left,r)}h&&(h.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&g.i.$(l))}}});g.ol(f);g.aa.Ia();g.D.Ia();g.K.Ia();return f};
g.IF=function(a){var c=a.options,d=u(a);g.la(d.parentNode,"contextmenu",null,function(e){g.g.Pp(e)||e.preventDefault()});d=g.la(window,"resize",null,function(){g.rc(!0);g.ol(a)});a.kq=d;g.Th.xD();c.Yk&&(a.ra?a.ra.S(a):a.P&&(a.P.S(a),a.P.show(c.Yk.childNodes),a.P.uc.set(0)));d=g.La.tc;c.Ny&&(d=a.bd.S(d));c.Eb&&c.Eb.controls&&a.$j.S(d);c.Hc&&c.Hc.scrollbars?(a.Ub=new g.rk(a),a.Ub.resize()):a.pi({x:.5,y:.5});c.zF&&g.Th.TF(c.uf,a)};
g.Th.xD=function(){g.AE||(g.la(document,"scroll",null,function(){for(var a=g.Jb.getAll(),c=0,d;d=a[c];c++)d.Un&&d.Un()}),g.la(document,"keydown",null,g.wG),g.hd(document,"touchend",null,g.ai),g.hd(document,"touchcancel",null,g.ai),g.g.userAgent.xg&&g.la(window,"orientationchange",document,function(){g.ol(g.Db())}));g.AE=!0};
g.Th.TF=function(a,c){function d(){for(;f.length;)g.Xa(f.pop());e.preload()}var e=c.zh;e.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");e.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");e.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var f=[];f.push(g.la(document,"mousemove",null,d,!0));f.push(g.la(document,"touchstart",null,d,!0))};g.Bf=function(a){this.name=a};g.F=function(a,c,d){if(!c)throw Error("Cannot create a node without a location.");this.Sn=a;this.Rm=g.F.MF(a);this.qa=c;(a=d||null)&&a.IA&&(this.JA=a.IA)};g.F.types={we:"field",ee:"block",wg:"input",qk:"output",ze:"next",Be:"previous",Gf:"stack",Ti:"workspace"};g.F.sB=-20;g.F.MF=function(a){switch(a){case g.F.types.Be:case g.F.types.ze:case g.F.types.wg:case g.F.types.qk:return!0}return!1};g.F.qm=function(a){return new g.F(g.F.types.we,a)};
g.F.Pf=function(a){return a?a.type==g.Wa||a.type==g.jb&&a.Wf()?g.F.$i(a.Wf()):a.type==g.jb?new g.F(g.F.types.ze,a):a.type==g.Ye?new g.F(g.F.types.qk,a):a.type==g.Ze?new g.F(g.F.types.Be,a):null:null};g.F.$i=function(a){return a?new g.F(g.F.types.wg,a.connection):null};g.F.Lg=function(a){return new g.F(g.F.types.ee,a)};g.F.rm=function(a){return new g.F(g.F.types.Gf,a)};g.F.sm=function(a,c){return new g.F(g.F.types.Ti,a,{IA:c})};b=g.F.prototype;b.Nb=function(){return this.Sn};
function Ic(a,c){a=a.qa;a instanceof g.eo||(a=a.B);if(!a||!a.v)return null;var d=H(a);a=D(d.v,!0);for(var e=0,f;f=a[e];e++)if(d.id==f.id)return c=e+(c?1:-1),-1==c||c==a.length?null:g.F.rm(a[c]);throw Error("Couldn't find "+(c?"next":"previous")+" stack?!");}function Jc(a){if(!a)return null;do var c=a.Z&&y(a.Z);while(c&&q(c)==a&&(a=c));return(c=a.Z||a.M)&&c.ca&&c.ca.Wf()?g.F.$i(c.ca.Wf()):g.F.rm(a)}
b.next=function(){switch(this.Sn){case g.F.types.Gf:return Ic(this,!0);case g.F.types.qk:return g.F.Lg(this.qa.B);case g.F.types.we:a:{var a=this.qa,c=a.Wf();var d=a.B;a=c.Qa.indexOf(a)+1;c=d.T.indexOf(c);for(var e;e=d.T[c];c++){for(var f=e.Qa;a<f.length;){if(f[a].ug){d=g.F.qm(f[a]);break a}a++}a=0;if(e.connection){d=g.F.$i(e);break a}}d=null}return d;case g.F.types.wg:a:{a=this.qa.Wf();d=a.B;for(a=d.T.indexOf(a)+1;c=d.T[a];a++){e=c.Qa;f=0;for(var h;h=e[f];f++)if(h.ug){d=g.F.qm(h);break a}if(c.connection){d=
g.F.$i(c);break a}}d=null}return d;case g.F.types.ee:if(d=this.qa.X)return g.F.Pf(d);break;case g.F.types.Be:return g.F.Lg(this.qa.B);case g.F.types.ze:if(d=this.qa.ca)return g.F.Pf(d)}return null};
b.Pm=function(){switch(this.Sn){case g.F.types.Ti:var a=D(this.qa,!0);if(0<a.length)return g.F.rm(a[0]);break;case g.F.types.Gf:a=this.qa;var c=a.Z||a.M;return c?g.F.Pf(c):g.F.Lg(a);case g.F.types.ee:a:{a=this.qa.T;c=0;for(var d;d=a[c];c++){for(var e=d.Qa,f=0,h;h=e[f];f++)if(h.ug){a=g.F.qm(h);break a}if(d.connection){a=g.F.$i(d);break a}}a=null}return a;case g.F.types.wg:if(a=this.qa.ca)return g.F.Pf(a)}return null};
b.cg=function(){switch(this.Sn){case g.F.types.Gf:return Ic(this,!1);case g.F.types.we:a:{var a=this.qa;var c=a.Wf();var d=a.B;a=c.Qa.indexOf(a)-1;for(var e=d.T.indexOf(c),f;f=d.T[e];e--){if(f.connection&&f!==c){c=g.F.$i(f);break a}for(f=f.Qa;-1<a;){if(f[a].ug){c=g.F.qm(f[a]);break a}a--}0<=e-1&&(a=d.T[e-1].Qa.length-1)}c=null}return c;case g.F.types.wg:a:{c=this.qa.Wf();d=c.B;for(a=d.T.indexOf(c);e=d.T[a];a--){if(e.connection&&e!==c){c=g.F.$i(e);break a}e=e.Qa;f=e.length-1;for(var h;h=e[f];f--)if(h.ug){c=
g.F.qm(h);break a}}c=null}return c;case g.F.types.ee:c=this.qa.M;if(c=this.qa.Z||c)return g.F.Pf(c);break;case g.F.types.Be:if((c=this.qa.ca)&&!c.Wf())return g.F.Pf(c);break;case g.F.types.ze:return g.F.Lg(this.qa.B)}return null};
b.nn=function(){switch(this.Sn){case g.F.types.Gf:var a=this.qa.Ra();return g.F.sm(this.qa.v,new g.g.N(a.x,a.y+g.F.sB));case g.F.types.qk:return(a=this.qa.ca)?g.F.Pf(a):g.F.rm(this.qa.B);case g.F.types.we:return g.F.Lg(this.qa.B);case g.F.types.wg:return g.F.Lg(this.qa.B);case g.F.types.ee:return Jc(this.qa);case g.F.types.Be:return Jc(this.qa.B);case g.F.types.ze:return Jc(this.qa.B)}return null};g.g.Ba={LL:0,EJ:3,WA:8,Cw:9,WJ:12,Uq:13,KC:16,pI:17,QA:18,KK:19,cI:20,Vq:27,pL:32,JK:33,IK:34,GI:35,nJ:36,Ao:37,Yl:38,Io:39,El:40,NK:43,PK:44,$q:45,Dl:46,ZERO:48,ONE:49,DL:50,xL:51,dJ:52,aJ:53,lL:54,jL:55,FI:56,SJ:57,ZI:59,XI:61,WI:173,YI:163,RK:63,VH:64,LA:65,XH:66,bB:67,rB:68,E:69,II:70,eJ:71,iJ:72,RB:73,sJ:74,$B:75,tJ:76,DJ:77,QJ:78,lK:79,HK:80,Q:81,SK:82,HC:83,UC:84,EL:85,$C:86,dD:87,Ow:88,OL:89,kD:90,qC:91,ML:92,nI:93,kK:96,dK:97,jK:98,iK:99,$J:100,ZJ:101,hK:102,gK:103,YJ:104,cK:105,bK:106,fK:107,
aK:109,eK:110,XJ:111,JI:112,NI:113,OI:114,QI:115,RI:116,SI:117,TI:118,UI:119,VI:120,KI:121,LI:122,MI:123,VJ:144,fL:145,$I:166,vJ:183,hL:186,qI:189,HI:187,kI:188,LK:190,mL:191,RH:192,yL:192,kL:222,mK:219,YH:220,gI:221,KL:224,FJ:224,GJ:91,HJ:93,JL:229,IL:252,MK:255};g.sb={};g.sb.pb={};g.sb.pb.vj={};g.sb.pb.cu={KC:"Shift",mB:"Control",QA:"Alt",qC:"Meta"};g.sb.pb.zM=function(a,c){var d=g.sb.pb.eF(c);d&&delete g.sb.pb.vj[d];g.sb.pb.vj[a]=c};g.sb.pb.bH=function(a){g.sb.pb.vj=a};g.sb.pb.dM=function(){var a={};g.g.object.yj(a,g.sb.pb.vj);return a};g.sb.pb.QE=function(a){return g.sb.pb.vj[a]};g.sb.pb.eF=function(a){for(var c=Object.keys(g.sb.pb.vj),d=0,e;e=c[d];d++)if(g.sb.pb.vj[e].name===a.name)return e;return null};
g.sb.pb.ZG=function(a){for(var c=g.g.object.values(g.sb.pb.cu),d="",e=0,f;f=c[e];e++)a.getModifierState(f)&&(d+=f);return d+=a.keyCode};g.sb.pb.dE=function(){for(var a=g.g.Ba.$B,c=[g.sb.pb.cu.mB],d="",e=g.g.object.values(g.sb.pb.cu),f=0,h;h=c[f];f++)if(-1<e.indexOf(h))d+=h;else throw Error(h+" is not a valid modifier key.");return d+a};
g.sb.pb.bE=function(){var a={},c=g.sb.pb.dE();a[g.g.Ba.dD]=g.navigation.Gq;a[g.g.Ba.LA]=g.navigation.uv;a[g.g.Ba.HC]=g.navigation.Fq;a[g.g.Ba.rB]=g.navigation.tv;a[g.g.Ba.RB]=g.navigation.NA;a[g.g.Ba.Uq]=g.navigation.OA;a[g.g.Ba.Ow]=g.navigation.MA;a[g.g.Ba.UC]=g.navigation.PA;a[g.g.Ba.E]=g.navigation.Eq;a[g.g.Ba.Vq]=g.navigation.Eq;a[c]=g.navigation.vv;return a};g.navigation={};g.navigation.$k=null;g.navigation.Bw=1;g.navigation.Ul=2;g.navigation.Ir=3;g.navigation.aj=g.navigation.Ul;g.navigation.ab={Be:"previous",ze:"next",vo:"in",Go:"out",$q:"insert",jr:"mark",Rv:"disconnect",Fw:"toolbox",Wq:"exit",Kr:"toggle_keyboard_nav"};g.navigation.ey=function(){var a=g.Db(),c=a.ra;c&&(g.navigation.aj=g.navigation.Ir,g.navigation.Yz(!1),a.bc.Rb||g.navigation.$t(),c.Fd.Yd||(a=c.Fd,(c=a.Le())&&a.$x&&Kc(c,a.$x)))};
g.navigation.by=function(){g.navigation.aj=g.navigation.Bw;var a=g.Db();var c=a.ra;c=c?c.P:Dc(a);a.bc.Rb||g.navigation.$t();c&&c.Kk()&&(a=D(c.Kk(),!0),0<a.length&&(a=a[0],a=g.F.rm(a),I(g.navigation.Lh(),a)))};g.navigation.qp=function(){g.rc();var a=g.Db(),c=a.Ya,d=!!a.ra,e=D(a,!0);g.navigation.Yz(d);g.navigation.aj=g.navigation.Ul;0<e.length?I(c,g.navigation.tt(e[0])):(a=g.F.sm(a,new g.g.N(100,100)),I(c,a))};
g.navigation.Lh=function(){var a=g.Db(),c=null;a.ba&&(c=(a=(c=a.ra)?c.P:Dc(a))?a.s.Ya:null);return c};g.navigation.KF=function(){var a=g.Db(),c=Dc(a);if(c&&c.isVisible()){var d=g.navigation.Lh().Rb.qa;d.isEnabled()?(c=vb(c,d),c.za(),Ga(c,!1),I(a.Ya,g.F.Lg(c)),g.navigation.nz()||g.navigation.qd("Something went wrong while inserting a block from the flyout."),g.navigation.qp(),I(a.Ya,g.navigation.tt(c)),g.navigation.SG()):g.navigation.qd("Can't insert a disabled block.")}else g.navigation.qd("Trying to insert from the flyout when the flyout does not  exist or is not visible")};
g.navigation.Yz=function(a){g.navigation.Lh()&&(g.navigation.Lh().Ca(),a&&Dc(g.Db()).Ca())};
g.navigation.ZF=function(){var a=g.Db().bc.Rb,c=g.Db().Ya.Rb;if(!a)return g.navigation.qd("Cannot insert with no marked node."),!1;if(!c)return g.navigation.qd("Cannot insert with no cursor node."),!1;a=a.Nb();c=c.Nb();return a==g.F.types.we?(g.navigation.qd("Should not have been able to mark a field."),!1):a==g.F.types.ee?(g.navigation.qd("Should not have been able to mark a block."),!1):a==g.F.types.Gf?(g.navigation.qd("Should not have been able to mark a stack."),!1):c==g.F.types.we?(g.navigation.qd("Cannot attach a field to anything else."),
!1):c==g.F.types.Ti?(g.navigation.qd("Cannot attach a workspace to anything else."),!1):!0};g.navigation.eG=function(a,c){if(a.bb)return g.navigation.qd("Cannot move a shadow block to the workspace."),!1;a.getParent()&&z(a,!1);a.moveTo(c.JA);return!0};
g.navigation.nz=function(){var a=g.Db().bc.Rb,c=g.Db().Ya.Rb;if(!g.navigation.ZF())return!1;var d=a.Nb(),e=c.Nb(),f=c.qa,h=a.qa;if(a.Rm&&c.Rm)return g.navigation.ef(f,h);if(a.Rm&&(e==g.F.types.ee||e==g.F.types.Gf))return g.navigation.Xy(f,h);if(d==g.F.types.Ti)return c=g.navigation.qt(c),g.navigation.eG(c,a);g.navigation.qd("Unexpected state in Blockly.navigation.modify_.");return!1};g.navigation.wE=function(a,c){var d=a.B,e=c.B;H(d)==H(e)&&(-1<p(d,!1).indexOf(e)?g.navigation.up(c).disconnect():g.navigation.up(a).disconnect())};
g.navigation.du=function(a,c){if(!a||!c)return!1;var d=a.B;return Ka(c,a)==g.sa.ho?(g.navigation.wE(a,c),E(c)||a.type!=g.jb&&a.type!=g.Wa||H(d).moveBy(c.Xb-a.Xb,c.$a-a.$a),c.connect(a),!0):!1};g.navigation.up=function(a){var c=a.B;return E(a)?c.Z?c.Z:c.M?c.M:null:a};g.navigation.By=function(a){return E(a)?a:a.ca?a.ca:null};
g.navigation.ef=function(a,c){if(!a||!c)return!1;var d=g.navigation.up(a),e=g.navigation.By(c),f=g.navigation.By(a),h=g.navigation.up(c);if(d&&e&&g.navigation.du(d,e)||f&&h&&g.navigation.du(f,h)||g.navigation.du(a,c))return!0;try{La(c,a)}catch(k){g.navigation.qd("Connection failed with error: "+k)}return!1};
g.navigation.Xy=function(a,c){switch(c.type){case g.Ze:if(g.navigation.ef(a.X,c))return!0;break;case g.jb:if(g.navigation.ef(a.Z,c))return!0;break;case g.Wa:if(g.navigation.ef(a.M,c))return!0;break;case g.Ye:for(var d=0;d<a.T.length;d++){var e=a.T[d].connection;if(e&&e.type===g.Wa&&g.navigation.ef(e,c))return!0}if(a.M&&g.navigation.ef(a.M,c))return!0}g.navigation.qd("This block can not be inserted at the marked location.");return!1};
g.navigation.vE=function(){var a=g.Db(),c=a.Ya.Rb;if(c.Rm){var d=c.qa;d.isConnected()?(c=E(d)?d:d.ca,d=E(d)?d.ca:d,d.B.bb?g.navigation.Vt("Cannot disconnect a shadow block"):(c.disconnect(),gc(d,c),$a(H(c.B)),c=g.F.Pf(c),I(a.Ya,c))):g.navigation.Vt("Cannot disconnect unconnected connection")}else g.navigation.Vt("Cannot disconnect blocks when the cursor is not on a connection")};g.navigation.$t=function(){var a=g.Db();I(a.bc,a.Ya.Rb)};g.navigation.SG=function(){var a=g.Db();I(a.bc,null);a.bc.Ca()};
g.navigation.Ib=function(a){g.navigation.aj=a};g.navigation.qt=function(a){return a?a.Nb()===g.F.types.ee?a.qa:a.Nb()===g.F.types.Gf?a.qa:a.Nb()===g.F.types.Ti?null:a.qa.B:null};g.navigation.tt=function(a){var c=a.Z||a.M;return c?g.F.Pf(c):g.F.Lg(a)};g.navigation.sz=function(a){var c=g.Db();if(c&&(c=c.Ya)){var d=g.navigation.qt(c.Rb);d===a?d.getParent()?(a=d.Z||d.M)&&I(c,g.F.Pf(a.ca)):I(c,g.F.sm(d.v,d.Ra())):-1<a.Kh(!1).indexOf(d)&&I(c,g.F.sm(d.v,d.Ra()))}};
g.navigation.fG=function(a){var c=g.Db().Ya;if(c){var d=g.navigation.qt(c.Rb);d===a&&I(c,g.F.Lg(d))}};g.navigation.Zs=function(){g.Oe||(g.Oe=!0,g.navigation.qp())};g.navigation.tE=function(){if(g.Oe){var a=g.Db();g.Oe=!1;a.Ya.Ca();a.bc.Ca();g.navigation.Lh()&&g.navigation.Lh().Ca()}};g.navigation.Vt=function(a){g.navigation.$k?g.navigation.$k("log",a):console.log(a)};g.navigation.qd=function(a){g.navigation.$k?g.navigation.$k("warn",a):console.warn(a)};
g.navigation.$L=function(a){g.navigation.$k?g.navigation.$k("error",a):console.error(a)};g.navigation.Ez=function(a){a=g.sb.pb.ZG(a);return(a=g.sb.pb.QE(a))?g.navigation.ei(a):!1};g.navigation.ei=function(a){var c=g.Db().options.readOnly,d=!1;g.Oe?c?-1<g.navigation.DC.indexOf(a)&&(d=g.navigation.Jy(a)):d=g.navigation.Jy(a):a.name===g.navigation.ab.Kr&&(g.navigation.Zs(),d=!0);return d};
g.navigation.Jy=function(a){var c=g.Db();if(a.name===g.navigation.ab.Kr)return g.navigation.tE(),!0;if(a.name===g.navigation.ab.Fw)return c.ra?g.navigation.ey():g.navigation.by(),!0;if(g.navigation.aj===g.navigation.Ul){c=c.Ya.Rb;var d=!1;c&&c.Nb()===g.F.types.we&&(d=c.qa.ei(a));d||(d=g.navigation.LH(a));return d}return g.navigation.aj===g.navigation.Bw?g.navigation.PE(a):g.navigation.aj===g.navigation.Ir?g.navigation.vH(a):!1};
g.navigation.LH=function(a){var c=g.Db();switch(a.name){case g.navigation.ab.Be:return c.Ya.cg(),!0;case g.navigation.ab.Go:return c.Ya.nn(),!0;case g.navigation.ab.ze:return c.Ya.next(),!0;case g.navigation.ab.vo:return c.Ya.Pm(),!0;case g.navigation.ab.$q:return g.navigation.nz(),!0;case g.navigation.ab.jr:return g.navigation.nF(),!0;case g.navigation.ab.Rv:return g.navigation.vE(),!0;default:return!1}};
g.navigation.PE=function(a){switch(a.name){case g.navigation.ab.Be:return g.navigation.Lh().cg(),!0;case g.navigation.ab.Go:return g.navigation.ey(),!0;case g.navigation.ab.ze:return g.navigation.Lh().next(),!0;case g.navigation.ab.jr:return g.navigation.KF(),!0;case g.navigation.ab.Wq:return g.navigation.qp(),!0;default:return!1}};
g.navigation.vH=function(a){if(a.name===g.navigation.ab.Wq)return g.navigation.qp(),!0;var c=g.Db().ra.ei(a);return c||a.name!==g.navigation.ab.vo?c:(g.navigation.by(),!0)};g.navigation.nF=function(){var a=g.Db().Ya.Rb,c=a.Nb();c==g.F.types.we?a.qa.wf():a.Rm||c==g.F.types.Ti?g.navigation.$t():c==g.F.types.ee?g.navigation.qd("Cannot mark a block."):c==g.F.types.Gf&&g.navigation.qd("Cannot mark a stack.")};g.navigation.Gq=new g.Bf(g.navigation.ab.Be);g.navigation.uv=new g.Bf(g.navigation.ab.Go);
g.navigation.Fq=new g.Bf(g.navigation.ab.ze);g.navigation.tv=new g.Bf(g.navigation.ab.vo);g.navigation.NA=new g.Bf(g.navigation.ab.$q);g.navigation.OA=new g.Bf(g.navigation.ab.jr);g.navigation.MA=new g.Bf(g.navigation.ab.Rv);g.navigation.PA=new g.Bf(g.navigation.ab.Fw);g.navigation.Eq=new g.Bf(g.navigation.ab.Wq);g.navigation.vv=new g.Bf(g.navigation.ab.Kr);g.navigation.DC=[g.navigation.Gq,g.navigation.uv,g.navigation.tv,g.navigation.Fq,g.navigation.vv];g.fe=function(a,c){this.AA=c||"";this.Xz=Object.create(null);if(a)for(a=a.split(","),c=0;c<a.length;c++)this.Xz[a[c]]=!0;this.reset()};g.fe.Tq="DEVELOPER_VARIABLE";g.fe.prototype.reset=function(){this.Qf=Object.create(null);this.Dx=Object.create(null);this.Ta=null};
function P(a,c){var d=g.j.Gd;if(c==g.O.ub){var e=a;d.Ta?e=(e=d.Ta.nf(e))?e.name:null:(console.log("Deprecated call to Blockly.Names.prototype.getName without defining a variable map. To fix, add the folowing code in your generator's init() function:\nBlockly.YourGeneratorName.variableDB_.setVariableMap(workspace.getVariableMap());"),e=null);e&&(a=e)}e=a.toLowerCase()+"_"+c;var f=c==g.O.ub||c==g.fe.Tq?d.AA:"";if(e in d.Qf)return f+d.Qf[e];a=Lc(d,a,c);d.Qf[e]=a.substr(f.length);return a}
function Lc(a,c,d){c?(c=encodeURI(c.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!="0123456789".indexOf(c[0])&&(c="my_"+c)):c=g.h.UNNAMED_KEY||"unnamed";for(var e="";a.Dx[c+e]||c+e in a.Xz;)e=e?e+1:2;c+=e;a.Dx[c]=!0;return(d==g.O.ub||d==g.fe.Tq?a.AA:"")+c}g.fe.He=function(a,c){return a.toLowerCase()==c.toLowerCase()};g.Ha={};g.Ha.ub=g.qw;g.Ha.tD=function(a){a=J(a,!1);for(var c=[],d=[],e=0;e<a.length;e++)if(a[e].Mh){var f=a[e].Mh();f&&(f[2]?c.push(f):d.push(f))}d.sort(g.Ha.Tz);c.sort(g.Ha.Tz);return[d,c]};g.Ha.Tz=function(a,c){return a[0].toLowerCase().localeCompare(c[0].toLowerCase())};g.Ha.LE=function(a,c){if(c.ac)return a;for(a=a||g.h.UNNAMED_KEY||"unnamed";!g.Ha.NF(a,c.v,c);){var d=a.match(/^(.*?)(\d+)$/);a=d?d[1]+(parseInt(d[2],10)+1):a+"2"}return a};g.Ha.NF=function(a,c,d){return!g.Ha.PF(a,c,d)};
g.Ha.PF=function(a,c,d){c=J(c,!1);for(var e=0;e<c.length;e++)if(c[e]!=d&&c[e].Mh){var f=c[e].Mh();if(g.fe.He(f[0],a))return!0}return!1};g.Ha.gq=function(a){a=a.trim();var c=g.Ha.LE(a,this.B),d=this.getValue();if(d!=a&&d!=c){a=J(this.B.v,!1);for(var e=0;e<a.length;e++)a[e].wn&&a[e].wn(d,c)}return c};
g.Ha.hj=function(a){function c(h,k){for(var l=0;l<h.length;l++){var m=h[l][0],n=h[l][1],r=g.g.xml.createElement("block");r.setAttribute("type",k);r.setAttribute("gap",16);var t=g.g.xml.createElement("mutation");t.setAttribute("name",m);r.appendChild(t);for(m=0;m<n.length;m++){var v=g.g.xml.createElement("arg");v.setAttribute("name",n[m]);t.appendChild(v)}d.push(r)}}var d=[];if(g.L.procedures_defnoreturn){var e=g.g.xml.createElement("block");e.setAttribute("type","procedures_defnoreturn");e.setAttribute("gap",
16);var f=g.g.xml.createElement("field");f.setAttribute("name","NAME");f.appendChild(g.g.xml.createTextNode(g.h.PROCEDURES_DEFNORETURN_PROCEDURE));e.appendChild(f);d.push(e)}g.L.procedures_defreturn&&(e=g.g.xml.createElement("block"),e.setAttribute("type","procedures_defreturn"),e.setAttribute("gap",16),f=g.g.xml.createElement("field"),f.setAttribute("name","NAME"),f.appendChild(g.g.xml.createTextNode(g.h.PROCEDURES_DEFRETURN_PROCEDURE)),e.appendChild(f),d.push(e));g.L.procedures_ifreturn&&(e=g.g.xml.createElement("block"),
e.setAttribute("type","procedures_ifreturn"),e.setAttribute("gap",16),d.push(e));d.length&&d[d.length-1].setAttribute("gap",24);a=g.Ha.tD(a);c(a[0],"procedures_callnoreturn");c(a[1],"procedures_callreturn");return d};g.Ha.VE=function(a,c){var d=[];c=J(c,!1);for(var e=0;e<c.length;e++)if(c[e].ke){var f=c[e].ke();f&&g.fe.He(f,a)&&d.push(c[e])}return d};
g.Ha.ln=function(a){var c=g.i.Jc,d=a.Mh()[0],e=a.cb(!0);a=g.Ha.VE(d,a.v);d=0;for(var f;f=a[d];d++){var h=f.cb();h=h&&g.R.Rd(h);f.Cb(e);var k=f.cb();k=k&&g.R.Rd(k);h!=k&&(g.i.Jc=!1,g.i.Ma(new g.i.pg(f,"mutation",null,h,k)),g.i.Jc=c)}};g.Ha.Im=function(a,c){c=D(c,!1);for(var d=0;d<c.length;d++)if(c[d].Mh){var e=c[d].Mh();if(e&&g.fe.He(e[0],a))return c[d]}return null};g.Zl=function(a,c,d,e){this.v=a;this.name=c;this.type=d||"";this.Rk=e||g.g.Rg();g.i.Ma(new g.i.Ce(this))};g.Zl.prototype.ua=function(){return this.Rk};g.Zl.mx=function(a,c){a=a.name.toLowerCase();c=c.name.toLowerCase();return a<c?-1:a==c?0:1};g.O={};g.O.ub=g.Hw;g.O.Sw=function(a){var c=J(a,!1);a=Object.create(null);for(var d=0;d<c.length;d++){var e=c[d].Vg();if(e)for(var f=0;f<e.length;f++){var h=e[f],k=h.ua();k&&(a[k]=h)}}c=[];for(k in a)c.push(a[k]);return c};g.O.QL=function(){console.warn("Deprecated call to Blockly.Variables.allUsedVariables. Use Blockly.Variables.allUsedVarModels instead.\nIf this is a major issue please file a bug on GitHub.")};g.O.yv={};
g.O.rD=function(a){a=J(a,!1);for(var c=Object.create(null),d=0,e;e=a[d];d++){var f=e.cM;!f&&e.aF&&(f=e.aF,g.O.yv[e.type]||(console.warn("Function getDeveloperVars() deprecated. Use getDeveloperVariables() (block type '"+e.type+"')"),g.O.yv[e.type]=!0));if(f)for(e=f(),f=0;f<e.length;f++)c[e[f]]=!0}return Object.keys(c)};
g.O.hj=function(a){var c=[],d=document.createElement("button");d.setAttribute("text","%{BKY_NEW_VARIABLE}");d.setAttribute("callbackKey","CREATE_VARIABLE");Hc(a,function(e){g.O.xx(e.qb)});c.push(d);a=g.O.OE(a);return c=c.concat(a)};
g.O.OE=function(a){a=a.Lm("");var c=[];if(0<a.length){var d=a[a.length-1];if(g.L.variables_set){var e=g.g.xml.createElement("block");e.setAttribute("type","variables_set");e.setAttribute("gap",g.L.math_change?8:24);e.appendChild(g.O.Gm(d));c.push(e)}g.L.math_change&&(e=g.g.xml.createElement("block"),e.setAttribute("type","math_change"),e.setAttribute("gap",g.L.variables_get?20:8),e.appendChild(g.O.Gm(d)),d=g.R.jh('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),
e.appendChild(d),c.push(e));if(g.L.variables_get){a.sort(g.Zl.mx);d=0;for(var f;f=a[d];d++)e=g.g.xml.createElement("block"),e.setAttribute("type","variables_get"),e.setAttribute("gap",8),e.appendChild(g.O.Gm(f)),c.push(e)}}return c};
g.O.ky=function(a){a=a.Sg();var c="";if(a.length)for(var d=1,e=0,f="ijkmnopqrstuvwxyzabcdefgh".charAt(e);!c;){for(var h=!1,k=0;k<a.length;k++)if(a[k].name.toLowerCase()==f){h=!0;break}h?(e++,25==e&&(e=0,d++),f="ijkmnopqrstuvwxyzabcdefgh".charAt(e),1<d&&(f+=d)):c=f}else c="i";return c};
g.O.xx=function(a,c,d){function e(h){g.O.Uz(g.h.NEW_VARIABLE_TITLE,h,function(k){if(k){var l=g.O.iG(k,a);if(l){var m=k.toLowerCase();if(l.type==f)var n=g.h.VARIABLE_ALREADY_EXISTS.replace("%1",m);else n=g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,n=n.replace("%1",m).replace("%2",l.type);g.alert(n,function(){e(k)})}else a.Qd(k,f),c&&c(k)}else c&&c(null)})}var f=d||"";e("")};g.O.Qd=g.O.xx;
g.O.iq=function(a,c){function d(e){var f=g.h.RENAME_VARIABLE_TITLE.replace("%1",c.name);g.O.Uz(f,e,function(h){if(h){var k=g.O.jG(h,c.type,a);k?(k=g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",h.toLowerCase()).replace("%2",k.type),g.alert(k,function(){d(h)})):a.ni(c.ua(),h)}})}d("")};g.O.Uz=function(a,c,d){g.prompt(a,c,function(e){e&&(e=e.replace(/[\s\xa0]+/g," ").trim(),e==g.h.RENAME_VARIABLE||e==g.h.NEW_VARIABLE)&&(e=null);d(e)})};
g.O.jG=function(a,c,d){d=d.Ta.Sg();a=a.toLowerCase();for(var e=0,f;f=d[e];e++)if(f.name.toLowerCase()==a&&f.type!=c)return f;return null};g.O.iG=function(a,c){c=c.Ta.Sg();a=a.toLowerCase();for(var d=0,e;e=c[d];d++)if(e.name.toLowerCase()==a)return e;return null};g.O.Gm=function(a){var c=g.g.xml.createElement("field");c.setAttribute("name","VAR");c.setAttribute("id",a.ua());c.setAttribute("variabletype",a.type);a=g.g.xml.createTextNode(a.name);c.appendChild(a);return c};
g.O.vp=function(a,c,d,e){var f=g.O.Xc(a,c,d,e);f||(f=g.O.eE(a,c,d,e));return f};g.O.Xc=function(a,c,d,e){var f=a.ki;if(c){var h=a.nf(c);!h&&f&&(h=f.nf(c));if(h)return h}if(d){if(void 0==e)throw Error("Tried to look up a variable by name without a type");h=a.Xc(d,e);!h&&f&&(h=f.Xc(d,e))}return h};g.O.eE=function(a,c,d,e){var f=a.ki;d||(d=g.O.ky(a.oe?a.Qj:a));return f?f.Qd(d,e,c):a.Qd(d,e,c)};
g.O.ly=function(a,c){a=a.Sg();var d=[];if(c.length!=a.length)for(var e=0;e<a.length;e++){var f=a[e];-1==c.indexOf(f)&&d.push(f)}return d};g.aa={};g.aa.Ga=null;g.aa.md=null;g.aa.ip=null;g.aa.Ia=function(){g.aa.Ga||(g.aa.Ga=document.createElement("div"),g.aa.Ga.className="blocklyWidgetDiv",document.body.appendChild(g.aa.Ga))};g.aa.show=function(a,c,d){g.aa.Ca();g.aa.md=a;g.aa.ip=d;g.aa.Ga.style.top=g.g.style.Ey().y+"px";g.aa.Ga.style.direction=c?"rtl":"ltr";g.aa.Ga.style.display="block"};
g.aa.Ca=function(){g.aa.md&&(g.aa.md=null,g.aa.Ga.style.display="none",g.aa.Ga.style.left="",g.aa.Ga.style.top="",g.aa.ip&&g.aa.ip(),g.aa.ip=null,g.aa.Ga.innerHTML="")};g.aa.isVisible=function(){return!!g.aa.md};g.aa.Nk=function(a){g.aa.md==a&&g.aa.Ca()};g.aa.qn=function(a,c,d){g.aa.Ga.style.left=a+"px";g.aa.Ga.style.top=c+"px";g.aa.Ga.style.height=d+"px"};g.aa.NG=function(a,c,d,e){var f=g.aa.GD(a,c,d);a=g.aa.FD(a,c,d,e);0>f?g.aa.qn(a,0,d.height+f):g.aa.qn(a,f,d.height)};
g.aa.FD=function(a,c,d,e){if(e)return c=Math.max(c.right-d.width,a.left),Math.min(c,a.right-d.width);c=Math.min(c.left,a.right-d.width);return Math.max(c,a.left)};g.aa.GD=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};g.VERSION="uncompiled";g.an=null;g.selected=null;g.cursor=null;g.Oe=!1;g.zm=[];g.im=null;g.Xo=null;g.ss=null;g.TL=null;g.rA=function(a){return{width:a.Xw,height:a.Vw}};g.vM=function(a){Ia(a)};g.ol=function(a){for(;a.options.Ob;)a=a.options.Ob;var c=u(a),d=c.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.Xw!=e&&(c.setAttribute("width",e+"px"),c.Xw=e);c.Vw!=d&&(c.setAttribute("height",d+"px"),c.Vw=d);a.resize()}};
g.wG=function(a){var c=g.an;if(!(g.g.Pp(a)||c.ba&&!c.isVisible()))if(c.options.readOnly)g.navigation.Ez(a);else{var d=!1;if(a.keyCode==g.g.Ba.Vq)g.rc(),g.navigation.ei(g.navigation.Eq);else{if(g.navigation.Ez(a))return;if(a.keyCode==g.g.Ba.WA||a.keyCode==g.g.Ba.Dl){a.preventDefault();if(g.gk.Et())return;g.selected&&g.selected.ne()&&(d=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(g.gk.Et())return;g.selected&&g.selected.ne()&&g.selected.Fc()&&(a.keyCode==g.g.Ba.bB?(g.rc(),g.ws(g.selected)):a.keyCode!=
g.g.Ba.Ow||g.selected.v.oe||(g.ws(g.selected),d=!0));a.keyCode==g.g.Ba.$C?g.im&&(a=g.Xo,a.oe&&(a=a.Qj),g.ss&&fb(a,g.ss)&&(g.i.$(!0),Ec(a),g.i.$(!1))):a.keyCode==g.g.Ba.kD&&(g.rc(),c.kv(a.shiftKey))}}d&&!g.selected.v.oe&&(g.i.$(!0),g.rc(),g.selected.J(!0,!0),g.i.$(!1))}};g.ws=function(a){if(a.$y)var c=a.fv();else{c=g.R.Bh(a,!0);g.R.qE(c);var d=a.Ra();c.setAttribute("x",a.G?-d.x:d.x);c.setAttribute("y",d.y)}g.im=c;g.Xo=a.v;g.ss=a.$y?null:g.g.gt(a,!0)};
g.Sx=function(a){var c=g.im,d=g.Xo;g.ws(a);Ec(a.v);g.im=c;g.Xo=d};g.tM=function(a){g.g.Pp(a)||a.preventDefault()};g.rc=function(a){g.K.Ca();g.aa.Ca();g.D.Ok();a||(a=g.Db(),a.bd&&a.bd.P&&a.bd.P.Ca(),a.ra&&a.ra.P&&a.ra.P.xk&&Kc(a.ra.Fd,null))};g.Db=function(){return g.an};g.alert=function(a,c){alert(a);c&&c()};g.confirm=function(a,c){c(confirm(a))};g.prompt=function(a,c,d){d(prompt(a,c))};g.RF=function(a){return function(){O(this,a)}};
g.Fk=function(a){for(var c=0;c<a.length;c++){var d=a[c];if(d){var e=d.type;null==e||""===e?console.warn("Block definition #"+c+" in JSON array is missing a type attribute. Skipping."):(g.L[e]&&console.warn("Block definition #"+c+' in JSON array overwrites prior definition of "'+e+'".'),g.L[e]={S:g.RF(d)})}else console.warn("Block definition #"+c+" in JSON array is "+d+". Skipping.")}};
g.la=function(a,c,d,e,f,h){function k(v){var C=!f;v=g.Touch.gH(v);for(var Q=0,T;T=v[Q];Q++)if(!C||g.Touch.$u(T))g.Touch.$G(T),d?e.call(d,T):e(T),l=!0}var l=!1,m=[];if(g.g.global.PointerEvent&&c in g.Touch.Hf)for(var n=0,r;r=g.Touch.Hf[c][n];n++)a.addEventListener(r,k,!1),m.push([a,r,k]);else if(a.addEventListener(c,k,!1),m.push([a,c,k]),c in g.Touch.Hf){var t=function(v){k(v);var C=!h;l&&C&&v.preventDefault()};for(n=0;r=g.Touch.Hf[c][n];n++)a.addEventListener(r,t,!1),m.push([a,r,t])}return m};
g.hd=function(a,c,d,e){function f(n){d?e.call(d,n):e(n)}var h=[];if(g.g.global.PointerEvent&&c in g.Touch.Hf)for(var k=0,l;l=g.Touch.Hf[c][k];k++)a.addEventListener(l,f,!1),h.push([a,l,f]);else if(a.addEventListener(c,f,!1),h.push([a,c,f]),c in g.Touch.Hf){var m=function(n){if(n.changedTouches&&1==n.changedTouches.length){var r=n.changedTouches[0];n.clientX=r.clientX;n.clientY=r.clientY}f(n);n.preventDefault()};for(k=0;l=g.Touch.Hf[c][k];k++)a.addEventListener(l,m,!1),h.push([a,l,m])}return h};
g.Xa=function(a){for(;a.length;){var c=a.pop();c[0].removeEventListener(c[1],c[2],!1)}};g.Yh=function(a){return/^\s*-?\d+(\.\d+)?\s*$/.test(a)};g.Uy=function(a){return g.g.Mb.CF(a)};
g.KD=function(){g.jd("LOGIC_HUE",["Blocks","logic","HUE"],void 0);g.jd("LOGIC_HUE",["Constants","Logic","HUE"],210);g.jd("LOOPS_HUE",["Blocks","loops","HUE"],void 0);g.jd("LOOPS_HUE",["Constants","Loops","HUE"],120);g.jd("MATH_HUE",["Blocks","math","HUE"],void 0);g.jd("MATH_HUE",["Constants","Math","HUE"],230);g.jd("TEXTS_HUE",["Blocks","texts","HUE"],void 0);g.jd("TEXTS_HUE",["Constants","Text","HUE"],160);g.jd("LISTS_HUE",["Blocks","lists","HUE"],void 0);g.jd("LISTS_HUE",["Constants","Lists","HUE"],
260);g.jd("COLOUR_HUE",["Blocks","colour","HUE"],void 0);g.jd("COLOUR_HUE",["Constants","Colour","HUE"],20);g.jd("VARIABLES_HUE",["Blocks","variables","HUE"],void 0);g.jd("VARIABLES_HUE",["Constants","Variables","HUE"],330);g.jd("VARIABLES_DYNAMIC_HUE",["Constants","VariablesDynamic","HUE"],310);g.jd("PROCEDURES_HUE",["Blocks","procedures","HUE"],void 0)};
g.jd=function(a,c,d){for(var e="Blockly",f=g,h=0;h<c.length;++h)e+="."+c[h],f&&(f=f[c[h]]);f&&f!==d&&(a=(void 0===d?'%1 has been removed. Use Blockly.Msg["%2"].':'%1 is deprecated and unused. Override Blockly.Msg["%2"].').replace("%1",e).replace("%2",a),console.warn(a))};var Mc={ar:"\u0627\u0644\u0639\u0631\u0628\u064a\u0629",be:"\u0431\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0456","be-tarask":"Tara\u0161kievica",bg:"\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438 \u0435\u0437\u0438\u043a",bn:"\u09ac\u09be\u0982\u09b2\u09be",br:"Brezhoneg",cs:"\u010cesky",da:"Dansk",de:"Deutsch",el:"\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac",en:"English",es:"Espa\u00f1ol",eu:"Euskara",fa:"\u0641\u0627\u0631\u0633\u06cc",fi:"Suomi",fr:"Fran\u00e7ais",gl:"Galego",ha:"Hausa",
he:"\u05e2\u05d1\u05e8\u05d9\u05ea",hi:"\u0939\u093f\u0928\u094d\u0926\u0940",hu:"Magyar",hy:"\u0570\u0561\u0575\u0565\u0580\u0567\u0576",ia:"Interlingua",id:"Bahasa Indonesia",ig:"As\u1ee5s\u1ee5 Igbo",is:"\u00cdslenska",it:"Italiano",ja:"\u65e5\u672c\u8a9e",kab:"Taqbaylit",ko:"\ud55c\uad6d\uc5b4",lt:"Lietuvi\u0173",lv:"Latvie\u0161u",ms:"Bahasa Melayu",my:"\u1019\u103c\u1014\u103a\u1019\u102c\u1005\u102c",nb:"Norsk Bokm\u00e5l",nl:"Nederlands, Vlaams",pl:"Polski",pms:"Piemont\u00e8is",pt:"Portugu\u00eas",
"pt-br":"Portugu\u00eas Brasileiro",ro:"Rom\u00e2n\u0103",ru:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439",sc:"Sardu",sk:"Sloven\u010dina",sl:"Sloven\u0161\u010dina",sq:"Shqip",sr:"\u0421\u0440\u043f\u0441\u043a\u0438",sv:"Svenska",th:"\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22",tr:"T\u00fcrk\u00e7e",uk:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",ur:"\u0627\u064f\u0631\u062f\u064f\u0648\u202c",vi:"Ti\u1ebfng Vi\u1ec7t",yo:"\u00c8d\u00e8 Yor\u00f9b\u00e1","zh-hans":"\u7b80\u4f53\u4e2d\u6587",
"zh-hant":"\u6b63\u9ad4\u4e2d\u6587"},Nc="ace ar fa he mzn ps ur".split(" "),Oc=window.BlocklyGamesLang,Pc=window.BlocklyGamesLanguages,Qc=".html"==window.location.pathname.substr(-5),B=null,R,Rc=Number,Sc,Tc=window.location.search.match(/[?&]level=([^&]+)/);Sc=Tc?decodeURIComponent(Tc[1].replace(/\+/g,"%20")):"NaN";var Uc=Rc(Sc);R=isNaN(Uc)?1:g.g.Ja.Mf(1,Uc,10);
function Vc(){document.title=document.getElementById("title").textContent;document.dir=-1!=Nc.indexOf(Oc)?"rtl":"ltr";document.head.parentElement.setAttribute("lang",Oc);var a=document.getElementById("languageMenu");if(a){for(var c=[],d=0;d<Pc.length;d++){var e=Pc[d];c.push([Mc[e],e])}c.sort(function(h,k){return h[0]>k[0]?1:h[0]<k[0]?-1:0});for(d=a.options.length=0;d<c.length;d++){var f=c[d];e=f[1];f=new Option(f[0],e);e==Oc&&(f.selected=!0);a.options.add(f)}1>=a.options.length&&(a.style.display=
"none")}for(d=1;10>=d;d++)a=document.getElementById("level"+d),c=!!Wc(d),a&&c&&(a.className+=" level_done");(d=document.querySelector('meta[name="viewport"]'))&&725>screen.availWidth&&d.setAttribute("content","width=725, initial-scale=.35, user-scalable=no");setTimeout(Xc,1)}function Wc(a){var c=Yc;try{var d=window.localStorage[c+a]}catch(e){}return d}function S(a){var c;(c=document.getElementById(a))?(c=c.textContent,c=c.replace(/\\n/g,"\n")):c=null;return null===c?"[Unknown message: "+a+"]":c}
function Zc(a,c){if(!a)throw TypeError("Element not found: "+a);"string"==typeof a&&(a=document.getElementById(a));a.addEventListener("click",c,!0);a.addEventListener("touchend",c,!0)}function $c(a){a%=360;0>a&&(a+=360);return a}
function Xc(){if(!Qc){window.GoogleAnalyticsObject="GoogleAnalyticsFunction";var a=function(d){(a.q=a.q||[]).push(arguments)};window.GoogleAnalyticsFunction=a;a.l=1*new Date;var c=document.createElement("script");c.async=1;c.src="//www.google-analytics.com/analytics.js";document.head.appendChild(c);a("create","UA-50448074-1","auto");a("send","pageview")}};g.g.A={};g.g.A.Va=function(a,c){return" "+a+","+c+" "};g.g.A.curve=function(a,c){return" "+a+c.join("")};g.g.A.moveTo=function(a,c){return" M "+a+","+c+" "};g.g.A.moveBy=function(a,c){return" m "+a+","+c+" "};g.g.A.lineTo=function(a,c){return" l "+a+","+c+" "};g.g.A.line=function(a){return" l"+a.join("")};g.g.A.ea=function(a,c){return" "+a+" "+c+" "};g.g.A.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};g.m.Bi=function(){this.Ff=0;this.LC=3;this.Ef=5;this.gw=8;this.ud=10;this.Dw=this.Ef;this.Jr=15;this.Wl=5;this.xh=8;this.uC=15;this.tC=4;this.rC=12;this.yB=16;this.zb=8;this.Do=15;this.SC=0;this.TC=20;this.XA=4;this.OC=15;this.PC=100;this.NC=15;this.kr=24;this.AB=14.5;this.zB=this.Jr+11;this.CB=2;this.BB=this.kr;this.zw=g.g.A.moveBy(0,0);this.XB=12;this.YB=6};b=g.m.Bi.prototype;
b.S=function(){this.jk=this.Wt();this.mk=this.Xt();this.Bg=this.Zt();this.Ji=this.Yt();var a=this.zb,c=g.g.A.arc("a","0 0,0",a,g.g.A.Va(-a,a)),d=g.g.A.arc("a","0 0,0",a,g.g.A.Va(a,a));this.Kl={width:a,height:a,Bu:c,$p:d};c=this.zb;a=g.g.A.moveBy(0,c)+g.g.A.arc("a","0 0,1",c,g.g.A.Va(c,-c));c=g.g.A.arc("a","0 0,1",c,g.g.A.Va(-c,-c));this.nw={iv:a,hs:c}};b.Wt=function(){var a=this.XB,c=this.YB,d=g.g.A.line([g.g.A.Va(6,3),g.g.A.Va(-12,6),g.g.A.Va(6,3)]);return{height:a,width:c,path:d}};
b.Zt=function(){var a=this.OC,c=this.PC,d=g.g.A.curve("c",[g.g.A.Va(30,-a),g.g.A.Va(70,-a),g.g.A.Va(c,0)]);return{height:a,width:c,path:d}};b.Yt=function(){function a(h){h=h?-1:1;var k=-h,l=d/2,m=g.g.A.Va(c,h*l);return g.g.A.curve("c",[g.g.A.Va(0,h*(l+2.5)),g.g.A.Va(-c,k*(l+.5)),g.g.A.Va(-c,h*l)])+g.g.A.curve("s",[g.g.A.Va(c,2.5*k),m])}var c=this.xh,d=this.Jr,e=a(!0),f=a(!1);return{width:c,height:d,Se:f,pn:e}};
b.Xt=function(){function a(k){return g.g.A.line([g.g.A.Va(k*e,d),g.g.A.Va(3*k,0),g.g.A.Va(k*e,-d)])}var c=this.uC,d=this.tC,e=(c-3)/2,f=a(1),h=a(-1);return{width:c,height:d,ji:f,Lz:h}};g.m.u={NONE:0,we:1,Tv:2,Wv:4,Fr:8,Cv:16,$v:32,Sv:64,wg:128,Yv:256,Aw:512,lB:1024,xr:2048,mr:4096,yC:8192,Qq:16384,gr:32768,er:65536,Br:131072,Ar:262144,cw:524288,Dr:1048576,Mr:2097152,Kq:4194304,Zv:8388608};g.m.u.wJ=g.m.u.gr|g.m.u.er;g.m.u.aL=g.m.u.Br|g.m.u.Ar;g.m.u.mu=16777216;g.m.u.Nb=function(){g.m.u.hasOwnProperty(void 0)||(g.m.u[void 0]=g.m.u.mu,g.m.u.mu<<=1);return g.m.u[void 0]};g.m.u.Vm=function(a){return a.type&g.m.u.we};g.m.u.rj=function(a){return a.type&g.m.u.Tv};
g.m.u.Uk=function(a){return a.type&g.m.u.Wv};g.m.u.sf=function(a){return a.type&g.m.u.Fr};g.m.u.iM=function(a){return a.type&g.m.u.$v};g.m.u.rf=function(a){return a.type&g.m.u.wg};g.m.u.Um=function(a){return a.type&g.m.u.Sv};g.m.u.Uh=function(a){return a.type&g.m.u.Yv};g.m.u.Ym=function(a){return a.type&g.m.u.Aw};g.m.u.Wk=function(a){return a.type&g.m.u.xr};g.m.u.Xh=function(a){return a.type&g.m.u.mr};g.m.u.QF=function(a){return a.type&(g.m.u.xr|g.m.u.mr)};g.m.u.Wh=function(a){return a.type&g.m.u.er};
g.m.u.kM=function(a){return a.type&g.m.u.Ar};g.m.u.Xm=function(a){return a.type&g.m.u.gr};g.m.u.lM=function(a){return a.type&g.m.u.Br};g.m.u.hM=function(a){return a.type&g.m.u.Qq};g.m.u.az=function(a){return a.type&g.m.u.cw};g.m.u.mM=function(a){return a.type&g.m.u.Dr};g.m.u.gM=function(a){return a.type&g.m.u.Cv};g.m.u.Qp=function(a){return a.type&g.m.u.Mr};g.m.u.Jp=function(a){return a.type&g.m.u.Kq};g.m.u.nM=function(a){return a.type&(g.m.u.Mr|g.m.u.Kq)};g.m.u.jM=function(a){return a.type&g.m.u.Zv};g.m.qh=function(a){this.height=this.width=0;this.type=g.m.u.NONE;this.Ch=this.Ua=0;this.C=a;this.Pe=this.C.Do};g.m.sa=function(a,c){g.m.sa.w.constructor.call(this,a);this.vs=c;a:switch(a=this.C,c.type){case g.Wa:case g.Ye:c=a.Ji;break a;case g.Ze:case g.jb:c=a.mk;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=g.m.u.lB};g.g.object.W(g.m.sa,g.m.qh);g.m.vr=function(a,c){g.m.vr.w.constructor.call(this,a,c);this.type|=g.m.u.yC;this.height=this.shape.height;this.width=this.shape.width;this.Fe=this.C.Wl;this.se=this.width};g.g.object.W(g.m.vr,g.m.sa);
g.m.yr=function(a,c){g.m.yr.w.constructor.call(this,a,c);this.type|=g.m.u.xr;this.height=this.shape.height;this.width=this.shape.width};g.g.object.W(g.m.yr,g.m.sa);g.m.nr=function(a,c){g.m.nr.w.constructor.call(this,a,c);this.type|=g.m.u.mr;this.height=this.shape.height;this.width=this.shape.width};g.g.object.W(g.m.nr,g.m.sa);g.m.Ll=function(a,c){g.m.Ll.w.constructor.call(this,a,c.connection);this.type|=g.m.u.wg;this.input=c;this.align=c.align;(this.Xi=c.connection&&y(c.connection)?y(c.connection):null)?(a=G(this.Xi),this.lm=a.width,this.$o=a.height):this.$o=this.lm=0;this.connection=c.connection;this.Fe=0};g.g.object.W(g.m.Ll,g.m.sa);
g.m.oh=function(a,c){g.m.oh.w.constructor.call(this,a,c);this.type|=g.m.u.Yv;this.Xi?(this.width=this.lm,this.height=this.$o):(this.height=this.C.zB,this.width=this.shape.width+this.C.AB);this.Fe=this.C.Wl;this.mm=this.shape.height;this.Gh=this.shape.width};g.g.object.W(g.m.oh,g.m.Ll);g.m.wh=function(a,c){g.m.wh.w.constructor.call(this,a,c);this.type|=g.m.u.Aw;this.height=this.Xi?this.$o+this.C.SC:this.C.BB;this.width=this.C.Do+this.shape.width};g.g.object.W(g.m.wh,g.m.Ll);
g.m.so=function(a,c){g.m.so.w.constructor.call(this,a,c);this.type|=g.m.u.Sv;this.height=this.Xi?this.$o-2*this.C.Wl:this.shape.height;this.width=this.shape.width+this.C.CB;this.Fe=this.C.Wl;this.mm=this.shape.height;this.Gh=this.shape.width};g.g.object.W(g.m.so,g.m.Ll);g.m.Ld=function(a,c){g.m.Ld.w.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=g.m.u.Wv;a=new g.g.$e(g.Ld.prototype.Ko,g.Ld.prototype.Ko-2);this.height=a.height;this.width=a.width};g.g.object.W(g.m.Ld,g.m.qh);g.m.dr=function(a){g.m.dr.w.constructor.call(this,a);this.type|=g.m.u.cw;this.height=this.C.jk.height;this.width=this.C.jk.width};g.g.object.W(g.m.dr,g.m.qh);
g.m.Pa=function(a,c){g.m.Pa.w.constructor.call(this,a);this.Xx=c;this.ld=c.ug&&!!c.B&&c.B.ld();this.NE=!1;this.type|=g.m.u.we;a=this.Xx.Ug();this.height=a.height;this.width=a.width};g.g.object.W(g.m.Pa,g.m.qh);g.m.Zq=function(a){g.m.Zq.w.constructor.call(this,a);this.type|=g.m.u.Tv;this.height=this.C.Bg.height;this.width=this.C.Bg.width;this.wk=this.height};g.g.object.W(g.m.Zq,g.m.qh);
g.m.No=function(a,c){g.m.No.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.m.u.Br:g.m.u.gr)|g.m.u.Qq;this.width=this.height=this.C.Ff};g.g.object.W(g.m.No,g.m.qh);g.m.Jo=function(a,c){g.m.Jo.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.m.u.Ar:g.m.u.er)|g.m.u.Qq;this.width=this.C.zb;this.height=this.C.zb/2};g.g.object.W(g.m.Jo,g.m.qh);g.m.hk=function(a,c){g.m.hk.w.constructor.call(this,a);this.type=this.type|g.m.u.Fr|g.m.u.$v;this.width=c;this.height=this.C.NC};g.g.object.W(g.m.hk,g.m.qh);g.m.Mi=function(a){this.type=g.m.u.Dr;this.elements=[];this.Ua=this.Oc=this.ng=this.minWidth=this.minHeight=this.width=this.height=0;this.Ly=this.Cp=this.At=this.Ad=this.jj=!1;this.C=a;this.Pe=this.C.Do};g.m.Mi.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function ad(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.m.u.rf(d))return d;return null}g.m.Mi.prototype.cv=function(){return!0};g.m.Mi.prototype.Vx=function(){return!0};
function bd(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.m.u.sf(d))return d;return null}g.m.tk=function(a){g.m.tk.w.constructor.call(this,a);this.type|=g.m.u.Mr;this.wk=this.Hg=0;this.yF=!1;this.connection=null};g.g.object.W(g.m.tk,g.m.Mi);g.m.tk.prototype.Bt=function(a){var c=a.Wg?"cap"===a.Wg:g.wa.Bg,d=a.Z&&y(a.Z);return!!a.M||c||(d?q(d)==a:!1)};
g.m.tk.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.m.u.sf(f)||(g.m.u.rj(f)?d=Math.max(d,f.wk):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.Hg=this.wk=d;this.ng=this.width};g.m.tk.prototype.cv=function(){return!1};g.m.ak=function(a){g.m.ak.w.constructor.call(this,a);this.type|=g.m.u.Kq;this.My=!1;this.connection=null;this.Ui=this.wm=0};g.g.object.W(g.m.ak,g.m.Mi);
g.m.ak.prototype.Bt=function(a){return!!a.M||!!q(a)};g.m.ak.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.m.u.sf(f)||(g.m.u.Xh(f)?d=Math.max(d,f.height):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.wm=d;this.ng=this.width};g.m.ak.prototype.cv=function(){return!1};
g.m.Mo=function(a,c,d){g.m.Mo.w.constructor.call(this,a);this.type=this.type|g.m.u.Fr|g.m.u.Cv;this.width=d;this.height=c;this.iy=!1;this.ng=0;this.elements=[new g.m.hk(this.C,d)]};g.g.object.W(g.m.Mo,g.m.Mi);g.m.Mo.prototype.measure=function(){};g.m.ik=function(a){g.m.ik.w.constructor.call(this,a);this.type|=g.m.u.Zv;this.px=0};g.g.object.W(g.m.ik,g.m.Mi);
g.m.ik.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,c=0,d;d=this.elements[c];c++)this.width+=d.width,g.m.u.rf(d)&&(g.m.u.Ym(d)?a+=d.lm:g.m.u.Um(d)&&0!=d.lm&&(a+=d.lm-d.Gh)),g.m.u.sf(d)||(this.height=Math.max(this.height,d.height));this.px=a;this.ng=this.width+a};g.m.ik.prototype.Vx=function(){return!this.jj&&!this.Ad};g.m.uh=function(a,c){this.U=c;this.eh=a;this.C=this.eh.C;this.M=c.M?new g.m.vr(this.C,c.M):null;this.Jt=Ma(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.Vh=c.Vh();this.G=c.G;this.Nj=this.width=this.wl=this.height=0;this.rows=[];this.Qy=[];this.lc=new g.m.tk(this.C);this.Kb=new g.m.ak(this.C);this.rq=this.se=0};b=g.m.uh.prototype;
b.measure=function(){var a=this.U.Wg?"cap"===this.U.Wg:g.wa.Bg,c=!!this.U.Z;this.lc.Bt(this.U)?this.lc.elements.push(new g.m.No(this.C)):this.lc.elements.push(new g.m.Jo(this.C));a?(a=new g.m.Zq(this.C),this.lc.elements.push(a),this.lc.Hg=a.wk):c&&(this.lc.yF=!0,this.lc.connection=new g.m.yr(this.C,this.U.Z),this.lc.elements.push(this.lc.connection));this.U.T.length&&this.U.T[0].type==g.jb&&!this.U.isCollapsed()?this.lc.minHeight=this.C.ud:this.lc.minHeight=this.C.Ef;this.rows.push(this.lc);a=new g.m.ik(this.C);
var d=Sa(this.U);if(d.length){c=0;for(var e;e=d[c];c++){var f=new g.m.Ld(this.C,e);this.isCollapsed&&e.ix?this.Qy.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.U.T[c];c++)if(d.isVisible()){!e||d.type!=g.jb&&e.type!=g.jb&&(d.type!=g.Wa&&d.type!=g.tg||this.Jt)||(this.rows.push(a),a=new g.m.ik(this.C));for(e=0;f=d.Qa[e];e++)a.elements.push(new g.m.Pa(this.C,f,d));this.Rw(d,a);e=d}this.isCollapsed&&(a.Ly=!0,a.elements.push(new g.m.dr(this.C)));(a.elements.length||a.Cp)&&this.rows.push(a);this.Kb.My=
!!this.U.X;this.Kb.minHeight=this.U.T.length&&this.U.T[this.U.T.length-1].type==g.jb?this.C.ud:this.C.Ef-1;this.Kb.Bt(this.U)?this.Kb.elements.push(new g.m.No(this.C)):this.Kb.elements.push(new g.m.Jo(this.C));this.Kb.My&&(this.Kb.connection=new g.m.nr(this.C,this.U.X),this.Kb.elements.push(this.Kb.connection));this.rows.push(this.Kb);for(a=0;c=this.rows[a];a++){d=c.elements;c.elements=[];c.cv()&&c.elements.push(new g.m.hk(this.C,this.tp(null,d[0])));for(e=0;e<d.length-1;e++)c.elements.push(d[e]),
c.elements.push(new g.m.hk(this.C,this.tp(d[e],d[e+1])));c.elements.push(d[d.length-1]);c.Vx()&&c.elements.push(new g.m.hk(this.C,this.tp(d[d.length-1],null)))}for(e=d=c=a=0;f=this.rows[e];e++)f.measure(),c=Math.max(c,f.width),f.Ad&&(a=Math.max(a,f.width-ad(f).width)),d=Math.max(d,f.ng);this.Nj=a;this.width=c;for(e=0;f=this.rows[e];e++)f.Ad&&(f.Nj=this.Nj);this.wl=Math.max(c,d);this.M&&(this.se=this.M.width,this.width+=this.M.width,this.wl+=this.M.width);for(a=0;c=this.rows[a];a++)c.Ad?(d=ad(c),e=
c.width-d.width,f=this.Nj-this.se,(e=f-e)&&this.Tr(c,e),e=c.width,f=this.width-this.se-(this.C.Kl.wM||0),d.width+=f-e,c.width+=f-e,c.ng=Math.max(c.width,this.Nj+c.px)):(d=this.width-this.se-c.width)&&this.Tr(c,d);a=this.rows;this.rows=[];for(c=0;c<a.length;c++)this.rows.push(a[c]),c!=a.length-1&&this.rows.push(cd(this,a[c],a[c+1]));this.Yx()};
b.Rw=function(a,c){this.Jt&&a.type==g.Wa?(c.elements.push(new g.m.oh(this.C,a)),c.At=!0):a.type==g.jb?(c.elements.push(new g.m.wh(this.C,a)),c.Ad=!0):a.type==g.Wa?(c.elements.push(new g.m.so(this.C,a)),c.jj=!0):a.type==g.tg&&(c.Cp=!0)};b.tp=function(a,c){if(a&&g.m.u.rf(a)&&!c){if(g.m.u.Um(a))return this.C.Ff;if(g.m.u.Uh(a))return this.C.ud;if(g.m.u.Ym(a))return this.C.Ff}return a&&g.m.u.Xm(a)&&c&&(g.m.u.Wk(c)||g.m.u.Xh(c))?c.Pe:a&&g.m.u.Wh(a)&&c&&(g.m.u.Wk(c)||g.m.u.Xh(c))?c.Pe-this.C.zb:this.C.Ef};
b.Tr=function(a,c){var d=bd(a);d&&(d.width+=c,a.width+=c)};function cd(a,c,d){a=new g.m.Mo(a.C,a.zy(c,d),a.width-a.se);c.Ad&&(a.iy=!0);return a}b.zy=function(){return this.C.Ef};b.sy=function(a,c){return g.m.u.sf(c)?a.Oc+c.height/2:g.m.u.Jp(a)?(a=a.Oc+a.height-a.wm,g.m.u.Xh(c)?a+c.height/2:a-c.height/2):g.m.u.Qp(a)?g.m.u.rj(c)?a.Hg-c.height/2:a.Hg+c.height/2:a.Oc+a.height/2};
function dd(a,c){for(var d=c.Ua,e=0,f;f=c.elements[e];e++)g.m.u.sf(f)&&(f.height=c.height),f.Ua=d,f.Ch=a.sy(c,f),d+=f.width}b.Yx=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++)e.Oc=c,e.Ua=this.se,c+=e.height,a=Math.max(a,e.ng),dd(this,e);this.wl=a+this.se;this.height=c;this.rq=this.lc.Hg;this.Kb.Ui=c-this.Kb.wm};g.m.fd=function(a,c){this.U=a;this.pa=c;a.Ra();this.Ip=this.Oa="";this.C=c.eh.C};b=g.m.fd.prototype;b.draw=function(){ed(this);fd(this);gd(this);this.U.Gj.Vu(this.Oa+"\n"+this.Ip);this.pa.G&&this.U.Gj.bt();g.m.Xn&&this.U.Lu.EE(this.U,this.pa);hd(this)};function hd(a){a.U.height=a.pa.height;a.U.width=a.pa.wl}function ed(a){for(var c=0,d;d=a.pa.Qy[c];c++)d.icon.Ud.setAttribute("display","none")}
function fd(a){a.Vs();for(var c=1;c<a.pa.rows.length-1;c++){var d=a.pa.rows[c];d.Ly?a.Am(d):d.Ad?a.Us(d):d.jj?a.Ws(d):a.Ts(d)}a.Ps();a.Ss()}b.Vs=function(){var a=this.pa.lc,c=a.elements,d=this.pa.lc;if(d.connection){var e=d.Ua+d.Pe;jc(d.connection.vs,this.pa.G?-e:e,0)}this.Oa+=g.g.A.moveBy(a.Ua,this.pa.rq);for(d=0;e=c[d];d++)g.m.u.Wh(e)?this.Oa+=this.C.nw.iv:g.m.u.Wk(e)?this.Oa+=e.shape.ji:g.m.u.rj(e)?this.Oa+=this.C.Bg.path:g.m.u.sf(e)&&(this.Oa+=g.g.A.ea("h",e.width));this.Oa+=g.g.A.ea("v",a.height)};
b.Am=function(a){this.Oa+=this.C.jk.path+g.g.A.ea("v",a.height-this.C.jk.height)};b.Ws=function(a){var c=ad(a);this.Oz(a);var d="function"==typeof c.shape.Se?c.shape.Se(c.height):c.shape.Se;this.Oa+=g.g.A.ea("H",c.Ua+c.width)+d+g.g.A.ea("v",a.height-c.mm)};b.Us=function(a){var c=ad(a);this.Oa+=g.g.A.ea("H",c.Ua+c.Pe+c.shape.width)+(c.shape.Lz+g.g.A.ea("h",-(c.Pe-this.C.Kl.width))+this.C.Kl.Bu)+g.g.A.ea("v",a.height-2*this.C.Kl.height)+this.C.Kl.$p+g.g.A.ea("H",a.Ua+a.width);this.Rz(a)};
b.Ts=function(a){this.Oa+=g.g.A.ea("V",a.Oc+a.height)};b.Ps=function(){var a=this.pa.Kb,c=a.elements;this.Qz();this.Oa+=g.g.A.ea("V",a.Ui);for(var d=c.length-1,e;e=c[d];d--)g.m.u.Xh(e)?this.Oa+=e.shape.Lz:g.m.u.Xm(e)?this.Oa+=g.g.A.ea("H",a.Ua):g.m.u.Wh(e)?this.Oa+=this.C.nw.hs:g.m.u.sf(e)&&(this.Oa+=g.g.A.ea("h",-1*e.width))};
b.Ss=function(){var a=this.pa.M;if(this.pa.M){var c=this.pa.se;jc(this.U.M,this.pa.G?-c:c,this.pa.M.Fe)}a&&(c=a.Fe+a.height,a="function"==typeof a.shape.pn?a.shape.pn(a.height):a.shape.pn,this.Oa+=g.g.A.ea("V",c)+a);this.Oa+="z"};
function gd(a){for(var c=0,d;d=a.pa.rows[c];c++)for(var e=0,f;f=d.elements[e];e++)if(g.m.u.Uh(f))a.Rs(f);else if(g.m.u.Uk(f)||g.m.u.Vm(f)){var h=a;if(g.m.u.Vm(f))var k=f.Xx.ya();else g.m.u.Uk(f)&&(k=f.icon.Ud);var l=f.Ch-f.height/2,m=f.Ua,n="";h.pa.G&&(m=-(m+f.width),f.NE&&(m+=f.width,n="scale(-1 1)"));g.m.u.Uk(f)?(k.setAttribute("display","block"),k.setAttribute("transform","translate("+m+","+l+")"),oc(f.icon)):k.setAttribute("transform","translate("+m+","+l+")"+n);h.pa.Vh&&k.setAttribute("display",
"none")}}b.Rs=function(a){var c=a.width,d=a.height,e=a.Fe,f=a.mm+e;this.Ip+=g.g.A.moveTo(a.Ua+a.Gh,a.Ch-d/2)+g.g.A.ea("v",e)+a.shape.Se+g.g.A.ea("v",d-f)+g.g.A.ea("h",c-a.Gh)+g.g.A.ea("v",-d)+"z";this.Pz(a)};b.Pz=function(a){var c=a.Ch-a.height/2;if(a.connection){var d=a.Ua+a.Gh;this.pa.G&&(d*=-1);jc(a.connection,d,c+a.Fe)}};b.Rz=function(a){var c=ad(a);if(c.connection){var d=a.Ua+a.Nj+c.Pe;this.pa.G&&(d*=-1);jc(c.connection,d,a.Oc)}};
b.Oz=function(a){var c=ad(a);if(c.connection){var d=a.Ua+a.width;this.pa.G&&(d*=-1);jc(c.connection,d,a.Oc)}};b.Qz=function(){var a=this.pa.Kb;if(a.connection){a=a.connection;var c=a.Ua;jc(a.vs,this.pa.G?-c:c,a.Ch-a.height/2)}};g.Aa=function(a,c){this.s=a;this.Np=c;this.Wd=null;this.C=a.eh.C};g.Aa.oo=5;g.Aa.bk=100;g.Aa.TJ=24;g.Aa.HL=5;g.Aa.Lo=10;g.Aa.Ev=2;g.Aa.NB=.75;g.Aa.no="#cc0a0a";g.Aa.mC="#4286f4";g.Aa.oB="blocklyCursor";g.Aa.lC="blocklyMarker";b=g.Aa.prototype;b.um=null;b.ya=function(){return this.H};
b.Ia=function(){this.H=g.g.o.I("g",{"class":this.Np?g.Aa.lC:g.Aa.oB},null);var a=this.Np?g.Aa.mC:g.Aa.no;this.Vc=g.g.o.I("g",{width:g.Aa.bk,height:g.Aa.oo},this.H);this.Dk=g.g.o.I("rect",{x:"0",y:"0",fill:a,width:g.Aa.bk,height:g.Aa.oo,style:"display: none;"},this.Vc);this.Ek=g.g.o.I("rect",{"class":"blocklyVerticalCursor",x:"0",y:"0",rx:"10",ry:"10",style:"display: none;",stroke:a},this.Vc);this.vm=g.g.o.I("path",{width:g.Aa.bk,height:g.Aa.oo,transform:"",style:"display: none;",fill:a},this.Vc);
this.bj=g.g.o.I("path",{width:g.Aa.bk,height:g.Aa.oo,transform:"",style:"display: none;",fill:"none",stroke:a,"stroke-width":"4"},this.Vc);this.Np||(g.g.o.I("animate",{attributeType:"XML",attributeName:"fill",dur:"1s",values:g.Aa.no+";transparent;transparent;",repeatCount:"indefinite"},this.Dk),g.g.o.I("animate",{attributeType:"XML",attributeName:"fill",dur:"1s",values:g.Aa.no+";transparent;transparent;",repeatCount:"indefinite"},this.vm),g.g.o.I("animate",{attributeType:"XML",attributeName:"stroke",
dur:"1s",values:g.Aa.no+";transparent;transparent;",repeatCount:"indefinite"},this.bj));return this.H};function id(a,c){a.Np?(a.Wd&&a.Wd.Cn(null),c.Cn(a.ya())):(a.Wd&&a.Wd.Bn(null),c.Bn(a.ya()));a.Wd=c}
function jd(a,c){if(c){var d=c.width,e=c.height,f=e*g.Aa.NB;c.Z?(e=g.Aa.Ev,d=g.g.A.moveBy(-1*e,f)+g.g.A.ea("V",-1*e)+g.g.A.ea("H",a.C.Do)+a.C.mk.ji+g.g.A.ea("H",d+2*e)+g.g.A.ea("V",f),a.bj.setAttribute("d",d)):c.M?(d=g.g.A.moveBy(d,0)+g.g.A.ea("h",-1*(d-a.C.Ji.width))+g.g.A.ea("v",a.C.Wl)+a.C.Ji.Se+g.g.A.ea("V",e)+g.g.A.ea("H",d),a.bj.setAttribute("d",d)):(e=g.Aa.Ev,d=g.g.A.moveBy(-1*e,f)+g.g.A.ea("V",-1*e)+g.g.A.ea("H",d+2*e)+g.g.A.ea("V",f),a.bj.setAttribute("d",d));a.s.G&&a.bj.setAttribute("transform",
"scale(-1 1)");a.um=a.bj;id(a,c);kd(a)}}function kd(a){a.Ca();a.um.style.display=""}function ld(a,c,d,e){a.Dk.setAttribute("x",c);a.Dk.setAttribute("y",d);a.Dk.setAttribute("width",e);a.um=a.Dk}function md(a,c,d,e,f){a.Ek.setAttribute("x",c);a.Ek.setAttribute("y",d);a.Ek.setAttribute("width",e);a.Ek.setAttribute("height",f);a.um=a.Ek}b.Ca=function(){this.Dk.style.display="none";this.Ek.style.display="none";this.vm.style.display="none";this.bj.style.display="none"};
b.draw=function(a){if(a)if(a.Nb()===g.F.types.ee)jd(this,a.qa);else if(a.Nb()===g.F.types.qk)jd(this,a.qa.B);else if(a.qa.type===g.Wa){var c=a.qa;a=c.B;var d=c.Cj.x;c=c.Cj.y;var e=g.g.A.moveTo(0,0)+this.C.Ji.Se;this.vm.setAttribute("d",e);this.vm.setAttribute("transform","translate("+d+","+c+")"+(this.s.G?" scale(-1 1)":""));this.um=this.vm;id(this,a);kd(this)}else if(a.qa.type===g.jb)c=a.qa,a=c.B,d=0,c=c.Cj.y,e=G(a).width,this.s.G&&(d=-e),ld(this,d,c,e),id(this,a),kd(this);else if(a.Nb()===g.F.types.Be)jd(this,
a.qa.B);else if(a.Nb()===g.F.types.we)a=a.qa,d=a.Ug().width,c=a.Ug().height,md(this,0,0,d,c),id(this,a),kd(this);else if(a.Nb()===g.F.types.Ti)d=a.JA,a=d.x,d=d.y,this.s.G&&(a-=g.Aa.bk),ld(this,a,d,g.Aa.bk),id(this,this.s),kd(this);else{if(a.Nb()===g.F.types.Gf){a=a.qa;c=G(a);d=c.width+g.Aa.Lo;c=c.height+g.Aa.Lo;var f=e=-1*g.Aa.Lo/2,h=-1*g.Aa.Lo/2;this.s.G&&(f=-(d+e));md(this,f,h,d,c);id(this,a);kd(this)}}else this.Ca()};b.J=function(){this.H&&g.g.o.removeNode(this.H)};g.m.vh=function(){this.C=null};b=g.m.vh.prototype;b.S=function(){this.C=this.iz();this.C.S()};b.iz=function(){return new g.m.Bi};b.lz=function(a){return new g.m.uh(this,a)};b.jz=function(a,c){return new g.m.fd(a,c)};b.kz=function(a){return new g.m.Ki(a)};b.za=function(a){if(g.m.Xn&&!a.Lu){if(!g.m.xB)throw Error("Missing require for Blockly.blockRendering.Debug");var c=new g.m.xB;a.Lu=c}c=this.lz(a);c.measure();this.jz(a,c).draw()};g.na={};g.na.Bi=function(){g.na.Bi.w.constructor.call(this);this.sd=1};g.g.object.W(g.na.Bi,g.m.Bi);g.na.Vv=function(a){this.pa=a;this.Qm=this.ga="";this.Sc=this.pa.G;a=a.eh;this.C=a.C;this.pf=a.pf;this.Bd=this.pf.rh;this.yu=this.pf.zC;this.Sk=this.pf.UB;this.sn=this.pf.Ji;this.nG=this.pf.mk;this.lH=this.pf.Bg;this.cz=this.pf.jk};g.na.Vv.prototype.Am=function(a){this.pa.G&&(this.ga+=g.g.A.ea("H",a.width-this.Bd),this.ga+=this.cz.ji,this.ga+=g.g.A.ea("v",a.height-this.cz.height-this.Bd))};
function nd(a,c){var d=c.Ua+c.width-a.Bd;c.iy&&(a.ga+=g.g.A.ea("H",d));a.Sc&&(a.ga+=g.g.A.ea("H",d),c.height>a.Bd&&(a.ga+=g.g.A.ea("V",c.Oc+c.height-a.Bd)))};g.na.Ki=function(a){this.Pj=a;this.Mn=g.g.o.I("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Pj);this.ml=g.g.o.I("path",{"class":"blocklyPath"},this.Pj);this.On=g.g.o.I("path",{"class":"blocklyPathLight"},this.Pj)};g.na.Ki.prototype.Vu=function(a,c){this.ml.setAttribute("d",a);this.Mn.setAttribute("d",a);this.On.setAttribute("d",c)};
g.na.Ki.prototype.bt=function(){this.ml.setAttribute("transform","scale(-1 1)");this.On.setAttribute("transform","scale(-1 1)");this.Mn.setAttribute("transform","translate(1,1) scale(-1 1)")};g.na.oh=function(a,c){g.na.oh.w.constructor.call(this,a,c);this.Xi&&(this.width+=this.C.sd,this.height+=this.C.sd)};g.g.object.W(g.na.oh,g.m.oh);g.na.wh=function(a,c){g.na.wh.w.constructor.call(this,a,c);this.Xi&&(this.height+=this.C.sd)};g.g.object.W(g.na.wh,g.m.wh);g.na.uh=function(a,c){g.na.uh.w.constructor.call(this,a,c)};g.g.object.W(g.na.uh,g.m.uh);b=g.na.uh.prototype;b.Rw=function(a,c){this.Jt&&a.type==g.Wa?(c.elements.push(new g.na.oh(this.C,a)),c.At=!0):a.type==g.jb?(c.elements.push(new g.na.wh(this.C,a)),c.Ad=!0):a.type==g.Wa?(c.elements.push(new g.m.so(this.C,a)),c.jj=!0):a.type==g.tg&&(c.Cp=!0)};
b.tp=function(a,c){if(!a)return c&&g.m.u.Vm(c)&&c.ld?this.C.Ef:c&&g.m.u.Uh(c)?this.C.gw:c&&g.m.u.Ym(c)?this.C.TC:this.C.ud;if(!g.m.u.rf(a)&&!c)return g.m.u.Vm(a)&&a.ld?this.C.Ef:g.m.u.Uk(a)?2*this.C.ud+1:g.m.u.rj(a)?this.C.Ff:g.m.u.QF(a)?this.C.ud:g.m.u.Wh(a)?this.C.rC:g.m.u.az(a)?this.C.Ff:this.C.ud;if(g.m.u.rf(a)&&!c){if(g.m.u.Um(a))return this.C.Ff;if(g.m.u.Uh(a))return this.C.ud;if(g.m.u.Ym(a))return this.C.Ff}if(!g.m.u.rf(a)&&c&&g.m.u.rf(c)){if(a.ld){if(g.m.u.Uh(c)||g.m.u.Um(c))return this.C.LC}else{if(g.m.u.Uh(c)||
g.m.u.Um(c))return this.C.gw;if(g.m.u.Ym(c))return this.C.ud}return this.C.ud-1}if(g.m.u.Uk(a)&&c&&!g.m.u.rf(c))return this.C.ud;if(g.m.u.Uh(a)&&c&&!g.m.u.rf(c))return c.ld?this.C.Ef:this.C.ud;if(g.m.u.Xm(a)&&c){if(g.m.u.rj(c))return this.C.Ff;if(g.m.u.Wk(c))return c.Pe;if(g.m.u.Xh(c))return a=(this.G?1:-1)*this.C.sd/2,c.Pe+a}if(g.m.u.Wh(a)&&c){if(g.m.u.Wk(c))return c.Pe-this.C.zb;if(g.m.u.Xh(c))return a=(this.G?1:-1)*this.C.sd/2,c.Pe-this.C.zb+a}return!g.m.u.rf(a)&&c&&!g.m.u.rf(c)&&a.ld==c.ld||c&&
g.m.u.az(c)?this.C.ud:this.C.Ef};b.Tr=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(g.m.u.sf(e)){d=e;break a}d=null}e=bd(a);if(a.jj||a.Ad)a.ng+=c;var f=ad(a);f?f.align==g.Hq?e.width+=c:f.align==g.xv?(d.width+=c/2,e.width+=c/2):f.align==g.yl&&(d.width+=c):e.width+=c;a.width+=c};b.zy=function(a,c){return g.m.u.Qp(a)&&g.m.u.Jp(c)?this.C.yB:g.m.u.Qp(a)||g.m.u.Jp(c)?this.C.Ff:a.jj&&c.jj?this.C.ud:!a.Ad&&c.Ad?this.C.XA:a.Ad&&c.Ad||!a.Ad&&c.Cp?this.C.ud:this.C.Ef};
b.sy=function(a,c){if(g.m.u.sf(c))return a.Oc+c.height/2;if(g.m.u.Jp(a))return a=a.Oc+a.height-a.wm,g.m.u.Xh(c)?a+c.height/2:a-c.height/2;if(g.m.u.Qp(a))return g.m.u.rj(c)?a.Hg-c.height/2:a.Hg+c.height/2;var d=a.Oc;g.m.u.Vm(c)||g.m.u.Uk(c)?(d+=c.height/2,(a.At||a.Ad)&&c.height+this.C.Dw<=a.height&&(d+=this.C.Dw)):d=g.m.u.Uh(c)?d+c.height/2:d+a.height/2;return d};
b.Yx=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.Oc=c;e.Ua=this.se;c+=e.height;a=Math.max(a,e.ng);var f=c-this.lc.wk;e==this.Kb&&f<this.C.kr&&(f=this.C.kr-f,this.Kb.height+=f,c+=f);dd(this,e)}this.Kb.Ui=c-this.Kb.wm;this.wl=a+this.se+this.C.sd;this.width+=this.C.sd;this.height=c+this.C.sd;this.rq=this.lc.Hg};g.na.fd=function(a,c){g.na.fd.w.constructor.call(this,a,c);this.Yf=new g.na.Vv(c)};g.g.object.W(g.na.fd,g.m.fd);b=g.na.fd.prototype;b.draw=function(){ed(this);fd(this);gd(this);var a=this.Yf;this.U.Gj.Vu(this.Oa+"\n"+this.Ip,a.ga+"\n"+a.Qm);this.pa.G&&this.U.Gj.bt();g.m.Xn&&this.U.Lu.EE(this.U,this.pa);hd(this)};
b.Vs=function(){var a=this.Yf,c=this.pa.lc;a.ga+=g.g.A.moveBy(c.Ua,a.pa.rq);for(var d=0,e;e=c.elements[d];d++)g.m.u.Xm(e)?a.ga+=a.pf.zw:g.m.u.Wh(e)?a.ga+=a.yu.iv(a.Sc):g.m.u.Wk(e)?a.ga+=a.nG.ji:g.m.u.rj(e)?a.ga+=a.lH.path(a.Sc):g.m.u.sf(e)&&0!=e.width&&(a.ga+=g.g.A.ea("H",e.Ua+e.width-a.Bd));a.ga+=g.g.A.ea("H",c.Ua+c.width-a.Bd);nd(this.Yf,this.pa.lc);g.na.fd.w.Vs.call(this)};b.Am=function(a){this.Yf.Am(a);g.na.fd.w.Am.call(this,a)};
b.Ws=function(a){var c=this.Yf,d=ad(a);if(c.Sc){var e=a.height-d.mm;c.ga+=g.g.A.moveTo(d.Ua+d.width-c.Bd,a.Oc)+c.sn.Se(c.Sc)+g.g.A.ea("v",e)}else c.ga+=g.g.A.moveTo(d.Ua+d.width,a.Oc)+c.sn.Se(c.Sc);g.na.fd.w.Ws.call(this,a)};
b.Us=function(a){var c=this.Yf,d=ad(a);if(c.Sc){var e=a.height-2*c.Sk.height;c.ga+=g.g.A.moveTo(d.Ua,a.Oc)+c.Sk.Bu(c.Sc)+g.g.A.ea("v",e)+c.Sk.$p(c.Sc)+g.g.A.lineTo(a.width-d.Ua-c.Sk.width,0)}else c.ga+=g.g.A.moveTo(d.Ua,a.Oc+a.height)+c.Sk.$p(c.Sc)+g.g.A.lineTo(a.width-d.Ua-c.Sk.width,0);g.na.fd.w.Us.call(this,a)};b.Ts=function(a){nd(this.Yf,a);g.na.fd.w.Ts.call(this,a)};
b.Ps=function(){var a=this.Yf,c=this.pa.Kb;if(a.Sc)a.ga+=g.g.A.ea("V",c.Ui-a.Bd);else{var d=a.pa.Kb.elements[0];g.m.u.Xm(d)?a.ga+=g.g.A.moveTo(c.Ua+a.Bd,c.Ui-a.Bd):g.m.u.Wh(d)&&(a.ga+=g.g.A.moveTo(c.Ua,c.Ui),a.ga+=a.yu.hs())}g.na.fd.w.Ps.call(this)};
b.Ss=function(){var a=this.Yf,c=a.pa.M;c&&(c=c.Fe+c.height,a.Sc?a.ga+=g.g.A.moveTo(a.pa.se,c):(a.ga+=g.g.A.moveTo(a.pa.se+a.Bd,a.pa.Kb.Ui-a.Bd),a.ga+=g.g.A.ea("V",c)),a.ga+=a.sn.pn(a.Sc));a.Sc||(c=a.pa.lc,a.ga=g.m.u.Wh(c.elements[0])?a.ga+g.g.A.ea("V",a.yu.height):a.ga+g.g.A.ea("V",c.Hg+a.Bd));g.na.fd.w.Ss.call(this)};
b.Rs=function(a){var c=this.Yf,d=c.Bd,e=a.Ua+a.Gh,f=a.Ch-a.height/2,h=a.width-a.Gh,k=f+d;if(c.Sc){f=a.Fe-d;var l=a.height-(a.Fe+a.mm)+d;c.Qm+=g.g.A.moveTo(e-d,k)+g.g.A.ea("v",f)+c.sn.Se(c.Sc)+g.g.A.ea("v",l)+g.g.A.ea("h",h)}else c.Qm+=g.g.A.moveTo(a.Ua+a.width+d,k)+g.g.A.ea("v",a.height)+g.g.A.ea("h",-h)+g.g.A.moveTo(e,f+a.Fe)+c.sn.Se(c.Sc);g.na.fd.w.Rs.call(this,a)};b.Pz=function(a){var c=a.Ch-a.height/2;if(a.connection){var d=a.Ua+a.Gh+this.C.sd;this.pa.G&&(d*=-1);jc(a.connection,d,c+a.Fe+this.C.sd)}};
b.Rz=function(a){var c=ad(a);if(c.connection){var d=a.Ua+a.Nj+c.Pe;d=this.pa.G?-1*d:d+this.C.sd;jc(c.connection,d,a.Oc+this.C.sd)}};b.Oz=function(a){var c=ad(a);if(c.connection){var d=a.Ua+a.width+this.C.sd;this.pa.G&&(d*=-1);jc(c.connection,d,a.Oc)}};b.Qz=function(){var a=this.pa.Kb;if(a.connection){a=a.connection;var c=a.Ua;jc(a.vs,(this.pa.G?-c:c)+this.C.sd/2,a.Ch-a.height/2+this.C.sd)}};g.na.Il=function(a){this.Ck=a;this.rh=.5;this.zw=g.g.A.moveBy(this.rh,this.rh);this.UB=od(this);this.zC=pd(this);this.Ji=this.Yt();this.mk=this.Xt();this.jk=this.Wt();this.Bg=this.Zt()};
function od(a){var c=a.Ck.zb;a=a.rh;var d=(1-Math.SQRT1_2)*(c+a)-a,e=g.g.A.moveBy(d,d)+g.g.A.arc("a","0 0,0",c,g.g.A.Va(-d-a,c-d)),f=g.g.A.arc("a","0 0,0",c+a,g.g.A.Va(c+a,c+a)),h=g.g.A.moveBy(d,-d)+g.g.A.arc("a","0 0,0",c+a,g.g.A.Va(c-d,d+a));return{width:c+a,height:c,Bu:function(k){return k?e:""},$p:function(k){return k?f:h}}}
function pd(a){var c=a.Ck.zb;a=a.rh;var d=(1-Math.SQRT1_2)*(c-a)+a,e=g.g.A.moveBy(d,d)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Va(c-d,-d+a)),f=g.g.A.moveBy(a,c)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Va(c,-c+a)),h=-d,k=g.g.A.moveBy(d,h)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Va(-d+a,-h-c));return{height:c,iv:function(l){return l?e:f},hs:function(){return k}}}
g.na.Il.prototype.Yt=function(){var a=this.Ck.xh,c=this.Ck.Jr,d=g.g.A.moveBy(-2,-c+3.4)+g.g.A.lineTo(-.45*a,-2.1),e=g.g.A.ea("v",2.5)+g.g.A.moveBy(.97*-a,2.5)+g.g.A.curve("q",[g.g.A.Va(.05*-a,10),g.g.A.Va(.3*a,9.5)])+g.g.A.moveBy(.67*a,-1.9)+g.g.A.ea("v",2.5),f=g.g.A.ea("v",-1.5)+g.g.A.moveBy(-.92*a,-.5)+g.g.A.curve("q",[g.g.A.Va(-.19*a,-5.5),g.g.A.Va(0,-11)])+g.g.A.moveBy(.92*a,1),h=g.g.A.moveBy(-5,c-.7)+g.g.A.lineTo(.46*a,-2.1);return{width:a,height:c,pn:function(k){return k?d:f},Se:function(k){return k?
e:h}}};g.na.Il.prototype.Xt=function(){return{ji:g.g.A.ea("h",this.rh)+this.Ck.mk.ji}};g.na.Il.prototype.Wt=function(){return{ji:g.g.A.lineTo(5.1,2.6)+g.g.A.moveBy(-10.2,6.8)+g.g.A.lineTo(5.1,2.6)}};g.na.Il.prototype.Zt=function(){var a=this.Ck.Bg.height,c=g.g.A.moveBy(25,-8.7)+g.g.A.curve("c",[g.g.A.Va(29.7,-6.2),g.g.A.Va(57.2,-.5),g.g.A.Va(75,8.7)]),d=g.g.A.curve("c",[g.g.A.Va(17.8,-9.2),g.g.A.Va(45.3,-14.9),g.g.A.Va(75,-8.7)])+g.g.A.moveTo(100.5,a+.5);return{path:function(e){return e?c:d}}};g.na.vh=function(){g.na.vh.w.constructor.call(this);this.pf=null};g.g.object.W(g.na.vh,g.m.vh);b=g.na.vh.prototype;b.S=function(){g.na.vh.w.S.call(this);this.pf=new g.na.Il(this.C)};b.iz=function(){return new g.na.Bi};b.lz=function(a){return new g.na.uh(this,a)};b.jz=function(a,c){return new g.na.fd(a,c)};b.kz=function(a){return new g.na.Ki(a)};g.m.register("geras",g.na.vh);g.h.ADD_COMMENT="Adicionar coment\u00e1rio";g.h.CANNOT_DELETE_VARIABLE_PROCEDURE="N\u00e3o se pode deletar a vari\u00e1vel '%1' porque \u00e9 parte da defini\u00e7\u00e3o da fun\u00e7\u00e3o '%2'";g.h.CHANGE_VALUE_TITLE="Mudar valor:";g.h.CLEAN_UP="Limpar blocos";g.h.COLLAPSED_WARNINGS_WARNING="Bloqueios recolhidos cont\u00eam avisos.";g.h.COLLAPSE_ALL="Colapsar Blocos";g.h.COLLAPSE_BLOCK="Colapsar Bloco";g.h.COLOUR_BLEND_COLOUR1="cor 1";g.h.COLOUR_BLEND_COLOUR2="cor 2";g.h.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp";
g.h.COLOUR_BLEND_RATIO="propor\u00e7\u00e3o";g.h.COLOUR_BLEND_TITLE="misturar";g.h.COLOUR_BLEND_TOOLTIP="Mistura duas cores em uma dada propor\u00e7\u00e3o (0,0 - 1,0).";g.h.COLOUR_PICKER_HELPURL="https://pt.wikipedia.org/wiki/Cor";g.h.COLOUR_PICKER_TOOLTIP="Escolher uma cor da palheta de cores.";g.h.COLOUR_RANDOM_HELPURL="http://randomcolour.com";g.h.COLOUR_RANDOM_TITLE="cor aleat\u00f3ria";g.h.COLOUR_RANDOM_TOOLTIP="Escolher cor de forma aleat\u00f3ria.";g.h.COLOUR_RGB_BLUE="azul";
g.h.COLOUR_RGB_GREEN="verde";g.h.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html";g.h.COLOUR_RGB_RED="vermelho";g.h.COLOUR_RGB_TITLE="colorir com";g.h.COLOUR_RGB_TOOLTIP="Criar uma cor com a quantidade especificada de vermelho, verde e azul. Todos os valores devem estar entre 0 e 100.";g.h.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/google/blockly/wiki/Loops#loop-termination-blocks";g.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="encerra o la\u00e7o";
g.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continua com a pr\u00f3xima itera\u00e7\u00e3o do la\u00e7o";g.h.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="Encerra o la\u00e7o.";g.h.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="Ignora o resto deste la\u00e7o, e continua com a pr\u00f3xima itera\u00e7\u00e3o.";g.h.CONTROLS_FLOW_STATEMENTS_WARNING="Aten\u00e7\u00e3o: Este bloco s\u00f3 pode ser usado dentro de um la\u00e7o.";g.h.CONTROLS_FOREACH_HELPURL="https://github.com/google/blockly/wiki/Loops#for-each";
g.h.CONTROLS_FOREACH_TITLE="para cada item %1 na lista %2";g.h.CONTROLS_FOREACH_TOOLTIP="Para cada item em uma lista, atribua o item \u00e0 vari\u00e1vel '%1' e ent\u00e3o realize algumas instru\u00e7\u00f5es.";g.h.CONTROLS_FOR_HELPURL="https://github.com/google/blockly/wiki/Loops#count-with";g.h.CONTROLS_FOR_TITLE="contar com %1 de %2 at\u00e9 %3 por %4";g.h.CONTROLS_FOR_TOOLTIP="Fa\u00e7a com que a vari\u00e1vel '%1' assuma os valores do n\u00famero inicial ao n\u00famero final, contando de acordo com o intervalo especificado e execute os blocos especificados.";
g.h.CONTROLS_IF_ELSEIF_TOOLTIP="Acrescente uma condi\u00e7\u00e3o para o bloco se.";g.h.CONTROLS_IF_ELSE_TOOLTIP="Acrescente uma condi\u00e7\u00e3o final para o bloco se.";g.h.CONTROLS_IF_HELPURL="https://github.com/google/blockly/wiki/IfElse";g.h.CONTROLS_IF_IF_TOOLTIP="Acrescente, remova ou reordene se\u00e7\u00f5es para reconfigurar este bloco.";g.h.CONTROLS_IF_MSG_ELSE="sen\u00e3o";g.h.CONTROLS_IF_MSG_ELSEIF="sen\u00e3o se";g.h.CONTROLS_IF_MSG_IF="se";g.h.CONTROLS_IF_TOOLTIP_1="Se um valor for verdadeiro, ent\u00e3o realize algumas instru\u00e7\u00f5es.";
g.h.CONTROLS_IF_TOOLTIP_2="Se um valor for verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es. Sen\u00e3o, realize o segundo bloco de instru\u00e7\u00f5es.";g.h.CONTROLS_IF_TOOLTIP_3="Se o primeiro valor \u00e9 verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es.  Sen\u00e3o, se o segundo valor \u00e9 verdadeiro, realize o segundo bloco de instru\u00e7\u00f5es.";g.h.CONTROLS_IF_TOOLTIP_4="Se o primeiro valor for verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es. Sen\u00e3o, se o segundo valor \u00e9 verdadeiro, realize o segundo bloco de instru\u00e7\u00f5es. Se nenhum dos blocos for verdadeiro, realize o \u00faltimo bloco de instru\u00e7\u00f5es.";
g.h.CONTROLS_REPEAT_HELPURL="https://pt.wikipedia.org/wiki/Estrutura_de_repeti%C3%A7%C3%A3o#Repeti.C3.A7.C3.A3o_com_vari.C3.A1vel_de_controle";g.h.CONTROLS_REPEAT_INPUT_DO="fa\u00e7a";g.h.CONTROLS_REPEAT_TITLE="repita %1 vezes";g.h.CONTROLS_REPEAT_TOOLTIP="Fa\u00e7a algumas instru\u00e7\u00f5es v\u00e1rias vezes.";g.h.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat";g.h.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="repita at\u00e9";g.h.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="repita enquanto";
g.h.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="Enquanto um valor for falso, ent\u00e3o fa\u00e7a algumas instru\u00e7\u00f5es.";g.h.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="Enquanto um valor for verdadeiro, ent\u00e3o fa\u00e7a algumas instru\u00e7\u00f5es.";g.h.DELETE_ALL_BLOCKS="Deletar todos os blocos %1?";g.h.DELETE_BLOCK="Deletar bloco";g.h.DELETE_VARIABLE="Deletar a vari\u00e1vel '%1'";g.h.DELETE_VARIABLE_CONFIRMATION="Deletar %1 usos da vari\u00e1vel '%2'?";g.h.DELETE_X_BLOCKS="Deletar %1 blocos";
g.h.DISABLE_BLOCK="Desabilitar bloco";g.h.DUPLICATE_BLOCK="Duplicar";g.h.DUPLICATE_COMMENT="Duplicar coment\u00e1rio";g.h.ENABLE_BLOCK="Habilitar bloco";g.h.EXPAND_ALL="Expandir blocos";g.h.EXPAND_BLOCK="Expandir bloco";g.h.EXTERNAL_INPUTS="Entradas externas";g.h.HELP="Ajuda";g.h.INLINE_INPUTS="Entradas incorporadas";g.h.IOS_CANCEL="blockly:IOS Cancelar/pt-br";g.h.IOS_ERROR="Erro";g.h.IOS_OK="Ok";g.h.IOS_PROCEDURES_ADD_INPUT="+ Adicionar Entrada";g.h.IOS_PROCEDURES_ALLOW_STATEMENTS="Permitir declara\u00e7\u00f5es";
g.h.IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR="Essa fun\u00e7\u00e3o tem entradas duplicadas.";g.h.IOS_PROCEDURES_INPUTS="ENTRADAS";g.h.IOS_VARIABLES_ADD_BUTTON="Adicionar";g.h.IOS_VARIABLES_ADD_VARIABLE="+ Adicionar Vari\u00e1vel";g.h.IOS_VARIABLES_DELETE_BUTTON="Deletar";g.h.IOS_VARIABLES_EMPTY_NAME_ERROR="Voc\u00ea n\u00e3o pode usar um nome de vari\u00e1vel vazio.";g.h.IOS_VARIABLES_RENAME_BUTTON="Blockly:Renomear varioas botoens/pt-br";g.h.IOS_VARIABLES_VARIABLE_NAME="Nome variavel";
g.h.LISTS_CREATE_EMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#create-empty-list";g.h.LISTS_CREATE_EMPTY_TITLE="criar lista vazia";g.h.LISTS_CREATE_EMPTY_TOOLTIP="Retorna uma lista, de tamanho 0, contendo nenhum registro";g.h.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="lista";g.h.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="Acrescenta, remove ou reordena se\u00e7\u00f5es para reconfigurar este bloco de lista.";g.h.LISTS_CREATE_WITH_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with";
g.h.LISTS_CREATE_WITH_INPUT_WITH="criar lista com";g.h.LISTS_CREATE_WITH_ITEM_TOOLTIP="Acrescenta um item \u00e0 lista.";g.h.LISTS_CREATE_WITH_TOOLTIP="Cria uma lista com a quantidade de itens informada.";g.h.LISTS_GET_INDEX_FIRST="primeiro";g.h.LISTS_GET_INDEX_FROM_END="n\u00ba a partir do final";g.h.LISTS_GET_INDEX_FROM_START="n\u00ba";g.h.LISTS_GET_INDEX_GET="obter";g.h.LISTS_GET_INDEX_GET_REMOVE="obter e remover";g.h.LISTS_GET_INDEX_LAST="\u00faltimo";g.h.LISTS_GET_INDEX_RANDOM="aleat\u00f3rio";
g.h.LISTS_GET_INDEX_REMOVE="remover";g.h.LISTS_GET_INDEX_TAIL="";g.h.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="Retorna o primeiro item em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_FROM="Retorna o item da lista na posi\u00e7\u00e3o especificada.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_LAST="Retorna o \u00faltimo item em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="Retorna um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="Remove e retorna o primeiro item de uma lista.";
g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="Remove e retorna o item na posi\u00e7\u00e3o especificada em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="Remove e retorna o \u00faltimo item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="Remove e retorna um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="Remove o primeiro item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="Remove o item na posi\u00e7\u00e3o especificada em uma lista.";
g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="Remove o \u00faltimo item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="Remove um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_SUBLIST_END_FROM_END="at\u00e9 n\u00ba a partir do final";g.h.LISTS_GET_SUBLIST_END_FROM_START="at\u00e9 n\u00ba";g.h.LISTS_GET_SUBLIST_END_LAST="at\u00e9 \u00faltimo";g.h.LISTS_GET_SUBLIST_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-a-sublist";g.h.LISTS_GET_SUBLIST_START_FIRST="obt\u00e9m sublista a partir do primeiro";
g.h.LISTS_GET_SUBLIST_START_FROM_END="obt\u00e9m sublista de n\u00ba a partir do final";g.h.LISTS_GET_SUBLIST_START_FROM_START="obt\u00e9m sublista de n\u00ba";g.h.LISTS_GET_SUBLIST_TAIL="";g.h.LISTS_GET_SUBLIST_TOOLTIP="Cria uma c\u00f3pia da por\u00e7\u00e3o especificada de uma lista.";g.h.LISTS_INDEX_FROM_END_TOOLTIP="%1 \u00e9 o \u00faltimo item.";g.h.LISTS_INDEX_FROM_START_TOOLTIP="%1 \u00e9 o primeiro item.";g.h.LISTS_INDEX_OF_FIRST="encontre a primeira ocorr\u00eancia do item";
g.h.LISTS_INDEX_OF_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list";g.h.LISTS_INDEX_OF_LAST="encontre a \u00faltima ocorr\u00eancia do item";g.h.LISTS_INDEX_OF_TOOLTIP="Retorna o \u00edndice da primeira/\u00faltima ocorr\u00eancia do item na lista.  Retorna %1 se o item n\u00e3o for encontrado.";g.h.LISTS_INLIST="na lista";g.h.LISTS_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#is-empty";g.h.LISTS_ISEMPTY_TITLE="%1 \u00e9 vazia";
g.h.LISTS_ISEMPTY_TOOLTIP="Retorna ao verdadeiro se a lista estiver vazia.";g.h.LISTS_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Lists#length-of";g.h.LISTS_LENGTH_TITLE="tamanho de %1";g.h.LISTS_LENGTH_TOOLTIP="Retorna o tamanho de uma lista.";g.h.LISTS_REPEAT_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with";g.h.LISTS_REPEAT_TITLE="criar lista com item %1 repetido %2 vezes";g.h.LISTS_REPEAT_TOOLTIP="Cria uma lista consistindo no valor informado repetido o n\u00famero de vezes especificado.";
g.h.LISTS_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Listas#invertendo-uma-lista";g.h.LISTS_REVERSE_MESSAGE0="inverter %1";g.h.LISTS_REVERSE_TOOLTIP="Inverter uma c\u00f3pia da lista.";g.h.LISTS_SET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#in-list--set";g.h.LISTS_SET_INDEX_INPUT_TO="como";g.h.LISTS_SET_INDEX_INSERT="inserir em";g.h.LISTS_SET_INDEX_SET="definir";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="Insere o item no in\u00edcio de uma lista.";
g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="Insere o item na posi\u00e7\u00e3o especificada em uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="Insere o item no final de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="Insere o item em uma posi\u00e7\u00e3o qualquer de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="Define o primeiro item de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_FROM="Define o item da posi\u00e7\u00e3o especificada de uma lista.";
g.h.LISTS_SET_INDEX_TOOLTIP_SET_LAST="Define o \u00faltimo item de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="Define um item aleat\u00f3rio de uma lista.";g.h.LISTS_SORT_HELPURL="https://github.com/google/blockly/wiki/Lists#sorting-a-list";g.h.LISTS_SORT_ORDER_ASCENDING="ascendente";g.h.LISTS_SORT_ORDER_DESCENDING="descendente";g.h.LISTS_SORT_TITLE="ordenar %1 %2 %3";g.h.LISTS_SORT_TOOLTIP="Ordenar uma c\u00f3pia de uma lista.";g.h.LISTS_SORT_TYPE_IGNORECASE="alfab\u00e9tico, ignorar mai\u00fascula/min\u00fascula";
g.h.LISTS_SORT_TYPE_NUMERIC="num\u00e9rico";g.h.LISTS_SORT_TYPE_TEXT="alfab\u00e9tico";g.h.LISTS_SPLIT_HELPURL="https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists";g.h.LISTS_SPLIT_LIST_FROM_TEXT="Fazer uma lista a partir do texto";g.h.LISTS_SPLIT_TEXT_FROM_LIST="fazer um texto a partir da lista";g.h.LISTS_SPLIT_TOOLTIP_JOIN="Juntar uma lista de textos em um \u00fanico texto, separado por um delimitador.";g.h.LISTS_SPLIT_TOOLTIP_SPLIT="Dividir o texto em uma lista de textos, separando-o em cada delimitador.";
g.h.LISTS_SPLIT_WITH_DELIMITER="com delimitador";g.h.LOGIC_BOOLEAN_FALSE="falso";g.h.LOGIC_BOOLEAN_HELPURL="https://github.com/google/blockly/wiki/Logic#values";g.h.LOGIC_BOOLEAN_TOOLTIP="Retorna verdadeiro ou falso.";g.h.LOGIC_BOOLEAN_TRUE="verdadeiro";g.h.LOGIC_COMPARE_HELPURL="https://pt.wikipedia.org/wiki/Inequa%C3%A7%C3%A3o";g.h.LOGIC_COMPARE_TOOLTIP_EQ="Retorna verdadeiro se ambas as entradas forem iguais.";g.h.LOGIC_COMPARE_TOOLTIP_GT="Retorna verdadeiro se a primeira entrada for maior que a segunda entrada.";
g.h.LOGIC_COMPARE_TOOLTIP_GTE="Retorna verdadeiro se a primeira entrada for maior ou igual \u00e0 segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_LT="Retorna verdadeiro se a primeira entrada for menor que a segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_LTE="Retorna verdadeiro se a primeira entrada for menor ou igual \u00e0 segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_NEQ="Retorna verdadeiro se ambas as entradas forem diferentes.";g.h.LOGIC_NEGATE_HELPURL="https://github.com/google/blockly/wiki/Logic#not";
g.h.LOGIC_NEGATE_TITLE="n\u00e3o %1";g.h.LOGIC_NEGATE_TOOLTIP="Retorna verdadeiro se a entrada for falsa.  Retorna falsa se a entrada for verdadeira.";g.h.LOGIC_NULL="nulo";g.h.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type";g.h.LOGIC_NULL_TOOLTIP="Retorna nulo.";g.h.LOGIC_OPERATION_AND="e";g.h.LOGIC_OPERATION_HELPURL="https://github.com/google/blockly/wiki/Logic#logical-operations";g.h.LOGIC_OPERATION_OR="ou";g.h.LOGIC_OPERATION_TOOLTIP_AND="Retorna verdadeiro se ambas as entradas forem verdadeiras.";
g.h.LOGIC_OPERATION_TOOLTIP_OR="Retorna verdadeiro se uma das estradas for verdadeira.";g.h.LOGIC_TERNARY_CONDITION="teste";g.h.LOGIC_TERNARY_HELPURL="https://en.wikipedia.org/wiki/%3F:";g.h.LOGIC_TERNARY_IF_FALSE="se falso";g.h.LOGIC_TERNARY_IF_TRUE="se verdadeiro";g.h.LOGIC_TERNARY_TOOLTIP='Avalia a condi\u00e7\u00e3o em "teste". Se a condi\u00e7\u00e3o for verdadeira retorna o valor "se verdadeiro", sen\u00e3o retorna o valor "se falso".';g.h.MATH_ADDITION_SYMBOL="+";
g.h.MATH_ARITHMETIC_HELPURL="https://pt.wikipedia.org/wiki/Aritm%C3%A9tica";g.h.MATH_ARITHMETIC_TOOLTIP_ADD="Retorna a soma dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_DIVIDE="Retorna o quociente da divis\u00e3o dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_MINUS="Retorna a diferen\u00e7a entre os dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="Retorna o produto dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_POWER="Retorna o primeiro n\u00famero elevado \u00e0 pot\u00eancia do segundo n\u00famero.";
g.h.MATH_ATAN2_HELPURL="https://en.wikipedia.org/wiki/Atan2";g.h.MATH_ATAN2_TITLE="atan2 de X:%1 Y:%2";g.h.MATH_ATAN2_TOOLTIP="Retorne o arco tangente do ponto (X, Y) em graus de -180 a 180.";g.h.MATH_CHANGE_HELPURL="https://pt.wikipedia.org/wiki/Adi%C3%A7%C3%A3o";g.h.MATH_CHANGE_TITLE="alterar %1 por %2";g.h.MATH_CHANGE_TOOLTIP='Soma um n\u00famero \u00e0 vari\u00e1vel "%1".';g.h.MATH_CONSTANT_HELPURL="https://pt.wikipedia.org/wiki/Anexo:Lista_de_constantes_matem%C3%A1ticas";
g.h.MATH_CONSTANT_TOOLTIP="Retorna uma das constantes comuns: \u03c0 (3.141\u2026), e (2.718\u2026), \u03c6 (1.618\u2026), sqrt(2) (1.414\u2026), sqrt(\u00bd) (0.707\u2026), ou \u221e (infinito).";g.h.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)";g.h.MATH_CONSTRAIN_TITLE="restringe %1 inferior %2 superior %3";g.h.MATH_CONSTRAIN_TOOLTIP="Restringe um n\u00famero entre os limites especificados (inclusivo).";g.h.MATH_DIVISION_SYMBOL="\u00f7";g.h.MATH_IS_DIVISIBLE_BY="\u00e9 divis\u00edvel por";
g.h.MATH_IS_EVEN="\u00e9 par";g.h.MATH_IS_NEGATIVE="\u00e9 negativo";g.h.MATH_IS_ODD="\u00e9 \u00edmpar";g.h.MATH_IS_POSITIVE="\u00e9 positivo";g.h.MATH_IS_PRIME="\u00e9 primo";g.h.MATH_IS_TOOLTIP="Verifica se um n\u00famero \u00e9 par, \u00edmpar, inteiro, positivo, negativo, ou se \u00e9 divis\u00edvel por outro n\u00famero.  Retorna verdadeiro ou falso.";g.h.MATH_IS_WHOLE="\u00e9 inteiro";g.h.MATH_MODULO_HELPURL="https://pt.wikipedia.org/wiki/Opera%C3%A7%C3%A3o_m%C3%B3dulo";
g.h.MATH_MODULO_TITLE="resto da divis\u00e3o de %1 \u00f7 %2";g.h.MATH_MODULO_TOOLTIP="Retorna o resto da divis\u00e3o de dois n\u00fameros.";g.h.MATH_MULTIPLICATION_SYMBOL="\u00d7";g.h.MATH_NUMBER_HELPURL="https://pt.wikipedia.org/wiki/N%C3%BAmero";g.h.MATH_NUMBER_TOOLTIP="Um n\u00famero.";g.h.MATH_ONLIST_HELPURL="";g.h.MATH_ONLIST_OPERATOR_AVERAGE="m\u00e9dia da lista";g.h.MATH_ONLIST_OPERATOR_MAX="maior da lista";g.h.MATH_ONLIST_OPERATOR_MEDIAN="mediana da lista";g.h.MATH_ONLIST_OPERATOR_MIN="menor da lista";
g.h.MATH_ONLIST_OPERATOR_MODE="moda da lista";g.h.MATH_ONLIST_OPERATOR_RANDOM="item aleat\u00f3rio da lista";g.h.MATH_ONLIST_OPERATOR_STD_DEV="desvio padr\u00e3o da lista";g.h.MATH_ONLIST_OPERATOR_SUM="soma de uma lista";g.h.MATH_ONLIST_TOOLTIP_AVERAGE="Retorna a m\u00e9dia aritm\u00e9tica dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_MAX="Retorna o maior n\u00famero da lista.";g.h.MATH_ONLIST_TOOLTIP_MEDIAN="Retorna a mediana dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_MIN="Retorna o menor n\u00famero da lista.";
g.h.MATH_ONLIST_TOOLTIP_MODE="Retorna uma lista do(s) item(ns) mais comum(ns) da lista.";g.h.MATH_ONLIST_TOOLTIP_RANDOM="Retorna um elemento aleat\u00f3rio da lista.";g.h.MATH_ONLIST_TOOLTIP_STD_DEV="Retorna o desvio padr\u00e3o dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_SUM="Retorna a soma de todos os n\u00fameros na lista.";g.h.MATH_POWER_SYMBOL="^";g.h.MATH_RANDOM_FLOAT_HELPURL="https://pt.wikipedia.org/wiki/Gerador_de_n%C3%BAmeros_pseudoaleat%C3%B3rios";
g.h.MATH_RANDOM_FLOAT_TITLE_RANDOM="fra\u00e7\u00e3o aleat\u00f3ria";g.h.MATH_RANDOM_FLOAT_TOOLTIP="Retorna uma fra\u00e7\u00e3o aleat\u00f3ria entre 0.0 (inclusivo) e 1.0 (exclusivo).";g.h.MATH_RANDOM_INT_HELPURL="https://pt.wikipedia.org/wiki/Gerador_de_n%C3%BAmeros_pseudoaleat%C3%B3rios";g.h.MATH_RANDOM_INT_TITLE="inteiro aleat\u00f3rio entre %1 e %2";g.h.MATH_RANDOM_INT_TOOLTIP="Retorna um n\u00famero inteiro entre os dois limites informados, inclusivo.";g.h.MATH_ROUND_HELPURL="https://pt.wikipedia.org/wiki/Arredondamento";
g.h.MATH_ROUND_OPERATOR_ROUND="arredonda";g.h.MATH_ROUND_OPERATOR_ROUNDDOWN="arredonda para baixo";g.h.MATH_ROUND_OPERATOR_ROUNDUP="arredonda para cima";g.h.MATH_ROUND_TOOLTIP="Arredonda um n\u00famero para cima ou para baixo.";g.h.MATH_SINGLE_HELPURL="https://pt.wikipedia.org/wiki/Raiz_quadrada";g.h.MATH_SINGLE_OP_ABSOLUTE="absoluto";g.h.MATH_SINGLE_OP_ROOT="raiz quadrada";g.h.MATH_SINGLE_TOOLTIP_ABS="Retorna o valor absoluto de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_EXP="Retorna o n\u00famero e elevado \u00e0 pot\u00eancia de um n\u00famero.";
g.h.MATH_SINGLE_TOOLTIP_LN="Retorna o logaritmo natural de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_LOG10="Retorna o logaritmo em base 10 de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_NEG="Retorna o oposto de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_POW10="Retorna 10 elevado \u00e0 pot\u00eancia de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_ROOT="Retorna a raiz quadrada de um n\u00famero.";g.h.MATH_SUBTRACTION_SYMBOL="-";g.h.MATH_TRIG_ACOS="acos";g.h.MATH_TRIG_ASIN="asin";g.h.MATH_TRIG_ATAN="atan";
g.h.MATH_TRIG_COS="cos";g.h.MATH_TRIG_HELPURL="https://pt.wikipedia.org/wiki/Fun%C3%A7%C3%A3o_trigonom%C3%A9trica";g.h.MATH_TRIG_SIN="sin";g.h.MATH_TRIG_TAN="tan";g.h.MATH_TRIG_TOOLTIP_ACOS="Retorna o arco cosseno de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_ASIN="Retorna o arco seno de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_ATAN="Retorna o arco tangente de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_COS="Retorna o cosseno de um grau (n\u00e3o radiano).";g.h.MATH_TRIG_TOOLTIP_SIN="Retorna o seno de um grau (n\u00e3o radiano).";
g.h.MATH_TRIG_TOOLTIP_TAN="Retorna a tangente de um grau (n\u00e3o radiano).";g.h.NEW_COLOUR_VARIABLE="Criar vari\u00e1vel colorida...";g.h.NEW_NUMBER_VARIABLE="Criar vari\u00e1vel num\u00e9rica...";g.h.NEW_STRING_VARIABLE="Criar vari\u00e1vel de segmentos de texto...";g.h.NEW_VARIABLE="Criar vari\u00e1vel...";g.h.NEW_VARIABLE_TITLE="Nome da nova vari\u00e1vel:";g.h.NEW_VARIABLE_TYPE_TITLE="Tipo da nova vari\u00e1vel:";g.h.ORDINAL_NUMBER_SUFFIX="";g.h.PROCEDURES_ALLOW_STATEMENTS="permitir declara\u00e7\u00f5es";
g.h.PROCEDURES_BEFORE_PARAMS="com:";g.h.PROCEDURES_CALLNORETURN_HELPURL="https://pt.wikipedia.org/wiki/Sub-rotina";g.h.PROCEDURES_CALLNORETURN_TOOLTIP='Executa a fun\u00e7\u00e3o definida pelo usu\u00e1rio "%1".';g.h.PROCEDURES_CALLRETURN_HELPURL="https://pt.wikipedia.org/wiki/Sub-rotina";g.h.PROCEDURES_CALLRETURN_TOOLTIP='Executa a fun\u00e7\u00e3o definida pelo usu\u00e1rio "%1" e usa seu retorno.';g.h.PROCEDURES_CALL_BEFORE_PARAMS="com:";g.h.PROCEDURES_CREATE_DO='Criar "%1"';
g.h.PROCEDURES_DEFNORETURN_COMMENT="Descreva esta fun\u00e7\u00e3o...";g.h.PROCEDURES_DEFNORETURN_DO="";g.h.PROCEDURES_DEFNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine";g.h.PROCEDURES_DEFNORETURN_PROCEDURE="fa\u00e7a algo";g.h.PROCEDURES_DEFNORETURN_TITLE="para";g.h.PROCEDURES_DEFNORETURN_TOOLTIP="Cria uma fun\u00e7\u00e3o que n\u00e3o tem retorno.";g.h.PROCEDURES_DEFRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine";g.h.PROCEDURES_DEFRETURN_RETURN="retorna";
g.h.PROCEDURES_DEFRETURN_TOOLTIP="Cria uma fun\u00e7\u00e3o que possui um valor de retorno.";g.h.PROCEDURES_DEF_DUPLICATE_WARNING="Aten\u00e7\u00e3o: Esta fun\u00e7\u00e3o tem par\u00e2metros duplicados.";g.h.PROCEDURES_HIGHLIGHT_DEF="Destacar defini\u00e7\u00e3o da fun\u00e7\u00e3o";g.h.PROCEDURES_IFRETURN_HELPURL="http://c2.com/cgi/wiki?GuardClause";g.h.PROCEDURES_IFRETURN_TOOLTIP="Se um valor \u00e9 verdadeiro, ent\u00e3o retorna um valor.";g.h.PROCEDURES_IFRETURN_WARNING="Aten\u00e7\u00e3o: Este bloco s\u00f3 pode ser utilizado dentro da defini\u00e7\u00e3o de uma fun\u00e7\u00e3o.";
g.h.PROCEDURES_MUTATORARG_TITLE="nome da entrada:";g.h.PROCEDURES_MUTATORARG_TOOLTIP="Adiciona uma entrada para esta fun\u00e7\u00e3o";g.h.PROCEDURES_MUTATORCONTAINER_TITLE="entradas";g.h.PROCEDURES_MUTATORCONTAINER_TOOLTIP="Adiciona, remove, ou reordena as entradas para esta fun\u00e7\u00e3o.";g.h.REDO="Refazer";g.h.REMOVE_COMMENT="Remover coment\u00e1rio";g.h.RENAME_VARIABLE="Renomear vari\u00e1vel...";g.h.RENAME_VARIABLE_TITLE="Renomear todas as vari\u00e1veis '%1' para:";
g.h.TEXT_APPEND_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification";g.h.TEXT_APPEND_TITLE="para %1 anexar texto %2";g.h.TEXT_APPEND_TOOLTIP='Acrescentar um peda\u00e7o de texto \u00e0 vari\u00e1vel "%1".';g.h.TEXT_CHANGECASE_HELPURL="https://github.com/google/blockly/wiki/Text#adjusting-text-case";g.h.TEXT_CHANGECASE_OPERATOR_LOWERCASE="para min\u00fasculas";g.h.TEXT_CHANGECASE_OPERATOR_TITLECASE="para Nomes Pr\u00f3prios";g.h.TEXT_CHANGECASE_OPERATOR_UPPERCASE="para MAI\u00daSCULAS";
g.h.TEXT_CHANGECASE_TOOLTIP="Retorna uma c\u00f3pia do texto em um formato diferente.";g.h.TEXT_CHARAT_FIRST="obter primeira letra";g.h.TEXT_CHARAT_FROM_END="obter letra # a partir do final";g.h.TEXT_CHARAT_FROM_START="obter letra n\u00ba";g.h.TEXT_CHARAT_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-text";g.h.TEXT_CHARAT_LAST="obter \u00faltima letra";g.h.TEXT_CHARAT_RANDOM="obter letra aleat\u00f3ria";g.h.TEXT_CHARAT_TAIL="";g.h.TEXT_CHARAT_TITLE="no texto %1 %2";
g.h.TEXT_CHARAT_TOOLTIP="Retorna a letra na posi\u00e7\u00e3o especificada.";g.h.TEXT_COUNT_HELPURL="https://github.com/google/blockly/wiki/Text#counting-substrings";g.h.TEXT_COUNT_MESSAGE0="Contar %1 em %2";g.h.TEXT_COUNT_TOOLTIP="Calcule quantas vezes algum texto aparece centro de algum outro texto.";g.h.TEXT_CREATE_JOIN_ITEM_TOOLTIP="Acrescentar um item ao texto.";g.h.TEXT_CREATE_JOIN_TITLE_JOIN="unir";g.h.TEXT_CREATE_JOIN_TOOLTIP="Acrescenta, remove ou reordena se\u00e7\u00f5es para reconfigurar este bloco de texto.";
g.h.TEXT_GET_SUBSTRING_END_FROM_END="at\u00e9 letra n\u00ba a partir do final";g.h.TEXT_GET_SUBSTRING_END_FROM_START="at\u00e9 letra n\u00ba";g.h.TEXT_GET_SUBSTRING_END_LAST="at\u00e9 \u00faltima letra";g.h.TEXT_GET_SUBSTRING_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text";g.h.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="no texto";g.h.TEXT_GET_SUBSTRING_START_FIRST="obter trecho de primeira letra";g.h.TEXT_GET_SUBSTRING_START_FROM_END="obter trecho de letra n\u00ba a partir do final";
g.h.TEXT_GET_SUBSTRING_START_FROM_START="obter trecho de letra n\u00ba";g.h.TEXT_GET_SUBSTRING_TAIL="";g.h.TEXT_GET_SUBSTRING_TOOLTIP="Retorna o trecho de texto especificado.";g.h.TEXT_INDEXOF_HELPURL="https://github.com/google/blockly/wiki/Text#finding-text";g.h.TEXT_INDEXOF_OPERATOR_FIRST="encontre a primeira ocorr\u00eancia do item";g.h.TEXT_INDEXOF_OPERATOR_LAST="encontre a \u00faltima ocorr\u00eancia do texto";g.h.TEXT_INDEXOF_TITLE="no texto %1 %2 %3";g.h.TEXT_INDEXOF_TOOLTIP="Retorna a posi\u00e7\u00e3o da primeira/\u00faltima ocorr\u00eancia do primeiro texto no segundo texto.  Retorna %1 se o texto n\u00e3o for encontrado.";
g.h.TEXT_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Text#checking-for-empty-text";g.h.TEXT_ISEMPTY_TITLE="%1 \u00e9 vazio";g.h.TEXT_ISEMPTY_TOOLTIP="Retorna verdadeiro se o texto fornecido for vazio.";g.h.TEXT_JOIN_HELPURL="https://github.com/google/blockly/wiki/Text#text-creation";g.h.TEXT_JOIN_TITLE_CREATEWITH="criar texto com";g.h.TEXT_JOIN_TOOLTIP="Criar um peda\u00e7o de texto juntando qualquer n\u00famero de itens.";g.h.TEXT_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification";
g.h.TEXT_LENGTH_TITLE="tamanho de %1";g.h.TEXT_LENGTH_TOOLTIP="Retorna o n\u00famero de letras (incluindo espa\u00e7os) no texto fornecido.";g.h.TEXT_PRINT_HELPURL="https://github.com/google/blockly/wiki/Text#printing-text";g.h.TEXT_PRINT_TITLE="imprime %1";g.h.TEXT_PRINT_TOOLTIP="Imprime o texto, n\u00famero ou valor especificado.";g.h.TEXT_PROMPT_HELPURL="https://github.com/google/blockly/wiki/Text#getting-input-from-the-user";g.h.TEXT_PROMPT_TOOLTIP_NUMBER="Pede ao usu\u00e1rio um n\u00famero.";
g.h.TEXT_PROMPT_TOOLTIP_TEXT="Pede ao usu\u00e1rio um texto.";g.h.TEXT_PROMPT_TYPE_NUMBER="Pede um n\u00famero com uma mensagem";g.h.TEXT_PROMPT_TYPE_TEXT="Pede um texto com uma mensagem";g.h.TEXT_REPLACE_HELPURL="https://github.com/google/blockly/wiki/Texto#substituindo-substrings";g.h.TEXT_REPLACE_MESSAGE0="substituir %1 por %2 em %3";g.h.TEXT_REPLACE_TOOLTIP="Substitua todas as ocorr\u00eancias de algum texto dentro de algum outro texto.";g.h.TEXT_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Texto#invertendo-texto";
g.h.TEXT_REVERSE_MESSAGE0="inverter %1";g.h.TEXT_REVERSE_TOOLTIP="Inverter a ordem dos caracteres no texto.";g.h.TEXT_TEXT_HELPURL="https://pt.wikipedia.org/wiki/Cadeia_de_caracteres";g.h.TEXT_TEXT_TOOLTIP="Uma letra, palavra ou linha de texto.";g.h.TEXT_TRIM_HELPURL="https://github.com/google/blockly/wiki/Text#trimming-removing-spaces";g.h.TEXT_TRIM_OPERATOR_BOTH="remover espa\u00e7os de ambos os lados de";g.h.TEXT_TRIM_OPERATOR_LEFT="remover espa\u00e7os \u00e0 esquerda de";
g.h.TEXT_TRIM_OPERATOR_RIGHT="remover espa\u00e7os \u00e0 direita de";g.h.TEXT_TRIM_TOOLTIP="Retorna uma c\u00f3pia do texto com os espa\u00e7os removidos de uma ou ambas extremidades.";g.h.TODAY="Hoje";g.h.UNDO="Desfazer";g.h.UNNAMED_KEY="Sem t\u00edtulo";g.h.VARIABLES_DEFAULT_NAME="item";g.h.VARIABLES_GET_CREATE_SET='Criar "definir %1"';g.h.VARIABLES_GET_HELPURL="https://github.com/google/blockly/wiki/Variables#get";g.h.VARIABLES_GET_TOOLTIP="Retorna o valor desta vari\u00e1vel.";
g.h.VARIABLES_SET="definir %1 para %2";g.h.VARIABLES_SET_CREATE_GET='Criar "obter %1"';g.h.VARIABLES_SET_HELPURL="https://github.com/google/blockly/wiki/Variables#set";g.h.VARIABLES_SET_TOOLTIP="Define esta vari\u00e1vel para o valor da entrada.";g.h.VARIABLE_ALREADY_EXISTS="A vari\u00e1vel chamada '%1' j\u00e1 existe.";g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="J\u00e1 existe uma vari\u00e1vel chamada '%1' para outra do tipo: '%2'.";g.h.WORKSPACE_COMMENT_DEFAULT_TEXT="Diz algo...";
g.h.CONTROLS_FOREACH_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_FOR_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=g.h.CONTROLS_IF_MSG_ELSEIF;g.h.CONTROLS_IF_ELSE_TITLE_ELSE=g.h.CONTROLS_IF_MSG_ELSE;g.h.CONTROLS_IF_IF_TITLE_IF=g.h.CONTROLS_IF_MSG_IF;g.h.CONTROLS_IF_MSG_THEN=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_WHILEUNTIL_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.LISTS_CREATE_WITH_ITEM_TITLE=g.h.VARIABLES_DEFAULT_NAME;g.h.LISTS_GET_INDEX_HELPURL=g.h.LISTS_INDEX_OF_HELPURL;
g.h.LISTS_GET_INDEX_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_GET_SUBLIST_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_INDEX_OF_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_SET_INDEX_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.MATH_CHANGE_TITLE_ITEM=g.h.VARIABLES_DEFAULT_NAME;g.h.PROCEDURES_DEFRETURN_COMMENT=g.h.PROCEDURES_DEFNORETURN_COMMENT;g.h.PROCEDURES_DEFRETURN_DO=g.h.PROCEDURES_DEFNORETURN_DO;g.h.PROCEDURES_DEFRETURN_PROCEDURE=g.h.PROCEDURES_DEFNORETURN_PROCEDURE;g.h.PROCEDURES_DEFRETURN_TITLE=g.h.PROCEDURES_DEFNORETURN_TITLE;
g.h.TEXT_APPEND_VARIABLE=g.h.VARIABLES_DEFAULT_NAME;g.h.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=g.h.VARIABLES_DEFAULT_NAME;g.h.MATH_HUE="230";g.h.LOOPS_HUE="120";g.h.LISTS_HUE="260";g.h.LOGIC_HUE="210";g.h.VARIABLES_HUE="330";g.h.TEXTS_HUE="160";g.h.PROCEDURES_HUE="290";g.h.COLOUR_HUE="20";g.h.VARIABLES_DYNAMIC_HUE="310";var V={zd:null,S:function(){Vc();var a=document.getElementById("linkButton");"BlocklyStorage"in window?(BlocklyStorage.HTTPREQUEST_ERROR=S("Games_httpRequestError"),BlocklyStorage.LINK_ALERT=S("Games_linkAlert"),BlocklyStorage.HASH_ERROR=S("Games_hashError"),BlocklyStorage.XML_ERROR=S("Games_xmlError"),BlocklyStorage.alert=U.qA.bind(U,a),a&&Zc(a,BlocklyStorage.link)):a&&(a.style.display="none");(a=document.getElementById("languageMenu"))&&a.addEventListener("change",V.JD,!0);g.L&&(g.L.vC=!1);g.j&&
(g.j.vC=!1)},qM:function(a,c){if("BlocklyStorage"in window&&1<window.location.hash.length)BlocklyStorage.retrieveXml(window.location.hash.substring(1));else{var d=null;try{d=window.sessionStorage.hz}catch(h){}d&&delete window.sessionStorage.hz;var e=Wc(R),f=c&&Wc(R-1);f&&"function"==typeof c&&(f=c(f));(a=d||e||f||a)&&V.dA(a)}},dA:function(a){V.zd?V.zd.setValue(a,-1):(a=g.R.jh(a),B.clear(),g.R.Qg(a,B),hb())},kt:function(){if(V.zd)var a=V.zd.getValue();else{a=g.R.EA(!0);if(1==D(B,!1).length&&a.querySelector){var c=
a.querySelector("block");c&&(c.removeAttribute("x"),c.removeAttribute("y"))}a=g.R.Rd(a)}return a},Kk:function(){return B},yM:function(){window.localStorage&&(window.localStorage[Yc+R]=V.kt())},Ep:function(){window.location=(Qc?"index.html":"./")+"?lang="+Oc},JD:function(){if(window.sessionStorage){if(V.zd)var a=V.zd.getValue();else a=g.R.EA(),a=g.R.Rd(a);window.sessionStorage.hz=a}a=document.getElementById("languageMenu");a=encodeURIComponent(a.options[a.selectedIndex].value);var c=window.location.search;
c=1>=c.length?"?lang="+a:c.match(/[?&]lang=[^&]*/)?c.replace(/([?&]lang=)[^&]*/,"$1"+a):c.replace(/\?/,"?lang="+a+"&");window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+c},ku:function(){10>R?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+Oc+"&level="+(R+1):V.Ep()},Sy:function(a,c){if(a){var d=a.match(/^block_id_([^']+)$/);d&&(a=d[1])}var e=a;a=B;if(void 0===c){for(var f=0;d=a.Om[f];f++)d.hh(!1);a.Om.length=
0}if(d=e?w(a,e):null)(c=void 0===c||c)?-1==a.Om.indexOf(d)&&a.Om.push(d):g.g.Qo(a.Om,d),d.hh(c)},fM:function(a,c){a=document.getElementById(a);a.firstChild||(a=g.Th(a,{rtl:-1!=Nc.indexOf(Oc),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),g.R.Qg(g.R.jh(c),a))},oH:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},Uf:function(a){if("click"==a.type&&"touchend"==V.Uf.Hu&&V.Uf.Fu+2E3>Date.now()||V.Uf.Hu==a.type&&V.Uf.Fu+400>Date.now())return a.preventDefault(),a.stopPropagation(),
!0;V.Uf.Hu=a.type;V.Uf.Fu=Date.now();return!1}};V.Uf.Hu=null;V.Uf.Fu=0;V.EF=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};V.FF=function(){var a=document.createElement("link");a.rel="stylesheet";a.type="text/css";a.href="common/prettify.css";document.head.appendChild(a);a=document.createElement("script");a.type="text/javascript";a.src="common/prettify.js";document.head.appendChild(a)};
window.BlocklyInterface=V;V.setCode=V.dA;V.getCode=V.kt;V.getWorkspace=V.Kk;var U={pj:!1,Ix:null,fp:null,pq:function(a,c,d,e,f,h){function k(){U.pj&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);U.pj&&U.me(!1);g.Db()&&g.rc(!0);U.pj=!0;U.Ix=c;U.fp=h;var l=document.getElementById("dialog");h=document.getElementById("dialogShadow");var m=document.getElementById("dialogBorder"),n;for(n in f)l.style[n]=f[n];e&&(h.style.visibility="visible",h.style.opacity=.3,h.style.zIndex=9,e=document.createElement("div"),
e.id="dialogHeader",l.appendChild(e),U.Es=g.hd(e,"mousedown",null,U.rE));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(U.bi(c,!1,.2),U.bi(l,!0,.8),setTimeout(k,175)):k()},Jx:0,Kx:0,rE:function(a){U.Hs();if(!g.g.tj(a)){var c=document.getElementById("dialog");U.Jx=c.offsetLeft-a.clientX;U.Kx=c.offsetTop-a.clientY;U.Gs=g.hd(document,"mouseup",null,U.Hs);U.Fs=g.hd(document,"mousemove",null,U.sE);a.stopPropagation()}},sE:function(a){var c=document.getElementById("dialog"),
d=U.Jx+a.clientX;a=U.Kx+a.clientY;a=Math.max(a,0);a=Math.min(a,window.innerHeight-c.offsetHeight);d=Math.max(d,0);d=Math.min(d,window.innerWidth-c.offsetWidth);c.style.left=d+"px";c.style.top=a+"px"},Hs:function(){U.Gs&&(g.Xa(U.Gs),U.Gs=null);U.Fs&&(g.Xa(U.Fs),U.Fs=null)},me:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(U.pj){U.Hs();U.Es&&(g.Xa(U.Es),U.Es=null);U.pj=!1;U.fp&&U.fp();U.fp=null;var d=!1===a?
null:U.Ix;a=document.getElementById("dialog");var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(U.bi(a,!1,.8),U.bi(d,!0,.2),setTimeout(c,175)):c();a.style.visibility="hidden";a.style.zIndex=-1;for((d=document.getElementById("dialogHeader"))&&d.parentNode.removeChild(d);a.firstChild;)d=a.firstChild,d.className+=" dialogHiddenContent",document.body.appendChild(d)}},bi:function(a,c,d){function e(){f.style.width=h.width+"px";f.style.height=h.height+"px";f.style.left=h.x+"px";f.style.top=
h.y+"px";f.style.opacity=d}if(a){var f=document.getElementById("dialogBorder"),h=U.SE(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},SE:function(a){var c=g.g.style.wp(a);c={x:c.x,y:c.y};a.getBBox?(a=a.getBBox(),c.height=a.height,c.width=a.width):(c.height=a.offsetHeight,c.width=a.offsetWidth);return c},qA:function(a,c){var d=document.getElementById("containerStorage");d.textContent="";c=c.split("\n");for(var e=0;e<c.length;e++){var f=document.createElement("p");
f.appendChild(document.createTextNode(c[e]));d.appendChild(f)}d=document.getElementById("dialogStorage");U.pq(d,a,!0,!0,{width:"50%",left:"25%",top:"5em"},U.nH);U.iH()},nD:function(){if(!Wc(R))if(U.pj||B.ic())setTimeout(U.nD,15E3);else{var a=document.getElementById("dialogAbort"),c=document.getElementById("abortCancel");c.addEventListener("click",U.me,!0);c.addEventListener("touchend",U.me,!0);c=document.getElementById("abortOk");c.addEventListener("click",V.Ep,!0);c.addEventListener("touchend",V.Ep,
!0);U.pq(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",U.Pw,!0)});document.body.addEventListener("keydown",U.Pw,!0)}},iA:function(){document.getElementById("galleryXml").value=V.kt();var a=document.getElementById("galleryDialog");if(!U.iA.WG){var c=document.getElementById("galleryCancel");c.addEventListener("click",U.me,!0);c.addEventListener("touchend",U.me,!0);c=document.getElementById("galleryOk");c.addEventListener("click",U.et,!0);c.addEventListener("touchend",
U.et,!0);U.iA.WG=!0}c=document.getElementById("submitButton");U.pq(a,c,!0,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",U.jy,!0)});document.body.addEventListener("keydown",U.jy,!0);setTimeout(function(){document.getElementById("galleryTitle").focus()},250)},XL:function(){var a=document.getElementById("dialogDone");if(B){var c=document.getElementById("dialogLinesText");c.textContent="";var d=qd();d=V.oH(d);var e=d.replace(/\/\/[^\n]*/g,"");e=e.replace(/\/\*.*\*\//g,
"");e=e.replace(/[ \t]+\n/g,"\n");e=e.replace(/\n+/g,"\n");e=e.trim();e=e.split("\n").length;var f=document.getElementById("containerCode");f.textContent=d;"function"==typeof prettyPrintOne&&(d=f.innerHTML,d=prettyPrintOne(d,"js"),f.innerHTML=d);d=1==e?S("Games_linesOfCode1"):S("Games_linesOfCode2").replace("%1",String(e));c.appendChild(document.createTextNode(d))}d=10>R?S("Games_nextLevel").replace("%1",String(R+1)):S("Games_finalLevel");c=document.getElementById("doneCancel");c.addEventListener("click",
U.me,!0);c.addEventListener("touchend",U.me,!0);c=document.getElementById("doneOk");c.addEventListener("click",V.ku,!0);c.addEventListener("touchend",V.ku,!0);U.pq(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",U.ox,!0)});document.body.addEventListener("keydown",U.ox,!0);document.getElementById("dialogDoneText").textContent=d},Hx:function(a){!U.pj||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(U.me(!0),a.stopPropagation(),a.preventDefault())},
iH:function(){document.body.addEventListener("keydown",U.Hx,!0)},nH:function(){document.body.removeEventListener("keydown",U.Hx,!0)},ox:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)U.me(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&V.ku()},Pw:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)U.me(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&V.Ep()},jy:function(a){27==a.keyCode?U.me(!0):13==a.keyCode&&U.et()},et:function(){var a=document.getElementById("galleryTitle");
if(a.value.trim()){a=document.getElementById("galleryForm");for(var c=[],d=0,e;e=a.elements[d];d++)e.name&&(c[d]=encodeURIComponent(e.name)+"="+encodeURIComponent(e.value));var f=new XMLHttpRequest;f.open("POST",a.action);f.setRequestHeader("Content-type","application/x-www-form-urlencoded");f.onload=function(){if(4==f.readyState){var h=200==f.status?S("Games_submitted"):S("Games_httpRequestError")+"\nStatus: "+f.status;U.qA(null,h)}};f.send(c.join("&"));U.me(!0)}else a.value="",a.focus()}};
window.BlocklyDialogs=U;U.hideDialog=U.me;g.Comment=function(a){g.Comment.w.constructor.call(this,a);this.jc=a.Ee;this.jc.text=this.jc.text||"";this.os="";nc(this)};g.g.object.W(g.Comment,g.Ld);b=g.Comment.prototype;
b.Qs=function(a){g.g.o.I("circle",{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},a);g.g.o.I("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);g.g.o.I("rect",{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},a)};
b.xs=function(){this.Em=g.g.o.I("foreignObject",{x:g.oa.dd,y:g.oa.dd},null);var a=document.createElementNS(g.g.o.Fi,"body");a.setAttribute("xmlns",g.g.o.Fi);a.className="blocklyMinimalBody";var c=this.Sj=document.createElementNS(g.g.o.Fi,"textarea");c.className="blocklyCommentTextarea";c.setAttribute("dir",this.U.G?"RTL":"LTR");c.value=this.jc.text;rd(this);a.appendChild(c);this.Em.appendChild(a);g.la(c,"mouseup",this,this.kH,!0,!0);g.la(c,"wheel",this,function(d){d.stopPropagation()});g.la(c,"change",
this,function(){this.os!=this.jc.text&&g.i.Ma(new g.i.pg(this.U,"comment",null,this.os,this.jc.text))});g.la(c,"input",this,function(){this.jc.text=c.value});setTimeout(c.focus.bind(c),0);return this.Em};b.lh=function(){g.Comment.w.lh.call(this);this.isVisible()&&(sd(this),td(this))};b.rG=function(){this.isVisible()&&(this.jc.size=this.Zb.ht(),rd(this))};
function rd(a){var c=a.jc.size,d=2*g.oa.dd,e=c.width-d;c=c.height-d;a.Em.setAttribute("width",e);a.Em.setAttribute("height",c);a.Sj.style.width=e-4+"px";a.Sj.style.height=c-4+"px"}b.Vb=function(a){a!=this.isVisible()&&(g.i.Ma(new g.i.xd(this.U,"commentOpen",!a,a)),(this.jc.Du=a)?td(this):sd(this))};
function td(a){if(!a.U.ld()||g.g.userAgent.vg)g.Jf.prototype.wx.call(a);else{a.Zb=new g.oa(a.U.v,a.xs(),a.U.$d,a.Qk,a.jc.size.width,a.jc.size.height);mb(a.Zb,a.U.id);var c=a.rG.bind(a);a.Zb.Mu=c;a.Ue()}}function sd(a){a.Fj?g.Jf.prototype.Mx.call(a):(a.Zb.J(),a.Zb=null,a.Sj=null,a.Em=null)}b.kH=function(){nb(this.Zb)&&this.Sj.focus();this.os=this.jc.text};b.ht=function(){return this.jc.size};b.zn=function(a,c){this.Zb?this.Zb.zn(a,c):(this.jc.size.width=a,this.jc.size.height=c)};
b.Sb=function(){return this.jc.text||""};b.ll=function(a){this.jc.text!=a&&(this.jc.text=a,uc(this))};function uc(a){a.Sj?a.Sj.value=a.jc.text:a.Fj&&(a.Fj.firstChild.textContent=a.jc.text)}b.J=function(){this.U.Bk=null;g.Ld.prototype.J.call(this)};g.Da={};g.Da.rd=function(a,c){g.yc.call(this);this.Uc=c;this.gf=a;this.Cm=this.nq=!1;this.Mt=!0;this.Cs=-1};g.g.object.W(g.Da.rd,g.yc);g.Da.rd.Ur={};b=g.Da.rd.prototype;b.ym=function(){g.Da.rd.w.ym.call(this);this.Da&&(this.Da=null);this.hb=null};
b.Fp=function(){var a=this.ta();if(a){var c=ud(this);c&&!c.id&&(c.id=this.ua()+".label");g.g.V.hg(a,g.g.V.Li.YC);g.g.V.Ib(a,g.g.V.State.Sl,!1);g.g.V.Ib(a,g.g.V.State.aC,this.Ik());c&&g.g.V.Ib(a,g.g.V.State.dw,c.id);(c=this.mt())&&g.g.V.hg(c,g.g.V.Li.BC);if(c=vd(this))if(g.g.V.hg(c,g.g.V.Li.LB),c.hasChildNodes())for(g.g.V.Ib(a,g.g.V.State.Xq,!1),a=this.kb.length,c=1;c<=a;c++){var d=(this.kb[c-1]||null).ta();g.g.V.Ib(d,g.g.V.State.JC,a);g.g.V.Ib(d,g.g.V.State.AC,c)}}};
b.Ia=function(){var a=document.createElement("div");a.appendChild(wd(this));this.hb=a};b.lf=function(){g.Da.rd.w.lf.call(this);g.Da.rd.Ur[this.ua()]=this;this.Fp()};b.Jh=function(){g.Da.rd.w.Jh.call(this);delete g.Da.rd.Ur[this.ua()]};
b.cm=function(a,c){var d=this.kb[c-1]||null,e=this.kb[c]||null;g.Da.rd.w.cm.call(this,a,c);a.fl=d;a.lu=e;d?d.lu=a:this.$x=a;e&&(e.fl=a);(c=this.Le())&&xd(a,c);yd(a,this.Ik()+1);if(c=this.ta())if(this.yq(),g.g.V.Ib(c,g.g.V.State.Xq,this.Je()),this.Je()){c=vd(this);a.ta()||a.Ia();var f=a.ta(),h=e&&e.ta();c.insertBefore(f,h);this.$c&&a.lf();e||(d?d.yq():(g.g.style.Uu(c,!0),this.Kj(this.Je())))}};b.add=function(a){if(a.getParent())throw Error(g.yc.Error.wr);this.cm(a,this.kb.length)};b.Le=function(){return null};
b.Ik=function(){var a=this.Cs;0>a&&(a=(a=this.getParent())?a.Ik()+1:0,yd(this,a));return a};function yd(a,c){if(c!=a.Cs){a.Cs=c;var d=zd(a);if(d){var e=Ad(a)+"px";a.Xk()?d.style.paddingRight=e:d.style.paddingLeft=e}za(a,function(f){yd(f,c+1)})}}b.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1};b.Kh=function(){var a=[];za(this,function(c){a.push(c)});return a};b.select=function(){var a=this.Le();a&&Kc(a,this)};
function Bd(a,c){if(a.nq!=c){a.nq=c;Cd(a);var d=a.ta();d&&(g.g.V.Ib(d,g.g.V.State.Sl,c),c&&(c=a.Le().ta(),g.g.V.Ib(c,g.g.V.State.wv,a.ua())))}}b.Je=function(){return this.Cm};
b.Kj=function(a){var c=a!=this.Cm,d;this.Cm=a;var e=this.Le(),f=this.ta();if(Ba(this)){if(!a&&e&&this.contains(e.Yd)&&this.select(),f){if(d=vd(this))g.g.style.Uu(d,a),g.g.V.Ib(f,g.g.V.State.Xq,a),a&&this.$c&&!d.hasChildNodes()&&(za(this,function(h){d.appendChild(wd(h))}),za(this,function(h){h.lf()}));this.yq()}}else(d=vd(this))&&g.g.style.Uu(d,!1);f&&(this.mt().className=this.sp());c&&(a?this.Px():this.Ox())};b.Px=function(){};b.Ox=function(){};b.toggle=function(){this.Kj(!this.Je())};
function wd(a){var c=a.Je()&&Ba(a),d=document.createElement("div");d.style.backgroundPosition=Dd(a);c||(d.style.display="none");c&&za(a,function(e){d.appendChild(wd(e))});c=document.createElement("div");c.id=a.ua();c.appendChild(Ed(a));c.appendChild(d);return c}function Ad(a){return Math.max(0,(a.Ik()-1)*a.Uc.Vy)}function Ed(a){var c=document.createElement("div");c.className=a.xp();c.style["padding-"+(a.Xk()?"right":"left")]=Ad(a)+"px";c.appendChild(Fd(a));c.appendChild(Gd(a));return c}
b.xp=function(){var a="";this.nq&&(a=" "+(this.Uc.lE||""));return this.Uc.Bx+a};function Gd(a){var c=document.createElement("span");c.className=a.Uc.jE||"";c.textContent=a.Sb();return c}function Fd(a){var c=document.createElement("span");c.style.display="inline-block";c.className=a.sp();return c}b.sp=function(){throw Error("unimplemented abstract method");};function Dd(a){return(a.lu?(a.Ik()-1)*a.Uc.Vy:"-100")+"px 0"}
b.ta=function(){var a=g.Da.rd.w.ta.call(this);a||(this.hb=a=document.getElementById(this.ua()));return a};function zd(a){return(a=a.ta())?a.firstChild:null}b.mt=function(){var a=zd(this);return a?a.firstChild:null};function ud(a){return(a=zd(a))&&a.lastChild?a.lastChild.previousSibling:null}function vd(a){return(a=a.ta())?a.lastChild:null}b.ll=function(a){this.gf=a};b.Sb=function(){return this.gf};function Cd(a){var c=zd(a);c&&(c.className=a.xp())}
b.yq=function(){var a=vd(this);a&&(a.style.backgroundPosition=Dd(this))};b.Fz=function(a){"expand"==a.target.getAttribute("type")&&Ba(this)?this.Mt&&this.toggle():(this.select(),Cd(this))};b.Cz=function(a){a.preventDefault()};b.uu=function(a){var c=!0;switch(a.keyCode){case g.g.Ba.Io:if(a.altKey)break;c=Hd(this);break;case g.g.Ba.Ao:if(a.altKey)break;c=Id(this);break;case g.g.Ba.El:c=Jd(this);break;case g.g.Ba.Yl:c=Kd(this);break;default:c=!1}c&&a.preventDefault();return c};
function Jd(a){a:if(Ba(a)&&a.Je())a=a.kb[0]||null;else{for(var c=a,d;c!=a.Le();){d=c.lu;if(null!=d){a=d;break a}c=c.getParent()}a=null}a&&a.select();return!0}function Kd(a){var c=a.fl;if(null!=c)a=Ld(c);else{c=a.getParent();var d=a.Le();a=c==d||a==d?null:c}a&&a.select();return!0}function Id(a){if(Ba(a)&&a.Je()&&a.Mt)a.Kj(!1);else{var c=a.getParent();a=a.Le();c&&c!=a&&c.select()}return!0}function Hd(a){return Ba(a)?(a.Je()?(a.kb[0]||null).select():a.Kj(!0),!0):!1}
function Ld(a){return a.Je()&&Ba(a)?Ld(a.kb[a.kb.length-1]||null):a}function xd(a,c){a.Da!=c&&(a.Da=c,za(a,function(d){xd(d,c)}))};g.Da.yh=function(a,c,d){this.ra=a;g.Da.rd.call(this,c,d)};g.g.object.W(g.Da.yh,g.Da.rd);b=g.Da.yh.prototype;b.Le=function(){if(this.Da)return this.Da;var a=this.getParent();return a&&(a=a.Le())?(xd(this,a),a):null};b.sp=function(){var a=this.Je(),c=this.IE;if(a&&c)return c;c=this.DF;if(!a&&c)return c;c=this.Uc;if(Ba(this)){if(a&&c.zx)return c.bp+" "+c.zx;if(!a&&c.gE)return c.bp+" "+c.gE}else if(c.Ax)return c.bp+" "+c.Ax;return""};
b.Cz=function(){Ba(this)&&this.Mt?(this.toggle(),this.select()):this.nq?Kc(this.Le(),null):this.select();Cd(this)};b.Fz=function(){};b.uu=function(a){if(this.Da.ra.qf){var c={},d=g.g.Ba.El,e=g.g.Ba.Yl;c[g.g.Ba.Io]=this.Xk()?e:d;c[g.g.Ba.Ao]=this.Xk()?d:e;c[g.g.Ba.Yl]=g.g.Ba.Ao;c[g.g.Ba.El]=g.g.Ba.Io;Object.defineProperties(a,{keyCode:{value:c[a.keyCode]||a.keyCode}})}return g.Da.yh.w.uu.call(this,a)};b.Zz=function(){this.Jz&&this.Jz.call(this.ra)};b.Px=g.Da.yh.prototype.Zz;b.Ox=g.Da.yh.prototype.Zz;g.Da.Ri=function(a,c){this.ra=a;g.Da.rd.call(this,"",c);this.Cm=!0;Bd(this,!0);this.Yd=this};g.g.object.W(g.Da.Ri,g.Da.rd);b=g.Da.Ri.prototype;b.Le=function(){return this};b.Ik=function(){return 0};b.oF=function(){this.gy=!0;var a=this.ta();g.g.o.mb(a,"focused");this.Yd&&this.Yd.select()};b.lF=function(){this.gy=!1;var a=this.ta();g.g.o.Tb(a,"focused")};b.hasFocus=function(){return this.gy};b.Je=function(){return!0};b.Kj=function(a){this.Cm=a};
b.mt=function(){var a=zd(this);return a?a.firstChild:null};b.yq=function(){};b.xp=function(){return g.Da.Ri.w.xp.call(this)+" "+this.Uc.iE};b.sp=function(){var a=this.Je(),c=this.IE;if(a&&c)return c;c=this.DF;if(!a&&c)return c;c=this.Uc;return a&&c.hE?c.bp+" "+c.hE:""};function Kc(a,c){if(c!=a.Yd&&(!a.Az||a.Az.call(a.ra,c))){var d=a.Yd;a.Yd&&Bd(a.Yd,!1);(a.Yd=c)&&Bd(c,!0);a.zz&&a.zz.call(a.ra,d,c)}}
b.Fp=function(){g.Da.Ri.w.Fp.call(this);var a=this.ta();g.g.V.hg(a,g.g.V.Li.XC);g.g.V.Ib(a,g.g.V.State.dw,ud(this).id)};b.lf=function(){g.Da.Ri.w.lf.call(this);var a=this.ta();a.className=this.Uc.kE;a.setAttribute("hideFocus","true");this.Zr();this.Fp()};b.Jh=function(){g.Da.Ri.w.Jh.call(this);this.Ds()};b.Zr=function(){var a=this.ta();a.tabIndex=0;this.uG=g.hd(a,"focus",this,this.oF);this.qG=g.hd(a,"blur",this,this.lF);this.sG=g.la(a,"click",this,this.sF);this.yG=g.hd(a,"keydown",this,this.pF)};
b.Ds=function(){g.Xa(this.uG);g.Xa(this.qG);g.Xa(this.sG);g.Xa(this.yG)};b.sF=function(a){var c;a:{for(var d=a.target;null!=d;){if(c=g.Da.rd.Ur[d.id])break a;if(d==this.ta())break;d=d.parentNode}c=null}if(c)switch(a.type){case "mousedown":c.Fz(a);break;case "click":c.Cz(a)}};b.pF=function(a){var c=!1;if(c=this.Yd&&this.Yd.uu(a)||c)g.g.style.Ru(this.Yd.ta(),this.ta().parentNode),a.preventDefault();return c};b.createNode=function(a){return new g.Da.yh(this.ra,a||"",this.Uc)};g.Qi=function(a){this.s=a;this.G=a.options.G;this.qf=a.options.Td;this.Fa=a.options.Fa;this.Uc={Vy:19,kE:"blocklyTreeRoot",iE:"blocklyHidden",Bx:"blocklyTreeRow",jE:"blocklyTreeLabel",bp:"blocklyTreeIcon",zx:"blocklyTreeIconOpen",Ax:"blocklyTreeIconNone",lE:"blocklyTreeSelected"};this.xA={Bx:"blocklyTreeSeparator"};this.qf&&(this.Uc.cssTreeRow+=a.G?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.xA.cssTreeRow="blocklyTreeSeparatorHorizontal "+(a.G?"blocklyHorizontalTreeRtl":"blocklyHorizontalTree"),
this.Uc.cssTreeIcon="")};b=g.Qi.prototype;b.width=0;b.height=0;b.Zk=null;
b.S=function(){var a=this.s,c=u(this.s);this.zc=document.createElement("div");this.zc.className="blocklyToolboxDiv blocklyNonSelectable";this.zc.setAttribute("dir",a.G?"RTL":"LTR");c.parentNode.insertBefore(this.zc,c);c=a.Wb;c.subscribe(this.zc,"toolbox","background-color");c.subscribe(this.zc,"toolboxText","color");g.la(this.zc,"mousedown",this,function(d){g.g.tj(d)||d.target==this.zc?g.rc(!1):g.rc(!0);g.Touch.Dh()},!1,!0);c={Pg:a.options.Pg,Ob:a,G:a.G,Re:a.options.Re,Td:a.Td,Fa:a.options.Fa,dh:a.options.dh};
this.P=null;if(a.Td){if(!g.Jl)throw Error("Missing require for Blockly.HorizontalFlyout");this.P=new g.Jl(c)}else{if(!g.Fg)throw Error("Missing require for Blockly.VerticalFlyout");this.P=new g.Fg(c)}g.g.o.nj(this.P.Ia("svg"),u(this.s));this.P.S(a);this.Uc.cleardotPath=a.options.uf+"1x1.gif";this.Uc.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.G?"Rtl":"Ltr");Md(this,a.options.Yk)};
function Md(a,c){a.Fd&&(a.Fd.J(),a.Zk=null);var d=new g.Da.Ri(a,a.Uc);a.Fd=d;Kc(d,null);d.Az=a.kF;d.zz=a.jF;var e=null;if(c){a.Fd.Lf=[];a.zt=!1;e=Nd(a,c,a.Fd,a.s.options.uf);if(a.Fd.Lf.length)throw Error("Toolbox cannot have both blocks and categories in the root level.");Ia(a.s)}d.za(a.zc);e&&Kc(d,e);Od(a);a.position();a.qf&&g.g.V.Ib(a.Fd.ta(),g.g.V.State.xC,"horizontal")}
b.kF=function(a){if(a==this.Fd)return!1;this.Zk&&(zd(this.Zk).style.backgroundColor="");if(a){var c=a.Mk||"#57e";zd(a).style.backgroundColor=c;Od(this,a)}return!0};b.jF=function(a,c){c&&c.Lf&&c.Lf.length?(this.P.show(c.Lf),this.Zk!=c&&this.P.uc.set(0),g.Oe&&g.navigation.Ib(g.navigation.Ir)):(this.P.Ca(),!g.Oe||c instanceof g.Qi.Or||g.navigation.Ib(g.navigation.Ul));a!=c&&a!=this&&(a=new g.i.xd(null,"category",a&&a.Sb(),c&&c.Sb()),a.xc=this.s.id,g.i.Ma(a));c&&(this.Zk=c)};b.vF=function(){g.ol(this.s)};
b.ei=function(a){var c=this.Fd.Yd;if(!c)return!1;switch(a.name){case g.navigation.ab.Be:return Kd(c);case g.navigation.ab.Go:return Id(c);case g.navigation.ab.ze:return Jd(c);case g.navigation.ab.vo:return Hd(c);default:return!1}};b.J=function(){this.P.J();this.Fd.J();this.s.Wb.unsubscribe(this.zc);g.g.o.removeNode(this.zc);this.Zk=this.s=null};b.Xf=function(){return this.width};b.ty=function(){return this.height};
b.position=function(){var a=this.zc;if(a){var c=u(this.s);c=g.rA(c);this.qf?(a.style.left="0",a.style.height="auto",a.style.width=c.width+"px",this.height=a.offsetHeight,this.Fa==g.Dg?a.style.top="0":a.style.bottom="0"):(this.Fa==g.Cg?a.style.right="0":a.style.left="0",a.style.height=c.height+"px",this.width=a.offsetWidth);this.P.position()}};
function Nd(a,c,d,e){for(var f=null,h=null,k=0,l;l=c.childNodes[k];k++)if(l.tagName)switch(l.tagName.toUpperCase()){case "CATEGORY":var m=g.g.Xd(l.getAttribute("name"));h=a.Fd.createNode(m);h.Jz=a.vF;h.Lf=[];d.add(h);var n=l.getAttribute("custom");n?h.Lf=n:(n=Nd(a,l,h,e))&&(f=n);var r=l.getAttribute("categorystyle");if((n=l.getAttribute("colour"))&&r)h.Mk="",console.warn('Toolbox category "'+m+'" can not have both a style and a colour');else if(r){n=a;var t=h;t.GM=r;var v=n.s.zp();r&&v&&((v=v.ID[r])&&
v.Mb?Pd(n,v.Mb,t,m):console.warn('Style "'+r+'" must exist and contain a colour value'))}else Pd(a,n,h,m);"true"==l.getAttribute("expanded")?(h.Lf.length&&(f=h),h.Kj(!0)):h.Kj(!1);h=l;break;case "SEP":if(h&&"CATEGORY"==h.tagName.toUpperCase()){d.add(new g.Qi.Or(a.xA));break}case "BLOCK":case "SHADOW":case "LABEL":case "BUTTON":d.Lf.push(l),h=l}return f}
function Pd(a,c,d,e){c=g.g.Xd(c);if(null===c||""===c)d.Mk="";else{var f=Number(c);isNaN(f)?(f=g.g.Mb.parse(c))?(d.Mk=f,a.zt=!0):(d.Mk="",console.warn('Toolbox category "'+e+'" has unrecognized colour attribute: '+c)):(d.Mk=g.Uy(f),a.zt=!0)}}function Od(a,c){c=(c||a.Fd).Kh(!1);for(var d=0,e;e=c[d];d++){var f=zd(e);if(f){var h=a.zt?"8px solid "+(e.Mk||"#ddd"):"none";a.s.G?f.style.borderRight=h:f.style.borderLeft=h}Od(a,e)}}
b.Hm=function(){if(!this.zc)return null;var a=this.zc.getBoundingClientRect(),c=a.top,d=c+a.height,e=a.left;a=e+a.width;return this.Fa==g.Dg?new g.g.Rect(-1E7,d,-1E7,1E7):this.Fa==g.Oi?new g.g.Rect(c,1E7,-1E7,1E7):this.Fa==g.Nd?new g.g.Rect(-1E7,1E7,-1E7,a):new g.g.Rect(-1E7,1E7,e,1E7)};g.Qi.Or=function(a){g.Da.yh.call(this,null,"",a)};g.g.object.W(g.Qi.Or,g.Da.yh);
g.ed.register([".blocklyToolboxDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {",
"height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;",
"}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<<PATH>>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {",
"background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",
'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]);g.Nr=function(a){this.s=a;this.Zi=[];if(!(0>=this.s.options.Up)){a={scrollbars:!0,Pg:this.s.options.Pg,Ob:this.s,G:this.s.G,Re:this.s.options.Re,dh:this.s.options.dh};if(this.s.Td){a.Fa=this.s.Fa==g.Dg?g.Oi:g.Dg;if(!g.Jl)throw Error("Missing require for Blockly.HorizontalFlyout");this.P=new g.Jl(a)}else{a.Fa=this.s.Fa==g.Cg?g.Nd:g.Cg;if(!g.Fg)throw Error("Missing require for Blockly.VerticalFlyout");this.P=new g.Fg(a)}ib(this.s,this.tG.bind(this))}};b=g.Nr.prototype;b.Si=47;b.bo=44;b.kk=16;b.ir=20;
b.Ml=20;b.Bo=10;b.Gr=0;b.Hr=32;b.MB=.1;b.Kt=!1;b.Vp=0;b.H=null;b.uq=null;b.St=0;b.$h=0;b.Zm=0;b.vl=0;
b.Ia=function(){this.H=g.g.o.I("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var c=g.g.o.I("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.H);g.g.o.I("rect",{width:this.Si,height:this.bo,y:this.kk},c);var d=g.g.o.I("image",{width:g.wd.width,x:-this.Gr,height:g.wd.height,y:-this.Hr,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.H);d.setAttributeNS(g.g.o.Kf,"xlink:href",this.s.options.uf+g.wd.url);c=g.g.o.I("clipPath",{id:"blocklyTrashLidClipPath"+a},this.H);
g.g.o.I("rect",{width:this.Si,height:this.kk},c);this.uq=g.g.o.I("image",{width:g.wd.width,x:-this.Gr,height:g.wd.height,y:-this.Hr,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.H);this.uq.setAttributeNS(g.g.o.Kf,"xlink:href",this.s.options.uf+g.wd.url);g.la(this.H,"mouseup",this,this.click);g.hd(d,"mouseover",this,this.dG);g.hd(d,"mouseout",this,this.bG);this.Vr();return this.H};
b.S=function(a){0<this.s.options.Up&&(g.g.o.nj(this.P.Ia("svg"),u(this.s)),this.P.S(this.s),this.P.Zy=function(){return!0});this.mh=this.ir+a;Xa(this,!1);return this.mh+this.bo+this.kk};b.J=function(){this.H&&(g.g.o.removeNode(this.H),this.H=null);this.s=this.uq=null;clearTimeout(this.St)};
b.position=function(){if(this.mh){var a=this.s.hc();a&&(this.Zm=a.Fa==g.Nd||this.s.Td&&!this.s.G?a.rb+a.oc-this.Si-this.Ml-g.La.tc:this.Ml+g.La.tc,this.vl=a.Fa==g.Oi?this.mh:a.yb+a.Ac-(this.bo+this.kk)-this.mh,this.H.setAttribute("transform","translate("+this.Zm+","+this.vl+")"))}};b.Hm=function(){if(!this.H)return null;var a=this.H.getBoundingClientRect(),c=a.top+this.Hr-this.Bo;a=a.left+this.Gr-this.Bo;return new g.g.Rect(c,c+this.kk+this.bo+2*this.Bo,a,a+this.Si+2*this.Bo)};
function Xa(a,c){a.Kt!=c&&(clearTimeout(a.St),a.Kt=c,a.Vr())}b.Vr=function(){this.$h+=this.Kt?.2:-.2;this.$h=Math.min(Math.max(this.$h,this.Vp),1);Qd(this,45*this.$h);this.H.style.opacity=.4+.4*this.$h;this.$h>this.Vp&&1>this.$h&&(this.St=setTimeout(this.Vr.bind(this),20))};function Qd(a,c){var d=a.s.Fa==g.Cg||a.s.Td&&a.s.G;a.uq.setAttribute("transform","rotate("+(d?-c:c)+","+(d?4:a.Si-4)+","+(a.kk-2)+")")}b.close=function(){Xa(this,!1)};
b.click=function(){if(this.Zi.length){for(var a=[],c=0,d;d=this.Zi[c];c++)a[c]=g.R.jh(d);this.P.show(a)}};b.dG=function(){this.Zi.length&&Xa(this,!0)};b.bG=function(){Xa(this,!1)};
b.tG=function(a){if(!(0>=this.s.options.Up)&&a.type==g.i.ao&&"shadow"!=a.qu.tagName.toLowerCase()){for(var c=a=a.qu.cloneNode(!0);c;){c.removeAttribute&&(c.removeAttribute("x"),c.removeAttribute("y"),c.removeAttribute("id"));var d=c.firstChild||c.nextSibling;if(!d)for(d=c.parentNode;d;){if(d.nextSibling){d=d.nextSibling;break}d=d.parentNode}c=d}a=g.R.Rd(a);if(-1==this.Zi.indexOf(a)){for(this.Zi.unshift(a);this.Zi.length>this.s.options.Up;)this.Zi.pop();this.Vp=this.MB;Qd(this,45*this.Vp)}}};g.Di=function(){g.Di.w.constructor.call(this)};g.g.object.W(g.Di,g.po);g.Di.prototype.next=function(){var a=this.Rb;if(!a)return null;(a=a.next())&&I(this,a);return a};g.Di.prototype.Pm=function(){return null};g.Di.prototype.cg=function(){var a=this.Rb;if(!a)return null;(a=a.cg())&&I(this,a);return a};g.Di.prototype.nn=function(){return null};g.Hl=function(a){a.hc=this.Km.bind(this);a.pi=this.gA.bind(this);this.s=new g.lb(a);this.s.oe=!0;this.s.Su(new g.Di);this.s.fA(new g.ph);this.G=!!a.G;this.tl=a.Fa;this.$s=[];this.Tp=[];this.gm=[];this.Dd=[];this.Cu=[];this.ql=this.s.eh.C.xh};b=g.Hl.prototype;b.xk=!0;b.Zh=!1;b.Yi=!0;b.zb=8;b.Xe=g.Hl.prototype.zb;b.JB=3*g.Hl.prototype.Xe;b.KB=3*g.Hl.prototype.Xe;b.Er=2;b.tb=0;b.Yc=0;b.DE=70;
b.Ia=function(a){this.H=g.g.o.I(a,{"class":"blocklyFlyout",style:"display: none"},null);this.Mc=g.g.o.I("path",{"class":"blocklyFlyoutBackground"},this.H);this.H.appendChild(this.s.Ia());this.s.Wb.subscribe(this.Mc,"flyout","fill");this.s.Wb.subscribe(this.Mc,"flyoutOpacity","fill-opacity");return this.H};
b.S=function(a){this.qb=a;this.s.Qj=a;this.uc=new g.La(this.s,this.qf,!1,"blocklyFlyoutScrollbar");this.Ca();Array.prototype.push.apply(this.$s,g.la(this.H,"wheel",this,this.IH));this.xk||(this.np=this.at.bind(this),ib(this.qb,this.np));Array.prototype.push.apply(this.$s,g.la(this.Mc,"mousedown",this,this.gi));this.s.Tg=this.qb.Tg.bind(this.qb);this.s.Ta=this.qb.Ta;a=this.s;a.ki=new g.Pr(a)};
b.J=function(){this.Ca();g.Xa(this.$s);this.np&&(jb(this.qb,this.np),this.np=null);this.uc&&(this.uc.J(),this.uc=null);this.s&&(this.s.Wb.unsubscribe(this.Mc),this.s.Qj=null,this.s.J(),this.s=null);this.H&&(g.g.o.removeNode(this.H),this.H=null);this.qb=this.Mc=null};b.Xf=function(){return this.tb};b.ty=function(){return this.Yc};b.Kk=function(){return this.s};b.isVisible=function(){return this.Zh};b.Vb=function(a){var c=a!=this.isVisible();this.Zh=a;c&&this.Tn()};
b.Ij=function(a){var c=a!=this.Yi;this.Yi=a;c&&this.Tn()};b.Tn=function(){var a=this.Yi?this.isVisible():!1;this.H.style.display=a?"block":"none";this.uc.Ij(a)};b.Ca=function(){if(this.isVisible()){this.Vb(!1);for(var a=0,c;c=this.Dd[a];a++)g.Xa(c);this.Dd.length=0;this.li&&(jb(this.s,this.li),this.li=null)}};
b.show=function(a){this.s.Lc(!1);this.Ca();Rd(this);if("string"==typeof a){a=this.s.Qj.hv[a]||null;if("function"!=typeof a)throw TypeError("Couldn't find a callback function when opening a toolbox category.");a=a(this.s.Qj);if(!Array.isArray(a))throw TypeError("Result of toolbox category callback must be an array.");}this.Vb(!0);var c=[],d=[];this.Cu.length=0;for(var e=this.qf?this.JB:this.KB,f=0,h;h=a[f];f++)if(h.tagName)switch(h.tagName.toUpperCase()){case "BLOCK":var k=g.R.fj(h,this.s);k.isEnabled()||
this.Cu.push(k);c.push({type:"block",block:k});h=parseInt(h.getAttribute("gap"),10);d.push(isNaN(h)?e:h);break;case "SEP":h=parseInt(h.getAttribute("gap"),10);!isNaN(h)&&0<d.length?d[d.length-1]=h:d.push(e);break;case "LABEL":case "BUTTON":k="LABEL"==h.tagName.toUpperCase();if(!g.fk)throw Error("Missing require for Blockly.FlyoutButton");h=new g.fk(this.s,this.qb,h,k);c.push({type:"button",button:h});d.push(e)}Sd(this,c,d);this.Dd.push(g.la(this.Mc,"mouseover",this,function(){for(var l=D(this.s,!1),
m=0,n;n=l[m];m++)n.vn()}));this.qf?this.Yc=0:this.tb=0;this.s.Lc(!0);this.Iu();this.at();this.position();this.li=this.Iu.bind(this);ib(this.s,this.li)};function Rd(a){for(var c=D(a.s,!1),d=0,e;e=c[d];d++)e.v==a.s&&e.J(!1,!1);for(d=0;d<a.Tp.length;d++)(c=a.Tp[d])&&g.g.o.removeNode(c);for(d=a.Tp.length=0;c=a.gm[d];d++)c.J();a.gm.length=0;a.s.ki.clear()}function Td(a,c){return function(d){var e=a.qb.Tg(d);e&&(Ab(e,c),zb(e,d,a))}}b.gi=function(a){var c=this.qb.Tg(a);c&&zb(c,a,this)};b.Zy=function(a){return a.isEnabled()};
function vb(a,c){var d=null;g.i.disable();var e=a.qb.Sg();a.qb.Lc(!1);try{var f=a.qb;if(!c.ya())throw Error("oldBlock is not rendered.");var h=g.R.Bh(c,!0);f.Lc(!1);var k=g.R.fj(h,f);if(!k.ya())throw Error("block is not rendered.");var l=g.g.Jm(f.fb),m=g.g.Jm(a.s.fb),n=c.Ra();n.scale(a.s.scale);var r=g.g.N.sum(m,n),t=g.g.N.xm(r,l);t.scale(1/f.scale);k.moveBy(t.x,t.y);d=k;g.rc()}finally{g.i.enable()}c=g.O.ly(a.qb,e);if(g.i.isEnabled())for(g.i.$(!0),g.i.Ma(new g.i.Ve(d)),e=0;e<c.length;e++)g.i.Ma(new g.i.Ce(c[e]));
a.xk?a.Ca():a.at();return d}b.at=function(){for(var a=D(this.s,!1),c=0,d;d=a[c];c++)if(-1==this.Cu.indexOf(d))for(var e=fb(this.qb,g.g.gt(d));d;)d.od(e),d=q(d)};
b.Iu=function(){this.li&&jb(this.s,this.li);this.s.scale=this.qb.scale;for(var a=0,c=D(this.s,!1),d=0,e;e=c[d];d++){var f=G(e).width;e.M&&(f-=this.ql);a=Math.max(a,f)}for(d=0;e=this.gm[d];d++)a=Math.max(a,e.width);a+=1.5*this.Xe+this.ql;a*=this.s.scale;a+=g.La.tc;if(this.tb!=a){for(d=0;e=c[d];d++){if(this.G){f=e.Ra().x;var h=a/this.s.scale-this.Xe;e.M||(h-=this.ql);e.moveBy(h-f,0)}e.ay&&(f=e.ay,h=e,e=G(h),f.setAttribute("width",e.width),f.setAttribute("height",e.height),h=h.Ra(),f.setAttribute("y",
h.y),f.setAttribute("x",this.G?h.x-e.width:h.x))}if(this.G)for(d=0;e=this.gm[d];d++)e.moveTo(a/this.s.scale-e.width-this.Xe-this.ql,e.nd.y);this.tb=a;this.position()}this.li&&ib(this.s,this.li)};function tb(a){return a.uc?a.uc.isVisible():!1};g.Fg=function(a){a.hc=this.Km.bind(this);a.pi=this.gA.bind(this);g.Fg.w.constructor.call(this,a);this.qf=!1};g.g.object.W(g.Fg,g.Hl);b=g.Fg.prototype;b.Km=function(){if(!this.isVisible())return null;try{var a=this.s.fb.getBBox()}catch(f){a={height:0,y:0,width:0,x:0}}var c=this.Er,d=this.Yc-2*this.Er,e=this.tb;this.G||(e-=this.Er);return{yb:d,rb:e,Pd:a.height*this.s.scale+2*this.Xe,ff:a.width*this.s.scale+2*this.Xe,mc:-this.s.scrollY+a.y,ec:-this.s.scrollX,pc:a.y,Cc:a.x,Ac:c,oc:0}};
b.gA=function(a){var c=this.Km();c&&("number"==typeof a.y&&(this.s.scrollY=-c.Pd*a.y),this.s.translate(this.s.scrollX+c.oc,this.s.scrollY+c.Ac))};
b.position=function(){if(this.isVisible()){var a=this.qb.hc();if(a){this.Yc=a.yb;var c=this.tb-this.zb,d=a.yb-2*this.zb,e=this.tl==g.Cg,f=c+this.zb;f=["M "+(e?f:0)+",0"];f.push("h",e?-c:c);f.push("a",this.zb,this.zb,0,0,e?0:1,e?-this.zb:this.zb,this.zb);f.push("v",Math.max(0,d));f.push("a",this.zb,this.zb,0,0,e?0:1,e?this.zb:-this.zb,this.zb);f.push("h",e?c:-c);f.push("z");this.Mc.setAttribute("d",f.join(" "));c=this.Yc;a=this.qb.Fa==this.tl?a.vA?this.tl==g.Nd?a.vA:a.rb-this.tb:this.tl==g.Nd?0:a.rb:
this.tl==g.Nd?0:a.rb+a.oc-this.tb;this.H.setAttribute("width",this.tb);this.H.setAttribute("height",c);"svg"==this.H.tagName?g.g.o.An(this.H,"translate("+a+"px,0px)"):this.H.setAttribute("transform","translate("+a+",0)");this.uc&&(this.uc.xu=new g.g.N(a,0),this.uc.resize(),ia(this.uc,this.uc.nd.x,this.uc.nd.y))}}};b.IH=function(a){var c=g.g.xy(a);if(c.y){var d=this.Km();c=d.mc-d.pc+c.y;c=Math.min(c,d.Pd-d.yb);c=Math.max(c,0);this.uc.set(c);g.aa.Ca()}a.preventDefault();a.stopPropagation()};
function Sd(a,c,d){a.s.scale=a.qb.scale;for(var e=a.Xe,f=a.G?e:e+a.ql,h=0,k;k=c[h];h++)if("block"==k.type){k=k.block;for(var l=p(k,!1),m=0,n;n=l[m];m++)n.ac=!0;k.za();n=k.ya();l=G(k);m=k.M?f-a.ql:f;k.moveBy(m,e);var r=a,t=k,v=h;m=g.g.o.I("rect",{"fill-opacity":0,x:a.G?m-l.width:m,y:e,height:l.height,width:l.width},null);m.zf=t;g.K.yk(m);r.s.fb.insertBefore(m,t.ya());t.ay=m;r.Tp[v]=m;r=a;r.Dd.push(g.la(n,"mousedown",null,Td(r,k)));r.Dd.push(g.la(m,"mousedown",null,Td(r,k)));r.Dd.push(g.hd(n,"mouseover",
k,k.Po));r.Dd.push(g.hd(n,"mouseout",k,k.vn));r.Dd.push(g.hd(m,"mouseover",k,k.Po));r.Dd.push(g.hd(m,"mouseout",k,k.vn));e+=l.height+d[h]}else"button"==k.type&&(l=a,m=k.button,n=f,r=e,t=m.Ia(),m.moveTo(n,r),m.show(),l.Dd.push(g.la(t,"mousedown",l,l.gi)),l.gm.push(m),e+=k.button.height+d[h])}
b.Hm=function(){if(!this.H)return null;var a=this.H.getBoundingClientRect(),c=a.left;if(this.tl==g.Nd)return new g.g.Rect(-1E9,1E9,-1E9,c+a.width);g.g.userAgent.Yq&&this.qb&&this.qb.sj&&(a=this.qb.H.getBoundingClientRect().x,10>Math.abs(a-c)&&(c+=this.pM*this.qb.options.Ob.scale));return new g.g.Rect(-1E9,1E9,c,1E9)};function Ud(a,c,d,e){var f=X;this.name=a;this.VD=c;this.nA=d;this.hH=e||0;this.Ah=f;this.Na=new g.g.N;this.reset();console.log(this+" loaded.")}b=Ud.prototype;b.mH=!1;b.jf=!1;b.kd=0;b.Og=0;b.facing=0;b.speed=0;b.Sf=0;b.Na=null;b.Nt=0;b.toString=function(){return"["+this.name+"]"};
b.reset=function(){delete this.mH;delete this.jf;delete this.speed;delete this.Sf;delete this.Nt;this.kd=this.hH;this.Na.x=this.nA.x;this.Na.y=this.nA.y;this.facing=this.Og=$c(g.g.Ja.rl(Math.atan2(50-this.Na.y,50-this.Na.x)));var a=this.VD;if("function"==typeof a)a=a();else if("string"!=typeof a)throw Error("Avatar "+this.name+" has invalid code: "+a);this.LF="Interpreter"in window?new Interpreter(a,this.Ah.HF):null};function Vd(a,c){a.kd+=c;100<=a.kd&&Wd(a)}
function Wd(a){a.speed=0;a.jf=!0;a.kd=100;a.Ah.Ho.unshift(a);a.Ah.We.push({type:"DIE",avatar:a});console.log(a+" sinks.")}b.stop=function(){this.Sf=0};var X={Hd:[],Ho:[],We:[],lk:[],IB:50,RC:100,EC:.5,hf:null,VA:1,hw:3,rv:5,iB:5,Nq:3,Mz:0,mp:0,tA:0,WC:3E5,Os:null};X.QC=[new g.g.N(10,90),new g.g.N(90,10),new g.g.N(10,10),new g.g.N(90,90),new g.g.N(50,99),new g.g.N(50,1),new g.g.N(1,50),new g.g.N(99,50),new g.g.N(50,49)];X.reset=function(){clearTimeout(X.Mz);X.We.length=0;X.lk.length=0;X.Ho.length=0;for(var a=X.tA=0,c;c=X.Hd[a];a++)c.reset()};X.pD=function(a,c,d,e){d||(d=X.QC[X.Hd.length]);a=new Ud(a,c,d,e);X.Hd.push(a)};
X.start=function(a){X.Os=a;X.mp=Date.now()+X.WC;console.log("Starting battle with "+X.Hd.length+" avatars.");X.update()};X.update=function(){X.CH();X.DH();X.BH();X.Hd.length<=X.Ho.length+1&&(X.mp=Math.min(X.mp,Date.now()+1E3));Date.now()>X.mp?X.stop():X.Mz=setTimeout(X.update,1E3/X.IB)};X.stop=function(){for(var a=[],c=0,d;d=X.Hd[c];c++)d.jf||a.push(d);c=a.length;for(a.sort(function(e,f){return e.kd-f.kd});a.length;)X.Ho.unshift(a.pop());X.Os&&X.Os(c)};
X.DH=function(){for(var a=X.lk.length-1;0<=a;a--){var c=X.lk[a];c.progress+=X.hw;var d=0;if(c.eq-c.progress<X.hw/2){X.lk.splice(a,1);for(var e=0,f;f=X.Hd[e];e++)if(!f.jf){var h=10*(1-g.g.N.jp(f.Na,c.Bm)/4);0<h&&(Vd(f,h),d=Math.max(d,h))}X.We.push({type:"BOOM",damage:d,x:c.Bm.x,y:c.Bm.y})}}};
X.BH=function(){for(var a=0,c;c=X.Hd[a];a++)if(!c.jf&&(c.speed<c.Sf?c.speed=Math.min(c.speed+X.rv,c.Sf):c.speed>c.Sf&&(c.speed=Math.max(c.speed-X.rv,c.Sf)),0<c.speed)){var d=X.hx(c),e=d[1],f=g.g.Ja.pd(c.Og),h=c.speed/100*X.VA,k=Math.cos(f)*h;h*=Math.sin(f);c.Na.x+=k;c.Na.y+=h;0>c.Na.x||100<c.Na.x||0>c.Na.y||100<c.Na.y?(c.Na.x=g.g.Ja.Mf(c.Na.x,0,100),c.Na.y=g.g.Ja.Mf(c.Na.y,0,100),e=c.speed/100*X.Nq,Vd(c,e),c.speed=0,c.Sf=0,X.We.push({type:"CRASH",avatar:c,damage:e})):(d=X.hx(c),f=d[0],d=d[1],d<X.iB&&
e>d&&(c.Na.x-=k,c.Na.y-=h,e=Math.max(c.speed,f.speed)/100*X.Nq,Vd(c,e),c.speed=0,c.Sf=0,Vd(f,e),f.speed=0,f.Sf=0,X.We.push({type:"CRASH",avatar:c,damage:e}),X.We.push({type:"CRASH",avatar:f,damage:e})))}};X.CH=function(){for(var a=0;a<X.RC;a++){X.tA++;for(var c=0,d;d=X.Hd[c];c++)if(!d.jf){X.hf=d;try{d.LF.step()}catch(e){console.log(d+" throws an error: "+e),Wd(d)}X.hf=null}}};
X.HF=function(a,c){var d=function(e,f){var h=e;e=X.hf;var k=void 0===f||null===f?5:f;if("number"!=typeof h||isNaN(h)||"number"!=typeof k||isNaN(k))throw TypeError();h=$c(h);k=g.g.Ja.Mf(k,0,20);e.Ah.We.push({type:"SCAN",avatar:e,degree:h,resolution:k});f=$c(h-k/2);h=$c(h+k/2);f>h&&(h+=360);k=e.Na.x;for(var l=e.Na.y,m=Infinity,n=0,r;r=e.Ah.Hd[n];n++)if(r!=e&&!r.jf){var t=r.Na.x,v=r.Na.y;r=Math.sqrt((v-l)*(v-l)+(t-k)*(t-k));r>=m||(t=Math.atan2(v-l,t-k),t=$c(g.g.Ja.rl(t)),t<f&&(t+=360),f<=t&&t<=h&&(m=
r))}return m};a.setProperty(c,"scan",a.createNativeFunction(d));d=function(e,f){var h=f;f=X.hf;if("number"!=typeof e||isNaN(e)||"number"!=typeof h||isNaN(h))throw TypeError;var k=Date.now();f.Nt+1E3*f.Ah.EC>k?e=!1:(f.Nt=k,k=new g.g.N(f.Na.x,f.Na.y),e=$c(e),f.facing=e,h=g.g.Ja.Mf(h,0,70),e={wD:f,Hn:k,Og:e,eq:h,Bm:new g.g.N(k.x+h*Math.cos(g.g.Ja.pd(e)),k.y+h*Math.sin(g.g.Ja.pd(e))),progress:0},f.Ah.lk.push(e),f.Ah.We.push({type:"BANG",avatar:f,degree:e.Og}),e=!0);return e};a.setProperty(c,"cannon",
a.createNativeFunction(d));d=function(e,f){var h=X.hf;f=void 0===f||null===f?50:f;if("number"!=typeof e||isNaN(e)||"number"!=typeof f||isNaN(f))throw TypeError;h.Og!=$c(e)&&(50>=h.speed?(h.Og=$c(e),h.facing=h.Og):f=0);0==h.speed&&0<f&&(h.speed=.1);h.Sf=g.g.Ja.Mf(f,0,100)};a.setProperty(c,"drive",a.createNativeFunction(d));a.setProperty(c,"swim",a.createNativeFunction(d));a.setProperty(c,"stop",a.createNativeFunction(function(){X.hf.stop()}));a.setProperty(c,"damage",a.createNativeFunction(function(){return X.hf.kd}));
a.setProperty(c,"health",a.createNativeFunction(function(){return 100-X.hf.kd}));a.setProperty(c,"speed",a.createNativeFunction(function(){return X.hf.speed}));d=function(){return X.hf.Na.x};a.setProperty(c,"loc_x",a.createNativeFunction(d));a.setProperty(c,"getX",a.createNativeFunction(d));d=function(){return X.hf.Na.y};a.setProperty(c,"loc_y",a.createNativeFunction(d));a.setProperty(c,"getY",a.createNativeFunction(d));if(c=a.getProperty(c,"Math"))d=function(e){return Math.sin(g.g.Ja.pd(e))},a.setProperty(c,
"sin_deg",a.createNativeFunction(d)),d=function(e){return Math.cos(g.g.Ja.pd(e))},a.setProperty(c,"cos_deg",a.createNativeFunction(d)),d=function(e){return Math.tan(g.g.Ja.pd(e))},a.setProperty(c,"tan_deg",a.createNativeFunction(d)),d=function(e){return g.g.Ja.rl(Math.asin(e))},a.setProperty(c,"asin_deg",a.createNativeFunction(d)),d=function(e){return g.g.Ja.rl(Math.acos(e))},a.setProperty(c,"acos_deg",a.createNativeFunction(d)),d=function(e){return g.g.Ja.rl(Math.atan(e))},a.setProperty(c,"atan_deg",
a.createNativeFunction(d))};X.hx=function(a){for(var c=null,d=Infinity,e=0,f;f=X.Hd[e];e++)if(!f.jf&&a!=f){var h=Math.min(d,g.g.N.jp(a.Na,f.Na));h<d&&(d=h,c=f)}return[c,d]};var Xd,Yd,Zd,$d={},ae=[],be=new Image;be.src="pond/sprites.png";var ce=["#ff8b00","#c90015","#166c0b","#223068"],de=0,ee=Object.create(null);
function fe(){Xd=document.getElementById("scratch").getContext("2d");var a=document.getElementById("display").getContext("2d");Yd=a;Zd=a.canvas.width;a.globalCompositeOperation="copy";ge(["pond/whack.mp3","pond/whack.ogg"],"whack");ge(["pond/boom.mp3","pond/boom.ogg"],"boom");ge(["pond/splash.mp3","pond/splash.ogg"],"splash");if(!g.g.userAgent.xg&&!g.g.userAgent.cr)for(var c in ee)a=ee[c],a.volume=.01,a.play(),a.pause()}
function he(){clearTimeout(de);ae.length=0;var a=document.getElementById("avatarStatRow1");a.innerHTML="";var c=document.getElementById("avatarStatRow2");c.innerHTML="";for(var d=[],e=[],f=0,h;h=X.Hd[f];f++){var k=Math.floor(f/2)%2?c:a,l=ce[f%ce.length];h.DA=f;var m=document.createElement("td");m.style.borderColor=l;var n=document.createElement("div");n.className="avatarStatHealth";n.style.background=l;h.HH=n;e[f]=n;m.appendChild(n);n=document.createElement("div");n.className="avatarStatName";h=document.createTextNode(h.name);
n.appendChild(h);d[f]=n;m.appendChild(n);n=document.createElement("div");h=document.createTextNode("\u00a0");n.appendChild(h);m.appendChild(n);k.appendChild(m)}for(f=0;n=d[f];f++)n.style.width=n.parentNode.offsetWidth-2+"px";for(f=0;n=e[f];f++)n.style.height=n.parentNode.offsetHeight-2+"px";ie()}var je=0,ke=0;function le(){ie();var a=Date.now(),c=Math.max(1,1E3/36-(a-je-ke));de=setTimeout(le,c);je=a;ke=c}function me(a){return a/100*(Zd-35)+17.5}
function ie(){var a=Xd;a.beginPath();a.rect(0,0,a.canvas.width,a.canvas.height);a.fillStyle="#527dbf";a.fill();for(var c=[],d=0,e;e=X.Hd[d];d++)e.jf&&c.push(e);for(d=0;e=X.Hd[d];d++)e.jf||c.push(e);for(d=0;e=c[d];d++){a.save();var f=me(e.Na.x),h=me(100-e.Na.y);a.translate(f,h);var k=e.DA%ce.length*35;e.jf&&(a.globalAlpha=.25);0<e.speed&&(a.save(),f=50<e.speed?0:25<e.speed?35:70,a.rotate(g.g.Ja.pd(-e.Og)),a.drawImage(be,455,f,35,35,-45.5,-17.5,35,35),a.restore());a.drawImage(be,0,k,35,35,-17.5,-17.5,
35,35);f=g.g.Ja.pd(e.facing);a.translate(12*Math.cos(f),12*-Math.sin(f)-2);f=(14-Math.round(e.facing/360*12))%12+1;e=e.facing%30;15<=e&&(e-=30);e/=1.5;a.rotate(g.g.Ja.pd(-e));a.drawImage(be,35*f,k,35,35,-15.5,-15.5,35,35);a.restore()}for(d=0;e=X.lk[d];d++){a.save();h=e.progress/e.eq;k=(e.Bm.y-e.Hn.y)*-h;f=e.eq/2;var l=.15*e.eq;f=l-Math.pow((e.progress-f)/Math.sqrt(l)*l/f,2);h=me(e.Hn.x+(e.Bm.x-e.Hn.x)*h);l=me(100-e.Hn.y+k-f);k=me(100-e.Hn.y+k);a.beginPath();a.arc(h,k,5*Math.max(0,1-f/10),0,2*Math.PI,
!0);a.closePath();a.fillStyle="rgba(128, 128, 128, "+Math.max(0,1-f/10)+")";a.fill();a.beginPath();a.arc(h,l,5,0,2*Math.PI,!0);a.closePath();a.fillStyle=ce[e.wD.DA%ce.length];a.fill()}for(d=0;d<X.We.length;d++)if(f=X.We[d],e=f.avatar,"CRASH"==f.type){if(k=$d[e.id],!k||k+1E3<Date.now())ne("whack",f.damage/X.Nq),$d[e.id]=Date.now()}else"SCAN"==f.type?(h=Math.max(f.resolution/2,.5),k=-g.g.Ja.pd(f.degree+h),l=-g.g.Ja.pd(f.degree-h),a.beginPath(),f=me(e.Na.x),h=me(100-e.Na.y),a.moveTo(f,h),a.lineTo(f+
200*Math.cos(k),h+200*Math.sin(k)),a.arc(f,h,200,k,l),a.lineTo(f,h),e=a.createRadialGradient(f,h,17.5,f,h,200),e.addColorStop(0,"rgba(255, 255, 255, 0.3)"),e.addColorStop(1,"rgba(255, 255, 255, 0)"),a.fillStyle=e,a.fill()):"BANG"!=f.type&&("BOOM"==f.type?(f.damage&&ne("boom",f.damage/10),ae.push({x:f.x,y:f.y,t:0})):"DIE"==f.type&&ne("splash"));X.We.length=0;for(d=ae.length-1;0<=d;d--)e=ae[d],f=me(e.x),h=me(100-e.y),a.beginPath(),a.arc(f,h,e.t+1,0,2*Math.PI,!0),a.closePath(),a.lineWidth=5,a.strokeStyle=
"rgba(255, 255, 255, "+(1-e.t/10)+")",a.stroke(),e.t+=2,10<e.t&&ae.splice(d,1);Yd.drawImage(a.canvas,0,0);for(d=0;e=c[d];d++)a=e.HH,a.parentNode.title=e.name+": "+Math.round(100-e.kd)+"%",a.style.width=Math.max(0,a.parentNode.offsetWidth*(1-e.kd/100)-2)+"px"}function ge(a,c){if(window.Audio&&a.length){for(var d,e=new window.Audio,f=0;f<a.length;f++){var h=a[f],k=h.match(/\.(\w+)$/);if(k&&e.canPlayType("audio/"+k[1])){d=new window.Audio(h);break}}d&&d.play&&(ee[c]=d)}}
function ne(a,c){a=ee[a];a=g.g.userAgent.xg||g.g.userAgent.xi?a:a.cloneNode();a.volume=void 0===c?1:c;a.play()};var oe=!1;function pe(){if(!oe){var a=document.getElementById("docsButton"),c=document.getElementById("dialogDocs"),d=document.getElementById("frameDocs"),e="pond/docs.html?lang="+Oc+"&mode="+R;d.src!=e&&(d.src=e);oe=!0;U.bi(a,!1,.2);U.bi(c,!0,.8);setTimeout(function(){c.style.visibility="visible";document.getElementById("dialogBorder").style.visibility="hidden"},175)}}
function qe(){if(oe){var a=document.getElementById("docsButton"),c=document.getElementById("dialogDocs");oe=!1;U.bi(c,!1,.8);U.bi(a,!0,.2);setTimeout(function(){document.getElementById("dialogBorder").style.visibility="hidden"},175);c.style.visibility="hidden"}}function re(a){if(!V.Uf(a)){a=document.getElementById("runButton");var c=document.getElementById("resetButton");c.style.minWidth||(c.style.minWidth=a.offsetWidth+"px");a.style.display="none";c.style.display="inline";se()}}
function te(a){V.Uf(a)||(document.getElementById("runButton").style.display="inline",document.getElementById("resetButton").style.display="none",X.reset(),he())}function se(){"Interpreter"in window?(X.reset(),he(),X.start(null),le()):setTimeout(se,250)};g.Ka=function(a,c,d){"function"!=typeof a&&g.Ka.zA(a);this.xj=a;this.rp=null;this.yn=0;this.dv=this.Eu=null;a=this.xj;if(Array.isArray(a)){for(var e=!1,f=0;f<a.length;f++){var h=a[f][0];"string"==typeof h?a[f][0]=g.g.Xd(h):(null!=h.alt&&(a[f][0].alt=g.g.Xd(h.alt)),e=!0)}if(!(e||2>a.length)){e=[];for(f=0;f<a.length;f++)e.push(a[f][0]);f=g.g.eb.Zu(e);h=g.g.eb.WD(e,f);var k=g.g.eb.XD(e,f);!h&&!k||f<=h+k||(h&&(this.Eu=e[0].substring(0,h-1)),k&&(this.dv=e[0].substr(1-k)),this.xj=g.Ka.uD(a,h,k))}}a=this.getOptions(!1)[0];
g.Ka.w.constructor.call(this,a[1],c,d);this.jl=this.Qh=null};g.g.object.W(g.Ka,g.Pa);g.Ka.va=function(a){return new g.Ka(a.options,void 0,a)};g.Ka.prototype.Ni=!0;g.Ka.fI=25;g.Ka.LJ=.45;g.Ka.Xv=5;g.Ka.SB=2*g.Ka.Xv;g.Ka.Av=g.g.userAgent.xi?"\u25bc":"\u25be";b=g.Ka.prototype;b.Rq="default";
b.Sh=function(){g.Ka.w.Sh.call(this);this.Qh=g.g.o.I("image",{y:g.Ka.Xv},this.mf);this.bf=g.g.o.I("tspan",{},this.kc);this.bf.appendChild(document.createTextNode(this.B.G?g.Ka.Av+" ":" "+g.Ka.Av));this.B.G?this.kc.insertBefore(this.bf,this.Rj):this.kc.appendChild(this.bf)};b.wf=function(){this.$g=this.Xs();this.$g.za(g.D.oy());g.g.o.mb(this.$g.ta(),"blocklyDropdownMenu");g.D.jA(this,this.Ys.bind(this));this.$g.focus();this.jl&&g.g.style.Ru(this.jl.ta(),this.$g.ta())};
b.Xs=function(){var a=new g.Gi;Aa(a,this.B.G);a.hg("listbox");var c=this.getOptions(!1);this.jl=null;for(var d=0;d<c.length;d++){var e=c[d][0],f=c[d][1];if("object"==typeof e){var h=new Image(e.width,e.height);h.src=e.src;h.alt=e.alt||"";e=h}e=new g.Co(e);e.hg("option");Aa(e,this.B.G);e.setValue(f);e.hm=!0;a.cm(e,a.kb.length,!0);cc(e,f==this.dc);f==this.dc&&(this.jl=e);dc(e,this.qF,this)}g.g.V.Ib(a.ta(),g.g.V.State.wv,this.jl?this.jl.ua():"");return a};b.Ys=function(){this.$g.J();this.$g=null};
b.qF=function(a){g.D.Nk(this,!0);this.Dz(a)};b.Dz=function(a){this.setValue(a.getValue())};g.Ka.uD=function(a,c,d){for(var e=[],f=0;f<a.length;f++){var h=a[f][0],k=a[f][1];h=h.substring(c,h.length-d);e[f]=[h,k]}return e};b=g.Ka.prototype;b.getOptions=function(a){return"function"==typeof this.xj?(this.rp&&a||(this.rp=this.xj.call(this),g.Ka.zA(this.rp)),this.rp):this.xj};
b.Hh=function(a){for(var c=!1,d=this.getOptions(!0),e=0,f;f=d[e];e++)if(f[1]==a){c=!0;break}return c?a:(this.B&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.B.type+", Field name: "+this.name+", Value: "+a),null)};b.ej=function(a){g.Ka.w.ej.call(this,a);a=this.getOptions(!0);for(var c=0,d;d=a[c];c++)d[1]==this.dc&&(this.yn=c)};b.Ue=function(){this.B&&this.bf&&(this.bf.style.fill=this.B.bb?Nb(this.B):this.B.Eh)};
b.eg=function(){this.Rj.nodeValue="";this.Qh.style.display="none";var a=this.getOptions(!0),c=0<=this.yn&&a[this.yn][0];if(c&&"object"==typeof c){this.Qh.style.display="";this.Qh.setAttributeNS(g.g.o.Kf,"xlink:href",c.src);this.Qh.setAttribute("height",c.height);this.Qh.setAttribute("width",c.width);a=g.g.o.yp(this.bf);var d=Number(c.width);this.cc.height=Number(c.height)+g.Ka.SB;this.cc.width=d+a+g.Pa.bm;this.B.G?(c=g.Pa.Ci-1,this.Qh.setAttribute("x",g.Pa.Ci+a),this.kc.setAttribute("x",c)):(c=d+
a+g.Pa.Ci+1,this.kc.setAttribute("text-anchor","end"),this.kc.setAttribute("x",c),this.Qh.setAttribute("x",g.Pa.Ci))}else this.Rj.nodeValue=Eb(this),this.kc.setAttribute("text-anchor","start"),this.kc.setAttribute("x",g.Pa.Ci),this.cc.height=g.Pa.Fv,this.cc.width=g.g.o.yp(this.kc)+g.Pa.bm;this.Vi.setAttribute("height",this.cc.height);this.Vi.setAttribute("width",this.cc.width)};b.st=function(){if(0>this.yn)return null;var a=this.getOptions(!0)[this.yn][0];return"object"==typeof a?a.alt:a};
g.Ka.zA=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 c=!1,d=0;d<a.length;++d){var e=a[d];Array.isArray(e)?"string"!=typeof e[1]?(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option id must be a string. Found "+e[1]+" in: ",e)):e[0]&&"string"!=typeof e[0]&&"string"!=typeof e[0].src&&(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option must have a string label or image description. Found"+
e[0]+" in: ",e)):(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option must be an array. Found: ",e))}if(c)throw TypeError("Found invalid FieldDropdown options.");};g.Ka.prototype.ei=function(a){if(this.$g){if(a===g.navigation.Gq)return Zb(this.$g),!0;if(a===g.navigation.Fq)return Xb(this.$g),!0}return g.Ka.w.ei.call(this,a)};g.Wc.register("field_dropdown",g.Ka);g.Ab=function(a,c,d){this.Gn=!0;null==a&&(a="");g.Ab.w.constructor.call(this,a,c,d)};g.g.object.W(g.Ab,g.Pa);g.Ab.va=function(a){var c=g.g.Xd(a.text);return new g.Ab(c,void 0,a)};g.Ab.prototype.Ni=!0;g.Ab.FB=11;g.Ab.YA=4;b=g.Ab.prototype;b.Rq="text";b.Od=function(a){g.Ab.w.Od.call(this,a);"boolean"==typeof a.spellcheck&&(this.Gn=a.spellcheck)};b.Hh=function(a){return null===a||void 0===a?null:String(a)};
b.Qx=function(){if(this.Tk){this.Lt=!1;var a=this.dc;this.dc=this.Zc.AH;this.B&&g.i.isEnabled()&&g.i.Ma(new g.i.pg(this.B,"field",this.name||null,a,this.dc))}};b.ej=function(a){this.Lt=!0;this.dc=a;this.Tk||(this.Zf=!0)};b.eg=function(){g.Ab.w.eg.call(this);this.Tk&&(this.B.G?setTimeout(this.jq.bind(this),0):this.jq(),this.Lt?(g.g.o.Tb(this.Zc,"blocklyInvalidInput"),g.g.V.Ib(this.Zc,"invalid",!1)):(g.g.o.mb(this.Zc,"blocklyInvalidInput"),g.g.V.Ib(this.Zc,"invalid",!0)))};
function ue(a){0!=a.Gn&&(a.Gn=!1,a.Zc&&a.Zc.setAttribute("spellcheck",a.Gn))}b.wf=function(a){this.s=this.B.v;a=a||!1;!a&&(g.g.userAgent.iw||g.g.userAgent.xi||g.g.userAgent.xg)?ve(this):(g.aa.show(this,this.B.G,this.JH.bind(this)),this.Zc=this.ov(),this.Tk=!0,a||(this.Zc.focus(),this.Zc.select()))};function ve(a){g.prompt(g.h.CHANGE_VALUE_TITLE,a.Sb(),function(c){a.setValue(c)})}
b.ov=function(){var a=g.aa.Ga,c=document.createElement("input");c.className="blocklyHtmlInput";c.setAttribute("spellcheck",this.Gn);var d=g.Ab.FB*this.s.scale+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=g.Ab.YA*this.s.scale+"px";a.appendChild(c);c.value=c.defaultValue=String(this.dc);c.AH=this.dc;c.yz=null;g.g.userAgent.Yq?setTimeout(this.jq.bind(this),0):this.jq();this.vu=g.la(c,"keydown",this,this.tu);this.xG=g.la(c,"input",this,this.vG);return c};
b.JH=function(){this.Tk=!1;this.Lt=!0;Fb(this);this.su&&this.su(this.dc);g.Xa(this.vu);g.Xa(this.xG);var a=g.aa.Ga.style;a.width="auto";a.height="auto";a.fontSize=""};b.tu=function(a){a.keyCode==g.g.Ba.Uq?(g.aa.Ca(),g.D.Ok()):a.keyCode==g.g.Ba.Vq?(this.Zc.value=this.Zc.defaultValue,g.aa.Ca(),g.D.Ok()):a.keyCode==g.g.Ba.Cw&&(g.aa.Ca(),g.D.Ok(),sc(this.B,this,!a.shiftKey),a.preventDefault())};b.vG=function(){var a=this.Zc.value;a!==this.Zc.yz&&(this.Zc.yz=a,g.i.$(!0),this.setValue(a),Fb(this),g.i.$(!1))};
b.jq=function(){var a=g.aa.Ga;var c=this.Vi.getBBox();var d=c.height*this.B.v.scale;var e=c.width*this.B.v.scale;var f=g.g.style.wp(this.Vi);c=f.y;d=f.y+d;var h=f.x;e=f.x+e;a.style.width=e-h+"px";a.style.height=d-c+"px";c=new g.g.N(this.B.G?e-a.offsetWidth:h,c);c.y+=1;g.g.userAgent.Yq&&g.aa.Ga.style.top&&(--c.x,--c.y);g.g.userAgent.Qr&&(c.y-=3);a.style.left=c.x+"px";a.style.top=c.y+"px"};
g.Ab.oG=function(a){console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);return isNaN(a)?null:String(a)};g.Ab.sM=function(a){(a=g.Ab.oG(a))&&(a=String(Math.max(0,Math.floor(a))));return a};g.Ab.prototype.bz=function(){return!0};g.Ab.prototype.st=function(){return this.Tk&&this.Zc?this.Zc.value:null};g.Wc.register("field_input",g.Ab);g.Jd=function(a,c,d,e,f,h){this.jn=-Infinity;this.gn=Infinity;this.cl=0;this.zs=null;g.Jd.w.constructor.call(this,a||0,f,h);h||(we(this,c),ze(this,d),Ae(this,e),this.setValue(this.getValue()))};g.g.object.W(g.Jd,g.Ab);g.Jd.va=function(a){return new g.Jd(a.value,void 0,void 0,void 0,void 0,a)};g.Jd.prototype.Ni=!0;g.Jd.prototype.Od=function(a){g.Jd.w.Od.call(this,a);we(this,a.min);ze(this,a.max);Ae(this,a.precision)};function we(a,c){null==c?a.jn=-Infinity:(c=Number(c),isNaN(c)||(a.jn=c))}
function ze(a,c){null==c?a.gn=Infinity:(c=Number(c),isNaN(c)||(a.gn=c))}function Ae(a,c){null==c?a.cl=0:(c=Number(c),isNaN(c)||(a.cl=c));var d=a.cl.toString(),e=d.indexOf(".");a.zs=-1==e?c?0:null:d.length-e-1}g.Jd.prototype.Hh=function(a){if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);if(isNaN(a))return null;a=Math.min(Math.max(a,this.jn),this.gn);this.cl&&isFinite(a)&&(a=Math.round(a/this.cl)*this.cl);null!=this.zs&&(a=Number(a.toFixed(this.zs)));return a};
g.Jd.prototype.ov=function(){var a=g.Jd.w.ov.call(this);-Infinity<this.jn&&g.g.V.Ib(a,g.g.V.State.bD,this.jn);Infinity>this.gn&&g.g.V.Ib(a,g.g.V.State.aD,this.gn);return a};g.Wc.register("field_number",g.Jd);g.Kd=function(a,c,d,e,f){this.xj=g.Kd.FE;this.oE=a||"";this.cc=new g.g.$e(0,g.wa.lr);f&&this.Od(f);c&&(this.Vj=c);f||Be(this,d,e)};g.g.object.W(g.Kd,g.Ka);g.Kd.va=function(a){var c=g.g.Xd(a.variable);return new g.Kd(c,void 0,void 0,void 0,a)};b=g.Kd.prototype;b.s=null;b.Ni=!0;b.Od=function(a){g.Kd.w.Od.call(this,a);Be(this,a.variableTypes,a.defaultType)};b.mj=function(){if(!this.ae){var a=g.O.vp(this.B.v,null,this.oE,this.nE);g.i.disable();this.setValue(a.ua());g.i.enable()}};
b.Fm=function(a){var c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";c=g.O.vp(this.B.v,c,d,e);if(null!=e&&e!==c.type)throw Error("Serialized variable type with id '"+c.ua()+"' had type "+c.type+", and does not match variable field that references it: "+g.R.Rd(a)+".");this.setValue(c.ua())};b.uA=function(a){this.mj();a.id=this.ae.ua();a.textContent=this.ae.name;this.ae.type&&a.setAttribute("variabletype",this.ae.type);return a};
b.Yu=function(a){if(a.bb)throw Error("Variable fields are not allowed to exist on shadow blocks.");g.Kd.w.Yu.call(this,a)};b.getValue=function(){return this.ae?this.ae.ua():null};b.Sb=function(){return this.ae?this.ae.name:""};b.Xc=function(){return this.ae};b.Dy=function(){return this.ae?this.Vj:null};
b.Hh=function(a){if(null===a)return null;var c=g.O.Xc(this.B.v,a);if(!c)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;c=c.type;var d;a:if(d=Ce(this)){for(var e=0;e<d.length;e++)if(c==d[e]){d=!0;break a}d=!1}else d=!0;return d?a:(console.warn("Variable type doesn't match this field!  Type was "+c),null)};b.ej=function(a){this.ae=g.O.Xc(this.B.v,a);g.Kd.w.ej.call(this,a)};
function Ce(a){var c=a.EH;if(null===c&&a.B&&a.B.v)return a.B.v.ut();c=c||[""];if(0==c.length)throw a=a.Sb(),Error("'variableTypes' of field variable "+a+" was an empty list");return c}
function Be(a,c,d){d=d||"";if(null==c||void 0==c)c=null;else if(Array.isArray(c)){for(var e=!1,f=0;f<c.length;f++)c[f]==d&&(e=!0);if(!e)throw Error("Invalid default type '"+d+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");a.nE=d;a.EH=c}
g.Kd.FE=function(){if(!this.ae)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");var a=this.Sb(),c=[];if(this.B&&this.B.v)for(var d=Ce(this),e=0;e<d.length;e++)c=c.concat(this.B.v.Lm(d[e]));c.sort(g.Zl.mx);d=[];for(e=0;e<c.length;e++)d[e]=[c[e].name,c[e].ua()];d.push([g.h.RENAME_VARIABLE,g.xw]);g.h.DELETE_VARIABLE&&d.push([g.h.DELETE_VARIABLE.replace("%1",a),g.Qv]);return d};
g.Kd.prototype.Dz=function(a){a=a.getValue();if(this.B&&this.B.v){if(a==g.xw){g.O.iq(this.B.v,this.ae);return}if(a==g.Qv){this.B.v.Rf(this.ae.ua());return}}this.setValue(a)};g.Kd.prototype.un=function(){return!0};g.Wc.register("field_variable",g.Kd);g.L.Ja={};g.ma={};g.ma.Math={};g.ma.Math.uo=230;
g.Fk([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],
["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",
name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",
extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",
options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},
{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",
helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}",
"RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",
message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,
output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",
style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);
g.ma.Math.Lr={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",
SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};
g.Y.register("math_op_tooltip",g.Y.Ro("OP",g.ma.Math.Lr));g.ma.Math.VB={cb:function(){var a=g.g.xml.createElement("mutation"),c="DIVISIBLE_BY"==F(this,"PROPERTY");a.setAttribute("divisor_input",c);return a},Cb:function(a){a="true"==a.getAttribute("divisor_input");this.Nc(a)},Nc:function(a){var c=A(this,"DIVISOR");a?c||M(this,"DIVISOR").xb("Number"):c&&this.ib("DIVISOR")}};g.ma.Math.WB=function(){Db(x(this,"PROPERTY"),function(a){this.B.Nc("DIVISIBLE_BY"==a)})};
g.Y.Ju("math_is_divisibleby_mutator",g.ma.Math.VB,g.ma.Math.WB);g.Y.register("math_change_tooltip",g.Y.ls("%{BKY_MATH_CHANGE_TOOLTIP}"));g.ma.Math.dC={Wn:function(a){"MODE"==a?this.M.xb("Array"):this.M.xb("Number")},cb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("op",F(this,"OP"));return a},Cb:function(a){this.Wn(a.getAttribute("op"))}};g.ma.Math.cC=function(){Db(x(this,"OP"),function(a){this.Wn(a)}.bind(this))};g.Y.Ju("math_modes_of_list_mutator",g.ma.Math.dC,g.ma.Math.cC);g.ka=function(a,c,d){this.jm=g.ka.gB;this.Dj=g.ka.rh;this.HA=g.ka.gD;this.xn=g.ka.GC;g.ka.w.constructor.call(this,a||0,c,d)};g.g.object.W(g.ka,g.Ab);g.ka.va=function(a){return new g.ka(a.angle,void 0,a)};g.ka.prototype.Ni=!0;g.ka.GC=15;g.ka.nc=50;g.ka.gB=!1;g.ka.rh=0;g.ka.gD=360;g.ka.zg=g.ka.nc-1;b=g.ka.prototype;
b.Od=function(a){g.ka.w.Od.call(this,a);switch(a.mode){case "compass":this.jm=!0;this.Dj=90;break;case "protractor":this.jm=!1,this.Dj=0}var c=a.clockwise;"boolean"==typeof c&&(this.jm=c);c=a.offset;null!=c&&(c=Number(c),isNaN(c)||(this.Dj=c));c=a.wrap;null!=c&&(c=Number(c),isNaN(c)||(this.HA=c));a=a.round;null!=a&&(a=Number(a),isNaN(a)||(this.xn=a))};b.Sh=function(){g.ka.w.Sh.call(this);this.sA=g.g.o.I("tspan",{},null);this.sA.appendChild(document.createTextNode("\u00b0"));this.kc.appendChild(this.sA)};
b.eg=function(){g.ka.w.eg.call(this);De(this)};b.wf=function(){g.ka.w.wf.call(this,g.g.userAgent.iw||g.g.userAgent.xi||g.g.userAgent.xg);var a=this.Xs();g.D.oy().appendChild(a);a=Ob(this.B);a=a.Yo||a.ts;g.D.Kc(this.B.Eh,a);g.D.jA(this,this.Ys.bind(this));De(this)};
b.Xs=function(){var a=g.g.o.I("svg",{xmlns:g.g.o.Vl,"xmlns:html":g.g.o.Fi,"xmlns:xlink":g.g.o.Kf,version:"1.1",height:2*g.ka.nc+"px",width:2*g.ka.nc+"px",style:"touch-action: none"},null),c=g.g.o.I("circle",{cx:g.ka.nc,cy:g.ka.nc,r:g.ka.zg,"class":"blocklyAngleCircle"},a);this.ft=g.g.o.I("path",{"class":"blocklyAngleGauge"},a);this.gz=g.g.o.I("line",{x1:g.ka.nc,y1:g.ka.nc,"class":"blocklyAngleLine"},a);for(var d=0;360>d;d+=15)g.g.o.I("line",{x1:g.ka.nc+g.ka.zg,y1:g.ka.nc,x2:g.ka.nc+g.ka.zg-(0==d%
45?10:5),y2:g.ka.nc,"class":"blocklyAngleMarks",transform:"rotate("+d+","+g.ka.nc+","+g.ka.nc+")"},a);this.UD=g.la(a,"click",this,this.AF);this.TD=g.la(c,"click",this,this.Iz,!0,!0);this.gG=g.la(c,"mousemove",this,this.Iz,!0,!0);return a};b.Ys=function(){g.Xa(this.UD);g.Xa(this.TD);g.Xa(this.gG)};b.AF=function(){g.D.Nk(this);g.aa.Ca()};
b.Iz=function(a){var c=this.ft.ownerSVGElement.getBoundingClientRect(),d=a.clientX-c.left-g.ka.nc;a=a.clientY-c.top-g.ka.nc;c=Math.atan(-a/d);isNaN(c)||(c=g.g.Ja.rl(c),0>d?c+=180:0<a&&(c+=360),c=this.jm?this.Dj+360-c:360-(this.Dj-c),Ee(this,c))};function Ee(a,c){a.xn&&(c=Math.round(c/a.xn)*a.xn);c=Fe(a,c);c!=a.dc&&(a.Zf=!0,a.Tk&&(a.Zc.value=String(c)),a.setValue(c))}
function De(a){if(a.ft){var c=Number(a.Sb())+a.Dj,d=g.g.Ja.pd(c%360);c=["M ",g.ka.nc,",",g.ka.nc];var e=g.ka.nc,f=g.ka.nc;if(!isNaN(d)){var h=Number(a.jm),k=g.g.Ja.pd(a.Dj),l=Math.cos(k)*g.ka.zg,m=Math.sin(k)*-g.ka.zg;h&&(d=2*k-d);e+=Math.cos(d)*g.ka.zg;f-=Math.sin(d)*g.ka.zg;d=Math.abs(Math.floor((d-k)/Math.PI)%2);h&&(d=1-d);c.push(" l ",l,",",m," A ",g.ka.zg,",",g.ka.zg," 0 ",d," ",h," ",e,",",f," z")}a.ft.setAttribute("d",c.join(""));a.gz.setAttribute("x2",e);a.gz.setAttribute("y2",f)}}
b.tu=function(a){g.ka.w.tu.call(this,a);var c;a.keyCode===g.g.Ba.Ao?c=this.B.G?1:-1:a.keyCode===g.g.Ba.Io?c=this.B.G?-1:1:a.keyCode===g.g.Ba.El?c=-1:a.keyCode===g.g.Ba.Yl&&(c=1);if(c){var d=this.getValue();Ee(this,d+c*this.xn);a.preventDefault();a.stopPropagation()}};b.Hh=function(a){a=Number(a);return isNaN(a)||!isFinite(a)?null:Fe(this,a)};function Fe(a,c){c%=360;0>c&&(c+=360);c>a.HA&&(c-=360);return c}g.ed.register(".blocklyAngleCircle {,stroke: #444;,stroke-width: 1;,fill: #ddd;,fill-opacity: .8;,},.blocklyAngleMarks {,stroke: #444;,stroke-width: 1;,},.blocklyAngleGauge {,fill: #f88;,fill-opacity: .8;,pointer-events: none;,},.blocklyAngleLine {,stroke: #f00;,stroke-width: 2;,stroke-linecap: round;,pointer-events: none;,}".split(","));
g.Wc.register("field_angle",g.ka);g.Generator=function(a){this.kG=a;this.GB=new RegExp(this.xe,"g")};g.Generator.ub="generated_function";b=g.Generator.prototype;b.wo=null;b.Md=null;b.Tc=null;b.td="  ";b.jB=60;b.Fo=[];
function qd(){var a=g.j,c=B;c||(console.warn("No workspace specified in workspaceToCode call.  Guessing."),c=g.Db());var d=[];a.S(c);c=D(c,!0);for(var e=0,f;f=c[e];e++){var h=Ge(a,f);Array.isArray(h)&&(h=h[0]);h&&(f.M&&(h=a.bA(h),a.Md&&!f.si&&(h=Y(a.Md,f)+h),a.Tc&&!f.si&&(h+=Y(a.Tc,f))),d.push(h))}d=d.join("\n");d=a.finish(d);d=d.replace(/^\s+\n/,"");d=d.replace(/\n\s+$/,"\n");return d=d.replace(/[ \t]+\n/g,"\n")}function He(a,c){return c+a.replace(/(?!\n$)\n/g,"\n"+c)}
function Ge(a,c){if(!c)return"";if(!c.isEnabled())return Ge(a,q(c));var d=a[c.type];if("function"!=typeof d)throw Error('Language "'+a.kG+'" does not know how to generate  code for block type "'+c.type+'".');d=d.call(c,c);if(Array.isArray(d)){if(!c.M)throw TypeError("Expecting string from statement block: "+c.type);return[a.mq(c,d[0],void 0),d[1]]}if("string"==typeof d)return a.Md&&!c.si&&(d=Y(a.Md,c)+d),a.Tc&&!c.si&&(d+=Y(a.Tc,c)),a.mq(c,d,void 0);if(null===d)return"";throw SyntaxError("Invalid code generated: "+
d);}
function Z(a,c,d){var e=g.j;if(isNaN(d))throw TypeError("Expecting valid order from block: "+a.type);var f=Tb(a,c);if(!f)return"";c=Ge(e,f);if(""===c)return"";if(!Array.isArray(c))throw TypeError("Expecting tuple from value block: "+f.type);a=c[0];c=c[1];if(isNaN(c))throw TypeError("Expecting valid order from value block: "+f.type);if(!a)return"";f=!1;var h=Math.floor(d),k=Math.floor(c);if(h<=k&&(h!=k||0!=h&&99!=h))for(f=!0,h=0;h<e.Fo.length;h++)if(e.Fo[h][0]==d&&e.Fo[h][1]==c){f=!1;break}f&&(a="("+
a+")");return a}function Ie(a,c){var d=g.j;a=Tb(a,c);c=Ge(d,a);if("string"!=typeof c)throw TypeError("Expecting code from statement block: "+(a&&a.type));c&&(c=He(c,d.td));return c}function Je(a,c){var d=g.j;d.wo&&(a=He(Y(d.wo,c),d.td)+a);d.Tc&&!c.si&&(a=He(Y(d.Tc,c),d.td)+a);d.Md&&!c.si&&(a+=He(Y(d.Md,c),d.td));return a}function Y(a,c){c=c.id.replace(/\$/g,"$$$$");return a.replace(/%1/g,"'"+c+"'")}b.zr="";function Ke(a){var c=g.j;c.zr+=a+","}b.xe="{leCUI8hutHZI4480Dc}";
function Le(a,c){var d=g.j;if(!d.cj[a]){var e=Lc(d.Gd,a,g.Ha.ub);d.dt[a]=e;c=c.join("\n").replace(d.GB,e);for(var f;f!=c;)f=c,c=c.replace(/^(( {2})*) {2}/gm,"$1\x00");c=c.replace(/\0/g,d.td);d.cj[a]=c}return d.dt[a]}b.S=function(){};b.mq=function(a,c){return c};b.finish=function(a){return a};b.bA=function(a){return a};g.j=new g.Generator("JavaScript");Ke("Blockly,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,enum,export,extends,import,super,implements,interface,let,package,private,protected,public,static,yield,const,null,true,false,Array,ArrayBuffer,Boolean,Date,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Error,eval,EvalError,Float32Array,Float64Array,Function,Infinity,Int16Array,Int32Array,Int8Array,isFinite,isNaN,Iterator,JSON,Math,NaN,Number,Object,parseFloat,parseInt,RangeError,ReferenceError,RegExp,StopIteration,String,SyntaxError,TypeError,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray,undefined,uneval,URIError,applicationCache,closed,Components,content,_content,controllers,crypto,defaultStatus,dialogArguments,directories,document,frameElement,frames,fullScreen,globalStorage,history,innerHeight,innerWidth,length,location,locationbar,localStorage,menubar,messageManager,mozAnimationStartTime,mozInnerScreenX,mozInnerScreenY,mozPaintCount,name,navigator,opener,outerHeight,outerWidth,pageXOffset,pageYOffset,parent,performance,personalbar,pkcs11,returnValue,screen,screenX,screenY,scrollbars,scrollMaxX,scrollMaxY,scrollX,scrollY,self,sessionStorage,sidebar,status,statusbar,toolbar,top,URL,window,addEventListener,alert,atob,back,blur,btoa,captureEvents,clearImmediate,clearInterval,clearTimeout,close,confirm,disableExternalCapture,dispatchEvent,dump,enableExternalCapture,escape,find,focus,forward,GeckoActiveXObject,getAttention,getAttentionWithCycleCount,getComputedStyle,getSelection,home,matchMedia,maximize,minimize,moveBy,moveTo,mozRequestAnimationFrame,open,openDialog,postMessage,print,prompt,QueryInterface,releaseEvents,removeEventListener,resizeBy,resizeTo,restore,routeEvent,scroll,scrollBy,scrollByLines,scrollByPages,scrollTo,setCursor,setImmediate,setInterval,setResizable,setTimeout,showModalDialog,sizeToContent,stop,unescape,updateCommands,XPCNativeWrapper,XPCSafeJSObjectWrapper,onabort,onbeforeunload,onblur,onchange,onclick,onclose,oncontextmenu,ondevicemotion,ondeviceorientation,ondragdrop,onerror,onfocus,onhashchange,onkeydown,onkeypress,onkeyup,onload,onmousedown,onmousemove,onmouseout,onmouseover,onmouseup,onmozbeforepaint,onpaint,onpopstate,onreset,onresize,onscroll,onselect,onsubmit,onunload,onpageshow,onpagehide,Image,Option,Worker,Event,Range,File,FileReader,Blob,BlobBuilder,Attr,CDATASection,CharacterData,Comment,console,DocumentFragment,DocumentType,DomConfiguration,DOMError,DOMErrorHandler,DOMException,DOMImplementation,DOMImplementationList,DOMImplementationRegistry,DOMImplementationSource,DOMLocator,DOMObject,DOMString,DOMStringList,DOMTimeStamp,DOMUserData,Entity,EntityReference,MediaQueryList,MediaQueryListListener,NameList,NamedNodeMap,Node,NodeFilter,NodeIterator,NodeList,Notation,Plugin,PluginArray,ProcessingInstruction,SharedWorker,Text,TimeRanges,Treewalker,TypeInfo,UserDataHandler,Worker,WorkerGlobalScope,HTMLDocument,HTMLElement,HTMLAnchorElement,HTMLAppletElement,HTMLAudioElement,HTMLAreaElement,HTMLBaseElement,HTMLBaseFontElement,HTMLBodyElement,HTMLBRElement,HTMLButtonElement,HTMLCanvasElement,HTMLDirectoryElement,HTMLDivElement,HTMLDListElement,HTMLEmbedElement,HTMLFieldSetElement,HTMLFontElement,HTMLFormElement,HTMLFrameElement,HTMLFrameSetElement,HTMLHeadElement,HTMLHeadingElement,HTMLHtmlElement,HTMLHRElement,HTMLIFrameElement,HTMLImageElement,HTMLInputElement,HTMLKeygenElement,HTMLLabelElement,HTMLLIElement,HTMLLinkElement,HTMLMapElement,HTMLMenuElement,HTMLMetaElement,HTMLModElement,HTMLObjectElement,HTMLOListElement,HTMLOptGroupElement,HTMLOptionElement,HTMLOutputElement,HTMLParagraphElement,HTMLParamElement,HTMLPreElement,HTMLQuoteElement,HTMLScriptElement,HTMLSelectElement,HTMLSourceElement,HTMLSpanElement,HTMLStyleElement,HTMLTableElement,HTMLTableCaptionElement,HTMLTableCellElement,HTMLTableDataCellElement,HTMLTableHeaderCellElement,HTMLTableColElement,HTMLTableRowElement,HTMLTableSectionElement,HTMLTextAreaElement,HTMLTimeElement,HTMLTitleElement,HTMLTrackElement,HTMLUListElement,HTMLUnknownElement,HTMLVideoElement,HTMLCanvasElement,CanvasRenderingContext2D,CanvasGradient,CanvasPattern,TextMetrics,ImageData,CanvasPixelArray,HTMLAudioElement,HTMLVideoElement,NotifyAudioAvailableEvent,HTMLCollection,HTMLAllCollection,HTMLFormControlsCollection,HTMLOptionsCollection,HTMLPropertiesCollection,DOMTokenList,DOMSettableTokenList,DOMStringMap,RadioNodeList,SVGDocument,SVGElement,SVGAElement,SVGAltGlyphElement,SVGAltGlyphDefElement,SVGAltGlyphItemElement,SVGAnimationElement,SVGAnimateElement,SVGAnimateColorElement,SVGAnimateMotionElement,SVGAnimateTransformElement,SVGSetElement,SVGCircleElement,SVGClipPathElement,SVGColorProfileElement,SVGCursorElement,SVGDefsElement,SVGDescElement,SVGEllipseElement,SVGFilterElement,SVGFilterPrimitiveStandardAttributes,SVGFEBlendElement,SVGFEColorMatrixElement,SVGFEComponentTransferElement,SVGFECompositeElement,SVGFEConvolveMatrixElement,SVGFEDiffuseLightingElement,SVGFEDisplacementMapElement,SVGFEDistantLightElement,SVGFEFloodElement,SVGFEGaussianBlurElement,SVGFEImageElement,SVGFEMergeElement,SVGFEMergeNodeElement,SVGFEMorphologyElement,SVGFEOffsetElement,SVGFEPointLightElement,SVGFESpecularLightingElement,SVGFESpotLightElement,SVGFETileElement,SVGFETurbulenceElement,SVGComponentTransferFunctionElement,SVGFEFuncRElement,SVGFEFuncGElement,SVGFEFuncBElement,SVGFEFuncAElement,SVGFontElement,SVGFontFaceElement,SVGFontFaceFormatElement,SVGFontFaceNameElement,SVGFontFaceSrcElement,SVGFontFaceUriElement,SVGForeignObjectElement,SVGGElement,SVGGlyphElement,SVGGlyphRefElement,SVGGradientElement,SVGLinearGradientElement,SVGRadialGradientElement,SVGHKernElement,SVGImageElement,SVGLineElement,SVGMarkerElement,SVGMaskElement,SVGMetadataElement,SVGMissingGlyphElement,SVGMPathElement,SVGPathElement,SVGPatternElement,SVGPolylineElement,SVGPolygonElement,SVGRectElement,SVGScriptElement,SVGStopElement,SVGStyleElement,SVGSVGElement,SVGSwitchElement,SVGSymbolElement,SVGTextElement,SVGTextPathElement,SVGTitleElement,SVGTRefElement,SVGTSpanElement,SVGUseElement,SVGViewElement,SVGVKernElement,SVGAngle,SVGColor,SVGICCColor,SVGElementInstance,SVGElementInstanceList,SVGLength,SVGLengthList,SVGMatrix,SVGNumber,SVGNumberList,SVGPaint,SVGPoint,SVGPointList,SVGPreserveAspectRatio,SVGRect,SVGStringList,SVGTransform,SVGTransformList,SVGAnimatedAngle,SVGAnimatedBoolean,SVGAnimatedEnumeration,SVGAnimatedInteger,SVGAnimatedLength,SVGAnimatedLengthList,SVGAnimatedNumber,SVGAnimatedNumberList,SVGAnimatedPreserveAspectRatio,SVGAnimatedRect,SVGAnimatedString,SVGAnimatedTransformList,SVGPathSegList,SVGPathSeg,SVGPathSegArcAbs,SVGPathSegArcRel,SVGPathSegClosePath,SVGPathSegCurvetoCubicAbs,SVGPathSegCurvetoCubicRel,SVGPathSegCurvetoCubicSmoothAbs,SVGPathSegCurvetoCubicSmoothRel,SVGPathSegCurvetoQuadraticAbs,SVGPathSegCurvetoQuadraticRel,SVGPathSegCurvetoQuadraticSmoothAbs,SVGPathSegCurvetoQuadraticSmoothRel,SVGPathSegLinetoAbs,SVGPathSegLinetoHorizontalAbs,SVGPathSegLinetoHorizontalRel,SVGPathSegLinetoRel,SVGPathSegLinetoVerticalAbs,SVGPathSegLinetoVerticalRel,SVGPathSegMovetoAbs,SVGPathSegMovetoRel,ElementTimeControl,TimeEvent,SVGAnimatedPathData,SVGAnimatedPoints,SVGColorProfileRule,SVGCSSRule,SVGExternalResourcesRequired,SVGFitToViewBox,SVGLangSpace,SVGLocatable,SVGRenderingIntent,SVGStylable,SVGTests,SVGTextContentElement,SVGTextPositioningElement,SVGTransformable,SVGUnitTypes,SVGURIReference,SVGViewSpec,SVGZoomAndPan");
g.j.Ii=0;g.j.BK=1.1;g.j.Qb=1.2;g.j.gb=2;g.j.zK=3;g.j.vK=3;g.j.rK=4.1;g.j.DK=4.2;g.j.Rl=4.3;g.j.Pl=4.4;g.j.CK=4.5;g.j.EK=4.6;g.j.wK=4.7;g.j.pK=4.8;g.j.xK=5;g.j.rr=5.1;g.j.Ol=5.2;g.j.Ql=5.3;g.j.pk=6.1;g.j.sh=6.2;g.j.tK=7;g.j.wC=8;g.j.yK=8;g.j.AK=8;g.j.mw=9;g.j.qK=10;g.j.uK=11;g.j.sK=12;g.j.pr=13;g.j.qr=14;g.j.Eo=15;g.j.yg=16;g.j.FK=17;g.j.Qc=18;g.j.Rc=99;g.j.Fo=[[g.j.gb,g.j.Qb],[g.j.gb,g.j.gb],[g.j.Qb,g.j.Qb],[g.j.Qb,g.j.gb],[g.j.Pl,g.j.Pl],[g.j.rr,g.j.rr],[g.j.sh,g.j.sh],[g.j.pr,g.j.pr],[g.j.qr,g.j.qr]];
g.j.S=function(a){g.j.cj=Object.create(null);g.j.dt=Object.create(null);g.j.Gd?g.j.Gd.reset():g.j.Gd=new g.fe(g.j.zr);g.j.Gd.Ta=a.Ta;for(var c=[],d=g.O.rD(a),e=0;e<d.length;e++)c.push(P(d[e],g.fe.Tq));a=g.O.Sw(a);for(e=0;e<a.length;e++)c.push(P(a[e].ua(),g.O.ub));c.length&&(g.j.cj.variables="var "+c.join(", ")+";")};g.j.finish=function(a){var c=[],d;for(d in g.j.cj)c.push(g.j.cj[d]);delete g.j.cj;delete g.j.dt;g.j.Gd.reset();return c.join("\n\n")+"\n\n\n"+a};g.j.bA=function(a){return a+";\n"};
g.j.PG=function(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,"\\'");return"'"+a+"'"};g.j.rM=function(a){return a.split(/\n/g).map(g.j.PG).join(" + '\\n' +\n")};
g.j.mq=function(a,c,d){var e="";if(!a.M||!a.M.ca){var f=a.Ee.text;f&&(f=g.g.eb.FA(f,g.j.jB-3),e+=He(f+"\n","// "));for(var h=0;h<a.T.length;h++)if(a.T[h].type==g.Wa){var k=y(a.T[h].connection);if(k){f=[];k=p(k,!0);for(var l=0;l<k.length;l++){var m=k[l].Ee.text;m&&f.push(m)}f.length&&f.push("");(f=f.join("\n"))&&(e+=He(f,"// "))}}}a=a.X&&y(a.X);d=d?"":Ge(g.j,a);return e+c+d};
g.j.Vf=function(a,c,d,e,f){d=d||0;f=f||g.j.Rc;a.v.options.Re&&d--;var h=a.v.options.Re?"1":"0";a=0<d?Z(a,c,g.j.sh)||h:0>d?Z(a,c,g.j.pk)||h:e?Z(a,c,g.j.Rl)||h:Z(a,c,f)||h;if(g.Yh(a))a=Number(a)+d,e&&(a=-a);else{if(0<d){a=a+" + "+d;var k=g.j.sh}else 0>d&&(a=a+" - "+-d,k=g.j.pk);e&&(a=d?"-("+a+")":"-"+a,k=g.j.Rl);k=Math.floor(k);f=Math.floor(f);k&&f>=k&&(a="("+a+")")}return a};g.j.Ja={};g.j.math_number=function(a){a=Number(F(a,"NUM"));return[a,0<=a?g.j.Ii:g.j.Rl]};g.j.math_arithmetic=function(a){var c={ADD:[" + ",g.j.sh],MINUS:[" - ",g.j.pk],MULTIPLY:[" * ",g.j.rr],DIVIDE:[" / ",g.j.Ol],POWER:[null,g.j.Qc]}[F(a,"OP")],d=c[0];c=c[1];var e=Z(a,"A",c)||"0";a=Z(a,"B",c)||"0";return d?[e+d+a,c]:["Math.pow("+e+", "+a+")",g.j.gb]};
g.j.math_single=function(a){var c=F(a,"OP");if("NEG"==c)return a=Z(a,"NUM",g.j.Rl)||"0","-"==a[0]&&(a=" "+a),["-"+a,g.j.Rl];a="SIN"==c||"COS"==c||"TAN"==c?Z(a,"NUM",g.j.Ol)||"0":Z(a,"NUM",g.j.Rc)||"0";switch(c){case "ABS":var d="Math.abs("+a+")";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+a+")";break;case "POW10":d="Math.pow(10,"+a+")";break;case "ROUND":d="Math.round("+a+")";break;case "ROUNDUP":d="Math.ceil("+a+")";break;case "ROUNDDOWN":d=
"Math.floor("+a+")";break;case "SIN":d="Math.sin("+a+" / 180 * Math.PI)";break;case "COS":d="Math.cos("+a+" / 180 * Math.PI)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.PI)"}if(d)return[d,g.j.gb];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.PI * 180";break;case "ACOS":d="Math.acos("+a+") / Math.PI * 180";break;case "ATAN":d="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,g.j.Ol]};
g.j.math_constant=function(a){return{PI:["Math.PI",g.j.Qb],E:["Math.E",g.j.Qb],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",g.j.Ol],SQRT2:["Math.SQRT2",g.j.Qb],SQRT1_2:["Math.SQRT1_2",g.j.Qb],INFINITY:["Infinity",g.j.Ii]}[F(a,"CONSTANT")]};
g.j.math_number_property=function(a){var c=Z(a,"NUMBER_TO_CHECK",g.j.Ql)||"0",d=F(a,"PROPERTY");if("PRIME"==d){var e=Le("mathIsPrime",["function "+g.j.xe+"(n) {","  // https://en.wikipedia.org/wiki/Primality_test#Naive_methods","  if (n == 2 || n == 3) {","    return true;","  }","  // False if n is NaN, negative, is 1, or not whole.","  // And false if n is divisible by 2 or 3.","  if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {","    return false;","  }","  // Check all the numbers of form 6k +/- 1, up to sqrt(n).",
"  for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {","    if (n % (x - 1) == 0 || n % (x + 1) == 0) {","      return false;","    }","  }","  return true;","}"])+"("+c+")";return[e,g.j.gb]}switch(d){case "EVEN":e=c+" % 2 == 0";break;case "ODD":e=c+" % 2 == 1";break;case "WHOLE":e=c+" % 1 == 0";break;case "POSITIVE":e=c+" > 0";break;case "NEGATIVE":e=c+" < 0";break;case "DIVISIBLE_BY":a=Z(a,"DIVISOR",g.j.Ql)||"0",e=c+" % "+a+" == 0"}return[e,g.j.mw]};
g.j.math_change=function(a){var c=Z(a,"DELTA",g.j.sh)||"0";a=P(F(a,"VAR"),g.O.ub);return a+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+c+";\n"};g.j.math_round=g.j.math_single;g.j.math_trig=g.j.math_single;
g.j.math_on_list=function(a){var c=F(a,"OP");switch(c){case "SUM":a=Z(a,"LIST",g.j.Qb)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=Z(a,"LIST",g.j.Qc)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=Z(a,"LIST",g.j.Qc)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":c=Le("mathMean",["function "+g.j.xe+"(myList) {","  return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]);a=Z(a,"LIST",g.j.Rc)||"[]";a=c+"("+a+")";break;case "MEDIAN":c=
Le("mathMedian",["function "+g.j.xe+"(myList) {","  var localList = myList.filter(function (x) {return typeof x == 'number';});","  if (!localList.length) return null;","  localList.sort(function(a, b) {return b - a;});","  if (localList.length % 2 == 0) {","    return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;","  } else {","    return localList[(localList.length - 1) / 2];","  }","}"]);a=Z(a,"LIST",g.j.Rc)||"[]";a=c+"("+a+")";break;case "MODE":c=Le("mathModes",
["function "+g.j.xe+"(values) {","  var modes = [];","  var counts = [];","  var maxCount = 0;","  for (var i = 0; i < values.length; i++) {","    var value = values[i];","    var found = false;","    var thisCount;","    for (var j = 0; j < counts.length; j++) {","      if (counts[j][0] === value) {","        thisCount = ++counts[j][1];","        found = true;","        break;","      }","    }","    if (!found) {","      counts.push([value, 1]);","      thisCount = 1;","    }","    maxCount = Math.max(thisCount, maxCount);",
"  }","  for (var j = 0; j < counts.length; j++) {","    if (counts[j][1] == maxCount) {","        modes.push(counts[j][0]);","    }","  }","  return modes;","}"]);a=Z(a,"LIST",g.j.Rc)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=Le("mathStandardDeviation",["function "+g.j.xe+"(numbers) {","  var n = numbers.length;","  if (!n) return null;","  var mean = numbers.reduce(function(x, y) {return x + y;}) / n;","  var variance = 0;","  for (var j = 0; j < n; j++) {","    variance += Math.pow(numbers[j] - mean, 2);",
"  }","  variance = variance / n;","  return Math.sqrt(variance);","}"]);a=Z(a,"LIST",g.j.Rc)||"[]";a=c+"("+a+")";break;case "RANDOM":c=Le("mathRandomList",["function "+g.j.xe+"(list) {","  var x = Math.floor(Math.random() * list.length);","  return list[x];","}"]);a=Z(a,"LIST",g.j.Rc)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,g.j.gb]};g.j.math_modulo=function(a){var c=Z(a,"DIVIDEND",g.j.Ql)||"0";a=Z(a,"DIVISOR",g.j.Ql)||"0";return[c+" % "+a,g.j.Ql]};
g.j.math_constrain=function(a){var c=Z(a,"VALUE",g.j.Qc)||"0",d=Z(a,"LOW",g.j.Qc)||"0";a=Z(a,"HIGH",g.j.Qc)||"Infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",g.j.gb]};
g.j.math_random_int=function(a){var c=Z(a,"FROM",g.j.Qc)||"0";a=Z(a,"TO",g.j.Qc)||"0";return[Le("mathRandomInt",["function "+g.j.xe+"(a, b) {","  if (a > b) {","    // Swap a and b to ensure a is smaller.","    var c = a;","    a = b;","    b = c;","  }","  return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+c+", "+a+")",g.j.gb]};g.j.math_random_float=function(){return["Math.random()",g.j.gb]};
g.j.math_atan2=function(a){var c=Z(a,"X",g.j.Qc)||"0";return["Math.atan2("+(Z(a,"Y",g.j.Qc)||"0")+", "+c+") / Math.PI * 180",g.j.Ol]};g.Pb=function(a){g.Pb.w.constructor.call(this,null);this.Vz=a};g.g.object.W(g.Pb,g.Ld);b=g.Pb.prototype;b.xl=0;b.Zn=0;
b.Qs=function(a){g.g.o.I("rect",{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);g.g.o.I("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);
g.g.o.I("circle",{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};b.Dt=function(a){this.U.ld()&&g.Ld.prototype.Dt.call(this,a)};
b.xs=function(){this.Ln=g.g.o.I("svg",{x:g.oa.dd,y:g.oa.dd},null);if(this.Vz.length)for(var a=g.g.xml.createElement("xml"),c=0,d;d=this.Vz[c];c++){var e=g.g.xml.createElement("block");e.setAttribute("type",d);a.appendChild(e)}else a=null;a={disable:!1,Pg:this.U.v.options.Pg,Yk:a,Ob:this.U.v,uf:this.U.v.options.uf,G:this.U.G,Fa:this.U.G?g.Cg:g.Nd,Td:!1,hc:this.cF.bind(this),pi:null,dh:this.U.v.options.dh};this.s=new g.lb(a);this.s.sj=!0;ib(this.s,g.i.uE);a=Cc(this.s,"g");c=this.s.Ia("blocklyMutatorBackground");
c.insertBefore(a,this.s.fb);this.Ln.appendChild(c);return this.Ln};b.lh=function(){g.Pb.w.lh.call(this);this.U.ac||(this.U.ld()?this.Ud&&g.g.o.Tb(this.Ud,"blocklyIconGroupReadonly"):(this.Vb(!1),this.Ud&&g.g.o.mb(this.Ud,"blocklyIconGroupReadonly")))};
function Me(a){var c=2*g.oa.dd,d=a.s.fb.getBBox();var e=a.U.G?-d.x:d.width+d.x;d=d.height+3*c;if(a.s.P){var f=a.s.P.Km();d=Math.max(d,f.Pd+20)}e+=3*c;if(Math.abs(a.xl-e)>c||Math.abs(a.Zn-d)>c)a.xl=e,a.Zn=d,a.Zb.zn(e+c,d+c),a.Ln.setAttribute("width",a.xl),a.Ln.setAttribute("height",a.Zn);a.U.G&&a.s.fb.setAttribute("transform","translate("+a.xl+",0)");a.s.resize()}
b.Vb=function(a){if(a!=this.isVisible())if(g.i.Ma(new g.i.xd(this.U,"mutatorOpen",!a,a)),a){this.Zb=new g.oa(this.U.v,this.xs(),this.U.$d,this.Qk,null,null);mb(this.Zb,this.U.id);if(a=this.s.options.Yk)this.s.P.S(this.s),this.s.P.show(a.childNodes);this.fh=this.U.Ng(this.s);a=p(this.fh,!1);for(var c=0,d;d=a[c];c++)d.za();this.fh.oq(!1);this.fh.Bs=!1;this.s.P?(a=2*this.s.P.zb,c=Dc(this.s).Xf()+a):c=a=16;this.U.G&&(c=-c);this.fh.moveBy(c,a);if(this.U.lq){var e=this;this.U.lq(this.fh);this.qq=function(){e.U.lq(e.fh)};
ib(this.U.v,this.qq)}Me(this);ib(this.s,this.KH.bind(this));this.Ue()}else this.Ln=null,this.s.J(),this.fh=this.s=null,this.Zb.J(),this.Zb=null,this.Zn=this.xl=0,this.qq&&(jb(this.U.v,this.qq),this.qq=null)};
b.KH=function(a){if(a.type!=g.i.Oo&&(a.type!=g.i.zi||"disabled"!=a.element)){if(!this.s.ic()){a=D(this.s,!1);for(var c=0,d;d=a[c];c++){var e=d.Ra(),f=G(d);20>e.y+f.height&&d.moveBy(0,20-f.height-e.y)}}if(this.fh.v==this.s){g.i.$(!0);d=this.U;a=(a=d.cb())&&g.R.Rd(a);c=d.ba;d.ba=!1;d.Kg(this.fh);d.ba=c;d.Ne();c=(c=d.cb())&&g.R.Rd(c);if(a!=c){g.i.Ma(new g.i.pg(d,"mutation",null,a,c));var h=g.i.$b();setTimeout(function(){g.i.$(h);d.Lb();g.i.$(!1)},g.co)}d.ba&&d.za();a!=c&&g.Oe&&g.navigation.fG(d);this.s.ic()||
Me(this);g.i.$(!1)}}};b.cF=function(){return{yb:this.Zn,rb:this.xl-Dc(this.s).Xf(),Ac:0,oc:this.s.G?0:Dc(this.s).Xf()}};b.J=function(){this.U.Vd=null;g.Ld.prototype.J.call(this)};g.Pb.hl=function(a,c,d){if(!a||!a.B.v)return!1;d=A(c,d).connection;var e=y(a);return e&&e!=c||d.ca==a?!1:(d.isConnected()&&d.disconnect(),d.connect(a),!0)};g.Pb.Zx=function(a){var c=null;if(a&&a.options){var d=a.options.Ob;a.oe?d&&d.options&&(c=d.options.Ob):d&&(c=d)}return c};g.L.Ut={};g.ma.jC={};g.ma.jC.uo=260;
g.Fk([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",
args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",
name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
g.L.lists_create_with={S:function(){this.wb=g.h.LISTS_CREATE_WITH_HELPURL;L(this,"list_blocks");this.Cd=3;this.Nc();this.Ed(!0,"Array");this.ri(new g.Pb(["lists_create_with_item"]));this.Sa(g.h.LISTS_CREATE_WITH_TOOLTIP)},cb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("items",this.Cd);return a},Cb:function(a){this.Cd=parseInt(a.getAttribute("items"),10);this.Nc()},Ng:function(a){var c=a.ci("lists_create_with_container");c.Ne();for(var d=A(c,"STACK").connection,e=0;e<this.Cd;e++){var f=
a.ci("lists_create_with_item");f.Ne();d.connect(f.Z);d=f.X}return c},Kg:function(a){var c=Tb(a,"STACK");for(a=[];c;)a.push(c.nv),c=c.X&&y(c.X);for(c=0;c<this.Cd;c++){var d=A(this,"ADD"+c).connection.ca;d&&-1==a.indexOf(d)&&d.disconnect()}this.Cd=a.length;this.Nc();for(c=0;c<this.Cd;c++)g.Pb.hl(a[c],this,"ADD"+c)},lq:function(a){a=Tb(a,"STACK");for(var c=0;a;){var d=A(this,"ADD"+c);a.nv=d&&d.connection.ca;c++;a=a.X&&y(a.X)}},Nc:function(){this.Cd&&A(this,"EMPTY")?this.ib("EMPTY"):this.Cd||A(this,"EMPTY")||
K(N(this,"EMPTY"),g.h.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.Cd;a++)if(!A(this,"ADD"+a)){var c=M(this,"ADD"+a);0==a&&K(c,g.h.LISTS_CREATE_WITH_INPUT_WITH)}for(;A(this,"ADD"+a);)this.ib("ADD"+a),a++}};g.L.lists_create_with_container={S:function(){L(this,"list_blocks");K(N(this),g.h.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);Rb(this,"STACK");this.Sa(g.h.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
g.L.lists_create_with_item={S:function(){L(this,"list_blocks");K(N(this),g.h.LISTS_CREATE_WITH_ITEM_TITLE);this.qe(!0);this.pe(!0);this.Sa(g.h.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
g.L.lists_indexOf={S:function(){var a=[[g.h.LISTS_INDEX_OF_FIRST,"FIRST"],[g.h.LISTS_INDEX_OF_LAST,"LAST"]];this.wb=g.h.LISTS_INDEX_OF_HELPURL;L(this,"list_blocks");this.Ed(!0,"Number");K(M(this,"VALUE").xb("Array"),g.h.LISTS_INDEX_OF_INPUT_IN_LIST);K(M(this,"FIND"),new g.Ka(a),"END");this.ad(!0);var c=this;this.Sa(function(){return g.h.LISTS_INDEX_OF_TOOLTIP.replace("%1",c.v.options.Re?"0":"-1")})}};
g.L.lists_getIndex={S:function(){var a=[[g.h.LISTS_GET_INDEX_GET,"GET"],[g.h.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[g.h.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.Rr=[[g.h.LISTS_GET_INDEX_FROM_START,"FROM_START"],[g.h.LISTS_GET_INDEX_FROM_END,"FROM_END"],[g.h.LISTS_GET_INDEX_FIRST,"FIRST"],[g.h.LISTS_GET_INDEX_LAST,"LAST"],[g.h.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.wb=g.h.LISTS_GET_INDEX_HELPURL;L(this,"list_blocks");a=new g.Ka(a,function(d){this.B.yA("REMOVE"==d)});K(M(this,"VALUE").xb("Array"),
g.h.LISTS_GET_INDEX_INPUT_IN_LIST);K(K(N(this),a,"MODE"),"","SPACE");N(this,"AT");g.h.LISTS_GET_INDEX_TAIL&&K(N(this,"TAIL"),g.h.LISTS_GET_INDEX_TAIL);this.ad(!0);this.Ed(!0);this.te(!0);var c=this;this.Sa(function(){var d=F(c,"MODE"),e=F(c,"WHERE"),f="";switch(d+" "+e){case "GET FROM_START":case "GET FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case "GET FIRST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case "GET RANDOM":f=
g.h.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case "GET_REMOVE LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case "GET_REMOVE RANDOM":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case "REMOVE FROM_START":case "REMOVE FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case "REMOVE FIRST":f=
g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case "REMOVE LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case "REMOVE RANDOM":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}if("FROM_START"==e||"FROM_END"==e)f+="  "+("FROM_START"==e?g.h.LISTS_INDEX_FROM_START_TOOLTIP:g.h.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",c.v.options.Re?"#1":"#0");return f})},cb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("statement",!this.M);a.setAttribute("at",A(this,"AT").type==g.Wa);return a},
Cb:function(a){var c="true"==a.getAttribute("statement");this.yA(c);a="false"!=a.getAttribute("at");this.te(a)},yA:function(a){a!=!this.M&&(z(this,!0),a?(this.Ed(!1),this.qe(!0),this.pe(!0)):(this.qe(!1),this.pe(!1),this.Ed(!0)))},te:function(a){this.ib("AT");this.ib("ORDINAL",!0);a?(M(this,"AT").xb("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&K(N(this,"ORDINAL"),g.h.ORDINAL_NUMBER_SUFFIX)):N(this,"AT");var c=new g.Ka(this.Rr,function(d){var e="FROM_START"==d||"FROM_END"==d;if(e!=a){var f=this.B;f.te(e);
Pb(f,d,"WHERE");return null}});K(A(this,"AT"),c,"WHERE");g.h.LISTS_GET_INDEX_TAIL&&Sb(this,"TAIL",null)}};
g.L.lists_setIndex={S:function(){var a=[[g.h.LISTS_SET_INDEX_SET,"SET"],[g.h.LISTS_SET_INDEX_INSERT,"INSERT"]];this.Rr=[[g.h.LISTS_GET_INDEX_FROM_START,"FROM_START"],[g.h.LISTS_GET_INDEX_FROM_END,"FROM_END"],[g.h.LISTS_GET_INDEX_FIRST,"FIRST"],[g.h.LISTS_GET_INDEX_LAST,"LAST"],[g.h.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.wb=g.h.LISTS_SET_INDEX_HELPURL;L(this,"list_blocks");K(M(this,"LIST").xb("Array"),g.h.LISTS_SET_INDEX_INPUT_IN_LIST);K(K(N(this),new g.Ka(a),"MODE"),"","SPACE");N(this,"AT");K(M(this,
"TO"),g.h.LISTS_SET_INDEX_INPUT_TO);this.ad(!0);this.qe(!0);this.pe(!0);this.Sa(g.h.LISTS_SET_INDEX_TOOLTIP);this.te(!0);var c=this;this.Sa(function(){var d=F(c,"MODE"),e=F(c,"WHERE"),f="";switch(d+" "+e){case "SET FROM_START":case "SET FROM_END":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case "INSERT FROM_START":case "INSERT FROM_END":f=
g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case "INSERT RANDOM":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if("FROM_START"==e||"FROM_END"==e)f+="  "+g.h.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",c.v.options.Re?"#1":"#0");return f})},cb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at",A(this,"AT").type==g.Wa);return a},Cb:function(a){a=
"false"!=a.getAttribute("at");this.te(a)},te:function(a){this.ib("AT");this.ib("ORDINAL",!0);a?(M(this,"AT").xb("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&K(N(this,"ORDINAL"),g.h.ORDINAL_NUMBER_SUFFIX)):N(this,"AT");var c=new g.Ka(this.Rr,function(d){var e="FROM_START"==d||"FROM_END"==d;if(e!=a){var f=this.B;f.te(e);Pb(f,d,"WHERE");return null}});Sb(this,"AT","TO");A(this,"ORDINAL")&&Sb(this,"ORDINAL","TO");K(A(this,"AT"),c,"WHERE")}};
g.L.lists_getSublist={S:function(){this.WHERE_OPTIONS_1=[[g.h.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[g.h.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[g.h.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[g.h.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[g.h.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[g.h.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.wb=g.h.LISTS_GET_SUBLIST_HELPURL;L(this,"list_blocks");K(M(this,"LIST").xb("Array"),g.h.LISTS_GET_SUBLIST_INPUT_IN_LIST);N(this,
"AT1");N(this,"AT2");g.h.LISTS_GET_SUBLIST_TAIL&&K(N(this,"TAIL"),g.h.LISTS_GET_SUBLIST_TAIL);this.ad(!0);this.Ed(!0,"Array");this.te(1,!0);this.te(2,!0);this.Sa(g.h.LISTS_GET_SUBLIST_TOOLTIP)},cb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at1",A(this,"AT1").type==g.Wa);a.setAttribute("at2",A(this,"AT2").type==g.Wa);return a},Cb:function(a){var c="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.te(1,c);this.te(2,a)},te:function(a,c){this.ib("AT"+a);this.ib("ORDINAL"+
a,!0);c?(M(this,"AT"+a).xb("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&K(N(this,"ORDINAL"+a),g.h.ORDINAL_NUMBER_SUFFIX)):N(this,"AT"+a);var d=new g.Ka(this["WHERE_OPTIONS_"+a],function(e){var f="FROM_START"==e||"FROM_END"==e;if(f!=c){var h=this.B;h.te(a,f);Pb(h,e,"WHERE"+a);return null}});K(A(this,"AT"+a),d,"WHERE"+a);1==a&&(Sb(this,"AT1","AT2"),A(this,"ORDINAL1")&&Sb(this,"ORDINAL1","AT2"));g.h.LISTS_GET_SUBLIST_TAIL&&Sb(this,"TAIL",null)}};
g.L.lists_sort={S:function(){O(this,{message0:g.h.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[g.h.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[g.h.LISTS_SORT_TYPE_TEXT,"TEXT"],[g.h.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[g.h.LISTS_SORT_ORDER_ASCENDING,"1"],[g.h.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:g.h.LISTS_SORT_TOOLTIP,helpUrl:g.h.LISTS_SORT_HELPURL})}};
g.L.lists_split={S:function(){var a=this,c=new g.Ka([[g.h.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[g.h.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(d){a.Wn(d)});this.wb=g.h.LISTS_SPLIT_HELPURL;L(this,"list_blocks");K(M(this,"INPUT").xb("String"),c,"MODE");K(M(this,"DELIM").xb("String"),g.h.LISTS_SPLIT_WITH_DELIMITER);this.ad(!0);this.Ed(!0,"Array");this.Sa(function(){var d=F(a,"MODE");if("SPLIT"==d)return g.h.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"==d)return g.h.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+
d);})},Wn:function(a){if(F(this,"MODE")!=a){var c=A(this,"INPUT").connection;c.vf=null;var d=y(c);d&&(c.disconnect(),d.bb?d.J():this.Lb())}"SPLIT"==a?(this.M.xb("Array"),A(this,"INPUT").xb("String")):(this.M.xb("String"),A(this,"INPUT").xb("Array"))},cb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("mode",F(this,"MODE"));return a},Cb:function(a){this.Wn(a.getAttribute("mode"))}};g.L.UF={};g.ma.gd={};g.ma.gd.uo=210;
g.Fk([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,
nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",
helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["\u2260","NEQ"],["\u200f<","LT"],["\u200f\u2264","LTE"],["\u200f>","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",
message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",
tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",
name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]);
g.Fk([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",
tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);g.ma.gd.Lr={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};g.Y.register("logic_op_tooltip",g.Y.Ro("OP",g.ma.gd.Lr));
g.ma.gd.Pq={Sd:0,Ge:0,si:!0,cb:function(){if(!this.Sd&&!this.Ge)return null;var a=g.g.xml.createElement("mutation");this.Sd&&a.setAttribute("elseif",this.Sd);this.Ge&&a.setAttribute("else",1);return a},Cb:function(a){this.Sd=parseInt(a.getAttribute("elseif"),10)||0;this.Ge=parseInt(a.getAttribute("else"),10)||0;this.QG()},Ng:function(a){var c=a.ci("controls_if_if");c.Ne();for(var d=c.X,e=1;e<=this.Sd;e++){var f=a.ci("controls_if_elseif");f.Ne();d.connect(f.Z);d=f.X}this.Ge&&(a=a.ci("controls_if_else"),
a.Ne(),d.connect(a.Z));return c},Kg:function(a){a=y(a.X);this.Ge=this.Sd=0;for(var c=[null],d=[null],e=null;a;){switch(a.type){case "controls_if_elseif":this.Sd++;c.push(a.nv);d.push(a.xf);break;case "controls_if_else":this.Ge++;e=a.xf;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.X&&y(a.X)}this.Nc();this.Wz(c,d,e)},lq:function(a){a=y(a.X);for(var c=1;a;){switch(a.type){case "controls_if_elseif":var d=A(this,"IF"+c),e=A(this,"DO"+c);a.nv=d&&d.connection.ca;a.xf=e&&e.connection.ca;
c++;break;case "controls_if_else":e=A(this,"ELSE");a.xf=e&&e.connection.ca;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.X&&y(a.X)}},QG:function(){var a=[null],c=[null],d=null;A(this,"ELSE")&&(d=A(this,"ELSE").connection.ca);for(var e=1;A(this,"IF"+e);){var f=A(this,"DO"+e);a.push(A(this,"IF"+e).connection.ca);c.push(f.connection.ca);e++}this.Nc();this.Wz(a,c,d)},Nc:function(){A(this,"ELSE")&&this.ib("ELSE");for(var a=1;A(this,"IF"+a);)this.ib("IF"+a),this.ib("DO"+a),a++;for(a=
1;a<=this.Sd;a++)K(M(this,"IF"+a).xb("Boolean"),g.h.CONTROLS_IF_MSG_ELSEIF),K(Rb(this,"DO"+a),g.h.CONTROLS_IF_MSG_THEN);this.Ge&&K(Rb(this,"ELSE"),g.h.CONTROLS_IF_MSG_ELSE)},Wz:function(a,c,d){for(var e=1;e<=this.Sd;e++)g.Pb.hl(a[e],this,"IF"+e),g.Pb.hl(c[e],this,"DO"+e);g.Pb.hl(d,this,"ELSE")}};g.Y.Ju("controls_if_mutator",g.ma.gd.Pq,null,["controls_if_elseif","controls_if_else"]);
g.ma.gd.Kv=function(){this.Sa(function(){if(this.Sd||this.Ge){if(!this.Sd&&this.Ge)return g.h.CONTROLS_IF_TOOLTIP_2;if(this.Sd&&!this.Ge)return g.h.CONTROLS_IF_TOOLTIP_3;if(this.Sd&&this.Ge)return g.h.CONTROLS_IF_TOOLTIP_4}else return g.h.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};g.Y.register("controls_if_tooltip",g.ma.gd.Kv);
g.ma.gd.fC={onchange:function(a){this.dl||(this.dl=[null,null]);var c=Tb(this,"A"),d=Tb(this,"B");c&&d&&!Ja(c.M,d.M)&&(g.i.$(a.group),a=this.dl[0],a!==c&&(z(c),a&&!a.bb&&A(this,"A").connection.connect(a.M)),c=this.dl[1],c!==d&&(z(d),c&&!c.bb&&A(this,"B").connection.connect(c.M)),this.Lb(),g.i.$(!1));this.dl[0]=Tb(this,"A");this.dl[1]=Tb(this,"B")}};g.ma.gd.eC=function(){this.yj(g.ma.gd.fC)};g.Y.register("logic_compare",g.ma.gd.eC);
g.ma.gd.gC={Sz:null,onchange:function(a){var c=Tb(this,"THEN"),d=Tb(this,"ELSE"),e=this.M.ca;if((c||d)&&e)for(var f=0;2>f;f++){var h=1==f?c:d;h&&!Ja(h.M,e)&&(g.i.$(a.group),e===this.Sz?(z(this),e.B.Lb()):(z(h),h.Lb()),g.i.$(!1))}this.Sz=e}};g.Y.fq("logic_ternary",g.ma.gd.gC);g.L.WF={};g.ma.ye={};g.ma.ye.uo=120;
g.Fk([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",
args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",
name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",
args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,
nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip",
"controls_flow_in_loop_check"]}]);g.ma.ye.eD={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};g.Y.register("controls_whileUntil_tooltip",g.Y.Ro("MODE",g.ma.ye.eD));g.ma.ye.ZA={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};g.Y.register("controls_flow_tooltip",g.Y.Ro("FLOW",g.ma.ye.ZA));
g.ma.ye.pB={Mg:function(a){if(!this.ac){var c=x(this,"VAR").Xc(),d=c.name;if(!this.isCollapsed()&&null!=d){var e={enabled:!0};e.text=g.h.VARIABLES_SET_CREATE_GET.replace("%1",d);c=g.O.Gm(c);d=g.g.xml.createElement("block");d.setAttribute("type","variables_get");d.appendChild(c);e.Bb=g.Ea.So(this,d);a.push(e)}}}};g.Y.fq("contextMenu_newGetVariableBlock",g.ma.ye.pB);g.Y.register("controls_for_tooltip",g.Y.ls("%{BKY_CONTROLS_FOR_TOOLTIP}"));g.Y.register("controls_forEach_tooltip",g.Y.ls("%{BKY_CONTROLS_FOREACH_TOOLTIP}"));
g.ma.ye.lo={iC:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],si:!0,Cy:function(a){do{if(-1!=g.ma.ye.lo.iC.indexOf(a.type))return a;a=Mb(a)}while(a);return null},onchange:function(){this.v.ic&&!this.v.ic()&&(g.ma.ye.lo.Cy(this)?(this.ih(null),this.ac||this.od(!0)):(this.ih(g.h.CONTROLS_FLOW_STATEMENTS_WARNING),this.ac||Qb(this)||this.od(!1)))}};g.Y.fq("controls_flow_in_loop_check",g.ma.ye.lo);g.Pc=function(a,c,d){this.$w=null;null==a&&(a="FALSE");g.Pc.w.constructor.call(this,a,c,d);this.cc.width=g.Pc.fD};g.g.object.W(g.Pc,g.Pa);g.Pc.va=function(a){return new g.Pc(a.checked,void 0,a)};g.Pc.fD=15;g.Pc.cB="\u2713";g.Pc.dB=g.Pa.Ci-3;g.Pc.eB=14;b=g.Pc.prototype;b.Ni=!0;b.Rq="default";b.Zf=!1;b.Od=function(a){g.Pc.w.Od.call(this,a);a.checkCharacter&&(this.$w=a.checkCharacter)};
b.Sh=function(){g.Pc.w.Sh.call(this);this.kc.setAttribute("x",g.Pc.dB);this.kc.setAttribute("y",g.Pc.eB);g.g.o.mb(this.kc,"blocklyCheckbox");this.Rj.nodeValue=this.$w||g.Pc.cB;this.kc.style.display=this.dc?"block":"none"};b.wf=function(){this.setValue(!this.dc)};b.Hh=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};b.ej=function(a){this.dc=Ne(a);this.kc&&(this.kc.style.display=this.dc?"block":"none")};b.getValue=function(){return this.dc?"TRUE":"FALSE"};b.Sb=function(){return String(Ne(this.dc))};
function Ne(a){return"string"==typeof a?"TRUE"==a:!!a}g.Wc.register("field_checkbox",g.Pc);g.L.OG={};
g.L.procedures_defnoreturn={S:function(){var a=new g.Ab("",g.Ha.gq);ue(a);K(K(K(N(this),g.h.PROCEDURES_DEFNORETURN_TITLE),a,"NAME"),"","PARAMS");this.ri(new g.Pb(["procedures_mutatorarg"]));(this.v.options.km||this.v.options.Ob&&this.v.options.Ob.options.km)&&g.h.PROCEDURES_DEFNORETURN_COMMENT&&this.gg(g.h.PROCEDURES_DEFNORETURN_COMMENT);L(this,"procedure_blocks");this.Sa(g.h.PROCEDURES_DEFNORETURN_TOOLTIP);this.wb=g.h.PROCEDURES_DEFNORETURN_HELPURL;this.xa=[];this.Yb=[];this.jg(!0);this.xf=null},
jg:function(a){this.Dp!==a&&(a?(K(Rb(this,"STACK"),g.h.PROCEDURES_DEFNORETURN_DO),A(this,"RETURN")&&Sb(this,"STACK","RETURN")):this.ib("STACK",!0),this.Dp=a)},Vn:function(){var a="";this.xa.length&&(a=g.h.PROCEDURES_BEFORE_PARAMS+" "+this.xa.join(", "));g.i.disable();try{Pb(this,a,"PARAMS")}finally{g.i.enable()}},cb:function(a){var c=g.g.xml.createElement("mutation");a&&c.setAttribute("name",F(this,"NAME"));for(var d=0;d<this.Yb.length;d++){var e=g.g.xml.createElement("arg"),f=this.Yb[d];e.setAttribute("name",
f.name);e.setAttribute("varid",f.ua());a&&this.zu&&e.setAttribute("paramId",this.zu[d]);c.appendChild(e)}this.Dp||c.setAttribute("statements","false");return c},Cb:function(a){this.xa=[];this.Yb=[];for(var c=0,d;d=a.childNodes[c];c++)if("arg"==d.nodeName.toLowerCase()){var e=d.getAttribute("name");d=d.getAttribute("varid")||d.getAttribute("varId");this.xa.push(e);d=g.O.vp(this.v,d,e,"");null!=d?this.Yb.push(d):console.log("Failed to create a variable with name "+e+", ignoring.")}this.Vn();g.Ha.ln(this);
this.jg("false"!==a.getAttribute("statements"))},Ng:function(a){var c=g.g.xml.createElement("block");c.setAttribute("type","procedures_mutatorcontainer");var d=g.g.xml.createElement("statement");d.setAttribute("name","STACK");c.appendChild(d);for(var e=0;e<this.xa.length;e++){var f=g.g.xml.createElement("block");f.setAttribute("type","procedures_mutatorarg");var h=g.g.xml.createElement("field");h.setAttribute("name","NAME");var k=g.g.xml.createTextNode(this.xa[e]);h.appendChild(k);f.appendChild(h);
h=g.g.xml.createElement("next");f.appendChild(h);d.appendChild(f);d=h}a=g.R.fj(c,a);"procedures_defreturn"==this.type?Pb(a,this.Dp,"STATEMENTS"):a.ib("STATEMENT_INPUT");g.Ha.ln(this);return a},Kg:function(a){this.xa=[];this.zu=[];this.Yb=[];for(var c=Tb(a,"STACK");c;){var d=F(c,"NAME");this.xa.push(d);d=this.v.Xc(d,"");this.Yb.push(d);this.zu.push(c.id);c=c.X&&y(c.X)}this.Vn();g.Ha.ln(this);a=F(a,"STATEMENTS");if(null!==a&&(a="TRUE"==a,this.Dp!=a))if(a)this.jg(!0),g.Pb.hl(this.xf,this,"STACK"),this.xf=
null;else{a=A(this,"STACK").connection;if(this.xf=a.ca)a=y(a),z(a),a.Lb();this.jg(!1)}},Mh:function(){return[F(this,"NAME"),this.xa,!1]},wt:function(){return this.xa},Vg:function(){return this.Yb},hq:function(a,c){var d=this.v.nf(a);if(""==d.type){d=d.name;c=this.v.nf(c);for(var e=!1,f=0;f<this.Yb.length;f++)this.Yb[f].ua()==a&&(this.xa[f]=c.name,this.Yb[f]=c,e=!0);e&&(this.hp(d,c.name),g.Ha.ln(this))}},zq:function(a){for(var c=a.name,d=!1,e=0;e<this.Yb.length;e++)if(this.Yb[e].ua()==a.ua()){var f=
this.xa[e];this.xa[e]=c;d=!0}d&&(this.hp(f,c),g.Ha.ln(this))},hp:function(a,c){this.Vn();if(this.Vd&&this.Vd.isVisible())for(var d=J(this.Vd.s,!1),e=0,f;f=d[e];e++)"procedures_mutatorarg"==f.type&&g.fe.He(a,F(f,"NAME"))&&Pb(f,c,"NAME")},Mg:function(a){if(!this.ac){var c={enabled:!0},d=F(this,"NAME");c.text=g.h.PROCEDURES_CREATE_DO.replace("%1",d);var e=g.g.xml.createElement("mutation");e.setAttribute("name",d);for(d=0;d<this.xa.length;d++){var f=g.g.xml.createElement("arg");f.setAttribute("name",
this.xa[d]);e.appendChild(f)}d=g.g.xml.createElement("block");d.setAttribute("type",this.Yw);d.appendChild(e);c.Bb=g.Ea.So(this,d);a.push(c);if(!this.isCollapsed())for(d=0;d<this.Yb.length;d++)c={enabled:!0},e=this.Yb[d],c.text=g.h.VARIABLES_SET_CREATE_GET.replace("%1",e.name),e=g.O.Gm(e),f=g.g.xml.createElement("block"),f.setAttribute("type","variables_get"),f.appendChild(e),c.Bb=g.Ea.So(this,f),a.push(c)}},Yw:"procedures_callnoreturn"};
g.L.procedures_defreturn={S:function(){var a=new g.Ab("",g.Ha.gq);ue(a);K(K(K(N(this),g.h.PROCEDURES_DEFRETURN_TITLE),a,"NAME"),"","PARAMS");K(Lb(M(this,"RETURN"),g.yl),g.h.PROCEDURES_DEFRETURN_RETURN);this.ri(new g.Pb(["procedures_mutatorarg"]));(this.v.options.km||this.v.options.Ob&&this.v.options.Ob.options.km)&&g.h.PROCEDURES_DEFRETURN_COMMENT&&this.gg(g.h.PROCEDURES_DEFRETURN_COMMENT);L(this,"procedure_blocks");this.Sa(g.h.PROCEDURES_DEFRETURN_TOOLTIP);this.wb=g.h.PROCEDURES_DEFRETURN_HELPURL;
this.xa=[];this.Yb=[];this.jg(!0);this.xf=null},jg:g.L.procedures_defnoreturn.jg,Vn:g.L.procedures_defnoreturn.Vn,cb:g.L.procedures_defnoreturn.cb,Cb:g.L.procedures_defnoreturn.Cb,Ng:g.L.procedures_defnoreturn.Ng,Kg:g.L.procedures_defnoreturn.Kg,Mh:function(){return[F(this,"NAME"),this.xa,!0]},wt:g.L.procedures_defnoreturn.wt,Vg:g.L.procedures_defnoreturn.Vg,hq:g.L.procedures_defnoreturn.hq,zq:g.L.procedures_defnoreturn.zq,hp:g.L.procedures_defnoreturn.hp,Mg:g.L.procedures_defnoreturn.Mg,Yw:"procedures_callreturn"};
g.L.procedures_mutatorcontainer={S:function(){K(N(this),g.h.PROCEDURES_MUTATORCONTAINER_TITLE);Rb(this,"STACK");K(K(N(this,"STATEMENT_INPUT"),g.h.PROCEDURES_ALLOW_STATEMENTS),new g.Pc("TRUE"),"STATEMENTS");L(this,"procedure_blocks");this.Sa(g.h.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1},onchange:function(a){if(this.v&&!this.v.oe&&(a.type==g.i.ao||a.type==g.i.Al)){var c=J(this.v),d=this.v.Sg();if(a.type==g.i.ao){a=[];for(var e=0;e<c.length;e+=1)F(c[e],"NAME")&&a.push(F(c[e],"NAME"));
for(c=0;c<d.length;c+=1)-1==a.indexOf(d[c].name)&&this.v.Rf(d[c].ua())}else if(a.type==g.i.Al&&(d=w(this.v,a.Bc),x(d,"NAME")&&(e=F(d,"NAME"),(a=this.v.Xc(e))||(a=this.v.Qd(e)),!d.Z.isConnected()&&!d.X.isConnected())))for(e=0;e<c.length;e+=1)if(d.id!=c[e].id&&F(c[e],"NAME")==a.name){e=g.O.ky(this.v);a=this.v.Qd(e);Pb(d,a.name,"NAME");break}}}};
g.L.procedures_mutatorarg={S:function(){var a=new g.Ab("x",this.Vj);a.pG=a.wf;a.wf=function(){this.tm=[];this.pG()};K(K(N(this),g.h.PROCEDURES_MUTATORARG_TITLE),a,"NAME");this.qe(!0);this.pe(!0);L(this,"procedure_blocks");this.Sa(g.h.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1;a.su=this.pE;a.tm=[];a.su("x")},Vj:function(a){var c=this.B,d=g.Pb.Zx(c.v);a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"");if(!a)return null;c=J(c.v);for(var e=0;e<c.length;e++)if(c[e].id!=this.B.id&&F(c[e],"NAME")==
a)return null;(c=d.Xc(a,""))&&c.name!=a&&d.ni(c.ua(),a);c||(c=d.Qd(a,""))&&this.tm&&this.tm.push(c);return a},pE:function(a){var c=g.Pb.Zx(this.B.v);if(c)for(var d=0;d<this.tm.length;d++){var e=this.tm[d];e.name!=a&&c.Rf(e.ua())}}};
g.L.procedures_callnoreturn={S:function(){K(N(this,"TOPROW"),this.id,"NAME");this.qe(!0);this.pe(!0);L(this,"procedure_blocks");this.wb=g.h.PROCEDURES_CALLNORETURN_HELPURL;this.xa=[];this.Yb=[];this.ah={};this.dg=null;this.Gu=!0},ke:function(){return F(this,"NAME")},wn:function(a,c){g.fe.He(a,this.ke())&&(Pb(this,c,"NAME"),this.Sa((this.M?g.h.PROCEDURES_CALLRETURN_TOOLTIP:g.h.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",c)))},Wu:function(a,c){var d=g.Ha.Im(this.ke(),this.v),e=d&&d.Vd&&d.Vd.isVisible();
e||(this.ah={},this.dg=null);if(c)if(a.join("\n")==this.xa.join("\n"))this.dg=c;else{if(c.length!=a.length)throw RangeError("paramNames and paramIds must be the same length.");this.gh(!1);this.dg||(this.ah={},this.dg=[]);d=this.ba;this.ba=!1;for(var f=0;f<this.xa.length;f++){var h=A(this,"ARG"+f);h&&(h=h.connection.ca,this.ah[this.dg[f]]=h,e&&h&&-1==c.indexOf(this.dg[f])&&(h.disconnect(),h.B.Lb()))}this.xa=[].concat(a);this.Yb=[];for(f=0;f<this.xa.length;f++)a=g.O.vp(this.v,null,this.xa[f],""),this.Yb.push(a);
this.Nc();if(this.dg=c)for(f=0;f<this.xa.length;f++)c=this.dg[f],c in this.ah&&(h=this.ah[c],g.Pb.hl(h,this,"ARG"+f)||delete this.ah[c]);(this.ba=d)&&this.za()}},Nc:function(){for(var a=0;a<this.xa.length;a++){var c=x(this,"ARGNAME"+a);if(c){g.i.disable();try{c.setValue(this.xa[a])}finally{g.i.enable()}}else c=new g.Id(this.xa[a]),K(Lb(M(this,"ARG"+a),g.yl),c,"ARGNAME"+a).S()}for(;A(this,"ARG"+a);)this.ib("ARG"+a),a++;if(a=A(this,"TOPROW"))this.xa.length?x(this,"WITH")||(K(a,g.h.PROCEDURES_CALL_BEFORE_PARAMS,
"WITH"),a.S()):x(this,"WITH")&&Ib(a,"WITH")},cb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("name",this.ke());for(var c=0;c<this.xa.length;c++){var d=g.g.xml.createElement("arg");d.setAttribute("name",this.xa[c]);a.appendChild(d)}return a},Cb:function(a){var c=a.getAttribute("name");this.wn(this.ke(),c);c=[];for(var d=[],e=0,f;f=a.childNodes[e];e++)"arg"==f.nodeName.toLowerCase()&&(c.push(f.getAttribute("name")),d.push(f.getAttribute("paramId")));this.Wu(c,d)},Vg:function(){return this.Yb},
onchange:function(a){if(this.v&&!this.v.oe&&a.Jc)if(a.type==g.i.Al&&-1!=a.Ph.indexOf(this.id)){var c=this.ke();c=g.Ha.Im(c,this.v);!c||c.type==this.As&&JSON.stringify(c.xa)==JSON.stringify(this.xa)||(c=null);if(!c){g.i.$(a.group);a=g.g.xml.createElement("xml");c=g.g.xml.createElement("block");c.setAttribute("type",this.As);var d=this.Ra(),e=d.y+2*g.vd;c.setAttribute("x",d.x+g.vd*(this.G?-1:1));c.setAttribute("y",e);d=this.cb();c.appendChild(d);d=g.g.xml.createElement("field");d.setAttribute("name",
"NAME");d.appendChild(g.g.xml.createTextNode(this.ke()));c.appendChild(d);a.appendChild(c);g.R.Qg(a,this.v);g.i.$(!1)}}else a.type==g.i.ao?(c=this.ke(),c=g.Ha.Im(c,this.v),c||(g.i.$(a.group),this.J(!0,!1),g.i.$(!1))):a.type==g.i.zi&&"disabled"==a.element&&(c=this.ke(),(c=g.Ha.Im(c,this.v))&&c.id==a.Bc&&((c=g.i.$b())&&console.log("Saw an existing group while responding to a definition change"),g.i.$(a.group),a.newValue?(this.Gu=this.isEnabled(),this.od(!1)):this.od(this.Gu),g.i.$(c)))},Mg:function(a){if(this.v.Fc()){var c=
{enabled:!0};c.text=g.h.PROCEDURES_HIGHLIGHT_DEF;var d=this.ke(),e=this.v;c.Bb=function(){var f=g.Ha.Im(d,e);if(f){if(e.Fc()){var h=w(e,f.id);if(h){var k=h.Ra(),l=G(h),m=e.scale;h=(k.x+(e.G?-1:1)*l.width/2)*m;k=(k.y+l.height/2)*m;l=e.hc();h=-(h-l.Cc-l.rb/2)-l.Cc;k=-(k-l.pc-l.yb/2)-l.pc;g.rc();e.scroll(h,k)}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.");f.select()}};a.push(c)}},As:"procedures_defnoreturn"};
g.L.procedures_callreturn={S:function(){K(N(this,"TOPROW"),"","NAME");this.Ed(!0);L(this,"procedure_blocks");this.wb=g.h.PROCEDURES_CALLRETURN_HELPURL;this.xa=[];this.ah={};this.dg=null;this.Gu=!0},ke:g.L.procedures_callnoreturn.ke,wn:g.L.procedures_callnoreturn.wn,Wu:g.L.procedures_callnoreturn.Wu,Nc:g.L.procedures_callnoreturn.Nc,cb:g.L.procedures_callnoreturn.cb,Cb:g.L.procedures_callnoreturn.Cb,Vg:g.L.procedures_callnoreturn.Vg,onchange:g.L.procedures_callnoreturn.onchange,Mg:g.L.procedures_callnoreturn.Mg,
As:"procedures_defreturn"};
g.L.procedures_ifreturn={S:function(){K(M(this,"CONDITION").xb("Boolean"),g.h.CONTROLS_IF_MSG_IF);K(M(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN);this.ad(!0);this.qe(!0);this.pe(!0);L(this,"procedure_blocks");this.Sa(g.h.PROCEDURES_IFRETURN_TOOLTIP);this.wb=g.h.PROCEDURES_IFRETURN_HELPURL;this.Oh=!0},cb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("value",Number(this.Oh));return a},Cb:function(a){this.Oh=1==a.getAttribute("value");this.Oh||(this.ib("VALUE"),K(N(this,"VALUE"),
g.h.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.v.ic&&!this.v.ic()){var a=!1,c=this;do{if(-1!=this.HB.indexOf(c.type)){a=!0;break}c=Mb(c)}while(c);a?("procedures_defnoreturn"==c.type&&this.Oh?(this.ib("VALUE"),K(N(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN),this.Oh=!1):"procedures_defreturn"!=c.type||this.Oh||(this.ib("VALUE"),K(M(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN),this.Oh=!0),this.ih(null),this.ac||this.od(!0)):(this.ih(g.h.PROCEDURES_IFRETURN_WARNING),this.ac||Qb(this)||
this.od(!1))}},HB:["procedures_defnoreturn","procedures_defreturn"]};g.L.FH={};g.ma.O={};g.ma.O.uo=330;
g.Fk([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,
style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);
g.ma.O.qB={Mg:function(a){if(!this.ac){if("variables_get"==this.type)var c="variables_set",d=g.h.VARIABLES_GET_CREATE_SET;else c="variables_get",d=g.h.VARIABLES_SET_CREATE_GET;var e={enabled:0<eb(this.v)},f=x(this,"VAR").Sb();e.text=d.replace("%1",f);d=g.g.xml.createElement("field");d.setAttribute("name","VAR");d.appendChild(g.g.xml.createTextNode(f));f=g.g.xml.createElement("block");f.setAttribute("type",c);f.appendChild(d);e.Bb=g.Ea.So(this,f);a.push(e)}else if("variables_get"==this.type||"variables_get_reporter"==
this.type)c={text:g.h.ZK,enabled:!0,Bb:g.ma.O.FC(this)},f=x(this,"VAR").Sb(),e={text:g.h.tI.replace("%1",f),enabled:!0,Bb:g.ma.O.uB(this)},a.unshift(c),a.unshift(e)}};g.ma.O.FC=function(a){return function(){var c=a.v,d=x(a,"VAR").Xc();g.O.iq(c,d)}};g.ma.O.uB=function(a){return function(){var c=a.v,d=x(a,"VAR").Xc();c.Rf(d.ua());Fc(c)}};g.Y.fq("contextMenu_variableSetterGetter",g.ma.O.qB);g.j.Ut={};g.j.lists_create_empty=function(){return["[]",g.j.Ii]};g.j.lists_create_with=function(a){for(var c=Array(a.Cd),d=0;d<a.Cd;d++)c[d]=Z(a,"ADD"+d,g.j.Qc)||"null";return["["+c.join(", ")+"]",g.j.Ii]};g.j.lists_repeat=function(a){var c=Le("listsRepeat",["function "+g.j.xe+"(value, n) {","  var array = [];","  for (var i = 0; i < n; i++) {","    array[i] = value;","  }","  return array;","}"]),d=Z(a,"ITEM",g.j.Qc)||"null";a=Z(a,"NUM",g.j.Qc)||"0";return[c+"("+d+", "+a+")",g.j.gb]};
g.j.lists_length=function(a){return[(Z(a,"VALUE",g.j.Qb)||"[]")+".length",g.j.Qb]};g.j.lists_isEmpty=function(a){return["!"+(Z(a,"VALUE",g.j.Qb)||"[]")+".length",g.j.Pl]};g.j.lists_indexOf=function(a){var c="FIRST"==F(a,"END")?"indexOf":"lastIndexOf",d=Z(a,"FIND",g.j.Rc)||"''";c=(Z(a,"VALUE",g.j.Qb)||"[]")+"."+c+"("+d+")";return a.v.options.Re?[c+" + 1",g.j.sh]:[c,g.j.gb]};
g.j.lists_getIndex=function(a){var c=F(a,"MODE")||"GET",d=F(a,"WHERE")||"FROM_START",e=Z(a,"VALUE","RANDOM"==d?g.j.Qc:g.j.Qb)||"[]";switch(d){case "FIRST":if("GET"==c)return[e+"[0]",g.j.Qb];if("GET_REMOVE"==c)return[e+".shift()",g.j.Qb];if("REMOVE"==c)return e+".shift();\n";break;case "LAST":if("GET"==c)return[e+".slice(-1)[0]",g.j.Qb];if("GET_REMOVE"==c)return[e+".pop()",g.j.Qb];if("REMOVE"==c)return e+".pop();\n";break;case "FROM_START":a=g.j.Vf(a,"AT");if("GET"==c)return[e+"["+a+"]",g.j.Qb];if("GET_REMOVE"==
c)return[e+".splice("+a+", 1)[0]",g.j.gb];if("REMOVE"==c)return e+".splice("+a+", 1);\n";break;case "FROM_END":a=g.j.Vf(a,"AT",1,!0);if("GET"==c)return[e+".slice("+a+")[0]",g.j.gb];if("GET_REMOVE"==c)return[e+".splice("+a+", 1)[0]",g.j.gb];if("REMOVE"==c)return e+".splice("+a+", 1);";break;case "RANDOM":e=Le("listsGetRandomItem",["function "+g.j.xe+"(list, remove) {","  var x = Math.floor(Math.random() * list.length);","  if (remove) {","    return list.splice(x, 1)[0];","  } else {","    return list[x];",
"  }","}"])+"("+e+", "+("GET"!=c)+")";if("GET"==c||"GET_REMOVE"==c)return[e,g.j.gb];if("REMOVE"==c)return e+";\n"}throw Error("Unhandled combination (lists_getIndex).");};
g.j.lists_setIndex=function(a){function c(){if(d.match(/^\w+$/))return"";var k=Lc(g.j.Gd,"tmpList",g.O.ub),l="var "+k+" = "+d+";\n";d=k;return l}var d=Z(a,"LIST",g.j.Qb)||"[]",e=F(a,"MODE")||"GET",f=F(a,"WHERE")||"FROM_START",h=Z(a,"TO",g.j.yg)||"null";switch(f){case "FIRST":if("SET"==e)return d+"[0] = "+h+";\n";if("INSERT"==e)return d+".unshift("+h+");\n";break;case "LAST":if("SET"==e)return a=c(),a+(d+"["+d+".length - 1] = "+h+";\n");if("INSERT"==e)return d+".push("+h+");\n";break;case "FROM_START":f=
g.j.Vf(a,"AT");if("SET"==e)return d+"["+f+"] = "+h+";\n";if("INSERT"==e)return d+".splice("+f+", 0, "+h+");\n";break;case "FROM_END":f=g.j.Vf(a,"AT",1,!1,g.j.pk);a=c();if("SET"==e)return a+(d+"["+d+".length - "+f+"] = "+h+";\n");if("INSERT"==e)return a+(d+".splice("+d+".length - "+f+", 0, "+h+");\n");break;case "RANDOM":a=c();f=Lc(g.j.Gd,"tmpX",g.O.ub);a+="var "+f+" = Math.floor(Math.random() * "+d+".length);\n";if("SET"==e)return a+(d+"["+f+"] = "+h+";\n");if("INSERT"==e)return a+(d+".splice("+f+
", 0, "+h+");\n")}throw Error("Unhandled combination (lists_setIndex).");};g.j.Ut.dF=function(a,c,d){return"FIRST"==c?"0":"FROM_END"==c?a+".length - 1 - "+d:"LAST"==c?a+".length - 1":d};
g.j.lists_getSublist=function(a){var c=Z(a,"LIST",g.j.Qb)||"[]",d=F(a,"WHERE1"),e=F(a,"WHERE2");if("FIRST"==d&&"LAST"==e)c+=".slice(0)";else if(c.match(/^\w+$/)||"FROM_END"!=d&&"FROM_START"==e){switch(d){case "FROM_START":var f=g.j.Vf(a,"AT1");break;case "FROM_END":f=g.j.Vf(a,"AT1",1,!1,g.j.pk);f=c+".length - "+f;break;case "FIRST":f="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(e){case "FROM_START":a=g.j.Vf(a,"AT2",1);break;case "FROM_END":a=g.j.Vf(a,"AT2",0,!1,g.j.pk);
a=c+".length - "+a;break;case "LAST":a=c+".length";break;default:throw Error("Unhandled option (lists_getSublist).");}c=c+".slice("+f+", "+a+")"}else{f=g.j.Vf(a,"AT1");a=g.j.Vf(a,"AT2");var h=g.j.Ut.dF,k={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};c=Le("subsequence"+k[d]+k[e],["function "+g.j.xe+"(sequence"+("FROM_END"==d||"FROM_START"==d?", at1":"")+("FROM_END"==e||"FROM_START"==e?", at2":"")+") {","  var start = "+h("sequence",d,"at1")+";","  var end = "+h("sequence",e,
"at2")+" + 1;","  return sequence.slice(start, end);","}"])+"("+c+("FROM_END"==d||"FROM_START"==d?", "+f:"")+("FROM_END"==e||"FROM_START"==e?", "+a:"")+")"}return[c,g.j.gb]};
g.j.lists_sort=function(a){var c=Z(a,"LIST",g.j.gb)||"[]",d="1"===F(a,"DIRECTION")?1:-1;a=F(a,"TYPE");var e=Le("listsGetSortCompare",["function "+g.j.xe+"(type, direction) {","  var compareFuncs = {",'    "NUMERIC": function(a, b) {',"        return Number(a) - Number(b); },",'    "TEXT": function(a, b) {',"        return a.toString() > b.toString() ? 1 : -1; },",'    "IGNORE_CASE": function(a, b) {',"        return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },","  };","  var compare = compareFuncs[type];",
"  return function(a, b) { return compare(a, b) * direction; }","}"]);return[c+".slice().sort("+e+'("'+a+'", '+d+"))",g.j.gb]};g.j.lists_split=function(a){var c=Z(a,"INPUT",g.j.Qb),d=Z(a,"DELIM",g.j.Rc)||"''";a=F(a,"MODE");if("SPLIT"==a)c||(c="''"),a="split";else if("JOIN"==a)c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+d+")",g.j.gb]};g.j.lists_reverse=function(a){return[(Z(a,"LIST",g.j.gb)||"[]")+".slice().reverse()",g.j.gb]};g.j.UF={};g.j.controls_if=function(a){var c=0,d="";g.j.Md&&(d+=Y(g.j.Md,a));do{var e=Z(a,"IF"+c,g.j.Rc)||"false";var f=Ie(a,"DO"+c);g.j.Tc&&(f=He(Y(g.j.Tc,a),g.j.td)+f);d+=(0<c?" else ":"")+"if ("+e+") {\n"+f+"}";++c}while(A(a,"IF"+c));if(A(a,"ELSE")||g.j.Tc)f=Ie(a,"ELSE"),g.j.Tc&&(f=He(Y(g.j.Tc,a),g.j.td)+f),d+=" else {\n"+f+"}";return d+"\n"};g.j.controls_ifelse=g.j.controls_if;
g.j.logic_compare=function(a){var c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[F(a,"OP")],d="=="==c||"!="==c?g.j.mw:g.j.wC,e=Z(a,"A",d)||"0";a=Z(a,"B",d)||"0";return[e+" "+c+" "+a,d]};g.j.logic_operation=function(a){var c="AND"==F(a,"OP")?"&&":"||",d="&&"==c?g.j.pr:g.j.qr,e=Z(a,"A",d);a=Z(a,"B",d);if(e||a){var f="&&"==c?"true":"false";e||(e=f);a||(a=f)}else a=e="false";return[e+" "+c+" "+a,d]};g.j.logic_negate=function(a){var c=g.j.Pl;return["!"+(Z(a,"BOOL",c)||"true"),c]};
g.j.logic_boolean=function(a){return["TRUE"==F(a,"BOOL")?"true":"false",g.j.Ii]};g.j.logic_null=function(){return["null",g.j.Ii]};g.j.logic_ternary=function(a){var c=Z(a,"IF",g.j.Eo)||"false",d=Z(a,"THEN",g.j.Eo)||"null";a=Z(a,"ELSE",g.j.Eo)||"null";return[c+" ? "+d+" : "+a,g.j.Eo]};g.j.WF={};g.j.controls_repeat_ext=function(a){var c=x(a,"TIMES")?String(Number(F(a,"TIMES"))):Z(a,"TIMES",g.j.yg)||"0",d=Ie(a,"DO");d=Je(d,a);a="";var e=Lc(g.j.Gd,"count",g.O.ub),f=c;c.match(/^\w+$/)||g.Yh(c)||(f=Lc(g.j.Gd,"repeat_end",g.O.ub),a+="var "+f+" = "+c+";\n");return a+("for (var "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")};g.j.controls_repeat=g.j.controls_repeat_ext;
g.j.controls_whileUntil=function(a){var c="UNTIL"==F(a,"MODE"),d=Z(a,"BOOL",c?g.j.Pl:g.j.Rc)||"false",e=Ie(a,"DO");e=Je(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"};
g.j.controls_for=function(a){var c=P(F(a,"VAR"),g.O.ub),d=Z(a,"FROM",g.j.yg)||"0",e=Z(a,"TO",g.j.yg)||"0",f=Z(a,"BY",g.j.yg)||"1",h=Ie(a,"DO");h=Je(h,a);if(g.Yh(d)&&g.Yh(e)&&g.Yh(f)){var k=Number(d)<=Number(e);a="for ("+c+" = "+d+"; "+c+(k?" <= ":" >= ")+e+"; "+c;c=Math.abs(Number(f));a=(1==c?a+(k?"++":"--"):a+((k?" += ":" -= ")+c))+(") {\n"+h+"}\n")}else a="",k=d,d.match(/^\w+$/)||g.Yh(d)||(k=Lc(g.j.Gd,c+"_start",g.O.ub),a+="var "+k+" = "+d+";\n"),d=e,e.match(/^\w+$/)||g.Yh(e)||(d=Lc(g.j.Gd,c+"_end",
g.O.ub),a+="var "+d+" = "+e+";\n"),e=Lc(g.j.Gd,c+"_inc",g.O.ub),a+="var "+e+" = ",a=g.Yh(f)?a+(Math.abs(f)+";\n"):a+("Math.abs("+f+");\n"),a=a+("if ("+k+" > "+d+") {\n")+(g.j.td+e+" = -"+e+";\n"),a+="}\n",a+="for ("+c+" = "+k+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+h+"}\n";return a};
g.j.controls_forEach=function(a){var c=P(F(a,"VAR"),g.O.ub),d=Z(a,"LIST",g.j.yg)||"[]",e=Ie(a,"DO");e=Je(e,a);a="";var f=d;d.match(/^\w+$/)||(f=Lc(g.j.Gd,c+"_list",g.O.ub),a+="var "+f+" = "+d+";\n");d=Lc(g.j.Gd,c+"_index",g.O.ub);e=g.j.td+c+" = "+f+"["+d+"];\n"+e;return a+("for (var "+d+" in "+f+") {\n"+e+"}\n")};
g.j.controls_flow_statements=function(a){var c="";g.j.Md&&(c+=Y(g.j.Md,a));g.j.Tc&&(c+=Y(g.j.Tc,a));if(g.j.Md){var d=g.ma.ye.lo.Cy(a);d&&!d.si&&(c+=Y(g.j.Md,d))}switch(F(a,"FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");};g.j.OG={};g.j.procedures_defreturn=function(a){var c=P(F(a,"NAME"),g.Ha.ub),d="";g.j.Md&&(d+=Y(g.j.Md,a));g.j.Tc&&(d+=Y(g.j.Tc,a));d&&(d=He(d,g.j.td));var e="";g.j.wo&&(e=He(Y(g.j.wo,a),g.j.td));var f=Ie(a,"STACK"),h=Z(a,"RETURN",g.j.Rc)||"",k="";f&&h&&(k=d);h&&(h=g.j.td+"return "+h+";\n");for(var l=[],m=0;m<a.xa.length;m++)l[m]=P(a.xa[m],g.O.ub);d="function "+c+"("+l.join(", ")+") {\n"+d+e+f+k+h+"}";d=g.j.mq(a,d);g.j.cj["%"+c]=d;return null};g.j.procedures_defnoreturn=g.j.procedures_defreturn;
g.j.procedures_callreturn=function(a){for(var c=P(F(a,"NAME"),g.Ha.ub),d=[],e=0;e<a.xa.length;e++)d[e]=Z(a,"ARG"+e,g.j.Qc)||"null";return[c+"("+d.join(", ")+")",g.j.gb]};g.j.procedures_callnoreturn=function(a){return g.j.procedures_callreturn(a)[0]+";\n"};g.j.procedures_ifreturn=function(a){var c="if ("+(Z(a,"CONDITION",g.j.Rc)||"false")+") {\n";g.j.Tc&&(c+=He(Y(g.j.Tc,a),g.j.td));a.Oh?(a=Z(a,"VALUE",g.j.Rc)||"null",c+=g.j.td+"return "+a+";\n"):c+=g.j.td+"return;\n";return c+"}\n"};g.j.FH={};g.j.variables_get=function(a){return[P(F(a,"VAR"),g.O.ub),g.j.Ii]};g.j.variables_set=function(a){var c=Z(a,"VALUE",g.j.yg)||"0";return P(F(a,"VAR"),g.O.ub)+" = "+c+";\n"};for(var Oe in g.ma.gd.Pq)g.L.controls_if[Oe]=g.ma.gd.Pq[Oe];g.L.controls_if.S=function(){this.wb=g.h.CONTROLS_IF_HELPURL;this.Kc(g.h.LOGIC_HUE);K(M(this,"IF0").xb("Boolean"),"if (");K(N(this),") {");Rb(this,"DO0");K(N(this,"TAIL"),"}");this.ad(!0);this.qe(!0);this.pe(!0);this.ri(new g.Pb(["controls_if_elseif","controls_if_else"]));g.ma.gd.Kv.apply(this)};
g.L.controls_if.Nc=function(){A(this,"ELSE")&&(this.ib("ELSEMSG"),this.ib("ELSE"));for(var a=1;A(this,"IF"+a);)this.ib("IF"+a),this.ib("TAIL"+a),this.ib("DO"+a),a++;for(a=1;a<=this.Sd;a++)K(M(this,"IF"+a).xb("Boolean"),"} else if ("),K(N(this,"TAIL"+a),") {"),Rb(this,"DO"+a);this.Ge&&(K(N(this,"ELSEMSG"),"} else {"),Rb(this,"ELSE"));Sb(this,"TAIL",null)};
g.L.logic_compare.S=function(){this.wb=g.h.LOGIC_COMPARE_HELPURL;this.Kc(g.h.LOGIC_HUE);this.Ed(!0,"Boolean");M(this,"A");K(M(this,"B"),new g.Ka([["==","EQ"],["!=","NEQ"],["<","LT"],["<=","LTE"],[">","GT"],[">=","GTE"]]),"OP");this.ad(!0);var a=this;this.Sa(function(){var c=F(a,"OP");return{EQ:g.h.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:g.h.LOGIC_COMPARE_TOOLTIP_NEQ,LT:g.h.LOGIC_COMPARE_TOOLTIP_LT,LTE:g.h.LOGIC_COMPARE_TOOLTIP_LTE,GT:g.h.LOGIC_COMPARE_TOOLTIP_GT,GTE:g.h.LOGIC_COMPARE_TOOLTIP_GTE}[c]});this.dl=
[null,null]};g.h.LOGIC_OPERATION_AND="&&";g.h.LOGIC_OPERATION_OR="||";g.h.LOGIC_NEGATE_TITLE="! %1";g.h.LOGIC_BOOLEAN_TRUE="true";g.h.LOGIC_BOOLEAN_FALSE="false";g.L.controls_whileUntil.S=function(){O(this,{message0:"while ( %1 ) { %2 %3 }",args0:[{type:"input_value",name:"BOOL",check:"Boolean"},{type:"input_dummy"},{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:g.h.LOOPS_HUE,tooltip:g.h.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE,helpUrl:g.h.CONTROLS_WHILEUNTIL_HELPURL})};
g.L.controls_for.S=function(){O(this,{message0:"for (var %1 = %2;  %3 < %4;  %5 += 1) { %6 %7 }",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"field_label",name:"VAR1",text:"?"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"field_label",name:"VAR2",text:"?"},{type:"input_dummy"},{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:g.h.LOOPS_HUE,helpUrl:g.h.CONTROLS_FOR_HELPURL});
var a=this;this.Sa(function(){return g.h.CONTROLS_FOR_TOOLTIP.replace("%1",F(a,"VAR"))})};g.L.controls_for.onchange=function(){var a=x(this,"VAR").Sb();Pb(this,a,"VAR1");Pb(this,a,"VAR2")};g.j.controls_for=function(a){var c=P(F(a,"VAR"),g.O.ub),d=Z(a,"FROM",g.j.yg)||"0",e=Z(a,"TO",g.j.yg)||"0",f=Ie(a,"DO");f=Je(f,a.id);return"for (var "+c+" = "+d+"; "+c+" < "+e+"; "+c+" += 1) {\n"+f+"}\n"};g.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="break ;";g.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continue ;";
g.L.math_arithmetic.S=function(){O(this,{message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["+","ADD"],["-","MINUS"],["*","MULTIPLY"],["/","DIVIDE"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",colour:g.h.MATH_HUE,helpUrl:g.h.MATH_ARITHMETIC_HELPURL});var a=this;this.Sa(function(){var c=F(a,"OP");return{ADD:g.h.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:g.h.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:g.h.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,
DIVIDE:g.h.MATH_ARITHMETIC_TOOLTIP_DIVIDE}[c]})};g.L.math_change.S=function(){O(this,{message0:"%1 += %2;",args0:[{type:"field_variable",name:"VAR",variable:"name"},{type:"input_value",name:"DELTA",check:"Number"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:g.h.VARIABLES_HUE,helpUrl:g.h.MATH_CHANGE_HELPURL});var a=this;this.Sa(function(){return g.h.MATH_CHANGE_TOOLTIP.replace("%1",F(a,"VAR"))})};
g.j.math_change=function(a){var c=Z(a,"DELTA",g.j.sh)||"0";return P(F(a,"VAR"),g.O.ub)+" += "+c+";\n"};g.L.math_random_int.S=function(){O(this,{message0:"%1(%2,%3)",args0:["Math.randomInt",{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",colour:g.h.MATH_HUE,tooltip:g.h.MATH_RANDOM_INT_TOOLTIP,helpUrl:g.h.MATH_RANDOM_INT_HELPURL})};g.h.MATH_RANDOM_FLOAT_TITLE_RANDOM="Math.random  (  )";g.h.LISTS_CREATE_EMPTY_TITLE="[ ]";
g.h.LISTS_CREATE_WITH_INPUT_WITH="[";g.L.lists_create_with.Nc=function(){A(this,"TAIL")&&this.ib("TAIL");this.Cd&&A(this,"EMPTY")?this.ib("EMPTY"):this.Cd||A(this,"EMPTY")||K(N(this,"EMPTY"),g.h.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.Cd;a++)if(!A(this,"ADD"+a)){var c=M(this,"ADD"+a);0==a?K(c,g.h.LISTS_CREATE_WITH_INPUT_WITH):K(c,",")}for(;A(this,"ADD"+a);)this.ib("ADD"+a),a++;this.Cd&&K(N(this,"TAIL"),"]")};
g.L.lists_getIndex={S:function(){O(this,{message0:"%1[%2]",args0:[{type:"input_value",name:"VALUE",check:"Array"},{type:"input_value",name:"AT",check:"Number"}],inputsInline:!0,output:null,colour:g.h.LISTS_HUE,tooltip:g.h.LISTS_GET_INDEX_TOOLTIP_GET_FROM+g.h.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1","#0"),helpUrl:g.h.LISTS_GET_INDEX_HELPURL})}};
g.L.lists_setIndex={S:function(){O(this,{message0:"%1[%2] = %3;",args0:[{type:"input_value",name:"LIST",check:"Array"},{type:"input_value",name:"AT",check:"Number"},{type:"input_value",name:"TO"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:g.h.LISTS_HUE,tooltip:g.h.LISTS_SET_INDEX_TOOLTIP_SET_FROM+g.h.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1","#0"),helpUrl:g.h.LISTS_SET_INDEX_HELPURL})}};g.h.LISTS_LENGTH_TITLE="%1 . length";
g.L.variables_get.S=function(){this.wb=g.h.VARIABLES_GET_HELPURL;this.Kc(g.h.VARIABLES_HUE);K(N(this),new g.Kd("name"),"VAR");this.Ed(!0);this.Sa(g.h.VARIABLES_GET_TOOLTIP)};g.L.variables_set.S=function(){this.wb=g.h.VARIABLES_SET_HELPURL;this.Kc(g.h.VARIABLES_HUE);K(K(K(M(this,"VALUE"),"var"),new g.Kd("name"),"VAR"),"=");K(N(this),";");this.ad(!0);this.qe(!0);this.pe(!0);this.Sa(g.h.VARIABLES_SET_TOOLTIP)};
g.L.procedures_defnoreturn.S=function(){var a=new g.Ab("",g.Ha.gq);K(K(K(K(K(N(this),"function"),a,"NAME"),"("),"","PARAMS"),") {");this.jg(!0);K(N(this),"}");this.ri(new g.Pb(["procedures_mutatorarg"]));g.h.PROCEDURES_DEFNORETURN_COMMENT&&this.gg(g.h.PROCEDURES_DEFNORETURN_COMMENT);this.Kc(g.h.PROCEDURES_HUE);this.Sa(g.h.PROCEDURES_DEFNORETURN_TOOLTIP);this.wb=g.h.PROCEDURES_DEFNORETURN_HELPURL;this.xa=[];this.Yb=[];this.jg(!0);this.xf=null};
g.L.procedures_defreturn.S=function(){var a=new g.Ab("",g.Ha.gq);K(K(K(K(K(N(this),"function"),a,"NAME"),"("),"","PARAMS"),") {");K(Lb(M(this,"RETURN"),g.yl),"return");K(N(this),"}");this.ri(new g.Pb(["procedures_mutatorarg"]));g.h.PROCEDURES_DEFRETURN_COMMENT&&this.gg(g.h.PROCEDURES_DEFRETURN_COMMENT);this.Kc(g.h.PROCEDURES_HUE);this.Sa(g.h.PROCEDURES_DEFRETURN_TOOLTIP);this.wb=g.h.PROCEDURES_DEFRETURN_HELPURL;this.xa=[];this.Yb=[];this.jg(!0);this.xf=null};g.h.PROCEDURES_BEFORE_PARAMS="";
g.L.procedures_callnoreturn.S=function(){this.wb=g.h.PROCEDURES_CALLNORETURN_HELPURL;this.Kc(g.h.PROCEDURES_HUE);K(K(N(this),"","NAME"),"(");K(N(this,"TAIL"),");");this.ad(!0);this.qe(!0);this.pe(!0);this.Sa(g.h.PROCEDURES_CALLNORETURN_TOOLTIP);this.xa=[];this.ah={}};g.L.procedures_callnoreturn.Nc=function(){for(var a=0;a<this.xa.length;a++)if(!A(this,"ARG"+a)){new g.Id(this.xa[a]);var c=M(this,"ARG"+a);0<a&&K(c,",");c.S()}for(;A(this,"ARG"+a);)this.ib("ARG"+a),a++;Sb(this,"TAIL",null)};
g.L.procedures_callreturn.S=function(){this.wb=g.h.PROCEDURES_CALLRETURN_HELPURL;this.Kc(g.h.PROCEDURES_HUE);K(K(N(this),"","NAME"),"(");K(N(this,"TAIL"),")");this.ad(!0);this.Ed(!0);this.Sa(g.h.PROCEDURES_CALLRETURN_TOOLTIP);this.xa=[];this.ah={}};g.L.procedures_callreturn.Nc=g.L.procedures_callnoreturn.Nc;delete g.L.procedures_ifreturn;g.L.pond_scan={S:function(){O(this,{message0:"%1(%2)",args0:["scan",{type:"input_value",name:"DEGREE",check:["Number","Angle"]}],inputsInline:!0,output:"Number",colour:290,tooltip:S("Pond_scanTooltip")})}};g.j.pond_scan=function(a){return["scan("+(Z(a,"DEGREE",g.j.Rc)||0)+")",g.j.gb]};
g.L.pond_cannon={S:function(){O(this,{message0:"%1(%2, %3);",args0:["cannon",{type:"input_value",name:"DEGREE",check:["Number","Angle"]},{type:"input_value",name:"RANGE",check:"Number"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:290,tooltip:S("Pond_cannonTooltip")})}};g.j.pond_cannon=function(a){var c=Z(a,"DEGREE",g.j.Qc)||0;a=Z(a,"RANGE",g.j.Qc)||0;return"cannon("+c+", "+a+");\n"};
g.L.pond_swim={S:function(){O(this,{message0:"%1(%2);",args0:["swim",{type:"input_value",name:"DEGREE",check:["Number","Angle"]}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:290,tooltip:S("Pond_swimTooltip")})}};g.j.pond_swim=function(a){return"swim("+(Z(a,"DEGREE",g.j.Rc)||0)+");\n"};g.L.pond_stop={S:function(){O(this,{message0:"%1(%2);",args0:["stop",""],previousStatement:null,nextStatement:null,colour:290,tooltip:S("Pond_stopTooltip")})}};g.j.pond_stop=function(){return"stop();\n"};
g.L.pond_health={S:function(){O(this,{message0:"%1(%2)",args0:["health",""],output:"Number",colour:290,tooltip:S("Pond_healthTooltip")})}};g.j.pond_health=function(){return["health()",g.j.gb]};g.L.pond_speed={S:function(){O(this,{message0:"%1(%2)",args0:["speed",""],output:"Number",colour:290,tooltip:S("Pond_speedTooltip")})}};g.j.pond_speed=function(){return["speed()",g.j.gb]};g.L.pond_getX={S:function(){O(this,{message0:"%1(%2)",args0:["getX",""],output:"Number",colour:290,tooltip:S("Pond_locXTooltip")})}};
g.j.pond_getX=function(){return["getX()",g.j.gb]};g.L.pond_getY={S:function(){O(this,{message0:"%1(%2)",args0:["getY",""],output:"Number",colour:290,tooltip:S("Pond_locYTooltip")})}};g.j.pond_getY=function(){return["getY()",g.j.gb]};
g.L.pond_math_number={S:function(){this.wb=g.h.MATH_NUMBER_HELPURL;this.Kc(g.h.MATH_HUE);K(N(this,"DUMMY"),new g.Jd(0),"NUM");this.Ed(!0,"Number");this.Sa(g.h.MATH_NUMBER_TOOLTIP)},cb:function(){var a=document.createElement("mutation");a.setAttribute("angle_field",x(this,"NUM").constructor==g.ka);return a},Cb:function(a){a="true"==a.getAttribute("angle_field");this.mv(a)},onchange:function(){if(this.v&&this.M.ca&&this.M.ca.df){var a=x(this,"NUM");-1!=this.M.ca.df.indexOf("Angle")?a.constructor!=g.ka&&
this.mv(!0):a.constructor!=g.Jd&&this.mv(!1)}},mv:function(a){g.i.disable();var c=A(this,"DUMMY"),d=x(this,"NUM"),e=d.getValue();a?(Ib(c,"NUM"),d=new g.ka(""),K(c,d,"NUM"),d.setValue(e)):(Ib(c,"NUM"),K(c,new g.Jd(e),"NUM"));this.ba&&this.za();g.i.enable()}};
g.L.pond_math_single={S:function(){O(this,{message0:"%1 (%2)",args0:[{type:"field_dropdown",name:"OP",options:[["Math.sqrt","ROOT"],["Math.abs","ABS"],["Math.sin_deg","SIN"],["Math.cos_deg","COS"],["Math.tan_deg","TAN"],["Math.asin_deg","ASIN"],["Math.acos_deg","ACOS"],["Math.atan_deg","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],inputsInline:!0,output:"Number",colour:g.h.MATH_HUE,helpUrl:g.h.MATH_SINGLE_HELPURL});var a=this;this.Sa(function(){var c=F(a,"OP");return{ROOT:g.h.MATH_SINGLE_TOOLTIP_ROOT,
ABS:g.h.MATH_SINGLE_TOOLTIP_ABS,SIN:g.h.MATH_TRIG_TOOLTIP_SIN,COS:g.h.MATH_TRIG_TOOLTIP_COS,TAN:g.h.MATH_TRIG_TOOLTIP_TAN,ASIN:g.h.MATH_TRIG_TOOLTIP_ASIN,ACOS:g.h.MATH_TRIG_TOOLTIP_ACOS,ATAN:g.h.MATH_TRIG_TOOLTIP_ATAN}[c]})}};
g.j.pond_math_single=function(a){var c=F(a,"OP");a=Z(a,"NUM",g.j.Rc)||"0";switch(c){case "ABS":c="Math.abs("+a+")";break;case "ROOT":c="Math.sqrt("+a+")";break;case "SIN":c="Math.sin_deg("+a+")";break;case "COS":c="Math.cos_deg("+a+")";break;case "TAN":c="Math.tan_deg("+a+")";break;case "ASIN":c="Math.asin_deg("+a+")";break;case "ACOS":c="Math.acos_deg("+a+")";break;case "ATAN":c="Math.atan_deg("+a+")";break;default:throw Error("Unknown math operator: "+c);}return[c,g.j.gb]};
g.j.pond_math_number=g.j.math_number;g.L.pond_loc_x=g.L.pond_getX;g.j.pond_loc_x=g.j.pond_getX;g.L.pond_loc_y=g.L.pond_getY;g.j.pond_loc_y=g.j.pond_getY;g.L.pond_controls_if=g.L.controls_if;g.j.pond_controls_if=g.j.controls_if;g.L.pond_loops_while=g.L.controls_whileUntil;g.j.pond_loops_while=g.j.controls_whileUntil;g.L.pond_math_arithmetic=g.L.math_arithmetic;g.j.pond_math_arithmetic=g.j.math_arithmetic;g.L.pond_math_change=g.L.math_change;g.j.pond_math_change=g.j.math_change;var Pe=Pe||{};function Qe(a,c){function d(){}d.prototype=c.prototype;a.w=c.prototype;a.prototype=new d;a.prototype.constructor=a;a.SL=function(e,f,h){return c.prototype[f].apply(e,Array.prototype.slice.call(arguments,2))}}if(!Re){var Re,Se="";"undefined"!==typeof navigator&&navigator&&"string"==typeof navigator.userAgent&&(Se=navigator.userAgent);var Te=0==Se.indexOf("Opera");Re={oM:{kJ:"ScriptEngine"in window},nK:Te,vg:!Te&&-1!=Se.indexOf("MSIE"),Qr:!Te&&-1!=Se.indexOf("WebKit")}}if(!Ue)var Ue={};
if(!Ve)var Ve={};if(!We)var We={};if(!Xe)var Xe={};if(!Ye)var Ye={};if(!Ze)var Ze={};var $e=Pe.rI?{xM:!0}:{};function af(){throw Error("Do not instantiate directly");}af.prototype.tx=null;af.prototype.toString=function(){return this.content};function bf(a){if(null!=a)switch(a.tx){case 1:return 1;case -1:return-1;case 0:return 0}return null}function cf(){af.call(this)}Qe(cf,af);cf.prototype.aE=$e;function df(a){return null!=a&&a.aE===$e?a:ef(String(String(a)).replace(ff,gf),bf(a))}
var ef=function(a){function c(){}c.prototype=a.prototype;return function(d,e){var f=new c;f.content=String(d);void 0!==e&&(f.tx=e);return f}}(cf),hf={"\x00":"&#0;",'"':"&quot;","&":"&amp;","'":"&#39;","<":"&lt;",">":"&gt;","\t":"&#9;","\n":"&#10;","\x0B":"&#11;","\f":"&#12;","\r":"&#13;"," ":"&#32;","-":"&#45;","/":"&#47;","=":"&#61;","`":"&#96;","\u0085":"&#133;","\u00a0":"&#160;","\u2028":"&#8232;","\u2029":"&#8233;"};function gf(a){return hf[a]}var ff=/[\x00\x22\x26\x27\x3c\x3e]/g;function jf(){return'<div style="display: none"><span id="Games_name">Jogos do Blockly</span><span id="Games_puzzle">Quebra-Cabe\u00e7a</span><span id="Games_maze">Labirinto</span><span id="Games_bird">P\u00e1ssaro</span><span id="Games_turtle">Tartaruga</span><span id="Games_movie">Filme</span><span id="Games_music">M\u00fasica</span><span id="Games_pondTutor">Tutor de Lagoa</span><span id="Games_pond">Lagoa</span><span id="Games_genetics">Gen\u00e9ticas</span><span id="Games_linesOfCode1">Voc\u00ea solucionou esse n\u00edvel com uma linha de JavaScript:</span><span id="Games_linesOfCode2">Voc\u00ea solucionou esse n\u00edvel com %1 linhas de JavaScript:</span><span id="Games_nextLevel">Voc\u00ea esta preparado para o n\u00edvel %1?</span><span id="Games_finalLevel">Voc\u00ea esta preparado para o pr\u00f3ximo desafio?</span><span id="Games_submitTitle">T\u00edtulo:</span><span id="Games_linkTooltip">Salvar e ligar aos blocos.</span><span id="Games_runTooltip">Rodar o programa que voc\u00ea escreveu.</span><span id="Games_runProgram">Executar o programa</span><span id="Games_resetTooltip">Parar a execu\u00e7\u00e3o do programa e resetar o nivel.</span><span id="Games_resetProgram">Reiniciar</span><span id="Games_help">Ajuda</span><span id="Games_dialogOk">OK</span><span id="Games_dialogCancel">Cancelar</span><span id="Games_catLogic">L\u00f3gica</span><span id="Games_catLoops">La\u00e7os</span><span id="Games_catMath">Matem\u00e1tica</span><span id="Games_catText">Texto</span><span id="Games_catLists">Listas</span><span id="Games_catColour">Cor</span><span id="Games_catVariables">Vari\u00e1veis</span><span id="Games_catProcedures">Fun\u00e7\u00f5es</span><span id="Games_httpRequestError">Houve um problema com a requisi\u00e7\u00e3o.</span><span id="Games_linkAlert">Compartilhe seus blocos com este link:\n\n%1</span><span id="Games_hashError">Desculpe, \'%1\' n\u00e3o corresponde a um programa salvo.</span><span id="Games_xmlError">N\u00e3o foi poss\u00edvel carregar seu arquivo salvo. Talvez ele tenha sido criado com uma vers\u00e3o diferente do Blockly?</span><span id="Games_submitted">Agradecemos pelo programa! Se a nossa equipa gostar dele, este ser\u00e1 publicado na galeria por n\u00f3s dentro de alguns dias.</span><span id="Games_listVariable">lista</span><span id="Games_textVariable">texto</span><span id="Games_breakLink">Quando voc\u00ea come\u00e7ar a editar o JavaScript, voc\u00ea n\u00e3o poder\u00e1 mais voltar a editar os blocos. Voc\u00ea tem certeza?</span><span id="Games_blocks">Blocos</div></div><div style="display: none"><span id="Pond_scanTooltip">Busque inimigos. Especifique uma dire\u00e7\u00e3o(0-360). \\nRetorna a distancia do inimigo mais proximo \\nnaquela dire\u00e7\u00e3o. Retorna infinito se nenhum \\ninimigo for encontrado. </span><span id="Pond_cannonTooltip">Dispare o canh\u00e3o. Especifique uma dire\u00e7\u00e3o \\n(0-360) e o alcance (0-70). </span><span id="Pond_swimTooltip">Nadar para a frente. Especifique uma dire\u00e7\u00e3o \\n(0-360). </span><span id="Pond_stopTooltip">Parar de nadar. O jogador fara uma parada lenta. </span><span id="Pond_healthTooltip">Retorna a saude atual do jogador (0 esta morto, \\n100 esta saud\u00e1vel). </span><span id="Pond_speedTooltip">Retorna a velocidade atual do jogador (0 esta \\npar\u00e1do, 100 esta na velocidade maxima) </span><span id="Pond_locXTooltip">Retorna a coordenada X do jogador (0 \u00e9 a margem \\nesquerda, 100 \u00e9 a margem direita). </span><span id="Pond_locYTooltip">Retorna a coordenada Y do jogador (0 \u00e9 a borda \\ninferior, 100 \u00e9 a borda superior). </span></div><div style="display: none"><span id="Pond_rabbitName">Coelho</span><span id="Pond_counterName">Contador</span><span id="Pond_rookName">Torre</span><span id="Pond_sniperName">Francoatirador</span><span id="Pond_myName">Jogador</span></div><h1><span id="title">'+
((Qc?'<a href="index.html?lang='+df(Oc)+'">':'<a href="./?lang='+df(Oc)+'">')+"Jogos do Blockly</a> : "+df({appName:"Lagoa"}.appName)+'</span></h1><div id="visualization"><canvas id="scratch" width="400" height="400" style="display: none"></canvas><canvas id="display" width="400" height="400"></canvas></div><table id="avatarStatTable"><tbody><tr id="avatarStatRow1"></tr><tr id="avatarStatRow2"></tr></tbody></table><table width="400"><tr><td style="width: 190px; text-align: center; vertical-align: top;"><button id="docsButton" title="Mostrar a documenta\u00e7\u00e3o de idioma.">Documenta\u00e7\u00e3o</button></td><td><button id="runButton" class="primary" title="Rodar o programa que voc\u00ea escreveu."><img src="common/1x1.gif" class="run icon21"> Executar o programa</button><button id="resetButton" class="primary" style="display: none" title="Parar a execu\u00e7\u00e3o do programa e resetar o nivel."><img src="common/1x1.gif" class="stop icon21"> Reiniciar</button></td></tr></table><div id="dialogDocs"><img src="common/1x1.gif" class="close icon21" id="closeDocs"><iframe id="frameDocs"></iframe></div><div id="tabarea"><div id="editorBar" class="tab-bar"><div class="tab tab-selected">Blocos</div><div class="tab">JavaScript</div></div><div class="tab-bar-clear"></div><div id="blockly"></div><div id="editor"></div></div><xml id="toolbox" style="display: none;" xmlns="https://developers.google.com/blockly/xml"><category name="Lagoa"><block type="pond_cannon"><value name="DEGREE"><shadow type="pond_math_number"><mutation angle_field="true"></mutation><field name="NUM">0</field></shadow></value><value name="RANGE"><shadow type="pond_math_number"><mutation angle_field="false"></mutation><field name="NUM">70</field></shadow></value></block><block type="pond_scan"><value name="DEGREE"><shadow type="pond_math_number"><mutation angle_field="true"></mutation><field name="NUM">0</field></shadow></value></block><block type="pond_swim"><value name="DEGREE"><shadow type="pond_math_number"><mutation angle_field="true"></mutation><field name="NUM">0</field></shadow></value></block><block type="pond_stop"></block><block type="pond_getX"></block><block type="pond_getY"></block><block type="pond_speed"></block><block type="pond_health"></block></category><category name="L\u00f3gica"><block type="controls_if"></block><block type="logic_compare"></block><block type="logic_operation"></block><block type="logic_boolean"></block></category><category name="La\u00e7os"><block type="controls_whileUntil"></block></category><category name="Matem\u00e1tica"><block type="pond_math_number"><mutation angle_field="false"></mutation></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="pond_math_single"><value name="NUM"><shadow type="math_number"><field name="NUM">9</field></shadow></value></block><block type="math_random_float"></block></category><sep></sep><category name="Vari\u00e1veis" custom="VARIABLE"></category><category name="Fun\u00e7\u00f5es" custom="PROCEDURE"></category></xml>\n<div id="playerRabbit" style="display: none">\n/* rabbit */\n// rabbit runs around the field, randomly and never fires; use as a target.\n\n/* go - go to the point specified */\nfunction go (dest_x, dest_y) {\n  var course = plot_course(dest_x, dest_y);\n  while (distance(getX(), getY(), dest_x, dest_y) > 5) {\n    drive(course, 25);\n  }\n  while (speed() > 0) {\n    drive(course, 0);\n  }\n}\n\n/* distance forumula. */\nfunction distance(x1, y1, x2, y2) {\n  var x = x1 - x2;\n  var y = y1 - y2;\n  return Math.sqrt((x * x) + (y * y));\n}\n\n/* plot_course - figure out which heading to go. */\nfunction plot_course(xx, yy) {\n  var d;\n  var curx = getX();\n  var cury = getY();\n  var x = curx - xx;\n  var y = cury - yy;\n\n  if (x == 0) {\n    if (yy > cury) {\n      d = 90;\n    } else {\n      d = 270;\n    }\n  } else {\n    if (yy < cury) {\n      if (xx > curx) {\n        d = 360 + Math.atan_deg(y / x);\n      } else {\n        d = 180 + Math.atan_deg(y / x);\n      }\n    } else {\n      if (xx > curx) {\n        d = Math.atan_deg(y / x);\n      } else {\n        d = 180 + Math.atan_deg(y / x);\n      }\n    }\n  }\n  return d;\n}\n\nwhile (true) {\n  // Go somewhere in the field.\n  var x = Math.random() * 100;\n  var y = Math.random() * 100;\n  go(x, y);\n}\n</div>\n\n<div id="playerCounter" style="display: none">\n/* counter */\n/* scan in a counter-clockwise direction (increasing degrees) */\n/* moves when hit */\n\nvar range;\nvar last_dir = 0;\n\nvar res = 2;\nvar d = damage();\nvar angle = Math.random() * 360;\nwhile (true) {\n  while ((range = scan(angle, res)) != Infinity) {\n    if (range > 70) { /* out of range, head toward it */\n      drive(angle, 50);\n      var i = 1;\n      while (i++ < 50) /* use a counter to limit move time */\n        ;\n      drive (angle, 0);\n      if (d != damage()) {\n        d = damage();\n        run();\n      }\n      angle -= 3;\n    } else {\n      while (!cannon(angle, range))\n        ;\n      if (d != damage()) {\n        d = damage();\n        run();\n      }\n      angle -= 15;\n    }\n  }\n  if (d != damage()) {\n    d = damage();\n    run();\n  }\n  angle += res;\n  angle %= 360;\n}\n\n/* run moves around the center of the field */\nfunction run() {\n  var i = 0;\n  var x = getX();\n  var y = getY();\n\n  if (last_dir == 0) {\n    last_dir = 1;\n    if (y > 51) {\n      drive(270, 100);\n      while (y - 10 < getY() && i++ < 50)\n        ;\n      drive(270, 0);\n    } else {\n      drive(90, 100);\n      while (y + 10 > getY() && i++ < 50)\n        ;\n      drive(90, 0);\n    }\n  } else {\n    last_dir = 0;\n    if (x > 51) {\n      drive(180, 100);\n      while (x - 10 < getX() && i++ < 50)\n        ;\n      drive(180, 0);\n    } else {\n      drive(0, 100);\n      while (x + 10 > getX() && i++ < 50)\n        ;\n      drive(0, 0);\n    }\n  }\n}\n</div>\n\n<div id="playerRook" style="display: none">\n/* rook.r  -  scans the battlefield like a rook, i.e., only 0,90,180,270 */\n/* move horizontally only, but looks horz and vertically */\n\n/* move to center of board */\nif (getY() < 50) {\n  while (getY() < 40)        /* stop near center */\n    drive(90, 100);           /* start moving */\n} else {\n  while (getY() > 60)        /* stop near center */\n    drive(270, 100);          /* start moving */\n}\ndrive(0, 0);\nwhile (speed() > 0)\n  ;\n\n/* initialize starting parameters */\nvar d = damage();\nvar course = 0;\nvar boundary = 99;\ndrive(course, 30);\n\n/* main loop */\nwhile(true) {\n  /* look all directions */\n  look(0);\n  look(90);\n  look(180);\n  look(270);\n\n  /* if near end of battlefield, change directions */\n  if (course == 0) {\n    if (getX() > boundary || speed() == 0)\n      change();\n  }\n  else {\n    if (getX() < boundary || speed() == 0)\n      change();\n  }\n}\n\n/* look somewhere, and fire cannon repeatedly at in-range target */\nfunction look(deg) {\n  var range;\n  while ((range = scan(deg, 4)) <= 70)  {\n    drive(course, 0);\n    cannon(deg, range);\n    if (d + 20 != damage()) {\n      d = damage();\n      change();\n    }\n  }\n}\n\nfunction change() {\n  if (course == 0) {\n    boundary = 1;\n    course = 180;\n  } else {\n    boundary = 99;\n    course = 0;\n  }\n  drive(course, 30);\n}\n</div>\n\n<div id="playerSniper" style="display: none">\n/* sniper */\n/* strategy: since a scan of the entire battlefield can be done in 90 */\n/* degrees from a corner, sniper can scan the field quickly. */\n\n/* external variables, that can be used by any function */\nvar corner = 0;           /* current corner 0, 1, 2, or 2 */\nvar sc = 0;               /* current scan start */\n\nvar range;          /* range to target */\n\n/* initialize the corner info */\n/* x and y location of a corner, and starting scan degree */\nvar c1x = 2,  c1y = 2,  s1 = 0;\nvar c2x = 2,  c2y = 98, s2 = 270;\nvar c3x = 98, c3y = 98, s3 = 180;\nvar c4x = 98, c4y = 2,  s4 = 90;\nvar closest = Infinity;\nnew_corner();       /* start at a random corner */\nvar d = damage();       /* get current damage */\nvar dir = sc;           /* starting scan direction */\n\nwhile (true) {         /* loop is executed forever */\n  while (dir < sc + 90) {  /* scan through 90 degree range */\n    range = scan(dir, 2);   /* look at a direction */\n    if (range <= 70) {\n      while (range > 0) {    /* keep firing while in range */\n        closest = range;     /* set closest flag */\n        cannon(dir, range);   /* fire! */\n        range = scan(dir, 1); /* check target again */\n        if (d + 15 > damage())  /* sustained several hits, */\n          range = 0;            /* goto new corner */\n      }\n      dir -= 10;             /* back up scan, in case */\n    }\n\n    dir += 2;                /* increment scan */\n    if (d != damage()) {     /* check for damage incurred */\n      new_corner();          /* we\'re hit, move now */\n      d = damage();\n      dir = sc;\n    }\n  }\n\n  if (closest == Infinity) {       /* check for any targets in range */\n    new_corner();             /* nothing, move to new corner */\n    d = damage();\n    dir = sc;\n  } else {                     /* targets in range, resume */\n    dir = sc;\n  }\n  closest = Infinity;\n}\n\n/* new corner function to move to a different corner */\nfunction new_corner() {\n  var x, y;\n\n  var rand = Math.floor(Math.random() * 4);           /* pick a random corner */\n  if (rand == corner)       /* but make it different than the */\n    corner = (rand + 1) % 4;/* current corner */\n  else\n    corner = rand;\n  if (corner == 0) {       /* set new x,y and scan start */\n    x = c1x;\n    y = c1y;\n    sc = s1;\n  }\n  if (corner == 1) {\n    x = c2x;\n    y = c2y;\n    sc = s2;\n  }\n  if (corner == 2) {\n    x = c3x;\n    y = c3y;\n    sc = s3;\n  }\n  if (corner == 3) {\n    x = c4x;\n    y = c4y;\n    sc = s4;\n  }\n\n  /* find the heading we need to get to the desired corner */\n  var angle = plot_course(x,y);\n\n  /* start drive train, full speed */\n\n  /* keep traveling until we are within 15 meters */\n  /* speed is checked in case we run into wall, other robot */\n  /* not terribly great, since were are doing nothing while moving */\n\n  while (distance(getX(), getY(), x, y) > 15)\n    drive(angle, 100);\n\n  /* cut speed, and creep the rest of the way */\n\n  while (distance(getX(), getY(), x, y) > 1)\n    drive(angle, 20);\n\n  /* stop drive, should coast in the rest of the way */\n  drive(angle, 0);\n}  /* end of new_corner */\n\n/* classical pythagorean distance formula */\nfunction distance(x1, y1, x2, y2) {\n  var x = x1 - x2;\n  var y = y1 - y2;\n  return Math.sqrt((x * x) + (y * y));\n}\n\n/* plot course function, return degree heading to */\n/* reach destination x, y; uses atan() trig function */\nfunction plot_course(xx, yy) {\n  var d;\n  var x,y;\n  var curx, cury;\n\n  curx = getX();  /* get current location */\n  cury = getY();\n  x = curx - xx;\n  y = cury - yy;\n\n  /* atan only returns -90 to +90, so figure out how to use */\n  /* the atan() value */\n\n  if (x == 0) {      /* x is zero, we either move due north or south */\n    if (yy > cury)\n      d = 90;        /* north */\n    else\n      d = 270;       /* south */\n  } else {\n    if (yy < cury) {\n      if (xx > curx)\n        d = 360 + Math.atan_deg(y / x);  /* south-east, quadrant 4 */\n      else\n        d = 180 + Math.atan_deg(y / x);  /* south-west, quadrant 3 */\n    } else {\n      if (xx > curx)\n        d = Math.atan_deg(y / x);        /* north-east, quadrant 1 */\n      else\n        d = 180 + Math.atan_deg(y / x);  /* north-west, quadrant 2 */\n    }\n  }\n  return d;\n}\n</div>\n<div id="dialogShadow" class="dialogAnimate"></div><div id="dialogBorder"></div><div id="dialog"></div>')}
;var Yc="pond-duck",kf=null,lf=!0,mf=!0;
function nf(a){for(var c=["blockly","editor"],d=0,e;e=c[d];d++)e=document.getElementById(e),e.style.visibility=d==a?"visible":"hidden";c=[".blocklyTooltipDiv",".blocklyToolboxDiv"];for(d=0;e=c[d];d++)e=document.querySelector(e),e.style.visibility=0==a?"visible":"hidden";document.getElementById("docsButton").disabled=!1;R=0==a?11:12;oe&&(document.getElementById("frameDocs").src="pond/docs.html?lang="+Oc+"&mode="+R);1==a&&lf&&(a=qd(),mf=!0,V.zd.setValue(a,-1),mf=!1)}
function of(){if(!mf)if(lf)if(!D(B,!1).length||confirm(S("Games_breakLink")))g.g.o.mb(kf[0],"tab-disabled"),lf=!1;else{var a=qd();mf=!0;V.zd.setValue(a,-1);mf=!1}else a=V.zd.getValue(),a.trim()||(B.clear(),g.g.o.Tb(kf[0],"tab-disabled"),lf=!0)}
window.addEventListener("load",function(){function a(){var v=h.offsetTop;k.style.top=v-window.pageYOffset+"px";k.style.left=f?"10px":"420px";k.style.width=window.innerWidth-440+"px";v=Math.max(0,v+k.offsetHeight-window.pageYOffset)+"px";for(var C=f?"10px":"420px",Q=window.innerWidth-440+"px",T=0,W;W=m[T];T++)W.style.top=v,W.style.left=C,W.style.width=Q}function c(v){return function(){if(!g.g.o.yt(d[v],"tab-disabled")){for(var C=0;C<d.length;C++)v==C?g.g.o.mb(d[C],"tab-selected"):g.g.o.Tb(d[C],"tab-selected");
nf(v)}}}document.body.innerHTML=jf();V.S();fe();Zc("runButton",re);Zc("resetButton",te);Zc("docsButton",pe);Zc("closeDocs",qe);setTimeout(V.EF,1);setTimeout(V.FF,1);for(var d=Array.prototype.slice.call(document.querySelectorAll("#editorBar>.tab")),e=0;e<d.length;e++)Zc(d[e],c(e));kf=d;var f=-1!=Nc.indexOf(Oc),h=document.getElementById("visualization"),k=document.getElementById("tabarea");e=document.getElementById("blockly");var l=document.getElementById("editor"),m=[e,l];window.addEventListener("scroll",
function(){a(null);g.ol(B)});window.addEventListener("resize",a);a(null);V.zd=window.ace.edit("editor");V.zd.setTheme("ace/theme/chrome");V.zd.setShowPrintMargin(!1);e=V.zd.getSession();e.setMode("ace/mode/javascript");e.setTabSize(2);e.setUseSoftTabs(!0);e.on("change",of);V.zd.setValue("cannon(0, 70);",-1);e=document.getElementById("toolbox");B=g.Th("blockly",{media:"third-party/blockly/media/",rtl:!1,toolbox:e,trashcan:!0,zoom:{controls:!0,wheel:!0}});Ke("scan,cannon,drive,swim,stop,speed,damage,health,loc_x,getX,loc_y,getY,");
e=g.R.jh('<xml><block type="pond_cannon" x="70" y="70"><value name="DEGREE"><shadow type="pond_math_number"><mutation angle_field="true"></mutation><field name="NUM">0</field></shadow></value><value name="RANGE"><shadow type="pond_math_number"><mutation angle_field="false"></mutation><field name="NUM">70</field></shadow></value></block></xml>');B.clear();g.R.Qg(e,B);hb();l=[{start:new g.g.N(20,80),kd:0,name:"Pond_myName",code:null},{start:new g.g.N(80,80),kd:0,name:"Pond_rookName",code:"playerRook"},
{start:new g.g.N(20,20),kd:0,name:"Pond_counterName",code:"playerCounter"},{start:new g.g.N(80,20),kd:0,name:"Pond_sniperName",code:"playerSniper"}];var n;for(e=0;n=l[e];e++){var r=n.code?document.getElementById(n.code).textContent:function(){return lf?qd():V.zd.getValue()},t=S(n.name);X.pD(t,r,n.start,n.kd)}X.reset();he();nf(0);mf=!1});
