// 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.V=function(a,c){this.x=a;this.y=c};g.g.V.Le=function(a,c){return a==c?!0:a&&c?a.x==c.x&&a.y==c.y:!1};g.g.V.Qx=function(a,c){var d=a.x-c.x;a=a.y-c.y;return Math.sqrt(d*d+a*a)};g.g.V.aG=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};g.g.V.Ek=function(a,c){return new g.g.V(a.x-c.x,a.y-c.y)};g.g.V.sum=function(a,c){return new g.g.V(a.x+c.x,a.y+c.y)};g.g.V.prototype.scale=function(a){this.x*=a;this.y*=a;return this};g.g.V.prototype.translate=function(a,c){this.x+=a;this.y+=c;return this};g.g.jb={};g.g.jb.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};g.g.jb.gv=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.jb.Av=function(a,c,d){for(var e=[0],f=[],h=0;he&&(e=l,f=k)}return f?g.g.jb.JA(a,f,d):c};g.g.jb.NH=function(a,c){for(var d=[],e=0;e=l?(f=2,h=l,(l=a.join(""))&&d.push(l),a.length=0):"{"==l?f=3:(a.push("%",l),f=0):2==f?"0"<=l&&"9">=l?h+=l:(d.push(parseInt(h,10)),k--,f=0):3==f&&(""==l?(a.splice(0,0,"%{"),k--,f=0):"}"!=l?a.push(l):(f=a.join(""),/[A-Z]\w*/i.test(f)?(l=f.toUpperCase(),(l=g.g.jb.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.uv(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.Tg.pA.charAt(Math.random()*a);return c.join("")}; g.g.Tg.pA="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; g.g.gj=function(){if(void 0!==g.g.gj.zs)return g.g.gj.zs;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.gj.zs="none"!==c;return g.g.gj.zs};g.g.gA=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.lF=function(){var a=g.g.style.Ft();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}}; g.g.cp=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};g.g.gF=function(){var a=document.documentElement,c=window;return g.g.userAgent.yg&&c.pageYOffset!=a.scrollTop?new g.g.V(a.scrollLeft,a.scrollTop):new g.g.V(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};g.g.rt=function(a,c){var d=Object.create(null),e=p(a,!0);c&&(a=q(a))&&(a=e.indexOf(a),e.splice(a,e.length-a));for(a=0;c=e[a];a++)d[c.type]?d[c.type]++:d[c.type]=1;return d}; g.g.eH=function(a,c){var d=c.x;c=c.y;var e=aa(a).getBoundingClientRect();d=new g.g.V(d-e.left,c-e.top);c=g.g.Km(a.kb);return g.g.V.Ek(d,c).scale(1/a.scale)}; g.Touch={};g.Touch.Jw="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.Tn=null;g.Touch.Nf={}; g.g.global.PointerEvent?g.Touch.Nf={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:g.Touch.Jw&&(g.Touch.Nf={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});g.eq=0; g.ZF=function(a,c){g.Zh();a.changedTouches&&1!=a.changedTouches.length||(g.eq=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);c&&ba(c,a)},g.lC))};g.Zh=function(){g.eq&&(clearTimeout(g.eq),g.eq=0)};g.Touch.Dh=function(){g.Touch.Tn=null};g.Touch.hv=function(a){return!g.Touch.QF(a)||g.Touch.WD(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.WD=function(a){var c=g.Touch.Lp(a);return void 0!==g.Touch.Tn&&null!==g.Touch.Tn?g.Touch.Tn==c:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(g.Touch.Tn=c,!0):!1}; g.Touch.gH=function(a){if(g.g.jb.startsWith(a.type,"touch")){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY}};g.Touch.QF=function(a){return g.g.jb.startsWith(a.type,"touch")||g.g.jb.startsWith(a.type,"mouse")||g.g.jb.startsWith(a.type,"pointer")};g.Touch.cq=function(a){return g.g.jb.startsWith(a.type,"touch")||g.g.jb.startsWith(a.type,"pointer")}; g.Touch.nH=function(a){var c=[];if(a.changedTouches)for(var d=0;d=d+this.Nh&&(e+=f);da(this,na(this,e));la(this);a.stopPropagation();a.preventDefault()}}; b.CG=function(a){pa(this.s);ea();g.g.lj(a)?a.stopPropagation():(this.oH=this.Qm,ra(this.s),this.rA=this.cj?a.clientX:a.clientY,g.La.Ue=g.ca(document,"mouseup",this,this.KG),g.La.hg=g.ca(document,"mousemove",this,this.HG),a.stopPropagation(),a.preventDefault())};b.HG=function(a){da(this,na(this,this.oH+((this.cj?a.clientX:a.clientY)-this.rA)));la(this)};b.KG=function(){sa(this.s);g.Touch.Dh();ea()};function ea(){g.wc(!0);g.La.Ue&&(g.Ua(g.La.Ue),g.La.Ue=null);g.La.hg&&(g.Ua(g.La.hg),g.La.hg=null)} function na(a,c){return c=0>=c||isNaN(c)||a.Wee.lw&&0<=e.lw;)e.Nj.shift();for(var h=0;d=e.Cd[h];h++)d(f)}}}; g.i.filter=function(a,c){a=a.slice();c||a.reverse();for(var d=[],e=Object.create(null),f=0,h;h=a[f];f++)if(!h.Uk()){var k=[h.type,h.Gc,h.Cc].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.Sl&&l.index==f-1)m.sj=h.sj,m.rj=h.rj,m.$h=h.$h,l.index=f;else if(h.type==g.i.si&&h.element==m.element&&h.name==m.name)m.newValue=h.newValue;else if(h.type!=g.i.$o||"click"!=h.element||"commentOpen"!=m.element&&"mutatorOpen"!=m.element&&"warningOpen"!=m.element)e[k]={event:h, index:1},d.push(h)}a=d.filter(function(n){return!n.Uk()});c||a.reverse();for(f=1;h=a[f];f++)h.type==g.i.si&&"mutation"==h.element&&a.unshift(a.splice(f,1)[0]);return a};g.i.ZD=function(){for(var a=0,c;c=g.i.Hl[a];a++)c.Pc=!1};g.i.disable=function(){g.i.Ss++};g.i.enable=function(){g.i.Ss--};g.i.isEnabled=function(){return 0==g.i.Ss};g.i.cc=function(){return g.i.My};g.i.aa=function(a){g.i.My="boolean"==typeof a?a?g.g.Tg():"":a}; g.i.ty=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.pa=function(a){switch(a.type){case g.i.wo:var c=new g.i.Ye(null);break;case g.i.El:c=new g.i.Ff(null);break;case g.i.si:c=new g.i.rh(null,"","","","");break;case g.i.Sl:c=new g.i.zi(null);break;case g.i.Lw:c=new g.i.He(null);break;case g.i.Mw:c=new g.i.df(null);break;case g.i.Nw:c=new g.i.Of(null,"");break;case g.i.$o:c=new g.i.yd(null,"","","");break;case g.i.to:c=new g.i.ug(null);break;case g.i.Ov:c=new g.i.Xj(null,"","");break;case g.i.uo:c=new g.i.ti(null);break;case g.i.Pv:c=new g.i.vg(null); break;default:throw Error("Unknown event type.");}c.pa(a);c.Cc=(void 0).id;return c};g.i.zE=function(a){if((a.type==g.i.Sl||a.type==g.i.wo)&&a.Cc){var c=g.Nb.tt(a.Cc);if(a=x(c,a.Gc)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.qd(!0);else if((a.L||a.$)&&!c.lc()){do a.qd(!1),a=q(a);while(a)}}}}; g.jD=function(){var a=g.Gi.Wj.PD;this.KD=g.Gi.Wj.rE;this.QD=a;this.bE=Object.create(null)};function ta(a,c){return(c=a.bE[c])&&"string"==typeof propertyValue&&ta(a,c)?ta(a,c):c?String(c):null};g.$l=function(a){this.Jq=a;this.Gq=[];this.Eh=Object.create(null)};g.$l.prototype.Kp=function(){return this.Jq};g.$l.prototype.subscribe=function(a,c,d){this.Eh[c]||(this.Eh[c]=[]);this.Eh[c].push({element:a,propertyName:d});a.style[d]=this.Jq&&ta(this.Jq,c)||""};g.$l.prototype.unsubscribe=function(a){if(a)for(var c=Object.keys(this.Eh),d=0,e;e=c[d];d++){for(var f=this.Eh[e],h=f.length-1;0<=h;h--)f[h].element===a&&f.splice(h,1);this.Eh[e].length||delete this.Eh[e]}}; g.$l.prototype.I=function(){this.Eh=this.Gq=this.Jq=this.od=null};g.Gi={};g.Gi.Wj={};g.Gi.Wj.rE={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.Gi.Wj.PD={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.Gi.Wj=new g.jD;g.i.Abstract=function(){this.Cc=void 0;this.group=g.i.cc();this.Pc=g.i.Pc};g.i.Abstract.prototype.fb=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};g.i.Abstract.prototype.pa=function(a){this.group=a.group};g.i.Abstract.prototype.Uk=function(){return!1};g.i.Abstract.prototype.run=function(){};function ua(a){if(a.Cc)var c=g.Nb.tt(a.Cc);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};g.i.Gg=function(a){g.i.Gg.w.constructor.call(this);this.ni=a.va();this.Cc=a.v.id};g.g.object.X(g.i.Gg,g.i.Abstract);g.i.Gg.prototype.fb=function(){var a=g.i.Gg.w.fb.call(this);a.varId=this.ni;return a};g.i.Gg.prototype.pa=function(a){g.i.Gg.w.fb.call(this);this.ni=a.varId};g.i.He=function(a){a&&(g.i.He.w.constructor.call(this,a),this.Qj=a.type,this.Pj=a.name)};g.g.object.X(g.i.He,g.i.Gg);g.i.He.prototype.type=g.i.Lw; g.i.He.prototype.fb=function(){var a=g.i.He.w.fb.call(this);a.varType=this.Qj;a.varName=this.Pj;return a};g.i.He.prototype.pa=function(a){g.i.He.w.pa.call(this,a);this.Qj=a.varType;this.Pj=a.varName};g.i.He.prototype.run=function(a){var c=ua(this);a?c.Md(this.Pj,this.Qj,this.ni):c.Zf(this.ni)};g.i.df=function(a){a&&(g.i.df.w.constructor.call(this,a),this.Qj=a.type,this.Pj=a.name)};g.g.object.X(g.i.df,g.i.Gg);g.i.df.prototype.type=g.i.Mw; g.i.df.prototype.fb=function(){var a=g.i.df.w.fb.call(this);a.varType=this.Qj;a.varName=this.Pj;return a};g.i.df.prototype.pa=function(a){g.i.df.w.pa.call(this,a);this.Qj=a.varType;this.Pj=a.varName};g.i.df.prototype.run=function(a){var c=ua(this);a?c.Zf(this.ni):c.Md(this.Pj,this.Qj,this.ni)};g.i.Of=function(a,c){a&&(g.i.Of.w.constructor.call(this,a),this.xu=a.name,this.qu=c)};g.g.object.X(g.i.Of,g.i.Gg);g.i.Of.prototype.type=g.i.Nw; g.i.Of.prototype.fb=function(){var a=g.i.Of.w.fb.call(this);a.oldName=this.xu;a.newName=this.qu;return a};g.i.Of.prototype.pa=function(a){g.i.Of.w.pa.call(this,a);this.xu=a.oldName;this.qu=a.newName};g.i.Of.prototype.run=function(a){var c=ua(this);a?c.gi(this.ni,this.qu):c.gi(this.ni,this.xu)}; g.Yr=function(a){this.Va=Object.create(null);this.v=a};b=g.Yr.prototype;b.clear=function(){this.Va=Object.create(null)};b.yq=function(a,c){var d=this.Zc(c,a.type),e=y(this.v,!1);g.i.aa(!0);try{if(d&&d.va()!=a.va()){var f=a.type;c!=d.name&&va(d,c,e);for(c=0;cc)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.Gq.splice(c,1);this.Zb.unsubscribe(this.Rc);this.options.Rb||(this.Zb.I(),this.Zb=null)}};g.Nb.Bw=3;b=g.Nb.prototype; b.og=function(a,c){a=a.Sa();c=c.Sa();return a.y+g.Nb.prototype.og.offset*a.x-(c.y+g.Nb.prototype.og.offset*c.x)};function wa(a,c){if(!g.g.cp(a.vl,c))throw Error("Block not present in workspace's list of top-most blocks.");}function A(a,c){var d=[].concat(a.vl);c&&1h)return!1;d+=c[e]}return d>ya(a)?!1:!0} function Aa(a){return Infinity!=a.options.ju||!!a.options.ku}b.yv=function(a){var c=a?this.yn:this.Nj,d=a?this.Nj:this.yn,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.Pc=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{g.i.Pc=!0}}};function Ba(a,c){a.Cd.push(c)}function Ca(a,c){g.g.cp(a.Cd,c)}function x(a,c){return a.ss[c]||null}g.Nb.cm=Object.create(null);g.Nb.tt=function(a){return g.Nb.cm[a]||null}; g.Nb.getAll=function(){var a=[],c;for(c in g.Nb.cm)a.push(g.Nb.cm[c]);return a};g.na=function(a,c,d,e,f,h){this.s=a;this.kf=c;this.nA=d;d=g.na.VA;this.s.G&&(d=-d);this.ED=g.g.Rd.rv(d);a.zf.appendChild(this.rm(c,!(!f||!h)));this.bc=e;this.zq&&Da(this);f&&h||(c=this.kf.getBBox(),f=c.width+2*g.na.gd,h=c.height+2*g.na.gd);this.Fn(f,h);Da(this);Ea(this);this.zq=!0;a.options.readOnly||(g.ca(this.gm,"mousedown",this,this.LD),this.ng&&g.ca(this.ng,"mousedown",this,this.$G))};g.na.gd=6;g.na.WA=5;g.na.VA=20;g.na.Fv=4;g.na.TA=8;g.na.Ue=null;g.na.hg=null;g.na.prototype.Uu=null; g.na.xv=function(){g.na.Ue&&(g.Ua(g.na.Ue),g.na.Ue=null);g.na.hg&&(g.Ua(g.na.hg),g.na.hg=null)};g.na.MD=function(){g.Touch.Dh();g.na.xv()};b=g.na.prototype;b.zq=!1;b.bc=null;b.eh=0;b.ei=0;b.yb=0;b.$c=0;b.ps=!0; b.rm=function(a,c){this.ke=g.g.o.K("g",{},null);var d={filter:"url(#"+this.s.options.Xx+")"};g.g.userAgent.bC&&(d={});d=g.g.o.K("g",d,this.ke);this.ws=g.g.o.K("path",{},d);this.gm=g.g.o.K("rect",{"class":"blocklyDraggable",x:0,y:0,rx:g.na.gd,ry:g.na.gd},d);c?(this.ng=g.g.o.K("g",{"class":this.s.G?"blocklyResizeSW":"blocklyResizeSE"},this.ke),c=2*g.na.gd,g.g.o.K("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.ng),g.g.o.K("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/ 3},this.ng),g.g.o.K("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.ng)):this.ng=null;this.ke.appendChild(a);return this.ke};b.za=function(){return this.ke};function Ga(a,c){a.ke.dataset&&(a.ke.dataset.blockId=c)}b.LD=function(a){var c=this.s.Vg(a);if(c){if(c.aj)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.ve||(c.ve=this);c.vf=a}};b.Jn=function(){};b.qe=function(){return!1}; b.$G=function(a){Ha(this);g.na.xv();g.g.lj(a)||(this.s.mv(a,new g.g.V(this.s.G?-this.yb:this.yb,this.$c)),g.na.Ue=g.ca(document,"mouseup",this,g.na.MD),g.na.hg=g.ca(document,"mousemove",this,this.aH),g.wc());a.stopPropagation()};b.aH=function(a){this.ps=!1;var c=this.s;a=g.g.nn(a,r(c),qa(c));a.x/=c.scale;a.y/=c.scale;c=g.g.V.sum(c.Ux,a);this.Fn(this.s.G?-c.x:c.x,c.y);this.s.G&&Da(this)};function Ha(a){var c=a.ke.parentNode;return c.lastChild!==a.ke?(c.appendChild(a.ke),!0):!1} function Ia(a,c,d){var e=a.s.G?a.bc.x-c.x-a.yb:c.x+a.bc.x;c=c.y+a.bc.y;return Math.max(0,Math.min(1,(Math.min(e+a.yb,d.gc+d.vb)-Math.max(e,d.gc))*(Math.min(c+a.$c,d.pc+d.Cb)-Math.max(c,d.pc))/(a.yb*a.$c)))}function Da(a){var c=a.bc.x;c=a.s.G?c-(a.eh+a.yb):c+a.eh;a.moveTo(c,a.ei+a.bc.y)}b.moveTo=function(a,c){this.ke.setAttribute("transform","translate("+a+","+c+")")};b.st=function(){return new g.g.ge(this.yb,this.$c)}; b.Fn=function(a,c){var d=2*g.na.gd;a=Math.max(a,d+45);c=Math.max(c,d+20);this.yb=a;this.$c=c;this.gm.setAttribute("width",a);this.gm.setAttribute("height",c);this.ng&&(this.s.G?this.ng.setAttribute("transform","translate("+2*g.na.gd+","+(c-d)+") scale(-1 1)"):this.ng.setAttribute("transform","translate("+(a-d)+","+(c-d)+")"));if(this.ps){a=this.s.jc();a.gc/=this.s.scale;a.vb/=this.s.scale;a.pc/=this.s.scale;a.Cb/=this.s.scale;c=-this.yb/4;if(!(this.yb>a.vb)){if(this.s.G){d=this.bc.x-c;var e=d-this.yb; var f=a.gc+a.vb,h=a.gc+g.La.xc/this.s.scale}else e=c+this.bc.x,d=e+this.yb,h=a.gc,f=a.gc+a.vb-g.La.xc/this.s.scale;this.s.G?ef&&(c=-(f-this.bc.x)):ef&&(c=f-this.bc.x-this.yb)}e=c;c=-this.$c/4;if(!(this.$c>a.Cb)){d=this.bc.y+c;f=d+this.$c;h=a.pc;var k=a.pc+a.Cb-g.La.xc/this.s.scale,l=this.bc.y;dk&&(c=k-l-this.$c)}h=c;f=this.nA.getBBox();c={x:e,y:-this.$c-g.xa.yr};d={x:-this.yb-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),t=Math.cos(m),v=a.st();m=(v.width+v.height)/g.na.WA;m=Math.min(m,v.width,v.height)/4;v=1-g.na.TA/k;f=d+v*f;h=e+v*h;v=d+m*t;var w=e+m*n;d-=m*t;e-=m*n;n=l+a.ED;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/g.na.Fv;k=Math.cos(n)*k/g.na.Fv;c.push("M"+v+","+ w);c.push("C"+(v+k)+","+(w+l)+" "+f+","+h+" "+f+","+h);c.push("C"+f+","+h+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.ws.setAttribute("d",c.join(" "))}b.se=function(a){this.gm.setAttribute("fill",a);this.ws.setAttribute("fill",a)};b.I=function(){g.na.xv();g.g.o.removeNode(this.ke);this.nA=this.kf=this.s=this.ng=this.gm=this.ws=this.ke=null};b.nu=function(a,c){a?a.Mj(c.x,c.y):this.moveTo(c.x,c.y);this.eh=this.s.G?this.bc.x-c.x-this.yb:c.x-this.bc.x;this.ei=c.y-this.bc.y;Ea(this)}; b.Sa=function(){return new g.g.V(this.bc.x+this.eh,this.bc.y+this.ei)};g.g.xml={};g.g.xml.xC="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.xC,a)};g.g.xml.createTextNode=function(a){return g.g.xml.document().createTextNode(a)};g.g.xml.vH=function(a){return(new DOMParser).parseFromString(a,"text/xml")};g.g.xml.Nd=function(a){return(new XMLSerializer).serializeToString(a)};g.i.Ef=function(a){g.i.Ef.w.constructor.call(this);this.Gc=a.id;this.Cc=a.v.id};g.g.object.X(g.i.Ef,g.i.Abstract);g.i.Ef.prototype.fb=function(){var a=g.i.Ef.w.fb.call(this);a.blockId=this.Gc;return a};g.i.Ef.prototype.pa=function(a){g.i.Ef.w.pa.call(this,a);this.Gc=a.blockId};g.i.rh=function(a,c,d,e,f){a&&(g.i.rh.w.constructor.call(this,a),this.element=c,this.name=d,this.oldValue=e,this.newValue=f)};g.g.object.X(g.i.rh,g.i.Ef);g.i.sg=g.i.rh;b=g.i.rh.prototype;b.type=g.i.si; b.fb=function(){var a=g.i.rh.w.fb.call(this);a.element=this.element;this.name&&(a.name=this.name);a.newValue=this.newValue;return a};b.pa=function(a){g.i.rh.w.pa.call(this,a);this.element=a.element;this.name=a.name;this.newValue=a.newValue};b.Uk=function(){return this.oldValue==this.newValue}; b.run=function(a){var c=x(ua(this),this.Gc);if(c)switch(c.Sd&&c.Sd.Yb(!1),a=a?this.newValue:this.oldValue,this.element){case "field":(c=B(c,this.name))?c.setValue(a):console.warn("Can't set non-existent field: "+this.name);break;case "comment":c.ji(a||null);break;case "collapsed":c.kh(!!a);break;case "disabled":c.qd(!a);break;case "inline":c.te(!!a);break;case "mutation":var d="";c.Pa&&(d=(d=c.Pa())&&g.R.Nd(d));if(c.lb){var e=g.R.mi(a||"");c.lb(e)}g.i.Oa(new g.i.rh(c,"mutation",null,d, a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.Gc)};g.i.Ye=function(a){a&&(g.i.Ye.w.constructor.call(this,a),this.xml=a.v.ga?g.R.ts(a):g.R.Bh(a),this.Ph=g.i.ty(a))};g.g.object.X(g.i.Ye,g.i.Ef);g.i.oo=g.i.Ye;g.i.Ye.prototype.type=g.i.wo;g.i.Ye.prototype.fb=function(){var a=g.i.Ye.w.fb.call(this);a.xml=g.R.Nd(this.xml);a.ids=this.Ph;return a}; g.i.Ye.prototype.pa=function(a){g.i.Ye.w.pa.call(this,a);this.xml=g.R.mi(a.xml);this.Ph=a.ids};g.i.Ye.prototype.run=function(a){var c=ua(this);if(a)a=g.g.xml.createElement("xml"),a.appendChild(this.xml),g.R.Hh(a,c);else{a=0;for(var d;d=this.Ph[a];a++){var e=x(c,d);e?e.I(!1):d==this.Gc&&console.warn("Can't uncreate non-existent block: "+d)}}}; g.i.Ff=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");g.i.Ff.w.constructor.call(this,a);this.zu=a.v.ga?g.R.ts(a):g.R.Bh(a);this.Ph=g.i.ty(a)}};g.g.object.X(g.i.Ff,g.i.Ef);g.i.aB=g.i.Ff;g.i.Ff.prototype.type=g.i.El;g.i.Ff.prototype.fb=function(){var a=g.i.Ff.w.fb.call(this);a.ids=this.Ph;return a};g.i.Ff.prototype.pa=function(a){g.i.Ff.w.pa.call(this,a);this.Ph=a.ids}; g.i.Ff.prototype.run=function(a){var c=ua(this);if(a){a=0;for(var d;d=this.Ph[a];a++){var e=x(c,d);e?e.I(!1):d==this.Gc&&console.warn("Can't delete non-existent block: "+d)}}else a=g.g.xml.createElement("xml"),a.appendChild(this.zu),g.R.Hh(a,c)};g.i.zi=function(a){a&&(g.i.zi.w.constructor.call(this,a),a=Ja(this),this.Fz=a.Pz,this.Ez=a.az,this.vu=a.xx)};g.g.object.X(g.i.zi,g.i.Ef);g.i.Cl=g.i.zi;b=g.i.zi.prototype;b.type=g.i.Sl; b.fb=function(){var a=g.i.zi.w.fb.call(this);this.sj&&(a.newParentId=this.sj);this.rj&&(a.newInputName=this.rj);this.$h&&(a.newCoordinate=Math.round(this.$h.x)+","+Math.round(this.$h.y));return a};b.pa=function(a){g.i.zi.w.pa.call(this,a);this.sj=a.newParentId;this.rj=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.$h=new g.g.V(Number(a[0]),Number(a[1])))};b.zj=function(){var a=Ja(this);this.sj=a.Pz;this.rj=a.az;this.$h=a.xx}; function Ja(a){var c=x(ua(a),a.Gc);a={};var d=c.getParent();if(d){a.Pz=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.az=c.name)}else a.xx=c.Sa();return a}b.Uk=function(){return this.Fz==this.sj&&this.Ez==this.rj&&g.g.V.Le(this.vu,this.$h)}; b.run=function(a){var c=ua(this),d=x(c,this.Gc);if(d){var e=a?this.sj:this.Fz,f=a?this.rj:this.Ez;a=a?this.$h:this.vu;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.Sa(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.L||d.$;if(f){if(c=E(h,f))var k=c.connection}else d.type==g.cf&&(k=h.U);k?d.connect(k):console.warn("Can't connect to non-existent input: "+f)}}else console.warn("Can't move non-existent block: "+this.Gc)};g.i.yd=function(a,c,d,e){g.i.yd.w.constructor.call(this);this.Gc=a?a.id:null;this.Cc=a?a.v.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.Pc=!1};g.g.object.X(g.i.yd,g.i.Abstract);g.i.yd.prototype.type=g.i.$o;g.i.yd.prototype.fb=function(){var a=g.i.yd.w.fb.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.Gc&&(a.blockId=this.Gc);return a}; g.i.yd.prototype.pa=function(a){g.i.yd.w.pa.call(this,a);this.element=a.element;this.newValue=a.newValue;this.Gc=a.blockId};g.Hd=function(a){this.T=a};b=g.Hd.prototype;b.lx=!0;b.Wo=17;b.Ub=null;b.dj=null;function Ka(a){a.Pd||(a.Pd=g.g.o.K("g",{"class":"blocklyIconGroup"},null),a.T.ec&&g.g.o.rb(a.Pd,"blocklyIconGroupReadonly"),a.Zs(a.Pd),a.T.za().appendChild(a.Pd),g.ca(a.Pd,"mouseup",a,a.Lt),a.ph())}b.I=function(){g.g.o.removeNode(this.Pd);this.Pd=null;this.Yb(!1);this.T=null};b.ph=function(){};b.isVisible=function(){return!!this.Ub};b.Lt=function(a){this.T.v.lc()||this.T.ec||g.g.lj(a)||this.Yb(!this.isVisible())}; b.Xe=function(){this.isVisible()&&this.Ub.se(this.T.Ni)};function La(a){var c=a.T.Sa(),d=g.g.Oe(a.Pd);c=new g.g.V(c.x+d.x+a.Wo/2,c.y+d.y+a.Wo/2);g.g.V.Le(a.dj,c)||(a.dj=c,a.isVisible()&&(a=a.Ub,a.bc=c,a.zq&&Da(a)))};g.Pf=function(a){g.Pf.w.constructor.call(this,a);Ka(this);this.Ed={}};g.g.object.X(g.Pf,g.Hd);g.Pf.prototype.lx=!1;g.Pf.prototype.Zs=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.Pf.wH=function(a){var c=g.g.o.K("text",{"class":"blocklyText blocklyBubbleText",y:g.na.gd},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.Tc.$u=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")}; g.Tc.er=[".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.D=function(){};g.D.ye=null;g.D.vs=null;g.D.od=null;g.D.tq=null;g.D.ho=16;g.D.Mv=1;g.D.Hv=12;g.D.rw=16;g.D.Zq=.25;g.D.Rv="#dadce0";g.D.Sv="#fff";g.D.js=null;g.D.uj=null; g.D.Ja=function(){if(!g.D.ye){var a=document.createElement("div");a.className="blocklyDropDownDiv";a.style.backgroundColor=g.D.Sv;a.style.borderColor=g.D.Rv;document.body.appendChild(a);g.D.ye=a;var c=document.createElement("div");c.className="blocklyDropDownContent";a.appendChild(c);g.D.kf=c;c=document.createElement("div");c.className="blocklyDropDownArrow";a.appendChild(c);g.D.ff=c;g.D.ye.style.opacity=0;g.D.ye.style.transition="transform "+g.D.Zq+"s, opacity "+g.D.Zq+"s";a.addEventListener("focusin", function(){g.g.o.rb(a,"focused")});a.addEventListener("focusout",function(){g.g.o.Sb(a,"focused")})}};g.D.iA=function(a){g.D.vs=a};g.D.sy=function(){return g.D.kf};g.D.YD=function(){g.D.kf.innerHTML="";g.D.kf.style.width=""};g.D.se=function(a){g.D.ye.style.backgroundColor=a;g.D.ye.style.borderColor=void 0};g.D.sM=function(a){g.D.ye.setAttribute("data-category",a)}; g.D.uM=function(a,c,d,e){var f=c.v.scale,h=c.width,k=c.height;h*=f;k*=f;f=c.za().getBoundingClientRect();h=f.left+h/2;k=f.top+k;f=f.top;e&&(f+=e);g.D.iA(r(c.v).parentNode);return g.D.show(a,c.G,h,k,h,f,d)};g.D.oA=function(a,c){var d=a.za().getBoundingClientRect(),e=d.left+d.width/2,f=d.bottom;d=d.top;var h=a.B;g.D.tq=!0;g.D.iA(r(h.v).parentNode);g.D.show(a,h.G,e,f,e,d,c)}; g.D.show=function(a,c,d,e,f,h,k){g.D.od=a;g.D.uj=k||null;a=g.D.By(d,e,f,h);a.ns?(g.D.ff.style.display="",g.D.ff.style.transform="translate("+a.fm+"px,"+a.Ww+"px) rotate(45deg)",g.D.ff.setAttribute("class",a.ls?"blocklyDropDownArrow arrowTop":"blocklyDropDownArrow arrowBottom")):g.D.ff.style.display="none";g.D.ye.style.direction=c?"rtl":"ltr";g.D.un(a.Rp,a.Sp,a.zp,a.Ap);return a.ls}; g.D.ZE=function(){var a=g.D.vs.getBoundingClientRect(),c=g.g.style.Wg(g.D.vs);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.By=function(a,c,d,e){var f=g.D.ZE(),h=g.g.style.Wg(g.D.ye);return c+h.heightf.top?g.D.zy(d,e,f,h):c+h.heightdocument.documentElement.clientTop?g.D.zy(d,e,f,h):g.D.jF(a,f,h)}; g.D.Ay=function(a,c,d,e){a=g.D.yt(a,d.left,d.right,e.width);return{Rp:a.Fk,Sp:c,zp:a.Fk,Ap:c+g.D.rw,fm:a.fm,Ww:-(g.D.ho/2+g.D.Mv),ls:!0,ns:!0}};g.D.zy=function(a,c,d,e){a=g.D.yt(a,d.left,d.right,e.width);return{Rp:a.Fk,Sp:c-e.height,zp:a.Fk,Ap:c-e.height-g.D.rw,fm:a.fm,Ww:e.height-2*g.D.Mv-g.D.ho/2,ls:!1,ns:!0}};g.D.jF=function(a,c,d){a=g.D.yt(a,c.left,c.right,d.width);return{Rp:a.Fk,Sp:0,zp:a.Fk,Ap:0,ns:!1}}; g.D.yt=function(a,c,d,e){var f=a;a=g.g.Rd.zk(c,a-e/2,d-e);f-=g.D.ho/2;c=g.g.Rd.zk(g.D.Hv,f-a,e-g.D.Hv-g.D.ho);return{fm:c,Fk:a}};g.D.isVisible=function(){return!!g.D.od};g.D.Ok=function(a,c){g.D.od===a&&(c?g.D.bj():g.D.Ha())};g.D.Ha=function(){var a=g.D.ye;a.style.transform="translate(0, 0)";a.style.opacity=0;g.D.js=setTimeout(function(){g.D.bj()},1E3*g.D.Zq);g.D.uj&&(g.D.uj(),g.D.uj=null)}; g.D.bj=function(){if(g.D.isVisible()){g.D.js&&clearTimeout(g.D.js);var a=g.D.ye;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=g.D.Sv;a.style.borderColor=g.D.Rv;g.D.uj&&(g.D.uj(),g.D.uj=null);g.D.YD();g.D.od=null}}; g.D.un=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.ye;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.nM=function(){if(g.D.od){var a=g.D.od.B,c=a.v.scale,d=g.D.tq?g.D.od.Bb.width:a.width,e=g.D.tq?g.D.od.Bb.height:a.height;d*=c;e*=c;a=g.D.tq?g.D.od.me.getBoundingClientRect():a.za().getBoundingClientRect();d=a.left+d/2;e=g.D.By(d,a.top+e,d,a.top);g.D.un(e.Rp,e.Sp,e.zp,e.Ap)}else g.D.Ha()};g.sb={};g.sb.Us=0;g.sb.tp=null;g.sb.DE=function(a){var c=a.v,d=a.za();c.Rf.play("delete");a=Qa(c,d);d=d.cloneNode(!0);d.CH=a.x;d.DH=a.y;d.setAttribute("transform","translate("+a.x+","+a.y+")");r(c).appendChild(d);d.Xw=d.getBBox();g.sb.Px(d,c.G,new Date,c.scale)};g.sb.Px=function(a,c,d,e){var f=(new Date-d)/150;1d)){var e=Qa(c,a.za());a.L?(e.x+=(a.G?3:-3)*d,e.y+=13*d):a.$&&(e.x+=(a.G?-23:23)*d,e.y+=3*d);a=g.g.o.K("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},r(c));g.sb.tx(a,new Date,d)}};g.sb.tx=function(a,c,d){var e=(new Date-c)/150;1a.v.scale)){var c=Ra(a).height;c=Math.atan(10/c)/Math.PI*180;a.G||(c*=-1);g.sb.Nx(a.za(),c,new Date)}};g.sb.Nx=function(a,c,d){var e=(new Date-d)/200;1a-g.nB)}if(a.Mc||a.Jb)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Mc||!a.Jb);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0} function Ua(a){a.Jb&&(g.g.o.removeNode(g.ta.Yy),delete g.ta.Yy);if(a.Kt){var c=a.Jb;c.type!=g.Ra||c.isConnected()?Va(a.Pk,!1):a.Pk.DF(c,!1);a.Pk=null;a.Kt=!1}else if(a.oj)if(a.oj){c=a.oj;var d=c.B,e=d.U,f=d.$,h=d.L;h=c.type==g.Ra&&!(h&&h.ka);!(c!=e||f&&f.ka)||h?D(C(c),!1):c.type==g.Xa&&c!=e?(e=c.ka,D(e.B,!1),f=f?f.ka:null,D(d,!0),f&&f.connect(e)):D(d,!0);if(c.ka)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.oj=null;d.za().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")} g.Jo.prototype.Kk=function(){var a=[];this.Hk&&a.push(this.Hk);this.mj&&a.push(this.mj);return a};g.ri=function(a,c){this.Kb=a;this.s=c;this.$f=new g.Jo(this.Kb);this.Vi=null;this.rg=!1;this.pg=this.Kb.Sa();this.wp=g.ri.JF(a)};g.ri.prototype.I=function(){this.zc=this.s=this.Kb=null;this.wp.length=0;this.$f&&(this.$f.I(),this.$f=null)};g.ri.JF=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=Wa(e);for(var f=0;fg.J.LC&&g.J.Ha()}else g.J.rq!=g.J.mb&&(clearTimeout(g.J.Kn),g.J.Xt=a.pageX,g.J.Yt=a.pageY,g.J.Kn=setTimeout(g.J.kH,g.J.RB))};g.J.Ha=function(){g.J.visible&&(g.J.visible=!1,g.J.Ca&&(g.J.Ca.style.display="none"));g.J.Kn&&clearTimeout(g.J.Kn)};g.J.block=function(){g.J.Ha();g.J.xk=!0};g.J.EH=function(){g.J.xk=!1}; g.J.kH=function(){if(!g.J.xk&&(g.J.rq=g.J.mb,g.J.Ca)){g.J.Ca.innerHTML="";for(var a=g.J.mb.Af;"function"==typeof a;)a=a();a=g.g.jb.IA(a,g.J.fC);a=a.split("\n");for(var c=0;cd+window.scrollY&&(f-=g.J.Ca.offsetHeight+2*g.J.ow);a?e=Math.max(g.J.rr-window.scrollX,e):e+g.J.Ca.offsetWidth>c+window.scrollX-2*g.J.rr&&(e=c-g.J.Ca.offsetWidth-2*g.J.rr);g.J.Ca.style.top=f+"px";g.J.Ca.style.left=e+"px"}};g.$j=function(a,c){this.zc=this.Ac=this.Ej=this.Fj=this.ve=this.zd=this.yz=null;this.Is=c;this.Vm=this.ij=this.Wm=this.Zi=!1;this.vf=a;this.O=this.pi=this.gf=this.Ig=this.oq=this.nq=null;this.Xp=this.aj=this.bx=!1;this.Ty=!g.yB};b=g.$j.prototype;b.I=function(){g.Touch.Dh();g.J.EH();this.Is.Ic=null;this.nq&&g.Ua(this.nq);this.oq&&g.Ua(this.oq);this.O=this.zc=this.Ac=this.Ej=this.Fj=null;this.gf&&(this.gf.I(),this.gf=null);this.pi&&(this.pi.I(),this.pi=null);this.Ig&&(this.Ig.I(),this.Ig=null)}; function jb(a,c){a.zd=g.g.V.Ek(new g.g.V(c.clientX,c.clientY),a.yz);if(a.Zi)var d=!1;else a.Zi=g.g.V.aG(a.zd)>(a.O?g.GB:g.xB),d=a.Zi;if(d){if(a.bx)throw Error("updateIsDragging_ should only be called once per gesture.");a.bx=!0;if(a.ve){a.Vm=!0;a.Ig=new g.Dl(a.ve,a.zc);d=a.Ig;g.i.cc()||g.i.aa(!0);d.s.Qc(!1);d.uc.ps=!1;d.Xi&&d.pu();d.uc.Bj&&d.uc.Bj(!0);var e=d.s.sa;e&&g.g.o.rb(e.Ec,d.uc.qe()?"blocklyToolboxDelete":"blocklyToolboxGrab");fb(a.Ig,a.vf,a.zd);d=!0}else d=!1;if(!d){if(a.Ac)if(a.O?(a.O.ez(a.Ac)? ((d=!kb(a.O))||(d=a.zd,d=Math.atan2(d.y,d.x)/Math.PI*180,e=a.O.IE,d=d-e||d<-180+e||d>180-e?!0:!1),d?(a.zc=a.O.ub,lb(a.zc),g.i.cc()||g.i.aa(!0),a.Ej=null,a.Ac=mb(a.O,a.Ac),a.Ac.select(),d=!0):d=!1):d=!1,a.ij=d):a.Ac.Lc()&&(a.ij=!0),a.ij){a.gf=new g.ri(a.Ac,a.zc);d=a.gf;e=a.zd;var f=a.Ty;g.i.cc()||g.i.aa(!0);d.s.kj&&cb(d.Kb);g.g.o.Mn();d.s.Qc(!1);g.sb.Vs();if(d.Kb.getParent()||f&&d.Kb.U&&C(d.Kb.U))D(d.Kb,f),e=d.bl(e),e=g.g.V.sum(d.pg,e),d.Kb.translate(e.x,e.y),g.sb.CE(d.Kb);d.Kb.Bj(!0);d.Kb.pu(); (e=d.s.sa)&&g.g.o.rb(e.Ec,d.Kb.qe()?"blocklyToolboxDelete":"blocklyToolboxGrab");Xa(a.gf,a.vf,a.zd);d=!0}else d=!1;else d=!1;if(d=!d)if(a.O)d=kb(a.O);else if(d=a.zc)d=a.zc,d=d.options.Nc&&d.options.Nc.Ih;d&&(a.pi=a.O?new g.Fo(a.O):new g.dm(a.zc),a.Wm=!0,a.pi.mv())}g.Zh()}a.vf=c} b.Ws=function(a){g.g.$p(a)?this.cancel():(this.aj=!0,g.sb.Vs(),lb(this.zc),this.zc.kj&&this.zc.resize(),pa(this.zc),this.vf=a,g.wc(!!this.O),g.J.block(),this.Ac&&(!this.Ac.ec&&a.shiftKey?(g.navigation.ht(),u(this.Is.cb,g.navigation.Bt(this.Ac))):this.Ac.select()),g.g.lj(a)?ba(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||g.ZF(a,this),this.yz=new g.g.V(a.clientX,a.clientY),this.Ty=a.altKey||a.ctrlKey||a.metaKey,this.wk(a)))}; b.wk=function(a){this.nq=g.ca(document,"mousemove",null,this.Pm.bind(this));this.oq=g.ca(document,"mouseup",null,this.Mp.bind(this));a.preventDefault();a.stopPropagation()};b.Pm=function(a){jb(this,a);this.Wm?this.pi.Ih(this.zd):this.ij?Xa(this.gf,this.vf,this.zd):this.Vm&&fb(this.Ig,this.vf,this.zd);a.preventDefault();a.stopPropagation()}; b.Mp=function(a){jb(this,a);g.Zh();if(this.Xp)console.log("Trying to end a gesture recursively.");else{this.Xp=!0;if(this.Vm)gb(this.Ig,a,this.zd);else if(this.ij)ab(this.gf,a,this.zd);else if(this.Wm){var c=this.pi;c.Ih(this.zd);sa(c.s)}else if(this.ve&&!this.Zi)this.ve.hH&&this.ve.hH(),this.ve.select&&this.ve.select();else if(nb(this))this.Fj.yf(),ob(this);else if(this.Ej&&!this.Zi&&!nb(this))this.O&&this.O.vk?this.Ac.isEnabled()&&(g.i.cc()||g.i.aa(!0),eb(mb(this.O,this.Ac))):g.i.Oa(new g.i.yd(this.Ej, "click",void 0,void 0)),ob(this),g.i.aa(!1);else if(!(this.Ej||this.ve||this.Fj||this.Zi))if(c=this.Is,a.shiftKey){g.navigation.ht();var d=g.g.eH(c,new g.g.V(a.clientX,a.clientY));d=g.F.um(c,d);u(c.cb,d)}else g.selected&&ib(g.selected);a.preventDefault();a.stopPropagation();this.I()}};b.cancel=function(){if(!this.Xp){g.Zh();if(this.Vm)gb(this.Ig,this.vf,this.zd);else if(this.ij)ab(this.gf,this.vf,this.zd);else if(this.Wm){var a=this.pi;a.Ih(this.zd);sa(a.s)}this.I()}}; function ba(a,c){a.Ac?(ob(a),g.wc(a.O),a.Ac.Jn(c)):a.ve?a.ve.Jn(c):a.zc&&!a.O&&(g.wc(),a.zc.Jn(c));c.preventDefault();c.stopPropagation();a.I()}function pb(a,c,d){if(a.aj)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");a.zc||(a.zc=d);a.vf=c;a.Ws(c);g.Se&&g.navigation.eb(g.navigation.Xl)}function qb(a,c,d){if(a.aj)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");a.O||(a.O=d);pb(a,c,d.Lk())} function ob(a){a.Ac&&!a.O&&cb(a.Ac)}function rb(a,c){a.Ej||a.ve||(a.Ej=c,c.ec&&c!=db(c)?sb(a,db(c)):sb(a,c))}function sb(a,c){c.ib?sb(a,c.getParent()):a.Ac=c}function nb(a){if(a.Fj){var c=a.Fj;c=!!c.B&&c.B.nd()&&!!c.yf&&"function"===typeof c.yf}else c=!1;return c&&!a.Zi&&(!a.O||!a.O.vk)}b.lc=function(){return this.Wm||this.ij||this.Vm};b.Kk=function(){return this.gf?this.gf.Kk():[]};g.$j.Mt=function(){for(var a=g.Nb.getAll(),c=0,d;d=a[c];c++)if(d.Ic)return!0;return!1};g.oa=function(a,c,d){this.zA=this.Oj=this.$a=null;this.Bb=new g.g.ge(0,0);this.Yc=null;d&&this.ld(d);this.setValue(a);c&&(this.Oj=c)};g.oa.lo=16;g.oa.Hw=12.5;g.oa.rk=10;g.oa.bs=10;g.oa.wg=g.oa.rk/2;b=g.oa.prototype;b.name=void 0;b.hq=50;b.B=null;b.sf=!0;b.oi=!0;b.kp=null;g.oa.Oo="\u00a0";b=g.oa.prototype;b.Gf=!0;b.Ei=!1;b.ld=function(a){var c=a.tooltip;"string"==typeof c&&(c=g.g.nc(a.tooltip));c&&this.Ta(c)};b.fv=function(a){if(this.B)throw Error("Field already bound to a block.");this.B=a}; b.Z=function(){this.me||(this.me=g.g.o.K("g",{},null),this.isVisible()||(this.me.style.display="none"),this.B.za().appendChild(this.me),this.Zg(),this.ph(),this.Ta(this.zA),g.J.wk(this.kp||this.za()),this.xz=g.ca(this.kp||this.za(),"mousedown",this,this.ai),this.ej())};b.Zg=function(){tb(this);ub(this)};b.ej=function(){}; function tb(a){a.Bb.height=Math.max(a.Bb.height,g.oa.lo);a.Bb.width=Math.max(a.Bb.width,g.oa.rk);a.Kd=g.g.o.K("rect",{rx:4,ry:4,x:0,y:0,height:a.Bb.height,width:a.Bb.width},a.me)}function ub(a){a.Bc=g.g.o.K("text",{"class":"blocklyText",y:g.oa.Hw,x:a.Kd?g.oa.wg:0},a.me);a.Kj=document.createTextNode("");a.Bc.appendChild(a.Kj)}b.Gm=function(a){this.setValue(a.textContent)};b.xA=function(a){a.textContent=this.getValue();return a};b.I=function(){g.D.Ok(this);g.ba.Ok(this);this.xz&&g.Ua(this.xz);g.g.o.removeNode(this.me)}; b.ph=function(){var a=this.kp||this.za();this.Gf&&a&&(this.B.nd()?(g.g.o.rb(a,"blocklyEditableText"),g.g.o.Sb(a,"blocklyNonEditableText"),a.style.cursor=this.xo):(g.g.o.rb(a,"blocklyNonEditableText"),g.g.o.Sb(a,"blocklyEditableText"),a.style.cursor=""))};b.isVisible=function(){return this.oi};b.Yb=function(a){if(this.oi!=a){this.oi=a;var c=this.za();c&&(c.style.display=a?"block":"none")}};function vb(a,c){a.Oj=c}b.Iy=function(){return this.Oj};b.za=function(){return this.me};b.Xe=function(){}; b.fh=function(){this.Kj&&(this.Kj.nodeValue=this.Ep(),this.zv())};b.zv=function(){var a=g.g.o.Nm(this.Bc);this.Kd&&(a+=g.oa.rk,this.Kd.setAttribute("width",a));this.Bb.width=a};b.Wg=function(){if(!this.isVisible())return new g.g.ge(0,0);this.sf?(this.fh(),this.sf=!1):this.oi&&0==this.Bb.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.fh());return this.Bb}; function wb(a){var c=a.Kd.getBBox(),d=c.height*a.B.v.scale;c=c.width*a.B.v.scale;a=g.g.style.Mm(a.Kd);return{top:a.y,bottom:a.y+d,left:a.x,right:a.x+c}}b.Ep=function(){var a=this.dc();if(!a)return g.oa.Oo;a.length>this.hq&&(a=a.substring(0,this.hq-2)+"\u2026");a=a.replace(/\s/g,g.oa.Oo);this.B&&this.B.G&&(a+="\u200f");return a};b.dc=function(){if(this.Jp){var a=this.Jp.call(this);if(null!==a)return String(a)}return String(this.getValue())}; b.ll=function(){throw Error("setText method is deprecated");};b.hn=function(){this.sf=!0};function xb(a){a.sf=!0;a.B&&a.B.ga&&(a.B.Ea(),a.B.Pb())}b.setValue=function(a){if(null!==a){var c=this.Qg(a);a=yb(this,a,c);if(!(a instanceof Error)){if(c=this.Iy())if(c=c.call(this,a),a=yb(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.B&&g.i.isEnabled()&&g.i.Oa(new g.i.sg(this.B,"field",this.name||null,c,a)),this.Rg(a),this.sf&&xb(this))}}}; function yb(a,c,d){if(null===d)return a.Tx(),a.sf&&xb(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.$a};b.Qg=function(a){return null===a||void 0===a?null:a};b.Rg=function(a){this.$a=a;this.sf=!0};b.Tx=function(){};b.ai=function(a){if(this.B&&this.B.v&&(a=this.B.v.Vg(a))){if(a.aj)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.Fj||(a.Fj=this)}};b.Ta=function(a){var c=this.kp||this.za();c?c.Af=a||""===a?a:this.B:this.zA=a}; b.zn=function(){return!1};b.ag=function(){for(var a=null,c=this.B,d=c.P,e=0;ea&&0<=c&&256>c&&0<=d&&256>d)?g.g.Ab.Xu(a,c,d):null}; g.g.Ab.Xu=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};g.g.Ab.Uy=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; g.g.Ab.EF=function(a){var c=g.SB,d=255*g.TB,e=0,f=0,h=0;if(0==c)h=f=e=d;else{var k=Math.floor(a/60),l=a/60-k;a=d*(1-c);var m=d*(1-c*l);c=d*(1-c*(1-l));switch(k){case 1:e=m;f=d;h=a;break;case 2:e=a;f=d;h=c;break;case 3:e=a;f=m;h=d;break;case 4:e=c;f=a;h=d;break;case 5:e=d;f=a;h=m;break;case 6:case 0:e=d,f=c,h=a}}return g.g.Ab.Xu(Math.floor(e),Math.floor(f),Math.floor(h))}; g.g.Ab.rs=function(a,c,d){a=g.g.Ab.Uy(g.g.Ab.parse(a));c=g.g.Ab.Uy(g.g.Ab.parse(c));return g.g.Ab.Xu(Math.round(c[0]+d*(a[0]-c[0])),Math.round(c[1]+d*(a[1]-c[1])),Math.round(c[2]+d*(a[2]-c[2])))};g.g.Ab.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"};g.g.Ol={};g.g.Ol.pG=0;g.g.Ol.yy=function(){return"blockly:"+(g.g.Ol.pG++).toString(36)};g.Ib=function(a,c,d){g.Ib.w.constructor.call(this,a||g.Ib.qo[0],c,d);this.Bb=new g.g.ge(g.Ib.vB,g.oa.lo)};g.g.object.X(g.Ib,g.oa);g.Ib.pa=function(a){return new g.Ib(a.colour,void 0,a)};g.Ib.vB=26;g.Ib.sI=g.oa.lo;b=g.Ib.prototype;b.Ei=!0;b.xo="default";b.sf=!1;b.Ds=null;b.wA=null;b.lm=0;b.ld=function(a){g.Ib.w.ld.call(this,a);a.colourOptions&&(this.Ds=a.colourOptions,this.wA=a.colourTitles);a.columns&&(this.lm=a.columns)};b.Zg=function(){tb(this);this.Kd.style.fillOpacity=1;this.Kd.style.fill=this.$a}; b.Qg=function(a){return"string"!=typeof a?null:g.g.Ab.parse(a)};b.Rg=function(a){this.$a=a;this.Kd&&(this.Kd.style.fill=a)};b.dc=function(){var a=this.$a;/^#(.)\1(.)\2(.)\3$/.test(a)&&(a="#"+a[1]+a[3]+a[5]);return a};g.Ib.qo="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "); g.Ib.gD=[];g.Ib.so=7;b=g.Ib.prototype;b.setColumns=function(a){this.lm=a;return this};b.yf=function(){this.dh=this.ft();g.D.sy().appendChild(this.dh);g.D.oA(this,this.gt.bind(this));this.dh.focus()};b.lq=function(a){a=(a=a.target)&&a.label;null!==a&&(this.setValue(a),g.D.Ok(this))}; b.Eu=function(a){var c=!1;if(a.keyCode===g.g.ya.am)Hb(this,0,-1),c=!0;else if(a.keyCode===g.g.ya.Fl)Hb(this,0,1),c=!0;else if(a.keyCode===g.g.ya.Ko)Hb(this,-1,0),c=!0;else if(a.keyCode===g.g.ya.To)Hb(this,1,0),c=!0;else if(a.keyCode===g.g.ya.Gl){if(c=Ib(this))c=c&&c.label,null!==c&&this.setValue(c);g.D.bj();c=!0}c&&a.stopPropagation()}; b.gg=function(a){if(this.dh){if(a===g.navigation.fo)return Hb(this,0,-1),!0;if(a===g.navigation.eo)return Hb(this,0,1),!0;if(a===g.navigation.Vq)return Hb(this,-1,0),!0;if(a===g.navigation.Uq)return Hb(this,1,0),!0}return g.Ib.w.gg.call(this,a)}; function Hb(a,c,d){var e=a.Ds||g.Ib.qo,f=a.lm||g.Ib.so,h=a.md%f,k=Math.floor(a.md/f);h+=c;k+=d;0>c?0>h&&0h&&(h=0):0f-1&&kf-1&&h--:0>d?0>k&&(k=0):0Math.floor(e.length/f)-1&&(k=Math.floor(e.length/f)-1);Jb(a,a.dh.childNodes[k].childNodes[h],k*f+h)}b.Fu=function(a){var c=(a=a.target)&&a.getAttribute("data-index");null!==c&&c!==this.md&&Jb(this,a,Number(c))};b.EG=function(){this.dh.focus()}; b.GG=function(){this.dh.blur();var a=Ib(this);a&&g.g.o.Sb(a,"blocklyColourHighlighted")};function Ib(a){var c=a.lm||g.Ib.so,d=a.dh.childNodes[Math.floor(a.md/c)];return d?d.childNodes[a.md%c]:null}function Jb(a,c,d){var e=Ib(a);e&&g.g.o.Sb(e,"blocklyColourHighlighted");g.g.o.rb(c,"blocklyColourHighlighted");a.md=d;g.g.M.eb(a.dh,g.g.M.State.Wq,c.getAttribute("id"))} b.ft=function(){var a=this.lm||g.Ib.so,c=this.Ds||g.Ib.qo,d=this.wA||g.Ib.gD,e=this.getValue(),f=document.createElement("table");f.className="blocklyColourTable";f.tabIndex=0;f.dir="ltr";g.g.M.ue(f,g.g.M.Kf.MB);g.g.M.eb(f,g.g.M.State.Do,!0);g.g.M.eb(f,"rowcount",Math.floor(c.length/a));g.g.M.eb(f,"colcount",a);for(var h,k=0;ktr>td {","border: .5px solid #888;","box-sizing: border-box;","cursor: pointer;","display: inline-block;","height: 20px;","padding: 0;","width: 20px;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","position: relative;","}",".blocklyColourSelected, .blocklyColourSelected:hover {", "border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}"]);g.vc.register("field_colour",g.Ib);g.Zj=function(a,c,d,e){this.s=a;this.ub=c;this.Ed=d.getAttribute("text");this.pd=new g.g.V(0,0);this.ah=e;this.hp=d.getAttribute("callbackKey")||d.getAttribute("callbackkey");this.Ax=d.getAttribute("web-class")||null};g.Zj.af=5;b=g.Zj.prototype;b.width=0;b.height=0;b.Ue=null; b.Ja=function(){var a=this.ah?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.Ax&&(a+=" "+this.Ax);this.H=g.g.o.K("g",{"class":a},this.s.kb);if(!this.ah)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.ah?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.H);var d=g.g.o.K("text",{"class":this.ah?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.H);d.textContent=g.g.nc(this.Ed); this.ah&&(this.qv=d,this.s.Zb.subscribe(this.qv,"flyoutText","fill"));this.width=g.g.o.Nm(d);this.height=20;this.ah||(this.width+=2*g.Zj.af,c.setAttribute("width",this.width),c.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);d.setAttribute("x",this.width/2);d.setAttribute("y",this.height-g.Zj.af);Kb(this);this.Ue=g.ca(this.H,"mouseup",this,this.LG);return this.H};b.show=function(){Kb(this);this.H.setAttribute("display","block")}; function Kb(a){a.H.setAttribute("transform","translate("+a.pd.x+","+a.pd.y+")")}b.moveTo=function(a,c){this.pd.x=a;this.pd.y=c;Kb(this)};b.I=function(){this.Ue&&g.Ua(this.Ue);this.H&&g.g.o.removeNode(this.H);this.qv&&this.s.Zb.unsubscribe(this.qv)}; b.LG=function(a){(a=this.ub.Vg(a))&&a.cancel();this.ah&&this.hp?console.warn("Labels should not have callbacks. Label text: "+this.Ed):this.ah||this.hp&&Lb(this.ub,this.hp)?this.ah||Lb(this.ub,this.hp)(this):console.warn("Buttons should have callbacks. Button text: "+this.Ed)};g.Tc.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,},.blocklyFlyoutLabelText {,fill: #000;,}".split(","));g.Dc=function(){this.fA=g.Dc.Gx;this.Qk=null;this.ad=!1;this.Td=this.mb=null;this.ob=[];this.Bs={}};g.Dc.Gx=!1;g.Dc.Error={Yq:"Component already rendered",Fr:"Unable to set parent component",fB:"Child component index out of bounds"};b=g.Dc.prototype;b.va=function(){return this.Qk||(this.Qk=g.g.Ol.yy())};b.ua=function(){return this.mb}; b.kl=function(a){if(this==a)throw Error(g.Dc.Error.Fr);var c;if(c=a&&this.Td&&this.Qk)c=(c=this.Qk)?this.Td.Bs[c]||null:null;if(c&&this.Td!=a)throw Error(g.Dc.Error.Fr);this.Td=a};b.getParent=function(){return this.Td};b.Ja=function(){this.mb=document.createElement("div")};b.Ea=function(a){this.fh(a)};b.fh=function(a,c){if(this.ad)throw Error(g.Dc.Error.Yq);this.mb||this.Ja();a?a.insertBefore(this.mb,c||null):document.body.appendChild(this.mb);this.Td&&!this.Td.ad||this.nf()}; b.nf=function(){this.ad=!0;Mb(this,function(a){!a.ad&&a.ua()&&a.nf()})};b.Jh=function(){Mb(this,function(a){a.ad&&a.Jh()});this.ad=!1};b.I=function(){this.EE||(this.EE=!0,this.zm())};b.zm=function(){this.ad&&this.Jh();Mb(this,function(a){a.I()});this.mb&&g.g.o.removeNode(this.mb);this.Td=this.mb=this.Bs=this.ob=null}; b.em=function(a,c,d){if(a.ad&&(d||!this.ad))throw Error(g.Dc.Error.Yq);if(0>c||c>this.ob.length)throw Error(g.Dc.Error.fB);this.Bs[a.va()]=a;if(a.getParent()==this){var e=this.ob.indexOf(a);-1a&&(a=(a=this.getParent())?a.Jk()+1:0,Tb(this,a));return a};function Tb(a,c){if(c!=a.Ms){a.Ms=c;var d=Ub(a);if(d){var e=Vb(a)+"px";a.Wk()?d.style.paddingRight=e:d.style.paddingLeft=e}Mb(a,function(f){Tb(f,c+1)})}}b.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1};b.Kh=function(){var a=[];Mb(this,function(c){a.push(c)});return a};b.select=function(){var a=this.Pe();a&&Bb(a,this)}; function Wb(a,c){if(a.Cq!=c){a.Cq=c;Xb(a);var d=a.ua();d&&(g.g.M.eb(d,g.g.M.State.mk,c),c&&(c=a.Pe().ua(),g.g.M.eb(c,g.g.M.State.Wq,a.va())))}}b.Ne=function(){return this.Cm}; b.Cj=function(a){var c=a!=this.Cm,d;this.Cm=a;var e=this.Pe(),f=this.ua();if(Ob(this)){if(!a&&e&&this.contains(e.Ud)&&this.select(),f){if(d=Qb(this))g.g.style.bv(d,a),g.g.M.eb(f,g.g.M.State.Do,a),a&&this.ad&&!d.hasChildNodes()&&(Mb(this,function(h){d.appendChild(Rb(h))}),Mb(this,function(h){h.nf()}));this.Mq()}}else(d=Qb(this))&&g.g.style.bv(d,!1);f&&(this.vt().className=this.Dp());c&&(a?this.Sx():this.Rx())};b.Sx=function(){};b.Rx=function(){};b.toggle=function(){this.Cj(!this.Ne())}; function Rb(a){var c=a.Ne()&&Ob(a),d=document.createElement("div");d.style.backgroundPosition=Yb(a);c||(d.style.display="none");c&&Mb(a,function(e){d.appendChild(Rb(e))});c=document.createElement("div");c.id=a.va();c.appendChild(Zb(a));c.appendChild(d);return c}function Vb(a){return Math.max(0,(a.Jk()-1)*a.Xc.$y)}function Zb(a){var c=document.createElement("div");c.className=a.Ip();c.style["padding-"+(a.Wk()?"right":"left")]=Vb(a)+"px";c.appendChild($b(a));c.appendChild(ac(a));return c} b.Ip=function(){var a="";this.Cq&&(a=" "+(this.Xc.qE||""));return this.Xc.Dx+a};function ac(a){var c=document.createElement("span");c.className=a.Xc.oE||"";c.textContent=a.dc();return c}function $b(a){var c=document.createElement("span");c.style.display="inline-block";c.className=a.Dp();return c}b.Dp=function(){throw Error("unimplemented abstract method");};function Yb(a){return(a.tu?(a.Jk()-1)*a.Xc.$y:"-100")+"px 0"} b.ua=function(){var a=g.Fa.sd.w.ua.call(this);a||(this.mb=a=document.getElementById(this.va()));return a};function Ub(a){return(a=a.ua())?a.firstChild:null}b.vt=function(){var a=Ub(this);return a?a.firstChild:null};function Pb(a){return(a=Ub(a))&&a.lastChild?a.lastChild.previousSibling:null}function Qb(a){return(a=a.ua())?a.lastChild:null}b.ll=function(a){this.kf=a};b.dc=function(){return this.kf};function Xb(a){var c=Ub(a);c&&(c.className=a.Ip())} b.Mq=function(){var a=Qb(this);a&&(a.style.backgroundPosition=Yb(this))};b.Lz=function(a){"expand"==a.target.getAttribute("type")&&Ob(this)?this.Tt&&this.toggle():(this.select(),Xb(this))};b.lq=function(a){a.preventDefault()};b.Du=function(a){var c=!0;switch(a.keyCode){case g.g.ya.To:if(a.altKey)break;c=bc(this);break;case g.g.ya.Ko:if(a.altKey)break;c=cc(this);break;case g.g.ya.Fl:c=dc(this);break;case g.g.ya.am:c=ec(this);break;default:c=!1}c&&a.preventDefault();return c}; function dc(a){a:if(Ob(a)&&a.Ne())a=a.ob[0]||null;else{for(var c=a,d;c!=a.Pe();){d=c.tu;if(null!=d){a=d;break a}c=c.getParent()}a=null}a&&a.select();return!0}function ec(a){var c=a.fl;if(null!=c)a=fc(c);else{c=a.getParent();var d=a.Pe();a=c==d||a==d?null:c}a&&a.select();return!0}function cc(a){if(Ob(a)&&a.Ne()&&a.Tt)a.Cj(!1);else{var c=a.getParent();a=a.Pe();c&&c!=a&&c.select()}return!0}function bc(a){return Ob(a)?(a.Ne()?(a.ob[0]||null).select():a.Cj(!0),!0):!1} function fc(a){return a.Ne()&&Ob(a)?fc(a.ob[a.ob.length-1]||null):a}function Sb(a,c){a.Fa!=c&&(a.Fa=c,Mb(a,function(d){Sb(d,c)}))};g.Fa.Ah=function(a,c,d){this.sa=a;g.Fa.sd.call(this,c,d)};g.g.object.X(g.Fa.Ah,g.Fa.sd);b=g.Fa.Ah.prototype;b.Pe=function(){if(this.Fa)return this.Fa;var a=this.getParent();return a&&(a=a.Pe())?(Sb(this,a),a):null};b.Dp=function(){var a=this.Ne(),c=this.NE;if(a&&c)return c;c=this.FF;if(!a&&c)return c;c=this.Xc;if(Ob(this)){if(a&&c.Bx)return c.pp+" "+c.Bx;if(!a&&c.lE)return c.pp+" "+c.lE}else if(c.Cx)return c.pp+" "+c.Cx;return""}; b.lq=function(){Ob(this)&&this.Tt?(this.toggle(),this.select()):this.Cq?Bb(this.Pe(),null):this.select();Xb(this)};b.Lz=function(){};b.Du=function(a){if(this.Fa.sa.rf){var c={},d=g.g.ya.Fl,e=g.g.ya.am;c[g.g.ya.To]=this.Wk()?e:d;c[g.g.ya.Ko]=this.Wk()?d:e;c[g.g.ya.am]=g.g.ya.Ko;c[g.g.ya.Fl]=g.g.ya.To;Object.defineProperties(a,{keyCode:{value:c[a.keyCode]||a.keyCode}})}return g.Fa.Ah.w.Du.call(this,a)};b.eA=function(){this.Oz&&this.Oz.call(this.sa)};b.Sx=g.Fa.Ah.prototype.eA;b.Rx=g.Fa.Ah.prototype.eA;g.Fa.Ii=function(a,c){this.sa=a;g.Fa.sd.call(this,"",c);this.Cm=!0;Wb(this,!0);this.Ud=this};g.g.object.X(g.Fa.Ii,g.Fa.sd);b=g.Fa.Ii.prototype;b.Pe=function(){return this};b.Jk=function(){return 0};b.rF=function(){this.ky=!0;var a=this.ua();g.g.o.rb(a,"focused");this.Ud&&this.Ud.select()};b.oF=function(){this.ky=!1;var a=this.ua();g.g.o.Sb(a,"focused")};b.hasFocus=function(){return this.ky};b.Ne=function(){return!0};b.Cj=function(a){this.Cm=a}; b.vt=function(){var a=Ub(this);return a?a.firstChild:null};b.Mq=function(){};b.Ip=function(){return g.Fa.Ii.w.Ip.call(this)+" "+this.Xc.nE};b.Dp=function(){var a=this.Ne(),c=this.NE;if(a&&c)return c;c=this.FF;if(!a&&c)return c;c=this.Xc;return a&&c.mE?c.pp+" "+c.mE:""};function Bb(a,c){if(c!=a.Ud&&(!a.Hz||a.Hz.call(a.sa,c))){var d=a.Ud;a.Ud&&Wb(a.Ud,!1);(a.Ud=c)&&Wb(c,!0);a.Gz&&a.Gz.call(a.sa,d,c)}} b.Qp=function(){g.Fa.Ii.w.Qp.call(this);var a=this.ua();g.g.M.ue(a,g.g.M.Kf.hD);g.g.M.eb(a,g.g.M.State.jw,Pb(this).id)};b.nf=function(){g.Fa.Ii.w.nf.call(this);var a=this.ua();a.className=this.Xc.pE;a.setAttribute("hideFocus","true");this.os();this.Qp()};b.Jh=function(){g.Fa.Ii.w.Jh.call(this);this.Ns()};b.os=function(){var a=this.ua();a.tabIndex=0;this.xG=g.jd(a,"focus",this,this.rF);this.uG=g.jd(a,"blur",this,this.oF);this.Au=g.ca(a,"click",this,this.vF);this.AG=g.jd(a,"keydown",this,this.sF)}; b.Ns=function(){g.Ua(this.xG);g.Ua(this.uG);g.Ua(this.Au);g.Ua(this.AG)};b.vF=function(a){var c;a:{for(var d=a.target;null!=d;){if(c=g.Fa.sd.gs[d.id])break a;if(d==this.ua())break;d=d.parentNode}c=null}if(c)switch(a.type){case "mousedown":c.Lz(a);break;case "click":c.lq(a)}};b.sF=function(a){var c=!1;if(c=this.Ud&&this.Ud.Du(a)||c)g.g.style.Zu(this.Ud.ua(),this.ua().parentNode),a.preventDefault();return c};b.createNode=function(a){return new g.Fa.Ah(this.sa,a||"",this.Xc)};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.Hi=function(a){this.s=a;this.G=a.options.G;this.rf=a.options.Od;this.Ia=a.options.Ia;this.Xc={$y:19,pE:"blocklyTreeRoot",nE:"blocklyHidden",Dx:"blocklyTreeRow",oE:"blocklyTreeLabel",pp:"blocklyTreeIcon",Bx:"blocklyTreeIconOpen",Cx:"blocklyTreeIconNone",qE:"blocklyTreeSelected"};this.AA={Dx:"blocklyTreeSeparator"};this.rf&&(this.Xc.cssTreeRow+=a.G?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.AA.cssTreeRow="blocklyTreeSeparatorHorizontal "+(a.G?"blocklyHorizontalTreeRtl":"blocklyHorizontalTree"), this.Xc.cssTreeIcon="")};b=g.Hi.prototype;b.width=0;b.height=0;b.Yk=null; b.Z=function(){var a=this.s,c=r(this.s);this.Ec=document.createElement("div");this.Ec.className="blocklyToolboxDiv blocklyNonSelectable";this.Ec.setAttribute("dir",a.G?"RTL":"LTR");c.parentNode.insertBefore(this.Ec,c);c=a.Zb;c.subscribe(this.Ec,"toolbox","background-color");c.subscribe(this.Ec,"toolboxText","color");g.ca(this.Ec,"mousedown",this,function(d){g.g.lj(d)||d.target==this.Ec?g.wc(!1):g.wc(!0);g.Touch.Dh()},!1,!0);c={Pg:a.options.Pg,Rb:a,G:a.G,Dd:a.options.Dd,Od:a.Od,Ia:a.options.Ia,gh:a.options.gh}; this.O=null;if(a.Od){if(!g.Ml)throw Error("Missing require for Blockly.HorizontalFlyout");this.O=new g.Ml(c)}else{if(!g.Hg)throw Error("Missing require for Blockly.VerticalFlyout");this.O=new g.Hg(c)}g.g.o.fj(this.O.Ja("svg"),r(this.s));this.O.Z(a);this.Xc.cleardotPath=a.options.wf+"1x1.gif";this.Xc.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.G?"Rtl":"Ltr");gc(this,a.options.Xk)}; function gc(a,c){a.Fd&&(a.Fd.I(),a.Yk=null);var d=new g.Fa.Ii(a,a.Xc);a.Fd=d;Bb(d,null);d.Hz=a.nF;d.Gz=a.mF;var e=null;if(c){a.Fd.Sf=[];a.Ht=!1;e=hc(a,c,a.Fd,a.s.options.wf);if(a.Fd.Sf.length)throw Error("Toolbox cannot have both blocks and categories in the root level.");ic(a.s)}d.Ea(a.Ec);e&&Bb(d,e);jc(a);a.position();a.rf&&g.g.M.eb(a.Fd.ua(),g.g.M.State.CC,"horizontal")} b.nF=function(a){if(a==this.Fd)return!1;this.Yk&&(Ub(this.Yk).style.backgroundColor="");if(a){var c=a.Nk||"#57e";Ub(a).style.backgroundColor=c;jc(this,a)}return!0};b.mF=function(a,c){c&&c.Sf&&c.Sf.length?(this.O.show(c.Sf),this.Yk!=c&&this.O.yc.set(0),g.Se&&g.navigation.eb(g.navigation.Rr)):(this.O.Ha(),!g.Se||c instanceof g.Hi.Xr||g.navigation.eb(g.navigation.Xl));a!=c&&a!=this&&(a=new g.i.yd(null,"category",a&&a.dc(),c&&c.dc()),a.Cc=this.s.id,g.i.Oa(a));c&&(this.Yk=c)};b.yF=function(){g.rl(this.s)}; b.gg=function(a){var c=this.Fd.Ud;if(!c)return!1;switch(a.name){case g.navigation.hb.Ge:return ec(c);case g.navigation.hb.So:return cc(c);case g.navigation.hb.De:return dc(c);case g.navigation.hb.Ho:return bc(c);default:return!1}};b.I=function(){this.O.I();this.Fd.I();this.s.Zb.unsubscribe(this.Ec);g.g.o.removeNode(this.Ec);this.Yk=this.s=null};b.cg=function(){return this.width};b.xy=function(){return this.height}; b.position=function(){var a=this.Ec;if(a){var c=r(this.s);c=g.vA(c);this.rf?(a.style.left="0",a.style.height="auto",a.style.width=c.width+"px",this.height=a.offsetHeight,this.Ia==g.Fg?a.style.top="0":a.style.bottom="0"):(this.Ia==g.Eg?a.style.right="0":a.style.left="0",a.style.height=c.height+"px",this.width=a.offsetWidth);this.O.position()}}; function hc(a,c,d,e){for(var f=null,h=null,k=0,l;l=c.childNodes[k];k++)if(l.tagName)switch(l.tagName.toUpperCase()){case "CATEGORY":var m=g.g.nc(l.getAttribute("name"));h=a.Fd.createNode(m);h.Oz=a.yF;h.Sf=[];d.add(h);var n=l.getAttribute("custom");n?h.Sf=n:(n=hc(a,l,h,e))&&(f=n);var t=l.getAttribute("categorystyle");if((n=l.getAttribute("colour"))&&t)h.Nk="",console.warn('Toolbox category "'+m+'" can not have both a style and a colour');else if(t){n=a;var v=h;v.yM=t;var w=n.s.Kp();t&&w&&((w=w.QD[t])&& w.Ab?kc(n,w.Ab,v,m):console.warn('Style "'+t+'" must exist and contain a colour value'))}else kc(a,n,h,m);"true"==l.getAttribute("expanded")?(h.Sf.length&&(f=h),h.Cj(!0)):h.Cj(!1);h=l;break;case "SEP":if(h&&"CATEGORY"==h.tagName.toUpperCase()){d.add(new g.Hi.Xr(a.AA));break}case "BLOCK":case "SHADOW":case "LABEL":case "BUTTON":d.Sf.push(l),h=l}return f} function kc(a,c,d,e){c=g.g.nc(c);if(null===c||""===c)d.Nk="";else{var f=Number(c);isNaN(f)?(f=g.g.Ab.parse(c))?(d.Nk=f,a.Ht=!0):(d.Nk="",console.warn('Toolbox category "'+e+'" has unrecognized colour attribute: '+c)):(d.Nk=g.Zy(f),a.Ht=!0)}}function jc(a,c){c=(c||a.Fd).Kh(!1);for(var d=0,e;e=c[d];d++){var f=Ub(e);if(f){var h=a.Ht?"8px solid "+(e.Nk||"#ddd"):"none";a.s.G?f.style.borderRight=h:f.style.borderLeft=h}jc(a,e)}} b.Im=function(){if(!this.Ec)return null;var a=this.Ec.getBoundingClientRect(),c=a.top,d=c+a.height,e=a.left;a=e+a.width;return this.Ia==g.Fg?new g.g.Rect(-1E7,d,-1E7,1E7):this.Ia==g.Fi?new g.g.Rect(c,1E7,-1E7,1E7):this.Ia==g.Jd?new g.g.Rect(-1E7,1E7,-1E7,a):new g.g.Rect(-1E7,1E7,e,1E7)};g.Hi.Xr=function(a){g.Fa.Ah.call(this,null,"",a)};g.g.object.X(g.Hi.Xr,g.Fa.Ah); g.Tc.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.Il=function(a){this.Cc=a.id;this.group=g.i.cc();this.Pc=!1};g.g.object.X(g.i.Il,g.i.Abstract);g.i.Il.prototype.type=g.i.FB;g.i.Il.prototype.fb=function(){var a={type:this.type};this.group&&(a.group=this.group);this.Cc&&(a.workspaceId=this.Cc);return a};g.i.Il.prototype.pa=function(a){this.Cc=a.workspaceId;this.group=a.group};g.R={};g.R.HA=function(a){var c=G,d=g.g.xml.createElement("xml"),e=g.R.HH(g.N.Vw(c));e.hasChildNodes()&&d.appendChild(e);var f=xa(c,!0);e=0;for(var h;h=f[e];e++)d.appendChild(h.tv(a));c=A(c,!0);for(e=0;f=c[e];e++)d.appendChild(g.R.ts(f,a));return d};g.R.HH=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.va();c.appendChild(f)}return c}; g.R.ts=function(a,c){var d;a.v.G&&(d=a.v.cg());c=g.R.Bh(a,c);var e=a.Sa();c.setAttribute("x",Math.round(a.v.G?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c};g.R.PE=function(a){var c=!1;a.name&&(a.Ei?c=!0:a.Gf&&(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.xA(c)):null}; g.R.BD=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.R.PE(h))&&c.appendChild(h)}; g.R.Bh=function(a,c){var d=g.g.xml.createElement(a.ib?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.Pa){var e=a.Pa();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}g.R.BD(a,d);if(e=a.Je.text){var f=a.Je.size,h=a.Je.Nu,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.xg){var m=C(h.connection);h.type==g.Ra?l=g.g.xml.createElement("value"):h.type==g.Xa&&(l=g.g.xml.createElement("statement"));e=h.connection.xf;!e||m&&m.ib||l.appendChild(g.R.kx(e,c));m&&(l.appendChild(g.R.Bh(m,c)),k=!1);l.setAttribute("name",h.name);k||d.appendChild(l)}}void 0!=a.$g&&a.$g!=a.MF&&d.setAttribute("inline",a.$g);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.qe()||a.ib||d.setAttribute("deletable", !1);a.Lc()||a.ib||d.setAttribute("movable",!1);a.nd()||d.setAttribute("editable",!1);if(f=q(a))l=g.g.xml.createElement("next"),l.appendChild(g.R.Bh(f,c)),d.appendChild(l);e=a.U&&a.U.xf;!e||f&&f.ib||l.appendChild(g.R.kx(e,c));return d}; g.R.kx=function(a,c){for(var d=a=a.cloneNode(!0),e;d;)if(c&&"shadow"==d.nodeName&&d.removeAttribute("id"),d.firstChild)d=d.firstChild;else{for(;d&&!d.nextSibling;)e=d,d=d.parentNode,e.nodeType==g.g.o.Node.TEXT_NODE&&""==e.data.trim()&&d.firstChild!=e&&g.g.o.removeNode(e);d&&(e=d,d=d.nextSibling,e.nodeType==g.g.o.Node.TEXT_NODE&&""==e.data.trim()&&g.g.o.removeNode(e))}return a}; g.R.Nd=function(a){a=g.g.xml.Nd(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1 $2")}while(a!=d);return a};g.R.VL=function(a){a=g.R.Nd(a).split("<");for(var c="",d=1;d"!=e.slice(-2)&&(c+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1");return a.replace(/^\n/,"")}; g.R.mi=function(a){var c=g.g.xml.vH(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};g.R.RL=function(a,c){c.Qc(!1);c.clear();a=g.R.Hh(a,c);c.Qc(!0);return a}; g.R.Hh=function(a,c){if(a instanceof g.Nb){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var e;c.G&&(e=c.cg());d=[];g.g.o.Mn();var f=a.childNodes.length,h=g.i.cc();h||g.i.aa(!0);c.Qc&&c.Qc(!1);var k=!0;try{for(var l=0;l=this.s.options.iq)){a={scrollbars:!0,Pg:this.s.options.Pg,Rb:this.s,G:this.s.G,Dd:this.s.options.Dd,gh:this.s.options.gh};if(this.s.Od){a.Ia=this.s.Ia==g.Fg?g.Fi:g.Fg;if(!g.Ml)throw Error("Missing require for Blockly.HorizontalFlyout");this.O=new g.Ml(a)}else{a.Ia=this.s.Ia==g.Eg?g.Jd:g.Eg;if(!g.Hg)throw Error("Missing require for Blockly.VerticalFlyout");this.O=new g.Hg(a)}Ba(this.s,this.wG.bind(this))}};b=g.Wr.prototype;b.Ji=47;b.jo=44;b.gk=16;b.vr=20; b.Rl=20;b.Mo=10;b.Pr=0;b.Qr=32;b.PB=.1;b.St=!1;b.jq=0;b.H=null;b.Hq=null;b.Zt=0;b.Yh=0;b.cn=0;b.wl=0; b.Ja=function(){this.H=g.g.o.K("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var c=g.g.o.K("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.H);g.g.o.K("rect",{width:this.Ji,height:this.jo,y:this.gk},c);var d=g.g.o.K("image",{width:g.xd.width,x:-this.Pr,height:g.xd.height,y:-this.Qr,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.H);d.setAttributeNS(g.g.o.ef,"xlink:href",this.s.options.wf+g.xd.url);c=g.g.o.K("clipPath",{id:"blocklyTrashLidClipPath"+a},this.H); g.g.o.K("rect",{width:this.Ji,height:this.gk},c);this.Hq=g.g.o.K("image",{width:g.xd.width,x:-this.Pr,height:g.xd.height,y:-this.Qr,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.H);this.Hq.setAttributeNS(g.g.o.ef,"xlink:href",this.s.options.wf+g.xd.url);g.ca(this.H,"mouseup",this,this.click);g.jd(d,"mouseover",this,this.hG);g.jd(d,"mouseout",this,this.fG);this.hs();return this.H}; b.Z=function(a){0this.jq&&1>this.Yh&&(this.Zt=setTimeout(this.hs.bind(this),20))};function nc(a,c){var d=a.s.Ia==g.Eg||a.s.Od&&a.s.G;a.Hq.setAttribute("transform","rotate("+(d?-c:c)+","+(d?4:a.Ji-4)+","+(a.gk-2)+")")}b.close=function(){$a(this,!1)}; b.click=function(){if(this.Qi.length){for(var a=[],c=0,d;d=this.Qi[c];c++)a[c]=g.R.mi(d);this.O.show(a)}};b.hG=function(){this.Qi.length&&$a(this,!0)};b.fG=function(){$a(this,!1)}; b.wG=function(a){if(!(0>=this.s.options.iq)&&a.type==g.i.io&&"shadow"!=a.zu.tagName.toLowerCase()){for(var c=a=a.zu.cloneNode(!0);c;){c.removeAttribute&&(c.removeAttribute("x"),c.removeAttribute("y"),c.removeAttribute("id"));var d=c.firstChild||c.nextSibling;if(!d)for(d=c.parentNode;d;){if(d.nextSibling){d=d.nextSibling;break}d=d.parentNode}c=d}a=g.R.Nd(a);if(-1==this.Qi.indexOf(a)){for(this.Qi.unshift(a);this.Qi.length>this.s.options.iq;)this.Qi.pop();this.jq=this.PB;nc(this,45*this.jq)}}};g.S=Object.create(null);g.ta=function(a,c){this.B=a;this.type=c};g.ta.po=0;g.ta.ww=1;g.ta.zw=2;g.ta.yw=3;g.ta.uw=4;g.ta.vw=5;g.ta.xw=6;b=g.ta.prototype;b.ka=null;b.Kg=null;b.xf=null;b.$b=0;b.gb=0; b.hf=function(a){var c=this,d=c.B,e=a.B;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=C(c),h=c.xf;c.xf=null;if(f.ib)h=g.R.Bh(f),f.I(),f=null;else if(c.type==g.Ra){if(!f.L)throw Error("Orphan block does not have an output connection.");var k=g.ta.lz(e,f);k&&(f.L.connect(k),f=null)}else if(c.type==g.Xa){if(!f.$)throw Error("Orphan block does not have a previous connection.");for(k=e;k.U;){var l=q(k);if(l&&!l.ib)k=l;else{oc(f.$,k.U)&&(k.U.connect(f.$),f=null);break}}}if(f&&(c.disconnect(), g.i.Pc)){var m=g.i.cc();setTimeout(function(){f.v&&!f.getParent()&&(g.i.aa(m),f.L?f.L.mq(c):f.$&&f.$.mq(c),g.i.aa(!1))},g.mo)}c.xf=h}var n;g.i.isEnabled()&&(n=new g.i.Cl(e));g.ta.dE(c,a);e.kl(d);n&&(n.zj(),g.i.Oa(n))};b.I=function(){if(this.isConnected()){this.xf=null;var a=C(this);a.ib?a.I():D(a)}};function F(a){return a.type==g.Ra||a.type==g.Xa}b.isConnected=function(){return!!this.ka}; function Eb(a,c){if(!c)return g.ta.yw;if(F(a))var d=a.B,e=c.B;else e=a.B,d=c.B;return d&&d==e?g.ta.ww:c.type!=g.jk[a.type]?g.ta.zw:d&&e&&d.v!==e.v?g.ta.vw:oc(a,c)?d.ib&&!e.ib?g.ta.xw:g.ta.po:g.ta.uw} function Fb(a,c){switch(Eb(a,c)){case g.ta.po:break;case g.ta.ww:throw Error("Attempted to connect a block to itself.");case g.ta.vw:throw Error("Blocks not on same workspace.");case g.ta.zw:throw Error("Attempt to connect incompatible types.");case g.ta.yw:throw Error("Target connection is null.");case g.ta.uw:throw Error("Connection checks failed. "+(a+" expected "+a.Kg+", found "+c.Kg));case g.ta.xw: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.Th()||Eb(this,a)!=g.ta.po)return!1;switch(a.type){case g.cf:return this.ka||-1!=g.Am.indexOf(a)?a=!1:a.ka?(a=C(a),a=a.Th()?!(a.$&&C(a.$)):!1):a=!0,a;case g.bf:if(a.isConnected()&&!C(a).Th()||this.isConnected())return!1;break;case g.Ra:if(a.isConnected()&&!C(a).Lc()&&!C(a).ib)return!1;break;case g.Xa:if(a.isConnected()&&!this.B.U&&!C(a).ib&&C(a).U)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=g.Am.indexOf(a)?!1:!0};b.mq=function(){}; b.connect=function(a){if(this.ka!=a){Fb(this,a);var c=g.i.cc();c||g.i.aa(!0);F(this)?this.hf(a):a.hf(this);c||g.i.aa(!1)}};g.ta.dE=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.ka=c;c.ka=a};g.ta.lH=function(a,c){for(var d=!1,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.ce(d));d.fv(a.B);a.B.ga&&d.Z();d.name=e;d.Ou&&(c=rc(a,c,d.Ou));a.Na.splice(c,0,d);++c;d.pv&&(c=rc(a,c,d.pv));a.B.ga&&(a.B.Ea(),a.B.Pb());return c}b.isVisible=function(){return this.oi}; b.Yb=function(a){var c=[];if(this.oi==a)return c;for(var d=(this.oi=a)?"block":"none",e=0,f;f=this.Na[e];e++)f.Yb(a);if(this.connection){if(a)c=sc(this.connection);else if(e=this.connection,tc(e,!0),e.ka)for(e=p(C(e),!1),f=0;f=d)this.Ni=g.Zy(d);else if(d=g.g.Ab.parse(c))this.Ni=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);}; function K(a,c){var d=a.v.Kp().KD[c];if(d)a.mx=d.colourSecondary,a.nx=d.colourTertiary,a.Yg=d.Yg,a.se(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.zn()&&a.push(f.getValue());return a}; b.Xg=function(){for(var a=[],c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)f.zn()&&(f=this.v.pf(f.getValue()))&&a.push(f);return a};b.Nq=function(a){for(var c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)f.zn()&&a.va()==f.getValue()&&xb(f)};b.xq=function(a,c){for(var d=0,e;e=this.P[d];d++)for(var f=0,h;h=e.Na[f];f++)h.zn()&&a==h.getValue()&&h.setValue(c)};function z(a,c){return(a=B(a,c))?a.getValue():null} function wc(a,c,d){a=B(a,d);if(!a)throw Error('Field "'+d+'" not found.');a.setValue(c)}b.Wd=function(a,c){if(a){void 0===c&&(c=null);if(!this.$){if(this.L)throw Error("Remove output connection prior to adding previous connection.");this.$=this.gn(g.cf)}this.$.wa(c)}else if(this.$){if(this.$.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.$.I();this.$=null}}; b.Vd=function(a,c){if(a)void 0===c&&(c=null),this.U||(this.U=this.gn(g.Xa)),this.U.wa(c);else if(this.U){if(this.U.isConnected())throw Error("Must disconnect next statement before removing connection.");this.U.I();this.U=null}}; b.bd=function(a,c){if(a){void 0===c&&(c=null);if(!this.L){if(this.$)throw Error("Remove previous connection prior to adding output connection.");this.L=this.gn(g.bf)}this.L.wa(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.te=function(a){this.$g!=a&&(g.i.Oa(new g.i.sg(this,"inline",null,this.$g,a)),this.$g=a)}; function qc(a){if(void 0!=a.$g)return a.$g;for(var c=1;ca&&(d=d.substring(0,a-3)+"...");return d};function L(a,c){return a.Qf(g.Ra,c)} function M(a,c){return a.Qf(g.xg,c||"")} function yc(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.Yg&&(a.Yg=c.style.Yg,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{K(a,e)}catch(I){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.se(e)}catch(I){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.zH(c["message"+e]),m=[],n=0,t=[],v=0;v=w||w>h.length)throw Error('Block "'+f.type+'": Message index %'+w+" out of range.");if(m[w])throw Error('Block "'+f.type+'": Message index %'+w+" duplicated.");m[w]=!0;n++;t.push(h[w-1])}else(w=w.trim())&&t.push(w)}if(n!=h.length)throw Error('Block "'+f.type+'": Message does not reference all '+ h.length+" arg(s).");t.length&&("string"==typeof t[t.length-1]||g.g.jb.startsWith(t[t.length-1].type,"field_"))&&(v={type:"input_dummy"},k&&(v.align=k),t.push(v));k={LEFT:g.Xq,RIGHT:g.fd,CENTRE:g.Dv};h=[];for(v=0;v=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.md)}function Ec(a,c,d){var e=a.ob.length;d=c.call(a,0>d?-1:d,e);for(var f=0;f<=e;){var h=a.ob[d]||null;if(h&&h.isEnabled()){Ac(a,d);break}f++;d=c.call(a,d,e)}}b.xF=function(a){(a=Bc(this,a.target))&&a.isEnabled()&&(this.ob[this.md]||null)!==a&&(Cc(this),this.lh(a))};b.pF=function(a){var c=Bc(this,a.target),d;if(d=c)c.isEnabled()&&(c.lh(!0),Gc(c)),d=void 0;d&&a.preventDefault()}; b.uF=function(){this.focus()};b.wF=function(){this.ua()&&(this.blur(),Cc(this),Ac(this,-1))};b.Gt=function(a){return 0!=this.ob.length&&Hc(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1};function Hc(a,c){var d=a.ob[a.md]||null;if(d&&"function"==typeof d.Gt&&d.Gt(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case g.g.ya.Gl:d&&Gc(d);break;case g.g.ya.am:Fc(a);break;case g.g.ya.Fl:Dc(a);break;default:return!1}return!0};g.No=function(a,c){g.Dc.call(this);this.kf=a;this.setValue(c);this.xp=!0};g.g.object.X(g.No,g.Dc);b=g.No.prototype; b.Ja=function(){var a=document.createElement("div");a.id=this.va();this.mb=a;a.className="goog-menuitem goog-option "+(this.xp?"":"goog-menuitem-disabled ")+(this.As?"goog-option-selected ":"")+(this.Wk()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.im){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(Ic(this));g.g.M.ue(a,this.Yu||(this.im?g.g.M.Kf.tC: g.g.M.Kf.sC));g.g.M.eb(a,g.g.M.State.mk,this.im&&this.As||!1)};function Ic(a){a=a.kf;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.$a=a};b.getValue=function(){return this.$a};b.ue=function(a){this.Yu=a};function Jc(a,c){if(a.im){a.As=c;var d=a.ua();d&&a.isEnabled()&&(c?(g.g.o.rb(d,"goog-option-selected"),g.g.M.eb(d,g.g.M.State.mk,!0)):(g.g.o.Sb(d,"goog-option-selected"),g.g.M.eb(d,g.g.M.State.mk,!1)))}} b.lh=function(a){var c=this.ua();c&&this.isEnabled()&&(a?g.g.o.rb(c,"goog-menuitem-highlight"):g.g.o.Sb(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.xp};b.qd=function(a){this.xp=a;(a=this.ua())&&(this.xp?g.g.o.Sb(a,"goog-menuitem-disabled"):g.g.o.rb(a,"goog-menuitem-disabled"))};function Gc(a){a.im&&Jc(a,!a.As);a.Tw&&a.Tw.call(a.yD,a)}function Kc(a,c,d){a.Tw=c;a.yD=d};g.g.Lq={};g.g.Lq.Wg=function(a){a=a.ua();var c=g.g.style.Wg(a);c.height=a.scrollHeight;return c};g.g.Lq.zD=function(a,c,d){c.left+=d.width;c.right+=d.width;a.left+=d.width;a.right+=d.width};g.Ga={};g.Ga.qp=null;g.Ga.Zx=null;g.Ga.show=function(a,c,d){g.ba.show(g.Ga,d,null);if(c.length){var e=g.Ga.SG(c,d);g.Ga.pd(e,a,d);setTimeout(function(){e.ua().focus()},1);g.Ga.qp=null}else g.Ga.Ha()};g.Ga.SG=function(a,c){var d=new g.yi;Nb(d,c);for(var e=0,f;f=a[e];e++){var h=new g.No(f.text);Nb(h,c);d.em(h,d.ob.length,!0);h.qd(f.enabled);f.enabled&&Kc(h,function(){g.Ga.Ha();this.Fb()},f)}return d}; g.Ga.pd=function(a,c,d){var e=g.g.lF();c={top:c.clientY+e.top,bottom:c.clientY+e.top,left:c.clientX+e.left,right:c.clientX+e.left};g.Ga.kE(a);var f=g.g.Lq.Wg(a);d&&g.g.Lq.zD(e,c,f);g.ba.TG(e,c,f,d);a.ua().focus()};g.Ga.kE=function(a){a.Ea(g.ba.Ca);var c=a.ua();g.g.o.rb(c,"blocklyContextMenu");g.ca(c,"contextmenu",null,g.g.qG);a.focus()};g.Ga.Ha=function(){g.ba.Ok(g.Ga);g.Ga.qp=null;g.Ga.Zx&&g.Ua(g.Ga.Zx)}; g.Ga.gp=function(a,c){return function(){g.i.disable();try{var d=g.R.Wi(c,a.v),e=a.Sa();e.x=a.G?e.x-g.wd:e.x+g.wd;e.y+=2*g.wd;d.moveBy(e.x,e.y)}finally{g.i.enable()}g.i.isEnabled()&&!d.ib&&g.i.Oa(new g.i.oo(d));d.select()}};g.Ga.HD=function(a){var c=p(a,!1).length,d=q(a);d&&(c-=p(d,!1).length);return{text:1==c?g.h.DELETE_BLOCK:g.h.DELETE_X_BLOCKS.replace("%1",String(c)),enabled:!0,Fb:function(){g.i.aa(!0);a.I(!0,!0);g.i.aa(!1)}}}; g.Ga.JD=function(a){return{enabled:!("function"==typeof a.Wb?!a.Wb():!a.Wb),text:g.h.HELP,Fb:function(){var c="function"==typeof a.Wb?a.Wb():a.Wb;c&&window.open(c)}}};g.Ga.ID=function(a){var c=Aa(a.v)?za(a.v,g.g.rt(a,!0)):!0;return{text:g.h.DUPLICATE_BLOCK,enabled:c,Fb:function(){g.Vx(a)}}};g.Ga.GD=function(a){var c={enabled:!g.g.userAgent.yg};a.Ak?(c.text=g.h.REMOVE_COMMENT,c.Fb=function(){a.ji(null)}):(c.text=g.h.ADD_COMMENT,c.Fb=function(){a.ji("")});return c}; g.Ga.SL=function(a){return{text:g.h.WK,enabled:!0,Fb:function(){g.i.aa(!0);a.I(!0,!0);g.i.aa(!1)}}};g.Ga.TL=function(a){return{text:g.h.FI,enabled:!0,Fb:function(){g.Vx(a)}}}; g.Ga.BM=function(a,c){if(!g.qk)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!g.g.userAgent.yg};d.text=g.h.OH;d.Fb=function(){var e=new g.qk(a,g.h.LL,g.qk.uB,g.qk.uB),f=aa(a).getBoundingClientRect();f=new g.g.V(c.clientX-f.left,c.clientY-f.top);var h=g.g.Km(a.kb);f=g.g.V.Ek(f,h);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.ga&&(e.Qd(),e.Ea(),e.select())};return d};g.Cg=function(a,c){g.Cg.w.constructor.call(this,a,c);this.Xf=a.v.op[c];this.Ex=a.v.op[g.jk[c]];this.tj=new g.g.V(0,0);this.Qh=!1;this.Wy=!this.Xf};g.g.object.X(g.Cg,g.ta);b=g.Cg.prototype;b.I=function(){g.Cg.w.I.call(this);this.Qh&&Lc(this.Xf,this)};function Mc(a,c){var d=a.$b-c.$b;a=a.gb-c.gb;return Math.sqrt(d*d+a*a)} function Gb(a,c){if(!a.B.v.lc()){var d=db(a.B);if(!d.ec){var e=!1;if(!d.Lc()){d=db(c.B);if(!d.Lc())return;c=a;e=!0}var f=g.selected==d;f||d.ap();var h=c.$b+g.wd+Math.floor(Math.random()*g.cr)-a.$b,k=c.gb+g.wd+Math.floor(Math.random()*g.cr)-a.gb;e&&(k=-k);d.G&&(h=c.$b-g.wd-Math.floor(Math.random()*g.cr)-a.$b);d.moveBy(h,k);f||d.Bn()}}}b.moveTo=function(a,c){this.Qh&&Lc(this.Xf,this);this.$b=a;this.gb=c;this.Wy||Nc(this.Xf,this)};b.moveBy=function(a,c){this.moveTo(this.$b+a,this.gb+c)}; function Oc(a,c){a.moveTo(c.x+a.tj.x,c.y+a.tj.y)}function Pc(a,c,d){a.tj.x=c;a.tj.y=d}function Qc(a){var c=a.ka.$b-a.$b,d=a.ka.gb-a.gb;if(0!=c||0!=d){a=C(a);var e=a.za();if(!e)throw Error("block is not rendered.");e=g.g.Oe(e);a.za().setAttribute("transform","translate("+(e.x-c)+","+(e.y-d)+")");bb(a,-c,-d)}} b.closest=function(a,c){var d=this.Ex;if(d.ic.length){var e=this.gb,f=this.$b;this.$b=f+c.x;this.gb=e+c.y;var h=Rc(d,this);c=null;for(var k=a,l,m=h-1;0<=m&&Math.abs(d.ic[m].gb-this.gb)<=a;)l=d.ic[m],this.Vp(l,k)&&(c=l,k=Mc(l,this)),m--;for(;hc?!1:g.Cg.w.Vp.call(this,a)};b.mq=function(a){Gb(this,a)};b.Ts=function(a,c){g.Cg.w.Ts.call(this,a,c);a.ga&&a.Ea();c.ga&&(mc(c),c.Ea())}; b.Wu=function(){var a=this.B,c=this.xf;if(a.v&&c&&g.i.Pc){g.Cg.w.Wu.call(this);c=C(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.Qd();c.Ea(!1);a.ga&&a.Ea()}};b.Cz=function(a){return Sc(this.Ex,this,a)};b.hf=function(a){g.Cg.w.hf.call(this,a);var c=this.B;a=a.B;c.ga&&mc(c);a.ga&&mc(a);c.ga&&a.ga&&(this.type==g.Xa||this.type==g.cf?a.Ea():c.Ea())};b.Iz=function(){this.isConnected()&&!oc(this,this.ka)&&(D(F(this)?C(this):this.B),this.B.Pb())};g.xa=function(a,c,d){this.H=g.g.o.K("g",{},null);this.H.Un="";this.wj=a.hh.uz(this.H);this.Rn=this.wj.Qn||null;this.Yd=this.wj.ql||null;this.Hj=this.wj.Sn||null;this.Yd.Af=this;this.ga=!1;this.ao=g.g.gj()&&!!a.je;g.J.wk(this.Yd);g.xa.w.constructor.call(this,a,c,d);this.H.dataset&&(this.H.dataset.id=this.id);this.Yc=null};g.g.object.X(g.xa,g.no);g.xa.prototype.height=0;g.xa.prototype.width=0;g.xa.prototype.$d=null;g.xa.oJ=-1;g.xa.dr="TEMP_COLLAPSED_WARNING_";g.xa.PC=10;g.xa.yr=25;g.xa.zh=8; g.xa.Dg=!1;b=g.xa.prototype;b.Qd=function(){if(!this.v.ga)throw TypeError("Workspace is headless.");for(var a=0,c;c=this.P[a];a++)c.Z();c=Wa(this);for(a=0;a=a.ic.length)return-1;for(var e=c.gb,f=d;0<=f&&a.ic[f].gb==e;){if(a.ic[f]==c)return f;f--}for(;dc.gb)e=f;else{d=f;break}}return d}function Lc(a,c){if(!c.Qh)throw Error("Connection not in database.");var d=Yc(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.Qh=!1;a.ic.splice(d,1)} function Sc(a,c,d){function e(n){var t=h-f[n].$b,v=k-f[n].gb;Math.sqrt(t*t+v*v)<=d&&m.push(f[n]);return v document.");}else a=null;return a};g.ie=function(a,c){g.ie.w.constructor.call(this,a,c);this.Zp=!1;this.Ie={};this.qA=this.wn=0;this.Gu=null};g.g.object.X(g.ie,g.$j);g.ie.vD=5;g.ie.wD=6;b=g.ie.prototype;b.Ws=function(a){g.ie.w.Ws.call(this,a);!this.Xp&&g.Touch.cq(a)&&$c(this,a)};b.wk=function(a){this.Gu=g.ca(document,"mousedown",null,this.zF.bind(this),!0);this.nq=g.ca(document,"mousemove",null,this.Pm.bind(this),!0);this.oq=g.ca(document,"mouseup",null,this.Mp.bind(this),!0);a.preventDefault();a.stopPropagation()}; b.zF=function(a){!this.lc()&&g.Touch.cq(a)&&($c(this,a),this.Zp&&g.Zh())};b.Pm=function(a){if(this.lc())g.Touch.hv(a)&&g.ie.w.Pm.call(this,a);else if(this.Zp){if(g.Touch.cq(a)){this.Ie[g.Touch.Lp(a)]=ad(this,a);var c=Object.keys(this.Ie);if(2==c.length){c=g.g.V.Qx(this.Ie[c[0]],this.Ie[c[1]])/this.qA;if(0this.wn){var d=c-this.wn;d=0Object.keys(this.Ie).length&&(this.Ie={},this.wn=0)}!this.Zp||this.lc()?g.Touch.hv(a)&&g.ie.w.Mp.call(this,a):(a.preventDefault(),a.stopPropagation(),this.I())};b.I=function(){g.ie.w.I.call(this);this.Gu&&g.Ua(this.Gu)};function $c(a,c){a.Ie[g.Touch.Lp(c)]=ad(a,c);var d=Object.keys(a.Ie);2==d.length&&(a.qA=g.g.V.Qx(a.Ie[d[0]],a.Ie[d[1]]),a.Zp=!0,c.preventDefault())} function ad(a,c){return a.zc?new g.g.V(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};g.Pw=function(a){this.Ku=a;this.Wl=Object.create(null)};b=g.Pw.prototype;b.Wt=null;b.I=function(){this.Wl=this.Ku=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=ya(a)))if(a.Ic&&a.Ic.cancel(),"comment"==c.tagName.toLowerCase()){g.i.disable();try{var d=g.qk.Gm(c),e=parseInt(c.getAttribute("x"),10),f=parseInt(c.getAttribute("y"),10);isNaN(e)||isNaN(f)||(a.G&&(e=-e),d.moveBy(e+50,f+50))}finally{g.i.enable()}d.select()}else a:{g.i.disable();try{var h=g.R.Wi(c,a),k=a.fc.Vb;if(g.Se&&k){g.navigation.bz(h,k.ra);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 t;t=n[d];d++){var v=t.Sa();if(1>=Math.abs(l-v.x)&&1>=Math.abs(m-v.y)){c=!0;break}}if(!c){var w=h.Me(!1);d=0;for(var I;I=w[d];d++)if(I.closest(g.wd,new g.g.V(l,m)).connection){c=!0;break}}c&&(l=a.G?l-g.wd:l+g.wd,m+=2*g.wd)}while(c);h.moveBy(l,m)}}finally{g.i.enable()}g.i.isEnabled()&&!h.ib&&g.i.Oa(new g.i.oo(h));h.select()}} function hd(a){if((a=a.re?a.Jj:a)&&!a.Ic&&a.sa&&a.sa.O){a=a.sa;var c=a.Fd.Ud;c&&c.Sf&&a.O.show(c.Sf)}}b.gi=function(a,c){g.qb.w.gi.call(this,a,c);hd(this)};b.Zf=function(a){g.qb.w.Zf.call(this,a);hd(this)};b.Md=function(a,c,d){a=g.qb.w.Md.call(this,a,c,d);hd(this);return a};function cd(a){a.Ix=a.cd&&a.H.parentNode?a.cd.Im():null;a.Hx=a.O?a.O.Im():a.sa?a.sa.Im():null}function Ya(a,c){return a.Ix&&a.Ix.contains(c.clientX,c.clientY)?g.hr:a.Hx&&a.Hx.contains(c.clientX,c.clientY)?g.Uv:g.Tv} b.ai=function(a){var c=this.Vg(a);c&&pb(c,a,this)};b.mv=function(a,c){a=g.g.nn(a,r(this),qa(this));a.x/=this.scale;a.y/=this.scale;this.Ux=g.g.V.Ek(c,a)};b.lc=function(){return null!=this.Ic&&this.Ic.lc()};function id(a){return a.options.Nc&&a.options.Nc.scrollbars||a.options.Nc&&a.options.Nc.Rj||a.options.Nc&&a.options.Nc.Ih||a.options.Hb&&a.options.Hb.controls||a.options.Hb&&a.options.Hb.Rj} b.Lc=function(){return this.options.Nc&&this.options.Nc.scrollbars||this.options.Nc&&this.options.Nc.Rj||this.options.Nc&&this.options.Nc.Ih||this.options.Hb&&this.options.Hb.Rj}; b.MG=function(a){if(g.$j.Mt())a.preventDefault(),a.stopPropagation();else{var c=this.options.Hb&&this.options.Hb.Rj,d=this.options.Nc&&this.options.Nc.Rj;if(c||d){var e=g.g.Cy(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.nn(a,r(this),qa(this)),this.zoom(c.x,c.y,e));a.preventDefault()}}}; function lc(a){var c=A(a,!1);a=xa(a,!1);c=c.concat(a);if(!c.length)return new g.g.Rect(0,0,0,0);a=Vc(c[0]);for(var d=1;da.bottom&&(a.bottom=e.bottom);e.lefta.right&&(a.right=e.right)}return a}b.XD=function(){this.Qc(!1);g.i.aa(!0);for(var a=A(this,!0),c=0,d=0,e;e=a[d];d++)if(e.Lc()){var f=e.Sa();e.moveBy(-f.x,c-f.y);Uc(e);c=e.Sa().y+Ra(e).height+g.xa.yr}g.i.aa(!1);this.Qc(!0)}; b.Jn=function(a){function c(I){if(I.qe())w=w.concat(p(I,!1));else{I=I.Kh(!1);for(var ca=0;caw.length?d():g.confirm(g.h.DELETE_ALL_BLOCKS.replace("%1",w.length),function(I){I&&d()})}};e.push(l);this.px&&this.px(e);g.Ga.show(a,e,this.G)}};function pa(a){if(a.options.Rb)pa(a.options.Rb);else{g.fn=a;document.activeElement&&document.activeElement.blur();try{r(a).focus()}catch(c){try{r(a).parentNode.setActive()}catch(d){r(a).parentNode.focus()}}}} b.zoom=function(a,c,d){if(!this.re&&!this.kj){d=Math.pow(this.options.Hb.dH,d);var e=this.scale*d;if(this.scale!=e){e>this.options.Hb.jn?d=this.options.Hb.jn/this.scale:ethis.options.Hb.jn?a=this.options.Hb.jn:this.options.Hb.ln&&af?g.ba.un(a,0,d.height+f):g.ba.un(a,f,d.height)}; g.ba.ND=function(a,c,d,e){if(e)return c=Math.max(c.right-d.width,a.left),Math.min(c,a.right-d.width);c=Math.min(c.left,a.right-d.width);return Math.max(c,a.left)};g.ba.OD=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};g.Hg=function(a){a.jc=this.Lm.bind(this);a.ki=this.mA.bind(this);g.Hg.w.constructor.call(this,a);this.rf=!1};g.g.object.X(g.Hg,g.Jl);b=g.Hg.prototype;b.Lm=function(){if(!this.isVisible())return null;try{var a=this.s.kb.getBBox()}catch(f){a={height:0,y:0,width:0,x:0}}var c=this.Nr,d=this.$c-2*this.Nr,e=this.yb;this.G||(e-=this.Nr);return{Cb:d,vb:e,Ld:a.height*this.s.scale+2*this.af,jf:a.width*this.s.scale+2*this.af,pc:-this.s.scrollY+a.y,gc:-this.s.scrollX,tc:a.y,Hc:a.x,Fc:c,qc:0}}; b.mA=function(a){var c=this.Lm();c&&("number"==typeof a.y&&(this.s.scrollY=-c.Ld*a.y),this.s.translate(this.s.scrollX+c.qc,this.s.scrollY+c.Fc))}; b.position=function(){if(this.isVisible()){var a=this.ub.jc();if(a){this.$c=a.Cb;var c=this.yb-this.Db,d=a.Cb-2*this.Db,e=this.ul==g.Eg,f=c+this.Db;f=["M "+(e?f:0)+",0"];f.push("h",e?-c:c);f.push("a",this.Db,this.Db,0,0,e?0:1,e?-this.Db:this.Db,this.Db);f.push("v",Math.max(0,d));f.push("a",this.Db,this.Db,0,0,e?0:1,e?this.Db:-this.Db,this.Db);f.push("h",e?c:-c);f.push("z");this.Rc.setAttribute("d",f.join(" "));c=this.$c;a=this.ub.Ia==this.ul?a.yA?this.ul==g.Jd?a.yA:a.vb-this.yb:this.ul==g.Jd?0:a.vb: this.ul==g.Jd?0:a.vb+a.qc-this.yb;this.H.setAttribute("width",this.yb);this.H.setAttribute("height",c);"svg"==this.H.tagName?g.g.o.Gn(this.H,"translate("+a+"px,0px)"):this.H.setAttribute("transform","translate("+a+",0)");this.yc&&(this.yc.Hu=new g.g.V(a,0),this.yc.resize(),ia(this.yc,this.yc.pd.x,this.yc.pd.y))}}};b.IH=function(a){var c=g.g.Cy(a);if(c.y){var d=this.Lm();c=d.pc-d.tc+c.y;c=Math.min(c,d.Ld-d.Cb);c=Math.max(c,0);this.yc.set(c);g.ba.Ha()}a.preventDefault();a.stopPropagation()}; function md(a,c,d){a.s.scale=a.ub.scale;for(var e=a.af,f=a.G?e:e+a.tl,h=0,k;k=c[h];h++)if("block"==k.type){k=k.block;for(var l=p(k,!1),m=0,n;n=l[m];m++)n.ec=!0;k.Ea();n=k.za();l=Ra(k);m=k.L?f-a.tl:f;k.moveBy(m,e);var t=a,v=k,w=h;m=g.g.o.K("rect",{"fill-opacity":0,x:a.G?m-l.width:m,y:e,height:l.height,width:l.width},null);m.Af=v;g.J.wk(m);t.s.kb.insertBefore(m,v.za());v.gy=m;t.gq[w]=m;t=a;t.Cd.push(g.ca(n,"mousedown",null,nd(t,k)));t.Cd.push(g.ca(m,"mousedown",null,nd(t,k)));t.Cd.push(g.jd(n,"mouseover", k,k.ap));t.Cd.push(g.jd(n,"mouseout",k,k.Bn));t.Cd.push(g.jd(m,"mouseover",k,k.ap));t.Cd.push(g.jd(m,"mouseout",k,k.Bn));e+=l.height+d[h]}else"button"==k.type&&(l=a,m=k.button,n=f,t=e,v=m.Ja(),m.moveTo(n,t),m.show(),l.Cd.push(g.ca(v,"mousedown",l,l.ai)),l.hm.push(m),e+=k.button.height+d[h])} b.Im=function(){if(!this.H)return null;var a=this.H.getBoundingClientRect(),c=a.left;if(this.ul==g.Jd)return new g.g.Rect(-1E9,1E9,-1E9,c+a.width);g.g.userAgent.Go&&this.ub&&this.ub.kj&&(a=this.ub.H.getBoundingClientRect().x,10>Math.abs(a-c)&&(c+=this.kM*this.ub.options.Rb.scale));return new g.g.Rect(-1E9,1E9,c,1E9)}; g.ds=function(a){this.s=a};b=g.ds.prototype;b.Ji=32;b.Kl=110;b.vr=20;b.Rl=20;b.H=null;b.cn=0;b.wl=0;b.Ja=function(){this.H=g.g.o.K("g",{},null);var a=String(Math.random()).substring(2);od(this,a);pd(this,a);this.s.Lc()&&qd(this,a);return this.H};b.Z=function(a){this.qh=this.vr+a;return this.qh+this.Kl};b.I=function(){this.H&&g.g.o.removeNode(this.H)}; b.position=function(){if(this.qh){var a=this.s.jc();a&&(this.cn=a.Ia==g.Jd||this.s.Od&&!this.s.G?a.vb+a.qc-this.Ji-this.Rl-g.La.xc:this.Rl+g.La.xc,a.Ia==g.Fi?(this.wl=this.qh,this.Rq.setAttribute("transform","translate(0, 34)"),this.Sq&&this.Sq.setAttribute("transform","translate(0, 77)")):(this.wl=a.Cb+a.Fc-this.Kl-this.qh,this.Rq.setAttribute("transform","translate(0, 43)"),this.Bv.setAttribute("transform","translate(0, 77)")),this.H.setAttribute("transform","translate("+this.cn+","+this.wl+")"))}}; function od(a,c){var d=a.s;a.Bv=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoomoutClipPath"+c},a.Bv);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.xd.width,height:g.xd.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+c+")"},a.Bv);a.setAttributeNS(g.g.o.ef,"xlink:href",d.options.wf+g.xd.url);g.ca(a,"mousedown",null,function(f){pa(d);jd(d,-1);g.Touch.Dh();f.stopPropagation();f.preventDefault()})} function pd(a,c){var d=a.s;a.Rq=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoominClipPath"+c},a.Rq);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.xd.width,height:g.xd.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+c+")"},a.Rq);a.setAttributeNS(g.g.o.ef,"xlink:href",d.options.wf+g.xd.url);g.ca(a,"mousedown",null,function(f){pa(d);jd(d,1);g.Touch.Dh();f.stopPropagation();f.preventDefault()})} function qd(a,c){var d=a.s;a.Sq=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoomresetClipPath"+c},a.Sq);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.xd.width,height:g.xd.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+c+")"},a.Sq);a.setAttributeNS(g.g.o.ef,"xlink:href",d.options.wf+g.xd.url);g.ca(a,"mousedown",null,function(f){pa(d);d.setScale(d.options.Hb.sA);g.g.o.rb(d.kb,"blocklyCanvasTransitioning");g.g.o.rb(d.zf,"blocklyCanvasTransitioning"); if(d.Lc()){var h=d.jc(),k=(h.jf-h.vb)/2,l=(h.Ld-h.Cb)/2;k=-k-h.Hc;l=-l-h.tc;d.scroll(k,l)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.");setTimeout(d.LE.bind(d),500);g.Touch.Dh();f.stopPropagation();f.preventDefault()})} g.Tc.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.Nv=function(a){this.pm=a;this.Ja()};b=g.Nv.prototype;b.bb=null;b.lf=null;b.pm=null;b.ii=1;b.On=null;b.Ja=function(){this.bb||(this.bb=g.g.o.K("svg",{xmlns:g.g.o.Yl,"xmlns:html":g.g.o.ak,"xmlns:xlink":g.g.o.ef,version:"1.1","class":"blocklyBlockDragSurface"},this.pm),this.lf=g.g.o.K("g",{},this.bb))};function hb(a,c){if(a.lf.childNodes.length)throw Error("Already dragging a block.");a.lf.appendChild(c);a.bb.style.display="block";a.On=new g.g.V(0,0)} b.Mj=function(a,c){this.On=new g.g.V(a*this.ii,c*this.ii);a=this.On.x;c=this.On.y;a=a.toFixed(0);c=c.toFixed(0);this.bb.style.display="block";g.g.o.Gn(this.bb,"translate3d("+a+"px, "+c+"px, 0px)")};b.At=function(){var a=g.g.Oe(this.bb);return new g.g.V(a.x/this.ii,a.y/this.ii)};b.cc=function(){return this.lf}; b.jp=function(a){a?a.appendChild(this.lf.firstChild):this.lf.removeChild(this.lf.firstChild);this.bb.style.display="none";if(this.lf.childNodes.length)throw Error("Drag group was not cleared.");this.On=null};g.Rh=function(a,c){g.SD();"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.Fe(c||{});var d=document.createElement("div");d.className="injectionDiv";a.appendChild(d);a=g.rm(d,c);var e=new g.Nv(d);d=new g.Qw(d);d=g.hE(a,c,e,d);g.xb.tb.iH(c.tb);g.KF(d);g.fn=d;g.rl(d);return d}; g.rm=function(a,c){a.setAttribute("dir","LTR");g.Dc.Gx=c.G;g.Tc.Rh(c.AF,c.wf);a=g.g.o.K("svg",{xmlns:g.g.o.Yl,"xmlns:html":g.g.o.ak,"xmlns:xlink":g.g.o.ef,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.Xx=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.Pg=f.id; c.Ly=g.xi.Ja(e,c.Ky,d);return a}; g.hE=function(a,c,d,e){c.Rb=null;var f=new g.qb(c,d,e);f.scale=c.Hb.sA;a.appendChild(f.Ja("blocklyMainBackground"));!c.Oy&&c.Xk&&(d=fd(f,"svg"),g.g.o.fj(d,a));c.Sy&&dd(f);c.Hb&&c.Hb.controls&&ed(f);f.Zb.subscribe(a,"workspace","background-color");f.translate(0,0);g.fn=f;c.readOnly||f.Lc()||Ba(f,function(h){if(!f.lc()&&!f.Lc()&&-1!=g.i.$A.indexOf(h.type)){var k=Object.create(null),l=f.jc(),m=f.scale;k.G=f.G;k.gc=l.gc/m;k.pc=l.pc/m;k.GA=(l.gc+l.vb)/m;k.FA=(l.pc+l.Cb)/m;id(f)?(l=lc(f),k.Hc=l.left,k.tc= l.top,k.wx=l.right,k.ux=l.bottom):(k.Hc=l.Hc/m,k.tc=l.tc/m,k.wx=(l.Hc+l.jf)/m,k.ux=(l.tc+l.Ld)/m);if(k.tck.FA||k.Hck.GA){l=null;h&&(l=g.i.cc(),g.i.aa(h.group));switch(h.type){case g.i.Bl:case g.i.Jv:var n=x(f,h.Gc);n=db(n);break;case g.i.to:case g.i.uo:n=f.mp[h.Uf]||null}if(n){m=Vc(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var t=k.pc,v=k.FA-m.height;v=Math.max(t,v);t=g.g.Rd.zk(t,m.top,v)-m.top;v=k.gc;var w=k.GA-m.width;k.G?v=Math.min(w,v):w=Math.max(v,w);n.moveBy(g.g.Rd.zk(v, m.left,w)-m.left,t)}h&&(h.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&g.i.aa(l))}}});g.rl(f);g.ba.Ja();g.D.Ja();g.J.Ja();return f}; g.KF=function(a){var c=a.options,d=r(a);g.ca(d.parentNode,"contextmenu",null,function(e){g.g.$p(e)||e.preventDefault()});d=g.ca(window,"resize",null,function(){g.wc(!0);g.rl(a)});a.Aq=d;g.Rh.FD();c.Xk&&(a.sa?a.sa.Z(a):a.O&&(a.O.Z(a),a.O.show(c.Xk.childNodes),a.O.yc.set(0)));d=g.La.xc;c.Sy&&(d=a.cd.Z(d));c.Hb&&c.Hb.controls&&a.Tj.Z(d);c.Nc&&c.Nc.scrollbars?(a.Xb=new g.nk(a),a.Xb.resize()):a.ki({x:.5,y:.5});c.CF&&g.Rh.XF(c.wf,a)}; g.Rh.FD=function(){g.FE||(g.ca(document,"scroll",null,function(){for(var a=g.Nb.getAll(),c=0,d;d=a[c];c++)d.Yn&&d.Yn()}),g.ca(document,"keydown",null,g.Eu),g.jd(document,"touchend",null,g.Zh),g.jd(document,"touchcancel",null,g.Zh),g.g.userAgent.ck&&g.ca(window,"orientationchange",document,function(){g.rl(g.Gb())}));g.FE=!0}; g.Rh.XF=function(a,c){function d(){for(;f.length;)g.Ua(f.pop());e.preload()}var e=c.Rf;e.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");e.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");e.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var f=[];f.push(g.ca(document,"mousemove",null,d,!0));f.push(g.ca(document,"touchstart",null,d,!0))};g.fe=function(a,c){this.EA=c||"";this.cA=Object.create(null);if(a)for(a=a.split(","),c=0;c1'), e.appendChild(d),c.push(e));if(g.S.variables_get){a.sort(g.bm.ox);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.Hm(f)),c.push(e)}}return c}; g.N.oy=function(a){a=a.Ug();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=!!Ed(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(Fd,1)}function Ed(a){var c=Gd;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 Hd(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 Fd(){if(!xd){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.Za=function(a,c){return" "+a+","+c+" "};g.g.A.curve=function(a,c){return" "+a+c.join("")};g.g.A.moveTo=function(a,c){return" M "+a+","+c+" "};g.g.A.moveBy=function(a,c){return" m "+a+","+c+" "};g.g.A.lineTo=function(a,c){return" l "+a+","+c+" "};g.g.A.line=function(a){return" l"+a.join("")};g.g.A.ea=function(a,c){return" "+a+" "+c+" "};g.g.A.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};g.m.ui=function(){this.Jf=0;this.SC=3;this.If=5;this.mw=8;this.vd=10;this.Gw=this.If;this.Sr=15;this.Zl=5;this.zh=8;this.zC=15;this.yC=4;this.vC=12;this.AB=16;this.Db=8;this.Po=15;this.XC=0;this.YC=20;this.YA=4;this.VC=15;this.WC=100;this.UC=15;this.xr=24;this.CB=14.5;this.BB=this.Sr+11;this.EB=2;this.DB=this.xr;this.Cw=g.g.A.moveBy(0,0);this.$B=12;this.aC=6};b=g.m.ui.prototype; b.Z=function(){this.fk=this.cu();this.hk=this.du();this.Dg=this.gu();this.Bi=this.fu();var a=this.Db,c=g.g.A.arc("a","0 0,0",a,g.g.A.Za(-a,a)),d=g.g.A.arc("a","0 0,0",a,g.g.A.Za(a,a));this.Nl={width:a,height:a,Lu:c,pq:d};c=this.Db;a=g.g.A.moveBy(0,c)+g.g.A.arc("a","0 0,1",c,g.g.A.Za(c,-c));c=g.g.A.arc("a","0 0,1",c,g.g.A.Za(-c,-c));this.qw={wv:a,us:c}};b.cu=function(){var a=this.$B,c=this.aC,d=g.g.A.line([g.g.A.Za(6,3),g.g.A.Za(-12,6),g.g.A.Za(6,3)]);return{height:a,width:c,path:d}}; b.gu=function(){var a=this.VC,c=this.WC,d=g.g.A.curve("c",[g.g.A.Za(30,-a),g.g.A.Za(70,-a),g.g.A.Za(c,0)]);return{height:a,width:c,path:d}};b.fu=function(){function a(h){h=h?-1:1;var k=-h,l=d/2,m=g.g.A.Za(c,h*l);return g.g.A.curve("c",[g.g.A.Za(0,h*(l+2.5)),g.g.A.Za(-c,k*(l+.5)),g.g.A.Za(-c,h*l)])+g.g.A.curve("s",[g.g.A.Za(c,2.5*k),m])}var c=this.zh,d=this.Sr,e=a(!0),f=a(!1);return{width:c,height:d,Ve:f,sn:e}}; b.du=function(){function a(k){return g.g.A.line([g.g.A.Za(k*e,d),g.g.A.Za(3*k,0),g.g.A.Za(k*e,-d)])}var c=this.zC,d=this.yC,e=(c-3)/2,f=a(1),h=a(-1);return{width:c,height:d,bi:f,Qz:h}};g.m.u={NONE:0,ze:1,Zv:2,aw:4,Or:8,Iv:16,ew:32,Xv:64,zg:128,cw:256,Dw:512,jB:1024,Gr:2048,zr:4096,DC:8192,gr:16384,qr:32768,pr:65536,Lr:131072,Kr:262144,iw:524288,Uo:1048576,Vr:2097152,$q:4194304,dw:8388608};g.m.u.uJ=g.m.u.qr|g.m.u.pr;g.m.u.ZK=g.m.u.Lr|g.m.u.Kr;g.m.u.uu=16777216;g.m.u.Qb=function(){g.m.u.hasOwnProperty(void 0)||(g.m.u[void 0]=g.m.u.uu,g.m.u.uu<<=1);return g.m.u[void 0]};g.m.u.Ym=function(a){return a.type&g.m.u.ze};g.m.u.jj=function(a){return a.type&g.m.u.Zv}; g.m.u.Tk=function(a){return a.type&g.m.u.aw};g.m.u.uf=function(a){return a.type&g.m.u.Or};g.m.u.dM=function(a){return a.type&g.m.u.ew};g.m.u.tf=function(a){return a.type&g.m.u.zg};g.m.u.Xm=function(a){return a.type&g.m.u.Xv};g.m.u.Sh=function(a){return a.type&g.m.u.cw};g.m.u.an=function(a){return a.type&g.m.u.Dw};g.m.u.Vk=function(a){return a.type&g.m.u.Gr};g.m.u.Vh=function(a){return a.type&g.m.u.zr};g.m.u.SF=function(a){return a.type&(g.m.u.Gr|g.m.u.zr)};g.m.u.Uh=function(a){return a.type&g.m.u.pr}; g.m.u.fM=function(a){return a.type&g.m.u.Kr};g.m.u.$m=function(a){return a.type&g.m.u.qr};g.m.u.gM=function(a){return a.type&g.m.u.Lr};g.m.u.cM=function(a){return a.type&g.m.u.gr};g.m.u.gz=function(a){return a.type&g.m.u.iw};g.m.u.hM=function(a){return a.type&g.m.u.Uo};g.m.u.bM=function(a){return a.type&g.m.u.Iv};g.m.u.bq=function(a){return a.type&g.m.u.Vr};g.m.u.Up=function(a){return a.type&g.m.u.$q};g.m.u.iM=function(a){return a.type&(g.m.u.Vr|g.m.u.$q)};g.m.u.eM=function(a){return a.type&g.m.u.dw};g.m.vh=function(a){this.height=this.width=0;this.type=g.m.u.NONE;this.Ch=this.Wa=0;this.C=a;this.Te=this.C.Po};g.m.ta=function(a,c){g.m.ta.w.constructor.call(this,a);this.Fs=c;a:switch(a=this.C,c.type){case g.Ra:case g.bf:c=a.Bi;break a;case g.cf:case g.Xa:c=a.hk;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=g.m.u.jB};g.g.object.X(g.m.ta,g.m.vh);g.m.Er=function(a,c){g.m.Er.w.constructor.call(this,a,c);this.type|=g.m.u.DC;this.height=this.shape.height;this.width=this.shape.width;this.Ke=this.C.Zl;this.we=this.width};g.g.object.X(g.m.Er,g.m.ta); g.m.Hr=function(a,c){g.m.Hr.w.constructor.call(this,a,c);this.type|=g.m.u.Gr;this.height=this.shape.height;this.width=this.shape.width};g.g.object.X(g.m.Hr,g.m.ta);g.m.Ar=function(a,c){g.m.Ar.w.constructor.call(this,a,c);this.type|=g.m.u.zr;this.height=this.shape.height;this.width=this.shape.width};g.g.object.X(g.m.Ar,g.m.ta);g.m.Pl=function(a,c){g.m.Pl.w.constructor.call(this,a,c.connection);this.type|=g.m.u.zg;this.input=c;this.align=c.align;(this.Oi=c.connection&&C(c.connection)?C(c.connection):null)?(a=Ra(this.Oi),this.nm=a.width,this.np=a.height):this.np=this.nm=0;this.connection=c.connection;this.Ke=0};g.g.object.X(g.m.Pl,g.m.ta); g.m.sh=function(a,c){g.m.sh.w.constructor.call(this,a,c);this.type|=g.m.u.cw;this.Oi?(this.width=this.nm,this.height=this.np):(this.height=this.C.BB,this.width=this.shape.width+this.C.CB);this.Ke=this.C.Zl;this.om=this.shape.height;this.Fh=this.shape.width};g.g.object.X(g.m.sh,g.m.Pl);g.m.yh=function(a,c){g.m.yh.w.constructor.call(this,a,c);this.type|=g.m.u.Dw;this.height=this.Oi?this.np+this.C.XC:this.C.DB;this.width=this.C.Po+this.shape.width};g.g.object.X(g.m.yh,g.m.Pl); g.m.Eo=function(a,c){g.m.Eo.w.constructor.call(this,a,c);this.type|=g.m.u.Xv;this.height=this.Oi?this.np-2*this.C.Zl:this.shape.height;this.width=this.shape.width+this.C.EB;this.Ke=this.C.Zl;this.om=this.shape.height;this.Fh=this.shape.width};g.g.object.X(g.m.Eo,g.m.Pl);g.m.Hd=function(a,c){g.m.Hd.w.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=g.m.u.aw;a=new g.g.ge(g.Hd.prototype.Wo,g.Hd.prototype.Wo-2);this.height=a.height;this.width=a.width};g.g.object.X(g.m.Hd,g.m.vh);g.m.nr=function(a){g.m.nr.w.constructor.call(this,a);this.type|=g.m.u.iw;this.height=this.C.fk.height;this.width=this.C.fk.width};g.g.object.X(g.m.nr,g.m.vh); g.m.oa=function(a,c){g.m.oa.w.constructor.call(this,a);this.$x=c;this.nd=c.Gf&&!!c.B&&c.B.nd();this.SE=c.wy();this.type|=g.m.u.ze;a=this.$x.Wg();this.height=a.height;this.width=a.width};g.g.object.X(g.m.oa,g.m.vh);g.m.lr=function(a){g.m.lr.w.constructor.call(this,a);this.type|=g.m.u.Zv;this.height=this.C.Dg.height;this.width=this.C.Dg.width;this.tk=this.height};g.g.object.X(g.m.lr,g.m.vh); g.m.Zo=function(a,c){g.m.Zo.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.m.u.Lr:g.m.u.qr)|g.m.u.gr;this.width=this.height=this.C.Jf};g.g.object.X(g.m.Zo,g.m.vh);g.m.Vo=function(a,c){g.m.Vo.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.m.u.Kr:g.m.u.pr)|g.m.u.gr;this.width=this.C.Db;this.height=this.C.Db/2};g.g.object.X(g.m.Vo,g.m.vh);g.m.dk=function(a,c){g.m.dk.w.constructor.call(this,a);this.type=this.type|g.m.u.Or|g.m.u.ew;this.width=c;this.height=this.C.UC};g.g.object.X(g.m.dk,g.m.vh);g.m.Di=function(a){this.type=g.m.u.Uo;this.elements=[];this.Wa=this.Sc=this.qg=this.minWidth=this.minHeight=this.width=this.height=0;this.Qy=this.Np=this.It=this.Ad=this.$i=!1;this.C=a;this.Te=this.C.Po};g.m.Di.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function Id(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.m.u.tf(d))return d;return null}g.m.Di.prototype.nv=function(){return!0};g.m.Di.prototype.Yx=function(){return!0}; function Jd(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.m.u.uf(d))return d;return null}g.m.pk=function(a){g.m.pk.w.constructor.call(this,a);this.type|=g.m.u.Vr;this.tk=this.Jg=0;this.BF=!1;this.connection=null};g.g.object.X(g.m.pk,g.m.Di);g.m.pk.prototype.Jt=function(a){var c=a.Yg?"cap"===a.Yg:g.xa.Dg,d=a.$&&C(a.$);return!!a.L||c||(d?q(d)==a:!1)}; g.m.pk.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.m.u.uf(f)||(g.m.u.jj(f)?d=Math.max(d,f.tk):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.Jg=this.tk=d;this.qg=this.width};g.m.pk.prototype.nv=function(){return!1};g.m.Uj=function(a){g.m.Uj.w.constructor.call(this,a);this.type|=g.m.u.$q;this.Ry=!1;this.connection=null;this.Li=this.ym=0};g.g.object.X(g.m.Uj,g.m.Di); g.m.Uj.prototype.Jt=function(a){return!!a.L||!!q(a)};g.m.Uj.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.m.u.uf(f)||(g.m.u.Vh(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.ym=d;this.qg=this.width};g.m.Uj.prototype.nv=function(){return!1}; g.m.Yo=function(a,c,d){g.m.Yo.w.constructor.call(this,a);this.type=this.type|g.m.u.Or|g.m.u.Iv;this.width=d;this.height=c;this.ly=!1;this.qg=0;this.elements=[new g.m.dk(this.C,d)]};g.g.object.X(g.m.Yo,g.m.Di);g.m.Yo.prototype.measure=function(){};g.m.ek=function(a){g.m.ek.w.constructor.call(this,a);this.type|=g.m.u.dw;this.sx=0};g.g.object.X(g.m.ek,g.m.Di); g.m.ek.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,c=0,d;d=this.elements[c];c++)this.width+=d.width,g.m.u.tf(d)&&(g.m.u.an(d)?a+=d.nm:g.m.u.Xm(d)&&0!=d.nm&&(a+=d.nm-d.Fh)),g.m.u.uf(d)||(this.height=Math.max(this.height,d.height));this.sx=a;this.qg=this.width+a};g.m.ek.prototype.Yx=function(){return!this.$i&&!this.Ad};g.m.wh=function(a,c){this.T=c;this.hh=a;this.C=this.hh.C;this.L=c.L?new g.m.Er(this.C,c.L):null;this.Rt=qc(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.Th=c.Th();this.G=c.G;this.Gj=this.width=this.xl=this.height=0;this.rows=[];this.Vy=[];this.oc=new g.m.pk(this.C);this.Ob=new g.m.Uj(this.C);this.Fq=this.we=0};b=g.m.wh.prototype; b.measure=function(){var a=this.T.Yg?"cap"===this.T.Yg:g.xa.Dg,c=!!this.T.$;this.oc.Jt(this.T)?this.oc.elements.push(new g.m.Zo(this.C)):this.oc.elements.push(new g.m.Vo(this.C));a?(a=new g.m.lr(this.C),this.oc.elements.push(a),this.oc.Jg=a.tk):c&&(this.oc.BF=!0,this.oc.connection=new g.m.Hr(this.C,this.T.$),this.oc.elements.push(this.oc.connection));this.T.P.length&&this.T.P[0].type==g.Xa&&!this.T.isCollapsed()?this.oc.minHeight=this.C.vd:this.oc.minHeight=this.C.If;this.rows.push(this.oc);a=new g.m.ek(this.C); var d=Wa(this.T);if(d.length){c=0;for(var e;e=d[c];c++){var f=new g.m.Hd(this.C,e);this.isCollapsed&&e.lx?this.Vy.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.T.P[c];c++)if(d.isVisible()){!e||d.type!=g.Xa&&e.type!=g.Xa&&(d.type!=g.Ra&&d.type!=g.xg||this.Rt)||(this.rows.push(a),a=new g.m.ek(this.C));for(e=0;f=d.Na[e];e++)a.elements.push(new g.m.oa(this.C,f,d));this.Uw(d,a);e=d}this.isCollapsed&&(a.Qy=!0,a.elements.push(new g.m.nr(this.C)));(a.elements.length||a.Np)&&this.rows.push(a);this.Ob.Ry= !!this.T.U;this.Ob.minHeight=this.T.P.length&&this.T.P[this.T.P.length-1].type==g.Xa?this.C.vd:this.C.If-1;this.Ob.Jt(this.T)?this.Ob.elements.push(new g.m.Zo(this.C)):this.Ob.elements.push(new g.m.Vo(this.C));this.Ob.Ry&&(this.Ob.connection=new g.m.Ar(this.C,this.T.U),this.Ob.elements.push(this.Ob.connection));this.rows.push(this.Ob);for(a=0;c=this.rows[a];a++){d=c.elements;c.elements=[];c.nv()&&c.elements.push(new g.m.dk(this.C,this.Fp(null,d[0])));for(e=0;ea.Bd&&(a.la+=g.g.A.ea("V",c.Sc+c.height-a.Bd)))};g.ma.Ci=function(a){this.Ij=a;this.Qn=g.g.o.K("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Ij);this.ql=g.g.o.K("path",{"class":"blocklyPath"},this.Ij);this.Sn=g.g.o.K("path",{"class":"blocklyPathLight"},this.Ij)};g.ma.Ci.prototype.cv=function(a,c){this.ql.setAttribute("d",a);this.Qn.setAttribute("d",a);this.Sn.setAttribute("d",c)}; g.ma.Ci.prototype.mt=function(){this.ql.setAttribute("transform","scale(-1 1)");this.Sn.setAttribute("transform","scale(-1 1)");this.Qn.setAttribute("transform","translate(1,1) scale(-1 1)")};g.ma.sh=function(a,c){g.ma.sh.w.constructor.call(this,a,c);this.Oi&&(this.width+=this.C.td,this.height+=this.C.td)};g.g.object.X(g.ma.sh,g.m.sh);g.ma.yh=function(a,c){g.ma.yh.w.constructor.call(this,a,c);this.Oi&&(this.height+=this.C.td)};g.g.object.X(g.ma.yh,g.m.yh);g.ma.wh=function(a,c){g.ma.wh.w.constructor.call(this,a,c)};g.g.object.X(g.ma.wh,g.m.wh);b=g.ma.wh.prototype;b.Uw=function(a,c){this.Rt&&a.type==g.Ra?(c.elements.push(new g.ma.sh(this.C,a)),c.It=!0):a.type==g.Xa?(c.elements.push(new g.ma.yh(this.C,a)),c.Ad=!0):a.type==g.Ra?(c.elements.push(new g.m.Eo(this.C,a)),c.$i=!0):a.type==g.xg&&(c.Np=!0)}; b.Fp=function(a,c){if(!a)return c&&g.m.u.Ym(c)&&c.nd?this.C.If:c&&g.m.u.Sh(c)?this.C.mw:c&&g.m.u.an(c)?this.C.YC:this.C.vd;if(!g.m.u.tf(a)&&!c)return g.m.u.Ym(a)&&a.nd?this.C.If:g.m.u.Tk(a)?2*this.C.vd+1:g.m.u.jj(a)?this.C.Jf:g.m.u.SF(a)?this.C.vd:g.m.u.Uh(a)?this.C.vC:g.m.u.gz(a)?this.C.Jf:this.C.vd;if(g.m.u.tf(a)&&!c){if(g.m.u.Xm(a))return this.C.Jf;if(g.m.u.Sh(a))return this.C.vd;if(g.m.u.an(a))return this.C.Jf}if(!g.m.u.tf(a)&&c&&g.m.u.tf(c)){if(a.nd){if(g.m.u.Sh(c)||g.m.u.Xm(c))return this.C.SC}else{if(g.m.u.Sh(c)|| g.m.u.Xm(c))return this.C.mw;if(g.m.u.an(c))return this.C.vd}return this.C.vd-1}if(g.m.u.Tk(a)&&c&&!g.m.u.tf(c))return this.C.vd;if(g.m.u.Sh(a)&&c&&!g.m.u.tf(c))return c.nd?this.C.If:this.C.vd;if(g.m.u.$m(a)&&c){if(g.m.u.jj(c))return this.C.Jf;if(g.m.u.Vk(c))return c.Te;if(g.m.u.Vh(c))return a=(this.G?1:-1)*this.C.td/2,c.Te+a}if(g.m.u.Uh(a)&&c){if(g.m.u.Vk(c))return c.Te-this.C.Db;if(g.m.u.Vh(c))return a=(this.G?1:-1)*this.C.td/2,c.Te-this.C.Db+a}return!g.m.u.tf(a)&&c&&!g.m.u.tf(c)&&a.nd==c.nd||c&& g.m.u.gz(c)?this.C.vd:this.C.If};b.fs=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(g.m.u.uf(e)){d=e;break a}d=null}e=Jd(a);if(a.$i||a.Ad)a.qg+=c;var f=Id(a);f?f.align==g.Xq?e.width+=c:f.align==g.Dv?(d.width+=c/2,e.width+=c/2):f.align==g.fd&&(d.width+=c):e.width+=c;a.width+=c};b.Ey=function(a,c){return g.m.u.bq(a)&&g.m.u.Up(c)?this.C.AB:g.m.u.bq(a)||g.m.u.Up(c)?this.C.Jf:a.$i&&c.$i?this.C.vd:!a.Ad&&c.Ad?this.C.YA:a.Ad&&c.Ad||!a.Ad&&c.Np?this.C.vd:this.C.If}; b.vy=function(a,c){if(g.m.u.uf(c))return a.Sc+c.height/2;if(g.m.u.Up(a))return a=a.Sc+a.height-a.ym,g.m.u.Vh(c)?a+c.height/2:a-c.height/2;if(g.m.u.bq(a))return g.m.u.jj(c)?a.Jg-c.height/2:a.Jg+c.height/2;var d=a.Sc;g.m.u.Ym(c)||g.m.u.Tk(c)?(d+=c.height/2,(a.It||a.Ad)&&c.height+this.C.Gw<=a.height&&(d+=this.C.Gw)):d=g.m.u.Sh(c)?d+c.height/2:d+a.height/2;return d}; b.ay=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.Sc=c;e.Wa=this.we;c+=e.height;a=Math.max(a,e.qg);var f=c-this.oc.tk;e==this.Ob&&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},su:function(){10>O?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+vd+"&level="+(O+1):R.Pp()},Xy:function(a,c){if(a){var d=a.match(/^block_id_([^']+)$/);d&&(a=d[1])}var e=a;a=G;if(void 0===c){for(var f=0;d= a.Rm[f];f++)d.lh(!1);a.Rm.length=0}if(d=e?x(a,e):null)(c=void 0===c||c)?-1==a.Rm.indexOf(d)&&a.Rm.push(d):g.g.cp(a.Rm,d),d.lh(c)},LF:function(a,c){a=document.getElementById(a);a.firstChild||(a=g.Rh(a,{rtl:yd(),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),g.R.Hh(g.R.mi(c),a))},sH:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},Sg:function(a){if("click"==a.type&&"touchend"==R.Sg.Ru&&R.Sg.Pu+2E3>Date.now()||R.Sg.Ru==a.type&&R.Sg.Pu+400>Date.now())return a.preventDefault(), a.stopPropagation(),!0;R.Sg.Ru=a.type;R.Sg.Pu=Date.now();return!1}};R.Sg.Ru=null;R.Sg.Pu=0;R.HF=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};R.IF=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.jA;R.getCode=R.ut;R.getWorkspace=R.Lk;var Q={hj:!1,Kx:null,sp:null,ml:function(a,c,d,e,f,h){function k(){Q.hj&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);Q.hj&&Q.pe(!1);g.Gb()&&g.wc(!0);Q.hj=!0;Q.Kx=c;Q.sp=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.Os=g.jd(e,"mousedown",null,Q.wE));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(Q.fq(c,!1,.2),Q.fq(l,!0,.8),setTimeout(k,175)):k()},Lx:0,Mx:0,wE:function(a){Q.Rs();if(!g.g.lj(a)){var c=document.getElementById("dialog");Q.Lx=c.offsetLeft-a.clientX;Q.Mx=c.offsetTop-a.clientY;Q.Qs=g.jd(document,"mouseup",null,Q.Rs);Q.Ps=g.jd(document,"mousemove",null,Q.xE);a.stopPropagation()}},xE:function(a){var c=document.getElementById("dialog"), d=Q.Lx+a.clientX;a=Q.Mx+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"},Rs:function(){Q.Qs&&(g.Ua(Q.Qs),Q.Qs=null);Q.Ps&&(g.Ua(Q.Ps),Q.Ps=null)},pe:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(Q.hj){Q.Rs();Q.Os&&(g.Ua(Q.Os),Q.Os=null);Q.hj=!1;Q.sp&&Q.sp();Q.sp=null;var d=!1===a? null:Q.Kx;a=document.getElementById("dialog");var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(Q.fq(a,!1,.8),Q.fq(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)}},fq: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.XE(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},XE:function(a){var c=g.g.style.Mm(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},uA: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.pe,!0);c.addEventListener("touchend",Q.pe,!0);c=document.getElementById("doneOk");c.addEventListener("click",R.su,!0);c.addEventListener("touchend",R.su,!0);Q.ml(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",Q.qx,!0)});document.body.addEventListener("keydown",Q.qx,!0);document.getElementById("dialogDoneText").textContent=d},Jx:function(a){!Q.hj||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(Q.pe(!0),a.stopPropagation(),a.preventDefault())}, kv:function(){document.body.addEventListener("keydown",Q.Jx,!0)},ov:function(){document.body.removeEventListener("keydown",Q.Jx,!0)},qx:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)Q.pe(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&R.su()},Sw:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)Q.pe(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&R.Pp()},ny:function(a){27==a.keyCode?Q.pe(!0):13==a.keyCode&&Q.qt()},qt: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.uA(null,h)}};f.send(c.join("&"));Q.pe(!0)}else a.value="",a.focus()}}; window.BlocklyDialogs=Q;Q.hideDialog=Q.pe;var Zd,S;function $d(){if(10==O)return 1a.length)){e=[];for(f=0;fthis.En)return null;var a=this.getOptions(!0)[this.En][0];return"object"==typeof a?a.alt:a}; g.Da.DA=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.co-d)>c)a.yl=e,a.co=d,a.Ub.Fn(e+c,d+c),a.Pn.setAttribute("width",a.yl),a.Pn.setAttribute("height",a.co);a.T.G&&a.s.kb.setAttribute("transform","translate("+a.yl+",0)");a.s.resize()} b.Yb=function(a){if(a!=this.isVisible())if(g.i.Oa(new g.i.yd(this.T,"mutatorOpen",!a,a)),a){this.Ub=new g.na(this.T.v,this.Hs(),this.T.Yd,this.dj,null,null);Ga(this.Ub,this.T.id);if(a=this.s.options.Xk)this.s.O.Z(this.s),this.s.O.show(a.childNodes);this.jh=this.T.Yf(this.s);a=p(this.jh,!1);for(var c=0,d;d=a[c];c++)d.Ea();this.jh.Dq(!1);this.jh.Ls=!1;this.s.O?(a=2*this.s.O.Db,c=Cb(this.s).cg()+a):c=a=16;this.T.G&&(c=-c);this.jh.moveBy(c,a);if(this.T.Dn){var e=this;this.T.Dn(this.jh);this.Eq=function(){e.T.Dn(e.jh)}; Ba(this.T.v,this.Eq)}ce(this);Ba(this.s,this.KH.bind(this));this.Xe()}else this.Pn=null,this.s.I(),this.jh=this.s=null,this.Ub.I(),this.Ub=null,this.co=this.yl=0,this.Eq&&(Ca(this.T.v,this.Eq),this.Eq=null)}; b.KH=function(a){if(a.type!=g.i.$o&&(a.type!=g.i.si||"disabled"!=a.element)){if(!this.s.lc()){a=A(this.s,!1);for(var c=0,d;d=a[c];c++){var e=d.Sa(),f=Ra(d);20>e.y+f.height&&d.moveBy(0,20-f.height-e.y)}}if(this.jh.v==this.s){g.i.aa(!0);d=this.T;a=(a=d.Pa())&&g.R.Nd(a);c=d.ga;d.ga=!1;d.Vf(this.jh);d.ga=c;d.Qd();c=(c=d.Pa())&&g.R.Nd(c);if(a!=c){g.i.Oa(new g.i.sg(d,"mutation",null,a,c));var h=g.i.cc();setTimeout(function(){g.i.aa(h);d.Pb();g.i.aa(!1)},g.mo)}d.ga&&d.Ea();a!=c&&g.Se&&g.navigation.jG(d); this.s.lc()||ce(this);g.i.aa(!1)}}};b.hF=function(){return{Cb:this.co,vb:this.yl-Cb(this.s).cg(),Fc:0,qc:this.s.G?0:Cb(this.s).cg()}};b.I=function(){this.T.Sd=null;g.Hd.prototype.I.call(this)};g.ac.yj=function(a,c,d){if(!a||!a.B.v)return!1;d=E(c,d).connection;var e=C(a);return e&&e!=c||d.ka==a?!1:(d.isConnected()&&d.disconnect(),d.connect(a),!0)};g.ac.by=function(a){var c=null;if(a&&a.options){var d=a.options.Rb;a.re?d&&d.options&&(c=d.options.Rb):d&&(c=d)}return c};g.S.au={};g.W.nC={};g.W.nC.bk=260; g.Gh([{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.S.lists_create_with={Z:function(){this.Wb=g.h.LISTS_CREATE_WITH_HELPURL;K(this,"list_blocks");this.Lb=3;this.dd();this.bd(!0,"Array");this.jl(new g.ac(["lists_create_with_item"]));this.Ta(g.h.LISTS_CREATE_WITH_TOOLTIP)},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("items",this.Lb);return a},lb:function(a){this.Lb=parseInt(a.getAttribute("items"),10);this.dd()},Yf:function(a){var c=a.fg("lists_create_with_container");c.Qd();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.Gh([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks", tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);g.W.ee.Ur={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};g.Y.register("logic_op_tooltip",g.Y.ep("OP",g.W.ee.Ur)); g.W.ee.lB={le:0,mf:0,li:!0,Pa:function(){if(!this.le&&!this.mf)return null;var a=g.g.xml.createElement("mutation");this.le&&a.setAttribute("elseif",this.le);this.mf&&a.setAttribute("else",1);return a},lb:function(a){this.le=parseInt(a.getAttribute("elseif"),10)||0;this.mf=parseInt(a.getAttribute("else"),10)||0;this.WG()},Yf:function(a){var c=a.fg("controls_if_if");c.Qd();for(var d=c.U,e=1;e<=this.le;e++){var f=a.fg("controls_if_elseif");f.Qd();d.connect(f.$);d=f.U}this.mf&&(a=a.fg("controls_if_else"), a.Qd(),d.connect(a.$));return c},Vf:function(a){a=C(a.U);this.mf=this.le=0;for(var c=[null],d=[null],e=null;a;){switch(a.type){case "controls_if_elseif":this.le++;c.push(a.bo);d.push(a.nh);break;case "controls_if_else":this.mf++;e=a.nh;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.U&&C(a.U)}this.dd();this.aA(c,d,e)},Dn:function(a){a=C(a.U);for(var c=1;a;){switch(a.type){case "controls_if_elseif":var d=E(this,"IF"+c),e=E(this,"DO"+c);a.bo=d&&d.connection.ka;a.nh=e&&e.connection.ka; c++;break;case "controls_if_else":e=E(this,"ELSE");a.nh=e&&e.connection.ka;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.U&&C(a.U)}},WG:function(){var a=[null],c=[null],d=null;E(this,"ELSE")&&(d=E(this,"ELSE").connection.ka);for(var e=1;E(this,"IF"+e);){var f=E(this,"DO"+e);a.push(E(this,"IF"+e).connection.ka);c.push(f.connection.ka);e++}this.dd();this.aA(a,c,d)},dd:function(){E(this,"ELSE")&&this.pb("ELSE");for(var a=1;E(this,"IF"+a);)this.pb("IF"+a),this.pb("DO"+a),a++;for(a= 1;a<=this.le;a++)H(L(this,"IF"+a).wa("Boolean"),g.h.CONTROLS_IF_MSG_ELSEIF),H(this.Qf(g.Xa,"DO"+a),g.h.CONTROLS_IF_MSG_THEN);this.mf&&H(this.Qf(g.Xa,"ELSE"),g.h.CONTROLS_IF_MSG_ELSE)},aA:function(a,c,d){for(var e=1;e<=this.le;e++)g.ac.yj(a[e],this,"IF"+e),g.ac.yj(c[e],this,"DO"+e);g.ac.yj(d,this,"ELSE")}};g.Y.An("controls_if_mutator",g.W.ee.lB,null,["controls_if_elseif","controls_if_else"]); g.W.ee.mB=function(){this.Ta(function(){if(this.le||this.mf){if(!this.le&&this.mf)return g.h.CONTROLS_IF_TOOLTIP_2;if(this.le&&!this.mf)return g.h.CONTROLS_IF_TOOLTIP_3;if(this.le&&this.mf)return g.h.CONTROLS_IF_TOOLTIP_4}else return g.h.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};g.Y.register("controls_if_tooltip",g.W.ee.mB); g.W.ee.jC={onchange:function(a){this.vn||(this.vn=[null,null]);var c=N(this,"A"),d=N(this,"B");c&&d&&!oc(c.L,d.L)&&(g.i.aa(a.group),a=this.vn[0],a!==c&&(D(c),a&&!a.ib&&E(this,"A").connection.connect(a.L)),c=this.vn[1],c!==d&&(D(d),c&&!c.ib&&E(this,"B").connection.connect(c.L)),this.Pb(),g.i.aa(!1));this.vn[0]=N(this,"A");this.vn[1]=N(this,"B")}};g.W.ee.iC=function(){this.eg(g.W.ee.jC)};g.Y.register("logic_compare",g.W.ee.iC); g.W.ee.kC={Wz:null,onchange:function(a){var c=N(this,"THEN"),d=N(this,"ELSE"),e=this.L.ka;if((c||d)&&e)for(var f=0;2>f;f++){var h=1==f?c:d;h&&!oc(h.L,e)&&(g.i.aa(a.group),e===this.Wz?(D(this),e.B.Pb()):(D(h),h.Pb()),g.i.aa(!1))}this.Wz=e}};g.Y.wq("logic_ternary",g.W.ee.kC);g.zb=function(a,c,d){this.ol=!0;null==a&&(a="");g.zb.w.constructor.call(this,a,c,d)};g.g.object.X(g.zb,g.oa);g.zb.pa=function(a){var c=g.g.nc(a.text);return new g.zb(c,void 0,a)};g.zb.prototype.Ei=!0;g.zb.Yv=11;g.zb.Lv=4;b=g.zb.prototype;b.xo="text";b.ld=function(a){g.zb.w.ld.call(this,a);"boolean"==typeof a.spellcheck&&(this.ol=a.spellcheck)};b.Qg=function(a){return null===a||void 0===a?null:String(a)}; b.Tx=function(){if(this.Sk){this.aq=!1;var a=this.$a;this.$a=this.kc.BA;this.B&&g.i.isEnabled()&&g.i.Oa(new g.i.sg(this.B,"field",this.name||null,a,this.$a))}};b.Rg=function(a){this.aq=!0;this.$a=a;this.Sk||(this.sf=!0)};b.fh=function(){g.zb.w.fh.call(this);this.Sk&&(this.B.G?setTimeout(this.ih.bind(this),0):this.ih(),this.aq?(g.g.o.Sb(this.kc,"blocklyInvalidInput"),g.g.M.eb(this.kc,"invalid",!1)):(g.g.o.rb(this.kc,"blocklyInvalidInput"),g.g.M.eb(this.kc,"invalid",!0)))}; function de(a){0!=a.ol&&(a.ol=!1,a.kc&&a.kc.setAttribute("spellcheck",a.ol))}b.yf=function(a){this.s=this.B.v;a=a||!1;!a&&(g.g.userAgent.wC||g.g.userAgent.Al||g.g.userAgent.ck)?ee(this):(g.ba.show(this,this.B.G,this.JH.bind(this)),this.kc=this.Pq(),this.Sk=!0,a||(this.kc.focus(),this.kc.select()))};function ee(a){g.prompt(g.h.CHANGE_VALUE_TITLE,a.dc(),function(c){a.setValue(c)})} b.Pq=function(){var a=g.ba.Ca,c=document.createElement("input");c.className="blocklyHtmlInput";c.setAttribute("spellcheck",this.ol);var d=g.zb.Yv*this.s.scale+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=g.zb.Lv*this.s.scale+"px";a.appendChild(c);c.value=c.defaultValue=String(this.$a);c.BA=this.$a;c.yu=null;g.g.userAgent.Go?setTimeout(this.ih.bind(this),0):this.ih();fe(this,c);return c}; b.JH=function(){this.Sk=!1;this.aq=!0;xb(this);this.Bu&&this.Bu(this.$a);g.Ua(this.pn);g.Ua(this.zG);var a=g.ba.Ca.style;a.width="auto";a.height="auto";a.fontSize=""};function fe(a,c){a.pn=g.ca(c,"keydown",a,a.Cu);a.zG=g.ca(c,"input",a,a.yG)}b.Cu=function(a){a.keyCode==g.g.ya.Gl?(g.ba.Ha(),g.D.bj()):a.keyCode==g.g.ya.jr?(this.kc.value=this.kc.defaultValue,g.ba.Ha(),g.D.bj()):a.keyCode==g.g.ya.Fw&&(g.ba.Ha(),g.D.bj(),Wc(this.B,this,!a.shiftKey),a.preventDefault())}; b.yG=function(){var a=this.kc.value;a!==this.kc.yu&&(this.kc.yu=a,g.i.aa(!0),this.setValue(a),xb(this),g.i.aa(!1))};b.ih=function(){var a=g.ba.Ca,c=wb(this);a.style.width=c.right-c.left+"px";a.style.height=c.bottom-c.top+"px";c=new g.g.V(this.B.G?c.right-a.offsetWidth:c.left,c.top);c.y+=1;g.g.userAgent.Go&&g.ba.Ca.style.top&&(--c.x,--c.y);g.g.userAgent.Zr&&(c.y-=3);a.style.left=c.x+"px";a.style.top=c.y+"px"}; g.zb.sG=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.zb.lM=function(a){(a=g.zb.sG(a))&&(a=String(Math.max(0,Math.floor(a))));return a};g.zb.prototype.hz=function(){return!0};g.zb.prototype.Jp=function(){return this.Sk&&this.kc?this.kc.value:null};g.vc.register("field_input",g.zb);g.Ze=function(a,c,d,e,f,h){this.mn=-Infinity;this.kn=Infinity;this.dl=0;this.Js=null;g.Ze.w.constructor.call(this,a||0,f,h);h||(ge(this,c),he(this,d),ie(this,e),this.setValue(this.getValue()))};g.g.object.X(g.Ze,g.zb);g.Ze.pa=function(a){return new g.Ze(a.value,void 0,void 0,void 0,void 0,a)};g.Ze.prototype.Ei=!0;g.Ze.prototype.ld=function(a){g.Ze.w.ld.call(this,a);ge(this,a.min);he(this,a.max);ie(this,a.precision)};function ge(a,c){null==c?a.mn=-Infinity:(c=Number(c),isNaN(c)||(a.mn=c))} function he(a,c){null==c?a.kn=Infinity:(c=Number(c),isNaN(c)||(a.kn=c))}function ie(a,c){null==c?a.dl=0:(c=Number(c),isNaN(c)||(a.dl=c));var d=a.dl.toString(),e=d.indexOf(".");a.Js=-1==e?c?0:null:d.length-e-1}g.Ze.prototype.Qg=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.mn),this.kn);this.dl&&isFinite(a)&&(a=Math.round(a/this.dl)*this.dl);null!=this.Js&&(a=Number(a.toFixed(this.Js)));return a}; g.Ze.prototype.Pq=function(){var a=g.Ze.w.Pq.call(this);-Infinitythis.kn&&g.g.M.eb(a,g.g.M.State.lD,this.kn);return a};g.vc.register("field_number",g.Ze);g.Be=function(a,c,d,e,f){this.pj=g.Be.KE;this.tE=a||"";this.Bb=new g.g.ge(0,g.xa.yr);f&&this.ld(f);c&&(this.Oj=c);f||je(this,d,e)};g.g.object.X(g.Be,g.Da);g.Be.pa=function(a){var c=g.g.nc(a.variable);return new g.Be(c,void 0,void 0,void 0,a)};b=g.Be.prototype;b.s=null;b.Ei=!0;b.ld=function(a){g.Be.w.ld.call(this,a);je(this,a.variableTypes,a.defaultType)};b.ej=function(){if(!this.Zd){var a=g.N.Hp(this.B.v,null,this.tE,this.sE);g.i.disable();this.setValue(a.va());g.i.enable()}}; b.Gm=function(a){var c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";c=g.N.Hp(this.B.v,c,d,e);if(null!=e&&e!==c.type)throw Error("Serialized variable type with id '"+c.va()+"' had type "+c.type+", and does not match variable field that references it: "+g.R.Nd(a)+".");this.setValue(c.va())};b.xA=function(a){this.ej();a.id=this.Zd.va();a.textContent=this.Zd.name;this.Zd.type&&a.setAttribute("variabletype",this.Zd.type);return a}; b.fv=function(a){if(a.ib)throw Error("Variable fields are not allowed to exist on shadow blocks.");g.Be.w.fv.call(this,a)};b.getValue=function(){return this.Zd?this.Zd.va():null};b.dc=function(){return this.Zd?this.Zd.name:""};b.Zc=function(){return this.Zd};b.Iy=function(){return this.Zd?this.Oj:null}; b.Qg=function(a){if(null===a)return null;var c=g.N.Zc(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=ke(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.Em=!1;this.bp="";g.Hf.w.constructor.call(this,a||"",null,k);k||(this.Em=!!h,this.bp=g.g.nc(e)||"");this.Bb=new g.g.ge(c,d+g.Hf.bs);this.GF=d;this.jm=null;"function"== typeof f&&(this.jm=f)};g.g.object.X(g.Hf,g.oa);g.Hf.pa=function(a){return new g.Hf(a.src,a.width,a.height,void 0,void 0,void 0,a)};g.Hf.bs=1;b=g.Hf.prototype;b.Gf=!1;b.sf=!1;b.ld=function(a){g.Hf.w.ld.call(this,a);this.Em=!!a.flipRtl;this.bp=g.g.nc(a.alt)||""};b.Zg=function(){this.Re=g.g.o.K("image",{height:this.GF+"px",width:this.Bb.width+"px",alt:this.bp},this.me);this.Re.setAttributeNS(g.g.o.ef,"xlink:href",this.$a)};b.Qg=function(a){return"string"!=typeof a?null:a}; b.Rg=function(a){this.$a=a;this.Re&&this.Re.setAttributeNS(g.g.o.ef,"xlink:href",this.$a||"")};b.wy=function(){return this.Em};b.yf=function(){this.jm&&this.jm(this)};b.Jp=function(){return this.bp};g.vc.register("field_image",g.Hf);g.Ae=function(a,c,d){null==a&&(a="");g.Ae.w.constructor.call(this,a,c,d)};g.g.object.X(g.Ae,g.zb);g.Ae.Lo=20;g.Ae.pa=function(a){var c=g.g.nc(a.text);return new g.Ae(c,void 0,a)};b=g.Ae.prototype;b.Zg=function(){tb(this);this.Iq=g.g.o.K("g",{"class":"blocklyEditableText"},this.me)}; b.Ep=function(){var a=this.$a;if(!a)return g.oa.Oo;var c=a.split("\n");a="";for(var d=0;dthis.hq&&(e=e.substring(0,this.hq-4)+"...");e=e.replace(/\s/g,g.oa.Oo);a+=e;d!==c.length-1&&(a+="\n")}this.B.G&&(a+="\u200f");return a}; b.fh=function(){for(var a;a=this.Iq.firstChild;)this.Iq.removeChild(a);a=this.Ep().split("\n");for(var c=g.oa.bs/2,d=0,e=0;ec&&(c=f);d+=g.Ae.Lo}this.Kd&&(c+=g.oa.rk,this.Kd.setAttribute("width",c),this.Kd.setAttribute("height",d));this.Bb.width=c;this.Bb.height=d};b.ih=function(){var a=g.ba.Ca,c=wb(this);a.style.width=c.right-c.left+"px";a.style.height=c.bottom-c.top+"px";c=new g.g.V(this.B.G?c.right-a.offsetWidth:c.left,c.top);a.style.left=c.x+"px";a.style.top=c.y+"px"}; b.Pq=function(){var a=g.ba.Ca,c=this.s.scale,d=document.createElement("textarea");d.className="blocklyHtmlInput blocklyHtmlTextAreaInput";d.setAttribute("spellcheck",this.ol);var e=g.zb.Yv*c+"pt";a.style.fontSize=e;d.style.fontSize=e;d.style.borderRadius=g.zb.Lv*c+"px";e=g.oa.wg*c;d.style.paddingLeft=e+"px";d.style.width="calc(100% - "+e+"px)";d.style.lineHeight=g.Ae.Lo*c+"px";a.appendChild(d);d.value=d.defaultValue=String(this.$a);d.BA=this.$a;d.yu=null;g.g.userAgent.Go?setTimeout(this.ih.bind(this), 0):this.ih();fe(this,d);return d};b.Cu=function(a){a.keyCode!==g.g.ya.Gl&&g.Ae.w.Cu.call(this,a)};g.Tc.register(".blocklyHtmlTextAreaInput {,font-family: monospace;,resize: none;,overflow: hidden;,height: 100%;,text-align: left;,}".split(","));g.vc.register("field_multilinetext",g.Ae);g.S.xH={};g.W.Text={};g.W.Text.bk=160; g.Gh([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_multiline",message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12, height:17,alt:"\u00b6"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",args0:[{type:"input_dummy"}, {type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",name:"TEXT"}], previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}", helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}", args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]); g.S.text_getSubstring={Z:function(){this.WHERE_OPTIONS_1=[[g.h.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[g.h.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[g.h.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[g.h.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[g.h.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[g.h.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.Wb=g.h.TEXT_GET_SUBSTRING_HELPURL;K(this,"text_blocks");H(L(this,"STRING").wa("String"),g.h.TEXT_GET_SUBSTRING_INPUT_IN_TEXT); M(this,"AT1");M(this,"AT2");g.h.TEXT_GET_SUBSTRING_TAIL&&H(M(this,"TAIL"),g.h.TEXT_GET_SUBSTRING_TAIL);this.te(!0);this.bd(!0,"String");this.Tb(1,!0);this.Tb(2,!0);this.Ta(g.h.TEXT_GET_SUBSTRING_TOOLTIP)},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at1",E(this,"AT1").type==g.Ra);a.setAttribute("at2",E(this,"AT2").type==g.Ra);return a},lb:function(a){var c="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.Tb(1,c);this.Tb(2,a)},Tb:function(a,c){this.pb("AT"+ a);this.pb("ORDINAL"+a,!0);c?(L(this,"AT"+a).wa("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&H(M(this,"ORDINAL"+a),g.h.ORDINAL_NUMBER_SUFFIX)):M(this,"AT"+a);2==a&&g.h.TEXT_GET_SUBSTRING_TAIL&&(this.pb("TAIL",!0),H(M(this,"TAIL"),g.h.TEXT_GET_SUBSTRING_TAIL));var d=new g.Da(this["WHERE_OPTIONS_"+a],function(e){var f="FROM_START"==e||"FROM_END"==e;if(f!=c){var h=this.B;h.Tb(a,f);wc(h,e,"WHERE"+a);return null}});H(E(this,"AT"+a),d,"WHERE"+a);1==a&&(zc(this,"AT1","AT2"),E(this,"ORDINAL1")&&zc(this,"ORDINAL1", "AT2"))}};g.S.text_changeCase={Z:function(){var a=[[g.h.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[g.h.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[g.h.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.Wb=g.h.TEXT_CHANGECASE_HELPURL;K(this,"text_blocks");H(L(this,"TEXT").wa("String"),new g.Da(a),"CASE");this.bd(!0,"String");this.Ta(g.h.TEXT_CHANGECASE_TOOLTIP)}}; g.S.text_trim={Z:function(){var a=[[g.h.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[g.h.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[g.h.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.Wb=g.h.TEXT_TRIM_HELPURL;K(this,"text_blocks");H(L(this,"TEXT").wa("String"),new g.Da(a),"MODE");this.bd(!0,"String");this.Ta(g.h.TEXT_TRIM_TOOLTIP)}}; g.S.text_print={Z:function(){yc(this,{message0:g.h.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:g.h.TEXT_PRINT_TOOLTIP,helpUrl:g.h.TEXT_PRINT_HELPURL})}}; g.S.text_prompt_ext={Z:function(){var a=[[g.h.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[g.h.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.Wb=g.h.TEXT_PROMPT_HELPURL;K(this,"text_blocks");var c=this;a=new g.Da(a,function(d){c.Cf(d)});H(L(this,"TEXT"),a,"TYPE");this.bd(!0,"String");this.Ta(function(){return"TEXT"==z(c,"TYPE")?g.h.TEXT_PROMPT_TOOLTIP_TEXT:g.h.TEXT_PROMPT_TOOLTIP_NUMBER})},Cf:function(a){this.L.wa("NUMBER"==a?"Number":"String")},Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("type", z(this,"TYPE"));return a},lb:function(a){this.Cf(a.getAttribute("type"))}}; g.S.text_prompt={Z:function(){this.eg(g.W.Text.Ir);var a=[[g.h.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[g.h.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],c=this;this.Wb=g.h.TEXT_PROMPT_HELPURL;K(this,"text_blocks");a=new g.Da(a,function(d){c.Cf(d)});H(H(H(H(M(this),a,"TYPE"),this.$k(!0)),new g.zb(""),"TEXT"),this.$k(!1));this.bd(!0,"String");this.Ta(function(){return"TEXT"==z(c,"TYPE")?g.h.TEXT_PROMPT_TOOLTIP_TEXT:g.h.TEXT_PROMPT_TOOLTIP_NUMBER})},Cf:g.S.text_prompt_ext.Cf,Pa:g.S.text_prompt_ext.Pa,lb:g.S.text_prompt_ext.lb}; g.S.text_count={Z:function(){yc(this,{message0:g.h.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:g.h.TEXT_COUNT_TOOLTIP,helpUrl:g.h.TEXT_COUNT_HELPURL})}}; g.S.text_replace={Z:function(){yc(this,{message0:g.h.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:g.h.TEXT_REPLACE_TOOLTIP,helpUrl:g.h.TEXT_REPLACE_HELPURL})}}; g.S.text_reverse={Z:function(){yc(this,{message0:g.h.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:g.h.TEXT_REVERSE_TOOLTIP,helpUrl:g.h.TEXT_REVERSE_HELPURL})}}; g.W.Text.Ir={IC:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",JC:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==", KC:12,HC:12,VG:function(a){for(var c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)if(a==f.name){rc(d,e,this.$k(!0));rc(d,e+2,this.$k(!1));return}console.warn('field named "'+a+'" not found in '+pc(this))},$k:function(a){a=this.G?!a:a;return new g.Hf(a?this.IC:this.JC,this.KC,this.HC,a?"\u201c":"\u201d")}};g.W.Text.fD=function(){this.eg(g.W.Text.Ir);this.VG("TEXT")}; g.W.Text.eD={Pa:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("items",this.Lb);return a},lb:function(a){this.Lb=parseInt(a.getAttribute("items"),10);this.dd()},Yf:function(a){var c=a.fg("text_create_join_container");c.Qd();for(var d=E(c,"STACK").connection,e=0;ed?U(a,c,g.j.Bg)||h:e?U(a,c,g.j.Vl)||h:U(a,c,f)||h;if(g.Wh(a))a=Number(a)+d,e&&(a=-a);else{if(0d&&(a=a+" - "+-d,k=g.j.Bg);e&&(a=d?"-("+a+")":"-"+a,k=g.j.Vl);k=Math.floor(k);f=Math.floor(f);k&&f>=k&&(a="("+a+")")}return a};g.j.Ab={};g.j.colour_picker=function(a){return[g.j.uq(z(a,"COLOUR")),g.j.Ee]};g.j.colour_random=function(){return[V("colourRandom",["function "+g.j.hc+"() {"," var num = Math.floor(Math.random() * Math.pow(2, 24));"," return '#' + ('00000' + num.toString(16)).substr(-6);","}"])+"()",g.j.Aa]}; g.j.colour_rgb=function(a){var c=U(a,"RED",g.j.Ya)||0,d=U(a,"GREEN",g.j.Ya)||0;a=U(a,"BLUE",g.j.Ya)||0;return[V("colourRgb",["function "+g.j.hc+"(r, g, b) {"," r = Math.max(Math.min(Number(r), 100), 0) * 2.55;"," g = Math.max(Math.min(Number(g), 100), 0) * 2.55;"," b = Math.max(Math.min(Number(b), 100), 0) * 2.55;"," r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);"," g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);"," b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);", " return '#' + r + g + b;","}"])+"("+c+", "+d+", "+a+")",g.j.Aa]}; g.j.colour_blend=function(a){var c=U(a,"COLOUR1",g.j.Ya)||"'#000000'",d=U(a,"COLOUR2",g.j.Ya)||"'#000000'";a=U(a,"RATIO",g.j.Ya)||.5;return[V("colourBlend",["function "+g.j.hc+"(c1, c2, ratio) {"," ratio = Math.max(Math.min(Number(ratio), 1), 0);"," var r1 = parseInt(c1.substring(1, 3), 16);"," var g1 = parseInt(c1.substring(3, 5), 16);"," var b1 = parseInt(c1.substring(5, 7), 16);"," var r2 = parseInt(c2.substring(1, 3), 16);"," var g2 = parseInt(c2.substring(3, 5), 16);"," var b2 = parseInt(c2.substring(5, 7), 16);", " var r = Math.round(r1 * (1 - ratio) + r2 * ratio);"," var g = Math.round(g1 * (1 - ratio) + g2 * ratio);"," var b = Math.round(b1 * (1 - ratio) + b2 * ratio);"," r = ('0' + (r || 0).toString(16)).slice(-2);"," g = ('0' + (g || 0).toString(16)).slice(-2);"," b = ('0' + (b || 0).toString(16)).slice(-2);"," return '#' + r + g + b;","}"])+"("+c+", "+d+", "+a+")",g.j.Aa]};g.j.au={};g.j.lists_create_empty=function(){return["[]",g.j.Ee]};g.j.lists_create_with=function(a){for(var c=Array(a.Lb),d=0;d b.toString() ? 1 : -1; },",' "IGNORE_CASE": function(a, b) {'," return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },"," };"," var compare = compareFuncs[type];", " return function(a, b) { return compare(a, b) * direction; }","}"]);return[c+".slice().sort("+e+'("'+a+'", '+d+"))",g.j.Aa]};g.j.lists_split=function(a){var c=U(a,"INPUT",g.j.ab),d=U(a,"DELIM",g.j.wb)||"''";a=z(a,"MODE");if("SPLIT"==a)c||(c="''"),a="split";else if("JOIN"==a)c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+d+")",g.j.Aa]};g.j.lists_reverse=function(a){return[(U(a,"LIST",g.j.Aa)||"[]")+".slice().reverse()",g.j.Aa]};g.j.YF={};g.j.controls_if=function(a){var c=0,d="";g.j.Id&&(d+=T(g.j.Id,a));do{var e=U(a,"IF"+c,g.j.wb)||"false";var f=oe(a,"DO"+c);g.j.Wc&&(f=ne(T(g.j.Wc,a),g.j.ud)+f);d+=(0",GTE:">="}[z(a,"OP")],d="=="==c||"!="==c?g.j.pw:g.j.BC,e=U(a,"A",d)||"0";a=U(a,"B",d)||"0";return[e+" "+c+" "+a,d]};g.j.logic_operation=function(a){var c="AND"==z(a,"OP")?"&&":"||",d="&&"==c?g.j.Br:g.j.Cr,e=U(a,"A",d);a=U(a,"B",d);if(e||a){var f="&&"==c?"true":"false";e||(e=f);a||(a=f)}else a=e="false";return[e+" "+c+" "+a,d]};g.j.logic_negate=function(a){var c=g.j.kk;return["!"+(U(a,"BOOL",c)||"true"),c]}; g.j.logic_boolean=function(a){return["TRUE"==z(a,"BOOL")?"true":"false",g.j.Ee]};g.j.logic_null=function(){return["null",g.j.Ee]};g.j.logic_ternary=function(a){var c=U(a,"IF",g.j.Qo)||"false",d=U(a,"THEN",g.j.Qo)||"null";a=U(a,"ELSE",g.j.Qo)||"null";return[c+" ? "+d+" : "+a,g.j.Qo]};g.j.$F={};g.j.controls_repeat_ext=function(a){var c=B(a,"TIMES")?String(Number(z(a,"TIMES"))):U(a,"TIMES",g.j.Ai)||"0",d=oe(a,"DO");d=pe(d,a);a="";var e=sd(g.j.Gd,"count",g.N.Eb),f=c;c.match(/^\w+$/)||g.Wh(c)||(f=sd(g.j.Gd,"repeat_end",g.N.Eb),a+="var "+f+" = "+c+";\n");return a+("for (var "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")};g.j.controls_repeat=g.j.controls_repeat_ext; g.j.controls_whileUntil=function(a){var c="UNTIL"==z(a,"MODE"),d=U(a,"BOOL",c?g.j.kk:g.j.wb)||"false",e=oe(a,"DO");e=pe(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"}; g.j.controls_for=function(a){var c=rd(z(a,"VAR"),g.N.Eb),d=U(a,"FROM",g.j.Ai)||"0",e=U(a,"TO",g.j.Ai)||"0",f=U(a,"BY",g.j.Ai)||"1",h=oe(a,"DO");h=pe(h,a);if(g.Wh(d)&&g.Wh(e)&&g.Wh(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.Wh(d)||(k=sd(g.j.Gd,c+"_start",g.N.Eb),a+="var "+k+" = "+d+";\n"),d=e,e.match(/^\w+$/)||g.Wh(e)||(d=sd(g.j.Gd,c+"_end", g.N.Eb),a+="var "+d+" = "+e+";\n"),e=sd(g.j.Gd,c+"_inc",g.N.Eb),a+="var "+e+" = ",a=g.Wh(f)?a+(Math.abs(f)+";\n"):a+("Math.abs("+f+");\n"),a=a+("if ("+k+" > "+d+") {\n")+(g.j.ud+e+" = -"+e+";\n"),a+="}\n",a+="for ("+c+" = "+k+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+h+"}\n";return a}; g.j.controls_forEach=function(a){var c=rd(z(a,"VAR"),g.N.Eb),d=U(a,"LIST",g.j.Ai)||"[]",e=oe(a,"DO");e=pe(e,a);a="";var f=d;d.match(/^\w+$/)||(f=sd(g.j.Gd,c+"_list",g.N.Eb),a+="var "+f+" = "+d+";\n");d=sd(g.j.Gd,c+"_index",g.N.Eb);e=g.j.ud+c+" = "+f+"["+d+"];\n"+e;return a+("for (var "+d+" in "+f+") {\n"+e+"}\n")}; g.j.controls_flow_statements=function(a){var c="";g.j.Id&&(c+=T(g.j.Id,a));g.j.Wc&&(c+=T(g.j.Wc,a));if(g.j.Id){var d=g.W.Ce.vo.Hy(a);d&&!d.li&&(c+=T(g.j.Id,d))}switch(z(a,"FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");};g.j.Rd={};g.j.math_number=function(a){a=Number(z(a,"NUM"));return[a,0<=a?g.j.Ee:g.j.Vl]};g.j.math_arithmetic=function(a){var c={ADD:[" + ",g.j.Ag],MINUS:[" - ",g.j.Bg],MULTIPLY:[" * ",g.j.Dr],DIVIDE:[" / ",g.j.Tl],POWER:[null,g.j.Ya]}[z(a,"OP")],d=c[0];c=c[1];var e=U(a,"A",c)||"0";a=U(a,"B",c)||"0";return d?[e+d+a,c]:["Math.pow("+e+", "+a+")",g.j.Aa]}; g.j.math_single=function(a){var c=z(a,"OP");if("NEG"==c)return a=U(a,"NUM",g.j.Vl)||"0","-"==a[0]&&(a=" "+a),["-"+a,g.j.Vl];a="SIN"==c||"COS"==c||"TAN"==c?U(a,"NUM",g.j.Tl)||"0":U(a,"NUM",g.j.wb)||"0";switch(c){case "ABS":var d="Math.abs("+a+")";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+a+")";break;case "POW10":d="Math.pow(10,"+a+")";break;case "ROUND":d="Math.round("+a+")";break;case "ROUNDUP":d="Math.ceil("+a+")";break;case "ROUNDDOWN":d= "Math.floor("+a+")";break;case "SIN":d="Math.sin("+a+" / 180 * Math.PI)";break;case "COS":d="Math.cos("+a+" / 180 * Math.PI)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.PI)"}if(d)return[d,g.j.Aa];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.PI * 180";break;case "ACOS":d="Math.acos("+a+") / Math.PI * 180";break;case "ATAN":d="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,g.j.Tl]}; g.j.math_constant=function(a){return{PI:["Math.PI",g.j.ab],E:["Math.E",g.j.ab],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",g.j.Tl],SQRT2:["Math.SQRT2",g.j.ab],SQRT1_2:["Math.SQRT1_2",g.j.ab],INFINITY:["Infinity",g.j.Ee]}[z(a,"CONSTANT")]}; g.j.math_number_property=function(a){var c=U(a,"NUMBER_TO_CHECK",g.j.Ul)||"0",d=z(a,"PROPERTY");if("PRIME"==d){var e=V("mathIsPrime",["function "+g.j.hc+"(n) {"," // https://en.wikipedia.org/wiki/Primality_test#Naive_methods"," if (n == 2 || n == 3) {"," return true;"," }"," // False if n is NaN, negative, is 1, or not whole."," // And false if n is divisible by 2 or 3."," if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {"," return false;"," }"," // Check all the numbers of form 6k +/- 1, up to sqrt(n).", " for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {"," if (n % (x - 1) == 0 || n % (x + 1) == 0) {"," return false;"," }"," }"," return true;","}"])+"("+c+")";return[e,g.j.Aa]}switch(d){case "EVEN":e=c+" % 2 == 0";break;case "ODD":e=c+" % 2 == 1";break;case "WHOLE":e=c+" % 1 == 0";break;case "POSITIVE":e=c+" > 0";break;case "NEGATIVE":e=c+" < 0";break;case "DIVISIBLE_BY":a=U(a,"DIVISOR",g.j.Ul)||"0",e=c+" % "+a+" == 0"}return[e,g.j.pw]}; g.j.math_change=function(a){var c=U(a,"DELTA",g.j.Ag)||"0";a=rd(z(a,"VAR"),g.N.Eb);return a+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+c+";\n"};g.j.math_round=g.j.math_single;g.j.math_trig=g.j.math_single; g.j.math_on_list=function(a){var c=z(a,"OP");switch(c){case "SUM":a=U(a,"LIST",g.j.ab)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=U(a,"LIST",g.j.Ya)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=U(a,"LIST",g.j.Ya)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":c=V("mathMean",["function "+g.j.hc+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]);a=U(a,"LIST",g.j.wb)||"[]";a=c+"("+a+")";break;case "MEDIAN":c= V("mathMedian",["function "+g.j.hc+"(myList) {"," var localList = myList.filter(function (x) {return typeof x == 'number';});"," if (!localList.length) return null;"," localList.sort(function(a, b) {return b - a;});"," if (localList.length % 2 == 0) {"," return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;"," } else {"," return localList[(localList.length - 1) / 2];"," }","}"]);a=U(a,"LIST",g.j.wb)||"[]";a=c+"("+a+")";break;case "MODE":c=V("mathModes",["function "+ g.j.hc+"(values) {"," var modes = [];"," var counts = [];"," var maxCount = 0;"," for (var i = 0; i < values.length; i++) {"," var value = values[i];"," var found = false;"," var thisCount;"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][0] === value) {"," thisCount = ++counts[j][1];"," found = true;"," break;"," }"," }"," if (!found) {"," counts.push([value, 1]);"," thisCount = 1;"," }"," maxCount = Math.max(thisCount, maxCount);", " }"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][1] == maxCount) {"," modes.push(counts[j][0]);"," }"," }"," return modes;","}"]);a=U(a,"LIST",g.j.wb)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=V("mathStandardDeviation",["function "+g.j.hc+"(numbers) {"," var n = numbers.length;"," if (!n) return null;"," var mean = numbers.reduce(function(x, y) {return x + y;}) / n;"," var variance = 0;"," for (var j = 0; j < n; j++) {"," variance += Math.pow(numbers[j] - mean, 2);", " }"," variance = variance / n;"," return Math.sqrt(variance);","}"]);a=U(a,"LIST",g.j.wb)||"[]";a=c+"("+a+")";break;case "RANDOM":c=V("mathRandomList",["function "+g.j.hc+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]);a=U(a,"LIST",g.j.wb)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,g.j.Aa]};g.j.math_modulo=function(a){var c=U(a,"DIVIDEND",g.j.Ul)||"0";a=U(a,"DIVISOR",g.j.Ul)||"0";return[c+" % "+a,g.j.Ul]}; g.j.math_constrain=function(a){var c=U(a,"VALUE",g.j.Ya)||"0",d=U(a,"LOW",g.j.Ya)||"0";a=U(a,"HIGH",g.j.Ya)||"Infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",g.j.Aa]}; g.j.math_random_int=function(a){var c=U(a,"FROM",g.j.Ya)||"0";a=U(a,"TO",g.j.Ya)||"0";return[V("mathRandomInt",["function "+g.j.hc+"(a, b) {"," if (a > b) {"," // Swap a and b to ensure a is smaller."," var c = a;"," a = b;"," b = c;"," }"," return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+c+", "+a+")",g.j.Aa]};g.j.math_random_float=function(){return["Math.random()",g.j.Aa]}; g.j.math_atan2=function(a){var c=U(a,"X",g.j.Ya)||"0";return["Math.atan2("+(U(a,"Y",g.j.Ya)||"0")+", "+c+") / Math.PI * 180",g.j.Tl]};g.j.UG={};g.j.procedures_defreturn=function(a){var c=rd(z(a,"NAME"),g.Ka.Eb),d="";g.j.Id&&(d+=T(g.j.Id,a));g.j.Wc&&(d+=T(g.j.Wc,a));d&&(d=ne(d,g.j.ud));var e="";g.j.Io&&(e=ne(T(g.j.Io,a),g.j.ud));var f=oe(a,"STACK"),h=U(a,"RETURN",g.j.wb)||"",k="";f&&h&&(k=d);h&&(h=g.j.ud+"return "+h+";\n");for(var l=[],m=0;m":">","\t":" ","\n":" ","\x0B":" ","\f":" ","\r":" "," ":" ","-":"-","/":"/","=":"=","`":"`","\u0085":"…","\u00a0":" ","\u2028":"
","\u2029":"
"};function Ke(a){return Le[a]}var Je=/[\x00\x22\x26\x27\x3c\x3e]/g;function Me(){return'
'};function Ne(){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
XYin\u00edcio xin\u00edcio yfim Xfim YraiolarguraalturaDesenha um circulo numa localidade espec\u00edfica e \\ncom o raio especificado. circuloDesenhar um ret\u00e2ngulo numa localidade espec\u00edfica \\ncom uma largura e uma altura especifica. retanguloDesenha uma linha de um ponto ao outro com um \\ncomprimento especifico. linhaRetornar o tempo atual na anima\u00e7\u00e3o (0-100).Trocar a cor da caneta.mudar a cor paraSeu filme n\u00e3o se move. Use blocos para fazer algo interessante. Depois voc\u00ea pode enviar seu filme para a galeria.

'+ ((xd?'':'')+"Jogos do Blockly : "+W({appName:"Filme"}.appName)+""),c="   ",d=1;11>d;d++)c+=" "+(d==O?''+W(d)+"":10==d?''+W(d)+"":'');return a+c+'

  
'+ (10!=O||xd?"":'
Enviar o seu filme 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.
')+ (Me()+"
")+(9==O?'
Mova o c\u00edrculo de fundo para o topo do seu programa. Ent\u00e3o aparecer\u00e1 atr\u00e1s da pessoa.
'+Me()+"
":"")+'
'+(1==O?"Use formas simples para desenhar essa pessoa.":2==O?"Este n\u00edvel \u00e9 um filme. Voc\u00ea quer que o bra\u00e7o da pessoa se mova pela tela. Pressione o bot\u00e3o play para ver uma pr\u00e9via.
Enquanto o filme passa, o valor do bloco 'time' conta de 0 a 100. Como queira a posi\u00e7\u00e3o 'y' do bra\u00e7o iniciar no 0 e que v\u00e1 at\u00e9 100 isto deve ser f\u00e1cil.": 3==O?"O bloco 'tempo' conta de 0 a 100. Mas agora voc\u00ea quer que a posi\u00e7\u00e3o 'y' do outro bra\u00e7o comece em 100 e v\u00e1 para 0. Voc\u00ea consegue descobrir uma f\u00f3rmula matem\u00e1tica simples que inverta a dire\u00e7\u00e3o?":4==O?"Use o que voc\u00ea aprendeu no n\u00edvel anterior para fazer pernas cruzadas.":5==O?'A f\u00f3rmula matem\u00e1tica para o bra\u00e7o \u00e9 complicada. Aqui est\u00e1 a resposta:

y = ((time - 50) ÷ 5) ^ 2‎2 ^ (5 ÷ (50 - time)) = y‎': 6==O?"D\u00ea a pessoa algumas m\u00e3os.":7==O?"Use o bloco 'se' para desenhar uma pequena cabe\u00e7a na primeira metade do filme. Em seguida, desenhe uma grande cabe\u00e7a para a segunda metade do filme.":8==O?"Fa\u00e7a as pernas inverterem a dire\u00e7\u00e3o a meio do filme.":9==O?"Desenhe um c\u00edrculo em expans\u00e3o atr\u00e1s da pessoa.":10==O?"Desenhe o que voc\u00ea quiser. Voc\u00ea conseguiu um grande numero de blocos novos para explorar. Divirta-se!"+(xd?"":'

Use o bot\u00e3o "Ver Galeria" para ver o que as outras pessoas desenharam. Se voc\u00ea desenhar algo interessante,use o bot\u00e3o "Enviar para a Galeria" para publicar.'): "")+"
"+Me()+"
"};function Oe(a){var c=Pe;this.$e=42;this.Ql=328;this.Kl=11.5;this.Mf=12;this.$a=0;this.ex=c;this.ks=[];this.Yz=[];c=g.g.o.Yl;var d=document.createElementNS(c,"text");d.setAttribute("style","font-size: 10pt");d.setAttribute("x",this.Ql+9);d.setAttribute("y",16);yd()&&d.setAttribute("text-anchor","end");a.appendChild(d);this.Ed=d;d="#ff3333 #f72f2f #ef2a2a #e72727 #df2222 #d71f1f #cf1a1a".split(" ");for(var e=0;ef;f++)a.ks.push(setTimeout(d(f),200*f/10))} b.setValue=function(a){this.$a=g.g.Rd.zk(a,0,1);a=this.$e+(this.Ql-this.$e)*this.$a;this.UF.setAttribute("x",a-8);this.kz.setAttribute("x",a-42-8);this.Ut.setAttribute("x",a-this.Mf);for(var c=0,d;d=this.Yz[c];c++)d.setAttribute("width",a-this.$e);for(;this.Ed.firstChild;)this.Ed.removeChild(this.Ed.firstChild);a=Math.round(100*this.$a);c=document.createTextNode("time = "+a);this.Ed.appendChild(c);this.ex&&this.ex(a)}; function Xe(a,c){var d=a.bb.createSVGPoint();d.x=c.clientX;d.y=c.clientY;a=a.bb.getScreenCTM().inverse();return d.matrixTransform(a)}function Qe(a,c,d,e){a.addEventListener(c,function(f){e.apply(d,arguments)},!1)}function We(a){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY};var Gd="movie",ae=1==O?0:100,be=Array(ae),af=!1,bf=0;function cf(){document.getElementById("coordinates").style.display="block"}function df(){document.getElementById("coordinates").style.display="none"} function ef(a){var c=yd(),d=a.clientX;a=a.clientY;c&&(d-=window.innerWidth);var e=document.getElementById("visualization");e=g.g.style.Mm(e);e=g.g.V.Ek(e,g.g.style.Ft());d+=c?e.x:-e.x;a-=e.y;d/=4;a=100-a/4;c&&(d+=100);10==O?(d=Math.round(d),a=Math.round(a)):(d=10*Math.round(d/10),a=10*Math.round(a/10));0<=d&&100>=d&&0<=a&&100>=a?(document.getElementById("x").textContent="x = "+d,document.getElementById("y").textContent="y = "+a):df()} function ff(){var a=document.getElementById("help"),c=document.getElementById("helpButton");2==O&&R.LF("sampleHelp2",'');Q.ml(a,c,!0,!0,{width:"50%",left:"25%",top:"5em"},gf);Q.kv()}function gf(){Q.ov()} function hf(a){var c=document.getElementById("visualization");S.strokeStyle="#000";S.fillStyle="#000";var d=document.createElement("canvas");d.id="answer"+a;d.width=400;d.height=400;d.style.display="none";c.appendChild(d);S.canvas.width=S.canvas.width;switch(O){case 1:X("#ff0000");Y(50,70,10);X("#3333ff");jf(50,40,20,40);X("#000000");Z(40,50,20,70,5);Z(60,50,80,70,5);break;case 2:X("#ff0000");Y(50,70,10);X("#3333ff");jf(50,40,20,40);X("#000000");Z(40,50,20,70,5);Z(60,50,80,a,5);break;case 3:X("#ff0000"); Y(50,70,10);X("#3333ff");jf(50,40,20,40);X("#000000");Z(40,50,20,100-a,5);Z(60,50,80,a,5);break;case 4:X("#ff0000");Y(50,70,10);X("#3333ff");jf(50,40,20,40);X("#000000");Z(40,50,20,100-a,5);Z(60,50,80,a,5);Z(40,20,a,0,5);Z(60,20,100-a,0,5);break;case 5:X("#ff0000");Y(50,70,10);X("#3333ff");jf(50,40,20,40);X("#000000");Z(40,50,20,100-a,5);Z(60,50,80,Math.pow((a-50)/5,2),5);Z(40,20,a,0,5);Z(60,20,100-a,0,5);break;case 6:X("#ff0000");Y(50,70,10);X("#3333ff");jf(50,40,20,40);X("#000000");Z(40,50,20,100- a,5);Z(60,50,80,Math.pow((a-50)/5,2),5);Z(40,20,a,0,5);Z(60,20,100-a,0,5);X("#ff0000");Y(20,100-a,5);Y(80,Math.pow((a-50)/5,2),5);break;case 7:X("#ff0000");50>a?Y(50,70,10):Y(50,80,20);X("#3333ff");jf(50,40,20,40);X("#000000");Z(40,50,20,100-a,5);Z(60,50,80,Math.pow((a-50)/5,2),5);Z(40,20,a,0,5);Z(60,20,100-a,0,5);X("#ff0000");Y(20,100-a,5);Y(80,Math.pow((a-50)/5,2),5);break;case 8:X("#ff0000");50>a?Y(50,70,10):Y(50,80,20);X("#3333ff");jf(50,40,20,40);X("#000000");Z(40,50,20,100-a,5);Z(60,50,80,Math.pow((a- 50)/5,2),5);50>a?(Z(40,20,a,0,5),Z(60,20,100-a,0,5)):(Z(40,20,100-a,0,5),Z(60,20,a,0,5));X("#ff0000");Y(20,100-a,5);Y(80,Math.pow((a-50)/5,2),5);break;case 9:X("#00ff00"),Y(50,a/2,a/2),X("#ff0000"),50>a?Y(50,70,10):Y(50,80,20),X("#3333ff"),jf(50,40,20,40),X("#000000"),Z(40,50,20,100-a,5),Z(60,50,80,Math.pow((a-50)/5,2),5),50>a?(Z(40,20,a,0,5),Z(60,20,100-a,0,5)):(Z(40,20,100-a,0,5),Z(60,20,a,0,5)),X("#ff0000"),Y(20,100-a,5),Y(80,Math.pow((a-50)/5,2),5)}a=d.getContext("2d");a.globalCompositeOperation= "copy";a.drawImage(S.canvas,0,0)}function kf(){var a=document.getElementById("hatching").getContext("2d");a.strokeStyle="#fff";a.lineWidth=1;for(var c=-400;400>c;c+=4)a.beginPath(),a.moveTo(c,-c),a.lineTo(c+400,-c+400),a.stroke()} function lf(){var a=document.getElementById("axies").getContext("2d");a.lineWidth=1;a.strokeStyle="#bba";a.fillStyle="#bba";a.font="normal 14px sans-serif";for(var c=1,d=.1;.9>d;d+=.1)a.beginPath(),a.moveTo(400*d,400),a.lineTo(400*d,400-9*c),a.stroke(),a.beginPath(),a.moveTo(0,400*d),a.lineTo(9*c,400*d),a.stroke(),2==c&&(a.fillText(Math.round(100*d),400*d+2,396),a.fillText(Math.round(100-100*d),3,400*d-2)),c=1==c?2:1} function mf(a){S.canvas.width=S.canvas.width;S.strokeStyle="#000";S.fillStyle="#000";S.globalAlpha=10==O?1:.9;for(var c=!0,d=0;c&&1E4>d;d++)try{c=a.step()}catch(e){alert(e),c=!1}} function Pe(a){if("Interpreter"in window){"number"==typeof a&&(bf=a);var c=bf;Zd.beginPath();Zd.rect(0,0,Zd.canvas.width,Zd.canvas.height);Zd.fillStyle="#ffffff";Zd.fill();if(c=document.getElementById("answer"+c))Zd.globalAlpha=.2,Zd.drawImage(c,0,0),Zd.globalAlpha=1;c=document.getElementById("hatching");Zd.drawImage(c,0,0);c=Yd();try{var d=new Interpreter(c,nf)}catch(e){console.error(e)}d?mf(d):S.canvas.width=S.canvas.width;Zd.drawImage(S.canvas,0,0);Zd.drawImage(document.getElementById("axies"), 0,0);of();1==O&&setTimeout(Ze,1E3)}else setTimeout(function(){Pe(a)},250)}function nf(a,c){var d=function(e,f,h){Y(e,f,h)};a.setProperty(c,"circle",a.createNativeFunction(d));d=function(e,f,h,k){jf(e,f,h,k)};a.setProperty(c,"rect",a.createNativeFunction(d));d=function(e,f,h,k,l){Z(e,f,h,k,l)};a.setProperty(c,"line",a.createNativeFunction(d));d=function(e){X(e)};a.setProperty(c,"penColour",a.createNativeFunction(d));a.setProperty(c,"time",a.createNativeFunction(function(){return bf}))} function Y(a,c,d){a*=4;c=4*(100-c);d=Math.max(4*d,0);S.beginPath();S.arc(a,c,d,0,2*Math.PI,!1);S.fill()}function jf(a,c,d,e){a*=4;c=4*(100-c);d=Math.max(4*d,0);e=Math.max(4*e,0);S.beginPath();S.rect(a-d/2,c-e/2,d,e);S.fill()}function Z(a,c,d,e,f){a*=4;c=4*(100-c);d*=4;e=4*(100-e);f*=4;S.beginPath();S.moveTo(a,c);S.lineTo(d,e);S.lineWidth=Math.max(f,0);S.stroke()}function X(a){S.strokeStyle=a;S.fillStyle=a} function of(){var a=document.getElementById("answer"+bf);if(a){a=a.getContext("2d").getImageData(0,0,400,400);for(var c=S.getImageData(0,0,400,400),d=Math.min(c.data.length,a.data.length),e=0,f=3;fO&&(G.Rf.play("win",.5),Q.cE()))} function pf(){var a=y(G).length,c=Yd();if(4>a||-1==c.indexOf("time()"))alert(P("Movie_submitDisabled"));else{a=new Interpreter(c,nf);c=bf;try{bf=Math.round(ae/2),mf(a)}finally{bf=c}a=document.getElementById("thumbnail");c=a.getContext("2d");c.globalCompositeOperation="copy";c.drawImage(S.canvas,0,0,200,200);a=a.toDataURL("image/png");document.getElementById("galleryThumb").value=a;Q.iv()}} window.addEventListener("load",function(){function a(){d.style.top=Math.max(10,e.offsetTop-window.pageYOffset)+"px";d.style.left=c?"10px":"420px";d.style.width=window.innerWidth-440+"px"}document.body.innerHTML=Ne();R.Z();var c=yd(),d=document.getElementById("blockly"),e=document.getElementById("visualization");window.addEventListener("scroll",function(){a(null);g.rl(G)});window.addEventListener("resize",a);a(null);10>O&&(g.Ib.so=3,g.Ib.qo="#ff0000 #ffcc33 #ffff00 #009900 #3333ff #cc33cc #ffffff #999999 #000000".split(" ")); var f=document.getElementById("toolbox");G=g.Rh("blockly",{media:"third-party/blockly/media/",rtl:c,toolbox:f,trashcan:!0,zoom:10==O?{controls:!0,wheel:!0}:null});qe("circle,rect,line,penColour,time");document.getElementById("submitButton")&&Hd("submitButton",pf);R.WF("",!0);Zd=document.getElementById("display").getContext("2d");Zd.globalCompositeOperation="source-over";S=document.getElementById("scratch").getContext("2d");kf();hf(0);setTimeout(function(){for(var h=1;h<=ae;h++)hf(h)},1); lf();Pe();Ba(G,Pe);f=document.getElementById("scrubber");new Oe(f);1==O&&(f.style.display="none");G.Rf.load(["movie/win.mp3","movie/win.ogg"],"win");setTimeout(R.HF,1);setTimeout(R.IF,1);Hd("helpButton",ff);2>location.hash.length&&!Ed(O)&&setTimeout(ff,1E3);e.addEventListener("mouseover",cf);e.addEventListener("mouseout",df);e.addEventListener("mousemove",ef)});