// Automatically generated file. Do not edit! 'use strict';var b,h={yI:{},vt:40,Ht:125,xy:5,Gy:10,bd:28};h.ly=h.bd;h.sy=8;h.Uy="#000000";h.rm=250;h.Go=10;h.jy=30;h.iz=750;h.Hz=100;h.yy=!0;h.Py=.45;h.Qy=.65;h.Ni={width:96,height:124,url:"sprites.png"};h.Sa=1;h.Vd=2;h.Ga=3;h.Xd=4;h.Qd=5;h.Co=-1;h.Js=0;h.Ks=1;h.PE=0;h.QE=1;h.NE=1;h.OE=2;h.Ji=[];h.Ji[h.Sa]=h.Vd;h.Ji[h.Vd]=h.Sa;h.Ji[h.Ga]=h.Xd;h.Ji[h.Xd]=h.Ga;h.fh=0;h.ik=1;h.zd=2;h.fg=3;h.bt=null;h.Ko=1;h.ct=2;h.bu="VARIABLE";h.Uz="VARIABLE_DYNAMIC";h.Jt="PROCEDURE";h.Qt="RENAME_VARIABLE_ID"; h.dt="DELETE_VARIABLE_ID"; h.g={};h.g.global=function(){return"object"===typeof self?self:"object"===typeof window?window:"object"===typeof global?global:this}(); h.h={};h.g.global.Blockly||(h.g.global.Blockly={});h.g.global.Blockly.Msg||(h.g.global.Blockly.Msg=h.h);h.g.I=function(a,c){this.x=a;this.y=c};h.g.I.Ne=function(a,c){return a==c?!0:a&&c?a.x==c.x&&a.y==c.y:!1};h.g.I.ng=function(a,c){var d=a.x-c.x;a=a.y-c.y;return Math.sqrt(d*d+a*a)};h.g.I.vC=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};h.g.I.Ok=function(a,c){return new h.g.I(a.x-c.x,a.y-c.y)};h.g.I.sum=function(a,c){return new h.g.I(a.x+c.x,a.y+c.y)};h.g.I.prototype.scale=function(a){this.x*=a;this.y*=a;return this};h.g.I.prototype.translate=function(a,c){this.x+=a;this.y+=c;return this};h.g.Oa={};h.g.Oa.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};h.g.Oa.qs=function(a){return a.length?a.reduce(function(c,d){return c.lengthc&&(c=d[e].length);e=-Infinity;var f=1;do{var g=e;var k=a;a=[];var l=d.length/f,m=1;for(e=0;eg);return k}; h.g.Oa.Fs=function(a,c,d){for(var e=[0],f=[],g=0;ge&&(e=l,f=k)}return f?h.g.Oa.Hx(a,f,d):c};h.g.Oa.bE=function(a,c){for(var d=[],e=0;e=l?(f=2,g=l,(l=a.join(""))&&d.push(l),a.length=0):"{"==l?f=3:(a.push("%",l),f=0):2==f?"0"<=l&&"9">=l?g+=l:(d.push(parseInt(g,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=h.g.Oa.startsWith(l,"BKY_")? l.substring(4):null)&&l in h.h?(f=h.h[l],"string"==typeof f?Array.prototype.push.apply(d,h.g.ys(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]=h.g.Af.ox.charAt(Math.random()*a);return c.join("")}; h.g.Af.ox="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; h.g.Gh=function(){if(void 0!==h.g.Gh.Rp)return h.g.Gh.Rp;if(!h.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=h.g.global.getComputedStyle(a);if(!c)return document.body.removeChild(a),!1;c=c.getPropertyValue(d[e])}document.body.removeChild(a); h.g.Gh.Rp="none"!==c;return h.g.Gh.Rp};h.g.$w=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)};h.g.PB=function(){var a=h.g.style.Jv();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}}; h.g.Xm=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};h.g.IB=function(){var a=document.documentElement,c=window;return h.g.userAgent.Uf&&c.pageYOffset!=a.scrollTop?new h.g.I(a.scrollLeft,a.scrollTop):new h.g.I(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};h.g.Fq=function(a,c){var d=Object.create(null),e=p(a,!0);c&&(a=u(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}; h.g.tD=function(a,c){var d=c.x;c=c.y;var e=aa(a).getBoundingClientRect();d=new h.g.I(d-e.left,c-e.top);c=h.g.Tk(a.Xa);return h.g.I.Ok(d,c).scale(1/a.scale)};h.i={};h.i.Nv="";h.i.ic=!0;h.i.gq=0;h.i.xm="create";h.i.Qs=h.i.xm;h.i.Wj="delete";h.i.Zx=h.i.Wj;h.i.yi="change";h.i.oE=h.i.yi;h.i.ck="move";h.i.Rs=h.i.ck;h.i.cu="var_create";h.i.du="var_delete";h.i.fu="var_rename";h.i.Vm="ui";h.i.vm="comment_create";h.i.Xs="comment_delete";h.i.Ws="comment_change";h.i.wm="comment_move";h.i.Fy="finished_loading";h.i.ay=[h.i.Qs,h.i.Rs,h.i.vm,h.i.wm];h.i.Xj=[];h.i.Ha=function(a){h.i.isEnabled()&&(h.i.Xj.length||setTimeout(h.i.rB,0),h.i.Xj.push(a))}; h.i.rB=function(){for(var a=h.i.filter(h.i.Xj,!0),c=h.i.Xj.length=0,d;d=a[c];c++)if(d.ac){var e=h.ob.Gq(d.ac);if(e){var f=d;if(f.ic)for(e.ni.push(f),e.Hl.length=0;e.ni.length>e.xt&&0<=e.xt;)e.ni.shift();for(var g=0;d=e.Kc[g];g++)d(f)}}}; h.i.filter=function(a,c){a=a.slice();c||a.reverse();for(var d=[],e=Object.create(null),f=0,g;g=a[f];f++)if(!g.uj()){var k=[g.type,g.pc,g.ac].join(" "),l=e[k],m=l?l.event:null;if(!l)e[k]={event:g,index:f},d.push(g);else if(g.type==h.i.ck&&l.index==f-1)m.Sh=g.Sh,m.Rh=g.Rh,m.Dg=g.Dg,l.index=f;else if(g.type==h.i.yi&&g.element==m.element&&g.name==m.name)m.newValue=g.newValue;else if(g.type!=h.i.Vm||"click"!=g.element||"commentOpen"!=m.element&&"mutatorOpen"!=m.element&&"warningOpen"!=m.element)e[k]={event:g, index:1},d.push(g)}a=d.filter(function(n){return!n.uj()});c||a.reverse();for(f=1;g=a[f];f++)g.type==h.i.yi&&"mutation"==g.element&&a.unshift(a.splice(f,1)[0]);return a};h.i.EA=function(){for(var a=0,c;c=h.i.Xj[a];a++)c.ic=!1};h.i.disable=function(){h.i.gq++};h.i.enable=function(){h.i.gq--};h.i.isEnabled=function(){return 0==h.i.gq};h.i.Fb=function(){return h.i.Nv};h.i.X=function(a){h.i.Nv="boolean"==typeof a?a?h.g.Af():"":a}; h.i.wv=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++)c[d]=e.id;return c}; h.i.qa=function(a){switch(a.type){case h.i.xm:var c=new h.i.Pd(null);break;case h.i.Wj:c=new h.i.ze(null);break;case h.i.yi:c=new h.i.Sf(null,"","","","");break;case h.i.ck:c=new h.i.ah(null);break;case h.i.cu:c=new h.i.Ad(null);break;case h.i.du:c=new h.i.Zd(null);break;case h.i.fu:c=new h.i.Fe(null,"");break;case h.i.Vm:c=new h.i.dd(null,"","","");break;case h.i.vm:c=new h.i.hf(null);break;case h.i.Ws:c=new h.i.Ai(null,"","");break;case h.i.wm:c=new h.i.Vg(null);break;case h.i.Xs:c=new h.i.jf(null); break;default:throw Error("Unknown event type.");}c.qa(a);c.ac=(void 0).id;return c};h.i.Zu=function(a){if((a.type==h.i.ck||a.type==h.i.xm)&&a.ac){var c=h.ob.Gq(a.ac);if(a=v(c,a.pc)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.Ze(!0);else if((a.M||a.U)&&!c.gc()){do a.Ze(!1),a=u(a);while(a)}}}}; h.i.Abstract=function(){this.ac=void 0;this.group=h.i.Fb();this.ic=h.i.ic};h.i.Abstract.prototype.Ma=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};h.i.Abstract.prototype.qa=function(a){this.group=a.group};h.i.Abstract.prototype.uj=function(){return!1};h.i.Abstract.prototype.run=function(){};function w(a){if(a.ac)var c=h.ob.Gq(a.ac);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};h.g.object={};h.g.object.S=function(a,c){a.w=c.prototype;a.prototype=Object.create(c.prototype);a.prototype.constructor=a};h.g.object.Ph=function(a,c){for(var d in c)a[d]=c[d]};h.g.object.values=function(a){return Object.values?Object.values(a):Object.keys(a).map(function(c){return a[c]})};h.i.dd=function(a,c,d,e){h.i.dd.w.constructor.call(this);this.pc=a?a.id:null;this.ac=a?a.C.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.ic=!1};h.g.object.S(h.i.dd,h.i.Abstract);h.i.dd.prototype.type=h.i.Vm;h.i.dd.prototype.Ma=function(){var a=h.i.dd.w.Ma.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.pc&&(a.blockId=this.pc);return a}; h.i.dd.prototype.qa=function(a){h.i.dd.w.qa.call(this,a);this.element=a.element;this.newValue=a.newValue;this.pc=a.blockId};h.g.m={};h.g.m.nc="http://www.w3.org/2000/svg";h.g.m.Em="http://www.w3.org/1999/xhtml";h.g.m.Ge="http://www.w3.org/1999/xlink";h.g.m.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};h.g.m.kh=null;h.g.m.Qp=0;h.g.m.L=function(a,c,d){a=document.createElementNS(h.g.m.nc,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}; h.g.m.Bb=function(a,c){var d=a.getAttribute("class")||"";if(-1!=(" "+d+" ").indexOf(" "+c+" "))return!1;d&&(d+=" ");a.setAttribute("class",d+c);return!0};h.g.m.Lc=function(a,c){var d=a.getAttribute("class");if(-1==(" "+d+" ").indexOf(" "+c+" "))return!1;d=d.split(/\s+/);for(var e=0;ed||d>a.Qb.length)throw Error(h.Ac.Error.gy);a.Tp[c.Pa()]=c;if(c.getParent()==a){var e=a.Qb.indexOf(c);-1>>/g,a),a=document.createElement("style"),d=document.createTextNode(d),a.appendChild(d),document.head.insertBefore(a,document.head.firstChild))}};h.Zc.ks=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")}; h.Zc.Io=[".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;","}"];h.g.Lb={};h.g.Lb.li=function(a){return a*Math.PI/180};h.g.Lb.wx=function(a){return 180*a/Math.PI};h.g.Lb.wk=function(a,c,d){if(df.top?h.D.Av(d,e,f,g):c+g.heightdocument.documentElement.clientTop?h.D.Av(d,e,f,g):h.D.MB(a,f,g)}; h.D.Bv=function(a,c,d,e){a=h.D.Jq(a,d.left,d.right,e.width);return{Fn:a.bj,Gn:c,tn:a.bj,un:c+h.D.Gt,qk:a.qk,qu:-(h.D.pm/2+h.D.Us),Gp:!0,Hp:!0}};h.D.Av=function(a,c,d,e){a=h.D.Jq(a,d.left,d.right,e.width);return{Fn:a.bj,Gn:c-e.height,tn:a.bj,un:c-e.height-h.D.Gt,qk:a.qk,qu:e.height-2*h.D.Us-h.D.pm/2,Gp:!1,Hp:!0}};h.D.MB=function(a,c,d){a=h.D.Jq(a,c.left,c.right,d.width);return{Fn:a.bj,Gn:0,tn:a.bj,un:0,Hp:!1}}; h.D.Jq=function(a,c,d,e){var f=a;a=h.g.Lb.wk(c,a-e/2,d-e);f-=h.D.pm/2;c=h.g.Lb.wk(h.D.Os,f-a,e-h.D.Os-h.D.pm);return{qk:c,bj:a}};h.D.isVisible=function(){return!!h.D.wc};h.D.kj=function(a,c){h.D.wc===a&&(c?h.D.lj():h.D.ta())};h.D.ta=function(){var a=h.D.td;a.style.transform="translate(0, 0)";a.style.opacity=0;h.D.Fp=setTimeout(function(){h.D.lj()},1E3*h.D.Eo);h.D.Wh&&(h.D.Wh(),h.D.Wh=null)}; h.D.lj=function(){if(h.D.isVisible()){h.D.Fp&&clearTimeout(h.D.Fp);var a=h.D.td;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=h.D.at;a.style.borderColor=h.D.$s;h.D.Wh&&(h.D.Wh(),h.D.Wh=null);h.D.DA();h.D.wc=null}}; h.D.Dl=function(a,c,d,e){a=Math.floor(a);c=Math.floor(c);d=Math.floor(d);e=Math.floor(e);var f=h.D.td;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)"}; h.D.cJ=function(){if(h.D.wc){var a=h.D.wc.A,c=a.C.scale,d=h.D.bo?h.D.wc.Gb.width:a.width,e=h.D.bo?h.D.wc.Gb.height:a.height;d*=c;e*=c;a=h.D.bo?h.D.wc.le.getBoundingClientRect():a.aa().getBoundingClientRect();d=a.left+d/2;e=h.D.Cv(d,a.top+e,d,a.top);h.D.Dl(e.Fn,e.Gn,e.tn,e.un)}else h.D.ta()}; h.Yg=function(a,c){this.jj=a;this.ss=c.spacing;this.kw=c.length;this.qC=(this.mr=a.firstChild)&&this.mr.nextSibling;this.BD=c.snap};h.Yg.prototype.Lg=1;h.Yg.prototype.J=function(){this.jj=null};h.Yg.prototype.update=function(a){this.Lg=a;var c=this.ss*a||100;this.jj.setAttribute("width",c);this.jj.setAttribute("height",c);c=Math.floor(this.ss/2)+.5;var d=c-this.kw/2,e=c+this.kw/2;c*=a;d*=a;e*=a;fa(this.mr,a,d,e,c,c);fa(this.qC,a,c,c,d,e)}; function fa(a,c,d,e,f,g){a&&(a.setAttribute("stroke-width",c),a.setAttribute("x1",d),a.setAttribute("y1",f),a.setAttribute("x2",e),a.setAttribute("y2",g))}h.Yg.prototype.moveTo=function(a,c){this.jj.setAttribute("x",a);this.jj.setAttribute("y",c);(h.g.userAgent.Uf||h.g.userAgent.Bm)&&this.update(this.Lg)}; h.Yg.Ja=function(a,c,d){a=h.g.m.L("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},d);0");c.Gd(e)}h.i.Ha(new h.i.Sf(c,"mutation",null,d, a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.pc)};h.i.Pd=function(a){a&&(h.i.Pd.w.constructor.call(this,a),this.xml=a.C.ea?h.N.Mp(a):h.N.gg(a),this.Eh=h.i.wv(a))};h.g.object.S(h.i.Pd,h.i.ye);h.i.tm=h.i.Pd;h.i.Pd.prototype.type=h.i.xm;h.i.Pd.prototype.Ma=function(){var a=h.i.Pd.w.Ma.call(this);a.xml=h.N.Fc(this.xml);a.ids=this.Eh;return a}; h.i.Pd.prototype.qa=function(a){h.i.Pd.w.qa.call(this,a);this.xml=h.N.Qg(a.xml);this.Eh=a.ids};h.i.Pd.prototype.run=function(a){var c=w(this);if(a)a=h.g.xml.createElement("xml"),a.appendChild(this.xml),h.N.wh(a,c);else{a=0;for(var d;d=this.Eh[a];a++){var e=v(c,d);e?e.J(!1):d==this.pc&&console.warn("Can't uncreate non-existent block: "+d)}}}; h.i.ze=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");h.i.ze.w.constructor.call(this,a);this.Ir=a.C.ea?h.N.Mp(a):h.N.gg(a);this.Eh=h.i.wv(a)}};h.g.object.S(h.i.ze,h.i.ye);h.i.by=h.i.ze;h.i.ze.prototype.type=h.i.Wj;h.i.ze.prototype.Ma=function(){var a=h.i.ze.w.Ma.call(this);a.ids=this.Eh;return a};h.i.ze.prototype.qa=function(a){h.i.ze.w.qa.call(this,a);this.Eh=a.ids}; h.i.ze.prototype.run=function(a){var c=w(this);if(a){a=0;for(var d;d=this.Eh[a];a++){var e=v(c,d);e?e.J(!1):d==this.pc&&console.warn("Can't delete non-existent block: "+d)}}else a=h.g.xml.createElement("xml"),a.appendChild(this.Ir),h.N.wh(a,c)};h.i.ah=function(a){a&&(h.i.ah.w.constructor.call(this,a),a=ia(this),this.Bw=a.Jw,this.Aw=a.Zv,this.Fr=a.Ou)};h.g.object.S(h.i.ah,h.i.ye);h.i.Tj=h.i.ah;b=h.i.ah.prototype;b.type=h.i.ck; b.Ma=function(){var a=h.i.ah.w.Ma.call(this);this.Sh&&(a.newParentId=this.Sh);this.Rh&&(a.newInputName=this.Rh);this.Dg&&(a.newCoordinate=Math.round(this.Dg.x)+","+Math.round(this.Dg.y));return a};b.qa=function(a){h.i.ah.w.qa.call(this,a);this.Sh=a.newParentId;this.Rh=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.Dg=new h.g.I(Number(a[0]),Number(a[1])))};b.Yh=function(){var a=ia(this);this.Sh=a.Jw;this.Rh=a.Zv;this.Dg=a.Ou}; function ia(a){var c=v(w(a),a.pc);a={};var d=c.getParent();if(d){a.Jw=d.id;a:{for(var e=0,f;f=d.P[e];e++)if(f.connection&&z(f.connection)==c){c=f;break a}c=null}c&&(a.Zv=c.name)}else a.Ou=c.Ia();return a}b.uj=function(){return this.Bw==this.Sh&&this.Aw==this.Rh&&h.g.I.Ne(this.Fr,this.Dg)}; b.run=function(a){var c=w(this),d=v(c,this.pc);if(d){var e=a?this.Sh:this.Bw,f=a?this.Rh:this.Aw;a=a?this.Dg:this.Fr;var g=null;if(e&&(g=v(c,e),!g)){console.warn("Can't connect to non-existent block: "+e);return}d.getParent()&&A(d);if(a)f=d.Ia(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.M||d.U;if(f){if(c=B(g,f))var k=c.connection}else d.type==h.Xd&&(k=g.V);k?d.connect(k):console.warn("Can't connect to non-existent input: "+f)}}else console.warn("Can't move non-existent block: "+this.pc)};h.i.Yj=function(a){this.ac=a.id;this.group=h.i.Fb();this.ic=!1};h.g.object.S(h.i.Yj,h.i.Abstract);h.i.Yj.prototype.type=h.i.Fy;h.i.Yj.prototype.Ma=function(){var a={type:this.type};this.group&&(a.group=this.group);this.ac&&(a.workspaceId=this.ac);return a};h.i.Yj.prototype.qa=function(a){this.ac=a.workspaceId;this.group=a.group};h.i.tf=function(a){h.i.tf.w.constructor.call(this);this.Rg=a.Pa();this.ac=a.C.id};h.g.object.S(h.i.tf,h.i.Abstract);h.i.tf.prototype.Ma=function(){var a=h.i.tf.w.Ma.call(this);a.varId=this.Rg;return a};h.i.tf.prototype.qa=function(a){h.i.tf.w.Ma.call(this);this.Rg=a.varId};h.i.Ad=function(a){a&&(h.i.Ad.w.constructor.call(this,a),this.ri=a.type,this.pi=a.name)};h.g.object.S(h.i.Ad,h.i.tf);h.i.Ad.prototype.type=h.i.cu; h.i.Ad.prototype.Ma=function(){var a=h.i.Ad.w.Ma.call(this);a.varType=this.ri;a.varName=this.pi;return a};h.i.Ad.prototype.qa=function(a){h.i.Ad.w.qa.call(this,a);this.ri=a.varType;this.pi=a.varName};h.i.Ad.prototype.run=function(a){var c=w(this);a?c.ie(this.pi,this.ri,this.Rg):c.sh(this.Rg)};h.i.Zd=function(a){a&&(h.i.Zd.w.constructor.call(this,a),this.ri=a.type,this.pi=a.name)};h.g.object.S(h.i.Zd,h.i.tf);h.i.Zd.prototype.type=h.i.du; h.i.Zd.prototype.Ma=function(){var a=h.i.Zd.w.Ma.call(this);a.varType=this.ri;a.varName=this.pi;return a};h.i.Zd.prototype.qa=function(a){h.i.Zd.w.qa.call(this,a);this.ri=a.varType;this.pi=a.varName};h.i.Zd.prototype.run=function(a){var c=w(this);a?c.sh(this.Rg):c.ie(this.pi,this.ri,this.Rg)};h.i.Fe=function(a,c){a&&(h.i.Fe.w.constructor.call(this,a),this.Hr=a.name,this.Cr=c)};h.g.object.S(h.i.Fe,h.i.tf);h.i.Fe.prototype.type=h.i.fu; h.i.Fe.prototype.Ma=function(){var a=h.i.Fe.w.Ma.call(this);a.oldName=this.Hr;a.newName=this.Cr;return a};h.i.Fe.prototype.qa=function(a){h.i.Fe.w.qa.call(this,a);this.Hr=a.oldName;this.Cr=a.newName};h.i.Fe.prototype.run=function(a){var c=w(this);a?c.$h(this.Rg,this.Cr):c.$h(this.Rg,this.Hr)};h.N={};h.N.Es=function(a){var c=C,d=h.g.xml.createElement("xml"),e=h.N.WD(h.Z.pu(c));e.hasChildNodes()&&d.appendChild(e);var f=ja(c,!0);e=0;for(var g;g=f[e];e++)d.appendChild(g.xs(a));c=D(c,!0);for(e=0;f=c[e];e++)d.appendChild(h.N.Mp(f,a));return d};h.N.WD=function(a){for(var c=h.g.xml.createElement("variables"),d=0,e;e=a[d];d++){var f=h.g.xml.createElement("variable");f.appendChild(h.g.xml.createTextNode(e.name));e.type&&f.setAttribute("type",e.type);f.id=e.Pa();c.appendChild(f)}return c}; h.N.Mp=function(a,c){var d;a.C.G&&(d=a.C.Df());c=h.N.gg(a,c);var e=a.Ia();c.setAttribute("x",Math.round(a.C.G?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c};h.N.pB=function(a){var c=!1;a.name&&(a.Mi?c=!0:a.kf&&(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=h.g.xml.createElement("field"),c.setAttribute("name",a.name),a.xx(c)):null}; h.N.hA=function(a,c){for(var d=0,e;e=a.P[d];d++)for(var f=0,g;g=e.La[f];f++)(g=h.N.pB(g))&&c.appendChild(g)}; h.N.gg=function(a,c){var d=h.g.xml.createElement(a.Qa?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.hc){var e=a.hc();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}h.N.hA(a,d);if(e=a.fe.text){var f=a.fe.size,g=a.fe.Lw,k=h.g.xml.createElement("comment");k.appendChild(h.g.xml.createTextNode(e));k.setAttribute("pinned",g);k.setAttribute("h",f.height);k.setAttribute("w",f.width);d.appendChild(k)}a.data&&(e=h.g.xml.createElement("data"),e.appendChild(h.g.xml.createTextNode(a.data)), d.appendChild(e));for(f=0;g=a.P[f];f++){var l;k=!0;if(g.type!=h.Qd){var m=z(g.connection);g.type==h.Sa?l=h.g.xml.createElement("value"):g.type==h.Ga&&(l=h.g.xml.createElement("statement"));e=g.connection.af;!e||m&&m.Qa||l.appendChild(h.N.Bu(e,c));m&&(l.appendChild(h.N.gg(m,c)),k=!1);l.setAttribute("name",g.name);k||d.appendChild(l)}}void 0!=a.If&&a.If!=a.hC&&d.setAttribute("inline",a.If);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.md()||a.Qa||d.setAttribute("deletable", !1);a.Rc()||a.Qa||d.setAttribute("movable",!1);a.Jc()||d.setAttribute("editable",!1);if(f=u(a))l=h.g.xml.createElement("next"),l.appendChild(h.N.gg(f,c)),d.appendChild(l);e=a.V&&a.V.af;!e||f&&f.Qa||l.appendChild(h.N.Bu(e,c));return d}; h.N.Bu=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==h.g.m.Node.TEXT_NODE&&""==e.data.trim()&&d.firstChild!=e&&h.g.m.removeNode(e);d&&(e=d,d=d.nextSibling,e.nodeType==h.g.m.Node.TEXT_NODE&&""==e.data.trim()&&h.g.m.removeNode(e))}return a}; h.N.Fc=function(a){a=h.g.xml.Fc(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1 $2")}while(a!=d);return a};h.N.zI=function(a){a=h.N.Fc(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/,"")}; h.N.Qg=function(a){var c=h.g.xml.KD(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};h.N.vI=function(a,c){c.Yb(!1);c.clear();a=h.N.wh(a,c);c.Yb(!0);return a}; h.N.wh=function(a,c){if(a instanceof h.ob){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var e;c.G&&(e=c.Df());d=[];h.g.m.Vl();var f=a.childNodes.length,g=h.i.Fb();g||h.i.X(!0);c.Yb&&c.Yb(!1);var k=!0;try{for(var l=0;l document.");}else a=null;return a};h.Touch={};h.Touch.$t="ontouchstart"in h.g.global||!!(h.g.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!h.g.global.navigator||!h.g.global.navigator.maxTouchPoints&&!h.g.global.navigator.msMaxTouchPoints);h.Touch.cm=null;h.Touch.Ee={}; h.g.global.PointerEvent?h.Touch.Ee={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:h.Touch.$t&&(h.Touch.Ee={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});h.Rn=0; h.uC=function(a,c){h.Cg();a.changedTouches&&1!=a.changedTouches.length||(h.Rn=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);c&&ra(c,a)},h.iz))};h.Cg=function(){h.Rn&&(clearTimeout(h.Rn),h.Rn=0)};h.Touch.$m=function(){h.Touch.cm=null};h.Touch.rs=function(a){return!h.Touch.lC(a)||h.Touch.BA(a)}; h.Touch.An=function(a){return void 0!=a.pointerId?a.pointerId:a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?a.changedTouches[0].identifier:"mouse"};h.Touch.BA=function(a){var c=h.Touch.An(a);return void 0!==h.Touch.cm&&null!==h.Touch.cm?h.Touch.cm==c:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(h.Touch.cm=c,!0):!1}; h.Touch.vD=function(a){if(h.g.Oa.startsWith(a.type,"touch")){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY}};h.Touch.lC=function(a){return h.g.Oa.startsWith(a.type,"touch")||h.g.Oa.startsWith(a.type,"mouse")||h.g.Oa.startsWith(a.type,"pointer")};h.Touch.Qn=function(a){return h.g.Oa.startsWith(a.type,"touch")||h.g.Oa.startsWith(a.type,"pointer")}; h.Touch.CD=function(a){var c=[];if(a.changedTouches)for(var d=0;d=d+this.sg&&(e+=f);sa(this,Aa(this,e));ya(this);a.stopPropagation();a.preventDefault()}}; b.VC=function(a){Ca(this.s);ta();h.g.wj(a)?a.stopPropagation():(this.ED=this.Xk,Ea(this.s),this.sx=this.Dh?a.clientX:a.clientY,h.Ca.Gg=h.pa(document,"mouseup",this,this.$C),h.Ca.Fg=h.pa(document,"mousemove",this,this.WC),a.stopPropagation(),a.preventDefault())};b.WC=function(a){sa(this,Aa(this,this.ED+((this.Dh?a.clientX:a.clientY)-this.sx)));ya(this)};b.$C=function(){Fa(this.s);h.Touch.$m();ta()};function ta(){h.vc(!0);h.Ca.Gg&&(h.Za(h.Ca.Gg),h.Ca.Gg=null);h.Ca.Fg&&(h.Za(h.Ca.Fg),h.Ca.Fg=null)} function Aa(a,c){return c=0>=c||isNaN(c)||a.Ndh.H.zz&&h.H.ta()}else h.H.ao!=h.H.ka&&(clearTimeout(h.H.Tl),h.H.jr=a.pageX,h.H.kr=a.pageY,h.H.Tl=setTimeout(h.H.zD,h.H.Oy))};h.H.ta=function(){h.H.visible&&(h.H.visible=!1,h.H.va&&(h.H.va.style.display="none"));h.H.Tl&&clearTimeout(h.H.Tl)};h.H.block=function(){h.H.ta();h.H.Wi=!0};h.H.SD=function(){h.H.Wi=!1}; h.H.zD=function(){if(!h.H.Wi&&(h.H.ao=h.H.ka,h.H.va)){h.H.va.innerHTML="";for(var a=h.H.ka.ue;"function"==typeof a;)a=a();a=h.g.Oa.Gx(a,h.H.cz);a=a.split("\n");for(var c=0;cd+window.scrollY&&(f-=h.H.va.offsetHeight+2*h.H.Ct);a?e=Math.max(h.H.Xo-window.scrollX,e):e+h.H.va.offsetWidth>c+window.scrollX-2*h.H.Xo&&(e=c-h.H.va.offsetWidth-2*h.H.Xo);h.H.va.style.top=f+"px";h.H.va.style.left=e+"px"}};h.ju=function(a){this.Dk=a;this.Ja()};b=h.ju.prototype;b.eb=null;b.je=null;b.Dk=null;b.Ja=function(){this.eb||(this.eb=h.g.m.L("svg",{xmlns:h.g.m.nc,"xmlns:html":h.g.m.Em,"xmlns:xlink":h.g.m.Ge,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.Dk.appendChild(this.eb))};b.mi=function(a,c){a=a.toFixed(0);c=c.toFixed(0);this.eb.style.display="block";h.g.m.Ll(this.eb,"translate3d("+a+"px, "+c+"px, 0px)")};b.Lq=function(){return h.g.Id(this.eb)}; b.Zm=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var c=this.eb.childNodes[0],d=this.eb.childNodes[1];if(!(c&&d&&h.g.m.Qv(c,"blocklyBlockCanvas")&&h.g.m.Qv(d,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!=this.Tr?h.g.m.qj(c,this.Tr):a.insertBefore(c,a.firstChild);h.g.m.qj(d,c);this.eb.style.display="none";if(this.eb.childNodes.length)throw Error("Drag surface was not cleared.");h.g.m.Ll(this.eb, "");this.Tr=null};h.hb=Object.create(null);h.na=function(a,c){this.A=a;this.type=c};h.na.um=0;h.na.Mt=1;h.na.Pt=2;h.na.Ot=3;h.na.Kt=4;h.na.Lt=5;h.na.Nt=6;b=h.na.prototype;b.ga=null;b.wf=null;b.af=null;b.wb=0;b.Na=0; b.ge=function(a){var c=this,d=c.A,e=a.A;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=z(c),g=c.af;c.af=null;if(f.Qa)g=h.N.gg(f),f.J(),f=null;else if(c.type==h.Sa){if(!f.M)throw Error("Orphan block does not have an output connection.");var k=h.na.hw(e,f);k&&(f.M.connect(k),f=null)}else if(c.type==h.Ga){if(!f.U)throw Error("Orphan block does not have a previous connection.");for(k=e;k.V;){var l=u(k);if(l&&!l.Qa)k=l;else{Ga(f.U,k.V)&&(k.V.connect(f.U),f=null);break}}}if(f&&(c.disconnect(), h.i.ic)){var m=h.i.Fb();setTimeout(function(){f.C&&!f.getParent()&&(h.i.X(m),f.M?f.M.Wn(c):f.U&&f.U.Wn(c),h.i.X(!1))},h.rm)}c.af=g}var n;h.i.isEnabled()&&(n=new h.i.Tj(e));h.na.NA(c,a);e.Hj(d);n&&(n.Yh(),h.i.Ha(n))};b.J=function(){if(this.isConnected()){this.af=null;var a=z(this);a.Qa?a.J():A(a)}};function E(a){return a.type==h.Sa||a.type==h.Ga}b.isConnected=function(){return!!this.ga}; function Ha(a,c){if(!c)return h.na.Ot;if(E(a))var d=a.A,e=c.A;else e=a.A,d=c.A;return d&&d==e?h.na.Mt:c.type!=h.Ji[a.type]?h.na.Pt:d&&e&&d.C!==e.C?h.na.Lt:Ga(a,c)?d.Qa&&!e.Qa?h.na.Nt:h.na.um:h.na.Kt} function Ia(a,c){switch(Ha(a,c)){case h.na.um:break;case h.na.Mt:throw Error("Attempted to connect a block to itself.");case h.na.Lt:throw Error("Blocks not on same workspace.");case h.na.Pt:throw Error("Attempt to connect incompatible types.");case h.na.Ot:throw Error("Target connection is null.");case h.na.Kt:throw Error("Connection checks failed. "+(a+" expected "+a.wf+", found "+c.wf));case h.na.Nt:throw Error("Connecting non-shadow to shadow block.");default:throw Error("Unknown connection failure: this should never happen!"); }}b.Jn=function(a){if(a.A.xg()||Ha(this,a)!=h.na.um)return!1;switch(a.type){case h.Xd:return this.ga||-1!=h.Pk.indexOf(a)?a=!1:a.ga?(a=z(a),a=a.xg()?!(a.U&&z(a.U)):!1):a=!0,a;case h.Vd:if(a.isConnected()&&!z(a).xg()||this.isConnected())return!1;break;case h.Sa:if(a.isConnected()&&!z(a).Rc()&&!z(a).Qa)return!1;break;case h.Ga:if(a.isConnected()&&!this.A.V&&!z(a).Qa&&z(a).V)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=h.Pk.indexOf(a)?!1:!0};b.Wn=function(){}; b.connect=function(a){if(this.ga!=a){Ia(this,a);var c=h.i.Fb();c||h.i.X(!0);E(this)?this.ge(a):a.ge(this);c||h.i.X(!1)}};h.na.NA=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.ga=c;c.ga=a};h.na.AD=function(a,c){for(var d=!1,e=0;ed)){var e=Ka(c,a.aa());a.M?(e.x+=(a.G?3:-3)*d,e.y+=13*d):a.U&&(e.x+=(a.G?-23:23)*d,e.y+=3*d);a=h.g.m.L("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},x(c));h.Va.Ku(a,new Date,d)}};h.Va.Ku=function(a,c,d){var e=(new Date-c)/150;1a.C.scale)){var c=G(a).height;c=Math.atan(10/c)/Math.PI*180;a.G||(c*=-1);h.Va.$u(a.aa(),c,new Date)}};h.Va.$u=function(a,c,d){var e=(new Date-d)/200;1a-h.sy)}if(a.Tb||a.ib)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Tb||!a.ib);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0} function Na(a){a.ib&&(h.g.m.removeNode(h.na.Yv),delete h.na.Yv);if(a.Vq){var c=a.ib;c.type!=h.Sa||c.isConnected()?Oa(a.mj,!1):a.mj.aC(c,!1);a.mj=null;a.Vq=!1}else if(a.Nh)if(a.Nh){c=a.Nh;var d=c.A,e=d.V,f=d.U,g=d.M;g=c.type==h.Sa&&!(g&&g.ga);!(c!=e||f&&f.ga)||g?A(z(c),!1):c.type==h.Ga&&c!=e?(e=c.ga,A(e.A,!1),f=f?f.ga:null,A(d,!0),f&&f.connect(e)):A(d,!0);if(c.ga)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.Nh=null;d.aa().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")} h.Hm.prototype.gj=function(){var a=[];this.fj&&a.push(this.fj);this.Lh&&a.push(this.Lh);return a};h.Ug=function(a,c){this.jb=a;this.s=c;this.Me=new h.Hm(this.jb);this.rh=null;this.ff=!1;this.df=this.jb.Ia();this.on=h.Ug.fC(a)};h.Ug.prototype.J=function(){this.Mb=this.s=this.jb=null;this.on.length=0;this.Me&&(this.Me.J(),this.Me=null)};h.Ug.fC=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=Pa(e);for(var f=0;fc)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.oo.splice(c,1);this.$b.unsubscribe(this.Zb);this.options.Vb||(this.$b.J(),this.$b=null)}};h.ob.Rt=3;b=h.ob.prototype; b.bf=function(a,c){a=a.Ia();c=c.Ia();return a.y+h.ob.prototype.bf.offset*a.x-(c.y+h.ob.prototype.bf.offset*c.x)};function bb(a,c){if(!h.g.Xm(a.Oj,c))throw Error("Block not present in workspace's list of top-most blocks.");}function D(a,c){var d=[].concat(a.Oj);c&&1g)return!1;d+=c[e]}return d>(isNaN(a.options.ul)?Infinity:a.options.ul-J(a).length)?!1:!0}function db(a){return Infinity!=a.options.ul||!!a.options.xr} b.Cs=function(a){var c=a?this.Hl:this.ni,d=a?this.ni:this.Hl,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=h.i.filter(f,a);h.i.ic=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{h.i.ic=!0}}};function K(a,c){a.Kc.push(c)}function eb(a,c){h.g.Xm(a.Kc,c)}function v(a,c){return a.Lp[c]||null}h.ob.mk=Object.create(null);h.ob.Gq=function(a){return h.ob.mk[a]||null}; h.ob.getAll=function(){var a=[],c;for(c in h.ob.mk)a.push(h.ob.mk[c]);return a};h.oa=function(a,c,d,e,f,g){this.s=a;this.mg=c;this.lx=d;d=h.oa.Vx;this.s.G&&(d=-d);this.kA=h.g.Lb.li(d);a.Pf.appendChild(this.Fk(c,!(!f||!g)));this.Cb=e;this.Zr&&fb(this);f&&g||(c=this.mg.getBBox(),f=c.width+2*h.oa.Yc,g=c.height+2*h.oa.Yc);gb(this,f,g);fb(this);hb(this);this.Zr=!0;a.options.readOnly||(h.pa(this.rk,"mousedown",this,this.rA),this.Ye&&h.pa(this.Ye,"mousedown",this,this.oD))};h.oa.Yc=6;h.oa.Wx=5;h.oa.Vx=20;h.oa.Ms=4;h.oa.Tx=8;h.oa.Gg=null;h.oa.Fg=null;h.oa.prototype.Yw=null; h.oa.Bs=function(){h.oa.Gg&&(h.Za(h.oa.Gg),h.oa.Gg=null);h.oa.Fg&&(h.Za(h.oa.Fg),h.oa.Fg=null)};h.oa.sA=function(){h.Touch.$m();h.oa.Bs()};b=h.oa.prototype;b.Zr=!1;b.Cb=null;b.Lf=0;b.Kg=0;b.bb=0;b.fc=0;b.Ip=!0; b.Fk=function(a,c){this.gd=h.g.m.L("g",{},null);var d={filter:"url(#"+this.s.options.gv+")"};h.g.userAgent.$y&&(d={});d=h.g.m.L("g",d,this.gd);this.Pp=h.g.m.L("path",{},d);this.rk=h.g.m.L("rect",{"class":"blocklyDraggable",x:0,y:0,rx:h.oa.Yc,ry:h.oa.Yc},d);c?(this.Ye=h.g.m.L("g",{"class":this.s.G?"blocklyResizeSW":"blocklyResizeSE"},this.gd),c=2*h.oa.Yc,h.g.m.L("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.Ye),h.g.m.L("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/ 3},this.Ye),h.g.m.L("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.Ye)):this.Ye=null;this.gd.appendChild(a);return this.gd};b.aa=function(){return this.gd};function ib(a,c){a.gd.dataset&&(a.gd.dataset.blockId=c)}b.rA=function(a){var c=this.s.rg(a);if(c){if(c.Ch)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.pd||(c.pd=this);c.re=a}};b.Rl=function(){};b.md=function(){return!1}; b.oD=function(a){var c=this.gd.parentNode;c.lastChild!==this.gd&&c.appendChild(this.gd);h.oa.Bs();h.g.wj(a)||(this.s.ts(a,new h.g.I(this.s.G?-this.bb:this.bb,this.fc)),h.oa.Gg=h.pa(document,"mouseup",this,h.oa.sA),h.oa.Fg=h.pa(document,"mousemove",this,this.pD),h.vc());a.stopPropagation()};b.pD=function(a){this.Ip=!1;var c=this.s;a=h.g.zl(a,x(c),Da(c));a.x/=c.scale;a.y/=c.scale;c=h.g.I.sum(c.cv,a);gb(this,this.s.G?-c.x:c.x,c.y);this.s.G&&fb(this)}; function jb(a,c,d){var e=a.s.G?a.Cb.x-c.x-a.bb:c.x+a.Cb.x;c=c.y+a.Cb.y;return Math.max(0,Math.min(1,(Math.min(e+a.bb,d.zb+d.lb)-Math.max(e,d.zb))*(Math.min(c+a.fc,d.Ib+d.vb)-Math.max(c,d.Ib))/(a.bb*a.fc)))}function fb(a){var c=a.Cb.x;c=a.s.G?c-(a.Lf+a.bb):c+a.Lf;a.moveTo(c,a.Kg+a.Cb.y)}b.moveTo=function(a,c){this.gd.setAttribute("transform","translate("+a+","+c+")")}; function gb(a,c,d){var e=2*h.oa.Yc;c=Math.max(c,e+45);d=Math.max(d,e+20);a.bb=c;a.fc=d;a.rk.setAttribute("width",c);a.rk.setAttribute("height",d);a.Ye&&(a.s.G?a.Ye.setAttribute("transform","translate("+2*h.oa.Yc+","+(d-e)+") scale(-1 1)"):a.Ye.setAttribute("transform","translate("+(c-e)+","+(d-e)+")"));if(a.Ip){c=a.s.uc();c.zb/=a.s.scale;c.lb/=a.s.scale;c.Ib/=a.s.scale;c.vb/=a.s.scale;d=-a.bb/4;if(!(a.bb>c.lb)){if(a.s.G){e=a.Cb.x-d;var f=e-a.bb;var g=c.zb+c.lb,k=c.zb+h.Ca.jc/a.s.scale}else f=d+a.Cb.x, e=f+a.bb,k=c.zb,g=c.zb+c.lb-h.Ca.jc/a.s.scale;a.s.G?fg&&(d=-(g-a.Cb.x)):fg&&(d=g-a.Cb.x-a.bb)}f=d;d=-a.fc/4;if(!(a.fc>c.vb)){e=a.Cb.y+d;g=e+a.fc;k=c.Ib;var l=c.Ib+c.vb-h.Ca.jc/a.s.scale,m=a.Cb.y;el&&(d=l-m-a.fc)}k=d;g=a.lx.getBBox();d={x:f,y:-a.fc-h.ra.$o};e={x:-a.bb-30,y:k};k={x:g.width,y:k};l={x:f,y:g.height};f=g.widthg&&(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),q=new h.g.Yd(a.bb,a.fc);m=(q.width+q.height)/h.oa.Wx;m=Math.min(m,q.width,q.height)/4;q=1-h.oa.Tx/k;f=d+q*f;g=e+q*g;q=d+m*r;var t=e+m*n;d-=m*r;e-=m*n;n=l+a.kA;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/h.oa.Ms;k=Math.cos(n)*k/h.oa.Ms;c.push("M"+ q+","+t);c.push("C"+(q+k)+","+(t+l)+" "+f+","+g+" "+f+","+g);c.push("C"+f+","+g+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.Pp.setAttribute("d",c.join(" "))}b.od=function(a){this.rk.setAttribute("fill",a);this.Pp.setAttribute("fill",a)};b.J=function(){h.oa.Bs();h.g.m.removeNode(this.gd);this.lx=this.mg=this.s=this.Ye=this.rk=this.Pp=this.gd=null};b.Ar=function(a,c){a?a.mi(c.x,c.y):this.moveTo(c.x,c.y);this.Lf=this.s.G?this.Cb.x-c.x-this.bb:c.x-this.Cb.x;this.Kg=c.y-this.Cb.y;hb(this)}; b.Ia=function(){return new h.g.I(this.Cb.x+this.Lf,this.Cb.y+this.Kg)};h.i.gf=function(a){this.Ie=a.id;this.ac=a.C.id;this.group=h.i.Fb();this.ic=h.i.ic};h.g.object.S(h.i.gf,h.i.Abstract);h.i.gf.prototype.Ma=function(){var a=h.i.gf.w.Ma.call(this);this.Ie&&(a.commentId=this.Ie);return a};h.i.gf.prototype.qa=function(a){h.i.gf.w.qa.call(this,a);this.Ie=a.commentId};h.i.Ai=function(a,c,d){a&&(h.i.Ai.w.constructor.call(this,a),this.zw=c,this.Vn=d)};h.g.object.S(h.i.Ai,h.i.gf);b=h.i.Ai.prototype;b.type=h.i.Ws; b.Ma=function(){var a=h.i.Ai.w.Ma.call(this);a.newContents=this.Vn;return a};b.qa=function(a){h.i.Ai.w.qa.call(this,a);this.Vn=a.newValue};b.uj=function(){return this.zw==this.Vn};b.run=function(a){var c;(c=w(this).fn[this.Ie]||null)?c.jJ(a?this.Vn:this.zw):console.warn("Can't change non-existent comment: "+this.Ie)};h.i.hf=function(a){a&&(h.i.hf.w.constructor.call(this,a),this.xml=a.xs())};h.g.object.S(h.i.hf,h.i.gf);h.i.hf.prototype.type=h.i.vm; h.i.hf.prototype.Ma=function(){var a=h.i.hf.w.Ma.call(this);a.xml=h.N.Fc(this.xml);return a};h.i.hf.prototype.qa=function(a){h.i.hf.w.qa.call(this,a);this.xml=h.N.Qg(a.xml)};h.i.hf.prototype.run=function(a){h.i.Zs(this,a)};h.i.Zs=function(a,c){var d=w(a);c?(c=h.g.xml.createElement("xml"),c.appendChild(a.xml),h.N.wh(c,d)):(d=d.fn[a.Ie]||null)?d.J(!1,!1):console.warn("Can't uncreate non-existent comment: "+a.Ie)};h.i.jf=function(a){a&&(h.i.jf.w.constructor.call(this,a),this.xml=a.xs())}; h.g.object.S(h.i.jf,h.i.gf);h.i.jf.prototype.type=h.i.Xs;h.i.jf.prototype.Ma=function(){return h.i.jf.w.Ma.call(this)};h.i.jf.prototype.qa=function(a){h.i.jf.w.qa.call(this,a)};h.i.jf.prototype.run=function(a){h.i.Zs(this,!a)};h.i.Vg=function(a){a&&(h.i.Vg.w.constructor.call(this,a),this.Wp=a,this.Gr=a.Kv(),this.Qh=null)};h.g.object.S(h.i.Vg,h.i.gf);b=h.i.Vg.prototype; b.Yh=function(){if(!this.Wp)throw Error("Tried to record the new position of a comment on the same event twice.");this.Qh=this.Wp.Kv();this.Wp=null};b.type=h.i.wm;b.Ma=function(){var a=h.i.Vg.w.Ma.call(this);this.Qh&&(a.newCoordinate=Math.round(this.Qh.x)+","+Math.round(this.Qh.y));return a};b.qa=function(a){h.i.Vg.w.qa.call(this,a);a.newCoordinate&&(a=a.newCoordinate.split(","),this.Qh=new h.g.I(Number(a[0]),Number(a[1])))};b.uj=function(){return h.g.I.Ne(this.Gr,this.Qh)}; b.run=function(a){var c;if(c=w(this).fn[this.Ie]||null){a=a?this.Qh:this.Gr;var d=c.Kv();c.moveBy(a.x-d.x,a.y-d.y)}else console.warn("Can't move non-existent comment: "+this.Ie)};h.Uj=function(a,c){this.Kb=a;this.s=c;this.rh=null;this.xo=!1;this.df=this.Kb.Ia();this.xh=h.g.Gh()&&c.fd?c.fd:null};h.Uj.prototype.J=function(){this.xh=this.s=this.Kb=null};function kb(a,c,d){d=a.Cj(d);d=h.g.I.sum(a.df,d);a.Kb.Ar(a.xh,d);a.Kb.md()&&(a.rh=Sa(a.s,c),a.xo=a.rh!=h.bt,c=a.s.kc,a.xo?(Ta(a.Kb,!0),a.rh==h.Ko&&c&&Ua(c,!0)):(Ta(a.Kb,!1),c&&Ua(c,!1)))} function lb(a,c,d){kb(a,c,d);c=a.Cj(d);c=h.g.I.sum(a.df,c);a.Kb.moveTo(c.x,c.y);c=a.s.kc;a.xo?(c&&setTimeout(c.close.bind(c),100),a.Rk(),a.Kb.J(!1,!0)):c&&c.close();a.xo||(a.xh&&a.xh.Zm(a.s.Pf),a.Kb.ci&&a.Kb.ci(!1),a.Rk());a.s.Yb(!0);a.s.wa&&a.s.wa.mD(a.Kb.md()?"blocklyToolboxDelete":"blocklyToolboxGrab");h.i.X(!1)}h.Uj.prototype.Rk=function(){if(this.Kb.cw){var a=new h.i.Vg(this.Kb);a.Gr=this.df;a.Yh();h.i.Ha(a)}}; h.Uj.prototype.Cj=function(a){a=new h.g.I(a.x/this.s.scale,a.y/this.s.scale);this.s.Kh&&a.scale(1/this.s.options.Vb.scale);return a};h.Uj.prototype.Br=function(){this.Kb.moveTo(0,0);this.xh.mi(this.df.x,this.df.y);ba(this.xh,this.Kb.aa())};h.nk=function(a){this.s=a;this.tx=new h.g.I(a.scrollX,a.scrollY)};h.nk.prototype.J=function(){this.s=null};h.nk.prototype.ts=function(){h.selected&&mb(h.selected);Ea(this.s)};h.nk.prototype.og=function(a){a=h.g.I.sum(this.tx,a);this.s.scroll(a.x,a.y)};h.Dm=function(a){h.Dm.w.constructor.call(this,a.ij());this.Xb=a.Xb;this.nj=a.nj};h.g.object.S(h.Dm,h.nk);h.Dm.prototype.og=function(a){a=h.g.I.sum(this.tx,a);this.nj?this.Xb.set(-a.x):this.Xb.set(-a.y)};h.Di=function(a,c){this.Mb=this.Nb=this.di=this.ei=this.pd=this.Ec=this.uw=null;this.Zp=c;this.cl=this.Ih=this.dl=this.Ah=!1;this.re=a;this.O=this.Tg=this.ee=this.uf=this.Yn=this.Xn=null;this.Ln=this.Ch=this.xu=!1;this.Uv=!h.yy};b=h.Di.prototype;b.J=function(){h.Touch.$m();h.H.SD();this.Zp.Rb=null;this.Xn&&h.Za(this.Xn);this.Yn&&h.Za(this.Yn);this.O=this.Mb=this.Nb=this.di=this.ei=null;this.ee&&(this.ee.J(),this.ee=null);this.Tg&&(this.Tg.J(),this.Tg=null);this.uf&&(this.uf.J(),this.uf=null)}; function nb(a,c){a.Ec=h.g.I.Ok(new h.g.I(c.clientX,c.clientY),a.uw);if(a.Ah)var d=!1;else a.Ah=h.g.I.vC(a.Ec)>(a.O?h.Gy:h.xy),d=a.Ah;if(d){if(a.xu)throw Error("updateIsDragging_ should only be called once per gesture.");a.xu=!0;if(a.pd){a.cl=!0;a.uf=new h.Uj(a.pd,a.Mb);d=a.uf;h.i.Fb()||h.i.X(!0);d.s.Yb(!1);d.Kb.Ip=!1;d.xh&&d.Br();d.Kb.ci&&d.Kb.ci(!0);var e=d.s.wa;e&&e.eA(d.Kb.md()?"blocklyToolboxDelete":"blocklyToolboxGrab");kb(a.uf,a.re,a.Ec);d=!0}else d=!1;if(!d){if(a.Nb)if(a.O?(a.O.bw(a.Nb)?((d= !ob(a.O))||(d=a.Ec,d=Math.atan2(d.y,d.x)/Math.PI*180,e=a.O.kB,d=d-e||d<-180+e||d>180-e?!0:!1),d?(a.Mb=a.O.rb,pb(a.Mb),h.i.Fb()||h.i.X(!0),a.di=null,a.Nb=qb(a.O,a.Nb),a.Nb.select(),d=!0):d=!1):d=!1,a.Ih=d):a.Nb.Rc()&&(a.Ih=!0),a.Ih){a.ee=new h.Ug(a.Nb,a.Mb);d=a.ee;e=a.Ec;var f=a.Uv;h.i.Fb()||h.i.X(!0);d.s.Kh&&Xa(d.jb);h.g.m.Vl();d.s.Yb(!1);h.Va.jq();if(d.jb.getParent()||f&&d.jb.V&&z(d.jb.V))A(d.jb,f),e=d.Cj(e),e=h.g.I.sum(d.df,e),d.jb.translate(e.x,e.y),h.Va.eB(d.jb);d.jb.ci(!0);d.jb.Br();(e= d.s.wa)&&e.eA(d.jb.md()?"blocklyToolboxDelete":"blocklyToolboxGrab");Qa(a.ee,a.re,a.Ec);d=!0}else d=!1;else d=!1;if(d=!d)if(a.O)d=ob(a.O);else if(d=a.Mb)d=a.Mb,d=d.options.Ub&&d.options.Ub.og;d&&(a.Tg=a.O?new h.Dm(a.O):new h.nk(a.Mb),a.dl=!0,a.Tg.ts())}h.Cg()}a.re=c} b.lq=function(a){h.g.On(a)?this.cancel():(this.Ch=!0,h.Va.jq(),pb(this.Mb),this.Mb.Kh&&this.Mb.resize(),Ca(this.Mb),this.re=a,h.vc(!!this.O),h.H.block(),this.Nb&&(!this.Nb.Qc&&a.shiftKey?(h.navigation.xq(),I(this.Zp.Ka,h.navigation.Pq(this.Nb))):this.Nb.select()),h.g.wj(a)?ra(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||h.uC(a,this),this.uw=new h.g.I(a.clientX,a.clientY),this.Uv=a.altKey||a.ctrlKey||a.metaKey,this.Vi(a)))}; b.Vi=function(a){this.Xn=h.pa(document,"mousemove",null,this.Wk.bind(this));this.Yn=h.pa(document,"mouseup",null,this.Bn.bind(this));a.preventDefault();a.stopPropagation()};b.Wk=function(a){nb(this,a);this.dl?this.Tg.og(this.Ec):this.Ih?Qa(this.ee,this.re,this.Ec):this.cl&&kb(this.uf,this.re,this.Ec);a.preventDefault();a.stopPropagation()}; b.Bn=function(a){nb(this,a);h.Cg();if(this.Ln)console.log("Trying to end a gesture recursively.");else{this.Ln=!0;if(this.cl)lb(this.uf,a,this.Ec);else if(this.Ih)Va(this.ee,a,this.Ec);else if(this.dl){var c=this.Tg;c.og(this.Ec);Fa(c.s)}else if(this.pd&&!this.Ah)this.pd.wD&&this.pd.wD(),this.pd.select&&this.pd.select();else if(rb(this))this.ei.Pg(),sb(this);else if(this.di&&!this.Ah&&!rb(this))this.O&&this.O.Ui?this.Nb.isEnabled()&&(h.i.Fb()||h.i.X(!0),Ya(qb(this.O,this.Nb))):h.i.Ha(new h.i.dd(this.di, "click",void 0,void 0)),sb(this),h.i.X(!1);else if(!(this.di||this.pd||this.ei||this.Ah))if(c=this.Zp,a.shiftKey){h.navigation.xq();var d=h.g.tD(c,new h.g.I(a.clientX,a.clientY));d=h.F.Ik(c,d);I(c.Ka,d)}else h.selected&&mb(h.selected);a.preventDefault();a.stopPropagation();this.J()}};b.cancel=function(){if(!this.Ln){h.Cg();if(this.cl)lb(this.uf,this.re,this.Ec);else if(this.Ih)Va(this.ee,this.re,this.Ec);else if(this.dl){var a=this.Tg;a.og(this.Ec);Fa(a.s)}this.J()}}; function ra(a,c){a.Nb?(sb(a),h.vc(a.O),a.Nb.Rl(c)):a.pd?a.pd.Rl(c):a.Mb&&!a.O&&(h.vc(),a.Mb.Rl(c));c.preventDefault();c.stopPropagation();a.J()}function tb(a,c,d){if(a.Ch)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");a.Mb||(a.Mb=d);a.re=c;a.lq(c);h.Se&&h.navigation.$e(h.navigation.Sm)}function ub(a,c,d){if(a.Ch)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");a.O||(a.O=d);tb(a,c,d.ij())} function sb(a){a.Nb&&!a.O&&Xa(a.Nb)}function vb(a,c){a.di||a.pd||(a.di=c,c.Qc&&c!=H(c)?wb(a,H(c)):wb(a,c))}function wb(a,c){c.Qa?wb(a,c.getParent()):a.Nb=c}function rb(a){if(a.ei){var c=a.ei;c=!!c.A&&c.A.Jc()&&!!c.Pg&&"function"===typeof c.Pg}else c=!1;return c&&!a.Ah&&(!a.O||!a.O.Ui)}b.gc=function(){return this.dl||this.Ih||this.cl};b.gj=function(){return this.ee?this.ee.gj():[]};h.Di.Xq=function(){for(var a=h.ob.getAll(),c=0,d;d=a[c];c++)if(d.Rb)return!0;return!1};h.Fa=function(a,c,d){this.zx=this.lm=this.Nc=null;this.Gb=new h.g.Yd(0,0);this.ec=null;d&&this.Ed(d);this.setValue(a);c&&(this.lm=c)};h.Fa.Ts=16;h.Fa.Yt=12.5;h.Fa.pk=10;h.Fa.nI=10;h.Fa.Ci=h.Fa.pk/2;b=h.Fa.prototype;b.name=void 0;b.rw=50;b.A=null;b.Jf=!0;b.Sg=!0;b.an=null;h.Fa.At="\u00a0";b=h.Fa.prototype;b.kf=!0;b.Mi=!1;b.Ed=function(a){var c=a.tooltip;"string"==typeof c&&(c=h.g.te(a.tooltip));c&&this.Od(c)};b.ps=function(a){if(this.A)throw Error("Field already bound to a block.");this.A=a}; b.ua=function(){this.le||(this.le=h.g.m.L("g",{},null),this.isVisible()||(this.le.style.display="none"),this.A.aa().appendChild(this.le),this.pj(),this.oi(),this.Od(this.zx),h.H.Vi(this.an||this.aa()),this.tw=h.pa(this.an||this.aa(),"mousedown",this,this.Eg),this.Fh())};b.pj=function(){this.Gb.height=Math.max(this.Gb.height,h.Fa.Ts);this.Gb.width=Math.max(this.Gb.width,h.Fa.pk);this.jh=h.g.m.L("rect",{rx:4,ry:4,x:0,y:0,height:this.Gb.height,width:this.Gb.width},this.le);xb(this)};b.Fh=function(){}; function xb(a){a.Uc=h.g.m.L("text",{"class":"blocklyText",y:h.Fa.Yt,x:a.jh?h.Fa.Ci:0},a.le);a.Lj=document.createTextNode("");a.Uc.appendChild(a.Lj)}b.Sk=function(a){this.setValue(a.textContent)};b.xx=function(a){a.textContent=this.getValue();return a};b.J=function(){h.D.kj(this);h.T.kj(this);this.tw&&h.Za(this.tw);h.g.m.removeNode(this.le)}; b.oi=function(){var a=this.an||this.aa();this.kf&&a&&(this.A.Jc()?(h.g.m.Bb(a,"blocklyEditableText"),h.g.m.Lc(a,"blocklyNonEditableText"),a.style.cursor=this.Ys):(h.g.m.Bb(a,"blocklyNonEditableText"),h.g.m.Lc(a,"blocklyEditableText"),a.style.cursor=""))};b.isVisible=function(){return this.Sg};b.yb=function(a){if(this.Sg!=a){this.Sg=a;var c=this.aa();c&&(c.style.display=a?"block":"none")}};function yb(a,c){a.lm=c}b.Iv=function(){return this.lm};b.aa=function(){return this.le};b.we=function(){}; b.Xe=function(){if(this.Lj){this.Lj.nodeValue=zb(this);var a=h.g.m.Mq(this.Uc);this.jh&&(a+=h.Fa.pk,this.jh.setAttribute("width",a));this.Gb.width=a}};b.Bf=function(){if(!this.isVisible())return new h.g.Yd(0,0);this.Jf?(this.Xe(),this.Jf=!1):this.Sg&&0==this.Gb.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.Xe());return this.Gb}; function zb(a){var c=a.kd();if(!c)return h.Fa.At;c.length>a.rw&&(c=c.substring(0,a.rw-2)+"\u2026");c=c.replace(/\s/g,h.Fa.At);a.A&&a.A.G&&(c+="\u200f");return c}b.kd=function(){if(this.Nq){var a=this.Nq.call(this);if(null!==a)return String(a)}return String(this.getValue())};b.lo=function(){throw Error("setText method is deprecated");};b.rl=function(){this.Jf=!0};function ab(a){a.Jf=!0;a.A&&a.A.ea&&(a.A.ya(),a.A.Ob())} b.setValue=function(a){if(null!==a){var c=this.vh(a);a=Ab(this,a,c);if(!(a instanceof Error)){if(c=this.Iv())if(c=c.call(this,a),a=Ab(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.A&&h.i.isEnabled()&&h.i.Ha(new h.i.Rf(this.A,"field",this.name||null,c,a)),this.cj(a),this.Jf&&ab(this))}}};function Ab(a,c,d){if(null===d)return a.bv(),a.Jf&&ab(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.Nc};b.vh=function(a){return null===a||void 0===a?null:a}; b.cj=function(a){this.Nc=a;this.Jf=!0};b.bv=function(){};b.Eg=function(a){if(this.A&&this.A.C&&(a=this.A.C.rg(a))){if(a.Ch)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.ei||(a.ei=this)}};b.Od=function(a){var c=this.an||this.aa();c?c.ue=a||""===a?a:this.A:this.zx=a};b.eo=function(){return!1};b.Pe=function(){for(var a=null,c=this.A,d=c.P,e=0;ec||c>a.La.length)throw Error("index "+c+" out of bounds.");if(!(d||""==d&&e))return c;"string"==typeof d&&(d=new h.vd(d));d.ps(a.A);a.A.ea&&d.ua();d.name=e;d.Rr&&(c=Bb(a,c,d.Rr));a.La.splice(c,0,d);++c;d.ws&&(c=Bb(a,c,d.ws));a.A.ea&&(a.A.ya(),a.A.Ob());return c}b.isVisible=function(){return this.Sg}; b.yb=function(a){var c=[];if(this.Sg==a)return c;for(var d=(this.Sg=a)?"block":"none",e=0,f;f=this.La[e];e++)f.yb(a);if(this.connection){if(a)c=Cb(this.connection);else if(e=this.connection,Db(e,!0),e.ga)for(e=p(z(e),!1),f=0;fa&&0<=c&&256>c&&0<=d&&256>d)?h.g.Db.fs(a,c,d):null}; h.g.Db.fs=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};h.g.Db.Vv=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; h.g.Db.bC=function(a){var c=h.Py,d=255*h.Qy,e=0,f=0,g=0;if(0==c)g=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;g=a;break;case 2:e=a;f=d;g=c;break;case 3:e=a;f=m;g=d;break;case 4:e=c;f=a;g=d;break;case 5:e=d;f=a;g=m;break;case 6:case 0:e=d,f=c,g=a}}return h.g.Db.fs(Math.floor(e),Math.floor(f),Math.floor(g))}; h.g.Db.Kp=function(a,c,d){a=h.g.Db.Vv(h.g.Db.parse(a));c=h.g.Db.Vv(h.g.Db.parse(c));return h.g.Db.fs(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])))};h.g.Db.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"};h.sm=function(a,c,d){if(h.Generator&&"undefined"!=typeof h.Generator.prototype[c])throw Error('Block prototypeName "'+c+'" conflicts with Blockly.Generator members.');this.id=d&&!v(a,d)?d:h.g.Af();a.Lp[this.id]=this;this.U=this.V=this.M=null;this.P=[];this.If=void 0;this.disabled=!1;this.ue="";this.contextMenu=!0;this.Ue=null;this.xf=[];this.fv=this.ww=this.Mk=!0;this.yf=this.Qa=!1;this.zk=null;this.fe={text:null,Lw:!1,size:new h.g.Yd(160,80)};this.Lx=new h.g.I(0,0);this.C=a;this.Qc=a.oe;this.G=a.G; this.il=!1;this.Ef=void 0;if(c){this.type=c;d=h.hb[c];if(!d||"object"!=typeof d)throw TypeError("Unknown block type: "+c);h.g.object.Ph(this,d)}a.Oj.push(this);a.Qf[this.type]||(a.Qf[this.type]=[]);a.Qf[this.type].push(this);"function"==typeof this.ua&&this.ua();this.hC=this.If;if(h.i.isEnabled()){(a=h.i.Fb())||h.i.X(!0);try{h.i.Ha(new h.i.tm(this))}finally{a||h.i.X(!1)}}if("function"==typeof this.onchange){if((a=this.onchange)&&"function"!=typeof a)throw Error("onchange must be a function.");this.Al&& eb(this.C,this.Al);if(this.onchange=a)this.Al=a.bind(this),K(this.C,this.Al)}};b=h.sm.prototype;b.data=null;b.jg="#000000";b.Eu=null;b.Fu=null; b.J=function(a){if(this.C){this.Al&&eb(this.C,this.Al);h.Se&&h.navigation.xw(this);A(this,a);h.i.isEnabled()&&h.i.Ha(new h.i.by(this));h.i.disable();try{if(this.C){bb(this.C,this);var c=this.C;c.Qf[this.type].splice(c.Qf[this.type].indexOf(this),1);c.Qf[this.type].length||delete c.Qf[this.type];delete this.C.Lp[this.id];this.C=null}h.selected==this&&(h.selected=null);for(var d=this.xf.length-1;0<=d;d--)this.xf[d].J(!1);d=0;for(var e;e=this.P[d];d++)e.J();this.P.length=0;var f=this.Hd(!0);d=0;for(var g;g= f[d];d++)g.J()}finally{h.i.enable()}}};b.Fh=function(){for(var a=0,c;c=this.P[a];a++)for(var d=0,e;e=c.La[d];d++)e.Fh&&e.Fh()}; function A(a,c){if(a.M){var d=null;a.M.isConnected()&&(d=a.M.ga,a.M.disconnect());if(d&&c){a:{c=null;for(var e=0;e=d)this.jg=h.cC(d);else if(d=h.g.Db.parse(c))this.jg=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);};function ha(a,c){for(var d=0,e;e=a.P[d];d++)for(var f=0,g;g=e.La[f];f++)if(g.name==c)return g;return null}function qa(a){for(var c=[],d=0,e;e=a.P[d];d++)for(var f=0,g;g=e.La[f];f++)g.eo()&&(g=a.C.Cf(g.getValue()))&&c.push(g);return c} function F(a,c){return(a=ha(a,c))?a.getValue():null}b.Pl=function(a,c){if(a){void 0===c&&(c=null);if(!this.U){if(this.M)throw Error("Remove output connection prior to adding previous connection.");this.U=this.ql(h.Xd)}this.U.Mc(c)}else if(this.U){if(this.U.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.U.J();this.U=null}}; b.jo=function(a,c){if(a)void 0===c&&(c=null),this.V||(this.V=this.ql(h.Ga)),this.V.Mc(c);else if(this.V){if(this.V.isConnected())throw Error("Must disconnect next statement before removing connection.");this.V.J();this.V=null}}; b.Ol=function(a,c){if(a){void 0===c&&(c=null);if(!this.M){if(this.U)throw Error("Remove previous connection prior to adding output connection.");this.M=this.ql(h.Vd)}this.M.Mc(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.Ng=function(a){this.If!=a&&(h.i.Ha(new h.i.Rf(this,"inline",null,this.If,a)),this.If=a)}; function Ja(a){if(void 0!=a.If)return a.If;for(var c=1;ca&&(d=d.substring(0,a-3)+"...");return d};function Ib(a,c){return a.ae(h.Sa,c)} function Jb(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.Ef&&(a.Ef=c.style.Ef,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{var f=a.C.Oq().qA[e];if(f)a.Eu=f.colourSecondary,a.Fu=f.colourTertiary,a.Ef=f.Ef,a.od(f.colourPrimary);else throw Error("Invalid style name: "+e);}catch(y){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.od(e)}catch(y){console.warn(d+"Illegal colour value: ",e)}}for(e=0;void 0!==c["message"+e];){f=a;for(var g=c["args"+e]||[],k=c["lastDummyAlign"+e],l=h.g.ND(c["message"+e]),m=[],n=0,r=[],q=0;q=t||t>g.length)throw Error('Block "'+f.type+'": Message index %'+t+" out of range.");if(m[t])throw Error('Block "'+f.type+'": Message index %'+t+" duplicated."); m[t]=!0;n++;r.push(g[t-1])}else(t=t.trim())&&r.push(t)}if(n!=g.length)throw Error('Block "'+f.type+'": Message does not reference all '+g.length+" arg(s).");r.length&&("string"==typeof r[r.length-1]||h.g.Oa.startsWith(r[r.length-1].type,"field_"))&&(q={type:"input_dummy"},k&&(q.align=k),r.push(q));k={LEFT:h.Co,RIGHT:h.Ks,CENTRE:h.Js};g=[];for(q=0;qc?d-1:c},a.Gf)}function Qb(a,c,d){var e=a.Qb.length;d=c.call(a,0>d?-1:d,e);for(var f=0;f<=e;){var g=a.Qb[d]||null;if(g&&g.isEnabled()){Mb(a,d);break}f++;d=c.call(a,d,e)}}b.VB=function(a){(a=Nb(this,a.target))&&a.isEnabled()&&(this.Qb[this.Gf]||null)!==a&&(Ob(this),this.Of(a))}; b.QB=function(a){var c=Nb(this,a.target),d;if(d=c)c.isEnabled()&&(c.Of(!0),Sb(c)),d=void 0;d&&a.preventDefault()};b.TB=function(){this.focus()};b.UB=function(){this.ka&&(this.blur(),Ob(this),Mb(this,-1))};b.Sq=function(a){return 0!=this.Qb.length&&Tb(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1}; function Tb(a,c){var d=a.Qb[a.Gf]||null;if(d&&"function"==typeof d.Sq&&d.Sq(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case h.g.Ta.Mo:d&&Sb(d);break;case h.g.Ta.au:Rb(a);break;case h.g.Ta.ft:Pb(a);break;default:return!1}return!0};h.Jm=function(a,c){h.Ac.call(this);this.mg=a;this.setValue(c);this.pn=!0};h.g.object.S(h.Jm,h.Ac);b=h.Jm.prototype; b.Ja=function(){var a=document.createElement("div");a.id=this.Pa();this.ka=a;a.className="goog-menuitem goog-option "+(this.pn?"":"goog-menuitem-disabled ")+(this.Sp?"goog-option-selected ":"")+(this.ew()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.vk){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(Ub(this));h.g.Da.Ij(a,this.gs||(this.vk?h.g.Da.qp.pz: h.g.Da.qp.oz));h.g.Da.$e(a,h.g.Da.State.sp,this.vk&&this.Sp||!1)};function Ub(a){a=a.mg;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.Nc=a};b.getValue=function(){return this.Nc};b.Ij=function(a){this.gs=a};function Vb(a,c){if(a.vk){a.Sp=c;var d=a.ka;d&&a.isEnabled()&&(c?(h.g.m.Bb(d,"goog-option-selected"),h.g.Da.$e(d,h.g.Da.State.sp,!0)):(h.g.m.Lc(d,"goog-option-selected"),h.g.Da.$e(d,h.g.Da.State.sp,!1)))}} b.Of=function(a){var c=this.ka;c&&this.isEnabled()&&(a?h.g.m.Bb(c,"goog-menuitem-highlight"):h.g.m.Lc(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.pn};b.Ze=function(a){this.pn=a;(a=this.ka)&&(this.pn?h.g.m.Lc(a,"goog-menuitem-disabled"):h.g.m.Bb(a,"goog-menuitem-disabled"))};function Sb(a){a.vk&&Vb(a,!a.Sp);a.nu&&a.nu.call(a.dA,a)}function Wb(a,c,d){a.nu=c;a.dA=d};h.g.uo={};h.g.uo.Bf=function(a){a=a.ka;var c=h.g.style.Bf(a);c.height=a.scrollHeight;return c};h.g.uo.fA=function(a,c,d){c.left+=d.width;c.right+=d.width;a.left+=d.width;a.right+=d.width};h.za={};h.za.jn=null;h.za.iv=null;h.za.show=function(a,c,d){h.T.show(h.za,d,null);if(c.length){var e=h.za.fD(c,d);h.za.Ve(e,a,d);setTimeout(function(){e.ka.focus()},1);h.za.jn=null}else h.za.ta()};h.za.fD=function(a,c){var d=new h.$g;ea(d,c);for(var e=0,f;f=a[e];e++){var g=new h.Jm(f.text);ea(g,c);da(d,g);g.Ze(f.enabled);f.enabled&&Wb(g,function(){h.za.ta();this.Pb()},f)}return d}; h.za.Ve=function(a,c,d){var e=h.g.PB();c={top:c.clientY+e.top,bottom:c.clientY+e.top,left:c.clientX+e.left,right:c.clientX+e.left};h.za.UA(a);var f=h.g.uo.Bf(a);d&&h.g.uo.fA(e,c,f);h.T.gD(e,c,f,d);a.ka.focus()};h.za.UA=function(a){a.ya(h.T.va);var c=a.ka;h.g.m.Bb(c,"blocklyContextMenu");h.pa(c,"contextmenu",null,h.g.LC);a.focus()};h.za.ta=function(){h.T.kj(h.za);h.za.jn=null;h.za.iv&&h.Za(h.za.iv)}; h.za.sI=function(a,c){return function(){h.i.disable();try{var d=h.N.dj(c,a.C),e=a.Ia();e.x=a.G?e.x-h.bd:e.x+h.bd;e.y+=2*h.bd;d.moveBy(e.x,e.y)}finally{h.i.enable()}h.i.isEnabled()&&!d.Qa&&h.i.Ha(new h.i.tm(d));d.select()}};h.za.nA=function(a){var c=p(a,!1).length,d=u(a);d&&(c-=p(d,!1).length);return{text:1==c?h.h.DELETE_BLOCK:h.h.DELETE_X_BLOCKS.replace("%1",String(c)),enabled:!0,Pb:function(){h.i.X(!0);a.J(!0,!0);h.i.X(!1)}}}; h.za.pA=function(a){return{enabled:!("function"==typeof a.Ff?!a.Ff():!a.Ff),text:h.h.HELP,Pb:function(){var c="function"==typeof a.Ff?a.Ff():a.Ff;c&&window.open(c)}}};h.za.oA=function(a){var c=db(a.C)?cb(a.C,h.g.Fq(a,!0)):!0;return{text:h.h.DUPLICATE_BLOCK,enabled:c,Pb:function(){h.ev(a)}}};h.za.mA=function(a){var c={enabled:!h.g.userAgent.Uf};a.zk?(c.text=h.h.REMOVE_COMMENT,c.Pb=function(){a.Gj(null)}):(c.text=h.h.ADD_COMMENT,c.Pb=function(){a.Gj("")});return c}; h.za.wI=function(a){return{text:h.h.uH,enabled:!0,Pb:function(){h.i.X(!0);a.J(!0,!0);h.i.X(!1)}}};h.za.xI=function(a){return{text:h.h.SE,enabled:!0,Pb:function(){h.ev(a)}}}; h.za.tJ=function(a,c){if(!h.Si)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!h.g.userAgent.Uf};d.text=h.h.cE;d.Pb=function(){var e=new h.Si(a,h.h.lI,h.Si.wy,h.Si.wy),f=aa(a).getBoundingClientRect();f=new h.g.I(c.clientX-f.left,c.clientY-f.top);var g=h.g.Tk(a.Xa);f=h.g.I.Ok(f,g);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.ea&&(e.Re(),e.ya(),e.select())};return d};h.qf=function(a,c){h.qf.w.constructor.call(this,a,c);this.Le=a.C.hn[c];this.Qu=a.C.hn[h.Ji[c]];this.Th=new h.g.I(0,0);this.ug=!1;this.Xv=!this.Le};h.g.object.S(h.qf,h.na);b=h.qf.prototype;b.J=function(){h.qf.w.J.call(this);this.ug&&Xb(this.Le,this)};function Yb(a,c){var d=a.wb-c.wb;a=a.Na-c.Na;return Math.sqrt(d*d+a*a)} function Zb(a,c){if(!a.A.C.gc()){var d=H(a.A);if(!d.Qc){var e=!1;if(!d.Rc()){d=H(c.A);if(!d.Rc())return;c=a;e=!0}var f=h.selected==d;f||d.Wm();var g=c.wb+h.bd+Math.floor(Math.random()*h.Go)-a.wb,k=c.Na+h.bd+Math.floor(Math.random()*h.Go)-a.Na;e&&(k=-k);d.G&&(g=c.wb-h.bd-Math.floor(Math.random()*h.Go)-a.wb);d.moveBy(g,k);f||d.Il()}}}b.moveTo=function(a,c){this.ug&&Xb(this.Le,this);this.wb=a;this.Na=c;this.Xv||$b(this.Le,this)};b.moveBy=function(a,c){this.moveTo(this.wb+a,this.Na+c)}; function ac(a,c){a.moveTo(c.x+a.Th.x,c.y+a.Th.y)}function M(a,c,d){a.Th.x=c;a.Th.y=d}function bc(a){var c=a.ga.wb-a.wb,d=a.ga.Na-a.Na;if(0!=c||0!=d){a=z(a);var e=a.aa();if(!e)throw Error("block is not rendered.");e=h.g.Id(e);a.aa().setAttribute("transform","translate("+(e.x-c)+","+(e.y-d)+")");Wa(a,-c,-d)}} b.closest=function(a,c){var d=this.Qu;if(d.Eb.length){var e=this.Na,f=this.wb;this.wb=f+c.x;this.Na=e+c.y;var g=cc(d,this);c=null;for(var k=a,l,m=g-1;0<=m&&Math.abs(d.Eb[m].Na-this.Na)<=a;)l=d.Eb[m],this.Jn(l,k)&&(c=l,k=Yb(l,this)),m--;for(;gc?!1:h.qf.w.Jn.call(this,a)};b.Wn=function(a){Zb(this,a)};b.hq=function(a,c){h.qf.w.hq.call(this,a,c);a.ea&&a.ya();c.ea&&(na(c),c.ya())}; b.ds=function(){var a=this.A,c=this.af;if(a.C&&c&&h.i.ic){h.qf.w.ds.call(this);c=z(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.Re();c.ya(!1);a.ea&&a.ya()}};b.yw=function(a){return dc(this.Qu,this,a)};b.ge=function(a){h.qf.w.ge.call(this,a);var c=this.A;a=a.A;c.ea&&na(c);a.ea&&na(a);c.ea&&a.ea&&(this.type==h.Ga||this.type==h.Xd?a.ya():c.ya())};b.Dw=function(){this.isConnected()&&!Ga(this,this.ga)&&(A(E(this)?z(this):this.A),this.A.Ob())};h.g.Rect=function(a,c,d,e){this.top=a;this.bottom=c;this.left=d;this.right=e};h.g.Rect.prototype.contains=function(a,c){return a>=this.left&&a<=this.right&&c>=this.top&&c<=this.bottom};h.xd=function(a){this.R=a};b=h.xd.prototype;b.Cu=!0;b.Qm=17;b.Cd=null;b.Zk=null;function ec(a){a.Pc||(a.Pc=h.g.m.L("g",{"class":"blocklyIconGroup"},null),a.R.Qc&&h.g.m.Bb(a.Pc,"blocklyIconGroupReadonly"),a.dv(a.Pc),a.R.aa().appendChild(a.Pc),h.pa(a.Pc,"mouseup",a,a.Wq),a.oi())}b.J=function(){h.g.m.removeNode(this.Pc);this.Pc=null;this.yb(!1);this.R=null};b.oi=function(){};b.isVisible=function(){return!!this.Cd};b.Wq=function(a){this.R.C.gc()||this.R.Qc||h.g.wj(a)||this.yb(!this.isVisible())}; b.we=function(){this.isVisible()&&this.Cd.od(this.R.jg)};function Ra(a,c){a.Zk=c;a.isVisible()&&(a=a.Cd,a.Cb=c,a.Zr&&fb(a))}function fc(a){var c=a.R.Ia(),d=h.g.Id(a.Pc);c=new h.g.I(c.x+d.x+a.Qm/2,c.y+d.y+a.Qm/2);h.g.I.Ne(a.Zk,c)||Ra(a,c)};h.$d=function(a){h.$d.w.constructor.call(this,a);ec(this);this.Mj={}};h.g.object.S(h.$d,h.xd);h.$d.prototype.Cu=!1;h.$d.prototype.dv=function(a){h.g.m.L("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);h.g.m.L("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);h.g.m.L("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)}; h.$d.LD=function(a){var c=h.g.m.L("text",{"class":"blocklyText blocklyBubbleText",y:h.oa.Yc},null);a=a.split("\n");for(var d=0;d=a.Eb.length)return-1;for(var e=c.Na,f=d;0<=f&&a.Eb[f].Na==e;){if(a.Eb[f]==c)return f;f--}for(;dc.Na)e=f;else{d=f;break}}return d}function Xb(a,c){if(!c.ug)throw Error("Connection not in database.");var d=lc(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.ug=!1;a.Eb.splice(d,1)} function dc(a,c,d){function e(n){var r=g-f[n].wb,q=k-f[n].Na;Math.sqrt(r*r+q*q)<=d&&m.push(f[n]);return qthis.Fl){var d=c-this.Fl;d=0Object.keys(this.Dd).length&&(this.Dd={},this.Fl=0)}!this.Nn||this.gc()?h.Touch.rs(a)&&h.cd.w.Bn.call(this,a):(a.preventDefault(),a.stopPropagation(),this.J())};b.J=function(){h.cd.w.J.call(this);this.Lr&&h.Za(this.Lr)};function mc(a,c){a.Dd[h.Touch.An(c)]=nc(a,c);var d=Object.keys(a.Dd);2==d.length&&(a.qx=h.g.I.ng(a.Dd[d[0]],a.Dd[d[1]]),a.Nn=!0,c.preventDefault())} function nc(a,c){return a.Mb?new h.g.I(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};h.iu=function(a){this.Or=a;this.gk=Object.create(null)};b=h.iu.prototype;b.ir=null;b.J=function(){this.gk=this.Or=null};b.load=function(a,c){if(a.length){try{var d=new h.g.global.Audio}catch(l){return}for(var e,f=0;f=(isNaN(a.options.ul)?Infinity:a.options.ul-J(a).length)))if(a.Rb&&a.Rb.cancel(),"comment"==c.tagName.toLowerCase()){h.i.disable();try{var d=h.Si.Sk(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{h.i.enable()}d.select()}else a:{h.i.disable();try{var g=h.N.dj(c,a),k=a.xb.tb;if(h.Se&&k){h.navigation.$v(g,k.ma);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 q=r.Ia();if(1>=Math.abs(l-q.x)&&1>=Math.abs(m-q.y)){c=!0;break}}if(!c){var t=g.Hd(!1);d=0;for(var y;y=t[d];d++)if(y.closest(h.bd,new h.g.I(l,m)).connection){c=!0;break}}c&&(l=a.G?l-h.bd:l+h.bd,m+=2*h.bd)}while(c);g.moveBy(l,m)}}finally{h.i.enable()}h.i.isEnabled()&&!g.Qa&&h.i.Ha(new h.i.tm(g));g.select()}}function wc(a){(a=a.oe?a.ki:a)&&!a.Rb&&a.wa&&a.wa.O&&a.wa.aJ()} b.$h=function(a,c){h.Ua.w.$h.call(this,a,c);wc(this)};b.sh=function(a){h.Ua.w.sh.call(this,a);wc(this)};b.ie=function(a,c,d){a=h.Ua.w.ie.call(this,a,c,d);wc(this);return a};function pc(a){a.Uu=a.kc&&a.K.parentNode?a.kc.xn():null;a.Tu=a.O?a.O.xn():a.wa?a.wa.xn():null}function Sa(a,c){return a.Uu&&a.Uu.contains(c.clientX,c.clientY)?h.Ko:a.Tu&&a.Tu.contains(c.clientX,c.clientY)?h.ct:h.bt}b.Eg=function(a){var c=this.rg(a);c&&tb(c,a,this)}; b.ts=function(a,c){a=h.g.zl(a,x(this),Da(this));a.x/=this.scale;a.y/=this.scale;this.cv=h.g.I.Ok(c,a)};b.gc=function(){return null!=this.Rb&&this.Rb.gc()};function xc(a){return a.options.Ub&&a.options.Ub.scrollbars||a.options.Ub&&a.options.Ub.si||a.options.Ub&&a.options.Ub.og||a.options.mb&&a.options.mb.controls||a.options.mb&&a.options.mb.si} b.Rc=function(){return this.options.Ub&&this.options.Ub.scrollbars||this.options.Ub&&this.options.Ub.si||this.options.Ub&&this.options.Ub.og||this.options.mb&&this.options.mb.si}; b.aD=function(a){if(h.Di.Xq())a.preventDefault(),a.stopPropagation();else{var c=this.options.mb&&this.options.mb.si,d=this.options.Ub&&this.options.Ub.si;if(c||d){var e=h.g.Dv(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=h.g.zl(a,x(this),Da(this)),this.zoom(c.x,c.y,e));a.preventDefault()}}}; function ka(a){var c=D(a,!1);a=ja(a,!1);c=c.concat(a);if(!c.length)return new h.g.Rect(0,0,0,0);a=ic(c[0]);for(var d=1;da.bottom&&(a.bottom=e.bottom);e.lefta.right&&(a.right=e.right)}return a}b.CA=function(){this.Yb(!1);h.i.X(!0);for(var a=D(this,!0),c=0,d=0,e;e=a[d];d++)if(e.Rc()){var f=e.Ia();e.moveBy(-f.x,c-f.y);hc(e);c=e.Ia().y+G(e).height+h.ra.$o}h.i.X(!1);this.Yb(!0)}; b.Rl=function(a){function c(y){if(y.md())t=t.concat(p(y,!1));else{y=pa(y,!1);for(var O=0;Ot.length?d():h.confirm(h.h.DELETE_ALL_BLOCKS.replace("%1",t.length),function(y){y&&d()})}};e.push(l);this.Hu&&this.Hu(e);h.za.show(a,e,this.G)}};function Ca(a){if(a.options.Vb)Ca(a.options.Vb);else{h.ol=a;document.activeElement&&document.activeElement.blur();try{x(a).focus()}catch(c){try{x(a).parentNode.setActive()}catch(d){x(a).parentNode.focus()}}}} b.zoom=function(a,c,d){if(!this.oe&&!this.Kh){d=Math.pow(this.options.mb.sD,d);var e=this.scale*d;if(this.scale!=e){e>this.options.mb.vl?d=this.options.mb.vl/this.scale:ethis.options.mb.vl?a=this.options.mb.vl:this.options.mb.xl&&ak.Ex||k.Dck.Fx){l=null;g&&(l=h.i.Fb(),h.i.X(g.group));switch(g.type){case h.i.Qs:case h.i.Rs:var n=v(f,g.pc);n=H(n);break;case h.i.vm:case h.i.wm:n=f.fn[g.Ie]||null}if(n){m=ic(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var r=k.Ib,q=k.Ex-m.height;q=Math.max(r,q);r=h.g.Lb.wk(r,m.top,q)-m.top;q=k.zb;var t=k.Fx-m.width;k.G?q=Math.min(t,q):t=Math.max(q,t);n.moveBy(h.g.Lb.wk(q, m.left,t)-m.left,r)}g&&(g.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&h.i.X(l))}}});h.bm(f);h.T.Ja();h.D.Ja();h.H.Ja();return f}; h.gC=function(a){var c=a.options,d=x(a);h.pa(d.parentNode,"contextmenu",null,function(e){h.g.On(e)||e.preventDefault()});d=h.pa(window,"resize",null,function(){h.vc(!0);h.bm(a)});a.ho=d;h.vg.lA();c.ll&&(a.wa?a.wa.ua(a):a.O&&(a.O.ua(a),a.O.show(c.ll.childNodes),a.O.Xb.set(0)));d=h.Ca.jc;c.Tv&&(d=a.kc.ua(d));c.mb&&c.mb.controls&&a.ui.ua(d);c.Ub&&c.Ub.scrollbars?(a.ub=new h.Pi(a),a.ub.resize()):a.Og({x:.5,y:.5});c.ZB&&h.vg.sC(c.Bj,a)}; h.vg.lA=function(){h.hB||(h.pa(document,"scroll",null,function(){for(var a=h.ob.getAll(),c=0,d;d=a[c];c++)d.hm&&d.hm()}),h.pa(document,"keydown",null,h.SC),h.ed(document,"touchend",null,h.Cg),h.ed(document,"touchcancel",null,h.Cg),h.g.userAgent.Zg&&h.pa(window,"orientationchange",document,function(){h.bm(h.gb())}));h.hB=!0}; h.vg.sC=function(a,c){function d(){for(;f.length;)h.Za(f.pop());e.preload()}var e=c.Bd;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(h.pa(document,"mousemove",null,d,!0));f.push(h.pa(document,"touchstart",null,d,!0))};h.xe=function(a){this.name=a};h.F=function(a,c,d){if(!c)throw Error("Cannot create a node without a location.");this.fm=a;this.bl=h.F.jC(a);this.ma=c;(a=d||null)&&a.Jx&&(this.Kx=a.Jx)};h.F.types={ud:"field",Xc:"block",lf:"input",Li:"output",Td:"next",Wd:"previous",De:"stack",hh:"workspace"};h.F.vy=-20;h.F.jC=function(a){switch(a){case h.F.types.Wd:case h.F.types.Td:case h.F.types.lf:case h.F.types.Li:return!0}return!1};h.F.Gk=function(a){return new h.F(h.F.types.ud,a)}; h.F.Ke=function(a){return a?a.type==h.Sa||a.type==h.Ga&&a.Pe()?h.F.oh(a.Pe()):a.type==h.Ga?new h.F(h.F.types.Td,a):a.type==h.Vd?new h.F(h.F.types.Li,a):a.type==h.Xd?new h.F(h.F.types.Wd,a):null:null};h.F.oh=function(a){return a?new h.F(h.F.types.lf,a.connection):null};h.F.zf=function(a){return new h.F(h.F.types.Xc,a)};h.F.Hk=function(a){return new h.F(h.F.types.De,a)};h.F.Ik=function(a,c){return new h.F(h.F.types.hh,a,{Jx:c})};b=h.F.prototype;b.qb=function(){return this.fm}; function zc(a,c){a=a.ma;a instanceof h.sm||(a=a.A);if(!a||!a.C)return null;var d=H(a);a=D(d.C,!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:h.F.Hk(a[c]);throw Error("Couldn't find "+(c?"next":"previous")+" stack?!");}function Ac(a){if(!a)return null;do var c=a.U&&z(a.U);while(c&&u(c)==a&&(a=c));return(c=a.U||a.M)&&c.ga&&c.ga.Pe()?h.F.oh(c.ga.Pe()):h.F.Hk(a)} b.next=function(){switch(this.fm){case h.F.types.De:return zc(this,!0);case h.F.types.Li:return h.F.zf(this.ma.A);case h.F.types.ud:a:{var a=this.ma,c=a.Pe();var d=a.A;a=c.La.indexOf(a)+1;c=d.P.indexOf(c);for(var e;e=d.P[c];c++){for(var f=e.La;a1'), e.appendChild(d),c.push(e));if(h.hb.variables_get){a.sort(h.kk.Gu);d=0;for(var f;f=a[d];d++)e=h.g.xml.createElement("block"),e.setAttribute("type","variables_get"),e.setAttribute("gap",8),e.appendChild(h.Z.Eq(f)),c.push(e)}}return c}; h.Z.vB=function(a){a=a.pg();var c="";if(a.length)for(var d=1,e=0,f="ijkmnopqrstuvwxyzabcdefgh".charAt(e);!c;){for(var g=!1,k=0;kf?h.T.Dl(a,0,d.height+f):h.T.Dl(a,f,d.height)};h.T.uA=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)}; h.T.vA=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};h.VERSION="uncompiled";h.ol=null;h.selected=null;h.cursor=null;h.Se=!1;h.Pk=[];h.xk=null;h.cn=null;h.Up=null;h.rI=null;h.JD=function(a){return{width:a.wu,height:a.uu}};h.dJ=function(a){oa(a)};h.bm=function(a){for(;a.options.Vb;)a=a.options.Vb;var c=x(a),d=c.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.wu!=e&&(c.setAttribute("width",e+"px"),c.wu=e);c.uu!=d&&(c.setAttribute("height",d+"px"),c.uu=d);a.resize()}}; h.SC=function(a){var c=h.ol;if(!(h.g.On(a)||c.ea&&!c.isVisible()))if(c.options.readOnly)h.navigation.Fw(a);else{var d=!1;if(a.keyCode==h.g.Ta.No)h.vc(),h.navigation.Vh(h.navigation.zo);else{if(h.navigation.Fw(a))return;if(a.keyCode==h.g.Ta.Xx||a.keyCode==h.g.Ta.Wj){a.preventDefault();if(h.Di.Xq())return;h.selected&&h.selected.md()&&(d=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(h.Di.Xq())return;h.selected&&h.selected.md()&&h.selected.Rc()&&(a.keyCode==h.g.Ta.ey?(h.vc(),h.Yp(h.selected)):a.keyCode!= h.g.Ta.ku||h.selected.C.oe||(h.Yp(h.selected),d=!0));a.keyCode==h.g.Ta.Rz?h.xk&&(a=h.cn,a.oe&&(a=a.ki),h.Up&&cb(a,h.Up)&&(h.i.X(!0),vc(a),h.i.X(!1))):a.keyCode==h.g.Ta.$z&&(h.vc(),c.Cs(a.shiftKey))}}d&&!h.selected.C.oe&&(h.i.X(!0),h.vc(),h.selected.J(!0,!0),h.i.X(!1))}};h.Yp=function(a){if(a.cw)var c=a.xs();else{c=h.N.gg(a,!0);h.N.ZA(c);var d=a.Ia();c.setAttribute("x",a.G?-d.x:d.x);c.setAttribute("y",d.y)}h.xk=c;h.cn=a.C;h.Up=a.cw?null:h.g.Fq(a,!0)}; h.ev=function(a){var c=h.xk,d=h.cn;h.Yp(a);vc(a.C);h.xk=c;h.cn=d};h.$I=function(a){h.g.On(a)||a.preventDefault()};h.vc=function(a){h.H.ta();h.T.ta();h.D.lj();a||(a=h.gb(),a.kc&&a.kc.O&&a.kc.O.ta(),a.wa&&a.wa.O&&a.wa.O.Ui&&a.wa.uI())};h.gb=function(){return h.ol};h.alert=function(a,c){alert(a);c&&c()};h.confirm=function(a,c){c(confirm(a))};h.prompt=function(a,c,d){d(prompt(a,c))};h.pC=function(a){return function(){Jb(this,a)}}; h.aq=function(a){for(var c=0;ca.length)){e=[];for(f=0;fthis.Kl)return null;var a=this.getOptions(!0)[this.Kl][0];return"object"==typeof a?a.alt:a}; h.Ra.Cx=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;dc||Math.abs(a.mm-d)>c)a.Rj=e,a.mm=d,gb(a.Cd,e+c,d+c),a.Yl.setAttribute("width",a.Rj),a.Yl.setAttribute("height",a.mm);a.R.G&&a.s.Xa.setAttribute("transform","translate("+a.Rj+",0)");a.s.resize()} b.yb=function(a){if(a!=this.isVisible())if(h.i.Ha(new h.i.dd(this.R,"mutatorOpen",!a,a)),a){this.Cd=new h.oa(this.R.C,Dc(this),this.R.rd,this.Zk,null,null);ib(this.Cd,this.R.id);if(a=this.s.options.ll)this.s.O.ua(this.s),this.s.O.show(a.childNodes);this.Nf=this.R.Lk(this.s);a=p(this.Nf,!1);for(var c=0,d;d=a[c];c++)d.ya();this.Nf.io(!1);this.Nf.Mk=!1;this.s.O?(a=2*this.s.O.fb,c=tc(this.s).Df()+a):c=a=16;this.R.G&&(c=-c);this.Nf.moveBy(c,a);if(this.R.hs){var e=this;this.R.hs(this.Nf);this.mo=function(){e.R.hs(e.Nf)}; K(this.R.C,this.mo)}Ec(this);K(this.s,this.ZD.bind(this));this.we()}else this.Yl=null,this.s.J(),this.Nf=this.s=null,this.Cd.J(),this.Cd=null,this.mm=this.Rj=0,this.mo&&(eb(this.R.C,this.mo),this.mo=null)}; b.ZD=function(a){if(a.type!=h.i.Vm&&(a.type!=h.i.yi||"disabled"!=a.element)){if(!this.s.gc()){a=D(this.s,!1);for(var c=0,d;d=a[c];c++){var e=d.Ia(),f=G(d);20>e.y+f.height&&d.moveBy(0,20-f.height-e.y)}}if(this.Nf.C==this.s){h.i.X(!0);d=this.R;a=(a=d.hc())&&h.N.Fc(a);c=d.ea;d.ea=!1;d.Ak(this.Nf);d.ea=c;d.Re();c=(c=d.hc())&&h.N.Fc(c);if(a!=c){h.i.Ha(new h.i.Rf(d,"mutation",null,a,c));var g=h.i.Fb();setTimeout(function(){h.i.X(g);d.Ob();h.i.X(!1)},h.rm)}d.ea&&d.ya();a!=c&&h.Se&&h.navigation.EC(d);this.s.gc()|| Ec(this);h.i.X(!1)}}};b.JB=function(){return{vb:this.mm,lb:this.Rj-tc(this.s).Df(),oc:0,dc:this.s.G?0:tc(this.s).Df()}};b.J=function(){this.R.se=null;h.xd.prototype.J.call(this)};h.Sd.Vr=function(a,c,d){if(a&&a.A.C){d=B(c,d).connection;var e=z(a);e&&e!=c||d.ga==a||(d.isConnected()&&d.disconnect(),d.connect(a))}};h.Sd.BI=function(a){var c=null;if(a&&a.options){var d=a.options.Vb;a.oe?d&&d.options&&(c=d.options.Vb):d&&(c=d)}return c};h.hb.tC={};h.cb={};h.cb.$c={};h.cb.$c.Ry=210; h.aq([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null, nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}", helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["\u2260","NEQ"],["\u200f<","LT"],["\u200f\u2264","LTE"],["\u200f>","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation", message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks", tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value", name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]); h.aq([{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}"}]);h.cb.$c.yp={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}"};h.ba.register("logic_op_tooltip",h.ba.tu(h.cb.$c.yp)); h.cb.$c.py={jd:0,ke:0,po:!0,hc:function(){if(!this.jd&&!this.ke)return null;var a=h.g.xml.createElement("mutation");this.jd&&a.setAttribute("elseif",this.jd);this.ke&&a.setAttribute("else",1);return a},Gd:function(a){this.jd=parseInt(a.getAttribute("elseif"),10)||0;this.ke=parseInt(a.getAttribute("else"),10)||0;this.iD()},Lk:function(a){var c=a.yj("controls_if_if");c.Re();for(var d=c.V,e=1;e<=this.jd;e++){var f=a.yj("controls_if_elseif");f.Re();d.connect(f.U);d=f.V}this.ke&&(a=a.yj("controls_if_else"), a.Re(),d.connect(a.U));return c},Ak:function(a){a=z(a.V);this.ke=this.jd=0;for(var c=[null],d=[null],e=null;a;){switch(a.type){case "controls_if_elseif":this.jd++;c.push(a.UD);d.push(a.vs);break;case "controls_if_else":this.ke++;e=a.vs;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.V&&z(a.V)}this.im();this.Vw(c,d,e)},hs:function(a){a=z(a.V);for(var c=1;a;){switch(a.type){case "controls_if_elseif":var d=B(this,"IF"+c),e=B(this,"DO"+c);a.UD=d&&d.connection.ga;a.vs=e&&e.connection.ga; c++;break;case "controls_if_else":e=B(this,"ELSE");a.vs=e&&e.connection.ga;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.V&&z(a.V)}},iD:function(){var a=[null],c=[null],d=null;B(this,"ELSE")&&(d=B(this,"ELSE").connection.ga);for(var e=1;B(this,"IF"+e);){var f=B(this,"DO"+e);a.push(B(this,"IF"+e).connection.ga);c.push(f.connection.ga);e++}this.im();this.Vw(a,c,d)},im:function(){B(this,"ELSE")&&this.Zh("ELSE");for(var a=1;B(this,"IF"+a);)this.Zh("IF"+a),this.Zh("DO"+a),a++;for(a= 1;a<=this.jd;a++)L(Ib(this,"IF"+a).Mc("Boolean"),h.h.CONTROLS_IF_MSG_ELSEIF),L(this.ae(h.Ga,"DO"+a),h.h.CONTROLS_IF_MSG_THEN);this.ke&&L(this.ae(h.Ga,"ELSE"),h.h.CONTROLS_IF_MSG_ELSE)},Vw:function(a,c,d){for(var e=1;e<=this.jd;e++)h.Sd.Vr(a[e],this,"IF"+e),h.Sd.Vr(c[e],this,"DO"+e);h.Sd.Vr(d,this,"ELSE")}};h.ba.Xr("controls_if_mutator",h.cb.$c.py,null,["controls_if_elseif","controls_if_else"]); h.cb.$c.qy=function(){this.Od(function(){if(this.jd||this.ke){if(!this.jd&&this.ke)return h.h.CONTROLS_IF_TOOLTIP_2;if(this.jd&&!this.ke)return h.h.CONTROLS_IF_TOOLTIP_3;if(this.jd&&this.ke)return h.h.CONTROLS_IF_TOOLTIP_4}else return h.h.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};h.ba.register("controls_if_tooltip",h.cb.$c.qy); h.cb.$c.gz={onchange:function(a){this.El||(this.El=[null,null]);var c=Kb(this,"A"),d=Kb(this,"B");c&&d&&!Ga(c.M,d.M)&&(h.i.X(a.group),a=this.El[0],a!==c&&(A(c),a&&!a.Qa&&B(this,"A").connection.connect(a.M)),c=this.El[1],c!==d&&(A(d),c&&!c.Qa&&B(this,"B").connection.connect(c.M)),this.Ob(),h.i.X(!1));this.El[0]=Kb(this,"A");this.El[1]=Kb(this,"B")}};h.cb.$c.fz=function(){this.Ph(h.cb.$c.gz)};h.ba.register("logic_compare",h.cb.$c.fz); h.cb.$c.hz={Rw:null,onchange:function(a){var c=Kb(this,"THEN"),d=Kb(this,"ELSE"),e=this.M.ga;if((c||d)&&e)for(var f=0;2>f;f++){var g=1==f?c:d;g&&!Ga(g.M,e)&&(h.i.X(a.group),e===this.Rw?(A(this),e.A.Ob()):(A(g),g.Ob()),h.i.X(!1))}this.Rw=e}};h.ba.jD();h.Ab=function(a,c,d){this.px=!0;null==a&&(a="");h.Ab.w.constructor.call(this,a,c,d)};h.g.object.S(h.Ab,h.Fa);h.Ab.qa=function(a){var c=h.g.te(a.text);return new h.Ab(c,void 0,a)};h.Ab.prototype.Mi=!0;h.Ab.Hy=11;h.Ab.$x=4;b=h.Ab.prototype;b.Ys="text";b.Ed=function(a){h.Ab.w.Ed.call(this,a);"boolean"==typeof a.spellcheck&&(this.px=a.spellcheck)};b.vh=function(a){return null===a||void 0===a?null:String(a)}; b.bv=function(){if(this.sj){this.gr=!1;var a=this.Nc;this.Nc=this.Ic.TD;this.A&&h.i.isEnabled()&&h.i.Ha(new h.i.Rf(this.A,"field",this.name||null,a,this.Nc))}};b.cj=function(a){this.gr=!0;this.Nc=a;this.sj||(this.Jf=!0)};b.Xe=function(){h.Ab.w.Xe.call(this);this.sj&&(this.A.G?setTimeout(this.fo.bind(this),0):this.fo(),this.gr?(h.g.m.Lc(this.Ic,"blocklyInvalidInput"),h.g.Da.$e(this.Ic,"invalid",!1)):(h.g.m.Bb(this.Ic,"blocklyInvalidInput"),h.g.Da.$e(this.Ic,"invalid",!0)))}; b.Pg=function(a){this.s=this.A.C;a=a||!1;!a&&(h.g.userAgent.zt||h.g.userAgent.wi||h.g.userAgent.Zg)?Fc(this):(h.T.show(this,this.A.G,this.YD.bind(this)),this.Ic=this.Ds(),this.sj=!0,a||(this.Ic.focus(),this.Ic.select()))};function Fc(a){h.prompt(h.h.CHANGE_VALUE_TITLE,a.kd(),function(c){a.setValue(c)})} b.Ds=function(){var a=h.T.va,c=document.createElement("input");c.className="blocklyHtmlInput";c.setAttribute("spellcheck",this.px);var d=h.Ab.Hy*this.s.scale+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=h.Ab.$x*this.s.scale+"px";a.appendChild(c);c.value=c.defaultValue=String(this.Nc);c.TD=this.Nc;c.Cw=null;h.g.userAgent.Po?setTimeout(this.fo.bind(this),0):this.fo();this.Kr=h.pa(c,"keydown",this,this.Jr);this.TC=h.pa(c,"input",this,this.RC);return c}; b.YD=function(){this.sj=!1;this.gr=!0;ab(this);this.QC&&this.QC(this.Nc);h.Za(this.Kr);h.Za(this.TC);var a=h.T.va.style;a.width="auto";a.height="auto";a.fontSize=""};b.Jr=function(a){a.keyCode==h.g.Ta.Mo?(h.T.ta(),h.D.lj()):a.keyCode==h.g.Ta.No?(this.Ic.value=this.Ic.defaultValue,h.T.ta(),h.D.lj()):a.keyCode==h.g.Ta.Wt&&(h.T.ta(),h.D.lj(),jc(this.A,this,!a.shiftKey),a.preventDefault())};b.RC=function(){var a=this.Ic.value;a!==this.Ic.Cw&&(this.Ic.Cw=a,h.i.X(!0),this.setValue(a),ab(this),h.i.X(!1))}; b.fo=function(){var a=h.T.va;var c=this.jh.getBBox();var d=c.height*this.A.C.scale;var e=c.width*this.A.C.scale;var f=h.g.style.zh(this.jh);c=f.y;d=f.y+d;var g=f.x;e=f.x+e;a.style.width=e-g+"px";a.style.height=d-c+"px";c=new h.g.I(this.A.G?e-a.offsetWidth:g,c);c.y+=1;h.g.userAgent.Po&&h.T.va.style.top&&(--c.x,--c.y);h.g.userAgent.Cp&&(c.y-=3);a.style.left=c.x+"px";a.style.top=c.y+"px"}; h.Ab.NC=function(a){console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);return isNaN(a)?null:String(a)};h.Ab.ZI=function(a){(a=h.Ab.NC(a))&&(a=String(Math.max(0,Math.floor(a))));return a};h.Ab.prototype.fw=function(){return!0};h.Ab.prototype.Nq=function(){return this.sj&&this.Ic?this.Ic.value:null};h.tc.register("field_input",h.Ab);h.Rd=function(a,c,d,e,f,g){this.yl=-Infinity;this.wl=Infinity;this.Dj=0;this.$p=null;h.Rd.w.constructor.call(this,a||0,f,g);g||(Gc(this,c),Hc(this,d),Ic(this,e),this.setValue(this.getValue()))};h.g.object.S(h.Rd,h.Ab);h.Rd.qa=function(a){return new h.Rd(a.value,void 0,void 0,void 0,void 0,a)};h.Rd.prototype.Mi=!0;h.Rd.prototype.Ed=function(a){h.Rd.w.Ed.call(this,a);Gc(this,a.min);Hc(this,a.max);Ic(this,a.precision)};function Gc(a,c){null==c?a.yl=-Infinity:(c=Number(c),isNaN(c)||(a.yl=c))} function Hc(a,c){null==c?a.wl=Infinity:(c=Number(c),isNaN(c)||(a.wl=c))}function Ic(a,c){null==c?a.Dj=0:(c=Number(c),isNaN(c)||(a.Dj=c));var d=a.Dj.toString(),e=d.indexOf(".");a.$p=-1==e?c?0:null:d.length-e-1}h.Rd.prototype.vh=function(a){if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);if(isNaN(a))return null;a=Math.min(Math.max(a,this.yl),this.wl);this.Dj&&isFinite(a)&&(a=Math.round(a/this.Dj)*this.Dj);null!=this.$p&&(a=Number(a.toFixed(this.$p)));return a}; h.Rd.prototype.Ds=function(){var a=h.Rd.w.Ds.call(this);-Infinitythis.wl&&h.g.Da.$e(a,h.g.Da.State.Sz,this.wl);return a};h.tc.register("field_number",h.Rd);h.wd=function(a,c,d,e,f){this.Oh=h.wd.mB;this.YA=a||"";this.Gb=new h.g.Yd(0,h.ra.$o);f&&this.Ed(f);c&&(this.lm=c);f||Jc(this,d,e)};h.g.object.S(h.wd,h.Ra);h.wd.qa=function(a){var c=h.g.te(a.variable);return new h.wd(c,void 0,void 0,void 0,a)};b=h.wd.prototype;b.s=null;b.Mi=!0;b.Ed=function(a){h.wd.w.Ed.call(this,a);Jc(this,a.variableTypes,a.defaultType)};b.Fh=function(){if(!this.Vc){var a=h.Z.zv(this.A.C,null,this.YA,this.XA);h.i.disable();this.setValue(a.Pa());h.i.enable()}}; b.Sk=function(a){var c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";c=h.Z.zv(this.A.C,c,d,e);if(null!=e&&e!==c.type)throw Error("Serialized variable type with id '"+c.Pa()+"' had type "+c.type+", and does not match variable field that references it: "+h.N.Fc(a)+".");this.setValue(c.Pa())};b.xx=function(a){this.Fh();a.id=this.Vc.Pa();a.textContent=this.Vc.name;this.Vc.type&&a.setAttribute("variabletype",this.Vc.type);return a}; b.ps=function(a){if(a.Qa)throw Error("Variable fields are not allowed to exist on shadow blocks.");h.wd.w.ps.call(this,a)};b.getValue=function(){return this.Vc?this.Vc.Pa():null};b.kd=function(){return this.Vc?this.Vc.name:""};b.me=function(){return this.Vc};b.Iv=function(){return this.Vc?this.lm:null}; b.vh=function(a){if(null===a)return null;var c=h.Z.me(this.A.C,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=Kc(this)){for(var e=0;ed;d+=15)h.g.m.L("line",{x1:h.$.Jb+h.$.pf,y1:h.$.Jb,x2:h.$.Jb+h.$.pf-(0==d%45?10:5),y2:h.$.Jb, "class":"blocklyAngleMarks",transform:"rotate("+d+","+h.$.Jb+","+h.$.Jb+")"},a);this.HA=h.pa(a,"click",this,this.$B);this.GA=h.pa(c,"click",this,this.Iw,!0,!0);this.FC=h.pa(c,"mousemove",this,this.Iw,!0,!0);return a};b.wq=function(){h.Za(this.HA);h.Za(this.GA);h.Za(this.FC)};b.$B=function(){h.D.kj(this);h.T.ta()}; b.Iw=function(a){var c=this.Dq.ownerSVGElement.getBoundingClientRect(),d=a.clientX-c.left-h.$.Jb;a=a.clientY-c.top-h.$.Jb;c=Math.atan(-a/d);isNaN(c)||(c=h.g.Lb.wx(c),0>d?c+=180:0c&&(c+=360);c>a.Ix&&(c-=360);return c}h.Zc.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(",")); h.tc.register("field_angle",h.$);h.Generator=function(a){this.JC=a;this.Iy=new RegExp(this.Tf,"g")};h.Generator.Zf="generated_function";b=h.Generator.prototype;b.Oi=null;b.sf=null;b.Fm=" ";b.ky=60;b.Om=[]; function Oc(){var a=h.o,c=C;c||(console.warn("No workspace specified in workspaceToCode call. Guessing."),c=h.gb());var d=[];a.ua(c);c=D(c,!0);for(var e=0,f;f=c[e];e++){var g=Pc(a,f);Array.isArray(g)&&(g=g[0]);g&&(f.M&&(g=a.bx(g),a.Oi&&!f.po&&(g=Qc(a.Oi,f)+g),a.sf&&!f.po&&(g+=Qc(a.sf,f))),d.push(g))}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 Rc(a,c){return c+a.replace(/(?!\n$)\n/g,"\n"+c)} function Pc(a,c){if(!c)return"";if(!c.isEnabled())return Pc(a,u(c));var d=a[c.type];if("function"!=typeof d)throw Error('Language "'+a.JC+'" 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.js(c,d[0],void 0),d[1]]}if("string"==typeof d)return a.Oi&&!c.po&&(d=Qc(a.Oi,c)+d),a.sf&&!c.po&&(d+=Qc(a.sf,c)),a.js(c,d,void 0);if(null===d)return"";throw SyntaxError("Invalid code generated: "+ d);} function N(a,c,d){var e=h.o;if(isNaN(d))throw TypeError("Expecting valid order from block: "+a.type);var f=Kb(a,c);if(!f)return"";c=Pc(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 g=Math.floor(d),k=Math.floor(c);if(g<=k&&(g!=k||0!=g&&99!=g))for(f=!0,g=0;gd?N(a,c,h.o.gp)||g:e?N(a,c,h.o.fk)||g:N(a,c,f)||g;if(h.nC(a))a=Number(a)+d,e&&(a=-a);else{if(0d&&(a=a+" - "+-d,k=h.o.gp);e&&(a=d?"-("+a+")":"-"+a,k=h.o.fk);k=Math.floor(k);f=Math.floor(f);k&&f>=k&&(a="("+a+")")}return a};h.o.tC={};h.o.controls_if=function(a){var c=0,d="";h.o.Oi&&(d+=Qc(h.o.Oi,a));do{var e=N(a,"IF"+c,h.o.nf)||"false";var f=Sc(a,"DO"+c);h.o.sf&&(f=Rc(Qc(h.o.sf,a),h.o.Fm)+f);d+=(0",GTE:">="}[F(a,"OP")],d="=="==c||"!="==c?h.o.Dt:h.o.Et,e=N(a,"A",d)||"0";a=N(a,"B",d)||"0";return[e+" "+c+" "+a,d]};h.o.logic_operation=function(a){var c="AND"==F(a,"OP")?"&&":"||",d="&&"==c?h.o.Nm:h.o.ep,e=N(a,"A",d);a=N(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]};h.o.logic_negate=function(a){var c=h.o.cp;return["!"+(N(a,"BOOL",c)||"true"),c]}; h.o.logic_boolean=function(a){return["TRUE"==F(a,"BOOL")?"true":"false",h.o.Lm]};h.o.logic_null=function(){return["null",h.o.Lm]};h.o.logic_ternary=function(a){var c=N(a,"IF",h.o.Mm)||"false",d=N(a,"THEN",h.o.Mm)||"null";a=N(a,"ELSE",h.o.Mm)||"null";return[c+" ? "+d+" : "+a,h.o.Mm]};h.o.Lb={};h.o.math_number=function(a){a=Number(F(a,"NUM"));return[a,0<=a?h.o.Lm:h.o.fk]};h.o.math_arithmetic=function(a){var c={ADD:[" + ",h.o.Ki],MINUS:[" - ",h.o.gp],MULTIPLY:[" * ",h.o.fp],DIVIDE:[" / ",h.o.dk],POWER:[null,h.o.Ce]}[F(a,"OP")],d=c[0];c=c[1];var e=N(a,"A",c)||"0";a=N(a,"B",c)||"0";return d?[e+d+a,c]:["Math.pow("+e+", "+a+")",h.o.ad]}; h.o.math_single=function(a){var c=F(a,"OP");if("NEG"==c)return a=N(a,"NUM",h.o.fk)||"0","-"==a[0]&&(a=" "+a),["-"+a,h.o.fk];a="SIN"==c||"COS"==c||"TAN"==c?N(a,"NUM",h.o.dk)||"0":N(a,"NUM",h.o.nf)||"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,h.o.ad];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,h.o.dk]}; h.o.math_constant=function(a){return{PI:["Math.PI",h.o.mf],E:["Math.E",h.o.mf],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",h.o.dk],SQRT2:["Math.SQRT2",h.o.mf],SQRT1_2:["Math.SQRT1_2",h.o.mf],INFINITY:["Infinity",h.o.Lm]}[F(a,"CONSTANT")]}; h.o.math_number_property=function(a){var c=N(a,"NUMBER_TO_CHECK",h.o.ek)||"0",d=F(a,"PROPERTY");if("PRIME"==d){var e=Uc("mathIsPrime",["function "+h.o.Tf+"(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,h.o.ad]}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=N(a,"DIVISOR",h.o.ek)||"0",e=c+" % "+a+" == 0"}return[e,h.o.Dt]}; h.o.math_change=function(a){var c=N(a,"DELTA",h.o.Ki)||"0";a=Bc(F(a,"VAR"),h.Z.Zf);return a+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+c+";\n"};h.o.math_round=h.o.math_single;h.o.math_trig=h.o.math_single; h.o.math_on_list=function(a){var c=F(a,"OP");switch(c){case "SUM":a=N(a,"LIST",h.o.mf)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=N(a,"LIST",h.o.Ce)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=N(a,"LIST",h.o.Ce)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":c=Uc("mathMean",["function "+h.o.Tf+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]);a=N(a,"LIST",h.o.nf)||"[]";a=c+"("+a+")";break;case "MEDIAN":c= Uc("mathMedian",["function "+h.o.Tf+"(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=N(a,"LIST",h.o.nf)||"[]";a=c+"("+a+")";break;case "MODE":c=Uc("mathModes", ["function "+h.o.Tf+"(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=N(a,"LIST",h.o.nf)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=Uc("mathStandardDeviation",["function "+h.o.Tf+"(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=N(a,"LIST",h.o.nf)||"[]";a=c+"("+a+")";break;case "RANDOM":c=Uc("mathRandomList",["function "+h.o.Tf+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]);a=N(a,"LIST",h.o.nf)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,h.o.ad]};h.o.math_modulo=function(a){var c=N(a,"DIVIDEND",h.o.ek)||"0";a=N(a,"DIVISOR",h.o.ek)||"0";return[c+" % "+a,h.o.ek]}; h.o.math_constrain=function(a){var c=N(a,"VALUE",h.o.Ce)||"0",d=N(a,"LOW",h.o.Ce)||"0";a=N(a,"HIGH",h.o.Ce)||"Infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",h.o.ad]}; h.o.math_random_int=function(a){var c=N(a,"FROM",h.o.Ce)||"0";a=N(a,"TO",h.o.Ce)||"0";return[Uc("mathRandomInt",["function "+h.o.Tf+"(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+")",h.o.ad]};h.o.math_random_float=function(){return["Math.random()",h.o.ad]}; h.o.math_atan2=function(a){var c=N(a,"X",h.o.Ce)||"0";return["Math.atan2("+(N(a,"Y",h.o.Ce)||"0")+", "+c+") / Math.PI * 180",h.o.dk]};var Vc={ar:"\u0627\u0644\u0639\u0631\u0628\u064a\u0629",be:"\u0431\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0456","be-tarask":"Tara\u0161kievica",bg:"\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438 \u0435\u0437\u0438\u043a",bn:"\u09ac\u09be\u0982\u09b2\u09be",br:"Brezhoneg",cs:"\u010cesky",da:"Dansk",de:"Deutsch",el:"\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac",en:"English",es:"Espa\u00f1ol",eu:"Euskara",fa:"\u0641\u0627\u0631\u0633\u06cc",fi:"Suomi",fr:"Fran\u00e7ais",gl:"Galego",ha:"Hausa", he:"\u05e2\u05d1\u05e8\u05d9\u05ea",hi:"\u0939\u093f\u0928\u094d\u0926\u0940",hu:"Magyar",hy:"\u0570\u0561\u0575\u0565\u0580\u0567\u0576",ia:"Interlingua",id:"Bahasa Indonesia",ig:"As\u1ee5s\u1ee5 Igbo",is:"\u00cdslenska",it:"Italiano",ja:"\u65e5\u672c\u8a9e",kab:"Taqbaylit",ko:"\ud55c\uad6d\uc5b4",lt:"Lietuvi\u0173",lv:"Latvie\u0161u",ms:"Bahasa Melayu",my:"\u1019\u103c\u1014\u103a\u1019\u102c\u1005\u102c",nb:"Norsk Bokm\u00e5l",nl:"Nederlands, Vlaams",pl:"Polski",pms:"Piemont\u00e8is",pt:"Portugu\u00eas", "pt-br":"Portugu\u00eas Brasileiro",ro:"Rom\u00e2n\u0103",ru:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439",sc:"Sardu",sk:"Sloven\u010dina",sl:"Sloven\u0161\u010dina",sq:"Shqip",sr:"\u0421\u0440\u043f\u0441\u043a\u0438",sv:"Svenska",th:"\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22",tr:"T\u00fcrk\u00e7e",uk:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",ur:"\u0627\u064f\u0631\u062f\u064f\u0648\u202c",vi:"Ti\u1ebfng Vi\u1ec7t",yo:"\u00c8d\u00e8 Yor\u00f9b\u00e1","zh-hans":"\u7b80\u4f53\u4e2d\u6587", "zh-hant":"\u6b63\u9ad4\u4e2d\u6587"},Wc="ace ar fa he mzn ps ur".split(" "),P=window.BlocklyGamesLang,Xc=window.BlocklyGamesLanguages,Yc=".html"==window.location.pathname.substr(-5),C=null,Q,Zc=Number,$c,ad=window.location.search.match(/[?&]level=([^&]+)/);$c=ad?decodeURIComponent(ad[1].replace(/\+/g,"%20")):"NaN";var bd=Zc($c);Q=isNaN(bd)?1:h.g.Lb.wk(1,bd,10); function cd(){document.title=document.getElementById("title").textContent;document.dir=-1!=Wc.indexOf(P)?"rtl":"ltr";document.head.parentElement.setAttribute("lang",P);var a=document.getElementById("languageMenu");if(a){for(var c=[],d=0;dk[0]?1:g[0]=a.options.length&&(a.style.display="none")}for(d= 1;10>=d;d++)a=document.getElementById("level"+d),c=!!dd(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(ed,1)}function dd(a){var c=fd;try{var d=window.localStorage[c+a]}catch(e){}return d}function R(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 gd(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 hd(a){a%=360;0>a&&(a+=360);return a} function ed(){if(!Yc){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")}};var id,S,jd,kd,ld,md;h.hb.bird_noWorm={ua:function(){Jb(this,{message0:R("Bird_noWorm"),output:"Boolean",colour:330,tooltip:R("Bird_noWormTooltip")})}};h.o.bird_noWorm=function(){return["noWorm()",h.o.ad]};h.hb.bird_heading={ua:function(){this.od(290);L(L(this.ae(h.Qd,""),R("Bird_heading")),new h.$("90"),"ANGLE");this.Pl(!0);this.Od(R("Bird_headingTooltip"))}};h.o.bird_heading=function(a){return"heading("+Number(F(a,"ANGLE"))+", 'block_id_"+a.id+"');\n"}; h.hb.bird_position={ua:function(){Jb(this,{message0:"%1",args0:[{type:"field_dropdown",name:"XY",options:[["x","X"],["y","Y"]]}],output:"Number",colour:330,tooltip:R("Bird_positionTooltip")})}};h.o.bird_position=function(a){return["get"+F(a,"XY").charAt(0)+"()",h.o.ad]}; h.hb.bird_compare={ua:function(){this.Ff=h.h.LOGIC_COMPARE_HELPURL;this.od(h.h.LOGIC_HUE);this.Ol(!0,"Boolean");Ib(this,"A").Mc("Number");L(Ib(this,"B").Mc("Number"),new h.Ra([["\u200f<","LT"],["\u200f>","GT"]]),"OP");this.Ng(!0);var a=this;this.Od(function(){var c=F(a,"OP");return{LT:h.h.LOGIC_COMPARE_TOOLTIP_LT,GT:h.h.LOGIC_COMPARE_TOOLTIP_GT}[c]})}};h.o.bird_compare=function(a){var c="LT"==F(a,"OP")?"<":">",d=h.o.Et,e=N(a,"A",d)||"0";a=N(a,"B",d)||"0";return[e+" "+c+" "+a,d]}; h.hb.bird_and={ua:function(){this.Ff=h.h.LOGIC_OPERATION_HELPURL;this.od(h.h.LOGIC_HUE);this.Ol(!0,"Boolean");Ib(this,"A").Mc("Boolean");L(Ib(this,"B").Mc("Boolean"),h.h.LOGIC_OPERATION_AND);this.Ng(!0);this.Od(h.h.LOGIC_OPERATION_TOOLTIP_AND)}};h.o.bird_and=function(a){var c=h.o.Nm,d=N(a,"A",c);a=N(a,"B",c);d||a?(d||(d="true"),a||(a="true")):a=d="false";return[d+" && "+a,c]}; h.hb.bird_ifElse={ua:function(){this.Ff=h.h.CONTROLS_IF_HELPURL;this.od(h.h.LOGIC_HUE);L(Ib(this,"CONDITION"),h.h.CONTROLS_IF_MSG_IF).Mc("Boolean");L(this.ae(h.Ga,"DO"),h.h.CONTROLS_IF_MSG_THEN);L(this.ae(h.Ga,"ELSE"),h.h.CONTROLS_IF_MSG_ELSE);this.Mk=!1;this.Od(h.h.CONTROLS_IF_TOOLTIP_2)}};h.o.bird_ifElse=function(a){var c=N(a,"CONDITION",h.o.nf)||"false",d=Sc(a,"DO");a=Sc(a,"ELSE");return"if ("+c+") {\n"+d+"} else {\n"+a+"}\n"};h.hb.controls_if.OC=h.hb.controls_if.ua; h.hb.controls_if.ua=function(){this.OC();this.Pl(!1);this.jo(!1);this.Mk=!1};var nd=nd||{};function od(a,c){function d(){}d.prototype=c.prototype;a.w=c.prototype;a.prototype=new d;a.prototype.constructor=a;a.qI=function(e,f,g){return c.prototype[f].apply(e,Array.prototype.slice.call(arguments,2))}}if(!pd){var pd,qd="";"undefined"!==typeof navigator&&navigator&&"string"==typeof navigator.userAgent&&(qd=navigator.userAgent);var rd=0==qd.indexOf("Opera");pd={VI:{zF:"ScriptEngine"in window},FG:rd,Uf:!rd&&-1!=qd.indexOf("MSIE"),Cp:!rd&&-1!=qd.indexOf("WebKit")}}if(!sd)var sd={}; if(!td)var td={};if(!ud)var ud={};if(!vd)var vd={};if(!wd)var wd={};if(!xd)var xd={};var yd=nd.GE?{fJ:!0}:{};function zd(){throw Error("Do not instantiate directly");}zd.prototype.Mu=null;zd.prototype.toString=function(){return this.content};function Ad(a){if(null!=a)switch(a.Mu){case 1:return 1;case -1:return-1;case 0:return 0}return null}function Dd(){zd.call(this)}od(Dd,zd);Dd.prototype.PA=yd;function T(a){return null!=a&&a.PA===yd?a:Ed(String(String(a)).replace(Fd,Gd),Ad(a))} var Ed=function(a){function c(){}c.prototype=a.prototype;return function(d,e){var f=new c;f.content=String(d);void 0!==e&&(f.Mu=e);return f}}(Dd),Hd={"\x00":"�",'"':""","&":"&","'":"'","<":"<",">":">","\t":" ","\n":" ","\x0B":" ","\f":" ","\r":" "," ":" ","-":"-","/":"/","=":"=","`":"`","\u0085":"…","\u00a0":" ","\u2028":"
","\u2029":"
"};function Gd(a){return Hd[a]}var Fd=/[\x00\x22\x26\x27\x3c\x3e]/g;function Id(){for(var a='
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
n\u00e3o tem minhocasdire\u00e7\u00e3oEsse bloco indica quando o p\u00e1ssaro n\u00e3o possui a \\nminhoca. Mover na dire\u00e7\u00e3o do \u00e2ngulo indicado: 0 \u00e9 para a \\ndireita, 90 \u00e9 para frente, etc. x e y marcam a posi\u00e7\u00e3o do p\u00e1ssaro. \\nQuando x = 0 o p\u00e1ssaro esta pr\u00f3ximo \\nda margem esquerda, quando x = 100 \\nesta perto da margem direita. Quando \\ny = 0 o p\u00e1ssaro esta em baixo, quando \\ny = 100 ele est\u00e1 no topo.

'+ ((Yc?'':'')+"Jogos do Blockly : "+T({appName:"P\u00e1ssaro"}.appName)+""),c="   ",d=1;11>d;d++)c+=" "+(d==Q?''+T(d)+"":10==d?''+T(d)+"":'');return a+c+'

 
Parab\u00e9ns!
Este n\u00edvel \u00e9 extremamente dif\u00edcil. Voc\u00ea deseja pul\u00e1-lo e ir ao pr\u00f3ximo jogo? Voc\u00ea sempre pode voltar mais tarde.
')+ (1==Q?'
Trocar o \u00e2ngulo da dire\u00e7\u00e3o para que o p\u00e1ssaro pegue a minhoca e aterrisse em seu ninho.
':2==Q?'
Usar este bloco para ir em uma posi\u00e7\u00e3o se voc\u00ea tiver a minhoca, ou uma posi\u00e7\u00e3o diferente se voc\u00ea n\u00e3o tiver a minhoca.
': 4==Q?"
'x' e sua posi\u00e7\u00e3o horizontal atual. Use este bloco para ir em uma dire\u00e7\u00e3o se 'x' for menor que um numero, ou uma dire\u00e7\u00e3o diferente caso contr\u00e1rio.
":5==Q?'
Clique no \u00edcone para modificar o bloco \'se\'.
':6==Q?"
Este n\u00edvel precisa de um bloco 'sen\u00e3o se' e de um bloco 'sen\u00e3o'.
": 8==Q?'
O bloco "e" somente \u00e9 verdadeiro se as duas entradas forem verdadeiras.
':"")+"
"+(5==Q?'
Puxe um bloco "sen\u00e3o" em cima do bloco "se".
':"")};h.Ap=function(a){this.s=a;this.nh=[];if(!(0>=this.s.options.Tn)){a={scrollbars:!0,uh:this.s.options.uh,Vb:this.s,G:this.s.G,zj:this.s.options.zj,ai:this.s.options.ai};if(this.s.Hf){a.Ya=this.s.Ya==h.fh?h.ik:h.fh;if(!h.Ro)throw Error("Missing require for Blockly.HorizontalFlyout");this.O=new h.Ro(a)}else{a.Ya=this.s.Ya==h.fg?h.zd:h.fg;if(!h.gh)throw Error("Missing require for Blockly.VerticalFlyout");this.O=new h.gh(a)}K(this.s,this.PC.bind(this))}};b=h.Ap.prototype;b.lk=47;b.qm=44;b.Hi=16;b.kz=20; b.wt=20;b.Im=10;b.up=0;b.vp=32;b.My=.1;b.er=!1;b.Un=0;b.K=null;b.qo=null;b.lr=0;b.Bg=0;b.jw=0;b.Ax=0; b.Ja=function(){this.K=h.g.m.L("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var c=h.g.m.L("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.K);h.g.m.L("rect",{width:this.lk,height:this.qm,y:this.Hi},c);var d=h.g.m.L("image",{width:h.Ni.width,x:-this.up,height:h.Ni.height,y:-this.vp,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.K);d.setAttributeNS(h.g.m.Ge,"xlink:href",this.s.options.Bj+h.Ni.url);c=h.g.m.L("clipPath",{id:"blocklyTrashLidClipPath"+a},this.K); h.g.m.L("rect",{width:this.lk,height:this.Hi},c);this.qo=h.g.m.L("image",{width:h.Ni.width,x:-this.up,height:h.Ni.height,y:-this.vp,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.K);this.qo.setAttributeNS(h.g.m.Ge,"xlink:href",this.s.options.Bj+h.Ni.url);h.pa(this.K,"mouseup",this,this.click);h.ed(d,"mouseover",this,this.CC);h.ed(d,"mouseout",this,this.AC);this.Ep();return this.K}; b.ua=function(a){0this.Un&&1>this.Bg&&(this.lr=setTimeout(this.Ep.bind(this),20))};function Jd(a,c){var d=a.s.Ya==h.fg||a.s.Hf&&a.s.G;a.qo.setAttribute("transform","rotate("+(d?-c:c)+","+(d?4:a.lk-4)+","+(a.Hi-2)+")")}b.close=function(){Ua(this,!1)}; b.click=function(){if(this.nh.length){for(var a=[],c=0,d;d=this.nh[c];c++)a[c]=h.N.Qg(d);this.O.show(a)}};b.CC=function(){this.nh.length&&Ua(this,!0)};b.AC=function(){Ua(this,!1)}; b.PC=function(a){if(!(0>=this.s.options.Tn)&&a.type==h.i.Zx&&"shadow"!=a.Ir.tagName.toLowerCase()){for(var c=a=a.Ir.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=h.N.Fc(a);if(-1==this.nh.indexOf(a)){for(this.nh.unshift(a);this.nh.length>this.s.options.Tn;)this.nh.pop();this.Un=this.My;Jd(this,45*this.Un)}}};h.Xg=function(){h.Xg.w.constructor.call(this)};h.g.object.S(h.Xg,h.Am);h.Xg.prototype.next=function(){var a=this.tb;if(!a)return null;(a=a.next())&&I(this,a);return a};h.Xg.prototype.$k=function(){return null};h.Xg.prototype.We=function(){var a=this.tb;if(!a)return null;(a=a.We())&&I(this,a);return a};h.Xg.prototype.Bl=function(){return null};h.Zj=function(a){a.uc=this.Uk.bind(this);a.Og=this.jx.bind(this);this.s=new h.Ua(a);this.s.oe=!0;this.s.ks(new h.Xg);this.s.ix(new h.Xf);this.G=!!a.G;this.Nj=a.Ya;this.yq=[];this.tl=[];this.tk=[];this.Kc=[];this.Qr=[];this.Kj=this.s.Mf.B.eg};b=h.Zj.prototype;b.Ui=!0;b.Ag=!1;b.mh=!0;b.fb=8;b.Wf=h.Zj.prototype.fb;b.Ky=3*h.Zj.prototype.Wf;b.Ly=3*h.Zj.prototype.Wf;b.rp=2;b.bb=0;b.fc=0;b.kB=70; b.Ja=function(a){this.K=h.g.m.L(a,{"class":"blocklyFlyout",style:"display: none"},null);this.Zb=h.g.m.L("path",{"class":"blocklyFlyoutBackground"},this.K);this.K.appendChild(this.s.Ja());this.s.$b.subscribe(this.Zb,"flyout","fill");this.s.$b.subscribe(this.Zb,"flyoutOpacity","fill-opacity");return this.K}; b.ua=function(a){this.rb=a;this.s.ki=a;this.Xb=new h.Ca(this.s,this.nj,!1,"blocklyFlyoutScrollbar");this.ta();Array.prototype.push.apply(this.yq,h.pa(this.K,"wheel",this,this.XD));this.Ui||(this.sn=this.zq.bind(this),K(this.rb,this.sn));Array.prototype.push.apply(this.yq,h.pa(this.Zb,"mousedown",this,this.Eg));this.s.rg=this.rb.rg.bind(this.rb);this.s.Aa=this.rb.Aa;a=this.s;a.Ig=new h.Bp(a)}; b.J=function(){this.ta();h.Za(this.yq);this.sn&&(eb(this.rb,this.sn),this.sn=null);this.Xb&&(this.Xb.J(),this.Xb=null);this.s&&(this.s.$b.unsubscribe(this.Zb),this.s.ki=null,this.s.J(),this.s=null);this.K&&(h.g.m.removeNode(this.K),this.K=null);this.rb=this.Zb=null};b.Df=function(){return this.bb};b.ij=function(){return this.s};b.isVisible=function(){return this.Ag};b.yb=function(a){var c=a!=this.isVisible();this.Ag=a;c&&this.gm()};b.bi=function(a){var c=a!=this.mh;this.mh=a;c&&this.gm()}; b.gm=function(){var a=this.mh?this.isVisible():!1;this.K.style.display=a?"block":"none";this.Xb.bi(a)};b.ta=function(){if(this.isVisible()){this.yb(!1);for(var a=0,c;c=this.Kc[a];a++)h.Za(c);this.Kc.length=0;this.Jg&&(eb(this.s,this.Jg),this.Jg=null)}}; b.show=function(a){this.s.Yb(!1);this.ta();Kd(this);if("string"==typeof a){a=this.s.ki.zs[a]||null;if("function"!=typeof a)throw TypeError("Couldn't find a callback function when opening a toolbox category.");a=a(this.s.ki);if(!Array.isArray(a))throw TypeError("Result of toolbox category callback must be an array.");}this.yb(!0);var c=[],d=[];this.Qr.length=0;for(var e=this.nj?this.Ky:this.Ly,f=0,g;g=a[f];f++)if(g.tagName)switch(g.tagName.toUpperCase()){case "BLOCK":var k=h.N.dj(g,this.s);k.isEnabled()|| this.Qr.push(k);c.push({type:"block",block:k});g=parseInt(g.getAttribute("gap"),10);d.push(isNaN(g)?e:g);break;case "SEP":g=parseInt(g.getAttribute("gap"),10);!isNaN(g)&&0Math.abs(a-c)&&(c+=this.WI*this.rb.options.Vb.scale));return new h.g.Rect(-1E9,1E9,c,1E9)};h.g.v={};h.g.v.Ea=function(a,c){return" "+a+","+c+" "};h.g.v.curve=function(a,c){return" "+a+c.join("")};h.g.v.moveTo=function(a,c){return" M "+a+","+c+" "};h.g.v.moveBy=function(a,c){return" m "+a+","+c+" "};h.g.v.lineTo=function(a,c){return" l "+a+","+c+" "};h.g.v.line=function(a){return" l"+a.join("")};h.g.v.W=function(a,c){return" "+a+" "+c+" "};h.g.v.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};h.j.Wg=function(){this.Be=0;this.Gz=3;this.Ae=5;this.yt=8;this.Cc=10;this.Xt=this.Ae;this.wp=15;this.hk=5;this.eg=8;this.vz=15;this.uz=4;this.rz=12;this.Ay=16;this.fb=8;this.Km=15;this.Lz=0;this.Mz=20;this.Yx=4;this.Jz=15;this.Kz=100;this.Iz=15;this.Zo=24;this.Cy=14.5;this.By=this.wp+11;this.Ey=2;this.Dy=this.Zo;this.St=h.g.v.moveBy(0,0);this.Yy=12;this.Zy=6};b=h.j.Wg.prototype; b.ua=function(){this.Gi=this.pr();this.Ii=this.qr();this.rf=this.vr();this.bh=this.rr();var a=this.fb,c=h.g.v.arc("a","0 0,0",a,h.g.v.Ea(-a,a)),d=h.g.v.arc("a","0 0,0",a,h.g.v.Ea(a,a));this.ak={width:a,height:a,Pr:c,$n:d};c=this.fb;a=h.g.v.moveBy(0,c)+h.g.v.arc("a","0 0,1",c,h.g.v.Ea(c,-c));c=h.g.v.arc("a","0 0,1",c,h.g.v.Ea(-c,-c));this.Ft={As:a,Np:c}};b.pr=function(){var a=this.Yy,c=this.Zy,d=h.g.v.line([h.g.v.Ea(6,3),h.g.v.Ea(-12,6),h.g.v.Ea(6,3)]);return{height:a,width:c,path:d}}; b.vr=function(){var a=this.Jz,c=this.Kz,d=h.g.v.curve("c",[h.g.v.Ea(30,-a),h.g.v.Ea(70,-a),h.g.v.Ea(c,0)]);return{height:a,width:c,path:d}};b.rr=function(){function a(g){g=g?-1:1;var k=-g,l=d/2,m=h.g.v.Ea(c,g*l);return h.g.v.curve("c",[h.g.v.Ea(0,g*(l+2.5)),h.g.v.Ea(-c,k*(l+.5)),h.g.v.Ea(-c,g*l)])+h.g.v.curve("s",[h.g.v.Ea(c,2.5*k),m])}var c=this.eg,d=this.wp,e=a(!0),f=a(!1);return{width:c,height:d,Md:f,Cl:e}}; b.qr=function(){function a(k){return h.g.v.line([h.g.v.Ea(k*e,d),h.g.v.Ea(3*k,0),h.g.v.Ea(k*e,-d)])}var c=this.vz,d=this.uz,e=(c-3)/2,f=a(1),g=a(-1);return{width:c,height:d,Hg:f,Kw:g}};h.j.u={NONE:0,ud:1,ht:2,kt:4,tp:8,Ps:16,qt:32,gt:64,lf:128,nt:256,Tt:512,ny:1024,jp:2048,ap:4096,xz:8192,Jo:16384,Wo:32768,Vo:65536,np:131072,mp:262144,ut:524288,pp:1048576,zp:2097152,Fo:4194304,ot:8388608};h.j.u.NF=h.j.u.Wo|h.j.u.Vo;h.j.u.wH=h.j.u.np|h.j.u.mp;h.j.u.Er=16777216;h.j.u.qb=function(){h.j.u.hasOwnProperty(void 0)||(h.j.u[void 0]=h.j.u.Er,h.j.u.Er<<=1);return h.j.u[void 0]};h.j.u.hl=function(a){return a.type&h.j.u.ud};h.j.u.Jh=function(a){return a.type&h.j.u.ht}; h.j.u.tj=function(a){return a.type&h.j.u.kt};h.j.u.qe=function(a){return a.type&h.j.u.tp};h.j.u.OI=function(a){return a.type&h.j.u.qt};h.j.u.pe=function(a){return a.type&h.j.u.lf};h.j.u.fl=function(a){return a.type&h.j.u.gt};h.j.u.wg=function(a){return a.type&h.j.u.nt};h.j.u.kl=function(a){return a.type&h.j.u.Tt};h.j.u.vj=function(a){return a.type&h.j.u.jp};h.j.u.zg=function(a){return a.type&h.j.u.ap};h.j.u.oC=function(a){return a.type&(h.j.u.jp|h.j.u.ap)};h.j.u.yg=function(a){return a.type&h.j.u.Vo}; h.j.u.RI=function(a){return a.type&h.j.u.mp};h.j.u.jl=function(a){return a.type&h.j.u.Wo};h.j.u.SI=function(a){return a.type&h.j.u.np};h.j.u.NI=function(a){return a.type&h.j.u.Jo};h.j.u.dw=function(a){return a.type&h.j.u.ut};h.j.u.TI=function(a){return a.type&h.j.u.pp};h.j.u.MI=function(a){return a.type&h.j.u.Ps};h.j.u.Pn=function(a){return a.type&h.j.u.zp};h.j.u.In=function(a){return a.type&h.j.u.Fo};h.j.u.UI=function(a){return a.type&(h.j.u.zp|h.j.u.Fo)};h.j.u.QI=function(a){return a.type&h.j.u.ot};h.j.Yf=function(a){this.height=this.width=0;this.type=h.j.u.NONE;this.hg=this.Ba=0;this.B=a;this.Ld=this.B.Km};h.j.na=function(a,c){h.j.na.w.constructor.call(this,a);this.Xp=c;a:switch(a=this.B,c.type){case h.Sa:case h.Vd:c=a.bh;break a;case h.Xd:case h.Ga:c=a.Ii;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=h.j.u.ny};h.g.object.S(h.j.na,h.j.Yf);h.j.ip=function(a,c){h.j.ip.w.constructor.call(this,a,c);this.type|=h.j.u.xz;this.height=this.shape.height;this.width=this.shape.width;this.Fd=this.B.hk;this.qd=this.width};h.g.object.S(h.j.ip,h.j.na); h.j.kp=function(a,c){h.j.kp.w.constructor.call(this,a,c);this.type|=h.j.u.jp;this.height=this.shape.height;this.width=this.shape.width};h.g.object.S(h.j.kp,h.j.na);h.j.bp=function(a,c){h.j.bp.w.constructor.call(this,a,c);this.type|=h.j.u.ap;this.height=this.shape.height;this.width=this.shape.width};h.g.object.S(h.j.bp,h.j.na);h.j.bk=function(a,c){h.j.bk.w.constructor.call(this,a,c.connection);this.type|=h.j.u.lf;this.input=c;this.align=c.align;(this.lh=c.connection&&z(c.connection)?z(c.connection):null)?(a=G(this.lh),this.Bk=a.width,this.gn=a.height):this.gn=this.Bk=0;this.connection=c.connection;this.Fd=0};h.g.object.S(h.j.bk,h.j.na); h.j.Vf=function(a,c){h.j.Vf.w.constructor.call(this,a,c);this.type|=h.j.u.nt;this.lh?(this.width=this.Bk,this.height=this.gn):(this.height=this.B.By,this.width=this.shape.width+this.B.Cy);this.Fd=this.B.hk;this.Ck=this.shape.height;this.lg=this.shape.width};h.g.object.S(h.j.Vf,h.j.bk);h.j.dg=function(a,c){h.j.dg.w.constructor.call(this,a,c);this.type|=h.j.u.Tt;this.height=this.lh?this.gn+this.B.Lz:this.B.Dy;this.width=this.B.Km+this.shape.width};h.g.object.S(h.j.dg,h.j.bk); h.j.Cm=function(a,c){h.j.Cm.w.constructor.call(this,a,c);this.type|=h.j.u.gt;this.height=this.lh?this.gn-2*this.B.hk:this.shape.height;this.width=this.shape.width+this.B.Ey;this.Fd=this.B.hk;this.Ck=this.shape.height;this.lg=this.shape.width};h.g.object.S(h.j.Cm,h.j.bk);h.j.xd=function(a,c){h.j.xd.w.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=h.j.u.kt;a=new h.g.Yd(h.xd.prototype.Qm,h.xd.prototype.Qm-2);this.height=a.height;this.width=a.width};h.g.object.S(h.j.xd,h.j.Yf);h.j.Uo=function(a){h.j.Uo.w.constructor.call(this,a);this.type|=h.j.u.ut;this.height=this.B.Gi.height;this.width=this.B.Gi.width};h.g.object.S(h.j.Uo,h.j.Yf); h.j.Fa=function(a,c){h.j.Fa.w.constructor.call(this,a);this.jv=c;this.Jc=c.kf&&!!c.A&&c.A.Jc();this.sB=!1;this.type|=h.j.u.ud;a=this.jv.Bf();this.height=a.height;this.width=a.width};h.g.object.S(h.j.Fa,h.j.Yf);h.j.Qo=function(a){h.j.Qo.w.constructor.call(this,a);this.type|=h.j.u.ht;this.height=this.B.rf.height;this.width=this.B.rf.width;this.Ti=this.height};h.g.object.S(h.j.Qo,h.j.Yf); h.j.Um=function(a,c){h.j.Um.w.constructor.call(this,a);this.type=(c&&"left"!=c?h.j.u.np:h.j.u.Wo)|h.j.u.Jo;this.width=this.height=this.B.Be};h.g.object.S(h.j.Um,h.j.Yf);h.j.Pm=function(a,c){h.j.Pm.w.constructor.call(this,a);this.type=(c&&"left"!=c?h.j.u.mp:h.j.u.Vo)|h.j.u.Jo;this.width=this.B.fb;this.height=this.B.fb/2};h.g.object.S(h.j.Pm,h.j.Yf);h.j.Ei=function(a,c){h.j.Ei.w.constructor.call(this,a);this.type=this.type|h.j.u.tp|h.j.u.qt;this.width=c;this.height=this.B.Iz};h.g.object.S(h.j.Ei,h.j.Yf);h.j.eh=function(a){this.type=h.j.u.pp;this.elements=[];this.Ba=this.bc=this.ef=this.minWidth=this.minHeight=this.width=this.height=0;this.Rv=this.Cn=this.Tq=this.Gc=this.Bh=!1;this.B=a;this.Ld=this.B.Km};h.j.eh.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function U(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(h.j.u.pe(d))return d;return null}h.j.eh.prototype.us=function(){return!0};h.j.eh.prototype.hv=function(){return!0}; function Nd(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(h.j.u.qe(d))return d;return null}h.j.Ri=function(a){h.j.Ri.w.constructor.call(this,a);this.type|=h.j.u.zp;this.Ti=this.vf=0;this.YB=!1;this.connection=null};h.g.object.S(h.j.Ri,h.j.eh);h.j.Ri.prototype.Uq=function(a){var c=a.Ef?"cap"===a.Ef:h.ra.rf,d=a.U&&z(a.U);return!!a.M||c||(d?u(d)==a:!1)}; h.j.Ri.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,h.j.u.qe(f)||(h.j.u.Jh(f)?d=Math.max(d,f.Ti):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.vf=this.Ti=d;this.ef=this.width};h.j.Ri.prototype.us=function(){return!1};h.j.xi=function(a){h.j.xi.w.constructor.call(this,a);this.type|=h.j.u.Fo;this.Sv=!1;this.connection=null;this.ih=this.Nk=0};h.g.object.S(h.j.xi,h.j.eh); h.j.xi.prototype.Uq=function(a){return!!a.M||!!u(a)};h.j.xi.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,h.j.u.qe(f)||(h.j.u.zg(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.Nk=d;this.ef=this.width};h.j.xi.prototype.us=function(){return!1}; h.j.Tm=function(a,c,d){h.j.Tm.w.constructor.call(this,a);this.type=this.type|h.j.u.tp|h.j.u.Ps;this.width=d;this.height=c;this.qv=!1;this.ef=0;this.elements=[new h.j.Ei(this.B,d)]};h.g.object.S(h.j.Tm,h.j.eh);h.j.Tm.prototype.measure=function(){};h.j.Fi=function(a){h.j.Fi.w.constructor.call(this,a);this.type|=h.j.u.ot;this.Ju=0};h.g.object.S(h.j.Fi,h.j.eh); h.j.Fi.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,h.j.u.pe(d)&&(h.j.u.kl(d)?a+=d.Bk:h.j.u.fl(d)&&0!=d.Bk&&(a+=d.Bk-d.lg)),h.j.u.qe(d)||(this.height=Math.max(this.height,d.height));this.Ju=a;this.ef=this.width+a};h.j.Fi.prototype.hv=function(){return!this.Bh&&!this.Gc};h.j.ag=function(a,c){this.R=c;this.Mf=a;this.B=this.Mf.B;this.M=c.M?new h.j.ip(this.B,c.M):null;this.dr=Ja(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.xg=c.xg();this.G=c.G;this.gi=this.width=this.Qj=this.height=0;this.rows=[];this.Wv=[];this.Hb=new h.j.Ri(this.B);this.pb=new h.j.xi(this.B);this.no=this.qd=0};b=h.j.ag.prototype; b.measure=function(){var a=this.R.Ef?"cap"===this.R.Ef:h.ra.rf,c=!!this.R.U;this.Hb.Uq(this.R)?this.Hb.elements.push(new h.j.Um(this.B)):this.Hb.elements.push(new h.j.Pm(this.B));a?(a=new h.j.Qo(this.B),this.Hb.elements.push(a),this.Hb.vf=a.Ti):c&&(this.Hb.YB=!0,this.Hb.connection=new h.j.kp(this.B,this.R.U),this.Hb.elements.push(this.Hb.connection));this.R.P.length&&this.R.P[0].type==h.Ga&&!this.R.isCollapsed()?this.Hb.minHeight=this.B.Cc:this.Hb.minHeight=this.B.Ae;this.rows.push(this.Hb);a=new h.j.Fi(this.B); var d=Pa(this.R);if(d.length){c=0;for(var e;e=d[c];c++){var f=new h.j.xd(this.B,e);this.isCollapsed&&e.Cu?this.Wv.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.R.P[c];c++)if(d.isVisible()){!e||d.type!=h.Ga&&e.type!=h.Ga&&(d.type!=h.Sa&&d.type!=h.Qd||this.dr)||(this.rows.push(a),a=new h.j.Fi(this.B));for(e=0;f=d.La[e];e++)a.elements.push(new h.j.Fa(this.B,f,d));this.ou(d,a);e=d}this.isCollapsed&&(a.Rv=!0,a.elements.push(new h.j.Uo(this.B)));(a.elements.length||a.Cn)&&this.rows.push(a);this.pb.Sv= !!this.R.V;this.pb.minHeight=this.R.P.length&&this.R.P[this.R.P.length-1].type==h.Ga?this.B.Cc:this.B.Ae-1;this.pb.Uq(this.R)?this.pb.elements.push(new h.j.Um(this.B)):this.pb.elements.push(new h.j.Pm(this.B));this.pb.Sv&&(this.pb.connection=new h.j.bp(this.B,this.R.V),this.pb.elements.push(this.pb.connection));this.rows.push(this.pb);for(a=0;c=this.rows[a];a++){d=c.elements;c.elements=[];c.us()&&c.elements.push(new h.j.Ei(this.B,this.yn(null,d[0])));for(e=0;ea.Hc&&(a.Y+=h.g.v.W("V",c.bc+c.height-a.Hc)))};h.ca.dh=function(a){this.ji=a;this.Zl=h.g.m.L("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.ji);this.Jj=h.g.m.L("path",{"class":"blocklyPath"},this.ji);this.am=h.g.m.L("path",{"class":"blocklyPathLight"},this.ji)};h.ca.dh.prototype.ns=function(a,c){this.Jj.setAttribute("d",a);this.Zl.setAttribute("d",a);this.am.setAttribute("d",c)}; h.ca.dh.prototype.Aq=function(){this.Jj.setAttribute("transform","scale(-1 1)");this.am.setAttribute("transform","scale(-1 1)");this.Zl.setAttribute("transform","translate(1,1) scale(-1 1)")};h.ca.Vf=function(a,c){h.ca.Vf.w.constructor.call(this,a,c);this.lh&&(this.width+=this.B.Bc,this.height+=this.B.Bc)};h.g.object.S(h.ca.Vf,h.j.Vf);h.ca.dg=function(a,c){h.ca.dg.w.constructor.call(this,a,c);this.lh&&(this.height+=this.B.Bc)};h.g.object.S(h.ca.dg,h.j.dg);h.ca.ag=function(a,c){h.ca.ag.w.constructor.call(this,a,c)};h.g.object.S(h.ca.ag,h.j.ag);b=h.ca.ag.prototype;b.ou=function(a,c){this.dr&&a.type==h.Sa?(c.elements.push(new h.ca.Vf(this.B,a)),c.Tq=!0):a.type==h.Ga?(c.elements.push(new h.ca.dg(this.B,a)),c.Gc=!0):a.type==h.Sa?(c.elements.push(new h.j.Cm(this.B,a)),c.Bh=!0):a.type==h.Qd&&(c.Cn=!0)}; b.yn=function(a,c){if(!a)return c&&h.j.u.hl(c)&&c.Jc?this.B.Ae:c&&h.j.u.wg(c)?this.B.yt:c&&h.j.u.kl(c)?this.B.Mz:this.B.Cc;if(!h.j.u.pe(a)&&!c)return h.j.u.hl(a)&&a.Jc?this.B.Ae:h.j.u.tj(a)?2*this.B.Cc+1:h.j.u.Jh(a)?this.B.Be:h.j.u.oC(a)?this.B.Cc:h.j.u.yg(a)?this.B.rz:h.j.u.dw(a)?this.B.Be:this.B.Cc;if(h.j.u.pe(a)&&!c){if(h.j.u.fl(a))return this.B.Be;if(h.j.u.wg(a))return this.B.Cc;if(h.j.u.kl(a))return this.B.Be}if(!h.j.u.pe(a)&&c&&h.j.u.pe(c)){if(a.Jc){if(h.j.u.wg(c)||h.j.u.fl(c))return this.B.Gz}else{if(h.j.u.wg(c)|| h.j.u.fl(c))return this.B.yt;if(h.j.u.kl(c))return this.B.Cc}return this.B.Cc-1}if(h.j.u.tj(a)&&c&&!h.j.u.pe(c))return this.B.Cc;if(h.j.u.wg(a)&&c&&!h.j.u.pe(c))return c.Jc?this.B.Ae:this.B.Cc;if(h.j.u.jl(a)&&c){if(h.j.u.Jh(c))return this.B.Be;if(h.j.u.vj(c))return c.Ld;if(h.j.u.zg(c))return a=(this.G?1:-1)*this.B.Bc/2,c.Ld+a}if(h.j.u.yg(a)&&c){if(h.j.u.vj(c))return c.Ld-this.B.fb;if(h.j.u.zg(c))return a=(this.G?1:-1)*this.B.Bc/2,c.Ld-this.B.fb+a}return!h.j.u.pe(a)&&c&&!h.j.u.pe(c)&&a.Jc==c.Jc||c&& h.j.u.dw(c)?this.B.Cc:this.B.Ae};b.Dp=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(h.j.u.qe(e)){d=e;break a}d=null}e=Nd(a);if(a.Bh||a.Gc)a.ef+=c;var f=U(a);f?f.align==h.Co?e.width+=c:f.align==h.Js?(d.width+=c/2,e.width+=c/2):f.align==h.Ks&&(d.width+=c):e.width+=c;a.width+=c};b.Fv=function(a,c){return h.j.u.Pn(a)&&h.j.u.In(c)?this.B.Ay:h.j.u.Pn(a)||h.j.u.In(c)?this.B.Be:a.Bh&&c.Bh?this.B.Cc:!a.Gc&&c.Gc?this.B.Yx:a.Gc&&c.Gc||!a.Gc&&c.Cn?this.B.Cc:this.B.Ae}; b.yv=function(a,c){if(h.j.u.qe(c))return a.bc+c.height/2;if(h.j.u.In(a))return a=a.bc+a.height-a.Nk,h.j.u.zg(c)?a+c.height/2:a-c.height/2;if(h.j.u.Pn(a))return h.j.u.Jh(c)?a.vf-c.height/2:a.vf+c.height/2;var d=a.bc;h.j.u.hl(c)||h.j.u.tj(c)?(d+=c.height/2,(a.Tq||a.Gc)&&c.height+this.B.Xt<=a.height&&(d+=this.B.Xt)):d=h.j.u.wg(c)?d+c.height/2:d+a.height/2;return d}; b.kv=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.bc=c;e.Ba=this.qd;c+=e.height;a=Math.max(a,e.ef);var f=c-this.Hb.Ti;e==this.pb&&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},Dr:function(){10>Q?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+P+"&level="+(Q+1):X.En()},Dn:function(a,c){if(a){var d=a.match(/^block_id_([^']+)$/);d&&(a=d[1])}uc(a,c)},LI:function(a,c){a=document.getElementById(a); a.firstChild||(a=h.vg(a,{rtl:-1!=Wc.indexOf(P),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),h.N.wh(h.N.Qg(c),a))},ID:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},Oe:function(a){if("click"==a.type&&"touchend"==X.Oe.Ur&&X.Oe.Sr+2E3>Date.now()||X.Oe.Ur==a.type&&X.Oe.Sr+400>Date.now())return a.preventDefault(),a.stopPropagation(),!0;X.Oe.Ur=a.type;X.Oe.Sr=Date.now();return!1}};X.Oe.Ur=null;X.Oe.Sr=0; X.dC=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};X.eC=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=X;X.setCode=X.gx;X.getCode=X.Hq;X.getWorkspace=X.ij;var W={Hh:!1,Wu:null,ln:null,Sl:function(a,c,d,e,f,g){function k(){W.Hh&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);W.Hh&&W.Oc(!1);h.gb()&&h.vc(!0);W.Hh=!0;W.Wu=c;W.ln=g;var l=document.getElementById("dialog");g=document.getElementById("dialogShadow");var m=document.getElementById("dialogBorder"),n;for(n in f)l.style[n]=f[n];e&&(g.style.visibility="visible",g.style.opacity=.3,g.style.zIndex=9,e=document.createElement("div"), e.id="dialogHeader",l.appendChild(e),W.bq=h.ed(e,"mousedown",null,W.$A));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(W.Sn(c,!1,.2),W.Sn(l,!0,.8),setTimeout(k,175)):k()},Xu:0,Yu:0,$A:function(a){W.fq();if(!h.g.wj(a)){var c=document.getElementById("dialog");W.Xu=c.offsetLeft-a.clientX;W.Yu=c.offsetTop-a.clientY;W.eq=h.ed(document,"mouseup",null,W.fq);W.cq=h.ed(document,"mousemove",null,W.aB);a.stopPropagation()}},aB:function(a){var c=document.getElementById("dialog"), d=W.Xu+a.clientX;a=W.Yu+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"},fq:function(){W.eq&&(h.Za(W.eq),W.eq=null);W.cq&&(h.Za(W.cq),W.cq=null)},Oc:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(W.Hh){W.fq();W.bq&&(h.Za(W.bq),W.bq=null);W.Hh=!1;W.ln&&W.ln();W.ln=null;var d=!1===a? null:W.Wu;a=document.getElementById("dialog");var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(W.Sn(a,!1,.8),W.Sn(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)}},Sn:function(a,c,d){function e(){f.style.width=g.width+"px";f.style.height=g.height+"px";f.style.left=g.x+"px";f.style.top= g.y+"px";f.style.opacity=d}if(a){var f=document.getElementById("dialogBorder"),g=W.yB(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},yB:function(a){var c=h.g.style.zh(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},ux:function(a,c){var d=document.getElementById("containerStorage");d.textContent="";c=c.split("\n");for(var e=0;eQ?R("Games_nextLevel").replace("%1",String(Q+1)):R("Games_finalLevel");c=document.getElementById("doneCancel");c.addEventListener("click", W.Oc,!0);c.addEventListener("touchend",W.Oc,!0);c=document.getElementById("doneOk");c.addEventListener("click",X.Dr,!0);c.addEventListener("touchend",X.Dr,!0);W.Sl(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",W.Iu,!0)});document.body.addEventListener("keydown",W.Iu,!0);document.getElementById("dialogDoneText").textContent=d},Vu:function(a){!W.Hh||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(W.Oc(!0),a.stopPropagation(),a.preventDefault())}, DD:function(){document.body.addEventListener("keydown",W.Vu,!0)},HD:function(){document.body.removeEventListener("keydown",W.Vu,!0)},Iu:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)W.Oc(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&X.Dr()},lu:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)W.Oc(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&X.En()},rv:function(a){27==a.keyCode?W.Oc(!0):13==a.keyCode&&W.Cq()},Cq: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 g=200==f.status?R("Games_submitted"):R("Games_httpRequestError")+"\nStatus: "+f.status;W.ux(null,g)}};f.send(c.join("&"));W.Oc(!0)}else a.value="",a.focus()}}; window.BlocklyDialogs=W;W.hideDialog=W.Oc;var fd="bird";function Y(a,c,d,e){this.nm=a;this.om=c;this.x1=d;this.y1=e}Y.prototype.ng=function(a){var c=this.x1-this.nm,d=this.y1-this.om,e=(a.x-this.nm)*c+(a.y-this.om)*d,f=c*c+d*d;e=f?e/f:-1;return h.g.I.ng(a,0>e?new h.g.I(this.nm,this.om):1f;f+=.1){if(c){var g=document.createElementNS(h.g.m.nc,"line");g.setAttribute("class","edges");g.setAttribute("x1",400*f);g.setAttribute("y1",400);g.setAttribute("x2",400*f);g.setAttribute("y2",400-9*e);a.appendChild(g)}d&&(g=document.createElementNS(h.g.m.nc,"line"),g.setAttribute("class","edges"),g.setAttribute("x1",0),g.setAttribute("y1",400*f),g.setAttribute("x2",9*e),g.setAttribute("y2",400*f),a.appendChild(g));2==e&&(c&&(g=document.createElementNS(h.g.m.nc,"text"), g.setAttribute("class","edgeX"),g.setAttribute("x",400*f+2),g.setAttribute("y",396),g.appendChild(document.createTextNode(Math.round(100*f))),a.appendChild(g)),d&&(g=document.createElementNS(h.g.m.nc,"text"),g.setAttribute("class","edgeY"),g.setAttribute("x",3),g.setAttribute("y",400*f-2),g.appendChild(document.createTextNode(Math.round(100-100*f))),a.appendChild(g)));e=1==e?2:1}} window.addEventListener("load",function(){function a(){d.style.top=Math.max(10,e.offsetTop-window.pageYOffset)+"px";d.style.left=c?"10px":"420px";d.style.width=window.innerWidth-440+"px"}document.body.innerHTML=Id();X.ua();var c=-1!=Wc.indexOf(P),d=document.getElementById("blockly"),e=document.getElementById("visualization");window.addEventListener("scroll",function(){a(null);h.bm(C)});window.addEventListener("resize",a);a(null);var f=document.getElementById("toolbox");C=h.vg("blockly",{media:"third-party/blockly/media/", rtl:c,toolbox:f,trashcan:!0});C.Bd.load(["bird/quack.ogg","bird/quack.mp3"],"quack");C.Bd.load(["bird/whack.mp3","bird/whack.ogg"],"whack");C.Bd.load(["bird/worm.mp3","bird/worm.ogg"],"worm");1':5>Q?'':'';X.rC(f,!1);ee();gd("runButton",fe);gd("resetButton",ge); setTimeout(function(){K(C,function(){he()});he()},5E3);890<")&&-1!=c.indexOf("bird_heading")||h.T.isVisible()||(g={width:"370px",top:"140px"},g[a?"right":"left"]="215px",f=D(C,!0),f=f.length?f[0].aa():d[0].aa());else if(2==Q)-1==c.indexOf("bird_noWorm")&&(g={width:"350px",top:"170px"},g[a?"right":"left"]="180px",f=d[1].aa());else if(4==Q)-1==c.indexOf("bird_compare")&&(g={width:"350px", top:"230px"},g[a?"right":"left"]="180px",f=d[2].aa());else if(5==Q){if(ie||(ie=setInterval(he,100)),-1==c.indexOf("mutation else")){f=D(C,!1);for(g=0;(d=f[g])&&"controls_if"!=d.type;g++);d.se.isVisible()?(e=document.getElementById("dialogMutatorHelp"),f=d.se.s.O.tl[1],c=h.g.style.zh(f),g={width:"340px",top:c.y+60+"px"},g.left=c.x-(a?310:0)+"px"):(c=h.g.style.zh(d.aa()),g={width:"340px",top:c.y+100+"px"},g.left=c.x-(a?280:0)+"px",f=d.aa())}}else if(6==Q){if(-1==c.indexOf("mutation")){f=D(C,!1);for(g= 0;(d=f[g])&&"controls_if"!=d.type;g++);c=h.g.style.zh(d.aa());g={width:"350px",top:c.y+220+"px"};g.left=c.x-(a?350:0)+"px";f=d.aa()}}else 8==Q&&-1==c.indexOf("bird_and")&&(g={width:"350px",top:"360px"},g[a?"right":"left"]="450px",f=d[4].aa());g?e.parentNode!=document.getElementById("dialog")&&W.Sl(e,f,!0,!1,g,null):W.Oc(!1)}} function ee(){for(var a=0;ah.g.I.ng(S,Z.nd))throw md.push(["play","quack",null]),me(Z.nd),md.push(["finish",null]),!0;!ld&&Z.zc&&15>h.g.I.ng(S,Z.zc)&&(me(Z.zc),md.push(["worm",null]),md.push(["play","worm",null]),ld=!0);a:{for(d=0;e=Z.xc[d];d++)if(6>e.ng(S)){d=!0;break a}d=!1}if(d)throw md.push(["play","whack",null]),!1;}));a.setProperty(c,"noWorm", a.createNativeFunction(function(){return!ld}));a.setProperty(c,"getX",a.createNativeFunction(function(){return S.x}));a.setProperty(c,"getY",a.createNativeFunction(function(){return S.y}))} function ke(){if("Interpreter"in window){md=[];h.selected&&mb(h.selected);var a=Oc(),c=a.indexOf("if ("),d=a.indexOf("}\n");-1!=c&&-1!=d&&(a=a.substring(c,d+2));c=0;a=new Interpreter("while(true) {\n"+a+"}",le);try{for(d=1E5;a.step();)if(0>=d--)throw Infinity;c=-1}catch(e){Infinity===e?c=2:!0===e?c=1:!1===e?c=-2:(c=-2,window.alert(e))}id=1==c?10:15;ee();be.push(setTimeout(ne,1))}else setTimeout(ke,250)} function ne(){be=[];var a=md.shift();a?(X.Dn(a.pop()),"move"==a[0]||"goto"==a[0]?(S.x=a[1],S.y=a[2],jd=a[3],ce="move"==a[0]?2:1,je()):"worm"==a[0]?document.getElementById("worm").style.visibility="hidden":"finish"==a[0]?(ce=3,je(),X.rD(),W.MA()):"play"==a[0]&&C.Bd.play(a[1],.5),be.push(setTimeout(ne,5*id))):X.Dn(null)} function je(){var a=hd(kd-jd);10>=Math.abs(a)?kd=jd:(kd+=0>a?10:-10,kd=hd(kd));var c=(14-Math.round(kd/360*12))%12,d=kd%30;15<=d&&(d-=30);d*=-1;if(1==ce)var e=0;else if(3==ce)e=3;else if(2==ce)e=Math.round(Date.now()/100)%3;else throw Error("Unknown pose.");a=S.x/100*400-60;var f=400*(1-S.y/100)-60,g=document.getElementById("bird");g.setAttribute("x",a-120*c);g.setAttribute("y",f-120*e);g.setAttribute("transform","rotate("+d+", "+(a+60)+", "+(f+60)+")");c=document.getElementById("clipRect");c.setAttribute("x", a);c.setAttribute("y",f)}function me(a){var c=Math.round(h.g.I.ng(S,a));a=hd(h.g.Lb.wx(Math.atan2(a.y-S.y,a.x-S.x)));for(var d=h.g.Lb.li(a),e=0;e