// 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(/<<>>/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("<<>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;", "}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<>>/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(<<>>/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.lengthc&&(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;eh);return k}; g.g.eb.pv=function(a,c,d){for(var e=[0],f=[],h=0;he&&(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=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;kd;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+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.Teimage, .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);-1f.top?g.D.uy(d,e,f,h):c+h.heightdocument.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.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 $2")}while(a!=d);return a};g.R.ZL=function(a){a=g.R.Rd(a).split("<");for(var c="",d=1;d"!=e.slice(-2)&&(c+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1");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 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;cd+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;ed)){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;1a.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;1a-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;fc)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&&1h)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?ef&&(c=-(f-this.fc.x)):ef&&(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;dk&&(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.widthh&&(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<-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;ec||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;fa&&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=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;ca&&(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=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=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);ac?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(;hc?!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.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(;dc.$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 tthis.rn){var d=c-this.rn;d=0Object.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=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;da.bottom&&(a.bottom=e.bottom);e.lefta.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;Qv.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:ethis.options.Eb.fn?a=this.options.Eb.fn:this.options.Eb.hn&&ak.BA||k.Cck.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;a1'), 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;kf?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;ck[0]?1:h[0]=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;ea.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=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;eR?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("<<>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<>>/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(<<>>/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("<<>>/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){0this.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)&&0Math.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.progressc.Sf&&(c.speed=Math.max(c.speed-X.rv,c.Sf)),0c.Na.x||100c.Na.y||100d&&(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;ah&&(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)),tk?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&&0a.length)){e=[];for(f=0;fthis.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;dthis.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;ed;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:0c&&(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;hd?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(0d&&(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","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 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",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","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":">","\t":" ","\n":" ","\x0B":" ","\f":" ","\r":" "," ":" ","-":"-","/":"/","=":"=","`":"`","\u0085":"…","\u00a0":" ","\u2028":"
","\u2029":"
"};function gf(a){return hf[a]}var ff=/[\x00\x22\x26\x27\x3c\x3e]/g;function jf(){return'
Jogos do BlocklyQuebra-Cabe\u00e7aLabirintoP\u00e1ssaroTartarugaFilmeM\u00fasicaTutor de LagoaLagoaGen\u00e9ticasVoc\u00ea solucionou esse n\u00edvel com uma linha de JavaScript:Voc\u00ea solucionou esse n\u00edvel com %1 linhas de JavaScript:Voc\u00ea esta preparado para o n\u00edvel %1?Voc\u00ea esta preparado para o pr\u00f3ximo desafio?T\u00edtulo:Salvar e ligar aos blocos.Rodar o programa que voc\u00ea escreveu.Executar o programaParar a execu\u00e7\u00e3o do programa e resetar o nivel.ReiniciarAjudaOKCancelarL\u00f3gicaLa\u00e7osMatem\u00e1ticaTextoListasCorVari\u00e1veisFun\u00e7\u00f5esHouve um problema com a requisi\u00e7\u00e3o.Compartilhe seus blocos com este link:\n\n%1Desculpe, \'%1\' n\u00e3o corresponde a um programa salvo.N\u00e3o foi poss\u00edvel carregar seu arquivo salvo. Talvez ele tenha sido criado com uma vers\u00e3o diferente do Blockly?Agradecemos pelo programa! Se a nossa equipa gostar dele, este ser\u00e1 publicado na galeria por n\u00f3s dentro de alguns dias.listatextoQuando voc\u00ea come\u00e7ar a editar o JavaScript, voc\u00ea n\u00e3o poder\u00e1 mais voltar a editar os blocos. Voc\u00ea tem certeza?Blocos
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. Dispare o canh\u00e3o. Especifique uma dire\u00e7\u00e3o \\n(0-360) e o alcance (0-70). Nadar para a frente. Especifique uma dire\u00e7\u00e3o \\n(0-360). Parar de nadar. O jogador fara uma parada lenta. Retorna a saude atual do jogador (0 esta morto, \\n100 esta saud\u00e1vel). Retorna a velocidade atual do jogador (0 esta \\npar\u00e1do, 100 esta na velocidade maxima) Retorna a coordenada X do jogador (0 \u00e9 a margem \\nesquerda, 100 \u00e9 a margem direita). Retorna a coordenada Y do jogador (0 \u00e9 a borda \\ninferior, 100 \u00e9 a borda superior).
CoelhoContadorTorreFrancoatiradorJogador

'+ ((Qc?'':'')+"Jogos do Blockly : "+df({appName:"Lagoa"}.appName)+'

Blocos
JavaScript
\n\n\n\n\n\n\n\n
')} ;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.tab")),e=0;e070');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});