// Automatically generated file.  Do not edit!

'use strict';var b,g={g:{}};g.g.global=function(){return"object"===typeof self?self:"object"===typeof window?window:"object"===typeof global?global:this}();
g.h={};g.g.global.Blockly||(g.g.global.Blockly={});g.g.global.Blockly.Msg||(g.g.global.Blockly.Msg=g.h);g.g.X=function(a,c){this.x=a;this.y=c};g.g.X.Je=function(a,c){return a==c?!0:a&&c?a.x==c.x&&a.y==c.y:!1};g.g.X.Ox=function(a,c){var d=a.x-c.x;a=a.y-c.y;return Math.sqrt(d*d+a*a)};g.g.X.UF=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};g.g.X.xm=function(a,c){return new g.g.X(a.x-c.x,a.y-c.y)};g.g.X.sum=function(a,c){return new g.g.X(a.x+c.x,a.y+c.y)};g.g.X.prototype.scale=function(a){this.x*=a;this.y*=a;return this};g.g.X.prototype.translate=function(a,c){this.x+=a;this.y+=c;return this};g.g.ib={};g.g.ib.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};g.g.ib.dv=function(a){return a.length?a.reduce(function(c,d){return c.length<d.length?c:d}).length:0};g.g.ib.VD=function(a,c){if(!a.length)return 0;if(1==a.length)return a[0].length;var d=0;c=c||g.g.ib.dv(a);for(var e=0;e<c;e++){for(var f=a[0][e],h=1;h<a.length;h++)if(f!=a[h][e])return d;" "==f&&(d=e+1)}for(h=1;h<a.length;h++)if((f=a[h][e])&&" "!=f)return d;return c};
g.g.ib.WD=function(a,c){if(!a.length)return 0;if(1==a.length)return a[0].length;var d=0;c=c||g.g.ib.dv(a);for(var e=0;e<c;e++){for(var f=a[0].substr(-e-1,1),h=1;h<a.length;h++)if(f!=a[h].substr(-e-1,1))return d;" "==f&&(d=e+1)}for(h=1;h<a.length;h++)if((f=a[h].charAt(a[h].length-e-1))&&" "!=f)return d;return c};g.g.ib.EA=function(a,c){a=a.split("\n");for(var d=0;d<a.length;d++)a[d]=g.g.ib.GH(a[d],c);return a.join("\n")};
g.g.ib.GH=function(a,c){if(a.length<=c)return a;for(var d=a.trim().split(/\s+/),e=0;e<d.length;e++)d[e].length>c&&(c=d[e].length);e=-Infinity;var f=1;do{var h=e;var k=a;a=[];var l=d.length/f,m=1;for(e=0;e<d.length-1;e++)m<(e+1.5)/l?(m++,a[e]=!0):a[e]=!1;a=g.g.ib.FA(d,a,c);e=g.g.ib.wv(d,a,c);a=g.g.ib.HH(d,a);f++}while(e>h);return k};
g.g.ib.wv=function(a,c,d){for(var e=[0],f=[],h=0;h<a.length;h++)e[e.length-1]+=a[h].length,!0===c[h]?(e.push(0),f.push(a[h].charAt(a[h].length-1))):!1===c[h]&&e[e.length-1]++;a=Math.max.apply(Math,e);for(h=c=0;h<e.length;h++)c-=2*Math.pow(Math.abs(d-e[h]),1.5),c-=Math.pow(a-e[h],1.5),-1!=".?!".indexOf(f[h])?c+=d/3:-1!=",;)]}".indexOf(f[h])&&(c+=d/4);1<e.length&&e[e.length-1]<=e[e.length-2]&&(c+=.5);return c};
g.g.ib.FA=function(a,c,d){for(var e=g.g.ib.wv(a,c,d),f,h=0;h<c.length-1;h++)if(c[h]!=c[h+1]){var k=[].concat(c);k[h]=!k[h];k[h+1]=!k[h+1];var l=g.g.ib.wv(a,k,d);l>e&&(e=l,f=k)}return f?g.g.ib.FA(a,f,d):c};g.g.ib.HH=function(a,c){for(var d=[],e=0;e<a.length;e++)d.push(a[e]),void 0!==c[e]&&d.push(c[e]?"\n":" ");return d.join("")};g.g.ge=function(a,c){this.width=a;this.height=c};g.g.ge.Je=function(a,c){return a==c?!0:a&&c?a.width==c.width&&a.height==c.height:!1};g.g.style={};g.g.style.Tg=function(a){if("none"!=g.g.style.Dy(a,"display"))return g.g.style.By(a);var c=a.style,d=c.display,e=c.visibility,f=c.position;c.visibility="hidden";c.position="absolute";c.display="inline";var h=a.offsetWidth;a=a.offsetHeight;c.display=d;c.position=f;c.visibility=e;return new g.g.ge(h,a)};g.g.style.By=function(a){return new g.g.ge(a.offsetWidth,a.offsetHeight)};g.g.style.Dy=function(a,c){return g.g.style.getComputedStyle(a,c)||g.g.style.WE(a,c)||a.style&&a.style[c]};
g.g.style.getComputedStyle=function(a,c){return document.defaultView&&document.defaultView.getComputedStyle&&(a=document.defaultView.getComputedStyle(a,null))?a[c]||a.getPropertyValue(c)||"":""};g.g.style.WE=function(a,c){return a.currentStyle?a.currentStyle[c]:null};g.g.style.Fp=function(a){var c=new g.g.X(0,0);a=a.getBoundingClientRect();var d=document.documentElement;d=new g.g.X(window.pageXOffset||d.scrollLeft,window.pageYOffset||d.scrollTop);c.x=a.left+d.x;c.y=a.top+d.y;return c};
g.g.style.Hy=function(){var a=document.body,c=document.documentElement;return new g.g.X(a.scrollLeft||c.scrollLeft,a.scrollTop||c.scrollTop)};g.g.style.Zu=function(a,c){a.style.display=c?"":"none"};g.g.style.Wk=function(){return"rtl"==g.g.style.Dy(void 0,"direction")};
g.g.style.TE=function(a){var c=g.g.style.getComputedStyle(a,"borderLeftWidth"),d=g.g.style.getComputedStyle(a,"borderRightWidth"),e=g.g.style.getComputedStyle(a,"borderTopWidth");a=g.g.style.getComputedStyle(a,"borderBottomWidth");return{top:parseFloat(e),right:parseFloat(d),bottom:parseFloat(a),left:parseFloat(c)}};g.g.style.Wu=function(a,c){a=g.g.style.YE(a,c);c.scrollLeft=a.x;c.scrollTop=a.y};
g.g.style.YE=function(a,c){var d=g.g.style.Fp(a),e=g.g.style.Fp(c),f=g.g.style.TE(c),h=d.x-e.x-f.left;d=d.y-e.y-f.top;a=g.g.style.By(a);e=c.clientHeight-a.height;f=c.scrollLeft;var k=c.scrollTop;f+=Math.min(h,Math.max(h-(c.clientWidth-a.width),0));k+=Math.min(d,Math.max(d-e,0));return new g.g.X(f,k)};g.g.userAgent={};
(function(a){function c(e){return-1!=d.indexOf(e.toUpperCase())}g.g.userAgent.raw=a;var d=g.g.userAgent.raw.toUpperCase();g.g.userAgent.wg=c("Trident")||c("MSIE");g.g.userAgent.Ao=c("Edge");g.g.userAgent.XB=c("JavaFX");g.g.userAgent.Wr=c("WebKit")&&!g.g.userAgent.Ao;g.g.userAgent.Eo=c("Gecko")&&!g.g.userAgent.Wr&&!g.g.userAgent.wg&&!g.g.userAgent.Ao;g.g.userAgent.zl=c("Android");g.g.userAgent.ck=c("iPad");g.g.userAgent.dw=c("iPod");g.g.userAgent.cw=c("iPhone")&&!g.g.userAgent.ck&&!g.g.userAgent.dw;
g.g.userAgent.kC=c("Macintosh");g.g.userAgent.WC=g.g.userAgent.ck||g.g.userAgent.zl&&!c("Mobile")||c("Silk");g.g.userAgent.sC=!g.g.userAgent.WC&&(g.g.userAgent.dw||g.g.userAgent.cw||g.g.userAgent.zl||c("IEMobile"))})(g.g.global.navigator&&g.g.global.navigator.userAgent||"");
g.g.jG=function(a){a.preventDefault();a.stopPropagation()};g.g.Yp=function(a){return"textarea"==a.target.type||"text"==a.target.type||"number"==a.target.type||"email"==a.target.type||"password"==a.target.type||"search"==a.target.type||"tel"==a.target.type||"url"==a.target.type||a.target.isContentEditable};
g.g.Me=function(a){var c=new g.g.X(0,0),d=a.getAttribute("x");d&&(c.x=parseInt(d,10));if(d=a.getAttribute("y"))c.y=parseInt(d,10);if(d=(d=a.getAttribute("transform"))&&d.match(g.g.Me.oD))c.x+=Number(d[1]),d[3]&&(c.y+=Number(d[3]));(a=a.getAttribute("style"))&&-1<a.indexOf("translate")&&(a=a.match(g.g.Me.pD))&&(c.x+=Number(a[1]),a[3]&&(c.y+=Number(a[3])));return c};
g.g.Jm=function(a){for(var c=0,d=0;a;){var e=g.g.Me(a);c+=e.x;d+=e.y;if(-1!=(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv "))break;a=a.parentNode}return new g.g.X(c,d)};g.g.Me.oD=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/;g.g.Me.pD=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/;g.g.jj=function(a){return a.ctrlKey&&g.g.userAgent.kC?!0:2==a.button};
g.g.ln=function(a,c,d){var e=c.createSVGPoint();e.x=a.clientX;e.y=a.clientY;d||(d=c.getScreenCTM().inverse());return e.matrixTransform(d)};g.g.Ay=function(a){switch(a.deltaMode){case 0:return{x:a.deltaX,y:a.deltaY};case 1:return{x:a.deltaX*g.hw,y:a.deltaY*g.hw};case 2:return{x:a.deltaX*g.pw,y:a.deltaY*g.pw}}};g.g.sH=function(a){return g.g.pv(a,!0)};g.g.nc=function(a){if("string"!=typeof a)return a;a=g.g.pv(a,!1);return a.length?a[0]:""};
g.g.gx=function(a){for(var c=g.h,d=a.match(/%{BKY_[A-Z]\w*}/ig),e=0;e<d.length;e++)void 0==c[d[e].toUpperCase().slice(6,-1)]&&console.log("WARNING: No message string for "+d[e]+" in "+a)};
g.g.pv=function(a,c){var d=[],e=a.split("");e.push("");var f=0;a=[];for(var h=null,k=0;k<e.length;k++){var l=e[k];0==f?"%"==l?((l=a.join(""))&&d.push(l),a.length=0,f=1):a.push(l):1==f?"%"==l?(a.push(l),f=0):c&&"0"<=l&&"9">=l?(f=2,h=l,(l=a.join(""))&&d.push(l),a.length=0):"{"==l?f=3:(a.push("%",l),f=0):2==f?"0"<=l&&"9">=l?h+=l:(d.push(parseInt(h,10)),k--,f=0):3==f&&(""==l?(a.splice(0,0,"%{"),k--,f=0):"}"!=l?a.push(l):(f=a.join(""),/[A-Z]\w*/i.test(f)?(l=f.toUpperCase(),(l=g.g.ib.startsWith(l,"BKY_")?
l.substring(4):null)&&l in g.h?(f=g.h[l],"string"==typeof f?Array.prototype.push.apply(d,g.g.pv(f,c)):c?d.push(String(f)):d.push(f)):d.push("%{"+f+"}")):d.push("%{"+f+"}"),f=a.length=0))}(l=a.join(""))&&d.push(l);c=[];for(k=a.length=0;k<d.length;++k)"string"==typeof d[k]?a.push(d[k]):((l=a.join(""))&&c.push(l),a.length=0,c.push(d[k]));(l=a.join(""))&&c.push(l);a.length=0;return c};g.g.Qg=function(){for(var a=g.g.Qg.lA.length,c=[],d=0;20>d;d++)c[d]=g.g.Qg.lA.charAt(Math.random()*a);return c.join("")};
g.g.Qg.lA="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
g.g.fj=function(){if(void 0!==g.g.fj.ws)return g.g.fj.ws;if(!g.g.global.getComputedStyle)return!1;var a=document.createElement("p"),c="none",d={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(a,null);for(var e in d)if(void 0!==a.style[e]){a.style[e]="translate3d(1px,1px,1px)";c=g.g.global.getComputedStyle(a);if(!c)return document.body.removeChild(a),!1;c=c.getPropertyValue(d[e])}document.body.removeChild(a);
g.g.fj.ws="none"!==c;return g.g.fj.ws};g.g.cA=function(a){if("object"!=typeof document)throw Error("Blockly.utils.runAfterPageLoad() requires browser document.");if("complete"==document.readyState)a();else var c=setInterval(function(){"complete"==document.readyState&&(clearInterval(c),a())},10)};g.g.gF=function(){var a=g.g.style.Hy();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}};
g.g.$o=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};g.g.bF=function(){var a=document.documentElement,c=window;return g.g.userAgent.wg&&c.pageYOffset!=a.scrollTop?new g.g.X(a.scrollLeft,a.scrollTop):new g.g.X(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};g.g.nt=function(a,c){var d=Object.create(null),e=p(a,!0);c&&(a=q(a))&&(a=e.indexOf(a),e.splice(a,e.length-a));for(a=0;c=e[a];a++)d[c.type]?d[c.type]++:d[c.type]=1;return d};
g.g.YG=function(a,c){var d=c.x;c=c.y;var e=aa(a).getBoundingClientRect();d=new g.g.X(d-e.left,c-e.top);c=g.g.Jm(a.jb);return g.g.X.xm(d,c).scale(1/a.scale)};
g.Touch={};g.Touch.Gw="ontouchstart"in g.g.global||!!(g.g.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!g.g.global.navigator||!g.g.global.navigator.maxTouchPoints&&!g.g.global.navigator.msMaxTouchPoints);g.Touch.Qn=null;g.Touch.Kf={};
g.g.global.PointerEvent?g.Touch.Kf={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:g.Touch.Gw&&(g.Touch.Kf={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});g.bq=0;
g.SF=function(a,c){g.Yh();a.changedTouches&&1!=a.changedTouches.length||(g.bq=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);c&&ba(c,a)},g.hC))};g.Yh=function(){g.bq&&(clearTimeout(g.bq),g.bq=0)};g.Touch.Bh=function(){g.Touch.Qn=null};g.Touch.ev=function(a){return!g.Touch.KF(a)||g.Touch.RD(a)};
g.Touch.Jp=function(a){return void 0!=a.pointerId?a.pointerId:a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?a.changedTouches[0].identifier:"mouse"};g.Touch.RD=function(a){var c=g.Touch.Jp(a);return void 0!==g.Touch.Qn&&null!==g.Touch.Qn?g.Touch.Qn==c:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(g.Touch.Qn=c,!0):!1};
g.Touch.$G=function(a){if(g.g.ib.startsWith(a.type,"touch")){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY}};g.Touch.KF=function(a){return g.g.ib.startsWith(a.type,"touch")||g.g.ib.startsWith(a.type,"mouse")||g.g.ib.startsWith(a.type,"pointer")};g.Touch.aq=function(a){return g.g.ib.startsWith(a.type,"touch")||g.g.ib.startsWith(a.type,"pointer")};
g.Touch.gH=function(a){var c=[];if(a.changedTouches)for(var d=0;d<a.changedTouches.length;d++)c[d]={type:a.type,changedTouches:[a.changedTouches[d]],target:a.target,stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()}};else c.push(a);return c};g.g.o={};g.g.o.Vl="http://www.w3.org/2000/svg";g.g.o.ak="http://www.w3.org/1999/xhtml";g.g.o.bf="http://www.w3.org/1999/xlink";g.g.o.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};g.g.o.Li=null;g.g.o.us=0;g.g.o.K=function(a,c,d){a=document.createElementNS(g.g.o.Vl,a);for(var e in c)a.setAttribute(e,c[e]);document.body.runtimeStyle&&(a.runtimeStyle=a.currentStyle=a.style);d&&d.appendChild(a);return a};
g.g.o.qb=function(a,c){var d=a.getAttribute("class")||"";if(-1!=(" "+d+" ").indexOf(" "+c+" "))return!1;d&&(d+=" ");a.setAttribute("class",d+c);return!0};g.g.o.Tb=function(a,c){var d=a.getAttribute("class");if(-1==(" "+d+" ").indexOf(" "+c+" "))return!1;d=d.split(/\s+/);for(var e=0;e<d.length;e++)d[e]&&d[e]!=c||(d.splice(e,1),e--);d.length?a.setAttribute("class",d.join(" ")):a.removeAttribute("class");return!0};g.g.o.Oy=function(a,c){return-1!=(" "+a.getAttribute("class")+" ").indexOf(" "+c+" ")};
g.g.o.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};g.g.o.ej=function(a,c){var d=c.nextSibling;c=c.parentNode;if(!c)throw Error("Reference node has no parent.");d?c.insertBefore(a,d):c.appendChild(a)};g.g.o.containsNode=function(a,c){return!!(a.compareDocumentPosition(c)&g.g.o.Node.DOCUMENT_POSITION_CONTAINED_BY)};g.g.o.Dn=function(a,c){a.style.transform=c;a.style["-webkit-transform"]=c};g.g.o.Jn=function(){g.g.o.us++;g.g.o.Li||(g.g.o.Li={})};
g.g.o.Kn=function(){g.g.o.us--;g.g.o.us||(g.g.o.Li=null)};g.g.o.Lm=function(a){var c=a.textContent+"\n"+a.className.baseVal,d;if(g.g.o.Li&&(d=g.g.o.Li[c]))return d;try{d=g.g.userAgent.wg||g.g.userAgent.Ao?a.getBBox().width:a.getComputedTextLength()}catch(e){return 8*a.textContent.length}g.g.o.Li&&(g.g.o.Li[c]=d);return d};
g.pk=function(a){this.s=a;this.oe=new g.La(a,!0,!0,"blocklyMainWorkspaceScrollbar");this.ve=new g.La(a,!1,!0,"blocklyMainWorkspaceScrollbar");this.om=g.g.o.K("rect",{height:g.La.xc,width:g.La.xc,"class":"blocklyScrollbarBackground"},null);g.g.o.ej(this.om,a.xf)};g.pk.prototype.Nb=null;g.pk.prototype.I=function(){g.g.o.removeNode(this.om);this.Nb=this.s=this.om=null;this.oe.I();this.oe=null;this.ve.I();this.ve=null};
g.pk.prototype.resize=function(){var a=this.s.jc();if(a){var c=!1,d=!1;this.Nb&&this.Nb.ub==a.ub&&this.Nb.Cb==a.Cb&&this.Nb.Hc==a.Hc&&this.Nb.qc==a.qc?(this.Nb&&this.Nb.gf==a.gf&&this.Nb.gc==a.gc&&this.Nb.Jc==a.Jc||(c=!0),this.Nb&&this.Nb.Od==a.Od&&this.Nb.pc==a.pc&&this.Nb.tc==a.tc||(d=!0)):d=c=!0;c&&this.oe.resize(a);d&&this.ve.resize(a);this.Nb&&this.Nb.ub==a.ub&&this.Nb.qc==a.qc||this.om.setAttribute("x",this.ve.rd.x);this.Nb&&this.Nb.Cb==a.Cb&&this.Nb.Hc==a.Hc||this.om.setAttribute("y",this.oe.rd.y);
this.Nb=a}};g.pk.prototype.set=function(a,c){var d={};a*=this.oe.Qc;c*=this.ve.Qc;var e=this.ve.Ue,f=a/this.oe.Ue;d.x=isNaN(f)?0:f;e=c/e;d.y=isNaN(e)?0:e;this.s.ji(d);da(this.oe,a);da(this.ve,c)};
g.La=function(a,c,d,e){this.s=a;this.al=d||!1;this.bj=c;this.Nb=null;this.pm(e);this.rd=new g.g.X(0,0);a=g.La.xc;c?(this.Tc.setAttribute("height",a),this.fg.setAttribute("height",a),this.Xd.setAttribute("height",a-5),this.Xd.setAttribute("y",2.5),this.an="width",this.Oz="x"):(this.Tc.setAttribute("width",a),this.fg.setAttribute("width",a),this.Xd.setAttribute("width",a-5),this.Xd.setAttribute("x",2.5),this.an="height",this.Oz="y");this.Jz=g.ca(this.Tc,"mousedown",this,this.uG);this.Kz=g.ca(this.Xd,
"mousedown",this,this.vG)};b=g.La.prototype;b.Eu=new g.g.X(0,0);b.nA=0;b.Ue=0;b.Lh=0;b.Om=0;b.Wh=!0;b.Oi=!0;g.La.xc=15;g.Touch.Gw&&(g.La.xc=25);g.La.VF=function(a,c){return a&&c&&a.ub==c.ub&&a.Cb==c.Cb&&a.gc==c.gc&&a.pc==c.pc&&a.Hc==c.Hc&&a.qc==c.qc&&a.gf==c.gf&&a.Od==c.Od&&a.Jc==c.Jc&&a.tc==c.tc?!0:!1};
g.La.prototype.I=function(){ea();g.Ua(this.Jz);this.Jz=null;g.Ua(this.Kz);this.Kz=null;g.g.o.removeNode(this.fg);this.Tc=this.H=this.fg=null;this.Xd&&(this.s.Zb.unsubscribe(this.Xd),this.Xd=null);this.s=null};function da(a,c){a.Om=c;a.Xd.setAttribute(a.Oz,a.Om)}function fa(a,c){a.Ue=c;a.fg.setAttribute(a.an,a.Ue);a.Tc.setAttribute(a.an,a.Ue)}g.pk.prototype.zj=function(a){this.oe.zj(a);this.ve.zj(a)};
function ia(a,c,d){a.rd.x=c;a.rd.y=d;g.g.o.Dn(a.fg,"translate("+(a.rd.x+a.Eu.x)+"px,"+(a.rd.y+a.Eu.y)+"px)")}b=g.La.prototype;b.resize=function(a){if(!a&&(a=this.s.jc(),!a))return;g.La.VF(a,this.Nb)||(this.Nb=a,this.bj?ja(this,a):ka(this,a),la(this))};function ja(a,c){var d=c.ub-1;a.al&&(d-=g.La.xc);fa(a,Math.max(0,d));d=c.qc+.5;a.al&&a.s.G&&(d+=g.La.xc);ia(a,d,c.Hc+c.Cb-g.La.xc-.5);ma(a,c)}
function ma(a,c){a.al||a.Yb(a.Ue<c.gf);a.Qc=a.Ue/c.gf;if(-Infinity==a.Qc||Infinity==a.Qc||isNaN(a.Qc))a.Qc=0;a.Lh=Math.max(0,c.ub*a.Qc);a.Xd.setAttribute(a.an,a.Lh);da(a,na(a,(c.gc-c.Jc)*a.Qc))}function ka(a,c){var d=c.Cb-1;a.al&&(d-=g.La.xc);fa(a,Math.max(0,d));d=c.qc+.5;a.s.G||(d+=c.ub-g.La.xc-1);ia(a,d,c.Hc+.5);oa(a,c)}
function oa(a,c){a.al||a.Yb(a.Ue<c.Od);a.Qc=a.Ue/c.Od;if(-Infinity==a.Qc||Infinity==a.Qc||isNaN(a.Qc))a.Qc=0;a.Lh=Math.max(0,c.Cb*a.Qc);a.Xd.setAttribute(a.an,a.Lh);da(a,na(a,(c.pc-c.tc)*a.Qc))}
b.pm=function(a){var c="blocklyScrollbar"+(this.bj?"Horizontal":"Vertical");a&&(c+=" "+a);this.fg=g.g.o.K("svg",{"class":c},null);this.H=g.g.o.K("g",{},this.fg);this.Tc=g.g.o.K("rect",{"class":"blocklyScrollbarBackground"},this.H);a=Math.floor((g.La.xc-5)/2);this.Xd=g.g.o.K("rect",{"class":"blocklyScrollbarHandle",rx:a,ry:a},this.H);this.s.Zb.subscribe(this.Xd,"scrollbar","fill");this.s.Zb.subscribe(this.Xd,"scrollbarOpacity","fill-opacity");g.g.o.ej(this.fg,r(this.s))};b.isVisible=function(){return this.Wh};
b.zj=function(a){var c=a!=this.Oi;this.Oi=a;c&&this.Un()};b.Yb=function(a){var c=a!=this.isVisible();if(this.al)throw Error("Unable to toggle visibility of paired scrollbars.");this.Wh=a;c&&this.Un()};b.Un=function(){this.Oi&&this.isVisible()?this.fg.setAttribute("display","block"):this.fg.setAttribute("display","none")};
b.uG=function(a){pa(this.s);g.Touch.Bh();ea();if(g.g.jj(a))a.stopPropagation();else{var c=g.g.ln(a,r(this.s),qa(this.s));c=this.bj?c.x:c.y;var d=g.g.Jm(this.Xd);d=this.bj?d.x:d.y;var e=this.Om,f=.95*this.Lh;c<=d?e-=f:c>=d+this.Lh&&(e+=f);da(this,na(this,e));la(this);a.stopPropagation();a.preventDefault()}};
b.vG=function(a){pa(this.s);ea();g.g.jj(a)?a.stopPropagation():(this.hH=this.Om,ra(this.s),this.nA=this.bj?a.clientX:a.clientY,g.La.Se=g.ca(document,"mouseup",this,this.DG),g.La.eg=g.ca(document,"mousemove",this,this.AG),a.stopPropagation(),a.preventDefault())};b.AG=function(a){da(this,na(this,this.hH+((this.bj?a.clientX:a.clientY)-this.nA)));la(this)};b.DG=function(){sa(this.s);g.Touch.Bh();ea()};function ea(){g.wc(!0);g.La.Se&&(g.Ua(g.La.Se),g.La.Se=null);g.La.eg&&(g.Ua(g.La.eg),g.La.eg=null)}
function na(a,c){return c=0>=c||isNaN(c)||a.Ue<a.Lh?0:Math.min(c,a.Ue-a.Lh)}function la(a){var c=a.Om/a.Ue;isNaN(c)&&(c=0);var d={};a.bj?d.x=c:d.y=c;a.s.ji(d)}b.set=function(a){da(this,na(this,a*this.Qc));la(this)};g.g.dd={};g.g.dd.rl=function(a){return a*Math.PI/180};g.g.dd.tM=function(a){return 180*a/Math.PI};g.g.dd.Ak=function(a,c,d){if(d<a){var e=d;d=a;a=e}return Math.max(a,Math.min(c,d))};g.zo=function(){this.Lc=this.Wb=null};function t(a,c){a.Wb=c;a.Lc&&a.Lc.draw(a.Wb)}b=g.zo.prototype;b.Ga=function(){this.Lc&&this.Lc.Ga()};b.next=function(){var a=this.Wb;if(!a)return null;for(a=a.next();a&&a.next()&&(a.Rb()==g.F.types.Ce||a.Rb()==g.F.types.ae);)a=a.next();a&&t(this,a);return a};b.Qm=function(){var a=this.Wb;if(!a)return null;if(a.Rb()==g.F.types.Ee||a.Rb()==g.F.types.mk)a=a.next();(a=a.Qm())&&t(this,a);return a};
b.hg=function(){var a=this.Wb;if(!a)return null;for(a=a.hg();a&&a.hg()&&(a.Rb()==g.F.types.Ce||a.Rb()==g.F.types.ae);)a=a.hg();a&&t(this,a);return a};b.pn=function(){var a=this.Wb;if(!a)return null;(a=a.pn())&&a.Rb()==g.F.types.ae&&(a=a.hg()||a);a&&t(this,a);return a};g.g.object={};g.g.object.Y=function(a,c){a.w=c.prototype;a.prototype=Object.create(c.prototype);a.prototype.constructor=a};g.g.object.ag=function(a,c){for(var d in c)a[d]=c[d]};g.g.object.values=function(a){return Object.values?Object.values(a):Object.keys(a).map(function(c){return a[c]})};g.rh=function(){g.rh.w.constructor.call(this)};g.g.object.Y(g.rh,g.zo);g.rh.prototype.next=function(){return null};g.rh.prototype.Qm=function(){return null};g.rh.prototype.hg=function(){return null};g.rh.prototype.pn=function(){return null};g.i={};g.i.Ly="";g.i.Rc=!0;g.i.Ps=0;g.i.uo="create";g.i.Al=g.i.uo;g.i.Dl="delete";g.i.fo=g.i.Dl;g.i.pi="change";g.i.UH=g.i.pi;g.i.Pl="move";g.i.Fv=g.i.Pl;g.i.Iw="var_create";g.i.Jw="var_delete";g.i.Kw="var_rename";g.i.Yl="ui";g.i.qo="comment_create";g.i.Lv="comment_delete";g.i.Kv="comment_change";g.i.so="comment_move";g.i.BB="finished_loading";g.i.WA=[g.i.Al,g.i.Fv,g.i.qo,g.i.so];g.i.Gl=[];g.i.Oa=function(a){g.i.isEnabled()&&(g.i.Gl.length||setTimeout(g.i.ME,0),g.i.Gl.push(a))};
g.i.ME=function(){for(var a=g.i.filter(g.i.Gl,!0),c=g.i.Gl.length=0,d;d=a[c];c++)if(d.Ec){var e=g.Ob.qt(d.Ec);if(e){var f=d;if(f.Rc)for(e.Nj.push(f),e.vn.length=0;e.Nj.length>e.iw&&0<=e.iw;)e.Nj.shift();for(var h=0;d=e.Gd[h];h++)d(f)}}};
g.i.filter=function(a,c){a=a.slice();c||a.reverse();for(var d=[],e=Object.create(null),f=0,h;h=a[f];f++)if(!h.Uk()){var k=[h.type,h.Ic,h.Ec].join(" "),l=e[k],m=l?l.event:null;if(!l)e[k]={event:h,index:f},d.push(h);else if(h.type==g.i.Pl&&l.index==f-1)m.qj=h.qj,m.pj=h.pj,m.Zh=h.Zh,l.index=f;else if(h.type==g.i.pi&&h.element==m.element&&h.name==m.name)m.newValue=h.newValue;else if(h.type!=g.i.Yl||"click"!=h.element||"commentOpen"!=m.element&&"mutatorOpen"!=m.element&&"warningOpen"!=m.element)e[k]={event:h,
index:1},d.push(h)}a=d.filter(function(n){return!n.Uk()});c||a.reverse();for(f=1;h=a[f];f++)h.type==g.i.pi&&"mutation"==h.element&&a.unshift(a.splice(f,1)[0]);return a};g.i.UD=function(){for(var a=0,c;c=g.i.Gl[a];a++)c.Rc=!1};g.i.disable=function(){g.i.Ps++};g.i.enable=function(){g.i.Ps--};g.i.isEnabled=function(){return 0==g.i.Ps};g.i.cc=function(){return g.i.Ly};g.i.aa=function(a){g.i.Ly="boolean"==typeof a?a?g.g.Qg():"":a};
g.i.qy=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++)c[d]=e.id;return c};
g.i.qa=function(a){switch(a.type){case g.i.uo:var c=new g.i.We(null);break;case g.i.Dl:c=new g.i.Df(null);break;case g.i.pi:c=new g.i.ph(null,"","","","");break;case g.i.Pl:c=new g.i.xi(null);break;case g.i.Iw:c=new g.i.Fe(null);break;case g.i.Jw:c=new g.i.af(null);break;case g.i.Kw:c=new g.i.Lf(null,"");break;case g.i.Yl:c=new g.i.Bd(null,"","","");break;case g.i.qo:c=new g.i.sg(null);break;case g.i.Kv:c=new g.i.Xj(null,"","");break;case g.i.so:c=new g.i.ri(null);break;case g.i.Lv:c=new g.i.tg(null);
break;default:throw Error("Unknown event type.");}c.qa(a);c.Ec=(void 0).id;return c};g.i.uE=function(a){if((a.type==g.i.Pl||a.type==g.i.uo)&&a.Ec){var c=g.Ob.qt(a.Ec);if(a=x(c,a.Ic)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.sd(!0);else if((a.L||a.$)&&!c.lc()){do a.sd(!1),a=q(a);while(a)}}}};
g.fD=function(){var a=g.Fi.Wj.KD;this.FD=g.Fi.Wj.mE;this.LD=a;this.XD=Object.create(null)};function ta(a,c){return(c=a.XD[c])&&"string"==typeof propertyValue&&ta(a,c)?ta(a,c):c?String(c):null};g.Xl=function(a){this.Fq=a;this.Cq=[];this.Ch=Object.create(null)};g.Xl.prototype.Ip=function(){return this.Fq};g.Xl.prototype.subscribe=function(a,c,d){this.Ch[c]||(this.Ch[c]=[]);this.Ch[c].push({element:a,propertyName:d});a.style[d]=this.Fq&&ta(this.Fq,c)||""};g.Xl.prototype.unsubscribe=function(a){if(a)for(var c=Object.keys(this.Ch),d=0,e;e=c[d];d++){for(var f=this.Ch[e],h=f.length-1;0<=h;h--)f[h].element===a&&f.splice(h,1);this.Ch[e].length||delete this.Ch[e]}};
g.Xl.prototype.I=function(){this.Ch=this.Cq=this.Fq=this.qd=null};g.Fi={};g.Fi.Wj={};g.Fi.Wj.mE={colour_blocks:{colourPrimary:"20"},list_blocks:{colourPrimary:"260"},logic_blocks:{colourPrimary:"210"},loop_blocks:{colourPrimary:"120"},math_blocks:{colourPrimary:"230"},procedure_blocks:{colourPrimary:"290"},text_blocks:{colourPrimary:"160"},variable_blocks:{colourPrimary:"330"},variable_dynamic_blocks:{colourPrimary:"310"},hat_blocks:{colourPrimary:"330",hat:"cap"}};
g.Fi.Wj.KD={colour_category:{colour:"20"},list_category:{colour:"260"},logic_category:{colour:"210"},loop_category:{colour:"120"},math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}};g.Fi.Wj=new g.fD;g.i.Abstract=function(){this.Ec=void 0;this.group=g.i.cc();this.Rc=g.i.Rc};g.i.Abstract.prototype.eb=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};g.i.Abstract.prototype.qa=function(a){this.group=a.group};g.i.Abstract.prototype.Uk=function(){return!1};g.i.Abstract.prototype.run=function(){};function ua(a){if(a.Ec)var c=g.Ob.qt(a.Ec);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};g.i.Eg=function(a){g.i.Eg.w.constructor.call(this);this.li=a.wa();this.Ec=a.v.id};g.g.object.Y(g.i.Eg,g.i.Abstract);g.i.Eg.prototype.eb=function(){var a=g.i.Eg.w.eb.call(this);a.varId=this.li;return a};g.i.Eg.prototype.qa=function(a){g.i.Eg.w.eb.call(this);this.li=a.varId};g.i.Fe=function(a){a&&(g.i.Fe.w.constructor.call(this,a),this.Qj=a.type,this.Pj=a.name)};g.g.object.Y(g.i.Fe,g.i.Eg);g.i.Fe.prototype.type=g.i.Iw;
g.i.Fe.prototype.eb=function(){var a=g.i.Fe.w.eb.call(this);a.varType=this.Qj;a.varName=this.Pj;return a};g.i.Fe.prototype.qa=function(a){g.i.Fe.w.qa.call(this,a);this.Qj=a.varType;this.Pj=a.varName};g.i.Fe.prototype.run=function(a){var c=ua(this);a?c.Pd(this.Pj,this.Qj,this.li):c.Vf(this.li)};g.i.af=function(a){a&&(g.i.af.w.constructor.call(this,a),this.Qj=a.type,this.Pj=a.name)};g.g.object.Y(g.i.af,g.i.Eg);g.i.af.prototype.type=g.i.Jw;
g.i.af.prototype.eb=function(){var a=g.i.af.w.eb.call(this);a.varType=this.Qj;a.varName=this.Pj;return a};g.i.af.prototype.qa=function(a){g.i.af.w.qa.call(this,a);this.Qj=a.varType;this.Pj=a.varName};g.i.af.prototype.run=function(a){var c=ua(this);a?c.Vf(this.li):c.Pd(this.Pj,this.Qj,this.li)};g.i.Lf=function(a,c){a&&(g.i.Lf.w.constructor.call(this,a),this.uu=a.name,this.nu=c)};g.g.object.Y(g.i.Lf,g.i.Eg);g.i.Lf.prototype.type=g.i.Kw;
g.i.Lf.prototype.eb=function(){var a=g.i.Lf.w.eb.call(this);a.oldName=this.uu;a.newName=this.nu;return a};g.i.Lf.prototype.qa=function(a){g.i.Lf.w.qa.call(this,a);this.uu=a.oldName;this.nu=a.newName};g.i.Lf.prototype.run=function(a){var c=ua(this);a?c.ei(this.li,this.nu):c.ei(this.li,this.uu)};
g.Vr=function(a){this.Va=Object.create(null);this.v=a};b=g.Vr.prototype;b.clear=function(){this.Va=Object.create(null)};b.uq=function(a,c){var d=this.ad(c,a.type),e=y(this.v,!1);g.i.aa(!0);try{if(d&&d.wa()!=a.wa()){var f=a.type;c!=d.name&&va(d,c,e);for(c=0;c<e.length;c++)e[c].tq(a.wa(),d.wa());g.i.Oa(new g.i.af(a));this.Va[f].splice(this.Mm(f).indexOf(a),1)}else va(a,c,e)}finally{g.i.aa(!1)}};
b.ei=function(a,c){var d=this.mf(a);if(!d)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.uq(d,c)};function va(a,c,d){g.i.Oa(new g.i.Lf(a,c));a.name=c;for(c=0;c<d.length;c++)d[c].Jq(a)}
b.Pd=function(a,c,d){var e=this.ad(a,c);if(e){if(d&&e.wa()!=d)throw Error('Variable "'+a+'" is already in use and its id is "'+e.wa()+'" which conflicts with the passed in id, "'+d+'".');return e}if(d&&this.mf(d))throw Error('Variable id, "'+d+'", is already in use.');e=d||g.g.Qg();c=c||"";e=new g.$l(this.v,a,c,e);a=this.Va[c]||[];a.push(e);delete this.Va[c];this.Va[c]=a;return e};
b.Vf=function(a){var c=this.mf(a);if(c){var d=c.name,e=this.At(a);a=0;for(var f;f=e[a];a++)if("procedures_defnoreturn"==f.type||"procedures_defreturn"==f.type){a=z(f,"NAME");d=g.h.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",d).replace("%2",a);g.alert(d);return}var h=this;1<e.length?(d=g.h.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(e.length)).replace("%2",d),g.confirm(d,function(k){k&&h.op(c,e)})):h.op(c,e)}else console.warn("Can't delete non-existent variable: "+a)};
b.op=function(a,c){var d=g.i.cc();d||g.i.aa(!0);try{for(var e=0;e<c.length;e++)c[e].I(!0,!1);var f=this.Va[a.type];c=0;for(var h;h=f[c];c++)if(h.wa()==a.wa()){f.splice(c,1);g.i.Oa(new g.i.af(a));break}}finally{d||g.i.aa(!1)}};b.ad=function(a,c){if(c=this.Va[c||""])for(var d=0,e;e=c[d];d++)if(g.fe.Je(e.name,a))return e;return null};b.mf=function(a){for(var c=Object.keys(this.Va),d=0;d<c.length;d++)for(var e=c[d],f=0,h;h=this.Va[e][f];f++)if(h.wa()==a)return h;return null};
b.Mm=function(a){return(a=this.Va[a||""])?a.slice():[]};b.zt=function(a){var c=[];a&&a.bi&&(c=Object.keys(a.bi.Va));a=Object.keys(this.Va).concat(c);c=!1;for(var d=0;d<a.length;d++)""==a[d]&&(c=!0);c||a.push("");return a};b.Rg=function(){var a=[],c;for(c in this.Va)a=a.concat(this.Va[c]);return a};b.At=function(a){for(var c=[],d=y(this.v,!1),e=0;e<d.length;e++){var f=d[e].Ug();if(f)for(var h=0;h<f.length;h++)f[h].wa()==a&&c.push(d[e])}return c};g.Ob=function(a){this.id=g.g.Qg();g.Ob.am[this.id]=this;this.options=a||{};this.G=!!this.options.G;this.Rd=!!this.options.Rd;this.Ia=this.options.Ia;this.ul=[];this.Gq=[];this.jp=Object.create(null);this.Gd=[];this.Nj=[];this.vn=[];this.ps=Object.create(null);this.mh=Object.create(null);this.Va=new g.Vr(this);this.bi=null;this.bb=new g.zo;this.fc=new g.rh;this.Zb=this.options.Sb?this.options.Sb.Zb:new g.Xl(this.options.rH||g.Fi.Wj);this.Zb.Cq.push(this)};b=g.Ob.prototype;b.ga=!1;b.Nt=!1;b.iw=1024;
b.lp=null;b.Xu=function(a){this.bb=a};b.hA=function(a){this.fc=a};b.Ip=function(){return this.Zb.Ip()};b.I=function(){this.Gd.length=0;this.clear();delete g.Ob.am[this.id];if(this.Zb){var a=this.Zb,c=a.Cq.indexOf(this);if(0>c)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.Cq.splice(c,1);this.Zb.unsubscribe(this.Tc);this.options.Sb||(this.Zb.I(),this.Zb=null)}};g.Ob.yw=3;b=g.Ob.prototype;
b.lg=function(a,c){a=a.Ta();c=c.Ta();return a.y+g.Ob.prototype.lg.offset*a.x-(c.y+g.Ob.prototype.lg.offset*c.x)};function wa(a,c){if(!g.g.$o(a.ul,c))throw Error("Block not present in workspace's list of top-most blocks.");}function A(a,c){var d=[].concat(a.ul);c&&1<d.length&&(a.lg.offset=Math.sin(g.g.dd.rl(g.Ob.yw)),a.G&&(a.lg.offset*=-1),d.sort(a.lg));return d}
function xa(a,c){var d=[].concat(a.Gq);c&&1<d.length&&(a.lg.offset=Math.sin(g.g.dd.rl(g.Ob.yw)),a.G&&(a.lg.offset*=-1),d.sort(a.lg));return d}function y(a,c){if(c){a=A(a,!0);c=[];for(var d=0;d<a.length;d++)c.push.apply(c,p(a[d],!0))}else for(c=A(a,!1),d=0;d<c.length;d++)c.push.apply(c,c[d].Ih(!1));return c.filter(function(e){return!e.Sh()})}
b.clear=function(){this.Nt=!0;try{var a=g.i.cc();for(a||g.i.aa(!0);this.ul.length;)this.ul[0].I();for(;this.Gq.length;)this.Gq[this.Gq.length-1].I();a||g.i.aa(!1);this.Va.clear();this.bi&&this.bi.clear()}finally{this.Nt=!1}};b.ei=function(a,c){this.Va.ei(a,c)};b.Pd=function(a,c,d){return this.Va.Pd(a,c,d)};b.At=function(a){return this.Va.At(a)};b.Vf=function(a){this.Va.Vf(a)};b.op=function(a,c){this.Va.op(a,c)};b.ad=function(a,c){return this.Va.ad(a,c)};b.mf=function(a){return this.Va.mf(a)};
b.Mm=function(a){return this.Va.Mm(a)};b.zt=function(){return this.Va.zt(this)};b.Rg=function(){return this.Va.Rg()};b.Zf=function(){return 0};b.cg=function(a,c){return new g.lo(this,a,c)};function ya(a){return isNaN(a.options.fu)?Infinity:a.options.fu-y(a).length}function za(a,c){if(!Aa(a))return!0;var d=0,e;for(e in c){var f=c[e];if(a.options.gu){var h=a.options.gu[e]||Infinity;var k=a.mh[e]?a.mh[e].slice(0):[];h-=k.length}else h=Infinity;if(f>h)return!1;d+=c[e]}return d>ya(a)?!1:!0}
function Aa(a){return Infinity!=a.options.fu||!!a.options.gu}b.uv=function(a){var c=a?this.vn:this.Nj,d=a?this.Nj:this.vn,e=c.pop();if(e){for(var f=[e];c.length&&e.group&&e.group==c[c.length-1].group;)f.push(c.pop());for(c=0;e=f[c];c++)d.push(e);f=g.i.filter(f,a);g.i.Rc=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{g.i.Rc=!0}}};function Ba(a,c){a.Gd.push(c)}function Ca(a,c){g.g.$o(a.Gd,c)}function x(a,c){return a.ps[c]||null}g.Ob.am=Object.create(null);g.Ob.qt=function(a){return g.Ob.am[a]||null};
g.Ob.getAll=function(){var a=[],c;for(c in g.Ob.am)a.push(g.Ob.am[c]);return a};g.oa=function(a,c,d,e,f,h){this.s=a;this.hf=c;this.jA=d;d=g.oa.RA;this.s.G&&(d=-d);this.zD=g.g.dd.rl(d);a.xf.appendChild(this.pm(c,!(!f||!h)));this.bc=e;this.vq&&Da(this);f&&h||(c=this.hf.getBBox(),f=c.width+2*g.oa.jd,h=c.height+2*g.oa.jd);this.Cn(f,h);Da(this);Ea(this);this.vq=!0;a.options.readOnly||(g.ca(this.em,"mousedown",this,this.GD),this.kg&&g.ca(this.kg,"mousedown",this,this.TG))};g.oa.jd=6;g.oa.SA=5;g.oa.RA=20;g.oa.Bv=4;g.oa.PA=8;g.oa.Se=null;g.oa.eg=null;g.oa.prototype.Ru=null;
g.oa.tv=function(){g.oa.Se&&(g.Ua(g.oa.Se),g.oa.Se=null);g.oa.eg&&(g.Ua(g.oa.eg),g.oa.eg=null)};g.oa.HD=function(){g.Touch.Bh();g.oa.tv()};b=g.oa.prototype;b.vq=!1;b.bc=null;b.ah=0;b.di=0;b.xb=0;b.bd=0;b.ls=!0;
b.pm=function(a,c){this.ke=g.g.o.K("g",{},null);var d={filter:"url(#"+this.s.options.Vx+")"};g.g.userAgent.XB&&(d={});d=g.g.o.K("g",d,this.ke);this.ts=g.g.o.K("path",{},d);this.em=g.g.o.K("rect",{"class":"blocklyDraggable",x:0,y:0,rx:g.oa.jd,ry:g.oa.jd},d);c?(this.kg=g.g.o.K("g",{"class":this.s.G?"blocklyResizeSW":"blocklyResizeSE"},this.ke),c=2*g.oa.jd,g.g.o.K("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.kg),g.g.o.K("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/
3},this.kg),g.g.o.K("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.kg)):this.kg=null;this.ke.appendChild(a);return this.ke};b.za=function(){return this.ke};function Fa(a,c){a.ke.dataset&&(a.ke.dataset.blockId=c)}b.GD=function(a){var c=this.s.Sg(a);if(c){if(c.$i)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.te||(c.te=this);c.tf=a}};b.Gn=function(){};b.pe=function(){return!1};
b.TG=function(a){Ga(this);g.oa.tv();g.g.jj(a)||(this.s.iv(a,new g.g.X(this.s.G?-this.xb:this.xb,this.bd)),g.oa.Se=g.ca(document,"mouseup",this,g.oa.HD),g.oa.eg=g.ca(document,"mousemove",this,this.UG),g.wc());a.stopPropagation()};b.UG=function(a){this.ls=!1;var c=this.s;a=g.g.ln(a,r(c),qa(c));a.x/=c.scale;a.y/=c.scale;c=g.g.X.sum(c.Sx,a);this.Cn(this.s.G?-c.x:c.x,c.y);this.s.G&&Da(this)};function Ga(a){var c=a.ke.parentNode;return c.lastChild!==a.ke?(c.appendChild(a.ke),!0):!1}
function Ha(a,c,d){var e=a.s.G?a.bc.x-c.x-a.xb:c.x+a.bc.x;c=c.y+a.bc.y;return Math.max(0,Math.min(1,(Math.min(e+a.xb,d.gc+d.ub)-Math.max(e,d.gc))*(Math.min(c+a.bd,d.pc+d.Cb)-Math.max(c,d.pc))/(a.xb*a.bd)))}function Da(a){var c=a.bc.x;c=a.s.G?c-(a.ah+a.xb):c+a.ah;a.moveTo(c,a.di+a.bc.y)}b.moveTo=function(a,c){this.ke.setAttribute("transform","translate("+a+","+c+")")};b.ot=function(){return new g.g.ge(this.xb,this.bd)};
b.Cn=function(a,c){var d=2*g.oa.jd;a=Math.max(a,d+45);c=Math.max(c,d+20);this.xb=a;this.bd=c;this.em.setAttribute("width",a);this.em.setAttribute("height",c);this.kg&&(this.s.G?this.kg.setAttribute("transform","translate("+2*g.oa.jd+","+(c-d)+") scale(-1 1)"):this.kg.setAttribute("transform","translate("+(a-d)+","+(c-d)+")"));if(this.ls){a=this.s.jc();a.gc/=this.s.scale;a.ub/=this.s.scale;a.pc/=this.s.scale;a.Cb/=this.s.scale;c=-this.xb/4;if(!(this.xb>a.ub)){if(this.s.G){d=this.bc.x-c;var e=d-this.xb;
var f=a.gc+a.ub,h=a.gc+g.La.xc/this.s.scale}else e=c+this.bc.x,d=e+this.xb,h=a.gc,f=a.gc+a.ub-g.La.xc/this.s.scale;this.s.G?e<h?c=-(h-this.bc.x+this.xb):d>f&&(c=-(f-this.bc.x)):e<h?c=h-this.bc.x:d>f&&(c=f-this.bc.x-this.xb)}e=c;c=-this.bd/4;if(!(this.bd>a.Cb)){d=this.bc.y+c;f=d+this.bd;h=a.pc;var k=a.pc+a.Cb-g.La.xc/this.s.scale,l=this.bc.y;d<h?c=h-l:f>k&&(c=k-l-this.bd)}h=c;f=this.jA.getBBox();c={x:e,y:-this.bd-g.xa.vr};d={x:-this.xb-30,y:h};h={x:f.width,y:h};k={x:e,y:f.height};e=f.width<f.height?
h:k;f=f.width<f.height?k:h;h=Ha(this,c,a);k=Ha(this,d,a);l=Ha(this,e,a);a=Math.max(h,k,l,Ha(this,f,a));h==a?(this.ah=c.x,this.di=c.y):k==a?(this.ah=d.x,this.di=d.y):l==a?(this.ah=e.x,this.di=e.y):(this.ah=f.x,this.di=f.y)}Da(this);Ea(this);this.Ru&&this.Ru()};
function Ea(a){var c=[],d=a.xb/2,e=a.bd/2,f=-a.ah,h=-a.di;if(d==f&&e==h)c.push("M "+d+","+e);else{h-=e;f-=d;a.s.G&&(f*=-1);var k=Math.sqrt(h*h+f*f),l=Math.acos(f/k);0>h&&(l=2*Math.PI-l);var m=l+Math.PI/2;m>2*Math.PI&&(m-=2*Math.PI);var n=Math.sin(m),u=Math.cos(m),v=a.ot();m=(v.width+v.height)/g.oa.SA;m=Math.min(m,v.width,v.height)/4;v=1-g.oa.PA/k;f=d+v*f;h=e+v*h;v=d+m*u;var w=e+m*n;d-=m*u;e-=m*n;n=l+a.zD;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/g.oa.Bv;k=Math.cos(n)*k/g.oa.Bv;c.push("M"+v+","+
w);c.push("C"+(v+k)+","+(w+l)+" "+f+","+h+" "+f+","+h);c.push("C"+f+","+h+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.ts.setAttribute("d",c.join(" "))}b.ed=function(a){this.em.setAttribute("fill",a);this.ts.setAttribute("fill",a)};b.I=function(){g.oa.tv();g.g.o.removeNode(this.ke);this.jA=this.hf=this.s=this.kg=this.em=this.ts=this.ke=null};b.ku=function(a,c){a?a.Mj(c.x,c.y):this.moveTo(c.x,c.y);this.ah=this.s.G?this.bc.x-c.x-this.xb:c.x-this.bc.x;this.di=c.y-this.bc.y;Ea(this)};
b.Ta=function(){return new g.g.X(this.bc.x+this.ah,this.bc.y+this.di)};g.g.xml={};g.g.xml.tC="https://developers.google.com/blockly/xml";g.g.xml.document=function(){return document};g.g.xml.createElement=function(a){return g.g.xml.document().createElementNS(g.g.xml.tC,a)};g.g.xml.createTextNode=function(a){return g.g.xml.document().createTextNode(a)};g.g.xml.oH=function(a){return(new DOMParser).parseFromString(a,"text/xml")};g.g.xml.Dd=function(a){return(new XMLSerializer).serializeToString(a)};g.i.Cf=function(a){g.i.Cf.w.constructor.call(this);this.Ic=a.id;this.Ec=a.v.id};g.g.object.Y(g.i.Cf,g.i.Abstract);g.i.Cf.prototype.eb=function(){var a=g.i.Cf.w.eb.call(this);a.blockId=this.Ic;return a};g.i.Cf.prototype.qa=function(a){g.i.Cf.w.qa.call(this,a);this.Ic=a.blockId};g.i.ph=function(a,c,d,e,f){a&&(g.i.ph.w.constructor.call(this,a),this.element=c,this.name=d,this.oldValue=e,this.newValue=f)};g.g.object.Y(g.i.ph,g.i.Cf);g.i.qg=g.i.ph;b=g.i.ph.prototype;b.type=g.i.pi;
b.eb=function(){var a=g.i.ph.w.eb.call(this);a.element=this.element;this.name&&(a.name=this.name);a.newValue=this.newValue;return a};b.qa=function(a){g.i.ph.w.qa.call(this,a);this.element=a.element;this.name=a.name;this.newValue=a.newValue};b.Uk=function(){return this.oldValue==this.newValue};
b.run=function(a){var c=x(ua(this),this.Ic);if(c)switch(c.Ud&&c.Ud.Yb(!1),a=a?this.newValue:this.oldValue,this.element){case "field":(c=B(c,this.name))?c.setValue(a):console.warn("Can't set non-existent field: "+this.name);break;case "comment":c.ii(a||null);break;case "collapsed":c.hh(!!a);break;case "disabled":c.sd(!a);break;case "inline":c.re(!!a);break;case "mutation":var d="";c.Pa&&(d=(d=c.Pa())&&g.R.Dd(d));if(c.kb){var e=g.R.lh(a||"<mutation/>");c.kb(e)}g.i.Oa(new g.i.ph(c,"mutation",null,d,
a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.Ic)};g.i.We=function(a){a&&(g.i.We.w.constructor.call(this,a),this.xml=a.v.ga?g.R.qs(a):g.R.zh(a),this.Nh=g.i.qy(a))};g.g.object.Y(g.i.We,g.i.Cf);g.i.mo=g.i.We;g.i.We.prototype.type=g.i.uo;g.i.We.prototype.eb=function(){var a=g.i.We.w.eb.call(this);a.xml=g.R.Dd(this.xml);a.ids=this.Nh;return a};
g.i.We.prototype.qa=function(a){g.i.We.w.qa.call(this,a);this.xml=g.R.lh(a.xml);this.Nh=a.ids};g.i.We.prototype.run=function(a){var c=ua(this);if(a)a=g.g.xml.createElement("xml"),a.appendChild(this.xml),g.R.Fh(a,c);else{a=0;for(var d;d=this.Nh[a];a++){var e=x(c,d);e?e.I(!1):d==this.Ic&&console.warn("Can't uncreate non-existent block: "+d)}}};
g.i.Df=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");g.i.Df.w.constructor.call(this,a);this.wu=a.v.ga?g.R.qs(a):g.R.zh(a);this.Nh=g.i.qy(a)}};g.g.object.Y(g.i.Df,g.i.Cf);g.i.XA=g.i.Df;g.i.Df.prototype.type=g.i.Dl;g.i.Df.prototype.eb=function(){var a=g.i.Df.w.eb.call(this);a.ids=this.Nh;return a};g.i.Df.prototype.qa=function(a){g.i.Df.w.qa.call(this,a);this.Nh=a.ids};
g.i.Df.prototype.run=function(a){var c=ua(this);if(a){a=0;for(var d;d=this.Nh[a];a++){var e=x(c,d);e?e.I(!1):d==this.Ic&&console.warn("Can't delete non-existent block: "+d)}}else a=g.g.xml.createElement("xml"),a.appendChild(this.wu),g.R.Fh(a,c)};g.i.xi=function(a){a&&(g.i.xi.w.constructor.call(this,a),a=Ja(this),this.Cz=a.Mz,this.Bz=a.$y,this.su=a.vx)};g.g.object.Y(g.i.xi,g.i.Cf);g.i.Bl=g.i.xi;b=g.i.xi.prototype;b.type=g.i.Pl;
b.eb=function(){var a=g.i.xi.w.eb.call(this);this.qj&&(a.newParentId=this.qj);this.pj&&(a.newInputName=this.pj);this.Zh&&(a.newCoordinate=Math.round(this.Zh.x)+","+Math.round(this.Zh.y));return a};b.qa=function(a){g.i.xi.w.qa.call(this,a);this.qj=a.newParentId;this.pj=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.Zh=new g.g.X(Number(a[0]),Number(a[1])))};b.yj=function(){var a=Ja(this);this.qj=a.Mz;this.pj=a.$y;this.Zh=a.vx};
function Ja(a){var c=x(ua(a),a.Ic);a={};var d=c.getParent();if(d){a.Mz=d.id;a:{for(var e=0,f;f=d.S[e];e++)if(f.connection&&C(f.connection)==c){c=f;break a}c=null}c&&(a.$y=c.name)}else a.vx=c.Ta();return a}b.Uk=function(){return this.Cz==this.qj&&this.Bz==this.pj&&g.g.X.Je(this.su,this.Zh)};
b.run=function(a){var c=ua(this),d=x(c,this.Ic);if(d){var e=a?this.qj:this.Cz,f=a?this.pj:this.Bz;a=a?this.Zh:this.su;var h=null;if(e&&(h=x(c,e),!h)){console.warn("Can't connect to non-existent block: "+e);return}d.getParent()&&D(d);if(a)f=d.Ta(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.L||d.$;if(f){if(c=E(h,f))var k=c.connection}else d.type==g.$e&&(k=h.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.Ic)};g.i.Bd=function(a,c,d,e){g.i.Bd.w.constructor.call(this);this.Ic=a?a.id:null;this.Ec=a?a.v.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.Rc=!1};g.g.object.Y(g.i.Bd,g.i.Abstract);g.i.Bd.prototype.type=g.i.Yl;g.i.Bd.prototype.eb=function(){var a=g.i.Bd.w.eb.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.Ic&&(a.blockId=this.Ic);return a};
g.i.Bd.prototype.qa=function(a){g.i.Bd.w.qa.call(this,a);this.element=a.element;this.newValue=a.newValue;this.Ic=a.blockId};g.Kd=function(a){this.T=a};b=g.Kd.prototype;b.jx=!0;b.Uo=17;b.Vb=null;b.cj=null;function Ka(a){a.Sd||(a.Sd=g.g.o.K("g",{"class":"blocklyIconGroup"},null),a.T.ec&&g.g.o.qb(a.Sd,"blocklyIconGroupReadonly"),a.Ws(a.Sd),a.T.za().appendChild(a.Sd),g.ca(a.Sd,"mouseup",a,a.It),a.nh())}b.I=function(){g.g.o.removeNode(this.Sd);this.Sd=null;this.Yb(!1);this.T=null};b.nh=function(){};b.isVisible=function(){return!!this.Vb};b.It=function(a){this.T.v.lc()||this.T.ec||g.g.jj(a)||this.Yb(!this.isVisible())};
b.Ve=function(){this.isVisible()&&this.Vb.ed(this.T.Mi)};function La(a){var c=a.T.Ta(),d=g.g.Me(a.Sd);c=new g.g.X(c.x+d.x+a.Uo/2,c.y+d.y+a.Uo/2);g.g.X.Je(a.cj,c)||(a.cj=c,a.isVisible()&&(a=a.Vb,a.bc=c,a.vq&&Da(a)))};g.Mf=function(a){g.Mf.w.constructor.call(this,a);Ka(this);this.ng={}};g.g.object.Y(g.Mf,g.Kd);g.Mf.prototype.jx=!1;g.Mf.prototype.Ws=function(a){g.g.o.K("path",{"class":"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},a);g.g.o.K("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);g.g.o.K("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)};
g.Mf.pH=function(a){var c=g.g.o.K("text",{"class":"blocklyText blocklyBubbleText",y:g.oa.jd},null);a=a.split("\n");for(var d=0;d<a.length;d++){var e=g.g.o.K("tspan",{dy:"1em",x:g.oa.jd},c),f=document.createTextNode(a[d]);e.appendChild(f)}return c};b=g.Mf.prototype;b.Yb=function(a){a!=this.isVisible()&&(g.i.Oa(new g.i.Bd(this.T,"warningOpen",!a,a)),a?this.wx():this.Mx())};
b.wx=function(){this.tj=g.Mf.pH(this.dc());this.Vb=new g.oa(this.T.v,this.tj,this.T.Yd,this.cj,null,null);Fa(this.Vb,this.T.id);if(this.T.G)for(var a=this.tj.getBBox().width,c=0,d;d=this.tj.childNodes[c];c++)d.setAttribute("text-anchor","end"),d.setAttribute("x",a+g.oa.jd);this.Ve()};b.Mx=function(){this.Vb.I();this.tj=this.Vb=null};b.kl=function(a,c){this.ng[c]!=a&&(a?this.ng[c]=a:delete this.ng[c],this.isVisible()&&(this.Yb(!1),this.Yb(!0)))};
b.dc=function(){var a=[],c;for(c in this.ng)a.push(this.ng[c]);return a.join("\n")};b.I=function(){this.T.hd=null;g.Kd.prototype.I.call(this)};g.Comment=function(a){g.Comment.w.constructor.call(this,a);this.mc=a.He;this.mc.text=this.mc.text||"";this.vs="";Ka(this)};g.g.object.Y(g.Comment,g.Kd);b=g.Comment.prototype;
b.Ws=function(a){g.g.o.K("circle",{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},a);g.g.o.K("path",{"class":"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},a);g.g.o.K("rect",{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},a)};
b.Es=function(){this.Em=g.g.o.K("foreignObject",{x:g.oa.jd,y:g.oa.jd},null);var a=document.createElementNS(g.g.o.ak,"body");a.setAttribute("xmlns",g.g.o.ak);a.className="blocklyMinimalBody";var c=this.Lj=document.createElementNS(g.g.o.ak,"textarea");c.className="blocklyCommentTextarea";c.setAttribute("dir",this.T.G?"RTL":"LTR");c.value=this.mc.text;Ma(this);a.appendChild(c);this.Em.appendChild(a);g.ca(c,"mouseup",this,this.iH,!0,!0);g.ca(c,"wheel",this,function(d){d.stopPropagation()});g.ca(c,"change",
this,function(){this.vs!=this.mc.text&&g.i.Oa(new g.i.qg(this.T,"comment",null,this.vs,this.mc.text))});g.ca(c,"input",this,function(){this.mc.text=c.value});setTimeout(c.focus.bind(c),0);return this.Em};b.nh=function(){g.Comment.w.nh.call(this);this.isVisible()&&(Na(this),Oa(this))};b.oG=function(){this.isVisible()&&(this.mc.size=this.Vb.ot(),Ma(this))};
function Ma(a){var c=a.mc.size,d=2*g.oa.jd,e=c.width-d;c=c.height-d;a.Em.setAttribute("width",e);a.Em.setAttribute("height",c);a.Lj.style.width=e-4+"px";a.Lj.style.height=c-4+"px"}b.Yb=function(a){a!=this.isVisible()&&(g.i.Oa(new g.i.Bd(this.T,"commentOpen",!a,a)),(this.mc.Ku=a)?Oa(this):Na(this))};
function Oa(a){if(!a.T.pd()||g.g.userAgent.wg)g.Mf.prototype.wx.call(a);else{a.Vb=new g.oa(a.T.v,a.Es(),a.T.Yd,a.cj,a.mc.size.width,a.mc.size.height);Fa(a.Vb,a.T.id);var c=a.oG.bind(a);a.Vb.Ru=c;a.Ve()}}function Na(a){a.tj?g.Mf.prototype.Mx.call(a):(a.Vb.I(),a.Vb=null,a.Lj=null,a.Em=null)}b.iH=function(){Ga(this.Vb)&&this.Lj.focus();this.vs=this.mc.text};b.ot=function(){return this.mc.size};b.Cn=function(a,c){this.Vb?this.Vb.Cn(a,c):(this.mc.size.width=a,this.mc.size.height=c)};
b.dc=function(){return this.mc.text||""};b.kl=function(a){this.mc.text!=a&&(this.mc.text=a,Pa(this))};function Pa(a){a.Lj?a.Lj.value=a.mc.text:a.tj&&(a.tj.firstChild.textContent=a.mc.text)}b.I=function(){this.T.Bk=null;g.Kd.prototype.I.call(this)};g.Vc={};g.Vc.Kt=!1;g.Vc.register=function(a){if(g.Vc.Kt)throw Error("CSS already injected");Array.prototype.push.apply(g.Vc.Zq,a);a.length=0};g.Vc.Ph=function(a,c){if(!g.Vc.Kt){g.Vc.Kt=!0;var d=g.Vc.Zq.join("\n");g.Vc.Zq.length=0;a&&(a=c.replace(/[\\/]$/,""),d=d.replace(/<<<PATH>>>/g,a),a=document.createElement("style"),d=document.createTextNode(d),a.appendChild(d),document.head.insertBefore(a,document.head.firstChild))}};g.Vc.Xu=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")};
g.Vc.Zq=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;",
"}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);",
"color: #000;","display: none;","font-family: sans-serif;","font-size: 9pt;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: fixed;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-radius: 2px;","padding: 4px;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;",
"overflow-x: hidden;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;","cursor: pointer;","}",".arrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;",
"border-color: inherit;","}",".arrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;",
"stroke-width: 1;","}",".blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<<PATH>>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;",
"}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;",
"}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none","}",".blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",".blocklyReplaceable .blocklyPathLight,",".blocklyReplaceable .blocklyPathDark {","display: none;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;",
"font-size: 11pt;","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text {","fill: #000;","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill: #000;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklySvg text, .blocklyBlockDragSurface text {",
"user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;",
"}",".blocklyCommentForeignObject {","position: relative;","z-index: 0;","}",".blocklyCommentRect {","fill: #E7DE8E;","stroke: #bcA903;","stroke-width: 1px","}",".blocklyCommentTarget {","fill: transparent;","stroke: #bcA903;","}",".blocklyCommentTargetFocused {","fill: none;","}",".blocklyCommentHandleTarget {","fill: none;","}",".blocklyCommentHandleTargetFocused {","fill: transparent;","}",".blocklyFocused>.blocklyCommentRect {","fill: #B9B272;","stroke: #B9B272;","}",".blocklySelected>.blocklyCommentTarget {",
"stroke: #fc3;","stroke-width: 3px;","}",".blocklyCommentTextarea {","background-color: #fef49c;","border: 0;","outline: 0;","margin: 0;","padding: 3px;","resize: none;","display: block;","overflow: hidden;","}",".blocklyCommentDeleteIcon {","cursor: pointer;","fill: #000;","display: none","}",".blocklySelected > .blocklyCommentDeleteIcon {","display: block","}",".blocklyDeleteIconShape {","fill: #000;","stroke: #000;","stroke-width: 1px;","}",".blocklyDeleteIconShape.blocklyDeleteIconHighlighted {",
"stroke: #fc3;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {",
"z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",
".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {",
"padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalCursor {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;",
"border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',
"outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem,",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem,",".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem {",
"padding-left: 12px;","}",".blocklyWidgetDiv .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-content {","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {","color: #000;","}",".blocklyWidgetDiv .goog-menuitem-disabled,",".blocklyDropDownDiv .goog-menuitem-disabled {","cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {",
"color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight ,",".blocklyDropDownDiv .goog-menuitem-highlight {","background-color: rgba(0,0,0,.1);","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-icon {",
"background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",
".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-right: -24px;","}"];
g.D=function(){};g.D.we=null;g.D.ss=null;g.D.qd=null;g.D.pq=null;g.D.eo=16;g.D.Iv=1;g.D.Dv=12;g.D.ow=16;g.D.Vq=.25;g.D.Nv="#dadce0";g.D.Ov="#fff";g.D.fs=null;g.D.sj=null;
g.D.Ja=function(){if(!g.D.we){var a=document.createElement("div");a.className="blocklyDropDownDiv";a.style.backgroundColor=g.D.Ov;a.style.borderColor=g.D.Nv;document.body.appendChild(a);g.D.we=a;var c=document.createElement("div");c.className="blocklyDropDownContent";a.appendChild(c);g.D.hf=c;c=document.createElement("div");c.className="blocklyDropDownArrow";a.appendChild(c);g.D.df=c;g.D.we.style.opacity=0;g.D.we.style.transition="transform "+g.D.Vq+"s, opacity "+g.D.Vq+"s";a.addEventListener("focusin",
function(){g.g.o.qb(a,"focused")});a.addEventListener("focusout",function(){g.g.o.Tb(a,"focused")})}};g.D.eA=function(a){g.D.ss=a};g.D.py=function(){return g.D.hf};g.D.TD=function(){g.D.hf.innerHTML="";g.D.hf.style.width=""};g.D.ed=function(a){g.D.we.style.backgroundColor=a;g.D.we.style.borderColor=void 0};g.D.mM=function(a){g.D.we.setAttribute("data-category",a)};
g.D.oM=function(a,c,d,e){var f=c.v.scale,h=c.width,k=c.height;h*=f;k*=f;f=c.za().getBoundingClientRect();h=f.left+h/2;k=f.top+k;f=f.top;e&&(f+=e);g.D.eA(r(c.v).parentNode);return g.D.show(a,c.G,h,k,h,f,d)};g.D.kA=function(a,c){var d=a.za().getBoundingClientRect(),e=d.left+d.width/2,f=d.bottom;d=d.top;var h=a.B;g.D.pq=!0;g.D.eA(r(h.v).parentNode);g.D.show(a,h.G,e,f,e,d,c)};
g.D.show=function(a,c,d,e,f,h,k){g.D.qd=a;g.D.sj=k||null;a=g.D.zy(d,e,f,h);a.js?(g.D.df.style.display="",g.D.df.style.transform="translate("+a.dm+"px,"+a.Uw+"px) rotate(45deg)",g.D.df.setAttribute("class",a.hs?"blocklyDropDownArrow arrowTop":"blocklyDropDownArrow arrowBottom")):g.D.df.style.display="none";g.D.we.style.direction=c?"rtl":"ltr";g.D.rn(a.Pp,a.Qp,a.wp,a.xp);return a.hs};
g.D.UE=function(){var a=g.D.ss.getBoundingClientRect(),c=g.g.style.Tg(g.D.ss);return{left:a.left,right:a.left+c.width,top:a.top,bottom:a.top+c.height,width:c.width,height:c.height}};g.D.zy=function(a,c,d,e){var f=g.D.UE(),h=g.g.style.Tg(g.D.we);return c+h.height<f.bottom?g.D.yy(a,c,f,h):e-h.height>f.top?g.D.xy(d,e,f,h):c+h.height<document.documentElement.clientHeight?g.D.yy(a,c,f,h):e-h.height>document.documentElement.clientTop?g.D.xy(d,e,f,h):g.D.eF(a,f,h)};
g.D.yy=function(a,c,d,e){a=g.D.vt(a,d.left,d.right,e.width);return{Pp:a.Fk,Qp:c,wp:a.Fk,xp:c+g.D.ow,dm:a.dm,Uw:-(g.D.eo/2+g.D.Iv),hs:!0,js:!0}};g.D.xy=function(a,c,d,e){a=g.D.vt(a,d.left,d.right,e.width);return{Pp:a.Fk,Qp:c-e.height,wp:a.Fk,xp:c-e.height-g.D.ow,dm:a.dm,Uw:e.height-2*g.D.Iv-g.D.eo/2,hs:!1,js:!0}};g.D.eF=function(a,c,d){a=g.D.vt(a,c.left,c.right,d.width);return{Pp:a.Fk,Qp:0,wp:a.Fk,xp:0,js:!1}};
g.D.vt=function(a,c,d,e){var f=a;a=g.g.dd.Ak(c,a-e/2,d-e);f-=g.D.eo/2;c=g.g.dd.Ak(g.D.Dv,f-a,e-g.D.Dv-g.D.eo);return{dm:c,Fk:a}};g.D.isVisible=function(){return!!g.D.qd};g.D.Ok=function(a,c){g.D.qd===a&&(c?g.D.aj():g.D.Ga())};g.D.Ga=function(){var a=g.D.we;a.style.transform="translate(0, 0)";a.style.opacity=0;g.D.fs=setTimeout(function(){g.D.aj()},1E3*g.D.Vq);g.D.sj&&(g.D.sj(),g.D.sj=null)};
g.D.aj=function(){if(g.D.isVisible()){g.D.fs&&clearTimeout(g.D.fs);var a=g.D.we;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=g.D.Ov;a.style.borderColor=g.D.Nv;g.D.sj&&(g.D.sj(),g.D.sj=null);g.D.TD();g.D.qd=null}};
g.D.rn=function(a,c,d,e){a=Math.floor(a);c=Math.floor(c);d=Math.floor(d);e=Math.floor(e);var f=g.D.we;f.style.left=a+"px";f.style.top=c+"px";f.style.display="block";f.style.opacity=1;f.style.transform="translate("+(d-a)+"px,"+(e-c)+"px)"};
g.D.hM=function(){if(g.D.qd){var a=g.D.qd.B,c=a.v.scale,d=g.D.pq?g.D.qd.Bb.width:a.width,e=g.D.pq?g.D.qd.Bb.height:a.height;d*=c;e*=c;a=g.D.pq?g.D.qd.me.getBoundingClientRect():a.za().getBoundingClientRect();d=a.left+d/2;e=g.D.zy(d,a.top+e,d,a.top);g.D.rn(e.Pp,e.Qp,e.wp,e.xp)}else g.D.Ga()};g.rb={};g.rb.Rs=0;g.rb.qp=null;g.rb.yE=function(a){var c=a.v,d=a.za();c.Nf.play("delete");a=Qa(c,d);d=d.cloneNode(!0);d.wH=a.x;d.xH=a.y;d.setAttribute("transform","translate("+a.x+","+a.y+")");r(c).appendChild(d);d.Vw=d.getBBox();g.rb.Nx(d,c.G,new Date,c.scale)};g.rb.Nx=function(a,c,d,e){var f=(new Date-d)/150;1<f?g.g.o.removeNode(a):(a.setAttribute("transform","translate("+(a.wH+(c?-1:1)*a.Vw.width*e/2*f)+","+(a.xH+a.Vw.height*e*f)+") scale("+(1-f)*e+")"),setTimeout(g.rb.Nx,10,a,c,d,e))};
g.rb.$D=function(a){var c=a.v,d=c.scale;c.Nf.play("click");if(!(1>d)){var e=Qa(c,a.za());a.L?(e.x+=(a.G?3:-3)*d,e.y+=13*d):a.$&&(e.x+=(a.G?-23:23)*d,e.y+=3*d);a=g.g.o.K("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},r(c));g.rb.qx(a,new Date,d)}};g.rb.qx=function(a,c,d){var e=(new Date-c)/150;1<e?g.g.o.removeNode(a):(a.setAttribute("r",25*e*d),a.style.opacity=1-e,g.rb.Rs=setTimeout(g.rb.qx,10,a,c,d))};
g.rb.xE=function(a){a.v.Nf.play("disconnect");if(!(1>a.v.scale)){var c=Ra(a).height;c=Math.atan(10/c)/Math.PI*180;a.G||(c*=-1);g.rb.Lx(a.za(),c,new Date)}};g.rb.Lx=function(a,c,d){var e=(new Date-d)/200;1<e?a.In="":(a.In="skewX("+Math.round(Math.sin(e*Math.PI*3)*(1-e)*c)+")",g.rb.qp=a,g.rb.Rs=setTimeout(g.rb.Lx,10,a,c,d));a.setAttribute("transform",a.Rn+a.In)};g.rb.Ss=function(){if(g.rb.qp){clearTimeout(g.rb.Rs);var a=g.rb.qp;a.In="";a.setAttribute("transform",a.Rn);g.rb.qp=null}};g.Ho=function(a){this.zf=g.selected=a;this.s=a.v;this.kj=this.St=null;this.Hk=Sa(this,this.zf);this.Oc=this.Jb=null;this.pg=!1;this.mj=null;this.Ht=!1;this.Pk=null;a=this.zf.Ke(!1);var c;a:{for(c=this.zf.V;c;){var d=C(c);if(!d)break a;c=d.V}c=null}c&&c!=this.zf.V&&(a.push(c),this.St=c,this.kj=Sa(this,c.B));this.ns=a};
g.Ho.prototype.I=function(){this.s=this.zf=null;this.ns.length=0;this.Oc=this.Jb=null;g.i.disable();try{this.Hk&&(this.Hk.I(),this.Hk=null),this.kj&&(this.kj.I(),this.kj=null)}finally{g.i.enable()}this.Pk=null};
g.Ho.prototype.update=function(a,c){var d=this.Jb&&this.Oc?g.eB:g.zd;for(var e=null,f=null,h=0;h<this.ns.length;h++){var k=this.ns[h],l=k.closest(d,a);l.connection&&(e=l.connection,f=k,d=l.qq)}e=(d={closest:e,local:f,qq:d},!!d.closest)&&c!=g.Qv;if((this.pg=!!c&&!this.zf.getParent()&&this.zf.pe()&&!e)||Ta(this,d,a)){g.i.disable();d.closest?(a=this.Jb!=d.closest,c=this.Oc!=d.local,this.Jb&&this.Oc&&(a||c||this.pg)&&Ua(this)):Ua(this);this.Oc=this.Jb=this.mj=null;if(!this.pg&&(a=d.closest,c=d.local,
a))if(a==this.Jb||a.B.Sh())console.log("Trying to connect to an insertion marker");else{this.Jb=a;this.Oc=c;a=this.Jb;c=this.Oc;if(c.type==g.Ze)a=a.isConnected()&&!g.ua.kz(this.zf,a.ka.B);else{a:{for(d=0;e=c.B.S[d];d++)if(e.connection&&e.connection.type==g.Sa){d=e.connection;break a}d=null}a=c==d?0:!this.zf.V&&c.type==g.$e&&a.isConnected()}if(a)a=this.Jb,c=this.Oc,C(a)?(this.Pk=C(a),Va(C(a),!0)):c.type==g.Ze&&(this.Pk=a.B,a.B.yF(a,!0)),this.Ht=!0;else{d=this.Oc;a=this.Jb;c=this.St&&d==this.St?this.kj:
this.Hk;a:{f=d.B;e=c.Ke(!0);f=f.Ke(!0);if(e.length!=f.length)throw Error("Connection lists did not match in length.");for(h=0;h<f.length;h++)if(f[h]==d){d=e[h];break a}d=null}if(d==this.mj)throw Error("Made it to connectMarker_ even though the marker isn't changing");c.Da();c.ga=!0;c.za().setAttribute("visibility","visible");d.type!=g.Sa&&d.type!=g.Ra||c.moveBy(a.$b-d.$b,a.fb-d.fb);d.connect(a);this.mj=d}this.Jb&&this.Jb.Gt()}g.i.enable()}};
function Sa(a,c){var d=c.type;g.i.disable();try{var e=a.s.cg(d);e.gA(!0);e.hh(c.isCollapsed());if(c.Pa){var f=c.Pa();f&&e.kb(f)}for(a=0;a<c.S.length;a++){var h=c.S[a],k=e.S[a];for(d=0;d<h.Na.length;d++)k.Na[d].setValue(h.Na[d].getValue())}e.Td();e.za().setAttribute("visibility","hidden")}finally{g.i.enable()}return e}
function Ta(a,c,d){var e=c.local,f=c.closest;c=c.qq;if(e&&f){if(a.Oc&&a.Jb){if(a.Jb==f&&a.Oc==e)return!1;e=a.Oc.$b+d.x-a.Jb.$b;a=a.Oc.fb+d.y-a.Jb.fb;a=Math.sqrt(e*e+a*a);return!(f&&c>a-g.jB)}if(a.Oc||a.Jb)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Oc||!a.Jb);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0}
function Ua(a){a.Jb&&(g.g.o.removeNode(g.ua.Wy),delete g.ua.Wy);if(a.Ht){var c=a.Jb;c.type!=g.Ra||c.isConnected()?Va(a.Pk,!1):a.Pk.yF(c,!1);a.Pk=null;a.Ht=!1}else if(a.mj)if(a.mj){c=a.mj;var d=c.B,e=d.V,f=d.$,h=d.L;h=c.type==g.Ra&&!(h&&h.ka);!(c!=e||f&&f.ka)||h?D(C(c),!1):c.type==g.Sa&&c!=e?(e=c.ka,D(e.B,!1),f=f?f.ka:null,D(d,!0),f&&f.connect(e)):D(d,!0);if(c.ka)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.mj=null;d.za().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")}
g.Ho.prototype.Kk=function(){var a=[];this.Hk&&a.push(this.Hk);this.kj&&a.push(this.kj);return a};g.oi=function(a,c){this.Kb=a;this.s=c;this.Wf=new g.Ho(this.Kb);this.Ui=null;this.pg=!1;this.mg=this.Kb.Ta();this.tp=g.oi.EF(a)};g.oi.prototype.I=function(){this.Bc=this.s=this.Kb=null;this.tp.length=0;this.Wf&&(this.Wf.I(),this.Wf=null)};g.oi.EF=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=Wa(e);for(var f=0;f<e.length;f++)c.push({location:e[f].cj,icon:e[f]})}return c};
function Xa(a,c,d){d=a.bl(d);var e=g.g.X.sum(a.mg,d);a.Kb.ku(e);for(e=0;e<a.tp.length;e++){var f=a.tp[e],h=f.icon;f=g.g.X.sum(f.location,d);h.cj=f;h.isVisible()&&(h=h.Vb,h.bc=f,h.vq&&Da(h))}a.Ui=Ya(a.s,c);a.Wf.update(d,a.Ui);a.pg=a.Wf.pg;c=a.s.fd;a.pg?(Za(a.Kb,!0),a.Ui==g.cr&&c&&$a(c,!0)):(Za(a.Kb,!1),c&&$a(c,!1))}
function ab(a,c,d){Xa(a,c,d);a.tp=[];g.g.o.Kn();g.rb.Ss();c=a.bl(d);d=g.g.X.sum(a.mg,c);var e=a.Kb;e.Yn&&(e.translate(d.x,d.y),e.v.je.gp(e.v.jb));d=a.s.fd;a.pg?(d&&setTimeout(d.close.bind(d),100),a.Cm(),a.Kb.I(!1,!0)):d&&d.close();a.pg||(bb(a.Kb,c.x,c.y),a.Kb.Aj(!1),a.Cm(),a.Wf.Jb?(c=a.Wf,c.Jb&&(g.i.disable(),Ua(c),g.i.enable(),c.Oc.connect(c.Jb),c.zf.ga&&(g.rb.$D((G(c.Oc)?c.Jb:c.Oc).B),cb(db(c.zf))))):a.Kb.Da(),eb(a.Kb));a.s.Sc(!0);(c=a.s.ta)&&g.g.o.Tb(c.Gc,a.Kb.pe()?"blocklyToolboxDelete":"blocklyToolboxGrab");
g.i.aa(!1)}g.oi.prototype.Cm=function(){var a=new g.i.Bl(this.Kb);a.su=this.mg;a.yj();g.i.Oa(a)};g.oi.prototype.bl=function(a){a=new g.g.X(a.x/this.s.scale,a.y/this.s.scale);this.s.ij&&a.scale(1/this.s.options.Sb.scale);return a};g.oi.prototype.Kk=function(){return this.Wf&&this.Wf.Kk?this.Wf.Kk():[]};g.i.rg=function(a){this.Qf=a.id;this.Ec=a.v.id;this.group=g.i.cc();this.Rc=g.i.Rc};g.g.object.Y(g.i.rg,g.i.Abstract);g.i.rg.prototype.eb=function(){var a=g.i.rg.w.eb.call(this);this.Qf&&(a.commentId=this.Qf);return a};g.i.rg.prototype.qa=function(a){g.i.rg.w.qa.call(this,a);this.Qf=a.commentId};g.i.Xj=function(a,c,d){a&&(g.i.Xj.w.constructor.call(this,a),this.Az=c,this.iq=d)};g.g.object.Y(g.i.Xj,g.i.rg);b=g.i.Xj.prototype;b.type=g.i.Kv;
b.eb=function(){var a=g.i.Xj.w.eb.call(this);a.newContents=this.iq;return a};b.qa=function(a){g.i.Xj.w.qa.call(this,a);this.iq=a.newValue};b.Uk=function(){return this.Az==this.iq};b.run=function(a){var c;(c=ua(this).jp[this.Qf]||null)?c.nM(a?this.iq:this.Az):console.warn("Can't change non-existent comment: "+this.Qf)};g.i.sg=function(a){a&&(g.i.sg.w.constructor.call(this,a),this.xml=a.ov())};g.g.object.Y(g.i.sg,g.i.rg);g.i.sg.prototype.type=g.i.qo;
g.i.sg.prototype.eb=function(){var a=g.i.sg.w.eb.call(this);a.xml=g.R.Dd(this.xml);return a};g.i.sg.prototype.qa=function(a){g.i.sg.w.qa.call(this,a);this.xml=g.R.lh(a.xml)};g.i.sg.prototype.run=function(a){g.i.Mv(this,a)};g.i.Mv=function(a,c){var d=ua(a);c?(c=g.g.xml.createElement("xml"),c.appendChild(a.xml),g.R.Fh(c,d)):(d=d.jp[a.Qf]||null)?d.I(!1,!1):console.warn("Can't uncreate non-existent comment: "+a.Qf)};g.i.tg=function(a){a&&(g.i.tg.w.constructor.call(this,a),this.xml=a.ov())};
g.g.object.Y(g.i.tg,g.i.rg);g.i.tg.prototype.type=g.i.Lv;g.i.tg.prototype.eb=function(){return g.i.tg.w.eb.call(this)};g.i.tg.prototype.qa=function(a){g.i.tg.w.qa.call(this,a)};g.i.tg.prototype.run=function(a){g.i.Mv(this,!a)};g.i.ri=function(a){a&&(g.i.ri.w.constructor.call(this,a),this.Bs=a,this.tu=a.Iy(),this.oj=null)};g.g.object.Y(g.i.ri,g.i.rg);b=g.i.ri.prototype;
b.yj=function(){if(!this.Bs)throw Error("Tried to record the new position of a comment on the same event twice.");this.oj=this.Bs.Iy();this.Bs=null};b.type=g.i.so;b.eb=function(){var a=g.i.ri.w.eb.call(this);this.oj&&(a.newCoordinate=Math.round(this.oj.x)+","+Math.round(this.oj.y));return a};b.qa=function(a){g.i.ri.w.qa.call(this,a);a.newCoordinate&&(a=a.newCoordinate.split(","),this.oj=new g.g.X(Number(a[0]),Number(a[1])))};b.Uk=function(){return g.g.X.Je(this.tu,this.oj)};
b.run=function(a){var c;if(c=ua(this).jp[this.Qf]||null){a=a?this.oj:this.tu;var d=c.Iy();c.moveBy(a.x-d.x,a.y-d.y)}else console.warn("Can't move non-existent comment: "+this.Qf)};g.Cl=function(a,c){this.uc=a;this.s=c;this.Ui=null;this.Mq=!1;this.mg=this.uc.Ta();this.Wi=g.g.fj()&&c.je?c.je:null};g.Cl.prototype.I=function(){this.Wi=this.s=this.uc=null};function fb(a,c,d){d=a.bl(d);d=g.g.X.sum(a.mg,d);a.uc.ku(a.Wi,d);a.uc.pe()&&(a.Ui=Ya(a.s,c),a.Mq=a.Ui!=g.Pv,c=a.s.fd,a.Mq?(Za(a.uc,!0),a.Ui==g.cr&&c&&$a(c,!0)):(Za(a.uc,!1),c&&$a(c,!1)))}
function gb(a,c,d){fb(a,c,d);c=a.bl(d);c=g.g.X.sum(a.mg,c);a.uc.moveTo(c.x,c.y);c=a.s.fd;a.Mq?(c&&setTimeout(c.close.bind(c),100),a.Cm(),a.uc.I(!1,!0)):c&&c.close();a.Mq||(a.Wi&&a.Wi.gp(a.s.xf),a.uc.Aj&&a.uc.Aj(!1),a.Cm());a.s.Sc(!0);a.s.ta&&g.g.o.Tb(a.s.ta.Gc,a.uc.pe()?"blocklyToolboxDelete":"blocklyToolboxGrab");g.i.aa(!1)}g.Cl.prototype.Cm=function(){if(this.uc.ez){var a=new g.i.ri(this.uc);a.tu=this.mg;a.yj();g.i.Oa(a)}};
g.Cl.prototype.bl=function(a){a=new g.g.X(a.x/this.s.scale,a.y/this.s.scale);this.s.ij&&a.scale(1/this.s.options.Sb.scale);return a};g.Cl.prototype.mu=function(){this.uc.moveTo(0,0);this.Wi.Mj(this.mg.x,this.mg.y);hb(this.Wi,this.uc.za())};g.OL={};g.hw=40;g.pw=125;g.tB=5;g.CB=10;g.zd=28;g.eB=g.zd;g.jB=8;g.RB="#000000";g.jo=250;g.Xq=10;g.cB=30;g.hC=750;g.PC=100;g.uB=!0;g.NB=.45;g.OB=.65;g.Ad={width:96,height:124,url:"sprites.png"};g.Ra=1;g.Ze=2;g.Sa=3;g.$e=4;g.vg=5;g.Tq=-1;g.zv=0;g.co=1;g.wI=0;g.xI=1;g.uI=1;g.vI=2;g.kk=[];g.kk[g.Ra]=g.Ze;g.kk[g.Ze]=g.Ra;g.kk[g.Sa]=g.$e;g.kk[g.$e]=g.Sa;g.Dg=0;g.Ei=1;g.Md=2;g.Cg=3;g.Pv=null;g.cr=1;g.Qv=2;g.Hw="VARIABLE";g.jD="VARIABLE_DYNAMIC";g.qw="PROCEDURE";g.xw="RENAME_VARIABLE_ID";g.Rv="DELETE_VARIABLE_ID";g.bm=function(a){this.s=a;this.pA=new g.g.X(a.scrollX,a.scrollY)};g.bm.prototype.I=function(){this.s=null};g.bm.prototype.iv=function(){g.selected&&ib(g.selected);ra(this.s)};g.bm.prototype.Gh=function(a){a=g.g.X.sum(this.pA,a);this.s.scroll(a.x,a.y)};g.Do=function(a){g.Do.w.constructor.call(this,a.Lk());this.yc=a.yc;this.pf=a.pf};g.g.object.Y(g.Do,g.bm);g.Do.prototype.Gh=function(a){a=g.g.X.sum(this.pA,a);this.pf?this.yc.set(-a.x):this.yc.set(-a.y)};g.J={};g.J.visible=!1;g.J.yk=!1;g.J.bC=50;g.J.wz=0;g.J.Hn=0;g.J.Ut=0;g.J.Vt=0;g.J.lb=null;g.J.oq=null;g.J.kw=0;g.J.lw=10;g.J.HC=10;g.J.MB=750;g.J.nr=5;g.J.Ca=null;g.J.Ja=function(){g.J.Ca||(g.J.Ca=document.createElement("div"),g.J.Ca.className="blocklyTooltipDiv",document.body.appendChild(g.J.Ca))};g.J.xk=function(a){g.ld(a,"mouseover",null,g.J.CG);g.ld(a,"mouseout",null,g.J.BG);a.addEventListener("mousemove",g.J.Cu,!1)};
g.J.CG=function(a){if(!g.J.yk){for(a=a.currentTarget;"string"!=typeof a.yf&&"function"!=typeof a.yf;)a=a.yf;g.J.lb!=a&&(g.J.Ga(),g.J.oq=null,g.J.lb=a);clearTimeout(g.J.wz)}};g.J.BG=function(){g.J.yk||(g.J.wz=setTimeout(function(){g.J.lb=null;g.J.oq=null;g.J.Ga()},1),clearTimeout(g.J.Hn))};
g.J.Cu=function(a){if(g.J.lb&&g.J.lb.yf&&!g.J.yk)if(g.J.visible){var c=g.J.Ut-a.pageX;a=g.J.Vt-a.pageY;Math.sqrt(c*c+a*a)>g.J.HC&&g.J.Ga()}else g.J.oq!=g.J.lb&&(clearTimeout(g.J.Hn),g.J.Ut=a.pageX,g.J.Vt=a.pageY,g.J.Hn=setTimeout(g.J.dH,g.J.MB))};g.J.Ga=function(){g.J.visible&&(g.J.visible=!1,g.J.Ca&&(g.J.Ca.style.display="none"));g.J.Hn&&clearTimeout(g.J.Hn)};g.J.block=function(){g.J.Ga();g.J.yk=!0};g.J.yH=function(){g.J.yk=!1};
g.J.dH=function(){if(!g.J.yk&&(g.J.oq=g.J.lb,g.J.Ca)){g.J.Ca.innerHTML="";for(var a=g.J.lb.yf;"function"==typeof a;)a=a();a=g.g.ib.EA(a,g.J.bC);a=a.split("\n");for(var c=0;c<a.length;c++){var d=document.createElement("div");d.appendChild(document.createTextNode(a[c]));g.J.Ca.appendChild(d)}a=g.J.lb.G;c=document.documentElement.clientWidth;d=document.documentElement.clientHeight;g.J.Ca.style.direction=a?"rtl":"ltr";g.J.Ca.style.display="block";g.J.visible=!0;var e=g.J.Ut;e=a?e-(g.J.kw+g.J.Ca.offsetWidth):
e+g.J.kw;var f=g.J.Vt+g.J.lw;f+g.J.Ca.offsetHeight>d+window.scrollY&&(f-=g.J.Ca.offsetHeight+2*g.J.lw);a?e=Math.max(g.J.nr-window.scrollX,e):e+g.J.Ca.offsetWidth>c+window.scrollX-2*g.J.nr&&(e=c-g.J.Ca.offsetWidth-2*g.J.nr);g.J.Ca.style.top=f+"px";g.J.Ca.style.left=e+"px"}};g.$j=function(a,c){this.Bc=this.Cc=this.Ej=this.Fj=this.te=this.Cd=this.vz=null;this.Fs=c;this.Tm=this.gj=this.Um=this.Yi=!1;this.tf=a;this.P=this.ni=this.ef=this.Gg=this.mq=this.lq=null;this.Vp=this.$i=this.$w=!1;this.Sy=!g.uB};b=g.$j.prototype;b.I=function(){g.Touch.Bh();g.J.yH();this.Fs.Kc=null;this.lq&&g.Ua(this.lq);this.mq&&g.Ua(this.mq);this.P=this.Bc=this.Cc=this.Ej=this.Fj=null;this.ef&&(this.ef.I(),this.ef=null);this.ni&&(this.ni.I(),this.ni=null);this.Gg&&(this.Gg.I(),this.Gg=null)};
function jb(a,c){a.Cd=g.g.X.xm(new g.g.X(c.clientX,c.clientY),a.vz);if(a.Yi)var d=!1;else a.Yi=g.g.X.UF(a.Cd)>(a.P?g.CB:g.tB),d=a.Yi;if(d){if(a.$w)throw Error("updateIsDragging_ should only be called once per gesture.");a.$w=!0;if(a.te){a.Tm=!0;a.Gg=new g.Cl(a.te,a.Bc);d=a.Gg;g.i.cc()||g.i.aa(!0);d.s.Sc(!1);d.uc.ls=!1;d.Wi&&d.mu();d.uc.Aj&&d.uc.Aj(!0);var e=d.s.ta;e&&g.g.o.qb(e.Gc,d.uc.pe()?"blocklyToolboxDelete":"blocklyToolboxGrab");fb(a.Gg,a.tf,a.Cd);d=!0}else d=!1;if(!d){if(a.Cc)if(a.P?(a.P.dz(a.Cc)?
((d=!kb(a.P))||(d=a.Cd,d=Math.atan2(d.y,d.x)/Math.PI*180,e=a.P.DE,d=d<e&&d>-e||d<-180+e||d>180-e?!0:!1),d?(a.Bc=a.P.tb,lb(a.Bc),g.i.cc()||g.i.aa(!0),a.Ej=null,a.Cc=mb(a.P,a.Cc),a.Cc.select(),d=!0):d=!1):d=!1,a.gj=d):a.Cc.Nc()&&(a.gj=!0),a.gj){a.ef=new g.oi(a.Cc,a.Bc);d=a.ef;e=a.Cd;var f=a.Sy;g.i.cc()||g.i.aa(!0);d.s.ij&&cb(d.Kb);g.g.o.Jn();d.s.Sc(!1);g.rb.Ss();if(d.Kb.getParent()||f&&d.Kb.V&&C(d.Kb.V))D(d.Kb,f),e=d.bl(e),e=g.g.X.sum(d.mg,e),d.Kb.translate(e.x,e.y),g.rb.xE(d.Kb);d.Kb.Aj(!0);d.Kb.mu();
(e=d.s.ta)&&g.g.o.qb(e.Gc,d.Kb.pe()?"blocklyToolboxDelete":"blocklyToolboxGrab");Xa(a.ef,a.tf,a.Cd);d=!0}else d=!1;else d=!1;if(d=!d)if(a.P)d=kb(a.P);else if(d=a.Bc)d=a.Bc,d=d.options.Pc&&d.options.Pc.Gh;d&&(a.ni=a.P?new g.Do(a.P):new g.bm(a.Bc),a.Um=!0,a.ni.iv())}g.Yh()}a.tf=c}
b.Ts=function(a){g.g.Yp(a)?this.cancel():(this.$i=!0,g.rb.Ss(),lb(this.Bc),this.Bc.ij&&this.Bc.resize(),pa(this.Bc),this.tf=a,g.wc(!!this.P),g.J.block(),this.Cc&&(!this.Cc.ec&&a.shiftKey?(g.navigation.et(),t(this.Fs.bb,g.navigation.yt(this.Cc))):this.Cc.select()),g.g.jj(a)?ba(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||g.SF(a,this),this.vz=new g.g.X(a.clientX,a.clientY),this.Sy=a.altKey||a.ctrlKey||a.metaKey,this.xk(a)))};
b.xk=function(a){this.lq=g.ca(document,"mousemove",null,this.Nm.bind(this));this.mq=g.ca(document,"mouseup",null,this.Kp.bind(this));a.preventDefault();a.stopPropagation()};b.Nm=function(a){jb(this,a);this.Um?this.ni.Gh(this.Cd):this.gj?Xa(this.ef,this.tf,this.Cd):this.Tm&&fb(this.Gg,this.tf,this.Cd);a.preventDefault();a.stopPropagation()};
b.Kp=function(a){jb(this,a);g.Yh();if(this.Vp)console.log("Trying to end a gesture recursively.");else{this.Vp=!0;if(this.Tm)gb(this.Gg,a,this.Cd);else if(this.gj)ab(this.ef,a,this.Cd);else if(this.Um){var c=this.ni;c.Gh(this.Cd);sa(c.s)}else if(this.te&&!this.Yi)this.te.aH&&this.te.aH(),this.te.select&&this.te.select();else if(nb(this))this.Fj.wf(),ob(this);else if(this.Ej&&!this.Yi&&!nb(this))this.P&&this.P.wk?this.Cc.isEnabled()&&(g.i.cc()||g.i.aa(!0),eb(mb(this.P,this.Cc))):g.i.Oa(new g.i.Bd(this.Ej,
"click",void 0,void 0)),ob(this),g.i.aa(!1);else if(!(this.Ej||this.te||this.Fj||this.Yi))if(c=this.Fs,a.shiftKey){g.navigation.et();var d=g.g.YG(c,new g.g.X(a.clientX,a.clientY));d=g.F.sm(c,d);t(c.bb,d)}else g.selected&&ib(g.selected);a.preventDefault();a.stopPropagation();this.I()}};b.cancel=function(){if(!this.Vp){g.Yh();if(this.Tm)gb(this.Gg,this.tf,this.Cd);else if(this.gj)ab(this.ef,this.tf,this.Cd);else if(this.Um){var a=this.ni;a.Gh(this.Cd);sa(a.s)}this.I()}};
function ba(a,c){a.Cc?(ob(a),g.wc(a.P),a.Cc.Gn(c)):a.te?a.te.Gn(c):a.Bc&&!a.P&&(g.wc(),a.Bc.Gn(c));c.preventDefault();c.stopPropagation();a.I()}function pb(a,c,d){if(a.$i)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");a.Bc||(a.Bc=d);a.tf=c;a.Ts(c);g.Qe&&g.navigation.cb(g.navigation.Ul)}function qb(a,c,d){if(a.$i)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");a.P||(a.P=d);pb(a,c,d.Lk())}
function ob(a){a.Cc&&!a.P&&cb(a.Cc)}function rb(a,c){a.Ej||a.te||(a.Ej=c,c.ec&&c!=db(c)?sb(a,db(c)):sb(a,c))}function sb(a,c){c.hb?sb(a,c.getParent()):a.Cc=c}function nb(a){if(a.Fj){var c=a.Fj;c=!!c.B&&c.B.pd()&&!!c.wf&&"function"===typeof c.wf}else c=!1;return c&&!a.Yi&&(!a.P||!a.P.wk)}b.lc=function(){return this.Um||this.gj||this.Tm};b.Kk=function(){return this.ef?this.ef.Kk():[]};g.$j.Jt=function(){for(var a=g.Ob.getAll(),c=0,d;d=a[c];c++)if(d.Kc)return!0;return!1};g.pa=function(a,c,d){this.vA=this.Oj=this.$a=null;this.Bb=new g.g.ge(0,0);this.$c=null;d&&this.nd(d);this.setValue(a);c&&(this.Oj=c)};g.pa.io=16;g.pa.Ew=12.5;g.pa.tk=10;g.pa.Yr=10;g.pa.ug=g.pa.tk/2;b=g.pa.prototype;b.name=void 0;b.fq=50;b.B=null;b.qf=!0;b.mi=!0;b.hp=null;g.pa.Mo="\u00a0";b=g.pa.prototype;b.Ef=!0;b.Ci=!1;b.nd=function(a){var c=a.tooltip;"string"==typeof c&&(c=g.g.nc(a.tooltip));c&&this.Ha(c)};b.cv=function(a){if(this.B)throw Error("Field already bound to a block.");this.B=a};
b.U=function(){this.me||(this.me=g.g.o.K("g",{},null),this.isVisible()||(this.me.style.display="none"),this.B.za().appendChild(this.me),this.Wg(),this.nh(),this.Ha(this.vA),g.J.xk(this.hp||this.za()),this.uz=g.ca(this.hp||this.za(),"mousedown",this,this.$h),this.dj())};b.Wg=function(){tb(this);ub(this)};b.dj=function(){};
function tb(a){a.Bb.height=Math.max(a.Bb.height,g.pa.io);a.Bb.width=Math.max(a.Bb.width,g.pa.tk);a.Nd=g.g.o.K("rect",{rx:4,ry:4,x:0,y:0,height:a.Bb.height,width:a.Bb.width},a.me)}function ub(a){a.Dc=g.g.o.K("text",{"class":"blocklyText",y:g.pa.Ew,x:a.Nd?g.pa.ug:0},a.me);a.Kj=document.createTextNode("");a.Dc.appendChild(a.Kj)}b.Fm=function(a){this.setValue(a.textContent)};b.tA=function(a){a.textContent=this.getValue();return a};b.I=function(){g.D.Ok(this);g.ba.Ok(this);this.uz&&g.Ua(this.uz);g.g.o.removeNode(this.me)};
b.nh=function(){var a=this.hp||this.za();this.Ef&&a&&(this.B.pd()?(g.g.o.qb(a,"blocklyEditableText"),g.g.o.Tb(a,"blocklyNonEditableText"),a.style.cursor=this.vo):(g.g.o.qb(a,"blocklyNonEditableText"),g.g.o.Tb(a,"blocklyEditableText"),a.style.cursor=""))};b.isVisible=function(){return this.mi};b.Yb=function(a){if(this.mi!=a){this.mi=a;var c=this.za();c&&(c.style.display=a?"block":"none")}};function vb(a,c){a.Oj=c}b.Gy=function(){return this.Oj};b.za=function(){return this.me};b.Ve=function(){};
b.bh=function(){this.Kj&&(this.Kj.nodeValue=this.Bp(),this.vv())};b.vv=function(){var a=g.g.o.Lm(this.Dc);this.Nd&&(a+=g.pa.tk,this.Nd.setAttribute("width",a));this.Bb.width=a};b.Tg=function(){if(!this.isVisible())return new g.g.ge(0,0);this.qf?(this.bh(),this.qf=!1):this.mi&&0==this.Bb.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.bh());return this.Bb};
function wb(a){var c=a.Nd.getBBox(),d=c.height*a.B.v.scale;c=c.width*a.B.v.scale;a=g.g.style.Fp(a.Nd);return{top:a.y,bottom:a.y+d,left:a.x,right:a.x+c}}b.Bp=function(){var a=this.dc();if(!a)return g.pa.Mo;a.length>this.fq&&(a=a.substring(0,this.fq-2)+"\u2026");a=a.replace(/\s/g,g.pa.Mo);this.B&&this.B.G&&(a+="\u200f");return a};b.dc=function(){if(this.Hp){var a=this.Hp.call(this);if(null!==a)return String(a)}return String(this.getValue())};
b.kl=function(){throw Error("setText method is deprecated");};b.fn=function(){this.qf=!0};function xb(a){a.qf=!0;a.B&&a.B.ga&&(a.B.Da(),a.B.Qb())}b.setValue=function(a){if(null!==a){var c=this.Og(a);a=yb(this,a,c);if(!(a instanceof Error)){if(c=this.Gy())if(c=c.call(this,a),a=yb(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.B&&g.i.isEnabled()&&g.i.Oa(new g.i.qg(this.B,"field",this.name||null,c,a)),this.Pg(a),this.qf&&xb(this))}}};
function yb(a,c,d){if(null===d)return a.Rx(),a.qf&&xb(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.$a};b.Og=function(a){return null===a||void 0===a?null:a};b.Pg=function(a){this.$a=a;this.qf=!0};b.Rx=function(){};b.$h=function(a){if(this.B&&this.B.v&&(a=this.B.v.Sg(a))){if(a.$i)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.Fj||(a.Fj=this)}};b.Ha=function(a){var c=this.hp||this.za();c?c.yf=a||""===a?a:this.B:this.vA=a};
b.wn=function(){return!1};b.Yf=function(){for(var a=null,c=this.B,d=c.S,e=0;e<c.S.length;e++)for(var f=d[e],h=f.Na,k=0;k<h.length;k++)if(h[k]===this){a=f;break}return a};b.uy=function(){return!1};b.gz=function(){return!1};b.dg=function(){return!1};b.En=function(a){a?(this.me.appendChild(a),this.$c=a):this.$c=null};b.Fn=function(a){a&&this.me.appendChild(a)};g.vc={};g.vc.Sn={};g.vc.register=function(a,c){if("string"!=typeof a||""==a.trim())throw Error('Invalid field type "'+a+'". The type must be a non-empty string.');if(g.vc.Sn[a])throw Error('Error: Field "'+a+'" is already registered.');if(!c||"function"!=typeof c.qa)throw Error('Field "'+c+'" must have a fromJson function');a=a.toLowerCase();g.vc.Sn[a]=c};g.vc.unregister=function(a){g.vc.Sn[a]?delete g.vc.Sn[a]:console.warn('No field mapping for type "'+a+'" found to unregister')};
g.vc.qa=function(a){var c=g.vc.Sn[a.type.toLowerCase()];return c?c.qa(a):(console.warn("Blockly could not create a field of type "+a.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null)};g.Bf=function(a){this.name=a};g.F=function(a,c,d){if(!c)throw Error("Cannot create a node without a location.");this.Tn=a;this.Sm=g.F.IF(a);this.sa=c;(a=d||null)&&a.GA&&(this.HA=a.GA)};g.F.types={xe:"field",ae:"block",xg:"input",mk:"output",Ce:"next",Ee:"previous",Jf:"stack",Ji:"workspace"};g.F.pB=-20;g.F.IF=function(a){switch(a){case g.F.types.Ee:case g.F.types.Ce:case g.F.types.xg:case g.F.types.mk:return!0}return!1};g.F.qm=function(a){return new g.F(g.F.types.xe,a)};
g.F.Sf=function(a){return a?a.type==g.Ra||a.type==g.Sa&&a.Yf()?g.F.Qi(a.Yf()):a.type==g.Sa?new g.F(g.F.types.Ce,a):a.type==g.Ze?new g.F(g.F.types.mk,a):a.type==g.$e?new g.F(g.F.types.Ee,a):null:null};g.F.Qi=function(a){return a?new g.F(g.F.types.xg,a.connection):null};g.F.Lg=function(a){return new g.F(g.F.types.ae,a)};g.F.rm=function(a){return new g.F(g.F.types.Jf,a)};g.F.sm=function(a,c){return new g.F(g.F.types.Ji,a,{GA:c})};b=g.F.prototype;b.Rb=function(){return this.Tn};
function zb(a,c){a=a.sa;a instanceof g.lo||(a=a.B);if(!a||!a.v)return null;var d=db(a);a=A(d.v,!0);for(var e=0,f;f=a[e];e++)if(d.id==f.id)return c=e+(c?1:-1),-1==c||c==a.length?null:g.F.rm(a[c]);throw Error("Couldn't find "+(c?"next":"previous")+" stack?!");}function Ab(a){if(!a)return null;do var c=a.$&&C(a.$);while(c&&q(c)==a&&(a=c));return(c=a.$||a.L)&&c.ka&&c.ka.Yf()?g.F.Qi(c.ka.Yf()):g.F.rm(a)}
b.next=function(){switch(this.Tn){case g.F.types.Jf:return zb(this,!0);case g.F.types.mk:return g.F.Lg(this.sa.B);case g.F.types.xe:a:{var a=this.sa,c=a.Yf();var d=a.B;a=c.Na.indexOf(a)+1;c=d.S.indexOf(c);for(var e;e=d.S[c];c++){for(var f=e.Na;a<f.length;){if(f[a].Ef){d=g.F.qm(f[a]);break a}a++}a=0;if(e.connection){d=g.F.Qi(e);break a}}d=null}return d;case g.F.types.xg:a:{a=this.sa.Yf();d=a.B;for(a=d.S.indexOf(a)+1;c=d.S[a];a++){e=c.Na;f=0;for(var h;h=e[f];f++)if(h.Ef){d=g.F.qm(h);break a}if(c.connection){d=
g.F.Qi(c);break a}}d=null}return d;case g.F.types.ae:if(d=this.sa.V)return g.F.Sf(d);break;case g.F.types.Ee:return g.F.Lg(this.sa.B);case g.F.types.Ce:if(d=this.sa.ka)return g.F.Sf(d)}return null};
b.Qm=function(){switch(this.Tn){case g.F.types.Ji:var a=A(this.sa,!0);if(0<a.length)return g.F.rm(a[0]);break;case g.F.types.Jf:a=this.sa;var c=a.$||a.L;return c?g.F.Sf(c):g.F.Lg(a);case g.F.types.ae:a:{a=this.sa.S;c=0;for(var d;d=a[c];c++){for(var e=d.Na,f=0,h;h=e[f];f++)if(h.Ef){a=g.F.qm(h);break a}if(d.connection){a=g.F.Qi(d);break a}}a=null}return a;case g.F.types.xg:if(a=this.sa.ka)return g.F.Sf(a)}return null};
b.hg=function(){switch(this.Tn){case g.F.types.Jf:return zb(this,!1);case g.F.types.xe:a:{var a=this.sa;var c=a.Yf();var d=a.B;a=c.Na.indexOf(a)-1;for(var e=d.S.indexOf(c),f;f=d.S[e];e--){if(f.connection&&f!==c){c=g.F.Qi(f);break a}for(f=f.Na;-1<a;){if(f[a].Ef){c=g.F.qm(f[a]);break a}a--}0<=e-1&&(a=d.S[e-1].Na.length-1)}c=null}return c;case g.F.types.xg:a:{c=this.sa.Yf();d=c.B;for(a=d.S.indexOf(c);e=d.S[a];a--){if(e.connection&&e!==c){c=g.F.Qi(e);break a}e=e.Na;f=e.length-1;for(var h;h=e[f];f--)if(h.Ef){c=
g.F.qm(h);break a}}c=null}return c;case g.F.types.ae:c=this.sa.L;if(c=this.sa.$||c)return g.F.Sf(c);break;case g.F.types.Ee:if((c=this.sa.ka)&&!c.Yf())return g.F.Sf(c);break;case g.F.types.Ce:return g.F.Lg(this.sa.B)}return null};
b.pn=function(){switch(this.Tn){case g.F.types.Jf:var a=this.sa.Ta();return g.F.sm(this.sa.v,new g.g.X(a.x,a.y+g.F.pB));case g.F.types.mk:return(a=this.sa.ka)?g.F.Sf(a):g.F.rm(this.sa.B);case g.F.types.xe:return g.F.Lg(this.sa.B);case g.F.types.xg:return g.F.Lg(this.sa.B);case g.F.types.ae:return Ab(this.sa);case g.F.types.Ee:return Ab(this.sa.B);case g.F.types.Ce:return Ab(this.sa.B)}return null};g.g.ya={DL:0,wJ:3,TA:8,Cw:9,OJ:12,Fl:13,NC:16,jI:17,OA:18,CK:19,XH:20,er:27,hL:32,BK:33,AK:34,BI:35,gJ:36,Io:37,Zl:38,Ro:39,El:40,FK:43,HK:44,ir:45,Dl:46,ZERO:48,ONE:49,vL:50,pL:51,ZI:52,WI:53,dL:54,bL:55,AI:56,KJ:57,UI:59,SI:61,RI:173,TI:163,JK:63,PH:64,JA:65,RH:66,YA:67,oB:68,E:69,DI:70,$I:71,bJ:72,PB:73,lJ:74,YB:75,mJ:76,vJ:77,IJ:78,dK:79,zK:80,Q:81,KK:82,KC:83,VC:84,wL:85,gD:86,kD:87,Ow:88,GL:89,qD:90,qC:91,EL:92,hI:93,cK:96,WJ:97,bK:98,aK:99,SJ:100,RJ:101,$J:102,ZJ:103,QJ:104,VJ:105,UJ:106,YJ:107,
TJ:109,XJ:110,PJ:111,EI:112,II:113,JI:114,KI:115,LI:116,MI:117,NI:118,OI:119,QI:120,FI:121,GI:122,HI:123,NJ:144,YK:145,VI:166,nJ:183,$K:186,kI:189,CI:187,eI:188,DK:190,eL:191,LH:192,qL:192,cL:222,eK:219,SH:220,aI:221,CL:224,xJ:224,yJ:91,zJ:93,BL:229,AL:252,EK:255};g.wb={};g.wb.sb={};g.wb.sb.lj={};g.wb.sb.iu={NC:"Shift",gB:"Control",OA:"Alt",qC:"Meta"};g.wb.sb.lM=function(a,c){var d=g.wb.sb.dF(c);d&&delete g.wb.sb.lj[d];g.wb.sb.lj[a]=c};g.wb.sb.bH=function(a){g.wb.sb.lj=a};g.wb.sb.UL=function(){var a={};g.g.object.ag(a,g.wb.sb.lj);return a};g.wb.sb.QE=function(a){return g.wb.sb.lj[a]};g.wb.sb.dF=function(a){for(var c=Object.keys(g.wb.sb.lj),d=0,e;e=c[d];d++)if(g.wb.sb.lj[e].name===a.name)return e;return null};
g.wb.sb.ZG=function(a){for(var c=g.g.object.values(g.wb.sb.iu),d="",e=0,f;f=c[e];e++)a.getModifierState(f)&&(d+=f);return d+=a.keyCode};g.wb.sb.dE=function(){for(var a=g.g.ya.YB,c=[g.wb.sb.iu.gB],d="",e=g.g.object.values(g.wb.sb.iu),f=0,h;h=c[f];f++)if(-1<e.indexOf(h))d+=h;else throw Error(h+" is not a valid modifier key.");return d+a};
g.wb.sb.bE=function(){var a={},c=g.wb.sb.dE();a[g.g.ya.kD]=g.navigation.bo;a[g.g.ya.JA]=g.navigation.Rq;a[g.g.ya.KC]=g.navigation.ao;a[g.g.ya.oB]=g.navigation.Qq;a[g.g.ya.PB]=g.navigation.LA;a[g.g.ya.Fl]=g.navigation.MA;a[g.g.ya.Ow]=g.navigation.KA;a[g.g.ya.VC]=g.navigation.NA;a[g.g.ya.E]=g.navigation.Pq;a[g.g.ya.er]=g.navigation.Pq;a[c]=g.navigation.yv;return a};g.navigation={};g.navigation.Zk=null;g.navigation.Bw=1;g.navigation.Ul=2;g.navigation.Or=3;g.navigation.Ri=g.navigation.Ul;g.navigation.gb={Ee:"previous",Ce:"next",Fo:"in",Qo:"out",ir:"insert",qr:"mark",Sv:"disconnect",Fw:"toolbox",gr:"exit",Qr:"toggle_keyboard_nav"};g.navigation.gy=function(){var a=g.Hb(),c=a.ta;c&&(g.navigation.Ri=g.navigation.Or,g.navigation.$z(!1),a.fc.Wb||g.navigation.du(),c.Id.Wd||(a=c.Id,(c=a.Ne())&&a.ay&&Bb(c,a.ay)))};
g.navigation.ey=function(){g.navigation.Ri=g.navigation.Bw;var a=g.Hb();var c=a.ta;c=c?c.P:Cb(a);a.fc.Wb||g.navigation.du();c&&c.Lk()&&(a=A(c.Lk(),!0),0<a.length&&(a=a[0],a=g.F.rm(a),t(g.navigation.Jh(),a)))};g.navigation.yp=function(){g.wc();var a=g.Hb(),c=a.bb,d=!!a.ta,e=A(a,!0);g.navigation.$z(d);g.navigation.Ri=g.navigation.Ul;0<e.length?t(c,g.navigation.yt(e[0])):(a=g.F.sm(a,new g.g.X(100,100)),t(c,a))};
g.navigation.Jh=function(){var a=g.Hb(),c=null;a.ga&&(c=(a=(c=a.ta)?c.P:Cb(a))?a.s.bb:null);return c};g.navigation.HF=function(){var a=g.Hb(),c=Cb(a);if(c&&c.isVisible()){var d=g.navigation.Jh().Wb.sa;d.isEnabled()?(c=mb(c,d),c.Da(),Db(c,!1),t(a.bb,g.F.Lg(c)),g.navigation.sz()||g.navigation.ud("Something went wrong while inserting a block from the flyout."),g.navigation.yp(),t(a.bb,g.navigation.yt(c)),g.navigation.QG()):g.navigation.ud("Can't insert a disabled block.")}else g.navigation.ud("Trying to insert from the flyout when the flyout does not  exist or is not visible")};
g.navigation.$z=function(a){g.navigation.Jh()&&(g.navigation.Jh().Ga(),a&&Cb(g.Hb()).Ga())};
g.navigation.WF=function(){var a=g.Hb().fc.Wb,c=g.Hb().bb.Wb;if(!a)return g.navigation.ud("Cannot insert with no marked node."),!1;if(!c)return g.navigation.ud("Cannot insert with no cursor node."),!1;a=a.Rb();c=c.Rb();return a==g.F.types.xe?(g.navigation.ud("Should not have been able to mark a field."),!1):a==g.F.types.ae?(g.navigation.ud("Should not have been able to mark a block."),!1):a==g.F.types.Jf?(g.navigation.ud("Should not have been able to mark a stack."),!1):c==g.F.types.xe?(g.navigation.ud("Cannot attach a field to anything else."),
!1):c==g.F.types.Ji?(g.navigation.ud("Cannot attach a workspace to anything else."),!1):!0};g.navigation.bG=function(a,c){if(a.hb)return g.navigation.ud("Cannot move a shadow block to the workspace."),!1;a.getParent()&&D(a,!1);a.moveTo(c.HA);return!0};
g.navigation.sz=function(){var a=g.Hb().fc.Wb,c=g.Hb().bb.Wb;if(!g.navigation.WF())return!1;var d=a.Rb(),e=c.Rb(),f=c.sa,h=a.sa;if(a.Sm&&c.Sm)return g.navigation.ff(f,h);if(a.Sm&&(e==g.F.types.ae||e==g.F.types.Jf))return g.navigation.az(f,h);if(d==g.F.types.Ji)return c=g.navigation.wt(c),g.navigation.bG(c,a);g.navigation.ud("Unexpected state in Blockly.navigation.modify_.");return!1};
g.navigation.wE=function(a,c){var d=a.B,e=c.B;db(d)==db(e)&&(-1<p(d,!1).indexOf(e)?g.navigation.Dp(c).disconnect():g.navigation.Dp(a).disconnect())};g.navigation.ju=function(a,c){if(!a||!c)return!1;var d=a.B;return Eb(c,a)==g.ua.no?(g.navigation.wE(a,c),G(c)||a.type!=g.Sa&&a.type!=g.Ra||db(d).moveBy(c.$b-a.$b,c.fb-a.fb),c.connect(a),!0):!1};g.navigation.Dp=function(a){var c=a.B;return G(a)?c.$?c.$:c.L?c.L:null:a};g.navigation.Ey=function(a){return G(a)?a:a.ka?a.ka:null};
g.navigation.ff=function(a,c){if(!a||!c)return!1;var d=g.navigation.Dp(a),e=g.navigation.Ey(c),f=g.navigation.Ey(a),h=g.navigation.Dp(c);if(d&&e&&g.navigation.ju(d,e)||f&&h&&g.navigation.ju(f,h)||g.navigation.ju(a,c))return!0;try{Fb(c,a)}catch(k){g.navigation.ud("Connection failed with error: "+k)}return!1};
g.navigation.az=function(a,c){switch(c.type){case g.$e:if(g.navigation.ff(a.V,c))return!0;break;case g.Sa:if(g.navigation.ff(a.$,c))return!0;break;case g.Ra:if(g.navigation.ff(a.L,c))return!0;break;case g.Ze:for(var d=0;d<a.S.length;d++){var e=a.S[d].connection;if(e&&e.type===g.Ra&&g.navigation.ff(e,c))return!0}if(a.L&&g.navigation.ff(a.L,c))return!0}g.navigation.ud("This block can not be inserted at the marked location.");return!1};
g.navigation.vE=function(){var a=g.Hb(),c=a.bb.Wb;if(c.Sm){var d=c.sa;d.isConnected()?(c=G(d)?d:d.ka,d=G(d)?d.ka:d,d.B.hb?g.navigation.Zt("Cannot disconnect a shadow block"):(c.disconnect(),Gb(d,c),cb(db(c.B)),c=g.F.Sf(c),t(a.bb,c))):g.navigation.Zt("Cannot disconnect unconnected connection")}else g.navigation.Zt("Cannot disconnect blocks when the cursor is not on a connection")};g.navigation.du=function(){var a=g.Hb();t(a.fc,a.bb.Wb)};g.navigation.QG=function(){var a=g.Hb();t(a.fc,null);a.fc.Ga()};
g.navigation.cb=function(a){g.navigation.Ri=a};g.navigation.wt=function(a){return a?a.Rb()===g.F.types.ae?a.sa:a.Rb()===g.F.types.Jf?a.sa:a.Rb()===g.F.types.Ji?null:a.sa.B:null};g.navigation.yt=function(a){var c=a.$||a.L;return c?g.F.Sf(c):g.F.Lg(a)};g.navigation.yz=function(a){var c=g.Hb();if(c&&(c=c.bb)){var d=g.navigation.wt(c.Wb);d===a?d.getParent()?(a=d.$||d.L)&&t(c,g.F.Sf(a.ka)):t(c,g.F.sm(d.v,d.Ta())):-1<a.Ih(!1).indexOf(d)&&t(c,g.F.sm(d.v,d.Ta()))}};
g.navigation.cG=function(a){var c=g.Hb().bb;if(c){var d=g.navigation.wt(c.Wb);d===a&&t(c,g.F.Lg(d))}};g.navigation.et=function(){g.Qe||(g.Qe=!0,g.navigation.yp())};g.navigation.tE=function(){if(g.Qe){var a=g.Hb();g.Qe=!1;a.bb.Ga();a.fc.Ga();g.navigation.Jh()&&g.navigation.Jh().Ga()}};g.navigation.Zt=function(a){g.navigation.Zk?g.navigation.Zk("log",a):console.log(a)};g.navigation.ud=function(a){g.navigation.Zk?g.navigation.Zk("warn",a):console.warn(a)};
g.navigation.QL=function(a){g.navigation.Zk?g.navigation.Zk("error",a):console.error(a)};g.navigation.Hz=function(a){a=g.wb.sb.ZG(a);return(a=g.wb.sb.QE(a))?g.navigation.dg(a):!1};g.navigation.dg=function(a){var c=g.Hb().options.readOnly,d=!1;g.Qe?c?-1<g.navigation.IC.indexOf(a)&&(d=g.navigation.My(a)):d=g.navigation.My(a):a.name===g.navigation.gb.Qr&&(g.navigation.et(),d=!0);return d};
g.navigation.My=function(a){var c=g.Hb();if(a.name===g.navigation.gb.Qr)return g.navigation.tE(),!0;if(a.name===g.navigation.gb.Fw)return c.ta?g.navigation.gy():g.navigation.ey(),!0;if(g.navigation.Ri===g.navigation.Ul){c=c.bb.Wb;var d=!1;c&&c.Rb()===g.F.types.xe&&(d=c.sa.dg(a));d||(d=g.navigation.FH(a));return d}return g.navigation.Ri===g.navigation.Bw?g.navigation.PE(a):g.navigation.Ri===g.navigation.Or?g.navigation.tH(a):!1};
g.navigation.FH=function(a){var c=g.Hb();switch(a.name){case g.navigation.gb.Ee:return c.bb.hg(),!0;case g.navigation.gb.Qo:return c.bb.pn(),!0;case g.navigation.gb.Ce:return c.bb.next(),!0;case g.navigation.gb.Fo:return c.bb.Qm(),!0;case g.navigation.gb.ir:return g.navigation.sz(),!0;case g.navigation.gb.qr:return g.navigation.lF(),!0;case g.navigation.gb.Sv:return g.navigation.vE(),!0;default:return!1}};
g.navigation.PE=function(a){switch(a.name){case g.navigation.gb.Ee:return g.navigation.Jh().hg(),!0;case g.navigation.gb.Qo:return g.navigation.gy(),!0;case g.navigation.gb.Ce:return g.navigation.Jh().next(),!0;case g.navigation.gb.qr:return g.navigation.HF(),!0;case g.navigation.gb.gr:return g.navigation.yp(),!0;default:return!1}};
g.navigation.tH=function(a){if(a.name===g.navigation.gb.gr)return g.navigation.yp(),!0;var c=g.Hb().ta.dg(a);return c||a.name!==g.navigation.gb.Fo?c:(g.navigation.ey(),!0)};g.navigation.lF=function(){var a=g.Hb().bb.Wb,c=a.Rb();c==g.F.types.xe?a.sa.wf():a.Sm||c==g.F.types.Ji?g.navigation.du():c==g.F.types.ae?g.navigation.ud("Cannot mark a block."):c==g.F.types.Jf&&g.navigation.ud("Cannot mark a stack.")};g.navigation.bo=new g.Bf(g.navigation.gb.Ee);g.navigation.Rq=new g.Bf(g.navigation.gb.Qo);
g.navigation.ao=new g.Bf(g.navigation.gb.Ce);g.navigation.Qq=new g.Bf(g.navigation.gb.Fo);g.navigation.LA=new g.Bf(g.navigation.gb.ir);g.navigation.MA=new g.Bf(g.navigation.gb.qr);g.navigation.KA=new g.Bf(g.navigation.gb.Sv);g.navigation.NA=new g.Bf(g.navigation.gb.Fw);g.navigation.Pq=new g.Bf(g.navigation.gb.gr);g.navigation.yv=new g.Bf(g.navigation.gb.Qr);g.navigation.IC=[g.navigation.bo,g.navigation.Rq,g.navigation.Qq,g.navigation.ao,g.navigation.yv];g.g.M={};g.g.M.QA="aria-";g.g.M.Jr="role";
g.g.M.If={JH:"alert",KH:"alertdialog",MH:"application",NH:"article",TH:"banner",WH:"button",YH:"checkbox",cI:"columnheader",dI:"combobox",fI:"complementary",gI:"contentinfo",nI:"definition",qI:"dialog",rI:"directory",tI:"document",YI:"form",HB:"grid",IB:"gridcell",JB:"group",eJ:"heading",hJ:"img",pJ:"link",qJ:"list",rJ:"listbox",sJ:"listitem",uJ:"log",AJ:"main",BJ:"marquee",CJ:"math",nC:"menu",EJ:"menubar",oC:"menuitem",pC:"menuitemcheckbox",FJ:"menuitemradio",JJ:"navigation",MJ:"note",gK:"option",
CC:"presentation",IK:"progressbar",LK:"radio",MK:"radiogroup",OK:"region",So:"row",UK:"rowgroup",VK:"rowheader",XK:"scrollbar",ZK:"search",aL:"separator",fL:"slider",iL:"spinbutton",jL:"status",Cw:"tab",kL:"table",lL:"tablist",mL:"tabpanel",nL:"textbox",oL:"textinfo",rL:"timer",sL:"toolbar",tL:"tooltip",dD:"tree",uL:"treegrid",eD:"treeitem"};
g.g.M.State={Sq:"activedescendant",OH:"atomic",QH:"autocomplete",VH:"busy",ZH:"checked",bI:"colindex",iI:"controls",pI:"describedby",sI:"disabled",yI:"dropeffect",Bo:"expanded",XI:"flowto",aJ:"grabbed",cJ:"haspopup",fJ:"hidden",jJ:"invalid",$B:"label",gw:"labelledby",aC:"level",tJ:"live",GJ:"multiline",HJ:"multiselectable",yC:"orientation",yK:"owns",BC:"posinset",GK:"pressed",NK:"readonly",PK:"relevant",SK:"required",WK:"rowindex",nk:"selected",MC:"setsize",gL:"sort",hD:"valuemax",iD:"valuemin",xL:"valuenow",
yL:"valuetext"};g.g.M.se=function(a,c){c?a.setAttribute(g.g.M.Jr,c):g.g.M.SG(a)};g.g.M.VL=function(a){return a.getAttribute(g.g.M.Jr)||null};g.g.M.SG=function(a){a.removeAttribute(g.g.M.Jr)};g.g.M.cb=function(a,c,d){Array.isArray(d)&&(d=d.join(" "));a.setAttribute(g.g.M.RE(c),d)};g.g.M.RE=function(a){return g.g.M.QA+a};g.g.Ab={};g.g.Ab.parse=function(a){a=String(a).toLowerCase().trim();var c=g.g.Ab.names[a];if(c)return c;c="#"==a[0]?a:"#"+a;if(/^#[0-9a-f]{6}$/.test(c))return c;if(/^#[0-9a-f]{3}$/.test(c))return["#",c[1],c[1],c[2],c[2],c[3],c[3]].join("");var d=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return d&&(a=Number(d[1]),c=Number(d[2]),d=Number(d[3]),0<=a&&256>a&&0<=c&&256>c&&0<=d&&256>d)?g.g.Ab.Uu(a,c,d):null};
g.g.Ab.Uu=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};g.g.Ab.Ty=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]};
g.g.Ab.zF=function(a){var c=g.NB,d=255*g.OB,e=0,f=0,h=0;if(0==c)h=f=e=d;else{var k=Math.floor(a/60),l=a/60-k;a=d*(1-c);var m=d*(1-c*l);c=d*(1-c*(1-l));switch(k){case 1:e=m;f=d;h=a;break;case 2:e=a;f=d;h=c;break;case 3:e=a;f=m;h=d;break;case 4:e=c;f=a;h=d;break;case 5:e=d;f=a;h=m;break;case 6:case 0:e=d,f=c,h=a}}return g.g.Ab.Uu(Math.floor(e),Math.floor(f),Math.floor(h))};
g.g.Ab.os=function(a,c,d){a=g.g.Ab.Ty(g.g.Ab.parse(a));c=g.g.Ab.Ty(g.g.Ab.parse(c));return g.g.Ab.Uu(Math.round(c[0]+d*(a[0]-c[0])),Math.round(c[1]+d*(a[1]-c[1])),Math.round(c[2]+d*(a[2]-c[2])))};g.g.Ab.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"};g.g.Ml={};g.g.Ml.iG=0;g.g.Ml.wy=function(){return"blockly:"+(g.g.Ml.iG++).toString(36)};g.Eb=function(a,c,d){g.Eb.w.constructor.call(this,a||g.Eb.oo[0],c,d);this.Bb=new g.g.ge(g.Eb.rB,g.pa.io)};g.g.object.Y(g.Eb,g.pa);g.Eb.qa=function(a){return new g.Eb(a.colour,void 0,a)};g.Eb.rB=26;g.Eb.mI=g.pa.io;b=g.Eb.prototype;b.Ci=!0;b.vo="default";b.qf=!1;b.As=null;b.sA=null;b.jm=0;b.nd=function(a){g.Eb.w.nd.call(this,a);a.colourOptions&&(this.As=a.colourOptions,this.sA=a.colourTitles);a.columns&&(this.jm=a.columns)};b.Wg=function(){tb(this);this.Nd.style.fillOpacity=1;this.Nd.style.fill=this.$a};
b.Og=function(a){return"string"!=typeof a?null:g.g.Ab.parse(a)};b.Pg=function(a){this.$a=a;this.Nd&&(this.Nd.style.fill=a)};b.dc=function(){var a=this.$a;/^#(.)\1(.)\2(.)\3$/.test(a)&&(a="#"+a[1]+a[3]+a[5]);return a};g.Eb.oo="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" ");
g.Eb.cD=[];g.Eb.po=7;b=g.Eb.prototype;b.setColumns=function(a){this.jm=a;return this};b.wf=function(){this.$g=this.ct();g.D.py().appendChild(this.$g);g.D.kA(this,this.dt.bind(this));this.$g.focus()};b.jq=function(a){a=(a=a.target)&&a.label;null!==a&&(this.setValue(a),g.D.Ok(this))};
b.Bu=function(a){var c=!1;if(a.keyCode===g.g.ya.Zl)Hb(this,0,-1),c=!0;else if(a.keyCode===g.g.ya.El)Hb(this,0,1),c=!0;else if(a.keyCode===g.g.ya.Io)Hb(this,-1,0),c=!0;else if(a.keyCode===g.g.ya.Ro)Hb(this,1,0),c=!0;else if(a.keyCode===g.g.ya.Fl){if(c=Ib(this))c=c&&c.label,null!==c&&this.setValue(c);g.D.aj();c=!0}c&&a.stopPropagation()};
b.dg=function(a){if(this.$g){if(a===g.navigation.bo)return Hb(this,0,-1),!0;if(a===g.navigation.ao)return Hb(this,0,1),!0;if(a===g.navigation.Rq)return Hb(this,-1,0),!0;if(a===g.navigation.Qq)return Hb(this,1,0),!0}return g.Eb.w.dg.call(this,a)};
function Hb(a,c,d){var e=a.As||g.Eb.oo,f=a.jm||g.Eb.po,h=a.od%f,k=Math.floor(a.od/f);h+=c;k+=d;0>c?0>h&&0<k?(h=f-1,k--):0>h&&(h=0):0<c?h>f-1&&k<Math.floor(e.length/f)-1?(h=0,k++):h>f-1&&h--:0>d?0>k&&(k=0):0<d&&k>Math.floor(e.length/f)-1&&(k=Math.floor(e.length/f)-1);Jb(a,a.$g.childNodes[k].childNodes[h],k*f+h)}b.Cu=function(a){var c=(a=a.target)&&a.getAttribute("data-index");null!==c&&c!==this.od&&Jb(this,a,Number(c))};b.xG=function(){this.$g.focus()};
b.zG=function(){this.$g.blur();var a=Ib(this);a&&g.g.o.Tb(a,"blocklyColourHighlighted")};function Ib(a){var c=a.jm||g.Eb.po,d=a.$g.childNodes[Math.floor(a.od/c)];return d?d.childNodes[a.od%c]:null}function Jb(a,c,d){var e=Ib(a);e&&g.g.o.Tb(e,"blocklyColourHighlighted");g.g.o.qb(c,"blocklyColourHighlighted");a.od=d;g.g.M.cb(a.$g,g.g.M.State.Sq,c.getAttribute("id"))}
b.ct=function(){var a=this.jm||g.Eb.po,c=this.As||g.Eb.oo,d=this.sA||g.Eb.cD,e=this.getValue(),f=document.createElement("table");f.className="blocklyColourTable";f.tabIndex=0;f.dir="ltr";g.g.M.se(f,g.g.M.If.HB);g.g.M.cb(f,g.g.M.State.Bo,!0);g.g.M.cb(f,"rowcount",Math.floor(c.length/a));g.g.M.cb(f,"colcount",a);for(var h,k=0;k<c.length;k++){0==k%a&&(h=document.createElement("tr"),g.g.M.se(h,g.g.M.If.So),f.appendChild(h));var l=document.createElement("td");h.appendChild(l);l.label=c[k];l.title=d[k]||
c[k];l.id=g.g.Ml.wy();l.setAttribute("data-index",k);g.g.M.se(l,g.g.M.If.IB);g.g.M.cb(l,g.g.M.State.$B,c[k]);g.g.M.cb(l,g.g.M.State.nk,c[k]==e);l.style.backgroundColor=c[k];c[k]==e&&(l.className="blocklyColourSelected",this.od=k)}this.xu=g.ca(f,"click",this,this.jq,!0);this.eg=g.ca(f,"mousemove",this,this.Cu,!0);this.wG=g.ca(f,"mouseenter",this,this.xG,!0);this.yG=g.ca(f,"mouseleave",this,this.zG,!0);this.nn=g.ca(f,"keydown",this,this.Bu);return f};
b.dt=function(){g.Ua(this.xu);g.Ua(this.eg);g.Ua(this.wG);g.Ua(this.yG);g.Ua(this.nn);this.$g=null};
g.Vc.register([".blocklyColourTable {","border-collapse: collapse;","display: block;","outline: none;","padding: 1px;","}",".blocklyColourTable>tr>td {","border: .5px solid #888;","box-sizing: border-box;","cursor: pointer;","display: inline-block;","height: 20px;","padding: 0;","width: 20px;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","position: relative;","}",".blocklyColourSelected, .blocklyColourSelected:hover {",
"border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}"]);g.vc.register("field_colour",g.Eb);g.Zj=function(a,c,d,e){this.s=a;this.tb=c;this.ng=d.getAttribute("text");this.rd=new g.g.X(0,0);this.Yg=e;this.ep=d.getAttribute("callbackKey")||d.getAttribute("callbackkey");this.yx=d.getAttribute("web-class")||null};g.Zj.Xe=5;b=g.Zj.prototype;b.width=0;b.height=0;b.Se=null;
b.Ja=function(){var a=this.Yg?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.yx&&(a+=" "+this.yx);this.H=g.g.o.K("g",{"class":a},this.s.jb);if(!this.Yg)var c=g.g.o.K("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.H);a=g.g.o.K("rect",{"class":this.Yg?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.H);var d=g.g.o.K("text",{"class":this.Yg?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.H);d.textContent=g.g.nc(this.ng);
this.Yg&&(this.nv=d,this.s.Zb.subscribe(this.nv,"flyoutText","fill"));this.width=g.g.o.Lm(d);this.height=20;this.Yg||(this.width+=2*g.Zj.Xe,c.setAttribute("width",this.width),c.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);d.setAttribute("x",this.width/2);d.setAttribute("y",this.height-g.Zj.Xe);Kb(this);this.Se=g.ca(this.H,"mouseup",this,this.EG);return this.H};b.show=function(){Kb(this);this.H.setAttribute("display","block")};
function Kb(a){a.H.setAttribute("transform","translate("+a.rd.x+","+a.rd.y+")")}b.moveTo=function(a,c){this.rd.x=a;this.rd.y=c;Kb(this)};b.I=function(){this.Se&&g.Ua(this.Se);this.H&&g.g.o.removeNode(this.H);this.nv&&this.s.Zb.unsubscribe(this.nv)};
b.EG=function(a){(a=this.tb.Sg(a))&&a.cancel();this.Yg&&this.ep?console.warn("Labels should not have callbacks. Label text: "+this.ng):this.Yg||this.ep&&Lb(this.tb,this.ep)?this.Yg||Lb(this.tb,this.ep)(this):console.warn("Buttons should have callbacks. Button text: "+this.ng)};g.Vc.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,},.blocklyFlyoutLabelText {,fill: #000;,}".split(","));g.Fc=function(){this.bA=g.Fc.Ex;this.Qk=null;this.cd=!1;this.Vd=this.lb=null;this.mb=[];this.ys={}};g.Fc.Ex=!1;g.Fc.Error={Uq:"Component already rendered",Cr:"Unable to set parent component",bB:"Child component index out of bounds"};b=g.Fc.prototype;b.wa=function(){return this.Qk||(this.Qk=g.g.Ml.wy())};b.va=function(){return this.lb};
b.jl=function(a){if(this==a)throw Error(g.Fc.Error.Cr);var c;if(c=a&&this.Vd&&this.Qk)c=(c=this.Qk)?this.Vd.ys[c]||null:null;if(c&&this.Vd!=a)throw Error(g.Fc.Error.Cr);this.Vd=a};b.getParent=function(){return this.Vd};b.Ja=function(){this.lb=document.createElement("div")};b.Da=function(a){this.bh(a)};b.bh=function(a,c){if(this.cd)throw Error(g.Fc.Error.Uq);this.lb||this.Ja();a?a.insertBefore(this.lb,c||null):document.body.appendChild(this.lb);this.Vd&&!this.Vd.cd||this.lf()};
b.lf=function(){this.cd=!0;Mb(this,function(a){!a.cd&&a.va()&&a.lf()})};b.Hh=function(){Mb(this,function(a){a.cd&&a.Hh()});this.cd=!1};b.I=function(){this.zE||(this.zE=!0,this.ym())};b.ym=function(){this.cd&&this.Hh();Mb(this,function(a){a.I()});this.lb&&g.g.o.removeNode(this.lb);this.Vd=this.lb=this.ys=this.mb=null};
b.cm=function(a,c,d){if(a.cd&&(d||!this.cd))throw Error(g.Fc.Error.Uq);if(0>c||c>this.mb.length)throw Error(g.Fc.Error.bB);this.ys[a.wa()]=a;if(a.getParent()==this){var e=this.mb.indexOf(a);-1<e&&this.mb.splice(e,1)}a.jl(this);this.mb.splice(c,0,a);a.cd&&this.cd&&a.getParent()==this?(d=this.lb,c=d.childNodes[c]||null,c!=a.va()&&d.insertBefore(a.va(),c)):d?(this.lb||this.Ja(),c=this.mb[c+1]||null,a.bh(this.lb,c?c.lb:null)):this.cd&&!a.cd&&a.lb&&a.lb.parentNode&&a.lb.parentNode.nodeType==g.g.o.Node.ELEMENT_NODE&&
a.lf()};b.Wk=function(){return this.bA};function Nb(a,c){if(a.cd)throw Error(g.Fc.Error.Uq);a.bA=c}function Ob(a){return 0!=a.mb.length}function Mb(a,c,d){for(var e=0;e<a.mb.length;e++)c.call(d,a.mb[e],e)};g.Ea={};g.Ea.vd=function(a,c){g.Fc.call(this);this.Zc=c;this.hf=a;this.Bm=this.yq=!1;this.Qt=!0;this.Js=-1};g.g.object.Y(g.Ea.vd,g.Fc);g.Ea.vd.bs={};b=g.Ea.vd.prototype;b.ym=function(){g.Ea.vd.w.ym.call(this);this.Ea&&(this.Ea=null);this.lb=null};
b.Op=function(){var a=this.va();if(a){var c=Pb(this);c&&!c.id&&(c.id=this.wa()+".label");g.g.M.se(a,g.g.M.If.eD);g.g.M.cb(a,g.g.M.State.nk,!1);g.g.M.cb(a,g.g.M.State.aC,this.Jk());c&&g.g.M.cb(a,g.g.M.State.gw,c.id);(c=this.st())&&g.g.M.se(c,g.g.M.If.CC);if(c=Qb(this))if(g.g.M.se(c,g.g.M.If.JB),c.hasChildNodes())for(g.g.M.cb(a,g.g.M.State.Bo,!1),a=this.mb.length,c=1;c<=a;c++){var d=(this.mb[c-1]||null).va();g.g.M.cb(d,g.g.M.State.MC,a);g.g.M.cb(d,g.g.M.State.BC,c)}}};
b.Ja=function(){var a=document.createElement("div");a.appendChild(Rb(this));this.lb=a};b.lf=function(){g.Ea.vd.w.lf.call(this);g.Ea.vd.bs[this.wa()]=this;this.Op()};b.Hh=function(){g.Ea.vd.w.Hh.call(this);delete g.Ea.vd.bs[this.wa()]};
b.cm=function(a,c){var d=this.mb[c-1]||null,e=this.mb[c]||null;g.Ea.vd.w.cm.call(this,a,c);a.dl=d;a.pu=e;d?d.pu=a:this.ay=a;e&&(e.dl=a);(c=this.Ne())&&Sb(a,c);Tb(a,this.Jk()+1);if(c=this.va())if(this.Iq(),g.g.M.cb(c,g.g.M.State.Bo,this.Le()),this.Le()){c=Qb(this);a.va()||a.Ja();var f=a.va(),h=e&&e.va();c.insertBefore(f,h);this.cd&&a.lf();e||(d?d.Iq():(g.g.style.Zu(c,!0),this.Bj(this.Le())))}};b.add=function(a){if(a.getParent())throw Error(g.Fc.Error.Cr);this.cm(a,this.mb.length)};b.Ne=function(){return null};
b.Jk=function(){var a=this.Js;0>a&&(a=(a=this.getParent())?a.Jk()+1:0,Tb(this,a));return a};function Tb(a,c){if(c!=a.Js){a.Js=c;var d=Ub(a);if(d){var e=Vb(a)+"px";a.Wk()?d.style.paddingRight=e:d.style.paddingLeft=e}Mb(a,function(f){Tb(f,c+1)})}}b.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1};b.Ih=function(){var a=[];Mb(this,function(c){a.push(c)});return a};b.select=function(){var a=this.Ne();a&&Bb(a,this)};
function Wb(a,c){if(a.yq!=c){a.yq=c;Xb(a);var d=a.va();d&&(g.g.M.cb(d,g.g.M.State.nk,c),c&&(c=a.Ne().va(),g.g.M.cb(c,g.g.M.State.Sq,a.wa())))}}b.Le=function(){return this.Bm};
b.Bj=function(a){var c=a!=this.Bm,d;this.Bm=a;var e=this.Ne(),f=this.va();if(Ob(this)){if(!a&&e&&this.contains(e.Wd)&&this.select(),f){if(d=Qb(this))g.g.style.Zu(d,a),g.g.M.cb(f,g.g.M.State.Bo,a),a&&this.cd&&!d.hasChildNodes()&&(Mb(this,function(h){d.appendChild(Rb(h))}),Mb(this,function(h){h.lf()}));this.Iq()}}else(d=Qb(this))&&g.g.style.Zu(d,!1);f&&(this.st().className=this.Ap());c&&(a?this.Qx():this.Px())};b.Qx=function(){};b.Px=function(){};b.toggle=function(){this.Bj(!this.Le())};
function Rb(a){var c=a.Le()&&Ob(a),d=document.createElement("div");d.style.backgroundPosition=Yb(a);c||(d.style.display="none");c&&Mb(a,function(e){d.appendChild(Rb(e))});c=document.createElement("div");c.id=a.wa();c.appendChild(Zb(a));c.appendChild(d);return c}function Vb(a){return Math.max(0,(a.Jk()-1)*a.Zc.Yy)}function Zb(a){var c=document.createElement("div");c.className=a.Gp();c.style["padding-"+(a.Wk()?"right":"left")]=Vb(a)+"px";c.appendChild($b(a));c.appendChild(ac(a));return c}
b.Gp=function(){var a="";this.yq&&(a=" "+(this.Zc.lE||""));return this.Zc.Bx+a};function ac(a){var c=document.createElement("span");c.className=a.Zc.jE||"";c.textContent=a.dc();return c}function $b(a){var c=document.createElement("span");c.style.display="inline-block";c.className=a.Ap();return c}b.Ap=function(){throw Error("unimplemented abstract method");};function Yb(a){return(a.pu?(a.Jk()-1)*a.Zc.Yy:"-100")+"px 0"}
b.va=function(){var a=g.Ea.vd.w.va.call(this);a||(this.lb=a=document.getElementById(this.wa()));return a};function Ub(a){return(a=a.va())?a.firstChild:null}b.st=function(){var a=Ub(this);return a?a.firstChild:null};function Pb(a){return(a=Ub(a))&&a.lastChild?a.lastChild.previousSibling:null}function Qb(a){return(a=a.va())?a.lastChild:null}b.kl=function(a){this.hf=a};b.dc=function(){return this.hf};function Xb(a){var c=Ub(a);c&&(c.className=a.Gp())}
b.Iq=function(){var a=Qb(this);a&&(a.style.backgroundPosition=Yb(this))};b.Iz=function(a){"expand"==a.target.getAttribute("type")&&Ob(this)?this.Qt&&this.toggle():(this.select(),Xb(this))};b.jq=function(a){a.preventDefault()};b.Au=function(a){var c=!0;switch(a.keyCode){case g.g.ya.Ro:if(a.altKey)break;c=bc(this);break;case g.g.ya.Io:if(a.altKey)break;c=cc(this);break;case g.g.ya.El:c=dc(this);break;case g.g.ya.Zl:c=ec(this);break;default:c=!1}c&&a.preventDefault();return c};
function dc(a){a:if(Ob(a)&&a.Le())a=a.mb[0]||null;else{for(var c=a,d;c!=a.Ne();){d=c.pu;if(null!=d){a=d;break a}c=c.getParent()}a=null}a&&a.select();return!0}function ec(a){var c=a.dl;if(null!=c)a=fc(c);else{c=a.getParent();var d=a.Ne();a=c==d||a==d?null:c}a&&a.select();return!0}function cc(a){if(Ob(a)&&a.Le()&&a.Qt)a.Bj(!1);else{var c=a.getParent();a=a.Ne();c&&c!=a&&c.select()}return!0}function bc(a){return Ob(a)?(a.Le()?(a.mb[0]||null).select():a.Bj(!0),!0):!1}
function fc(a){return a.Le()&&Ob(a)?fc(a.mb[a.mb.length-1]||null):a}function Sb(a,c){a.Ea!=c&&(a.Ea=c,Mb(a,function(d){Sb(d,c)}))};g.Ea.yh=function(a,c,d){this.ta=a;g.Ea.vd.call(this,c,d)};g.g.object.Y(g.Ea.yh,g.Ea.vd);b=g.Ea.yh.prototype;b.Ne=function(){if(this.Ea)return this.Ea;var a=this.getParent();return a&&(a=a.Ne())?(Sb(this,a),a):null};b.Ap=function(){var a=this.Le(),c=this.IE;if(a&&c)return c;c=this.AF;if(!a&&c)return c;c=this.Zc;if(Ob(this)){if(a&&c.zx)return c.mp+" "+c.zx;if(!a&&c.gE)return c.mp+" "+c.gE}else if(c.Ax)return c.mp+" "+c.Ax;return""};
b.jq=function(){Ob(this)&&this.Qt?(this.toggle(),this.select()):this.yq?Bb(this.Ne(),null):this.select();Xb(this)};b.Iz=function(){};b.Au=function(a){if(this.Ea.ta.pf){var c={},d=g.g.ya.El,e=g.g.ya.Zl;c[g.g.ya.Ro]=this.Wk()?e:d;c[g.g.ya.Io]=this.Wk()?d:e;c[g.g.ya.Zl]=g.g.ya.Io;c[g.g.ya.El]=g.g.ya.Ro;Object.defineProperties(a,{keyCode:{value:c[a.keyCode]||a.keyCode}})}return g.Ea.yh.w.Au.call(this,a)};b.aA=function(){this.Lz&&this.Lz.call(this.ta)};b.Qx=g.Ea.yh.prototype.aA;b.Px=g.Ea.yh.prototype.aA;g.Ea.Hi=function(a,c){this.ta=a;g.Ea.vd.call(this,"",c);this.Bm=!0;Wb(this,!0);this.Wd=this};g.g.object.Y(g.Ea.Hi,g.Ea.vd);b=g.Ea.Hi.prototype;b.Ne=function(){return this};b.Jk=function(){return 0};b.mF=function(){this.iy=!0;var a=this.va();g.g.o.qb(a,"focused");this.Wd&&this.Wd.select()};b.jF=function(){this.iy=!1;var a=this.va();g.g.o.Tb(a,"focused")};b.hasFocus=function(){return this.iy};b.Le=function(){return!0};b.Bj=function(a){this.Bm=a};
b.st=function(){var a=Ub(this);return a?a.firstChild:null};b.Iq=function(){};b.Gp=function(){return g.Ea.Hi.w.Gp.call(this)+" "+this.Zc.iE};b.Ap=function(){var a=this.Le(),c=this.IE;if(a&&c)return c;c=this.AF;if(!a&&c)return c;c=this.Zc;return a&&c.hE?c.mp+" "+c.hE:""};function Bb(a,c){if(c!=a.Wd&&(!a.Ez||a.Ez.call(a.ta,c))){var d=a.Wd;a.Wd&&Wb(a.Wd,!1);(a.Wd=c)&&Wb(c,!0);a.Dz&&a.Dz.call(a.ta,d,c)}}
b.Op=function(){g.Ea.Hi.w.Op.call(this);var a=this.va();g.g.M.se(a,g.g.M.If.dD);g.g.M.cb(a,g.g.M.State.gw,Pb(this).id)};b.lf=function(){g.Ea.Hi.w.lf.call(this);var a=this.va();a.className=this.Zc.kE;a.setAttribute("hideFocus","true");this.ks();this.Op()};b.Hh=function(){g.Ea.Hi.w.Hh.call(this);this.Ks()};b.ks=function(){var a=this.va();a.tabIndex=0;this.qG=g.ld(a,"focus",this,this.mF);this.nG=g.ld(a,"blur",this,this.jF);this.xu=g.ca(a,"click",this,this.qF);this.tG=g.ld(a,"keydown",this,this.nF)};
b.Ks=function(){g.Ua(this.qG);g.Ua(this.nG);g.Ua(this.xu);g.Ua(this.tG)};b.qF=function(a){var c;a:{for(var d=a.target;null!=d;){if(c=g.Ea.vd.bs[d.id])break a;if(d==this.va())break;d=d.parentNode}c=null}if(c)switch(a.type){case "mousedown":c.Iz(a);break;case "click":c.jq(a)}};b.nF=function(a){var c=!1;if(c=this.Wd&&this.Wd.Au(a)||c)g.g.style.Wu(this.Wd.va(),this.va().parentNode),a.preventDefault();return c};b.createNode=function(a){return new g.Ea.yh(this.ta,a||"",this.Zc)};g.g.Rect=function(a,c,d,e){this.top=a;this.bottom=c;this.left=d;this.right=e};g.g.Rect.prototype.contains=function(a,c){return a>=this.left&&a<=this.right&&c>=this.top&&c<=this.bottom};g.Gi=function(a){this.s=a;this.G=a.options.G;this.pf=a.options.Rd;this.Ia=a.options.Ia;this.Zc={Yy:19,kE:"blocklyTreeRoot",iE:"blocklyHidden",Bx:"blocklyTreeRow",jE:"blocklyTreeLabel",mp:"blocklyTreeIcon",zx:"blocklyTreeIconOpen",Ax:"blocklyTreeIconNone",lE:"blocklyTreeSelected"};this.wA={Bx:"blocklyTreeSeparator"};this.pf&&(this.Zc.cssTreeRow+=a.G?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.wA.cssTreeRow="blocklyTreeSeparatorHorizontal "+(a.G?"blocklyHorizontalTreeRtl":"blocklyHorizontalTree"),
this.Zc.cssTreeIcon="")};b=g.Gi.prototype;b.width=0;b.height=0;b.Yk=null;
b.U=function(){var a=this.s,c=r(this.s);this.Gc=document.createElement("div");this.Gc.className="blocklyToolboxDiv blocklyNonSelectable";this.Gc.setAttribute("dir",a.G?"RTL":"LTR");c.parentNode.insertBefore(this.Gc,c);c=a.Zb;c.subscribe(this.Gc,"toolbox","background-color");c.subscribe(this.Gc,"toolboxText","color");g.ca(this.Gc,"mousedown",this,function(d){g.g.jj(d)||d.target==this.Gc?g.wc(!1):g.wc(!0);g.Touch.Bh()},!1,!0);c={Ng:a.options.Ng,Sb:a,G:a.G,Hd:a.options.Hd,Rd:a.Rd,Ia:a.options.Ia,dh:a.options.dh};
this.P=null;if(a.Rd){if(!g.Kl)throw Error("Missing require for Blockly.HorizontalFlyout");this.P=new g.Kl(c)}else{if(!g.Fg)throw Error("Missing require for Blockly.VerticalFlyout");this.P=new g.Fg(c)}g.g.o.ej(this.P.Ja("svg"),r(this.s));this.P.U(a);this.Zc.cleardotPath=a.options.uf+"1x1.gif";this.Zc.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.G?"Rtl":"Ltr");gc(this,a.options.Xk)};
function gc(a,c){a.Id&&(a.Id.I(),a.Yk=null);var d=new g.Ea.Hi(a,a.Zc);a.Id=d;Bb(d,null);d.Ez=a.iF;d.Dz=a.hF;var e=null;if(c){a.Id.Of=[];a.Dt=!1;e=hc(a,c,a.Id,a.s.options.uf);if(a.Id.Of.length)throw Error("Toolbox cannot have both blocks and categories in the root level.");ic(a.s)}d.Da(a.Gc);e&&Bb(d,e);jc(a);a.position();a.pf&&g.g.M.cb(a.Id.va(),g.g.M.State.yC,"horizontal")}
b.iF=function(a){if(a==this.Id)return!1;this.Yk&&(Ub(this.Yk).style.backgroundColor="");if(a){var c=a.Nk||"#57e";Ub(a).style.backgroundColor=c;jc(this,a)}return!0};b.hF=function(a,c){c&&c.Of&&c.Of.length?(this.P.show(c.Of),this.Yk!=c&&this.P.yc.set(0),g.Qe&&g.navigation.cb(g.navigation.Or)):(this.P.Ga(),!g.Qe||c instanceof g.Gi.Ur||g.navigation.cb(g.navigation.Ul));a!=c&&a!=this&&(a=new g.i.Bd(null,"category",a&&a.dc(),c&&c.dc()),a.Ec=this.s.id,g.i.Oa(a));c&&(this.Yk=c)};b.tF=function(){g.ol(this.s)};
b.dg=function(a){var c=this.Id.Wd;if(!c)return!1;switch(a.name){case g.navigation.gb.Ee:return ec(c);case g.navigation.gb.Qo:return cc(c);case g.navigation.gb.Ce:return dc(c);case g.navigation.gb.Fo:return bc(c);default:return!1}};b.I=function(){this.P.I();this.Id.I();this.s.Zb.unsubscribe(this.Gc);g.g.o.removeNode(this.Gc);this.Yk=this.s=null};b.Zf=function(){return this.width};b.vy=function(){return this.height};
b.position=function(){var a=this.Gc;if(a){var c=r(this.s);c=g.rA(c);this.pf?(a.style.left="0",a.style.height="auto",a.style.width=c.width+"px",this.height=a.offsetHeight,this.Ia==g.Dg?a.style.top="0":a.style.bottom="0"):(this.Ia==g.Cg?a.style.right="0":a.style.left="0",a.style.height=c.height+"px",this.width=a.offsetWidth);this.P.position()}};
function hc(a,c,d,e){for(var f=null,h=null,k=0,l;l=c.childNodes[k];k++)if(l.tagName)switch(l.tagName.toUpperCase()){case "CATEGORY":var m=g.g.nc(l.getAttribute("name"));h=a.Id.createNode(m);h.Lz=a.tF;h.Of=[];d.add(h);var n=l.getAttribute("custom");n?h.Of=n:(n=hc(a,l,h,e))&&(f=n);var u=l.getAttribute("categorystyle");if((n=l.getAttribute("colour"))&&u)h.Nk="",console.warn('Toolbox category "'+m+'" can not have both a style and a colour');else if(u){n=a;var v=h;v.sM=u;var w=n.s.Ip();u&&w&&((w=w.LD[u])&&
w.Ab?kc(n,w.Ab,v,m):console.warn('Style "'+u+'" must exist and contain a colour value'))}else kc(a,n,h,m);"true"==l.getAttribute("expanded")?(h.Of.length&&(f=h),h.Bj(!0)):h.Bj(!1);h=l;break;case "SEP":if(h&&"CATEGORY"==h.tagName.toUpperCase()){d.add(new g.Gi.Ur(a.wA));break}case "BLOCK":case "SHADOW":case "LABEL":case "BUTTON":d.Of.push(l),h=l}return f}
function kc(a,c,d,e){c=g.g.nc(c);if(null===c||""===c)d.Nk="";else{var f=Number(c);isNaN(f)?(f=g.g.Ab.parse(c))?(d.Nk=f,a.Dt=!0):(d.Nk="",console.warn('Toolbox category "'+e+'" has unrecognized colour attribute: '+c)):(d.Nk=g.Xy(f),a.Dt=!0)}}function jc(a,c){c=(c||a.Id).Ih(!1);for(var d=0,e;e=c[d];d++){var f=Ub(e);if(f){var h=a.Dt?"8px solid "+(e.Nk||"#ddd"):"none";a.s.G?f.style.borderRight=h:f.style.borderLeft=h}jc(a,e)}}
b.Hm=function(){if(!this.Gc)return null;var a=this.Gc.getBoundingClientRect(),c=a.top,d=c+a.height,e=a.left;a=e+a.width;return this.Ia==g.Dg?new g.g.Rect(-1E7,d,-1E7,1E7):this.Ia==g.Ei?new g.g.Rect(c,1E7,-1E7,1E7):this.Ia==g.Md?new g.g.Rect(-1E7,1E7,-1E7,a):new g.g.Rect(-1E7,1E7,e,1E7)};g.Gi.Ur=function(a){g.Ea.yh.call(this,null,"",a)};g.g.object.Y(g.Gi.Ur,g.Ea.yh);
g.Vc.register([".blocklyToolboxDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {",
"height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;",
"}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<<PATH>>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {",
"background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",
'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]);g.i.Hl=function(a){this.Ec=a.id;this.group=g.i.cc();this.Rc=!1};g.g.object.Y(g.i.Hl,g.i.Abstract);g.i.Hl.prototype.type=g.i.BB;g.i.Hl.prototype.eb=function(){var a={type:this.type};this.group&&(a.group=this.group);this.Ec&&(a.workspaceId=this.Ec);return a};g.i.Hl.prototype.qa=function(a){this.Ec=a.workspaceId;this.group=a.group};g.R={};g.R.DA=function(a){var c=H,d=g.g.xml.createElement("xml"),e=g.R.BH(g.O.Tw(c));e.hasChildNodes()&&d.appendChild(e);var f=xa(c,!0);e=0;for(var h;h=f[e];e++)d.appendChild(h.ov(a));c=A(c,!0);for(e=0;f=c[e];e++)d.appendChild(g.R.qs(f,a));return d};g.R.BH=function(a){for(var c=g.g.xml.createElement("variables"),d=0,e;e=a[d];d++){var f=g.g.xml.createElement("variable");f.appendChild(g.g.xml.createTextNode(e.name));e.type&&f.setAttribute("type",e.type);f.id=e.wa();c.appendChild(f)}return c};
g.R.qs=function(a,c){var d;a.v.G&&(d=a.v.Zf());c=g.R.zh(a,c);var e=a.Ta();c.setAttribute("x",Math.round(a.v.G?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c};g.R.KE=function(a){var c=!1;a.name&&(a.Ci?c=!0:a.Ef&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),c=!0));return c?(c=g.g.xml.createElement("field"),c.setAttribute("name",a.name),a.tA(c)):null};
g.R.wD=function(a,c){for(var d=0,e;e=a.S[d];d++)for(var f=0,h;h=e.Na[f];f++)(h=g.R.KE(h))&&c.appendChild(h)};
g.R.zh=function(a,c){var d=g.g.xml.createElement(a.hb?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.Pa){var e=a.Pa();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}g.R.wD(a,d);if(e=a.He.text){var f=a.He.size,h=a.He.Ku,k=g.g.xml.createElement("comment");k.appendChild(g.g.xml.createTextNode(e));k.setAttribute("pinned",h);k.setAttribute("h",f.height);k.setAttribute("w",f.width);d.appendChild(k)}a.data&&(e=g.g.xml.createElement("data"),e.appendChild(g.g.xml.createTextNode(a.data)),
d.appendChild(e));for(f=0;h=a.S[f];f++){var l;k=!0;if(h.type!=g.vg){var m=C(h.connection);h.type==g.Ra?l=g.g.xml.createElement("value"):h.type==g.Sa&&(l=g.g.xml.createElement("statement"));e=h.connection.vf;!e||m&&m.hb||l.appendChild(g.R.ix(e,c));m&&(l.appendChild(g.R.zh(m,c)),k=!1);l.setAttribute("name",h.name);k||d.appendChild(l)}}void 0!=a.Xg&&a.Xg!=a.GF&&d.setAttribute("inline",a.Xg);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.pe()||a.hb||d.setAttribute("deletable",
!1);a.Nc()||a.hb||d.setAttribute("movable",!1);a.pd()||d.setAttribute("editable",!1);if(f=q(a))l=g.g.xml.createElement("next"),l.appendChild(g.R.zh(f,c)),d.appendChild(l);e=a.V&&a.V.vf;!e||f&&f.hb||l.appendChild(g.R.ix(e,c));return d};
g.R.ix=function(a,c){for(var d=a=a.cloneNode(!0),e;d;)if(c&&"shadow"==d.nodeName&&d.removeAttribute("id"),d.firstChild)d=d.firstChild;else{for(;d&&!d.nextSibling;)e=d,d=d.parentNode,e.nodeType==g.g.o.Node.TEXT_NODE&&""==e.data.trim()&&d.firstChild!=e&&g.g.o.removeNode(e);d&&(e=d,d=d.nextSibling,e.nodeType==g.g.o.Node.TEXT_NODE&&""==e.data.trim()&&g.g.o.removeNode(e))}return a};
g.R.Dd=function(a){a=g.g.xml.Dd(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1&#10;$2")}while(a!=d);return a};g.R.PL=function(a){a=g.R.Dd(a).split("<");for(var c="",d=1;d<a.length;d++){var e=a[d];"/"==e[0]&&(c=c.substring(2));a[d]=c+"<"+e;"/"!=e[0]&&"/>"!=e.slice(-2)&&(c+="  ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>");return a.replace(/^\n/,"")};
g.R.lh=function(a){var c=g.g.xml.oH(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};g.R.LL=function(a,c){c.Sc(!1);c.clear();a=g.R.Fh(a,c);c.Sc(!0);return a};
g.R.Fh=function(a,c){if(a instanceof g.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.Zf());d=[];g.g.o.Jn();var f=a.childNodes.length,h=g.i.cc();h||g.i.aa(!0);c.Sc&&c.Sc(!1);var k=!0;try{for(var l=0;l<f;l++){var m=a.childNodes[l],n=m.nodeName.toLowerCase();if("block"==n||"shadow"==n&&!g.i.Rc){var u=g.R.Vi(m,c);d.push(u.id);var v=m.hasAttribute("x")?parseInt(m.getAttribute("x"),10):10,w=m.hasAttribute("y")?parseInt(m.getAttribute("y"),
10):10;isNaN(v)||isNaN(w)||u.moveBy(c.G?e-v:v,w);k=!1}else{if("shadow"==n)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==n)c.ga?g.rk?g.rk.Fm(m):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):g.nD?g.nD.Fm(m):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==n){if(k)g.R.CE(m,c);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");
k=!1}}}}finally{h||g.i.aa(!1),g.g.o.Kn()}c.Sc&&c.Sc(!0);g.i.Oa(new g.i.Hl(c));return d};g.R.IL=function(a,c){if(c.hasOwnProperty("scale")){var d=g.xa.xh;try{g.xa.xh=0;var e=lc(c)}finally{g.xa.xh=d}}a=g.R.Fh(a,c);if(e&&e.top!=e.bottom){d=e.bottom;var f=e.left;var h=Infinity,k=Infinity;for(e=0;e<a.length;e++){var l=x(c,a[e]).Ta();l.y<k&&(k=l.y);l.x<h&&(h=l.x)}d=d-k+g.xa.LC;f-=h;var m;c.G&&(m=c.Zf());for(e=0;e<a.length;e++)x(c,a[e]).moveBy(c.G?m-f:f,d)}return a};
g.R.Vi=function(a,c){if(a instanceof g.Ob){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}g.i.disable();d=c.Rg();try{var e=g.R.Us(a,c),f=p(e,!1);if(c.ga){Db(e,!0);for(var h=f.length-1;0<=h;h--)f[h].Td();for(h=f.length-1;0<=h;h--)f[h].Da(!1);setTimeout(function(){e.v&&Db(e,!1)},1);mc(e);ic(c)}else for(h=f.length-1;0<=h;h--)f[h].dj()}finally{g.i.enable()}if(g.i.isEnabled()){a=g.O.ny(c,d);for(h=0;h<a.length;h++)g.i.Oa(new g.i.Fe(a[h]));g.i.Oa(new g.i.mo(e))}return e};
g.R.CE=function(a,c){for(var d=0,e;e=a.childNodes[d];d++)if(e.nodeType==g.g.o.Node.ELEMENT_NODE){var f=e.getAttribute("type"),h=e.getAttribute("id");c.Pd(e.textContent,f,h)}};
g.R.Us=function(a,c){var d=null,e=a.getAttribute("type");if(!e)throw TypeError("Block type unspecified: "+a.outerHTML);var f=a.getAttribute("id");d=c.cg(e,f);var h=null;f=0;for(var k;k=a.childNodes[f];f++)if(k.nodeType!=g.g.o.Node.TEXT_NODE){for(var l=h=null,m=0,n;n=k.childNodes[m];m++)n.nodeType==g.g.o.Node.ELEMENT_NODE&&("block"==n.nodeName.toLowerCase()?h=n:"shadow"==n.nodeName.toLowerCase()&&(l=n));!h&&l&&(h=l);m=k.getAttribute("name");switch(k.nodeName.toLowerCase()){case "mutation":d.kb&&(d.kb(k),
d.Td&&d.Td());break;case "comment":if(!g.Comment){console.warn("Missing require for Blockly.Comment, ignoring block comment.");break}h=k.textContent;l="true"==k.getAttribute("pinned");m=parseInt(k.getAttribute("w"),10);k=parseInt(k.getAttribute("h"),10);d.ii(h);d.He.Ku=l;isNaN(m)||isNaN(k)||(d.He.size=new g.g.ge(m,k));l&&d.XE&&!d.ec&&setTimeout(function(){d.Pf.Yb(!0)},1);break;case "data":d.data=k.textContent;break;case "title":case "field":g.R.BE(d,m,k);break;case "value":case "statement":k=E(d,
m);if(!k){console.warn("Ignoring non-existent input "+m+" in block "+e);break}l&&(k.connection.vf=l);if(h)if(h=g.R.Us(h,c),h.L)k.connection.connect(h.L);else if(h.$)k.connection.connect(h.$);else throw TypeError("Child block does not have output or previous statement.");break;case "next":l&&d.V&&(d.V.vf=l);if(h){if(!d.V)throw TypeError("Next statement does not exist.");if(d.V.isConnected())throw TypeError("Next statement is already connected.");h=g.R.Us(h,c);if(!h.$)throw TypeError("Next block does not have previous statement.");
d.V.connect(h.$)}break;default:console.warn("Ignoring unknown tag: "+k.nodeName)}}(f=a.getAttribute("inline"))&&d.re("true"==f);(f=a.getAttribute("disabled"))&&d.sd("true"!=f&&"disabled"!=f);if(f=a.getAttribute("deletable"))d.Is="true"==f;(f=a.getAttribute("movable"))&&d.zq("true"==f);(f=a.getAttribute("editable"))&&d.Yu("true"==f);(f=a.getAttribute("collapsed"))&&d.hh("true"==f);if("shadow"==a.nodeName.toLowerCase()){a=d.Ih(!1);for(f=0;c=a[f];f++)if(!c.hb)throw TypeError("Shadow block not allowed non-shadow child.");
if(d.Ug().length)throw TypeError("Shadow blocks cannot have variable references.");d.bv(!0)}return d};g.R.BE=function(a,c,d){var e=B(a,c);e?e.Fm(d):console.warn("Ignoring non-existent field "+c+" in block "+a.type)};g.R.qE=function(a){for(var c=0,d;d=a.childNodes[c];c++)if("next"==d.nodeName.toLowerCase()){a.removeChild(d);break}};g.Tr=function(a){this.s=a;this.Pi=[];if(!(0>=this.s.options.gq)){a={scrollbars:!0,Ng:this.s.options.Ng,Sb:this.s,G:this.s.G,Hd:this.s.options.Hd,dh:this.s.options.dh};if(this.s.Rd){a.Ia=this.s.Ia==g.Dg?g.Ei:g.Dg;if(!g.Kl)throw Error("Missing require for Blockly.HorizontalFlyout");this.P=new g.Kl(a)}else{a.Ia=this.s.Ia==g.Cg?g.Md:g.Cg;if(!g.Fg)throw Error("Missing require for Blockly.VerticalFlyout");this.P=new g.Fg(a)}Ba(this.s,this.pG.bind(this))}};b=g.Tr.prototype;b.Ii=47;b.ho=44;b.hk=16;b.pr=20;
b.Ol=20;b.Ko=10;b.Mr=0;b.Nr=32;b.KB=.1;b.Pt=!1;b.hq=0;b.H=null;b.Dq=null;b.Wt=0;b.Xh=0;b.$m=0;b.vl=0;
b.Ja=function(){this.H=g.g.o.K("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var c=g.g.o.K("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.H);g.g.o.K("rect",{width:this.Ii,height:this.ho,y:this.hk},c);var d=g.g.o.K("image",{width:g.Ad.width,x:-this.Mr,height:g.Ad.height,y:-this.Nr,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.H);d.setAttributeNS(g.g.o.bf,"xlink:href",this.s.options.uf+g.Ad.url);c=g.g.o.K("clipPath",{id:"blocklyTrashLidClipPath"+a},this.H);
g.g.o.K("rect",{width:this.Ii,height:this.hk},c);this.Dq=g.g.o.K("image",{width:g.Ad.width,x:-this.Mr,height:g.Ad.height,y:-this.Nr,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.H);this.Dq.setAttributeNS(g.g.o.bf,"xlink:href",this.s.options.uf+g.Ad.url);g.ca(this.H,"mouseup",this,this.click);g.ld(d,"mouseover",this,this.aG);g.ld(d,"mouseout",this,this.ZF);this.ds();return this.H};
b.U=function(a){0<this.s.options.gq&&(g.g.o.ej(this.P.Ja("svg"),r(this.s)),this.P.U(this.s),this.P.dz=function(){return!0});this.oh=this.pr+a;$a(this,!1);return this.oh+this.ho+this.hk};b.I=function(){this.H&&(g.g.o.removeNode(this.H),this.H=null);this.s=this.Dq=null;clearTimeout(this.Wt)};
b.position=function(){if(this.oh){var a=this.s.jc();a&&(this.$m=a.Ia==g.Md||this.s.Rd&&!this.s.G?a.ub+a.qc-this.Ii-this.Ol-g.La.xc:this.Ol+g.La.xc,this.vl=a.Ia==g.Ei?this.oh:a.Cb+a.Hc-(this.ho+this.hk)-this.oh,this.H.setAttribute("transform","translate("+this.$m+","+this.vl+")"))}};b.Hm=function(){if(!this.H)return null;var a=this.H.getBoundingClientRect(),c=a.top+this.Nr-this.Ko;a=a.left+this.Mr-this.Ko;return new g.g.Rect(c,c+this.hk+this.ho+2*this.Ko,a,a+this.Ii+2*this.Ko)};
function $a(a,c){a.Pt!=c&&(clearTimeout(a.Wt),a.Pt=c,a.ds())}b.ds=function(){this.Xh+=this.Pt?.2:-.2;this.Xh=Math.min(Math.max(this.Xh,this.hq),1);nc(this,45*this.Xh);this.H.style.opacity=.4+.4*this.Xh;this.Xh>this.hq&&1>this.Xh&&(this.Wt=setTimeout(this.ds.bind(this),20))};function nc(a,c){var d=a.s.Ia==g.Cg||a.s.Rd&&a.s.G;a.Dq.setAttribute("transform","rotate("+(d?-c:c)+","+(d?4:a.Ii-4)+","+(a.hk-2)+")")}b.close=function(){$a(this,!1)};
b.click=function(){if(this.Pi.length){for(var a=[],c=0,d;d=this.Pi[c];c++)a[c]=g.R.lh(d);this.P.show(a)}};b.aG=function(){this.Pi.length&&$a(this,!0)};b.ZF=function(){$a(this,!1)};
b.pG=function(a){if(!(0>=this.s.options.gq)&&a.type==g.i.fo&&"shadow"!=a.wu.tagName.toLowerCase()){for(var c=a=a.wu.cloneNode(!0);c;){c.removeAttribute&&(c.removeAttribute("x"),c.removeAttribute("y"),c.removeAttribute("id"));var d=c.firstChild||c.nextSibling;if(!d)for(d=c.parentNode;d;){if(d.nextSibling){d=d.nextSibling;break}d=d.parentNode}c=d}a=g.R.Dd(a);if(-1==this.Pi.indexOf(a)){for(this.Pi.unshift(a);this.Pi.length>this.s.options.gq;)this.Pi.pop();this.hq=this.KB;nc(this,45*this.hq)}}};g.N=Object.create(null);g.ua=function(a,c){this.B=a;this.type=c};g.ua.no=0;g.ua.tw=1;g.ua.ww=2;g.ua.vw=3;g.ua.rw=4;g.ua.sw=5;g.ua.uw=6;b=g.ua.prototype;b.ka=null;b.Ig=null;b.vf=null;b.$b=0;b.fb=0;
b.ff=function(a){var c=this,d=c.B,e=a.B;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=C(c),h=c.vf;c.vf=null;if(f.hb)h=g.R.zh(f),f.I(),f=null;else if(c.type==g.Ra){if(!f.L)throw Error("Orphan block does not have an output connection.");var k=g.ua.kz(e,f);k&&(f.L.connect(k),f=null)}else if(c.type==g.Sa){if(!f.$)throw Error("Orphan block does not have a previous connection.");for(k=e;k.V;){var l=q(k);if(l&&!l.hb)k=l;else{oc(f.$,k.V)&&(k.V.connect(f.$),f=null);break}}}if(f&&(c.disconnect(),
g.i.Rc)){var m=g.i.cc();setTimeout(function(){f.v&&!f.getParent()&&(g.i.aa(m),f.L?f.L.kq(c):f.$&&f.$.kq(c),g.i.aa(!1))},g.jo)}c.vf=h}var n;g.i.isEnabled()&&(n=new g.i.Bl(e));g.ua.ZD(c,a);e.jl(d);n&&(n.yj(),g.i.Oa(n))};b.I=function(){if(this.isConnected()){this.vf=null;var a=C(this);a.hb?a.I():D(a)}};function G(a){return a.type==g.Ra||a.type==g.Sa}b.isConnected=function(){return!!this.ka};
function Eb(a,c){if(!c)return g.ua.vw;if(G(a))var d=a.B,e=c.B;else e=a.B,d=c.B;return d&&d==e?g.ua.tw:c.type!=g.kk[a.type]?g.ua.ww:d&&e&&d.v!==e.v?g.ua.sw:oc(a,c)?d.hb&&!e.hb?g.ua.uw:g.ua.no:g.ua.rw}
function Fb(a,c){switch(Eb(a,c)){case g.ua.no:break;case g.ua.tw:throw Error("Attempted to connect a block to itself.");case g.ua.sw:throw Error("Blocks not on same workspace.");case g.ua.ww:throw Error("Attempt to connect incompatible types.");case g.ua.vw:throw Error("Target connection is null.");case g.ua.rw:throw Error("Connection checks failed. "+(a+" expected "+a.Ig+", found "+c.Ig));case g.ua.uw:throw Error("Connecting non-shadow to shadow block.");default:throw Error("Unknown connection failure: this should never happen!");
}}b.Tp=function(a){if(a.B.Sh()||Eb(this,a)!=g.ua.no)return!1;switch(a.type){case g.$e:return this.ka||-1!=g.zm.indexOf(a)?a=!1:a.ka?(a=C(a),a=a.Sh()?!(a.$&&C(a.$)):!1):a=!0,a;case g.Ze:if(a.isConnected()&&!C(a).Sh()||this.isConnected())return!1;break;case g.Ra:if(a.isConnected()&&!C(a).Nc()&&!C(a).hb)return!1;break;case g.Sa:if(a.isConnected()&&!this.B.V&&!C(a).hb&&C(a).V)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=g.zm.indexOf(a)?!1:!0};b.kq=function(){};
b.connect=function(a){if(this.ka!=a){Fb(this,a);var c=g.i.cc();c||g.i.aa(!0);G(this)?this.ff(a):a.ff(this);c||g.i.aa(!1)}};g.ua.ZD=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.ka=c;c.ka=a};g.ua.eH=function(a,c){for(var d=!1,e=0;e<a.S.length;e++){var f=a.S[e].connection;if(f&&f.type==g.Ra&&oc(c.L,f)){if(d)return null;d=f}}return d};g.ua.kz=function(a,c){for(var d;d=g.ua.eH(a,c);)if(a=C(d),!a||a.hb)return d;return null};b=g.ua.prototype;
b.disconnect=function(){var a=this.ka;if(!a)throw Error("Source connection not connected.");if(a.ka!=this)throw Error("Target connection not connected to source connection.");if(G(this)){var c=this.B;var d=a.B;a=this}else c=a.B,d=this.B;var e=g.i.cc();e||g.i.aa(!0);this.Qs(c,d);a.Tu();e||g.i.aa(!1)};b.Qs=function(a,c){var d;g.i.isEnabled()&&(d=new g.i.Bl(c));this.ka=this.ka.ka=null;c.jl(null);d&&(d.yj(),g.i.Oa(d))};
b.Tu=function(){var a=this.B,c=this.vf;if(a.v&&c&&g.i.Rc)if(a=g.R.Vi(c,a.v),a.L)this.connect(a.L);else if(a.$)this.connect(a.$);else throw Error("Child block does not have output or previous statement.");};function C(a){return a.isConnected()?a.ka.B:null}function oc(a,c){if(!a.Ig||!c.Ig)return!0;for(var d=0;d<a.Ig.length;d++)if(-1!=c.Ig.indexOf(a.Ig[d]))return!0;return!1}b.Fz=function(){this.isConnected()&&!oc(this,this.ka)&&D(G(this)?C(this):this.B)};
b.Za=function(a){a?(Array.isArray(a)||(a=[a]),this.Ig=a,this.Fz()):this.Ig=null;return this};b.zz=function(){return[]};b.Yf=function(){for(var a=null,c=this.B,d=c.S,e=0;e<c.S.length;e++)if(d[e].connection===this){a=d[e];break}return a};
b.toString=function(){var a=this.B;if(a)if(a.L==this)var c="Output Connection of ";else if(a.$==this)c="Previous Connection of ";else if(a.V==this)c="Next Connection of ";else{c=null;for(var d=0,e;e=a.S[d];d++)if(e.connection==this){c=e;break}if(c)c='Input "'+c.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}else return"Orphan Connection";return c+pc(a)};g.Z={};g.Z.yl={};g.Z.register=function(a,c){if("string"!=typeof a||""==a.trim())throw Error('Error: Invalid extension name "'+a+'"');if(g.Z.yl[a])throw Error('Error: Extension "'+a+'" is already registered.');if("function"!=typeof c)throw Error('Error: Extension "'+a+'" must be a function');g.Z.yl[a]=c};g.Z.rq=function(a,c){if(!c||"object"!=typeof c)throw Error('Error: Mixin "'+a+'" must be a object');g.Z.register(a,function(){this.ag(c)})};
g.Z.xn=function(a,c,d,e){var f='Error when registering mutator "'+a+'": ';g.Z.ex(f,c.kb,"domToMutation");g.Z.ex(f,c.Pa,"mutationToDom");var h=g.Z.hx(c,f);if(d&&"function"!=typeof d)throw Error('Extension "'+a+'" is not a function');g.Z.register(a,function(){if(h){if(!g.ac)throw Error(f+"Missing require for Blockly.Mutator");this.il(new g.ac(e))}this.ag(c);d&&d.apply(this)})};g.Z.unregister=function(a){g.Z.yl[a]?delete g.Z.yl[a]:console.warn('No extension mapping for name "'+a+'" found to unregister')};
g.Z.apply=function(a,c,d){var e=g.Z.yl[a];if("function"!=typeof e)throw Error('Error: Extension "'+a+'" not found.');if(d)g.Z.QD(a,c);else var f=g.Z.ut(c);e.apply(c);if(d)g.Z.OD('Error after applying mutator "'+a+'": ',c);else if(!g.Z.eG(f,c))throw Error('Error when applying extension "'+a+'": mutation properties changed when applying a non-mutator extension.');};
g.Z.ex=function(a,c,d){if(!c)throw Error(a+'missing required property "'+d+'"');if("function"!=typeof c)throw Error(a+'" required property "'+d+'" must be a function');};g.Z.QD=function(a,c){if(g.Z.ut(c).length)throw Error('Error: tried to apply mutation "'+a+'" to a block that already has mutator functions.  Block id: '+c.id);};
g.Z.hx=function(a,c){var d=void 0!==a.Rf,e=void 0!==a.Uf;if(d&&e){if("function"!=typeof a.Rf)throw Error(c+"compose must be a function.");if("function"!=typeof a.Uf)throw Error(c+"decompose must be a function.");return!0}if(d||e)throw Error(c+'Must have both or neither of "compose" and "decompose"');return!1};
g.Z.OD=function(a,c){if("function"!=typeof c.kb)throw Error(a+'Applying a mutator didn\'t add "domToMutation"');if("function"!=typeof c.Pa)throw Error(a+'Applying a mutator didn\'t add "mutationToDom"');g.Z.hx(c,a)};g.Z.ut=function(a){var c=[];void 0!==a.kb&&c.push(a.kb);void 0!==a.Pa&&c.push(a.Pa);void 0!==a.Rf&&c.push(a.Rf);void 0!==a.Uf&&c.push(a.Uf);return c};g.Z.eG=function(a,c){c=g.Z.ut(c);if(c.length!=a.length)return!1;for(var d=0;d<c.length;d++)if(a[d]!=c[d])return!1;return!0};
g.Z.ap=function(a,c){var d=[];"object"==typeof document&&g.g.cA(function(){for(var e in c)g.g.gx(c[e])});return function(){this.type&&-1==d.indexOf(this.type)&&(g.Z.PD(this,a,c),d.push(this.type));this.Ha(function(){var e=z(this,a),f=c[e];null==f?-1==d.indexOf(this.type)&&(e="No tooltip mapping for value "+e+" of field "+a,null!=this.type&&(e+=" of block type "+this.type),console.warn(e+".")):f=g.g.nc(f);return f}.bind(this))}};
g.Z.PD=function(a,c,d){var e=B(a,c);if("function"!=typeof e.nj){e=e.getOptions();for(var f=0;f<e.length;++f){var h=e[f][1];null==d[h]&&console.warn("No tooltip mapping for value "+h+" of field "+c+" of block type "+a.type)}}};g.Z.bp=function(a){"object"==typeof document&&g.g.cA(function(){g.g.gx(a)});return function(){this.Ha(function(){var c=B(this,"VAR");return g.g.nc(a).replace("%1",c?c.dc():"")}.bind(this))}};
g.Z.JE=function(){this.uH=this.yf;this.Ha(function(){var a=this.getParent();return a&&qc(a)&&a.yf||this.uH}.bind(this))};g.Z.register("parent_tooltip_when_inline",g.Z.JE);g.ce=function(a,c,d){this.fp=null;null==a&&(a="");g.ce.w.constructor.call(this,a,null,d);d||(this.fp=c||null);this.Bb=new g.g.ge(0,g.pa.Ew)};g.g.object.Y(g.ce,g.pa);g.ce.qa=function(a){var c=g.g.nc(a.text);return new g.ce(c,void 0,a)};g.ce.prototype.Ef=!1;g.ce.prototype.nd=function(a){g.ce.w.nd.call(this,a);this.fp=a["class"]};g.ce.prototype.Wg=function(){ub(this);this.Dc.setAttribute("y",this.Bb.height);this.fp&&g.g.o.qb(this.Dc,this.fp)};
g.ce.prototype.Og=function(a){return null===a||void 0===a?null:String(a)};g.vc.register("field_label",g.ce);g.ew=function(a,c,d,e){if(a!=g.vg&&!c)throw Error("Value inputs and statement inputs must have non-empty name.");this.type=a;this.name=c;this.B=d;this.connection=e;this.Na=[]};b=g.ew.prototype;b.align=g.Tq;b.mi=!0;function I(a,c,d){rc(a,a.Na.length,c,d);return a}
function rc(a,c,d,e){if(0>c||c>a.Na.length)throw Error("index "+c+" out of bounds.");if(!(d||""==d&&e))return c;"string"==typeof d&&(d=new g.ce(d));d.cv(a.B);a.B.ga&&d.U();d.name=e;d.Lu&&(c=rc(a,c,d.Lu));a.Na.splice(c,0,d);++c;d.mv&&(c=rc(a,c,d.mv));a.B.ga&&(a.B.Da(),a.B.Qb());return c}b.isVisible=function(){return this.mi};
b.Yb=function(a){var c=[];if(this.mi==a)return c;for(var d=(this.mi=a)?"block":"none",e=0,f;f=this.Na[e];e++)f.Yb(a);if(this.connection){if(a)c=sc(this.connection);else if(e=this.connection,tc(e,!0),e.ka)for(e=p(C(e),!1),f=0;f<e.length;f++){for(var h=e[f],k=h.Ke(!0),l=0;l<k.length;l++)tc(k[l],!0);h=Wa(h);for(l=0;l<h.length;l++)h[l].Yb(!1)}if(e=C(this.connection))e.za().style.display=d,a||(e.ga=!1)}return c};b.fn=function(){for(var a=0,c;c=this.Na[a];a++)c.fn()};
b.Za=function(a){if(!this.connection)throw Error("This input does not have a connection.");this.connection.Za(a);return this};function uc(a,c){a.align=c;a.B.ga&&a.B.Da();return a}b.U=function(){if(this.B.v.ga)for(var a=0;a<this.Na.length;a++)this.Na[a].U()};b.I=function(){for(var a=0,c;c=this.Na[a];a++)c.I();this.connection&&this.connection.I();this.B=null};g.lo=function(a,c,d){if(g.Generator&&"undefined"!=typeof g.Generator.prototype[c])throw Error('Block prototypeName "'+c+'" conflicts with Blockly.Generator members.');this.id=d&&!x(a,d)?d:g.g.Qg();a.ps[this.id]=this;this.$=this.V=this.L=null;this.S=[];this.Xg=void 0;this.disabled=!1;this.yf="";this.contextMenu=!0;this.gg=null;this.Jg=[];this.Ux=this.xz=this.Is=!0;this.Kg=this.hb=!1;this.Bk=null;this.He={text:null,Ku:!1,size:new g.g.ge(160,80)};this.IA=new g.g.X(0,0);this.v=a;this.ec=a.qe;this.G=a.G;
this.Xm=!1;this.Vg=void 0;if(c){this.type=c;d=g.N[c];if(!d||"object"!=typeof d)throw TypeError("Unknown block type: "+c);g.g.object.ag(this,d)}a.ul.push(this);a.mh[this.type]||(a.mh[this.type]=[]);a.mh[this.type].push(this);"function"==typeof this.U&&this.U();this.GF=this.Xg;if(g.i.isEnabled()){(a=g.i.cc())||g.i.aa(!0);try{g.i.Oa(new g.i.mo(this))}finally{a||g.i.aa(!1)}}if("function"==typeof this.onchange){if((a=this.onchange)&&"function"!=typeof a)throw Error("onchange must be a function.");this.on&&
Ca(this.v,this.on);if(this.onchange=a)this.on=a.bind(this),Ba(this.v,this.on)}};b=g.lo.prototype;b.data=null;b.Mi="#000000";b.kx=null;b.lx=null;
b.I=function(a){if(this.v){this.on&&Ca(this.v,this.on);g.Qe&&g.navigation.yz(this);D(this,a);g.i.isEnabled()&&g.i.Oa(new g.i.XA(this));g.i.disable();try{if(this.v){wa(this.v,this);var c=this.v;c.mh[this.type].splice(c.mh[this.type].indexOf(this),1);c.mh[this.type].length||delete c.mh[this.type];delete this.v.ps[this.id];this.v=null}g.selected==this&&(g.selected=null);for(var d=this.Jg.length-1;0<=d;d--)this.Jg[d].I(!1);d=0;for(var e;e=this.S[d];d++)e.I();this.S.length=0;var f=this.Ke(!0);d=0;for(var h;h=
f[d];d++)h.I()}finally{g.i.enable()}}};b.dj=function(){for(var a=0,c;c=this.S[a];a++)for(var d=0,e;e=c.Na[d];d++)e.dj&&e.dj()};
function D(a,c){if(a.L){var d=null;a.L.isConnected()&&(d=a.L.ka,a.L.disconnect());if(d&&c){a:{c=null;for(var e=0;e<a.S.length;e++){var f=a.S[e].connection;if(f&&f.type==g.Ra&&f.ka){if(c){a=null;break a}c=f}}a=c}a&&a.isConnected()&&!C(a).hb&&(a=a.ka,a.disconnect(),oc(a,d)?d.connect(a):a.kq(d))}}else a.$&&(d=null,a.$.isConnected()&&(d=a.$.ka,a.$.disconnect()),e=q(a),c&&e&&!e.hb&&(a=a.V.ka,a.disconnect(),d&&oc(d,a)&&d.connect(a)))}
b.Ke=function(){var a=[];this.L&&a.push(this.L);this.$&&a.push(this.$);this.V&&a.push(this.V);for(var c=0,d;d=this.S[c];c++)d.connection&&a.push(d.connection);return a};b.Qb=function(){console.warn("Not expected to reach Block.bumpNeighbours function. BlockSvg.bumpNeighbours was expected to be called instead.")};b.getParent=function(){return this.gg};function vc(a){do{var c=a;a=a.getParent();if(!a)return null}while(q(a)==c);return a}function q(a){return a.V&&C(a.V)}
function db(a){var c=a;do a=c,c=a.gg;while(c);return a}b.Ih=function(a){if(!a)return this.Jg;a=[];for(var c=0,d;d=this.S[c];c++)d.connection&&(d=C(d.connection))&&a.push(d);(c=q(this))&&a.push(c);return a};b.jl=function(a){if(a!=this.gg){if(this.gg){g.g.$o(this.gg.Jg,this);if(this.$&&this.$.isConnected())throw Error("Still connected to previous block.");if(this.L&&this.L.isConnected())throw Error("Still connected to parent block.");this.gg=null}else wa(this.v,this);(this.gg=a)?a.Jg.push(this):this.v.ul.push(this)}};
function p(a,c){var d=[a];a=a.Ih(c);for(var e,f=0;e=a[f];f++)d.push.apply(d,p(e,c));return d}b.pe=function(){return this.Is&&!this.hb&&!(this.v&&this.v.options.readOnly)};b.Nc=function(){return this.xz&&!this.hb&&!(this.v&&this.v.options.readOnly)};b.zq=function(a){this.xz=a};b.bv=function(a){this.hb=a};b.Sh=function(){return this.Xm};b.gA=function(a){this.Xm=a};b.pd=function(){return this.Ux&&!(this.v&&this.v.options.readOnly)};
b.Yu=function(a){this.Ux=a;a=0;for(var c;c=this.S[a];a++)for(var d=0,e;e=c.Na[d];d++)e.nh()};b.Ha=function(a){this.yf=a};function wc(a){var c=a.kx;return c?c:g.g.Ab.os("#fff",a.Mi,.6)}b.ed=function(a){var c="string"==typeof a?g.g.nc(a):a,d=Number(c);if(!isNaN(d)&&0<=d&&360>=d)this.Mi=g.Xy(d);else if(d=g.g.Ab.parse(c))this.Mi=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);};
function J(a,c){var d=a.v.Ip().FD[c];if(d)a.kx=d.colourSecondary,a.lx=d.colourTertiary,a.Vg=d.Vg,a.ed(d.colourPrimary);else throw Error("Invalid style name: "+c);}function B(a,c){for(var d=0,e;e=a.S[d];d++)for(var f=0,h;h=e.Na[f];f++)if(h.name==c)return h;return null}b.Bt=function(){for(var a=[],c=0,d;d=this.S[c];c++)for(var e=0,f;f=d.Na[e];e++)f.wn()&&a.push(f.getValue());return a};
b.Ug=function(){for(var a=[],c=0,d;d=this.S[c];c++)for(var e=0,f;f=d.Na[e];e++)f.wn()&&(f=this.v.mf(f.getValue()))&&a.push(f);return a};b.Jq=function(a){for(var c=0,d;d=this.S[c];c++)for(var e=0,f;f=d.Na[e];e++)f.wn()&&a.wa()==f.getValue()&&xb(f)};b.tq=function(a,c){for(var d=0,e;e=this.S[d];d++)for(var f=0,h;h=e.Na[f];f++)h.wn()&&a==h.getValue()&&h.setValue(c)};function z(a,c){return(a=B(a,c))?a.getValue():null}
function xc(a,c,d){a=B(a,d);if(!a)throw Error('Field "'+d+'" not found.');a.setValue(c)}b.Ac=function(a,c){if(a){void 0===c&&(c=null);if(!this.$){if(this.L)throw Error("Remove output connection prior to adding previous connection.");this.$=this.dn(g.$e)}this.$.Za(c)}else if(this.$){if(this.$.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.$.I();this.$=null}};
b.zc=function(a,c){if(a)void 0===c&&(c=null),this.V||(this.V=this.dn(g.Sa)),this.V.Za(c);else if(this.V){if(this.V.isConnected())throw Error("Must disconnect next statement before removing connection.");this.V.I();this.V=null}};
b.td=function(a,c){if(a){void 0===c&&(c=null);if(!this.L){if(this.$)throw Error("Remove previous connection prior to adding output connection.");this.L=this.dn(g.Ze)}this.L.Za(c)}else if(this.L){if(this.L.isConnected())throw Error("Must disconnect output value before removing connection.");this.L.I();this.L=null}};b.re=function(a){this.Xg!=a&&(g.i.Oa(new g.i.qg(this,"inline",null,this.Xg,a)),this.Xg=a)};
function qc(a){if(void 0!=a.Xg)return a.Xg;for(var c=1;c<a.S.length;c++)if(a.S[c-1].type==g.vg&&a.S[c].type==g.vg)return!1;for(c=1;c<a.S.length;c++)if(a.S[c-1].type==g.Ra&&a.S[c].type==g.vg)return!0;return!1}b.isEnabled=function(){return!this.disabled};b.sd=function(a){this.isEnabled()!=a&&(g.i.Oa(new g.i.qg(this,"disabled",null,this.disabled,!a)),this.disabled=!a)};function yc(a){for(a=vc(a);a;){if(a.disabled)return!0;a=vc(a)}return!1}b.isCollapsed=function(){return this.Kg};
b.hh=function(a){this.Kg!=a&&(g.i.Oa(new g.i.qg(this,"collapsed",null,this.Kg,a)),this.Kg=a)};b.toString=function(a,c){var d=[],e=c||"?";if(this.Kg)d.push(E(this,"_TEMP_COLLAPSED_INPUT").Na[0].dc());else for(var f=0,h;h=this.S[f];f++){for(var k=0,l;l=h.Na[k];k++)d.push(l.dc());h.connection&&((h=C(h.connection))?d.push(h.toString(void 0,c)):d.push(e))}d=d.join(" ").trim()||"???";a&&d.length>a&&(d=d.substring(0,a-3)+"...");return d};function K(a,c){return a.cf(g.Ra,c)}
function L(a,c){return a.cf(g.vg,c||"")}
function zc(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.Vg&&(a.Vg=c.style.Vg,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{J(a,e)}catch(F){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.ed(e)}catch(F){console.warn(d+
"Illegal colour value: ",e)}}for(e=0;void 0!==c["message"+e];){for(var f=a,h=c["args"+e]||[],k=c["lastDummyAlign"+e],l=g.g.sH(c["message"+e]),m=[],n=0,u=[],v=0;v<l.length;v++){var w=l[v];if("number"==typeof w){if(0>=w||w>h.length)throw Error('Block "'+f.type+'": Message index %'+w+" out of range.");if(m[w])throw Error('Block "'+f.type+'": Message index %'+w+" duplicated.");m[w]=!0;n++;u.push(h[w-1])}else(w=w.trim())&&u.push(w)}if(n!=h.length)throw Error('Block "'+f.type+'": Message does not reference all '+
h.length+" arg(s).");u.length&&("string"==typeof u[u.length-1]||g.g.ib.startsWith(u[u.length-1].type,"field_"))&&(v={type:"input_dummy"},k&&(v.align=k),u.push(v));k={LEFT:g.Tq,RIGHT:g.co,CENTRE:g.zv};h=[];for(v=0;v<u.length;v++)if(m=u[v],"string"==typeof m)h.push([m,void 0]);else{l=n=null;do if(w=!1,"string"==typeof m)n=new g.ce(m);else switch(m.type){case "input_value":l=K(f,m.name);break;case "input_statement":l=f.cf(g.Sa,m.name);break;case "input_dummy":l=L(f,m.name);break;default:n=g.vc.qa(m),
!n&&m.alt&&(m=m.alt,w=!0)}while(w);if(n)h.push([n,m.name]);else if(l){m.check&&l.Za(m.check);m.align&&uc(l,k[m.align]);for(m=0;m<h.length;m++)I(l,h[m][0],h[m][1]);h.length=0}}e++}void 0!==c.inputsInline&&a.re(c.inputsInline);void 0!==c.output&&a.td(!0,c.output);void 0!==c.previousStatement&&a.Ac(!0,c.previousStatement);void 0!==c.nextStatement&&a.zc(!0,c.nextStatement);void 0!==c.tooltip&&(e=c.tooltip,e=g.g.nc(e),a.Ha(e));void 0!==c.enableContextMenu&&(e=c.enableContextMenu,a.contextMenu=!!e);void 0!==
c.helpUrl&&(e=c.helpUrl,e=g.g.nc(e),a.Lb=e);"string"==typeof c.extensions&&(console.warn(d+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+c.type+"' block."),c.extensions=[c.extensions]);void 0!==c.mutator&&g.Z.apply(c.mutator,a,!0);if(Array.isArray(c.extensions))for(c=c.extensions,d=0;d<c.length;++d)g.Z.apply(c[d],a,!1)}
b.ag=function(a,c){if(void 0!==c&&"boolean"!=typeof c)throw Error("opt_disableCheck must be a boolean if provided");if(!c){c=[];for(var d in a)void 0!==this[d]&&c.push(d);if(c.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(c));}g.g.object.ag(this,a)};b.cf=function(a,c){var d=null;if(a==g.Ra||a==g.Sa)d=this.dn(a);a=new g.ew(a,c,this,d);this.S.push(a);return a};
function Ac(a,c,d){if(c!=d){for(var e=-1,f=d?-1:a.S.length,h=0,k;k=a.S[h];h++)if(k.name==c){if(e=h,-1!=f)break}else if(d&&k.name==d&&(f=h,-1!=e))break;if(-1==e)throw Error('Named input "'+c+'" not found.');if(-1==f)throw Error('Reference input "'+d+'" not found.');a.lu(e,f)}}
b.lu=function(a,c){if(a==c)throw Error("Can't move input to itself.");if(a>=this.S.length)throw RangeError("Input index "+a+" out of bounds.");if(c>this.S.length)throw RangeError("Reference input "+c+" out of bounds.");var d=this.S[a];this.S.splice(a,1);a<c&&c--;this.S.splice(c,0,d)};b.ob=function(a,c){for(var d=0,e;e=this.S[d];d++)if(e.name==a){e.I();this.S.splice(d,1);return}if(!c)throw Error("Input not found: "+a);};function E(a,c){for(var d=0,e;e=a.S[d];d++)if(e.name==c)return e;return null}
function Bc(a,c){return(a=E(a,c))&&a.connection&&C(a.connection)}b.ii=function(a){this.He.text!=a&&(g.i.Oa(new g.i.qg(this,"comment",null,this.He.text,a)),this.Bk=this.He.text=a)};b.jh=function(){};b.il=function(){};b.Ta=function(){return this.IA};b.moveBy=function(a,c){if(this.gg)throw Error("Block has parent.");var d=new g.i.Bl(this);this.IA.translate(a,c);d.yj();g.i.Oa(d)};b.dn=function(a){return new g.ua(this,a)};
function pc(a){var c=a.type?'"'+a.type+'" block':"Block";a.id&&(c+=' (id="'+a.id+'")');return c};g.m={};g.m.fl={};g.m.Xn=!1;g.m.register=function(a,c){if(g.m.fl[a])throw Error("Renderer has already been registered.");g.m.fl[a]=c};g.m.unregister=function(a){g.m.fl[a]?delete g.m.fl[a]:console.warn('No renderer mapping for name "'+a+'" found to unregister')};g.m.qM=function(){g.m.Xn=!0};g.m.rM=function(){g.m.Xn=!1};g.m.U=function(a){function c(){c.w.constructor.call(this)}if(!g.m.fl[a])throw Error("Renderer not registered: ",a);g.g.object.Y(c,g.m.fl[a]);a=new c;a.U();return a};g.ti=function(){g.ti.w.constructor.call(this)};g.g.object.Y(g.ti,g.zo);g.ti.prototype.next=function(){var a=this.Wb;if(!a)return null;(a=a.next())&&t(this,a);return a};g.ti.prototype.Qm=function(){return null};g.ti.prototype.hg=function(){var a=this.Wb;if(!a)return null;(a=a.hg())&&t(this,a);return a};g.ti.prototype.pn=function(){return null};g.m.kJ=function(){};g.m.Ai=function(a){this.Ij=a;this.ml=g.g.o.K("path",{"class":"blocklyPath"},this.Ij);this.Pn=g.g.o.K("path",{"class":"blocklyPathLight"},this.Ij);this.Nn=g.g.o.K("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Ij)};g.m.Ai.prototype.$u=function(a){this.ml.setAttribute("d",a);this.Pn.style.display="none";this.Nn.style.display="none"};g.m.Ai.prototype.ht=function(){this.ml.setAttribute("transform","scale(-1 1)")};g.wi=function(){g.Fc.call(this);this.od=-1};g.g.object.Y(g.wi,g.Fc);b=g.wi.prototype;b.Ja=function(){var a=document.createElement("div");a.id=this.wa();this.lb=a;a.className="goog-menu goog-menu-vertical blocklyNonSelectable";a.tabIndex=0;g.g.M.se(a,this.Vu||g.g.M.If.nC)};b.focus=function(){var a=this.va();a&&(a.focus(),g.g.o.qb(a,"focused"))};b.blur=function(){var a=this.va();a&&(a.blur(),g.g.o.Tb(a,"focused"))};b.se=function(a){this.Vu=a};
b.lf=function(){g.wi.w.lf.call(this);Mb(this,function(a){if(a.cd){var c=a.va();c=c.id||(c.id=a.wa());this.zk||(this.zk={});this.zk[c]=a}},this);this.ks()};b.Hh=function(){Cc(this,-1);g.wi.w.Hh.call(this)};b.ym=function(){g.wi.w.ym.call(this);this.Ks()};b.ks=function(){var a=this.va();this.$F=g.ca(a,"mouseover",this,this.sF,!0);this.hm=g.ca(a,"click",this,this.kF,!0);this.XF=g.ca(a,"mouseenter",this,this.pF,!0);this.YF=g.ca(a,"mouseleave",this,this.rF,!0);this.nn=g.ca(a,"keydown",this,this.Ct)};
b.Ks=function(){g.Ua(this.$F);g.Ua(this.hm);g.Ua(this.XF);g.Ua(this.YF);g.Ua(this.nn)};b.zk=null;function Dc(a,c){if(a.zk)for(var d=a.va();c&&c!==d;){var e=c.id;if(e in a.zk)return a.zk[e];c=c.parentNode}return null}function Ec(a){(a=a.mb[a.od]||null)&&a.ih(!1)}function Cc(a,c){var d=a.mb[c]||null;d?(d.ih(!0),a.od=c):-1<a.od&&((a.mb[a.od]||null).ih(!1),a.od=-1);d&&g.g.style.Wu(d.va(),a.va())}b.ih=function(a){Cc(this,this.mb.indexOf(a))};
function Fc(a){Ec(a);Gc(a,function(c,d){return(c+1)%d},a.od)}function Hc(a){Ec(a);Gc(a,function(c,d){c--;return 0>c?d-1:c},a.od)}function Gc(a,c,d){var e=a.mb.length;d=c.call(a,0>d?-1:d,e);for(var f=0;f<=e;){var h=a.mb[d]||null;if(h&&h.isEnabled()){Cc(a,d);break}f++;d=c.call(a,d,e)}}b.sF=function(a){(a=Dc(this,a.target))&&a.isEnabled()&&(this.mb[this.od]||null)!==a&&(Ec(this),this.ih(a))};b.kF=function(a){var c=Dc(this,a.target),d;if(d=c)c.isEnabled()&&(c.ih(!0),Ic(c)),d=void 0;d&&a.preventDefault()};
b.pF=function(){this.focus()};b.rF=function(){this.va()&&(this.blur(),Ec(this),Cc(this,-1))};b.Ct=function(a){return 0!=this.mb.length&&Jc(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1};function Jc(a,c){var d=a.mb[a.od]||null;if(d&&"function"==typeof d.Ct&&d.Ct(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case g.g.ya.Fl:d&&Ic(d);break;case g.g.ya.Zl:Hc(a);break;case g.g.ya.El:Fc(a);break;default:return!1}return!0};g.Lo=function(a,c){g.Fc.call(this);this.hf=a;this.setValue(c);this.up=!0};g.g.object.Y(g.Lo,g.Fc);b=g.Lo.prototype;
b.Ja=function(){var a=document.createElement("div");a.id=this.wa();this.lb=a;a.className="goog-menuitem goog-option "+(this.up?"":"goog-menuitem-disabled ")+(this.xs?"goog-option-selected ":"")+(this.Wk()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.gm){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(Kc(this));g.g.M.se(a,this.Vu||(this.gm?g.g.M.If.pC:
g.g.M.If.oC));g.g.M.cb(a,g.g.M.State.nk,this.gm&&this.xs||!1)};function Kc(a){a=a.hf;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.$a=a};b.getValue=function(){return this.$a};b.se=function(a){this.Vu=a};function Lc(a,c){if(a.gm){a.xs=c;var d=a.va();d&&a.isEnabled()&&(c?(g.g.o.qb(d,"goog-option-selected"),g.g.M.cb(d,g.g.M.State.nk,!0)):(g.g.o.Tb(d,"goog-option-selected"),g.g.M.cb(d,g.g.M.State.nk,!1)))}}
b.ih=function(a){var c=this.va();c&&this.isEnabled()&&(a?g.g.o.qb(c,"goog-menuitem-highlight"):g.g.o.Tb(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.up};b.sd=function(a){this.up=a;(a=this.va())&&(this.up?g.g.o.Tb(a,"goog-menuitem-disabled"):g.g.o.qb(a,"goog-menuitem-disabled"))};function Ic(a){a.gm&&Lc(a,!a.xs);a.Rw&&a.Rw.call(a.tD,a)}function Mc(a,c,d){a.Rw=c;a.tD=d};g.g.Hq={};g.g.Hq.Tg=function(a){a=a.va();var c=g.g.style.Tg(a);c.height=a.scrollHeight;return c};g.g.Hq.uD=function(a,c,d){c.left+=d.width;c.right+=d.width;a.left+=d.width;a.right+=d.width};g.Fa={};g.Fa.np=null;g.Fa.Xx=null;g.Fa.show=function(a,c,d){g.ba.show(g.Fa,d,null);if(c.length){var e=g.Fa.KG(c,d);g.Fa.rd(e,a,d);setTimeout(function(){e.va().focus()},1);g.Fa.np=null}else g.Fa.Ga()};g.Fa.KG=function(a,c){var d=new g.wi;Nb(d,c);for(var e=0,f;f=a[e];e++){var h=new g.Lo(f.text);Nb(h,c);d.cm(h,d.mb.length,!0);h.sd(f.enabled);f.enabled&&Mc(h,function(){g.Fa.Ga();this.Gb()},f)}return d};
g.Fa.rd=function(a,c,d){var e=g.g.gF();c={top:c.clientY+e.top,bottom:c.clientY+e.top,left:c.clientX+e.left,right:c.clientX+e.left};g.Fa.fE(a);var f=g.g.Hq.Tg(a);d&&g.g.Hq.uD(e,c,f);g.ba.LG(e,c,f,d);a.va().focus()};g.Fa.fE=function(a){a.Da(g.ba.Ca);var c=a.va();g.g.o.qb(c,"blocklyContextMenu");g.ca(c,"contextmenu",null,g.g.jG);a.focus()};g.Fa.Ga=function(){g.ba.Ok(g.Fa);g.Fa.np=null;g.Fa.Xx&&g.Ua(g.Fa.Xx)};
g.Fa.cp=function(a,c){return function(){g.i.disable();try{var d=g.R.Vi(c,a.v),e=a.Ta();e.x=a.G?e.x-g.zd:e.x+g.zd;e.y+=2*g.zd;d.moveBy(e.x,e.y)}finally{g.i.enable()}g.i.isEnabled()&&!d.hb&&g.i.Oa(new g.i.mo(d));d.select()}};g.Fa.CD=function(a){var c=p(a,!1).length,d=q(a);d&&(c-=p(d,!1).length);return{text:1==c?g.h.DELETE_BLOCK:g.h.DELETE_X_BLOCKS.replace("%1",String(c)),enabled:!0,Gb:function(){g.i.aa(!0);a.I(!0,!0);g.i.aa(!1)}}};
g.Fa.ED=function(a){return{enabled:!("function"==typeof a.Lb?!a.Lb():!a.Lb),text:g.h.HELP,Gb:function(){var c="function"==typeof a.Lb?a.Lb():a.Lb;c&&window.open(c)}}};g.Fa.DD=function(a){var c=Aa(a.v)?za(a.v,g.g.nt(a,!0)):!0;return{text:g.h.DUPLICATE_BLOCK,enabled:c,Gb:function(){g.Tx(a)}}};g.Fa.BD=function(a){var c={enabled:!g.g.userAgent.wg};a.Bk?(c.text=g.h.REMOVE_COMMENT,c.Gb=function(){a.ii(null)}):(c.text=g.h.ADD_COMMENT,c.Gb=function(){a.ii("")});return c};
g.Fa.ML=function(a){return{text:g.h.QK,enabled:!0,Gb:function(){g.i.aa(!0);a.I(!0,!0);g.i.aa(!1)}}};g.Fa.NL=function(a){return{text:g.h.zI,enabled:!0,Gb:function(){g.Tx(a)}}};
g.Fa.vM=function(a,c){if(!g.rk)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!g.g.userAgent.wg};d.text=g.h.IH;d.Gb=function(){var e=new g.rk(a,g.h.FL,g.rk.qB,g.rk.qB),f=aa(a).getBoundingClientRect();f=new g.g.X(c.clientX-f.left,c.clientY-f.top);var h=g.g.Jm(a.jb);f=g.g.X.xm(f,h);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.ga&&(e.Td(),e.Da(),e.select())};return d};g.Ag=function(a,c){g.Ag.w.constructor.call(this,a,c);this.Tf=a.v.lp[c];this.Cx=a.v.lp[g.kk[c]];this.rj=new g.g.X(0,0);this.Oh=!1;this.Vy=!this.Tf};g.g.object.Y(g.Ag,g.ua);b=g.Ag.prototype;b.I=function(){g.Ag.w.I.call(this);this.Oh&&Nc(this.Tf,this)};function Oc(a,c){var d=a.$b-c.$b;a=a.fb-c.fb;return Math.sqrt(d*d+a*a)}
function Gb(a,c){if(!a.B.v.lc()){var d=db(a.B);if(!d.ec){var e=!1;if(!d.Nc()){d=db(c.B);if(!d.Nc())return;c=a;e=!0}var f=g.selected==d;f||d.Yo();var h=c.$b+g.zd+Math.floor(Math.random()*g.Xq)-a.$b,k=c.fb+g.zd+Math.floor(Math.random()*g.Xq)-a.fb;e&&(k=-k);d.G&&(h=c.$b-g.zd-Math.floor(Math.random()*g.Xq)-a.$b);d.moveBy(h,k);f||d.yn()}}}b.moveTo=function(a,c){this.Oh&&Nc(this.Tf,this);this.$b=a;this.fb=c;this.Vy||Pc(this.Tf,this)};b.moveBy=function(a,c){this.moveTo(this.$b+a,this.fb+c)};
function Qc(a,c){a.moveTo(c.x+a.rj.x,c.y+a.rj.y)}function Rc(a,c,d){a.rj.x=c;a.rj.y=d}function Sc(a){var c=a.ka.$b-a.$b,d=a.ka.fb-a.fb;if(0!=c||0!=d){a=C(a);var e=a.za();if(!e)throw Error("block is not rendered.");e=g.g.Me(e);a.za().setAttribute("transform","translate("+(e.x-c)+","+(e.y-d)+")");bb(a,-c,-d)}}
b.closest=function(a,c){var d=this.Cx;if(d.ic.length){var e=this.fb,f=this.$b;this.$b=f+c.x;this.fb=e+c.y;var h=Tc(d,this);c=null;for(var k=a,l,m=h-1;0<=m&&Math.abs(d.ic[m].fb-this.fb)<=a;)l=d.ic[m],this.Tp(l,k)&&(c=l,k=Oc(l,this)),m--;for(;h<d.ic.length&&Math.abs(d.ic[h].fb-this.fb)<=a;)l=d.ic[h],this.Tp(l,k)&&(c=l,k=Oc(l,this)),h++;this.$b=f;this.fb=e;a={connection:c,qq:k}}else a={connection:null,qq:a};return a};
b.Gt=function(){var a=this.B.v.eh.C;a=this.type==g.Ra||this.type==g.Ze?g.g.A.moveBy(0,-5)+g.g.A.ea("v",5)+a.zi.Te+g.g.A.ea("v",5):g.g.A.moveBy(-5,0)+g.g.A.ea("h",5)+a.ik.ai+g.g.A.ea("h",5);var c=this.B.Ta();g.ua.Wy=g.g.o.K("path",{"class":"blocklyHighlightedConnectionPath",d:a,transform:"translate("+(this.$b-c.x)+","+(this.fb-c.y)+")"+(this.B.G?" scale(-1 1)":"")},this.B.za())};
function sc(a){tc(a,!1);var c=[];if(a.type!=g.Ra&&a.type!=g.Sa)return c;if(a=C(a)){if(a.isCollapsed()){var d=[];a.L&&d.push(a.L);a.V&&d.push(a.V);a.$&&d.push(a.$)}else d=a.Ke(!0);for(var e=0;e<d.length;e++)c.push.apply(c,sc(d[e]));c.length||(c[0]=a)}return c}function tc(a,c){(a.Vy=c)&&a.Oh?Nc(a.Tf,a):c||a.Oh||Pc(a.Tf,a)}b.Tp=function(a,c){return Oc(this,a)>c?!1:g.Ag.w.Tp.call(this,a)};b.kq=function(a){Gb(this,a)};b.Qs=function(a,c){g.Ag.w.Qs.call(this,a,c);a.ga&&a.Da();c.ga&&(mc(c),c.Da())};
b.Tu=function(){var a=this.B,c=this.vf;if(a.v&&c&&g.i.Rc){g.Ag.w.Tu.call(this);c=C(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.Td();c.Da(!1);a.ga&&a.Da()}};b.zz=function(a){return Uc(this.Cx,this,a)};b.ff=function(a){g.Ag.w.ff.call(this,a);var c=this.B;a=a.B;c.ga&&mc(c);a.ga&&mc(a);c.ga&&a.ga&&(this.type==g.Sa||this.type==g.$e?a.Da():c.Da())};b.Fz=function(){this.isConnected()&&!oc(this,this.ka)&&(D(G(this)?C(this):this.B),this.B.Qb())};g.xa=function(a,c,d){this.H=g.g.o.K("g",{},null);this.H.Rn="";this.uj=a.eh.qz(this.H);this.On=this.uj.Nn||null;this.Yd=this.uj.ml||null;this.Hj=this.uj.Pn||null;this.Yd.yf=this;this.ga=!1;this.Yn=g.g.fj()&&!!a.je;g.J.xk(this.Yd);g.xa.w.constructor.call(this,a,c,d);this.H.dataset&&(this.H.dataset.id=this.id);this.$c=null};g.g.object.Y(g.xa,g.lo);g.xa.prototype.height=0;g.xa.prototype.width=0;g.xa.prototype.$d=null;g.xa.iJ=-1;g.xa.Yq="TEMP_COLLAPSED_WARNING_";g.xa.LC=10;g.xa.vr=25;g.xa.xh=8;
g.xa.Bg=!1;b=g.xa.prototype;b.Td=function(){if(!this.v.ga)throw TypeError("Workspace is headless.");for(var a=0,c;c=this.S[a];a++)c.U();c=Wa(this);for(a=0;a<c.length;a++)Ka(c[a]);this.Ve();Vc(this);this.v.options.readOnly||this.HE||g.ca(this.za(),"mousedown",this,this.$h);this.HE=!0;this.za().parentNode||this.v.jb.appendChild(this.za())};
b.select=function(){if(this.hb&&this.getParent())this.getParent().select();else if(g.selected!=this){var a=null;if(g.selected){a=g.selected.id;g.i.disable();try{ib(g.selected)}finally{g.i.enable()}}a=new g.i.Bd(null,"selected",a,this.id);a.Ec=this.v.id;g.i.Oa(a);g.selected=this;this.Yo()}};function ib(a){if(g.selected==a){var c=new g.i.Bd(null,"selected",a.id,null);c.Ec=a.v.id;g.i.Oa(c);g.selected=null;a.yn()}}b.Ud=null;b.Bk=null;b.Pf=null;b.hd=null;
function Wa(a){var c=[];a.Ud&&c.push(a.Ud);a.Pf&&c.push(a.Pf);a.hd&&c.push(a.hd);return c}b.jl=function(a){var c=this.gg;if(a!=c){g.g.o.Jn();g.xa.w.jl.call(this,a);g.g.o.Kn();var d=this.za();if(!this.v.Nt&&d){var e=this.Ta();a?(a.za().appendChild(d),a=this.Ta(),bb(this,a.x-e.x,a.y-e.y)):c&&(this.v.jb.appendChild(d),this.translate(e.x,e.y))}}};
b.Ta=function(){var a=0,c=0,d=this.Yn?this.v.je.cc():null,e=this.za();if(e){do{var f=g.g.Me(e);a+=f.x;c+=f.y;this.Yn&&this.v.je.jf.firstChild==e&&(f=this.v.je.xt(),a+=f.x,c+=f.y);e=e.parentNode}while(e&&e!=this.v.jb&&e!=d)}return new g.g.X(a,c)};b.moveBy=function(a,c){if(this.gg)throw Error("Block has parent.");var d=g.i.isEnabled();if(d)var e=new g.i.Bl(this);var f=this.Ta();this.translate(f.x+a,f.y+c);bb(this,a,c);d&&(e.yj(),g.i.Oa(e));ic(this.v)};
b.translate=function(a,c){this.za().setAttribute("transform","translate("+a+","+c+")")};b.mu=function(){if(this.Yn){var a=this.Ta();this.za().removeAttribute("transform");this.v.je.Mj(a.x,a.y);hb(this.v.je,this.za())}};b.moveTo=function(a){var c=this.Ta();this.moveBy(a.x-c.x,a.y-c.y)};b.ku=function(a){this.Yn?this.v.je.Mj(a.x,a.y):(this.H.Rn="translate("+a.x+","+a.y+")",this.H.setAttribute("transform",this.H.Rn+this.H.In))};
function Wc(a){if(a.v&&!a.v.lc()&&!a.getParent()&&!a.ec){var c=a.v.Oe;if(c&&c.fH){var d=c.gv,e=d/2,f=a.Ta();c=Math.round((f.x-e)/d)*d+e-f.x;d=Math.round((f.y-e)/d)*d+e-f.y;c=Math.round(c);d=Math.round(d);0==c&&0==d||a.moveBy(c,d)}}}function Xc(a){var c=a.Ta(),d=a.L?g.xa.xh:0,e=Ra(a),f=c.y,h=c.y+e.height;a.G?(a=c.x-(e.width-d),c=c.x+d):(a=c.x-d,c=c.x+e.width-d);return new g.g.Rect(f,h,a,c)}b.fn=function(){for(var a=0,c;c=this.S[a];a++)c.fn()};
b.hh=function(a){if(this.Kg!=a){for(var c=[],d=0,e;e=this.S[d];d++)c.push.apply(c,e.Yb(!a));if(a){e=Wa(this);for(d=0;d<e.length;d++)e[d].Yb(!1);d=this.toString(g.cB);I(L(this,"_TEMP_COLLAPSED_INPUT"),d).U();e=p(this,!0);if(d=q(this))d=e.indexOf(d),e.splice(d,e.length-d);d=1;for(var f;f=e[d];d++)if(f.hd){this.jh(g.h.COLLAPSED_WARNINGS_WARNING,g.xa.Yq);break}}else this.ob("_TEMP_COLLAPSED_INPUT"),this.hd&&(this.hd.kl("",g.xa.Yq),Object.keys(this.hd.ng).length||this.jh(null));g.xa.w.hh.call(this,a);
c.length||(c[0]=this);if(this.ga)for(d=0;f=c[d];d++)f.Da()}};function Yc(a,c,d){for(var e=[],f=0,h;h=a.S[f];f++){for(var k=0,l;l=h.Na[k];k++)l.gz()&&l.isVisible()&&e.push(l);h.connection&&(h=C(h.connection))&&e.push(h)}c=e.indexOf(c);-1==c&&(c=d?-1:e.length);(e=e[d?c+1:c-1])?e instanceof g.pa?e.wf():Yc(e,null,d):(e=a.getParent())&&Yc(e,a,d)}
b.$h=function(a){var c=this.v&&this.v.Sg(a);if(c){if(c.$i)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");rb(c,this);c.tf=a}};
function Zc(a){if(a.v.options.readOnly||!a.contextMenu)return null;var c=[];if(!a.ec){a.pe()&&a.Nc()&&c.push(g.Fa.DD(a));a.v.options.km&&!a.Kg&&a.pd()&&c.push(g.Fa.BD(a));if(a.Nc())if(a.Kg)a.v.options.collapse&&(d={enabled:!0},d.text=g.h.EXPAND_BLOCK,d.Gb=function(){a.hh(!1)},c.push(d));else{for(var d=1;d<a.S.length;d++)if(a.S[d-1].type!=g.Sa&&a.S[d].type!=g.Sa){d={enabled:!0};var e=qc(a);d.text=e?g.h.EXTERNAL_INPUTS:g.h.INLINE_INPUTS;d.Gb=function(){a.re(!e)};c.push(d);break}a.v.options.collapse&&
(d={enabled:!0},d.text=g.h.COLLAPSE_BLOCK,d.Gb=function(){a.hh(!0)},c.push(d))}a.v.options.disable&&a.pd()&&(d={text:a.isEnabled()?g.h.DISABLE_BLOCK:g.h.ENABLE_BLOCK,enabled:!yc(a),Gb:function(){var f=g.i.cc();f||g.i.aa(!0);a.sd(!a.isEnabled());f||g.i.aa(!1)}},c.push(d));a.pe()&&c.push(g.Fa.CD(a))}c.push(g.Fa.ED(a));a.Mg&&a.Mg(c);return c}b.Gn=function(a){var c=Zc(this);c&&c.length&&(g.Fa.show(a,c,this.G),g.Fa.np=this)};
function bb(a,c,d){if(a.ga){for(var e=a.Ke(!1),f=0;f<e.length;f++)e[f].moveBy(c,d);e=Wa(a);for(f=0;f<e.length;f++)La(e[f]);for(f=0;f<a.Jg.length;f++)bb(a.Jg[f],c,d)}}b.Aj=function(a){if(a){var c=this.za();c.Rn="";c.In="";g.zm=g.zm.concat(this.Ke(!0));g.g.o.qb(this.H,"blocklyDragging")}else g.zm=[],g.g.o.Tb(this.H,"blocklyDragging");for(c=0;c<this.Jg.length;c++)this.Jg[c].Aj(a)};function Vc(a){a.Nc()?g.g.o.qb(a.H,"blocklyDraggable"):g.g.o.Tb(a.H,"blocklyDraggable")}
b.zq=function(a){g.xa.w.zq.call(this,a);Vc(this)};b.Yu=function(a){g.xa.w.Yu.call(this,a);a=Wa(this);for(var c=0;c<a.length;c++)a[c].nh()};b.bv=function(a){g.xa.w.bv.call(this,a);this.Ve()};b.gA=function(a){this.Xm!=a&&(this.Xm=a)&&(this.ed(g.RB),g.g.o.qb(this.H,"blocklyInsertionMarker"))};b.za=function(){return this.H};
b.I=function(a,c){if(this.v){g.J.Ga();g.g.o.Jn();var d=this.v;if(g.selected==this){ib(this);var e=this.v;e.Kc&&e.Kc.cancel()}g.Fa.np==this&&g.Fa.Ga();g.Qe&&g.navigation.yz(this);c&&this.ga&&(D(this,a),g.rb.yE(this));this.ga=!1;if(this.$d){for(var f in this.$d)clearTimeout(this.$d[f]);this.$d=null}c=Wa(this);for(e=0;e<c.length;e++)c[e].I();g.xa.w.I.call(this,a);g.g.o.removeNode(this.H);ic(d);this.On=this.Hj=this.Yd=this.H=null;g.g.o.Kn()}};
b.Ve=function(){var a;if(this.isEnabled()){if(this.hb){var c=wc(this);this.Hj.style.display="none";this.On.setAttribute("fill",c);this.Yd.setAttribute("stroke","none");this.Yd.setAttribute("fill",c)}else{if(c=this.lx)var d=a=null;else d=this.Mi,c=null,a=g.g.Ab.os("#fff",d,.3),d=g.g.Ab.os("#000",d,.2);c?(this.Hj.style.display="none",this.On.style.display="none",this.Yd.setAttribute("stroke",c)):(this.Hj.style.display="",this.On.style.display="",this.Yd.setAttribute("stroke","none"),this.Hj.setAttribute("stroke",
a),this.On.setAttribute("fill",d));this.Yd.setAttribute("fill",this.Mi)}c=Wa(this);for(a=0;a<c.length;a++)c[a].Ve();for(c=0;a=this.S[c];c++){d=0;for(var e;e=a.Na[d];d++)e.Ve()}}};function mc(a){!a.isEnabled()||yc(a)?g.g.o.qb(a.H,"blocklyDisabled")&&a.Yd.setAttribute("fill","url(#"+a.v.options.Ng+")"):g.g.o.Tb(a.H,"blocklyDisabled")&&a.Ve();a=a.Ih(!1);for(var c=0,d;d=a[c];c++)mc(d)}b.XE=function(){return this.Pf};
b.ii=function(a){if(!g.Comment)throw Error("Missing require for Blockly.Comment");this.He.text!=a&&(g.xa.w.ii.call(this,a),a=null!=a,!!this.Pf==a?Pa(this.Pf):(a?this.Bk=this.Pf=new g.Comment(this):(this.Pf.I(),this.Bk=this.Pf=null),this.ga&&(this.Da(),this.Qb())))};
b.jh=function(a,c){this.$d||(this.$d=Object.create(null));var d=c||"";if(d)this.$d[d]&&(clearTimeout(this.$d[d]),delete this.$d[d]);else for(var e in this.$d)clearTimeout(this.$d[e]),delete this.$d[e];if(this.v.lc()){var f=this;this.$d[d]=setTimeout(function(){f.v&&(delete f.$d[d],f.jh(a,d))},100)}else{this.ec&&(a=null);c=vc(this);for(e=null;c;)c.isCollapsed()&&(e=c),c=vc(c);e&&e.jh(g.h.COLLAPSED_WARNINGS_WARNING,g.xa.Yq);c=!1;"string"==typeof a?(this.hd||(this.hd=new g.Mf(this),c=!0),this.hd.kl(a,
d)):this.hd&&!d?(this.hd.I(),c=!0):this.hd&&(c=this.hd.dc(),this.hd.kl("",d),(e=this.hd.dc())||this.hd.I(),c=c!=e);c&&this.ga&&(this.Da(),this.Qb())}};b.il=function(a){this.Ud&&this.Ud!==a&&this.Ud.I();a&&(a.T=this,this.Ud=a,Ka(a))};b.sd=function(a){this.isEnabled()!=a&&(g.xa.w.sd.call(this,a),this.ga&&mc(this))};b.ih=function(a){this.ga&&(a?(this.Yd.setAttribute("filter","url(#"+this.v.options.Vx+")"),this.Hj.style.display="none"):(this.Yd.setAttribute("filter","none"),this.Hj.style.display="inline"))};
b.Yo=function(){g.g.o.qb(this.H,"blocklySelected")};b.yn=function(){g.g.o.Tb(this.H,"blocklySelected")};function Za(a,c){c?g.g.o.qb(a.H,"blocklyDraggingDelete"):g.g.o.Tb(a.H,"blocklyDraggingDelete")}b.ed=function(a){g.xa.w.ed.call(this,a);this.ga&&this.Ve()};function cb(a){do{var c=a.za();c.parentNode.appendChild(c);a=a.getParent()}while(a)}b.Ac=function(a,c){g.xa.w.Ac.call(this,a,c);this.ga&&(this.Da(),this.Qb())};b.zc=function(a,c){g.xa.w.zc.call(this,a,c);this.ga&&(this.Da(),this.Qb())};
b.td=function(a,c){g.xa.w.td.call(this,a,c);this.ga&&(this.Da(),this.Qb())};b.re=function(a){g.xa.w.re.call(this,a);this.ga&&(this.Da(),this.Qb())};b.ob=function(a,c){g.xa.w.ob.call(this,a,c);this.ga&&(this.Da(),this.Qb())};b.lu=function(a,c){g.xa.w.lu.call(this,a,c);this.ga&&(this.Da(),this.Qb())};b.cf=function(a,c){a=g.xa.w.cf.call(this,a,c);this.ga&&(this.Da(),this.Qb());return a};
function Db(a,c){if(!c&&a.isCollapsed()){if(a.L&&tc(a.L,c),a.$&&tc(a.$,c),a.V){tc(a.V,c);var d=C(a.V);d&&Db(d,c)}}else{a=a.Ke(!0);for(var e=0;d=a[e];e++)tc(d,c),G(d)&&(d=C(d))&&Db(d,c)}}b.Ke=function(a){var c=[];if(a||this.ga)if(this.L&&c.push(this.L),this.$&&c.push(this.$),this.V&&c.push(this.V),a||!this.Kg){a=0;for(var d;d=this.S[a];a++)d.connection&&c.push(d.connection)}return c};b.dn=function(a){return new g.Ag(this,a)};
b.Qb=function(){if(this.v&&!this.v.lc()){var a=db(this);if(!a.ec)for(var c=this.Ke(!1),d=0,e;e=c[d];d++){e.isConnected()&&G(e)&&C(e).Qb();for(var f=e.zz(g.zd),h=0,k;k=f[h];h++)e.isConnected()&&k.isConnected()||db(k.B)!=a&&(G(e)?Gb(k,e):Gb(e,k))}}};function eb(a){var c=g.i.cc();setTimeout(function(){g.i.aa(c);Wc(a);g.i.aa(!1)},g.jo/2);setTimeout(function(){g.i.aa(c);a.Qb();g.i.aa(!1)},g.jo)}
b.Da=function(a){g.g.o.Jn();this.ga=!0;this.v.eh.Da(this);var c=this.Ta();this.$&&Qc(this.$,c);this.L&&Qc(this.L,c);for(var d=0;d<this.S.length;d++){var e=this.S[d].connection;e&&(Qc(e,c),e.isConnected()&&Sc(e))}this.V&&(Qc(this.V,c),this.V.isConnected()&&Sc(this.V));!1!==a&&((a=this.getParent())?a.Da(!0):ic(this.v));g.g.o.Kn()};b.En=function(a){a?(this.H.appendChild(a),this.$c=a):this.$c=null};b.Fn=function(a){a&&(this.$c?this.H.insertBefore(a,this.$c):this.H.appendChild(a))};
function Ra(a){var c=a.height,d=a.width;if(a=q(a))a=Ra(a),c+=a.height-4,d=Math.max(d,a.width);return{height:c,width:d}}function Va(a,c){c?g.g.o.qb(a.H,"blocklyReplaceable"):g.g.o.Tb(a.H,"blocklyReplaceable")};g.Yj=function(){this.ic=[]};function Pc(a,c){if(c.Oh)throw Error("Connection already in database.");c.B.ec||(a.ic.splice(Tc(a,c),0,c),c.Oh=!0)}function $c(a,c){if(!a.ic.length)return-1;var d=Tc(a,c);if(d>=a.ic.length)return-1;for(var e=c.fb,f=d;0<=f&&a.ic[f].fb==e;){if(a.ic[f]==c)return f;f--}for(;d<a.ic.length&&a.ic[d].fb==e;){if(a.ic[d]==c)return d;d++}return-1}
function Tc(a,c){if(!a.ic.length)return 0;for(var d=0,e=a.ic.length;d<e;){var f=Math.floor((d+e)/2);if(a.ic[f].fb<c.fb)d=f+1;else if(a.ic[f].fb>c.fb)e=f;else{d=f;break}}return d}function Nc(a,c){if(!c.Oh)throw Error("Connection not in database.");var d=$c(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.Oh=!1;a.ic.splice(d,1)}
function Uc(a,c,d){function e(n){var u=h-f[n].$b,v=k-f[n].fb;Math.sqrt(u*u+v*v)<=d&&m.push(f[n]);return v<d}var f=a.ic,h=c.$b,k=c.fb;a=0;for(var l=c=f.length-2;a<l;)f[l].fb<k?a=l:c=l,l=Math.floor((a+c)/2);var m=[];c=a=l;if(f.length){for(;0<=a&&e(a);)a--;do c++;while(c<f.length&&e(c))}return m}g.Yj.U=function(){var a=[];a[g.Ra]=new g.Yj;a[g.Ze]=new g.Yj;a[g.Sa]=new g.Yj;a[g.$e]=new g.Yj;return a};g.ui=function(a,c){this.Mk=a;this.gv=c.spacing;this.mz=c.length;this.OF=(this.Xt=a.firstChild)&&this.Xt.nextSibling;this.fH=c.snap};g.ui.prototype.gi=1;g.ui.prototype.I=function(){this.Mk=null};g.ui.prototype.update=function(a){this.gi=a;var c=this.gv*a||100;this.Mk.setAttribute("width",c);this.Mk.setAttribute("height",c);c=Math.floor(this.gv/2)+.5;var d=c-this.mz/2,e=c+this.mz/2;c*=a;d*=a;e*=a;ad(this.Xt,a,d,e,c,c);ad(this.OF,a,c,c,d,e)};
function ad(a,c,d,e,f,h){a&&(a.setAttribute("stroke-width",c),a.setAttribute("x1",d),a.setAttribute("y1",f),a.setAttribute("x2",e),a.setAttribute("y2",h))}g.ui.prototype.moveTo=function(a,c){this.Mk.setAttribute("x",a);this.Mk.setAttribute("y",c);(g.g.userAgent.wg||g.g.userAgent.Ao)&&this.update(this.gi)};
g.ui.Ja=function(a,c,d){a=g.g.o.K("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},d);0<c.length&&0<c.spacing?(g.g.o.K("line",{stroke:c.colour},a),1<c.length&&g.g.o.K("line",{stroke:c.colour},a)):g.g.o.K("line",{},a);return a};g.De=function(a){var c=!!a.readOnly;if(c)var d=null,e=!1,f=!1,h=!1,k=!1,l=!1,m=!1;else{d=g.De.IG(a.toolbox||null);e=!(!d||!d.getElementsByTagName("category").length);f=a.trashcan;void 0===f&&(f=e);var n=a.maxTrashcanContents;f?void 0===n&&(n=32):n=0;h=a.collapse;void 0===h&&(h=e);k=a.comments;void 0===k&&(k=e);l=a.disable;void 0===l&&(l=e);m=a.sounds;void 0===m&&(m=!0)}var u=!!a.rtl,v=a.horizontalLayout;void 0===v&&(v=!1);var w=a.toolboxPosition;w="end"===w?!1:!0;w=v?w?g.Dg:g.Ei:w==u?g.Cg:g.Md;var F=
a.css;void 0===F&&(F=!0);var ca="https://blockly-demo.appspot.com/static/media/";a.media?ca=a.media:a.path&&(ca=a.path+"media/");var ha=void 0===a.oneBasedIndex?!0:!!a.oneBasedIndex,Ia=a.theme,Je=a.keyMap||g.wb.sb.bE(),Ke=a.renderer||"geras";this.G=u;this.Hd=ha;this.collapse=h;this.km=k;this.disable=l;this.readOnly=c;this.fu=a.maxBlocks||Infinity;this.gu=a.maxInstances;this.uf=ca;this.Ny=e;this.Pc=g.De.HG(a,e);this.Ry=f;this.gq=n;this.xF=m;this.vF=F;this.Rd=v;this.Xk=d;this.Jy=g.De.GG(a);this.Ib=
g.De.JG(a);this.Ia=w;this.rH=Ia;this.sb=Je;this.dh=Ke};g.De.prototype.Sb=null;g.De.prototype.ji=null;g.De.prototype.jc=null;g.De.HG=function(a,c){var d=a.move||{},e={};e.scrollbars=void 0===d.scrollbars&&void 0===a.scrollbars?c:!!d.scrollbars||!!a.scrollbars;e.Rj=e.scrollbars&&void 0!==d.wheel?!!d.wheel:!1;e.Gh=e.scrollbars?void 0===d.drag?!0:!!d.drag:!1;return e};
g.De.JG=function(a){a=a.zoom||{};var c={};c.controls=void 0===a.controls?!1:!!a.controls;c.Rj=void 0===a.wheel?!1:!!a.wheel;c.oA=void 0===a.startScale?1:Number(a.startScale);c.gn=void 0===a.maxScale?3:Number(a.maxScale);c.jn=void 0===a.minScale?.3:Number(a.minScale);c.XG=void 0===a.scaleSpeed?1.2:Number(a.scaleSpeed);return c};g.De.GG=function(a){a=a.grid||{};var c={};c.spacing=Number(a.spacing)||0;c.Ab=a.colour||"#888";c.length=Number(a.length)||1;c.pM=0<c.spacing&&!!a.snap;return c};
g.De.IG=function(a){if(a){if("string"!=typeof a&&(g.g.userAgent.wg&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"==typeof a&&(a=g.R.lh(a),"xml"!=a.nodeName.toLowerCase()))throw TypeError("Toolbox should be an <xml> document.");}else a=null;return a};g.ie=function(a,c){g.ie.w.constructor.call(this,a,c);this.Xp=!1;this.Ge={};this.mA=this.tn=0;this.Du=null};g.g.object.Y(g.ie,g.$j);g.ie.rD=5;g.ie.sD=6;b=g.ie.prototype;b.Ts=function(a){g.ie.w.Ts.call(this,a);!this.Vp&&g.Touch.aq(a)&&bd(this,a)};b.xk=function(a){this.Du=g.ca(document,"mousedown",null,this.uF.bind(this),!0);this.lq=g.ca(document,"mousemove",null,this.Nm.bind(this),!0);this.mq=g.ca(document,"mouseup",null,this.Kp.bind(this),!0);a.preventDefault();a.stopPropagation()};
b.uF=function(a){!this.lc()&&g.Touch.aq(a)&&(bd(this,a),this.Xp&&g.Yh())};b.Nm=function(a){if(this.lc())g.Touch.ev(a)&&g.ie.w.Nm.call(this,a);else if(this.Xp){if(g.Touch.aq(a)){this.Ge[g.Touch.Jp(a)]=cd(this,a);var c=Object.keys(this.Ge);if(2==c.length){c=g.g.X.Ox(this.Ge[c[0]],this.Ge[c[1]])/this.mA;if(0<this.tn&&Infinity>this.tn){var d=c-this.tn;d=0<d?d*g.ie.rD:d*g.ie.sD;var e=this.Bc,f=g.g.ln(a,r(e),qa(e));e.zoom(f.x,f.y,d)}this.tn=c;a.preventDefault()}}g.Yh()}else g.ie.w.Nm.call(this,a)};
b.Kp=function(a){if(g.Touch.aq(a)&&!this.lc()){var c=g.Touch.Jp(a);this.Ge[c]&&delete this.Ge[c];2>Object.keys(this.Ge).length&&(this.Ge={},this.tn=0)}!this.Xp||this.lc()?g.Touch.ev(a)&&g.ie.w.Kp.call(this,a):(a.preventDefault(),a.stopPropagation(),this.I())};b.I=function(){g.ie.w.I.call(this);this.Du&&g.Ua(this.Du)};function bd(a,c){a.Ge[g.Touch.Jp(c)]=cd(a,c);var d=Object.keys(a.Ge);2==d.length&&(a.mA=g.g.X.Ox(a.Ge[d[0]],a.Ge[d[1]]),a.Xp=!0,c.preventDefault())}
function cd(a,c){return a.Bc?new g.g.X(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};g.Mw=function(a){this.Hu=a;this.Tl=Object.create(null)};b=g.Mw.prototype;b.Tt=null;b.I=function(){this.Tl=this.Hu=null};b.load=function(a,c){if(a.length){try{var d=new g.g.global.Audio}catch(l){return}for(var e,f=0;f<a.length;f++){var h=a[f],k=h.match(/\.(\w+)$/);if(k&&d.canPlayType("audio/"+k[1])){e=new g.g.global.Audio(h);break}}e&&e.play&&(this.Tl[c]=e)}};
b.preload=function(){for(var a in this.Tl){var c=this.Tl[a];c.volume=.01;var d=c.play();void 0!==d?d.then(c.pause).catch(function(){}):c.pause();if(g.g.userAgent.ck||g.g.userAgent.cw)break}};b.play=function(a,c){var d=this.Tl[a];d?(a=new Date,null!=this.Tt&&a-this.Tt<g.PC||(this.Tt=a,d=g.g.userAgent.ck||g.g.userAgent.zl?d:d.cloneNode(),d.volume=void 0===c?1:c,d.play())):this.Hu&&this.Hu.Nf.play(a,c)};g.Nw=function(a){this.nm=a;this.Ja()};b=g.Nw.prototype;b.Xa=null;b.jf=null;b.nm=null;b.Ja=function(){this.Xa||(this.Xa=g.g.o.K("svg",{xmlns:g.g.o.Vl,"xmlns:html":g.g.o.ak,"xmlns:xlink":g.g.o.bf,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.nm.appendChild(this.Xa))};b.Mj=function(a,c){a=a.toFixed(0);c=c.toFixed(0);this.Xa.style.display="block";g.g.o.Dn(this.Xa,"translate3d("+a+"px, "+c+"px, 0px)")};b.xt=function(){return g.g.Me(this.Xa)};
b.gp=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var c=this.Xa.childNodes[0],d=this.Xa.childNodes[1];if(!(c&&d&&g.g.o.Oy(c,"blocklyBlockCanvas")&&g.g.o.Oy(d,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!=this.dl?g.g.o.ej(c,this.dl):a.insertBefore(c,a.firstChild);g.g.o.ej(d,c);this.Xa.style.display="none";if(this.Xa.childNodes.length)throw Error("Drag surface was not cleared.");g.g.o.Dn(this.Xa,
"");this.dl=null};
g.pb=function(a,c,d){g.pb.w.constructor.call(this,a);this.jc=a.jc||g.pb.fF;this.ji=a.ji||g.pb.cH;this.lp=g.Yj.U();c&&(this.je=c);d&&(this.Sj=d);this.Kq=this.Sj&&g.g.fj();this.Pm=[];this.Nf=new g.Mw(a.Sb);this.Oe=this.options.Ky?new g.ui(a.Ky,a.Jy):null;this.$c=null;g.O&&g.O.Xi&&dd(this,g.Hw,g.O.Xi);g.Lw&&g.Lw.Xi&&dd(this,g.jD,g.Lw.Xi);g.Ka&&g.Ka.Xi&&dd(this,g.qw,g.Ka.Xi);this.eh=g.m.U(this.options.dh||"geras")};g.g.object.Y(g.pb,g.Ob);b=g.pb.prototype;b.wq=null;b.ga=!0;b.Wh=!0;b.qe=!1;b.ij=!1;
b.Su=!0;b.scrollX=0;b.scrollY=0;b.Sx=null;b.scale=1;b.fd=null;b.Xb=null;b.P=null;b.ta=null;b.Kc=null;b.je=null;b.Sj=null;b.Kq=!1;b.Up=!1;b.Lt=null;b.lz=null;b.jt={};b.qv={};b.nx=null;b.Jj=null;b.bz=null;b.Mt=!0;b.Xu=function(a){this.bb&&this.bb.Lc&&this.bb.Lc.I();if(this.bb=a)this.bb.Lc=new g.Ba(this,!1),this.En(this.bb.Lc.Ja())};b.hA=function(a){this.fc&&this.fc.Lc&&this.fc.Lc.I();if(this.fc=a)this.fc.Lc=new g.Ba(this,!0),this.Fn(this.fc.Lc.Ja())};
b.En=function(a){a?this.jb&&(this.jb.appendChild(a),this.$c=a):this.$c=null};b.Fn=function(a){a&&this.jb&&(this.$c?this.jb.insertBefore(a,this.$c):this.jb.appendChild(a))};function qa(a){if(a.Mt){var c=r(a).getScreenCTM();c&&(a.bz=c.inverse(),a.Mt=!1)}return a.bz}b.Vn=function(){this.Mt=!0};b.isVisible=function(){return this.Wh};
function Qa(a,c){var d=0,e=0,f=1;if(g.g.o.containsNode(a.jb,c)||g.g.o.containsNode(a.xf,c))f=a.scale;do{var h=g.g.Me(c);if(c==a.jb||c==a.xf)f=1;d+=h.x*f;e+=h.y*f;c=c.parentNode}while(c&&c!=r(a));return new g.g.X(d,e)}function aa(a){if(!a.Lt)for(var c=a.H;c;){if(-1!=(" "+(c.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){a.Lt=c;break}c=c.parentNode}return a.Lt}
b.Ja=function(a){this.H=g.g.o.K("g",{"class":"blocklyWorkspace"},null);a&&(this.Tc=g.g.o.K("rect",{height:"100%",width:"100%","class":a},this.H),"blocklyMainBackground"==a&&this.Oe?this.Tc.style.fill="url(#"+this.Oe.Mk.id+")":this.Zb.subscribe(this.Tc,"workspace","fill"));this.jb=g.g.o.K("g",{"class":"blocklyBlockCanvas"},this.H);this.xf=g.g.o.K("g",{"class":"blocklyBubbleCanvas"},this.H);this.qe||(g.ca(this.H,"mousedown",this,this.$h,!1,!0),g.ca(this.H,"wheel",this,this.FG));if(this.options.Ny){if(!g.Gi)throw Error("Missing require for Blockly.Toolbox");
this.ta=new g.Gi(this)}this.Oe&&this.Oe.update(this.scale);ed(this);this.bb.Lc=new g.Ba(this,!1);a=this.bb.Lc.Ja();this.H.appendChild(a);this.fc.Lc=new g.Ba(this,!0);a=this.fc.Lc.Ja();this.H.appendChild(a);return this.H};
b.I=function(){this.ga=!1;this.Kc&&this.Kc.cancel();this.H&&(g.g.o.removeNode(this.H),this.H=null);this.xf=this.jb=null;this.ta&&(this.ta.I(),this.ta=null);this.P&&(this.P.I(),this.P=null);this.fd&&(this.fd.I(),this.fd=null);this.Xb&&(this.Xb.I(),this.Xb=null);this.Tj&&(this.Tj.I(),this.Tj=null);this.fc&&this.fc.Lc.I();this.bb&&this.bb.Lc.I();this.Nf&&(this.Nf.I(),this.Nf=null);this.Oe&&(this.Oe.I(),this.Oe=null);this.Zb&&this.Zb.unsubscribe(this.Tc);g.pb.w.I.call(this);this.jt=this.qv=this.lp=null;
if(!this.options.Sb){var a=r(this).parentNode;a&&g.g.o.removeNode(a)}this.wq&&(g.Ua(this.wq),this.wq=null)};b.cg=function(a,c){return new g.xa(this,a,c)};function fd(a){if(!g.Tr)throw Error("Missing require for Blockly.Trashcan");a.fd=new g.Tr(a);var c=a.fd.Ja();a.H.insertBefore(c,a.jb)}function gd(a){if(!g.Zr)throw Error("Missing require for Blockly.ZoomControls");a.Tj=new g.Zr(a);var c=a.Tj.Ja();a.H.appendChild(c)}
function hd(a,c){var d={Ng:a.options.Ng,Sb:a,G:a.G,Hd:a.options.Hd,Rd:a.Rd,Ia:a.options.Ia,dh:a.options.dh};if(a.Rd){if(!g.Kl)throw Error("Missing require for Blockly.HorizontalFlyout");a.P=new g.Kl(d)}else{if(!g.Fg)throw Error("Missing require for Blockly.VerticalFlyout");a.P=new g.Fg(d)}a.P.wk=!1;return a.P.Ja(c)}function Cb(a){return a.P?a.P:a.ta?a.ta.P:null}function ic(a){if(a.Su&&a.ga){if(a.Xb){var c=a.jc();ma(a.Xb.oe,c);oa(a.Xb.ve,c)}a.Vn()}}
b.resize=function(){this.ta&&this.ta.position();this.P&&this.P.position();this.fd&&this.fd.position();this.Tj&&this.Tj.position();this.Xb&&this.Xb.resize();this.Vn();ed(this)};function lb(a){var c=g.g.bF();g.g.X.Je(a.lz,c)||(a.lz=c,a.Vn(),ed(a))}function r(a){if(a.Xw)return a.Xw;for(var c=a.H;c;){if("svg"==c.tagName)return a.Xw=c;c=c.parentNode}return null}
b.translate=function(a,c){if(this.Kq&&this.Up)this.Sj.Mj(a,c);else{var d="translate("+a+","+c+") scale("+this.scale+")";this.jb.setAttribute("transform",d);this.xf.setAttribute("transform",d)}if(this.je){d=this.je;var e=this.scale;d.gi=e;d.jf.setAttribute("transform","translate("+a.toFixed(0)+","+c.toFixed(0)+") scale("+e+")")}this.Oe&&this.Oe.moveTo(a,c)};
function sa(a){if(a.Kq){a.Up=!1;var c=a.Sj.xt();a.Sj.gp(a.H);c="translate("+c.x+","+c.y+") scale("+a.scale+")";a.jb.setAttribute("transform",c);a.xf.setAttribute("transform",c)}}
function ra(a){if(a.Kq&&!a.Up){a.Up=!0;var c=a.jb.previousSibling,d=parseInt(r(a).getAttribute("width"),10),e=parseInt(r(a).getAttribute("height"),10),f=g.g.Me(a.jb),h=a.Sj,k=a.jb,l=a.xf,m=a.scale;if(h.Xa.childNodes.length)throw Error("Already dragging a block.");h.dl=c;k.setAttribute("transform","translate(0, 0) scale("+m+")");l.setAttribute("transform","translate(0, 0) scale("+m+")");h.Xa.setAttribute("width",d);h.Xa.setAttribute("height",e);h.Xa.appendChild(k);h.Xa.appendChild(l);h.Xa.style.display=
"block";a.Sj.Mj(f.x,f.y)}}b.Zf=function(){var a=this.jc();return a?a.ub/this.scale:0};b.Yb=function(a){this.Xb&&this.Xb.zj(a);Cb(this)&&Cb(this).zj(a);r(this).style.display=a?"block":"none";this.ta&&(this.ta.Gc.style.display=a?"block":"none");if(a){for(var c=y(this,!1),d=c.length-1;0<=d;d--)c[d].fn();this.Da();this.ta&&this.ta.position()}else g.wc(!0);this.Wh=a};b.Da=function(){for(var a=y(this,!1),c=a.length-1;0<=c;c--)a[c].Da(!1);if(this.Kc)for(a=this.Kc.Kk(),c=0;c<a.length;c++)a[c].Da(!1)};
function id(a,c){var d=H;if(void 0===c){for(var e=0,f;f=d.Pm[e];e++)f.ih(!1);d.Pm.length=0}if(f=a?x(d,a):null)(a=void 0===c||c)?-1==d.Pm.indexOf(f)&&d.Pm.push(f):g.g.$o(d.Pm,f),f.ih(a)}
function jd(a){var c=g.im;if(a.ga&&!(c.getElementsByTagName("block").length>=ya(a)))if(a.Kc&&a.Kc.cancel(),"comment"==c.tagName.toLowerCase()){g.i.disable();try{var d=g.rk.Fm(c),e=parseInt(c.getAttribute("x"),10),f=parseInt(c.getAttribute("y"),10);isNaN(e)||isNaN(f)||(a.G&&(e=-e),d.moveBy(e+50,f+50))}finally{g.i.enable()}d.select()}else a:{g.i.disable();try{var h=g.R.Vi(c,a),k=a.fc.Wb;if(g.Qe&&k){g.navigation.az(h,k.sa);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=y(a,!1);d=0;for(var u;u=n[d];d++){var v=u.Ta();if(1>=Math.abs(l-v.x)&&1>=Math.abs(m-v.y)){c=!0;break}}if(!c){var w=h.Ke(!1);d=0;for(var F;F=w[d];d++)if(F.closest(g.zd,new g.g.X(l,m)).connection){c=!0;break}}c&&(l=a.G?l-g.zd:l+g.zd,m+=2*g.zd)}while(c);h.moveBy(l,m)}}finally{g.i.enable()}g.i.isEnabled()&&!h.hb&&g.i.Oa(new g.i.mo(h));h.select()}}
function kd(a){if((a=a.qe?a.Jj:a)&&!a.Kc&&a.ta&&a.ta.P){a=a.ta;var c=a.Id.Wd;c&&c.Of&&a.P.show(c.Of)}}b.ei=function(a,c){g.pb.w.ei.call(this,a,c);kd(this)};b.Vf=function(a){g.pb.w.Vf.call(this,a);kd(this)};b.Pd=function(a,c,d){a=g.pb.w.Pd.call(this,a,c,d);kd(this);return a};function ed(a){a.Gx=a.fd&&a.H.parentNode?a.fd.Hm():null;a.Fx=a.P?a.P.Hm():a.ta?a.ta.Hm():null}function Ya(a,c){return a.Gx&&a.Gx.contains(c.clientX,c.clientY)?g.cr:a.Fx&&a.Fx.contains(c.clientX,c.clientY)?g.Qv:g.Pv}
b.$h=function(a){var c=this.Sg(a);c&&pb(c,a,this)};b.iv=function(a,c){a=g.g.ln(a,r(this),qa(this));a.x/=this.scale;a.y/=this.scale;this.Sx=g.g.X.xm(c,a)};b.lc=function(){return null!=this.Kc&&this.Kc.lc()};function ld(a){return a.options.Pc&&a.options.Pc.scrollbars||a.options.Pc&&a.options.Pc.Rj||a.options.Pc&&a.options.Pc.Gh||a.options.Ib&&a.options.Ib.controls||a.options.Ib&&a.options.Ib.Rj}
b.Nc=function(){return this.options.Pc&&this.options.Pc.scrollbars||this.options.Pc&&this.options.Pc.Rj||this.options.Pc&&this.options.Pc.Gh||this.options.Ib&&this.options.Ib.Rj};
b.FG=function(a){if(g.$j.Jt())a.preventDefault(),a.stopPropagation();else{var c=this.options.Ib&&this.options.Ib.Rj,d=this.options.Pc&&this.options.Pc.Rj;if(c||d){var e=g.g.Ay(a);!c||!a.ctrlKey&&d?(c=this.scrollX-e.x,d=this.scrollY-e.y,a.shiftKey&&!e.x&&(c=this.scrollX-e.y,d=this.scrollY),this.scroll(c,d)):(e=-e.y/50,c=g.g.ln(a,r(this),qa(this)),this.zoom(c.x,c.y,e));a.preventDefault()}}};
function lc(a){var c=A(a,!1);a=xa(a,!1);c=c.concat(a);if(!c.length)return new g.g.Rect(0,0,0,0);a=Xc(c[0]);for(var d=1;d<c.length;d++){var e=Xc(c[d]);e.top<a.top&&(a.top=e.top);e.bottom>a.bottom&&(a.bottom=e.bottom);e.left<a.left&&(a.left=e.left);e.right>a.right&&(a.right=e.right)}return a}b.SD=function(){this.Sc(!1);g.i.aa(!0);for(var a=A(this,!0),c=0,d=0,e;e=a[d];d++)if(e.Nc()){var f=e.Ta();e.moveBy(-f.x,c-f.y);Wc(e);c=e.Ta().y+Ra(e).height+g.xa.vr}g.i.aa(!1);this.Sc(!0)};
b.Gn=function(a){function c(F){if(F.pe())w=w.concat(p(F,!1));else{F=F.Ih(!1);for(var ca=0;ca<F.length;ca++)c(F[ca])}}function d(){g.i.aa(h);var F=w.shift();F&&(F.v?(F.I(!1,!0),setTimeout(d,10)):d());g.i.aa(!1)}if(!this.options.readOnly&&!this.qe){var e=[],f=A(this,!0),h=g.g.Qg(),k=this,l={};l.text=g.h.UNDO;l.enabled=0<this.Nj.length;l.Gb=this.uv.bind(this,!1);e.push(l);l={};l.text=g.h.REDO;l.enabled=0<this.vn.length;l.Gb=this.uv.bind(this,!0);e.push(l);this.Nc()&&(l={},l.text=g.h.CLEAN_UP,l.enabled=
1<f.length,l.Gb=this.SD.bind(this),e.push(l));if(this.options.collapse){for(var m=l=!1,n=0;n<f.length;n++)for(var u=f[n];u;)u.isCollapsed()?l=!0:m=!0,u=q(u);var v=function(F){for(var ca=0,ha=0;ha<f.length;ha++)for(var Ia=f[ha];Ia;)setTimeout(Ia.hh.bind(Ia,F),ca),Ia=q(Ia),ca+=10};m={enabled:m};m.text=g.h.COLLAPSE_ALL;m.Gb=function(){v(!0)};e.push(m);l={enabled:l};l.text=g.h.EXPAND_ALL;l.Gb=function(){v(!1)};e.push(l)}var w=[];for(n=0;n<f.length;n++)c(f[n]);l={text:1==w.length?g.h.DELETE_BLOCK:g.h.DELETE_X_BLOCKS.replace("%1",
String(w.length)),enabled:0<w.length,Gb:function(){k.Kc&&k.Kc.cancel();2>w.length?d():g.confirm(g.h.DELETE_ALL_BLOCKS.replace("%1",w.length),function(F){F&&d()})}};e.push(l);this.nx&&this.nx(e);g.Fa.show(a,e,this.G)}};function pa(a){if(a.options.Sb)pa(a.options.Sb);else{g.cn=a;document.activeElement&&document.activeElement.blur();try{r(a).focus()}catch(c){try{r(a).parentNode.setActive()}catch(d){r(a).parentNode.focus()}}}}
b.zoom=function(a,c,d){if(!this.qe&&!this.ij){d=Math.pow(this.options.Ib.XG,d);var e=this.scale*d;if(this.scale!=e){e>this.options.Ib.gn?d=this.options.Ib.gn/this.scale:e<this.options.Ib.jn&&(d=this.options.Ib.jn/this.scale);var f=this.jb.getCTM(),h=r(this).createSVGPoint();h.x=a;h.y=c;h=h.matrixTransform(f.inverse());a=h.x;c=h.y;f=f.translate(a*(1-d),c*(1-d)).scale(d);this.scrollX=f.e;this.scrollY=f.f;this.setScale(e)}}};
function md(a,c){var d=a.jc();if(a.P){var e=d.nH/2;d=d.mH/2}else e=d.ub/2+d.qc,d=d.Cb/2+d.Hc;a.zoom(e,d,c)}b.GE=function(){g.g.o.Tb(this.jb,"blocklyCanvasTransitioning");g.g.o.Tb(this.xf,"blocklyCanvasTransitioning")};
b.setScale=function(a){this.options.Ib.gn&&a>this.options.Ib.gn?a=this.options.Ib.gn:this.options.Ib.jn&&a<this.options.Ib.jn&&(a=this.options.Ib.jn);this.scale=a;g.wc(!1);this.P&&(this.P.Pu(),ed(this));this.Oe&&this.Oe.update(this.scale);a=this.jc();this.scrollX-=a.qc;this.scrollY-=a.Hc;a.gc+=a.qc;a.pc+=a.Hc;this.scroll(this.scrollX,this.scrollY);this.Xb&&(this.P?(ja(this.Xb.oe,a),ka(this.Xb.ve,a)):(ma(this.Xb.oe,a),oa(this.Xb.ve,a)))};
b.scroll=function(a,c){g.wc(!0);var d=this.jc(),e=d.gf+d.Jc-d.ub,f=d.Od+d.tc-d.Cb;a=Math.min(a,-d.Jc);c=Math.min(c,-d.tc);a=Math.max(a,-e);c=Math.max(c,-f);this.scrollX=a;this.scrollY=c;this.Xb&&(da(this.Xb.oe,-(a+d.Jc)*this.Xb.oe.Qc),da(this.Xb.ve,-(c+d.tc)*this.Xb.ve.Qc));a+=d.qc;c+=d.Hc;this.translate(a,c)};g.pb.sy=function(a){var c=0,d=0;a&&(c=a.Zf(),d=a.vy());return{width:c,height:d}};g.pb.$E=function(a,c){return ld(a)?g.pb.ZE(a,c):g.pb.oy(a)};
g.pb.oy=function(a){var c=lc(a),d=a.scale;a=c.top*d;var e=c.bottom*d,f=c.left*d;c=c.right*d;return{top:a,bottom:e,left:f,right:c,width:c-f,height:e-a}};g.pb.ZE=function(a,c){a=g.pb.oy(a);var d=c.width;c=c.height;var e=d/2,f=c/2,h=Math.min(a.left-e,a.right-d),k=Math.min(a.top-f,a.bottom-c);return{left:h,top:k,height:Math.max(a.bottom+f,a.top+c)-k,width:Math.max(a.right+e,a.left+d)-h}};
g.pb.fF=function(){var a=g.pb.sy(this.ta),c=g.pb.sy(this.P),d=g.rA(r(this)),e={height:d.height,width:d.width};if(this.ta)if(this.Ia==g.Dg||this.Ia==g.Ei)e.height-=a.height;else{if(this.Ia==g.Md||this.Ia==g.Cg)e.width-=a.width}else if(this.P)if(this.Ia==g.Dg||this.Ia==g.Ei)e.height-=c.height;else if(this.Ia==g.Md||this.Ia==g.Cg)e.width-=c.width;var f=g.pb.$E(this,e),h=0;this.ta&&this.Ia==g.Md?h=a.width:this.P&&this.Ia==g.Md&&(h=c.width);var k=0;this.ta&&this.Ia==g.Dg?k=a.height:this.P&&this.Ia==g.Dg&&
(k=c.height);return{Od:f.height,gf:f.width,tc:f.top,Jc:f.left,Cb:e.height,ub:e.width,pc:-this.scrollY,gc:-this.scrollX,Hc:k,qc:h,mH:d.height,nH:d.width,uA:a.width,uM:a.height,SL:c.width,RL:c.height,Ia:this.Ia}};g.pb.cH=function(a){var c=this.jc();"number"==typeof a.x&&(this.scrollX=-c.gf*a.x-c.Jc);"number"==typeof a.y&&(this.scrollY=-c.Od*a.y-c.tc);this.translate(this.scrollX+c.qc,this.scrollY+c.Hc)};g.pb.prototype.Sc=function(a){var c=!this.Su&&a;this.Su=a;c&&ic(this)};
g.pb.prototype.clear=function(){this.Sc(!1);g.pb.w.clear.call(this);this.Sc(!0)};function nd(a,c){if("function"!=typeof c)throw TypeError("Button callbacks must be functions.");a.jt.CREATE_VARIABLE=c}function Lb(a,c){return(a=a.jt[c])?a:null}function dd(a,c,d){if("function"!=typeof d)throw TypeError("Toolbox category callbacks must be functions.");a.qv[c]=d}
g.pb.prototype.Sg=function(a){var c="mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type,d=this.Kc;return d?c&&d.$i?(console.warn("Tried to start the same gesture twice."),d.cancel(),null):d:c?this.Kc=new g.ie(a,this):null};g.Il=function(a){a.jc=this.Km.bind(this);a.ji=this.iA.bind(this);this.s=new g.pb(a);this.s.qe=!0;this.s.Xu(new g.ti);this.s.hA(new g.rh);this.G=!!a.G;this.tl=a.Ia;this.ft=[];this.eq=[];this.fm=[];this.Gd=[];this.Ju=[];this.ql=this.s.eh.C.xh};b=g.Il.prototype;b.wk=!0;b.Wh=!1;b.Oi=!0;b.Db=8;b.Xe=g.Il.prototype.Db;b.FB=3*g.Il.prototype.Xe;b.GB=3*g.Il.prototype.Xe;b.Kr=2;b.xb=0;b.bd=0;b.DE=70;
b.Ja=function(a){this.H=g.g.o.K(a,{"class":"blocklyFlyout",style:"display: none"},null);this.Tc=g.g.o.K("path",{"class":"blocklyFlyoutBackground"},this.H);this.H.appendChild(this.s.Ja());this.s.Zb.subscribe(this.Tc,"flyout","fill");this.s.Zb.subscribe(this.Tc,"flyoutOpacity","fill-opacity");return this.H};
b.U=function(a){this.tb=a;this.s.Jj=a;this.yc=new g.La(this.s,this.pf,!1,"blocklyFlyoutScrollbar");this.Ga();Array.prototype.push.apply(this.ft,g.ca(this.H,"wheel",this,this.CH));this.wk||(this.vp=this.gt.bind(this),Ba(this.tb,this.vp));Array.prototype.push.apply(this.ft,g.ca(this.Tc,"mousedown",this,this.$h));this.s.Sg=this.tb.Sg.bind(this.tb);this.s.Va=this.tb.Va;a=this.s;a.bi=new g.Vr(a)};
b.I=function(){this.Ga();g.Ua(this.ft);this.vp&&(Ca(this.tb,this.vp),this.vp=null);this.yc&&(this.yc.I(),this.yc=null);this.s&&(this.s.Zb.unsubscribe(this.Tc),this.s.Jj=null,this.s.I(),this.s=null);this.H&&(g.g.o.removeNode(this.H),this.H=null);this.tb=this.Tc=null};b.Zf=function(){return this.xb};b.vy=function(){return this.bd};b.Lk=function(){return this.s};b.isVisible=function(){return this.Wh};b.Yb=function(a){var c=a!=this.isVisible();this.Wh=a;c&&this.Un()};
b.zj=function(a){var c=a!=this.Oi;this.Oi=a;c&&this.Un()};b.Un=function(){var a=this.Oi?this.isVisible():!1;this.H.style.display=a?"block":"none";this.yc.zj(a)};b.Ga=function(){if(this.isVisible()){this.Yb(!1);for(var a=0,c;c=this.Gd[a];a++)g.Ua(c);this.Gd.length=0;this.ci&&(Ca(this.s,this.ci),this.ci=null)}};
b.show=function(a){this.s.Sc(!1);this.Ga();od(this);if("string"==typeof a){a=this.s.Jj.qv[a]||null;if("function"!=typeof a)throw TypeError("Couldn't find a callback function when opening a toolbox category.");a=a(this.s.Jj);if(!Array.isArray(a))throw TypeError("Result of toolbox category callback must be an array.");}this.Yb(!0);var c=[],d=[];this.Ju.length=0;for(var e=this.pf?this.FB:this.GB,f=0,h;h=a[f];f++)if(h.tagName)switch(h.tagName.toUpperCase()){case "BLOCK":var k=g.R.Vi(h,this.s);k.isEnabled()||
this.Ju.push(k);c.push({type:"block",block:k});h=parseInt(h.getAttribute("gap"),10);d.push(isNaN(h)?e:h);break;case "SEP":h=parseInt(h.getAttribute("gap"),10);!isNaN(h)&&0<d.length?d[d.length-1]=h:d.push(e);break;case "LABEL":case "BUTTON":k="LABEL"==h.tagName.toUpperCase();if(!g.Zj)throw Error("Missing require for Blockly.FlyoutButton");h=new g.Zj(this.s,this.tb,h,k);c.push({type:"button",button:h});d.push(e)}pd(this,c,d);this.Gd.push(g.ca(this.Tc,"mouseover",this,function(){for(var l=A(this.s,!1),
m=0,n;n=l[m];m++)n.yn()}));this.pf?this.bd=0:this.xb=0;this.s.Sc(!0);this.Pu();this.gt();this.position();this.ci=this.Pu.bind(this);Ba(this.s,this.ci)};function od(a){for(var c=A(a.s,!1),d=0,e;e=c[d];d++)e.v==a.s&&e.I(!1,!1);for(d=0;d<a.eq.length;d++)(c=a.eq[d])&&g.g.o.removeNode(c);for(d=a.eq.length=0;c=a.fm[d];d++)c.I();a.fm.length=0;a.s.bi.clear()}function qd(a,c){return function(d){var e=a.tb.Sg(d);e&&(rb(e,c),qb(e,d,a))}}b.$h=function(a){var c=this.tb.Sg(a);c&&qb(c,a,this)};b.dz=function(a){return a.isEnabled()};
function mb(a,c){var d=null;g.i.disable();var e=a.tb.Rg();a.tb.Sc(!1);try{var f=a.tb;if(!c.za())throw Error("oldBlock is not rendered.");var h=g.R.zh(c,!0);f.Sc(!1);var k=g.R.Vi(h,f);if(!k.za())throw Error("block is not rendered.");var l=g.g.Jm(f.jb),m=g.g.Jm(a.s.jb),n=c.Ta();n.scale(a.s.scale);var u=g.g.X.sum(m,n),v=g.g.X.xm(u,l);v.scale(1/f.scale);k.moveBy(v.x,v.y);d=k;g.wc()}finally{g.i.enable()}c=g.O.ny(a.tb,e);if(g.i.isEnabled())for(g.i.aa(!0),g.i.Oa(new g.i.We(d)),e=0;e<c.length;e++)g.i.Oa(new g.i.Fe(c[e]));
a.wk?a.Ga():a.gt();return d}b.gt=function(){for(var a=A(this.s,!1),c=0,d;d=a[c];c++)if(-1==this.Ju.indexOf(d))for(var e=za(this.tb,g.g.nt(d));d;)d.sd(e),d=q(d)};
b.Pu=function(){this.ci&&Ca(this.s,this.ci);this.s.scale=this.tb.scale;for(var a=0,c=A(this.s,!1),d=0,e;e=c[d];d++){var f=Ra(e).width;e.L&&(f-=this.ql);a=Math.max(a,f)}for(d=0;e=this.fm[d];d++)a=Math.max(a,e.width);a+=1.5*this.Xe+this.ql;a*=this.s.scale;a+=g.La.xc;if(this.xb!=a){for(d=0;e=c[d];d++){if(this.G){f=e.Ta().x;var h=a/this.s.scale-this.Xe;e.L||(h-=this.ql);e.moveBy(h-f,0)}e.by&&(f=e.by,h=e,e=Ra(h),f.setAttribute("width",e.width),f.setAttribute("height",e.height),h=h.Ta(),f.setAttribute("y",
h.y),f.setAttribute("x",this.G?h.x-e.width:h.x))}if(this.G)for(d=0;e=this.fm[d];d++)e.moveTo(a/this.s.scale-e.width-this.Xe-this.ql,e.rd.y);this.xb=a;this.position()}this.ci&&Ba(this.s,this.ci)};function kb(a){return a.yc?a.yc.isVisible():!1};g.ba={};g.ba.Ca=null;g.ba.qd=null;g.ba.sp=null;g.ba.Ja=function(){g.ba.Ca||(g.ba.Ca=document.createElement("div"),g.ba.Ca.className="blocklyWidgetDiv",document.body.appendChild(g.ba.Ca))};g.ba.show=function(a,c,d){g.ba.Ga();g.ba.qd=a;g.ba.sp=d;g.ba.Ca.style.top=g.g.style.Hy().y+"px";g.ba.Ca.style.direction=c?"rtl":"ltr";g.ba.Ca.style.display="block"};
g.ba.Ga=function(){g.ba.qd&&(g.ba.qd=null,g.ba.Ca.style.display="none",g.ba.Ca.style.left="",g.ba.Ca.style.top="",g.ba.sp&&g.ba.sp(),g.ba.sp=null,g.ba.Ca.innerHTML="")};g.ba.isVisible=function(){return!!g.ba.qd};g.ba.Ok=function(a){g.ba.qd==a&&g.ba.Ga()};g.ba.rn=function(a,c,d){g.ba.Ca.style.left=a+"px";g.ba.Ca.style.top=c+"px";g.ba.Ca.style.height=d+"px"};g.ba.LG=function(a,c,d,e){var f=g.ba.JD(a,c,d);a=g.ba.ID(a,c,d,e);0>f?g.ba.rn(a,0,d.height+f):g.ba.rn(a,f,d.height)};
g.ba.ID=function(a,c,d,e){if(e)return c=Math.max(c.right-d.width,a.left),Math.min(c,a.right-d.width);c=Math.min(c.left,a.right-d.width);return Math.max(c,a.left)};g.ba.JD=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};g.Fg=function(a){a.jc=this.Km.bind(this);a.ji=this.iA.bind(this);g.Fg.w.constructor.call(this,a);this.pf=!1};g.g.object.Y(g.Fg,g.Il);b=g.Fg.prototype;b.Km=function(){if(!this.isVisible())return null;try{var a=this.s.jb.getBBox()}catch(f){a={height:0,y:0,width:0,x:0}}var c=this.Kr,d=this.bd-2*this.Kr,e=this.xb;this.G||(e-=this.Kr);return{Cb:d,ub:e,Od:a.height*this.s.scale+2*this.Xe,gf:a.width*this.s.scale+2*this.Xe,pc:-this.s.scrollY+a.y,gc:-this.s.scrollX,tc:a.y,Jc:a.x,Hc:c,qc:0}};
b.iA=function(a){var c=this.Km();c&&("number"==typeof a.y&&(this.s.scrollY=-c.Od*a.y),this.s.translate(this.s.scrollX+c.qc,this.s.scrollY+c.Hc))};
b.position=function(){if(this.isVisible()){var a=this.tb.jc();if(a){this.bd=a.Cb;var c=this.xb-this.Db,d=a.Cb-2*this.Db,e=this.tl==g.Cg,f=c+this.Db;f=["M "+(e?f:0)+",0"];f.push("h",e?-c:c);f.push("a",this.Db,this.Db,0,0,e?0:1,e?-this.Db:this.Db,this.Db);f.push("v",Math.max(0,d));f.push("a",this.Db,this.Db,0,0,e?0:1,e?this.Db:-this.Db,this.Db);f.push("h",e?c:-c);f.push("z");this.Tc.setAttribute("d",f.join(" "));c=this.bd;a=this.tb.Ia==this.tl?a.uA?this.tl==g.Md?a.uA:a.ub-this.xb:this.tl==g.Md?0:a.ub:
this.tl==g.Md?0:a.ub+a.qc-this.xb;this.H.setAttribute("width",this.xb);this.H.setAttribute("height",c);"svg"==this.H.tagName?g.g.o.Dn(this.H,"translate("+a+"px,0px)"):this.H.setAttribute("transform","translate("+a+",0)");this.yc&&(this.yc.Eu=new g.g.X(a,0),this.yc.resize(),ia(this.yc,this.yc.rd.x,this.yc.rd.y))}}};b.CH=function(a){var c=g.g.Ay(a);if(c.y){var d=this.Km();c=d.pc-d.tc+c.y;c=Math.min(c,d.Od-d.Cb);c=Math.max(c,0);this.yc.set(c);g.ba.Ga()}a.preventDefault();a.stopPropagation()};
function pd(a,c,d){a.s.scale=a.tb.scale;for(var e=a.Xe,f=a.G?e:e+a.ql,h=0,k;k=c[h];h++)if("block"==k.type){k=k.block;for(var l=p(k,!1),m=0,n;n=l[m];m++)n.ec=!0;k.Da();n=k.za();l=Ra(k);m=k.L?f-a.ql:f;k.moveBy(m,e);var u=a,v=k,w=h;m=g.g.o.K("rect",{"fill-opacity":0,x:a.G?m-l.width:m,y:e,height:l.height,width:l.width},null);m.yf=v;g.J.xk(m);u.s.jb.insertBefore(m,v.za());v.by=m;u.eq[w]=m;u=a;u.Gd.push(g.ca(n,"mousedown",null,qd(u,k)));u.Gd.push(g.ca(m,"mousedown",null,qd(u,k)));u.Gd.push(g.ld(n,"mouseover",
k,k.Yo));u.Gd.push(g.ld(n,"mouseout",k,k.yn));u.Gd.push(g.ld(m,"mouseover",k,k.Yo));u.Gd.push(g.ld(m,"mouseout",k,k.yn));e+=l.height+d[h]}else"button"==k.type&&(l=a,m=k.button,n=f,u=e,v=m.Ja(),m.moveTo(n,u),m.show(),l.Gd.push(g.ca(v,"mousedown",l,l.$h)),l.fm.push(m),e+=k.button.height+d[h])}
b.Hm=function(){if(!this.H)return null;var a=this.H.getBoundingClientRect(),c=a.left;if(this.tl==g.Md)return new g.g.Rect(-1E9,1E9,-1E9,c+a.width);g.g.userAgent.Eo&&this.tb&&this.tb.ij&&(a=this.tb.H.getBoundingClientRect().x,10>Math.abs(a-c)&&(c+=this.eM*this.tb.options.Sb.scale));return new g.g.Rect(-1E9,1E9,c,1E9)};
g.Zr=function(a){this.s=a};b=g.Zr.prototype;b.Ii=32;b.Wv=110;b.pr=20;b.Ol=20;b.H=null;b.$m=0;b.vl=0;b.Ja=function(){this.H=g.g.o.K("g",{},null);var a=String(Math.random()).substring(2);rd(this,a);sd(this,a);this.s.Nc()&&td(this,a);return this.H};b.U=function(a){this.oh=this.pr+a;return this.oh+this.Wv};b.I=function(){this.H&&g.g.o.removeNode(this.H)};
b.position=function(){if(this.oh){var a=this.s.jc();a&&(this.$m=a.Ia==g.Md||this.s.Rd&&!this.s.G?a.ub+a.qc-this.Ii-this.Ol-g.La.xc:this.Ol+g.La.xc,a.Ia==g.Ei?(this.vl=this.oh,this.Nq.setAttribute("transform","translate(0, 34)"),this.Oq&&this.Oq.setAttribute("transform","translate(0, 77)")):(this.vl=a.Cb+a.Hc-this.Wv-this.oh,this.Nq.setAttribute("transform","translate(0, 43)"),this.xv.setAttribute("transform","translate(0, 77)")),this.H.setAttribute("transform","translate("+this.$m+","+this.vl+")"))}};
function rd(a,c){var d=a.s;a.xv=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoomoutClipPath"+c},a.xv);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.Ad.width,height:g.Ad.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+c+")"},a.xv);a.setAttributeNS(g.g.o.bf,"xlink:href",d.options.uf+g.Ad.url);g.ca(a,"mousedown",null,function(f){pa(d);md(d,-1);g.Touch.Bh();f.stopPropagation();f.preventDefault()})}
function sd(a,c){var d=a.s;a.Nq=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoominClipPath"+c},a.Nq);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.Ad.width,height:g.Ad.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+c+")"},a.Nq);a.setAttributeNS(g.g.o.bf,"xlink:href",d.options.uf+g.Ad.url);g.ca(a,"mousedown",null,function(f){pa(d);md(d,1);g.Touch.Bh();f.stopPropagation();f.preventDefault()})}
function td(a,c){var d=a.s;a.Oq=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoomresetClipPath"+c},a.Oq);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.Ad.width,height:g.Ad.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+c+")"},a.Oq);a.setAttributeNS(g.g.o.bf,"xlink:href",d.options.uf+g.Ad.url);g.ca(a,"mousedown",null,function(f){pa(d);d.setScale(d.options.Ib.oA);g.g.o.qb(d.jb,"blocklyCanvasTransitioning");g.g.o.qb(d.xf,"blocklyCanvasTransitioning");
if(d.Nc()){var h=d.jc(),k=(h.gf-h.ub)/2,l=(h.Od-h.Cb)/2;k=-k-h.Jc;l=-l-h.tc;d.scroll(k,l)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.");setTimeout(d.GE.bind(d),500);g.Touch.Bh();f.stopPropagation();f.preventDefault()})}
g.Vc.register([".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]);g.Jv=function(a){this.nm=a;this.Ja()};b=g.Jv.prototype;b.Xa=null;b.jf=null;b.nm=null;b.gi=1;b.Ln=null;b.Ja=function(){this.Xa||(this.Xa=g.g.o.K("svg",{xmlns:g.g.o.Vl,"xmlns:html":g.g.o.ak,"xmlns:xlink":g.g.o.bf,version:"1.1","class":"blocklyBlockDragSurface"},this.nm),this.jf=g.g.o.K("g",{},this.Xa))};function hb(a,c){if(a.jf.childNodes.length)throw Error("Already dragging a block.");a.jf.appendChild(c);a.Xa.style.display="block";a.Ln=new g.g.X(0,0)}
b.Mj=function(a,c){this.Ln=new g.g.X(a*this.gi,c*this.gi);a=this.Ln.x;c=this.Ln.y;a=a.toFixed(0);c=c.toFixed(0);this.Xa.style.display="block";g.g.o.Dn(this.Xa,"translate3d("+a+"px, "+c+"px, 0px)")};b.xt=function(){var a=g.g.Me(this.Xa);return new g.g.X(a.x/this.gi,a.y/this.gi)};b.cc=function(){return this.jf};
b.gp=function(a){a?a.appendChild(this.jf.firstChild):this.jf.removeChild(this.jf.firstChild);this.Xa.style.display="none";if(this.jf.childNodes.length)throw Error("Drag group was not cleared.");this.Ln=null};g.Ph=function(a,c){g.ND();"string"==typeof a&&(a=document.getElementById(a)||document.querySelector(a));if(!g.g.o.containsNode(document,a))throw Error("Error: container is not in current document.");c=new g.De(c||{});var d=document.createElement("div");d.className="injectionDiv";a.appendChild(d);a=g.pm(d,c);var e=new g.Jv(d);d=new g.Nw(d);d=g.cE(a,c,e,d);g.wb.sb.bH(c.sb);g.FF(d);g.cn=d;g.ol(d);return d};
g.pm=function(a,c){a.setAttribute("dir","LTR");g.Fc.Ex=c.G;g.Vc.Ph(c.vF,c.uf);a=g.g.o.K("svg",{xmlns:g.g.o.Vl,"xmlns:html":g.g.o.ak,"xmlns:xlink":g.g.o.bf,version:"1.1","class":"blocklySvg"},a);var d=g.g.o.K("defs",{},a),e=String(Math.random()).substring(2),f=g.g.o.K("filter",{id:"blocklyEmbossFilter"+e},d);g.g.o.K("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:1,result:"blur"},f);var h=g.g.o.K("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",
result:"specOut"},f);g.g.o.K("fePointLight",{x:-5E3,y:-1E4,z:2E4},h);g.g.o.K("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},f);g.g.o.K("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},f);c.Vx=f.id;f=g.g.o.K("pattern",{id:"blocklyDisabledPattern"+e,patternUnits:"userSpaceOnUse",width:10,height:10},d);g.g.o.K("rect",{width:10,height:10,fill:"#aaa"},f);g.g.o.K("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},f);c.Ng=f.id;
c.Ky=g.ui.Ja(e,c.Jy,d);return a};
g.cE=function(a,c,d,e){c.Sb=null;var f=new g.pb(c,d,e);f.scale=c.Ib.oA;a.appendChild(f.Ja("blocklyMainBackground"));!c.Ny&&c.Xk&&(d=hd(f,"svg"),g.g.o.ej(d,a));c.Ry&&fd(f);c.Ib&&c.Ib.controls&&gd(f);f.Zb.subscribe(a,"workspace","background-color");f.translate(0,0);g.cn=f;c.readOnly||f.Nc()||Ba(f,function(h){if(!f.lc()&&!f.Nc()&&-1!=g.i.WA.indexOf(h.type)){var k=Object.create(null),l=f.jc(),m=f.scale;k.G=f.G;k.gc=l.gc/m;k.pc=l.pc/m;k.CA=(l.gc+l.ub)/m;k.BA=(l.pc+l.Cb)/m;ld(f)?(l=lc(f),k.Jc=l.left,k.tc=
l.top,k.ux=l.right,k.sx=l.bottom):(k.Jc=l.Jc/m,k.tc=l.tc/m,k.ux=(l.Jc+l.gf)/m,k.sx=(l.tc+l.Od)/m);if(k.tc<k.pc||k.sx>k.BA||k.Jc<k.gc||k.ux>k.CA){l=null;h&&(l=g.i.cc(),g.i.aa(h.group));switch(h.type){case g.i.Al:case g.i.Fv:var n=x(f,h.Ic);n=db(n);break;case g.i.qo:case g.i.so:n=f.jp[h.Qf]||null}if(n){m=Xc(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var u=k.pc,v=k.BA-m.height;v=Math.max(u,v);u=g.g.dd.Ak(u,m.top,v)-m.top;v=k.gc;var w=k.CA-m.width;k.G?v=Math.min(w,v):w=Math.max(v,w);n.moveBy(g.g.dd.Ak(v,
m.left,w)-m.left,u)}h&&(h.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&g.i.aa(l))}}});g.ol(f);g.ba.Ja();g.D.Ja();g.J.Ja();return f};
g.FF=function(a){var c=a.options,d=r(a);g.ca(d.parentNode,"contextmenu",null,function(e){g.g.Yp(e)||e.preventDefault()});d=g.ca(window,"resize",null,function(){g.wc(!0);g.ol(a)});a.wq=d;g.Ph.AD();c.Xk&&(a.ta?a.ta.U(a):a.P&&(a.P.U(a),a.P.show(c.Xk.childNodes),a.P.yc.set(0)));d=g.La.xc;c.Ry&&(d=a.fd.U(d));c.Ib&&c.Ib.controls&&a.Tj.U(d);c.Pc&&c.Pc.scrollbars?(a.Xb=new g.pk(a),a.Xb.resize()):a.ji({x:.5,y:.5});c.xF&&g.Ph.QF(c.uf,a)};
g.Ph.AD=function(){g.AE||(g.ca(document,"scroll",null,function(){for(var a=g.Ob.getAll(),c=0,d;d=a[c];c++)d.Vn&&d.Vn()}),g.ca(document,"keydown",null,g.Bu),g.ld(document,"touchend",null,g.Yh),g.ld(document,"touchcancel",null,g.Yh),g.g.userAgent.ck&&g.ca(window,"orientationchange",document,function(){g.ol(g.Hb())}));g.AE=!0};
g.Ph.QF=function(a,c){function d(){for(;f.length;)g.Ua(f.pop());e.preload()}var e=c.Nf;e.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");e.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");e.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var f=[];f.push(g.ca(document,"mousemove",null,d,!0));f.push(g.ca(document,"touchstart",null,d,!0))};g.fe=function(a,c){this.AA=c||"";this.Zz=Object.create(null);if(a)for(a=a.split(","),c=0;c<a.length;c++)this.Zz[a[c]]=!0;this.reset()};g.fe.dr="DEVELOPER_VARIABLE";g.fe.prototype.reset=function(){this.Tf=Object.create(null);this.Dx=Object.create(null);this.Va=null};
function ud(a,c){var d=g.j.Jd;if(c==g.O.Fb){var e=a;d.Va?e=(e=d.Va.mf(e))?e.name:null:(console.log("Deprecated call to Blockly.Names.prototype.getName without defining a variable map. To fix, add the folowing code in your generator's init() function:\nBlockly.YourGeneratorName.variableDB_.setVariableMap(workspace.getVariableMap());"),e=null);e&&(a=e)}e=a.toLowerCase()+"_"+c;var f=c==g.O.Fb||c==g.fe.dr?d.AA:"";if(e in d.Tf)return f+d.Tf[e];a=vd(d,a,c);d.Tf[e]=a.substr(f.length);return a}
function vd(a,c,d){c?(c=encodeURI(c.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!="0123456789".indexOf(c[0])&&(c="my_"+c)):c=g.h.UNNAMED_KEY||"unnamed";for(var e="";a.Dx[c+e]||c+e in a.Zz;)e=e?e+1:2;c+=e;a.Dx[c]=!0;return(d==g.O.Fb||d==g.fe.dr?a.AA:"")+c}g.fe.Je=function(a,c){return a.toLowerCase()==c.toLowerCase()};g.Ka={};g.Ka.Fb=g.qw;g.Ka.xD=function(a){a=y(a,!1);for(var c=[],d=[],e=0;e<a.length;e++)if(a[e].Kh){var f=a[e].Kh();f&&(f[2]?c.push(f):d.push(f))}d.sort(g.Ka.Uz);c.sort(g.Ka.Uz);return[d,c]};g.Ka.Uz=function(a,c){return a[0].toLowerCase().localeCompare(c[0].toLowerCase())};g.Ka.LE=function(a,c){if(c.ec)return a;for(a=a||g.h.UNNAMED_KEY||"unnamed";!g.Ka.JF(a,c.v,c);){var d=a.match(/^(.*?)(\d+)$/);a=d?d[1]+(parseInt(d[2],10)+1):a+"2"}return a};g.Ka.JF=function(a,c,d){return!g.Ka.LF(a,c,d)};
g.Ka.LF=function(a,c,d){c=y(c,!1);for(var e=0;e<c.length;e++)if(c[e]!=d&&c[e].Kh){var f=c[e].Kh();if(g.fe.Je(f[0],a))return!0}return!1};g.Ka.Yz=function(a){a=a.trim();var c=g.Ka.LE(a,this.B),d=this.getValue();if(d!=a&&d!=c){a=y(this.B.v,!1);for(var e=0;e<a.length;e++)a[e].zn&&a[e].zn(d,c)}return c};
g.Ka.Xi=function(a){function c(h,k){for(var l=0;l<h.length;l++){var m=h[l][0],n=h[l][1],u=g.g.xml.createElement("block");u.setAttribute("type",k);u.setAttribute("gap",16);var v=g.g.xml.createElement("mutation");v.setAttribute("name",m);u.appendChild(v);for(m=0;m<n.length;m++){var w=g.g.xml.createElement("arg");w.setAttribute("name",n[m]);v.appendChild(w)}d.push(u)}}var d=[];if(g.N.procedures_defnoreturn){var e=g.g.xml.createElement("block");e.setAttribute("type","procedures_defnoreturn");e.setAttribute("gap",
16);var f=g.g.xml.createElement("field");f.setAttribute("name","NAME");f.appendChild(g.g.xml.createTextNode(g.h.PROCEDURES_DEFNORETURN_PROCEDURE));e.appendChild(f);d.push(e)}g.N.procedures_defreturn&&(e=g.g.xml.createElement("block"),e.setAttribute("type","procedures_defreturn"),e.setAttribute("gap",16),f=g.g.xml.createElement("field"),f.setAttribute("name","NAME"),f.appendChild(g.g.xml.createTextNode(g.h.PROCEDURES_DEFRETURN_PROCEDURE)),e.appendChild(f),d.push(e));g.N.procedures_ifreturn&&(e=g.g.xml.createElement("block"),
e.setAttribute("type","procedures_ifreturn"),e.setAttribute("gap",16),d.push(e));d.length&&d[d.length-1].setAttribute("gap",24);a=g.Ka.xD(a);c(a[0],"procedures_callnoreturn");c(a[1],"procedures_callreturn");return d};g.Ka.VE=function(a,c){var d=[];c=y(c,!1);for(var e=0;e<c.length;e++)if(c[e].ne){var f=c[e].ne();f&&g.fe.Je(f,a)&&d.push(c[e])}return d};
g.Ka.mn=function(a){var c=g.i.Rc,d=a.Kh()[0],e=a.Pa(!0);a=g.Ka.VE(d,a.v);d=0;for(var f;f=a[d];d++){var h=f.Pa();h=h&&g.R.Dd(h);f.kb(e);var k=f.Pa();k=k&&g.R.Dd(k);h!=k&&(g.i.Rc=!1,g.i.Oa(new g.i.qg(f,"mutation",null,h,k)),g.i.Rc=c)}};g.Ka.Im=function(a,c){c=A(c,!1);for(var d=0;d<c.length;d++)if(c[d].Kh){var e=c[d].Kh();if(e&&g.fe.Je(e[0],a))return c[d]}return null};g.$l=function(a,c,d,e){this.v=a;this.name=c;this.type=d||"";this.Qk=e||g.g.Qg();g.i.Oa(new g.i.Fe(this))};g.$l.prototype.wa=function(){return this.Qk};g.$l.mx=function(a,c){a=a.name.toLowerCase();c=c.name.toLowerCase();return a<c?-1:a==c?0:1};g.O={};g.O.Fb=g.Hw;g.O.Tw=function(a){var c=y(a,!1);a=Object.create(null);for(var d=0;d<c.length;d++){var e=c[d].Ug();if(e)for(var f=0;f<e.length;f++){var h=e[f],k=h.wa();k&&(a[k]=h)}}c=[];for(k in a)c.push(a[k]);return c};g.O.HL=function(){console.warn("Deprecated call to Blockly.Variables.allUsedVariables. Use Blockly.Variables.allUsedVarModels instead.\nIf this is a major issue please file a bug on GitHub.")};g.O.Av={};
g.O.vD=function(a){a=y(a,!1);for(var c=Object.create(null),d=0,e;e=a[d];d++){var f=e.TL;!f&&e.aF&&(f=e.aF,g.O.Av[e.type]||(console.warn("Function getDeveloperVars() deprecated. Use getDeveloperVariables() (block type '"+e.type+"')"),g.O.Av[e.type]=!0));if(f)for(e=f(),f=0;f<e.length;f++)c[e[f]]=!0}return Object.keys(c)};
g.O.Xi=function(a){var c=[],d=document.createElement("button");d.setAttribute("text","%{BKY_NEW_VARIABLE}");d.setAttribute("callbackKey","CREATE_VARIABLE");nd(a,function(e){g.O.xx(e.tb)});c.push(d);a=g.O.OE(a);return c=c.concat(a)};
g.O.OE=function(a){a=a.Mm("");var c=[];if(0<a.length){var d=a[a.length-1];if(g.N.variables_set){var e=g.g.xml.createElement("block");e.setAttribute("type","variables_set");e.setAttribute("gap",g.N.math_change?8:24);e.appendChild(g.O.Gm(d));c.push(e)}g.N.math_change&&(e=g.g.xml.createElement("block"),e.setAttribute("type","math_change"),e.setAttribute("gap",g.N.variables_get?20:8),e.appendChild(g.O.Gm(d)),d=g.R.lh('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),
e.appendChild(d),c.push(e));if(g.N.variables_get){a.sort(g.$l.mx);d=0;for(var f;f=a[d];d++)e=g.g.xml.createElement("block"),e.setAttribute("type","variables_get"),e.setAttribute("gap",8),e.appendChild(g.O.Gm(f)),c.push(e)}}return c};
g.O.ly=function(a){a=a.Rg();var c="";if(a.length)for(var d=1,e=0,f="ijkmnopqrstuvwxyzabcdefgh".charAt(e);!c;){for(var h=!1,k=0;k<a.length;k++)if(a[k].name.toLowerCase()==f){h=!0;break}h?(e++,25==e&&(e=0,d++),f="ijkmnopqrstuvwxyzabcdefgh".charAt(e),1<d&&(f+=d)):c=f}else c="i";return c};
g.O.xx=function(a,c,d){function e(h){g.O.Vz(g.h.NEW_VARIABLE_TITLE,h,function(k){if(k){var l=g.O.fG(k,a);if(l){var m=k.toLowerCase();if(l.type==f)var n=g.h.VARIABLE_ALREADY_EXISTS.replace("%1",m);else n=g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,n=n.replace("%1",m).replace("%2",l.type);g.alert(n,function(){e(k)})}else a.Pd(k,f),c&&c(k)}else c&&c(null)})}var f=d||"";e("")};g.O.Pd=g.O.xx;
g.O.uq=function(a,c){function d(e){var f=g.h.RENAME_VARIABLE_TITLE.replace("%1",c.name);g.O.Vz(f,e,function(h){if(h){var k=g.O.gG(h,c.type,a);k?(k=g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",h.toLowerCase()).replace("%2",k.type),g.alert(k,function(){d(h)})):a.ei(c.wa(),h)}})}d("")};g.O.Vz=function(a,c,d){g.prompt(a,c,function(e){e&&(e=e.replace(/[\s\xa0]+/g," ").trim(),e==g.h.RENAME_VARIABLE||e==g.h.NEW_VARIABLE)&&(e=null);d(e)})};
g.O.gG=function(a,c,d){d=d.Va.Rg();a=a.toLowerCase();for(var e=0,f;f=d[e];e++)if(f.name.toLowerCase()==a&&f.type!=c)return f;return null};g.O.fG=function(a,c){c=c.Va.Rg();a=a.toLowerCase();for(var d=0,e;e=c[d];d++)if(e.name.toLowerCase()==a)return e;return null};g.O.Gm=function(a){var c=g.g.xml.createElement("field");c.setAttribute("name","VAR");c.setAttribute("id",a.wa());c.setAttribute("variabletype",a.type);a=g.g.xml.createTextNode(a.name);c.appendChild(a);return c};
g.O.Ep=function(a,c,d,e){var f=g.O.ad(a,c,d,e);f||(f=g.O.eE(a,c,d,e));return f};g.O.ad=function(a,c,d,e){var f=a.bi;if(c){var h=a.mf(c);!h&&f&&(h=f.mf(c));if(h)return h}if(d){if(void 0==e)throw Error("Tried to look up a variable by name without a type");h=a.ad(d,e);!h&&f&&(h=f.ad(d,e))}return h};g.O.eE=function(a,c,d,e){var f=a.bi;d||(d=g.O.ly(a.qe?a.Jj:a));return f?f.Pd(d,e,c):a.Pd(d,e,c)};
g.O.ny=function(a,c){a=a.Rg();var d=[];if(c.length!=a.length)for(var e=0;e<a.length;e++){var f=a[e];-1==c.indexOf(f)&&d.push(f)}return d};g.VERSION="uncompiled";g.cn=null;g.selected=null;g.cursor=null;g.Qe=!1;g.zm=[];g.im=null;g.ip=null;g.zs=null;g.KL=null;g.rA=function(a){return{width:a.Yw,height:a.Ww}};g.iM=function(a){ic(a)};g.ol=function(a){for(;a.options.Sb;)a=a.options.Sb;var c=r(a),d=c.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.Yw!=e&&(c.setAttribute("width",e+"px"),c.Yw=e);c.Ww!=d&&(c.setAttribute("height",d+"px"),c.Ww=d);a.resize()}};
g.Bu=function(a){var c=g.cn;if(!(g.g.Yp(a)||c.ga&&!c.isVisible()))if(c.options.readOnly)g.navigation.Hz(a);else{var d=!1;if(a.keyCode==g.g.ya.er)g.wc(),g.navigation.dg(g.navigation.Pq);else{if(g.navigation.Hz(a))return;if(a.keyCode==g.g.ya.TA||a.keyCode==g.g.ya.Dl){a.preventDefault();if(g.$j.Jt())return;g.selected&&g.selected.pe()&&(d=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(g.$j.Jt())return;g.selected&&g.selected.pe()&&g.selected.Nc()&&(a.keyCode==g.g.ya.YA?(g.wc(),g.Ds(g.selected)):a.keyCode!=
g.g.ya.Ow||g.selected.v.qe||(g.Ds(g.selected),d=!0));a.keyCode==g.g.ya.gD?g.im&&(a=g.ip,a.qe&&(a=a.Jj),g.zs&&za(a,g.zs)&&(g.i.aa(!0),jd(a),g.i.aa(!1))):a.keyCode==g.g.ya.qD&&(g.wc(),c.uv(a.shiftKey))}}d&&!g.selected.v.qe&&(g.i.aa(!0),g.wc(),g.selected.I(!0,!0),g.i.aa(!1))}};g.Ds=function(a){if(a.ez)var c=a.ov();else{c=g.R.zh(a,!0);g.R.qE(c);var d=a.Ta();c.setAttribute("x",a.G?-d.x:d.x);c.setAttribute("y",d.y)}g.im=c;g.ip=a.v;g.zs=a.ez?null:g.g.nt(a,!0)};
g.Tx=function(a){var c=g.im,d=g.ip;g.Ds(a);jd(a.v);g.im=c;g.ip=d};g.gM=function(a){g.g.Yp(a)||a.preventDefault()};g.wc=function(a){g.J.Ga();g.ba.Ga();g.D.aj();a||(a=g.Hb(),a.fd&&a.fd.P&&a.fd.P.Ga(),a.ta&&a.ta.P&&a.ta.P.wk&&Bb(a.ta.Id,null))};g.Hb=function(){return g.cn};g.alert=function(a,c){alert(a);c&&c()};g.confirm=function(a,c){c(confirm(a))};g.prompt=function(a,c,d){d(prompt(a,c))};g.NF=function(a){return function(){zc(this,a)}};
g.Eh=function(a){for(var c=0;c<a.length;c++){var d=a[c];if(d){var e=d.type;null==e||""===e?console.warn("Block definition #"+c+" in JSON array is missing a type attribute. Skipping."):(g.N[e]&&console.warn("Block definition #"+c+' in JSON array overwrites prior definition of "'+e+'".'),g.N[e]={U:g.NF(d)})}else console.warn("Block definition #"+c+" in JSON array is "+d+". Skipping.")}};
g.ca=function(a,c,d,e,f,h){function k(w){var F=!f;w=g.Touch.gH(w);for(var ca=0,ha;ha=w[ca];ca++)if(!F||g.Touch.ev(ha))g.Touch.$G(ha),d?e.call(d,ha):e(ha),l=!0}var l=!1,m=[];if(g.g.global.PointerEvent&&c in g.Touch.Kf)for(var n=0,u;u=g.Touch.Kf[c][n];n++)a.addEventListener(u,k,!1),m.push([a,u,k]);else if(a.addEventListener(c,k,!1),m.push([a,c,k]),c in g.Touch.Kf){var v=function(w){k(w);var F=!h;l&&F&&w.preventDefault()};for(n=0;u=g.Touch.Kf[c][n];n++)a.addEventListener(u,v,!1),m.push([a,u,v])}return m};
g.ld=function(a,c,d,e){function f(n){d?e.call(d,n):e(n)}var h=[];if(g.g.global.PointerEvent&&c in g.Touch.Kf)for(var k=0,l;l=g.Touch.Kf[c][k];k++)a.addEventListener(l,f,!1),h.push([a,l,f]);else if(a.addEventListener(c,f,!1),h.push([a,c,f]),c in g.Touch.Kf){var m=function(n){if(n.changedTouches&&1==n.changedTouches.length){var u=n.changedTouches[0];n.clientX=u.clientX;n.clientY=u.clientY}f(n);n.preventDefault()};for(k=0;l=g.Touch.Kf[c][k];k++)a.addEventListener(l,m,!1),h.push([a,l,m])}return h};
g.Ua=function(a){for(;a.length;){var c=a.pop();c[0].removeEventListener(c[1],c[2],!1)}};g.Vh=function(a){return/^\s*-?\d+(\.\d+)?\s*$/.test(a)};g.Xy=function(a){return g.g.Ab.zF(a)};
g.ND=function(){g.md("LOGIC_HUE",["Blocks","logic","HUE"],void 0);g.md("LOGIC_HUE",["Constants","Logic","HUE"],210);g.md("LOOPS_HUE",["Blocks","loops","HUE"],void 0);g.md("LOOPS_HUE",["Constants","Loops","HUE"],120);g.md("MATH_HUE",["Blocks","math","HUE"],void 0);g.md("MATH_HUE",["Constants","Math","HUE"],230);g.md("TEXTS_HUE",["Blocks","texts","HUE"],void 0);g.md("TEXTS_HUE",["Constants","Text","HUE"],160);g.md("LISTS_HUE",["Blocks","lists","HUE"],void 0);g.md("LISTS_HUE",["Constants","Lists","HUE"],
260);g.md("COLOUR_HUE",["Blocks","colour","HUE"],void 0);g.md("COLOUR_HUE",["Constants","Colour","HUE"],20);g.md("VARIABLES_HUE",["Blocks","variables","HUE"],void 0);g.md("VARIABLES_HUE",["Constants","Variables","HUE"],330);g.md("VARIABLES_DYNAMIC_HUE",["Constants","VariablesDynamic","HUE"],310);g.md("PROCEDURES_HUE",["Blocks","procedures","HUE"],void 0)};
g.md=function(a,c,d){for(var e="Blockly",f=g,h=0;h<c.length;++h)e+="."+c[h],f&&(f=f[c[h]]);f&&f!==d&&(a=(void 0===d?'%1 has been removed. Use Blockly.Msg["%2"].':'%1 is deprecated and unused. Override Blockly.Msg["%2"].').replace("%1",e).replace("%2",a),console.warn(a))};var wd={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"},xd="ace ar fa he mzn ps ur".split(" "),yd=window.BlocklyGamesLang,zd=window.BlocklyGamesLanguages,Ad=".html"==window.location.pathname.substr(-5),H=null,M,Bd=Number,Cd,Dd=window.location.search.match(/[?&]level=([^&]+)/);Cd=Dd?decodeURIComponent(Dd[1].replace(/\+/g,"%20")):"NaN";var Ed=Bd(Cd);M=isNaN(Ed)?1:g.g.dd.Ak(1,Ed,10);
function Fd(){document.title=document.getElementById("title").textContent;document.dir=-1!=xd.indexOf(yd)?"rtl":"ltr";document.head.parentElement.setAttribute("lang",yd);var a=document.getElementById("languageMenu");if(a){for(var c=[],d=0;d<zd.length;d++){var e=zd[d];c.push([wd[e],e])}c.sort(function(h,k){return h[0]>k[0]?1:h[0]<k[0]?-1:0});for(d=a.options.length=0;d<c.length;d++){var f=c[d];e=f[1];f=new Option(f[0],e);e==yd&&(f.selected=!0);a.options.add(f)}1>=a.options.length&&(a.style.display=
"none")}for(d=1;10>=d;d++)a=document.getElementById("level"+d),c=!!Gd(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(Hd,1)}function Gd(a){var c=Id;try{var d=window.localStorage[c+a]}catch(e){}return d}function N(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 Jd(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(){if(!Ad){window.GoogleAnalyticsObject="GoogleAnalyticsFunction";var a=function(d){(a.q=a.q||[]).push(arguments)};window.GoogleAnalyticsFunction=a;a.l=1*new Date;var c=document.createElement("script");c.async=1;c.src="//www.google-analytics.com/analytics.js";document.head.appendChild(c);a("create","UA-50448074-1","auto");a("send","pageview")}};g.g.A={};g.g.A.Ya=function(a,c){return" "+a+","+c+" "};g.g.A.curve=function(a,c){return" "+a+c.join("")};g.g.A.moveTo=function(a,c){return" M "+a+","+c+" "};g.g.A.moveBy=function(a,c){return" m "+a+","+c+" "};g.g.A.lineTo=function(a,c){return" l "+a+","+c+" "};g.g.A.line=function(a){return" l"+a.join("")};g.g.A.ea=function(a,c){return" "+a+" "+c+" "};g.g.A.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};g.m.si=function(){this.Hf=0;this.OC=3;this.Gf=5;this.jw=8;this.yd=10;this.Dw=this.Gf;this.Pr=15;this.Wl=5;this.xh=8;this.vC=15;this.uC=4;this.rC=12;this.wB=16;this.Db=8;this.No=15;this.TC=0;this.UC=20;this.UA=4;this.RC=15;this.SC=100;this.QC=15;this.rr=24;this.yB=14.5;this.xB=this.Pr+11;this.AB=2;this.zB=this.rr;this.zw=g.g.A.moveBy(0,0);this.VB=12;this.WB=6};b=g.m.si.prototype;
b.U=function(){this.fk=this.$t();this.ik=this.au();this.Bg=this.cu();this.zi=this.bu();var a=this.Db,c=g.g.A.arc("a","0 0,0",a,g.g.A.Ya(-a,a)),d=g.g.A.arc("a","0 0,0",a,g.g.A.Ya(a,a));this.Ll={width:a,height:a,Iu:c,nq:d};c=this.Db;a=g.g.A.moveBy(0,c)+g.g.A.arc("a","0 0,1",c,g.g.A.Ya(c,-c));c=g.g.A.arc("a","0 0,1",c,g.g.A.Ya(-c,-c));this.nw={rv:a,rs:c}};b.$t=function(){var a=this.VB,c=this.WB,d=g.g.A.line([g.g.A.Ya(6,3),g.g.A.Ya(-12,6),g.g.A.Ya(6,3)]);return{height:a,width:c,path:d}};
b.cu=function(){var a=this.RC,c=this.SC,d=g.g.A.curve("c",[g.g.A.Ya(30,-a),g.g.A.Ya(70,-a),g.g.A.Ya(c,0)]);return{height:a,width:c,path:d}};b.bu=function(){function a(h){h=h?-1:1;var k=-h,l=d/2,m=g.g.A.Ya(c,h*l);return g.g.A.curve("c",[g.g.A.Ya(0,h*(l+2.5)),g.g.A.Ya(-c,k*(l+.5)),g.g.A.Ya(-c,h*l)])+g.g.A.curve("s",[g.g.A.Ya(c,2.5*k),m])}var c=this.xh,d=this.Pr,e=a(!0),f=a(!1);return{width:c,height:d,Te:f,qn:e}};
b.au=function(){function a(k){return g.g.A.line([g.g.A.Ya(k*e,d),g.g.A.Ya(3*k,0),g.g.A.Ya(k*e,-d)])}var c=this.vC,d=this.uC,e=(c-3)/2,f=a(1),h=a(-1);return{width:c,height:d,ai:f,Nz:h}};g.m.u={NONE:0,xe:1,Vv:2,Yv:4,Lr:8,Ev:16,bw:32,Tv:64,xg:128,$v:256,Aw:512,fB:1024,Dr:2048,wr:4096,zC:8192,$q:16384,mr:32768,lr:65536,Ir:131072,Hr:262144,fw:524288,So:1048576,Sr:2097152,Wq:4194304,aw:8388608};g.m.u.oJ=g.m.u.mr|g.m.u.lr;g.m.u.TK=g.m.u.Ir|g.m.u.Hr;g.m.u.qu=16777216;g.m.u.Rb=function(){g.m.u.hasOwnProperty(void 0)||(g.m.u[void 0]=g.m.u.qu,g.m.u.qu<<=1);return g.m.u[void 0]};g.m.u.Wm=function(a){return a.type&g.m.u.xe};g.m.u.hj=function(a){return a.type&g.m.u.Vv};
g.m.u.Tk=function(a){return a.type&g.m.u.Yv};g.m.u.sf=function(a){return a.type&g.m.u.Lr};g.m.u.YL=function(a){return a.type&g.m.u.bw};g.m.u.rf=function(a){return a.type&g.m.u.xg};g.m.u.Vm=function(a){return a.type&g.m.u.Tv};g.m.u.Rh=function(a){return a.type&g.m.u.$v};g.m.u.Zm=function(a){return a.type&g.m.u.Aw};g.m.u.Vk=function(a){return a.type&g.m.u.Dr};g.m.u.Uh=function(a){return a.type&g.m.u.wr};g.m.u.MF=function(a){return a.type&(g.m.u.Dr|g.m.u.wr)};g.m.u.Th=function(a){return a.type&g.m.u.lr};
g.m.u.$L=function(a){return a.type&g.m.u.Hr};g.m.u.Ym=function(a){return a.type&g.m.u.mr};g.m.u.aM=function(a){return a.type&g.m.u.Ir};g.m.u.XL=function(a){return a.type&g.m.u.$q};g.m.u.fz=function(a){return a.type&g.m.u.fw};g.m.u.bM=function(a){return a.type&g.m.u.So};g.m.u.WL=function(a){return a.type&g.m.u.Ev};g.m.u.$p=function(a){return a.type&g.m.u.Sr};g.m.u.Sp=function(a){return a.type&g.m.u.Wq};g.m.u.cM=function(a){return a.type&(g.m.u.Sr|g.m.u.Wq)};g.m.u.ZL=function(a){return a.type&g.m.u.aw};g.m.sh=function(a){this.height=this.width=0;this.type=g.m.u.NONE;this.Ah=this.Wa=0;this.C=a;this.Re=this.C.No};g.m.ua=function(a,c){g.m.ua.w.constructor.call(this,a);this.Cs=c;a:switch(a=this.C,c.type){case g.Ra:case g.Ze:c=a.zi;break a;case g.$e:case g.Sa:c=a.ik;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=g.m.u.fB};g.g.object.Y(g.m.ua,g.m.sh);g.m.Br=function(a,c){g.m.Br.w.constructor.call(this,a,c);this.type|=g.m.u.zC;this.height=this.shape.height;this.width=this.shape.width;this.Ie=this.C.Wl;this.ue=this.width};g.g.object.Y(g.m.Br,g.m.ua);
g.m.Er=function(a,c){g.m.Er.w.constructor.call(this,a,c);this.type|=g.m.u.Dr;this.height=this.shape.height;this.width=this.shape.width};g.g.object.Y(g.m.Er,g.m.ua);g.m.xr=function(a,c){g.m.xr.w.constructor.call(this,a,c);this.type|=g.m.u.wr;this.height=this.shape.height;this.width=this.shape.width};g.g.object.Y(g.m.xr,g.m.ua);g.m.Nl=function(a,c){g.m.Nl.w.constructor.call(this,a,c.connection);this.type|=g.m.u.xg;this.input=c;this.align=c.align;(this.Ni=c.connection&&C(c.connection)?C(c.connection):null)?(a=Ra(this.Ni),this.lm=a.width,this.kp=a.height):this.kp=this.lm=0;this.connection=c.connection;this.Ie=0};g.g.object.Y(g.m.Nl,g.m.ua);
g.m.qh=function(a,c){g.m.qh.w.constructor.call(this,a,c);this.type|=g.m.u.$v;this.Ni?(this.width=this.lm,this.height=this.kp):(this.height=this.C.xB,this.width=this.shape.width+this.C.yB);this.Ie=this.C.Wl;this.mm=this.shape.height;this.Dh=this.shape.width};g.g.object.Y(g.m.qh,g.m.Nl);g.m.wh=function(a,c){g.m.wh.w.constructor.call(this,a,c);this.type|=g.m.u.Aw;this.height=this.Ni?this.kp+this.C.TC:this.C.zB;this.width=this.C.No+this.shape.width};g.g.object.Y(g.m.wh,g.m.Nl);
g.m.Co=function(a,c){g.m.Co.w.constructor.call(this,a,c);this.type|=g.m.u.Tv;this.height=this.Ni?this.kp-2*this.C.Wl:this.shape.height;this.width=this.shape.width+this.C.AB;this.Ie=this.C.Wl;this.mm=this.shape.height;this.Dh=this.shape.width};g.g.object.Y(g.m.Co,g.m.Nl);g.m.Kd=function(a,c){g.m.Kd.w.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=g.m.u.Yv;a=new g.g.ge(g.Kd.prototype.Uo,g.Kd.prototype.Uo-2);this.height=a.height;this.width=a.width};g.g.object.Y(g.m.Kd,g.m.sh);g.m.jr=function(a){g.m.jr.w.constructor.call(this,a);this.type|=g.m.u.fw;this.height=this.C.fk.height;this.width=this.C.fk.width};g.g.object.Y(g.m.jr,g.m.sh);
g.m.pa=function(a,c){g.m.pa.w.constructor.call(this,a);this.Yx=c;this.pd=c.Ef&&!!c.B&&c.B.pd();this.NE=c.uy();this.type|=g.m.u.xe;a=this.Yx.Tg();this.height=a.height;this.width=a.width};g.g.object.Y(g.m.pa,g.m.sh);g.m.hr=function(a){g.m.hr.w.constructor.call(this,a);this.type|=g.m.u.Vv;this.height=this.C.Bg.height;this.width=this.C.Bg.width;this.vk=this.height};g.g.object.Y(g.m.hr,g.m.sh);
g.m.Xo=function(a,c){g.m.Xo.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.m.u.Ir:g.m.u.mr)|g.m.u.$q;this.width=this.height=this.C.Hf};g.g.object.Y(g.m.Xo,g.m.sh);g.m.To=function(a,c){g.m.To.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.m.u.Hr:g.m.u.lr)|g.m.u.$q;this.width=this.C.Db;this.height=this.C.Db/2};g.g.object.Y(g.m.To,g.m.sh);g.m.dk=function(a,c){g.m.dk.w.constructor.call(this,a);this.type=this.type|g.m.u.Lr|g.m.u.bw;this.width=c;this.height=this.C.QC};g.g.object.Y(g.m.dk,g.m.sh);g.m.Bi=function(a){this.type=g.m.u.So;this.elements=[];this.Wa=this.Uc=this.og=this.minWidth=this.minHeight=this.width=this.height=0;this.Py=this.Lp=this.Et=this.Ed=this.Zi=!1;this.C=a;this.Re=this.C.No};g.m.Bi.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function Kd(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.m.u.rf(d))return d;return null}g.m.Bi.prototype.jv=function(){return!0};g.m.Bi.prototype.Wx=function(){return!0};
function Ld(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.m.u.sf(d))return d;return null}g.m.qk=function(a){g.m.qk.w.constructor.call(this,a);this.type|=g.m.u.Sr;this.vk=this.Hg=0;this.wF=!1;this.connection=null};g.g.object.Y(g.m.qk,g.m.Bi);g.m.qk.prototype.Ft=function(a){var c=a.Vg?"cap"===a.Vg:g.xa.Bg,d=a.$&&C(a.$);return!!a.L||c||(d?q(d)==a:!1)};
g.m.qk.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.m.u.sf(f)||(g.m.u.hj(f)?d=Math.max(d,f.vk):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.Hg=this.vk=d;this.og=this.width};g.m.qk.prototype.jv=function(){return!1};g.m.Uj=function(a){g.m.Uj.w.constructor.call(this,a);this.type|=g.m.u.Wq;this.Qy=!1;this.connection=null;this.Ki=this.wm=0};g.g.object.Y(g.m.Uj,g.m.Bi);
g.m.Uj.prototype.Ft=function(a){return!!a.L||!!q(a)};g.m.Uj.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.m.u.sf(f)||(g.m.u.Uh(f)?d=Math.max(d,f.height):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.wm=d;this.og=this.width};g.m.Uj.prototype.jv=function(){return!1};
g.m.Wo=function(a,c,d){g.m.Wo.w.constructor.call(this,a);this.type=this.type|g.m.u.Lr|g.m.u.Ev;this.width=d;this.height=c;this.jy=!1;this.og=0;this.elements=[new g.m.dk(this.C,d)]};g.g.object.Y(g.m.Wo,g.m.Bi);g.m.Wo.prototype.measure=function(){};g.m.ek=function(a){g.m.ek.w.constructor.call(this,a);this.type|=g.m.u.aw;this.px=0};g.g.object.Y(g.m.ek,g.m.Bi);
g.m.ek.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,c=0,d;d=this.elements[c];c++)this.width+=d.width,g.m.u.rf(d)&&(g.m.u.Zm(d)?a+=d.lm:g.m.u.Vm(d)&&0!=d.lm&&(a+=d.lm-d.Dh)),g.m.u.sf(d)||(this.height=Math.max(this.height,d.height));this.px=a;this.og=this.width+a};g.m.ek.prototype.Wx=function(){return!this.Zi&&!this.Ed};g.m.uh=function(a,c){this.T=c;this.eh=a;this.C=this.eh.C;this.L=c.L?new g.m.Br(this.C,c.L):null;this.Ot=qc(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.Sh=c.Sh();this.G=c.G;this.Gj=this.width=this.wl=this.height=0;this.rows=[];this.Uy=[];this.oc=new g.m.qk(this.C);this.Pb=new g.m.Uj(this.C);this.Bq=this.ue=0};b=g.m.uh.prototype;
b.measure=function(){var a=this.T.Vg?"cap"===this.T.Vg:g.xa.Bg,c=!!this.T.$;this.oc.Ft(this.T)?this.oc.elements.push(new g.m.Xo(this.C)):this.oc.elements.push(new g.m.To(this.C));a?(a=new g.m.hr(this.C),this.oc.elements.push(a),this.oc.Hg=a.vk):c&&(this.oc.wF=!0,this.oc.connection=new g.m.Er(this.C,this.T.$),this.oc.elements.push(this.oc.connection));this.T.S.length&&this.T.S[0].type==g.Sa&&!this.T.isCollapsed()?this.oc.minHeight=this.C.yd:this.oc.minHeight=this.C.Gf;this.rows.push(this.oc);a=new g.m.ek(this.C);
var d=Wa(this.T);if(d.length){c=0;for(var e;e=d[c];c++){var f=new g.m.Kd(this.C,e);this.isCollapsed&&e.jx?this.Uy.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.T.S[c];c++)if(d.isVisible()){!e||d.type!=g.Sa&&e.type!=g.Sa&&(d.type!=g.Ra&&d.type!=g.vg||this.Ot)||(this.rows.push(a),a=new g.m.ek(this.C));for(e=0;f=d.Na[e];e++)a.elements.push(new g.m.pa(this.C,f,d));this.Sw(d,a);e=d}this.isCollapsed&&(a.Py=!0,a.elements.push(new g.m.jr(this.C)));(a.elements.length||a.Lp)&&this.rows.push(a);this.Pb.Qy=
!!this.T.V;this.Pb.minHeight=this.T.S.length&&this.T.S[this.T.S.length-1].type==g.Sa?this.C.yd:this.C.Gf-1;this.Pb.Ft(this.T)?this.Pb.elements.push(new g.m.Xo(this.C)):this.Pb.elements.push(new g.m.To(this.C));this.Pb.Qy&&(this.Pb.connection=new g.m.xr(this.C,this.T.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.jv()&&c.elements.push(new g.m.dk(this.C,this.Cp(null,d[0])));for(e=0;e<d.length-1;e++)c.elements.push(d[e]),
c.elements.push(new g.m.dk(this.C,this.Cp(d[e],d[e+1])));c.elements.push(d[d.length-1]);c.Wx()&&c.elements.push(new g.m.dk(this.C,this.Cp(d[d.length-1],null)))}for(e=d=c=a=0;f=this.rows[e];e++)f.measure(),c=Math.max(c,f.width),f.Ed&&(a=Math.max(a,f.width-Kd(f).width)),d=Math.max(d,f.og);this.Gj=a;this.width=c;for(e=0;f=this.rows[e];e++)f.Ed&&(f.Gj=this.Gj);this.wl=Math.max(c,d);this.L&&(this.ue=this.L.width,this.width+=this.L.width,this.wl+=this.L.width);for(a=0;c=this.rows[a];a++)c.Ed?(d=Kd(c),e=
c.width-d.width,f=this.Gj-this.ue,(e=f-e)&&this.$r(c,e),e=c.width,f=this.width-this.ue-(this.C.Ll.jM||0),d.width+=f-e,c.width+=f-e,c.og=Math.max(c.width,this.Gj+c.px)):(d=this.width-this.ue-c.width)&&this.$r(c,d);a=this.rows;this.rows=[];for(c=0;c<a.length;c++)this.rows.push(a[c]),c!=a.length-1&&this.rows.push(Md(this,a[c],a[c+1]));this.Zx()};
b.Sw=function(a,c){this.Ot&&a.type==g.Ra?(c.elements.push(new g.m.qh(this.C,a)),c.Et=!0):a.type==g.Sa?(c.elements.push(new g.m.wh(this.C,a)),c.Ed=!0):a.type==g.Ra?(c.elements.push(new g.m.Co(this.C,a)),c.Zi=!0):a.type==g.vg&&(c.Lp=!0)};b.Cp=function(a,c){if(a&&g.m.u.rf(a)&&!c){if(g.m.u.Vm(a))return this.C.Hf;if(g.m.u.Rh(a))return this.C.yd;if(g.m.u.Zm(a))return this.C.Hf}return a&&g.m.u.Ym(a)&&c&&(g.m.u.Vk(c)||g.m.u.Uh(c))?c.Re:a&&g.m.u.Th(a)&&c&&(g.m.u.Vk(c)||g.m.u.Uh(c))?c.Re-this.C.Db:this.C.Gf};
b.$r=function(a,c){var d=Ld(a);d&&(d.width+=c,a.width+=c)};function Md(a,c,d){a=new g.m.Wo(a.C,a.Cy(c,d),a.width-a.ue);c.Ed&&(a.jy=!0);return a}b.Cy=function(){return this.C.Gf};b.ty=function(a,c){return g.m.u.sf(c)?a.Uc+c.height/2:g.m.u.Sp(a)?(a=a.Uc+a.height-a.wm,g.m.u.Uh(c)?a+c.height/2:a-c.height/2):g.m.u.$p(a)?g.m.u.hj(c)?a.Hg-c.height/2:a.Hg+c.height/2:a.Uc+a.height/2};
function Nd(a,c){for(var d=c.Wa,e=0,f;f=c.elements[e];e++)g.m.u.sf(f)&&(f.height=c.height),f.Wa=d,f.Ah=a.ty(c,f),d+=f.width}b.Zx=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++)e.Uc=c,e.Wa=this.ue,c+=e.height,a=Math.max(a,e.og),Nd(this,e);this.wl=a+this.ue;this.height=c;this.Bq=this.oc.Hg;this.Pb.Ki=c-this.Pb.wm};g.m.kd=function(a,c){this.T=a;this.ra=c;a.Ta();this.Rp=this.Qa="";this.C=c.eh.C};b=g.m.kd.prototype;b.draw=function(){Od(this);Pd(this);Qd(this);this.T.uj.$u(this.Qa+"\n"+this.Rp);this.ra.G&&this.T.uj.ht();g.m.Xn&&this.T.Qu.EE(this.T,this.ra);Rd(this)};function Rd(a){a.T.height=a.ra.height;a.T.width=a.ra.wl}function Od(a){for(var c=0,d;d=a.ra.Uy[c];c++)d.icon.Sd.setAttribute("display","none")}
function Pd(a){a.at();for(var c=1;c<a.ra.rows.length-1;c++){var d=a.ra.rows[c];d.Py?a.Am(d):d.Ed?a.$s(d):d.Zi?a.bt(d):a.Zs(d)}a.Vs();a.Ys()}b.at=function(){var a=this.ra.oc,c=a.elements,d=this.ra.oc;if(d.connection){var e=d.Wa+d.Re;Rc(d.connection.Cs,this.ra.G?-e:e,0)}this.Qa+=g.g.A.moveBy(a.Wa,this.ra.Bq);for(d=0;e=c[d];d++)g.m.u.Th(e)?this.Qa+=this.C.nw.rv:g.m.u.Vk(e)?this.Qa+=e.shape.ai:g.m.u.hj(e)?this.Qa+=this.C.Bg.path:g.m.u.sf(e)&&(this.Qa+=g.g.A.ea("h",e.width));this.Qa+=g.g.A.ea("v",a.height)};
b.Am=function(a){this.Qa+=this.C.fk.path+g.g.A.ea("v",a.height-this.C.fk.height)};b.bt=function(a){var c=Kd(a);this.Pz(a);var d="function"==typeof c.shape.Te?c.shape.Te(c.height):c.shape.Te;this.Qa+=g.g.A.ea("H",c.Wa+c.width)+d+g.g.A.ea("v",a.height-c.mm)};b.$s=function(a){var c=Kd(a);this.Qa+=g.g.A.ea("H",c.Wa+c.Re+c.shape.width)+(c.shape.Nz+g.g.A.ea("h",-(c.Re-this.C.Ll.width))+this.C.Ll.Iu)+g.g.A.ea("v",a.height-2*this.C.Ll.height)+this.C.Ll.nq+g.g.A.ea("H",a.Wa+a.width);this.Sz(a)};
b.Zs=function(a){this.Qa+=g.g.A.ea("V",a.Uc+a.height)};b.Vs=function(){var a=this.ra.Pb,c=a.elements;this.Rz();this.Qa+=g.g.A.ea("V",a.Ki);for(var d=c.length-1,e;e=c[d];d--)g.m.u.Uh(e)?this.Qa+=e.shape.Nz:g.m.u.Ym(e)?this.Qa+=g.g.A.ea("H",a.Wa):g.m.u.Th(e)?this.Qa+=this.C.nw.rs:g.m.u.sf(e)&&(this.Qa+=g.g.A.ea("h",-1*e.width))};
b.Ys=function(){var a=this.ra.L;if(this.ra.L){var c=this.ra.ue;Rc(this.T.L,this.ra.G?-c:c,this.ra.L.Ie)}a&&(c=a.Ie+a.height,a="function"==typeof a.shape.qn?a.shape.qn(a.height):a.shape.qn,this.Qa+=g.g.A.ea("V",c)+a);this.Qa+="z"};
function Qd(a){for(var c=0,d;d=a.ra.rows[c];c++)for(var e=0,f;f=d.elements[e];e++)if(g.m.u.Rh(f))a.Xs(f);else if(g.m.u.Tk(f)||g.m.u.Wm(f)){var h=a;if(g.m.u.Wm(f))var k=f.Yx.za();else g.m.u.Tk(f)&&(k=f.icon.Sd);var l=f.Ah-f.height/2,m=f.Wa,n="";h.ra.G&&(m=-(m+f.width),f.NE&&(m+=f.width,n="scale(-1 1)"));g.m.u.Tk(f)?(k.setAttribute("display","block"),k.setAttribute("transform","translate("+m+","+l+")"),La(f.icon)):k.setAttribute("transform","translate("+m+","+l+")"+n);h.ra.Sh&&k.setAttribute("display",
"none")}}b.Xs=function(a){var c=a.width,d=a.height,e=a.Ie,f=a.mm+e;this.Rp+=g.g.A.moveTo(a.Wa+a.Dh,a.Ah-d/2)+g.g.A.ea("v",e)+a.shape.Te+g.g.A.ea("v",d-f)+g.g.A.ea("h",c-a.Dh)+g.g.A.ea("v",-d)+"z";this.Qz(a)};b.Qz=function(a){var c=a.Ah-a.height/2;if(a.connection){var d=a.Wa+a.Dh;this.ra.G&&(d*=-1);Rc(a.connection,d,c+a.Ie)}};b.Sz=function(a){var c=Kd(a);if(c.connection){var d=a.Wa+a.Gj+c.Re;this.ra.G&&(d*=-1);Rc(c.connection,d,a.Uc)}};
b.Pz=function(a){var c=Kd(a);if(c.connection){var d=a.Wa+a.width;this.ra.G&&(d*=-1);Rc(c.connection,d,a.Uc)}};b.Rz=function(){var a=this.ra.Pb;if(a.connection){a=a.connection;var c=a.Wa;Rc(a.Cs,this.ra.G?-c:c,a.Ah-a.height/2)}};g.Ba=function(a,c){this.s=a;this.Wp=c;this.Vd=null;this.C=a.eh.C};g.Ba.xo=5;g.Ba.Vj=100;g.Ba.LJ=24;g.Ba.zL=5;g.Ba.Vo=10;g.Ba.Gv=2;g.Ba.LB=.75;g.Ba.wo="#cc0a0a";g.Ba.mC="#4286f4";g.Ba.kB="blocklyCursor";g.Ba.lC="blocklyMarker";b=g.Ba.prototype;b.um=null;b.za=function(){return this.H};
b.Ja=function(){this.H=g.g.o.K("g",{"class":this.Wp?g.Ba.lC:g.Ba.kB},null);var a=this.Wp?g.Ba.mC:g.Ba.wo;this.$c=g.g.o.K("g",{width:g.Ba.Vj,height:g.Ba.xo},this.H);this.Dk=g.g.o.K("rect",{x:"0",y:"0",fill:a,width:g.Ba.Vj,height:g.Ba.xo,style:"display: none;"},this.$c);this.Ek=g.g.o.K("rect",{"class":"blocklyVerticalCursor",x:"0",y:"0",rx:"10",ry:"10",style:"display: none;",stroke:a},this.$c);this.vm=g.g.o.K("path",{width:g.Ba.Vj,height:g.Ba.xo,transform:"",style:"display: none;",fill:a},this.$c);
this.Si=g.g.o.K("path",{width:g.Ba.Vj,height:g.Ba.xo,transform:"",style:"display: none;",fill:"none",stroke:a,"stroke-width":"4"},this.$c);this.Wp||(g.g.o.K("animate",{attributeType:"XML",attributeName:"fill",dur:"1s",values:g.Ba.wo+";transparent;transparent;",repeatCount:"indefinite"},this.Dk),g.g.o.K("animate",{attributeType:"XML",attributeName:"fill",dur:"1s",values:g.Ba.wo+";transparent;transparent;",repeatCount:"indefinite"},this.vm),g.g.o.K("animate",{attributeType:"XML",attributeName:"stroke",
dur:"1s",values:g.Ba.wo+";transparent;transparent;",repeatCount:"indefinite"},this.Si));return this.H};function Sd(a,c){a.Wp?(a.Vd&&a.Vd.Fn(null),c.Fn(a.za())):(a.Vd&&a.Vd.En(null),c.En(a.za()));a.Vd=c}
function Td(a,c){if(c){var d=c.width,e=c.height,f=e*g.Ba.LB;c.$?(e=g.Ba.Gv,d=g.g.A.moveBy(-1*e,f)+g.g.A.ea("V",-1*e)+g.g.A.ea("H",a.C.No)+a.C.ik.ai+g.g.A.ea("H",d+2*e)+g.g.A.ea("V",f),a.Si.setAttribute("d",d)):c.L?(d=g.g.A.moveBy(d,0)+g.g.A.ea("h",-1*(d-a.C.zi.width))+g.g.A.ea("v",a.C.Wl)+a.C.zi.Te+g.g.A.ea("V",e)+g.g.A.ea("H",d),a.Si.setAttribute("d",d)):(e=g.Ba.Gv,d=g.g.A.moveBy(-1*e,f)+g.g.A.ea("V",-1*e)+g.g.A.ea("H",d+2*e)+g.g.A.ea("V",f),a.Si.setAttribute("d",d));a.s.G&&a.Dm(a.Si);a.um=a.Si;
Sd(a,c);Ud(a)}}function Ud(a){a.Ga();a.um.style.display=""}function Vd(a,c,d,e){a.Dk.setAttribute("x",c);a.Dk.setAttribute("y",d);a.Dk.setAttribute("width",e);a.um=a.Dk}function Wd(a,c,d,e,f){a.Ek.setAttribute("x",c);a.Ek.setAttribute("y",d);a.Ek.setAttribute("width",e);a.Ek.setAttribute("height",f);a.um=a.Ek}b.Dm=function(a){a.setAttribute("transform","scale(-1 1)")};b.Ga=function(){this.Dk.style.display="none";this.Ek.style.display="none";this.vm.style.display="none";this.Si.style.display="none"};
b.draw=function(a){if(a)if(a.Rb()===g.F.types.ae)Td(this,a.sa);else if(a.Rb()===g.F.types.mk)Td(this,a.sa.B);else if(a.sa.type===g.Ra){var c=a.sa;a=c.B;var d=c.rj.x;c=c.rj.y;var e=g.g.A.moveTo(0,0)+this.C.zi.Te;this.vm.setAttribute("d",e);this.vm.setAttribute("transform","translate("+d+","+c+")"+(this.s.G?" scale(-1 1)":""));this.um=this.vm;Sd(this,a);Ud(this)}else if(a.sa.type===g.Sa)c=a.sa,a=c.B,d=0,c=c.rj.y,e=Ra(a).width,this.s.G&&(d=-e),Vd(this,d,c,e),Sd(this,a),Ud(this);else if(a.Rb()===g.F.types.Ee)Td(this,
a.sa.B);else if(a.Rb()===g.F.types.xe)a=a.sa,d=a.Tg().width,c=a.Tg().height,Wd(this,0,0,d,c),Sd(this,a),Ud(this);else if(a.Rb()===g.F.types.Ji)d=a.HA,a=d.x,d=d.y,this.s.G&&(a-=g.Ba.Vj),Vd(this,a,d,g.Ba.Vj),Sd(this,this.s),Ud(this);else{if(a.Rb()===g.F.types.Jf){a=a.sa;c=Ra(a);d=c.width+g.Ba.Vo;c=c.height+g.Ba.Vo;var f=e=-1*g.Ba.Vo/2,h=-1*g.Ba.Vo/2;this.s.G&&(f=-(d+e));Wd(this,f,h,d,c);Sd(this,a);Ud(this)}}else this.Ga()};b.I=function(){this.H&&g.g.o.removeNode(this.H)};g.m.vh=function(){this.C=null};b=g.m.vh.prototype;b.U=function(){this.C=this.oz();this.C.U()};b.oz=function(){return new g.m.si};b.rz=function(a){return new g.m.uh(this,a)};b.pz=function(a,c){return new g.m.kd(a,c)};b.qz=function(a){return new g.m.Ai(a)};b.Da=function(a){if(g.m.Xn&&!a.Qu){if(!g.m.vB)throw Error("Missing require for Blockly.blockRendering.Debug");var c=new g.m.vB;a.Qu=c}c=this.rz(a);c.measure();this.pz(a,c).draw()};g.ma={};g.ma.si=function(){g.ma.si.w.constructor.call(this);this.wd=1};g.g.object.Y(g.ma.si,g.m.si);g.ma.Xv=function(a){this.ra=a;this.Rm=this.la="";this.Xc=this.ra.G;a=a.eh;this.C=a.C;this.nf=a.nf;this.Fd=this.nf.jk;this.Fu=this.nf.AC;this.Rk=this.nf.SB;this.un=this.nf.zi;this.kG=this.nf.ik;this.jH=this.nf.Bg;this.hz=this.nf.fk};g.ma.Xv.prototype.Am=function(a){this.ra.G&&(this.la+=g.g.A.ea("H",a.width-this.Fd),this.la+=this.hz.ai,this.la+=g.g.A.ea("v",a.height-this.hz.height-this.Fd))};
function Xd(a,c){var d=c.Wa+c.width-a.Fd;c.jy&&(a.la+=g.g.A.ea("H",d));a.Xc&&(a.la+=g.g.A.ea("H",d),c.height>a.Fd&&(a.la+=g.g.A.ea("V",c.Uc+c.height-a.Fd)))};g.ma.Ai=function(a){this.Ij=a;this.Nn=g.g.o.K("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Ij);this.ml=g.g.o.K("path",{"class":"blocklyPath"},this.Ij);this.Pn=g.g.o.K("path",{"class":"blocklyPathLight"},this.Ij)};g.ma.Ai.prototype.$u=function(a,c){this.ml.setAttribute("d",a);this.Nn.setAttribute("d",a);this.Pn.setAttribute("d",c)};
g.ma.Ai.prototype.ht=function(){this.ml.setAttribute("transform","scale(-1 1)");this.Pn.setAttribute("transform","scale(-1 1)");this.Nn.setAttribute("transform","translate(1,1) scale(-1 1)")};g.ma.qh=function(a,c){g.ma.qh.w.constructor.call(this,a,c);this.Ni&&(this.width+=this.C.wd,this.height+=this.C.wd)};g.g.object.Y(g.ma.qh,g.m.qh);g.ma.wh=function(a,c){g.ma.wh.w.constructor.call(this,a,c);this.Ni&&(this.height+=this.C.wd)};g.g.object.Y(g.ma.wh,g.m.wh);g.ma.uh=function(a,c){g.ma.uh.w.constructor.call(this,a,c)};g.g.object.Y(g.ma.uh,g.m.uh);b=g.ma.uh.prototype;b.Sw=function(a,c){this.Ot&&a.type==g.Ra?(c.elements.push(new g.ma.qh(this.C,a)),c.Et=!0):a.type==g.Sa?(c.elements.push(new g.ma.wh(this.C,a)),c.Ed=!0):a.type==g.Ra?(c.elements.push(new g.m.Co(this.C,a)),c.Zi=!0):a.type==g.vg&&(c.Lp=!0)};
b.Cp=function(a,c){if(!a)return c&&g.m.u.Wm(c)&&c.pd?this.C.Gf:c&&g.m.u.Rh(c)?this.C.jw:c&&g.m.u.Zm(c)?this.C.UC:this.C.yd;if(!g.m.u.rf(a)&&!c)return g.m.u.Wm(a)&&a.pd?this.C.Gf:g.m.u.Tk(a)?2*this.C.yd+1:g.m.u.hj(a)?this.C.Hf:g.m.u.MF(a)?this.C.yd:g.m.u.Th(a)?this.C.rC:g.m.u.fz(a)?this.C.Hf:this.C.yd;if(g.m.u.rf(a)&&!c){if(g.m.u.Vm(a))return this.C.Hf;if(g.m.u.Rh(a))return this.C.yd;if(g.m.u.Zm(a))return this.C.Hf}if(!g.m.u.rf(a)&&c&&g.m.u.rf(c)){if(a.pd){if(g.m.u.Rh(c)||g.m.u.Vm(c))return this.C.OC}else{if(g.m.u.Rh(c)||
g.m.u.Vm(c))return this.C.jw;if(g.m.u.Zm(c))return this.C.yd}return this.C.yd-1}if(g.m.u.Tk(a)&&c&&!g.m.u.rf(c))return this.C.yd;if(g.m.u.Rh(a)&&c&&!g.m.u.rf(c))return c.pd?this.C.Gf:this.C.yd;if(g.m.u.Ym(a)&&c){if(g.m.u.hj(c))return this.C.Hf;if(g.m.u.Vk(c))return c.Re;if(g.m.u.Uh(c))return a=(this.G?1:-1)*this.C.wd/2,c.Re+a}if(g.m.u.Th(a)&&c){if(g.m.u.Vk(c))return c.Re-this.C.Db;if(g.m.u.Uh(c))return a=(this.G?1:-1)*this.C.wd/2,c.Re-this.C.Db+a}return!g.m.u.rf(a)&&c&&!g.m.u.rf(c)&&a.pd==c.pd||c&&
g.m.u.fz(c)?this.C.yd:this.C.Gf};b.$r=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(g.m.u.sf(e)){d=e;break a}d=null}e=Ld(a);if(a.Zi||a.Ed)a.og+=c;var f=Kd(a);f?f.align==g.Tq?e.width+=c:f.align==g.zv?(d.width+=c/2,e.width+=c/2):f.align==g.co&&(d.width+=c):e.width+=c;a.width+=c};b.Cy=function(a,c){return g.m.u.$p(a)&&g.m.u.Sp(c)?this.C.wB:g.m.u.$p(a)||g.m.u.Sp(c)?this.C.Hf:a.Zi&&c.Zi?this.C.yd:!a.Ed&&c.Ed?this.C.UA:a.Ed&&c.Ed||!a.Ed&&c.Lp?this.C.yd:this.C.Gf};
b.ty=function(a,c){if(g.m.u.sf(c))return a.Uc+c.height/2;if(g.m.u.Sp(a))return a=a.Uc+a.height-a.wm,g.m.u.Uh(c)?a+c.height/2:a-c.height/2;if(g.m.u.$p(a))return g.m.u.hj(c)?a.Hg-c.height/2:a.Hg+c.height/2;var d=a.Uc;g.m.u.Wm(c)||g.m.u.Tk(c)?(d+=c.height/2,(a.Et||a.Ed)&&c.height+this.C.Dw<=a.height&&(d+=this.C.Dw)):d=g.m.u.Rh(c)?d+c.height/2:d+a.height/2;return d};
b.Zx=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.Uc=c;e.Wa=this.ue;c+=e.height;a=Math.max(a,e.og);var f=c-this.oc.vk;e==this.Pb&&f<this.C.rr&&(f=this.C.rr-f,this.Pb.height+=f,c+=f);Nd(this,e)}this.Pb.Ki=c-this.Pb.wm;this.wl=a+this.ue+this.C.wd;this.width+=this.C.wd;this.height=c+this.C.wd;this.Bq=this.oc.Hg};g.ma.kd=function(a,c){g.ma.kd.w.constructor.call(this,a,c);this.$f=new g.ma.Xv(c)};g.g.object.Y(g.ma.kd,g.m.kd);b=g.ma.kd.prototype;b.draw=function(){Od(this);Pd(this);Qd(this);var a=this.$f;this.T.uj.$u(this.Qa+"\n"+this.Rp,a.la+"\n"+a.Rm);this.ra.G&&this.T.uj.ht();g.m.Xn&&this.T.Qu.EE(this.T,this.ra);Rd(this)};
b.at=function(){var a=this.$f,c=this.ra.oc;a.la+=g.g.A.moveBy(c.Wa,a.ra.Bq);for(var d=0,e;e=c.elements[d];d++)g.m.u.Ym(e)?a.la+=a.nf.zw:g.m.u.Th(e)?a.la+=a.Fu.rv(a.Xc):g.m.u.Vk(e)?a.la+=a.kG.ai:g.m.u.hj(e)?a.la+=a.jH.path(a.Xc):g.m.u.sf(e)&&0!=e.width&&(a.la+=g.g.A.ea("H",e.Wa+e.width-a.Fd));a.la+=g.g.A.ea("H",c.Wa+c.width-a.Fd);Xd(this.$f,this.ra.oc);g.ma.kd.w.at.call(this)};b.Am=function(a){this.$f.Am(a);g.ma.kd.w.Am.call(this,a)};
b.bt=function(a){var c=this.$f,d=Kd(a);if(c.Xc){var e=a.height-d.mm;c.la+=g.g.A.moveTo(d.Wa+d.width-c.Fd,a.Uc)+c.un.Te(c.Xc)+g.g.A.ea("v",e)}else c.la+=g.g.A.moveTo(d.Wa+d.width,a.Uc)+c.un.Te(c.Xc);g.ma.kd.w.bt.call(this,a)};
b.$s=function(a){var c=this.$f,d=Kd(a);if(c.Xc){var e=a.height-2*c.Rk.height;c.la+=g.g.A.moveTo(d.Wa,a.Uc)+c.Rk.Iu(c.Xc)+g.g.A.ea("v",e)+c.Rk.nq(c.Xc)+g.g.A.lineTo(a.width-d.Wa-c.Rk.width,0)}else c.la+=g.g.A.moveTo(d.Wa,a.Uc+a.height)+c.Rk.nq(c.Xc)+g.g.A.lineTo(a.width-d.Wa-c.Rk.width,0);g.ma.kd.w.$s.call(this,a)};b.Zs=function(a){Xd(this.$f,a);g.ma.kd.w.Zs.call(this,a)};
b.Vs=function(){var a=this.$f,c=this.ra.Pb;if(a.Xc)a.la+=g.g.A.ea("V",c.Ki-a.Fd);else{var d=a.ra.Pb.elements[0];g.m.u.Ym(d)?a.la+=g.g.A.moveTo(c.Wa+a.Fd,c.Ki-a.Fd):g.m.u.Th(d)&&(a.la+=g.g.A.moveTo(c.Wa,c.Ki),a.la+=a.Fu.rs())}g.ma.kd.w.Vs.call(this)};
b.Ys=function(){var a=this.$f,c=a.ra.L;c&&(c=c.Ie+c.height,a.Xc?a.la+=g.g.A.moveTo(a.ra.ue,c):(a.la+=g.g.A.moveTo(a.ra.ue+a.Fd,a.ra.Pb.Ki-a.Fd),a.la+=g.g.A.ea("V",c)),a.la+=a.un.qn(a.Xc));a.Xc||(c=a.ra.oc,a.la=g.m.u.Th(c.elements[0])?a.la+g.g.A.ea("V",a.Fu.height):a.la+g.g.A.ea("V",c.Hg+a.Fd));g.ma.kd.w.Ys.call(this)};
b.Xs=function(a){var c=this.$f,d=c.Fd,e=a.Wa+a.Dh,f=a.Ah-a.height/2,h=a.width-a.Dh,k=f+d;if(c.Xc){f=a.Ie-d;var l=a.height-(a.Ie+a.mm)+d;c.Rm+=g.g.A.moveTo(e-d,k)+g.g.A.ea("v",f)+c.un.Te(c.Xc)+g.g.A.ea("v",l)+g.g.A.ea("h",h)}else c.Rm+=g.g.A.moveTo(a.Wa+a.width+d,k)+g.g.A.ea("v",a.height)+g.g.A.ea("h",-h)+g.g.A.moveTo(e,f+a.Ie)+c.un.Te(c.Xc);g.ma.kd.w.Xs.call(this,a)};b.Qz=function(a){var c=a.Ah-a.height/2;if(a.connection){var d=a.Wa+a.Dh+this.C.wd;this.ra.G&&(d*=-1);Rc(a.connection,d,c+a.Ie+this.C.wd)}};
b.Sz=function(a){var c=Kd(a);if(c.connection){var d=a.Wa+a.Gj+c.Re;d=this.ra.G?-1*d:d+this.C.wd;Rc(c.connection,d,a.Uc+this.C.wd)}};b.Pz=function(a){var c=Kd(a);if(c.connection){var d=a.Wa+a.width+this.C.wd;this.ra.G&&(d*=-1);Rc(c.connection,d,a.Uc)}};b.Rz=function(){var a=this.ra.Pb;if(a.connection){a=a.connection;var c=a.Wa;Rc(a.Cs,(this.ra.G?-c:c)+this.C.wd/2,a.Ah-a.height/2+this.C.wd)}};g.ma.Jl=function(a){this.Ck=a;this.jk=.5;this.zw=g.g.A.moveBy(this.jk,this.jk);this.SB=Yd(this);this.AC=Zd(this);this.zi=this.bu();this.ik=this.au();this.fk=this.$t();this.Bg=this.cu()};
function Yd(a){var c=a.Ck.Db;a=a.jk;var d=(1-Math.SQRT1_2)*(c+a)-a,e=g.g.A.moveBy(d,d)+g.g.A.arc("a","0 0,0",c,g.g.A.Ya(-d-a,c-d)),f=g.g.A.arc("a","0 0,0",c+a,g.g.A.Ya(c+a,c+a)),h=g.g.A.moveBy(d,-d)+g.g.A.arc("a","0 0,0",c+a,g.g.A.Ya(c-d,d+a));return{width:c+a,height:c,Iu:function(k){return k?e:""},nq:function(k){return k?f:h}}}
function Zd(a){var c=a.Ck.Db;a=a.jk;var d=(1-Math.SQRT1_2)*(c-a)+a,e=g.g.A.moveBy(d,d)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Ya(c-d,-d+a)),f=g.g.A.moveBy(a,c)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Ya(c,-c+a)),h=-d,k=g.g.A.moveBy(d,h)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Ya(-d+a,-h-c));return{height:c,rv:function(l){return l?e:f},rs:function(){return k}}}
g.ma.Jl.prototype.bu=function(){var a=this.Ck.xh,c=this.Ck.Pr,d=g.g.A.moveBy(-2,-c+3.4)+g.g.A.lineTo(-.45*a,-2.1),e=g.g.A.ea("v",2.5)+g.g.A.moveBy(.97*-a,2.5)+g.g.A.curve("q",[g.g.A.Ya(.05*-a,10),g.g.A.Ya(.3*a,9.5)])+g.g.A.moveBy(.67*a,-1.9)+g.g.A.ea("v",2.5),f=g.g.A.ea("v",-1.5)+g.g.A.moveBy(-.92*a,-.5)+g.g.A.curve("q",[g.g.A.Ya(-.19*a,-5.5),g.g.A.Ya(0,-11)])+g.g.A.moveBy(.92*a,1),h=g.g.A.moveBy(-5,c-.7)+g.g.A.lineTo(.46*a,-2.1);return{width:a,height:c,qn:function(k){return k?d:f},Te:function(k){return k?
e:h}}};g.ma.Jl.prototype.au=function(){return{ai:g.g.A.ea("h",this.jk)+this.Ck.ik.ai}};g.ma.Jl.prototype.$t=function(){return{ai:g.g.A.lineTo(5.1,2.6)+g.g.A.moveBy(-10.2,6.8)+g.g.A.lineTo(5.1,2.6)}};g.ma.Jl.prototype.cu=function(){var a=this.Ck.Bg.height,c=g.g.A.moveBy(25,-8.7)+g.g.A.curve("c",[g.g.A.Ya(29.7,-6.2),g.g.A.Ya(57.2,-.5),g.g.A.Ya(75,8.7)]),d=g.g.A.curve("c",[g.g.A.Ya(17.8,-9.2),g.g.A.Ya(45.3,-14.9),g.g.A.Ya(75,-8.7)])+g.g.A.moveTo(100.5,a+.5);return{path:function(e){return e?c:d}}};g.ma.vh=function(){g.ma.vh.w.constructor.call(this);this.nf=null};g.g.object.Y(g.ma.vh,g.m.vh);b=g.ma.vh.prototype;b.U=function(){g.ma.vh.w.U.call(this);this.nf=new g.ma.Jl(this.C)};b.oz=function(){return new g.ma.si};b.rz=function(a){return new g.ma.uh(this,a)};b.pz=function(a,c){return new g.ma.kd(a,c)};b.qz=function(a){return new g.ma.Ai(a)};g.m.register("geras",g.ma.vh);g.h.ADD_COMMENT="Adicionar coment\u00e1rio";g.h.CANNOT_DELETE_VARIABLE_PROCEDURE="N\u00e3o se pode deletar a vari\u00e1vel '%1' porque \u00e9 parte da defini\u00e7\u00e3o da fun\u00e7\u00e3o '%2'";g.h.CHANGE_VALUE_TITLE="Mudar valor:";g.h.CLEAN_UP="Limpar blocos";g.h.COLLAPSED_WARNINGS_WARNING="Bloqueios recolhidos cont\u00eam avisos.";g.h.COLLAPSE_ALL="Colapsar Blocos";g.h.COLLAPSE_BLOCK="Colapsar Bloco";g.h.COLOUR_BLEND_COLOUR1="cor 1";g.h.COLOUR_BLEND_COLOUR2="cor 2";g.h.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp";
g.h.COLOUR_BLEND_RATIO="propor\u00e7\u00e3o";g.h.COLOUR_BLEND_TITLE="misturar";g.h.COLOUR_BLEND_TOOLTIP="Mistura duas cores em uma dada propor\u00e7\u00e3o (0,0 - 1,0).";g.h.COLOUR_PICKER_HELPURL="https://pt.wikipedia.org/wiki/Cor";g.h.COLOUR_PICKER_TOOLTIP="Escolher uma cor da palheta de cores.";g.h.COLOUR_RANDOM_HELPURL="http://randomcolour.com";g.h.COLOUR_RANDOM_TITLE="cor aleat\u00f3ria";g.h.COLOUR_RANDOM_TOOLTIP="Escolher cor de forma aleat\u00f3ria.";g.h.COLOUR_RGB_BLUE="azul";
g.h.COLOUR_RGB_GREEN="verde";g.h.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html";g.h.COLOUR_RGB_RED="vermelho";g.h.COLOUR_RGB_TITLE="colorir com";g.h.COLOUR_RGB_TOOLTIP="Criar uma cor com a quantidade especificada de vermelho, verde e azul. Todos os valores devem estar entre 0 e 100.";g.h.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/google/blockly/wiki/Loops#loop-termination-blocks";g.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="encerra o la\u00e7o";
g.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continua com a pr\u00f3xima itera\u00e7\u00e3o do la\u00e7o";g.h.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="Encerra o la\u00e7o.";g.h.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="Ignora o resto deste la\u00e7o, e continua com a pr\u00f3xima itera\u00e7\u00e3o.";g.h.CONTROLS_FLOW_STATEMENTS_WARNING="Aten\u00e7\u00e3o: Este bloco s\u00f3 pode ser usado dentro de um la\u00e7o.";g.h.CONTROLS_FOREACH_HELPURL="https://github.com/google/blockly/wiki/Loops#for-each";
g.h.CONTROLS_FOREACH_TITLE="para cada item %1 na lista %2";g.h.CONTROLS_FOREACH_TOOLTIP="Para cada item em uma lista, atribua o item \u00e0 vari\u00e1vel '%1' e ent\u00e3o realize algumas instru\u00e7\u00f5es.";g.h.CONTROLS_FOR_HELPURL="https://github.com/google/blockly/wiki/Loops#count-with";g.h.CONTROLS_FOR_TITLE="contar com %1 de %2 at\u00e9 %3 por %4";g.h.CONTROLS_FOR_TOOLTIP="Fa\u00e7a com que a vari\u00e1vel '%1' assuma os valores do n\u00famero inicial ao n\u00famero final, contando de acordo com o intervalo especificado e execute os blocos especificados.";
g.h.CONTROLS_IF_ELSEIF_TOOLTIP="Acrescente uma condi\u00e7\u00e3o para o bloco se.";g.h.CONTROLS_IF_ELSE_TOOLTIP="Acrescente uma condi\u00e7\u00e3o final para o bloco se.";g.h.CONTROLS_IF_HELPURL="https://github.com/google/blockly/wiki/IfElse";g.h.CONTROLS_IF_IF_TOOLTIP="Acrescente, remova ou reordene se\u00e7\u00f5es para reconfigurar este bloco.";g.h.CONTROLS_IF_MSG_ELSE="sen\u00e3o";g.h.CONTROLS_IF_MSG_ELSEIF="sen\u00e3o se";g.h.CONTROLS_IF_MSG_IF="se";g.h.CONTROLS_IF_TOOLTIP_1="Se um valor for verdadeiro, ent\u00e3o realize algumas instru\u00e7\u00f5es.";
g.h.CONTROLS_IF_TOOLTIP_2="Se um valor for verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es. Sen\u00e3o, realize o segundo bloco de instru\u00e7\u00f5es.";g.h.CONTROLS_IF_TOOLTIP_3="Se o primeiro valor \u00e9 verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es.  Sen\u00e3o, se o segundo valor \u00e9 verdadeiro, realize o segundo bloco de instru\u00e7\u00f5es.";g.h.CONTROLS_IF_TOOLTIP_4="Se o primeiro valor for verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es. Sen\u00e3o, se o segundo valor \u00e9 verdadeiro, realize o segundo bloco de instru\u00e7\u00f5es. Se nenhum dos blocos for verdadeiro, realize o \u00faltimo bloco de instru\u00e7\u00f5es.";
g.h.CONTROLS_REPEAT_HELPURL="https://pt.wikipedia.org/wiki/Estrutura_de_repeti%C3%A7%C3%A3o#Repeti.C3.A7.C3.A3o_com_vari.C3.A1vel_de_controle";g.h.CONTROLS_REPEAT_INPUT_DO="fa\u00e7a";g.h.CONTROLS_REPEAT_TITLE="repita %1 vezes";g.h.CONTROLS_REPEAT_TOOLTIP="Fa\u00e7a algumas instru\u00e7\u00f5es v\u00e1rias vezes.";g.h.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat";g.h.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="repita at\u00e9";g.h.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="repita enquanto";
g.h.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="Enquanto um valor for falso, ent\u00e3o fa\u00e7a algumas instru\u00e7\u00f5es.";g.h.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="Enquanto um valor for verdadeiro, ent\u00e3o fa\u00e7a algumas instru\u00e7\u00f5es.";g.h.DELETE_ALL_BLOCKS="Deletar todos os blocos %1?";g.h.DELETE_BLOCK="Deletar bloco";g.h.DELETE_VARIABLE="Deletar a vari\u00e1vel '%1'";g.h.DELETE_VARIABLE_CONFIRMATION="Deletar %1 usos da vari\u00e1vel '%2'?";g.h.DELETE_X_BLOCKS="Deletar %1 blocos";
g.h.DISABLE_BLOCK="Desabilitar bloco";g.h.DUPLICATE_BLOCK="Duplicar";g.h.DUPLICATE_COMMENT="Duplicar coment\u00e1rio";g.h.ENABLE_BLOCK="Habilitar bloco";g.h.EXPAND_ALL="Expandir blocos";g.h.EXPAND_BLOCK="Expandir bloco";g.h.EXTERNAL_INPUTS="Entradas externas";g.h.HELP="Ajuda";g.h.INLINE_INPUTS="Entradas incorporadas";g.h.IOS_CANCEL="blockly:IOS Cancelar/pt-br";g.h.IOS_ERROR="Erro";g.h.IOS_OK="Ok";g.h.IOS_PROCEDURES_ADD_INPUT="+ Adicionar Entrada";g.h.IOS_PROCEDURES_ALLOW_STATEMENTS="Permitir declara\u00e7\u00f5es";
g.h.IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR="Essa fun\u00e7\u00e3o tem entradas duplicadas.";g.h.IOS_PROCEDURES_INPUTS="ENTRADAS";g.h.IOS_VARIABLES_ADD_BUTTON="Adicionar";g.h.IOS_VARIABLES_ADD_VARIABLE="+ Adicionar Vari\u00e1vel";g.h.IOS_VARIABLES_DELETE_BUTTON="Deletar";g.h.IOS_VARIABLES_EMPTY_NAME_ERROR="Voc\u00ea n\u00e3o pode usar um nome de vari\u00e1vel vazio.";g.h.IOS_VARIABLES_RENAME_BUTTON="Blockly:Renomear varioas botoens/pt-br";g.h.IOS_VARIABLES_VARIABLE_NAME="Nome variavel";
g.h.LISTS_CREATE_EMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#create-empty-list";g.h.LISTS_CREATE_EMPTY_TITLE="criar lista vazia";g.h.LISTS_CREATE_EMPTY_TOOLTIP="Retorna uma lista, de tamanho 0, contendo nenhum registro";g.h.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="lista";g.h.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="Acrescenta, remove ou reordena se\u00e7\u00f5es para reconfigurar este bloco de lista.";g.h.LISTS_CREATE_WITH_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with";
g.h.LISTS_CREATE_WITH_INPUT_WITH="criar lista com";g.h.LISTS_CREATE_WITH_ITEM_TOOLTIP="Acrescenta um item \u00e0 lista.";g.h.LISTS_CREATE_WITH_TOOLTIP="Cria uma lista com a quantidade de itens informada.";g.h.LISTS_GET_INDEX_FIRST="primeiro";g.h.LISTS_GET_INDEX_FROM_END="n\u00ba a partir do final";g.h.LISTS_GET_INDEX_FROM_START="n\u00ba";g.h.LISTS_GET_INDEX_GET="obter";g.h.LISTS_GET_INDEX_GET_REMOVE="obter e remover";g.h.LISTS_GET_INDEX_LAST="\u00faltimo";g.h.LISTS_GET_INDEX_RANDOM="aleat\u00f3rio";
g.h.LISTS_GET_INDEX_REMOVE="remover";g.h.LISTS_GET_INDEX_TAIL="";g.h.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="Retorna o primeiro item em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_FROM="Retorna o item da lista na posi\u00e7\u00e3o especificada.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_LAST="Retorna o \u00faltimo item em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="Retorna um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="Remove e retorna o primeiro item de uma lista.";
g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="Remove e retorna o item na posi\u00e7\u00e3o especificada em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="Remove e retorna o \u00faltimo item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="Remove e retorna um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="Remove o primeiro item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="Remove o item na posi\u00e7\u00e3o especificada em uma lista.";
g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="Remove o \u00faltimo item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="Remove um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_SUBLIST_END_FROM_END="at\u00e9 n\u00ba a partir do final";g.h.LISTS_GET_SUBLIST_END_FROM_START="at\u00e9 n\u00ba";g.h.LISTS_GET_SUBLIST_END_LAST="at\u00e9 \u00faltimo";g.h.LISTS_GET_SUBLIST_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-a-sublist";g.h.LISTS_GET_SUBLIST_START_FIRST="obt\u00e9m sublista a partir do primeiro";
g.h.LISTS_GET_SUBLIST_START_FROM_END="obt\u00e9m sublista de n\u00ba a partir do final";g.h.LISTS_GET_SUBLIST_START_FROM_START="obt\u00e9m sublista de n\u00ba";g.h.LISTS_GET_SUBLIST_TAIL="";g.h.LISTS_GET_SUBLIST_TOOLTIP="Cria uma c\u00f3pia da por\u00e7\u00e3o especificada de uma lista.";g.h.LISTS_INDEX_FROM_END_TOOLTIP="%1 \u00e9 o \u00faltimo item.";g.h.LISTS_INDEX_FROM_START_TOOLTIP="%1 \u00e9 o primeiro item.";g.h.LISTS_INDEX_OF_FIRST="encontre a primeira ocorr\u00eancia do item";
g.h.LISTS_INDEX_OF_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list";g.h.LISTS_INDEX_OF_LAST="encontre a \u00faltima ocorr\u00eancia do item";g.h.LISTS_INDEX_OF_TOOLTIP="Retorna o \u00edndice da primeira/\u00faltima ocorr\u00eancia do item na lista.  Retorna %1 se o item n\u00e3o for encontrado.";g.h.LISTS_INLIST="na lista";g.h.LISTS_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#is-empty";g.h.LISTS_ISEMPTY_TITLE="%1 \u00e9 vazia";
g.h.LISTS_ISEMPTY_TOOLTIP="Retorna ao verdadeiro se a lista estiver vazia.";g.h.LISTS_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Lists#length-of";g.h.LISTS_LENGTH_TITLE="tamanho de %1";g.h.LISTS_LENGTH_TOOLTIP="Retorna o tamanho de uma lista.";g.h.LISTS_REPEAT_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with";g.h.LISTS_REPEAT_TITLE="criar lista com item %1 repetido %2 vezes";g.h.LISTS_REPEAT_TOOLTIP="Cria uma lista consistindo no valor informado repetido o n\u00famero de vezes especificado.";
g.h.LISTS_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Listas#invertendo-uma-lista";g.h.LISTS_REVERSE_MESSAGE0="inverter %1";g.h.LISTS_REVERSE_TOOLTIP="Inverter uma c\u00f3pia da lista.";g.h.LISTS_SET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#in-list--set";g.h.LISTS_SET_INDEX_INPUT_TO="como";g.h.LISTS_SET_INDEX_INSERT="inserir em";g.h.LISTS_SET_INDEX_SET="definir";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="Insere o item no in\u00edcio de uma lista.";
g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="Insere o item na posi\u00e7\u00e3o especificada em uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="Insere o item no final de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="Insere o item em uma posi\u00e7\u00e3o qualquer de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="Define o primeiro item de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_FROM="Define o item da posi\u00e7\u00e3o especificada de uma lista.";
g.h.LISTS_SET_INDEX_TOOLTIP_SET_LAST="Define o \u00faltimo item de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="Define um item aleat\u00f3rio de uma lista.";g.h.LISTS_SORT_HELPURL="https://github.com/google/blockly/wiki/Lists#sorting-a-list";g.h.LISTS_SORT_ORDER_ASCENDING="ascendente";g.h.LISTS_SORT_ORDER_DESCENDING="descendente";g.h.LISTS_SORT_TITLE="ordenar %1 %2 %3";g.h.LISTS_SORT_TOOLTIP="Ordenar uma c\u00f3pia de uma lista.";g.h.LISTS_SORT_TYPE_IGNORECASE="alfab\u00e9tico, ignorar mai\u00fascula/min\u00fascula";
g.h.LISTS_SORT_TYPE_NUMERIC="num\u00e9rico";g.h.LISTS_SORT_TYPE_TEXT="alfab\u00e9tico";g.h.LISTS_SPLIT_HELPURL="https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists";g.h.LISTS_SPLIT_LIST_FROM_TEXT="Fazer uma lista a partir do texto";g.h.LISTS_SPLIT_TEXT_FROM_LIST="fazer um texto a partir da lista";g.h.LISTS_SPLIT_TOOLTIP_JOIN="Juntar uma lista de textos em um \u00fanico texto, separado por um delimitador.";g.h.LISTS_SPLIT_TOOLTIP_SPLIT="Dividir o texto em uma lista de textos, separando-o em cada delimitador.";
g.h.LISTS_SPLIT_WITH_DELIMITER="com delimitador";g.h.LOGIC_BOOLEAN_FALSE="falso";g.h.LOGIC_BOOLEAN_HELPURL="https://github.com/google/blockly/wiki/Logic#values";g.h.LOGIC_BOOLEAN_TOOLTIP="Retorna verdadeiro ou falso.";g.h.LOGIC_BOOLEAN_TRUE="verdadeiro";g.h.LOGIC_COMPARE_HELPURL="https://pt.wikipedia.org/wiki/Inequa%C3%A7%C3%A3o";g.h.LOGIC_COMPARE_TOOLTIP_EQ="Retorna verdadeiro se ambas as entradas forem iguais.";g.h.LOGIC_COMPARE_TOOLTIP_GT="Retorna verdadeiro se a primeira entrada for maior que a segunda entrada.";
g.h.LOGIC_COMPARE_TOOLTIP_GTE="Retorna verdadeiro se a primeira entrada for maior ou igual \u00e0 segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_LT="Retorna verdadeiro se a primeira entrada for menor que a segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_LTE="Retorna verdadeiro se a primeira entrada for menor ou igual \u00e0 segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_NEQ="Retorna verdadeiro se ambas as entradas forem diferentes.";g.h.LOGIC_NEGATE_HELPURL="https://github.com/google/blockly/wiki/Logic#not";
g.h.LOGIC_NEGATE_TITLE="n\u00e3o %1";g.h.LOGIC_NEGATE_TOOLTIP="Retorna verdadeiro se a entrada for falsa.  Retorna falsa se a entrada for verdadeira.";g.h.LOGIC_NULL="nulo";g.h.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type";g.h.LOGIC_NULL_TOOLTIP="Retorna nulo.";g.h.LOGIC_OPERATION_AND="e";g.h.LOGIC_OPERATION_HELPURL="https://github.com/google/blockly/wiki/Logic#logical-operations";g.h.LOGIC_OPERATION_OR="ou";g.h.LOGIC_OPERATION_TOOLTIP_AND="Retorna verdadeiro se ambas as entradas forem verdadeiras.";
g.h.LOGIC_OPERATION_TOOLTIP_OR="Retorna verdadeiro se uma das estradas for verdadeira.";g.h.LOGIC_TERNARY_CONDITION="teste";g.h.LOGIC_TERNARY_HELPURL="https://en.wikipedia.org/wiki/%3F:";g.h.LOGIC_TERNARY_IF_FALSE="se falso";g.h.LOGIC_TERNARY_IF_TRUE="se verdadeiro";g.h.LOGIC_TERNARY_TOOLTIP='Avalia a condi\u00e7\u00e3o em "teste". Se a condi\u00e7\u00e3o for verdadeira retorna o valor "se verdadeiro", sen\u00e3o retorna o valor "se falso".';g.h.MATH_ADDITION_SYMBOL="+";
g.h.MATH_ARITHMETIC_HELPURL="https://pt.wikipedia.org/wiki/Aritm%C3%A9tica";g.h.MATH_ARITHMETIC_TOOLTIP_ADD="Retorna a soma dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_DIVIDE="Retorna o quociente da divis\u00e3o dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_MINUS="Retorna a diferen\u00e7a entre os dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="Retorna o produto dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_POWER="Retorna o primeiro n\u00famero elevado \u00e0 pot\u00eancia do segundo n\u00famero.";
g.h.MATH_ATAN2_HELPURL="https://en.wikipedia.org/wiki/Atan2";g.h.MATH_ATAN2_TITLE="atan2 de X:%1 Y:%2";g.h.MATH_ATAN2_TOOLTIP="Retorne o arco tangente do ponto (X, Y) em graus de -180 a 180.";g.h.MATH_CHANGE_HELPURL="https://pt.wikipedia.org/wiki/Adi%C3%A7%C3%A3o";g.h.MATH_CHANGE_TITLE="alterar %1 por %2";g.h.MATH_CHANGE_TOOLTIP='Soma um n\u00famero \u00e0 vari\u00e1vel "%1".';g.h.MATH_CONSTANT_HELPURL="https://pt.wikipedia.org/wiki/Anexo:Lista_de_constantes_matem%C3%A1ticas";
g.h.MATH_CONSTANT_TOOLTIP="Retorna uma das constantes comuns: \u03c0 (3.141\u2026), e (2.718\u2026), \u03c6 (1.618\u2026), sqrt(2) (1.414\u2026), sqrt(\u00bd) (0.707\u2026), ou \u221e (infinito).";g.h.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)";g.h.MATH_CONSTRAIN_TITLE="restringe %1 inferior %2 superior %3";g.h.MATH_CONSTRAIN_TOOLTIP="Restringe um n\u00famero entre os limites especificados (inclusivo).";g.h.MATH_DIVISION_SYMBOL="\u00f7";g.h.MATH_IS_DIVISIBLE_BY="\u00e9 divis\u00edvel por";
g.h.MATH_IS_EVEN="\u00e9 par";g.h.MATH_IS_NEGATIVE="\u00e9 negativo";g.h.MATH_IS_ODD="\u00e9 \u00edmpar";g.h.MATH_IS_POSITIVE="\u00e9 positivo";g.h.MATH_IS_PRIME="\u00e9 primo";g.h.MATH_IS_TOOLTIP="Verifica se um n\u00famero \u00e9 par, \u00edmpar, inteiro, positivo, negativo, ou se \u00e9 divis\u00edvel por outro n\u00famero.  Retorna verdadeiro ou falso.";g.h.MATH_IS_WHOLE="\u00e9 inteiro";g.h.MATH_MODULO_HELPURL="https://pt.wikipedia.org/wiki/Opera%C3%A7%C3%A3o_m%C3%B3dulo";
g.h.MATH_MODULO_TITLE="resto da divis\u00e3o de %1 \u00f7 %2";g.h.MATH_MODULO_TOOLTIP="Retorna o resto da divis\u00e3o de dois n\u00fameros.";g.h.MATH_MULTIPLICATION_SYMBOL="\u00d7";g.h.MATH_NUMBER_HELPURL="https://pt.wikipedia.org/wiki/N%C3%BAmero";g.h.MATH_NUMBER_TOOLTIP="Um n\u00famero.";g.h.MATH_ONLIST_HELPURL="";g.h.MATH_ONLIST_OPERATOR_AVERAGE="m\u00e9dia da lista";g.h.MATH_ONLIST_OPERATOR_MAX="maior da lista";g.h.MATH_ONLIST_OPERATOR_MEDIAN="mediana da lista";g.h.MATH_ONLIST_OPERATOR_MIN="menor da lista";
g.h.MATH_ONLIST_OPERATOR_MODE="moda da lista";g.h.MATH_ONLIST_OPERATOR_RANDOM="item aleat\u00f3rio da lista";g.h.MATH_ONLIST_OPERATOR_STD_DEV="desvio padr\u00e3o da lista";g.h.MATH_ONLIST_OPERATOR_SUM="soma de uma lista";g.h.MATH_ONLIST_TOOLTIP_AVERAGE="Retorna a m\u00e9dia aritm\u00e9tica dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_MAX="Retorna o maior n\u00famero da lista.";g.h.MATH_ONLIST_TOOLTIP_MEDIAN="Retorna a mediana dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_MIN="Retorna o menor n\u00famero da lista.";
g.h.MATH_ONLIST_TOOLTIP_MODE="Retorna uma lista do(s) item(ns) mais comum(ns) da lista.";g.h.MATH_ONLIST_TOOLTIP_RANDOM="Retorna um elemento aleat\u00f3rio da lista.";g.h.MATH_ONLIST_TOOLTIP_STD_DEV="Retorna o desvio padr\u00e3o dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_SUM="Retorna a soma de todos os n\u00fameros na lista.";g.h.MATH_POWER_SYMBOL="^";g.h.MATH_RANDOM_FLOAT_HELPURL="https://pt.wikipedia.org/wiki/Gerador_de_n%C3%BAmeros_pseudoaleat%C3%B3rios";
g.h.MATH_RANDOM_FLOAT_TITLE_RANDOM="fra\u00e7\u00e3o aleat\u00f3ria";g.h.MATH_RANDOM_FLOAT_TOOLTIP="Retorna uma fra\u00e7\u00e3o aleat\u00f3ria entre 0.0 (inclusivo) e 1.0 (exclusivo).";g.h.MATH_RANDOM_INT_HELPURL="https://pt.wikipedia.org/wiki/Gerador_de_n%C3%BAmeros_pseudoaleat%C3%B3rios";g.h.MATH_RANDOM_INT_TITLE="inteiro aleat\u00f3rio entre %1 e %2";g.h.MATH_RANDOM_INT_TOOLTIP="Retorna um n\u00famero inteiro entre os dois limites informados, inclusivo.";g.h.MATH_ROUND_HELPURL="https://pt.wikipedia.org/wiki/Arredondamento";
g.h.MATH_ROUND_OPERATOR_ROUND="arredonda";g.h.MATH_ROUND_OPERATOR_ROUNDDOWN="arredonda para baixo";g.h.MATH_ROUND_OPERATOR_ROUNDUP="arredonda para cima";g.h.MATH_ROUND_TOOLTIP="Arredonda um n\u00famero para cima ou para baixo.";g.h.MATH_SINGLE_HELPURL="https://pt.wikipedia.org/wiki/Raiz_quadrada";g.h.MATH_SINGLE_OP_ABSOLUTE="absoluto";g.h.MATH_SINGLE_OP_ROOT="raiz quadrada";g.h.MATH_SINGLE_TOOLTIP_ABS="Retorna o valor absoluto de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_EXP="Retorna o n\u00famero e elevado \u00e0 pot\u00eancia de um n\u00famero.";
g.h.MATH_SINGLE_TOOLTIP_LN="Retorna o logaritmo natural de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_LOG10="Retorna o logaritmo em base 10 de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_NEG="Retorna o oposto de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_POW10="Retorna 10 elevado \u00e0 pot\u00eancia de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_ROOT="Retorna a raiz quadrada de um n\u00famero.";g.h.MATH_SUBTRACTION_SYMBOL="-";g.h.MATH_TRIG_ACOS="acos";g.h.MATH_TRIG_ASIN="asin";g.h.MATH_TRIG_ATAN="atan";
g.h.MATH_TRIG_COS="cos";g.h.MATH_TRIG_HELPURL="https://pt.wikipedia.org/wiki/Fun%C3%A7%C3%A3o_trigonom%C3%A9trica";g.h.MATH_TRIG_SIN="sin";g.h.MATH_TRIG_TAN="tan";g.h.MATH_TRIG_TOOLTIP_ACOS="Retorna o arco cosseno de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_ASIN="Retorna o arco seno de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_ATAN="Retorna o arco tangente de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_COS="Retorna o cosseno de um grau (n\u00e3o radiano).";g.h.MATH_TRIG_TOOLTIP_SIN="Retorna o seno de um grau (n\u00e3o radiano).";
g.h.MATH_TRIG_TOOLTIP_TAN="Retorna a tangente de um grau (n\u00e3o radiano).";g.h.NEW_COLOUR_VARIABLE="Criar vari\u00e1vel colorida...";g.h.NEW_NUMBER_VARIABLE="Criar vari\u00e1vel num\u00e9rica...";g.h.NEW_STRING_VARIABLE="Criar vari\u00e1vel de segmentos de texto...";g.h.NEW_VARIABLE="Criar vari\u00e1vel...";g.h.NEW_VARIABLE_TITLE="Nome da nova vari\u00e1vel:";g.h.NEW_VARIABLE_TYPE_TITLE="Tipo da nova vari\u00e1vel:";g.h.ORDINAL_NUMBER_SUFFIX="";g.h.PROCEDURES_ALLOW_STATEMENTS="permitir declara\u00e7\u00f5es";
g.h.PROCEDURES_BEFORE_PARAMS="com:";g.h.PROCEDURES_CALLNORETURN_HELPURL="https://pt.wikipedia.org/wiki/Sub-rotina";g.h.PROCEDURES_CALLNORETURN_TOOLTIP='Executa a fun\u00e7\u00e3o definida pelo usu\u00e1rio "%1".';g.h.PROCEDURES_CALLRETURN_HELPURL="https://pt.wikipedia.org/wiki/Sub-rotina";g.h.PROCEDURES_CALLRETURN_TOOLTIP='Executa a fun\u00e7\u00e3o definida pelo usu\u00e1rio "%1" e usa seu retorno.';g.h.PROCEDURES_CALL_BEFORE_PARAMS="com:";g.h.PROCEDURES_CREATE_DO='Criar "%1"';
g.h.PROCEDURES_DEFNORETURN_COMMENT="Descreva esta fun\u00e7\u00e3o...";g.h.PROCEDURES_DEFNORETURN_DO="";g.h.PROCEDURES_DEFNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine";g.h.PROCEDURES_DEFNORETURN_PROCEDURE="fa\u00e7a algo";g.h.PROCEDURES_DEFNORETURN_TITLE="para";g.h.PROCEDURES_DEFNORETURN_TOOLTIP="Cria uma fun\u00e7\u00e3o que n\u00e3o tem retorno.";g.h.PROCEDURES_DEFRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine";g.h.PROCEDURES_DEFRETURN_RETURN="retorna";
g.h.PROCEDURES_DEFRETURN_TOOLTIP="Cria uma fun\u00e7\u00e3o que possui um valor de retorno.";g.h.PROCEDURES_DEF_DUPLICATE_WARNING="Aten\u00e7\u00e3o: Esta fun\u00e7\u00e3o tem par\u00e2metros duplicados.";g.h.PROCEDURES_HIGHLIGHT_DEF="Destacar defini\u00e7\u00e3o da fun\u00e7\u00e3o";g.h.PROCEDURES_IFRETURN_HELPURL="http://c2.com/cgi/wiki?GuardClause";g.h.PROCEDURES_IFRETURN_TOOLTIP="Se um valor \u00e9 verdadeiro, ent\u00e3o retorna um valor.";g.h.PROCEDURES_IFRETURN_WARNING="Aten\u00e7\u00e3o: Este bloco s\u00f3 pode ser utilizado dentro da defini\u00e7\u00e3o de uma fun\u00e7\u00e3o.";
g.h.PROCEDURES_MUTATORARG_TITLE="nome da entrada:";g.h.PROCEDURES_MUTATORARG_TOOLTIP="Adiciona uma entrada para esta fun\u00e7\u00e3o";g.h.PROCEDURES_MUTATORCONTAINER_TITLE="entradas";g.h.PROCEDURES_MUTATORCONTAINER_TOOLTIP="Adiciona, remove, ou reordena as entradas para esta fun\u00e7\u00e3o.";g.h.REDO="Refazer";g.h.REMOVE_COMMENT="Remover coment\u00e1rio";g.h.RENAME_VARIABLE="Renomear vari\u00e1vel...";g.h.RENAME_VARIABLE_TITLE="Renomear todas as vari\u00e1veis '%1' para:";
g.h.TEXT_APPEND_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification";g.h.TEXT_APPEND_TITLE="para %1 anexar texto %2";g.h.TEXT_APPEND_TOOLTIP='Acrescentar um peda\u00e7o de texto \u00e0 vari\u00e1vel "%1".';g.h.TEXT_CHANGECASE_HELPURL="https://github.com/google/blockly/wiki/Text#adjusting-text-case";g.h.TEXT_CHANGECASE_OPERATOR_LOWERCASE="para min\u00fasculas";g.h.TEXT_CHANGECASE_OPERATOR_TITLECASE="para Nomes Pr\u00f3prios";g.h.TEXT_CHANGECASE_OPERATOR_UPPERCASE="para MAI\u00daSCULAS";
g.h.TEXT_CHANGECASE_TOOLTIP="Retorna uma c\u00f3pia do texto em um formato diferente.";g.h.TEXT_CHARAT_FIRST="obter primeira letra";g.h.TEXT_CHARAT_FROM_END="obter letra # a partir do final";g.h.TEXT_CHARAT_FROM_START="obter letra n\u00ba";g.h.TEXT_CHARAT_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-text";g.h.TEXT_CHARAT_LAST="obter \u00faltima letra";g.h.TEXT_CHARAT_RANDOM="obter letra aleat\u00f3ria";g.h.TEXT_CHARAT_TAIL="";g.h.TEXT_CHARAT_TITLE="no texto %1 %2";
g.h.TEXT_CHARAT_TOOLTIP="Retorna a letra na posi\u00e7\u00e3o especificada.";g.h.TEXT_COUNT_HELPURL="https://github.com/google/blockly/wiki/Text#counting-substrings";g.h.TEXT_COUNT_MESSAGE0="Contar %1 em %2";g.h.TEXT_COUNT_TOOLTIP="Calcule quantas vezes algum texto aparece centro de algum outro texto.";g.h.TEXT_CREATE_JOIN_ITEM_TOOLTIP="Acrescentar um item ao texto.";g.h.TEXT_CREATE_JOIN_TITLE_JOIN="unir";g.h.TEXT_CREATE_JOIN_TOOLTIP="Acrescenta, remove ou reordena se\u00e7\u00f5es para reconfigurar este bloco de texto.";
g.h.TEXT_GET_SUBSTRING_END_FROM_END="at\u00e9 letra n\u00ba a partir do final";g.h.TEXT_GET_SUBSTRING_END_FROM_START="at\u00e9 letra n\u00ba";g.h.TEXT_GET_SUBSTRING_END_LAST="at\u00e9 \u00faltima letra";g.h.TEXT_GET_SUBSTRING_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text";g.h.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="no texto";g.h.TEXT_GET_SUBSTRING_START_FIRST="obter trecho de primeira letra";g.h.TEXT_GET_SUBSTRING_START_FROM_END="obter trecho de letra n\u00ba a partir do final";
g.h.TEXT_GET_SUBSTRING_START_FROM_START="obter trecho de letra n\u00ba";g.h.TEXT_GET_SUBSTRING_TAIL="";g.h.TEXT_GET_SUBSTRING_TOOLTIP="Retorna o trecho de texto especificado.";g.h.TEXT_INDEXOF_HELPURL="https://github.com/google/blockly/wiki/Text#finding-text";g.h.TEXT_INDEXOF_OPERATOR_FIRST="encontre a primeira ocorr\u00eancia do item";g.h.TEXT_INDEXOF_OPERATOR_LAST="encontre a \u00faltima ocorr\u00eancia do texto";g.h.TEXT_INDEXOF_TITLE="no texto %1 %2 %3";g.h.TEXT_INDEXOF_TOOLTIP="Retorna a posi\u00e7\u00e3o da primeira/\u00faltima ocorr\u00eancia do primeiro texto no segundo texto.  Retorna %1 se o texto n\u00e3o for encontrado.";
g.h.TEXT_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Text#checking-for-empty-text";g.h.TEXT_ISEMPTY_TITLE="%1 \u00e9 vazio";g.h.TEXT_ISEMPTY_TOOLTIP="Retorna verdadeiro se o texto fornecido for vazio.";g.h.TEXT_JOIN_HELPURL="https://github.com/google/blockly/wiki/Text#text-creation";g.h.TEXT_JOIN_TITLE_CREATEWITH="criar texto com";g.h.TEXT_JOIN_TOOLTIP="Criar um peda\u00e7o de texto juntando qualquer n\u00famero de itens.";g.h.TEXT_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification";
g.h.TEXT_LENGTH_TITLE="tamanho de %1";g.h.TEXT_LENGTH_TOOLTIP="Retorna o n\u00famero de letras (incluindo espa\u00e7os) no texto fornecido.";g.h.TEXT_PRINT_HELPURL="https://github.com/google/blockly/wiki/Text#printing-text";g.h.TEXT_PRINT_TITLE="imprime %1";g.h.TEXT_PRINT_TOOLTIP="Imprime o texto, n\u00famero ou valor especificado.";g.h.TEXT_PROMPT_HELPURL="https://github.com/google/blockly/wiki/Text#getting-input-from-the-user";g.h.TEXT_PROMPT_TOOLTIP_NUMBER="Pede ao usu\u00e1rio um n\u00famero.";
g.h.TEXT_PROMPT_TOOLTIP_TEXT="Pede ao usu\u00e1rio um texto.";g.h.TEXT_PROMPT_TYPE_NUMBER="Pede um n\u00famero com uma mensagem";g.h.TEXT_PROMPT_TYPE_TEXT="Pede um texto com uma mensagem";g.h.TEXT_REPLACE_HELPURL="https://github.com/google/blockly/wiki/Texto#substituindo-substrings";g.h.TEXT_REPLACE_MESSAGE0="substituir %1 por %2 em %3";g.h.TEXT_REPLACE_TOOLTIP="Substitua todas as ocorr\u00eancias de algum texto dentro de algum outro texto.";g.h.TEXT_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Texto#invertendo-texto";
g.h.TEXT_REVERSE_MESSAGE0="inverter %1";g.h.TEXT_REVERSE_TOOLTIP="Inverter a ordem dos caracteres no texto.";g.h.TEXT_TEXT_HELPURL="https://pt.wikipedia.org/wiki/Cadeia_de_caracteres";g.h.TEXT_TEXT_TOOLTIP="Uma letra, palavra ou linha de texto.";g.h.TEXT_TRIM_HELPURL="https://github.com/google/blockly/wiki/Text#trimming-removing-spaces";g.h.TEXT_TRIM_OPERATOR_BOTH="remover espa\u00e7os de ambos os lados de";g.h.TEXT_TRIM_OPERATOR_LEFT="remover espa\u00e7os \u00e0 esquerda de";
g.h.TEXT_TRIM_OPERATOR_RIGHT="remover espa\u00e7os \u00e0 direita de";g.h.TEXT_TRIM_TOOLTIP="Retorna uma c\u00f3pia do texto com os espa\u00e7os removidos de uma ou ambas extremidades.";g.h.TODAY="Hoje";g.h.UNDO="Desfazer";g.h.UNNAMED_KEY="Sem t\u00edtulo";g.h.VARIABLES_DEFAULT_NAME="item";g.h.VARIABLES_GET_CREATE_SET='Criar "definir %1"';g.h.VARIABLES_GET_HELPURL="https://github.com/google/blockly/wiki/Variables#get";g.h.VARIABLES_GET_TOOLTIP="Retorna o valor desta vari\u00e1vel.";
g.h.VARIABLES_SET="definir %1 para %2";g.h.VARIABLES_SET_CREATE_GET='Criar "obter %1"';g.h.VARIABLES_SET_HELPURL="https://github.com/google/blockly/wiki/Variables#set";g.h.VARIABLES_SET_TOOLTIP="Define esta vari\u00e1vel para o valor da entrada.";g.h.VARIABLE_ALREADY_EXISTS="A vari\u00e1vel chamada '%1' j\u00e1 existe.";g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="J\u00e1 existe uma vari\u00e1vel chamada '%1' para outra do tipo: '%2'.";g.h.WORKSPACE_COMMENT_DEFAULT_TEXT="Diz algo...";
g.h.CONTROLS_FOREACH_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_FOR_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=g.h.CONTROLS_IF_MSG_ELSEIF;g.h.CONTROLS_IF_ELSE_TITLE_ELSE=g.h.CONTROLS_IF_MSG_ELSE;g.h.CONTROLS_IF_IF_TITLE_IF=g.h.CONTROLS_IF_MSG_IF;g.h.CONTROLS_IF_MSG_THEN=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_WHILEUNTIL_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.LISTS_CREATE_WITH_ITEM_TITLE=g.h.VARIABLES_DEFAULT_NAME;g.h.LISTS_GET_INDEX_HELPURL=g.h.LISTS_INDEX_OF_HELPURL;
g.h.LISTS_GET_INDEX_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_GET_SUBLIST_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_INDEX_OF_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_SET_INDEX_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.MATH_CHANGE_TITLE_ITEM=g.h.VARIABLES_DEFAULT_NAME;g.h.PROCEDURES_DEFRETURN_COMMENT=g.h.PROCEDURES_DEFNORETURN_COMMENT;g.h.PROCEDURES_DEFRETURN_DO=g.h.PROCEDURES_DEFNORETURN_DO;g.h.PROCEDURES_DEFRETURN_PROCEDURE=g.h.PROCEDURES_DEFNORETURN_PROCEDURE;g.h.PROCEDURES_DEFRETURN_TITLE=g.h.PROCEDURES_DEFNORETURN_TITLE;
g.h.TEXT_APPEND_VARIABLE=g.h.VARIABLES_DEFAULT_NAME;g.h.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=g.h.VARIABLES_DEFAULT_NAME;g.h.MATH_HUE="230";g.h.LOOPS_HUE="120";g.h.LISTS_HUE="260";g.h.LOGIC_HUE="210";g.h.VARIABLES_HUE="330";g.h.TEXTS_HUE="160";g.h.PROCEDURES_HUE="290";g.h.COLOUR_HUE="20";g.h.VARIABLES_DYNAMIC_HUE="310";var P={Gk:null,U:function(){Fd();var a=document.getElementById("linkButton");"BlocklyStorage"in window?(BlocklyStorage.HTTPREQUEST_ERROR=N("Games_httpRequestError"),BlocklyStorage.LINK_ALERT=N("Games_linkAlert"),BlocklyStorage.HASH_ERROR=N("Games_hashError"),BlocklyStorage.XML_ERROR=N("Games_xmlError"),BlocklyStorage.alert=O.qA.bind(O,a),a&&Jd(a,BlocklyStorage.link)):a&&(a.style.display="none");(a=document.getElementById("languageMenu"))&&a.addEventListener("change",P.MD,!0);g.N&&(g.N.wC=!1);g.j&&
(g.j.wC=!1)},PF:function(a,c){if("BlocklyStorage"in window&&1<window.location.hash.length)BlocklyStorage.retrieveXml(window.location.hash.substring(1));else{var d=null;try{d=window.sessionStorage.nz}catch(h){}d&&delete window.sessionStorage.nz;var e=Gd(M),f=c&&Gd(M-1);f&&"function"==typeof c&&(f=c(f));(a=d||e||f||a)&&P.fA(a)}},fA:function(a){P.Gk?P.Gk.setValue(a,-1):(a=g.R.lh(a),H.clear(),g.R.Fh(a,H),a=H,a.Nj.length=0,a.vn.length=0,g.i.UD())},rt:function(){if(P.Gk)var a=P.Gk.getValue();else{a=g.R.DA(!0);
if(1==A(H,!1).length&&a.querySelector){var c=a.querySelector("block");c&&(c.removeAttribute("x"),c.removeAttribute("y"))}a=g.R.Dd(a)}return a},Lk:function(){return H},WG:function(){window.localStorage&&(window.localStorage[Id+M]=P.rt())},Np:function(){window.location=(Ad?"index.html":"./")+"?lang="+yd},MD:function(){if(window.sessionStorage){if(P.Gk)var a=P.Gk.getValue();else a=g.R.DA(),a=g.R.Dd(a);window.sessionStorage.nz=a}a=document.getElementById("languageMenu");a=encodeURIComponent(a.options[a.selectedIndex].value);
var c=window.location.search;c=1>=c.length?"?lang="+a:c.match(/[?&]lang=[^&]*/)?c.replace(/([?&]lang=)[^&]*/,"$1"+a):c.replace(/\?/,"?lang="+a+"&");window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+c},ou:function(){10>M?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+yd+"&level="+(M+1):P.Np()},Gt:function(a,c){if(a){var d=a.match(/^block_id_([^']+)$/);d&&(a=d[1])}id(a,c)},Zy:function(a,c){a=document.getElementById(a);
a.firstChild||(a=g.Ph(a,{rtl:-1!=xd.indexOf(yd),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),g.R.Fh(g.R.lh(c),a))},lH:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},Xf:function(a){if("click"==a.type&&"touchend"==P.Xf.Ou&&P.Xf.Mu+2E3>Date.now()||P.Xf.Ou==a.type&&P.Xf.Mu+400>Date.now())return a.preventDefault(),a.stopPropagation(),!0;P.Xf.Ou=a.type;P.Xf.Mu=Date.now();return!1}};P.Xf.Ou=null;P.Xf.Mu=0;
P.CF=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};P.DF=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=P;P.setCode=P.fA;P.getCode=P.rt;P.getWorkspace=P.Lk;var O={Qh:!1,Ix:null,pp:null,Dj:function(a,c,d,e,f,h){function k(){O.Qh&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);O.Qh&&O.Qd(!1);g.Hb()&&g.wc(!0);O.Qh=!0;O.Ix=c;O.pp=h;var l=document.getElementById("dialog");h=document.getElementById("dialogShadow");var m=document.getElementById("dialogBorder"),n;for(n in f)l.style[n]=f[n];e&&(h.style.visibility="visible",h.style.opacity=.3,h.style.zIndex=9,e=document.createElement("div"),
e.id="dialogHeader",l.appendChild(e),O.Ls=g.ld(e,"mousedown",null,O.rE));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(O.cq(c,!1,.2),O.cq(l,!0,.8),setTimeout(k,175)):k()},Jx:0,Kx:0,rE:function(a){O.Os();if(!g.g.jj(a)){var c=document.getElementById("dialog");O.Jx=c.offsetLeft-a.clientX;O.Kx=c.offsetTop-a.clientY;O.Ns=g.ld(document,"mouseup",null,O.Os);O.Ms=g.ld(document,"mousemove",null,O.sE);a.stopPropagation()}},sE:function(a){var c=document.getElementById("dialog"),
d=O.Jx+a.clientX;a=O.Kx+a.clientY;a=Math.max(a,0);a=Math.min(a,window.innerHeight-c.offsetHeight);d=Math.max(d,0);d=Math.min(d,window.innerWidth-c.offsetWidth);c.style.left=d+"px";c.style.top=a+"px"},Os:function(){O.Ns&&(g.Ua(O.Ns),O.Ns=null);O.Ms&&(g.Ua(O.Ms),O.Ms=null)},Qd:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(O.Qh){O.Os();O.Ls&&(g.Ua(O.Ls),O.Ls=null);O.Qh=!1;O.pp&&O.pp();O.pp=null;var d=!1===a?
null:O.Ix;a=document.getElementById("dialog");var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(O.cq(a,!1,.8),O.cq(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)}},cq:function(a,c,d){function e(){f.style.width=h.width+"px";f.style.height=h.height+"px";f.style.left=h.x+"px";f.style.top=
h.y+"px";f.style.opacity=d}if(a){var f=document.getElementById("dialogBorder"),h=O.SE(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},SE:function(a){var c=g.g.style.Fp(a);c={x:c.x,y:c.y};a.getBBox?(a=a.getBBox(),c.height=a.height,c.width=a.width):(c.height=a.offsetHeight,c.width=a.offsetWidth);return c},qA:function(a,c){var d=document.getElementById("containerStorage");d.textContent="";c=c.split("\n");for(var e=0;e<c.length;e++){var f=document.createElement("p");
f.appendChild(document.createTextNode(c[e]));d.appendChild(f)}d=document.getElementById("dialogStorage");O.Dj(d,a,!0,!0,{width:"50%",left:"25%",top:"5em"},O.kv);O.hv()},Qw:function(){if(!Gd(M))if(O.Qh||H.lc())setTimeout(O.Qw,15E3);else{var a=document.getElementById("dialogAbort"),c=document.getElementById("abortCancel");c.addEventListener("click",O.Qd,!0);c.addEventListener("touchend",O.Qd,!0);c=document.getElementById("abortOk");c.addEventListener("click",P.Np,!0);c.addEventListener("touchend",P.Np,
!0);O.Dj(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",O.Pw,!0)});document.body.addEventListener("keydown",O.Pw,!0)}},fv:function(){document.getElementById("galleryXml").value=P.rt();var a=document.getElementById("galleryDialog");if(!O.fv.VG){var c=document.getElementById("galleryCancel");c.addEventListener("click",O.Qd,!0);c.addEventListener("touchend",O.Qd,!0);c=document.getElementById("galleryOk");c.addEventListener("click",O.mt,!0);c.addEventListener("touchend",
O.mt,!0);O.fv.VG=!0}c=document.getElementById("submitButton");O.Dj(a,c,!0,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",O.ky,!0)});document.body.addEventListener("keydown",O.ky,!0);setTimeout(function(){document.getElementById("galleryTitle").focus()},250)},YD:function(){var a=document.getElementById("dialogDone");if(H){var c=document.getElementById("dialogLinesText");c.textContent="";var d=$d();d=P.lH(d);var e=d.replace(/\/\/[^\n]*/g,"");e=e.replace(/\/\*.*\*\//g,
"");e=e.replace(/[ \t]+\n/g,"\n");e=e.replace(/\n+/g,"\n");e=e.trim();e=e.split("\n").length;var f=document.getElementById("containerCode");f.textContent=d;"function"==typeof prettyPrintOne&&(d=f.innerHTML,d=prettyPrintOne(d,"js"),f.innerHTML=d);d=1==e?N("Games_linesOfCode1"):N("Games_linesOfCode2").replace("%1",String(e));c.appendChild(document.createTextNode(d))}d=10>M?N("Games_nextLevel").replace("%1",String(M+1)):N("Games_finalLevel");c=document.getElementById("doneCancel");c.addEventListener("click",
O.Qd,!0);c.addEventListener("touchend",O.Qd,!0);c=document.getElementById("doneOk");c.addEventListener("click",P.ou,!0);c.addEventListener("touchend",P.ou,!0);O.Dj(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",O.ox,!0)});document.body.addEventListener("keydown",O.ox,!0);document.getElementById("dialogDoneText").textContent=d},Hx:function(a){!O.Qh||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(O.Qd(!0),a.stopPropagation(),a.preventDefault())},
hv:function(){document.body.addEventListener("keydown",O.Hx,!0)},kv:function(){document.body.removeEventListener("keydown",O.Hx,!0)},ox:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)O.Qd(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&P.ou()},Pw:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)O.Qd(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&P.Np()},ky:function(a){27==a.keyCode?O.Qd(!0):13==a.keyCode&&O.mt()},mt:function(){var a=document.getElementById("galleryTitle");
if(a.value.trim()){a=document.getElementById("galleryForm");for(var c=[],d=0,e;e=a.elements[d];d++)e.name&&(c[d]=encodeURIComponent(e.name)+"="+encodeURIComponent(e.value));var f=new XMLHttpRequest;f.open("POST",a.action);f.setRequestHeader("Content-type","application/x-www-form-urlencoded");f.onload=function(){if(4==f.readyState){var h=200==f.status?N("Games_submitted"):N("Games_httpRequestError")+"\nStatus: "+f.status;O.qA(null,h)}};f.send(c.join("&"));O.Qd(!0)}else a.value="",a.focus()}};
window.BlocklyDialogs=O;O.hideDialog=O.Qd;function ae(a){this.ZB=23;this.gk=18;this.kr=132;this.Di=20;this.$a=.5;this.ax=void 0;this.gs=[];var c=g.g.o.Vl,d=document.createElementNS(c,"line");d.setAttribute("class","sliderTrack");d.setAttribute("x1",10);d.setAttribute("y1",35);d.setAttribute("x2",140);d.setAttribute("y2",35);a.appendChild(d);d=document.createElementNS(c,"rect");d.setAttribute("style","opacity: 0");d.setAttribute("x",10-this.Di);d.setAttribute("y",35-this.Di);d.setAttribute("width",130+2*this.Di);d.setAttribute("height",2*
this.Di);d.setAttribute("rx",this.Di);d.setAttribute("ry",this.Di);a.appendChild(d);this.vH=d;d=document.createElementNS(c,"path");d.setAttribute("class","sliderKnob");d.setAttribute("d","m 0,0 l -8,8 v 12 h 16 v -12 z");a.appendChild(d);this.jz=d;c=document.createElementNS(c,"circle");c.setAttribute("style","opacity: 0");c.setAttribute("r",this.Di);c.setAttribute("cy",35);a.appendChild(c);this.Rt=c;for(this.setValue(.5);a&&"svg"!=a.nodeName.toLowerCase();)a=a.parentNode;this.Xa=a;be(this.Rt,"mousedown",
this,this.iz);be(this.Rt,"touchstart",this,this.iz);be(this.vH,"mousedown",this,this.PG);be(this.Xa,"mouseup",null,ce);be(this.Xa,"touchend",null,ce);be(this.Xa,"mousemove",null,de);be(this.Xa,"touchmove",null,de);be(document,"mouseover",null,ee)}var fe=null,ge=0,he=0;ae.prototype.iz=function(a){if("touchstart"==a.type){if(1!=a.changedTouches.length)return;ie(a)}fe=this;ge=je(this,a).x;he=0;var c=this.jz.getAttribute("transform");c&&(c=c.match(/translate\(\s*([-\d.]+)/))&&(he=Number(c[1]));a.preventDefault()};
function ce(){fe=null}function ee(a){if(fe){a=a.target;do if(a==fe.Xa)return;while(a=a.parentNode);fe=null}}function de(a){var c=fe;if(c){if("touchmove"==a.type){if(1!=a.changedTouches.length)return;ie(a)}a=je(c,a).x-ge+he;c.setValue((a-c.gk)/(c.kr-c.gk))}}ae.prototype.PG=function(a){if("touchstart"==a.type){if(1!=a.changedTouches.length)return;ie(a)}a=je(this,a).x;ke(this,(a-this.gk)/(this.kr-this.gk))};ae.prototype.getValue=function(){return this.$a};
function ke(a,c){function d(h){return function(){a.setValue(h*(c-e)/9+e)}}for(;a.gs.length;)clearTimeout(a.gs.pop());for(var e=a.getValue(),f=0;10>f;f++)a.gs.push(setTimeout(d(f),200*f/10))}ae.prototype.setValue=function(a){this.$a=g.g.dd.Ak(a,0,1);a=this.gk+(this.kr-this.gk)*this.$a;this.jz.setAttribute("transform","translate("+a+","+this.ZB+")");this.Rt.setAttribute("cx",a);this.ax&&this.ax(this.$a)};
function je(a,c){var d=a.Xa.createSVGPoint();d.x=c.clientX;d.y=c.clientY;a=a.Xa.getScreenCTM().inverse();return d.matrixTransform(a)}function be(a,c,d,e){a.addEventListener(c,function(f){e.apply(d,arguments)},!1)}function ie(a){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY};var le,Q,me,R,ne,oe,pe,qe;
function re(){function a(d){for(var e=0;5>e;e++)S(d),T(144)}switch(M){case 1:for(var c=0;4>c;c++)S(100),T(90);break;case 2:for(c=0;5>c;c++)S(100),T(72);break;case 3:U("#ffff00");a(100);break;case 4:U("#ffff00");a(50);V(!1);S(150);V(!0);S(20);break;case 5:U("#ffff00");for(c=0;4>c;c++)V(!1),S(150),T(90),V(!0),a(50);break;case 6:U("#ffff00");for(c=0;3>c;c++)V(!1),S(150),T(120),V(!0),a(50);V(!1);T(-90);S(100);V(!0);U("#ffffff");S(50);break;case 7:U("#ffff00");for(c=0;3>c;c++)V(!1),S(150),T(120),V(!0),
a(50);V(!1);T(-90);S(100);V(!0);U("#ffffff");for(c=0;4>c;c++)S(50),S(-50),T(45);break;case 8:U("#ffff00");for(c=0;3>c;c++)V(!1),S(150),T(120),V(!0),a(50);V(!1);T(-90);S(100);V(!0);U("#ffffff");for(c=0;360>c;c++)S(50),S(-50),T(1);break;case 9:U("#ffff00");for(c=0;3>c;c++)V(!1),S(150),T(120),V(!0),a(50);V(!1);T(-90);S(100);V(!0);U("#ffffff");for(c=0;360>c;c++)S(50),S(-50),T(1);T(120);S(20);U("#000000");for(c=0;360>c;c++)S(50),S(-50),T(1)}}
function se(a){if(10==M)return 1<y(H).length;console.log("Pixel errors: "+a);if(100<a)return!1;a=y(H).length;return 2>=M&&3<a||3==M&&4<a?(a=document.getElementById("helpUseLoop"),O.Dj(a,null,!1,!0,{width:"30%",left:"35%",top:"12em"},O.kv),O.hv(),!1):!0};g.N.Ab={};g.W={};g.W.nB={};g.W.nB.bk=20;
g.Eh([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",
name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",
name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]);g.na=function(a,c,d){"function"!=typeof a&&g.na.zA(a);this.nj=a;this.zp=null;this.Bn=0;this.mv=this.Lu=null;a=this.nj;if(Array.isArray(a)){for(var e=!1,f=0;f<a.length;f++){var h=a[f][0];"string"==typeof h?a[f][0]=g.g.nc(h):(null!=h.alt&&(a[f][0].alt=g.g.nc(h.alt)),e=!0)}if(!(e||2>a.length)){e=[];for(f=0;f<a.length;f++)e.push(a[f][0]);f=g.g.ib.dv(e);h=g.g.ib.VD(e,f);var k=g.g.ib.WD(e,f);!h&&!k||f<=h+k||(h&&(this.Lu=e[0].substring(0,h-1)),k&&(this.mv=e[0].substr(1-k)),this.nj=g.na.yD(a,h,k))}}a=this.getOptions(!1)[0];
g.na.w.constructor.call(this,a[1],c,d);this.hl=this.Pe=null};g.g.object.Y(g.na,g.pa);g.na.qa=function(a){return new g.na(a.options,void 0,a)};g.na.prototype.Ci=!0;g.na.$H=25;g.na.DJ=.45;g.na.Zv=5;g.na.QB=2*g.na.Zv;g.na.Cv=g.g.userAgent.zl?"\u25bc":"\u25be";b=g.na.prototype;b.vo="default";
b.Wg=function(){g.na.w.Wg.call(this);this.Pe=g.g.o.K("image",{y:g.na.Zv},this.me);this.df=g.g.o.K("tspan",{},this.Dc);this.df.appendChild(document.createTextNode(this.B.G?g.na.Cv+" ":" "+g.na.Cv));this.B.G?this.Dc.insertBefore(this.df,this.Kj):this.Dc.appendChild(this.df)};b.wf=function(){this.Zg=this.ct();this.Zg.Da(g.D.py());g.g.o.qb(this.Zg.va(),"blocklyDropdownMenu");g.D.kA(this,this.dt.bind(this));this.Zg.focus();this.hl&&g.g.style.Wu(this.hl.va(),this.Zg.va())};
b.ct=function(){var a=new g.wi;Nb(a,this.B.G);a.se("listbox");var c=this.getOptions(!1);this.hl=null;for(var d=0;d<c.length;d++){var e=c[d][0],f=c[d][1];if("object"==typeof e){var h=new Image(e.width,e.height);h.src=e.src;h.alt=e.alt||"";e=h}e=new g.Lo(e);e.se("option");Nb(e,this.B.G);e.setValue(f);e.gm=!0;a.cm(e,a.mb.length,!0);Lc(e,f==this.$a);f==this.$a&&(this.hl=e);Mc(e,this.oF,this)}g.g.M.cb(a.va(),g.g.M.State.Sq,this.hl?this.hl.wa():"");return a};b.dt=function(){this.Zg.I();this.Zg=null};
b.oF=function(a){g.D.Ok(this,!0);this.Gz(a)};b.Gz=function(a){this.setValue(a.getValue())};g.na.yD=function(a,c,d){for(var e=[],f=0;f<a.length;f++){var h=a[f][0],k=a[f][1];h=h.substring(c,h.length-d);e[f]=[h,k]}return e};b=g.na.prototype;b.getOptions=function(a){return"function"==typeof this.nj?(this.zp&&a||(this.zp=this.nj.call(this),g.na.zA(this.zp)),this.zp):this.nj};
b.Og=function(a){for(var c=!1,d=this.getOptions(!0),e=0,f;f=d[e];e++)if(f[1]==a){c=!0;break}return c?a:(this.B&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.B.type+", Field name: "+this.name+", Value: "+a),null)};b.Pg=function(a){g.na.w.Pg.call(this,a);a=this.getOptions(!0);for(var c=0,d;d=a[c];c++)d[1]==this.$a&&(this.Bn=c)};b.Ve=function(){this.B&&this.df&&(this.df.style.fill=this.B.hb?wc(this.B):this.B.Mi)};
b.bh=function(){this.Kj.nodeValue="";this.Pe.style.display="none";var a=this.getOptions(!0),c=0<=this.Bn&&a[this.Bn][0];if(c&&"object"==typeof c){this.Pe.style.display="";this.Pe.setAttributeNS(g.g.o.bf,"xlink:href",c.src);this.Pe.setAttribute("height",c.height);this.Pe.setAttribute("width",c.width);a=g.g.o.Lm(this.df);var d=Number(c.width);this.Bb.height=Number(c.height)+g.na.QB;this.Bb.width=d+a+g.pa.tk;this.B.G?(c=g.pa.ug-1,this.Pe.setAttribute("x",g.pa.ug+a),this.Dc.setAttribute("x",c)):(c=d+
a+g.pa.ug+1,this.Dc.setAttribute("text-anchor","end"),this.Dc.setAttribute("x",c),this.Pe.setAttribute("x",g.pa.ug))}else this.Kj.nodeValue=this.Bp(),this.Dc.setAttribute("text-anchor","start"),this.Dc.setAttribute("x",g.pa.ug),this.Bb.height=g.pa.io,this.Bb.width=g.g.o.Lm(this.Dc)+g.pa.tk;this.Nd.setAttribute("height",this.Bb.height);this.Nd.setAttribute("width",this.Bb.width)};b.Hp=function(){if(0>this.Bn)return null;var a=this.getOptions(!0)[this.Bn][0];return"object"==typeof a?a.alt:a};
g.na.zA=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");if(!a.length)throw TypeError("FieldDropdown options must not be an empty array.");for(var c=!1,d=0;d<a.length;++d){var e=a[d];Array.isArray(e)?"string"!=typeof e[1]?(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option id must be a string. Found "+e[1]+" in: ",e)):e[0]&&"string"!=typeof e[0]&&"string"!=typeof e[0].src&&(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option must have a string label or image description. Found"+
e[0]+" in: ",e)):(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option must be an array. Found: ",e))}if(c)throw TypeError("Found invalid FieldDropdown options.");};g.na.prototype.dg=function(a){if(this.Zg){if(a===g.navigation.bo)return Hc(this.Zg),!0;if(a===g.navigation.ao)return Fc(this.Zg),!0}return g.na.w.dg.call(this,a)};g.vc.register("field_dropdown",g.na);g.ac=function(a){g.ac.w.constructor.call(this,null);this.Wz=a};g.g.object.Y(g.ac,g.Kd);b=g.ac.prototype;b.xl=0;b.$n=0;
b.Ws=function(a){g.g.o.K("rect",{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);g.g.o.K("path",{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},a);
g.g.o.K("circle",{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};b.It=function(a){this.T.pd()&&g.Kd.prototype.It.call(this,a)};
b.Es=function(){this.Mn=g.g.o.K("svg",{x:g.oa.jd,y:g.oa.jd},null);if(this.Wz.length)for(var a=g.g.xml.createElement("xml"),c=0,d;d=this.Wz[c];c++){var e=g.g.xml.createElement("block");e.setAttribute("type",d);a.appendChild(e)}else a=null;a={disable:!1,Ng:this.T.v.options.Ng,Xk:a,Sb:this.T.v,uf:this.T.v.options.uf,G:this.T.G,Ia:this.T.G?g.Cg:g.Md,Rd:!1,jc:this.cF.bind(this),ji:null,dh:this.T.v.options.dh};this.s=new g.pb(a);this.s.ij=!0;Ba(this.s,g.i.uE);a=hd(this.s,"g");c=this.s.Ja("blocklyMutatorBackground");
c.insertBefore(a,this.s.jb);this.Mn.appendChild(c);return this.Mn};b.nh=function(){g.ac.w.nh.call(this);this.T.ec||(this.T.pd()?this.Sd&&g.g.o.Tb(this.Sd,"blocklyIconGroupReadonly"):(this.Yb(!1),this.Sd&&g.g.o.qb(this.Sd,"blocklyIconGroupReadonly")))};
function te(a){var c=2*g.oa.jd,d=a.s.jb.getBBox();var e=a.T.G?-d.x:d.width+d.x;d=d.height+3*c;if(a.s.P){var f=a.s.P.Km();d=Math.max(d,f.Od+20)}e+=3*c;if(Math.abs(a.xl-e)>c||Math.abs(a.$n-d)>c)a.xl=e,a.$n=d,a.Vb.Cn(e+c,d+c),a.Mn.setAttribute("width",a.xl),a.Mn.setAttribute("height",a.$n);a.T.G&&a.s.jb.setAttribute("transform","translate("+a.xl+",0)");a.s.resize()}
b.Yb=function(a){if(a!=this.isVisible())if(g.i.Oa(new g.i.Bd(this.T,"mutatorOpen",!a,a)),a){this.Vb=new g.oa(this.T.v,this.Es(),this.T.Yd,this.cj,null,null);Fa(this.Vb,this.T.id);if(a=this.s.options.Xk)this.s.P.U(this.s),this.s.P.show(a.childNodes);this.gh=this.T.Uf(this.s);a=p(this.gh,!1);for(var c=0,d;d=a[c];c++)d.Da();this.gh.zq(!1);this.gh.Is=!1;this.s.P?(a=2*this.s.P.Db,c=Cb(this.s).Zf()+a):c=a=16;this.T.G&&(c=-c);this.gh.moveBy(c,a);if(this.T.An){var e=this;this.T.An(this.gh);this.Aq=function(){e.T.An(e.gh)};
Ba(this.T.v,this.Aq)}te(this);Ba(this.s,this.EH.bind(this));this.Ve()}else this.Mn=null,this.s.I(),this.gh=this.s=null,this.Vb.I(),this.Vb=null,this.$n=this.xl=0,this.Aq&&(Ca(this.T.v,this.Aq),this.Aq=null)};
b.EH=function(a){if(a.type!=g.i.Yl&&(a.type!=g.i.pi||"disabled"!=a.element)){if(!this.s.lc()){a=A(this.s,!1);for(var c=0,d;d=a[c];c++){var e=d.Ta(),f=Ra(d);20>e.y+f.height&&d.moveBy(0,20-f.height-e.y)}}if(this.gh.v==this.s){g.i.aa(!0);d=this.T;a=(a=d.Pa())&&g.R.Dd(a);c=d.ga;d.ga=!1;d.Rf(this.gh);d.ga=c;d.Td();c=(c=d.Pa())&&g.R.Dd(c);if(a!=c){g.i.Oa(new g.i.qg(d,"mutation",null,a,c));var h=g.i.cc();setTimeout(function(){g.i.aa(h);d.Qb();g.i.aa(!1)},g.jo)}d.ga&&d.Da();a!=c&&g.Qe&&g.navigation.cG(d);
this.s.lc()||te(this);g.i.aa(!1)}}};b.cF=function(){return{Cb:this.$n,ub:this.xl-Cb(this.s).Zf(),Hc:0,qc:this.s.G?0:Cb(this.s).Zf()}};b.I=function(){this.T.Ud=null;g.Kd.prototype.I.call(this)};g.ac.xj=function(a,c,d){if(!a||!a.B.v)return!1;d=E(c,d).connection;var e=C(a);return e&&e!=c||d.ka==a?!1:(d.isConnected()&&d.disconnect(),d.connect(a),!0)};g.ac.$x=function(a){var c=null;if(a&&a.options){var d=a.options.Sb;a.qe?d&&d.options&&(c=d.options.Sb):d&&(c=d)}return c};g.N.Yt={};g.W.jC={};g.W.jC.bk=260;
g.Eh([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",
args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",
name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
g.N.lists_create_with={U:function(){this.Lb=g.h.LISTS_CREATE_WITH_HELPURL;J(this,"list_blocks");this.Mb=3;this.gd();this.td(!0,"Array");this.il(new g.ac(["lists_create_with_item"]));this.Ha(g.h.LISTS_CREATE_WITH_TOOLTIP)},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("items",this.Mb);return a},kb:function(a){this.Mb=parseInt(a.getAttribute("items"),10);this.gd()},Uf:function(a){var c=a.cg("lists_create_with_container");c.Td();for(var d=E(c,"STACK").connection,e=0;e<this.Mb;e++){var f=
a.cg("lists_create_with_item");f.Td();d.connect(f.$);d=f.V}return c},Rf:function(a){var c=Bc(a,"STACK");for(a=[];c;)a.push(c.Zn),c=c.V&&C(c.V);for(c=0;c<this.Mb;c++){var d=E(this,"ADD"+c).connection.ka;d&&-1==a.indexOf(d)&&d.disconnect()}this.Mb=a.length;this.gd();for(c=0;c<this.Mb;c++)g.ac.xj(a[c],this,"ADD"+c)},An:function(a){a=Bc(a,"STACK");for(var c=0;a;){var d=E(this,"ADD"+c);a.Zn=d&&d.connection.ka;c++;a=a.V&&C(a.V)}},gd:function(){this.Mb&&E(this,"EMPTY")?this.ob("EMPTY"):this.Mb||E(this,"EMPTY")||
I(L(this,"EMPTY"),g.h.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.Mb;a++)if(!E(this,"ADD"+a)){var c=K(this,"ADD"+a);0==a&&I(c,g.h.LISTS_CREATE_WITH_INPUT_WITH)}for(;E(this,"ADD"+a);)this.ob("ADD"+a),a++}};g.N.lists_create_with_container={U:function(){J(this,"list_blocks");I(L(this),g.h.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.cf(g.Sa,"STACK");this.Ha(g.h.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
g.N.lists_create_with_item={U:function(){J(this,"list_blocks");I(L(this),g.h.LISTS_CREATE_WITH_ITEM_TITLE);this.Ac(!0);this.zc(!0);this.Ha(g.h.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
g.N.lists_indexOf={U:function(){var a=[[g.h.LISTS_INDEX_OF_FIRST,"FIRST"],[g.h.LISTS_INDEX_OF_LAST,"LAST"]];this.Lb=g.h.LISTS_INDEX_OF_HELPURL;J(this,"list_blocks");this.td(!0,"Number");I(K(this,"VALUE").Za("Array"),g.h.LISTS_INDEX_OF_INPUT_IN_LIST);I(K(this,"FIND"),new g.na(a),"END");this.re(!0);var c=this;this.Ha(function(){return g.h.LISTS_INDEX_OF_TOOLTIP.replace("%1",c.v.options.Hd?"0":"-1")})}};
g.N.lists_getIndex={U:function(){var a=[[g.h.LISTS_GET_INDEX_GET,"GET"],[g.h.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[g.h.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.Xr=[[g.h.LISTS_GET_INDEX_FROM_START,"FROM_START"],[g.h.LISTS_GET_INDEX_FROM_END,"FROM_END"],[g.h.LISTS_GET_INDEX_FIRST,"FIRST"],[g.h.LISTS_GET_INDEX_LAST,"LAST"],[g.h.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.Lb=g.h.LISTS_GET_INDEX_HELPURL;J(this,"list_blocks");a=new g.na(a,function(d){this.B.yA("REMOVE"==d)});I(K(this,"VALUE").Za("Array"),
g.h.LISTS_GET_INDEX_INPUT_IN_LIST);I(I(L(this),a,"MODE"),"","SPACE");L(this,"AT");g.h.LISTS_GET_INDEX_TAIL&&I(L(this,"TAIL"),g.h.LISTS_GET_INDEX_TAIL);this.re(!0);this.td(!0);this.Ub(!0);var c=this;this.Ha(function(){var d=z(c,"MODE"),e=z(c,"WHERE"),f="";switch(d+" "+e){case "GET FROM_START":case "GET FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case "GET FIRST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case "GET RANDOM":f=
g.h.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case "GET_REMOVE LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case "GET_REMOVE RANDOM":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case "REMOVE FROM_START":case "REMOVE FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case "REMOVE FIRST":f=
g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case "REMOVE LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case "REMOVE RANDOM":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}if("FROM_START"==e||"FROM_END"==e)f+="  "+("FROM_START"==e?g.h.LISTS_INDEX_FROM_START_TOOLTIP:g.h.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",c.v.options.Hd?"#1":"#0");return f})},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("statement",!this.L);a.setAttribute("at",E(this,"AT").type==g.Ra);return a},
kb:function(a){var c="true"==a.getAttribute("statement");this.yA(c);a="false"!=a.getAttribute("at");this.Ub(a)},yA:function(a){a!=!this.L&&(D(this,!0),a?(this.td(!1),this.Ac(!0),this.zc(!0)):(this.Ac(!1),this.zc(!1),this.td(!0)))},Ub:function(a){this.ob("AT");this.ob("ORDINAL",!0);a?(K(this,"AT").Za("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&I(L(this,"ORDINAL"),g.h.ORDINAL_NUMBER_SUFFIX)):L(this,"AT");var c=new g.na(this.Xr,function(d){var e="FROM_START"==d||"FROM_END"==d;if(e!=a){var f=this.B;f.Ub(e);
xc(f,d,"WHERE");return null}});I(E(this,"AT"),c,"WHERE");g.h.LISTS_GET_INDEX_TAIL&&Ac(this,"TAIL",null)}};
g.N.lists_setIndex={U:function(){var a=[[g.h.LISTS_SET_INDEX_SET,"SET"],[g.h.LISTS_SET_INDEX_INSERT,"INSERT"]];this.Xr=[[g.h.LISTS_GET_INDEX_FROM_START,"FROM_START"],[g.h.LISTS_GET_INDEX_FROM_END,"FROM_END"],[g.h.LISTS_GET_INDEX_FIRST,"FIRST"],[g.h.LISTS_GET_INDEX_LAST,"LAST"],[g.h.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.Lb=g.h.LISTS_SET_INDEX_HELPURL;J(this,"list_blocks");I(K(this,"LIST").Za("Array"),g.h.LISTS_SET_INDEX_INPUT_IN_LIST);I(I(L(this),new g.na(a),"MODE"),"","SPACE");L(this,"AT");I(K(this,
"TO"),g.h.LISTS_SET_INDEX_INPUT_TO);this.re(!0);this.Ac(!0);this.zc(!0);this.Ha(g.h.LISTS_SET_INDEX_TOOLTIP);this.Ub(!0);var c=this;this.Ha(function(){var d=z(c,"MODE"),e=z(c,"WHERE"),f="";switch(d+" "+e){case "SET FROM_START":case "SET FROM_END":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case "INSERT FROM_START":case "INSERT FROM_END":f=
g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case "INSERT RANDOM":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if("FROM_START"==e||"FROM_END"==e)f+="  "+g.h.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",c.v.options.Hd?"#1":"#0");return f})},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at",E(this,"AT").type==g.Ra);return a},kb:function(a){a=
"false"!=a.getAttribute("at");this.Ub(a)},Ub:function(a){this.ob("AT");this.ob("ORDINAL",!0);a?(K(this,"AT").Za("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&I(L(this,"ORDINAL"),g.h.ORDINAL_NUMBER_SUFFIX)):L(this,"AT");var c=new g.na(this.Xr,function(d){var e="FROM_START"==d||"FROM_END"==d;if(e!=a){var f=this.B;f.Ub(e);xc(f,d,"WHERE");return null}});Ac(this,"AT","TO");E(this,"ORDINAL")&&Ac(this,"ORDINAL","TO");I(E(this,"AT"),c,"WHERE")}};
g.N.lists_getSublist={U:function(){this.WHERE_OPTIONS_1=[[g.h.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[g.h.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[g.h.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[g.h.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[g.h.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[g.h.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.Lb=g.h.LISTS_GET_SUBLIST_HELPURL;J(this,"list_blocks");I(K(this,"LIST").Za("Array"),g.h.LISTS_GET_SUBLIST_INPUT_IN_LIST);L(this,
"AT1");L(this,"AT2");g.h.LISTS_GET_SUBLIST_TAIL&&I(L(this,"TAIL"),g.h.LISTS_GET_SUBLIST_TAIL);this.re(!0);this.td(!0,"Array");this.Ub(1,!0);this.Ub(2,!0);this.Ha(g.h.LISTS_GET_SUBLIST_TOOLTIP)},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at1",E(this,"AT1").type==g.Ra);a.setAttribute("at2",E(this,"AT2").type==g.Ra);return a},kb:function(a){var c="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.Ub(1,c);this.Ub(2,a)},Ub:function(a,c){this.ob("AT"+a);this.ob("ORDINAL"+
a,!0);c?(K(this,"AT"+a).Za("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&I(L(this,"ORDINAL"+a),g.h.ORDINAL_NUMBER_SUFFIX)):L(this,"AT"+a);var d=new g.na(this["WHERE_OPTIONS_"+a],function(e){var f="FROM_START"==e||"FROM_END"==e;if(f!=c){var h=this.B;h.Ub(a,f);xc(h,e,"WHERE"+a);return null}});I(E(this,"AT"+a),d,"WHERE"+a);1==a&&(Ac(this,"AT1","AT2"),E(this,"ORDINAL1")&&Ac(this,"ORDINAL1","AT2"));g.h.LISTS_GET_SUBLIST_TAIL&&Ac(this,"TAIL",null)}};
g.N.lists_sort={U:function(){zc(this,{message0:g.h.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[g.h.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[g.h.LISTS_SORT_TYPE_TEXT,"TEXT"],[g.h.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[g.h.LISTS_SORT_ORDER_ASCENDING,"1"],[g.h.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:g.h.LISTS_SORT_TOOLTIP,helpUrl:g.h.LISTS_SORT_HELPURL})}};
g.N.lists_split={U:function(){var a=this,c=new g.na([[g.h.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[g.h.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(d){a.Af(d)});this.Lb=g.h.LISTS_SPLIT_HELPURL;J(this,"list_blocks");I(K(this,"INPUT").Za("String"),c,"MODE");I(K(this,"DELIM").Za("String"),g.h.LISTS_SPLIT_WITH_DELIMITER);this.re(!0);this.td(!0,"Array");this.Ha(function(){var d=z(a,"MODE");if("SPLIT"==d)return g.h.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"==d)return g.h.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+
d);})},Af:function(a){if(z(this,"MODE")!=a){var c=E(this,"INPUT").connection;c.vf=null;var d=C(c);d&&(c.disconnect(),d.hb?d.I():this.Qb())}"SPLIT"==a?(this.L.Za("Array"),E(this,"INPUT").Za("String")):(this.L.Za("String"),E(this,"INPUT").Za("Array"))},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("mode",z(this,"MODE"));return a},kb:function(a){this.Af(a.getAttribute("mode"))}};g.N.RF={};g.W.ee={};g.W.ee.bk=210;
g.Eh([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,
nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",
helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["\u2260","NEQ"],["\u200f<","LT"],["\u200f\u2264","LTE"],["\u200f>","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",
message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",
tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",
name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]);
g.Eh([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",
tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);g.W.ee.Rr={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};g.Z.register("logic_op_tooltip",g.Z.ap("OP",g.W.ee.Rr));
g.W.ee.hB={le:0,kf:0,ki:!0,Pa:function(){if(!this.le&&!this.kf)return null;var a=g.g.xml.createElement("mutation");this.le&&a.setAttribute("elseif",this.le);this.kf&&a.setAttribute("else",1);return a},kb:function(a){this.le=parseInt(a.getAttribute("elseif"),10)||0;this.kf=parseInt(a.getAttribute("else"),10)||0;this.OG()},Uf:function(a){var c=a.cg("controls_if_if");c.Td();for(var d=c.V,e=1;e<=this.le;e++){var f=a.cg("controls_if_elseif");f.Td();d.connect(f.$);d=f.V}this.kf&&(a=a.cg("controls_if_else"),
a.Td(),d.connect(a.$));return c},Rf:function(a){a=C(a.V);this.kf=this.le=0;for(var c=[null],d=[null],e=null;a;){switch(a.type){case "controls_if_elseif":this.le++;c.push(a.Zn);d.push(a.kh);break;case "controls_if_else":this.kf++;e=a.kh;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.V&&C(a.V)}this.gd();this.Xz(c,d,e)},An:function(a){a=C(a.V);for(var c=1;a;){switch(a.type){case "controls_if_elseif":var d=E(this,"IF"+c),e=E(this,"DO"+c);a.Zn=d&&d.connection.ka;a.kh=e&&e.connection.ka;
c++;break;case "controls_if_else":e=E(this,"ELSE");a.kh=e&&e.connection.ka;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.V&&C(a.V)}},OG:function(){var a=[null],c=[null],d=null;E(this,"ELSE")&&(d=E(this,"ELSE").connection.ka);for(var e=1;E(this,"IF"+e);){var f=E(this,"DO"+e);a.push(E(this,"IF"+e).connection.ka);c.push(f.connection.ka);e++}this.gd();this.Xz(a,c,d)},gd:function(){E(this,"ELSE")&&this.ob("ELSE");for(var a=1;E(this,"IF"+a);)this.ob("IF"+a),this.ob("DO"+a),a++;for(a=
1;a<=this.le;a++)I(K(this,"IF"+a).Za("Boolean"),g.h.CONTROLS_IF_MSG_ELSEIF),I(this.cf(g.Sa,"DO"+a),g.h.CONTROLS_IF_MSG_THEN);this.kf&&I(this.cf(g.Sa,"ELSE"),g.h.CONTROLS_IF_MSG_ELSE)},Xz:function(a,c,d){for(var e=1;e<=this.le;e++)g.ac.xj(a[e],this,"IF"+e),g.ac.xj(c[e],this,"DO"+e);g.ac.xj(d,this,"ELSE")}};g.Z.xn("controls_if_mutator",g.W.ee.hB,null,["controls_if_elseif","controls_if_else"]);
g.W.ee.iB=function(){this.Ha(function(){if(this.le||this.kf){if(!this.le&&this.kf)return g.h.CONTROLS_IF_TOOLTIP_2;if(this.le&&!this.kf)return g.h.CONTROLS_IF_TOOLTIP_3;if(this.le&&this.kf)return g.h.CONTROLS_IF_TOOLTIP_4}else return g.h.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};g.Z.register("controls_if_tooltip",g.W.ee.iB);
g.W.ee.fC={onchange:function(a){this.sn||(this.sn=[null,null]);var c=Bc(this,"A"),d=Bc(this,"B");c&&d&&!oc(c.L,d.L)&&(g.i.aa(a.group),a=this.sn[0],a!==c&&(D(c),a&&!a.hb&&E(this,"A").connection.connect(a.L)),c=this.sn[1],c!==d&&(D(d),c&&!c.hb&&E(this,"B").connection.connect(c.L)),this.Qb(),g.i.aa(!1));this.sn[0]=Bc(this,"A");this.sn[1]=Bc(this,"B")}};g.W.ee.eC=function(){this.ag(g.W.ee.fC)};g.Z.register("logic_compare",g.W.ee.eC);
g.W.ee.gC={Tz:null,onchange:function(a){var c=Bc(this,"THEN"),d=Bc(this,"ELSE"),e=this.L.ka;if((c||d)&&e)for(var f=0;2>f;f++){var h=1==f?c:d;h&&!oc(h.L,e)&&(g.i.aa(a.group),e===this.Tz?(D(this),e.B.Qb()):(D(h),h.Qb()),g.i.aa(!1))}this.Tz=e}};g.Z.rq("logic_ternary",g.W.ee.gC);g.yb=function(a,c,d){this.ll=!0;null==a&&(a="");g.yb.w.constructor.call(this,a,c,d)};g.g.object.Y(g.yb,g.pa);g.yb.qa=function(a){var c=g.g.nc(a.text);return new g.yb(c,void 0,a)};g.yb.prototype.Ci=!0;g.yb.Uv=11;g.yb.Hv=4;b=g.yb.prototype;b.vo="text";b.nd=function(a){g.yb.w.nd.call(this,a);"boolean"==typeof a.spellcheck&&(this.ll=a.spellcheck)};b.Og=function(a){return null===a||void 0===a?null:String(a)};
b.Rx=function(){if(this.Sk){this.Zp=!1;var a=this.$a;this.$a=this.kc.xA;this.B&&g.i.isEnabled()&&g.i.Oa(new g.i.qg(this.B,"field",this.name||null,a,this.$a))}};b.Pg=function(a){this.Zp=!0;this.$a=a;this.Sk||(this.qf=!0)};b.bh=function(){g.yb.w.bh.call(this);this.Sk&&(this.B.G?setTimeout(this.fh.bind(this),0):this.fh(),this.Zp?(g.g.o.Tb(this.kc,"blocklyInvalidInput"),g.g.M.cb(this.kc,"invalid",!1)):(g.g.o.qb(this.kc,"blocklyInvalidInput"),g.g.M.cb(this.kc,"invalid",!0)))};
function ue(a){0!=a.ll&&(a.ll=!1,a.kc&&a.kc.setAttribute("spellcheck",a.ll))}b.wf=function(a){this.s=this.B.v;a=a||!1;!a&&(g.g.userAgent.sC||g.g.userAgent.zl||g.g.userAgent.ck)?ve(this):(g.ba.show(this,this.B.G,this.DH.bind(this)),this.kc=this.Lq(),this.Sk=!0,a||(this.kc.focus(),this.kc.select()))};function ve(a){g.prompt(g.h.CHANGE_VALUE_TITLE,a.dc(),function(c){a.setValue(c)})}
b.Lq=function(){var a=g.ba.Ca,c=document.createElement("input");c.className="blocklyHtmlInput";c.setAttribute("spellcheck",this.ll);var d=g.yb.Uv*this.s.scale+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=g.yb.Hv*this.s.scale+"px";a.appendChild(c);c.value=c.defaultValue=String(this.$a);c.xA=this.$a;c.vu=null;g.g.userAgent.Eo?setTimeout(this.fh.bind(this),0):this.fh();we(this,c);return c};
b.DH=function(){this.Sk=!1;this.Zp=!0;xb(this);this.yu&&this.yu(this.$a);g.Ua(this.nn);g.Ua(this.sG);var a=g.ba.Ca.style;a.width="auto";a.height="auto";a.fontSize=""};function we(a,c){a.nn=g.ca(c,"keydown",a,a.zu);a.sG=g.ca(c,"input",a,a.rG)}b.zu=function(a){a.keyCode==g.g.ya.Fl?(g.ba.Ga(),g.D.aj()):a.keyCode==g.g.ya.er?(this.kc.value=this.kc.defaultValue,g.ba.Ga(),g.D.aj()):a.keyCode==g.g.ya.Cw&&(g.ba.Ga(),g.D.aj(),Yc(this.B,this,!a.shiftKey),a.preventDefault())};
b.rG=function(){var a=this.kc.value;a!==this.kc.vu&&(this.kc.vu=a,g.i.aa(!0),this.setValue(a),xb(this),g.i.aa(!1))};b.fh=function(){var a=g.ba.Ca,c=wb(this);a.style.width=c.right-c.left+"px";a.style.height=c.bottom-c.top+"px";c=new g.g.X(this.B.G?c.right-a.offsetWidth:c.left,c.top);c.y+=1;g.g.userAgent.Eo&&g.ba.Ca.style.top&&(--c.x,--c.y);g.g.userAgent.Wr&&(c.y-=3);a.style.left=c.x+"px";a.style.top=c.y+"px"};
g.yb.lG=function(a){console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);return isNaN(a)?null:String(a)};g.yb.fM=function(a){(a=g.yb.lG(a))&&(a=String(Math.max(0,Math.floor(a))));return a};g.yb.prototype.gz=function(){return!0};g.yb.prototype.Hp=function(){return this.Sk&&this.kc?this.kc.value:null};g.vc.register("field_input",g.yb);g.ze=function(a,c,d,e,f,h){this.kn=-Infinity;this.hn=Infinity;this.cl=0;this.Gs=null;g.ze.w.constructor.call(this,a||0,f,h);h||(xe(this,c),ye(this,d),ze(this,e),this.setValue(this.getValue()))};g.g.object.Y(g.ze,g.yb);g.ze.qa=function(a){return new g.ze(a.value,void 0,void 0,void 0,void 0,a)};g.ze.prototype.Ci=!0;g.ze.prototype.nd=function(a){g.ze.w.nd.call(this,a);xe(this,a.min);ye(this,a.max);ze(this,a.precision)};function xe(a,c){null==c?a.kn=-Infinity:(c=Number(c),isNaN(c)||(a.kn=c))}
function ye(a,c){null==c?a.hn=Infinity:(c=Number(c),isNaN(c)||(a.hn=c))}function ze(a,c){null==c?a.cl=0:(c=Number(c),isNaN(c)||(a.cl=c));var d=a.cl.toString(),e=d.indexOf(".");a.Gs=-1==e?c?0:null:d.length-e-1}g.ze.prototype.Og=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.kn),this.hn);this.cl&&isFinite(a)&&(a=Math.round(a/this.cl)*this.cl);null!=this.Gs&&(a=Number(a.toFixed(this.Gs)));return a};
g.ze.prototype.Lq=function(){var a=g.ze.w.Lq.call(this);-Infinity<this.kn&&g.g.M.cb(a,g.g.M.State.iD,this.kn);Infinity>this.hn&&g.g.M.cb(a,g.g.M.State.hD,this.hn);return a};g.vc.register("field_number",g.ze);g.Ae=function(a,c,d,e,f){this.nj=g.Ae.FE;this.oE=a||"";this.Bb=new g.g.ge(0,g.xa.vr);f&&this.nd(f);c&&(this.Oj=c);f||Ae(this,d,e)};g.g.object.Y(g.Ae,g.na);g.Ae.qa=function(a){var c=g.g.nc(a.variable);return new g.Ae(c,void 0,void 0,void 0,a)};b=g.Ae.prototype;b.s=null;b.Ci=!0;b.nd=function(a){g.Ae.w.nd.call(this,a);Ae(this,a.variableTypes,a.defaultType)};b.dj=function(){if(!this.Zd){var a=g.O.Ep(this.B.v,null,this.oE,this.nE);g.i.disable();this.setValue(a.wa());g.i.enable()}};
b.Fm=function(a){var c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";c=g.O.Ep(this.B.v,c,d,e);if(null!=e&&e!==c.type)throw Error("Serialized variable type with id '"+c.wa()+"' had type "+c.type+", and does not match variable field that references it: "+g.R.Dd(a)+".");this.setValue(c.wa())};b.tA=function(a){this.dj();a.id=this.Zd.wa();a.textContent=this.Zd.name;this.Zd.type&&a.setAttribute("variabletype",this.Zd.type);return a};
b.cv=function(a){if(a.hb)throw Error("Variable fields are not allowed to exist on shadow blocks.");g.Ae.w.cv.call(this,a)};b.getValue=function(){return this.Zd?this.Zd.wa():null};b.dc=function(){return this.Zd?this.Zd.name:""};b.ad=function(){return this.Zd};b.Gy=function(){return this.Zd?this.Oj:null};
b.Og=function(a){if(null===a)return null;var c=g.O.ad(this.B.v,a);if(!c)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;c=c.type;var d;a:if(d=Be(this)){for(var e=0;e<d.length;e++)if(c==d[e]){d=!0;break a}d=!1}else d=!0;return d?a:(console.warn("Variable type doesn't match this field!  Type was "+c),null)};b.Pg=function(a){this.Zd=g.O.ad(this.B.v,a);g.Ae.w.Pg.call(this,a)};
function Be(a){var c=a.zH;if(null===c&&a.B&&a.B.v)return a.B.v.zt();c=c||[""];if(0==c.length)throw a=a.dc(),Error("'variableTypes' of field variable "+a+" was an empty list");return c}
function Ae(a,c,d){d=d||"";if(null==c||void 0==c)c=null;else if(Array.isArray(c)){for(var e=!1,f=0;f<c.length;f++)c[f]==d&&(e=!0);if(!e)throw Error("Invalid default type '"+d+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");a.nE=d;a.zH=c}
g.Ae.FE=function(){if(!this.Zd)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");var a=this.dc(),c=[];if(this.B&&this.B.v)for(var d=Be(this),e=0;e<d.length;e++)c=c.concat(this.B.v.Mm(d[e]));c.sort(g.$l.mx);d=[];for(e=0;e<c.length;e++)d[e]=[c[e].name,c[e].wa()];d.push([g.h.RENAME_VARIABLE,g.xw]);g.h.DELETE_VARIABLE&&d.push([g.h.DELETE_VARIABLE.replace("%1",a),g.Rv]);return d};
g.Ae.prototype.Gz=function(a){a=a.getValue();if(this.B&&this.B.v){if(a==g.xw){g.O.uq(this.B.v,this.Zd);return}if(a==g.Rv){this.B.v.Vf(this.Zd.wa());return}}this.setValue(a)};g.Ae.prototype.wn=function(){return!0};g.vc.register("field_variable",g.Ae);g.N.TF={};g.W.Be={};g.W.Be.bk=120;
g.Eh([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",
args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",
name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",
args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,
nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip",
"controls_flow_in_loop_check"]}]);g.W.Be.lD={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};g.Z.register("controls_whileUntil_tooltip",g.Z.ap("MODE",g.W.Be.lD));g.W.Be.VA={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};g.Z.register("controls_flow_tooltip",g.Z.ap("FLOW",g.W.Be.VA));
g.W.Be.lB={Mg:function(a){if(!this.ec){var c=B(this,"VAR").ad(),d=c.name;if(!this.isCollapsed()&&null!=d){var e={enabled:!0};e.text=g.h.VARIABLES_SET_CREATE_GET.replace("%1",d);c=g.O.Gm(c);d=g.g.xml.createElement("block");d.setAttribute("type","variables_get");d.appendChild(c);e.Gb=g.Fa.cp(this,d);a.push(e)}}}};g.Z.rq("contextMenu_newGetVariableBlock",g.W.Be.lB);g.Z.register("controls_for_tooltip",g.Z.bp("%{BKY_CONTROLS_FOR_TOOLTIP}"));g.Z.register("controls_forEach_tooltip",g.Z.bp("%{BKY_CONTROLS_FOREACH_TOOLTIP}"));
g.W.Be.to={iC:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],ki:!0,Fy:function(a){do{if(-1!=g.W.Be.to.iC.indexOf(a.type))return a;a=vc(a)}while(a);return null},onchange:function(){this.v.lc&&!this.v.lc()&&(g.W.Be.to.Fy(this)?(this.jh(null),this.ec||this.sd(!0)):(this.jh(g.h.CONTROLS_FLOW_STATEMENTS_WARNING),this.ec||yc(this)||this.sd(!1)))}};g.Z.rq("controls_flow_in_loop_check",g.W.Be.to);g.N.dd={};g.W.Math={};g.W.Math.bk=230;
g.Eh([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],
["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",
name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",
extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",
options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},
{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",
helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}",
"RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",
message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,
output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",
style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);
g.W.Math.Rr={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",
SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};
g.Z.register("math_op_tooltip",g.Z.ap("OP",g.W.Math.Rr));g.W.Math.TB={Pa:function(){var a=g.g.xml.createElement("mutation"),c="DIVISIBLE_BY"==z(this,"PROPERTY");a.setAttribute("divisor_input",c);return a},kb:function(a){a="true"==a.getAttribute("divisor_input");this.gd(a)},gd:function(a){var c=E(this,"DIVISOR");a?c||K(this,"DIVISOR").Za("Number"):c&&this.ob("DIVISOR")}};g.W.Math.UB=function(){vb(B(this,"PROPERTY"),function(a){this.B.gd("DIVISIBLE_BY"==a)})};
g.Z.xn("math_is_divisibleby_mutator",g.W.Math.TB,g.W.Math.UB);g.Z.register("math_change_tooltip",g.Z.bp("%{BKY_MATH_CHANGE_TOOLTIP}"));g.W.Math.dC={Af:function(a){"MODE"==a?this.L.Za("Array"):this.L.Za("Number")},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("op",z(this,"OP"));return a},kb:function(a){this.Af(a.getAttribute("op"))}};g.W.Math.cC=function(){vb(B(this,"OP"),function(a){this.Af(a)}.bind(this))};g.Z.xn("math_modes_of_list_mutator",g.W.Math.dC,g.W.Math.cC);g.Wc=function(a,c,d){this.bx=null;null==a&&(a="FALSE");g.Wc.w.constructor.call(this,a,c,d);this.Bb.width=g.Wc.mD};g.g.object.Y(g.Wc,g.pa);g.Wc.qa=function(a){return new g.Wc(a.checked,void 0,a)};g.Wc.mD=15;g.Wc.ZA="\u2713";g.Wc.$A=g.pa.ug-3;g.Wc.aB=14;b=g.Wc.prototype;b.Ci=!0;b.vo="default";b.qf=!1;b.nd=function(a){g.Wc.w.nd.call(this,a);a.checkCharacter&&(this.bx=a.checkCharacter)};
b.Wg=function(){g.Wc.w.Wg.call(this);this.Dc.setAttribute("x",g.Wc.$A);this.Dc.setAttribute("y",g.Wc.aB);g.g.o.qb(this.Dc,"blocklyCheckbox");this.Kj.nodeValue=this.bx||g.Wc.ZA;this.Dc.style.display=this.$a?"block":"none"};b.wf=function(){this.setValue(!this.$a)};b.Og=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};b.Pg=function(a){this.$a=Ce(a);this.Dc&&(this.Dc.style.display=this.$a?"block":"none")};b.getValue=function(){return this.$a?"TRUE":"FALSE"};b.dc=function(){return String(Ce(this.$a))};
function Ce(a){return"string"==typeof a?"TRUE"==a:!!a}g.vc.register("field_checkbox",g.Wc);g.N.MG={};
g.N.procedures_defnoreturn={U:function(){var a=new g.yb("",g.Ka.Yz);ue(a);I(I(I(L(this),g.h.PROCEDURES_DEFNORETURN_TITLE),a,"NAME"),"","PARAMS");this.il(new g.ac(["procedures_mutatorarg"]));(this.v.options.km||this.v.options.Sb&&this.v.options.Sb.options.km)&&g.h.PROCEDURES_DEFNORETURN_COMMENT&&this.ii(g.h.PROCEDURES_DEFNORETURN_COMMENT);J(this,"procedure_blocks");this.Ha(g.h.PROCEDURES_DEFNORETURN_TOOLTIP);this.Lb=g.h.PROCEDURES_DEFNORETURN_HELPURL;this.Ma=[];this.rc=[];this.Cj(!0);this.kh=null},
Cj:function(a){this.Mp!==a&&(a?(I(this.cf(g.Sa,"STACK"),g.h.PROCEDURES_DEFNORETURN_DO),E(this,"RETURN")&&Ac(this,"STACK","RETURN")):this.ob("STACK",!0),this.Mp=a)},Wn:function(){var a="";this.Ma.length&&(a=g.h.PROCEDURES_BEFORE_PARAMS+" "+this.Ma.join(", "));g.i.disable();try{xc(this,a,"PARAMS")}finally{g.i.enable()}},Pa:function(a){var c=g.g.xml.createElement("mutation");a&&c.setAttribute("name",z(this,"NAME"));for(var d=0;d<this.rc.length;d++){var e=g.g.xml.createElement("arg"),f=this.rc[d];e.setAttribute("name",
f.name);e.setAttribute("varid",f.wa());a&&this.Gu&&e.setAttribute("paramId",this.Gu[d]);c.appendChild(e)}this.Mp||c.setAttribute("statements","false");return c},kb:function(a){this.Ma=[];this.rc=[];for(var c=0,d;d=a.childNodes[c];c++)if("arg"==d.nodeName.toLowerCase()){var e=d.getAttribute("name");d=d.getAttribute("varid")||d.getAttribute("varId");this.Ma.push(e);d=g.O.Ep(this.v,d,e,"");null!=d?this.rc.push(d):console.log("Failed to create a variable with name "+e+", ignoring.")}this.Wn();g.Ka.mn(this);
this.Cj("false"!==a.getAttribute("statements"))},Uf:function(a){var c=g.g.xml.createElement("block");c.setAttribute("type","procedures_mutatorcontainer");var d=g.g.xml.createElement("statement");d.setAttribute("name","STACK");c.appendChild(d);for(var e=0;e<this.Ma.length;e++){var f=g.g.xml.createElement("block");f.setAttribute("type","procedures_mutatorarg");var h=g.g.xml.createElement("field");h.setAttribute("name","NAME");var k=g.g.xml.createTextNode(this.Ma[e]);h.appendChild(k);f.appendChild(h);
h=g.g.xml.createElement("next");f.appendChild(h);d.appendChild(f);d=h}a=g.R.Vi(c,a);"procedures_defreturn"==this.type?xc(a,this.Mp,"STATEMENTS"):a.ob("STATEMENT_INPUT");g.Ka.mn(this);return a},Rf:function(a){this.Ma=[];this.Gu=[];this.rc=[];for(var c=Bc(a,"STACK");c;){var d=z(c,"NAME");this.Ma.push(d);d=this.v.ad(d,"");this.rc.push(d);this.Gu.push(c.id);c=c.V&&C(c.V)}this.Wn();g.Ka.mn(this);a=z(a,"STATEMENTS");if(null!==a&&(a="TRUE"==a,this.Mp!=a))if(a)this.Cj(!0),g.ac.xj(this.kh,this,"STACK"),this.kh=
null;else{a=E(this,"STACK").connection;if(this.kh=a.ka)a=C(a),D(a),a.Qb();this.Cj(!1)}},Kh:function(){return[z(this,"NAME"),this.Ma,!1]},Bt:function(){return this.Ma},Ug:function(){return this.rc},tq:function(a,c){var d=this.v.mf(a);if(""==d.type){d=d.name;c=this.v.mf(c);for(var e=!1,f=0;f<this.rc.length;f++)this.rc[f].wa()==a&&(this.Ma[f]=c.name,this.rc[f]=c,e=!0);e&&(this.rp(d,c.name),g.Ka.mn(this))}},Jq:function(a){for(var c=a.name,d=!1,e=0;e<this.rc.length;e++)if(this.rc[e].wa()==a.wa()){var f=
this.Ma[e];this.Ma[e]=c;d=!0}d&&(this.rp(f,c),g.Ka.mn(this))},rp:function(a,c){this.Wn();if(this.Ud&&this.Ud.isVisible())for(var d=y(this.Ud.s,!1),e=0,f;f=d[e];e++)"procedures_mutatorarg"==f.type&&g.fe.Je(a,z(f,"NAME"))&&xc(f,c,"NAME")},Mg:function(a){if(!this.ec){var c={enabled:!0},d=z(this,"NAME");c.text=g.h.PROCEDURES_CREATE_DO.replace("%1",d);var e=g.g.xml.createElement("mutation");e.setAttribute("name",d);for(d=0;d<this.Ma.length;d++){var f=g.g.xml.createElement("arg");f.setAttribute("name",
this.Ma[d]);e.appendChild(f)}d=g.g.xml.createElement("block");d.setAttribute("type",this.Zw);d.appendChild(e);c.Gb=g.Fa.cp(this,d);a.push(c);if(!this.isCollapsed())for(d=0;d<this.rc.length;d++)c={enabled:!0},e=this.rc[d],c.text=g.h.VARIABLES_SET_CREATE_GET.replace("%1",e.name),e=g.O.Gm(e),f=g.g.xml.createElement("block"),f.setAttribute("type","variables_get"),f.appendChild(e),c.Gb=g.Fa.cp(this,f),a.push(c)}},Zw:"procedures_callnoreturn"};
g.N.procedures_defreturn={U:function(){var a=new g.yb("",g.Ka.Yz);ue(a);I(I(I(L(this),g.h.PROCEDURES_DEFRETURN_TITLE),a,"NAME"),"","PARAMS");I(uc(K(this,"RETURN"),g.co),g.h.PROCEDURES_DEFRETURN_RETURN);this.il(new g.ac(["procedures_mutatorarg"]));(this.v.options.km||this.v.options.Sb&&this.v.options.Sb.options.km)&&g.h.PROCEDURES_DEFRETURN_COMMENT&&this.ii(g.h.PROCEDURES_DEFRETURN_COMMENT);J(this,"procedure_blocks");this.Ha(g.h.PROCEDURES_DEFRETURN_TOOLTIP);this.Lb=g.h.PROCEDURES_DEFRETURN_HELPURL;
this.Ma=[];this.rc=[];this.Cj(!0);this.kh=null},Cj:g.N.procedures_defnoreturn.Cj,Wn:g.N.procedures_defnoreturn.Wn,Pa:g.N.procedures_defnoreturn.Pa,kb:g.N.procedures_defnoreturn.kb,Uf:g.N.procedures_defnoreturn.Uf,Rf:g.N.procedures_defnoreturn.Rf,Kh:function(){return[z(this,"NAME"),this.Ma,!0]},Bt:g.N.procedures_defnoreturn.Bt,Ug:g.N.procedures_defnoreturn.Ug,tq:g.N.procedures_defnoreturn.tq,Jq:g.N.procedures_defnoreturn.Jq,rp:g.N.procedures_defnoreturn.rp,Mg:g.N.procedures_defnoreturn.Mg,Zw:"procedures_callreturn"};
g.N.procedures_mutatorcontainer={U:function(){I(L(this),g.h.PROCEDURES_MUTATORCONTAINER_TITLE);this.cf(g.Sa,"STACK");I(I(L(this,"STATEMENT_INPUT"),g.h.PROCEDURES_ALLOW_STATEMENTS),new g.Wc("TRUE"),"STATEMENTS");J(this,"procedure_blocks");this.Ha(g.h.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1},onchange:function(a){if(this.v&&!this.v.qe&&(a.type==g.i.fo||a.type==g.i.Al)){var c=y(this.v),d=this.v.Rg();if(a.type==g.i.fo){a=[];for(var e=0;e<c.length;e+=1)z(c[e],"NAME")&&a.push(z(c[e],"NAME"));
for(c=0;c<d.length;c+=1)-1==a.indexOf(d[c].name)&&this.v.Vf(d[c].wa())}else if(a.type==g.i.Al&&(d=x(this.v,a.Ic),B(d,"NAME")&&(e=z(d,"NAME"),(a=this.v.ad(e))||(a=this.v.Pd(e)),!d.$.isConnected()&&!d.V.isConnected())))for(e=0;e<c.length;e+=1)if(d.id!=c[e].id&&z(c[e],"NAME")==a.name){e=g.O.ly(this.v);a=this.v.Pd(e);xc(d,a.name,"NAME");break}}}};
g.N.procedures_mutatorarg={U:function(){var a=new g.yb("x",this.Oj);a.mG=a.wf;a.wf=function(){this.tm=[];this.mG()};I(I(L(this),g.h.PROCEDURES_MUTATORARG_TITLE),a,"NAME");this.Ac(!0);this.zc(!0);J(this,"procedure_blocks");this.Ha(g.h.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1;a.yu=this.pE;a.tm=[];a.yu("x")},Oj:function(a){var c=this.B,d=g.ac.$x(c.v);a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"");if(!a)return null;c=y(c.v);for(var e=0;e<c.length;e++)if(c[e].id!=this.B.id&&z(c[e],"NAME")==
a)return null;(c=d.ad(a,""))&&c.name!=a&&d.ei(c.wa(),a);c||(c=d.Pd(a,""))&&this.tm&&this.tm.push(c);return a},pE:function(a){var c=g.ac.$x(this.B.v);if(c)for(var d=0;d<this.tm.length;d++){var e=this.tm[d];e.name!=a&&c.Vf(e.wa())}}};
g.N.procedures_callnoreturn={U:function(){I(L(this,"TOPROW"),this.id,"NAME");this.Ac(!0);this.zc(!0);J(this,"procedure_blocks");this.Lb=g.h.PROCEDURES_CALLNORETURN_HELPURL;this.Ma=[];this.rc=[];this.vj={};this.jg=null;this.Nu=!0},ne:function(){return z(this,"NAME")},zn:function(a,c){g.fe.Je(a,this.ne())&&(xc(this,c,"NAME"),this.Ha((this.L?g.h.PROCEDURES_CALLRETURN_TOOLTIP:g.h.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",c)))},av:function(a,c){var d=g.Ka.Im(this.ne(),this.v),e=d&&d.Ud&&d.Ud.isVisible();
e||(this.vj={},this.jg=null);if(c)if(a.join("\n")==this.Ma.join("\n"))this.jg=c;else{if(c.length!=a.length)throw RangeError("paramNames and paramIds must be the same length.");this.hh(!1);this.jg||(this.vj={},this.jg=[]);d=this.ga;this.ga=!1;for(var f=0;f<this.Ma.length;f++){var h=E(this,"ARG"+f);h&&(h=h.connection.ka,this.vj[this.jg[f]]=h,e&&h&&-1==c.indexOf(this.jg[f])&&(h.disconnect(),h.B.Qb()))}this.Ma=[].concat(a);this.rc=[];for(f=0;f<this.Ma.length;f++)a=g.O.Ep(this.v,null,this.Ma[f],""),this.rc.push(a);
this.gd();if(this.jg=c)for(f=0;f<this.Ma.length;f++)c=this.jg[f],c in this.vj&&(h=this.vj[c],g.ac.xj(h,this,"ARG"+f)||delete this.vj[c]);(this.ga=d)&&this.Da()}},gd:function(){for(var a=0;a<this.Ma.length;a++){var c=B(this,"ARGNAME"+a);if(c){g.i.disable();try{c.setValue(this.Ma[a])}finally{g.i.enable()}}else c=new g.ce(this.Ma[a]),I(uc(K(this,"ARG"+a),g.co),c,"ARGNAME"+a).U()}for(;E(this,"ARG"+a);)this.ob("ARG"+a),a++;if(a=E(this,"TOPROW"))if(this.Ma.length)B(this,"WITH")||(I(a,g.h.PROCEDURES_CALL_BEFORE_PARAMS,
"WITH"),a.U());else if(B(this,"WITH"))a:{c=0;for(var d;d=a.Na[c];c++)if("WITH"===d.name){d.I();a.Na.splice(c,1);a.B.ga&&(a.B.Da(),a.B.Qb());break a}throw Error('Field "%s" not found.',"WITH");}},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("name",this.ne());for(var c=0;c<this.Ma.length;c++){var d=g.g.xml.createElement("arg");d.setAttribute("name",this.Ma[c]);a.appendChild(d)}return a},kb:function(a){var c=a.getAttribute("name");this.zn(this.ne(),c);c=[];for(var d=[],e=0,f;f=
a.childNodes[e];e++)"arg"==f.nodeName.toLowerCase()&&(c.push(f.getAttribute("name")),d.push(f.getAttribute("paramId")));this.av(c,d)},Ug:function(){return this.rc},onchange:function(a){if(this.v&&!this.v.qe&&a.Rc)if(a.type==g.i.Al&&-1!=a.Nh.indexOf(this.id)){var c=this.ne();c=g.Ka.Im(c,this.v);!c||c.type==this.Hs&&JSON.stringify(c.Ma)==JSON.stringify(this.Ma)||(c=null);if(!c){g.i.aa(a.group);a=g.g.xml.createElement("xml");c=g.g.xml.createElement("block");c.setAttribute("type",this.Hs);var d=this.Ta(),
e=d.y+2*g.zd;c.setAttribute("x",d.x+g.zd*(this.G?-1:1));c.setAttribute("y",e);d=this.Pa();c.appendChild(d);d=g.g.xml.createElement("field");d.setAttribute("name","NAME");d.appendChild(g.g.xml.createTextNode(this.ne()));c.appendChild(d);a.appendChild(c);g.R.Fh(a,this.v);g.i.aa(!1)}}else a.type==g.i.fo?(c=this.ne(),c=g.Ka.Im(c,this.v),c||(g.i.aa(a.group),this.I(!0,!1),g.i.aa(!1))):a.type==g.i.pi&&"disabled"==a.element&&(c=this.ne(),(c=g.Ka.Im(c,this.v))&&c.id==a.Ic&&((c=g.i.cc())&&console.log("Saw an existing group while responding to a definition change"),
g.i.aa(a.group),a.newValue?(this.Nu=this.isEnabled(),this.sd(!1)):this.sd(this.Nu),g.i.aa(c)))},Mg:function(a){if(this.v.Nc()){var c={enabled:!0};c.text=g.h.PROCEDURES_HIGHLIGHT_DEF;var d=this.ne(),e=this.v;c.Gb=function(){var f=g.Ka.Im(d,e);if(f){if(e.Nc()){var h=x(e,f.id);if(h){var k=h.Ta(),l=Ra(h),m=e.scale;h=(k.x+(e.G?-1:1)*l.width/2)*m;k=(k.y+l.height/2)*m;l=e.jc();h=-(h-l.Jc-l.ub/2)-l.Jc;k=-(k-l.tc-l.Cb/2)-l.tc;g.wc();e.scroll(h,k)}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.");
f.select()}};a.push(c)}},Hs:"procedures_defnoreturn"};
g.N.procedures_callreturn={U:function(){I(L(this,"TOPROW"),"","NAME");this.td(!0);J(this,"procedure_blocks");this.Lb=g.h.PROCEDURES_CALLRETURN_HELPURL;this.Ma=[];this.vj={};this.jg=null;this.Nu=!0},ne:g.N.procedures_callnoreturn.ne,zn:g.N.procedures_callnoreturn.zn,av:g.N.procedures_callnoreturn.av,gd:g.N.procedures_callnoreturn.gd,Pa:g.N.procedures_callnoreturn.Pa,kb:g.N.procedures_callnoreturn.kb,Ug:g.N.procedures_callnoreturn.Ug,onchange:g.N.procedures_callnoreturn.onchange,Mg:g.N.procedures_callnoreturn.Mg,
Hs:"procedures_defreturn"};
g.N.procedures_ifreturn={U:function(){I(K(this,"CONDITION").Za("Boolean"),g.h.CONTROLS_IF_MSG_IF);I(K(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN);this.re(!0);this.Ac(!0);this.zc(!0);J(this,"procedure_blocks");this.Ha(g.h.PROCEDURES_IFRETURN_TOOLTIP);this.Lb=g.h.PROCEDURES_IFRETURN_HELPURL;this.Mh=!0},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("value",Number(this.Mh));return a},kb:function(a){this.Mh=1==a.getAttribute("value");this.Mh||(this.ob("VALUE"),I(L(this,"VALUE"),
g.h.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.v.lc&&!this.v.lc()){var a=!1,c=this;do{if(-1!=this.EB.indexOf(c.type)){a=!0;break}c=vc(c)}while(c);a?("procedures_defnoreturn"==c.type&&this.Mh?(this.ob("VALUE"),I(L(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN),this.Mh=!1):"procedures_defreturn"!=c.type||this.Mh||(this.ob("VALUE"),I(K(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN),this.Mh=!0),this.jh(null),this.ec||this.sd(!0)):(this.jh(g.h.PROCEDURES_IFRETURN_WARNING),this.ec||yc(this)||
this.sd(!1))}},EB:["procedures_defnoreturn","procedures_defreturn"]};g.Ff=function(a,c,d,e,f,h,k){if(!a)throw Error("Src value of an image field is required");a=g.g.nc(a);d=Number(g.g.nc(d));c=Number(g.g.nc(c));if(isNaN(d)||isNaN(c))throw Error("Height and width values of an image field must cast to numbers.");if(0>=d||0>=c)throw Error("Height and width values of an image field must be greater than 0.");this.Dm=!1;this.Zo="";g.Ff.w.constructor.call(this,a||"",null,k);k||(this.Dm=!!h,this.Zo=g.g.nc(e)||"");this.Bb=new g.g.ge(c,d+g.Ff.Yr);this.BF=d;this.hm=null;"function"==
typeof f&&(this.hm=f)};g.g.object.Y(g.Ff,g.pa);g.Ff.qa=function(a){return new g.Ff(a.src,a.width,a.height,void 0,void 0,void 0,a)};g.Ff.Yr=1;b=g.Ff.prototype;b.Ef=!1;b.qf=!1;b.nd=function(a){g.Ff.w.nd.call(this,a);this.Dm=!!a.flipRtl;this.Zo=g.g.nc(a.alt)||""};b.Wg=function(){this.Pe=g.g.o.K("image",{height:this.BF+"px",width:this.Bb.width+"px",alt:this.Zo},this.me);this.Pe.setAttributeNS(g.g.o.bf,"xlink:href",this.$a)};b.Og=function(a){return"string"!=typeof a?null:a};
b.Pg=function(a){this.$a=a;this.Pe&&this.Pe.setAttributeNS(g.g.o.bf,"xlink:href",this.$a||"")};b.uy=function(){return this.Dm};b.wf=function(){this.hm&&this.hm(this)};b.Hp=function(){return this.Zo};g.vc.register("field_image",g.Ff);g.ye=function(a,c,d){null==a&&(a="");g.ye.w.constructor.call(this,a,c,d)};g.g.object.Y(g.ye,g.yb);g.ye.Jo=20;g.ye.qa=function(a){var c=g.g.nc(a.text);return new g.ye(c,void 0,a)};b=g.ye.prototype;b.Wg=function(){tb(this);this.Eq=g.g.o.K("g",{"class":"blocklyEditableText"},this.me)};
b.Bp=function(){var a=this.$a;if(!a)return g.pa.Mo;var c=a.split("\n");a="";for(var d=0;d<c.length;d++){var e=c[d];e.length>this.fq&&(e=e.substring(0,this.fq-4)+"...");e=e.replace(/\s/g,g.pa.Mo);a+=e;d!==c.length-1&&(a+="\n")}this.B.G&&(a+="\u200f");return a};
b.bh=function(){for(var a;a=this.Eq.firstChild;)this.Eq.removeChild(a);a=this.Bp().split("\n");for(var c=g.pa.Yr/2,d=0,e=0;e<a.length;e++)g.g.o.K("text",{"class":"blocklyText blocklyMultilineText",x:g.pa.ug,y:d+c,dy:g.ye.Jo/2},this.Eq).appendChild(document.createTextNode(a[e])),d+=g.ye.Jo;this.vv();this.Sk&&(this.B.G?setTimeout(this.fh.bind(this),0):this.fh(),this.Zp?(g.g.o.Tb(this.kc,"blocklyInvalidInput"),g.g.M.cb(this.kc,"invalid",!1)):(g.g.o.qb(this.kc,"blocklyInvalidInput"),g.g.M.cb(this.kc,
"invalid",!0)))};b.vv=function(){for(var a=this.Eq.childNodes,c=0,d=0,e=0;e<a.length;e++){var f=g.g.o.Lm(a[e]);f>c&&(c=f);d+=g.ye.Jo}this.Nd&&(c+=g.pa.tk,this.Nd.setAttribute("width",c),this.Nd.setAttribute("height",d));this.Bb.width=c;this.Bb.height=d};b.fh=function(){var a=g.ba.Ca,c=wb(this);a.style.width=c.right-c.left+"px";a.style.height=c.bottom-c.top+"px";c=new g.g.X(this.B.G?c.right-a.offsetWidth:c.left,c.top);a.style.left=c.x+"px";a.style.top=c.y+"px"};
b.Lq=function(){var a=g.ba.Ca,c=this.s.scale,d=document.createElement("textarea");d.className="blocklyHtmlInput blocklyHtmlTextAreaInput";d.setAttribute("spellcheck",this.ll);var e=g.yb.Uv*c+"pt";a.style.fontSize=e;d.style.fontSize=e;d.style.borderRadius=g.yb.Hv*c+"px";e=g.pa.ug*c;d.style.paddingLeft=e+"px";d.style.width="calc(100% - "+e+"px)";d.style.lineHeight=g.ye.Jo*c+"px";a.appendChild(d);d.value=d.defaultValue=String(this.$a);d.xA=this.$a;d.vu=null;g.g.userAgent.Eo?setTimeout(this.fh.bind(this),
0):this.fh();we(this,d);return d};b.zu=function(a){a.keyCode!==g.g.ya.Fl&&g.ye.w.zu.call(this,a)};g.Vc.register(".blocklyHtmlTextAreaInput {,font-family: monospace;,resize: none;,overflow: hidden;,height: 100%;,text-align: left;,}".split(","));g.vc.register("field_multilinetext",g.ye);g.N.qH={};g.W.Text={};g.W.Text.bk=160;
g.Eh([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_multiline",message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,
height:17,alt:"\u00b6"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",args0:[{type:"input_dummy"},
{type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",name:"TEXT"}],
previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",
helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",
args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);
g.N.text_getSubstring={U:function(){this.WHERE_OPTIONS_1=[[g.h.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[g.h.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[g.h.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[g.h.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[g.h.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[g.h.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.Lb=g.h.TEXT_GET_SUBSTRING_HELPURL;J(this,"text_blocks");I(K(this,"STRING").Za("String"),g.h.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);
L(this,"AT1");L(this,"AT2");g.h.TEXT_GET_SUBSTRING_TAIL&&I(L(this,"TAIL"),g.h.TEXT_GET_SUBSTRING_TAIL);this.re(!0);this.td(!0,"String");this.Ub(1,!0);this.Ub(2,!0);this.Ha(g.h.TEXT_GET_SUBSTRING_TOOLTIP)},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at1",E(this,"AT1").type==g.Ra);a.setAttribute("at2",E(this,"AT2").type==g.Ra);return a},kb:function(a){var c="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.Ub(1,c);this.Ub(2,a)},Ub:function(a,c){this.ob("AT"+
a);this.ob("ORDINAL"+a,!0);c?(K(this,"AT"+a).Za("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&I(L(this,"ORDINAL"+a),g.h.ORDINAL_NUMBER_SUFFIX)):L(this,"AT"+a);2==a&&g.h.TEXT_GET_SUBSTRING_TAIL&&(this.ob("TAIL",!0),I(L(this,"TAIL"),g.h.TEXT_GET_SUBSTRING_TAIL));var d=new g.na(this["WHERE_OPTIONS_"+a],function(e){var f="FROM_START"==e||"FROM_END"==e;if(f!=c){var h=this.B;h.Ub(a,f);xc(h,e,"WHERE"+a);return null}});I(E(this,"AT"+a),d,"WHERE"+a);1==a&&(Ac(this,"AT1","AT2"),E(this,"ORDINAL1")&&Ac(this,"ORDINAL1",
"AT2"))}};g.N.text_changeCase={U:function(){var a=[[g.h.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[g.h.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[g.h.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.Lb=g.h.TEXT_CHANGECASE_HELPURL;J(this,"text_blocks");I(K(this,"TEXT").Za("String"),new g.na(a),"CASE");this.td(!0,"String");this.Ha(g.h.TEXT_CHANGECASE_TOOLTIP)}};
g.N.text_trim={U:function(){var a=[[g.h.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[g.h.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[g.h.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.Lb=g.h.TEXT_TRIM_HELPURL;J(this,"text_blocks");I(K(this,"TEXT").Za("String"),new g.na(a),"MODE");this.td(!0,"String");this.Ha(g.h.TEXT_TRIM_TOOLTIP)}};
g.N.text_print={U:function(){zc(this,{message0:g.h.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:g.h.TEXT_PRINT_TOOLTIP,helpUrl:g.h.TEXT_PRINT_HELPURL})}};
g.N.text_prompt_ext={U:function(){var a=[[g.h.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[g.h.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.Lb=g.h.TEXT_PROMPT_HELPURL;J(this,"text_blocks");var c=this;a=new g.na(a,function(d){c.Af(d)});I(K(this,"TEXT"),a,"TYPE");this.td(!0,"String");this.Ha(function(){return"TEXT"==z(c,"TYPE")?g.h.TEXT_PROMPT_TOOLTIP_TEXT:g.h.TEXT_PROMPT_TOOLTIP_NUMBER})},Af:function(a){this.L.Za("NUMBER"==a?"Number":"String")},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("type",
z(this,"TYPE"));return a},kb:function(a){this.Af(a.getAttribute("type"))}};
g.N.text_prompt={U:function(){this.ag(g.W.Text.Fr);var a=[[g.h.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[g.h.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],c=this;this.Lb=g.h.TEXT_PROMPT_HELPURL;J(this,"text_blocks");a=new g.na(a,function(d){c.Af(d)});I(I(I(I(L(this),a,"TYPE"),this.$k(!0)),new g.yb(""),"TEXT"),this.$k(!1));this.td(!0,"String");this.Ha(function(){return"TEXT"==z(c,"TYPE")?g.h.TEXT_PROMPT_TOOLTIP_TEXT:g.h.TEXT_PROMPT_TOOLTIP_NUMBER})},Af:g.N.text_prompt_ext.Af,Pa:g.N.text_prompt_ext.Pa,kb:g.N.text_prompt_ext.kb};
g.N.text_count={U:function(){zc(this,{message0:g.h.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:g.h.TEXT_COUNT_TOOLTIP,helpUrl:g.h.TEXT_COUNT_HELPURL})}};
g.N.text_replace={U:function(){zc(this,{message0:g.h.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:g.h.TEXT_REPLACE_TOOLTIP,helpUrl:g.h.TEXT_REPLACE_HELPURL})}};
g.N.text_reverse={U:function(){zc(this,{message0:g.h.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:g.h.TEXT_REVERSE_TOOLTIP,helpUrl:g.h.TEXT_REVERSE_HELPURL})}};
g.W.Text.Fr={EC:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",FC:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",
GC:12,DC:12,NG:function(a){for(var c=0,d;d=this.S[c];c++)for(var e=0,f;f=d.Na[e];e++)if(a==f.name){rc(d,e,this.$k(!0));rc(d,e+2,this.$k(!1));return}console.warn('field named "'+a+'" not found in '+pc(this))},$k:function(a){a=this.G?!a:a;return new g.Ff(a?this.EC:this.FC,this.GC,this.DC,a?"\u201c":"\u201d")}};g.W.Text.bD=function(){this.ag(g.W.Text.Fr);this.NG("TEXT")};
g.W.Text.aD={Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("items",this.Mb);return a},kb:function(a){this.Mb=parseInt(a.getAttribute("items"),10);this.gd()},Uf:function(a){var c=a.cg("text_create_join_container");c.Td();for(var d=E(c,"STACK").connection,e=0;e<this.Mb;e++){var f=a.cg("text_create_join_item");f.Td();d.connect(f.$);d=f.V}return c},Rf:function(a){var c=Bc(a,"STACK");for(a=[];c;)a.push(c.Zn),c=c.V&&C(c.V);for(c=0;c<this.Mb;c++){var d=E(this,"ADD"+c).connection.ka;
d&&-1==a.indexOf(d)&&d.disconnect()}this.Mb=a.length;this.gd();for(c=0;c<this.Mb;c++)g.ac.xj(a[c],this,"ADD"+c)},An:function(a){a=Bc(a,"STACK");for(var c=0;a;){var d=E(this,"ADD"+c);a.Zn=d&&d.connection.ka;c++;a=a.V&&C(a.V)}},gd:function(){this.Mb&&E(this,"EMPTY")?this.ob("EMPTY"):this.Mb||E(this,"EMPTY")||I(I(L(this,"EMPTY"),this.$k(!0)),this.$k(!1));for(var a=0;a<this.Mb;a++)if(!E(this,"ADD"+a)){var c=K(this,"ADD"+a);0==a&&I(c,g.h.TEXT_JOIN_TITLE_CREATEWITH)}for(;E(this,"ADD"+a);)this.ob("ADD"+
a),a++}};g.W.Text.$C=function(){this.ag(g.W.Text.Fr);this.Mb=2;this.gd();this.il(new g.ac(["text_create_join_item"]))};g.Z.register("text_append_tooltip",g.Z.bp("%{BKY_TEXT_APPEND_TOOLTIP}"));g.W.Text.ZC=function(){var a=this;this.Ha(function(){return g.h.TEXT_INDEXOF_TOOLTIP.replace("%1",a.v.options.Hd?"0":"-1")})};
g.W.Text.YC={Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at",!!this.cz);return a},kb:function(a){a="false"!=a.getAttribute("at");this.Ub(a)},Ub:function(a){this.ob("AT",!0);this.ob("ORDINAL",!0);a&&(K(this,"AT").Za("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&I(L(this,"ORDINAL"),g.h.ORDINAL_NUMBER_SUFFIX));g.h.TEXT_CHARAT_TAIL&&(this.ob("TAIL",!0),I(L(this,"TAIL"),g.h.TEXT_CHARAT_TAIL));this.cz=a}};
g.W.Text.XC=function(){vb(B(this,"WHERE"),function(c){c="FROM_START"==c||"FROM_END"==c;c!=this.cz&&this.B.Ub(c)});this.Ub(!0);var a=this;this.Ha(function(){var c=z(a,"WHERE"),d=g.h.TEXT_CHARAT_TOOLTIP;("FROM_START"==c||"FROM_END"==c)&&(c="FROM_START"==c?g.h.LISTS_INDEX_FROM_START_TOOLTIP:g.h.LISTS_INDEX_FROM_END_TOOLTIP)&&(d+="  "+c.replace("%1",a.v.options.Hd?"#1":"#0"));return d})};g.Z.register("text_indexOf_tooltip",g.W.Text.ZC);g.Z.register("text_quotes",g.W.Text.bD);
g.Z.xn("text_join_mutator",g.W.Text.aD,g.W.Text.$C);g.Z.xn("text_charAt_mutator",g.W.Text.YC,g.W.Text.XC);g.N.AH={};g.W.O={};g.W.O.bk=330;
g.Eh([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,
style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);
g.W.O.mB={Mg:function(a){if(!this.ec){if("variables_get"==this.type)var c="variables_set",d=g.h.VARIABLES_GET_CREATE_SET;else c="variables_get",d=g.h.VARIABLES_SET_CREATE_GET;var e={enabled:0<ya(this.v)},f=B(this,"VAR").dc();e.text=d.replace("%1",f);d=g.g.xml.createElement("field");d.setAttribute("name","VAR");d.appendChild(g.g.xml.createTextNode(f));f=g.g.xml.createElement("block");f.setAttribute("type",c);f.appendChild(d);e.Gb=g.Fa.cp(this,f);a.push(e)}else if("variables_get"==this.type||"variables_get_reporter"==
this.type)c={text:g.h.RK,enabled:!0,Gb:g.W.O.JC(this)},f=B(this,"VAR").dc(),e={text:g.h.oI.replace("%1",f),enabled:!0,Gb:g.W.O.sB(this)},a.unshift(c),a.unshift(e)}};g.W.O.JC=function(a){return function(){var c=a.v,d=B(a,"VAR").ad();g.O.uq(c,d)}};g.W.O.sB=function(a){return function(){var c=a.v,d=B(a,"VAR").ad();c.Vf(d.wa());kd(c)}};g.Z.rq("contextMenu_variableSetterGetter",g.W.O.mB);g.Generator=function(a){this.hG=a;this.DB=new RegExp(this.hc,"g")};g.Generator.Fb="generated_function";b=g.Generator.prototype;b.Go=null;b.Ld=null;b.Yc=null;b.xd="  ";b.dB=60;b.Po=[];
function $d(){var a=g.j,c=H;c||(console.warn("No workspace specified in workspaceToCode call.  Guessing."),c=g.Hb());var d=[];a.U(c);c=A(c,!0);for(var e=0,f;f=c[e];e++){var h=De(a,f);Array.isArray(h)&&(h=h[0]);h&&(f.L&&(h=a.dA(h),a.Ld&&!f.ki&&(h=W(a.Ld,f)+h),a.Yc&&!f.ki&&(h+=W(a.Yc,f))),d.push(h))}d=d.join("\n");d=a.finish(d);d=d.replace(/^\s+\n/,"");d=d.replace(/\n\s+$/,"\n");return d=d.replace(/[ \t]+\n/g,"\n")}function Ee(a,c){return c+a.replace(/(?!\n$)\n/g,"\n"+c)}
function De(a,c){if(!c)return"";if(!c.isEnabled())return De(a,q(c));var d=a[c.type];if("function"!=typeof d)throw Error('Language "'+a.hG+'" does not know how to generate  code for block type "'+c.type+'".');d=d.call(c,c);if(Array.isArray(d)){if(!c.L)throw TypeError("Expecting string from statement block: "+c.type);return[a.xq(c,d[0],void 0),d[1]]}if("string"==typeof d)return a.Ld&&!c.ki&&(d=W(a.Ld,c)+d),a.Yc&&!c.ki&&(d+=W(a.Yc,c)),a.xq(c,d,void 0);if(null===d)return"";throw SyntaxError("Invalid code generated: "+
d);}
function X(a,c,d){var e=g.j;if(isNaN(d))throw TypeError("Expecting valid order from block: "+a.type);var f=Bc(a,c);if(!f)return"";c=De(e,f);if(""===c)return"";if(!Array.isArray(c))throw TypeError("Expecting tuple from value block: "+f.type);a=c[0];c=c[1];if(isNaN(c))throw TypeError("Expecting valid order from value block: "+f.type);if(!a)return"";f=!1;var h=Math.floor(d),k=Math.floor(c);if(h<=k&&(h!=k||0!=h&&99!=h))for(f=!0,h=0;h<e.Po.length;h++)if(e.Po[h][0]==d&&e.Po[h][1]==c){f=!1;break}f&&(a="("+
a+")");return a}function Fe(a,c){var d=g.j;a=Bc(a,c);c=De(d,a);if("string"!=typeof c)throw TypeError("Expecting code from statement block: "+(a&&a.type));c&&(c=Ee(c,d.xd));return c}function Ge(a,c){var d=g.j;d.Go&&(a=Ee(W(d.Go,c),d.xd)+a);d.Yc&&!c.ki&&(a=Ee(W(d.Yc,c),d.xd)+a);d.Ld&&!c.ki&&(a+=Ee(W(d.Ld,c),d.xd));return a}function W(a,c){c=c.id.replace(/\$/g,"$$$$");return a.replace(/%1/g,"'"+c+"'")}b.Gr="";function He(a){var c=g.j;c.Gr+=a+","}b.hc="{leCUI8hutHZI4480Dc}";
function Y(a,c){var d=g.j;if(!d.Ti[a]){var e=vd(d.Jd,a,g.Ka.Fb);d.kt[a]=e;c=c.join("\n").replace(d.DB,e);for(var f;f!=c;)f=c,c=c.replace(/^(( {2})*) {2}/gm,"$1\x00");c=c.replace(/\0/g,d.xd);d.Ti[a]=c}return d.kt[a]}b.U=function(){};b.xq=function(a,c){return c};b.finish=function(a){return a};b.dA=function(a){return a};g.j=new g.Generator("JavaScript");He("Blockly,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,enum,export,extends,import,super,implements,interface,let,package,private,protected,public,static,yield,const,null,true,false,Array,ArrayBuffer,Boolean,Date,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Error,eval,EvalError,Float32Array,Float64Array,Function,Infinity,Int16Array,Int32Array,Int8Array,isFinite,isNaN,Iterator,JSON,Math,NaN,Number,Object,parseFloat,parseInt,RangeError,ReferenceError,RegExp,StopIteration,String,SyntaxError,TypeError,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray,undefined,uneval,URIError,applicationCache,closed,Components,content,_content,controllers,crypto,defaultStatus,dialogArguments,directories,document,frameElement,frames,fullScreen,globalStorage,history,innerHeight,innerWidth,length,location,locationbar,localStorage,menubar,messageManager,mozAnimationStartTime,mozInnerScreenX,mozInnerScreenY,mozPaintCount,name,navigator,opener,outerHeight,outerWidth,pageXOffset,pageYOffset,parent,performance,personalbar,pkcs11,returnValue,screen,screenX,screenY,scrollbars,scrollMaxX,scrollMaxY,scrollX,scrollY,self,sessionStorage,sidebar,status,statusbar,toolbar,top,URL,window,addEventListener,alert,atob,back,blur,btoa,captureEvents,clearImmediate,clearInterval,clearTimeout,close,confirm,disableExternalCapture,dispatchEvent,dump,enableExternalCapture,escape,find,focus,forward,GeckoActiveXObject,getAttention,getAttentionWithCycleCount,getComputedStyle,getSelection,home,matchMedia,maximize,minimize,moveBy,moveTo,mozRequestAnimationFrame,open,openDialog,postMessage,print,prompt,QueryInterface,releaseEvents,removeEventListener,resizeBy,resizeTo,restore,routeEvent,scroll,scrollBy,scrollByLines,scrollByPages,scrollTo,setCursor,setImmediate,setInterval,setResizable,setTimeout,showModalDialog,sizeToContent,stop,unescape,updateCommands,XPCNativeWrapper,XPCSafeJSObjectWrapper,onabort,onbeforeunload,onblur,onchange,onclick,onclose,oncontextmenu,ondevicemotion,ondeviceorientation,ondragdrop,onerror,onfocus,onhashchange,onkeydown,onkeypress,onkeyup,onload,onmousedown,onmousemove,onmouseout,onmouseover,onmouseup,onmozbeforepaint,onpaint,onpopstate,onreset,onresize,onscroll,onselect,onsubmit,onunload,onpageshow,onpagehide,Image,Option,Worker,Event,Range,File,FileReader,Blob,BlobBuilder,Attr,CDATASection,CharacterData,Comment,console,DocumentFragment,DocumentType,DomConfiguration,DOMError,DOMErrorHandler,DOMException,DOMImplementation,DOMImplementationList,DOMImplementationRegistry,DOMImplementationSource,DOMLocator,DOMObject,DOMString,DOMStringList,DOMTimeStamp,DOMUserData,Entity,EntityReference,MediaQueryList,MediaQueryListListener,NameList,NamedNodeMap,Node,NodeFilter,NodeIterator,NodeList,Notation,Plugin,PluginArray,ProcessingInstruction,SharedWorker,Text,TimeRanges,Treewalker,TypeInfo,UserDataHandler,Worker,WorkerGlobalScope,HTMLDocument,HTMLElement,HTMLAnchorElement,HTMLAppletElement,HTMLAudioElement,HTMLAreaElement,HTMLBaseElement,HTMLBaseFontElement,HTMLBodyElement,HTMLBRElement,HTMLButtonElement,HTMLCanvasElement,HTMLDirectoryElement,HTMLDivElement,HTMLDListElement,HTMLEmbedElement,HTMLFieldSetElement,HTMLFontElement,HTMLFormElement,HTMLFrameElement,HTMLFrameSetElement,HTMLHeadElement,HTMLHeadingElement,HTMLHtmlElement,HTMLHRElement,HTMLIFrameElement,HTMLImageElement,HTMLInputElement,HTMLKeygenElement,HTMLLabelElement,HTMLLIElement,HTMLLinkElement,HTMLMapElement,HTMLMenuElement,HTMLMetaElement,HTMLModElement,HTMLObjectElement,HTMLOListElement,HTMLOptGroupElement,HTMLOptionElement,HTMLOutputElement,HTMLParagraphElement,HTMLParamElement,HTMLPreElement,HTMLQuoteElement,HTMLScriptElement,HTMLSelectElement,HTMLSourceElement,HTMLSpanElement,HTMLStyleElement,HTMLTableElement,HTMLTableCaptionElement,HTMLTableCellElement,HTMLTableDataCellElement,HTMLTableHeaderCellElement,HTMLTableColElement,HTMLTableRowElement,HTMLTableSectionElement,HTMLTextAreaElement,HTMLTimeElement,HTMLTitleElement,HTMLTrackElement,HTMLUListElement,HTMLUnknownElement,HTMLVideoElement,HTMLCanvasElement,CanvasRenderingContext2D,CanvasGradient,CanvasPattern,TextMetrics,ImageData,CanvasPixelArray,HTMLAudioElement,HTMLVideoElement,NotifyAudioAvailableEvent,HTMLCollection,HTMLAllCollection,HTMLFormControlsCollection,HTMLOptionsCollection,HTMLPropertiesCollection,DOMTokenList,DOMSettableTokenList,DOMStringMap,RadioNodeList,SVGDocument,SVGElement,SVGAElement,SVGAltGlyphElement,SVGAltGlyphDefElement,SVGAltGlyphItemElement,SVGAnimationElement,SVGAnimateElement,SVGAnimateColorElement,SVGAnimateMotionElement,SVGAnimateTransformElement,SVGSetElement,SVGCircleElement,SVGClipPathElement,SVGColorProfileElement,SVGCursorElement,SVGDefsElement,SVGDescElement,SVGEllipseElement,SVGFilterElement,SVGFilterPrimitiveStandardAttributes,SVGFEBlendElement,SVGFEColorMatrixElement,SVGFEComponentTransferElement,SVGFECompositeElement,SVGFEConvolveMatrixElement,SVGFEDiffuseLightingElement,SVGFEDisplacementMapElement,SVGFEDistantLightElement,SVGFEFloodElement,SVGFEGaussianBlurElement,SVGFEImageElement,SVGFEMergeElement,SVGFEMergeNodeElement,SVGFEMorphologyElement,SVGFEOffsetElement,SVGFEPointLightElement,SVGFESpecularLightingElement,SVGFESpotLightElement,SVGFETileElement,SVGFETurbulenceElement,SVGComponentTransferFunctionElement,SVGFEFuncRElement,SVGFEFuncGElement,SVGFEFuncBElement,SVGFEFuncAElement,SVGFontElement,SVGFontFaceElement,SVGFontFaceFormatElement,SVGFontFaceNameElement,SVGFontFaceSrcElement,SVGFontFaceUriElement,SVGForeignObjectElement,SVGGElement,SVGGlyphElement,SVGGlyphRefElement,SVGGradientElement,SVGLinearGradientElement,SVGRadialGradientElement,SVGHKernElement,SVGImageElement,SVGLineElement,SVGMarkerElement,SVGMaskElement,SVGMetadataElement,SVGMissingGlyphElement,SVGMPathElement,SVGPathElement,SVGPatternElement,SVGPolylineElement,SVGPolygonElement,SVGRectElement,SVGScriptElement,SVGStopElement,SVGStyleElement,SVGSVGElement,SVGSwitchElement,SVGSymbolElement,SVGTextElement,SVGTextPathElement,SVGTitleElement,SVGTRefElement,SVGTSpanElement,SVGUseElement,SVGViewElement,SVGVKernElement,SVGAngle,SVGColor,SVGICCColor,SVGElementInstance,SVGElementInstanceList,SVGLength,SVGLengthList,SVGMatrix,SVGNumber,SVGNumberList,SVGPaint,SVGPoint,SVGPointList,SVGPreserveAspectRatio,SVGRect,SVGStringList,SVGTransform,SVGTransformList,SVGAnimatedAngle,SVGAnimatedBoolean,SVGAnimatedEnumeration,SVGAnimatedInteger,SVGAnimatedLength,SVGAnimatedLengthList,SVGAnimatedNumber,SVGAnimatedNumberList,SVGAnimatedPreserveAspectRatio,SVGAnimatedRect,SVGAnimatedString,SVGAnimatedTransformList,SVGPathSegList,SVGPathSeg,SVGPathSegArcAbs,SVGPathSegArcRel,SVGPathSegClosePath,SVGPathSegCurvetoCubicAbs,SVGPathSegCurvetoCubicRel,SVGPathSegCurvetoCubicSmoothAbs,SVGPathSegCurvetoCubicSmoothRel,SVGPathSegCurvetoQuadraticAbs,SVGPathSegCurvetoQuadraticRel,SVGPathSegCurvetoQuadraticSmoothAbs,SVGPathSegCurvetoQuadraticSmoothRel,SVGPathSegLinetoAbs,SVGPathSegLinetoHorizontalAbs,SVGPathSegLinetoHorizontalRel,SVGPathSegLinetoRel,SVGPathSegLinetoVerticalAbs,SVGPathSegLinetoVerticalRel,SVGPathSegMovetoAbs,SVGPathSegMovetoRel,ElementTimeControl,TimeEvent,SVGAnimatedPathData,SVGAnimatedPoints,SVGColorProfileRule,SVGCSSRule,SVGExternalResourcesRequired,SVGFitToViewBox,SVGLangSpace,SVGLocatable,SVGRenderingIntent,SVGStylable,SVGTests,SVGTextContentElement,SVGTextPositioningElement,SVGTransformable,SVGUnitTypes,SVGURIReference,SVGViewSpec,SVGZoomAndPan");
g.j.Ye=0;g.j.tK=1.1;g.j.ab=1.2;g.j.Aa=2;g.j.rK=3;g.j.nK=3;g.j.jK=4.1;g.j.vK=4.2;g.j.Sl=4.3;g.j.lk=4.4;g.j.uK=4.5;g.j.wK=4.6;g.j.oK=4.7;g.j.hK=4.8;g.j.pK=5;g.j.Ar=5.1;g.j.Ql=5.2;g.j.Rl=5.3;g.j.zg=6.1;g.j.yg=6.2;g.j.lK=7;g.j.xC=8;g.j.qK=8;g.j.sK=8;g.j.mw=9;g.j.iK=10;g.j.mK=11;g.j.kK=12;g.j.yr=13;g.j.zr=14;g.j.Oo=15;g.j.yi=16;g.j.xK=17;g.j.vb=18;g.j.zb=99;g.j.Po=[[g.j.Aa,g.j.ab],[g.j.Aa,g.j.Aa],[g.j.ab,g.j.ab],[g.j.ab,g.j.Aa],[g.j.lk,g.j.lk],[g.j.Ar,g.j.Ar],[g.j.yg,g.j.yg],[g.j.yr,g.j.yr],[g.j.zr,g.j.zr]];
g.j.U=function(a){g.j.Ti=Object.create(null);g.j.kt=Object.create(null);g.j.Jd?g.j.Jd.reset():g.j.Jd=new g.fe(g.j.Gr);g.j.Jd.Va=a.Va;for(var c=[],d=g.O.vD(a),e=0;e<d.length;e++)c.push(ud(d[e],g.fe.dr));a=g.O.Tw(a);for(e=0;e<a.length;e++)c.push(ud(a[e].wa(),g.O.Fb));c.length&&(g.j.Ti.variables="var "+c.join(", ")+";")};g.j.finish=function(a){var c=[],d;for(d in g.j.Ti)c.push(g.j.Ti[d]);delete g.j.Ti;delete g.j.kt;g.j.Jd.reset();return c.join("\n\n")+"\n\n\n"+a};g.j.dA=function(a){return a+";\n"};
g.j.wj=function(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,"\\'");return"'"+a+"'"};g.j.dG=function(a){return a.split(/\n/g).map(g.j.wj).join(" + '\\n' +\n")};
g.j.xq=function(a,c,d){var e="";if(!a.L||!a.L.ka){var f=a.He.text;f&&(f=g.g.ib.EA(f,g.j.dB-3),e+=Ee(f+"\n","// "));for(var h=0;h<a.S.length;h++)if(a.S[h].type==g.Ra){var k=C(a.S[h].connection);if(k){f=[];k=p(k,!0);for(var l=0;l<k.length;l++){var m=k[l].He.text;m&&f.push(m)}f.length&&f.push("");(f=f.join("\n"))&&(e+=Ee(f,"// "))}}}a=a.V&&C(a.V);d=d?"":De(g.j,a);return e+c+d};
g.j.Mc=function(a,c,d,e,f){d=d||0;f=f||g.j.zb;a.v.options.Hd&&d--;var h=a.v.options.Hd?"1":"0";a=0<d?X(a,c,g.j.yg)||h:0>d?X(a,c,g.j.zg)||h:e?X(a,c,g.j.Sl)||h:X(a,c,f)||h;if(g.Vh(a))a=Number(a)+d,e&&(a=-a);else{if(0<d){a=a+" + "+d;var k=g.j.yg}else 0>d&&(a=a+" - "+-d,k=g.j.zg);e&&(a=d?"-("+a+")":"-"+a,k=g.j.Sl);k=Math.floor(k);f=Math.floor(f);k&&f>=k&&(a="("+a+")")}return a};g.j.Ab={};g.j.colour_picker=function(a){return[g.j.wj(z(a,"COLOUR")),g.j.Ye]};g.j.colour_random=function(){return[Y("colourRandom",["function "+g.j.hc+"() {","  var num = Math.floor(Math.random() * Math.pow(2, 24));","  return '#' + ('00000' + num.toString(16)).substr(-6);","}"])+"()",g.j.Aa]};
g.j.colour_rgb=function(a){var c=X(a,"RED",g.j.vb)||0,d=X(a,"GREEN",g.j.vb)||0;a=X(a,"BLUE",g.j.vb)||0;return[Y("colourRgb",["function "+g.j.hc+"(r, g, b) {","  r = Math.max(Math.min(Number(r), 100), 0) * 2.55;","  g = Math.max(Math.min(Number(g), 100), 0) * 2.55;","  b = Math.max(Math.min(Number(b), 100), 0) * 2.55;","  r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);","  g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);","  b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);",
"  return '#' + r + g + b;","}"])+"("+c+", "+d+", "+a+")",g.j.Aa]};
g.j.colour_blend=function(a){var c=X(a,"COLOUR1",g.j.vb)||"'#000000'",d=X(a,"COLOUR2",g.j.vb)||"'#000000'";a=X(a,"RATIO",g.j.vb)||.5;return[Y("colourBlend",["function "+g.j.hc+"(c1, c2, ratio) {","  ratio = Math.max(Math.min(Number(ratio), 1), 0);","  var r1 = parseInt(c1.substring(1, 3), 16);","  var g1 = parseInt(c1.substring(3, 5), 16);","  var b1 = parseInt(c1.substring(5, 7), 16);","  var r2 = parseInt(c2.substring(1, 3), 16);","  var g2 = parseInt(c2.substring(3, 5), 16);","  var b2 = parseInt(c2.substring(5, 7), 16);",
"  var r = Math.round(r1 * (1 - ratio) + r2 * ratio);","  var g = Math.round(g1 * (1 - ratio) + g2 * ratio);","  var b = Math.round(b1 * (1 - ratio) + b2 * ratio);","  r = ('0' + (r || 0).toString(16)).slice(-2);","  g = ('0' + (g || 0).toString(16)).slice(-2);","  b = ('0' + (b || 0).toString(16)).slice(-2);","  return '#' + r + g + b;","}"])+"("+c+", "+d+", "+a+")",g.j.Aa]};g.j.Yt={};g.j.lists_create_empty=function(){return["[]",g.j.Ye]};g.j.lists_create_with=function(a){for(var c=Array(a.Mb),d=0;d<a.Mb;d++)c[d]=X(a,"ADD"+d,g.j.vb)||"null";return["["+c.join(", ")+"]",g.j.Ye]};g.j.lists_repeat=function(a){var c=Y("listsRepeat",["function "+g.j.hc+"(value, n) {","  var array = [];","  for (var i = 0; i < n; i++) {","    array[i] = value;","  }","  return array;","}"]),d=X(a,"ITEM",g.j.vb)||"null";a=X(a,"NUM",g.j.vb)||"0";return[c+"("+d+", "+a+")",g.j.Aa]};
g.j.lists_length=function(a){return[(X(a,"VALUE",g.j.ab)||"[]")+".length",g.j.ab]};g.j.lists_isEmpty=function(a){return["!"+(X(a,"VALUE",g.j.ab)||"[]")+".length",g.j.lk]};g.j.lists_indexOf=function(a){var c="FIRST"==z(a,"END")?"indexOf":"lastIndexOf",d=X(a,"FIND",g.j.zb)||"''";c=(X(a,"VALUE",g.j.ab)||"[]")+"."+c+"("+d+")";return a.v.options.Hd?[c+" + 1",g.j.yg]:[c,g.j.Aa]};
g.j.lists_getIndex=function(a){var c=z(a,"MODE")||"GET",d=z(a,"WHERE")||"FROM_START",e=X(a,"VALUE","RANDOM"==d?g.j.vb:g.j.ab)||"[]";switch(d){case "FIRST":if("GET"==c)return[e+"[0]",g.j.ab];if("GET_REMOVE"==c)return[e+".shift()",g.j.ab];if("REMOVE"==c)return e+".shift();\n";break;case "LAST":if("GET"==c)return[e+".slice(-1)[0]",g.j.ab];if("GET_REMOVE"==c)return[e+".pop()",g.j.ab];if("REMOVE"==c)return e+".pop();\n";break;case "FROM_START":a=g.j.Mc(a,"AT");if("GET"==c)return[e+"["+a+"]",g.j.ab];if("GET_REMOVE"==
c)return[e+".splice("+a+", 1)[0]",g.j.Aa];if("REMOVE"==c)return e+".splice("+a+", 1);\n";break;case "FROM_END":a=g.j.Mc(a,"AT",1,!0);if("GET"==c)return[e+".slice("+a+")[0]",g.j.Aa];if("GET_REMOVE"==c)return[e+".splice("+a+", 1)[0]",g.j.Aa];if("REMOVE"==c)return e+".splice("+a+", 1);";break;case "RANDOM":e=Y("listsGetRandomItem",["function "+g.j.hc+"(list, remove) {","  var x = Math.floor(Math.random() * list.length);","  if (remove) {","    return list.splice(x, 1)[0];","  } else {","    return list[x];",
"  }","}"])+"("+e+", "+("GET"!=c)+")";if("GET"==c||"GET_REMOVE"==c)return[e,g.j.Aa];if("REMOVE"==c)return e+";\n"}throw Error("Unhandled combination (lists_getIndex).");};
g.j.lists_setIndex=function(a){function c(){if(d.match(/^\w+$/))return"";var k=vd(g.j.Jd,"tmpList",g.O.Fb),l="var "+k+" = "+d+";\n";d=k;return l}var d=X(a,"LIST",g.j.ab)||"[]",e=z(a,"MODE")||"GET",f=z(a,"WHERE")||"FROM_START",h=X(a,"TO",g.j.yi)||"null";switch(f){case "FIRST":if("SET"==e)return d+"[0] = "+h+";\n";if("INSERT"==e)return d+".unshift("+h+");\n";break;case "LAST":if("SET"==e)return a=c(),a+(d+"["+d+".length - 1] = "+h+";\n");if("INSERT"==e)return d+".push("+h+");\n";break;case "FROM_START":f=
g.j.Mc(a,"AT");if("SET"==e)return d+"["+f+"] = "+h+";\n";if("INSERT"==e)return d+".splice("+f+", 0, "+h+");\n";break;case "FROM_END":f=g.j.Mc(a,"AT",1,!1,g.j.zg);a=c();if("SET"==e)return a+(d+"["+d+".length - "+f+"] = "+h+";\n");if("INSERT"==e)return a+(d+".splice("+d+".length - "+f+", 0, "+h+");\n");break;case "RANDOM":a=c();f=vd(g.j.Jd,"tmpX",g.O.Fb);a+="var "+f+" = Math.floor(Math.random() * "+d+".length);\n";if("SET"==e)return a+(d+"["+f+"] = "+h+";\n");if("INSERT"==e)return a+(d+".splice("+f+
", 0, "+h+");\n")}throw Error("Unhandled combination (lists_setIndex).");};g.j.Yt.tt=function(a,c,d){return"FIRST"==c?"0":"FROM_END"==c?a+".length - 1 - "+d:"LAST"==c?a+".length - 1":d};
g.j.lists_getSublist=function(a){var c=X(a,"LIST",g.j.ab)||"[]",d=z(a,"WHERE1"),e=z(a,"WHERE2");if("FIRST"==d&&"LAST"==e)c+=".slice(0)";else if(c.match(/^\w+$/)||"FROM_END"!=d&&"FROM_START"==e){switch(d){case "FROM_START":var f=g.j.Mc(a,"AT1");break;case "FROM_END":f=g.j.Mc(a,"AT1",1,!1,g.j.zg);f=c+".length - "+f;break;case "FIRST":f="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(e){case "FROM_START":a=g.j.Mc(a,"AT2",1);break;case "FROM_END":a=g.j.Mc(a,"AT2",0,!1,g.j.zg);
a=c+".length - "+a;break;case "LAST":a=c+".length";break;default:throw Error("Unhandled option (lists_getSublist).");}c=c+".slice("+f+", "+a+")"}else{f=g.j.Mc(a,"AT1");a=g.j.Mc(a,"AT2");var h=g.j.Yt.tt,k={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};c=Y("subsequence"+k[d]+k[e],["function "+g.j.hc+"(sequence"+("FROM_END"==d||"FROM_START"==d?", at1":"")+("FROM_END"==e||"FROM_START"==e?", at2":"")+") {","  var start = "+h("sequence",d,"at1")+";","  var end = "+h("sequence",e,
"at2")+" + 1;","  return sequence.slice(start, end);","}"])+"("+c+("FROM_END"==d||"FROM_START"==d?", "+f:"")+("FROM_END"==e||"FROM_START"==e?", "+a:"")+")"}return[c,g.j.Aa]};
g.j.lists_sort=function(a){var c=X(a,"LIST",g.j.Aa)||"[]",d="1"===z(a,"DIRECTION")?1:-1;a=z(a,"TYPE");var e=Y("listsGetSortCompare",["function "+g.j.hc+"(type, direction) {","  var compareFuncs = {",'    "NUMERIC": function(a, b) {',"        return Number(a) - Number(b); },",'    "TEXT": function(a, b) {',"        return a.toString() > b.toString() ? 1 : -1; },",'    "IGNORE_CASE": function(a, b) {',"        return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },","  };","  var compare = compareFuncs[type];",
"  return function(a, b) { return compare(a, b) * direction; }","}"]);return[c+".slice().sort("+e+'("'+a+'", '+d+"))",g.j.Aa]};g.j.lists_split=function(a){var c=X(a,"INPUT",g.j.ab),d=X(a,"DELIM",g.j.zb)||"''";a=z(a,"MODE");if("SPLIT"==a)c||(c="''"),a="split";else if("JOIN"==a)c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+d+")",g.j.Aa]};g.j.lists_reverse=function(a){return[(X(a,"LIST",g.j.Aa)||"[]")+".slice().reverse()",g.j.Aa]};g.j.RF={};g.j.controls_if=function(a){var c=0,d="";g.j.Ld&&(d+=W(g.j.Ld,a));do{var e=X(a,"IF"+c,g.j.zb)||"false";var f=Fe(a,"DO"+c);g.j.Yc&&(f=Ee(W(g.j.Yc,a),g.j.xd)+f);d+=(0<c?" else ":"")+"if ("+e+") {\n"+f+"}";++c}while(E(a,"IF"+c));if(E(a,"ELSE")||g.j.Yc)f=Fe(a,"ELSE"),g.j.Yc&&(f=Ee(W(g.j.Yc,a),g.j.xd)+f),d+=" else {\n"+f+"}";return d+"\n"};g.j.controls_ifelse=g.j.controls_if;
g.j.logic_compare=function(a){var c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[z(a,"OP")],d="=="==c||"!="==c?g.j.mw:g.j.xC,e=X(a,"A",d)||"0";a=X(a,"B",d)||"0";return[e+" "+c+" "+a,d]};g.j.logic_operation=function(a){var c="AND"==z(a,"OP")?"&&":"||",d="&&"==c?g.j.yr:g.j.zr,e=X(a,"A",d);a=X(a,"B",d);if(e||a){var f="&&"==c?"true":"false";e||(e=f);a||(a=f)}else a=e="false";return[e+" "+c+" "+a,d]};g.j.logic_negate=function(a){var c=g.j.lk;return["!"+(X(a,"BOOL",c)||"true"),c]};
g.j.logic_boolean=function(a){return["TRUE"==z(a,"BOOL")?"true":"false",g.j.Ye]};g.j.logic_null=function(){return["null",g.j.Ye]};g.j.logic_ternary=function(a){var c=X(a,"IF",g.j.Oo)||"false",d=X(a,"THEN",g.j.Oo)||"null";a=X(a,"ELSE",g.j.Oo)||"null";return[c+" ? "+d+" : "+a,g.j.Oo]};g.j.TF={};g.j.controls_repeat_ext=function(a){var c=B(a,"TIMES")?String(Number(z(a,"TIMES"))):X(a,"TIMES",g.j.yi)||"0",d=Fe(a,"DO");d=Ge(d,a);a="";var e=vd(g.j.Jd,"count",g.O.Fb),f=c;c.match(/^\w+$/)||g.Vh(c)||(f=vd(g.j.Jd,"repeat_end",g.O.Fb),a+="var "+f+" = "+c+";\n");return a+("for (var "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")};g.j.controls_repeat=g.j.controls_repeat_ext;
g.j.controls_whileUntil=function(a){var c="UNTIL"==z(a,"MODE"),d=X(a,"BOOL",c?g.j.lk:g.j.zb)||"false",e=Fe(a,"DO");e=Ge(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"};
g.j.controls_for=function(a){var c=ud(z(a,"VAR"),g.O.Fb),d=X(a,"FROM",g.j.yi)||"0",e=X(a,"TO",g.j.yi)||"0",f=X(a,"BY",g.j.yi)||"1",h=Fe(a,"DO");h=Ge(h,a);if(g.Vh(d)&&g.Vh(e)&&g.Vh(f)){var k=Number(d)<=Number(e);a="for ("+c+" = "+d+"; "+c+(k?" <= ":" >= ")+e+"; "+c;c=Math.abs(Number(f));a=(1==c?a+(k?"++":"--"):a+((k?" += ":" -= ")+c))+(") {\n"+h+"}\n")}else a="",k=d,d.match(/^\w+$/)||g.Vh(d)||(k=vd(g.j.Jd,c+"_start",g.O.Fb),a+="var "+k+" = "+d+";\n"),d=e,e.match(/^\w+$/)||g.Vh(e)||(d=vd(g.j.Jd,c+"_end",
g.O.Fb),a+="var "+d+" = "+e+";\n"),e=vd(g.j.Jd,c+"_inc",g.O.Fb),a+="var "+e+" = ",a=g.Vh(f)?a+(Math.abs(f)+";\n"):a+("Math.abs("+f+");\n"),a=a+("if ("+k+" > "+d+") {\n")+(g.j.xd+e+" = -"+e+";\n"),a+="}\n",a+="for ("+c+" = "+k+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+h+"}\n";return a};
g.j.controls_forEach=function(a){var c=ud(z(a,"VAR"),g.O.Fb),d=X(a,"LIST",g.j.yi)||"[]",e=Fe(a,"DO");e=Ge(e,a);a="";var f=d;d.match(/^\w+$/)||(f=vd(g.j.Jd,c+"_list",g.O.Fb),a+="var "+f+" = "+d+";\n");d=vd(g.j.Jd,c+"_index",g.O.Fb);e=g.j.xd+c+" = "+f+"["+d+"];\n"+e;return a+("for (var "+d+" in "+f+") {\n"+e+"}\n")};
g.j.controls_flow_statements=function(a){var c="";g.j.Ld&&(c+=W(g.j.Ld,a));g.j.Yc&&(c+=W(g.j.Yc,a));if(g.j.Ld){var d=g.W.Be.to.Fy(a);d&&!d.ki&&(c+=W(g.j.Ld,d))}switch(z(a,"FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");};g.j.dd={};g.j.math_number=function(a){a=Number(z(a,"NUM"));return[a,0<=a?g.j.Ye:g.j.Sl]};g.j.math_arithmetic=function(a){var c={ADD:[" + ",g.j.yg],MINUS:[" - ",g.j.zg],MULTIPLY:[" * ",g.j.Ar],DIVIDE:[" / ",g.j.Ql],POWER:[null,g.j.vb]}[z(a,"OP")],d=c[0];c=c[1];var e=X(a,"A",c)||"0";a=X(a,"B",c)||"0";return d?[e+d+a,c]:["Math.pow("+e+", "+a+")",g.j.Aa]};
g.j.math_single=function(a){var c=z(a,"OP");if("NEG"==c)return a=X(a,"NUM",g.j.Sl)||"0","-"==a[0]&&(a=" "+a),["-"+a,g.j.Sl];a="SIN"==c||"COS"==c||"TAN"==c?X(a,"NUM",g.j.Ql)||"0":X(a,"NUM",g.j.zb)||"0";switch(c){case "ABS":var d="Math.abs("+a+")";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+a+")";break;case "POW10":d="Math.pow(10,"+a+")";break;case "ROUND":d="Math.round("+a+")";break;case "ROUNDUP":d="Math.ceil("+a+")";break;case "ROUNDDOWN":d=
"Math.floor("+a+")";break;case "SIN":d="Math.sin("+a+" / 180 * Math.PI)";break;case "COS":d="Math.cos("+a+" / 180 * Math.PI)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.PI)"}if(d)return[d,g.j.Aa];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.PI * 180";break;case "ACOS":d="Math.acos("+a+") / Math.PI * 180";break;case "ATAN":d="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,g.j.Ql]};
g.j.math_constant=function(a){return{PI:["Math.PI",g.j.ab],E:["Math.E",g.j.ab],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",g.j.Ql],SQRT2:["Math.SQRT2",g.j.ab],SQRT1_2:["Math.SQRT1_2",g.j.ab],INFINITY:["Infinity",g.j.Ye]}[z(a,"CONSTANT")]};
g.j.math_number_property=function(a){var c=X(a,"NUMBER_TO_CHECK",g.j.Rl)||"0",d=z(a,"PROPERTY");if("PRIME"==d){var e=Y("mathIsPrime",["function "+g.j.hc+"(n) {","  // https://en.wikipedia.org/wiki/Primality_test#Naive_methods","  if (n == 2 || n == 3) {","    return true;","  }","  // False if n is NaN, negative, is 1, or not whole.","  // And false if n is divisible by 2 or 3.","  if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {","    return false;","  }","  // Check all the numbers of form 6k +/- 1, up to sqrt(n).",
"  for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {","    if (n % (x - 1) == 0 || n % (x + 1) == 0) {","      return false;","    }","  }","  return true;","}"])+"("+c+")";return[e,g.j.Aa]}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=X(a,"DIVISOR",g.j.Rl)||"0",e=c+" % "+a+" == 0"}return[e,g.j.mw]};
g.j.math_change=function(a){var c=X(a,"DELTA",g.j.yg)||"0";a=ud(z(a,"VAR"),g.O.Fb);return a+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+c+";\n"};g.j.math_round=g.j.math_single;g.j.math_trig=g.j.math_single;
g.j.math_on_list=function(a){var c=z(a,"OP");switch(c){case "SUM":a=X(a,"LIST",g.j.ab)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=X(a,"LIST",g.j.vb)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=X(a,"LIST",g.j.vb)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":c=Y("mathMean",["function "+g.j.hc+"(myList) {","  return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]);a=X(a,"LIST",g.j.zb)||"[]";a=c+"("+a+")";break;case "MEDIAN":c=
Y("mathMedian",["function "+g.j.hc+"(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=X(a,"LIST",g.j.zb)||"[]";a=c+"("+a+")";break;case "MODE":c=Y("mathModes",["function "+
g.j.hc+"(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=X(a,"LIST",g.j.zb)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=Y("mathStandardDeviation",["function "+g.j.hc+"(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=X(a,"LIST",g.j.zb)||"[]";a=c+"("+a+")";break;case "RANDOM":c=Y("mathRandomList",["function "+g.j.hc+"(list) {","  var x = Math.floor(Math.random() * list.length);","  return list[x];","}"]);a=X(a,"LIST",g.j.zb)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,g.j.Aa]};g.j.math_modulo=function(a){var c=X(a,"DIVIDEND",g.j.Rl)||"0";a=X(a,"DIVISOR",g.j.Rl)||"0";return[c+" % "+a,g.j.Rl]};
g.j.math_constrain=function(a){var c=X(a,"VALUE",g.j.vb)||"0",d=X(a,"LOW",g.j.vb)||"0";a=X(a,"HIGH",g.j.vb)||"Infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",g.j.Aa]};
g.j.math_random_int=function(a){var c=X(a,"FROM",g.j.vb)||"0";a=X(a,"TO",g.j.vb)||"0";return[Y("mathRandomInt",["function "+g.j.hc+"(a, b) {","  if (a > b) {","    // Swap a and b to ensure a is smaller.","    var c = a;","    a = b;","    b = c;","  }","  return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+c+", "+a+")",g.j.Aa]};g.j.math_random_float=function(){return["Math.random()",g.j.Aa]};
g.j.math_atan2=function(a){var c=X(a,"X",g.j.vb)||"0";return["Math.atan2("+(X(a,"Y",g.j.vb)||"0")+", "+c+") / Math.PI * 180",g.j.Ql]};g.j.MG={};g.j.procedures_defreturn=function(a){var c=ud(z(a,"NAME"),g.Ka.Fb),d="";g.j.Ld&&(d+=W(g.j.Ld,a));g.j.Yc&&(d+=W(g.j.Yc,a));d&&(d=Ee(d,g.j.xd));var e="";g.j.Go&&(e=Ee(W(g.j.Go,a),g.j.xd));var f=Fe(a,"STACK"),h=X(a,"RETURN",g.j.zb)||"",k="";f&&h&&(k=d);h&&(h=g.j.xd+"return "+h+";\n");for(var l=[],m=0;m<a.Ma.length;m++)l[m]=ud(a.Ma[m],g.O.Fb);d="function "+c+"("+l.join(", ")+") {\n"+d+e+f+k+h+"}";d=g.j.xq(a,d);g.j.Ti["%"+c]=d;return null};g.j.procedures_defnoreturn=g.j.procedures_defreturn;
g.j.procedures_callreturn=function(a){for(var c=ud(z(a,"NAME"),g.Ka.Fb),d=[],e=0;e<a.Ma.length;e++)d[e]=X(a,"ARG"+e,g.j.vb)||"null";return[c+"("+d.join(", ")+")",g.j.Aa]};g.j.procedures_callnoreturn=function(a){return g.j.procedures_callreturn(a)[0]+";\n"};g.j.procedures_ifreturn=function(a){var c="if ("+(X(a,"CONDITION",g.j.zb)||"false")+") {\n";g.j.Yc&&(c+=Ee(W(g.j.Yc,a),g.j.xd));a.Mh?(a=X(a,"VALUE",g.j.zb)||"null",c+=g.j.xd+"return "+a+";\n"):c+=g.j.xd+"return;\n";return c+"}\n"};g.j.qH={};g.j.text=function(a){return[g.j.wj(z(a,"TEXT")),g.j.Ye]};g.j.text_multiline=function(a){a=g.j.dG(z(a,"TEXT"));a.includes("\n")&&(a="("+a+")");return[a,g.j.Ye]};g.j.text.Ik=function(a){return g.j.text.Ik.kH.test(a)?a:"String("+a+")"};g.j.text.Ik.kH=/^\s*'([^']|\\')*'\s*$/;
g.j.text_join=function(a){switch(a.Mb){case 0:return["''",g.j.Ye];case 1:return a=X(a,"ADD0",g.j.zb)||"''",a=g.j.text.Ik(a),[a,g.j.Aa];case 2:var c=X(a,"ADD0",g.j.zb)||"''";a=X(a,"ADD1",g.j.zb)||"''";a=g.j.text.Ik(c)+" + "+g.j.text.Ik(a);return[a,g.j.yg];default:c=Array(a.Mb);for(var d=0;d<a.Mb;d++)c[d]=X(a,"ADD"+d,g.j.vb)||"''";a="["+c.join(",")+"].join('')";return[a,g.j.Aa]}};g.j.text_append=function(a){var c=ud(z(a,"VAR"),g.O.Fb);a=X(a,"TEXT",g.j.zb)||"''";return c+" += "+g.j.text.Ik(a)+";\n"};
g.j.text_length=function(a){return[(X(a,"VALUE",g.j.Aa)||"''")+".length",g.j.ab]};g.j.text_isEmpty=function(a){return["!"+(X(a,"VALUE",g.j.ab)||"''")+".length",g.j.lk]};g.j.text_indexOf=function(a){var c="FIRST"==z(a,"END")?"indexOf":"lastIndexOf",d=X(a,"FIND",g.j.zb)||"''";c=(X(a,"VALUE",g.j.ab)||"''")+"."+c+"("+d+")";return a.v.options.Hd?[c+" + 1",g.j.yg]:[c,g.j.Aa]};
g.j.text_charAt=function(a){var c=z(a,"WHERE")||"FROM_START",d=X(a,"VALUE","RANDOM"==c?g.j.zb:g.j.ab)||"''";switch(c){case "FIRST":return[d+".charAt(0)",g.j.Aa];case "LAST":return[d+".slice(-1)",g.j.Aa];case "FROM_START":return a=g.j.Mc(a,"AT"),[d+".charAt("+a+")",g.j.Aa];case "FROM_END":return a=g.j.Mc(a,"AT",1,!0),[d+".slice("+a+").charAt(0)",g.j.Aa];case "RANDOM":return d=Y("textRandomLetter",["function "+g.j.hc+"(text) {","  var x = Math.floor(Math.random() * text.length);","  return text[x];",
"}"])+"("+d+")",[d,g.j.Aa]}throw Error("Unhandled option (text_charAt).");};g.j.text.tt=function(a,c,d){return"FIRST"==c?"0":"FROM_END"==c?a+".length - 1 - "+d:"LAST"==c?a+".length - 1":d};
g.j.text_getSubstring=function(a){var c=X(a,"STRING",g.j.Aa)||"''",d=z(a,"WHERE1"),e=z(a,"WHERE2");if("FIRST"!=d||"LAST"!=e)if(c.match(/^'?\w+'?$/)||"FROM_END"!=d&&"LAST"!=d&&"FROM_END"!=e&&"LAST"!=e){switch(d){case "FROM_START":var f=g.j.Mc(a,"AT1");break;case "FROM_END":f=g.j.Mc(a,"AT1",1,!1,g.j.zg);f=c+".length - "+f;break;case "FIRST":f="0";break;default:throw Error("Unhandled option (text_getSubstring).");}switch(e){case "FROM_START":a=g.j.Mc(a,"AT2",1);break;case "FROM_END":a=g.j.Mc(a,"AT2",
0,!1,g.j.zg);a=c+".length - "+a;break;case "LAST":a=c+".length";break;default:throw Error("Unhandled option (text_getSubstring).");}c=c+".slice("+f+", "+a+")"}else{f=g.j.Mc(a,"AT1");a=g.j.Mc(a,"AT2");var h=g.j.text.tt,k={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};c=Y("subsequence"+k[d]+k[e],["function "+g.j.hc+"(sequence"+("FROM_END"==d||"FROM_START"==d?", at1":"")+("FROM_END"==e||"FROM_START"==e?", at2":"")+") {","  var start = "+h("sequence",d,"at1")+";","  var end = "+
h("sequence",e,"at2")+" + 1;","  return sequence.slice(start, end);","}"])+"("+c+("FROM_END"==d||"FROM_START"==d?", "+f:"")+("FROM_END"==e||"FROM_START"==e?", "+a:"")+")"}return[c,g.j.Aa]};
g.j.text_changeCase=function(a){var c={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[z(a,"CASE")];a=X(a,"TEXT",c?g.j.ab:g.j.zb)||"''";return[c?a+c:Y("textToTitleCase",["function "+g.j.hc+"(str) {","  return str.replace(/\\S+/g,","      function(txt) {return txt[0].toUpperCase() + txt.substring(1).toLowerCase();});","}"])+"("+a+")",g.j.Aa]};
g.j.text_trim=function(a){var c={LEFT:".replace(/^[\\s\\xa0]+/, '')",RIGHT:".replace(/[\\s\\xa0]+$/, '')",BOTH:".trim()"}[z(a,"MODE")];return[(X(a,"TEXT",g.j.ab)||"''")+c,g.j.Aa]};g.j.text_print=function(a){return"window.alert("+(X(a,"TEXT",g.j.zb)||"''")+");\n"};g.j.text_prompt_ext=function(a){var c="window.prompt("+(B(a,"TEXT")?g.j.wj(z(a,"TEXT")):X(a,"TEXT",g.j.zb)||"''")+")";"NUMBER"==z(a,"TYPE")&&(c="Number("+c+")");return[c,g.j.Aa]};g.j.text_prompt=g.j.text_prompt_ext;
g.j.text_count=function(a){var c=X(a,"TEXT",g.j.ab)||"''";a=X(a,"SUB",g.j.zb)||"''";return[Y("textCount",["function "+g.j.hc+"(haystack, needle) {","  if (needle.length === 0) {","    return haystack.length + 1;","  } else {","    return haystack.split(needle).length - 1;","  }","}"])+"("+c+", "+a+")",g.j.zg]};
g.j.text_replace=function(a){var c=X(a,"TEXT",g.j.ab)||"''",d=X(a,"FROM",g.j.zb)||"''";a=X(a,"TO",g.j.zb)||"''";return[Y("textReplace",["function "+g.j.hc+"(haystack, needle, replacement) {",'  needle = needle.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g,"\\\\$1")','                 .replace(/\\x08/g,"\\\\x08");',"  return haystack.replace(new RegExp(needle, 'g'), replacement);","}"])+"("+c+", "+d+", "+a+")",g.j.ab]};
g.j.text_reverse=function(a){return[(X(a,"TEXT",g.j.ab)||"''")+".split('').reverse().join('')",g.j.ab]};g.j.AH={};g.j.variables_get=function(a){return[ud(z(a,"VAR"),g.O.Fb),g.j.Ye]};g.j.variables_set=function(a){var c=X(a,"VALUE",g.j.yi)||"0";return ud(z(a,"VAR"),g.O.Fb)+" = "+c+";\n"};g.N.turtle_move={U:function(){var a=[[N("Turtle_moveForward"),"moveForward"],[N("Turtle_moveBackward"),"moveBackward"]];this.ed(160);I(K(this,"VALUE").Za("Number"),new g.na(a),"DIR");this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_moveTooltip"))}};g.j.turtle_move=function(a){var c=X(a,"VALUE",g.j.vb)||"0";return z(a,"DIR")+"("+c+", 'block_id_"+a.id+"');\n"};
g.N.turtle_move_internal={U:function(){var a=[[N("Turtle_moveForward"),"moveForward"],[N("Turtle_moveBackward"),"moveBackward"]];this.ed(160);I(I(L(this),new g.na(a),"DIR"),new g.na([["20","20"],["50","50"],["100","100"],["150","150"]]),"VALUE");this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_moveTooltip"))}};g.j.turtle_move_internal=function(a){var c=Number(z(a,"VALUE"));return z(a,"DIR")+"("+c+", 'block_id_"+a.id+"');\n"};
g.N.turtle_turn={U:function(){var a=[[N("Turtle_turnRight"),"turnRight"],[N("Turtle_turnLeft"),"turnLeft"]];a[0][0]+=" \u21bb";a[1][0]+=" \u21ba";this.ed(160);I(K(this,"VALUE").Za("Number"),new g.na(a),"DIR");this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_turnTooltip"))}};g.j.turtle_turn=function(a){var c=X(a,"VALUE",g.j.vb)||"0";return z(a,"DIR")+"("+c+", 'block_id_"+a.id+"');\n"};
g.N.turtle_turn_internal={U:function(){var a=[[N("Turtle_turnRight"),"turnRight"],[N("Turtle_turnLeft"),"turnLeft"]];a[0][0]+=" \u21bb";a[1][0]+=" \u21ba";this.ed(160);I(I(L(this),new g.na(a),"DIR"),new g.na([["1\u00b0","1"],["45\u00b0","45"],["72\u00b0","72"],["90\u00b0","90"],["120\u00b0","120"],["144\u00b0","144"]]),"VALUE");this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_turnTooltip"))}};g.j.turtle_turn_internal=function(a){var c=Number(z(a,"VALUE"));return z(a,"DIR")+"("+c+", 'block_id_"+a.id+"');\n"};
g.N.turtle_width={U:function(){this.ed(160);I(K(this,"WIDTH").Za("Number"),N("Turtle_setWidth"));this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_widthTooltip"))}};g.j.turtle_width=function(a){return"penWidth("+(X(a,"WIDTH",g.j.vb)||"1")+", 'block_id_"+a.id+"');\n"};g.N.turtle_pen={U:function(){zc(this,{message0:"%1",args0:[{type:"field_dropdown",name:"PEN",options:[[N("Turtle_penUp"),"penUp"],[N("Turtle_penDown"),"penDown"]]}],previousStatement:null,nextStatement:null,colour:160,tooltip:N("Turtle_penTooltip")})}};
g.j.turtle_pen=function(a){return z(a,"PEN")+"('block_id_"+a.id+"');\n"};g.N.turtle_colour={U:function(){this.ed(g.h.COLOUR_HUE);I(K(this,"COLOUR").Za("Colour"),N("Turtle_setColour"));this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_colourTooltip"))}};g.j.turtle_colour=function(a){return"penColour("+(X(a,"COLOUR",g.j.vb)||"'#000000'")+", 'block_id_"+a.id+"');\n"};
g.N.turtle_colour_internal={U:function(){this.ed(g.h.COLOUR_HUE);I(I(L(this),N("Turtle_setColour")),new g.Eb("#ff0000"),"COLOUR");this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_colourTooltip"))}};g.j.turtle_colour_internal=function(a){return"penColour("+g.j.wj(z(a,"COLOUR"))+", 'block_id_"+a.id+"');\n"};
g.N.turtle_visibility={U:function(){zc(this,{message0:"%1",args0:[{type:"field_dropdown",name:"VISIBILITY",options:[[N("Turtle_hideTurtle"),"hideTurtle"],[N("Turtle_showTurtle"),"showTurtle"]]}],previousStatement:null,nextStatement:null,colour:160,tooltip:N("Turtle_turtleVisibilityTooltip")})}};g.j.turtle_visibility=function(a){return z(a,"VISIBILITY")+"('block_id_"+a.id+"');\n"};
g.N.turtle_print={U:function(){this.Lb=N("Turtle_printHelpUrl");this.ed(160);I(K(this,"TEXT"),N("Turtle_print"));this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_printTooltip"))}};g.j.turtle_print=function(a){return"print("+String(X(a,"TEXT",g.j.vb)||"''")+", 'block_id_"+a.id+"');\n"};
g.N.turtle_font={U:function(){var a=[[N("Turtle_fontNormal"),"normal"],[N("Turtle_fontItalic"),"italic"],[N("Turtle_fontBold"),"bold"]];this.Lb=N("Turtle_fontHelpUrl");this.ed(160);I(I(L(this),N("Turtle_font")),new g.na([["Arial","Arial"],["Courier New","Courier New"],["Georgia","Georgia"],["Impact","Impact"],["Times New Roman","Times New Roman"],["Trebuchet MS","Trebuchet MS"],["Verdana","Verdana"]]),"FONT");I(I(L(this),N("Turtle_fontSize")),new g.ze(18,1,1E3),"FONTSIZE");I(L(this),new g.na(a),"FONTSTYLE");
this.Ac(!0);this.zc(!0);this.Ha(N("Turtle_fontTooltip"))}};g.j.turtle_font=function(a){var c=g.j.wj(z(a,"FONT")),d=Number(z(a,"FONTSIZE")),e=g.j.wj(z(a,"FONTSTYLE"));return"font("+c+","+d+","+e+", 'block_id_"+a.id+"');\n"};
g.N.turtle_repeat_internal={U:function(){zc(this,{message0:g.h.CONTROLS_REPEAT_TITLE,args0:[{type:"field_dropdown",name:"TIMES",options:[["3","3"],["4","4"],["5","5"],["360","360"]]}],previousStatement:null,nextStatement:null,colour:g.h.LOOPS_HUE,tooltip:g.h.CONTROLS_REPEAT_TOOLTIP,helpUrl:g.h.CONTROLS_REPEAT_HELPURL});I(this.cf(g.Sa,"DO"),g.h.CONTROLS_REPEAT_INPUT_DO)}};g.j.turtle_repeat_internal=g.j.controls_repeat;var Ie=Ie||{};function Le(a,c){function d(){}d.prototype=c.prototype;a.w=c.prototype;a.prototype=new d;a.prototype.constructor=a;a.JL=function(e,f,h){return c.prototype[f].apply(e,Array.prototype.slice.call(arguments,2))}}if(!Me){var Me,Ne="";"undefined"!==typeof navigator&&navigator&&"string"==typeof navigator.userAgent&&(Ne=navigator.userAgent);var Oe=0==Ne.indexOf("Opera");Me={dM:{dJ:"ScriptEngine"in window},fK:Oe,wg:!Oe&&-1!=Ne.indexOf("MSIE"),Wr:!Oe&&-1!=Ne.indexOf("WebKit")}}if(!Pe)var Pe={};
if(!Qe)var Qe={};if(!Re)var Re={};if(!Se)var Se={};if(!Te)var Te={};if(!Ue)var Ue={};var Ve=Ie.lI?{kM:!0}:{};function We(){throw Error("Do not instantiate directly");}We.prototype.tx=null;We.prototype.toString=function(){return this.content};function Xe(a){if(null!=a)switch(a.tx){case 1:return 1;case -1:return-1;case 0:return 0}return null}function Ye(){We.call(this)}Le(Ye,We);Ye.prototype.aE=Ve;function Z(a){return null!=a&&a.aE===Ve?a:Ze(String(String(a)).replace($e,af),Xe(a))}
var Ze=function(a){function c(){}c.prototype=a.prototype;return function(d,e){var f=new c;f.content=String(d);void 0!==e&&(f.tx=e);return f}}(Ye),bf={"\x00":"&#0;",'"':"&quot;","&":"&amp;","'":"&#39;","<":"&lt;",">":"&gt;","\t":"&#9;","\n":"&#10;","\x0B":"&#11;","\f":"&#12;","\r":"&#13;"," ":"&#32;","-":"&#45;","/":"&#47;","=":"&#61;","`":"&#96;","\u0085":"&#133;","\u00a0":"&#160;","\u2028":"&#8232;","\u2029":"&#8233;"};function af(a){return bf[a]}var $e=/[\x00\x22\x26\x27\x3c\x3e]/g;function cf(){return'<div class="farSide" style="padding: 1ex 3ex 0"><button class="secondary" onclick="BlocklyDialogs.hideDialog(true)">OK</button></div>'};function df(){for(var a='<div style="display: none"><span id="Games_name">Jogos do Blockly</span><span id="Games_puzzle">Quebra-Cabe\u00e7a</span><span id="Games_maze">Labirinto</span><span id="Games_bird">P\u00e1ssaro</span><span id="Games_turtle">Tartaruga</span><span id="Games_movie">Filme</span><span id="Games_music">M\u00fasica</span><span id="Games_pondTutor">Tutor de Lagoa</span><span id="Games_pond">Lagoa</span><span id="Games_genetics">Gen\u00e9ticas</span><span id="Games_linesOfCode1">Voc\u00ea solucionou esse n\u00edvel com uma linha de JavaScript:</span><span id="Games_linesOfCode2">Voc\u00ea solucionou esse n\u00edvel com %1 linhas de JavaScript:</span><span id="Games_nextLevel">Voc\u00ea esta preparado para o n\u00edvel %1?</span><span id="Games_finalLevel">Voc\u00ea esta preparado para o pr\u00f3ximo desafio?</span><span id="Games_submitTitle">T\u00edtulo:</span><span id="Games_linkTooltip">Salvar e ligar aos blocos.</span><span id="Games_runTooltip">Rodar o programa que voc\u00ea escreveu.</span><span id="Games_runProgram">Executar o programa</span><span id="Games_resetTooltip">Parar a execu\u00e7\u00e3o do programa e resetar o nivel.</span><span id="Games_resetProgram">Reiniciar</span><span id="Games_help">Ajuda</span><span id="Games_dialogOk">OK</span><span id="Games_dialogCancel">Cancelar</span><span id="Games_catLogic">L\u00f3gica</span><span id="Games_catLoops">La\u00e7os</span><span id="Games_catMath">Matem\u00e1tica</span><span id="Games_catText">Texto</span><span id="Games_catLists">Listas</span><span id="Games_catColour">Cor</span><span id="Games_catVariables">Vari\u00e1veis</span><span id="Games_catProcedures">Fun\u00e7\u00f5es</span><span id="Games_httpRequestError">Houve um problema com a requisi\u00e7\u00e3o.</span><span id="Games_linkAlert">Compartilhe seus blocos com este link:\n\n%1</span><span id="Games_hashError">Desculpe, \'%1\' n\u00e3o corresponde a um programa salvo.</span><span id="Games_xmlError">N\u00e3o foi poss\u00edvel carregar seu arquivo salvo. Talvez ele tenha sido criado com uma vers\u00e3o diferente do Blockly?</span><span id="Games_submitted">Agradecemos pelo programa! Se a nossa equipa gostar dele, este ser\u00e1 publicado na galeria por n\u00f3s dentro de alguns dias.</span><span id="Games_listVariable">lista</span><span id="Games_textVariable">texto</span><span id="Games_breakLink">Quando voc\u00ea come\u00e7ar a editar o JavaScript, voc\u00ea n\u00e3o poder\u00e1 mais voltar a editar os blocos. Voc\u00ea tem certeza?</span><span id="Games_blocks">Blocos</div></div><div style="display: none"><span id="Turtle_moveTooltip">Move a tartaruga para frente ou para tr\u00e1s a \\nquantidade especificada. </span><span id="Turtle_moveForward">avan\u00e7ar</span><span id="Turtle_moveBackward">mover para tr\u00e1s</span><span id="Turtle_turnTooltip">Gira a tartaruga para esquerda ou direita de \\nacordo com o n\u00famero de graus especificado. </span><span id="Turtle_turnRight">vire \u00e0 direita</span><span id="Turtle_turnLeft">vire \u00e0 esquerda</span><span id="Turtle_widthTooltip">Muda o tamanho da caneta.</span><span id="Turtle_setWidth">configurar largura para</span><span id="Turtle_colourTooltip">Muda a cor da caneta.</span><span id="Turtle_setColour">Configurar cor para</span><span id="Turtle_penTooltip">Levanta ou abaixa a caneta, para parar ou voltar \\na desenhar. </span><span id="Turtle_penUp">levantar caneta</span><span id="Turtle_penDown">abaixar caneta</span><span id="Turtle_turtleVisibilityTooltip">Torna a tartaruga (c\u00edrculo e seta) vis\u00edvel ou \\ninvis\u00edvel. </span><span id="Turtle_hideTurtle">esconder tartaruga</span><span id="Turtle_showTurtle">mostrar tartaruga</span><span id="Turtle_printHelpUrl">https://pt.wikipedia.org/wiki/Impress%C3%A3o</span><span id="Turtle_printTooltip">Desenha texto na dire\u00e7\u00e3o da tartaruga em sua \\nlocaliza\u00e7\u00e3o. </span><span id="Turtle_print">imprimir</span><span id="Turtle_fontHelpUrl">https://pt.wikipedia.org/wiki/Fonte_tipogr%C3%A1fica</span><span id="Turtle_fontTooltip">Configurar a fonte usada pelo bloco de impress\u00e3o \\nna tela. </span><span id="Turtle_font">fonte</span><span id="Turtle_fontSize">tamanho da fonte</span><span id="Turtle_fontNormal">normal</span><span id="Turtle_fontBold">negrito</span><span id="Turtle_fontItalic">it\u00e1lico</span><span id="Turtle_submitDisabled">Rode seu programa at\u00e9 que ele pare. Depois voc\u00ea pode submeter seu desenho a galeria.</span></div><table width="100%"><tr><td><h1><span id="title">'+
((Ad?'<a href="index.html?lang='+Z(yd)+'">':'<a href="./?lang='+Z(yd)+'">')+"Jogos do Blockly</a> : "+Z({appName:"Tartaruga"}.appName)+"</span>"),c=" &nbsp; ",d=1;11>d;d++)c+=" "+(d==M?'<span class="level_number level_done" id="level'+Z(d)+'">'+Z(d)+"</span>":10==d?'<a class="level_number" id="level'+Z(d)+'" href="?lang='+Z(yd)+"&level="+Z(d)+Z("")+'">'+Z(d)+"</a>":'<a class="level_dot" id="level'+Z(d)+'" href="?lang='+Z(yd)+"&level="+Z(d)+Z("")+'"></a>');return a+c+'</h1></td><td class="farSide"><select id="languageMenu"></select>&nbsp;<button id="linkButton" title="Salvar e ligar aos blocos."><img src="common/1x1.gif" class="link icon21"></button>&nbsp;<button id="helpButton">Ajuda</button></td></tr></table><div id="visualization"><canvas id="scratch" width="400" height="400" style="display: none"></canvas><canvas id="answer" width="400" height="400" style="display: none"></canvas><canvas id="display" width="400" height="400"></canvas></div><table style="padding-top: 1em;"><tr><td style="width: 190px; text-align: center; vertical-align: top;"><svg id="slider" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="150" height="50">\x3c!-- Slow icon. --\x3e<clipPath id="slowClipPath"><rect width=26 height=12 x=5 y=14 /></clipPath><image xlink:href="turtle/icons.png" height=42 width=84 x=-21 y=-10 clip-path="url(#slowClipPath)" />\x3c!-- Fast icon. --\x3e<clipPath id="fastClipPath"><rect width=26 height=16 x=120 y=10 /></clipPath><image xlink:href="turtle/icons.png" height=42 width=84 x=120 y=-11 clip-path="url(#fastClipPath)" /></svg></td><td style="width: 15px;"><img id="spinner" style="visibility: hidden;" src="common/loading.gif" height=15 width=15></td><td style="width: 190px; text-align: center"><button id="runButton" class="primary" title="Rodar o programa que voc\u00ea escreveu."><img src="common/1x1.gif" class="run icon21"> Executar o programa</button><button id="resetButton" class="primary" style="display: none" title="Parar a execu\u00e7\u00e3o do programa e resetar o nivel."><img src="common/1x1.gif" class="stop icon21"> Reiniciar</button></td></tr></table>'+
(10!=M||Ad?"":'<table style="padding-top: 1em; width: 400px;"><tr><td style="text-align: center;"><form action="/gallery" target="turtle-gallery"><input type="hidden" name="app" value="turtle"><input type="hidden" name="lang" value="'+Z(yd)+'"><button type="submit" title="Abrir a galeria de desenhos."><img src="common/1x1.gif" class="gallery icon21"> Ver a Galeria</button></form></td><td style="text-align: center;"><button id="submitButton" title="Enviar seu desenho para a galeria."><img src="common/1x1.gif" class="camera icon21"> Enviar a Galeria</button></td></tr></table><div id="galleryDialog" class="dialogHiddenContent"><form id="galleryForm" action="/gallery-api/submit" method="post" onsubmit="return false"><header>Enviar seu desenho para a galeria.</header><canvas id="thumbnail" width="200" height="200"></canvas><input type="hidden" name="app" value="turtle"><input id="galleryThumb" type="hidden" name="thumb"><input id="galleryXml" type="hidden" name="xml"><div>T\u00edtulo: <input id="galleryTitle" type="text" name="title" required></div><footer>\x3c!--Legal disclaimer goes here if needed.--\x3e</footer><div class="farSide"><button id="galleryCancel" type="button">Cancelar</button><button id="galleryOk" class="secondary" type="submit">OK</button></div></form></div>')+
('<xml id="toolbox" style="display: none" xmlns="https://developers.google.com/blockly/xml">'+(10==M?'<category name="Tartaruga"><block type="turtle_move"><value name="VALUE"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="turtle_turn"><value name="VALUE"><shadow type="math_number"><field name="NUM">90</field></shadow></value></block><block type="turtle_width"><value name="WIDTH"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="turtle_pen"></block><block type="turtle_visibility"></block><block type="turtle_print"><value name="TEXT"><shadow type="text"></shadow></value></block><block type="turtle_font"></block></category><category name="Cor"><block type="turtle_colour"><value name="COLOUR"><shadow type="colour_picker"></shadow></value></block><block type="colour_picker"></block><block type="colour_random"></block><block type="colour_rgb"><value name="RED"><shadow type="math_number"><field name="NUM">100</field></shadow></value><value name="GREEN"><shadow type="math_number"><field name="NUM">50</field></shadow></value><value name="BLUE"><shadow type="math_number"><field name="NUM">0</field></shadow></value></block><block type="colour_blend"><value name="COLOUR1"><shadow type="colour_picker"><field name="COLOUR">#ff0000</field></shadow></value><value name="COLOUR2"><shadow type="colour_picker"><field name="COLOUR">#3333ff</field></shadow></value><value name="RATIO"><shadow type="math_number"><field name="NUM">0.5</field></shadow></value></block></category><category name="L\u00f3gica"><block type="controls_if"></block><block type="logic_compare"></block><block type="logic_operation"></block><block type="logic_negate"></block><block type="logic_boolean"></block><block type="logic_ternary"></block></category><category name="La\u00e7os"><block type="controls_repeat_ext"><value name="TIMES"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="controls_whileUntil"></block><block type="controls_for"><value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="TO"><shadow type="math_number"><field name="NUM">10</field></shadow></value><value name="BY"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="controls_flow_statements"></block></category><category name="Matem\u00e1tica"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_single"><value name="NUM"><shadow type="math_number"><field name="NUM">9</field></shadow></value></block><block type="math_trig"><value name="NUM"><shadow type="math_number"><field name="NUM">45</field></shadow></value></block><block type="math_constant"></block><block type="math_number_property"><value name="NUMBER_TO_CHECK"><shadow type="math_number"><field name="NUM">0</field></shadow></value></block><block type="math_round"><value name="NUM"><shadow type="math_number"><field name="NUM">3.1</field></shadow></value></block><block type="math_modulo"><value name="DIVIDEND"><shadow type="math_number"><field name="NUM">64</field></shadow></value><value name="DIVISOR"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="math_constrain"><value name="VALUE"><shadow type="math_number"><field name="NUM">50</field></shadow></value><value name="LOW"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="HIGH"><shadow type="math_number"><field name="NUM">100</field></shadow></value></block><block type="math_random_int"><value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="TO"><shadow type="math_number"><field name="NUM">100</field></shadow></value></block><block type="math_random_float"></block></category><category name="Listas"><block type="lists_create_with"><mutation items="0"></mutation></block><block type="lists_create_with"></block><block type="lists_repeat"><value name="NUM"><shadow type="math_number"><field name="NUM">5</field></shadow></value></block><block type="lists_length"></block><block type="lists_isEmpty"></block><block type="lists_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_getIndex"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_setIndex"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_getSublist"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_sort"></block><block type="lists_reverse"></block></category><sep></sep><category name="Vari\u00e1veis" custom="VARIABLE"></category><category name="Fun\u00e7\u00f5es" custom="PROCEDURE"></category>':
'<category name="Tartaruga"><block type="turtle_move_internal"><field name="VALUE">100</field></block><block type="turtle_turn_internal"><field name="VALUE">90</field></block>'+(3<M?'<block type="turtle_pen"></block>':"")+"</category>"+(2<M?'<category name="Cor"><block type="turtle_colour_internal"></block></category>':"")+'<category name="La\u00e7os"><block type="turtle_repeat_internal"><field name="TIMES">4</field></block></category>')+'</xml><div id="blockly"></div><div id="dialogShadow" class="dialogAnimate"></div><div id="dialogBorder"></div><div id="dialog"></div><div id="dialogDone" class="dialogHiddenContent"><div style="font-size: large; margin: 1em;">Parab\u00e9ns!</div><div id="dialogLinesText" style="font-size: large; margin: 1em;"></div><pre id="containerCode"></pre><div id="dialogDoneText" style="font-size: large; margin: 1em;"></div><div id="dialogDoneButtons" class="farSide" style="padding: 1ex 3ex 0"><button id="doneCancel">Cancelar</button><button id="doneOk" class="secondary">OK</button></div></div><div id="dialogAbort" class="dialogHiddenContent">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.<div class="farSide" style="padding: 1ex 3ex 0"><button id="abortCancel">Cancelar</button><button id="abortOk" class="secondary">OK</button></div></div><div id="dialogStorage" class="dialogHiddenContent"><div id="containerStorage"></div>')+
(cf()+"</div>")+(4>M?'<div id="helpUseLoop" class="dialogHiddenContent"><div style="padding-bottom: 0.7ex">Sua solu\u00e7\u00e3o funciona, mas voc\u00ea pode fazer melhor. '+(3>M?"Desenhe o contorno somente com esses tr\u00eas blocos.":"Desenhe a estrela somente com 4 blocos.")+"</div>"+cf()+"</div>":"")+'<div id="help" class="dialogHiddenContent"><div style="padding-bottom: 0.7ex">'+(1==M?'Crie um programa que desenha um quadrado.<br><img src="turtle/square.gif" height=146 width=146 style="margin-bottom: -50px">':
2==M?"Modifique seu programa para que desenhe um pent\u00e1gono em vez de um quadrado.":3==M?'Aqui est\u00e1 um novo bloco que te permite trocar a cor:<div id="sampleHelp3" class="readonly"></div>Desenhe uma estrela amarela.':4==M?'Aqui esta um novo bloco que te permite suspender a caneta quando voc\u00ea move o cursor:<div id="sampleHelp4" class="readonly"></div>Desenhe uma pequena estrela amarela, depois, desenhe uma linha em cima dela.':5==M?"Em vez de uma estrela, voc\u00ea pode desenhar quatro estrelas dispostas como um quadrado?":
6==M?"Desenhe tr\u00eas estrelas amarelas e uma linha branca.":7==M?"Desenhe as estrelas, depois desenhe quatro linhas brancas.":8==M?"Desenhar 360 linhas brancas vai parecer uma lua cheia.":9==M?"Voc\u00ea pode adicionar um circulo preto para que a lua fique crescente?":10==M?"Desenhe o que voc\u00ea quiser. Voc\u00ea conseguiu um grande numero de blocos novos para explorar. Divirta-se!"+(Ad?"":'<br><br>Use o bot\u00e3o "Ver Galeria" para ver o que as outras pessoas desenharam. Se voc\u00ea desenhar algo interessante,use o bot\u00e3o "Enviar para a Galeria" para publicar.'):
"")+"</div>"+cf()+"</div>"+(1==M?'<div id="helpToolbox" class="dialogHiddenContent"><div><img src="turtle/help_left.png" class="mirrorImg" height=23 width=64></div>Escolha uma categoria para ver os blocos.</div>':"")};var Id="turtle",ef=[],ff=0,gf=null,hf=!0,jf=!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=df();P.U();var c=-1!=xd.indexOf(yd),d=document.getElementById("blockly"),e=document.getElementById("visualization");window.addEventListener("scroll",function(){a(null);g.ol(H)});window.addEventListener("resize",a);a(null);10>M&&(g.Eb.po=3,g.Eb.oo="#ff0000 #ffcc33 #ffff00 #009900 #3333ff #cc33cc #ffffff #999999 #000000".split(" "));
var f=document.getElementById("toolbox");H=g.Ph("blockly",{media:"third-party/blockly/media/",rtl:c,toolbox:f,trashcan:!0,zoom:10==M?{controls:!0,wheel:!0}:null});He("moveForward,moveBackward,turnRight,turnLeft,penUp,penDown,penWidth,penColour,hideTurtle,showTurtle,print,font");document.getElementById("submitButton")&&Jd("submitButton",kf);f=document.getElementById("slider");le=new ae(f);P.PF(10==M?'<xml><block type="turtle_move" x="70" y="70"><value name="VALUE"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block></xml>':
'<xml><block type="turtle_move_internal" x="70" y="70"><field name="VALUE">100</field></block></xml>',10!=M||lf);Q=document.getElementById("display").getContext("2d");me=document.getElementById("answer").getContext("2d");R=document.getElementById("scratch").getContext("2d");mf();re();me.globalCompositeOperation="copy";me.drawImage(R.canvas,0,0);me.globalCompositeOperation="source-over";mf();Jd("runButton",nf);Jd("resetButton",of);H.Nf.load(["turtle/win.mp3","turtle/win.ogg"],"win");setTimeout(P.CF,
1);setTimeout(P.DF,1);Jd("helpButton",pf);2>location.hash.length&&!Gd(M)&&(setTimeout(pf,1E3),9==M&&setTimeout(O.Qw,3E5));1==M&&Ba(H,qf)});
function lf(a){for(var c=a=g.R.lh(a);c;){if("block"==c.nodeName.toLowerCase()){for(var d=c.getAttribute("type"),e=c.lastChild;e&&"field"!=e.nodeName.toLowerCase();)e=e.previousSibling;var f=e&&e.getAttribute("name");if("turtle_colour_internal"==d&&"COLOUR"==f){c.setAttribute("type","turtle_colour");c.removeChild(e);var h=document.createElement("value");h.setAttribute("name","COLOUR");c.appendChild(h);var k=document.createElement("shadow");k.setAttribute("type","colour_picker");h.appendChild(k);k.appendChild(e)}"turtle_repeat_internal"==
d&&"TIMES"==f&&(c.setAttribute("type","controls_repeat_ext"),c.removeChild(e),h=document.createElement("value"),h.setAttribute("name","TIMES"),c.appendChild(h),k=document.createElement("shadow"),k.setAttribute("type","math_number"),h.appendChild(k),e.setAttribute("name","NUM"),k.appendChild(e));"turtle_move_internal"==d&&"VALUE"==f&&(c.setAttribute("type","turtle_move"),c.removeChild(e),h=document.createElement("value"),h.setAttribute("name","VALUE"),c.appendChild(h),k=document.createElement("shadow"),
k.setAttribute("type","math_number"),h.appendChild(k),e.setAttribute("name","NUM"),k.appendChild(e));"turtle_turn_internal"==d&&"VALUE"==f&&(c.setAttribute("type","turtle_turn"),c.removeChild(e),h=document.createElement("value"),h.setAttribute("name","VALUE"),c.appendChild(h),k=document.createElement("shadow"),k.setAttribute("type","math_number"),h.appendChild(k),e.setAttribute("name","NUM"),k.appendChild(e))}c=rf(c)}return g.R.Dd(a)}
function rf(a){if(a.firstChild)return a.firstChild;do if(a.nextSibling)return a.nextSibling;while(a=a.parentNode);return a}function pf(){var a=document.getElementById("help"),c=document.getElementById("helpButton");3==M?P.Zy("sampleHelp3",'<xml><block type="turtle_colour_internal" x="5" y="10"><field name="COLOUR">#ffff00</field></block></xml>'):4==M&&P.Zy("sampleHelp4",'<xml><block type="turtle_pen" x="5" y="10"></block></xml>');O.Dj(a,c,!0,!0,{width:"50%",left:"25%",top:"5em"},sf);O.hv()}
function sf(){O.kv();1==M&&setTimeout(tf,5E3)}function tf(){if(!uf&&!O.Qh){var a=document.getElementById("helpToolbox"),c={width:"25%",top:"3.3em"};-1!=xd.indexOf(yd)?c.right="525px":c.left="525px";var d=document.getElementById(":0");O.Dj(a,d,!0,!1,c,null)}}var uf=!1;function qf(a){a.type==g.i.Yl&&"category"==a.element&&(uf=!0,O.Qd(!1),Ca(H,qf))}
function mf(){oe=ne=200;pe=0;hf=qe=!0;R.canvas.width=R.canvas.width;R.strokeStyle="#ffffff";R.fillStyle="#ffffff";R.lineWidth=5;R.lineCap="round";R.font="normal 18pt Arial";vf();for(var a=0;a<ef.length;a++)window.clearTimeout(ef[a]);ef.length=0;gf=null}
function vf(){Q.beginPath();Q.rect(0,0,Q.canvas.width,Q.canvas.height);Q.fillStyle="#000000";Q.fill();Q.globalCompositeOperation="source-over";Q.globalAlpha=.2;Q.drawImage(me.canvas,0,0);Q.globalAlpha=1;Q.globalCompositeOperation="source-over";Q.drawImage(R.canvas,0,0);if(hf){Q.strokeStyle=R.strokeStyle;Q.fillStyle=R.fillStyle;var a=R.lineWidth/2+10;Q.beginPath();Q.arc(ne,oe,a,0,2*Math.PI,!1);Q.lineWidth=3;Q.stroke();var c=g.g.dd.rl(pe),d=ne+(a+10)*Math.sin(c),e=oe-(a+10)*Math.cos(c);c-=.3;var f=
ne+(a+4)*Math.sin(c),h=oe-(a+4)*Math.cos(c);c+=.15;var k=ne+(a+6)*Math.sin(c),l=oe-(a+6)*Math.cos(c);c+=.3;var m=ne+(a+6)*Math.sin(c),n=oe-(a+6)*Math.cos(c);c+=.15;var u=ne+(a+4)*Math.sin(c);a=oe-(a+4)*Math.cos(c);Q.beginPath();Q.moveTo(d,e);Q.lineTo(f,h);Q.bezierCurveTo(k,l,m,n,u,a);Q.closePath();Q.fill()}}
function nf(a){if(!P.Xf(a)){a=document.getElementById("runButton");var c=document.getElementById("resetButton");c.style.minWidth||(c.style.minWidth=a.offsetWidth+"px");a.style.display="none";c.style.display="inline";document.getElementById("spinner").style.visibility="visible";wf()}}
function of(a){P.Xf(a)||(document.getElementById("runButton").style.display="inline",document.getElementById("resetButton").style.display="none",document.getElementById("spinner").style.visibility="hidden",id(null),mf(),jf=!1)}
function xf(a,c){var d=function(e,f){S(e,f)};a.setProperty(c,"moveForward",a.createNativeFunction(d));d=function(e,f){S(-e,f)};a.setProperty(c,"moveBackward",a.createNativeFunction(d));d=function(e,f){T(e,f)};a.setProperty(c,"turnRight",a.createNativeFunction(d));d=function(e,f){T(-e,f)};a.setProperty(c,"turnLeft",a.createNativeFunction(d));d=function(e){V(!1,e)};a.setProperty(c,"penUp",a.createNativeFunction(d));d=function(e){V(!0,e)};a.setProperty(c,"penDown",a.createNativeFunction(d));d=function(e,
f){R.lineWidth=e;yf(f)};a.setProperty(c,"penWidth",a.createNativeFunction(d));d=function(e,f){U(e,f)};a.setProperty(c,"penColour",a.createNativeFunction(d));d=function(e){hf=!1;yf(e)};a.setProperty(c,"hideTurtle",a.createNativeFunction(d));d=function(e){hf=!0;yf(e)};a.setProperty(c,"showTurtle",a.createNativeFunction(d));d=function(e,f){R.save();R.translate(ne,oe);R.rotate(g.g.dd.rl(pe-90));R.fillText(e,0,0);R.restore();yf(f)};a.setProperty(c,"print",a.createNativeFunction(d));d=function(e,f,h,k){R.font=
h+" "+f+"pt "+e;yf(k)};a.setProperty(c,"font",a.createNativeFunction(d))}function wf(){if("Interpreter"in window){mf();g.selected&&ib(g.selected);var a=$d();gf=new Interpreter(a,xf);ef.push(setTimeout(zf,100))}else setTimeout(wf,250)}
function zf(){ff=ef.length=0;do{try{var a=gf.step()}catch(h){alert(h),a=!1}a&&ff&&(a=!1,ef.push(setTimeout(zf,ff)))}while(a);if(!ff){document.getElementById("spinner").style.visibility="hidden";id(null);a=R.getImageData(0,0,400,400);for(var c=me.getImageData(0,0,400,400),d=Math.min(a.data.length,c.data.length),e=0,f=3;f<d;f+=4)64<Math.abs(a.data[f]-c.data[f])&&e++;se(e)?(P.WG(),10>M&&(H.Nf.play("win",.5),O.YD())):U("#ff0000");jf=!0}}
function yf(a){a&&(vf(),P.Gt(a),a=1E3*Math.pow(1-le.getValue(),2),ff=Math.max(1,a))}function S(a,c){qe&&(R.beginPath(),R.moveTo(ne,oe));if(a){var d=g.g.dd.rl(pe);ne+=a*Math.sin(d);oe-=a*Math.cos(d);a=0}else a=.1;qe&&(R.lineTo(ne,oe+a),R.stroke());yf(c)}function T(a,c){a=pe+a;a%=360;0>a&&(a+=360);pe=a;yf(c)}function V(a,c){qe=a;yf(c)}function U(a,c){R.strokeStyle=a;R.fillStyle=a;yf(c)}
function kf(){if(jf){var a=document.getElementById("thumbnail"),c=a.getContext("2d");c.globalCompositeOperation="copy";c.drawImage(Q.canvas,0,0,200,200);a=a.toDataURL("image/png");document.getElementById("galleryThumb").value=a;O.fv()}else alert(N("Turtle_submitDisabled"))};
