// 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.S=function(a,c){this.x=a;this.y=c};g.g.S.ve=function(a,c){return a==c?!0:a&&c?a.x==c.x&&a.y==c.y:!1};g.g.S.Bx=function(a,c){var d=a.x-c.x;a=a.y-c.y;return Math.sqrt(d*d+a*a)};g.g.S.yF=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};g.g.S.hm=function(a,c){return new g.g.S(a.x-c.x,a.y-c.y)};g.g.S.sum=function(a,c){return new g.g.S(a.x+c.x,a.y+c.y)};g.g.S.prototype.scale=function(a){this.x*=a;this.y*=a;return this};g.g.S.prototype.translate=function(a,c){this.x+=a;this.y+=c;return this};g.g.ab={};g.g.ab.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};g.g.ab.Lu=function(a){return a.length?a.reduce(function(c,d){return c.lengthc&&(c=d[e].length);e=-Infinity;var f=1;do{var h=e;var k=a;a=[];var l=d.length/f,m=1;for(e=0;eh);return k}; g.g.ab.cv=function(a,c,d){for(var e=[0],f=[],h=0;he&&(e=l,f=k)}return f?g.g.ab.tA(a,f,d):c};g.g.ab.jH=function(a,c){for(var d=[],e=0;e=l?(f=2,h=l,(l=a.join(""))&&d.push(l),a.length=0):"{"==l?f=3:(a.push("%",l),f=0):2==f?"0"<=l&&"9">=l?h+=l:(d.push(parseInt(h,10)),k--,f=0):3==f&&(""==l?(a.splice(0,0,"%{"),k--,f=0):"}"!=l?a.push(l):(f=a.join(""),/[A-Z]\w*/i.test(f)?(l=f.toUpperCase(),(l=g.g.ab.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.Wu(f,c)):c?d.push(String(f)):d.push(f)):d.push("%{"+f+"}")):d.push("%{"+f+"}"),f=a.length=0))}(l=a.join(""))&&d.push(l);c=[];for(k=a.length=0;kd;d++)c[d]=g.g.Eg.bA.charAt(Math.random()*a);return c.join("")}; g.g.Eg.bA="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; g.g.$i=function(){if(void 0!==g.g.$i.Zr)return g.g.$i.Zr;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.$i.Zr="none"!==c;return g.g.$i.Zr};g.g.Tz=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.KE=function(){var a=g.g.style.uy();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}}; g.g.Co=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};g.g.DE=function(){var a=document.documentElement,c=window;return g.g.userAgent.lg&&c.pageYOffset!=a.scrollTop?new g.g.S(a.scrollLeft,a.scrollTop):new g.g.S(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};g.g.Ss=function(a,c){var d=Object.create(null),e=p(a,!0);c&&(a=t(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.AG=function(a,c){var d=c.x;c=c.y;var e=aa(a).getBoundingClientRect();d=new g.g.S(d-e.left,c-e.top);c=g.g.tm(a.bb);return g.g.S.hm(d,c).scale(1/a.scale)}; g.Touch={};g.Touch.rw="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.An=null;g.Touch.yf={}; g.g.global.PointerEvent?g.Touch.yf={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:g.Touch.rw&&(g.Touch.yf={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});g.Dp=0; g.wF=function(a,c){g.Kh();a.changedTouches&&1!=a.changedTouches.length||(g.Dp=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);c&&ba(c,a)},g.TB))};g.Kh=function(){g.Dp&&(clearTimeout(g.Dp),g.Dp=0)};g.Touch.nh=function(){g.Touch.An=null};g.Touch.Mu=function(a){return!g.Touch.oF(a)||g.Touch.sD(a)}; g.Touch.lp=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.sD=function(a){var c=g.Touch.lp(a);return void 0!==g.Touch.An&&null!==g.Touch.An?g.Touch.An==c:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(g.Touch.An=c,!0):!1}; g.Touch.CG=function(a){if(g.g.ab.startsWith(a.type,"touch")){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY}};g.Touch.oF=function(a){return g.g.ab.startsWith(a.type,"touch")||g.g.ab.startsWith(a.type,"mouse")||g.g.ab.startsWith(a.type,"pointer")};g.Touch.Cp=function(a){return g.g.ab.startsWith(a.type,"touch")||g.g.ab.startsWith(a.type,"pointer")}; g.Touch.JG=function(a){var c=[];if(a.changedTouches)for(var d=0;d=d+this.Ah&&(e+=f);ca(this,ma(this,e));ka(this);a.stopPropagation();a.preventDefault()}}; b.cG=function(a){oa(this.s);da();g.g.fj(a)?a.stopPropagation():(this.KG=this.xm,qa(this.s),this.dA=this.Vi?a.clientX:a.clientY,g.Ja.Fe=g.ka(document,"mouseup",this,this.iG),g.Ja.Ph=g.ka(document,"mousemove",this,this.eG),a.stopPropagation(),a.preventDefault())};b.eG=function(a){ca(this,ma(this,this.KG+((this.Vi?a.clientX:a.clientY)-this.dA)));ka(this)};b.iG=function(){ra(this.s);g.Touch.nh();da()};function da(){g.mc(!0);g.Ja.Fe&&(g.Xa(g.Ja.Fe),g.Ja.Fe=null);g.Ja.Ph&&(g.Xa(g.Ja.Ph),g.Ja.Ph=null)} function ma(a,c){return c=0>=c||isNaN(c)||a.Iee.Tv&&0<=e.Tv;)e.Hj.shift();for(var h=0;d=e.sd[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.Lk()){var k=[h.type,h.zc,h.uc].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.zl&&l.index==f-1)m.nj=h.nj,m.mj=h.mj,m.Mh=h.Mh,l.index=f;else if(h.type==g.i.ei&&h.element==m.element&&h.name==m.name)m.newValue=h.newValue;else if(h.type!=g.i.xo||"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.Lk()});c||a.reverse();for(f=1;h=a[f];f++)h.type==g.i.ei&&"mutation"==h.element&&a.unshift(a.splice(f,1)[0]);return a};g.i.vD=function(){for(var a=0,c;c=g.i.ql[a];a++)c.Jc=!1};g.i.disable=function(){g.i.vs++};g.i.enable=function(){g.i.vs--};g.i.isEnabled=function(){return 0==g.i.vs};g.i.Ub=function(){return g.i.yy};g.i.Z=function(a){g.i.yy="boolean"==typeof a?a?g.g.Eg():"":a}; g.i.Zx=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.sa=function(a){switch(a.type){case g.i.Wn:var c=new g.i.ie(null);break;case g.i.ol:c=new g.i.Oe(null);break;case g.i.ei:c=new g.i.$g(null,"","","","");break;case g.i.zl:c=new g.i.ni(null);break;case g.i.tw:c=new g.i.re(null);break;case g.i.uw:c=new g.i.Te(null);break;case g.i.vw:c=new g.i.zf(null,"");break;case g.i.xo:c=new g.i.od(null,"","","");break;case g.i.Tn:c=new g.i.gg(null);break;case g.i.vv:c=new g.i.Rj(null,"","");break;case g.i.Un:c=new g.i.gi(null);break;case g.i.wv:c=new g.i.hg(null); break;default:throw Error("Unknown event type.");}c.sa(a);c.uc=(void 0).id;return c};g.i.xx=function(a){if((a.type==g.i.zl||a.type==g.i.Wn)&&a.uc){var c=g.Fb.Us(a.uc);if(a=x(c,a.zc)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.Kc(!0);else if((a.L||a.Y)&&!c.dc()){do a.Kc(!1),a=t(a);while(a)}}}}; g.GC=function(){var a=g.yi.Qj.lD;this.gD=g.yi.Qj.PD;this.mD=a;this.zD=Object.create(null)};function sa(a,c){return(c=a.zD[c])&&"string"==typeof propertyValue&&sa(a,c)?sa(a,c):c?String(c):null};g.Jl=function(a){this.hq=a;this.fq=[];this.ph=Object.create(null)};g.Jl.prototype.kp=function(){return this.hq};g.Jl.prototype.subscribe=function(a,c,d){this.ph[c]||(this.ph[c]=[]);this.ph[c].push({element:a,propertyName:d});a.style[d]=this.hq&&sa(this.hq,c)||""};g.Jl.prototype.unsubscribe=function(a){if(a)for(var c=Object.keys(this.ph),d=0,e;e=c[d];d++){for(var f=this.ph[e],h=f.length-1;0<=h;h--)f[h].element===a&&f.splice(h,1);this.ph[e].length||delete this.ph[e]}}; g.Jl.prototype.I=function(){this.ph=this.fq=this.hq=this.dd=null};g.yi={};g.yi.Qj={};g.yi.Qj.PD={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.yi.Qj.lD={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.yi.Qj=new g.GC;g.i.Abstract=function(){this.uc=void 0;this.group=g.i.Ub();this.Jc=g.i.Jc};g.i.Abstract.prototype.Wa=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};g.i.Abstract.prototype.sa=function(a){this.group=a.group};g.i.Abstract.prototype.Lk=function(){return!1};g.i.Abstract.prototype.run=function(){};function ta(a){if(a.uc)var c=g.Fb.Us(a.uc);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};g.i.rg=function(a){g.i.rg.w.constructor.call(this);this.ai=a.ua();this.uc=a.v.id};g.g.object.T(g.i.rg,g.i.Abstract);g.i.rg.prototype.Wa=function(){var a=g.i.rg.w.Wa.call(this);a.varId=this.ai;return a};g.i.rg.prototype.sa=function(a){g.i.rg.w.Wa.call(this);this.ai=a.varId};g.i.re=function(a){a&&(g.i.re.w.constructor.call(this,a),this.Kj=a.type,this.Jj=a.name)};g.g.object.T(g.i.re,g.i.rg);g.i.re.prototype.type=g.i.tw; g.i.re.prototype.Wa=function(){var a=g.i.re.w.Wa.call(this);a.varType=this.Kj;a.varName=this.Jj;return a};g.i.re.prototype.sa=function(a){g.i.re.w.sa.call(this,a);this.Kj=a.varType;this.Jj=a.varName};g.i.re.prototype.run=function(a){var c=ta(this);a?c.Cd(this.Jj,this.Kj,this.ai):c.Hf(this.ai)};g.i.Te=function(a){a&&(g.i.Te.w.constructor.call(this,a),this.Kj=a.type,this.Jj=a.name)};g.g.object.T(g.i.Te,g.i.rg);g.i.Te.prototype.type=g.i.uw; g.i.Te.prototype.Wa=function(){var a=g.i.Te.w.Wa.call(this);a.varType=this.Kj;a.varName=this.Jj;return a};g.i.Te.prototype.sa=function(a){g.i.Te.w.sa.call(this,a);this.Kj=a.varType;this.Jj=a.varName};g.i.Te.prototype.run=function(a){var c=ta(this);a?c.Hf(this.ai):c.Cd(this.Jj,this.Kj,this.ai)};g.i.zf=function(a,c){a&&(g.i.zf.w.constructor.call(this,a),this.Zt=a.name,this.Tt=c)};g.g.object.T(g.i.zf,g.i.rg);g.i.zf.prototype.type=g.i.vw; g.i.zf.prototype.Wa=function(){var a=g.i.zf.w.Wa.call(this);a.oldName=this.Zt;a.newName=this.Tt;return a};g.i.zf.prototype.sa=function(a){g.i.zf.w.sa.call(this,a);this.Zt=a.oldName;this.Tt=a.newName};g.i.zf.prototype.run=function(a){var c=ta(this);a?c.Uh(this.ai,this.Tt):c.Uh(this.ai,this.Zt)}; g.Cr=function(a){this.Pa=Object.create(null);this.v=a};b=g.Cr.prototype;b.clear=function(){this.Pa=Object.create(null)};b.Tp=function(a,c){var d=this.Tc(c,a.type),e=y(this.v,!1);g.i.Z(!0);try{if(d&&d.ua()!=a.ua()){var f=a.type;c!=d.name&&ua(d,c,e);for(c=0;cc)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.fq.splice(c,1);this.Rb.unsubscribe(this.Mc);this.options.Kb||(this.Rb.I(),this.Rb=null)}};g.Fb.jw=3;b=g.Fb.prototype; b.Yf=function(a,c){a=a.Oa();c=c.Oa();return a.y+g.Fb.prototype.Yf.offset*a.x-(c.y+g.Fb.prototype.Yf.offset*c.x)};function va(a,c){if(!g.g.Co(a.cl,c))throw Error("Block not present in workspace's list of top-most blocks.");}function A(a,c){var d=[].concat(a.cl);c&&1h)return!1;d+=c[e]}return d>xa(a)?!1:!0} function za(a){return Infinity!=a.options.Mt||!!a.options.Nt}b.$u=function(a){var c=a?this.dn:this.Hj,d=a?this.Hj:this.dn,e=c.pop();if(e){for(var f=[e];c.length&&e.group&&e.group==c[c.length-1].group;)f.push(c.pop());for(c=0;e=f[c];c++)d.push(e);f=g.i.filter(f,a);g.i.Jc=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{g.i.Jc=!0}}};function Aa(a,c){a.sd.push(c)}function Ba(a,c){g.g.Co(a.sd,c)}function x(a,c){return a.Rr[c]||null}g.Fb.Ll=Object.create(null);g.Fb.Us=function(a){return g.Fb.Ll[a]||null}; g.Fb.getAll=function(){var a=[],c;for(c in g.Fb.Ll)a.push(g.Fb.Ll[c]);return a};g.na=function(a,c,d,e,f,h){this.s=a;this.Ze=c;this.$z=d;d=g.na.FA;this.s.G&&(d=-d);this.aD=g.g.td.Uu(d);a.pf.appendChild(this.$l(c,!(!f||!h)));this.Tb=e;this.Up&&Ca(this);f&&h||(c=this.Ze.getBBox(),f=c.width+2*g.na.Zc,h=c.height+2*g.na.Zc);this.kn(f,h);Ca(this);Da(this);this.Up=!0;a.options.readOnly||(g.ka(this.Ql,"mousedown",this,this.hD),this.Uf&&g.ka(this.Uf,"mousedown",this,this.vG))};g.na.Zc=6;g.na.GA=5;g.na.FA=20;g.na.kv=4;g.na.DA=8;g.na.Fe=null;g.na.Ph=null;g.na.prototype.wu=null; g.na.Zu=function(){g.na.Fe&&(g.Xa(g.na.Fe),g.na.Fe=null);g.na.Ph&&(g.Xa(g.na.Ph),g.na.Ph=null)};g.na.iD=function(){g.Touch.nh();g.na.Zu()};b=g.na.prototype;b.Up=!1;b.Tb=null;b.Qg=0;b.Th=0;b.ob=0;b.Uc=0;b.Or=!0; b.$l=function(a,c){this.Ud=g.g.o.K("g",{},null);var d={filter:"url(#"+this.s.options.Ix+")"};g.g.userAgent.JB&&(d={});d=g.g.o.K("g",d,this.Ud);this.Vr=g.g.o.K("path",{},d);this.Ql=g.g.o.K("rect",{"class":"blocklyDraggable",x:0,y:0,rx:g.na.Zc,ry:g.na.Zc},d);c?(this.Uf=g.g.o.K("g",{"class":this.s.G?"blocklyResizeSW":"blocklyResizeSE"},this.Ud),c=2*g.na.Zc,g.g.o.K("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.Uf),g.g.o.K("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/ 3},this.Uf),g.g.o.K("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.Uf)):this.Uf=null;this.Ud.appendChild(a);return this.Ud};b.wa=function(){return this.Ud};function Fa(a,c){a.Ud.dataset&&(a.Ud.dataset.blockId=c)}b.hD=function(a){var c=this.s.Gg(a);if(c){if(c.Ti)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.ae||(c.ae=this);c.kf=a}};b.pn=function(){};b.Zd=function(){return!1}; b.vG=function(a){Ga(this);g.na.Zu();g.g.fj(a)||(this.s.Qu(a,new g.g.S(this.s.G?-this.ob:this.ob,this.Uc)),g.na.Fe=g.ka(document,"mouseup",this,g.na.iD),g.na.Ph=g.ka(document,"mousemove",this,this.wG),g.mc());a.stopPropagation()};b.wG=function(a){this.Or=!1;var c=this.s;a=g.g.Um(a,v(c),pa(c));a.x/=c.scale;a.y/=c.scale;c=g.g.S.sum(c.Fx,a);this.kn(this.s.G?-c.x:c.x,c.y);this.s.G&&Ca(this)};function Ga(a){var c=a.Ud.parentNode;return c.lastChild!==a.Ud?(c.appendChild(a.Ud),!0):!1} function Ha(a,c,d){var e=a.s.G?a.Tb.x-c.x-a.ob:c.x+a.Tb.x;c=c.y+a.Tb.y;return Math.max(0,Math.min(1,(Math.min(e+a.ob,d.Zb+d.lb)-Math.max(e,d.Zb))*(Math.min(c+a.Uc,d.hc+d.rb)-Math.max(c,d.hc))/(a.ob*a.Uc)))}function Ca(a){var c=a.Tb.x;c=a.s.G?c-(a.Qg+a.ob):c+a.Qg;a.moveTo(c,a.Th+a.Tb.y)}b.moveTo=function(a,c){this.Ud.setAttribute("transform","translate("+a+","+c+")")};b.Ts=function(){return new g.g.qe(this.ob,this.Uc)}; b.kn=function(a,c){var d=2*g.na.Zc;a=Math.max(a,d+45);c=Math.max(c,d+20);this.ob=a;this.Uc=c;this.Ql.setAttribute("width",a);this.Ql.setAttribute("height",c);this.Uf&&(this.s.G?this.Uf.setAttribute("transform","translate("+2*g.na.Zc+","+(c-d)+") scale(-1 1)"):this.Uf.setAttribute("transform","translate("+(a-d)+","+(c-d)+")"));if(this.Or){a=this.s.bc();a.Zb/=this.s.scale;a.lb/=this.s.scale;a.hc/=this.s.scale;a.rb/=this.s.scale;c=-this.ob/4;if(!(this.ob>a.lb)){if(this.s.G){d=this.Tb.x-c;var e=d-this.ob; var f=a.Zb+a.lb,h=a.Zb+g.Ja.oc/this.s.scale}else e=c+this.Tb.x,d=e+this.ob,h=a.Zb,f=a.Zb+a.lb-g.Ja.oc/this.s.scale;this.s.G?ef&&(c=-(f-this.Tb.x)):ef&&(c=f-this.Tb.x-this.ob)}e=c;c=-this.Uc/4;if(!(this.Uc>a.rb)){d=this.Tb.y+c;f=d+this.Uc;h=a.hc;var k=a.hc+a.rb-g.Ja.oc/this.s.scale,l=this.Tb.y;dk&&(c=k-l-this.Uc)}h=c;f=this.$z.getBBox();c={x:e,y:-this.Uc-g.va.Vq};d={x:-this.ob-30,y:h};h={x:f.width,y:h};k={x:e,y:f.height};e=f.widthh&&(l=2*Math.PI-l);var m=l+Math.PI/2;m>2*Math.PI&&(m-=2*Math.PI);var n=Math.sin(m),q=Math.cos(m),r=a.Ts();m=(r.width+r.height)/g.na.GA;m=Math.min(m,r.width,r.height)/4;r=1-g.na.DA/k;f=d+r*f;h=e+r*h;r=d+m*q;var u=e+m*n;d-=m*q;e-=m*n;n=l+a.aD;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/g.na.kv;k=Math.cos(n)*k/g.na.kv;c.push("M"+r+","+ u);c.push("C"+(r+k)+","+(u+l)+" "+f+","+h+" "+f+","+h);c.push("C"+f+","+h+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.Vr.setAttribute("d",c.join(" "))}b.mf=function(a){this.Ql.setAttribute("fill",a);this.Vr.setAttribute("fill",a)};b.I=function(){g.na.Zu();g.g.o.removeNode(this.Ud);this.$z=this.Ze=this.s=this.Uf=this.Ql=this.Vr=this.Ud=null};b.Qt=function(a,c){a?a.Gj(c.x,c.y):this.moveTo(c.x,c.y);this.Qg=this.s.G?this.Tb.x-c.x-this.ob:c.x-this.Tb.x;this.Th=c.y-this.Tb.y;Da(this)}; b.Oa=function(){return new g.g.S(this.Tb.x+this.Qg,this.Tb.y+this.Th)};g.g.xml={};g.g.xml.eC="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.eC,a)};g.g.xml.createTextNode=function(a){return g.g.xml.document().createTextNode(a)};g.g.xml.QG=function(a){return(new DOMParser).parseFromString(a,"text/xml")};g.g.xml.Dd=function(a){return(new XMLSerializer).serializeToString(a)};g.i.tf=function(a){g.i.tf.w.constructor.call(this);this.zc=a.id;this.uc=a.v.id};g.g.object.T(g.i.tf,g.i.Abstract);g.i.tf.prototype.Wa=function(){var a=g.i.tf.w.Wa.call(this);a.blockId=this.zc;return a};g.i.tf.prototype.sa=function(a){g.i.tf.w.sa.call(this,a);this.zc=a.blockId};g.i.$g=function(a,c,d,e,f){a&&(g.i.$g.w.constructor.call(this,a),this.element=c,this.name=d,this.oldValue=e,this.newValue=f)};g.g.object.T(g.i.$g,g.i.tf);g.i.eg=g.i.$g;b=g.i.$g.prototype;b.type=g.i.ei; b.Wa=function(){var a=g.i.$g.w.Wa.call(this);a.element=this.element;this.name&&(a.name=this.name);a.newValue=this.newValue;return a};b.sa=function(a){g.i.$g.w.sa.call(this,a);this.element=a.element;this.name=a.name;this.newValue=a.newValue};b.Lk=function(){return this.oldValue==this.newValue}; b.run=function(a){var c=x(ta(this),this.zc);if(c)switch(c.Gd&&c.Gd.Qb(!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.Wh(a||null);break;case "collapsed":c.Ug(!!a);break;case "disabled":c.Kc(!a);break;case "inline":c.Je(!!a);break;case "mutation":var d="";c.eb&&(d=(d=c.eb())&&g.O.Dd(d));if(c.Ab){var e=g.O.$h(a||"");c.Ab(e)}g.i.Ka(new g.i.$g(c,"mutation",null,d, a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.zc)};g.i.ie=function(a){a&&(g.i.ie.w.constructor.call(this,a),this.xml=a.v.ca?g.O.Sr(a):g.O.lh(a),this.Lg=g.i.Zx(a))};g.g.object.T(g.i.ie,g.i.tf);g.i.Rn=g.i.ie;g.i.ie.prototype.type=g.i.Wn;g.i.ie.prototype.Wa=function(){var a=g.i.ie.w.Wa.call(this);a.xml=g.O.Dd(this.xml);a.ids=this.Lg;return a}; g.i.ie.prototype.sa=function(a){g.i.ie.w.sa.call(this,a);this.xml=g.O.$h(a.xml);this.Lg=a.ids};g.i.ie.prototype.run=function(a){var c=ta(this);if(a)a=g.g.xml.createElement("xml"),a.appendChild(this.xml),g.O.uh(a,c);else{a=0;for(var d;d=this.Lg[a];a++){var e=x(c,d);e?e.I(!1):d==this.zc&&console.warn("Can't uncreate non-existent block: "+d)}}}; g.i.Oe=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");g.i.Oe.w.constructor.call(this,a);this.$t=a.v.ca?g.O.Sr(a):g.O.lh(a);this.Lg=g.i.Zx(a)}};g.g.object.T(g.i.Oe,g.i.tf);g.i.MA=g.i.Oe;g.i.Oe.prototype.type=g.i.ol;g.i.Oe.prototype.Wa=function(){var a=g.i.Oe.w.Wa.call(this);a.ids=this.Lg;return a};g.i.Oe.prototype.sa=function(a){g.i.Oe.w.sa.call(this,a);this.Lg=a.ids}; g.i.Oe.prototype.run=function(a){var c=ta(this);if(a){a=0;for(var d;d=this.Lg[a];a++){var e=x(c,d);e?e.I(!1):d==this.zc&&console.warn("Can't delete non-existent block: "+d)}}else a=g.g.xml.createElement("xml"),a.appendChild(this.$t),g.O.uh(a,c)};g.i.ni=function(a){a&&(g.i.ni.w.constructor.call(this,a),a=Ia(this),this.oz=a.Bz,this.nz=a.My,this.Xt=a.gx)};g.g.object.T(g.i.ni,g.i.tf);g.i.ll=g.i.ni;b=g.i.ni.prototype;b.type=g.i.zl; b.Wa=function(){var a=g.i.ni.w.Wa.call(this);this.nj&&(a.newParentId=this.nj);this.mj&&(a.newInputName=this.mj);this.Mh&&(a.newCoordinate=Math.round(this.Mh.x)+","+Math.round(this.Mh.y));return a};b.sa=function(a){g.i.ni.w.sa.call(this,a);this.nj=a.newParentId;this.mj=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.Mh=new g.g.S(Number(a[0]),Number(a[1])))};b.tj=function(){var a=Ia(this);this.nj=a.Bz;this.mj=a.My;this.Mh=a.gx}; function Ia(a){var c=x(ta(a),a.zc);a={};var d=c.getParent();if(d){a.Bz=d.id;a:{for(var e=0,f;f=d.P[e];e++)if(f.connection&&C(f.connection)==c){c=f;break a}c=null}c&&(a.My=c.name)}else a.gx=c.Oa();return a}b.Lk=function(){return this.oz==this.nj&&this.nz==this.mj&&g.g.S.ve(this.Xt,this.Mh)}; b.run=function(a){var c=ta(this),d=x(c,this.zc);if(d){var e=a?this.nj:this.oz,f=a?this.mj:this.nz;a=a?this.Mh:this.Xt;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.Oa(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.L||d.Y;if(f){if(c=E(h,f))var k=c.connection}else d.type==g.Se&&(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.zc)};g.i.od=function(a,c,d,e){g.i.od.w.constructor.call(this);this.zc=a?a.id:null;this.uc=a?a.v.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.Jc=!1};g.g.object.T(g.i.od,g.i.Abstract);g.i.od.prototype.type=g.i.xo;g.i.od.prototype.Wa=function(){var a=g.i.od.w.Wa.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.zc&&(a.blockId=this.zc);return a}; g.i.od.prototype.sa=function(a){g.i.od.w.sa.call(this,a);this.element=a.element;this.newValue=a.newValue;this.zc=a.blockId};g.wd=function(a){this.R=a};b=g.wd.prototype;b.Sw=!0;b.to=17;b.Nb=null;b.Wi=null;function Ja(a){a.Fd||(a.Fd=g.g.o.K("g",{"class":"blocklyIconGroup"},null),a.R.Wb&&g.g.o.qb(a.Fd,"blocklyIconGroupReadonly"),a.Cs(a.Fd),a.R.wa().appendChild(a.Fd),g.ka(a.Fd,"mouseup",a,a.mt),a.Yg())}b.I=function(){g.g.o.removeNode(this.Fd);this.Fd=null;this.Qb(!1);this.R=null};b.Yg=function(){};b.isVisible=function(){return!!this.Nb};b.mt=function(a){this.R.v.dc()||this.R.Wb||g.g.fj(a)||this.Qb(!this.isVisible())}; b.Ne=function(){this.isVisible()&&this.Nb.mf(this.R.oh)};function Ka(a){var c=a.R.Oa(),d=g.g.ze(a.Fd);c=new g.g.S(c.x+d.x+a.to/2,c.y+d.y+a.to/2);g.g.S.ve(a.Wi,c)||(a.Wi=c,a.isVisible()&&(a=a.Nb,a.Tb=c,a.Up&&Ca(a)))};g.Af=function(a){g.Af.w.constructor.call(this,a);Ja(this);this.ag={}};g.g.object.T(g.Af,g.wd);g.Af.prototype.Sw=!1;g.Af.prototype.Cs=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.Af.SG=function(a){var c=g.g.o.K("text",{"class":"blocklyText blocklyBubbleText",y:g.na.Zc},null);a=a.split("\n");for(var d=0;d>>/g,a),a=document.createElement("style"),d=document.createTextNode(d),a.appendChild(d),document.head.insertBefore(a,document.head.firstChild))}};g.hd.Du=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")}; g.hd.Aq=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;", "}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);", "color: #000;","display: none;","font-family: sans-serif;","font-size: 9pt;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: fixed;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-radius: 2px;","padding: 4px;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;", "overflow-x: hidden;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;","cursor: pointer;","}",".arrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;", "border-color: inherit;","}",".arrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;", "stroke-width: 1;","}",".blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;", "}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;", "}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none","}",".blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",".blocklyReplaceable .blocklyPathLight,",".blocklyReplaceable .blocklyPathDark {","display: none;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;", "font-size: 11pt;","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text {","fill: #000;","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill: #000;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklySvg text, .blocklyBlockDragSurface text {", "user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;", "}",".blocklyCommentForeignObject {","position: relative;","z-index: 0;","}",".blocklyCommentRect {","fill: #E7DE8E;","stroke: #bcA903;","stroke-width: 1px","}",".blocklyCommentTarget {","fill: transparent;","stroke: #bcA903;","}",".blocklyCommentTargetFocused {","fill: none;","}",".blocklyCommentHandleTarget {","fill: none;","}",".blocklyCommentHandleTargetFocused {","fill: transparent;","}",".blocklyFocused>.blocklyCommentRect {","fill: #B9B272;","stroke: #B9B272;","}",".blocklySelected>.blocklyCommentTarget {", "stroke: #fc3;","stroke-width: 3px;","}",".blocklyCommentTextarea {","background-color: #fef49c;","border: 0;","outline: 0;","margin: 0;","padding: 3px;","resize: none;","display: block;","overflow: hidden;","}",".blocklyCommentDeleteIcon {","cursor: pointer;","fill: #000;","display: none","}",".blocklySelected > .blocklyCommentDeleteIcon {","display: block","}",".blocklyDeleteIconShape {","fill: #000;","stroke: #000;","stroke-width: 1px;","}",".blocklyDeleteIconShape.blocklyDeleteIconHighlighted {", "stroke: #fc3;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {", "z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", ".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {", "padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalCursor {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<>>/sprites.png) no-repeat -48px -16px;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;", "border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;', "outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem,",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem,",".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem {", "padding-left: 12px;","}",".blocklyWidgetDiv .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-content {","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {","color: #000;","}",".blocklyWidgetDiv .goog-menuitem-disabled,",".blocklyDropDownDiv .goog-menuitem-disabled {","cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {", "color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight ,",".blocklyDropDownDiv .goog-menuitem-highlight {","background-color: rgba(0,0,0,.1);","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-icon {", "background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,", ".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-right: -24px;","}"];g.Tj=function(a,c,d,e){this.s=a;this.jb=c;this.ag=d.getAttribute("text");this.ed=new g.g.S(0,0);this.Og=e;this.Fo=d.getAttribute("callbackKey")||d.getAttribute("callbackkey");this.jx=d.getAttribute("web-class")||null};g.Tj.Qe=5;b=g.Tj.prototype;b.width=0;b.height=0;b.Fe=null; b.Ga=function(){var a=this.Og?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.jx&&(a+=" "+this.jx);this.H=g.g.o.K("g",{"class":a},this.s.bb);if(!this.Og)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.Og?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.H);var d=g.g.o.K("text",{"class":this.Og?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.H);d.textContent=g.g.nc(this.ag); this.Og&&(this.Tu=d,this.s.Rb.subscribe(this.Tu,"flyoutText","fill"));this.width=g.g.o.jp(d);this.height=20;this.Og||(this.width+=2*g.Tj.Qe,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.Tj.Qe);Pa(this);this.Fe=g.ka(this.H,"mouseup",this,this.jG);return this.H};b.show=function(){Pa(this);this.H.setAttribute("display","block")}; function Pa(a){a.H.setAttribute("transform","translate("+a.ed.x+","+a.ed.y+")")}b.moveTo=function(a,c){this.ed.x=a;this.ed.y=c;Pa(this)};b.I=function(){this.Fe&&g.Xa(this.Fe);this.H&&g.g.o.removeNode(this.H);this.Tu&&this.s.Rb.unsubscribe(this.Tu)}; b.jG=function(a){(a=this.jb.Gg(a))&&a.cancel();this.Og&&this.Fo?console.warn("Labels should not have callbacks. Label text: "+this.ag):this.Og||this.Fo&&Qa(this.jb,this.Fo)?this.Og||Qa(this.jb,this.Fo)(this):console.warn("Buttons should have callbacks. Button text: "+this.ag)};g.hd.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,},.blocklyFlyoutLabelText {,fill: #000;,}".split(","));g.sf=function(a){this.name=a};g.F=function(a,c,d){if(!c)throw Error("Cannot create a node without a location.");this.Dn=a;this.Dm=g.F.mF(a);this.qa=c;(a=d||null)&&a.uA&&(this.vA=a.uA)};g.F.types={ke:"field",Nd:"block",mg:"input",fk:"output",oe:"next",pe:"previous",xf:"stack",Ci:"workspace"};g.F.dB=-20;g.F.mF=function(a){switch(a){case g.F.types.pe:case g.F.types.oe:case g.F.types.mg:case g.F.types.fk:return!0}return!1};g.F.am=function(a){return new g.F(g.F.types.ke,a)}; g.F.Ff=function(a){return a?a.type==g.Ua||a.type==g.Ra&&a.Lf()?g.F.Ki(a.Lf()):a.type==g.Ra?new g.F(g.F.types.oe,a):a.type==g.Re?new g.F(g.F.types.fk,a):a.type==g.Se?new g.F(g.F.types.pe,a):null:null};g.F.Ki=function(a){return a?new g.F(g.F.types.mg,a.connection):null};g.F.zg=function(a){return new g.F(g.F.types.Nd,a)};g.F.bm=function(a){return new g.F(g.F.types.xf,a)};g.F.cm=function(a,c){return new g.F(g.F.types.Ci,a,{uA:c})};b=g.F.prototype;b.Jb=function(){return this.Dn}; function Ra(a,c){a=a.qa;a instanceof g.Qn||(a=a.B);if(!a||!a.v)return null;var d=G(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.bm(a[c]);throw Error("Couldn't find "+(c?"next":"previous")+" stack?!");}function Sa(a){if(!a)return null;do var c=a.Y&&C(a.Y);while(c&&t(c)==a&&(a=c));return(c=a.Y||a.L)&&c.ga&&c.ga.Lf()?g.F.Ki(c.ga.Lf()):g.F.bm(a)} b.next=function(){switch(this.Dn){case g.F.types.xf:return Ra(this,!0);case g.F.types.fk:return g.F.zg(this.qa.B);case g.F.types.ke:a:{var a=this.qa,c=a.Lf();var d=a.B;a=c.Na.indexOf(a)+1;c=d.P.indexOf(c);for(var e;e=d.P[c];c++){for(var f=e.Na;ac||c>this.fb.length)throw Error(g.vc.Error.RA);this.bs[a.ua()]=a;if(a.getParent()==this){var e=this.fb.indexOf(a);-1a&&(a=(a=this.getParent())?a.Ak()+1:0,hb(this,a));return a};function hb(a,c){if(c!=a.ps){a.ps=c;var d=ib(a);if(d){var e=jb(a)+"px";a.Nk()?d.style.paddingRight=e:d.style.paddingLeft=e}ab(a,function(f){hb(f,c+1)})}}b.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1};b.xh=function(){var a=[];ab(this,function(c){a.push(c)});return a};b.select=function(){var a=this.Ae();a&&Ta(a,this)}; function kb(a,c){if(a.Zp!=c){a.Zp=c;lb(a);var d=a.ta();d&&(g.g.U.Eb(d,g.g.U.State.El,c),c&&(c=a.Ae().ta(),g.g.U.Eb(c,g.g.U.State.hv,a.ua())))}}b.ye=function(){return this.lm}; b.wj=function(a){var c=a!=this.lm,d;this.lm=a;var e=this.Ae(),f=this.ta();if(cb(this)){if(!a&&e&&this.contains(e.Id)&&this.select(),f){if(d=eb(this))g.g.style.Gu(d,a),g.g.U.Eb(f,g.g.U.State.Iq,a),a&&this.Wc&&!d.hasChildNodes()&&(ab(this,function(h){d.appendChild(fb(h))}),ab(this,function(h){h.bf()}));this.kq()}}else(d=eb(this))&&g.g.style.Gu(d,!1);f&&(this.Xs().className=this.cp());c&&(a?this.Dx():this.Cx())};b.Dx=function(){};b.Cx=function(){};b.toggle=function(){this.wj(!this.ye())}; function fb(a){var c=a.ye()&&cb(a),d=document.createElement("div");d.style.backgroundPosition=mb(a);c||(d.style.display="none");c&&ab(a,function(e){d.appendChild(fb(e))});c=document.createElement("div");c.id=a.ua();c.appendChild(nb(a));c.appendChild(d);return c}function jb(a){return Math.max(0,(a.Ak()-1)*a.Rc.Ly)}function nb(a){var c=document.createElement("div");c.className=a.ip();c.style["padding-"+(a.Nk()?"right":"left")]=jb(a)+"px";c.appendChild(ob(a));c.appendChild(pb(a));return c} b.ip=function(){var a="";this.Zp&&(a=" "+(this.Rc.OD||""));return this.Rc.mx+a};function pb(a){var c=document.createElement("span");c.className=a.Rc.MD||"";c.textContent=a.cc();return c}function ob(a){var c=document.createElement("span");c.style.display="inline-block";c.className=a.cp();return c}b.cp=function(){throw Error("unimplemented abstract method");};function mb(a){return(a.Vt?(a.Ak()-1)*a.Rc.Ly:"-100")+"px 0"} b.ta=function(){var a=g.Aa.gd.w.ta.call(this);a||(this.cb=a=document.getElementById(this.ua()));return a};function ib(a){return(a=a.ta())?a.firstChild:null}b.Xs=function(){var a=ib(this);return a?a.firstChild:null};function db(a){return(a=ib(a))&&a.lastChild?a.lastChild.previousSibling:null}function eb(a){return(a=a.ta())?a.lastChild:null}b.Yk=function(a){this.Ze=a};b.cc=function(){return this.Ze};function lb(a){var c=ib(a);c&&(c.className=a.ip())} b.kq=function(){var a=eb(this);a&&(a.style.backgroundPosition=mb(this))};b.xz=function(a){"expand"==a.target.getAttribute("type")&&cb(this)?this.xt&&this.toggle():(this.select(),lb(this))};b.uz=function(a){a.preventDefault()};b.bu=function(a){var c=!0;switch(a.keyCode){case g.g.Ia.ir:if(a.altKey)break;c=qb(this);break;case g.g.Ia.Oq:if(a.altKey)break;c=rb(this);break;case g.g.Ia.$n:c=sb(this);break;case g.g.Ia.zo:c=tb(this);break;default:c=!1}c&&a.preventDefault();return c}; function sb(a){a:if(cb(a)&&a.ye())a=a.fb[0]||null;else{for(var c=a,d;c!=a.Ae();){d=c.Vt;if(null!=d){a=d;break a}c=c.getParent()}a=null}a&&a.select();return!0}function tb(a){var c=a.Tk;if(null!=c)a=ub(c);else{c=a.getParent();var d=a.Ae();a=c==d||a==d?null:c}a&&a.select();return!0}function rb(a){if(cb(a)&&a.ye()&&a.xt)a.wj(!1);else{var c=a.getParent();a=a.Ae();c&&c!=a&&c.select()}return!0}function qb(a){return cb(a)?(a.ye()?(a.fb[0]||null).select():a.wj(!0),!0):!1} function ub(a){return a.ye()&&cb(a)?ub(a.fb[a.fb.length-1]||null):a}function gb(a,c){a.Aa!=c&&(a.Aa=c,ab(a,function(d){gb(d,c)}))};g.Aa.jh=function(a,c,d){this.oa=a;g.Aa.gd.call(this,c,d)};g.g.object.T(g.Aa.jh,g.Aa.gd);b=g.Aa.jh.prototype;b.Ae=function(){if(this.Aa)return this.Aa;var a=this.getParent();return a&&(a=a.Ae())?(gb(this,a),a):null};b.cp=function(){var a=this.ye(),c=this.jE;if(a&&c)return c;c=this.eF;if(!a&&c)return c;c=this.Rc;if(cb(this)){if(a&&c.kx)return c.Oo+" "+c.kx;if(!a&&c.JD)return c.Oo+" "+c.JD}else if(c.lx)return c.Oo+" "+c.lx;return""}; b.uz=function(){cb(this)&&this.xt?(this.toggle(),this.select()):this.Zp?Ta(this.Ae(),null):this.select();lb(this)};b.xz=function(){};b.bu=function(a){if(this.Aa.oa.ef){var c={},d=g.g.Ia.$n,e=g.g.Ia.zo;c[g.g.Ia.ir]=this.Nk()?e:d;c[g.g.Ia.Oq]=this.Nk()?d:e;c[g.g.Ia.zo]=g.g.Ia.Oq;c[g.g.Ia.$n]=g.g.Ia.ir;Object.defineProperties(a,{keyCode:{value:c[a.keyCode]||a.keyCode}})}return g.Aa.jh.w.bu.call(this,a)};b.Rz=function(){this.Az&&this.Az.call(this.oa)};b.Dx=g.Aa.jh.prototype.Rz;b.Cx=g.Aa.jh.prototype.Rz;g.Aa.Ai=function(a,c){this.oa=a;g.Aa.gd.call(this,"",c);this.lm=!0;kb(this,!0);this.Id=this};g.g.object.T(g.Aa.Ai,g.Aa.gd);b=g.Aa.Ai.prototype;b.Ae=function(){return this};b.Ak=function(){return 0};b.QE=function(){this.Sx=!0;var a=this.ta();g.g.o.qb(a,"focused");this.Id&&this.Id.select()};b.NE=function(){this.Sx=!1;var a=this.ta();g.g.o.fc(a,"focused")};b.hasFocus=function(){return this.Sx};b.ye=function(){return!0};b.wj=function(a){this.lm=a}; b.Xs=function(){var a=ib(this);return a?a.firstChild:null};b.kq=function(){};b.ip=function(){return g.Aa.Ai.w.ip.call(this)+" "+this.Rc.LD};b.cp=function(){var a=this.ye(),c=this.jE;if(a&&c)return c;c=this.eF;if(!a&&c)return c;c=this.Rc;return a&&c.KD?c.Oo+" "+c.KD:""};function Ta(a,c){if(c!=a.Id&&(!a.rz||a.rz.call(a.oa,c))){var d=a.Id;a.Id&&kb(a.Id,!1);(a.Id=c)&&kb(c,!0);a.qz&&a.qz.call(a.oa,d,c)}} b.qp=function(){g.Aa.Ai.w.qp.call(this);var a=this.ta();g.g.U.Xf(a,g.g.U.ti.EC);g.g.U.Eb(a,g.g.U.State.Rv,db(this).id)};b.bf=function(){g.Aa.Ai.w.bf.call(this);var a=this.ta();a.className=this.Rc.ND;a.setAttribute("hideFocus","true");this.Nr();this.qp()};b.wh=function(){g.Aa.Ai.w.wh.call(this);this.qs()};b.Nr=function(){var a=this.ta();a.tabIndex=0;this.WF=g.yc(a,"focus",this,this.QE);this.SF=g.yc(a,"blur",this,this.NE);this.UF=g.ka(a,"click",this,this.UE);this.aG=g.yc(a,"keydown",this,this.RE)}; b.qs=function(){g.Xa(this.WF);g.Xa(this.SF);g.Xa(this.UF);g.Xa(this.aG)};b.UE=function(a){var c;a:{for(var d=a.target;null!=d;){if(c=g.Aa.gd.Hr[d.id])break a;if(d==this.ta())break;d=d.parentNode}c=null}if(c)switch(a.type){case "mousedown":c.xz(a);break;case "click":c.uz(a)}};b.RE=function(a){var c=!1;if(c=this.Id&&this.Id.bu(a)||c)g.g.style.Cu(this.Id.ta(),this.ta().parentNode),a.preventDefault();return c};b.createNode=function(a){return new g.Aa.jh(this.oa,a||"",this.Rc)};g.g.Ib={};g.g.Ib.parse=function(a){a=String(a).toLowerCase().trim();var c=g.g.Ib.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.Ib.Au(a,c,d):null}; g.g.Ib.Au=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};g.g.Ib.Gy=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; g.g.Ib.dF=function(a){var c=g.zB,d=255*g.AB,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.Ib.Au(Math.floor(e),Math.floor(f),Math.floor(h))}; g.g.Ib.Qr=function(a,c,d){a=g.g.Ib.Gy(g.g.Ib.parse(a));c=g.g.Ib.Gy(g.g.Ib.parse(c));return g.g.Ib.Au(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.Ib.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.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.zi=function(a){this.s=a;this.G=a.options.G;this.ef=a.options.Ed;this.Da=a.options.Da;this.Rc={Ly:19,ND:"blocklyTreeRoot",LD:"blocklyHidden",mx:"blocklyTreeRow",MD:"blocklyTreeLabel",Oo:"blocklyTreeIcon",kx:"blocklyTreeIconOpen",lx:"blocklyTreeIconNone",OD:"blocklyTreeSelected"};this.lA={mx:"blocklyTreeSeparator"};this.ef&&(this.Rc.cssTreeRow+=a.G?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.lA.cssTreeRow="blocklyTreeSeparatorHorizontal "+(a.G?"blocklyHorizontalTreeRtl":"blocklyHorizontalTree"), this.Rc.cssTreeIcon="")};b=g.zi.prototype;b.width=0;b.height=0;b.Ok=null; b.aa=function(){var a=this.s,c=v(this.s);this.wc=document.createElement("div");this.wc.className="blocklyToolboxDiv blocklyNonSelectable";this.wc.setAttribute("dir",a.G?"RTL":"LTR");c.parentNode.insertBefore(this.wc,c);c=a.Rb;c.subscribe(this.wc,"toolbox","background-color");c.subscribe(this.wc,"toolboxText","color");g.ka(this.wc,"mousedown",this,function(d){g.g.fj(d)||d.target==this.wc?g.mc(!1):g.mc(!0);g.Touch.nh()},!1,!0);c={Cg:a.options.Cg,Kb:a,G:a.G,Ge:a.options.Ge,Ed:a.Ed,Da:a.options.Da,Rg:a.options.Rg}; this.M=null;if(a.Ed){if(!g.vl)throw Error("Missing require for Blockly.HorizontalFlyout");this.M=new g.vl(c)}else{if(!g.sg)throw Error("Missing require for Blockly.VerticalFlyout");this.M=new g.sg(c)}g.g.o.Zi(this.M.Ga("svg"),v(this.s));this.M.aa(a);this.Rc.cleardotPath=a.options.lf+"1x1.gif";this.Rc.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.G?"Rtl":"Ltr");vb(this,a.options.Of)}; function vb(a,c){a.ud&&(a.ud.I(),a.Ok=null);var d=new g.Aa.Ai(a,a.Rc);a.ud=d;Ta(d,null);d.rz=a.ME;d.qz=a.LE;var e=null;if(c){a.ud.Cf=[];a.gt=!1;e=wb(a,c,a.ud,a.s.options.lf);if(a.ud.Cf.length)throw Error("Toolbox cannot have both blocks and categories in the root level.");xb(a.s)}d.za(a.wc);e&&Ta(d,e);yb(a);a.position();a.ef&&g.g.U.Eb(a.ud.ta(),g.g.U.State.jC,"horizontal")} b.ME=function(a){if(a==this.ud)return!1;this.Ok&&(ib(this.Ok).style.backgroundColor="");if(a){var c=a.Fk||"#57e";ib(a).style.backgroundColor=c;yb(this,a)}return!0};b.LE=function(a,c){c&&c.Cf&&c.Cf.length?(this.M.show(c.Cf),this.Ok!=c&&this.M.pc.set(0),g.De&&g.navigation.Eb(g.navigation.vr)):(this.M.ya(),!g.De||c instanceof g.zi.Br||g.navigation.Eb(g.navigation.Gl));a!=c&&a!=this&&(a=new g.i.od(null,"category",a&&a.cc(),c&&c.cc()),a.uc=this.s.id,g.i.Ka(a));c&&(this.Ok=c)};b.XE=function(){g.$k(this.s)}; b.Nh=function(a){var c=this.ud.Id;if(!c)return!1;switch(a.name){case g.navigation.Za.pe:return tb(c);case g.navigation.Za.qo:return rb(c);case g.navigation.Za.oe:return sb(c);case g.navigation.Za.fo:return qb(c);default:return!1}};b.I=function(){this.M.I();this.ud.I();this.s.Rb.unsubscribe(this.wc);g.g.o.removeNode(this.wc);this.Ok=this.s=null};b.Mf=function(){return this.width};b.ey=function(){return this.height}; b.position=function(){var a=this.wc;if(a){var c=v(this.s);c=g.hA(c);this.ef?(a.style.left="0",a.style.height="auto",a.style.width=c.width+"px",this.height=a.offsetHeight,this.Da==g.qg?a.style.top="0":a.style.bottom="0"):(this.Da==g.pg?a.style.right="0":a.style.left="0",a.style.height=c.height+"px",this.width=a.offsetWidth);this.M.position()}}; function wb(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.ud.createNode(m);h.Az=a.XE;h.Cf=[];d.add(h);var n=l.getAttribute("custom");n?h.Cf=n:(n=wb(a,l,h,e))&&(f=n);var q=l.getAttribute("categorystyle");if((n=l.getAttribute("colour"))&&q)h.Fk="",console.warn('Toolbox category "'+m+'" can not have both a style and a colour');else if(q){n=a;var r=h;r.YL=q;var u=n.s.kp();q&&u&&((u=u.mD[q])&& u.Ib?zb(n,u.Ib,r,m):console.warn('Style "'+q+'" must exist and contain a colour value'))}else zb(a,n,h,m);"true"==l.getAttribute("expanded")?(h.Cf.length&&(f=h),h.wj(!0)):h.wj(!1);h=l;break;case "SEP":if(h&&"CATEGORY"==h.tagName.toUpperCase()){d.add(new g.zi.Br(a.lA));break}case "BLOCK":case "SHADOW":case "LABEL":case "BUTTON":d.Cf.push(l),h=l}return f} function zb(a,c,d,e){c=g.g.nc(c);if(null===c||""===c)d.Fk="";else{var f=Number(c);isNaN(f)?(f=g.g.Ib.parse(c))?(d.Fk=f,a.gt=!0):(d.Fk="",console.warn('Toolbox category "'+e+'" has unrecognized colour attribute: '+c)):(d.Fk=g.Ky(f),a.gt=!0)}}function yb(a,c){c=(c||a.ud).xh(!1);for(var d=0,e;e=c[d];d++){var f=ib(e);if(f){var h=a.gt?"8px solid "+(e.Fk||"#ddd"):"none";a.s.G?f.style.borderRight=h:f.style.borderLeft=h}yb(a,e)}} b.rm=function(){if(!this.wc)return null;var a=this.wc.getBoundingClientRect(),c=a.top,d=c+a.height,e=a.left;a=e+a.width;return this.Da==g.qg?new g.g.Rect(-1E7,d,-1E7,1E7):this.Da==g.xi?new g.g.Rect(c,1E7,-1E7,1E7):this.Da==g.zd?new g.g.Rect(-1E7,1E7,-1E7,a):new g.g.Rect(-1E7,1E7,e,1E7)};g.zi.Br=function(a){g.Aa.jh.call(this,null,"",a)};g.g.object.T(g.zi.Br,g.Aa.jh); g.hd.register([".blocklyToolboxDelete {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {", "height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;", "}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {", "background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {", 'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]);g.i.rl=function(a){this.uc=a.id;this.group=g.i.Ub();this.Jc=!1};g.g.object.T(g.i.rl,g.i.Abstract);g.i.rl.prototype.type=g.i.oB;g.i.rl.prototype.Wa=function(){var a={type:this.type};this.group&&(a.group=this.group);this.uc&&(a.workspaceId=this.uc);return a};g.i.rl.prototype.sa=function(a){this.uc=a.workspaceId;this.group=a.group};g.O={};g.O.rA=function(a){var c=I,d=g.g.xml.createElement("xml"),e=g.O.dH(g.N.Ew(c));e.hasChildNodes()&&d.appendChild(e);var f=wa(c,!0);e=0;for(var h;h=f[e];e++)d.appendChild(h.Vu(a));c=A(c,!0);for(e=0;f=c[e];e++)d.appendChild(g.O.Sr(f,a));return d};g.O.dH=function(a){for(var c=g.g.xml.createElement("variables"),d=0,e;e=a[d];d++){var f=g.g.xml.createElement("variable");f.appendChild(g.g.xml.createTextNode(e.name));e.type&&f.setAttribute("type",e.type);f.id=e.ua();c.appendChild(f)}return c}; g.O.Sr=function(a,c){var d;a.v.G&&(d=a.v.Mf());c=g.O.lh(a,c);var e=a.Oa();c.setAttribute("x",Math.round(a.v.G?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c};g.O.lE=function(a){var c=!1;a.name&&(a.gk?c=!0:a.uf&&(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.iA(c)):null}; g.O.YC=function(a,c){for(var d=0,e;e=a.P[d];d++)for(var f=0,h;h=e.Na[f];f++)(h=g.O.lE(h))&&c.appendChild(h)}; g.O.lh=function(a,c){var d=g.g.xml.createElement(a.$a?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.eb){var e=a.eb();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}g.O.YC(a,d);if(e=a.te.text){var f=a.te.size,h=a.te.mu,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.P[f];f++){var l;k=!0;if(h.type!=g.jg){var m=C(h.connection);h.type==g.Ua?l=g.g.xml.createElement("value"):h.type==g.Ra&&(l=g.g.xml.createElement("statement"));e=h.connection.nf;!e||m&&m.$a||l.appendChild(g.O.Rw(e,c));m&&(l.appendChild(g.O.lh(m,c)),k=!1);l.setAttribute("name",h.name);k||d.appendChild(l)}}void 0!=a.Mg&&a.Mg!=a.kF&&d.setAttribute("inline",a.Mg);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.Zd()||a.$a||d.setAttribute("deletable", !1);a.Fc()||a.$a||d.setAttribute("movable",!1);a.cd()||d.setAttribute("editable",!1);if(f=t(a))l=g.g.xml.createElement("next"),l.appendChild(g.O.lh(f,c)),d.appendChild(l);e=a.V&&a.V.nf;!e||f&&f.$a||l.appendChild(g.O.Rw(e,c));return d}; g.O.Rw=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.O.Dd=function(a){a=g.g.xml.Dd(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1 $2")}while(a!=d);return a};g.O.tL=function(a){a=g.O.Dd(a).split("<");for(var c="",d=1;d"!=e.slice(-2)&&(c+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1");return a.replace(/^\n/,"")}; g.O.$h=function(a){var c=g.g.xml.QG(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};g.O.pL=function(a,c){c.Lc(!1);c.clear();a=g.O.uh(a,c);c.Lc(!0);return a}; g.O.uh=function(a,c){if(a instanceof g.Fb){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var e;c.G&&(e=c.Mf());d=[];g.g.o.tn();var f=a.childNodes.length,h=g.i.Ub();h||g.i.Z(!0);c.Lc&&c.Lc(!1);var k=!0;try{for(var l=0;l=this.s.options.Gp)){a={scrollbars:!0,Cg:this.s.options.Cg,Kb:this.s,G:this.s.G,Ge:this.s.options.Ge,Rg:this.s.options.Rg};if(this.s.Ed){a.Da=this.s.Da==g.qg?g.xi:g.qg;if(!g.vl)throw Error("Missing require for Blockly.HorizontalFlyout");this.M=new g.vl(a)}else{a.Da=this.s.Da==g.pg?g.zd:g.pg;if(!g.sg)throw Error("Missing require for Blockly.VerticalFlyout");this.M=new g.sg(a)}Aa(this.s,this.VF.bind(this))}};b=g.Ar.prototype;b.Bi=47;b.On=44;b.ak=16;b.Sq=20; b.yl=20;b.lo=10;b.qr=0;b.rr=32;b.wB=.1;b.vt=!1;b.Hp=0;b.H=null;b.gq=null;b.Dt=0;b.Jh=0;b.Lm=0;b.dl=0; b.Ga=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.Bi,height:this.On,y:this.ak},c);var d=g.g.o.K("image",{width:g.nd.width,x:-this.qr,height:g.nd.height,y:-this.rr,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.H);d.setAttributeNS(g.g.o.Ue,"xlink:href",this.s.options.lf+g.nd.url);c=g.g.o.K("clipPath",{id:"blocklyTrashLidClipPath"+a},this.H); g.g.o.K("rect",{width:this.Bi,height:this.ak},c);this.gq=g.g.o.K("image",{width:g.nd.width,x:-this.qr,height:g.nd.height,y:-this.rr,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.H);this.gq.setAttributeNS(g.g.o.Ue,"xlink:href",this.s.options.lf+g.nd.url);g.ka(this.H,"mouseup",this,this.click);g.yc(d,"mouseover",this,this.FF);g.yc(d,"mouseout",this,this.DF);this.Ir();return this.H}; b.aa=function(a){0this.Hp&&1>this.Jh&&(this.Dt=setTimeout(this.Ir.bind(this),20))};function Db(a,c){var d=a.s.Da==g.pg||a.s.Ed&&a.s.G;a.gq.setAttribute("transform","rotate("+(d?-c:c)+","+(d?4:a.Bi-4)+","+(a.ak-2)+")")}b.close=function(){Cb(this,!1)}; b.click=function(){if(this.Ji.length){for(var a=[],c=0,d;d=this.Ji[c];c++)a[c]=g.O.$h(d);this.M.show(a)}};b.FF=function(){this.Ji.length&&Cb(this,!0)};b.DF=function(){Cb(this,!1)}; b.VF=function(a){if(!(0>=this.s.options.Gp)&&a.type==g.i.Nn&&"shadow"!=a.$t.tagName.toLowerCase()){for(var c=a=a.$t.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.O.Dd(a);if(-1==this.Ji.indexOf(a)){for(this.Ji.unshift(a);this.Ji.length>this.s.options.Gp;)this.Ji.pop();this.Hp=this.wB;Db(this,45*this.Hp)}}};g.W=Object.create(null);g.ra=function(a,c){this.B=a;this.type=c};g.ra.Sn=0;g.ra.ew=1;g.ra.hw=2;g.ra.gw=3;g.ra.cw=4;g.ra.dw=5;g.ra.fw=6;b=g.ra.prototype;b.ga=null;b.vg=null;b.nf=null;b.Sb=0;b.Ya=0; b.Xe=function(a){var c=this,d=c.B,e=a.B;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=C(c),h=c.nf;c.nf=null;if(f.$a)h=g.O.lh(f),f.I(),f=null;else if(c.type==g.Ua){if(!f.L)throw Error("Orphan block does not have an output connection.");var k=g.ra.Xy(e,f);k&&(f.L.connect(k),f=null)}else if(c.type==g.Ra){if(!f.Y)throw Error("Orphan block does not have a previous connection.");for(k=e;k.V;){var l=t(k);if(l&&!l.$a)k=l;else{Eb(f.Y,k.V)&&(k.V.connect(f.Y),f=null);break}}}if(f&&(c.disconnect(), g.i.Jc)){var m=g.i.Ub();setTimeout(function(){f.v&&!f.getParent()&&(g.i.Z(m),f.L?f.L.Jp(c):f.Y&&f.Y.Jp(c),g.i.Z(!1))},g.Pn)}c.nf=h}var n;g.i.isEnabled()&&(n=new g.i.ll(e));g.ra.BD(c,a);e.Xk(d);n&&(n.tj(),g.i.Ka(n))};b.I=function(){if(this.isConnected()){this.nf=null;var a=C(this);a.$a?a.I():D(a)}};function H(a){return a.type==g.Ua||a.type==g.Ra}b.isConnected=function(){return!!this.ga}; function Xa(a,c){if(!c)return g.ra.gw;if(H(a))var d=a.B,e=c.B;else e=a.B,d=c.B;return d&&d==e?g.ra.ew:c.type!=g.dk[a.type]?g.ra.hw:d&&e&&d.v!==e.v?g.ra.dw:Eb(a,c)?d.$a&&!e.$a?g.ra.fw:g.ra.Sn:g.ra.cw} function Ya(a,c){switch(Xa(a,c)){case g.ra.Sn:break;case g.ra.ew:throw Error("Attempted to connect a block to itself.");case g.ra.dw:throw Error("Blocks not on same workspace.");case g.ra.hw:throw Error("Attempt to connect incompatible types.");case g.ra.gw:throw Error("Target connection is null.");case g.ra.cw:throw Error("Connection checks failed. "+(a+" expected "+a.vg+", found "+c.vg));case g.ra.fw:throw Error("Connecting non-shadow to shadow block.");default:throw Error("Unknown connection failure: this should never happen!"); }}b.vp=function(a){if(a.B.Ng()||Xa(this,a)!=g.ra.Sn)return!1;switch(a.type){case g.Se:return this.ga||-1!=g.jm.indexOf(a)?a=!1:a.ga?(a=C(a),a=a.Ng()?!(a.Y&&C(a.Y)):!1):a=!0,a;case g.Re:if(a.isConnected()&&!C(a).Ng()||this.isConnected())return!1;break;case g.Ua:if(a.isConnected()&&!C(a).Fc()&&!C(a).$a)return!1;break;case g.Ra:if(a.isConnected()&&!this.B.V&&!C(a).$a&&C(a).V)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=g.jm.indexOf(a)?!1:!0};b.Jp=function(){}; b.connect=function(a){if(this.ga!=a){Ya(this,a);var c=g.i.Ub();c||g.i.Z(!0);H(this)?this.Xe(a):a.Xe(this);c||g.i.Z(!1)}};g.ra.BD=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.ga=c;c.ga=a};g.ra.HG=function(a,c){for(var d=!1,e=0;ed)){var e=Gb(c,a.wa());a.L?(e.x+=(a.G?3:-3)*d,e.y+=13*d):a.Y&&(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},v(c));g.hb.$w(a,new Date,d)}};g.hb.$w=function(a,c,d){var e=(new Date-c)/150;1a.v.scale)){var c=J(a).height;c=Math.atan(10/c)/Math.PI*180;a.G||(c*=-1);g.hb.yx(a.wa(),c,new Date)}};g.hb.yx=function(a,c,d){var e=(new Date-d)/200;1a-g.ZA)}if(a.Gc||a.zb)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Gc||!a.zb);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0} function Jb(a){a.zb&&(g.g.o.removeNode(g.ra.Jy),delete g.ra.Jy);if(a.kt){var c=a.zb;c.type!=g.Ua||c.isConnected()?Kb(a.Hk,!1):a.Hk.cF(c,!1);a.Hk=null;a.kt=!1}else if(a.ij)if(a.ij){c=a.ij;var d=c.B,e=d.V,f=d.Y,h=d.L;h=c.type==g.Ua&&!(h&&h.ga);!(c!=e||f&&f.ga)||h?D(C(c),!1):c.type==g.Ra&&c!=e?(e=c.ga,D(e.B,!1),f=f?f.ga:null,D(d,!0),f&&f.connect(e)):D(d,!0);if(c.ga)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.ij=null;d.wa().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")} g.jo.prototype.Bk=function(){var a=[];this.zk&&a.push(this.zk);this.gj&&a.push(this.gj);return a};g.di=function(a,c){this.Bb=a;this.s=c;this.If=new g.jo(this.Bb);this.Ni=null;this.dg=!1;this.Zf=this.Bb.Oa();this.Wo=g.di.iF(a)};g.di.prototype.I=function(){this.qc=this.s=this.Bb=null;this.Wo.length=0;this.If&&(this.If.I(),this.If=null)};g.di.iF=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=Lb(e);for(var f=0;fg.J.oC&&g.J.ya()}else g.J.Op!=g.J.cb&&(clearTimeout(g.J.qn),g.J.Bt=a.pageX,g.J.Ct=a.pageY,g.J.qn=setTimeout(g.J.GG,g.J.yB))};g.J.ya=function(){g.J.visible&&(g.J.visible=!1,g.J.Ca&&(g.J.Ca.style.display="none"));g.J.qn&&clearTimeout(g.J.qn)};g.J.block=function(){g.J.ya();g.J.nk=!0};g.J.$G=function(){g.J.nk=!1}; g.J.GG=function(){if(!g.J.nk&&(g.J.Op=g.J.cb,g.J.Ca)){g.J.Ca.innerHTML="";for(var a=g.J.cb.qf;"function"==typeof a;)a=a();a=g.g.ab.sA(a,g.J.NB);a=a.split("\n");for(var c=0;cd+window.scrollY&&(f-=g.J.Ca.offsetHeight+2*g.J.Xv);a?e=Math.max(g.J.Rq-window.scrollX,e):e+g.J.Ca.offsetWidth>c+window.scrollX-2*g.J.Rq&&(e=c-g.J.Ca.offsetWidth-2*g.J.Rq);g.J.Ca.style.top=f+"px";g.J.Ca.style.left=e+"px"}};g.Uj=function(a,c){this.qc=this.rc=this.yj=this.zj=this.ae=this.pd=this.hz=null;this.ls=c;this.Em=this.cj=this.Fm=this.Ri=!1;this.kf=a;this.M=this.ci=this.We=this.tg=this.Lp=this.Kp=null;this.xp=this.Ti=this.Lw=!1;this.Fy=!g.hB};b=g.Uj.prototype;b.I=function(){g.Touch.nh();g.J.$G();this.ls.Bc=null;this.Kp&&g.Xa(this.Kp);this.Lp&&g.Xa(this.Lp);this.M=this.qc=this.rc=this.yj=this.zj=null;this.We&&(this.We.I(),this.We=null);this.ci&&(this.ci.I(),this.ci=null);this.tg&&(this.tg.I(),this.tg=null)}; function Wb(a,c){a.pd=g.g.S.hm(new g.g.S(c.clientX,c.clientY),a.hz);if(a.Ri)var d=!1;else a.Ri=g.g.S.yF(a.pd)>(a.M?g.pB:g.gB),d=a.Ri;if(d){if(a.Lw)throw Error("updateIsDragging_ should only be called once per gesture.");a.Lw=!0;if(a.ae){a.Em=!0;a.tg=new g.ml(a.ae,a.qc);d=a.tg;g.i.Ub()||g.i.Z(!0);d.s.Lc(!1);d.lc.Or=!1;d.Pi&&d.St();d.lc.vj&&d.lc.vj(!0);var e=d.s.oa;e&&g.g.o.qb(e.wc,d.lc.Zd()?"blocklyToolboxDelete":"blocklyToolboxGrab");Sb(a.tg,a.kf,a.pd);d=!0}else d=!1;if(!d){if(a.rc)if(a.M?(a.M.Qy(a.rc)? ((d=!Xb(a.M))||(d=a.pd,d=Math.atan2(d.y,d.x)/Math.PI*180,e=a.M.eE,d=d-e||d<-180+e||d>180-e?!0:!1),d?(a.qc=a.M.jb,Yb(a.qc),g.i.Ub()||g.i.Z(!0),a.yj=null,a.rc=Va(a.M,a.rc),a.rc.select(),d=!0):d=!1):d=!1,a.cj=d):a.rc.Fc()&&(a.cj=!0),a.cj){a.We=new g.di(a.rc,a.qc);d=a.We;e=a.pd;var f=a.Fy;g.i.Ub()||g.i.Z(!0);d.s.ej&&$a(d.Bb);g.g.o.tn();d.s.Lc(!1);g.hb.ys();if(d.Bb.getParent()||f&&d.Bb.V&&C(d.Bb.V))D(d.Bb,f),e=d.Rk(e),e=g.g.S.sum(d.Zf,e),d.Bb.translate(e.x,e.y),g.hb.ZD(d.Bb);d.Bb.vj(!0);d.Bb.St(); (e=d.s.oa)&&g.g.o.qb(e.wc,d.Bb.Zd()?"blocklyToolboxDelete":"blocklyToolboxGrab");Mb(a.We,a.kf,a.pd);d=!0}else d=!1;else d=!1;if(d=!d)if(a.M)d=Xb(a.M);else if(d=a.qc)d=a.qc,d=d.options.Hc&&d.options.Hc.vh;d&&(a.ci=a.M?new g.co(a.M):new g.Ml(a.qc),a.Fm=!0,a.ci.Qu())}g.Kh()}a.kf=c} b.zs=function(a){g.g.Ap(a)?this.cancel():(this.Ti=!0,g.hb.ys(),Yb(this.qc),this.qc.ej&&this.qc.resize(),oa(this.qc),this.kf=a,g.mc(!!this.M),g.J.block(),this.rc&&(!this.rc.Wb&&a.shiftKey?(g.navigation.Ls(),w(this.ls.Va,g.navigation.bt(this.rc))):this.rc.select()),g.g.fj(a)?ba(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||g.wF(a,this),this.hz=new g.g.S(a.clientX,a.clientY),this.Fy=a.altKey||a.ctrlKey||a.metaKey,this.mk(a)))}; b.mk=function(a){this.Kp=g.ka(document,"mousemove",null,this.wm.bind(this));this.Lp=g.ka(document,"mouseup",null,this.mp.bind(this));a.preventDefault();a.stopPropagation()};b.wm=function(a){Wb(this,a);this.Fm?this.ci.vh(this.pd):this.cj?Mb(this.We,this.kf,this.pd):this.Em&&Sb(this.tg,this.kf,this.pd);a.preventDefault();a.stopPropagation()}; b.mp=function(a){Wb(this,a);g.Kh();if(this.xp)console.log("Trying to end a gesture recursively.");else{this.xp=!0;if(this.Em)Tb(this.tg,a,this.pd);else if(this.cj)Pb(this.We,a,this.pd);else if(this.Fm){var c=this.ci;c.vh(this.pd);ra(c.s)}else if(this.ae&&!this.Ri)this.ae.DG&&this.ae.DG(),this.ae.select&&this.ae.select();else if(Zb(this))this.zj.Le(),$b(this);else if(this.yj&&!this.Ri&&!Zb(this))this.M&&this.M.lk?this.rc.isEnabled()&&(g.i.Ub()||g.i.Z(!0),Rb(Va(this.M,this.rc))):g.i.Ka(new g.i.od(this.yj, "click",void 0,void 0)),$b(this),g.i.Z(!1);else if(!(this.yj||this.ae||this.zj||this.Ri))if(c=this.ls,a.shiftKey){g.navigation.Ls();var d=g.g.AG(c,new g.g.S(a.clientX,a.clientY));d=g.F.cm(c,d);w(c.Va,d)}else g.selected&&Vb(g.selected);a.preventDefault();a.stopPropagation();this.I()}};b.cancel=function(){if(!this.xp){g.Kh();if(this.Em)Tb(this.tg,this.kf,this.pd);else if(this.cj)Pb(this.We,this.kf,this.pd);else if(this.Fm){var a=this.ci;a.vh(this.pd);ra(a.s)}this.I()}}; function ba(a,c){a.rc?($b(a),g.mc(a.M),a.rc.pn(c)):a.ae?a.ae.pn(c):a.qc&&!a.M&&(g.mc(),a.qc.pn(c));c.preventDefault();c.stopPropagation();a.I()}function ac(a,c,d){if(a.Ti)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");a.qc||(a.qc=d);a.kf=c;a.zs(c);g.De&&g.navigation.Eb(g.navigation.Gl)}function bc(a,c,d){if(a.Ti)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");a.M||(a.M=d);ac(a,c,d.Dk())} function $b(a){a.rc&&!a.M&&$a(a.rc)}function cc(a,c){a.yj||a.ae||(a.yj=c,c.Wb&&c!=G(c)?dc(a,G(c)):dc(a,c))}function dc(a,c){c.$a?dc(a,c.getParent()):a.rc=c}function Zb(a){if(a.zj){var c=a.zj;c=!!c.B&&c.B.cd()&&!!c.Le&&"function"===typeof c.Le}else c=!1;return c&&!a.Ri&&(!a.M||!a.M.lk)}b.dc=function(){return this.Fm||this.cj||this.Em};b.Bk=function(){return this.We?this.We.Bk():[]};g.Uj.nt=function(){for(var a=g.Fb.getAll(),c=0,d;d=a[c];c++)if(d.Bc)return!0;return!1};g.Ha=function(a,c,d){this.kA=this.Ij=this.kb=null;this.Lb=new g.g.qe(0,0);this.Sc=null;d&&this.Ad(d);this.setValue(a);c&&(this.Ij=c)};g.Ha.rv=16;g.Ha.pw=12.5;g.Ha.Nl=10;g.Ha.Aw=10;g.Ha.ji=g.Ha.Nl/2;b=g.Ha.prototype;b.name=void 0;b.ez=50;b.B=null;b.ff=!0;b.bi=!0;b.Io=null;g.Ha.Vv="\u00a0";b=g.Ha.prototype;b.uf=!0;b.gk=!1;b.Ad=function(a){var c=a.tooltip;"string"==typeof c&&(c=g.g.nc(a.tooltip));c&&this.vb(c)};b.Ku=function(a){if(this.B)throw Error("Field already bound to a block.");this.B=a}; b.aa=function(){this.we||(this.we=g.g.o.K("g",{},null),this.isVisible()||(this.we.style.display="none"),this.B.wa().appendChild(this.we),this.Yi(),this.Yg(),this.vb(this.kA),g.J.mk(this.Io||this.wa()),this.gz=g.ka(this.Io||this.wa(),"mousedown",this,this.Oh),this.Xi())};b.Yi=function(){this.Lb.height=Math.max(this.Lb.height,g.Ha.rv);this.Lb.width=Math.max(this.Lb.width,g.Ha.Nl);this.Ei=g.g.o.K("rect",{rx:4,ry:4,x:0,y:0,height:this.Lb.height,width:this.Lb.width},this.we);ec(this)};b.Xi=function(){}; function ec(a){a.tc=g.g.o.K("text",{"class":"blocklyText",y:g.Ha.pw,x:a.Ei?g.Ha.ji:0},a.we);a.Ej=document.createTextNode("");a.tc.appendChild(a.Ej)}b.pm=function(a){this.setValue(a.textContent)};b.iA=function(a){a.textContent=this.getValue();return a};b.I=function(){g.D.ym(this);g.$.ym(this);this.gz&&g.Xa(this.gz);g.g.o.removeNode(this.we)}; b.Yg=function(){var a=this.Io||this.wa();this.uf&&a&&(this.B.cd()?(g.g.o.qb(a,"blocklyEditableText"),g.g.o.fc(a,"blocklyNonEditableText"),a.style.cursor=this.Cq):(g.g.o.qb(a,"blocklyNonEditableText"),g.g.o.fc(a,"blocklyEditableText"),a.style.cursor=""))};b.isVisible=function(){return this.bi};b.Qb=function(a){if(this.bi!=a){this.bi=a;var c=this.wa();c&&(c.style.display=a?"block":"none")}};function fc(a,c){a.Ij=c}b.sy=function(){return this.Ij};b.wa=function(){return this.we};b.Ne=function(){}; b.Tf=function(){if(this.Ej){this.Ej.nodeValue=gc(this);var a=g.g.o.jp(this.tc);this.Ei&&(a+=g.Ha.Nl,this.Ei.setAttribute("width",a));this.Lb.width=a}};b.Hg=function(){if(!this.isVisible())return new g.g.qe(0,0);this.ff?(this.Tf(),this.ff=!1):this.bi&&0==this.Lb.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.Tf());return this.Lb}; function gc(a){var c=a.cc();if(!c)return g.Ha.Vv;c.length>a.ez&&(c=c.substring(0,a.ez-2)+"\u2026");c=c.replace(/\s/g,g.Ha.Vv);a.B&&a.B.G&&(c+="\u200f");return c}b.cc=function(){if(this.Ck){var a=this.Ck.call(this);if(null!==a)return String(a)}return String(this.getValue())};b.Yk=function(){throw Error("setText method is deprecated");};b.Pm=function(){this.ff=!0};function hc(a){a.ff=!0;a.B&&a.B.ca&&(a.B.za(),a.B.Hb())} b.setValue=function(a){if(null!==a){var c=this.Dg(a);a=ic(this,a,c);if(!(a instanceof Error)){if(c=this.sy())if(c=c.call(this,a),a=ic(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.B&&g.i.isEnabled()&&g.i.Ka(new g.i.eg(this.B,"field",this.name||null,c,a)),this.sh(a),this.ff&&hc(this))}}};function ic(a,c,d){if(null===d)return a.Ex(),a.ff&&hc(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.kb};b.Dg=function(a){return null===a||void 0===a?null:a}; b.sh=function(a){this.kb=a;this.ff=!0};b.Ex=function(){};b.Oh=function(a){if(this.B&&this.B.v&&(a=this.B.v.Gg(a))){if(a.Ti)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.zj||(a.zj=this)}};b.vb=function(a){var c=this.Io||this.wa();c?c.qf=a||""===a?a:this.B:this.kA=a};b.fn=function(){return!1};b.Lf=function(){for(var a=null,c=this.B,d=c.P,e=0;ec||c>a.Na.length)throw Error("index "+c+" out of bounds.");if(!(d||""==d&&e))return c;"string"==typeof d&&(d=new g.Od(d));d.Ku(a.B);a.B.ca&&d.aa();d.name=e;d.nu&&(c=jc(a,c,d.nu));a.Na.splice(c,0,d);++c;d.Su&&(c=jc(a,c,d.Su));a.B.ca&&(a.B.za(),a.B.Hb());return c}b.isVisible=function(){return this.bi}; b.Qb=function(a){var c=[];if(this.bi==a)return c;for(var d=(this.bi=a)?"block":"none",e=0,f;f=this.Na[e];e++)f.Qb(a);if(this.connection){if(a)c=kc(this.connection);else if(e=this.connection,lc(e,!0),e.ga)for(e=p(C(e),!1),f=0;f=d)this.oh=g.Ky(d);else if(d=g.g.Ib.parse(c))this.oh=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);};function L(a,c){var d=a.v.kp().gD[c];if(d)a.Uw=d.colourSecondary,a.Vw=d.colourTertiary,a.Jg=d.Jg,a.mf(d.colourPrimary);else throw Error("Invalid style name: "+c);}function B(a,c){for(var d=0,e;e=a.P[d];d++)for(var f=0,h;h=e.Na[f];f++)if(h.name==c)return h;return null} b.et=function(){for(var a=[],c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)f.fn()&&a.push(f.getValue());return a};b.Ig=function(){for(var a=[],c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)f.fn()&&(f=this.v.cf(f.getValue()))&&a.push(f);return a};b.lq=function(a){for(var c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)f.fn()&&a.ua()==f.getValue()&&hc(f)};b.Sp=function(a,c){for(var d=0,e;e=this.P[d];d++)for(var f=0,h;h=e.Na[f];f++)h.fn()&&a==h.getValue()&&h.setValue(c)}; function z(a,c){return(a=B(a,c))?a.getValue():null}function qc(a,c,d){a=B(a,d);if(!a)throw Error('Field "'+d+'" not found.');a.setValue(c)}b.Wf=function(a,c){if(a){void 0===c&&(c=null);if(!this.Y){if(this.L)throw Error("Remove output connection prior to adding previous connection.");this.Y=this.Om(g.Se)}this.Y.Db(c)}else if(this.Y){if(this.Y.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.Y.I();this.Y=null}}; b.Vf=function(a,c){if(a)void 0===c&&(c=null),this.V||(this.V=this.Om(g.Ra)),this.V.Db(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.Ke=function(a,c){if(a){void 0===c&&(c=null);if(!this.L){if(this.Y)throw Error("Remove previous connection prior to adding output connection.");this.L=this.Om(g.Re)}this.L.Db(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.Je=function(a){this.Mg!=a&&(g.i.Ka(new g.i.eg(this,"inline",null,this.Mg,a)),this.Mg=a)}; function Fb(a){if(void 0!=a.Mg)return a.Mg;for(var c=1;ca&&(d=d.substring(0,a-3)+"...");return d};function M(a,c){return a.Bf(g.Ua,c)}function N(a,c){return a.Bf(g.jg,c||"")} function sc(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.Jg&&(a.Jg=c.style.Jg,c.style=null);if(c.style&&c.colour)throw Error(d+"Must not have both a colour and a style.");if(c.style){var e=c.style;try{L(a,e)}catch(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.mf(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.UG(c["message"+e]),m=[],n=0,q=[],r=0;r=u||u>h.length)throw Error('Block "'+f.type+'": Message index %'+u+" out of range.");if(m[u])throw Error('Block "'+f.type+'": Message index %'+u+" duplicated.");m[u]=!0;n++;q.push(h[u-1])}else(u=u.trim())&&q.push(u)}if(n!=h.length)throw Error('Block "'+f.type+'": Message does not reference all '+ h.length+" arg(s).");q.length&&("string"==typeof q[q.length-1]||g.g.ab.startsWith(q[q.length-1].type,"field_"))&&(r={type:"input_dummy"},k&&(r.align=k),q.push(r));k={LEFT:g.uq,RIGHT:g.Ln,CENTRE:g.iv};h=[];for(r=0;r=this.P.length)throw RangeError("Input index "+a+" out of bounds.");if(c>this.P.length)throw RangeError("Reference input "+c+" out of bounds.");var d=this.P[a];this.P.splice(a,1);ac?d-1:c},a.Kg)}function zc(a,c,d){var e=a.fb.length;d=c.call(a,0>d?-1:d,e);for(var f=0;f<=e;){var h=a.fb[d]||null;if(h&&h.isEnabled()){vc(a,d);break}f++;d=c.call(a,d,e)}}b.WE=function(a){(a=wc(this,a.target))&&a.isEnabled()&&(this.fb[this.Kg]||null)!==a&&(xc(this),this.Vg(a))};b.OE=function(a){var c=wc(this,a.target),d;if(d=c)c.isEnabled()&&(c.Vg(!0),Bc(c)),d=void 0;d&&a.preventDefault()}; b.TE=function(){this.focus()};b.VE=function(){this.ta()&&(this.blur(),xc(this),vc(this,-1))};b.ft=function(a){return 0!=this.fb.length&&Cc(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1};function Cc(a,c){var d=a.fb[a.Kg]||null;if(d&&"function"==typeof d.ft&&d.ft(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case g.g.Ia.Fq:d&&Bc(d);break;case g.g.Ia.zo:Ac(a);break;case g.g.Ia.$n:yc(a);break;default:return!1}return!0};g.mo=function(a,c){g.vc.call(this);this.Ze=a;this.setValue(c);this.Xo=!0};g.g.object.T(g.mo,g.vc);b=g.mo.prototype; b.Ga=function(){var a=document.createElement("div");a.id=this.ua();this.cb=a;a.className="goog-menuitem goog-option "+(this.Xo?"":"goog-menuitem-disabled ")+(this.$r?"goog-option-selected ":"")+(this.Nk()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.Sl){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(Dc(this));g.g.U.Xf(a,this.Bu||(this.Sl?g.g.U.ti.aC: g.g.U.ti.$B));g.g.U.Eb(a,g.g.U.State.El,this.Sl&&this.$r||!1)};function Dc(a){a=a.Ze;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.kb=a};b.getValue=function(){return this.kb};b.Xf=function(a){this.Bu=a};function Ec(a,c){if(a.Sl){a.$r=c;var d=a.ta();d&&a.isEnabled()&&(c?(g.g.o.qb(d,"goog-option-selected"),g.g.U.Eb(d,g.g.U.State.El,!0)):(g.g.o.fc(d,"goog-option-selected"),g.g.U.Eb(d,g.g.U.State.El,!1)))}} b.Vg=function(a){var c=this.ta();c&&this.isEnabled()&&(a?g.g.o.qb(c,"goog-menuitem-highlight"):g.g.o.fc(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.Xo};b.Kc=function(a){this.Xo=a;(a=this.ta())&&(this.Xo?g.g.o.fc(a,"goog-menuitem-disabled"):g.g.o.qb(a,"goog-menuitem-disabled"))};function Bc(a){a.Sl&&Ec(a,!a.$r);a.Cw&&a.Cw.call(a.VC,a)}function Fc(a,c,d){a.Cw=c;a.VC=d};g.g.jq={};g.g.jq.Hg=function(a){a=a.ta();var c=g.g.style.Hg(a);c.height=a.scrollHeight;return c};g.g.jq.WC=function(a,c,d){c.left+=d.width;c.right+=d.width;a.left+=d.width;a.right+=d.width};g.Ba={};g.Ba.Po=null;g.Ba.Kx=null;g.Ba.show=function(a,c,d){g.$.show(g.Ba,d,null);if(c.length){var e=g.Ba.oG(c,d);g.Ba.ed(e,a,d);setTimeout(function(){e.ta().focus()},1);g.Ba.Po=null}else g.Ba.ya()};g.Ba.oG=function(a,c){var d=new g.mi;bb(d,c);for(var e=0,f;f=a[e];e++){var h=new g.mo(f.text);bb(h,c);d.Ol(h,d.fb.length,!0);h.Kc(f.enabled);f.enabled&&Fc(h,function(){g.Ba.ya();this.tb()},f)}return d}; g.Ba.ed=function(a,c,d){var e=g.g.KE();c={top:c.clientY+e.top,bottom:c.clientY+e.top,left:c.clientX+e.left,right:c.clientX+e.left};g.Ba.ID(a);var f=g.g.jq.Hg(a);d&&g.g.jq.WC(e,c,f);g.$.pG(e,c,f,d);a.ta().focus()};g.Ba.ID=function(a){a.za(g.$.Ca);var c=a.ta();g.g.o.qb(c,"blocklyContextMenu");g.ka(c,"contextmenu",null,g.g.OF);a.focus()};g.Ba.ya=function(){g.$.ym(g.Ba);g.Ba.Po=null;g.Ba.Kx&&g.Xa(g.Ba.Kx)}; g.Ba.Eo=function(a,c){return function(){g.i.disable();try{var d=g.O.Oi(c,a.v),e=a.Oa();e.x=a.G?e.x-g.md:e.x+g.md;e.y+=2*g.md;d.moveBy(e.x,e.y)}finally{g.i.enable()}g.i.isEnabled()&&!d.$a&&g.i.Ka(new g.i.Rn(d));d.select()}};g.Ba.dD=function(a){var c=p(a,!1).length,d=t(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,tb:function(){g.i.Z(!0);a.I(!0,!0);g.i.Z(!1)}}}; g.Ba.fD=function(a){return{enabled:!("function"==typeof a.Ec?!a.Ec():!a.Ec),text:g.h.HELP,tb:function(){var c="function"==typeof a.Ec?a.Ec():a.Ec;c&&window.open(c)}}};g.Ba.eD=function(a){var c=za(a.v)?ya(a.v,g.g.Ss(a,!0)):!0;return{text:g.h.DUPLICATE_BLOCK,enabled:c,tb:function(){g.Gx(a)}}};g.Ba.cD=function(a){var c={enabled:!g.g.userAgent.lg};a.qk?(c.text=g.h.REMOVE_COMMENT,c.tb=function(){a.Wh(null)}):(c.text=g.h.ADD_COMMENT,c.tb=function(){a.Wh("")});return c}; g.Ba.qL=function(a){return{text:g.h.uK,enabled:!0,tb:function(){g.i.Z(!0);a.I(!0,!0);g.i.Z(!1)}}};g.Ba.rL=function(a){return{text:g.h.aI,enabled:!0,tb:function(){g.Gx(a)}}}; g.Ba.aM=function(a,c){if(!g.jk)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!g.g.userAgent.lg};d.text=g.h.kH;d.tb=function(){var e=new g.jk(a,g.h.jL,g.jk.eB,g.jk.eB),f=aa(a).getBoundingClientRect();f=new g.g.S(c.clientX-f.left,c.clientY-f.top);var h=g.g.tm(a.bb);f=g.g.S.hm(f,h);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.ca&&(e.Ce(),e.za(),e.select())};return d};g.ng=function(a,c){g.ng.w.constructor.call(this,a,c);this.Gf=a.v.No[c];this.nx=a.v.No[g.dk[c]];this.oj=new g.g.S(0,0);this.Ch=!1;this.Iy=!this.Gf};g.g.object.T(g.ng,g.ra);b=g.ng.prototype;b.I=function(){g.ng.w.I.call(this);this.Ch&&Gc(this.Gf,this)};function Hc(a,c){var d=a.Sb-c.Sb;a=a.Ya-c.Ya;return Math.sqrt(d*d+a*a)} function Za(a,c){if(!a.B.v.dc()){var d=G(a.B);if(!d.Wb){var e=!1;if(!d.Fc()){d=G(c.B);if(!d.Fc())return;c=a;e=!0}var f=g.selected==d;f||d.Ao();var h=c.Sb+g.md+Math.floor(Math.random()*g.yq)-a.Sb,k=c.Ya+g.md+Math.floor(Math.random()*g.yq)-a.Ya;e&&(k=-k);d.G&&(h=c.Sb-g.md-Math.floor(Math.random()*g.yq)-a.Sb);d.moveBy(h,k);f||d.gn()}}}b.moveTo=function(a,c){this.Ch&&Gc(this.Gf,this);this.Sb=a;this.Ya=c;this.Iy||Ic(this.Gf,this)};b.moveBy=function(a,c){this.moveTo(this.Sb+a,this.Ya+c)}; function Jc(a,c){a.moveTo(c.x+a.oj.x,c.y+a.oj.y)}function Kc(a,c,d){a.oj.x=c;a.oj.y=d}function Lc(a){var c=a.ga.Sb-a.Sb,d=a.ga.Ya-a.Ya;if(0!=c||0!=d){a=C(a);var e=a.wa();if(!e)throw Error("block is not rendered.");e=g.g.ze(e);a.wa().setAttribute("transform","translate("+(e.x-c)+","+(e.y-d)+")");Qb(a,-c,-d)}} b.closest=function(a,c){var d=this.nx;if(d.ac.length){var e=this.Ya,f=this.Sb;this.Sb=f+c.x;this.Ya=e+c.y;var h=Mc(d,this);c=null;for(var k=a,l,m=h-1;0<=m&&Math.abs(d.ac[m].Ya-this.Ya)<=a;)l=d.ac[m],this.vp(l,k)&&(c=l,k=Hc(l,this)),m--;for(;hc?!1:g.ng.w.vp.call(this,a)};b.Jp=function(a){Za(this,a)};b.ws=function(a,c){g.ng.w.ws.call(this,a,c);a.ca&&a.za();c.ca&&(Bb(c),c.za())}; b.yu=function(){var a=this.B,c=this.nf;if(a.v&&c&&g.i.Jc){g.ng.w.yu.call(this);c=C(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.Ce();c.za(!1);a.ca&&a.za()}};b.lz=function(a){return Nc(this.nx,this,a)};b.Xe=function(a){g.ng.w.Xe.call(this,a);var c=this.B;a=a.B;c.ca&&Bb(c);a.ca&&Bb(a);c.ca&&a.ca&&(this.type==g.Ra||this.type==g.Se?a.za():c.za())};b.sz=function(){this.isConnected()&&!Eb(this,this.ga)&&(D(H(this)?C(this):this.B),this.B.Hb())};g.va=function(a,c,d){this.H=g.g.o.K("g",{},null);this.H.Bn="";this.rj=a.Sg.cz(this.H);this.yn=this.rj.xn||null;this.Kd=this.rj.Zk||null;this.Bj=this.rj.zn||null;this.Kd.qf=this;this.ca=!1;this.Jn=g.g.$i()&&!!a.Td;g.J.mk(this.Kd);g.va.w.constructor.call(this,a,c,d);this.H.dataset&&(this.H.dataset.id=this.id);this.Sc=null};g.g.object.T(g.va,g.Qn);g.va.prototype.height=0;g.va.prototype.width=0;g.va.prototype.Md=null;g.va.LI=-1;g.va.zq="TEMP_COLLAPSED_WARNING_";g.va.sC=10;g.va.Vq=25;g.va.ih=8; g.va.og=!1;b=g.va.prototype;b.Ce=function(){if(!this.v.ca)throw TypeError("Workspace is headless.");for(var a=0,c;c=this.P[a];a++)c.aa();c=Lb(this);for(a=0;a=a.ac.length)return-1;for(var e=c.Ya,f=d;0<=f&&a.ac[f].Ya==e;){if(a.ac[f]==c)return f;f--}for(;dc.Ya)e=f;else{d=f;break}}return d}function Gc(a,c){if(!c.Ch)throw Error("Connection not in database.");var d=Tc(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.Ch=!1;a.ac.splice(d,1)} function Nc(a,c,d){function e(n){var q=h-f[n].Sb,r=k-f[n].Ya;Math.sqrt(q*q+r*r)<=d&&m.push(f[n]);return r document.");}else a=null;return a};g.Sd=function(a,c){g.Sd.w.constructor.call(this,a,c);this.zp=!1;this.se={};this.cA=this.an=0;this.du=null};g.g.object.T(g.Sd,g.Uj);g.Sd.SC=5;g.Sd.TC=6;b=g.Sd.prototype;b.zs=function(a){g.Sd.w.zs.call(this,a);!this.xp&&g.Touch.Cp(a)&&Vc(this,a)};b.mk=function(a){this.du=g.ka(document,"mousedown",null,this.YE.bind(this),!0);this.Kp=g.ka(document,"mousemove",null,this.wm.bind(this),!0);this.Lp=g.ka(document,"mouseup",null,this.mp.bind(this),!0);a.preventDefault();a.stopPropagation()}; b.YE=function(a){!this.dc()&&g.Touch.Cp(a)&&(Vc(this,a),this.zp&&g.Kh())};b.wm=function(a){if(this.dc())g.Touch.Mu(a)&&g.Sd.w.wm.call(this,a);else if(this.zp){if(g.Touch.Cp(a)){this.se[g.Touch.lp(a)]=Wc(this,a);var c=Object.keys(this.se);if(2==c.length){c=g.g.S.Bx(this.se[c[0]],this.se[c[1]])/this.cA;if(0this.an){var d=c-this.an;d=0Object.keys(this.se).length&&(this.se={},this.an=0)}!this.zp||this.dc()?g.Touch.Mu(a)&&g.Sd.w.mp.call(this,a):(a.preventDefault(),a.stopPropagation(),this.I())};b.I=function(){g.Sd.w.I.call(this);this.du&&g.Xa(this.du)};function Vc(a,c){a.se[g.Touch.lp(c)]=Wc(a,c);var d=Object.keys(a.se);2==d.length&&(a.cA=g.g.S.Bx(a.se[d[0]],a.se[d[1]]),a.zp=!0,c.preventDefault())} function Wc(a,c){return a.qc?new g.g.S(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};g.xw=function(a){this.ju=a;this.Fl=Object.create(null)};b=g.xw.prototype;b.At=null;b.I=function(){this.Fl=this.ju=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=xa(a)))if(a.Bc&&a.Bc.cancel(),"comment"==c.tagName.toLowerCase()){g.i.disable();try{var d=g.jk.pm(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.O.Oi(c,a),k=a.Xb.Ob;if(g.De&&k){g.navigation.Ny(h,k.qa);break a}var l=parseInt(c.getAttribute("x"),10),m=parseInt(c.getAttribute("y"), 10);if(!isNaN(l)&&!isNaN(m)){a.G&&(l=-l);do{c=!1;var n=y(a,!1);d=0;for(var q;q=n[d];d++){var r=q.Oa();if(1>=Math.abs(l-r.x)&&1>=Math.abs(m-r.y)){c=!0;break}}if(!c){var u=h.xe(!1);d=0;for(var F;F=u[d];d++)if(F.closest(g.md,new g.g.S(l,m)).connection){c=!0;break}}c&&(l=a.G?l-g.md:l+g.md,m+=2*g.md)}while(c);h.moveBy(l,m)}}finally{g.i.enable()}g.i.isEnabled()&&!h.$a&&g.i.Ka(new g.i.Rn(h));h.select()}} function dd(a){if((a=a.$d?a.Dj:a)&&!a.Bc&&a.oa&&a.oa.M){a=a.oa;var c=a.ud.Id;c&&c.Cf&&a.M.show(c.Cf)}}b.Uh=function(a,c){g.gb.w.Uh.call(this,a,c);dd(this)};b.Hf=function(a){g.gb.w.Hf.call(this,a);dd(this)};b.Cd=function(a,c,d){a=g.gb.w.Cd.call(this,a,c,d);dd(this);return a};function Yc(a){a.sx=a.Xc&&a.H.parentNode?a.Xc.rm():null;a.qx=a.M?a.M.rm():a.oa?a.oa.rm():null}function Nb(a,c){return a.sx&&a.sx.contains(c.clientX,c.clientY)?g.Dq:a.qx&&a.qx.contains(c.clientX,c.clientY)?g.Bv:g.Av} b.Oh=function(a){var c=this.Gg(a);c&&ac(c,a,this)};b.Qu=function(a,c){a=g.g.Um(a,v(this),pa(this));a.x/=this.scale;a.y/=this.scale;this.Fx=g.g.S.hm(c,a)};b.dc=function(){return null!=this.Bc&&this.Bc.dc()};function ed(a){return a.options.Hc&&a.options.Hc.scrollbars||a.options.Hc&&a.options.Hc.Lj||a.options.Hc&&a.options.Hc.vh||a.options.wb&&a.options.wb.controls||a.options.wb&&a.options.wb.Lj} b.Fc=function(){return this.options.Hc&&this.options.Hc.scrollbars||this.options.Hc&&this.options.Hc.Lj||this.options.Hc&&this.options.Hc.vh||this.options.wb&&this.options.wb.Lj}; b.kG=function(a){if(g.Uj.nt())a.preventDefault(),a.stopPropagation();else{var c=this.options.wb&&this.options.wb.Lj,d=this.options.Hc&&this.options.Hc.Lj;if(c||d){var e=g.g.ky(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.Um(a,v(this),pa(this)),this.zoom(c.x,c.y,e));a.preventDefault()}}}; function Ab(a){var c=A(a,!1);a=wa(a,!1);c=c.concat(a);if(!c.length)return new g.g.Rect(0,0,0,0);a=Qc(c[0]);for(var d=1;da.bottom&&(a.bottom=e.bottom);e.lefta.right&&(a.right=e.right)}return a}b.tD=function(){this.Lc(!1);g.i.Z(!0);for(var a=A(this,!0),c=0,d=0,e;e=a[d];d++)if(e.Fc()){var f=e.Oa();e.moveBy(-f.x,c-f.y);Pc(e);c=e.Oa().y+J(e).height+g.va.Vq}g.i.Z(!1);this.Lc(!0)}; b.pn=function(a){function c(F){if(F.Zd())u=u.concat(p(F,!1));else{F=F.xh(!1);for(var X=0;Xu.length?d():g.confirm(g.h.DELETE_ALL_BLOCKS.replace("%1",u.length),function(F){F&&d()})}};e.push(l);this.Xw&&this.Xw(e);g.Ba.show(a,e,this.G)}}; function fd(a){var c=I;if(a=g.Rd.Cz(a)){if(!c.options.Of)throw Error("Existing toolbox is null. Can't create new toolbox.");if(a.getElementsByTagName("category").length){if(!c.oa)throw Error("Existing toolbox has no categories. Can't change mode.");c.options.Of=a;vb(c.oa,a)}else{if(!c.M)throw Error("Existing toolbox has categories. Can't change mode.");c.options.Of=a;c.M.show(a.childNodes)}}else if(c.options.Of)throw Error("Can't nullify an existing toolbox.");} function oa(a){if(a.options.Kb)oa(a.options.Kb);else{g.Nm=a;document.activeElement&&document.activeElement.blur();try{v(a).focus()}catch(c){try{v(a).parentNode.setActive()}catch(d){v(a).parentNode.focus()}}}} b.zoom=function(a,c,d){if(!this.$d&&!this.ej){d=Math.pow(this.options.wb.zG,d);var e=this.scale*d;if(this.scale!=e){e>this.options.wb.Qm?d=this.options.wb.Qm/this.scale:ethis.options.wb.Qm?a=this.options.wb.Qm:this.options.wb.Sm&&af?g.$.Zm(a,0,d.height+f):g.$.Zm(a,f,d.height)};g.$.jD=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.$.kD=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};g.sg=function(a){a.bc=this.um.bind(this);a.Xh=this.Zz.bind(this);g.sg.w.constructor.call(this,a);this.ef=!1};g.g.object.T(g.sg,g.tl);b=g.sg.prototype;b.um=function(){if(!this.isVisible())return null;try{var a=this.s.bb.getBBox()}catch(f){a={height:0,y:0,width:0,x:0}}var c=this.nr,d=this.Uc-2*this.nr,e=this.ob;this.G||(e-=this.nr);return{rb:d,lb:e,Bd:a.height*this.s.scale+2*this.Qe,Ye:a.width*this.s.scale+2*this.Qe,hc:-this.s.scrollY+a.y,Zb:-this.s.scrollX,kc:a.y,Ac:a.x,xc:c,jc:0}}; b.Zz=function(a){var c=this.um();c&&("number"==typeof a.y&&(this.s.scrollY=-c.Bd*a.y),this.s.translate(this.s.scrollX+c.jc,this.s.scrollY+c.xc))}; b.position=function(){if(this.isVisible()){var a=this.jb.bc();if(a){this.Uc=a.rb;var c=this.ob-this.sb,d=a.rb-2*this.sb,e=this.bl==g.pg,f=c+this.sb;f=["M "+(e?f:0)+",0"];f.push("h",e?-c:c);f.push("a",this.sb,this.sb,0,0,e?0:1,e?-this.sb:this.sb,this.sb);f.push("v",Math.max(0,d));f.push("a",this.sb,this.sb,0,0,e?0:1,e?this.sb:-this.sb,this.sb);f.push("h",e?c:-c);f.push("z");this.Mc.setAttribute("d",f.join(" "));c=this.Uc;a=this.jb.Da==this.bl?a.jA?this.bl==g.zd?a.jA:a.lb-this.ob:this.bl==g.zd?0:a.lb: this.bl==g.zd?0:a.lb+a.jc-this.ob;this.H.setAttribute("width",this.ob);this.H.setAttribute("height",c);"svg"==this.H.tagName?g.g.o.ln(this.H,"translate("+a+"px,0px)"):this.H.setAttribute("transform","translate("+a+",0)");this.pc&&(this.pc.fu=new g.g.S(a,0),this.pc.resize(),ha(this.pc,this.pc.ed.x,this.pc.ed.y))}}};b.eH=function(a){var c=g.g.ky(a);if(c.y){var d=this.um();c=d.hc-d.kc+c.y;c=Math.min(c,d.Bd-d.rb);c=Math.max(c,0);this.pc.set(c);g.$.ya()}a.preventDefault();a.stopPropagation()}; function jd(a,c,d){a.s.scale=a.jb.scale;for(var e=a.Qe,f=a.G?e:e+a.al,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.Wb=!0;k.za();n=k.wa();l=J(k);m=k.L?f-a.al:f;k.moveBy(m,e);var q=a,r=k,u=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.qf=r;g.J.mk(m);q.s.bb.insertBefore(m,r.wa());r.Px=m;q.Fp[u]=m;q=a;q.sd.push(g.ka(n,"mousedown",null,kd(q,k)));q.sd.push(g.ka(m,"mousedown",null,kd(q,k)));q.sd.push(g.yc(n,"mouseover", k,k.Ao));q.sd.push(g.yc(n,"mouseout",k,k.gn));q.sd.push(g.yc(m,"mouseover",k,k.Ao));q.sd.push(g.yc(m,"mouseout",k,k.gn));e+=l.height+d[h]}else"button"==k.type&&(l=a,m=k.button,n=f,q=e,r=m.Ga(),m.moveTo(n,q),m.show(),l.sd.push(g.ka(r,"mousedown",l,l.Oh)),l.Rl.push(m),e+=k.button.height+d[h])} b.rm=function(){if(!this.H)return null;var a=this.H.getBoundingClientRect(),c=a.left;if(this.bl==g.zd)return new g.g.Rect(-1E9,1E9,-1E9,c+a.width);g.g.userAgent.Jq&&this.jb&&this.jb.ej&&(a=this.jb.H.getBoundingClientRect().x,10>Math.abs(a-c)&&(c+=this.JL*this.jb.options.Kb.scale));return new g.g.Rect(-1E9,1E9,c,1E9)}; g.Fr=function(a){this.s=a};b=g.Fr.prototype;b.Bi=32;b.Gv=110;b.Sq=20;b.yl=20;b.H=null;b.Lm=0;b.dl=0;b.Ga=function(){this.H=g.g.o.K("g",{},null);var a=String(Math.random()).substring(2);ld(this,a);md(this,a);this.s.Fc()&&nd(this,a);return this.H};b.aa=function(a){this.Zg=this.Sq+a;return this.Zg+this.Gv};b.I=function(){this.H&&g.g.o.removeNode(this.H)}; b.position=function(){if(this.Zg){var a=this.s.bc();a&&(this.Lm=a.Da==g.zd||this.s.Ed&&!this.s.G?a.lb+a.jc-this.Bi-this.yl-g.Ja.oc:this.yl+g.Ja.oc,a.Da==g.xi?(this.dl=this.Zg,this.oq.setAttribute("transform","translate(0, 34)"),this.pq&&this.pq.setAttribute("transform","translate(0, 77)")):(this.dl=a.rb+a.xc-this.Gv-this.Zg,this.oq.setAttribute("transform","translate(0, 43)"),this.dv.setAttribute("transform","translate(0, 77)")),this.H.setAttribute("transform","translate("+this.Lm+","+this.dl+")"))}}; function ld(a,c){var d=a.s;a.dv=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoomoutClipPath"+c},a.dv);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.nd.width,height:g.nd.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+c+")"},a.dv);a.setAttributeNS(g.g.o.Ue,"xlink:href",d.options.lf+g.nd.url);g.ka(a,"mousedown",null,function(f){oa(d);gd(d,-1);g.Touch.nh();f.stopPropagation();f.preventDefault()})} function md(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:"blocklyZoominClipPath"+c},a.oq);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.nd.width,height:g.nd.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+c+")"},a.oq);a.setAttributeNS(g.g.o.Ue,"xlink:href",d.options.lf+g.nd.url);g.ka(a,"mousedown",null,function(f){oa(d);gd(d,1);g.Touch.nh();f.stopPropagation();f.preventDefault()})} function nd(a,c){var d=a.s;a.pq=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoomresetClipPath"+c},a.pq);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.nd.width,height:g.nd.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+c+")"},a.pq);a.setAttributeNS(g.g.o.Ue,"xlink:href",d.options.lf+g.nd.url);g.ka(a,"mousedown",null,function(f){oa(d);d.setScale(d.options.wb.eA);g.g.o.qb(d.bb,"blocklyCanvasTransitioning");g.g.o.qb(d.pf,"blocklyCanvasTransitioning"); if(d.Fc()){var h=d.bc(),k=(h.Ye-h.lb)/2,l=(h.Bd-h.rb)/2;k=-k-h.Ac;l=-l-h.kc;d.scroll(k,l)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.");setTimeout(d.hE.bind(d),500);g.Touch.nh();f.stopPropagation();f.preventDefault()})} g.hd.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.uv=function(a){this.Yl=a;this.Ga()};b=g.uv.prototype;b.Sa=null;b.$e=null;b.Yl=null;b.Vh=1;b.vn=null;b.Ga=function(){this.Sa||(this.Sa=g.g.o.K("svg",{xmlns:g.g.o.Hl,"xmlns:html":g.g.o.Vj,"xmlns:xlink":g.g.o.Ue,version:"1.1","class":"blocklyBlockDragSurface"},this.Yl),this.$e=g.g.o.K("g",{},this.Sa))};function Ub(a,c){if(a.$e.childNodes.length)throw Error("Already dragging a block.");a.$e.appendChild(c);a.Sa.style.display="block";a.vn=new g.g.S(0,0)} b.Gj=function(a,c){this.vn=new g.g.S(a*this.Vh,c*this.Vh);a=this.vn.x;c=this.vn.y;a=a.toFixed(0);c=c.toFixed(0);this.Sa.style.display="block";g.g.o.ln(this.Sa,"translate3d("+a+"px, "+c+"px, 0px)")};b.at=function(){var a=g.g.ze(this.Sa);return new g.g.S(a.x/this.Vh,a.y/this.Vh)};b.Ub=function(){return this.$e}; b.Ho=function(a){a?a.appendChild(this.$e.firstChild):this.$e.removeChild(this.$e.firstChild);this.Sa.style.display="none";if(this.$e.childNodes.length)throw Error("Drag group was not cleared.");this.vn=null}; g.D=function(){};g.D.je=null;g.D.Ur=null;g.D.dd=null;g.D.Pp=null;g.D.Mn=16;g.D.tv=1;g.D.nv=12;g.D.$v=16;g.D.wq=.25;g.D.yv="#dadce0";g.D.zv="#fff";g.D.Jr=null;g.D.pj=null; g.D.Ga=function(){if(!g.D.je){var a=document.createElement("div");a.className="blocklyDropDownDiv";a.style.backgroundColor=g.D.zv;a.style.borderColor=g.D.yv;document.body.appendChild(a);g.D.je=a;var c=document.createElement("div");c.className="blocklyDropDownContent";a.appendChild(c);g.D.Ze=c;c=document.createElement("div");c.className="blocklyDropDownArrow";a.appendChild(c);g.D.Ve=c;g.D.je.style.opacity=0;g.D.je.style.transition="transform "+g.D.wq+"s, opacity "+g.D.wq+"s";a.addEventListener("focusin", function(){g.g.o.qb(a,"focused")});a.addEventListener("focusout",function(){g.g.o.fc(a,"focused")})}};g.D.Vz=function(a){g.D.Ur=a};g.D.Yx=function(){return g.D.Ze};g.D.uD=function(){g.D.Ze.innerHTML="";g.D.Ze.style.width=""};g.D.mf=function(a,c){g.D.je.style.backgroundColor=a;g.D.je.style.borderColor=c};g.D.SL=function(a){g.D.je.setAttribute("data-category",a)}; g.D.UL=function(a,c,d,e){var f=c.v.scale,h=c.width,k=c.height;h*=f;k*=f;f=c.wa().getBoundingClientRect();h=f.left+h/2;k=f.top+k;f=f.top;e&&(f+=e);g.D.Vz(v(c.v).parentNode);return g.D.show(a,c.G,h,k,h,f,d)};g.D.aA=function(a,c){var d=a.wa().getBoundingClientRect(),e=d.left+d.width/2,f=d.bottom;d=d.top;var h=a.B;g.D.Pp=!0;g.D.Vz(v(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.dd=a;g.D.pj=k||null;a=g.D.jy(d,e,f,h);a.Mr?(g.D.Ve.style.display="",g.D.Ve.style.transform="translate("+a.Pl+"px,"+a.Fw+"px) rotate(45deg)",g.D.Ve.setAttribute("class",a.Lr?"blocklyDropDownArrow arrowTop":"blocklyDropDownArrow arrowBottom")):g.D.Ve.style.display="none";g.D.je.style.direction=c?"rtl":"ltr";g.D.Zm(a.rp,a.sp,a.Zo,a.$o);return a.Lr}; g.D.vE=function(){var a=g.D.Ur.getBoundingClientRect(),c=g.g.style.Hg(g.D.Ur);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.jy=function(a,c,d,e){var f=g.D.vE(),h=g.g.style.Hg(g.D.je);return c+h.heightf.top?g.D.gy(d,e,f,h):c+h.heightdocument.documentElement.clientTop?g.D.gy(d,e,f,h):g.D.IE(a,f,h)}; g.D.iy=function(a,c,d,e){a=g.D.Zs(a,d.left,d.right,e.width);return{rp:a.xk,sp:c,Zo:a.xk,$o:c+g.D.$v,Pl:a.Pl,Fw:-(g.D.Mn/2+g.D.tv),Lr:!0,Mr:!0}};g.D.gy=function(a,c,d,e){a=g.D.Zs(a,d.left,d.right,e.width);return{rp:a.xk,sp:c-e.height,Zo:a.xk,$o:c-e.height-g.D.$v,Pl:a.Pl,Fw:e.height-2*g.D.tv-g.D.Mn/2,Lr:!1,Mr:!0}};g.D.IE=function(a,c,d){a=g.D.Zs(a,c.left,c.right,d.width);return{rp:a.xk,sp:0,Zo:a.xk,$o:0,Mr:!1}}; g.D.Zs=function(a,c,d,e){var f=a;a=g.g.td.Gi(c,a-e/2,d-e);f-=g.D.Mn/2;c=g.g.td.Gi(g.D.nv,f-a,e-g.D.nv-g.D.Mn);return{Pl:c,xk:a}};g.D.isVisible=function(){return!!g.D.dd};g.D.ym=function(a,c){g.D.dd===a&&(c?g.D.Ui():g.D.ya())};g.D.ya=function(){var a=g.D.je;a.style.transform="translate(0, 0)";a.style.opacity=0;g.D.Jr=setTimeout(function(){g.D.Ui()},1E3*g.D.wq);g.D.pj&&(g.D.pj(),g.D.pj=null)}; g.D.Ui=function(){if(g.D.isVisible()){g.D.Jr&&clearTimeout(g.D.Jr);var a=g.D.je;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=g.D.zv;a.style.borderColor=g.D.yv;g.D.pj&&(g.D.pj(),g.D.pj=null);g.D.uD();g.D.dd=null}}; g.D.Zm=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.je;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.NL=function(){if(g.D.dd){var a=g.D.dd.B,c=a.v.scale,d=g.D.Pp?g.D.dd.Lb.width:a.width,e=g.D.Pp?g.D.dd.Lb.height:a.height;d*=c;e*=c;a=g.D.Pp?g.D.dd.we.getBoundingClientRect():a.wa().getBoundingClientRect();d=a.left+d/2;e=g.D.jy(d,a.top+e,d,a.top);g.D.Zm(e.rp,e.sp,e.Zo,e.$o)}else g.D.ya()};g.Dh=function(a,c){g.oD();"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.Rd(c||{});var d=document.createElement("div");d.className="injectionDiv";a.appendChild(d);a=g.$l(d,c);var e=new g.uv(d);d=new g.yw(d);d=g.FD(a,c,e,d);g.mb.ib.EG(c.ib);g.jF(d);g.Nm=d;g.$k(d);return d}; g.$l=function(a,c){a.setAttribute("dir","LTR");g.vc.px=c.G;g.hd.Dh(c.ZE,c.lf);a=g.g.o.K("svg",{xmlns:g.g.o.Hl,"xmlns:html":g.g.o.Vj,"xmlns:xlink":g.g.o.Ue,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.Ix=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.Cg=f.id; c.xy=g.li.Ga(e,c.wy,d);return a}; g.FD=function(a,c,d,e){c.Kb=null;var f=new g.gb(c,d,e);f.scale=c.wb.eA;a.appendChild(f.Ga("blocklyMainBackground"));!c.Ay&&c.Of&&(d=ad(f,"svg"),g.g.o.Zi(d,a));c.Ey&&Zc(f);c.wb&&c.wb.controls&&$c(f);f.Rb.subscribe(a,"workspace","background-color");f.translate(0,0);g.Nm=f;c.readOnly||f.Fc()||Aa(f,function(h){if(!f.dc()&&!f.Fc()&&-1!=g.i.LA.indexOf(h.type)){var k=Object.create(null),l=f.bc(),m=f.scale;k.G=f.G;k.Zb=l.Zb/m;k.hc=l.hc/m;k.qA=(l.Zb+l.lb)/m;k.pA=(l.hc+l.rb)/m;ed(f)?(l=Ab(f),k.Ac=l.left,k.kc= l.top,k.ex=l.right,k.ax=l.bottom):(k.Ac=l.Ac/m,k.kc=l.kc/m,k.ex=(l.Ac+l.Ye)/m,k.ax=(l.kc+l.Bd)/m);if(k.kck.pA||k.Ack.qA){l=null;h&&(l=g.i.Ub(),g.i.Z(h.group));switch(h.type){case g.i.kl:case g.i.pv:var n=x(f,h.zc);n=G(n);break;case g.i.Tn:case g.i.Un:n=f.Lo[h.Ef]||null}if(n){m=Qc(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var q=k.hc,r=k.pA-m.height;r=Math.max(q,r);q=g.g.td.Gi(q,m.top,r)-m.top;r=k.Zb;var u=k.qA-m.width;k.G?r=Math.min(u,r):u=Math.max(r,u);n.moveBy(g.g.td.Gi(r, m.left,u)-m.left,q)}h&&(h.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&g.i.Z(l))}}});g.$k(f);g.$.Ga();g.D.Ga();g.J.Ga();return f}; g.jF=function(a){var c=a.options,d=v(a);g.ka(d.parentNode,"contextmenu",null,function(e){g.g.Ap(e)||e.preventDefault()});d=g.ka(window,"resize",null,function(){g.mc(!0);g.$k(a)});a.Wp=d;g.Dh.bD();c.Of&&(a.oa?a.oa.aa(a):a.M&&(a.M.aa(a),a.M.show(c.Of.childNodes),a.M.pc.set(0)));d=g.Ja.oc;c.Ey&&(d=a.Xc.aa(d));c.wb&&c.wb.controls&&a.Nj.aa(d);c.Hc&&c.Hc.scrollbars?(a.Pb=new g.hk(a),a.Pb.resize()):a.Xh({x:.5,y:.5});c.aF&&g.Dh.uF(c.lf,a)}; g.Dh.bD=function(){g.bE||(g.ka(document,"scroll",null,function(){for(var a=g.Fb.getAll(),c=0,d;d=a[c];c++)d.Fn&&d.Fn()}),g.ka(document,"keydown",null,g.ZF),g.yc(document,"touchend",null,g.Kh),g.yc(document,"touchcancel",null,g.Kh),g.g.userAgent.Wj&&g.ka(window,"orientationchange",document,function(){g.$k(g.ub())}));g.bE=!0}; g.Dh.uF=function(a,c){function d(){for(;f.length;)g.Xa(f.pop());e.preload()}var e=c.kh;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.ka(document,"mousemove",null,d,!0));f.push(g.ka(document,"touchstart",null,d,!0))};g.Qd=function(a,c){this.oA=c||"";this.Pz=Object.create(null);if(a)for(a=a.split(","),c=0;c1'), e.appendChild(d),c.push(e));if(g.W.variables_get){a.sort(g.Kl.Ww);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.N.qm(f)),c.push(e)}}return c}; g.N.Vx=function(a){a=a.Fg();var c="";if(a.length)for(var d=1,e=0,f="ijkmnopqrstuvwxyzabcdefgh".charAt(e);!c;){for(var h=!1,k=0;kk[0]?1:h[0]=a.options.length&&(a.style.display= "none")}for(d=1;10>=d;d++)a=document.getElementById("level"+d),c=!!Ad(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(Bd,1)}function Ad(a){var c=Cd;try{var d=window.localStorage[c+a]}catch(e){}return d}function P(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 Dd(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 Bd(){if(!ud){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.Ta=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.ba=function(a,c){return" "+a+" "+c+" "};g.g.A.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};g.j.ii=function(){this.wf=0;this.vC=3;this.vf=5;this.Uv=8;this.ld=10;this.ow=this.vf;this.wr=15;this.Il=5;this.ih=8;this.gC=15;this.fC=4;this.cC=12;this.jB=16;this.sb=8;this.no=15;this.AC=0;this.BC=20;this.IA=4;this.yC=15;this.zC=100;this.xC=15;this.Uq=24;this.lB=14.5;this.kB=this.wr+11;this.nB=2;this.mB=this.Uq;this.kw=g.g.A.moveBy(0,0);this.HB=12;this.IB=6};b=g.j.ii.prototype; b.aa=function(){this.Zj=this.Ht();this.bk=this.It();this.og=this.Kt();this.ri=this.Jt();var a=this.sb,c=g.g.A.arc("a","0 0,0",a,g.g.A.Ta(-a,a)),d=g.g.A.arc("a","0 0,0",a,g.g.A.Ta(a,a));this.wl={width:a,height:a,ku:c,Mp:d};c=this.sb;a=g.g.A.moveBy(0,c)+g.g.A.arc("a","0 0,1",c,g.g.A.Ta(c,-c));c=g.g.A.arc("a","0 0,1",c,g.g.A.Ta(-c,-c));this.Zv={Yu:a,Tr:c}};b.Ht=function(){var a=this.HB,c=this.IB,d=g.g.A.line([g.g.A.Ta(6,3),g.g.A.Ta(-12,6),g.g.A.Ta(6,3)]);return{height:a,width:c,path:d}}; b.Kt=function(){var a=this.yC,c=this.zC,d=g.g.A.curve("c",[g.g.A.Ta(30,-a),g.g.A.Ta(70,-a),g.g.A.Ta(c,0)]);return{height:a,width:c,path:d}};b.Jt=function(){function a(h){h=h?-1:1;var k=-h,l=d/2,m=g.g.A.Ta(c,h*l);return g.g.A.curve("c",[g.g.A.Ta(0,h*(l+2.5)),g.g.A.Ta(-c,k*(l+.5)),g.g.A.Ta(-c,h*l)])+g.g.A.curve("s",[g.g.A.Ta(c,2.5*k),m])}var c=this.ih,d=this.wr,e=a(!0),f=a(!1);return{width:c,height:d,He:f,Ym:e}}; b.It=function(){function a(k){return g.g.A.line([g.g.A.Ta(k*e,d),g.g.A.Ta(3*k,0),g.g.A.Ta(k*e,-d)])}var c=this.gC,d=this.fC,e=(c-3)/2,f=a(1),h=a(-1);return{width:c,height:d,Qh:f,Dz:h}};g.j.u={NONE:0,ke:1,Fv:2,Iv:4,pr:8,ov:16,Mv:32,Ev:64,mg:128,Kv:256,lw:512,VA:1024,er:2048,Wq:4096,kC:8192,Bq:16384,Qq:32768,Pq:65536,kr:131072,jr:262144,Qv:524288,mr:1048576,zr:2097152,xq:4194304,Lv:8388608};g.j.u.TI=g.j.u.Qq|g.j.u.Pq;g.j.u.xK=g.j.u.kr|g.j.u.jr;g.j.u.Wt=16777216;g.j.u.Jb=function(){g.j.u.hasOwnProperty(void 0)||(g.j.u[void 0]=g.j.u.Wt,g.j.u.Wt<<=1);return g.j.u[void 0]};g.j.u.Hm=function(a){return a.type&g.j.u.ke};g.j.u.dj=function(a){return a.type&g.j.u.Fv}; g.j.u.Kk=function(a){return a.type&g.j.u.Iv};g.j.u.hf=function(a){return a.type&g.j.u.pr};g.j.u.CL=function(a){return a.type&g.j.u.Mv};g.j.u.gf=function(a){return a.type&g.j.u.mg};g.j.u.Gm=function(a){return a.type&g.j.u.Ev};g.j.u.Eh=function(a){return a.type&g.j.u.Kv};g.j.u.Km=function(a){return a.type&g.j.u.lw};g.j.u.Mk=function(a){return a.type&g.j.u.er};g.j.u.Gh=function(a){return a.type&g.j.u.Wq};g.j.u.qF=function(a){return a.type&(g.j.u.er|g.j.u.Wq)};g.j.u.Fh=function(a){return a.type&g.j.u.Pq}; g.j.u.EL=function(a){return a.type&g.j.u.jr};g.j.u.Jm=function(a){return a.type&g.j.u.Qq};g.j.u.FL=function(a){return a.type&g.j.u.kr};g.j.u.BL=function(a){return a.type&g.j.u.Bq};g.j.u.Sy=function(a){return a.type&g.j.u.Qv};g.j.u.GL=function(a){return a.type&g.j.u.mr};g.j.u.AL=function(a){return a.type&g.j.u.ov};g.j.u.Bp=function(a){return a.type&g.j.u.zr};g.j.u.up=function(a){return a.type&g.j.u.xq};g.j.u.HL=function(a){return a.type&(g.j.u.zr|g.j.u.xq)};g.j.u.DL=function(a){return a.type&g.j.u.Lv};g.j.dh=function(a){this.height=this.width=0;this.type=g.j.u.NONE;this.mh=this.Qa=0;this.C=a;this.Ee=this.C.no};g.j.ra=function(a,c){g.j.ra.w.constructor.call(this,a);this.hs=c;a:switch(a=this.C,c.type){case g.Ua:case g.Re:c=a.ri;break a;case g.Se:case g.Ra:c=a.bk;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=g.j.u.VA};g.g.object.T(g.j.ra,g.j.dh);g.j.cr=function(a,c){g.j.cr.w.constructor.call(this,a,c);this.type|=g.j.u.kC;this.height=this.shape.height;this.width=this.shape.width;this.ue=this.C.Il;this.ce=this.width};g.g.object.T(g.j.cr,g.j.ra); g.j.gr=function(a,c){g.j.gr.w.constructor.call(this,a,c);this.type|=g.j.u.er;this.height=this.shape.height;this.width=this.shape.width};g.g.object.T(g.j.gr,g.j.ra);g.j.Xq=function(a,c){g.j.Xq.w.constructor.call(this,a,c);this.type|=g.j.u.Wq;this.height=this.shape.height;this.width=this.shape.width};g.g.object.T(g.j.Xq,g.j.ra);g.j.xl=function(a,c){g.j.xl.w.constructor.call(this,a,c.connection);this.type|=g.j.u.mg;this.input=c;this.align=c.align;(this.Hi=c.connection&&C(c.connection)?C(c.connection):null)?(a=J(this.Hi),this.Wl=a.width,this.Mo=a.height):this.Mo=this.Wl=0;this.connection=c.connection;this.ue=0};g.g.object.T(g.j.xl,g.j.ra); g.j.ah=function(a,c){g.j.ah.w.constructor.call(this,a,c);this.type|=g.j.u.Kv;this.Hi?(this.width=this.Wl,this.height=this.Mo):(this.height=this.C.kB,this.width=this.shape.width+this.C.lB);this.ue=this.C.Il;this.Xl=this.shape.height;this.qh=this.shape.width};g.g.object.T(g.j.ah,g.j.xl);g.j.hh=function(a,c){g.j.hh.w.constructor.call(this,a,c);this.type|=g.j.u.lw;this.height=this.Hi?this.Mo+this.C.AC:this.C.mB;this.width=this.C.no+this.shape.width};g.g.object.T(g.j.hh,g.j.xl); g.j.bo=function(a,c){g.j.bo.w.constructor.call(this,a,c);this.type|=g.j.u.Ev;this.height=this.Hi?this.Mo-2*this.C.Il:this.shape.height;this.width=this.shape.width+this.C.nB;this.ue=this.C.Il;this.Xl=this.shape.height;this.qh=this.shape.width};g.g.object.T(g.j.bo,g.j.xl);g.j.wd=function(a,c){g.j.wd.w.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=g.j.u.Iv;a=new g.g.qe(g.wd.prototype.to,g.wd.prototype.to-2);this.height=a.height;this.width=a.width};g.g.object.T(g.j.wd,g.j.dh);g.j.Mq=function(a){g.j.Mq.w.constructor.call(this,a);this.type|=g.j.u.Qv;this.height=this.C.Zj.height;this.width=this.C.Zj.width};g.g.object.T(g.j.Mq,g.j.dh); g.j.Ha=function(a,c){g.j.Ha.w.constructor.call(this,a);this.Lx=c;this.cd=c.uf&&!!c.B&&c.B.cd();this.oE=c.by();this.type|=g.j.u.ke;a=this.Lx.Hg();this.height=a.height;this.width=a.width};g.g.object.T(g.j.Ha,g.j.dh);g.j.Kq=function(a){g.j.Kq.w.constructor.call(this,a);this.type|=g.j.u.Fv;this.height=this.C.og.height;this.width=this.C.og.width;this.kk=this.height};g.g.object.T(g.j.Kq,g.j.dh); g.j.wo=function(a,c){g.j.wo.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.j.u.kr:g.j.u.Qq)|g.j.u.Bq;this.width=this.height=this.C.wf};g.g.object.T(g.j.wo,g.j.dh);g.j.so=function(a,c){g.j.so.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.j.u.jr:g.j.u.Pq)|g.j.u.Bq;this.width=this.C.sb;this.height=this.C.sb/2};g.g.object.T(g.j.so,g.j.dh);g.j.Xj=function(a,c){g.j.Xj.w.constructor.call(this,a);this.type=this.type|g.j.u.pr|g.j.u.Mv;this.width=c;this.height=this.C.xC};g.g.object.T(g.j.Xj,g.j.dh);g.j.ui=function(a){this.type=g.j.u.mr;this.elements=[];this.Qa=this.Nc=this.cg=this.minWidth=this.minHeight=this.width=this.height=0;this.Cy=this.np=this.ht=this.qd=this.Si=!1;this.C=a;this.Ee=this.C.no};g.j.ui.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function Ed(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.j.u.gf(d))return d;return null}g.j.ui.prototype.Ru=function(){return!0};g.j.ui.prototype.Jx=function(){return!0}; function Fd(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.j.u.hf(d))return d;return null}g.j.ik=function(a){g.j.ik.w.constructor.call(this,a);this.type|=g.j.u.zr;this.kk=this.ug=0;this.$E=!1;this.connection=null};g.g.object.T(g.j.ik,g.j.ui);g.j.ik.prototype.jt=function(a){var c=a.Jg?"cap"===a.Jg:g.va.og,d=a.Y&&C(a.Y);return!!a.L||c||(d?t(d)==a:!1)}; g.j.ik.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.j.u.hf(f)||(g.j.u.dj(f)?d=Math.max(d,f.kk):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.ug=this.kk=d;this.cg=this.width};g.j.ik.prototype.Ru=function(){return!1};g.j.Oj=function(a){g.j.Oj.w.constructor.call(this,a);this.type|=g.j.u.xq;this.Dy=!1;this.connection=null;this.Di=this.gm=0};g.g.object.T(g.j.Oj,g.j.ui); g.j.Oj.prototype.jt=function(a){return!!a.L||!!t(a)};g.j.Oj.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.j.u.hf(f)||(g.j.u.Gh(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.gm=d;this.cg=this.width};g.j.Oj.prototype.Ru=function(){return!1}; g.j.vo=function(a,c,d){g.j.vo.w.constructor.call(this,a);this.type=this.type|g.j.u.pr|g.j.u.ov;this.width=d;this.height=c;this.Tx=!1;this.cg=0;this.elements=[new g.j.Xj(this.C,d)]};g.g.object.T(g.j.vo,g.j.ui);g.j.vo.prototype.measure=function(){};g.j.Yj=function(a){g.j.Yj.w.constructor.call(this,a);this.type|=g.j.u.Lv;this.Zw=0};g.g.object.T(g.j.Yj,g.j.ui); g.j.Yj.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.j.u.gf(d)&&(g.j.u.Km(d)?a+=d.Wl:g.j.u.Gm(d)&&0!=d.Wl&&(a+=d.Wl-d.qh)),g.j.u.hf(d)||(this.height=Math.max(this.height,d.height));this.Zw=a;this.cg=this.width+a};g.j.Yj.prototype.Jx=function(){return!this.Si&&!this.qd};g.j.fh=function(a,c){this.R=c;this.Sg=a;this.C=this.Sg.C;this.L=c.L?new g.j.cr(this.C,c.L):null;this.ut=Fb(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.Ng=c.Ng();this.G=c.G;this.Aj=this.width=this.fl=this.height=0;this.rows=[];this.Hy=[];this.gc=new g.j.ik(this.C);this.Gb=new g.j.Oj(this.C);this.cq=this.ce=0};b=g.j.fh.prototype; b.measure=function(){var a=this.R.Jg?"cap"===this.R.Jg:g.va.og,c=!!this.R.Y;this.gc.jt(this.R)?this.gc.elements.push(new g.j.wo(this.C)):this.gc.elements.push(new g.j.so(this.C));a?(a=new g.j.Kq(this.C),this.gc.elements.push(a),this.gc.ug=a.kk):c&&(this.gc.$E=!0,this.gc.connection=new g.j.gr(this.C,this.R.Y),this.gc.elements.push(this.gc.connection));this.R.P.length&&this.R.P[0].type==g.Ra&&!this.R.isCollapsed()?this.gc.minHeight=this.C.ld:this.gc.minHeight=this.C.vf;this.rows.push(this.gc);a=new g.j.Yj(this.C); var d=Lb(this.R);if(d.length){c=0;for(var e;e=d[c];c++){var f=new g.j.wd(this.C,e);this.isCollapsed&&e.Sw?this.Hy.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.R.P[c];c++)if(d.isVisible()){!e||d.type!=g.Ra&&e.type!=g.Ra&&(d.type!=g.Ua&&d.type!=g.jg||this.ut)||(this.rows.push(a),a=new g.j.Yj(this.C));for(e=0;f=d.Na[e];e++)a.elements.push(new g.j.Ha(this.C,f,d));this.Dw(d,a);e=d}this.isCollapsed&&(a.Cy=!0,a.elements.push(new g.j.Mq(this.C)));(a.elements.length||a.np)&&this.rows.push(a);this.Gb.Dy= !!this.R.V;this.Gb.minHeight=this.R.P.length&&this.R.P[this.R.P.length-1].type==g.Ra?this.C.ld:this.C.vf-1;this.Gb.jt(this.R)?this.Gb.elements.push(new g.j.wo(this.C)):this.Gb.elements.push(new g.j.so(this.C));this.Gb.Dy&&(this.Gb.connection=new g.j.Xq(this.C,this.R.V),this.Gb.elements.push(this.Gb.connection));this.rows.push(this.Gb);for(a=0;c=this.rows[a];a++){d=c.elements;c.elements=[];c.Ru()&&c.elements.push(new g.j.Xj(this.C,this.ep(null,d[0])));for(e=0;ea.rd&&(a.ea+=g.g.A.ba("V",c.Nc+c.height-a.rd)))};g.ma.si=function(a){this.Cj=a;this.xn=g.g.o.K("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Cj);this.Zk=g.g.o.K("path",{"class":"blocklyPath"},this.Cj);this.zn=g.g.o.K("path",{"class":"blocklyPathLight"},this.Cj)};g.ma.si.prototype.Hu=function(a,c){this.Zk.setAttribute("d",a);this.xn.setAttribute("d",a);this.zn.setAttribute("d",c)}; g.ma.si.prototype.Os=function(){this.Zk.setAttribute("transform","scale(-1 1)");this.zn.setAttribute("transform","scale(-1 1)");this.xn.setAttribute("transform","translate(1,1) scale(-1 1)")};g.ma.ah=function(a,c){g.ma.ah.w.constructor.call(this,a,c);this.Hi&&(this.width+=this.C.jd,this.height+=this.C.jd)};g.g.object.T(g.ma.ah,g.j.ah);g.ma.hh=function(a,c){g.ma.hh.w.constructor.call(this,a,c);this.Hi&&(this.height+=this.C.jd)};g.g.object.T(g.ma.hh,g.j.hh);g.ma.fh=function(a,c){g.ma.fh.w.constructor.call(this,a,c)};g.g.object.T(g.ma.fh,g.j.fh);b=g.ma.fh.prototype;b.Dw=function(a,c){this.ut&&a.type==g.Ua?(c.elements.push(new g.ma.ah(this.C,a)),c.ht=!0):a.type==g.Ra?(c.elements.push(new g.ma.hh(this.C,a)),c.qd=!0):a.type==g.Ua?(c.elements.push(new g.j.bo(this.C,a)),c.Si=!0):a.type==g.jg&&(c.np=!0)}; b.ep=function(a,c){if(!a)return c&&g.j.u.Hm(c)&&c.cd?this.C.vf:c&&g.j.u.Eh(c)?this.C.Uv:c&&g.j.u.Km(c)?this.C.BC:this.C.ld;if(!g.j.u.gf(a)&&!c)return g.j.u.Hm(a)&&a.cd?this.C.vf:g.j.u.Kk(a)?2*this.C.ld+1:g.j.u.dj(a)?this.C.wf:g.j.u.qF(a)?this.C.ld:g.j.u.Fh(a)?this.C.cC:g.j.u.Sy(a)?this.C.wf:this.C.ld;if(g.j.u.gf(a)&&!c){if(g.j.u.Gm(a))return this.C.wf;if(g.j.u.Eh(a))return this.C.ld;if(g.j.u.Km(a))return this.C.wf}if(!g.j.u.gf(a)&&c&&g.j.u.gf(c)){if(a.cd){if(g.j.u.Eh(c)||g.j.u.Gm(c))return this.C.vC}else{if(g.j.u.Eh(c)|| g.j.u.Gm(c))return this.C.Uv;if(g.j.u.Km(c))return this.C.ld}return this.C.ld-1}if(g.j.u.Kk(a)&&c&&!g.j.u.gf(c))return this.C.ld;if(g.j.u.Eh(a)&&c&&!g.j.u.gf(c))return c.cd?this.C.vf:this.C.ld;if(g.j.u.Jm(a)&&c){if(g.j.u.dj(c))return this.C.wf;if(g.j.u.Mk(c))return c.Ee;if(g.j.u.Gh(c))return a=(this.G?1:-1)*this.C.jd/2,c.Ee+a}if(g.j.u.Fh(a)&&c){if(g.j.u.Mk(c))return c.Ee-this.C.sb;if(g.j.u.Gh(c))return a=(this.G?1:-1)*this.C.jd/2,c.Ee-this.C.sb+a}return!g.j.u.gf(a)&&c&&!g.j.u.gf(c)&&a.cd==c.cd||c&& g.j.u.Sy(c)?this.C.ld:this.C.vf};b.Gr=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(g.j.u.hf(e)){d=e;break a}d=null}e=Fd(a);if(a.Si||a.qd)a.cg+=c;var f=Ed(a);f?f.align==g.uq?e.width+=c:f.align==g.iv?(d.width+=c/2,e.width+=c/2):f.align==g.Ln&&(d.width+=c):e.width+=c;a.width+=c};b.ny=function(a,c){return g.j.u.Bp(a)&&g.j.u.up(c)?this.C.jB:g.j.u.Bp(a)||g.j.u.up(c)?this.C.wf:a.Si&&c.Si?this.C.ld:!a.qd&&c.qd?this.C.IA:a.qd&&c.qd||!a.qd&&c.np?this.C.ld:this.C.vf}; b.ay=function(a,c){if(g.j.u.hf(c))return a.Nc+c.height/2;if(g.j.u.up(a))return a=a.Nc+a.height-a.gm,g.j.u.Gh(c)?a+c.height/2:a-c.height/2;if(g.j.u.Bp(a))return g.j.u.dj(c)?a.ug-c.height/2:a.ug+c.height/2;var d=a.Nc;g.j.u.Hm(c)||g.j.u.Kk(c)?(d+=c.height/2,(a.ht||a.qd)&&c.height+this.C.ow<=a.height&&(d+=this.C.ow)):d=g.j.u.Eh(c)?d+c.height/2:d+a.height/2;return d}; b.Mx=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.Nc=c;e.Qa=this.ce;c+=e.height;a=Math.max(a,e.cg);var f=c-this.gc.kk;e==this.Gb&&f=c.length?"?lang="+a:c.match(/[?&]lang=[^&]*/)?c.replace(/([?&]lang=)[^&]*/,"$1"+a):c.replace(/\?/,"?lang="+a+"&");window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+c},Ut:function(){10>O?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+sd+"&level="+(O+1):R.pp()},zm:function(a,c){if(a){var d=a.match(/^block_id_([^']+)$/);d&&(a=d[1])}bd(a,c)},ot:function(a,c){a=document.getElementById(a); a.firstChild||(a=g.Dh(a,{rtl:-1!=rd.indexOf(sd),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),g.O.uh(g.O.$h(c),a))},NG:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},Jf:function(a){if("click"==a.type&&"touchend"==R.Jf.qu&&R.Jf.ou+2E3>Date.now()||R.Jf.qu==a.type&&R.Jf.ou+400>Date.now())return a.preventDefault(),a.stopPropagation(),!0;R.Jf.qu=a.type;R.Jf.ou=Date.now();return!1}};R.Jf.qu=null;R.Jf.ou=0; R.gF=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};R.hF=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=R;R.setCode=R.Wz;R.getCode=R.Vs;R.getWorkspace=R.Dk;var Q={bj:!1,ux:null,So:null,xj:function(a,c,d,e,f,h){function k(){Q.bj&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);Q.bj&&Q.Yd(!1);g.ub()&&g.mc(!0);Q.bj=!0;Q.ux=c;Q.So=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),Q.rs=g.yc(e,"mousedown",null,Q.UD));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(Q.Ep(c,!1,.2),Q.Ep(l,!0,.8),setTimeout(k,175)):k()},vx:0,wx:0,UD:function(a){Q.us();if(!g.g.fj(a)){var c=document.getElementById("dialog");Q.vx=c.offsetLeft-a.clientX;Q.wx=c.offsetTop-a.clientY;Q.ts=g.yc(document,"mouseup",null,Q.us);Q.ss=g.yc(document,"mousemove",null,Q.VD);a.stopPropagation()}},VD:function(a){var c=document.getElementById("dialog"), d=Q.vx+a.clientX;a=Q.wx+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"},us:function(){Q.ts&&(g.Xa(Q.ts),Q.ts=null);Q.ss&&(g.Xa(Q.ss),Q.ss=null)},Yd:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(Q.bj){Q.us();Q.rs&&(g.Xa(Q.rs),Q.rs=null);Q.bj=!1;Q.So&&Q.So();Q.So=null;var d=!1===a? null:Q.ux;a=document.getElementById("dialog");var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(Q.Ep(a,!1,.8),Q.Ep(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)}},Ep: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=Q.tE(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},tE:function(a){var c=g.g.style.hp(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},gA:function(a,c){var d=document.getElementById("containerStorage");d.textContent="";c=c.split("\n");for(var e=0;eO?P("Games_nextLevel").replace("%1",String(O+1)):P("Games_finalLevel");c=document.getElementById("doneCancel");c.addEventListener("click", Q.Yd,!0);c.addEventListener("touchend",Q.Yd,!0);c=document.getElementById("doneOk");c.addEventListener("click",R.Ut,!0);c.addEventListener("touchend",R.Ut,!0);Q.xj(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",Q.Yw,!0)});document.body.addEventListener("keydown",Q.Yw,!0);document.getElementById("dialogDoneText").textContent=d},tx:function(a){!Q.bj||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(Q.Yd(!0),a.stopPropagation(),a.preventDefault())}, bq:function(){document.body.addEventListener("keydown",Q.tx,!0)},eq:function(){document.body.removeEventListener("keydown",Q.tx,!0)},Yw:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)Q.Yd(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&R.Ut()},Bw:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)Q.Yd(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&R.pp()},Ux:function(a){27==a.keyCode?Q.Yd(!0):13==a.keyCode&&Q.Rs()},Rs: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?P("Games_submitted"):P("Games_httpRequestError")+"\nStatus: "+f.status;Q.gA(null,h)}};f.send(c.join("&"));Q.Yd(!0)}else a.value="",a.focus()}}; window.BlocklyDialogs=Q;Q.hideDialog=Q.Yd;g.pb=function(a,c,d){this.sn=!0;null==a&&(a="");g.pb.w.constructor.call(this,a,c,d)};g.g.object.T(g.pb,g.Ha);g.pb.sa=function(a){var c=g.g.nc(a.text);return new g.pb(c,void 0,a)};g.pb.prototype.gk=!0;g.pb.qB=11;g.pb.JA=4;b=g.pb.prototype;b.Cq="text";b.Ad=function(a){g.pb.w.Ad.call(this,a);"boolean"==typeof a.spellcheck&&(this.sn=a.spellcheck)};b.Dg=function(a){return null===a||void 0===a?null:String(a)}; b.Ex=function(){if(this.aj){this.wt=!1;var a=this.kb;this.kb=this.Vc.aH;this.B&&g.i.isEnabled()&&g.i.Ka(new g.i.eg(this.B,"field",this.name||null,a,this.kb))}};b.sh=function(a){this.wt=!0;this.kb=a;this.aj||(this.ff=!0)};b.Tf=function(){g.pb.w.Tf.call(this);this.aj&&(this.B.G?setTimeout(this.Vp.bind(this),0):this.Vp(),this.wt?(g.g.o.fc(this.Vc,"blocklyInvalidInput"),g.g.U.Eb(this.Vc,"invalid",!1)):(g.g.o.qb(this.Vc,"blocklyInvalidInput"),g.g.U.Eb(this.Vc,"invalid",!0)))}; function Vd(a){0!=a.sn&&(a.sn=!1,a.Vc&&a.Vc.setAttribute("spellcheck",a.sn))}b.Le=function(a){this.s=this.B.v;a=a||!1;!a&&(g.g.userAgent.dC||g.g.userAgent.jl||g.g.userAgent.Wj)?Wd(this):(g.$.show(this,this.B.G,this.fH.bind(this)),this.Vc=this.bv(),this.aj=!0,a||(this.Vc.focus(),this.Vc.select()))};function Wd(a){g.prompt(g.h.CHANGE_VALUE_TITLE,a.cc(),function(c){a.setValue(c)})} b.bv=function(){var a=g.$.Ca,c=document.createElement("input");c.className="blocklyHtmlInput";c.setAttribute("spellcheck",this.sn);var d=g.pb.qB*this.s.scale+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=g.pb.JA*this.s.scale+"px";a.appendChild(c);c.value=c.defaultValue=this.Ws(this.kb);c.aH=this.kb;c.pz=null;g.g.userAgent.Jq?setTimeout(this.Vp.bind(this),0):this.Vp();this.cu=g.ka(c,"keydown",this,this.YF);this.$F=g.ka(c,"input",this,this.XF);return c}; b.fH=function(){this.aj=!1;this.wt=!0;hc(this);this.au&&this.au(this.kb);g.Xa(this.cu);g.Xa(this.$F);var a=g.$.Ca.style;a.width="auto";a.height="auto";a.fontSize=""};b.YF=function(a){a.keyCode==g.g.Ia.Fq?(g.$.ya(),g.D.Ui()):a.keyCode==g.g.Ia.Gq?(this.Vc.value=this.Vc.defaultValue,g.$.ya(),g.D.Ui()):a.keyCode==g.g.Ia.nw&&(g.$.ya(),g.D.Ui(),Rc(this.B,this,!a.shiftKey),a.preventDefault())}; b.XF=function(){var a=this.Vc.value;a!==this.Vc.pz&&(this.Vc.pz=a,g.i.Z(!0),this.setValue(this.ty(a)),hc(this),g.i.Z(!1))}; b.Vp=function(){var a=g.$.Ca;var c=this.Ei.getBBox();var d=c.height*this.B.v.scale;var e=c.width*this.B.v.scale;var f=g.g.style.hp(this.Ei);c=f.y;d=f.y+d;var h=f.x;e=f.x+e;a.style.width=e-h+"px";a.style.height=d-c+"px";c=new g.g.S(this.B.G?e-a.offsetWidth:h,c);c.y+=1;g.g.userAgent.Jq&&g.$.Ca.style.top&&(--c.x,--c.y);g.g.userAgent.Dr&&(c.y-=3);a.style.left=c.x+"px";a.style.top=c.y+"px"}; g.pb.QF=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.pb.LL=function(a){(a=g.pb.QF(a))&&(a=String(Math.max(0,Math.floor(a))));return a};g.pb.prototype.Ty=function(){return!0};g.pb.prototype.Ck=function(){return this.aj&&this.Vc?this.Vc.value:null};g.pb.prototype.Ws=function(a){return String(a)}; g.pb.prototype.ty=function(a){return a};g.Dc.register("field_input",g.pb);function Xd(a){Xd.w.constructor.call(this,a)}g.g.object.T(Xd,g.pb);Xd.sa=function(a){return new Xd(a.pitch)};var Yd="C3 D3 E3 F3 G3 A3 B3 C4 D4 E4 F4 G4 A4".split(/ /);b=Xd.prototype;b.Le=function(){Xd.w.Le.call(this);if(g.$.Ca.firstChild){var a=this.Js();g.D.Yx().appendChild(a);a=pc(this.B);a=a.Ko||a.fs;g.D.mf(this.B.oh,a);g.D.aA(this,this.Ks.bind(this));this.wD=g.yc(this.Vb,"click",this,this.bF);this.IF=g.yc(this.Vb,"mousemove",this,this.dG);Zd(this)}}; b.Js=function(){this.Vb=document.createElement("div");this.Vb.id="notePicker";return this.Vb};b.Ks=function(){g.Xa(this.wD);g.Xa(this.IF)};b.bF=function(){g.$.ya();g.D.Ui()};b.dG=function(a){var c=this.Vb.getBoundingClientRect();a=g.g.td.Gi(Math.round(13.5-(a.clientY-c.top)/7.5),0,12);this.Vb.style.backgroundPosition=37*-a+"px 0";this.ff=!0;this.aj&&(this.Vc.value=this.Ws(a));this.setValue(a)};b.Ck=function(){if(this.aj)var a=Xd.w.Ck.call(this);else a=this.getValue(),a=Yd[Number(a)]||null;return a}; b.Ws=function(a){return Yd[Number(a)]};b.ty=function(a){a=Yd.indexOf(a.trim().toUpperCase());return-1a.length)){e=[];for(f=0;fthis.jn)return null;var a=this.getOptions(!0)[this.jn][0];return"object"==typeof a?a.alt:a}; g.Ma.nA=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");if(!a.length)throw TypeError("FieldDropdown options must not be an empty array.");for(var c=!1,d=0;dc||Math.abs(a.Kn-d)>c)a.hl=e,a.Kn=d,a.Nb.kn(e+c,d+c),a.wn.setAttribute("width",a.hl),a.wn.setAttribute("height",a.Kn);a.R.G&&a.s.bb.setAttribute("transform","translate("+a.hl+",0)");a.s.resize()} b.Qb=function(a){if(a!=this.isVisible())if(g.i.Ka(new g.i.od(this.R,"mutatorOpen",!a,a)),a){this.Nb=new g.na(this.R.v,this.ks(),this.R.Kd,this.Wi,null,null);Fa(this.Nb,this.R.id);if(a=this.s.options.Of)this.s.M.aa(this.s),this.s.M.show(a.childNodes);this.Tg=this.R.Bg(this.s);a=p(this.Tg,!1);for(var c=0,d;d=a[c];c++)d.za();this.Tg.$p(!1);this.Tg.Qo=!1;this.s.M?(a=2*this.s.M.sb,c=Ua(this.s).Mf()+a):c=a=16;this.R.G&&(c=-c);this.Tg.moveBy(c,a);if(this.R.Xp){var e=this;this.R.Xp(this.Tg);this.aq=function(){e.R.Xp(e.Tg)}; Aa(this.R.v,this.aq)}$d(this);Aa(this.s,this.gH.bind(this));this.Ne()}else this.wn=null,this.s.I(),this.Tg=this.s=null,this.Nb.I(),this.Nb=null,this.Kn=this.hl=0,this.aq&&(Ba(this.R.v,this.aq),this.aq=null)}; b.gH=function(a){if(a.type!=g.i.xo&&(a.type!=g.i.ei||"disabled"!=a.element)){if(!this.s.dc()){a=A(this.s,!1);for(var c=0,d;d=a[c];c++){var e=d.Oa(),f=J(d);20>e.y+f.height&&d.moveBy(0,20-f.height-e.y)}}if(this.Tg.v==this.s){g.i.Z(!0);d=this.R;a=(a=d.eb())&&g.O.Dd(a);c=d.ca;d.ca=!1;d.yg(this.Tg);d.ca=c;d.Ce();c=(c=d.eb())&&g.O.Dd(c);if(a!=c){g.i.Ka(new g.i.eg(d,"mutation",null,a,c));var h=g.i.Ub();setTimeout(function(){g.i.Z(h);d.Hb();g.i.Z(!1)},g.Pn)}d.ca&&d.za();a!=c&&g.De&&g.navigation.HF(d);this.s.dc()|| $d(this);g.i.Z(!1)}}};b.EE=function(){return{rb:this.Kn,lb:this.hl-Ua(this.s).Mf(),xc:0,jc:this.s.G?0:Ua(this.s).Mf()}};b.I=function(){this.R.Gd=null;g.wd.prototype.I.call(this)};g.ic.Uk=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.ga==a?!1:(d.isConnected()&&d.disconnect(),d.connect(a),!0)};g.ic.Nx=function(a){var c=null;if(a&&a.options){var d=a.options.Kb;a.$d?d&&d.options&&(c=d.options.Kb):d&&(c=d)}return c};g.W.Ft={};g.la={};g.la.VB={};g.la.VB.eo=260; g.wk([{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.W.lists_create_with={aa:function(){this.Ec=g.h.LISTS_CREATE_WITH_HELPURL;L(this,"list_blocks");this.jf=3;this.fe();this.Ke(!0,"Array");this.on(new g.ic(["lists_create_with_item"]));this.vb(g.h.LISTS_CREATE_WITH_TOOLTIP)},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("items",this.jf);return a},Ab:function(a){this.jf=parseInt(a.getAttribute("items"),10);this.fe()},Bg:function(a){var c=a.Lh("lists_create_with_container");c.Ce();for(var d=E(c,"STACK").connection,e=0;e","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation", message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks", tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value", name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]); g.wk([{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.la.Pd.yr={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.X.register("logic_op_tooltip",g.X.Do("OP",g.la.Pd.yr)); g.la.Pd.XA={Vd:0,af:0,Zh:!0,eb:function(){if(!this.Vd&&!this.af)return null;var a=g.g.xml.createElement("mutation");this.Vd&&a.setAttribute("elseif",this.Vd);this.af&&a.setAttribute("else",1);return a},Ab:function(a){this.Vd=parseInt(a.getAttribute("elseif"),10)||0;this.af=parseInt(a.getAttribute("else"),10)||0;this.rG()},Bg:function(a){var c=a.Lh("controls_if_if");c.Ce();for(var d=c.V,e=1;e<=this.Vd;e++){var f=a.Lh("controls_if_elseif");f.Ce();d.connect(f.Y);d=f.V}this.af&&(a=a.Lh("controls_if_else"), a.Ce(),d.connect(a.Y));return c},yg:function(a){a=C(a.V);this.af=this.Vd=0;for(var c=[null],d=[null],e=null;a;){switch(a.type){case "controls_if_elseif":this.Vd++;c.push(a.av);d.push(a.$f);break;case "controls_if_else":this.af++;e=a.$f;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.V&&C(a.V)}this.fe();this.Oz(c,d,e)},Xp: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.av=d&&d.connection.ga;a.$f=e&&e.connection.ga; c++;break;case "controls_if_else":e=E(this,"ELSE");a.$f=e&&e.connection.ga;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.V&&C(a.V)}},rG:function(){var a=[null],c=[null],d=null;E(this,"ELSE")&&(d=E(this,"ELSE").connection.ga);for(var e=1;E(this,"IF"+e);){var f=E(this,"DO"+e);a.push(E(this,"IF"+e).connection.ga);c.push(f.connection.ga);e++}this.fe();this.Oz(a,c,d)},fe:function(){E(this,"ELSE")&&this.Yb("ELSE");for(var a=1;E(this,"IF"+a);)this.Yb("IF"+a),this.Yb("DO"+a),a++;for(a= 1;a<=this.Vd;a++)K(M(this,"IF"+a).Db("Boolean"),g.h.CONTROLS_IF_MSG_ELSEIF),K(this.Bf(g.Ra,"DO"+a),g.h.CONTROLS_IF_MSG_THEN);this.af&&K(this.Bf(g.Ra,"ELSE"),g.h.CONTROLS_IF_MSG_ELSE)},Oz:function(a,c,d){for(var e=1;e<=this.Vd;e++)g.ic.Uk(a[e],this,"IF"+e),g.ic.Uk(c[e],this,"DO"+e);g.ic.Uk(d,this,"ELSE")}};g.X.tu("controls_if_mutator",g.la.Pd.XA,null,["controls_if_elseif","controls_if_else"]); g.la.Pd.YA=function(){this.vb(function(){if(this.Vd||this.af){if(!this.Vd&&this.af)return g.h.CONTROLS_IF_TOOLTIP_2;if(this.Vd&&!this.af)return g.h.CONTROLS_IF_TOOLTIP_3;if(this.Vd&&this.af)return g.h.CONTROLS_IF_TOOLTIP_4}else return g.h.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};g.X.register("controls_if_tooltip",g.la.Pd.YA); g.la.Pd.RB={onchange:function(a){this.$m||(this.$m=[null,null]);var c=uc(this,"A"),d=uc(this,"B");c&&d&&!Eb(c.L,d.L)&&(g.i.Z(a.group),a=this.$m[0],a!==c&&(D(c),a&&!a.$a&&E(this,"A").connection.connect(a.L)),c=this.$m[1],c!==d&&(D(d),c&&!c.$a&&E(this,"B").connection.connect(c.L)),this.Hb(),g.i.Z(!1));this.$m[0]=uc(this,"A");this.$m[1]=uc(this,"B")}};g.la.Pd.QB=function(){this.kj(g.la.Pd.RB)};g.X.register("logic_compare",g.la.Pd.QB); g.la.Pd.SB={Jz:null,onchange:function(a){var c=uc(this,"THEN"),d=uc(this,"ELSE"),e=this.L.ga;if((c||d)&&e)for(var f=0;2>f;f++){var h=1==f?c:d;h&&!Eb(h.L,e)&&(g.i.Z(a.group),e===this.Jz?(D(this),e.B.Hb()):(D(h),h.Hb()),g.i.Z(!1))}this.Jz=e}};g.X.Rp("logic_ternary",g.la.Pd.SB);g.Pe=function(a,c,d,e,f,h){this.Tm=-Infinity;this.Rm=Infinity;this.Sk=0;this.ns=null;g.Pe.w.constructor.call(this,a||0,f,h);h||(ae(this,c),be(this,d),ce(this,e),this.setValue(this.getValue()))};g.g.object.T(g.Pe,g.pb);g.Pe.sa=function(a){return new g.Pe(a.value,void 0,void 0,void 0,void 0,a)};g.Pe.prototype.gk=!0;g.Pe.prototype.Ad=function(a){g.Pe.w.Ad.call(this,a);ae(this,a.min);be(this,a.max);ce(this,a.precision)};function ae(a,c){null==c?a.Tm=-Infinity:(c=Number(c),isNaN(c)||(a.Tm=c))} function be(a,c){null==c?a.Rm=Infinity:(c=Number(c),isNaN(c)||(a.Rm=c))}function ce(a,c){null==c?a.Sk=0:(c=Number(c),isNaN(c)||(a.Sk=c));var d=a.Sk.toString(),e=d.indexOf(".");a.ns=-1==e?c?0:null:d.length-e-1}g.Pe.prototype.Dg=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.Tm),this.Rm);this.Sk&&isFinite(a)&&(a=Math.round(a/this.Sk)*this.Sk);null!=this.ns&&(a=Number(a.toFixed(this.ns)));return a}; g.Pe.prototype.bv=function(){var a=g.Pe.w.bv.call(this);-Infinitythis.Rm&&g.g.U.Eb(a,g.g.U.State.IC,this.Rm);return a};g.Dc.register("field_number",g.Pe);g.me=function(a,c,d,e,f){this.jj=g.me.gE;this.RD=a||"";this.Lb=new g.g.qe(0,g.va.Vq);f&&this.Ad(f);c&&(this.Ij=c);f||de(this,d,e)};g.g.object.T(g.me,g.Ma);g.me.sa=function(a){var c=g.g.nc(a.variable);return new g.me(c,void 0,void 0,void 0,a)};b=g.me.prototype;b.s=null;b.gk=!0;b.Ad=function(a){g.me.w.Ad.call(this,a);de(this,a.variableTypes,a.defaultType)};b.Xi=function(){if(!this.Ld){var a=g.N.gp(this.B.v,null,this.RD,this.QD);g.i.disable();this.setValue(a.ua());g.i.enable()}}; b.pm=function(a){var c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";c=g.N.gp(this.B.v,c,d,e);if(null!=e&&e!==c.type)throw Error("Serialized variable type with id '"+c.ua()+"' had type "+c.type+", and does not match variable field that references it: "+g.O.Dd(a)+".");this.setValue(c.ua())};b.iA=function(a){this.Xi();a.id=this.Ld.ua();a.textContent=this.Ld.name;this.Ld.type&&a.setAttribute("variabletype",this.Ld.type);return a}; b.Ku=function(a){if(a.$a)throw Error("Variable fields are not allowed to exist on shadow blocks.");g.me.w.Ku.call(this,a)};b.getValue=function(){return this.Ld?this.Ld.ua():null};b.cc=function(){return this.Ld?this.Ld.name:""};b.Tc=function(){return this.Ld};b.sy=function(){return this.Ld?this.Ij:null}; b.Dg=function(a){if(null===a)return null;var c=g.N.Tc(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=ee(this)){for(var e=0;e=d||0>=c)throw Error("Height and width values of an image field must be greater than 0.");this.nm=!1;this.Bo="";g.kg.w.constructor.call(this,a||"",null,k);k||(this.nm=!!h,this.Bo=g.g.nc(e)||"");this.Lb=new g.g.qe(c,d+g.kg.Aw);this.fF=d;this.Tl=null;"function"== typeof f&&(this.Tl=f)};g.g.object.T(g.kg,g.Ha);g.kg.sa=function(a){return new g.kg(a.src,a.width,a.height,void 0,void 0,void 0,a)};g.kg.Aw=1;b=g.kg.prototype;b.uf=!1;b.ff=!1;b.Ad=function(a){g.kg.w.Ad.call(this,a);this.nm=!!a.flipRtl;this.Bo=g.g.nc(a.alt)||""};b.Yi=function(){this.Vb=g.g.o.K("image",{height:this.fF+"px",width:this.Lb.width+"px",alt:this.Bo},this.we);this.Vb.setAttributeNS(g.g.o.Ue,"xlink:href",this.kb)};b.Dg=function(a){return"string"!=typeof a?null:a}; b.sh=function(a){this.kb=a;this.Vb&&this.Vb.setAttributeNS(g.g.o.Ue,"xlink:href",this.kb||"")};b.by=function(){return this.nm};b.Le=function(){this.Tl&&this.Tl(this)};b.Ck=function(){return this.Bo};g.Dc.register("field_image",g.kg);g.Generator=function(a){this.MF=a;this.rB=new RegExp(this.le,"g")};g.Generator.xb="generated_function";b=g.Generator.prototype;b.ho=null;b.yd=null;b.Qc=null;b.kd=" ";b.TA=60;b.po=[]; function Ud(){var a=g.m,c=I;c||(console.warn("No workspace specified in workspaceToCode call. Guessing."),c=g.ub());var d=[];a.aa(c);c=A(c,!0);for(var e=0,f;f=c[e];e++){var h=ge(a,f);Array.isArray(h)&&(h=h[0]);h&&(f.L&&(h=a.Uz(h),a.yd&&!f.Zh&&(h=S(a.yd,f)+h),a.Qc&&!f.Zh&&(h+=S(a.Qc,f))),d.push(h))}d=d.join("\n");d=a.finish(d);d=d.replace(/^\s+\n/,"");d=d.replace(/\n\s+$/,"\n");return d=d.replace(/[ \t]+\n/g,"\n")}function he(a,c){return c+a.replace(/(?!\n$)\n/g,"\n"+c)} function ge(a,c){if(!c)return"";if(!c.isEnabled())return ge(a,t(c));var d=a[c.type];if("function"!=typeof d)throw Error('Language "'+a.MF+'" 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.Yp(c,d[0],void 0),d[1]]}if("string"==typeof d)return a.yd&&!c.Zh&&(d=S(a.yd,c)+d),a.Qc&&!c.Zh&&(d+=S(a.Qc,c)),a.Yp(c,d,void 0);if(null===d)return"";throw SyntaxError("Invalid code generated: "+ d);} function T(a,c,d){var e=g.m;if(isNaN(d))throw TypeError("Expecting valid order from block: "+a.type);var f=uc(a,c);if(!f)return"";c=ge(e,f);if(""===c)return"";if(!Array.isArray(c))throw TypeError("Expecting tuple from value block: "+f.type);a=c[0];c=c[1];if(isNaN(c))throw TypeError("Expecting valid order from value block: "+f.type);if(!a)return"";f=!1;var h=Math.floor(d),k=Math.floor(c);if(h<=k&&(h!=k||0!=h&&99!=h))for(f=!0,h=0;hd?T(a,c,g.m.ek)||h:e?T(a,c,g.m.Dl)||h:T(a,c,f)||h;if(g.Hh(a))a=Number(a)+d,e&&(a=-a);else{if(0d&&(a=a+" - "+-d,k=g.m.ek);e&&(a=d?"-("+a+")":"-"+a,k=g.m.Dl);k=Math.floor(k);f=Math.floor(f);k&&f>=k&&(a="("+a+")")}return a};g.m.Ft={};g.m.lists_create_empty=function(){return["[]",g.m.eh]};g.m.lists_create_with=function(a){for(var c=Array(a.jf),d=0;d b.toString() ? 1 : -1; },",' "IGNORE_CASE": function(a, b) {'," return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },"," };"," var compare = compareFuncs[type];", " return function(a, b) { return compare(a, b) * direction; }","}"]);return[c+".slice().sort("+e+'("'+a+'", '+d+"))",g.m.yb]};g.m.lists_split=function(a){var c=T(a,"INPUT",g.m.Mb),d=T(a,"DELIM",g.m.xd)||"''";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.m.yb]};g.m.lists_reverse=function(a){return[(T(a,"LIST",g.m.yb)||"[]")+".slice().reverse()",g.m.yb]};g.m.vF={};g.m.controls_if=function(a){var c=0,d="";g.m.yd&&(d+=S(g.m.yd,a));do{var e=T(a,"IF"+c,g.m.xd)||"false";var f=ie(a,"DO"+c);g.m.Qc&&(f=he(S(g.m.Qc,a),g.m.kd)+f);d+=(0",GTE:">="}[z(a,"OP")],d="=="==c||"!="==c?g.m.Yv:g.m.iC,e=T(a,"A",d)||"0";a=T(a,"B",d)||"0";return[e+" "+c+" "+a,d]};g.m.logic_operation=function(a){var c="AND"==z(a,"OP")?"&&":"||",d="&&"==c?g.m.Yq:g.m.Zq,e=T(a,"A",d);a=T(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.m.logic_negate=function(a){var c=g.m.Bl;return["!"+(T(a,"BOOL",c)||"true"),c]}; g.m.logic_boolean=function(a){return["TRUE"==z(a,"BOOL")?"true":"false",g.m.eh]};g.m.logic_null=function(){return["null",g.m.eh]};g.m.logic_ternary=function(a){var c=T(a,"IF",g.m.oo)||"false",d=T(a,"THEN",g.m.oo)||"null";a=T(a,"ELSE",g.m.oo)||"null";return[c+" ? "+d+" : "+a,g.m.oo]};g.m.xF={};g.m.controls_repeat_ext=function(a){var c=B(a,"TIMES")?String(Number(z(a,"TIMES"))):T(a,"TIMES",g.m.pi)||"0",d=ie(a,"DO");d=je(d,a);a="";var e=pd(g.m.vd,"count",g.N.xb),f=c;c.match(/^\w+$/)||g.Hh(c)||(f=pd(g.m.vd,"repeat_end",g.N.xb),a+="var "+f+" = "+c+";\n");return a+("for (var "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")};g.m.controls_repeat=g.m.controls_repeat_ext; g.m.controls_whileUntil=function(a){var c="UNTIL"==z(a,"MODE"),d=T(a,"BOOL",c?g.m.Bl:g.m.xd)||"false",e=ie(a,"DO");e=je(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"}; g.m.controls_for=function(a){var c=od(z(a,"VAR"),g.N.xb),d=T(a,"FROM",g.m.pi)||"0",e=T(a,"TO",g.m.pi)||"0",f=T(a,"BY",g.m.pi)||"1",h=ie(a,"DO");h=je(h,a);if(g.Hh(d)&&g.Hh(e)&&g.Hh(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.Hh(d)||(k=pd(g.m.vd,c+"_start",g.N.xb),a+="var "+k+" = "+d+";\n"),d=e,e.match(/^\w+$/)||g.Hh(e)||(d=pd(g.m.vd,c+"_end", g.N.xb),a+="var "+d+" = "+e+";\n"),e=pd(g.m.vd,c+"_inc",g.N.xb),a+="var "+e+" = ",a=g.Hh(f)?a+(Math.abs(f)+";\n"):a+("Math.abs("+f+");\n"),a=a+("if ("+k+" > "+d+") {\n")+(g.m.kd+e+" = -"+e+";\n"),a+="}\n",a+="for ("+c+" = "+k+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+h+"}\n";return a}; g.m.controls_forEach=function(a){var c=od(z(a,"VAR"),g.N.xb),d=T(a,"LIST",g.m.pi)||"[]",e=ie(a,"DO");e=je(e,a);a="";var f=d;d.match(/^\w+$/)||(f=pd(g.m.vd,c+"_list",g.N.xb),a+="var "+f+" = "+d+";\n");d=pd(g.m.vd,c+"_index",g.N.xb);e=g.m.kd+c+" = "+f+"["+d+"];\n"+e;return a+("for (var "+d+" in "+f+") {\n"+e+"}\n")}; g.m.controls_flow_statements=function(a){var c="";g.m.yd&&(c+=S(g.m.yd,a));g.m.Qc&&(c+=S(g.m.Qc,a));if(g.m.yd){var d=g.la.ne.Vn.qy(a);d&&!d.Zh&&(c+=S(g.m.yd,d))}switch(z(a,"FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");};g.m.td={};g.m.math_number=function(a){a=Number(z(a,"NUM"));return[a,0<=a?g.m.eh:g.m.Dl]};g.m.math_arithmetic=function(a){var c={ADD:[" + ",g.m.oi],MINUS:[" - ",g.m.ek],MULTIPLY:[" * ",g.m.$q],DIVIDE:[" / ",g.m.Al],POWER:[null,g.m.ad]}[z(a,"OP")],d=c[0];c=c[1];var e=T(a,"A",c)||"0";a=T(a,"B",c)||"0";return d?[e+d+a,c]:["Math.pow("+e+", "+a+")",g.m.yb]}; g.m.math_single=function(a){var c=z(a,"OP");if("NEG"==c)return a=T(a,"NUM",g.m.Dl)||"0","-"==a[0]&&(a=" "+a),["-"+a,g.m.Dl];a="SIN"==c||"COS"==c||"TAN"==c?T(a,"NUM",g.m.Al)||"0":T(a,"NUM",g.m.xd)||"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.m.yb];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.m.Al]}; g.m.math_constant=function(a){return{PI:["Math.PI",g.m.Mb],E:["Math.E",g.m.Mb],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",g.m.Al],SQRT2:["Math.SQRT2",g.m.Mb],SQRT1_2:["Math.SQRT1_2",g.m.Mb],INFINITY:["Infinity",g.m.eh]}[z(a,"CONSTANT")]}; g.m.math_number_property=function(a){var c=T(a,"NUMBER_TO_CHECK",g.m.Cl)||"0",d=z(a,"PROPERTY");if("PRIME"==d){var e=le("mathIsPrime",["function "+g.m.le+"(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.m.yb]}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=T(a,"DIVISOR",g.m.Cl)||"0",e=c+" % "+a+" == 0"}return[e,g.m.Yv]}; g.m.math_change=function(a){var c=T(a,"DELTA",g.m.oi)||"0";a=od(z(a,"VAR"),g.N.xb);return a+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+c+";\n"};g.m.math_round=g.m.math_single;g.m.math_trig=g.m.math_single; g.m.math_on_list=function(a){var c=z(a,"OP");switch(c){case "SUM":a=T(a,"LIST",g.m.Mb)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=T(a,"LIST",g.m.ad)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=T(a,"LIST",g.m.ad)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":c=le("mathMean",["function "+g.m.le+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]);a=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;case "MEDIAN":c= le("mathMedian",["function "+g.m.le+"(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=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;case "MODE":c=le("mathModes", ["function "+g.m.le+"(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=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=le("mathStandardDeviation",["function "+g.m.le+"(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=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;case "RANDOM":c=le("mathRandomList",["function "+g.m.le+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]);a=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,g.m.yb]};g.m.math_modulo=function(a){var c=T(a,"DIVIDEND",g.m.Cl)||"0";a=T(a,"DIVISOR",g.m.Cl)||"0";return[c+" % "+a,g.m.Cl]}; g.m.math_constrain=function(a){var c=T(a,"VALUE",g.m.ad)||"0",d=T(a,"LOW",g.m.ad)||"0";a=T(a,"HIGH",g.m.ad)||"Infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",g.m.yb]}; g.m.math_random_int=function(a){var c=T(a,"FROM",g.m.ad)||"0";a=T(a,"TO",g.m.ad)||"0";return[le("mathRandomInt",["function "+g.m.le+"(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.m.yb]};g.m.math_random_float=function(){return["Math.random()",g.m.yb]}; g.m.math_atan2=function(a){var c=T(a,"X",g.m.ad)||"0";return["Math.atan2("+(T(a,"Y",g.m.ad)||"0")+", "+c+") / Math.PI * 180",g.m.Al]};g.m.qG={};g.m.procedures_defreturn=function(a){var c=od(z(a,"NAME"),g.Ea.xb),d="";g.m.yd&&(d+=S(g.m.yd,a));g.m.Qc&&(d+=S(g.m.Qc,a));d&&(d=he(d,g.m.kd));var e="";g.m.ho&&(e=he(S(g.m.ho,a),g.m.kd));var f=ie(a,"STACK"),h=T(a,"RETURN",g.m.xd)||"",k="";f&&h&&(k=d);h&&(h=g.m.kd+"return "+h+";\n");for(var l=[],m=0;mO&&(a.shift(),a.pop());sc(this,{message0:P("Music_playNote"),args0:[{type:"field_dropdown",name:"DURATION",options:a},{type:"input_value", name:"PITCH",check:"Number"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:160,tooltip:P("Music_playNoteTooltip")})}};g.m.music_note=function(a){var c=T(a,"PITCH",g.m.ad)||"7";return"play("+Number(z(a,"DURATION"))+", "+c+", 'block_id_"+a.id+"');\n"};g.W.music_rest_whole={aa:function(){sc(this,{message0:P("Music_rest"),args0:[{type:"field_image",src:"music/rest1.png",width:10,height:20,alt:"-"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:160,tooltip:P("Music_restWholeTooltip")})}}; g.m.music_rest_whole=function(a){return"rest(1, 'block_id_"+a.id+"');\n"}; g.W.music_rest={aa:function(){sc(this,{message0:P("Music_rest"),args0:[{type:"field_dropdown",name:"DURATION",options:[[{src:"music/rest1.png",width:10,height:20,alt:"whole"},"1"],[{src:"music/rest0.5.png",width:10,height:20,alt:"half"},"0.5"],[{src:"music/rest0.25.png",width:10,height:20,alt:"quarter"},"0.25"],[{src:"music/rest0.125.png",width:10,height:20,alt:"eighth"},"0.125"],[{src:"music/rest0.0625.png",width:10,height:20,alt:"sixteenth"},"0.0625"]]}],inputsInline:!0,previousStatement:null,nextStatement:null, colour:160,tooltip:P("Music_restTooltip")})}};g.m.music_rest=function(a){return"rest("+Number(z(a,"DURATION"))+", 'block_id_"+a.id+"');\n"}; g.W.music_instrument={aa:function(){sc(this,{message0:P("Music_setInstrument"),args0:[{type:"field_dropdown",name:"INSTRUMENT",options:[[P("Music_piano"),"piano"],[P("Music_trumpet"),"trumpet"],[P("Music_banjo"),"banjo"],[P("Music_violin"),"violin"],[P("Music_guitar"),"guitar"],[P("Music_flute"),"flute"],[P("Music_drum"),"drum"],[P("Music_choir"),"choir"]]}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:160,tooltip:P("Music_setInstrumentTooltip")})}}; g.m.music_instrument=function(a){return"setInstrument("+g.m.Nz(z(a,"INSTRUMENT"))+", 'block_id_"+a.id+"');\n"};g.W.music_start={aa:function(){sc(this,{message0:P("Music_start"),args0:[{type:"field_image",src:"music/play.png",width:17,height:17,alt:"\u25b6"}],message1:"%1",args1:[{type:"input_statement",name:"STACK"}],colour:0,tooltip:P("Music_startTooltip")})}};g.m.music_start=function(a){U++;a=ie(a,"STACK");g.m.rh["%start"+U]="function start"+U+"() {\n"+a+"}\n";return null}; 10>O&&(g.W.procedures_defnoreturn.aa=function(){var a=new g.pb("",g.Ea.uu);Vd(a);K(K(K(N(this),g.h.PROCEDURES_DEFNORETURN_TITLE),a,"NAME"),"","PARAMS");this.mf(g.h.PROCEDURES_HUE);this.vb(g.h.PROCEDURES_DEFNORETURN_TOOLTIP);this.Ec=g.h.PROCEDURES_DEFNORETURN_HELPURL;this.Fa=[];this.$b=[];this.Yh(!0);this.$f=null},delete g.W.procedures_defreturn,delete g.W.procedures_ifreturn);var ne=ne||{};function oe(a,c){function d(){}d.prototype=c.prototype;a.w=c.prototype;a.prototype=new d;a.prototype.constructor=a;a.nL=function(e,f,h){return c.prototype[f].apply(e,Array.prototype.slice.call(arguments,2))}}if(!pe){var pe,qe="";"undefined"!==typeof navigator&&navigator&&"string"==typeof navigator.userAgent&&(qe=navigator.userAgent);var re=0==qe.indexOf("Opera");pe={IL:{GI:"ScriptEngine"in window},KJ:re,lg:!re&&-1!=qe.indexOf("MSIE"),Dr:!re&&-1!=qe.indexOf("WebKit")}}if(!se)var se={}; if(!te)var te={};if(!ue)var ue={};if(!ve)var ve={};if(!we)var we={};if(!xe)var xe={};var ye=ne.OH?{QL:!0}:{};function ze(){throw Error("Do not instantiate directly");}ze.prototype.bx=null;ze.prototype.toString=function(){return this.content};function Ae(a){if(null!=a)switch(a.bx){case 1:return 1;case -1:return-1;case 0:return 0}return null}function Be(){ze.call(this)}oe(Be,ze);Be.prototype.DD=ye;function V(a){return null!=a&&a.DD===ye?a:Ce(String(String(a)).replace(De,Ee),Ae(a))} var Ce=function(a){function c(){}c.prototype=a.prototype;return function(d,e){var f=new c;f.content=String(d);void 0!==e&&(f.bx=e);return f}}(Be),Fe={"\x00":"�",'"':""","&":"&","'":"'","<":"<",">":">","\t":" ","\n":" ","\x0B":" ","\f":" ","\r":" "," ":" ","-":"-","/":"/","=":"=","`":"`","\u0085":"…","\u00a0":" ","\u2028":"
","\u2029":"
"};function Ee(a){return Fe[a]}var De=/[\x00\x22\x26\x27\x3c\x3e]/g;function Ie(){return'
'};function Je(){for(var a='
Jogos do BlocklyQuebra-Cabe\u00e7aLabirintoP\u00e1ssaroTartarugaFilmeM\u00fasicaTutor de LagoaLagoaGen\u00e9ticasVoc\u00ea solucionou esse n\u00edvel com uma linha de JavaScript:Voc\u00ea solucionou esse n\u00edvel com %1 linhas de JavaScript:Voc\u00ea esta preparado para o n\u00edvel %1?Voc\u00ea esta preparado para o pr\u00f3ximo desafio?T\u00edtulo:Salvar e ligar aos blocos.Rodar o programa que voc\u00ea escreveu.Executar o programaParar a execu\u00e7\u00e3o do programa e resetar o nivel.ReiniciarAjudaOKCancelarL\u00f3gicaLa\u00e7osMatem\u00e1ticaTextoListasCorVari\u00e1veisFun\u00e7\u00f5esHouve um problema com a requisi\u00e7\u00e3o.Compartilhe seus blocos com este link:\n\n%1Desculpe, \'%1\' n\u00e3o corresponde a um programa salvo.N\u00e3o foi poss\u00edvel carregar seu arquivo salvo. Talvez ele tenha sido criado com uma vers\u00e3o diferente do Blockly?Agradecemos pelo programa! Se a nossa equipa gostar dele, este ser\u00e1 publicado na galeria por n\u00f3s dentro de alguns dias.listatextoQuando voc\u00ea come\u00e7ar a editar o JavaScript, voc\u00ea n\u00e3o poder\u00e1 mais voltar a editar os blocos. Voc\u00ea tem certeza?Blocos
Toque uma nota musical com a dura\u00e7\u00e3o e altura \\nespec\u00edficas. tocar %1 nota %2Aguarde pela dura\u00e7\u00e3o especificada.Aguarde por uma semibreve.resta %1Alterne para o instrumento espec\u00edfico ao tocar \\nas notas musicais posteriores. ajustar o instrumento para %1Execute os blocos dentro quando o bot\u00e3o de \\n\'Executar programa\' for clicado. quando %1 \u00e9 clicadoUma nota (C4 \u00e9 7).primeira partepianotrompetebanjoviolinoguitarraflautatamborcoroExecute o seu programa at\u00e9 ele parar. Ent\u00e3o poder\u00e1 enviar a sua m\u00fasica para a galeria.

'+ ((ud?'':'')+"Jogos do Blockly : "+V({appName:"M\u00fasica"}.appName)+""),c="   ",d=1;11>d;d++)c+=" "+(d==O?''+V(d)+"":10==d?''+V(d)+"":'');return a+c+'

  
\x3c!-- Slow icon. --\x3e\x3c!-- Fast icon. --\x3e
'+ (10!=O||ud?"":'
Envie sua m\u00fasica para a galeria.
T\u00edtulo:
\x3c!--Legal disclaimer goes here if needed.--\x3e
')+ ('
Parab\u00e9ns!
Este n\u00edvel \u00e9 extremamente dif\u00edcil. Voc\u00ea deseja pul\u00e1-lo e ir ao pr\u00f3ximo jogo? Voc\u00ea sempre pode voltar mais tarde.
')+ (Ie()+'
A sua solu\u00e7\u00e3o funcionou, mas pode fazer melhor. Utilize as fun\u00e7\u00f5es para reduzir a quantidade de c\u00f3digo repetido.
')+Ie()+'
A m\u00fasica soar\u00e1 melhor se usar um instrumento diferente em cada bloco inicial.
'+Ie()+'
'+ (1==O?"Componha as primeiras quatro notas de 'Fr\u00e8re Jacques'.

C4 - D4 - E4 - C4

":2==O?"Uma 'fun\u00e7\u00e3o' permite agrupar os blocos, e depois execut\u00e1-los mais de uma vez.
Crie uma fun\u00e7\u00e3o para tocar as quatro primeiras notas de 'Fr\u00e8re Jacques'. Execute essa fun\u00e7\u00e3o duas vezes. N\u00e3o acrescente novos blocos de notas.":3==O?'Crie uma segunda fun\u00e7\u00e3o para a pr\u00f3xima parte de \'Fr\u00e8re Jacques\'. A \u00faltima nota \u00e9 mais longa.
': 4==O?'Crie uma terceira fun\u00e7\u00e3o para a pr\u00f3xima parte de \'Fr\u00e8re Jacques\'. As quatro primeiras notas s\u00e3o mais curtas.
':5==O?"Complete toda a cantiga de 'Fr\u00e8re Jacques'.":6==O?'Este bloco novo permite que mude para outro instrumento.
Tocar a sua \u00e1ria com um violino.':7==O?'Este novo bloco acrescenta um temporizador silencioso.
Crie um segundo bloco inicial que tenha dois blocos silenciosos, e ent\u00e3o toque \'Fr\u00e8re Jacques\'.': 8==O?"Cada bloco inicial deve tocar 'Fr\u00e8re Jacques' duas vezes.":9==O?"Crie quatro blocos iniciais que toquem 'Fr\u00e8re Jacques' duas vezes. Acrescente o n\u00famero correto dos blocos silenciosos.":10==O?"Componha o que o que voc\u00ea quiser. Voc\u00ea tem uma grande quantidade de blocos novos que pode explorar. Divirta-se!"+(ud?"":'

Utilize o bot\u00e3o "Ver Galeria" para ver o que as outras pessoas compuseram. Se compor algo interessante, use o bot\u00e3o "Enviar para a Galeria" para publicar.'): "")+"
"+Ie()+"
"};function Ke(a){var c=Le;this.LB=23;this.$j=18;this.Nq=132;this.wi=20;this.kb=.5;this.Mw=c;this.Kr=[];c=g.g.o.Hl;var 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.wi);d.setAttribute("y",35-this.wi);d.setAttribute("width",130+2*this.wi);d.setAttribute("height", 2*this.wi);d.setAttribute("rx",this.wi);d.setAttribute("ry",this.wi);a.appendChild(d);this.XG=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.Wy=d;c=document.createElementNS(c,"circle");c.setAttribute("style","opacity: 0");c.setAttribute("r",this.wi);c.setAttribute("cy",35);a.appendChild(c);this.yt=c;for(this.setValue(.5);a&&"svg"!=a.nodeName.toLowerCase();)a=a.parentNode;this.Sa=a;Me(this.yt,"mousedown", this,this.Vy);Me(this.yt,"touchstart",this,this.Vy);Me(this.XG,"mousedown",this,this.sG);Me(this.Sa,"mouseup",null,Ne);Me(this.Sa,"touchend",null,Ne);Me(this.Sa,"mousemove",null,Oe);Me(this.Sa,"touchmove",null,Oe);Me(document,"mouseover",null,Pe)}var Qe=null,Re=0,Se=0;Ke.prototype.Vy=function(a){if("touchstart"==a.type){if(1!=a.changedTouches.length)return;Te(a)}Qe=this;Re=Ue(this,a).x;Se=0;var c=this.Wy.getAttribute("transform");c&&(c=c.match(/translate\(\s*([-\d.]+)/))&&(Se=Number(c[1]));a.preventDefault()}; function Ne(){Qe=null}function Pe(a){if(Qe){a=a.target;do if(a==Qe.Sa)return;while(a=a.parentNode);Qe=null}}function Oe(a){var c=Qe;if(c){if("touchmove"==a.type){if(1!=a.changedTouches.length)return;Te(a)}a=Ue(c,a).x-Re+Se;c.setValue((a-c.$j)/(c.Nq-c.$j))}}Ke.prototype.sG=function(a){if("touchstart"==a.type){if(1!=a.changedTouches.length)return;Te(a)}a=Ue(this,a).x;Ve(this,(a-this.$j)/(this.Nq-this.$j))};Ke.prototype.getValue=function(){return this.kb}; function Ve(a,c){function d(h){return function(){a.setValue(h*(c-e)/9+e)}}for(;a.Kr.length;)clearTimeout(a.Kr.pop());for(var e=a.getValue(),f=0;10>f;f++)a.Kr.push(setTimeout(d(f),200*f/10))}Ke.prototype.setValue=function(a){this.kb=g.g.td.Gi(a,0,1);a=this.$j+(this.Nq-this.$j)*this.kb;this.Wy.setAttribute("transform","translate("+a+","+this.LB+")");this.yt.setAttribute("cx",a);this.Mw&&this.Mw(this.kb)}; function Ue(a,c){var d=a.Sa.createSVGPoint();d.x=c.clientX;d.y=c.clientY;a=a.Sa.getScreenCTM().inverse();return d.matrixTransform(a)}function Me(a,c,d,e){a.addEventListener(c,function(f){e.apply(d,arguments)},!1)}function Te(a){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY};var Cd="music",We=0,U=0,Xe=0,Ye=0,Ze=null,$e=[],af=0,W=0,Y=null,bf=!1; window.addEventListener("load",function(){function a(){var n=e.offsetTop;f.style.top=n+"px";h.style.top=n+"px";d.style.top=Math.max(10,n-window.pageYOffset)+"px";d.style.left=c?"10px":"420px";d.style.width=window.innerWidth-440+"px"}document.body.innerHTML=Je();R.aa();var c=-1!=rd.indexOf(sd),d=document.getElementById("blockly"),e=document.getElementById("paddingBox"),f=document.getElementById("staveBox"),h=document.getElementById("musicBox");window.addEventListener("scroll",function(){a(null);g.$k(I)}); window.addEventListener("resize",a);a(null);var k=1.03333-.0333333*O,l=document.getElementById("toolbox");I=g.Dh("blockly",{disable:!1,media:"third-party/blockly/media/",rtl:c,toolbox:l,zoom:{maxScale:2,controls:!0,wheel:!0,startScale:k}});Aa(I,g.i.xx);Aa(I,cf);ke("play,rest,setInstrument,start0,start1,start2,start3,start4,start5,start6,start7,start8,start9");document.getElementById("submitButton")&&Dd("submitButton",df);k=document.getElementById("slider");me=new Ke(k);R.tF('',10!=O||ef);if(6location.hash.length&&!Ad(O)&&setTimeout(lf,1E3)});function kf(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/SoundJS/soundjs.min.js";a.onload=mf;document.head.appendChild(a)} function mf(){for(var a="piano trumpet violin drum flute banjo guitar choir".split(" "),c=[],d=0;d/g,">");d=d.replace(/%1/g,e);R.ot("sampleHelp2", d)}else 6==O?R.ot("sampleHelp6",''):7==O&&R.ot("sampleHelp7",'');Q.xj(a,c,!0,!0,{width:"50%",left:"25%",top:"5em"},qf);Q.bq()}function qf(){Q.eq()} function cf(a){var c=document.getElementById("toolbox"),d=document.getElementById("music_start");if(d){var e=Z?Z.length:4,f=U;if(a instanceof g.i.ie){for(var h=[],k=A(I,!1),l=0,m;m=k[l];l++)"music_start"!=m.type||m.Ng()||h.push(m);if(e a.length&&h.length;)m=h.shift(),m.Eu(!1),a.push(m);e>a.length&&(d.setAttribute("disabled","false"),fd(c));U=a.length}U!=f&&jf()}} function gf(){clearTimeout(We);for(var a=0,c;c=$e[a];a++)rf(c);Y=Ze=null;af=W=$e.length=0;bf=!1;document.getElementById("staveBox").innerHTML="";a=document.getElementById("musicContainer");a.innerHTML="";Ye=0;c=document.createElement("img");c.id="musicContainerWidth";c.src="common/1x1.gif";a.appendChild(c);if(Z){nf(Z.length);for(a=0;aO){m=Z[Y.Me-1];var n=Y.transcript;l=n.length-2;if(m[l]!=n[l]||m[l+1]!=n[l+1])k=!0}pf(Y.Me,W/64,String(f),e,k?"wrong":"");vf(h)};a.setProperty(c,"play",a.createNativeFunction(d));d=function(e,f){rf(Y);Y.Np=64*e+W;1O){var k=Z[Y.Me-1],l=Y.transcript,m=l.length-2;if(k[m]!=l[m]||k[m+1]W)break a}while(f);rf(e);e.Gk&&(R.zm(e.Gk,!1),e.Gk=null);e.done=!0}c?(yf()&&(R.yG(),10>O&&(U=0,Q.AD())),document.getElementById("spinner").style.visibility="hidden",bd(null), bf=!0):(sf(),W++,We=setTimeout(xf,af+W*a-Date.now()))}function rf(a){var c=a.Ou;c&&(setTimeout(c.stop.bind(c),100),a.Ou=null)} function sf(){var a=document.getElementById("musicBox"),c=document.getElementById("musicContainer"),d=document.getElementById("musicContainerWidth"),e=10>O?200:100;e=W?Math.round(W/64*256+10+e):a.scrollWidth+e;for(d.width=e;Yea)return!1;if((7==O||8==O)&&1>a||9==O&&3>a)return console.log("Not enough instruments. Found: "+a),a=document.getElementById("helpUseInstruments"), c={width:"30%",left:"35%",top:"12em"},Q.xj(a,null,!1,!0,c,Q.eq),Q.bq(),!1}c=[void 0,void 0,16,23,38,47,47,53,55,71,void 0][O];d=0;var e=y(I);a=0;for(var f;f=e[a];a++)"music_instrument"!=f.type&&f.isEnabled()&&!rc(f)&&d++;return c&&d>c?(console.log("Too many blocks. Found: "+d+" Max: "+c),a=document.getElementById("helpUseFunctions"),c={width:"30%",left:"35%",top:"12em"},Q.xj(a,null,!1,!0,c,Q.eq),Q.bq(),!1):!0}function ef(a){return a.replace(/"music_rest_whole"/g,'"music_rest"')} function df(){if(bf&&U){var a="data:image/png;base64,"+[void 0,"iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfhDAQXCQ8DSgv8AAACEklEQVRo3mP8z0B7wMQwasmoJaOWjFoyasmoJaOWjFpCR0samV3p4JN/IqNxMjIt+UsPS248oIMll3fRI04WvKeDJcfX0yN1TaaHJRd66JFP+n7SwZLnsfTI8dtW09gSRlYGhq/Vn2lrSdACVgaGR620tYQvqp6N4efcczS15DtDdRgzw5sptI74xS4MDAu20zp1zZVl+D+B1pZIb+Fl2LWF1jWjXgwDQz/Nq99KXYZ9p2ltiWwKA8NMmjck/PUY9tDcEvkAhte7aG0Jg6/gt4M0t8SEi+EC7Rt3dgxvaW/Jf4Zf9Gim/qeHJay0t4SRgY32ljxn4KW9JfcZNGluyeefDLI0t2T3Nx4tmlty+hOTO80t2c9gQPNS+PAD1nCaW3LiJUMArS15sZ3JVorWlvyTlMkkSiELBZZIdb3XobolV7afu8bMZRyCaHpJE1tUEws22/NCCkMuOYaI/yQBYn1yqmY3jPntEanhSqQlTRPfURB5xFlSOPU3A60tKUZvvf+j/gDOHIyRAXHqWzIZPay4jUltbRAE3Rh6FH6QloSJ8MlSdAH2Cnaq+4QHXUvwfxIBI+HGGQfaKIrjTlYGqkc8WlJy2k6qHcRYkoTM4Sncy056biQcok8cECGnsvs/GYCYUvhxoSoDAwMDk1bK0v9kAUai1kjcvPCAQVBOSY3cFvPoQoxRS0YtGbVk1JLhbgkATHAP6cDyYR8AAAAASUVORK5CYII=", "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAAB8klEQVRo3u3aO0/CUBQA4FMjJsaBTg4uxcHEzZLowlLG3on6CwyDM/EXgLMD8AuAXyDbrYvt4uojTg4GBgc10dY4OZg6FHld0tflOJhzN3pP79f7OL20oASAX1aAEEIIIYQQTGTYj6pVlnGrv7TPNl8i6ldlgTdu8/eYGDnknttOgjAJ5ILbD8kiMyLPnNufiaOzINecX6U6IS3yzTkfpL2qdMix8/SVoevpkNfHRUcPGLNdQMyTNcZMDcDGy5MCM1kONU9KzNwHzDzZYCbbAsw82TEZA9Q8MUy2h7yE10su/qa1mwN8hL5IEEIIIYQQQgghhBBCyB8ivWpRUZRi24+JC9KUujH1wWuov42olhF1Wvae9LYb4w74fZyn32oX9cEUAMA/dPEn/sTFX10tYawKSxgu/w5AGzfknwoBliwybLu3AAB6fXSgK+SFZsnlyaA8CVbDdDCEVpzIJmKRxuwLifCk+XIUyCDe3DAsRmKMGMTTYRFSSWfEIMJ0hsjMC+f8eSCFNIXBr4xulJMjNS+QQjxVQDqjKiccMaPpJbl5RyEdwdCmah1nkHSHiEIqKdMh034i5HWtjL/9HrUQ9vi56653s25wkasrPz3nGecjNk9utDHRCSRKzA9nLdf9yOu6VQaZotAfMQghhBBC/jvyA6C+2c6ogwZuAAAAAElFTkSuQmCC", "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAAB4ElEQVRo3u2aPVKDUBCAl4ytA7U6k1hZQio7SUorMuMBoicgOQG5AXKC4AGcxMoyuQFJaQWeAGbsXYvEwPuBBxkZR2e3y9t979tfMnlEQ2hfOkAQghCEIASRyonS4vXjSq54Oz0rU9xyK6iSYXPPHe4IKjxBfnNO4PxOvv58cV2iaA65+Qzkiu1gVqKwqPAEIQhBCEIQghCEIAQhCEEIQpA/DcmeHi41TesH2Y/+jmcQ0+Xu8M3ksS1IMMv9T9qBZNPwuJo0gGTDTfuFP5rRADI5mlGVrmwLYBqHOovXOCN+IXkHsBtAkmCZAAAMvP2C2LE2exn0Eq4zADBGnnia9Jo2GuQGPRsREXvCzqi4I8z1Rs/jjpNCJqzHO0Ne/BKnAKAGJOXuxOSQcZFhQCWkU3ccuuxHtzCXy77qOSYEYgkFRkTEeXFJX1XEUSNdYm/sEzPOEV5a6RUsFJBYjPXb64UDAADOnEGwIe4yiwqIL2wxC9rVKhbSK/a2p4LY1eMgSlzpVc1XG3OrWi98rehh4weke68w4FtLX1vKFna5OJQvipAdoK4su0J36cXsRmoG211uijUgGB0o3RphsJPllDglTnzq2wC67UVYV2LXBDAdPy4z0OiPGAQhCEEI8t8hX5wfXfFkGIkcAAAAAElFTkSuQmCC", "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAACU0lEQVRo3u2aTY7aQBCFnyMWkRLJZjkrs8rWzlwAcwLgBMAJ4AYWJwBOYOYEkBPYXCD2Ohs7J7AjJcomUmXhAf90N+OMbWmkVG2A6nZ/7q56JSijEfq3d2AIQxjy/0AGUu/w93v59B8fBooBXe7/84sATVq7hll32yAOPKdw1R4e5P6vnz4qBh7l/p/fAIBkNnZJbvBVAwq/DyLiwDOEIQxhCEMYwhCGMIQhDGEIQ97iT+ymdgkCwJhNjd4g2eGYAADOxq4vyHZ/a1hlq34g2STqPfDR5xoj6R6STOqL9gCZC/3DUeeQvRAPszUkOUyGmqbNn66OgzBlc3eBl1tR4ew22clbUb6wipnea0W9mMLZdl98CCovJTsabXQSrZrIwXPaiDGayNrQ9SB7yzZiTKQMLCs9c9NftlL8XNFOPxdvdTdy/rHUJ9+BcRFOIR56vqATbi75LjYzlUAuhXjKkC/HIANgONfCvVXKwQ6SIIEzUhCSp3MEAPbSqurkVFxgjFwiori5HCqWlmJko9TPTasH68o1FzZheEZd7YN7qSrIwW4waXVUlJWwLljZcemnJvtYSgAgIoqFopDXrkXZZcVNGGuoIGKi5zedWkXIvSYISRitZ4gnjOjXLHItADAXjU6KiMSUdp8hDuSnle/G91Nqar78dkFEr5SDxFxhqR0pHm3oZ6OrL6iLjaJA6nu7K8Z4f8sws8oI6dVWS6FF6THRqTwwTamFWVLxonoDU59aWaEs001rD7zitQWY011Mrc2b6tDH64qwNP5zDEMYwpBu7S/9DO5PRs/ScgAAAABJRU5ErkJggg=="][U], c=document.getElementById("thumbnail").getContext("2d");c.globalCompositeOperation="copy";var d=new Image;d.onload=function(){c.drawImage(d,0,0,200,200)};d.src=a;document.getElementById("galleryThumb").value=a;Q.Nu()}else alert(P("Music_submitDisabled"))}function wf(a,c){this.Me=a;this.stateStack=c;this.transcript=[];this.Oy="piano";this.Np=0;this.Ou=this.Gk=null;this.zu=10>O;this.done=!1};